FemRepresentationParameters.h
Go to the documentation of this file.
1 // This file is a part of the OpenSurgSim project.
2 // Copyright 2013, SimQuest Solutions Inc.
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 
16 #ifndef SURGSIM_PHYSICS_FEMREPRESENTATIONPARAMETERS_H
17 #define SURGSIM_PHYSICS_FEMREPRESENTATIONPARAMETERS_H
18 
19 #include <algorithm>
20 #include <vector>
21 
22 namespace SurgSim
23 {
24 
25 namespace Physics
26 {
27 
30 {
31 public:
34 
37 
41  bool operator ==(const FemRepresentationParameters &p) const;
42 
46  bool operator !=(const FemRepresentationParameters &p) const;
47 
51  bool addBoundaryCondition(size_t nodeId);
52 
56  bool removeBoundaryCondition(size_t nodeId);
57 
61  size_t addBoundaryConditions(const std::vector<size_t>& boundaryConditions);
62 
65 
68  const std::vector<size_t>& getBoundaryConditions() const;
69 
72  void setBoundaryConditionMass(double mass);
73 
76  double getBoundaryConditionMass() const;
77 
80  void setBoundaryConditionInverseMass(double invMass);
81 
84  double getBoundaryConditionInverseMass() const;
85 
88  void setDensity(double rho);
89 
92  double getDensity() const;
93 
96  void setRayleighDampingMass(double massCoef);
97 
100  double getRayleighDampingMass() const;
101 
104  void setRayleighDampingStiffness(double stiffnessCoef);
105 
108  double getRayleighDampingStiffness() const;
109 
112  void setYoungModulus(double E);
113 
116  double getYoungModulus() const;
117 
120  void setPoissonRatio(double nu);
121 
124  double getPoissonRatio() const;
125 
130  bool isValid() const;
131 
132 private:
134  void checkValidity();
135 
137  std::vector<size_t> m_boundaryConditions;
138 
141 
145 
147  double m_rho;
148 
151 
154 
157 
162 
164  bool m_isValid;
165 };
166 
167 }; // Physics
168 
169 }; // SurgSim
170 
171 #endif // SURGSIM_PHYSICS_FEMREPRESENTATIONPARAMETERS_H
double m_poissonRatio
Poisson ratio (unit less) Theoretically within (-1, 0.5) with 0.5 for incompressible material In gene...
Definition: FemRepresentationParameters.h:161
Definition: DriveElementFromInputBehavior.cpp:27
bool operator!=(const FemRepresentationParameters &p) const
Comparison operator (difference test)
Definition: FemRepresentationParameters.cpp:48
double m_boundaryConditionsInverseMass
Boundary conditions mass property (useful to build the system matrix inverse) Note that m_boundaryCon...
Definition: FemRepresentationParameters.h:144
double getPoissonRatio() const
Get the material Poisson ratio.
Definition: FemRepresentationParameters.cpp:171
FemRepresentationParameters()
Default constructor.
Definition: FemRepresentationParameters.cpp:24
The FemRepresentationParameters class defines the physical parameters for all Finite Element Model (1...
Definition: FemRepresentationParameters.h:29
const std::vector< size_t > & getBoundaryConditions() const
Get all boundary conditions.
Definition: FemRepresentationParameters.cpp:96
bool operator==(const FemRepresentationParameters &p) const
Comparison operator (equality test)
Definition: FemRepresentationParameters.cpp:35
double m_rayleighDampingStiffness
Rayleigh damping, stiffness parameter (in s)
Definition: FemRepresentationParameters.h:153
double getRayleighDampingMass() const
Get the Rayleigh damping mass parameter.
Definition: FemRepresentationParameters.cpp:138
double getDensity() const
Get the mass density of the fem.
Definition: FemRepresentationParameters.cpp:127
double m_rho
Density of the object (in Kg.m-3)
Definition: FemRepresentationParameters.h:147
bool addBoundaryCondition(size_t nodeId)
Add a boundary condition.
Definition: FemRepresentationParameters.cpp:53
double getYoungModulus() const
Get the material Young modulus.
Definition: FemRepresentationParameters.cpp:160
double m_rayleighDampingMass
Rayleigh damping, mass parameter (in s-1)
Definition: FemRepresentationParameters.h:150
double m_boundaryConditionsMass
Boundary conditions mass property (useful to build the system matrix)
Definition: FemRepresentationParameters.h:140
void setDensity(double rho)
Set the mass density of the fem.
Definition: FemRepresentationParameters.cpp:121
std::vector< size_t > m_boundaryConditions
Boundary conditions (vector of node indices to fix)
Definition: FemRepresentationParameters.h:137
void setPoissonRatio(double nu)
Set the Poisson ratio of the material.
Definition: FemRepresentationParameters.cpp:165
virtual ~FemRepresentationParameters()
Destructor.
Definition: FemRepresentationParameters.cpp:31
void setRayleighDampingStiffness(double stiffnessCoef)
Set the Rayleigh damping stiffness parameter.
Definition: FemRepresentationParameters.cpp:143
double getBoundaryConditionInverseMass() const
Get the boundary condition inverse mass property.
Definition: FemRepresentationParameters.cpp:116
double getRayleighDampingStiffness() const
Get the Rayleigh damping stiffness parameter.
Definition: FemRepresentationParameters.cpp:149
bool removeBoundaryCondition(size_t nodeId)
Remove a boundary condition.
Definition: FemRepresentationParameters.cpp:64
void setBoundaryConditionMass(double mass)
Set the boundary condition mass property.
Definition: FemRepresentationParameters.cpp:101
void setYoungModulus(double E)
Set the Young modulus of the material.
Definition: FemRepresentationParameters.cpp:154
bool m_isValid
Validity of the set of parameters.
Definition: FemRepresentationParameters.h:164
bool isValid() const
Test if the the parameters are fully set and ready.
Definition: FemRepresentationParameters.cpp:176
void clearBoundaryConditions()
Remove all boundary conditions.
Definition: FemRepresentationParameters.cpp:91
double m_youngModulus
Young modulus (in N.m-2 or Pa or Kg.m-1.s-2)
Definition: FemRepresentationParameters.h:156
size_t addBoundaryConditions(const std::vector< size_t > &boundaryConditions)
Add boundary conditions.
Definition: FemRepresentationParameters.cpp:75
void setBoundaryConditionInverseMass(double invMass)
Set the boundary condition inverse mass property.
Definition: FemRepresentationParameters.cpp:111
void checkValidity()
Check the validity of the parameters and set the flag m_isValid accordingly.
Definition: FemRepresentationParameters.cpp:181
void setRayleighDampingMass(double massCoef)
Set the Rayleigh damping mass parameter.
Definition: FemRepresentationParameters.cpp:132
double getBoundaryConditionMass() const
Get the boundary condition mass property.
Definition: FemRepresentationParameters.cpp:106