20 #ifndef _MBSIM_SYMBOLIC_FUNCTION_H_ 21 #define _MBSIM_SYMBOLIC_FUNCTION_H_ 23 #include <mbsim/functions/function.h> 24 #include <fmatvec/symbolic_function.h> 30 template<
typename Ret,
typename Arg>
37 Function<Ret(Arg)>::init(stage, config);
39 fmatvec::SymbolicFunction<Ret(Arg)>::init();
44 void initializeUsingXML(xercesc::DOMElement *element)
override {
45 Function<Ret(Arg)>::initializeUsingXML(element);
47 auto definition=MBXMLUtils::E(element)->getFirstElementChildNamed(MBSIM%
"definition");
50 "Symbolic functions must be defined inside of a <definition> child element.", element);
54 std::stringstream func(MBXMLUtils::E(definition)->getText<std::string>());
56 func.read(buf, 2); buf[2]=0;
57 if(buf!=std::string(
"f("))
59 MBXMLUtils::E(definition)->getText<std::string>(), definition);
60 typename fmatvec::SymbolicFunction<Ret(Arg)>::ArgS argS;
62 this->setIndependentVariable(argS);
63 func.read(buf, 2); buf[2]=0;
64 if(buf!=std::string(
")="))
66 MBXMLUtils::E(definition)->getText<std::string>(), definition);
67 typename fmatvec::SymbolicFunction<Ret(Arg)>::RetS retS;
69 this->setDependentFunction(retS);
89 template<
typename Ret,
typename Arg1,
typename Arg2>
91 public fmatvec::SymbolicFunction<Ret(Arg1, Arg2)> {
97 Function<Ret(Arg1, Arg2)>::init(stage, config);
99 fmatvec::SymbolicFunction<Ret(Arg1, Arg2)>::init();
104 void initializeUsingXML(xercesc::DOMElement *element)
override {
105 Function<Ret(Arg1, Arg2)>::initializeUsingXML(element);
107 auto definition=MBXMLUtils::E(element)->getFirstElementChildNamed(MBSIM%
"definition");
110 "Symbolic functions must be defined inside of a <definition> child element.", element);
114 std::stringstream func(MBXMLUtils::E(definition)->getText<std::string>());
116 func.read(buf, 2); buf[2]=0;
117 if(buf!=std::string(
"f("))
119 MBXMLUtils::E(definition)->getText<std::string>(), definition);
120 typename fmatvec::SymbolicFunction<Ret(Arg1,Arg2)>::Arg1S arg1S;
122 this->setIndependentVariable1(arg1S);
126 MBXMLUtils::E(definition)->getText<std::string>(), definition);
127 typename fmatvec::SymbolicFunction<Ret(Arg1,Arg2)>::Arg2S arg2S;
129 this->setIndependentVariable2(arg2S);
130 func.read(buf, 2); buf[2]=0;
131 if(buf!=std::string(
")="))
133 MBXMLUtils::E(definition)->getText<std::string>(), definition);
134 typename fmatvec::SymbolicFunction<Ret(Arg1,Arg2)>::RetS retS;
136 this->setDependentFunction(retS);
void init(Element::InitStage stage, const InitConfigSet &config) override
plots time series header
Definition: symbolic_function.h:36
Definition: symbolic_function.h:28
static void message(std::ostream &str, const std::string &msg, const xercesc::DOMElement *e=nullptr)
InitStage
The stages of the initialization.
Definition: element.h:64
Definition: contact_kinematics.h:32
void init(Element::InitStage stage, const InitConfigSet &config) override
plots time series header
Definition: symbolic_function.h:96
namespace MBSim
Definition: bilateral_constraint.cc:29