7 #include "imstkAbstractCellMesh.h"    26     static constexpr 
int CellVertexCount = N;
    29     using CellType       = Eigen::Matrix<int, N, 1>;
    55         if (m_indices != 
nullptr)
    70         for (
const auto& cell : *m_indices)
    74             for (
int i = 0; i < N; i++)
    99                 for (
int i = 0; i < N; i++)
   102                     const int vertexId2 = indices[cellId][i];
   103                     if (vertexId2 != static_cast<int>(vertexId))
   116                                                                const Vec3d& imstkNotUsed(pos))
 const   118         return Eigen::Vector<double, N>::Zero();
   125                                const Eigen::Matrix<double, N, 1>& bary)
 const   127         Vec3d position = Vec3d::Zero();
   132         const Eigen::Matrix<int, N, 1>& cell = indices[cellId];
   134         for (
int i = 0; i < N; i++)
   136             position += vertices[cell[i]] * bary[i];
   147     std::shared_ptr<VecDataArray<int, N>> getCells()
 const { 
return m_indices; }
   159     std::unique_ptr<CellMesh<N>> 
clone()
   161         return std::unique_ptr<CellMesh<N>>(cloneImplementation());
   165     std::shared_ptr<VecDataArray<int, N>> m_indices = 
nullptr;
   173         geom->m_indices = std::make_shared<VecDataArray<int, N>>(*m_indices);
   174         for (
auto i : m_cellAttributes)
   176             geom->m_cellAttributes[i.first] = i.second->clone();
   178         geom->m_initialVertexPositions = std::make_shared<VecDataArray<double, 3>>(*m_initialVertexPositions);
   179         geom->m_vertexPositions = std::make_shared<VecDataArray<double, 3>>(*m_vertexPositions);
   180         for (
auto i : m_vertexAttributes)
   182             geom->m_vertexAttributes[i.first] = i.second->clone();
 void initialize(std::shared_ptr< VecDataArray< double, 3 >> positions)
Initializes the data structure given vertex positions. 
 
std::unique_ptr< CellMesh< N > > clone()
Polymorphic clone, hides the declaration in superclass return own type. 
 
virtual Eigen::Vector< double, N > computeBarycentricWeights(const int imstkNotUsed(cellId), const Vec3d &imstkNotUsed(pos)) const
compute the barycentric weights of a given point in 3D space for a given the cell ...
 
void computeVertexNeighbors() override
Computes neighboring vertices for all vertices. 
 
std::shared_ptr< AbstractDataArray > getAbstractCells() const override
Get cells as abstract array. Overridden by derived classes to return cells as point indices...
 
std::vector< std::unordered_set< int > > m_vertexToNeighborVertex
Map of vertices to neighbor vertices. 
 
void clear() override
Clears all the mesh data. 
 
void initialize(std::shared_ptr< VecDataArray< double, 3 >> vertices, std::shared_ptr< VecDataArray< int, N >> indices)
Initializes the rest of the data structures given vertex positions and connectivity. 
 
int getNumCells() const override
Returns the number of cells. 
 
void setCells(std::shared_ptr< VecDataArray< int, N >> indices)
Get/Set cell connectivity. 
 
std::vector< std::unordered_set< int > > m_vertexToCells
Map of vertices to neighbor cells. 
 
void clear() override
Clears all the mesh data. 
 
Abstract template base class for all meshes that have homogenous cell types. This class allows templa...
 
Vec3d computeWorldPosition(const int cellId, const Eigen::Matrix< double, N, 1 > &bary) const
compute the world position of a point in 3D given the cellId and a set of barycentric coordinates ...
 
int getCellVertexCount() const override
Number of verticies associated with the cell type. 
 
Provides non templated base for cell based meshes. 
 
void computeVertexToCellMap() override
Computes neighboring cells for all vertices.