00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef _KINETICEXCITATION_H_
00021 #define _KINETICEXCITATION_H_
00022
00023 #include <mbsim/link_mechanics.h>
00024 #include <mbsim/frame.h>
00025
00026 namespace MBSim {
00027
00028 template <class Ret, class Arg> class Function1;
00029
00036 class KineticExcitation : public LinkMechanics {
00037 public:
00042 KineticExcitation(const std::string &name="");
00043
00047 virtual ~KineticExcitation();
00048
00049
00050 virtual void updateh(double t, int i=0);
00051 virtual void updateg(double) {}
00052 virtual void updategd(double) {}
00053
00054
00055
00056 virtual void init(InitStage stage);
00057
00058
00059
00060 void calclaSize(int j);
00061 bool isActive() const { return true; }
00062 bool isSingleValued() const { return true; }
00063 bool gActiveChanged() { return false; }
00064
00065
00066
00067 virtual void plot(double t, double dt = 1);
00068
00069
00074 void setForce(fmatvec::Mat dir, Function1<fmatvec::Vec,double> *func);
00075
00077 void setMoment(fmatvec::Mat dir, Function1<fmatvec::Vec,double> *func);
00078
00082 void setFrameOfReference(Frame *ref_) { refFrame=ref_; }
00083
00084 using LinkMechanics::connect;
00085
00090 void connect(MBSim::Frame *frame1, MBSim::Frame *frame2);
00091
00092 #ifdef HAVE_OPENMBVCPPINTERFACE
00093
00094 void setOpenMBVForceArrow(OpenMBV::Arrow *arrow) {
00095 std::vector<bool> which; which.resize(2, false);
00096 which[1]=true;
00097 LinkMechanics::setOpenMBVForceArrow(arrow, which);
00098 }
00099
00101 void setOpenMBVMomentArrow(OpenMBV::Arrow *arrow) {
00102 std::vector<bool> which; which.resize(2, false);
00103 which[1]=true;
00104 LinkMechanics::setOpenMBVMomentArrow(arrow, which);
00105 }
00106 #endif
00107
00108 void initializeUsingXML(MBXMLUtils::TiXmlElement *element);
00109 virtual MBXMLUtils::TiXmlElement* writeXMLFile(MBXMLUtils::TiXmlNode *element);
00110
00111 virtual std::string getType() const { return "KineticExcitation"; }
00112
00113 protected:
00117 Frame *refFrame;
00118
00122 fmatvec::Mat3xV forceDir, momentDir;
00123
00127 Function1<fmatvec::Vec,double> *F, *M;
00128
00132 Frame C;
00133
00134 private:
00135 std::string saved_frameOfReference, saved_ref, saved_ref1, saved_ref2;
00136 };
00137
00138 }
00139
00140 #endif
00141