76 template < index_t DIMENSION >
91 return gmme_id( type_name(), this->index() );
102 return is_mesh_valid() && are_geomodel_vertex_indices_valid();
109 virtual bool is_connectivity_valid()
const;
115 bool is_parent_connectivity_valid()
const;
123 return static_cast< index_t
>( boundaries_.size() );
125 const gmme_id& boundary_gmme( index_t x )
const;
130 return static_cast< index_t
>( incident_entities_.size() );
132 const gmme_id& incident_entity_gmme( index_t x )
const;
139 bool has_inside_border()
const;
154 return nb_parents() != 0;
162 return could_be_undefined_parent_gmge( parent_type ).is_defined();
167 return static_cast< index_t
>( parents_.size() );
170 const gmge_id& parent_gmge( index_t
id )
const;
187 index_t parent_index )
const;
195 void save(
const std::string& filename )
const 197 mesh_->save_mesh( filename );
205 return mesh_->vertex_nn_search();
215 return mesh_->nb_vertices();
222 return mesh_->vertex( vertex_index );
232 virtual index_t nb_mesh_elements()
const = 0;
236 virtual index_t nb_mesh_element_vertices(
237 index_t mesh_element_index )
const = 0;
247 virtual index_t mesh_element_vertex_index(
261 return vertex( mesh_element_vertex_index( element_local_vertex ) );
269 virtual double mesh_element_size(
270 index_t mesh_element_index )
const = 0;
272 index_t mesh_element_index )
const = 0;
276 for(
auto v :
range( nb_vertices() ) )
278 result += vertex( v );
281 return result /
static_cast< double >( nb_vertices() );
287 for(
auto i :
range( nb_mesh_elements() ) )
289 size += mesh_element_size( i );
296 GEO::AttributesManager& vertex_attribute_manager()
const 298 return mesh_->vertex_attribute_manager();
307 virtual void copy_mesh_entity(
310 this->copy_name( from );
311 this->id_ = from.
index();
317 virtual bool is_index_valid() const final;
318 virtual
bool is_mesh_valid()
const 320 return mesh_ !=
nullptr;
326 mesh_ = std::move( mesh );
333 bool is_boundary_connectivity_valid()
const;
340 bool is_incident_entity_connectivity_valid()
const;
347 bool are_geomodel_vertex_indices_valid()
const;
349 void unbind_vertex_mapping_attribute()
const;
350 void bind_vertex_mapping_attribute()
const;
352 virtual void change_mesh_data_structure(
const MeshType& type ) = 0;
358 gmge_id could_be_undefined_parent_gmge(
363 std::vector< index_t > boundaries_{};
366 std::vector< index_t > incident_entities_{};
369 std::vector< index_t > parents_{};
373 std::shared_ptr< MeshBase< DIMENSION > > mesh_{};
381 template < index_t DIMENSION >
393 this->unbind_vertex_mapping_attribute();
403 return type_name_static();
410 bool is_on_voi()
const final;
426 index_t nb_vertices = point_set_mesh_->nb_vertices();
449 index_t mesh_element = 0 ) const final
452 return this->vertex( 0 );
460 return *point_set_mesh_;
472 update_mesh_storage_type(
491 bool is_mesh_valid()
const final;
497 point_set_mesh_ = std::move( mesh );
501 void change_mesh_data_structure(
const MeshType& type )
final;
504 std::shared_ptr< PointSetMesh< DIMENSION > > point_set_mesh_{};
514 template < index_t DIMENSION >
525 this->unbind_vertex_mapping_attribute();
535 return type_name_static();
538 bool is_on_voi()
const final;
548 bool is_connectivity_valid()
const final;
552 return line_mesh_->edge_aabb();
561 return line_mesh_->edge_nn_search();
569 return line_mesh_->nb_edges();
589 element_local_vertex.element_id_ < nb_mesh_elements() );
591 return line_mesh_->edge_vertex( element_local_vertex );
600 return ( this->boundary_gmme( 0 ).is_defined() )
601 && ( this->boundary_gmme( 0 ) == this->boundary_gmme( 1 ) );
610 return line_mesh_->edge_length( edge_index );
617 index_t edge_index )
const final 620 return line_mesh_->edge_barycenter( edge_index );
623 bool is_first_corner_first_vertex()
const;
639 update_mesh_storage_type(
658 bool is_mesh_valid()
const final;
664 line_mesh_ = std::move( mesh );
668 void change_mesh_data_structure(
const MeshType& type )
final;
671 std::shared_ptr< LineMesh< DIMENSION > > line_mesh_{};
681 template < index_t DIMENSION >
692 this->unbind_vertex_mapping_attribute();
697 return type_name_static();
711 return surface_mesh_->polygons_are_simplicies();
716 return surface_mesh_->polygon_aabb();
725 return surface_mesh_->polygon_nn_search();
730 return surface_mesh_->polygon_attribute_manager();
742 return surface_mesh_->nb_polygons();
751 return surface_mesh_->nb_polygon_vertices( polygon_index );
762 element_local_vertex.element_id_ < nb_mesh_elements() );
764 < nb_mesh_element_vertices(
765 element_local_vertex.element_id_ ) );
766 return surface_mesh_->polygon_vertex( element_local_vertex );
780 polygon_local_edge.
polygon_id_ < nb_mesh_elements() );
783 < nb_mesh_element_vertices( polygon_local_edge.
polygon_id_ ) );
784 return surface_mesh_->polygon_adjacent( polygon_local_edge );
794 index_t polygon_index )
const final 797 return surface_mesh_->polygon_barycenter( polygon_index );
806 return surface_mesh_->polygon_area( polygon_index );
814 return *surface_mesh_;
823 update_mesh_storage_type(
849 bool is_mesh_valid()
const final;
855 surface_mesh_ = std::move( mesh );
859 void change_mesh_data_structure(
const MeshType& type )
final;
862 std::shared_ptr< SurfaceMesh< DIMENSION > > surface_mesh_{};
865 template < index_t DIMENSION >
882 bool is_on_voi()
const final;
893 return mesh().nb_polygons() > 0;
901 std::vector< bool > sides_{};
916 bool is_on_voi()
const final;
917 const Region< 3 >& incident_entity( index_t x )
const;
929 template < index_t DIMENSION >
940 this->unbind_vertex_mapping_attribute();
950 return type_name_static();
953 bool is_on_voi()
const final;
957 bool is_connectivity_valid()
const final;
961 return volume_mesh_->nb_cells() > 0;
966 return volume_mesh_->cells_are_simplicies();
971 return volume_mesh_->cell_aabb();
980 return volume_mesh_->cell_nn_search();
985 return volume_mesh_->cell_attribute_manager();
998 return volume_mesh_->nb_cells();
1009 return volume_mesh_->nb_cell_vertices( cell_index );
1024 element_local_vertex.element_id_ < nb_mesh_elements() );
1026 < nb_mesh_element_vertices(
1027 element_local_vertex.element_id_ ) );
1028 return volume_mesh_->cell_vertex( element_local_vertex );
1043 return volume_mesh_->cell_type( cell_index );
1054 return volume_mesh_->nb_cell_edges( cell_index );
1065 return volume_mesh_->nb_cell_facets( cell_index );
1072 index_t cell_index, index_t facet_index )
const 1078 return volume_mesh_->nb_cell_facet_vertices(
1086 index_t cell_index, index_t edge_index, index_t vertex_index )
const 1093 vertex_index < nb_mesh_element_vertices( cell_index ) );
1094 return volume_mesh_->cell_edge_vertex(
1095 cell_index, edge_index, vertex_index );
1102 index_t facet_index,
1103 index_t vertex_index )
const 1110 vertex_index < nb_mesh_element_vertices( cell_index ) );
1111 return volume_mesh_->cell_facet_vertex(
1119 index_t cell_index, index_t facet_index )
const 1125 return volume_mesh_->cell_adjacent(
1148 return volume_mesh_->cell_volume( cell_index );
1159 for(
auto i :
range( this->nb_boundaries() ) )
1176 side( i ) ? result -= cur_volume : result += cur_volume;
1180 return std::fabs( result );
1186 index_t cell_index )
const final 1191 return volume_mesh_->cell_barycenter( cell_index );
1198 index_t vertex_id, index_t cell_hint )
const 1200 return volume_mesh_->cells_around_vertex( vertex_id, cell_hint );
1215 return *volume_mesh_;
1224 update_mesh_storage_type(
1228 bool is_mesh_valid()
const final;
1230 void update_mesh_storage_type(
1233 volume_mesh_ = std::move( mesh );
1237 void change_mesh_data_structure(
const MeshType& type )
final;
1239 void copy_mesh_entity(
1242 const auto& region_from =
1245 sides_ = region_from.sides_;
1253 std::vector< bool > sides_{};
1256 std::shared_ptr< VolumeMesh< DIMENSION > > volume_mesh_{};
1261 template < index_t DIMENSION >
1280 const std::shared_ptr< MeshBase< DIMENSION > >&
mesh()
const 1287 return gmme_.incident_entities_;
1292 return gmme_.boundaries_;
1299 template < index_t DIMENSION >
1334 return gmme_.boundaries_;
1339 return gmme_.incident_entities_;
1342 std::vector< bool >& modifiable_sides();
1346 return gmme_.parents_;
1356 gmme_.copy_mesh_entity( from );
1359 void change_mesh_data_structure(
const MeshType& type );
1361 template <
template < index_t >
class ENTITY >
1367 return std::unique_ptr< ENTITY< DIMENSION > >(
1368 new ENTITY< DIMENSION >( geomodel, id, type ) );
std::vector< index_t > & modifiable_boundaries()
index_t nb_mesh_element_vertices(index_t mesh_element=0) const final
double size() const final
const SurfaceAABBTree< DIMENSION > & polygon_aabb() const
index_t nb_incident_entities() const
#define ringmesh_disable_copy_and_move(Class)
index_t cell_edge_vertex_index(index_t cell_index, index_t edge_index, index_t vertex_index) const
const LineAABBTree< DIMENSION > & edge_aabb() const
Surface(const GeoModel3D &geomodel, index_t id, const MeshType type)
Abstract base class for GeoModelMeshEntity.
GEO::vecng< DIMENSION, double > vecn
const NNSearch< DIMENSION > & polygon_nn_search() const
Return the NNSearch for the polygons of the surface.
const LineMesh< DIMENSION > & mesh() const
Get the low level mesh data structure.
double size() const final
Compute the volume of the Region.
index_t mesh_element_vertex_index(const ElementLocalVertex &element_local_vertex) const final
Index of the vertex in the Surface from its index in a polygon of the mesh.
index_t nb_cell_edges(index_t cell_index) const
MeshEntityType type_name() const final
double mesh_element_size(index_t polygon_index) const final
void save(const std::string &filename) const
const vecn< DIMENSION > & vertex(index_t vertex_index) const
Coordinates of the vertex_index.
index_t nb_cell_facets(index_t cell_index) const
const NNSearch< DIMENSION > & edge_nn_search() const
Return the NNSearch for the edges of the line.
index_t nb_mesh_element_vertices(index_t polygon_index) const final
The GeologicalEntityType described the type of the Geological entities User can defined there own Geo...
MeshEntityType type_name() const final
bool has_parent(const GeologicalEntityType &parent_type) const
Check if the entity has a parent of the given type.
index_t nb_mesh_elements() const final
std::vector< index_t > cells_around_vertex(index_t vertex_id, index_t cell_hint) const
const PointSetMesh< DIMENSION > & mesh() const
Get the low level mesh data structure.
Corner(const GeoModel< DIMENSION > &geomodel, index_t id, const MeshType &type)
Creates a Corner. A point is added to its Mesh.
static std::unique_ptr< ENTITY< DIMENSION > > create_entity(const GeoModel< DIMENSION > &geomodel, index_t id, const MeshType &type)
const NNSearch< DIMENSION > & vertex_nn_search() const
Return the NNSearch for the Entity vertices.
void ringmesh_unused(const T &)
MeshEntityType type_name() const final
vecn< DIMENSION > entity_barycenter() const
GeoModelMeshEntity< DIMENSION > & gmme_
index_t mesh_element_vertex_index(const ElementLocalVertex &element_local_vertex) const final
Index of a vertex in the Region from its index in a cell.
#define ringmesh_template_assert_2d_or_3d(type)
A GeoModelEntity of type CORNER.
std::vector< index_t > boundaries_
Boundary relations of this entity.
CellType cell_type(index_t cell_index) const
void update_mesh_storage_type(std::unique_ptr< LineMesh< DIMENSION > > mesh)
void set_mesh(std::shared_ptr< MeshBase< DIMENSION > > mesh)
static MeshEntityType type_name_static()
double mesh_element_size(index_t mesh_element=0) const final
bool is_meshed() const
Tells whether the Surface2D is meshed or not.
#define ringmesh_template_assert_3d(type)
bool is_closed() const
A Line is closed if its two extremities are identitical.
index_t nb_boundaries() const
vecn< DIMENSION > mesh_element_barycenter(index_t mesh_element=0) const final
vecn< DIMENSION > mesh_element_barycenter(index_t edge_index) const final
Gets the barycenter of an edge.
index_t nb_mesh_element_vertices(index_t mesh_element=0) const final
void update_mesh_storage_type(std::unique_ptr< PointSetMesh< DIMENSION > > mesh)
Surface(const GeoModel2D &geomodel, index_t id, const MeshType type)
const SurfaceMesh< DIMENSION > & mesh() const
Get the low level mesh data structure.
vecn< DIMENSION > mesh_element_barycenter(index_t polygon_index) const final
static MeshEntityType type_name_static()
index_t nb_mesh_elements() const final
index_t nb_parents() const
index_t nb_mesh_elements() const final
A GeoModelEntity of type SURFACE.
MeshEntityType type_name() const final
index_t nb_mesh_element_vertices(index_t cell_index) const final
const NNSearch< DIMENSION > & cell_nn_search() const
Return the NNSearch for the cells of the region.
const std::shared_ptr< MeshBase< DIMENSION > > & mesh() const
void copy(const GeoModelMeshEntity< DIMENSION > &from)
index_t mesh_element_vertex_index(const ElementLocalVertex &element_local_vertex) const final
Get the index of a vertex in the Line from the.
double mesh_element_size(index_t edge_index) const final
Gets the length of an edge.
void update_mesh_storage_type(std::unique_ptr< SurfaceMesh< DIMENSION > > mesh)
Line(const GeoModel< DIMENSION > &geomodel, index_t id, const MeshType &type)
static MeshEntityType type_name_static()
encapsulate adimensional mesh functionalities in order to provide an API on which we base the RINGMes...
bool is_simplicial() const
index_t cell_adjacent_index(index_t cell_index, index_t facet_index) const
const Surface< DIMENSION > & incident_entity(index_t x) const
const VolumeAABBTree< DIMENSION > & cell_aabb() const
index_t mesh_element_vertex_index(const ElementLocalVertex &element_local_vertex=ElementLocalVertex(0, 0)) const final
Get the index of the unique vertex constituting of the Corner.
std::string & modifiable_name()
bool side(index_t i) const
index_t nb_cell_facet_vertices(index_t cell_index, index_t facet_index) const
GEO::AttributesManager & polygon_attribute_manager() const
vecn< DIMENSION > mesh_element_barycenter(index_t cell_index) const final
Get the center of the cell.
std::vector< index_t > & modifiable_parents()
Builder tools to remove entities from a GeoModel.
bool side(index_t i) const
#define ringmesh_assert(x)
const GeoModelMeshEntity< DIMENSION > & incident_entity(index_t x) const
index_t & modifiable_index()
bool is_valid() const final
Global validity of the entity.
GeoModelMeshEntityAccess(GeoModelMeshEntity< DIMENSION > &gme)
A GeoModelEntity of type REGION.
The MeshEntityType described the type of the meshed entities There are 4 MeshEntityTypes correspondin...
This template is a specialization of a gme_id to the GeoModelGeologicalEntity.
Classes to build GeoModel from various inputs.
index_t polygon_adjacent_index(const PolygonLocalEdge &polygon_local_edge) const
Gets the polygon adjacent along an edge of a polygon.
virtual void copy_mesh_entity(const GeoModelMeshEntity< DIMENSION > &from)
A GeoModelEntity of type LINE.
Abstract base class describing one entity of a GeoModel.
const vecn< DIMENSION > & mesh_element_vertex(const ElementLocalVertex &element_local_vertex) const
Coordinates of a vertex of a mesh element.
const std::vector< index_t > & boundary_relation_ids() const
const std::vector< index_t > & incident_entity_relation_ids() const
index_t nb_mesh_elements() const final
std::vector< index_t > incident_entities_
Incident-entity relations of this entity.
static MeshEntityType type_name_static()
const GeoModelMeshEntity< DIMENSION > & gmme_
std::vector< index_t > parents_
Parents relations of this entity.
SurfaceBase(const GeoModel< DIMENSION > &geomodel, index_t id, const MeshType type)
std::vector< index_t > & modifiable_incident_entities()
virtual double size() const
bool is_simplicial() const
index_t cell_facet_vertex_index(index_t cell_index, index_t facet_index, index_t vertex_index) const
This template is a specialization of a gme_id to the GeoModelMeshEntity.
index_t nb_vertices() const
double mesh_element_size(index_t cell_index) const final
Volume of a cell.
FORWARD_DECLARATION_DIMENSION_CLASS(GeoModelMeshEntityAccess)
GeoModelMeshEntityConstAccess(const GeoModelMeshEntity< DIMENSION > &gme)
GEO::AttributesManager & cell_attribute_manager() const
#define ringmesh_assert_not_reached
MeshEntityType mesh_entity_type() const
std::shared_ptr< MeshBase< DIMENSION > > & modifiable_mesh()