7#ifndef STRUCTUREDGRID_H
8#define STRUCTUREDGRID_H
268 return origin + incI + incJ *
m_nPoints[1];
365 std::array<MInt, nDim> result{};
366 std::fill_n(result.begin(), nDim, plus);
371 std::array<MInt, nDim> result{};
372 std::fill_n(result.begin(), nDim, plus);
377 std::array<MInt, nDim> result{};
378 for(
MInt i = 0; i < nDim; ++i) {
379 result[i] =
m_nCells[nDim - 1 - i] - minus;
385 std::array<MInt, nDim> result{};
386 for(
MInt i = 0; i < nDim; ++i) {
387 result[i] =
m_nPoints[nDim - 1 - i] - minus;
MBool m_readDecompositionFromFile
MInt noDomains() const
Return the total number of domains (total number of ranks in current MPI communicator)
void setCells(StructuredCell *cells)
void gridDecomposition(MBool)
Create decomposition of the grid into partitions for MPI parallelization.
void computeCellJacobian()
void computeMetrics()
Computes all metrics by calling the functions for each type of metric computation (cell,...
void extrapolateGhostPointCoordinates()
std::array< MInt, nDim > cellEnd(const MInt minus)
MFloat ** m_oldCoordinates
SingularInformation * m_singularity
void saveCellJacobian()
Copies the current state of the cell Jacobians to m_cells->oldCellJacobian.
MInt domainId() const
Return the domainId (rank)
MInt pointIndex(const MInt i, const MInt j, const MInt k)
Compute point ID for given (i,j,k)
void periodicPointsChange(MFloat &, const MInt, const MInt)
Displaces the points on periodic boundaries by the distance between the two periodic boundaries.
MInt getPointIdFromCell(const MInt i, const MInt j)
Compute the lower point id for cell (i,j)
std::unique_ptr< StructuredDecomposition< nDim > > m_partition
MInt getPointIdFromPoint(const MInt origin, const MInt incI, const MInt incJ, const MInt incK)
Compute the point id of the point that has the offset (incI, inJ, incK) to the given point origin.
void exchangePoints(std::vector< std::unique_ptr< StructuredComm< nDim > > > &, std::vector< std::unique_ptr< StructuredComm< nDim > > > &, StructuredCommType)
Exchanges the boundary grid points between MPI partitions.
MFloat ** m_initCoordinates
constexpr MInt solverId() const
Return the solver id to which this grid belongs.
void writeGrid(MString, MString)
Writes the current grid (including deformations for moving grids) to a file.
MInt getMyBlockNoPoints(MInt dim)
Returns the number of total block points in the given dimension for the own block.
MInt cellIndex(const MInt i, const MInt j)
Compute cell ID for given (i,j)
void computeCornerMetrics()
void computeModCornerJacobian()
void computeCornerJacobian()
void computeCellMetrics()
MInt getPointIdFromPoint(const MInt origin, const MInt incI, const MInt incJ)
Compute the point id of the point that has the offset (incI, inJ) to the given point origin.
MInt getBlockId(MInt domainId_)
Returns the block id of the block in which the given domain is located.
std::array< MInt, nDim > pointBegin(const MInt plus)
MInt surfId(const MInt point, const MInt isd, const MInt dim)
~StructuredGrid()
Destructor of the structured grid class.
void readGrid()
Reads in the coordinates (x,y,z) from the grid file.
MInt getCellIdFromCell(MInt origin, MInt incI, MInt incJ)
Compute the cell id of the cell that has the offset (incI, inJ) to the given cell origin.
MInt getActivePoints(MInt domainId_, MInt dim)
Returns the number of active points in the given dimension (without ghost-cells) of the given domain ...
void computeJacobian()
Computes the Jacobians by calling the functions for each type of Jacobian computation (corner,...
MInt getMyBlockId()
Returns the block id of the block in which the own domain.
MInt getMyBlockNoCells(MInt dim)
Returns the number of total block cells in the given dimension for the own block.
MInt pointIndex(const MInt i, const MInt j)
Compute point ID for given (i,j)
void sendPoints(std::vector< std::unique_ptr< StructuredComm< nDim > > > &, StructuredCommType, std::vector< MPI_Request > &)
Send the coordinates between partitions to other partitions.
MInt getMyOffset(MInt dim)
Returns the offset in the given dimension of the own domain inside the block.
MInt getPointIdFromCell(const MInt i, const MInt j, const MInt k)
Compute the lower point id for cell (i,j,k)
void computeDxt(MFloat, MFloat *, MInt)
void computeModCornerMetrics()
MFloat * m_periodicDisplacements
void computeSurfaceJacobian()
void setCellReference(StructuredCell *)
Sets the reference to the cell object.
void writePartitionedGrid()
Saves coordinates for partitioned grid with ghost points. Useful for debugging.
MInt getMyActivePoints(MInt dim)
Returns the number of active points in the given dimension (without ghost-cells) of the own domain.
MInt getBlockNoPoints(MInt blockId_, MInt dim)
Returns the number of total block points in the given dimension for the given block id.
std::array< MInt, nDim > pointEnd(const MInt minus)
void computeSurfaceMetricsSingularity()
Computes the surface metrics for the cell surfaces at the surface centroids (2D) Special version for ...
MString m_gridInputFileName
void computeCellCenterCoordinates()
void scatterPoints(std::vector< std::unique_ptr< StructuredComm< nDim > > > &, StructuredCommType)
Distributes the exchanged points from the receiving buffers to the actual coordinates of the grid.
void gatherPoints(std::vector< std::unique_ptr< StructuredComm< nDim > > > &, StructuredCommType)
Gathers the coordinates of the points for all given sending maps and copies them to a sending buffer.
MInt getNoBlocks()
Returns the total number of blocks.
void prepareReadGrid()
Prepares the arrays containing the size of the grid (points/cells) before the grid coordinates are ac...
MInt getBlockNoCells(MInt blockId_, MInt dim)
Returns the number of total block cells in the given dimension for the given block id.
MInt getOffset(MInt domainId_, MInt dim)
Returns the offset in the given dimension inside the block of the own domain.
constexpr MPI_Comm mpiComm() const
Return the MPI communicator used by this grid.
void allocateMetricsAndJacobians()
Allocates memory for the metrics and the Jacobians.
std::array< MInt, nDim > cellBegin(const MInt plus)
MInt getCellIdFromCell(const MInt origin, const MInt incI, const MInt incJ, const MInt incK)
Compute the cell id of the cell that has the offset (incI, inJ, incK) to the given cell origin.
void crossProduct(MFloat *result, MFloat *vec1, MFloat *vec2)
Computes the 3D cross product.
MInt cellIndex(const MInt i, const MInt j, const MInt k)
Compute cell ID for given (i,j,k)
void receivePoints(std::vector< std::unique_ptr< StructuredComm< nDim > > > &, StructuredCommType, std::vector< MPI_Request > &)
Receives the coordinates between partitions to other partitions.
MFloat crossProduct(MFloat vec1[2], MFloat vec2[2])
Computes the 2D cross product.
void computeSurfaceMetrics()
MInt getGridMovingMethod()
std::basic_string< char > MString