1 // ============================================================================= 2 // PROJECT CHRONO - http://projectchrono.org 3 // 4 // Copyright (c) 2014 projectchrono.org 5 // All rights reserved. 6 // 7 // Use of this source code is governed by a BSD-style license that can be found 8 // in the LICENSE file at the top level of the distribution and at 9 // http://projectchrono.org/license-chrono.txt. 10 // 11 // ============================================================================= 12 // Authors: Alessandro Tasora, Radu Serban 13 // ============================================================================= 14 15 #include "chrono/motion_functions/ChFunction_Derive.h" 16 17 namespace chrono { 18 19 // Register into the object factory, to enable run-time 20 // dynamic creation and persistence CH_FACTORY_REGISTER(ChFunction_Derive)21CH_FACTORY_REGISTER(ChFunction_Derive) 22 23 ChFunction_Derive::ChFunction_Derive(const ChFunction_Derive& other) { 24 order = other.order; 25 fa = std::shared_ptr<ChFunction>(other.fa->Clone()); 26 } 27 Get_y(double x) const28double ChFunction_Derive::Get_y(double x) const { 29 return fa->Get_y_dx(x); 30 } 31 Estimate_x_range(double & xmin,double & xmax) const32void ChFunction_Derive::Estimate_x_range(double& xmin, double& xmax) const { 33 fa->Estimate_x_range(xmin, xmax); 34 } 35 ArchiveOUT(ChArchiveOut & marchive)36void ChFunction_Derive::ArchiveOUT(ChArchiveOut& marchive) { 37 // version number 38 marchive.VersionWrite<ChFunction_Derive>(); 39 // serialize parent class 40 ChFunction::ArchiveOUT(marchive); 41 // serialize all member data: 42 marchive << CHNVP(fa); 43 marchive << CHNVP(order); 44 } 45 ArchiveIN(ChArchiveIn & marchive)46void ChFunction_Derive::ArchiveIN(ChArchiveIn& marchive) { 47 // version number 48 /*int version =*/ marchive.VersionRead<ChFunction_Derive>(); 49 // deserialize parent class 50 ChFunction::ArchiveIN(marchive); 51 // stream in all member data: 52 marchive >> CHNVP(fa); 53 marchive >> CHNVP(order); 54 } 55 56 } // end namespace chrono 57