Fem.h
Go to the documentation of this file.
// This file is a part of the OpenSurgSim project.
// Copyright 2015, 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_FEM_H
#define SURGSIM_PHYSICS_FEM_H
#include "SurgSim/DataStructures/Vertices.h"
#include "SurgSim/Framework/Asset.h"
#include "SurgSim/Physics/FemElementStructs.h"
namespace SurgSim
{
namespace Physics
{
template <class VertexData, class Element>
class Fem : public SurgSim::DataStructures::Vertices<VertexData>, public SurgSim::Framework::Asset,
public std::enable_shared_from_this<Fem<VertexData, Element>>
{
public:
Fem();
size_t addElement(std::shared_ptr<Element> element);
size_t getNumElements() const;
const std::vector<std::shared_ptr<Element>>& getElements() const;
std::vector<std::shared_ptr<Element>>& getElements();
std::shared_ptr<Element> getElement(size_t id) const;
size_t addBoundaryCondition(size_t boundaryCondition);
const std::vector<size_t>& getBoundaryConditions() const;
std::vector<size_t>& getBoundaryConditions();
size_t getBoundaryCondition(size_t id) const;
protected:
template <class PlyType, class FemType>
bool loadFemFile(const std::string& filename);
std::vector<std::shared_ptr<Element>> m_elements;
std::vector<size_t> m_boundaryConditions;
};
} // namespace Physics
} // namespace SurgSim
#include "SurgSim/Physics/Fem-inl.h"
#endif // SURGSIM_PHYSICS_FEM_H
SurgSim::Physics::Fem::getBoundaryCondition
size_t getBoundaryCondition(size_t id) const
Retrieves a specific boundary condition.
Definition: Fem-inl.h:86
SurgSim
Definition: CompoundShapeToGraphics.cpp:29
SurgSim::Framework::Asset
This class is used to facilitate file loading.
Definition: Asset.h:39
Vertices.h
SurgSim::Physics::Fem::m_elements
std::vector< std::shared_ptr< Element > > m_elements
Vector of individual elements.
Definition: Fem.h:93
Fem-inl.h
SurgSim::Physics::Fem::getBoundaryConditions
const std::vector< size_t > & getBoundaryConditions() const
Gets entire vector of boundary conditions.
Definition: Fem-inl.h:74
SurgSim::Physics::Fem::getElement
std::shared_ptr< Element > getElement(size_t id) const
Retrieve a specific element from the mesh.
Definition: Fem-inl.h:61
SurgSim::Physics::Fem::addElement
size_t addElement(std::shared_ptr< Element > element)
Adds FEM element to mesh of Element template type.
Definition: Fem-inl.h:35
SurgSim::Physics::Fem::getElements
const std::vector< std::shared_ptr< Element > > & getElements() const
Gets entire FEM element vector.
Definition: Fem-inl.h:49
Asset.h
SurgSim::Physics::Fem::loadFemFile
bool loadFemFile(const std::string &filename)
Shared loading method for all 3 dimensions.
Definition: Fem-inl.h:91
SurgSim::Physics::Fem::addBoundaryCondition
size_t addBoundaryCondition(size_t boundaryCondition)
Add boundary condition to mesh.
Definition: Fem-inl.h:67
SurgSim::Physics::Fem::m_boundaryConditions
std::vector< size_t > m_boundaryConditions
Vector of vertex ids that have boundary conditions.
Definition: Fem.h:96
SurgSim::Physics::Fem::Fem
Fem()
Default constructor.
Definition: Fem-inl.h:30
FemElementStructs.h
SurgSim::Physics::Fem
Base class for a data structure for holding FEM mesh data of different dimensions.
Definition: Fem.h:39
SurgSim::Physics::Fem::getNumElements
size_t getNumElements() const
Gets number of FEM elements in the mesh.
Definition: Fem-inl.h:42
SurgSim::DataStructures::Vertices
Base class for mesh structures, handling basic vertex functionality.
Definition: Vertices.h:51