7 #include "imstkPointSet.h" 8 #include "imstkVecDataArray.h" 10 #include <unordered_set> 29 bool isMesh()
const override {
return true; }
31 void clear()
override;
36 void print()
const override;
38 virtual int getNumCells()
const = 0;
79 const std::unordered_map<std::string, std::shared_ptr<AbstractDataArray>>&
getCellAttributes()
const {
return m_cellAttributes; }
81 void setCellAttribute(
const std::string& arrayName, std::shared_ptr<AbstractDataArray> arr)
83 m_cellAttributes[arrayName] = arr;
86 std::shared_ptr<AbstractDataArray> getCellAttribute(
const std::string& name)
const 88 auto it = m_cellAttributes.find(name);
89 if (it == m_cellAttributes.end())
91 LOG(FATAL) <<
"No attribute with name " << name <<
" found in " <<
getTypeName();
102 return (m_cellAttributes.find(arrayName) != m_cellAttributes.end());
108 void setCellAttributes(std::unordered_map<std::string, std::shared_ptr<AbstractDataArray>> attributes) { m_cellAttributes = attributes; }
113 void setCellScalars(
const std::string& arrayName, std::shared_ptr<AbstractDataArray> scalars);
115 std::string getActiveCellScalars()
const {
return m_activeCellScalars; }
116 std::shared_ptr<AbstractDataArray> getCellScalars()
const;
124 std::string getActiveCellNormals()
const {
return m_activeCellNormals; }
125 std::shared_ptr<VecDataArray<double, 3>> getCellNormals()
const;
133 std::string getActiveCellTangents()
const {
return m_activeCellTangents; }
134 std::shared_ptr<VecDataArray<double, 3>> getCellTangents()
const;
138 void setCellActiveAttribute(std::string& activeAttributeName, std::string attributeName,
139 const int expectedNumComponents,
const ScalarTypeId expectedScalarType);
145 std::unordered_map<std::string, std::shared_ptr<AbstractDataArray>> m_cellAttributes;
147 std::string m_activeCellNormals =
"";
148 std::string m_activeCellTangents =
"";
149 std::string m_activeCellScalars =
"";
Base class for all geometries represented by discrete points and elements The pointsets follow a pipe...
void setCellNormals(const std::string &arrayName, std::shared_ptr< VecDataArray< double, 3 >> normals)
Get/Set the active normals.
virtual const std::string getTypeName() const =0
Returns the string representing the type name of the geometry.
void print() const override
Print the surface mesh.
std::vector< std::unordered_set< int > > m_vertexToNeighborVertex
Map of vertices to neighbor vertices.
void clear() override
Clears all the mesh data.
const std::vector< int > getCellsForVertex(const int vertexId)
Returns cells that contain the vertex, will calculate vertex cells if necessary.
virtual void computeVertexToCellMap()
Computes neighboring cells for all vertices.
const std::unordered_map< std::string, std::shared_ptr< AbstractDataArray > > & getCellAttributes() const
Get the cell attributes map.
std::vector< std::unordered_set< int > > m_vertexToCells
Map of vertices to neighbor cells.
void setCellTangents(const std::string &arrayName, std::shared_ptr< VecDataArray< double, 3 >> tangents)
Get/Set the active tangents.
bool isMesh() const override
Returns true if the geometry is a mesh, else returns false.
void setCellAttributes(std::unordered_map< std::string, std::shared_ptr< AbstractDataArray >> attributes)
Set the cell attributes map.
virtual int getCellVertexCount() const =0
Number of verticies associated with the cell type.
bool hasCellAttribute(const std::string &arrayName) const
Check if a specific data array exists.
virtual std::shared_ptr< AbstractDataArray > getAbstractCells() const =0
Get cells as abstract array. Overridden by derived classes to return cells as point indices...
virtual void computeVertexNeighbors()
Computes neighboring vertices for all vertices.
const std::vector< std::unordered_set< int > > & getVertexToCellMap() const
Returns map of vertices to cells that contain the vertex (reverse linkage)
void setCellScalars(const std::string &arrayName, std::shared_ptr< AbstractDataArray > scalars)
Get/Set the active scalars.
const std::vector< std::unordered_set< int > > & getVertexNeighbors() const
Returns map of vertices to neighboring vertices.
Provides non templated base for cell based meshes.