RINGMesh  Version 5.0.0
A programming library for geological model meshes
geomodel_builder_geology.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2012-2017, Association Scientifique pour la Geologie et ses
3  * Applications (ASGA). All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  * * Redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer.
9  * * Redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution.
12  * * Neither the name of ASGA nor the
13  * names of its contributors may be used to endorse or promote products
14  * derived from this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
18  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ASGA BE LIABLE FOR ANY DIRECT,
20  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  *
27  * http://www.ring-team.org
28  *
29  * RING Project
30  * Ecole Nationale Superieure de Geologie - GeoRessources
31  * 2 Rue du Doyen Marcel Roubault - TSA 70605
32  * 54518 VANDOEUVRE-LES-NANCY
33  * FRANCE
34  */
35 
36 #pragma once
37 
38 #include <ringmesh/basic/common.h>
39 
42 
48 namespace RINGMesh
49 {
50  FORWARD_DECLARATION_DIMENSION_CLASS( GeoModelBuilderBase );
51  FORWARD_DECLARATION_DIMENSION_CLASS( GeoModelBuilder );
52 } // namespace RINGMesh
53 
54 namespace RINGMesh
55 {
56  template < index_t DIMENSION >
57  class RINGMESH_API GeoModelBuilderGeology final
58  {
61  friend class GeoModelBuilderBase< DIMENSION >;
62  friend class GeoModelBuilder< DIMENSION >;
63 
64  public:
65  void copy_geology( const GeoModel< DIMENSION >& from );
66 
71  gmge_id create_geological_entity( const GeologicalEntityType& type );
72 
73  bool create_geological_entities(
74  const GeologicalEntityType& type, index_t nb );
75 
76  void set_geological_entity_geol_feature( const gmge_id& gmge_id,
78  geol_feature );
79 
81  const gmme_id& child_gmme, index_t id, const gmge_id& parent_gmge )
82  {
85  GeoModelMeshEntity< DIMENSION >& mesh_entity =
86  geomodel_access_.modifiable_mesh_entity( child_gmme );
87  ringmesh_assert( id < mesh_entity.nb_parents() );
88  GeoModelMeshEntityAccess< DIMENSION > gmme_access( mesh_entity );
89  index_t relationship_id = gmme_access.modifiable_parents()[id];
90  RelationshipManager& manager =
91  geomodel_access_.modifiable_entity_type_manager()
92  .relationship_manager;
94  relationship_id, parent_gmge );
95  }
96 
97  void add_parent_children_relation(
98  const gmge_id& parent, const gmme_id& children );
99 
100  void remove_parent_children_relation(
101  const gmge_id& parent, const gmme_id& children );
102  void set_geological_entity_child(
103  const gmge_id& parent_gmge, index_t id, index_t child_id );
104 
105  void delete_geological_entity(
106  const GeologicalEntityType& type, index_t index );
107 
113  void build_contacts();
114 
115  protected:
117  GeoModel< DIMENSION >& geomodel );
118  ~GeoModelBuilderGeology() = default;
119 
120  private:
121  index_t create_geological_entity_type(
122  const GeologicalEntityType& type );
123 
124  index_t find_or_create_geological_entity_type(
125  const GeologicalEntityType& type );
126 
127  void copy_geological_entity_topology( const GeoModel< DIMENSION >& from,
128  const GeologicalEntityType& type );
129 
130  bool check_if_boundary_incident_entity_relation_already_exists(
131  const gmge_id& parent, const gmme_id& children );
132 
133  private:
137  };
138 } // namespace RINGMesh
#define ringmesh_disable_copy_and_move(Class)
Definition: common.h:76
Abstract base class for GeoModelMeshEntity.
The GeologicalEntityType described the type of the Geological entities User can defined there own Geo...
Definition: entity_type.h:137
Base class to build or edit a GeoModel.
GeoModelBuilder< DIMENSION > & builder_
#define ringmesh_template_assert_2d_or_3d(type)
Definition: common.h:80
GEOL_FEATURE
Geological feature types for GeoModelEntity.
GeoModelAccess< DIMENSION > geomodel_access_
#define ringmesh_assert(x)
This template is a specialization of a gme_id to the GeoModelGeologicalEntity.
Definition: entity_type.h:262
this class contains methods to manage relations between Geological and Mesh entities. For instance: A "Contact" can be the parent of one or more "Line" An "Interface" can the parent of one or more "Surface" A "Layer" can be the parent of one or more "Region"
Classes to build GeoModel from various inputs.
Definition: algorithm.h:48
void set_mesh_entity_parent(const gmme_id &child_gmme, index_t id, const gmge_id &parent_gmge)
This template is a specialization of a gme_id to the GeoModelMeshEntity.
Definition: entity_type.h:285
FORWARD_DECLARATION_DIMENSION_CLASS(GeoModelMeshEntityAccess)
void set_parent_to_parent_child_relationship(index_t relationship_id, const gmge_id &parent)