GEOS
MeshGeneratorBase.hpp
Go to the documentation of this file.
1 /*
2  * ------------------------------------------------------------------------------------------------------------
3  * SPDX-License-Identifier: LGPL-2.1-only
4  *
5  * Copyright (c) 2016-2024 Lawrence Livermore National Security LLC
6  * Copyright (c) 2018-2024 TotalEnergies
7  * Copyright (c) 2018-2024 The Board of Trustees of the Leland Stanford Junior University
8  * Copyright (c) 2023-2024 Chevron
9  * Copyright (c) 2019- GEOS/GEOSX Contributors
10  * All rights reserved
11  *
12  * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details.
13  * ------------------------------------------------------------------------------------------------------------
14  */
15 
20 #ifndef GEOS_MESH_GENERATORS_MESHGENERATORBASE_HPP
21 #define GEOS_MESH_GENERATORS_MESHGENERATORBASE_HPP
22 
23 #include "mesh/mpiCommunications/SpatialPartition.hpp"
24 
25 #include "dataRepository/Group.hpp"
27 #include "codingUtilities/Utilities.hpp"
28 #include "common/DataTypes.hpp"
29 
30 
31 namespace geos
32 {
33 
34 // Forward declarations
35 class CellBlockManager;
36 class NodeManager;
37 class EdgeManager;
38 class FaceManager;
39 class ElementRegionManager;
40 
54  EdgeManager const & edgeManager,
55  FaceManager const & faceManager,
56  ElementRegionManager const & elemManager );
57 
64 {
65 public:
66 
72  explicit MeshGeneratorBase( string const & name,
73  Group * const parent );
74 
76  virtual void expandObjectCatalogs() override;
77 
80 
87  virtual Group * createChild( string const & childKey, string const & childName ) override;
88 
94 
100  void generateMesh( Group & parent, SpatialPartition & partition );
101 
105  enum struct Block
106  {
107  VOLUMIC,
108  SURFACIC,
109  LINEIC
110  };
111 
120  virtual void importFieldOnArray( Block block,
121  string const & blockName,
122  string const & meshFieldName,
123  bool isMaterialField,
124  dataRepository::WrapperBase & wrapper ) const = 0;
125 
132  virtual void freeResources() {}
133 
139 
145 
148  {
153  constexpr static char const * checkEulerCharacteristicString() { return "checkEulerCharacteristic"; }
154  };
155 
158 
159 protected:
162 
165 
166 private:
172  virtual void fillCellBlockManager( CellBlockManager & cellBlockManager, SpatialPartition & partition )
173  {
174  GEOS_UNUSED_VAR( cellBlockManager );
175  GEOS_UNUSED_VAR( partition );
176  GEOS_ERROR( "Cell mesh generation not implemented for generator of this type" );
177  }
178 
179  void attachWellInfo( CellBlockManager & cellBlockManager );
180 
187  virtual void fillParticleBlockManager( ParticleBlockManager & particleBlockManager, ParticleManager & particleManager, SpatialPartition const & partition )
188  {
189  GEOS_UNUSED_VAR( particleBlockManager );
190  GEOS_UNUSED_VAR( particleManager );
191  GEOS_UNUSED_VAR( partition );
192  GEOS_ERROR( "Particle mesh generation not implemented for generator of this type" );
193  }
194 
195 };
196 }
197 
198 #endif /* GEOS_MESH_GENERATORS_MESHGENERATORBASE_HPP */
#define GEOS_UNUSED_VAR(...)
Mark an unused variable and silence compiler warnings.
#define GEOS_ERROR(...)
Raise a hard error and terminate the program.
Definition: Logger.hpp:226
The CellBlockManager class provides an interface to ObjectManagerBase in order to manage CellBlock da...
This class provides an interface to ObjectManagerBase in order to manage edge data.
Definition: EdgeManager.hpp:43
The ElementRegionManager class provides an interface to ObjectManagerBase in order to manage ElementR...
The FaceManager class provides an interface to ObjectManagerBase in order to manage face data.
Definition: FaceManager.hpp:44
The MeshGeneratorBase class provides an abstract base class implementation for different mesh types....
static CatalogInterface::CatalogType & getCatalog()
Accessor for the singleton Catalog object.
stdMap< string, string > const & getSurfacicFieldsMapping() const
Get the name mapping between mesh surfacic field names and internal GEOS surfacic field names.
stdMap< string, string > m_volumicFields
Mapping from volumic field source to GEOS field.
virtual void freeResources()
Free internal resources associated with mesh/data import.
stdMap< string, string > const & getVolumicFieldsMapping() const
Get the name mapping between mesh volumic field names and internal GEOS volumic field names.
stdMap< string, string > m_surfacicFields
Mapping from surfacic field source to GEOS field.
integer m_checkEulerCharacteristic
When non-zero, compute χ = V − E + F − C after mesh loading and warn if χ ≠ 1.
virtual void expandObjectCatalogs() override
This function is used to expand any catalogs in the data structure.
Block
Describe which kind of block must be considered.
void generateMesh(Group &parent, SpatialPartition &partition)
Generate the mesh object the input mesh object.
virtual void importFieldOnArray(Block block, string const &blockName, string const &meshFieldName, bool isMaterialField, dataRepository::WrapperBase &wrapper) const =0
import field from the mesh on the array accessible via the given wrapper.
MeshGeneratorBase(string const &name, Group *const parent)
Main constructor for MeshGenerator base class.
virtual Group * createChild(string const &childKey, string const &childName) override
Create a new geometric object (box, plane, etc) as a child of this group.
The NodeManager class provides an interface to ObjectManagerBase in order to manage node data.
Definition: NodeManager.hpp:46
The ParticleBlockManager class provides an interface to ObjectManagerBase in order to manage Particle...
The ParticleManager class provides an interface to ObjectManagerBase in order to manage ParticleRegio...
This class provides the base class/interface for the catalog value objects.
std::unordered_map< std::string, std::unique_ptr< CatalogInterface< BASETYPE, ARGS... > > > CatalogType
This is the type that will be used for the catalog. The catalog is actually instantiated in the BASET...
Base class for all wrappers containing common operations.
Definition: WrapperBase.hpp:56
internal::StdMapWrapper< std::map< Key, T, Compare, Allocator >, USE_STD_CONTAINER_BOUNDS_CHECKING > stdMap
integer computeEulerCharacteristic(NodeManager const &nodeManager, EdgeManager const &edgeManager, FaceManager const &faceManager, ElementRegionManager const &elemManager)
Compute the Euler-Poincaré characteristic χ = V − E + F − C for the bulk mesh.
int integer
Signed integer type.
Definition: DataTypes.hpp:81
Key for the checkEulerCharacteristic XML attribute.
constexpr static char const * checkEulerCharacteristicString()
Get the XML attribute name for the Euler characteristic check flag.