Fem1DRepresentation.h
Go to the documentation of this file.
// This file is a part of the OpenSurgSim project.
// Copyright 2013-2016, 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_FEM1DREPRESENTATION_H
#define SURGSIM_PHYSICS_FEM1DREPRESENTATION_H
#include <memory>
#include <string>
#include "SurgSim/Framework/FrameworkConvert.h"
#include "SurgSim/Math/Matrix.h"
#include "SurgSim/Math/RigidTransform.h"
#include "SurgSim/Math/Vector.h"
#include "SurgSim/Physics/Fem1D.h"
#include "SurgSim/Physics/FemRepresentation.h"
namespace SurgSim
{
namespace DataStructures
{
struct IndexedLocalCoordinate;
struct Location;
}
namespace Framework
{
class Asset;
}
namespace Math
{
class OdeState;
}
namespace Physics
{
class Localization;
SURGSIM_STATIC_REGISTRATION(Fem1DRepresentation);
class Fem1DRepresentation : public FemRepresentation
{
public:
explicit Fem1DRepresentation(const std::string& name);
virtual ~Fem1DRepresentation();
SURGSIM_CLASSNAME(SurgSim::Physics::Fem1DRepresentation);
void loadFem(const std::string& fileName) override;
void setFem(std::shared_ptr<SurgSim::Framework::Asset> mesh);
std::shared_ptr<Fem1D> getFem() const;
void addExternalGeneralizedForce(std::shared_ptr<Localization> localization,
const SurgSim::Math::Vector& generalizedForce,
const SurgSim::Math::Matrix& K = SurgSim::Math::Matrix(),
const SurgSim::Math::Matrix& D = SurgSim::Math::Matrix()) override;
std::shared_ptr<Localization> createLocalization(const SurgSim::DataStructures::Location& location) override;
protected:
void transformState(std::shared_ptr<SurgSim::Math::OdeState> state,
const SurgSim::Math::RigidTransform3d& transform) override;
bool doInitialize() override;
private:
std::shared_ptr<Localization> createNodeLocalization(size_t nodeId);
std::shared_ptr<Localization> createElementLocalization(
const SurgSim::DataStructures::IndexedLocalCoordinate& location);
std::shared_ptr<Fem1D> m_fem;
};
} // namespace Physics
} // namespace SurgSim
#endif // SURGSIM_PHYSICS_FEM1DREPRESENTATION_H
SurgSim
Definition: CompoundShapeToGraphics.cpp:29
SurgSim::DataStructures::IndexedLocalCoordinate
A generic (size_t index, Vector coordinate) pair.
Definition: IndexedLocalCoordinate.h:29
SurgSim::Physics::Fem1DRepresentation
Finite Element Model 1D is a fem built with 1D FemElement.
Definition: Fem1DRepresentation.h:54
SurgSim::Physics::FemRepresentation
Finite Element Model (a.k.a FEM) is a deformable model (a set of nodes connected by FemElement)...
Definition: FemRepresentation.h:46
SurgSim::DataStructures::Location
A Location defines a local position w.r.t.
Definition: Location.h:39
SurgSim::Math::Matrix
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > Matrix
A dynamic size matrix.
Definition: Matrix.h:65
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::Fem1DRepresentation::m_fem
std::shared_ptr< Fem1D > m_fem
The Fem1DRepresentation&#39;s asset as a Fem1D.
Definition: Fem1DRepresentation.h:102
Fem1D.h
RigidTransform.h
Definitions of 2x2 and 3x3 rigid (isometric) transforms.
Matrix.h
Definitions of small fixed-size square matrix types.
SurgSim::Math::RigidTransform3d
Eigen::Transform< double, 3, Eigen::Isometry > RigidTransform3d
A 3D rigid (isometric) transform, represented as doubles.
Definition: RigidTransform.h:46
Vector.h
Definitions of small fixed-size vector types.
FemRepresentation.h
FrameworkConvert.h