16 #ifndef SURGSIM_PHYSICS_FEMREPRESENTATION_H
17 #define SURGSIM_PHYSICS_FEMREPRESENTATION_H
32 class FemPlyReaderDelegate;
62 void addFemElement(
const std::shared_ptr<FemElement> element);
73 std::shared_ptr<FemElement>
getFemElement(
size_t femElementId);
159 bool useGlobalMassMatrix =
false,
bool useGlobalStiffnessMatrix =
false,
double scale = 1.0);
185 virtual std::shared_ptr<FemPlyReaderDelegate>
getDelegate() = 0;
202 #endif // SURGSIM_PHYSICS_FEMREPRESENTATION_H
virtual const SurgSim::Math::Matrix & computeK(const SurgSim::Math::OdeState &state) override
Evaluation of K = -df/dx (x,v) for a given state.
Definition: FemRepresentation.cpp:284
const std::string & getFilename() const
Gets the name of the file to be loaded.
Definition: FemRepresentation.cpp:52
Definition: DriveElementFromInputBehavior.cpp:27
double getTotalMass() const
Gets the total mass of the fem.
Definition: FemRepresentation.cpp:153
virtual bool doInitialize() override
Interface to be implemented by derived classes.
Definition: FemRepresentation.cpp:95
A generic (size_t index, Vector coordinate) pair.
Definition: IndexedLocalCoordinate.h:29
Finite Element Model (a.k.a.
Definition: FemRepresentation.h:38
virtual void afterUpdate(double dt) override
Postprocessing done after the update call.
Definition: FemRepresentation.cpp:193
std::string m_filename
Filename for loading the fem representation.
Definition: FemRepresentation.h:180
virtual std::shared_ptr< FemPlyReaderDelegate > getDelegate()=0
To be implemented by derived classes.
FemRepresentation(const std::string &name)
Constructor.
Definition: FemRepresentation.cpp:34
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > Matrix
A dynamic size matrix.
Definition: Matrix.h:65
void setFilename(const std::string &filename)
Sets the name of the file to be loaded.
Definition: FemRepresentation.cpp:47
virtual const SurgSim::Math::Matrix & computeM(const SurgSim::Math::OdeState &state) override
Evaluation of the LHS matrix M(x,v) for a given state.
Definition: FemRepresentation.cpp:231
struct SurgSim::Physics::FemRepresentation::@1 m_rayleighDamping
Rayleigh damping parameters (massCoefficient and stiffnessCoefficient) D = massCoefficient.M + stiffnessCoefficient.K Matrices: D = damping, M = mass, K = stiffness.
void addFemElementsForce(SurgSim::Math::Vector *f, const SurgSim::Math::OdeState &state, double scale=1.0)
Adds the FemElements forces to f (given a state)
Definition: FemRepresentation.cpp:399
double massCoefficient
Definition: FemRepresentation.h:194
OdeState defines the state y of an ode of 2nd order of the form M(x,v).a = F(x, v) with boundary cond...
Definition: OdeState.h:34
void setRayleighDampingStiffness(double stiffnessCoef)
Sets the Rayleigh stiffness parameter.
Definition: FemRepresentation.cpp:173
double getRayleighDampingMass() const
Gets the Rayleigh mass parameter.
Definition: FemRepresentation.cpp:168
double stiffnessCoefficient
Definition: FemRepresentation.h:195
Eigen::Matrix< double, Eigen::Dynamic, 1 > Vector
A dynamic size column vector.
Definition: Vector.h:67
virtual const SurgSim::Math::Matrix & computeD(const SurgSim::Math::OdeState &state) override
Evaluation of D = -df/dv (x,v) for a given state.
Definition: FemRepresentation.cpp:245
bool isValidCoordinate(const SurgSim::DataStructures::IndexedLocalCoordinate &coordinate) const
Determines whether the associated coordinate is valid.
Definition: FemRepresentation.cpp:147
virtual SurgSim::Math::Vector & computeF(const SurgSim::Math::OdeState &state) override
Evaluation of the RHS function f(x,v) for a given state.
Definition: FemRepresentation.cpp:215
double getRayleighDampingStiffness() const
Gets the Rayleigh stiffness parameter.
Definition: FemRepresentation.cpp:163
size_t getNumFemElements() const
Gets the number of FemElement.
Definition: FemRepresentation.cpp:136
std::vector< std::shared_ptr< FemElement > > m_femElements
FemElements.
Definition: FemRepresentation.h:188
void setRayleighDampingMass(double massCoef)
Sets the Rayleigh mass parameter.
Definition: FemRepresentation.cpp:178
Definitions of small fixed-size vector types.
std::vector< double > m_massPerNode
Useful information per node.
Definition: FemRepresentation.h:177
virtual void beforeUpdate(double dt) override
Preprocessing done before the update call.
Definition: FemRepresentation.cpp:183
virtual ~FemRepresentation()
Destructor.
Definition: FemRepresentation.cpp:43
virtual void computeFMDK(const SurgSim::Math::OdeState &state, SurgSim::Math::Vector **f, SurgSim::Math::Matrix **M, SurgSim::Math::Matrix **D, SurgSim::Math::Matrix **K) override
Evaluation of f(x,v), M(x,v), D = -df/dv(x,v), K = -df/dx(x,v) When all the terms are needed...
Definition: FemRepresentation.cpp:301
void addFemElement(const std::shared_ptr< FemElement > element)
Adds a FemElement.
Definition: FemRepresentation.cpp:131
bool loadFile()
Loads the file.
Definition: FemRepresentation.cpp:57
void addRayleighDampingForce(SurgSim::Math::Vector *f, const SurgSim::Math::OdeState &state, bool useGlobalMassMatrix=false, bool useGlobalStiffnessMatrix=false, double scale=1.0)
Adds the Rayleigh damping forces.
Definition: FemRepresentation.cpp:353
std::shared_ptr< FemElement > getFemElement(size_t femElementId)
Retrieves a given FemElement from its id.
Definition: FemRepresentation.cpp:141
void addGravityForce(SurgSim::Math::Vector *f, const SurgSim::Math::OdeState &state, double scale=1.0)
Adds the gravity force to f (given a state)
Definition: FemRepresentation.cpp:409