42 #include <geogram/mesh/mesh.h> 43 #include <geogram/mesh/mesh_io.h> 59 #define COMMON_GEOGRAM_MESH_IMPLEMENTATION( Class ) \ 60 friend class Class##Builder< DIMENSION >; \ 63 Class() : mesh_( new GEO::Mesh( DIMENSION, false ) ) \ 66 static MeshType type_name_static() \ 70 void save_mesh( const std::string& filename ) const override \ 72 GEO::mesh_save( *mesh_, filename, GEO::MeshIOFlags() ); \ 74 const GEO::Mesh& gfx_mesh() const \ 78 void print_mesh_bounded_attributes() const override \ 80 print_bounded_attributes( *mesh_ ); \ 82 GEO::AttributesManager& vertex_attribute_manager() const override \ 84 return mesh_->vertices.attributes(); \ 86 MeshType type_name() const override \ 88 return type_name_static(); \ 90 static std::string default_extension_static() \ 94 std::string default_extension() const override \ 96 return default_extension_static(); \ 98 const vecn< DIMENSION >& vertex( index_t v_id ) const override \ 100 ringmesh_assert( v_id < nb_vertices() ); \ 101 double* vertex_ptr = mesh_->vertices.point_ptr( v_id ); \ 102 return *(vecn< DIMENSION >*) ( vertex_ptr ); \ 104 index_t nb_vertices() const override \ 106 return mesh_->vertices.nb(); \ 110 vecn< DIMENSION >& ref_vertex( index_t v_id ) \ 112 ringmesh_assert( v_id < nb_vertices() ); \ 113 double* vertex_ptr = mesh_->vertices.point_ptr( v_id ); \ 114 return *(vecn< DIMENSION >*) ( vertex_ptr ); \ 118 std::unique_ptr< GEO::Mesh > mesh_ 120 template < index_t DIMENSION >
128 template < index_t DIMENSION >
137 return mesh_->edges.vertex( edge_local_vertex.
element_id_,
143 return mesh_->edges.nb();
148 return mesh_->edges.attributes();
154 template < index_t DIMENSION >
163 return mesh_->facets.vertex( polygon_local_vertex.
element_id_,
169 return mesh_->facets.nb();
174 return mesh_->facets.nb_vertices( polygon_id );
180 return mesh_->facets.adjacent( polygon_local_edge.
polygon_id_,
186 return mesh_->facets.attributes();
191 return mesh_->facets.are_simplices();
197 template < index_t DIMENSION >
206 return mesh_->cells.vertex( cell_local_vertex.
element_id_,
211 index_t cell_id, index_t edge_id, index_t vertex_id )
const override 213 return mesh_->cells.edge_vertex( cell_id, edge_id, vertex_id );
217 index_t vertex_id )
const override 219 return mesh_->cells.facet_vertex( cell_local_facet.
cell_id_,
226 return mesh_->cells.facet(
232 return mesh_->cells.nb_facets( cell_id );
237 return mesh_->cell_facets.nb();
242 return mesh_->cells.nb_edges( cell_id );
248 return mesh_->cells.facet_nb_vertices(
254 return mesh_->cells.nb_vertices( cell_id );
259 return mesh_->cells.nb();
264 return mesh_->cells.corners_begin( cell_id );
269 return mesh_->cells.corners_end( cell_id );
275 return mesh_->cells.adjacent(
281 return mesh_->cells.attributes();
286 return mesh_->cell_facets.attributes();
291 return static_cast< CellType >( mesh_->cells.type( cell_id ) );
296 return mesh_->cells.are_simplices();
index_t nb_cell_vertices(index_t cell_id) const override
Gets the number of vertices of a cell.
index_t cell_facet_vertex(const CellLocalFacet &cell_local_facet, index_t vertex_id) const override
Gets a vertex by cell facet and local vertex index.
index_t edge_vertex(const ElementLocalVertex &edge_local_vertex) const override
index_t nb_cell_edges(index_t cell_id) const override
Gets the number of edges in a cell.
index_t polygon_adjacent(const PolygonLocalEdge &polygon_local_edge) const override
Gets an adjacent polygon index by polygon index and local edge index.
index_t nb_edges() const override
Gets the number of all the edges in the whole Mesh.
index_t cell_begin(index_t cell_id) const override
index_t nb_cell_facets(index_t cell_id) const override
Gets the number of facet in a cell.
GEO::AttributesManager & cell_facet_attribute_manager() const override
GEO::AttributesManager & edge_attribute_manager() const override
bool cells_are_simplicies() const override
Tests whether all the cells are tetrahedra. When all the cells are tetrahedra, storage and access is ...
index_t cell_vertex(const ElementLocalVertex &cell_local_vertex) const override
Gets a vertex index by cell and local vertex index.
index_t nb_polygons() const override
Gets the number of all polygons in the whole Mesh.
bool polygons_are_simplicies() const override
Tests whether all the polygons are triangles. when all the polygons are triangles, storage and access is optimized.
GEO::AttributesManager & cell_attribute_manager() const override
void register_geogram_mesh()
GEO::AttributesManager & polygon_attribute_manager() const override
index_t nb_cell_facets() const override
Gets the total number of facet in a all cells.
double RINGMESH_API mesh_cell_volume(const GEO::Mesh &M, index_t c)
index_t cell_end(index_t cell_id) const override
index_t nb_cell_facet_vertices(const CellLocalFacet &cell_local_facet) const override
Gets the number of vertices of a facet in a cell.
COMMON_GEOGRAM_MESH_IMPLEMENTATION(GeogramPointSetMesh)
index_t nb_cells() const override
Gets the number of cells in the Mesh.
double cell_volume(index_t cell_id) const override
compute the volume of the cell
index_t cell_adjacent(const CellLocalFacet &cell_local_facet) const override
index_t nb_polygon_vertices(index_t polygon_id) const override
Gets the number of vertices in the polygon.
CellType cell_type(index_t cell_id) const override
Gets the type of a cell.
index_t cell_facet(const CellLocalFacet &cell_local_facet) const override
Gets a facet index by cell and local facet index.
Classes to build GeoModel from various inputs.
index_t polygon_vertex(const ElementLocalVertex &polygon_local_vertex) const override
Gets the vertex index by polygon index and local vertex index.
index_t cell_edge_vertex(index_t cell_id, index_t edge_id, index_t vertex_id) const override
Gets a vertex index by cell and local edge and local vertex index.
FORWARD_DECLARATION_DIMENSION_CLASS(GeoModelMeshEntityAccess)