54 template < index_t DIMENSION >
58 const auto& geomodel_vertices = geomodel.
mesh.vertices;
59 const auto& vertices =
60 geomodel_vertices.gme_vertices( geomodel_point_id );
61 for(
const auto& vertex : vertices )
76 template < index_t DIMENSION >
78 const std::vector< index_t >& rhs_vertices )
84 const auto& geomodel_vertices = line.
geomodel().mesh.vertices;
89 != geomodel_vertices.geomodel_vertex_id( line.
gmme(), i ) )
104 != geomodel_vertices.geomodel_vertex_id(
118 template < index_t DIMENSION >
119 void reorder_closed_line_vertices_to_start_at_corner(
121 std::vector< index_t >& line_vertices )
129 if( line_vertices.empty() )
133 for(
auto i :
range( 1, line_vertices.size() - 1 ) )
135 auto corner = find_corner( geomodel, line_vertices[i] );
136 if( corner.is_defined() )
138 line_vertices.pop_back();
139 std::rotate( line_vertices.begin(), line_vertices.begin() + i,
140 line_vertices.end() );
141 line_vertices.push_back( line_vertices.front() );
151 template < index_t DIMENSION >
154 : builder_( builder ),
155 geomodel_( geomodel ),
156 geomodel_access_( geomodel )
160 template < index_t DIMENSION >
166 builder_.geology.copy_geological_entity_topology(
171 template < index_t DIMENSION >
177 auto old_size =
static_cast< index_t
>( store.size() );
178 auto new_size = old_size + nb_additional_entities;
179 store.reserve( new_size );
180 for(
auto i :
range( old_size, new_size ) )
188 template < index_t DIMENSION >
193 const auto& children_mesh_entity =
geomodel_.mesh_entity( children );
194 if( children_mesh_entity.has_parent( parent.
type() ) )
197 parent == children_mesh_entity.parent_gmge( parent.
type() ) );
203 template < index_t DIMENSION >
207 auto& parent_entity =
209 const auto& parent_entity_types =
210 geomodel_.entity_type_manager().relationship_manager.parent_types(
215 "Wrong Parent type in the parent children relation between ",
216 parent,
" and ", children );
225 auto& children_entity =
227 const auto& children_type =
228 geomodel_.entity_type_manager().relationship_manager.child_type(
231 if( children_type != children.
type() )
234 "Wrong children type in the parent children relation between ",
235 parent,
" and ", children );
239 .relationship_manager;
241 manager.add_parent_child_relationship( parent, children );
252 template < index_t DIMENSION >
257 .relationship_manager;
259 manager.find_parent_child_relationship( parent, children );
260 if( relation_id == NO_ID )
262 std::ostringstream message;
264 "No parent children relation found between ", parent,
" and ",
270 auto& childs = parent_access.modifiable_children();
272 childs.begin(), childs.end(), [relation_id]( index_t relation ) {
273 return relation == relation_id;
278 auto& parents = children_access.modifiable_parents();
280 parents.begin(), parents.end(), [relation_id]( index_t relation ) {
281 return relation == relation_id;
285 template < index_t DIMENSION >
287 const gmge_id& parent_gmge, index_t
id, index_t child_id )
293 const auto& child_type =
294 geomodel_.entity_type_manager().relationship_manager.child_type(
295 parent_gmge.
type() );
296 gmme_id child{ child_type, child_id };
300 .relationship_manager;
301 manager.set_child_to_parent_child_relationship(
302 relationship_id, child );
305 template < index_t DIMENSION >
312 template < index_t DIMENSION >
318 static_cast< index_t
>(
geomodel_.nb_geological_entities( type ) );
327 template < index_t DIMENSION >
334 .geological_entity_manager.geological_entity_type_index( type );
335 if( type_index == NO_ID )
342 template < index_t DIMENSION >
350 .geological_entity_manager.geological_entity_types_.push_back(
356 const auto child_type = geol_entity->child_type_name();
358 .relationship_manager;
359 parentage.register_geology_relationship( type, child_type );
362 .geological_entity_manager.nb_geological_entity_types()
366 template < index_t DIMENSION >
372 [&type, &from,
this]( index_t i ) {
377 gmge_access.copy( from.geological_entity(
id ) );
381 template < index_t DIMENSION >
385 .geological_entity_manager.is_valid_type(
394 std::vector< std::set< gmge_id > > interfaces;
395 for(
const auto& line :
geomodel_.lines() )
397 std::set< gmge_id > cur_interfaces;
401 auto parent_interface = surface.parent_gmge(
403 cur_interfaces.insert( parent_interface );
406 for(
auto j :
range( interfaces.size() ) )
408 if( cur_interfaces.size() == interfaces[j].size()
409 && std::equal( cur_interfaces.begin(), cur_interfaces.end(),
410 interfaces[j].begin() ) )
422 interfaces.push_back( cur_interfaces );
424 std::string name =
"contact";
425 for(
const auto& it : cur_interfaces )
428 name +=
geomodel_.geological_entity( it ).name();
430 builder_.info.set_geological_entity_name( contact_id, name );
435 template < index_t DIMENSION >
445 gmge_access.modifiable_geol_feature() = geol_feature;
index_t nb_incident_entities() const
const GeoModel< DIMENSION > & geomodel() const
GeoModelMesh< DIMENSION > mesh
static std::unique_ptr< BaseClass > create(const Key &key, const Args &... args)
void remove_parent_children_relation(const gmge_id &parent, const gmme_id &children)
GeoModel< DIMENSION > & geomodel_
The GeologicalEntityType described the type of the Geological entities User can defined there own Geo...
bool check_if_boundary_incident_entity_relation_already_exists(const gmge_id &parent, const gmme_id &children)
GeoModelBuilder< DIMENSION > & builder_
void add_parent_children_relation(const gmge_id &parent, const gmme_id &children)
void RINGMESH_API rotate(GeoModel3D &geomodel, const vec3 &origin, const vec3 &axis, double angle, bool degrees=false)
Rotate the boundary geomodel.
void set_geological_entity_geol_feature(const gmge_id &gmge_id, typename GeoModelGeologicalEntity< DIMENSION >::GEOL_FEATURE geol_feature)
std::vector< index_t > & modifiable_children()
Entity_type_template type() const
index_t nb_geological_entity_types() const
Returns the index of the geological entity type storage.
GeoModelBuilderGeology(GeoModelBuilder< DIMENSION > &builder, GeoModel< DIMENSION > &geomodel)
GEOL_FEATURE
Geological feature types for GeoModelEntity.
GeoModelAccess< DIMENSION > geomodel_access_
index_t create_geological_entity_type(const GeologicalEntityType &type)
index_t find_or_create_geological_entity_type(const GeologicalEntityType &type)
void delete_geological_entity(const GeologicalEntityType &type, index_t index)
void build_contacts()
Build the Contacts.
static MeshEntityType type_name_static()
bool create_geological_entities(const GeologicalEntityType &type, index_t nb)
const GeologicalEntityType & geological_entity_type(index_t index) const
void set_geological_entity_child(const gmge_id &parent_gmge, index_t id, index_t child_id)
const Surface< DIMENSION > & incident_entity(index_t x) const
index_t nb_corners() const
std::vector< index_t > & modifiable_parents()
#define ringmesh_assert(x)
gmge_id create_geological_entity(const GeologicalEntityType &type)
Create and store a geological entity of the given type.
bool contains(const container &in, const T &value)
void copy_geology(const GeoModel< DIMENSION > &from)
void copy_geological_entity_topology(const GeoModel< DIMENSION > &from, const GeologicalEntityType &type)
This template is a specialization of a gme_id to the GeoModelGeologicalEntity.
Classes to build GeoModel from various inputs.
A GeoModelEntity of type LINE.
This template is a specialization of a gme_id to the GeoModelMeshEntity.
index_t nb_geological_entities(const GeologicalEntityType &type) const
Returns the number of geological entities of the given type.
index_t nb_vertices() const
void parallel_for(index_t size, const ACTION &action)