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 Total, S.A
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 // This forward declaration prevents from exposing the internals of the module,
35 // which are only accessed through some private functions signatures.
36 // In order to avoid this forward declaration, we could expose an ABC
37 // instead of exposing the MeshGeneratorBase implementation.
38 class CellBlockManager;
39 
46 {
47 public:
48 
54  explicit MeshGeneratorBase( string const & name,
55  Group * const parent );
56 
58  virtual void expandObjectCatalogs() override;
59 
62 
69  virtual Group * createChild( string const & childKey, string const & childName ) override;
70 
76 
82  void generateMesh( Group & parent, SpatialPartition & partition );
83 
87  enum struct Block
88  {
89  VOLUMIC,
90  SURFACIC,
91  LINEIC
92  };
93 
102  virtual void importFieldOnArray( Block block,
103  string const & blockName,
104  string const & meshFieldName,
105  bool isMaterialField,
106  dataRepository::WrapperBase & wrapper ) const = 0;
107 
114  virtual void freeResources() {}
115 
120  std::map< string, string > const & getVolumicFieldsMapping() const { return m_volumicFields; }
121 
126  std::map< string, string > const & getSurfacicFieldsMapping() const { return m_surfacicFields; }
127 
128 protected:
130  std::map< string, string > m_volumicFields;
131 
133  std::map< string, string > m_surfacicFields;
134 
135 private:
141  virtual void fillCellBlockManager( CellBlockManager & cellBlockManager, SpatialPartition & partition )
142  {
143  GEOS_UNUSED_VAR( cellBlockManager );
144  GEOS_UNUSED_VAR( partition );
145  GEOS_ERROR( "Cell mesh generation not implemented for generator of this type" );
146  }
147 
148  void attachWellInfo( CellBlockManager & cellBlockManager );
149 
156  virtual void fillParticleBlockManager( ParticleBlockManager & particleBlockManager, ParticleManager & particleManager, SpatialPartition const & partition )
157  {
158  GEOS_UNUSED_VAR( particleBlockManager );
159  GEOS_UNUSED_VAR( particleManager );
160  GEOS_UNUSED_VAR( partition );
161  GEOS_ERROR( "Particle mesh generation not implemented for generator of this type" );
162  }
163 
164 };
165 }
166 
167 #endif /* GEOS_MESH_GENERATORS_MESHGENERATORBASE_HPP */
#define GEOS_UNUSED_VAR(...)
Mark an unused variable and silence compiler warnings.
Definition: GeosxMacros.hpp:84
#define GEOS_ERROR(msg)
Raise a hard error and terminate the program.
Definition: Logger.hpp:157
The CellBlockManager class provides an interface to ObjectManagerBase in order to manage CellBlock da...
The MeshGeneratorBase class provides an abstract base class implementation for different mesh types....
std::map< string, string > m_volumicFields
Mapping from volumic field source to GEOS field.
static CatalogInterface::CatalogType & getCatalog()
Accessor for the singleton Catalog object.
std::map< string, string > const & getVolumicFieldsMapping() const
Get the name mapping between mesh volumic field names and internal GEOS volumic field names.
std::map< string, string > const & getSurfacicFieldsMapping() const
Get the name mapping between mesh surfacic field names and internal GEOS surfacic field names.
virtual void freeResources()
Free internal resources associated with mesh/data import.
virtual void expandObjectCatalogs() override
This function is used to expand any catalogs in the data structure.
std::map< string, string > m_surfacicFields
Mapping from surfacic field source to GEOS field.
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 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