mbsim  4.0.0
MBSim Kernel
kinetic_excitation.h
1 /* Copyright (C) 2004-2013 MBSim Development Team
2  *
3  * This library is free software; you can redistribute it and/or
4  * modify it under the terms of the GNU Lesser General Public
5  * License as published by the Free Software Foundation; either
6  * version 2.1 of the License, or (at your option) any later version.
7  *
8  * This library is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  * Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public
14  * License along with this library; if not, write to the Free Software
15  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16  *
17  * Contact: martin.o.foerg@googlemail.com
18  */
19 
20 #ifndef _KINETICEXCITATION_H_
21 #define _KINETICEXCITATION_H_
22 
23 #include <mbsim/links/floating_frame_link.h>
24 #include <mbsim/functions/function.h>
25 
26 #include "mbsim/utils/boost_parameters.h"
27 #include "mbsim/utils/openmbv_utils.h"
28 
29 namespace MBSim {
30 
38  public:
43  KineticExcitation(const std::string &name="");
44 
48  ~KineticExcitation() override;
49 
50  void updateGeneralizedPositions() override { updrrel = false; }
51  void updateGeneralizedVelocities() override { updvrel = false; }
52  void updatelaF() override;
53  void updatelaM() override;
54 
55  void init(InitStage stage, const InitConfigSet &config) override;
56 
57  bool isActive() const override { return true; }
58  bool isSingleValued() const override { return true; }
59  bool gActiveChanged() override { return false; }
60 
64  void setForceDirection(const fmatvec::Mat3xV& fd) { forceDir <<= fd; }
65 
69  void setMomentDirection(const fmatvec::Mat3xV& md) { momentDir <<= md; }
70 
75  void setForceFunction(Function<fmatvec::VecV(double)> *func);
76 
78  void setMomentFunction(Function<fmatvec::VecV(double)> *func);
79 
80  using FloatingFrameLink::connect;
81 
85  void connect(MBSim::Frame *frame_) { frame[1] = frame_; }
86 
87  void plot() override;
88 
89  void initializeUsingXML(xercesc::DOMElement *element) override;
90 
91  BOOST_PARAMETER_MEMBER_FUNCTION( (void), enableOpenMBV, tag, (optional (sideOfInteraction,(OpenMBVInteractionArrow::SideOfInteraction),OpenMBVInteractionArrow::action)(scaleLength,(double),1)(scaleSize,(double),1)(referencePoint,(OpenMBVArrow::ReferencePoint),OpenMBVArrow::toPoint)(colorRepresentation,(OpenMBVArrow::ColorRepresentation),OpenMBVArrow::none)(minimalColorValue,(double),0)(maximalColorValue,(double),1)(diffuseColor,(const fmatvec::Vec3&),fmatvec::Vec3(std::vector<double>{-1,1,1}))(transparency,(double),0)(pointSize,(double),0)(lineWidth,(double),0))) {
92  ombvArrow = std::shared_ptr<OpenMBVInteractionArrow>(new OpenMBVInteractionArrow(sideOfInteraction,scaleLength,scaleSize,OpenMBVArrow::toHead,referencePoint,colorRepresentation,minimalColorValue,maximalColorValue,diffuseColor,transparency,pointSize,lineWidth));
93  }
94 
95  protected:
99  Function<fmatvec::VecV(double)> *F, *M;
100 
101  std::shared_ptr<OpenMBVInteractionArrow> ombvArrow;
102  std::vector<std::shared_ptr<OpenMBV::Arrow>> openMBVForce, openMBVMoment;
103 
104 #ifndef SWIG
105  double (KineticExcitation::*evalOMBVForceColorRepresentation[2])();
106  double (KineticExcitation::*evalOMBVMomentColorRepresentation[2])();
107 #endif
108  double evalNone() { return 1; }
109  double evalAboluteForce() { return nrm2(evalForce()); }
110  double evalAboluteMoment() { return nrm2(evalMoment()); }
111  };
112 
113 }
114 
115 #endif /* _KINETICEXCITATION_H_ */
void setMomentDirection(const fmatvec::Mat3xV &md)
Definition: kinetic_excitation.h:69
~KineticExcitation() override
destructor
Definition: kinetic_excitation.cc:43
void setForceDirection(const fmatvec::Mat3xV &fd)
Definition: kinetic_excitation.h:64
kinetic excitations given by time dependent functions
Definition: kinetic_excitation.h:37
KineticExcitation(const std::string &name="")
constructor
Definition: kinetic_excitation.cc:35
void setMomentFunction(Function< fmatvec::VecV(double)> *func)
see setForce
Definition: kinetic_excitation.cc:94
void setForceFunction(Function< fmatvec::VecV(double)> *func)
Set the force excitation. forceDir*func(t) is the applied force vector in space. This force vector is...
Definition: kinetic_excitation.cc:88
InitStage
The stages of the initialization.
Definition: element.h:62
void connect(MBSim::Frame *frame_)
Definition: kinetic_excitation.h:85
Definition: planar_contour.h:30
std::string name
name of element
Definition: element.h:235
cartesian frame on bodies used for application of e.g. links and loads
Definition: frame.h:39
Function< fmatvec::VecV(double)> * F
portions of the force / moment in the specific directions
Definition: kinetic_excitation.h:99
void init(InitStage stage, const InitConfigSet &config) override
plots time series header
Definition: kinetic_excitation.cc:48
bool isActive() const override
Definition: kinetic_excitation.h:57
bool gActiveChanged() override
Definition: kinetic_excitation.h:59
void plot() override
plots time dependent data
Definition: kinetic_excitation.cc:100
bool isSingleValued() const override
asks the link if it contains single valued force laws that contribute to the right-hand side vector h
Definition: kinetic_excitation.h:58
namespace MBSim
Definition: eigenanalyzer.cc:47