Fem3DRepresentation.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_FEM3DREPRESENTATION_H
17 #define SURGSIM_PHYSICS_FEM3DREPRESENTATION_H
18 
19 #include <memory>
20 #include <string>
21 #include <unordered_map>
22 
25 #include "SurgSim/Math/Matrix.h"
27 
28 namespace SurgSim
29 {
30 
31 namespace DataStructures
32 {
33 class TriangleMesh;
34 }
35 
36 namespace Physics
37 {
38 SURGSIM_STATIC_REGISTRATION(Fem3DRepresentation);
39 
40 class FemPlyReaderDelegate;
41 
44 {
45 public:
48  explicit Fem3DRepresentation(const std::string& name);
49 
51  virtual ~Fem3DRepresentation();
52 
54 
57  virtual RepresentationType getType() const override;
58 
59  virtual void addExternalGeneralizedForce(std::shared_ptr<Localization> localization,
60  SurgSim::Math::Vector& generalizedForce,
62  const SurgSim::Math::Matrix& D = SurgSim::Math::Matrix()) override;
63 
64  virtual std::shared_ptr<Localization> createLocalization(const SurgSim::DataStructures::Location&) override;
65 
66 protected:
67  virtual bool doWakeUp() override;
68 
72  virtual void transformState(std::shared_ptr<SurgSim::Math::OdeState> state,
73  const SurgSim::Math::RigidTransform3d& transform) override;
74 
75 private:
76  virtual std::shared_ptr<FemPlyReaderDelegate> getDelegate() override;
77 
82  std::unordered_map<size_t, size_t> createTriangleIdToElementIdMap(
84 
86  std::unordered_map<size_t, size_t> m_triangleIdToElementIdMap;
87 };
88 
89 } // namespace Physics
90 } // namespace SurgSim
91 
92 #endif // SURGSIM_PHYSICS_FEM3DREPRESENTATION_H
Definition: DriveElementFromInputBehavior.cpp:27
Finite Element Model 3D is a fem built with 3D FemElement.
Definition: Fem3DRepresentation.h:43
RepresentationType
Definition: Representation.h:42
Finite Element Model (a.k.a.
Definition: FemRepresentation.h:38
Definition: Location.h:31
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > Matrix
A dynamic size matrix.
Definition: Matrix.h:65
SURGSIM_STATIC_REGISTRATION(SerializationMockComponent)
std::unordered_map< size_t, size_t > m_triangleIdToElementIdMap
Mapping from collision triangle&#39;s id to fem element id.
Definition: Fem3DRepresentation.h:86
string(TOUPPER ${DEVICE}DEVICE_UPPER_CASE) option(BUILD_DEVICE_ $
Definition: CMakeLists.txt:35
Eigen::Matrix< double, Eigen::Dynamic, 1 > Vector
A dynamic size column vector.
Definition: Vector.h:67
#define SURGSIM_CLASSNAME(ClassName)
Declare the class name of a class with the appropriate function header, do not use quotes...
Definition: Macros.h:21
Definitions of small fixed-size square matrix types.
Eigen::Transform< double, 3, Eigen::Isometry > RigidTransform3d
A 3D rigid (isometric) transform, represented as doubles.
Definition: RigidTransform.h:46
A TriangleMesh stores normal information for the triangles.
Definition: TriangleMesh.h:62