20 #ifndef _VECTOR_VALUED_FUNCTIONS_H_ 21 #define _VECTOR_VALUED_FUNCTIONS_H_ 23 #include "mbsim/functions/function.h" 24 #include "mbsim/utils/utils.h" 30 template<
typename Ret,
typename Arg>
37 for(
auto it=component.begin(); it!=component.end(); ++it)
38 (*it)->setParent(
this);
41 for (
unsigned int i=0; i<component.size(); i++)
44 void addComponent(
Function<
double(Arg)> *
function) {
45 component.push_back(
function);
46 function->setParent(
this);
48 int getArgSize()
const override {
return 1; }
49 std::pair<int, int> getRetSize()
const override {
return std::make_pair(component.size(),1); }
50 Ret operator()(
const Arg &x)
override {
51 for(
unsigned int i=0; i<component.size(); i++)
52 y[i]=(*component[i])(x);
55 typename B::DRetDArg parDer(
const Arg &x)
override {
56 for(
unsigned int i=0; i<component.size(); i++)
57 dy[i]=component[i]->parDer(x);
60 typename B::DRetDArg parDerDirDer(
const Arg &xDir,
const Arg &x)
override {
61 for(
unsigned int i=0; i<component.size(); i++)
62 ddy[i]=component[i]->parDerDirDer(xDir,x);
65 void initializeUsingXML(xercesc::DOMElement *element)
override {
66 xercesc::DOMElement *e=MBXMLUtils::E(element)->getFirstElementChildNamed(MBSIM%
"components")->getFirstElementChild();
69 e=e->getNextElementSibling();
73 Function<Ret(Arg)>::init(stage, config);
74 for(
auto it=component.begin(); it!=component.end(); ++it)
75 (*it)->init(stage, config);
77 y.resize(component.size());
78 dy.resize(component.size());
79 ddy.resize(component.size());
83 std::vector<
Function<double(Arg)> *> component;
84 std::vector<double> y;
85 std::vector<typename fmatvec::Der<double, Arg>::type> dy ,ddy;
InitStage
The stages of the initialization.
Definition: element.h:62
Definition: vector_valued_function.h:28
Definition: contact_kinematics.h:32
void init(Element::InitStage stage, const InitConfigSet &config) override
plots time series header
Definition: vector_valued_function.h:72
static ContainerType * createAndInit(const xercesc::DOMElement *element)
Definition: objectfactory.h:76
namespace MBSim
Definition: bilateral_constraint.cc:29