RINGMesh  Version 5.0.0
A programming library for geological model meshes
geomodel_builder.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 
45 
51 namespace RINGMesh
52 {
53  FORWARD_DECLARATION_DIMENSION_CLASS( GeoModelBuilderBase );
54  FORWARD_DECLARATION_DIMENSION_CLASS( GeoModelBuilder );
55 } // namespace RINGMesh
56 
57 namespace RINGMesh
58 {
59  template < index_t DIMENSION >
60  class RINGMESH_API GeoModelBuilderInfo
61  {
64  friend class GeoModelBuilderBase< DIMENSION >;
65  friend class GeoModelBuilder< DIMENSION >;
66 
67  public:
71  void set_geomodel_name( const std::string& name )
72  {
73  geomodel_access_.modifiable_name() = name;
74  }
75 
80  const gmme_id& gmme_id, const std::string& name )
81  {
83  geomodel_access_.modifiable_mesh_entity( gmme_id ) );
84  gmme_access.modifiable_name() = name;
85  }
86 
91  const gmge_id& gmge_id, const std::string& name )
92  {
94  geomodel_access_.modifiable_geological_entity( gmge_id ) );
95  gmge_access.modifiable_name() = name;
96  }
97 
98  protected:
100  GeoModel< DIMENSION >& geomodel );
101  ~GeoModelBuilderInfo() = default;
102 
103  private:
107  };
108 
109  template < index_t DIMENSION >
110  class RINGMESH_API GeoModelBuilderCopy
111  {
114  friend class GeoModelBuilderBase< DIMENSION >;
115  friend class GeoModelBuilder< DIMENSION >;
116 
117  public:
118  void copy_geomodel( const GeoModel< DIMENSION >& from );
119 
120  private:
122  GeoModel< DIMENSION >& geomodel );
123  ~GeoModelBuilderCopy() = default;
124 
125  private:
129  };
130 
138  template < index_t DIMENSION >
139  class RINGMESH_API GeoModelBuilderBase
140  {
143 
144  public:
145  virtual ~GeoModelBuilderBase() = default;
146 
150  void end_geomodel();
151 
152  void build_corners_from_lines();
153 
154  void build_lines_and_corners_from_surfaces();
155 
156  protected:
158  GeoModel< DIMENSION >& geomodel );
159 
160  void cut_geomodel_on_internal_boundaries();
161 
162  public:
170 
171  protected:
174  };
175 
176  template < index_t DIMENSION >
177  class RINGMESH_API GeoModelBuilder : public GeoModelBuilderBase< DIMENSION >
178  {
179  };
180 
181  template <>
182  class RINGMESH_API GeoModelBuilder< 2 > : public GeoModelBuilderBase< 2 >
183  {
184  public:
185  explicit GeoModelBuilder( GeoModel2D& geomodel );
186  };
187 
188  template <>
189  class RINGMESH_API GeoModelBuilder< 3 > : public GeoModelBuilderBase< 3 >
190  {
191  public:
192  explicit GeoModelBuilder( GeoModel3D& geomodel );
193 
194  void build_regions_from_lines_and_surfaces();
195  };
196 
197  ALIAS_2D_AND_3D( GeoModelBuilder );
198 } // namespace RINGMesh
#define ringmesh_disable_copy_and_move(Class)
Definition: common.h:76
GeoModel< DIMENSION > & geomodel_
GeoModelBuilderGeometry< DIMENSION > geometry
Base class to build or edit a GeoModel.
GeoModelBuilderTopology< DIMENSION > topology
GeoModel< DIMENSION > & geomodel_
GeoModel< DIMENSION > & geomodel_
#define ringmesh_template_assert_2d_or_3d(type)
Definition: common.h:80
GeoModelAccess< DIMENSION > geomodel_access_
ALIAS_2D_AND_3D(Box)
GeoModelBuilder< DIMENSION > & builder_
GeoModelBuilderCopy< DIMENSION > copy
GeoModelBuilder< DIMENSION > & builder_
GeoModelBuilderRemoval< DIMENSION > removal
void set_geological_entity_name(const gmge_id &gmge_id, const std::string &name)
Set the name of a geomodel geological entity.
GeoModelAccess< DIMENSION > geomodel_access_
GeoModelBuilderGeology< DIMENSION > geology
GeoModelAccess< DIMENSION > geomodel_access_
GeoModelBuilderRepair< DIMENSION > repair
GeoModelBuilderInfo< DIMENSION > info
This template is a specialization of a gme_id to the GeoModelGeologicalEntity.
Definition: entity_type.h:262
Classes to build GeoModel from various inputs.
Definition: algorithm.h:48
void set_mesh_entity_name(const gmme_id &gmme_id, const std::string &name)
Set the name of a geomodel mesh entity.
Try repairing a supposedly invalid GeoModel.
void set_geomodel_name(const std::string &name)
Set the name of the geomodel.
This template is a specialization of a gme_id to the GeoModelMeshEntity.
Definition: entity_type.h:285
FORWARD_DECLARATION_DIMENSION_CLASS(GeoModelMeshEntityAccess)