20 #ifndef GEOS_MESH_GENERATORS_INTERNALMESHGENERATOR_HPP
21 #define GEOS_MESH_GENERATORS_INTERNALMESHGENERATOR_HPP
26 #include "mesh/mpiCommunications/SpatialPartition.hpp"
57 string const & blockName,
58 string const & meshFieldName,
111 integer const ( &numNodesInDir )[3],
112 int const ( &firstElemIndexInPartition )[3],
115 GEOS_UNUSED_VAR( globalIJK, numNodesInDir, firstElemIndexInPartition, nodeOfBox );
127 int const (&globalIJK)[3],
128 integer const (&numNodesInDir)[3],
129 int const (&firstElemIndexInPartition)[3],
149 constexpr
static char const * xCoordsString() {
return "xCoords"; }
150 constexpr
static char const * yCoordsString() {
return "yCoords"; }
151 constexpr
static char const * zCoordsString() {
return "zCoords"; }
152 constexpr
static char const * xElemsString() {
return "nx"; }
153 constexpr
static char const * yElemsString() {
return "ny"; }
154 constexpr
static char const * zElemsString() {
return "nz"; }
155 constexpr
static char const * xBiasString() {
return "xBias"; }
156 constexpr
static char const * yBiasString() {
return "yBias"; }
157 constexpr
static char const * zBiasString() {
return "zBias"; }
158 constexpr
static char const * cellBlockNamesString() {
return "cellBlockNames"; }
159 constexpr
static char const * elementTypesString() {
return "elementTypes"; }
160 constexpr
static char const * trianglePatternString() {
return "trianglePattern"; }
161 constexpr
static char const * meshTypeString() {
return "meshType"; }
162 constexpr
static char const * positionToleranceString() {
return "positionTolerance"; }
251 int m_trianglePattern;
263 real64 m_skewCenter[3] = { 0, 0, 0 };
267 virtual void fillCellBlockManager(
CellBlockManager & cellBlockManager, SpatialPartition & partition )
override;
273 inline globalIndex nodeGlobalIndex(
int const index[3] )
275 return index[0] + index[1]*(m_numElemsTotal[0]+1) + index[2]*(m_numElemsTotal[0]+1)*(m_numElemsTotal[1]+1);
282 inline globalIndex elemGlobalIndex(
int const index[3] )
284 return index[0] + index[1]*m_numElemsTotal[0] + index[2]*m_numElemsTotal[0]*m_numElemsTotal[1];
296 template<
typename OUT_VECTOR >
297 inline void getNodePosition(
int const (&a)[3],
int trianglePattern, OUT_VECTOR && X )
302 if( trianglePattern == 1 )
304 int startingIndex = 0;
307 for( block=0; block<
m_nElems[0].size(); ++block )
309 startingIndex = endingIndex;
310 endingIndex = startingIndex +
m_nElems[0][block];
312 xPosIndex = endingIndex;
315 for(
int i=0; i<3; ++i )
324 int startingIndex = 0;
327 for( block=0; block<
m_nElems[i].size(); ++block )
329 startingIndex = endingIndex;
330 endingIndex = startingIndex +
m_nElems[i][block];
331 if( a[i]>=startingIndex && a[i]<=endingIndex )
340 X[i] = min + (max-min) * (
double( a[i] - startingIndex ) /
m_nElems[i][block] );
351 i == 1 ? viewKeyStruct::yBiasString() :
352 viewKeyStruct::zBiasString() ) <<
353 ", block index = " << block <<
" : Mesh bias must between -1 and 1!" );
357 real64 x0 = xmean * double( a[i] - startingIndex );
359 real64 dx = -x0*chi + x0*x0*chi/len;
365 if( i==0 ) xInterval = (max-min) /
m_nElems[i][block];
366 if( trianglePattern == 1 && i == 1 && a[1] % 2 == 1 && a[0] != 0 && a[0] != xPosIndex )
367 X[0] -= xInterval * 0.5;
378 template<
typename OUT_VECTOR >
379 inline void getElemCenterPosition(
int const k[3], OUT_VECTOR && X )
381 for(
int i=0; i<3; ++i )
383 X[i] =
m_min[i] + (
m_max[i]-
m_min[i]) * ( ( k[i] + 0.5 ) / m_numElemsTotal[i] );
#define GEOS_UNUSED_VAR(...)
Mark an unused variable and silence compiler warnings.
#define GEOS_ERROR_IF(EXP, msg)
Conditionally raise a hard error and terminate the program.
The CellBlockManager class provides an interface to ObjectManagerBase in order to manage CellBlock da...
The InternalMeshGenerator class is a class handling GEOSX generated meshes.
real64 m_max[3]
Maximum extent of mesh dimensions.
void postInputInitialization() override
array1d< integer > m_nElems[3]
Ndim x nElem spatialized for element indexes.
int m_dim
Mesh number of dimension.
static string catalogName()
Return the name of the InternalMeshGenerator in object Catalog.
virtual void coordinateTransformation(arrayView2d< real64, nodes::REFERENCE_POSITION_USD > X, std::map< string, SortedArray< localIndex > > &nodeSets)
Performs a coordinate transformation of all nodes.
void setConnectivityForPeriodicBoundary(int const component, int const (&globalIJK)[3], integer const (&numNodesInDir)[3], int const (&firstElemIndexInPartition)[3], localIndex(&nodeOfBox)[8])
Alter connectivity to adhere to a periodic type boundary.
real64 m_min[3]
Minimum extent of mesh dimensions.
virtual bool isCartesian() const
InternalMeshGenerator(const string &name, Group *const parent)
Main constructor for InternalMeshGenerator.
virtual void setConnectivityForPeriodicBoundaries(int(&globalIJK)[3], integer const (&numNodesInDir)[3], int const (&firstElemIndexInPartition)[3], localIndex(&nodeOfBox)[8])
Alter connectivity to adhere to a specific periodic type boundary.
array1d< real64 > m_nElemBias[3]
Ndim x nElem spatialized array of element bias.
void importFieldOnArray(Block block, string const &blockName, string const &meshFieldName, bool isMaterialField, dataRepository::WrapperBase &wrapper) const override
import field from the mesh on the array accessible via the given wrapper.
virtual void reduceNumNodesForPeriodicBoundary(SpatialPartition &partition, integer(&numNodes)[3])
Reduce the number of nodes in a block coordinate direction for.
real64 m_coordinatePrecision
Position tolerance for adding nodes to nodesets.
virtual void setNodeGlobalIndicesOnPeriodicBoundary(SpatialPartition &partition, int(&index)[3])
Alter the directional indices for when the ending index should be set to the beginning of the index a...
array1d< real64 > m_vertices[3]
Array of vertex coordinates.
array1d< real64 > m_setCoords[3]
The MeshGeneratorBase class provides an abstract base class implementation for different mesh types....
Block
Describe which kind of block must be considered.
localIndex size() const
Get the "size" of the group, which determines the number of elements in resizable wrappers.
DataContext const & getWrapperDataContext(KEY key) const
Base class for all wrappers containing common operations.
GEOS_GLOBALINDEX_TYPE globalIndex
Global index type (for indexing objects across MPI partitions).
double real64
64-bit floating point type.
GEOS_LOCALINDEX_TYPE localIndex
Local index type (for indexing objects within an MPI partition).
std::int32_t integer
Signed integer type.
mapBase< TKEY, TVAL, std::integral_constant< bool, true > > map
Ordered map type.
LvArray::SortedArray< T, localIndex, LvArray::ChaiBuffer > SortedArray
A sorted array of local indices.
ArrayView< T, 2, USD > arrayView2d
Alias for 2D array view.
Array< T, 1 > array1d
Alias for 1D array.