Fem3DElementTetrahedron.h
Go to the documentation of this file.
// This file is a part of the OpenSurgSim project.
// Copyright 2013, SimQuest Solutions Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef SURGSIM_PHYSICS_FEM3DELEMENTTETRAHEDRON_H
#define SURGSIM_PHYSICS_FEM3DELEMENTTETRAHEDRON_H
#include <array>
#include "SurgSim/Math/Matrix.h"
#include "SurgSim/Math/Vector.h"
#include "SurgSim/Physics/Fem.h"
#include "SurgSim/Physics/FemElement.h"
namespace SurgSim
{
namespace Physics
{
SURGSIM_STATIC_REGISTRATION(Fem3DElementTetrahedron);
class Fem3DElementTetrahedron : public FemElement
{
public:
Fem3DElementTetrahedron();
explicit Fem3DElementTetrahedron(std::array<size_t, 4> nodeIds);
explicit Fem3DElementTetrahedron(std::shared_ptr<FemElementStructs::FemElementParameter> elementData);
SURGSIM_CLASSNAME(SurgSim::Physics::Fem3DElementTetrahedron)
void initialize(const SurgSim::Math::OdeState& state) override;
double getVolume(const SurgSim::Math::OdeState& state) const override;
SurgSim::Math::Vector computeCartesianCoordinate(const SurgSim::Math::OdeState& state,
const SurgSim::Math::Vector& naturalCoordinate) const override;
SurgSim::Math::Vector computeNaturalCoordinate(const SurgSim::Math::OdeState& state,
const SurgSim::Math::Vector& cartesianCoordinate) const override;
protected:
void initializeMembers();
void doUpdateFMDK(const Math::OdeState& state, int options) override;
void computeShapeFunctions(const SurgSim::Math::OdeState& state,
double* volume,
std::array<double, 4>* ai,
std::array<double, 4>* bi,
std::array<double, 4>* ci,
std::array<double, 4>* di) const;
void computeStiffness(const SurgSim::Math::OdeState& state,
SurgSim::Math::Matrix* k);
void computeMass(const SurgSim::Math::OdeState& state,
SurgSim::Math::Matrix* m);
double m_restVolume;
std::array<double, 4> m_ai, m_bi, m_ci, m_di;
Eigen::Matrix<double, 12, 1> m_x0;
Eigen::Matrix<double, 6, 6> m_Em;
Eigen::Matrix<double, 6, 12> m_strain;
Eigen::Matrix<double, 6, 12> m_stress;
};
} // namespace Physics
} // namespace SurgSim
#endif // SURGSIM_PHYSICS_FEM3DELEMENTTETRAHEDRON_H
FemElement.h
SurgSim
Definition: CompoundShapeToGraphics.cpp:29
SurgSim::Physics::Fem3DElementTetrahedron::m_strain
Eigen::Matrix< double, 6, 12 > m_strain
Strain matrix.
Definition: Fem3DElementTetrahedron.h:119
SurgSim::Physics::Fem3DElementTetrahedron::m_bi
std::array< double, 4 > m_bi
Definition: Fem3DElementTetrahedron.h:111
SurgSim::Physics::Fem3DElementTetrahedron
Class for Fem Element 3D based on a tetrahedron volume discretization.
Definition: Fem3DElementTetrahedron.h:41
SurgSim::Physics::Fem3DElementTetrahedron::m_ai
std::array< double, 4 > m_ai
Shape functions coefficients Ni(x,y,z) = 1/6V ( ai + x.bi + y.ci + z.di )
Definition: Fem3DElementTetrahedron.h:111
SurgSim::Math::Matrix
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > Matrix
A dynamic size matrix.
Definition: Matrix.h:65
SurgSim::Physics::Fem3DElementTetrahedron::m_x0
Eigen::Matrix< double, 12, 1 > m_x0
The tetrahedon rest state.
Definition: Fem3DElementTetrahedron.h:114
SurgSim::Physics::Fem3DElementTetrahedron::computeShapeFunctions
void computeShapeFunctions(const SurgSim::Math::OdeState &state, double *volume, std::array< double, 4 > *ai, std::array< double, 4 > *bi, std::array< double, 4 > *ci, std::array< double, 4 > *di) const
Computes the tetrahedron shape functions.
Definition: Fem3DElementTetrahedron.cpp:229
SurgSim::Physics::Fem3DElementTetrahedron::initializeMembers
void initializeMembers()
Initializes variables needed before Initialize() is called.
Definition: Fem3DElementTetrahedron.cpp:73
SurgSim::Math::OdeState
The state of an ode of 2nd order of the form with boundary conditions.
Definition: OdeState.h:38
SurgSim::Physics::Fem3DElementTetrahedron::m_stress
Eigen::Matrix< double, 6, 12 > m_stress
Stress matrix.
Definition: Fem3DElementTetrahedron.h:121
SurgSim::Physics::Fem3DElementTetrahedron::computeStiffness
void computeStiffness(const SurgSim::Math::OdeState &state, SurgSim::Math::Matrix *k)
Computes the tetrahedron stiffness matrix.
Definition: Fem3DElementTetrahedron.cpp:171
SurgSim::Physics::Fem3DElementTetrahedron::computeCartesianCoordinate
SurgSim::Math::Vector computeCartesianCoordinate(const SurgSim::Math::OdeState &state, const SurgSim::Math::Vector &naturalCoordinate) const override
Computes a given natural coordinate in cartesian coordinates.
Definition: Fem3DElementTetrahedron.cpp:353
SurgSim::Physics::FemElement
Base class for all Fem Element (1D, 2D, 3D) It handles the node ids to which it is connected and requ...
Definition: FemElement.h:45
SurgSim::Physics::Fem3DElementTetrahedron::computeMass
void computeMass(const SurgSim::Math::OdeState &state, SurgSim::Math::Matrix *m)
Computes the tetrahedron mass matrix.
Definition: Fem3DElementTetrahedron.cpp:126
SurgSim::Physics::Fem3DElementTetrahedron::m_Em
Eigen::Matrix< double, 6, 6 > m_Em
Elasticity material matrix (contains the elastic properties of the material)
Definition: Fem3DElementTetrahedron.h:117
SurgSim::Math::Vector
Eigen::Matrix< double, Eigen::Dynamic, 1 > Vector
A dynamic size column vector.
Definition: Vector.h:68
SURGSIM_CLASSNAME
#define SURGSIM_CLASSNAME(ClassName)
Declare the class name of a class with the appropriate function header, do not use quotes...
Definition: Macros.h:21
SurgSim::Physics::Fem3DElementTetrahedron::m_ci
std::array< double, 4 > m_ci
Definition: Fem3DElementTetrahedron.h:111
Matrix.h
Definitions of small fixed-size square matrix types.
SurgSim::Physics::Fem3DElementTetrahedron::m_di
std::array< double, 4 > m_di
Definition: Fem3DElementTetrahedron.h:111
Vector.h
Definitions of small fixed-size vector types.
SurgSim::Physics::Fem3DElementTetrahedron::m_restVolume
double m_restVolume
Shape functions: Tetrahedron rest volume.
Definition: Fem3DElementTetrahedron.h:109
SurgSim::Physics::Fem3DElementTetrahedron::computeNaturalCoordinate
SurgSim::Math::Vector computeNaturalCoordinate(const SurgSim::Math::OdeState &state, const SurgSim::Math::Vector &cartesianCoordinate) const override
Computes a natural coordinate given a global coordinate.
Definition: Fem3DElementTetrahedron.cpp:372
SurgSim::Physics::Fem3DElementTetrahedron::doUpdateFMDK
void doUpdateFMDK(const Math::OdeState &state, int options) override
Update the FemElement based on the given state.
Definition: Fem3DElementTetrahedron.cpp:78
SurgSim::Physics::Fem3DElementTetrahedron::initialize
void initialize(const SurgSim::Math::OdeState &state) override
Initialize the FemElement once everything has been set.
Definition: Fem3DElementTetrahedron.cpp:92
SurgSim::Physics::Fem3DElementTetrahedron::getVolume
double getVolume(const SurgSim::Math::OdeState &state) const override
Gets the element volume based on the input state (in m-3)
Definition: Fem3DElementTetrahedron.cpp:210
SurgSim::Physics::Fem3DElementTetrahedron::Fem3DElementTetrahedron
Fem3DElementTetrahedron()
Constructor.
Definition: Fem3DElementTetrahedron.cpp:50
Fem.h