RINGMesh  Version 5.0.0
A programming library for geological model meshes
stratigraphic_column.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 
40 #include <string>
41 #include <vector>
42 
51 namespace RINGMesh
52 {
55 
56  ALIAS_3D( Interface );
57  ALIAS_3D( Layer );
58 } // namespace RINGMesh
59 
60 namespace RINGMesh
61 {
62  // @todo To develop
63  enum struct ROCKTYPE
64  {
65  NONE,
66  MULTIPLE
67  };
68 
73  class RINGMESH_API RockFeature
74  {
75  public:
81  RockFeature( std::string name, ROCKTYPE type )
82  : name_( std::move( name ) ), type_( type )
83  {
84  }
89  explicit RockFeature( std::string name )
90  : RockFeature( std::move( name ), ROCKTYPE::NONE )
91  {
92  }
93 
97  const std::string& get_name() const
98  {
99  return name_;
100  }
101  void set_name( const std::string& name )
102  {
103  name_ = name;
104  }
105 
106  const ROCKTYPE& get_rock_type() const
107  {
108  return type_;
109  }
110 
111  void set_rock_type( ROCKTYPE type )
112  {
113  type_ = type;
114  }
115 
116  private:
117  std::string name_{};
119  };
120 
121  enum struct RELATION
122  {
123  CONFORMABLE = 0,
124  ERODED = 10,
125  TRUNCATION = 11,
126  TOPLAP = 12,
127  BASELAP = 20,
128  ONLAP = 21,
129  DOWNLAP = 22
130  };
131 
139  class RINGMESH_API StratigraphicUnit
140  {
142 
143  public:
159  StratigraphicUnit( std::string name, RockFeature rock );
160 
161  virtual ~StratigraphicUnit() = default;
162 
163  virtual const std::string& get_name() const
164  {
165  return name_;
166  }
174  void set_rock_feature( const RockFeature& rock_feature )
175  {
176  rock_ = rock_feature;
177  }
178 
180  {
181  return rock_;
182  }
183 
184  virtual bool is_conformable_base() const = 0;
185  virtual bool is_conformable_top() const = 0;
186  virtual RELATION get_relation_base() const = 0;
187  virtual RELATION get_relation_top() const = 0;
188  virtual const Interface3D& get_interface_base() const = 0;
189  virtual const Interface3D& get_interface_top() const = 0;
190  virtual double get_min_thick() const = 0;
191  virtual double get_max_thick() const = 0;
192 
193  protected:
198 
199  protected:
200  std::string name_{};
202  };
203 
205  {
206  public:
207  UnsubdividedStratigraphicUnit( std::string name,
208  const Interface3D& interface_base,
209  const Interface3D& interface_top,
210  const Layer3D& layer,
211  RELATION relation_top,
212  RELATION relation_base,
213  RockFeature rock,
214  double min_thick,
215  double max_thick );
216 
217  bool is_conformable_base() const final
218  {
219  return ( relation_base_ == RELATION::CONFORMABLE );
220  }
221 
222  bool is_conformable_top() const final
223  {
224  return ( relation_top_ == RELATION::CONFORMABLE );
225  }
226 
228  {
229  return relation_base_;
230  }
231 
233  {
234  return relation_top_;
235  }
236 
237  const Interface3D& get_interface_base() const final
238  {
239  return *interface_base_;
240  }
241 
242  const Interface3D& get_interface_top() const final
243  {
244  return *interface_top_;
245  }
246 
247  double get_min_thick() const final
248  {
249  return min_thick_;
250  }
251 
252  double get_max_thick() const final
253  {
254  return max_thick_;
255  }
256 
257  private:
258  const Interface3D* interface_top_;
259  const Interface3D* interface_base_;
260  const Layer3D* layer_;
263  double min_thick_;
264  double max_thick_;
265  };
266 
267  class RINGMESH_API SubdividedStratigraphicUnit : public StratigraphicUnit
268  {
269  public:
270  SubdividedStratigraphicUnit( std::string name,
271  RockFeature rock,
272  const std::vector< const StratigraphicUnit* >& sub_units )
273  : StratigraphicUnit( std::move( name ), std::move( rock ) ),
274  units_( sub_units )
275  {
276  }
277 
278  bool is_conformable_base() const final
279  {
280  return ( units_.back()->is_conformable_base() );
281  }
282 
283  bool is_conformable_top() const final
284  {
285  return ( units_.front()->is_conformable_top() );
286  }
287 
289  {
290  return units_.back()->get_relation_base();
291  }
292 
294  {
295  return units_.front()->get_relation_top();
296  }
297 
298  const Interface3D& get_interface_base() const final
299  {
300  return units_.back()->get_interface_base();
301  }
302 
303  const Interface3D& get_interface_top() const final
304  {
305  return units_.front()->get_interface_top();
306  }
307 
308  double get_min_thick() const final
309  {
310  double sum_min_thick = 0.;
311  for( auto unit : units_ )
312  {
313  sum_min_thick += unit->get_min_thick();
314  }
315  return sum_min_thick;
316  }
317 
318  double get_max_thick() const final
319  {
320  double sum_max_thick = 0.;
321  for( auto unit : units_ )
322  {
323  sum_max_thick += unit->get_max_thick();
324  }
325  return sum_max_thick;
326  }
327 
328  private:
329  std::vector< const StratigraphicUnit* > units_{};
330  };
331 
333  {
338  };
339 
343  class RINGMESH_API StratigraphicColumn
344  {
345  public:
354  StratigraphicColumn( std::string name,
355  const std::vector< const StratigraphicUnit* >& units,
357  : name_( std::move( name ) ), units_( units ), type_( type )
358  {
359  }
360 
366  std::string name, const STRATIGRAPHIC_PARADIGM type )
367  : StratigraphicColumn( std::move( name ), {}, type )
368  {
369  }
370 
380  void insert_unit_below( const StratigraphicUnit& above,
381  const StratigraphicUnit& unit_to_add );
385  void insert_top_unit( const StratigraphicUnit& to_add );
389  void insert_base_unit( const StratigraphicUnit& to_add );
390 
391  void remove_unit( const StratigraphicUnit& unit );
392 
402  {
403  return units_.front();
404  }
405 
410  {
411  return units_.back();
412  }
413 
420  const StratigraphicUnit* get_unit_above(
421  const StratigraphicUnit& unit ) const;
428  const StratigraphicUnit* get_unit_below(
429  const StratigraphicUnit& unit ) const;
430 
431  const StratigraphicUnit* get_unit( const index_t index ) const
432  {
433  return units_[index];
434  }
435 
436  const StratigraphicUnit* get_unit( const std::string& name ) const;
437 
441  const std::vector< const StratigraphicUnit* >& get_all_units() const
442  {
443  return units_;
444  }
445 
452  {
453  return type_;
454  }
455 
461  bool is_conformable_base() const
462  {
463  return ( units_.back()->is_conformable_base() );
464  }
470  bool is_conformable_top() const
471  {
472  return ( units_.front()->is_conformable_top() );
473  }
474 
481  {
482  return ( units_.back()->get_relation_base() );
483  }
490  {
491  return ( units_.front()->get_relation_top() );
492  }
493 
499  const Interface3D& get_interface_base() const
500  {
501  return ( units_.back()->get_interface_base() );
502  }
508  const Interface3D& get_interface_top() const
509  {
510  return ( units_.front()->get_interface_top() );
511  }
512 
516  double get_column_min_thick() const;
520  double get_column_max_thick() const;
521 
522  const std::string& get_name() const
523  {
524  return name_;
525  }
526 
530  private:
535  index_t get_index( const std::string& unit_name ) const;
536 
537  private:
538  std::string name_{};
539  std::vector< const StratigraphicUnit* > units_{};
541  };
542 } // namespace RINGMesh
#define ringmesh_disable_copy_and_move(Class)
Definition: common.h:76
const StratigraphicUnit * get_base_unit() const
RELATION get_relation_base()
get_relation_base for the Stratigraphic Column
const Interface3D & get_interface_top() const final
RELATION get_relation_top()
get_relation_top for the Stratigraphic Column
RockFeature(std::string name)
Simple constructor of RockFeature.
SubdividedStratigraphicUnit(std::string name, RockFeature rock, const std::vector< const StratigraphicUnit * > &sub_units)
Manages the RockFeature, which contains a RockType and more informations.
const std::vector< const StratigraphicUnit *> & get_all_units() const
const StratigraphicUnit * get_unit(const index_t index) const
StratigraphicColumn(std::string name, const std::vector< const StratigraphicUnit * > &units, STRATIGRAPHIC_PARADIGM type)
Complete constructor of StratigraphicColumn.
void set_name(const std::string &name)
ALIAS_3D(GeoModel)
const Interface3D & get_interface_base() const final
const Interface3D & get_interface_top() const
get_interface_top for the Stratigraphic Column
virtual const std::string & get_name() const
const Interface3D & get_interface_base() const final
Representing Stratigraphic Units Each Unit has a name, two delimiting interfaces with two correspondi...
const std::string & get_name() const
void set_rock_feature(const RockFeature &rock_feature)
A stratigraphic column is composed of several stratigraphic units.
RockFeature(std::string name, ROCKTYPE type)
Complete constructor of a RockFeature.
const ROCKTYPE & get_rock_type() const
const RockFeature & get_rock_feature() const
void set_rock_type(ROCKTYPE type)
bool is_conformable_base() const
is_conformable_base for the Stratigraphic Column
const std::string & get_name() const
bool is_conformable_top() const
is_conformable_top for the Stratigraphic Column
Classes to build GeoModel from various inputs.
Definition: algorithm.h:48
STRATIGRAPHIC_PARADIGM get_paradigm() const
FORWARD_DECLARATION_DIMENSION_CLASS(GeoModelMeshEntityAccess)
const StratigraphicUnit * get_top_unit() const
const Interface3D & get_interface_top() const final
const Interface3D & get_interface_base() const
get_interface_base for the Stratigraphic Column
StratigraphicColumn(std::string name, const STRATIGRAPHIC_PARADIGM type)
Simple Constructor of StratigraphicColumn.