MAIA bb96820c
Multiphysics at AIA
Loading...
Searching...
No Matches
PostData< nDim_ > Class Template Reference

#include <postdata.h>

Inheritance diagram for PostData< nDim_ >:
[legend]
Collaboration diagram for PostData< nDim_ >:
[legend]

Public Types

using CartesianSolver = typename maia::CartesianSolver< nDim, PostData >
 
using Grid = typename CartesianSolver::Grid
 
using GridProxy = typename CartesianSolver::GridProxy
 
using SolverCell = PostCell
 
using Cell = typename maia::grid::tree::Tree< nDim >::Cell
 
using Geom = Geometry< nDim >
 
- Public Types inherited from maia::CartesianSolver< nDim_, PostData< nDim_ > >
using Grid = CartesianGrid< nDim >
 
using GridProxy = typename maia::grid::Proxy< nDim >
 
using Geom = Geometry< nDim >
 
using TreeProxy = maia::grid::tree::TreeProxy< nDim >
 
using Cell = maia::grid::tree::Cell
 

Public Member Functions

 PostData (MInt, GridProxy &gridProxy_, Geom &geometry_, const MPI_Comm comm)
 
 ~PostData ()
 
Geomgeometry () const
 Access the solver's geometry. More...
 
MInt noInternalCells () const override
 Return the number of internal cells within this solver. More...
 
MFloat timeStep () const
 
MFloat time () const override
 Return the time. More...
 
void preTimeStep () override
 
void postTimeStep () override
 
MBool solutionStep () override
 
void initSolver () override
 
void finalizeInitSolver () override
 
MBool prepareRestart (MBool, MBool &) override
 Prepare the solvers for a grid-restart. More...
 
void writeRestartFile (const MBool, const MBool, const MString, MInt *) override
 
void writeRestartFile (MBool) override
 
void saveDataFile (const MBool writeBackup, const MString fileName, const MInt noVars, std::vector< MString > &variablesName, MFloat *variables)
 
void saveRestartFile (const MBool writeBackup)
 
void loadRestartFile ()
 
void loadMeanFile (const MString fileName)
 load a file for averaging More...
 
void loadGridFlowVars (const MChar *fileName, MInt noVariables, std::vector< MString > name)
 This function reads the parallel Netcdf cartesian grid cell based solution/restart file currently used in postData! More...
 
void saveSolverSolution (const MBool, const MBool)
 
void reIntAfterRestart (MBool)
 This function resets the grid-trigger after a restart that is handled by the grid-controller! More...
 
void prepareAdaptation () override
 prepare solver adaptation More...
 
void postAdaptation () override
 reinit the solver after a single adaptation step More...
 
void finalizeAdaptation () override
 reinit the solver after the full adaptation loop! More...
 
void setSensors (std::vector< std::vector< MFloat > > &sensors, std::vector< MFloat > &sensorWeight, std::vector< std::bitset< 64 > > &sensorCellFlag, std::vector< MInt > &sensorSolverId) override
 set the sensors for a single adaptation step More...
 
void removeChilds (const MInt) override
 Coarsen the given cell. More...
 
void removeCell (const MInt) override
 Remove the given cell. More...
 
void refineCell (const MInt) override
 
void swapCells (const MInt, const MInt) override
 
void swapProxy (const MInt cellId0, const MInt cellId1) override
 
MInt cellOutside (const MFloat *, const MInt, const MInt) override
 checks if a child lies outSide of the domain! necessary for refinement at the bndry! More...
 
void resizeGridMap () override
 Swap the given cells. More...
 
virtual void cleanUp ()
 
void copyGridProperties ()
 
void setAndAllocateSolverData (const MBool)
 
void setVariableNames ()
 
MInt c_noCells () const
 Returns the number of grid-cells. More...
 
MInt a_noCells () const
 
MInt a_hasNeighbor (const MInt cellId, const MInt dir) const
 Returns wether cell cellId has a neighbor in dir dir. More...
 
const MFloatc_coordinate (const MInt cellId, const MInt dim)
 Returns the coordinate of the cell from the grid().tree() cellId for dimension dir. More...
 
MFloat c_coordinate (const MInt cellId, const MInt dim) const
 Returns the coordinate of the cell from the grid().tree() cellId for dimension dir. More...
 
MInt c_level (const MInt cellId) const
 Returns the grid level of the cell cellId. More...
 
MInt a_level (const MInt) const
 
MInt c_noChildren (const MInt cellId) const
 Returns the number of children of the cell cellId. More...
 
MLong c_parentId (const MInt cellId) const
 Returns the grid parent id of the cell cellId. More...
 
MLong c_globalId (const MInt cellId) const
 Returns the global grid id of the grid cell cellId. More...
 
MLong c_childId (const MInt cellId, const MInt pos) const
 
MInt noVariables () const
 Return the number of primitive variables. More...
 
MFloata_variable (const MInt cellId, const MInt varId)
 Returns conservative variable v of the cell cellId for variables varId. More...
 
MFloat a_variable (const MInt cellId, const MInt varId) const
 Returns conservative variable v of the cell cellId for variables varId. More...
 
MFloata_averagedVariable (const MInt cellId, const MInt varId)
 
MBool isMeanFile () const
 
MInt fileNoVars () const
 
std::vector< MStringfileVarNames () const
 
MBool a_isHalo (const MInt cellId) const
 Returns IsHalo of the cell cellId. More...
 
maia::post::cell::BitsetType::reference a_isHalo (const MInt cellId)
 Returns IsHalo of the cell cellId. More...
 
MBool a_isWindow (const MInt cellId) const
 Returns IsWindow of the cell cellId. More...
 
maia::post::cell::BitsetType::reference a_isWindow (const MInt cellId)
 Returns IsWindow of the cell cellId. More...
 
void a_resetPropertiesSolver (const MInt cellId)
 Returns property p of the cell cellId. More...
 
std::pair< MInt, MIntgetPropertyVariableOffset (MString s)
 
void setPropertyVariableOffset (MString s, MInt start, MInt length)
 
MString getVariableName (MInt offset)
 
void setCellWeights (MFloat *) override
 sets the cell-weight for balancing and a restarting More...
 
MInt noLoadTypes () const override
 Return the number of Ls load types. More...
 
void getDefaultWeights (MFloat *weights, std::vector< MString > &names) const
 Return the default weights for all load quantities. More...
 
void getLoadQuantities (MInt *const loadQuantities) const override
 Return the cumulative load quantities on this domain. More...
 
MFloat getCellLoad (const MInt cellId, const MFloat *const weights) const override
 Return the load of a single cell (given computational weights). More...
 
void getDomainDecompositionInformation (std::vector< std::pair< MString, MInt > > &domainInfo) override
 Return decomposition information, i.e. number of local elements,... More...
 
void getSolverTimings (std::vector< std::pair< MString, MFloat > > &solverTimings, const MBool) override
 Get solver timings. More...
 
MInt noCellDataDlb () const override
 Methods to inquire solver data information. More...
 
MInt cellDataTypeDlb (const MInt dataId) const override
 
MInt cellDataSizeDlb (const MInt dataId, const MInt gridCellId) override
 Return data size to be communicated during DLB for a grid cell and given data id. More...
 
void getCellDataDlb (const MInt dataId, const MInt oldNoCells, const MInt *const bufferIdToCellId, MFloat *const data) override
 
void setCellDataDlb (const MInt dataId, const MFloat *const data) override
 Set solver data for DLB. More...
 
- Public Member Functions inherited from maia::CartesianSolver< nDim_, PostData< nDim_ > >
 CartesianSolver (const MInt solverId, GridProxy &gridProxy_, const MPI_Comm comm, const MBool checkActive=false)
 
MInt minLevel () const
 Read-only accessors for grid data. More...
 
MInt maxLevel () const
 
MInt maxNoGridCells () const
 
MInt maxRefinementLevel () const
 
MInt maxUniformRefinementLevel () const
 
MInt noNeighborDomains () const
 
MInt neighborDomain (const MInt id) const
 
MLong domainOffset (const MInt id) const
 
MInt noHaloLayers () const
 
MInt noHaloCells (const MInt domainId) const
 
MInt haloCellId (const MInt domainId, const MInt cellId) const
 
MInt noWindowCells (const MInt domainId) const
 
MInt windowCellId (const MInt domainId, const MInt cellId) const
 
MString gridInputFileName () const
 
MFloat reductionFactor () const
 
MFloat centerOfGravity (const MInt dir) const
 
MInt neighborList (const MInt cellId, const MInt dir) const
 
const MLonglocalPartitionCellGlobalIds (const MInt cellId) const
 
MLong localPartitionCellOffsets (const MInt index) const
 
MInt noMinCells () const
 
MInt minCell (const MInt id) const
 
const MInthaloCell (const MInt domainId, const MInt cellId) const
 
const MIntwindowCell (const MInt domainId, const MInt cellId) const
 
MBool isActive () const override
 
constexpr GridProxygrid () const
 
GridProxygrid ()
 
virtual void sensorDerivative (std::vector< std::vector< MFloat > > &, std::vector< std::bitset< 64 > > &, std::vector< MFloat > &, MInt, MInt)
 
virtual void sensorDivergence (std::vector< std::vector< MFloat > > &, std::vector< std::bitset< 64 > > &, std::vector< MFloat > &, MInt, MInt)
 
virtual void sensorTotalPressure (std::vector< std::vector< MFloat > > &, std::vector< std::bitset< 64 > > &, std::vector< MFloat > &, MInt, MInt)
 
virtual void sensorEntropyGrad (std::vector< std::vector< MFloat > > &, std::vector< std::bitset< 64 > > &, std::vector< MFloat > &, MInt, MInt)
 
virtual void sensorEntropyQuot (std::vector< std::vector< MFloat > > &, std::vector< std::bitset< 64 > > &, std::vector< MFloat > &, MInt, MInt)
 
virtual void sensorVorticity (std::vector< std::vector< MFloat > > &, std::vector< std::bitset< 64 > > &, std::vector< MFloat > &, MInt, MInt)
 
virtual void sensorInterface (std::vector< std::vector< MFloat > > &, std::vector< std::bitset< 64 > > &, std::vector< MFloat > &, MInt, MInt)
 
void sensorLimit (std::vector< std::vector< MFloat > > &, std::vector< std::bitset< 64 > > &, std::vector< MFloat > &, MInt, MInt, std::function< MFloat(MInt)>, const MFloat, const MInt *, const MBool, const MBool allowCoarsening=true)
 simple sensor to apply a limit for a value More...
 
void sensorSmooth (std::vector< std::vector< MFloat > > &, std::vector< std::bitset< 64 > > &, std::vector< MFloat > &, MInt, MInt)
 sensor to smooth level jumps NOTE: only refines additional cells to ensure a smooth level transition this requires that all other sensors are frozen i.e. no refine/coarse sensors set! More...
 
void sensorBand (std::vector< std::vector< MFloat > > &, std::vector< std::bitset< 64 > > &, std::vector< MFloat > &, MInt, MInt)
 This sensor generates a max refinement band around the cells with max refinement level. In order for it to work, the property addedAdaptationSteps has to be equal to /maxRefinementLevel() - minLevel()/. This sensor also ensures a smooth transition between levels. Do not use together with sensorSmooth. More...
 
virtual void sensorMeanStress (std::vector< std::vector< MFloat > > &, std::vector< std::bitset< 64 > > &, std::vector< MFloat > &, MInt, MInt)
 
virtual void sensorParticle (std::vector< std::vector< MFloat > > &, std::vector< std::bitset< 64 > > &, std::vector< MFloat > &, MInt, MInt)
 
virtual void sensorSpecies (std::vector< std::vector< MFloat > > &, std::vector< std::bitset< 64 > > &, std::vector< MFloat > &, MInt, MInt)
 
virtual void sensorPatch (std::vector< std::vector< MFloat > > &sensor, std::vector< std::bitset< 64 > > &sensorCellFlag, std::vector< MFloat > &sensorWeight, MInt sensorOffset, MInt sen)
 
virtual void sensorCutOff (std::vector< std::vector< MFloat > > &, std::vector< std::bitset< 64 > > &, std::vector< MFloat > &, MInt, MInt)
 
void saveSensorData (const std::vector< std::vector< MFloat > > &sensors, const MInt &level, const MString &gridFileName, const MInt *const recalcIds) override
 Saves all sensor values for debug/tunig purposes. More...
 
void assertValidGridCellId (const MInt) const
 
MLong c_parentId (const MInt cellId) const
 Returns the grid parent id of the cell cellId. More...
 
MLong c_neighborId (const MInt cellId, const MInt dir) const
 Returns the grid neighbor id of the grid cell cellId dir. More...
 
MInt c_noCells () const
 
MInt c_level (const MInt cellId) const
 
MLong c_globalGridId (const MInt cellId)
 
void exchangeData (T *data, const MInt dataBlockSize=1)
 Exchange memory in 'data' assuming a solver size of 'dataBlockSize' per cell. More...
 
void exchangeLeafData (std::function< T &(MInt, MInt)> data, const MInt noDat=1)
 Blocking exchange memory in 'data' assuming a solver size of 'dataBlockSize' per cell NOTE: exchange is only performed on leaf-cells and leaf-NeighborDomains Assumes, that updateLeafCellExchange has been called in the proxy previously! More...
 
void exchangeSparseLeafValues (G getData, S setData, const MInt dataSize, M cellMapping)
 Exchange of sparse data structures on max Level. More...
 
void exchangeAzimuthalPer (T *data, MInt dataBlockSize=1, MInt firstBlock=0)
 Exchange of sparse data structures on max Level. More...
 
void collectVariables (T *variablesIn, ScratchSpace< T > &variablesOut, const std::vector< MString > &variablesNameIn, std::vector< MString > &variablesNameOut, const MInt noVars, const MInt noCells, const MBool reverseOrder=false)
 generalised helper function for writing restart files! This is necessary for example if the minLevel shall be raised at the new restart! More...
 
void collectVariables (T **variablesIn, ScratchSpace< T > &variablesOut, const std::vector< MString > &variablesNameIn, std::vector< MString > &variablesNameOut, const MInt noVars, const MInt noCells)
 generalised helper function for writing restart files! This is necessary for example if the minLevel shall be raised at the new restart! More...
 
void saveGridFlowVars (const MChar *fileName, const MChar *gridFileName, const MInt noTotalCells, const MInt noInternal, MFloatScratchSpace &dbVariables, std::vector< MString > &dbVariablesName, MInt noDbVars, MIntScratchSpace &idVariables, std::vector< MString > &idVariablesName, MInt noIdVars, MFloatScratchSpace &dbParameters, std::vector< MString > &dbParametersName, MIntScratchSpace &idParameters, std::vector< MString > &idParametersName, MInt *recalcIds, MFloat time)
 This function writes the parallel Netcdf cartesian grid cell based solution/restart file currently used in PostData, LPT and LS solvers! More...
 
void collectParameters (T, ScratchSpace< T > &, const MChar *, std::vector< MString > &)
 This function collects a single parameters for the massivley parallel IO functions. More...
 
void calcRecalcCellIdsSolver (const MInt *const recalcIdsTree, MInt &noCells, MInt &noInternalCellIds, std::vector< MInt > &recalcCellIdsSolver, std::vector< MInt > &reorderedCellIds)
 Derive recalc cell ids of the solver and reordered cell ids. More...
 
- Public Member Functions inherited from Solver
MString getIdentifier (const MBool useSolverId=false, const MString preString="", const MString postString="_")
 
virtual ~Solver ()=default
 
virtual MInt noInternalCells () const =0
 Return the number of internal cells within this solver. More...
 
virtual MFloat time () const =0
 Return the time. More...
 
virtual MInt noVariables () const
 Return the number of variables. More...
 
virtual void getDimensionalizationParams (std::vector< std::pair< MFloat, MString > > &) const
 Return the dimensionalization parameters of this solver. More...
 
void updateDomainInfo (const MInt domainId, const MInt noDomains, const MPI_Comm mpiComm, const MString &loc)
 Set new domain information. More...
 
virtual MFloata_slope (const MInt, MInt const, const MInt)
 
virtual MBool a_isBndryCell (const MInt) const
 
virtual MFloata_FcellVolume (MInt)
 
virtual MInt getCurrentTimeStep () const
 
virtual void accessSampleVariables (MInt, MFloat *&)
 
virtual void getSampleVariableNames (std::vector< MString > &NotUsed(varNames))
 
virtual MBool a_isBndryGhostCell (MInt) const
 
virtual void saveCoarseSolution ()
 
virtual void getSolverSamplingProperties (std::vector< MInt > &NotUsed(samplingVarIds), std::vector< MInt > &NotUsed(noSamplingVars), std::vector< std::vector< MString > > &NotUsed(samplingVarNames), const MString NotUsed(featureName)="")
 
virtual void initSolverSamplingVariables (const std::vector< MInt > &NotUsed(varIds), const std::vector< MInt > &NotUsed(noSamplingVars))
 
virtual void calcSamplingVariables (const std::vector< MInt > &NotUsed(varIds), const MBool NotUsed(exchange))
 
virtual void calcSamplingVarAtPoint (const MFloat *NotUsed(point), const MInt NotUsed(id), const MInt NotUsed(sampleVarId), MFloat *NotUsed(state), const MBool NotUsed(interpolate)=false)
 
virtual void balance (const MInt *const NotUsed(noCellsToReceiveByDomain), const MInt *const NotUsed(noCellsToSendByDomain), const MInt *const NotUsed(targetDomainsByCell), const MInt NotUsed(oldNoCells))
 Perform load balancing. More...
 
virtual MBool hasSplitBalancing () const
 Return if load balancing for solver is split into multiple methods or implemented in balance() More...
 
virtual void balancePre ()
 
virtual void balancePost ()
 
virtual void finalizeBalance ()
 
virtual void resetSolver ()
 Reset the solver/solver for load balancing. More...
 
virtual void cancelMpiRequests ()
 Cancel open mpi (receive) requests in the solver (e.g. due to interleaved execution) More...
 
virtual void setCellWeights (MFloat *)
 Set cell weights. More...
 
virtual MInt noLoadTypes () const
 
virtual void getDefaultWeights (MFloat *NotUsed(weights), std::vector< MString > &NotUsed(names)) const
 
virtual void getLoadQuantities (MInt *const NotUsed(loadQuantities)) const
 
virtual MFloat getCellLoad (const MInt NotUsed(cellId), const MFloat *const NotUsed(weights)) const
 
virtual void limitWeights (MFloat *NotUsed(weights))
 
virtual void localToGlobalIds ()
 
virtual void globalToLocalIds ()
 
virtual MInt noCellDataDlb () const
 Methods to inquire solver data information. More...
 
virtual MInt cellDataTypeDlb (const MInt NotUsed(dataId)) const
 
virtual MInt cellDataSizeDlb (const MInt NotUsed(dataId), const MInt NotUsed(cellId))
 
virtual void getCellDataDlb (const MInt NotUsed(dataId), const MInt NotUsed(oldNoCells), const MInt *const NotUsed(bufferIdToCellId), MInt *const NotUsed(data))
 
virtual void getCellDataDlb (const MInt NotUsed(dataId), const MInt NotUsed(oldNoCells), const MInt *const NotUsed(bufferIdToCellId), MLong *const NotUsed(data))
 
virtual void getCellDataDlb (const MInt NotUsed(dataId), const MInt NotUsed(oldNoCells), const MInt *const NotUsed(bufferIdToCellId), MFloat *const NotUsed(data))
 
virtual void setCellDataDlb (const MInt NotUsed(dataId), const MInt *const NotUsed(data))
 
virtual void setCellDataDlb (const MInt NotUsed(dataId), const MLong *const NotUsed(data))
 
virtual void setCellDataDlb (const MInt NotUsed(dataId), const MFloat *const NotUsed(data))
 
virtual void getGlobalSolverVars (std::vector< MFloat > &NotUsed(globalFloatVars), std::vector< MInt > &NotUsed(globalIntVars))
 
virtual void setGlobalSolverVars (std::vector< MFloat > &NotUsed(globalFloatVars), std::vector< MInt > &NotUsed(globalIdVars))
 
void enableDlbTimers ()
 
void reEnableDlbTimers ()
 
void disableDlbTimers ()
 
MBool dlbTimersEnabled ()
 
void startLoadTimer (const MString name)
 
void stopLoadTimer (const MString &name)
 
void stopIdleTimer (const MString &name)
 
void startIdleTimer (const MString &name)
 
MBool isLoadTimerRunning ()
 
virtual MInt noSolverTimers (const MBool NotUsed(allTimings))
 
virtual void getSolverTimings (std::vector< std::pair< MString, MFloat > > &NotUsed(solverTimings), const MBool NotUsed(allTimings))
 
virtual void getDomainDecompositionInformation (std::vector< std::pair< MString, MInt > > &NotUsed(domainInfo))
 
void setDlbTimer (const MInt timerId)
 
virtual void prepareAdaptation (std::vector< std::vector< MFloat > > &, std::vector< MFloat > &, std::vector< std::bitset< 64 > > &, std::vector< MInt > &)
 
virtual void reinitAfterAdaptation ()
 
virtual void prepareAdaptation ()
 prepare adaptation for split adaptation before the adaptation loop More...
 
virtual void setSensors (std::vector< std::vector< MFloat > > &, std::vector< MFloat > &, std::vector< std::bitset< 64 > > &, std::vector< MInt > &)
 set solver sensors for split adaptation within the adaptation loop More...
 
virtual void saveSensorData (const std::vector< std::vector< MFloat > > &, const MInt &, const MString &, const MInt *const)
 
virtual void postAdaptation ()
 post adaptation for split adaptation within the adaptation loop More...
 
virtual void finalizeAdaptation ()
 finalize adaptation for split sadptation after the adaptation loop More...
 
virtual void refineCell (const MInt)
 Refine the given cell. More...
 
virtual void removeChilds (const MInt)
 Coarsen the given cell. More...
 
virtual void removeCell (const MInt)
 Remove the given cell. More...
 
virtual void swapCells (const MInt, const MInt)
 Swap the given cells. More...
 
virtual void swapProxy (const MInt, const MInt)
 Swap the given cells. More...
 
virtual MInt cellOutside (const MFloat *, const MInt, const MInt)
 Check whether cell is outside the fluid domain. More...
 
virtual void resizeGridMap ()
 Swap the given cells. More...
 
virtual MBool prepareRestart (MBool, MBool &)
 Prepare the solvers for a grid-restart. More...
 
virtual void reIntAfterRestart (MBool)
 
MPI_Comm mpiComm () const
 Return the MPI communicator used by this solver. More...
 
virtual MInt domainId () const
 Return the domainId (rank) More...
 
virtual MInt noDomains () const
 
virtual MBool isActive () const
 
void setSolverStatus (const MBool status)
 
MBool getSolverStatus ()
 Get the solver status indicating if the solver is currently active in the execution recipe. More...
 
MString testcaseDir () const
 Return the testcase directory. More...
 
MString outputDir () const
 Return the directory for output files. More...
 
MString restartDir () const
 Return the directory for restart files. More...
 
MString solverMethod () const
 Return the solverMethod of this solver. More...
 
MString solverType () const
 Return the solverType of this solver. More...
 
MInt restartInterval () const
 Return the restart interval of this solver. More...
 
MInt restartTimeStep () const
 Return the restart interval of this solver. More...
 
MInt solverId () const
 Return the solverId. More...
 
MBool restartFile ()
 
MInt readSolverSamplingVarNames (std::vector< MString > &varNames, const MString featureName="") const
 Read sampling variables names, store in vector and return the number of sampling variables. More...
 
virtual MBool hasRestartTimeStep () const
 
virtual MBool forceAdaptation ()
 
virtual void preTimeStep ()=0
 
virtual void postTimeStep ()=0
 
virtual void initSolver ()=0
 
virtual void finalizeInitSolver ()=0
 
virtual void saveSolverSolution (const MBool NotUsed(forceOutput)=false, const MBool NotUsed(finalTimeStep)=false)=0
 
virtual void cleanUp ()=0
 
virtual MBool solutionStep ()
 
virtual void preSolutionStep (MInt)
 
virtual MBool postSolutionStep ()
 
virtual MBool solverConverged ()
 
virtual void getInterpolatedVariables (MInt, const MFloat *, MFloat *)
 
virtual void loadRestartFile ()
 
virtual MInt determineRestartTimeStep () const
 
virtual void writeRestartFile (MBool)
 
virtual void writeRestartFile (const MBool, const MBool, const MString, MInt *)
 
virtual void setTimeStep ()
 
virtual void implicitTimeStep ()
 
virtual void prepareNextTimeStep ()
 

Public Attributes

maia::post::collector::PostCellCollector< nDimm_cells
 Collector for POST data. More...
 
Geomm_geometry
 
MBool m_forceWriteRestart = false
 
MFloat m_timeStep = NAN
 
MFloat m_time = NAN
 
MString m_outputFormat
 
MInt m_sourceVarsIndex
 
std::vector< MStringm_variablesName
 
MFloat ** m_averagedVars = nullptr
 
- Public Attributes inherited from Solver
std::set< MIntm_freeIndices
 
MBool m_singleAdaptation = false
 
MBool m_splitAdaptation = true
 
MBool m_saveSensorData = false
 

Static Public Attributes

static constexpr MInt nDim = nDim_
 

Protected Member Functions

MInt getVariablePropertyIndex (MString s)
 Return the number of primitive variables. More...
 
void readProperties ()
 
MBool hasSplitBalancing () const override
 Return if load balancing for solver is split into multiple methods or implemented in balance() More...
 
void resetSolver () override
 Reset the solver prior to load balancing. More...
 
void balancePre () override
 Reinitialize solver for DLB prior to setting solution data. More...
 
void balancePost () override
 Reinitialize solver for DLB after to setting solution data. More...
 
void finalizeBalance () override
 Reinitialize solver after all data structures have been recreated. More...
 
const std::vector< std::vector< MString > > m_averageVariableName
 
const std::vector< std::vector< MString > > m_averageVariableName
 
- Protected Member Functions inherited from maia::CartesianSolver< nDim_, PostData< nDim_ > >
void identifyBoundaryCells (MBool *const isInterface, const std::vector< MInt > &bndCndIds=std::vector< MInt >())
 
void identifyBoundaryCells ()
 
MBool cellIsOnGeometry (MInt cellId, Geometry< nDim > *geom)
 checks whether a cell lies on a certain geometry copied the essential part from identifyBoundaryCells More...
 
void setBoundaryDistance (const MBool *const interfaceCell, const MFloat *const outerBandWidth, MFloatScratchSpace &distance)
 transverses over all neighboring cells for a specified length More...
 
void markSurrndCells (MIntScratchSpace &inList, const MInt bandWidth, const MInt level, const MBool refineDiagonals=true)
 
void receiveWindowTriangles ()
 Receives triangles from neighbors contained in their window cells and inserts them locally. More...
 
void compactCells ()
 Removes all holes in the cell collector and moves halo cells to the back of the collector. More...
 
MInt createCellId (const MInt gridCellId)
 
void removeCellId (const MInt cellId)
 
MInt inCell (const MInt cellId, MFloat *point, MFloat fac=F1)
 
MInt setUpInterpolationStencil (const MInt cellId, MInt *, const MFloat *, std::function< MBool(MInt, MInt)>, MBool allowIncompleteStencil)
 
MFloat interpolateFieldData (MInt *, MFloat *, MInt varId, std::function< MFloat(MInt, MInt)> scalarField, std::function< MFloat(MInt, MInt)> coordinate)
 
MFloat leastSquaresInterpolation (MInt *, MFloat *, MInt varId, std::function< MFloat(MInt, MInt)> scalarField, std::function< MFloat(MInt, MInt)> coordinate)
 
void checkNoHaloLayers ()
 check that each solver has the required number of haloLayers for leaf cells!!! TODO labels:toenhance under production, needs to be cleaned up! More...
 
void mapInterpolationCells (std::map< MInt, MInt > &cellMap)
 
void setHaloCellsOnInactiveRanks ()
 
void patchRefinement (std::vector< std::vector< MFloat > > &sensors, std::vector< std::bitset< 64 > > &sensorCellFlag, std::vector< MFloat > &sensorWeight, MInt sensorOffset, MInt sen)
 
void reOrderCellIds (std::vector< MInt > &reOrderedCells)
 reOrder cellIds before writing the restart file! This is necessary for example if the minLevel shall be raised at the new restart! More...
 
void recomputeGlobalIds (std::vector< MInt > &, std::vector< MLong > &)
 reOrder cellIds before writing the restart file! This is necessary for example if the minLevel shall be raised at the new restart! More...
 
void extractPointIdsFromGrid (Collector< PointBasedCell< nDim > > *&, Collector< CartesianGridPoint< nDim > > *&, const MBool, const std::map< MInt, MInt > &, MInt levelThreshold=999999, MFloat *bBox=nullptr, MBool levelSetMb=false) const
 Creates a list of unique corner points for all cells using a hash map levelThreshold optionally specifies the maximum cell level to be extracted bBox optionally specifies a bounding to box to which the extracted domain shall be truncated. More...
 
- Protected Member Functions inherited from Solver
 Solver (const MInt solverId, const MPI_Comm comm, const MBool isActive=true)
 
MFloat returnLoadRecord () const
 
MFloat returnIdleRecord () const
 

Protected Attributes

const std::vector< MStringm_propertyName
 
std::vector< std::pair< MInt, MInt > > m_variableOffset
 
MInt m_noVariables = 0
 
MInt m_adaptationLevel = -1
 
MBool m_forceAdaptation = false
 
MBool m_adaptationSinceLastRestart = false
 
MString m_currentGridFileName {}
 
MInt m_loadBalancingReinitStage = -1
 
MBool m_isMeanFile = false
 
MInt m_fileNoVars = -1
 
std::vector< MStringm_fileVarNames {}
 
- Protected Attributes inherited from maia::CartesianSolver< nDim_, PostData< nDim_ > >
MIntm_rfnBandWidth
 
MInt m_noSensors
 
MInt m_adaptationInterval
 
MInt m_adaptationStep
 
std::vector< MIntm_maxSensorRefinementLevel
 
std::vector< MFloatm_sensorWeight
 
std::vector< MFloatm_sensorDerivativeVariables
 
MBool m_adaptation
 
MBool m_adapts
 
MInt m_noInitialSensors
 
MBool m_resTriggeredAdapt
 
MInt m_noSmoothingLayers
 
MInt m_sensorBandAdditionalLayers
 
MBool m_sensorInterface
 
MBool m_sensorParticle
 
std::vector< MStringm_sensorType
 
MIntm_recalcIds
 
std::vector< funm_sensorFnPtr
 
MInt m_maxNoSets
 
std::vector< MFloatm_azimuthalCartRecCoord
 
const MInt m_revDir [6]
 
const MInt m_noDirs
 
- Protected Attributes inherited from Solver
MFloat m_Re {}
 the Reynolds number More...
 
MFloat m_Ma {}
 the Mach number More...
 
MInt m_solutionInterval
 The number of timesteps before writing the next solution file. More...
 
MInt m_solutionOffset {}
 
std::set< MIntm_solutionTimeSteps
 
MInt m_restartInterval
 The number of timesteps before writing the next restart file. More...
 
MInt m_restartTimeStep
 
MInt m_restartOffset
 
MString m_solutionOutput
 
MBool m_useNonSpecifiedRestartFile = false
 
MBool m_initFromRestartFile
 
MInt m_residualInterval
 The number of timesteps before writing the next residual. More...
 
const MInt m_solverId
 a unique solver identifier More...
 
MFloatm_outerBandWidth = nullptr
 
MFloatm_innerBandWidth = nullptr
 
MIntm_bandWidth = nullptr
 
MBool m_restart = false
 
MBool m_restartFile = false
 

Static Protected Attributes

static const std::vector< std::vector< MString > > m_averageVariableName
 

Private Member Functions

template<typename dataType >
void setCellDataDlb_ (const MInt dataId, const dataType *const data)
 Set the solver cell data after DLB. More...
 
template<typename dataType >
void getCellDataDlb_ (const MInt dataId, const MInt oldNoCells, const MInt *const bufferIdToCellId, dataType *const data)
 Store the solver data for a given data id ordered in the given buffer for DLB. More...
 

Static Private Member Functions

static constexpr std::array< MInt, nDimgetArray012 ()
 Static indices for accessing post variables in nDim spatial dimensions. More...
 

Additional Inherited Members

- Protected Types inherited from maia::CartesianSolver< nDim_, PostData< nDim_ > >
using fun = void(CartesianSolver< nDim, PostData< nDim_ > >::*)(std::vector< std::vector< MFloat > > &, std::vector< std::bitset< 64 > > &, std::vector< MFloat > &, MInt, MInt)
 

Detailed Description

template<MInt nDim_>
class PostData< nDim_ >

Definition at line 23 of file postdata.h.

Member Typedef Documentation

◆ CartesianSolver

template<MInt nDim_>
using PostData< nDim_ >::CartesianSolver = typename maia::CartesianSolver<nDim, PostData>

Definition at line 27 of file postdata.h.

◆ Cell

template<MInt nDim_>
using PostData< nDim_ >::Cell = typename maia::grid::tree::Tree<nDim>::Cell

Definition at line 31 of file postdata.h.

◆ Geom

template<MInt nDim_>
using PostData< nDim_ >::Geom = Geometry<nDim>

Definition at line 73 of file postdata.h.

◆ Grid

template<MInt nDim_>
using PostData< nDim_ >::Grid = typename CartesianSolver::Grid

Definition at line 28 of file postdata.h.

◆ GridProxy

template<MInt nDim_>
using PostData< nDim_ >::GridProxy = typename CartesianSolver::GridProxy

Definition at line 29 of file postdata.h.

◆ SolverCell

template<MInt nDim_>
using PostData< nDim_ >::SolverCell = PostCell

Definition at line 30 of file postdata.h.

Constructor & Destructor Documentation

◆ PostData()

template<MInt nDim>
PostData< nDim >::PostData ( MInt  solverId_,
GridProxy gridProxy_,
Geom geometry_,
const MPI_Comm  comm 
)

Definition at line 61 of file postdata.cpp.

63 : maia::CartesianSolver<nDim, PostData<nDim>>(solverId_, gridProxy_, comm, true),
64 m_geometry(&geometry_),
65 m_time(0.0) {
66 TRACE();
67
69
70 for(MInt i = 0; i < (MInt)m_propertyName.size(); i++) {
71 m_variableOffset.push_back(std::make_pair(std::numeric_limits<MInt>::max(), -std::numeric_limits<MInt>::max()));
72 }
73}
void readProperties()
std::vector< std::pair< MInt, MInt > > m_variableOffset
Definition: postdata.h:290
const std::vector< MString > m_propertyName
Definition: postdata.h:270
Geom * m_geometry
Definition: postdata.h:79
MFloat m_time
Definition: postdata.h:202
int32_t MInt
Definition: maiatypes.h:62

◆ ~PostData()

template<MInt nDim_>
PostData< nDim_ >::~PostData ( )
inline

Definition at line 77 of file postdata.h.

77{};

Member Function Documentation

◆ a_averagedVariable()

template<MInt nDim_>
MFloat & PostData< nDim_ >::a_averagedVariable ( const MInt  cellId,
const MInt  varId 
)
inline

Definition at line 173 of file postdata.h.

173{ return m_averagedVars[cellId][varId]; }
MFloat ** m_averagedVars
Definition: postdata.h:257
void const MInt cellId
Definition: collector.h:239

◆ a_hasNeighbor()

template<MInt nDim_>
MInt PostData< nDim_ >::a_hasNeighbor ( const MInt  cellId,
const MInt  dir 
) const
inline

Definition at line 137 of file postdata.h.

137 {
138 if(cellId > (m_cells.size() - 1)) return -1;
139 return grid().tree().hasNeighbor(cellId, dir);
140 }
maia::post::collector::PostCellCollector< nDim > m_cells
Collector for POST data.
Definition: postdata.h:34

◆ a_isHalo() [1/2]

template<MInt nDim_>
maia::post::cell::BitsetType::reference PostData< nDim_ >::a_isHalo ( const MInt  cellId)
inline

Definition at line 185 of file postdata.h.

185 {
186 return m_cells.hasProperty(cellId, SolverCell::IsHalo);
187 }

◆ a_isHalo() [2/2]

template<MInt nDim_>
MBool PostData< nDim_ >::a_isHalo ( const MInt  cellId) const
inline

Definition at line 182 of file postdata.h.

182{ return m_cells.hasProperty(cellId, SolverCell::IsHalo); }

◆ a_isWindow() [1/2]

template<MInt nDim_>
maia::post::cell::BitsetType::reference PostData< nDim_ >::a_isWindow ( const MInt  cellId)
inline

Definition at line 193 of file postdata.h.

193 {
194 return m_cells.hasProperty(cellId, SolverCell::IsWindow);
195 }

◆ a_isWindow() [2/2]

template<MInt nDim_>
MBool PostData< nDim_ >::a_isWindow ( const MInt  cellId) const
inline

Definition at line 190 of file postdata.h.

190{ return m_cells.hasProperty(cellId, SolverCell::IsWindow); }

◆ a_level()

template<MInt nDim_>
MInt PostData< nDim_ >::a_level ( const  MInt) const
inline

Definition at line 152 of file postdata.h.

152{ TERMM(1, "Make this function return something meaningful in future!"); }

◆ a_noCells()

template<MInt nDim_>
MInt PostData< nDim_ >::a_noCells ( ) const
inline

Definition at line 134 of file postdata.h.

134{ return m_cells.size(); }

◆ a_resetPropertiesSolver()

template<MInt nDim_>
void PostData< nDim_ >::a_resetPropertiesSolver ( const MInt  cellId)
inline

Definition at line 198 of file postdata.h.

198{ m_cells.resetProperties(cellId); }

◆ a_variable() [1/2]

template<MInt nDim_>
MFloat & PostData< nDim_ >::a_variable ( const MInt  cellId,
const MInt  varId 
)
inline

Definition at line 168 of file postdata.h.

168{ return m_cells.variable(cellId, varId); }

◆ a_variable() [2/2]

template<MInt nDim_>
MFloat PostData< nDim_ >::a_variable ( const MInt  cellId,
const MInt  varId 
) const
inline

Definition at line 171 of file postdata.h.

171{ return m_cells.variable(cellId, varId); }

◆ balancePost()

template<MInt nDim>
void PostData< nDim >::balancePost
overrideprotectedvirtual
Author
Thomas Hoesgen

Reimplemented from Solver.

Definition at line 1087 of file postdata.cpp.

1087 {
1088 TRACE();
1089
1092
1093 // Nothing to do if solver is not active
1094 if(!grid().isActive()) return;
1095
1097}
MBool m_adaptationSinceLastRestart
Definition: postdata.h:296
MInt m_loadBalancingReinitStage
Definition: postdata.h:305

◆ balancePre()

template<MInt nDim>
void PostData< nDim >::balancePre
overrideprotectedvirtual
Author
Thomas Hoesgen

Reimplemented from Solver.

Definition at line 1046 of file postdata.cpp.

1046 {
1047 TRACE();
1048
1049 // Note: every function that allocates persistent memory should first deallocate that memory, for
1050 // this to work initialize all pointers with nullptr in the class definition
1051
1052 // Set reinitialization stage
1054
1055 // Store currently used memory
1056 /* const MLong previouslyAllocated = allocatedBytes(); */
1057
1058 // Update the grid proxy for this solver
1059 grid().update();
1060
1061 if(!grid().isActive()) {
1062 // Reset parallelization information if solver is not active
1063 updateDomainInfo(-1, -1, MPI_COMM_NULL, AT_);
1064 } else {
1065 // Set new domain info for solver
1067 }
1068
1069 // Return if solver is not active
1070 if(!grid().isActive()) {
1071 m_cells.reset(grid().maxNoCells());
1073 return;
1074 }
1075
1076 // Resize cell collector to internal cells
1077 m_cells.reset(grid().raw().treeb().capacity());
1078
1080 this->checkNoHaloLayers();
1081}
void setAndAllocateSolverData(const MBool)
Definition: postdata.cpp:150
virtual MInt domainId() const
Return the domainId (rank)
Definition: solver.h:383
MPI_Comm mpiComm() const
Return the MPI communicator used by this solver.
Definition: solver.h:380
virtual MInt noDomains() const
Definition: solver.h:387
void updateDomainInfo(const MInt domainId, const MInt noDomains, const MPI_Comm mpiComm, const MString &loc)
Set new domain information.
Definition: solver.h:135
void checkNoHaloLayers()
check that each solver has the required number of haloLayers for leaf cells!!! TODO labels:toenhance ...
void const MInt const MInt const MInt const MInt maxNoCells
Definition: collector.h:240

◆ c_childId()

template<MInt nDim_>
MLong PostData< nDim_ >::c_childId ( const MInt  cellId,
const MInt  pos 
) const
inline

Definition at line 162 of file postdata.h.

162{ return grid().tree().child(cellId, pos); }

◆ c_coordinate() [1/2]

template<MInt nDim_>
const MFloat & PostData< nDim_ >::c_coordinate ( const MInt  cellId,
const MInt  dim 
)
inline

Definition at line 143 of file postdata.h.

143{ return grid().tree().coordinate(cellId, dim); }

◆ c_coordinate() [2/2]

template<MInt nDim_>
MFloat PostData< nDim_ >::c_coordinate ( const MInt  cellId,
const MInt  dim 
) const
inline

Definition at line 146 of file postdata.h.

146{ return grid().tree().coordinate(cellId, dim); }

◆ c_globalId()

template<MInt nDim_>
MLong PostData< nDim_ >::c_globalId ( const MInt  cellId) const
inline

Definition at line 160 of file postdata.h.

160{ return grid().tree().globalId(cellId); }

◆ c_level()

template<MInt nDim_>
MInt PostData< nDim_ >::c_level ( const MInt  cellId) const
inline

Definition at line 149 of file postdata.h.

149{ return grid().tree().level(cellId); }

◆ c_noCells()

template<MInt nDim_>
MInt PostData< nDim_ >::c_noCells ( ) const
inline

Definition at line 132 of file postdata.h.

132{ return grid().tree().size(); }

◆ c_noChildren()

template<MInt nDim_>
MInt PostData< nDim_ >::c_noChildren ( const MInt  cellId) const
inline

Definition at line 154 of file postdata.h.

154{ return grid().tree().noChildren(cellId); }

◆ c_parentId()

template<MInt nDim_>
MLong PostData< nDim_ >::c_parentId ( const MInt  cellId) const
inline

Definition at line 157 of file postdata.h.

157{ return grid().tree().parent(cellId); }

◆ cellDataSizeDlb()

template<MInt nDim>
MInt PostData< nDim >::cellDataSizeDlb ( const MInt  dataId,
const MInt  gridCellId 
)
override

Definition at line 1113 of file postdata.cpp.

1113 {
1114 // Inactive ranks do not have any data to communicate
1115 if(!isActive()) {
1116 return 0;
1117 }
1118
1119 // Convert to solver cell id and check
1120 const MInt cellId = grid().tree().grid2solver(gridCellId);
1121 if(cellId < 0 || cellId >= noInternalCells()) {
1122 return 0;
1123 }
1124
1125 MInt dataSize = 0;
1126
1127 switch(dataId) {
1128 case 0: // variables
1129 dataSize = noVariables();
1130 break;
1131 default:
1132 TERMM(1, "Unknown data id.");
1133 break;
1134 }
1135
1136 return dataSize;
1137}
MInt noInternalCells() const override
Return the number of internal cells within this solver.
Definition: postdata.h:84
MInt noVariables() const
Return the number of primitive variables.
Definition: postdata.h:165

◆ cellDataTypeDlb()

template<MInt nDim_>
MInt PostData< nDim_ >::cellDataTypeDlb ( const MInt  dataId) const
inlineoverride

Definition at line 236 of file postdata.h.

236 {
237 if(dataId == 0) {
238 return MFLOAT;
239 } else {
240 TERMM(1, "solverCelldataType: invalid data id " + std::to_string(dataId));
241 }
242 };
@ MFLOAT
Definition: enums.h:269

◆ cellOutside()

template<MInt nDim>
MInt PostData< nDim >::cellOutside ( const MFloat coords,
const MInt  level,
const MInt  gridCellId 
)
overridevirtual
Author
Tim Wegmann

Reimplemented from Solver.

Definition at line 1025 of file postdata.cpp.

1025 {
1026 return -1;
1027
1028 std::ignore = coords;
1029 std::ignore = level;
1030 std::ignore = gridCellId;
1031}

◆ cleanUp()

template<MInt nDim_>
virtual void PostData< nDim_ >::cleanUp ( )
inlinevirtual

Implements Solver.

Definition at line 125 of file postdata.h.

125{};

◆ copyGridProperties()

template<MInt nDim>
void PostData< nDim >::copyGridProperties

Definition at line 112 of file postdata.cpp.

112 {
113 TRACE();
114
115 // d) Set Properties for valid-grid-cells
116 for(MInt i = 0; i < noNeighborDomains(); i++) {
117 for(MInt c = 0; c < noHaloCells(i); c++) {
118 a_isHalo(haloCellId(i, c)) = true;
119 }
120 for(MInt j = 0; j < noWindowCells(i); j++) {
121 a_isWindow(windowCellId(i, j)) = true;
122 }
123 }
124
125 // Inactive can only have halo cells, however noNeighborDomains=-1
126 if(!isActive()) {
127 for(MInt c = 0; c < a_noCells(); c++) {
128 a_isHalo(c) = true;
129 }
130 }
131}
MBool a_isWindow(const MInt cellId) const
Returns IsWindow of the cell cellId.
Definition: postdata.h:190
MInt a_noCells() const
Definition: postdata.h:134
MBool a_isHalo(const MInt cellId) const
Returns IsHalo of the cell cellId.
Definition: postdata.h:182
MInt noWindowCells(const MInt domainId) const
MInt noHaloCells(const MInt domainId) const
MInt windowCellId(const MInt domainId, const MInt cellId) const
MInt haloCellId(const MInt domainId, const MInt cellId) const

◆ fileNoVars()

template<MInt nDim_>
MInt PostData< nDim_ >::fileNoVars ( ) const
inline

Definition at line 178 of file postdata.h.

178{ return m_fileNoVars; }
MInt m_fileNoVars
Definition: postdata.h:315

◆ fileVarNames()

template<MInt nDim_>
std::vector< MString > PostData< nDim_ >::fileVarNames ( ) const
inline

Definition at line 179 of file postdata.h.

179{ return m_fileVarNames; }
std::vector< MString > m_fileVarNames
Definition: postdata.h:317

◆ finalizeAdaptation()

template<MInt nDim>
void PostData< nDim >::finalizeAdaptation
overridevirtual
Author
Tim Wegmann

Reimplemented from Solver.

Definition at line 882 of file postdata.cpp.

882 {
883 TRACE();
884
885 m_forceAdaptation = false;
887}
MBool m_forceAdaptation
Definition: postdata.h:295

◆ finalizeBalance()

template<MInt nDim>
void PostData< nDim >::finalizeBalance
overrideprotectedvirtual
Author
Thomas Hoesgen

Reimplemented from Solver.

Definition at line 1102 of file postdata.cpp.

1102 {
1103 TRACE();
1104
1105 // Nothing to do if solver is not active
1106 if(!grid().isActive()) return;
1107
1109}

◆ finalizeInitSolver()

template<MInt nDim>
void PostData< nDim >::finalizeInitSolver
overridevirtual

Implements Solver.

Definition at line 276 of file postdata.cpp.

276 {
277 TRACE();
278
279 if(!isActive()) return;
280
281 if(m_restart) {
282 // TODO labels:PP allow to skip loading restart, e.g. if we want to start the averaging after adding the pp-solver
283 // at some point and just need everything set to zero instead?
285 }
286}
void loadRestartFile()
Definition: postdata.cpp:454
MBool m_restart
Definition: solver.h:97

◆ geometry()

template<MInt nDim_>
Geom & PostData< nDim_ >::geometry ( ) const
inline

Definition at line 82 of file postdata.h.

82{ return *m_geometry; }

◆ getArray012()

template<MInt nDim_>
static constexpr std::array< MInt, nDim > PostData< nDim_ >::getArray012 ( )
inlinestaticconstexprprivate

Definition at line 375 of file postdata.h.

375 {
376 IF_CONSTEXPR(nDim == 2) {
377 std::array<MInt, 2> a = {0, 1};
378 return a;
379 }
380 else {
381 std::array<MInt, 3> a = {0, 1, 2};
382 return a;
383 }
384 }
static constexpr MInt nDim
Definition: postdata.h:25
Definition: contexttypes.h:19

◆ getCellDataDlb()

template<MInt nDim_>
void PostData< nDim_ >::getCellDataDlb ( const MInt  dataId,
const MInt  oldNoCells,
const MInt *const  bufferIdToCellId,
MFloat *const  data 
)
inlineoverride

Definition at line 245 of file postdata.h.

246 {
247 getCellDataDlb_(dataId, oldNoCells, bufferIdToCellId, data);
248 };
void getCellDataDlb_(const MInt dataId, const MInt oldNoCells, const MInt *const bufferIdToCellId, dataType *const data)
Store the solver data for a given data id ordered in the given buffer for DLB.
Definition: postdata.h:344

◆ getCellDataDlb_()

template<MInt nDim_>
template<typename dataType >
void PostData< nDim_ >::getCellDataDlb_ ( const MInt  dataId,
const MInt  oldNoCells,
const MInt *const  bufferIdToCellId,
dataType *const  data 
)
inlineprivate

Definition at line 344 of file postdata.h.

345 {
346 TRACE();
347
348 MInt localBufferId = 0;
349 for(MInt i = 0; i < oldNoCells; i++) {
350 const MInt gridCellId = bufferIdToCellId[i];
351
352 if(gridCellId < 0) continue;
353
354 const MInt cellId = grid().tree().grid2solver(gridCellId);
355 if(cellId < 0 || cellId >= noInternalCells()) {
356 continue;
357 }
358
359 switch(dataId) {
360 case 0: {
361 const MInt dataSize = noVariables();
362 std::copy_n(&a_variable(cellId, 0), dataSize, &data[localBufferId * dataSize]);
363 break;
364 }
365 default:
366 TERMM(1, "Unknown data id.");
367 break;
368 }
369 localBufferId++;
370 }
371 }
MFloat & a_variable(const MInt cellId, const MInt varId)
Returns conservative variable v of the cell cellId for variables varId.
Definition: postdata.h:168

◆ getCellLoad()

template<MInt nDim>
MFloat PostData< nDim >::getCellLoad ( const MInt  gridCellId,
const MFloat *const  weights 
) const
override
Parameters
[in]cellIdRequested grid cell id.
[in]weightsComputational weights for different simulation components.
Returns
Cell load.
Author
Tim Wegmann

Definition at line 770 of file postdata.cpp.

770 {
771 TRACE();
772
773 ASSERT(isActive(), "solver is not active");
774
775 // Convert to solver cell id and check
776 const MInt cellId = grid().tree().grid2solver(gridCellId);
777 if(cellId < 0) {
778 return 0;
779 }
780
781 if(cellId < 0 || cellId >= grid().noInternalCells()) {
782 TERMM(1, "The given cell id is invalid.");
783 }
784
785 // Default cell load
786 MFloat cellLoad = 0.0;
787
788 cellLoad = weights[0];
789
790 // TODO: add other load types!
791
792 return cellLoad;
793}
double MFloat
Definition: maiatypes.h:52

◆ getDefaultWeights()

template<MInt nDim>
void PostData< nDim >::getDefaultWeights ( MFloat weights,
std::vector< MString > &  names 
) const
Author
Tim Wegmann

Definition at line 683 of file postdata.cpp.

683 {
684 TRACE();
685
686 // TODO set sensible default values
687 weights[0] = 1.0;
688 names[0] = "pp_cell";
689 MInt count = 1;
690
691 // TODO: add other load types!
692
693 if(noLoadTypes() != count) {
694 TERMM(1, "Count does not match noLoadTypes.");
695 }
696}
MInt noLoadTypes() const override
Return the number of Ls load types.
Definition: postdata.cpp:670

◆ getDomainDecompositionInformation()

template<MInt nDim>
void PostData< nDim >::getDomainDecompositionInformation ( std::vector< std::pair< MString, MInt > > &  domainInfo)
override
Author
Tim Wegmann

Definition at line 703 of file postdata.cpp.

703 {
704 TRACE();
705
706 const MString namePrefix = "s" + std::to_string(solverId()) + "_";
707
708 // Number of Post-Data-Cells
709 const MInt noCells = c_noCells();
710
711 domainInfo.emplace_back(namePrefix + "noPostCells", noCells);
712
713 // additionally add cells for probing
714}
MInt c_noCells() const
Returns the number of grid-cells.
Definition: postdata.h:132
MInt solverId() const
Return the solverId.
Definition: solver.h:425
std::basic_string< char > MString
Definition: maiatypes.h:55

◆ getLoadQuantities()

template<MInt nDim>
void PostData< nDim >::getLoadQuantities ( MInt *const  loadQuantities) const
override
Parameters
[out]loadQuantitiesStorage for load quantities.
Author
Tim Wegmann

Definition at line 742 of file postdata.cpp.

742 {
743 TRACE();
744
745 // Nothing to do if solver is not active
746 if(!isActive()) {
747 return;
748 }
749
750 // reset
751 for(MInt type = 0; type < noLoadTypes(); type++) {
752 loadQuantities[type] = 0;
753 }
754
755 loadQuantities[0] = c_noCells();
756
757 // TODO: add other load types!
758}

◆ getPropertyVariableOffset()

template<MInt nDim_>
std::pair< MInt, MInt > PostData< nDim_ >::getPropertyVariableOffset ( MString  s)
inline

Definition at line 207 of file postdata.h.

207 {
209 return (index > -1) ? m_variableOffset[index]
210 : std::make_pair(std::numeric_limits<MInt>::max(), std::numeric_limits<MInt>::min());
211 }
MInt getVariablePropertyIndex(MString s)
Return the number of primitive variables.
Definition: postdata.h:261
IdType index(const FloatType *const x, const IdType level)
Return Hilbert index for given location and level in 2D or 3D.
Definition: hilbert.h:165

◆ getSolverTimings()

template<MInt nDim>
void PostData< nDim >::getSolverTimings ( std::vector< std::pair< MString, MFloat > > &  solverTimings,
const  MBool 
)
override
Author
Tim Wegmann

Definition at line 648 of file postdata.cpp.

648 {
649 TRACE();
650
651 const MString namePrefix = "s" + std::to_string(solverId()) + "_";
652
653 const MFloat load = returnLoadRecord();
654 const MFloat idle = returnIdleRecord();
655
656 solverTimings.emplace_back(namePrefix + "loadPostData", load);
657 solverTimings.emplace_back(namePrefix + "idlePostData", idle);
658}
MFloat returnIdleRecord() const
Definition: solver.h:486
MFloat returnLoadRecord() const
Definition: solver.h:485

◆ getVariableName()

template<MInt nDim>
MString PostData< nDim >::getVariableName ( MInt  offset)

Definition at line 197 of file postdata.cpp.

197 {
198 MString s = "var" + std::to_string(offset);
199 if(offset >= getPropertyVariableOffset("primitive").first && offset < getPropertyVariableOffset("primitive").second) {
200 MInt index = offset - getPropertyVariableOffset("primitive").first;
202 }
203 if(offset >= getPropertyVariableOffset("square").first && offset < getPropertyVariableOffset("square").second) {
204 MInt index = offset - getPropertyVariableOffset("square").first;
206 }
207 if(offset >= getPropertyVariableOffset("skewness").first && offset < getPropertyVariableOffset("skewness").second) {
208 MInt index = offset - getPropertyVariableOffset("skewness").first;
210 }
211 if(offset >= getPropertyVariableOffset("kurtosis").first && offset < getPropertyVariableOffset("kurtosis").second) {
212 MInt index = offset - getPropertyVariableOffset("kurtosis").first;
214 }
215 if(offset >= getPropertyVariableOffset("statisticCombustionAnalysis").first
216 && offset < getPropertyVariableOffset("statisticCombustionAnalysis").second) {
217 MInt index = offset - getPropertyVariableOffset("statisticCombustionAnalysis").first;
219 }
220 if(offset >= getPropertyVariableOffset("averageVorticity").first
221 && offset < getPropertyVariableOffset("averageVorticity").second) {
222 MInt index = offset - getPropertyVariableOffset("averageVorticity").first;
224 }
225 if(offset >= getPropertyVariableOffset("averageSpeedOfSound").first
226 && offset < getPropertyVariableOffset("averageSpeedOfSound").second) {
227 MInt index = offset - getPropertyVariableOffset("averageSpeedOfSound").first;
229 }
230 if(offset >= getPropertyVariableOffset("lamb0").first && offset < getPropertyVariableOffset("lamb0").second) {
231 MInt index = offset - getPropertyVariableOffset("lamb0").first;
233 }
234 if(offset >= getPropertyVariableOffset("du").first && offset < getPropertyVariableOffset("du").second) {
235 MInt index = offset - getPropertyVariableOffset("du").first;
237 }
238 if(offset >= getPropertyVariableOffset("drho").first && offset < getPropertyVariableOffset("drho").second) {
239 MInt index = offset - getPropertyVariableOffset("drho").first;
241 }
242 if(offset >= getPropertyVariableOffset("dp").first && offset < getPropertyVariableOffset("dp").second) {
243 MInt index = offset - getPropertyVariableOffset("dp").first;
245 }
246 if(offset >= getPropertyVariableOffset("gradu").first && offset < getPropertyVariableOffset("gradu").second) {
247 MInt index = offset - getPropertyVariableOffset("gradu").first;
249 }
250 if(offset >= getPropertyVariableOffset("ugradu").first && offset < getPropertyVariableOffset("ugradu").second) {
251 MInt index = offset - getPropertyVariableOffset("ugradu").first;
253 }
254 if(offset >= getPropertyVariableOffset("ugradrho").first && offset < getPropertyVariableOffset("ugradrho").second) {
255 MInt index = offset - getPropertyVariableOffset("ugradrho").first;
257 }
258 if(offset >= getPropertyVariableOffset("gradprho").first && offset < getPropertyVariableOffset("gradprho").second) {
259 MInt index = offset - getPropertyVariableOffset("gradprho").first;
261 }
262 if(offset >= getPropertyVariableOffset("rhodivu").first && offset < getPropertyVariableOffset("rhodivu").second) {
263 MInt index = offset - getPropertyVariableOffset("rhodivu").first;
265 }
266 if(offset >= getPropertyVariableOffset("correlation").first
267 && offset < getPropertyVariableOffset("correlation").second) {
268 MInt index = offset - getPropertyVariableOffset("correlation").first;
269 s = m_averageVariableName[16][0 /*index*/] + to_string(index);
270 }
271 return s;
272}
std::pair< MInt, MInt > getPropertyVariableOffset(MString s)
Definition: postdata.h:207
static const std::vector< std::vector< MString > > m_averageVariableName
Definition: postdata.h:288

◆ getVariablePropertyIndex()

template<MInt nDim_>
MInt PostData< nDim_ >::getVariablePropertyIndex ( MString  s)
inlineprotected

Definition at line 261 of file postdata.h.

261 {
262 auto entry = std::find(m_propertyName.begin(), m_propertyName.end(), s);
263 if(entry != m_propertyName.end()) {
264 return std::distance(m_propertyName.begin(), entry);
265 } else {
266 return -1;
267 }
268 };

◆ hasSplitBalancing()

template<MInt nDim_>
MBool PostData< nDim_ >::hasSplitBalancing ( ) const
inlineoverrideprotectedvirtual

Reimplemented from Solver.

Definition at line 304 of file postdata.h.

304{ return true; }

◆ initSolver()

template<MInt nDim>
void PostData< nDim >::initSolver
overridevirtual

Implements Solver.

Definition at line 135 of file postdata.cpp.

135 {
136 TRACE();
137
138 if(!isActive()) {
139 m_cells.clear();
140 m_cells.reset(grid().maxNoCells());
142 return;
143 }
144
146}

◆ isMeanFile()

template<MInt nDim_>
MBool PostData< nDim_ >::isMeanFile ( ) const
inline

Definition at line 177 of file postdata.h.

177{ return m_isMeanFile; }
MBool m_isMeanFile
Definition: postdata.h:313

◆ loadGridFlowVars()

template<MInt nDim>
void PostData< nDim >::loadGridFlowVars ( const MChar fileName,
MInt  noVariables,
std::vector< MString name 
)
Author
Jannik Borgelt

Definition at line 545 of file postdata.cpp.

545 {
546 TRACE();
547
548 // File loading.
549 stringstream variables;
550
551 using namespace maia::parallel_io;
552 ParallelIo parallelIo(fileName, PIO_READ, mpiComm());
553
554 // This should be the same for all the variables
555 ParallelIo::size_type dimLen = noInternalCells();
556 ParallelIo::size_type start = domainOffset(domainId()) - grid().bitOffset();
557
558 // set offset for all read operations
559 parallelIo.setOffset(dimLen, start);
560
561 for(MInt vId = 0; vId < noVariables; vId++) {
562 MString varName = names[vId]; // varNames[vId];//
563
564 // Load our variables
565 MFloatScratchSpace tmpVar((MInt)dimLen, AT_, "tmpVar");
566
567 parallelIo.readArray(tmpVar.getPointer(), "variables" + to_string(vId));
568 for(MInt i = 0; i < (MInt)dimLen; ++i) {
569 a_variable(i, vId) = tmpVar.p[i];
570 }
571 }
572}
This class is a ScratchSpace.
Definition: scratch.h:758
PARALLELIO_DEFAULT_BACKEND ParallelIo
Definition: parallelio.h:292

◆ loadMeanFile()

template<MInt nDim>
void PostData< nDim >::loadMeanFile ( const MString  fileName)
Author
A. Niemoeller
Date
23.04.14

checks for attribute "isMeanFile", if found all variables are loaded (e.g. means and statistical moments).

Parameters
[in]fileNamename of data file to load

Definition at line 488 of file postdata.cpp.

488 {
489 TRACE();
490
491 if(!isActive()) return;
492
493 ParallelIo parallelIo(fileName, maia::parallel_io::PIO_READ, mpiComm());
494
495 if(parallelIo.hasAttribute(MString("isMeanFile"))) {
496 // This should be the same for all the variables
497 ParallelIo::size_type dimLen = noInternalCells();
498 ParallelIo::size_type start = domainOffset(domainId()) - grid().bitOffset();
499
500 // set offset for all read operations
501 parallelIo.setOffset(dimLen, start);
502
503 vector<MString> var_names = parallelIo.getDatasetNames(1);
504 m_fileNoVars = var_names.size();
505 const MInt noCells = noInternalCells();
506
507 // Note: allocate new storage for all variables from the file
508 mAlloc(m_averagedVars, noCells, m_fileNoVars, "m_averagedVars", AT_);
509 ScratchSpace<MFloat> tmpVars(noCells, AT_, "tmpVars");
510
511 m_fileVarNames.clear();
512 for(MInt varId = 0; varId < m_fileNoVars; varId++) {
513 // Check for variable 'name' attribute
514 if(parallelIo.hasAttribute("name", var_names[varId])) {
515 MString varName = "";
516 parallelIo.getAttribute(&varName, "name", var_names[varId]);
517 m_fileVarNames.push_back(varName);
518 } else {
519 TERMM(1, "Variable has no attribute 'name'.");
520 }
521
522 parallelIo.readArray(tmpVars.begin(), var_names[varId]);
523 for(MInt cellId = 0; cellId < noCells; cellId++) {
524 m_averagedVars[cellId][varId] = tmpVars[cellId];
525 }
526 }
527 TERMM_IF_COND(m_fileVarNames.size() > 0 && (MInt)m_fileVarNames.size() != m_fileNoVars,
528 "Error: not every variable in '" + MString(fileName) + "' has the 'name' attribute.");
529
530 m_isMeanFile = true;
531 } else {
532 TERMM(1, "FIXME try to load regular data file");
533 m_isMeanFile = false;
534 // loadGridFlowVars(...);
535 }
536}
void mAlloc(T *&a, const MLong N, const MString &objectName, MString function)
allocates memory for one-dimensional array 'a' of size N
Definition: alloc.h:173
const MInt PIO_READ
Definition: parallelio.h:40

◆ loadRestartFile()

template<MInt nDim>
void PostData< nDim >::loadRestartFile
virtual

Reimplemented from Solver.

Definition at line 454 of file postdata.cpp.

454 {
455 TRACE();
456
457 stringstream fileName;
458 fileName << restartDir() << "restartFile_" << solverId() << "_" << globalTimeStep << ParallelIo::fileExt();
459
460 if(domainId() == 0) {
461 cerr << "loading post data for solver " << solverId() << " at time step " << globalTimeStep << " ...";
462 }
463
464 vector<MString> name;
465 for(MInt v = 0; v < noVariables(); v++) {
466 name.push_back(m_variablesName[v]);
467 }
468
469 m_log << "loading postprocessing variables ... ";
470
471 loadGridFlowVars((fileName.str()).c_str(), noVariables(), name);
472
473 m_log << "ok" << endl;
474}
void loadGridFlowVars(const MChar *fileName, MInt noVariables, std::vector< MString > name)
This function reads the parallel Netcdf cartesian grid cell based solution/restart file currently use...
Definition: postdata.cpp:545
std::vector< MString > m_variablesName
Definition: postdata.h:254
MString restartDir() const
Return the directory for restart files.
Definition: solver.h:410
MInt globalTimeStep
InfoOutFile m_log

◆ m_averageVariableName() [1/2]

const std::vector< std::vector< MString > > PostData< 3 >::m_averageVariableName
protected

Definition at line 20 of file postdata.cpp.

◆ m_averageVariableName() [2/2]

const std::vector< std::vector< MString > > PostData< 2 >::m_averageVariableName
protected

Definition at line 41 of file postdata.cpp.

◆ noCellDataDlb()

template<MInt nDim_>
MInt PostData< nDim_ >::noCellDataDlb ( ) const
inlineoverridevirtual

Reimplemented from Solver.

Definition at line 235 of file postdata.h.

235{ return 1; }; // communicated data: variables

◆ noInternalCells()

template<MInt nDim_>
MInt PostData< nDim_ >::noInternalCells ( ) const
inlineoverridevirtual

Implements Solver.

Definition at line 84 of file postdata.h.

84{ return grid().noInternalCells(); }

◆ noLoadTypes()

template<MInt nDim>
MInt PostData< nDim >::noLoadTypes
overridevirtual

Type 1: number of cells Type 2: ??? number cells used for probing Type 3: ??? number cells used for averaging

Author
Tim Wegmann

Reimplemented from Solver.

Definition at line 670 of file postdata.cpp.

670 {
671 TRACE();
672
673 const MInt noLsLoadTypes = 1;
674
675 return noLsLoadTypes;
676}

◆ noVariables()

template<MInt nDim_>
MInt PostData< nDim_ >::noVariables ( ) const
inlinevirtual

Reimplemented from Solver.

Definition at line 165 of file postdata.h.

165{ return m_noVariables; };
MInt m_noVariables
Definition: postdata.h:293

◆ postAdaptation()

template<MInt nDim>
void PostData< nDim >::postAdaptation
overridevirtual
Author
Tim Wegmann

Reimplemented from Solver.

Definition at line 854 of file postdata.cpp.

854 {
855 TRACE();
856
857 if(isActive()) {
858 this->compactCells();
859 m_freeIndices.clear();
860 } else {
861 grid().updateGridMap();
862 }
863
864 grid().updateOther();
865
867 this->checkNoHaloLayers();
868
869 // Nothing further to be done if solver inactive
870 if(!isActive()) return;
871
873
875}
void copyGridProperties()
Definition: postdata.cpp:112
MInt m_adaptationLevel
Definition: postdata.h:294
std::set< MInt > m_freeIndices
Definition: solver.h:101
void compactCells()
Removes all holes in the cell collector and moves halo cells to the back of the collector.

◆ postTimeStep()

template<MInt nDim_>
void PostData< nDim_ >::postTimeStep ( )
inlineoverridevirtual

Implements Solver.

Definition at line 89 of file postdata.h.

89{};

◆ prepareAdaptation()

template<MInt nDim>
void PostData< nDim >::prepareAdaptation
overridevirtual
Author
Tim Wegmann

Reimplemented from Solver.

Definition at line 800 of file postdata.cpp.

800 {
801 TRACE();
802
803 ASSERT(m_freeIndices.empty(), "");
804
806
807 if(!isActive()) return;
808}

◆ prepareRestart()

template<MInt nDim>
MBool PostData< nDim >::prepareRestart ( MBool  ,
MBool  
)
overridevirtual

Reimplemented from Solver.

Definition at line 312 of file postdata.cpp.

312 {
313 TRACE();
314
315 writeGridRestart = false;
316
317 // write intermediate restart file
318 if(m_restartInterval == -1 && !writeRestart) {
319 writeRestart = false;
320 }
321
322 MInt relativeTimeStep = globalTimeStep - m_restartOffset;
323 MInt relativeRestartTimeStep = m_restartTimeStep - m_restartOffset;
324
325 if(((relativeTimeStep % m_restartInterval) == 0 && relativeTimeStep > relativeRestartTimeStep) || writeRestart) {
326 writeRestart = true;
327 }
328
330 writeRestart = true;
332 writeGridRestart = true;
333 }
334 }
335
336 return writeRestart;
337}
MBool m_forceWriteRestart
Definition: postdata.h:175
MInt m_restartTimeStep
Definition: solver.h:80
MInt m_restartInterval
The number of timesteps before writing the next restart file.
Definition: solver.h:79
MInt m_restartOffset
Definition: solver.h:81

◆ preTimeStep()

template<MInt nDim_>
void PostData< nDim_ >::preTimeStep ( )
inlineoverridevirtual

Implements Solver.

Definition at line 88 of file postdata.h.

88{};

◆ readProperties()

template<MInt nDim_>
void PostData< nDim_ >::readProperties ( )
protected

◆ refineCell()

template<MInt nDim>
void PostData< nDim >::refineCell ( const MInt  gridCellId)
overridevirtual
Author
Tim Wegmann, Jannik Borgelt

Reimplemented from Solver.

Definition at line 894 of file postdata.cpp.

894 {
895 TRACE();
896
897 const MInt solverCellId = grid().tree().grid2solver(gridCellId);
898
899 for(MInt child = 0; child < grid().m_maxNoChilds; child++) {
900 const MInt childId = grid().raw().treeb().child(gridCellId, child);
901 if(childId == -1) continue;
902
903 if(!grid().raw().a_hasProperty(childId, Cell::WasNewlyCreated)
904 && grid().raw().a_hasProperty(gridCellId, Cell::IsPartLvlAncestor)) {
905 continue;
906 }
907
908 if(!g_multiSolverGrid) ASSERT(grid().raw().a_hasProperty(childId, Cell::WasNewlyCreated), "");
909
910 // If solver is inactive all cells musst be halo cells!
911 if(!isActive()) ASSERT(grid().raw().a_isHalo(childId), "");
912 // If child exists in grid but is not located inside solver geometry
913 if(!grid().solverFlag(childId, solverId())) continue;
914
915 const MInt solverChildId = this->createCellId(childId);
916
917 if(!g_multiSolverGrid) ASSERT(solverChildId == childId, "");
918
919 for(MInt v = 0; v < noVariables(); v++) {
920 a_variable(solverChildId, v) = a_variable(solverCellId, v);
921 }
922
923 // check-child-values
924#if !defined NDEBUG
925 for(MInt v = 0; v < noVariables(); v++) {
926 if(std::isnan(a_variable(solverChildId, v))) {
927 cerr << "Invalid-value in refined-Cell! "
928 << " " << solverChildId << " in rank " << domainId() << endl;
929 }
930 }
931#endif
932 }
933}
MBool g_multiSolverGrid

◆ reIntAfterRestart()

template<MInt nDim>
void PostData< nDim >::reIntAfterRestart ( MBool  doneRestart)
virtual
Author
Tim Wegmann

Reimplemented from Solver.

Definition at line 345 of file postdata.cpp.

345 {
346 TRACE();
347
348 if(doneRestart) {
350 }
351
352 m_forceWriteRestart = false;
353}

◆ removeCell()

template<MInt nDim>
void PostData< nDim >::removeCell ( const MInt  MInt)
overridevirtual

Reimplemented from Solver.

Definition at line 966 of file postdata.cpp.

966 {
967 TRACE();
968 // If solver is inactive cell musst never be a internal cell
969 if(!isActive()) {
970 ASSERT(grid().raw().a_isHalo(gridCellId), "");
971 }
972
973 const MInt solverCellId = grid().tree().grid2solver(gridCellId);
974
975 ASSERT(gridCellId > -1 && gridCellId < grid().raw().treeb().size() && solverCellId > -1
976 && solverCellId < m_cells.size() && grid().tree().solver2grid(solverCellId) == gridCellId,
977 "");
978
979 this->removeCellId(solverCellId);
980}

◆ removeChilds()

template<MInt nDim>
void PostData< nDim >::removeChilds ( const MInt  MInt)
overridevirtual

Reimplemented from Solver.

Definition at line 937 of file postdata.cpp.

937 {
938 TRACE();
939 // If solver is inactive cell must never be an internal cell
940 if(!isActive()) {
941 ASSERT(grid().raw().a_isHalo(gridCellId), "");
942 }
943
944 const MInt solverCellId = grid().tree().grid2solver(gridCellId);
945
946 ASSERT(solverCellId > -1 && solverCellId < m_cells.size(), "solverCellId is: " << solverCellId);
947
948 if(!g_multiSolverGrid) ASSERT(solverCellId == gridCellId, "");
949
950 for(MInt c = 0; c < grid().m_maxNoChilds; c++) {
951 MInt childId = c_childId(solverCellId, c);
952 if(childId < 0) continue;
953 this->removeCellId(childId);
954 }
955
956 if(!g_multiSolverGrid) {
957 ASSERT((grid().raw().treeb().size() - m_cells.size()) <= grid().m_maxNoChilds, "");
958 }
959}
MLong c_childId(const MInt cellId, const MInt pos) const
Definition: postdata.h:162

◆ resetSolver()

template<MInt nDim>
void PostData< nDim >::resetSolver
overrideprotectedvirtual
Author
Thomas Hoesgen

Reimplemented from Solver.

Definition at line 1037 of file postdata.cpp.

1037 {
1038 TRACE();
1040}
MBool mDeallocate(T *&a)
deallocates the memory previously allocated for element 'a'
Definition: alloc.h:544

◆ resizeGridMap()

template<MInt nDim>
void PostData< nDim >::resizeGridMap
overridevirtual

Reimplemented from Solver.

Definition at line 984 of file postdata.cpp.

984 {
985 grid().resizeGridMap(m_cells.size());
986}

◆ saveDataFile()

template<MInt nDim>
void PostData< nDim >::saveDataFile ( const MBool  writeBackup,
const MString  fileName,
const MInt  noVars,
std::vector< MString > &  variablesName,
MFloat variables 
)

Definition at line 372 of file postdata.cpp.

373 {
374 TRACE();
375
376 ASSERT(noVars > 0, "No variables set for PostData restart!");
377 ASSERT((MInt)variablesName.size() == noVars, "");
378
379 if(domainId() == 0) {
380 cerr << "Writing post data file '" << fileName << "' for solver " << solverId() << " at time step "
381 << globalTimeStep << " ...";
382 }
383
384 vector<MInt> reOrderedCells;
385 MInt countInternal = 0;
386 if(grid().newMinLevel() > 0) {
387 if(domainId() == 0) {
388 cerr << "Increasing minLevel for solver " << m_solverId;
389 }
390 this->reOrderCellIds(reOrderedCells);
391 for(MUint i = 0; i < reOrderedCells.size(); i++) {
392 if(a_isHalo(reOrderedCells[i])) continue;
393 countInternal++;
394 }
395 m_recalcIds = nullptr;
396 }
397 const MInt noCells = grid().newMinLevel() < 0 ? noInternalCells() : reOrderedCells.size();
398 const MInt noInternalCellIds = grid().newMinLevel() < 0 ? noInternalCells() : countInternal;
399
400 MFloatScratchSpace dbVariables(noCells * noVars, AT_, "dbVariables");
401 MIntScratchSpace idVariables(noCells * 2, AT_, "idVariables");
402 MFloatScratchSpace dbParameters(0, AT_, "dbParameters");
403 MIntScratchSpace idParameters(1, AT_, "idParameters");
404 vector<MString> dbVariablesName;
405 vector<MString> idVariablesName;
406 vector<MString> dbParametersName;
407 vector<MString> idParametersName;
408
409 this->collectVariables(variables, dbVariables, variablesName, dbVariablesName, noVars, noCells);
410
411 this->collectParameters(globalTimeStep, idParameters, "globalTimeStep", idParametersName);
412
413 MIntScratchSpace recalcIdsSolver(grid().tree().size(), AT_, "recalcIds");
414 if(m_recalcIds != nullptr) {
415 MInt cellId = 0;
416 for(MInt gridcell = 0; gridcell < grid().raw().m_noInternalCells; gridcell++) {
417 if(grid().raw().a_hasProperty(gridcell, Cell::IsHalo)) continue;
418 MInt l_solverId = grid().tree().grid2solver(m_recalcIds[gridcell]);
419 if(l_solverId > -1) {
420 recalcIdsSolver[cellId] = l_solverId;
421 cellId++;
422 ASSERT(grid().solverFlag(m_recalcIds[gridcell], m_solverId), "");
423 }
424 }
425 ASSERT(cellId == grid().noInternalCells(), "recalc ids size is wrong");
426 }
427
428 MString gridFile = (m_currentGridFileName == "") ? grid().gridInputFileName() : m_currentGridFileName;
429
430 saveGridFlowVars(fileName.c_str(), gridFile.c_str(), noCells, noInternalCellIds, dbVariables, dbVariablesName, 0,
431 idVariables, idVariablesName, 0, dbParameters, dbParametersName, idParameters, idParametersName,
432 recalcIdsSolver.begin(), -1);
433
434 // TODO labels:PP this is still specific to restart files
435 if(writeBackup) {
436 stringstream backupFileName;
437 backupFileName.clear();
438 backupFileName.str("");
439 backupFileName << outputDir() << "restartFileBackup_" << solverId() << "_" << globalTimeStep;
440 backupFileName << ParallelIo::fileExt();
441 if(domainId() == 0) cerr << "Writing post data (backup) for solver " << solverId() << "... ";
442
443 saveGridFlowVars((backupFileName.str()).c_str(), gridFile.c_str(), noCells, noInternalCellIds, dbVariables,
444 dbVariablesName, 0, idVariables, idVariablesName, 0, dbParameters, dbParametersName, idParameters,
445 idParametersName, recalcIdsSolver.begin(), -1);
446 }
447
448
449 if(domainId() == 0) cerr << "ok" << endl;
450}
MString m_currentGridFileName
Definition: postdata.h:300
MString outputDir() const
Return the directory for output files.
Definition: solver.h:407
const MInt m_solverId
a unique solver identifier
Definition: solver.h:90
void saveGridFlowVars(const MChar *fileName, const MChar *gridFileName, const MInt noTotalCells, const MInt noInternal, MFloatScratchSpace &dbVariables, std::vector< MString > &dbVariablesName, MInt noDbVars, MIntScratchSpace &idVariables, std::vector< MString > &idVariablesName, MInt noIdVars, MFloatScratchSpace &dbParameters, std::vector< MString > &dbParametersName, MIntScratchSpace &idParameters, std::vector< MString > &idParametersName, MInt *recalcIds, MFloat time)
This function writes the parallel Netcdf cartesian grid cell based solution/restart file currently us...
void collectVariables(T *variablesIn, ScratchSpace< T > &variablesOut, const std::vector< MString > &variablesNameIn, std::vector< MString > &variablesNameOut, const MInt noVars, const MInt noCells, const MBool reverseOrder=false)
generalised helper function for writing restart files! This is necessary for example if the minLevel ...
void collectParameters(T, ScratchSpace< T > &, const MChar *, std::vector< MString > &)
This function collects a single parameters for the massivley parallel IO functions.
void reOrderCellIds(std::vector< MInt > &reOrderedCells)
reOrder cellIds before writing the restart file! This is necessary for example if the minLevel shall ...
uint32_t MUint
Definition: maiatypes.h:63

◆ saveRestartFile()

template<MInt nDim>
void PostData< nDim >::saveRestartFile ( const MBool  writeBackup)

Definition at line 356 of file postdata.cpp.

356 {
357 TRACE();
358
359 ASSERT(noVariables() > 0, "No variables set for PostData restart!");
360 ASSERT(!m_variablesName.empty(), "");
361 ASSERT((MInt)m_variablesName.size() == noVariables(), "");
362
363 // TODO labels:IO use same restart file name format for all solvers, e.g. restart_s[solverId]_[timeStep].[ext] with
364 // zero padded formatted timeStep
365 stringstream fileName;
366 fileName << outputDir() << "restartFile_" << solverId() << "_" << globalTimeStep << ParallelIo::fileExt();
367
368 saveDataFile(writeBackup, fileName.str(), noVariables(), m_variablesName, &a_variable(0, 0));
369}
void saveDataFile(const MBool writeBackup, const MString fileName, const MInt noVars, std::vector< MString > &variablesName, MFloat *variables)
Definition: postdata.cpp:372

◆ saveSolverSolution()

template<MInt nDim>
void PostData< nDim >::saveSolverSolution ( const  MBool,
const  MBool 
)

Definition at line 575 of file postdata.cpp.

575 {
576 TRACE();
577
578 if(!isActive()) return;
579
580 MInt offset = m_solutionOffset;
581
582 // solution output
583 // ---------------
584 if((((globalTimeStep - offset) % m_solutionInterval) == 0 && globalTimeStep >= offset)
585 || (m_solutionTimeSteps.count(globalTimeStep) > 0)) {
586 if(domainId() == 0)
587 cerr << "solverId: " << m_solverId << ", Writing " << m_outputFormat << " output at time step " << globalTimeStep
588 << ", time " << m_time << " ... ";
589
590 m_log << "Writing " << m_outputFormat << " output at time step " << globalTimeStep << ", time " << m_time
591 << " for postData ... ";
592
593 MFloatScratchSpace dbVariables(a_noCells() * noVariables(), AT_, "dbVariables");
594 MIntScratchSpace idVariables(a_noCells() * 2, AT_, "idVariables");
595 MFloatScratchSpace dbParameters(4, AT_, "dbParameters");
596 MIntScratchSpace idParameters(2, AT_, "idParameters");
597 vector<MString> dbVariablesName;
598 vector<MString> idVariablesName;
599 vector<MString> dbParametersName;
600 vector<MString> idParametersName;
601 vector<MString> name;
602
603 stringstream fileName;
604
605 fileName << m_solutionOutput << "ppQOUT_" << globalTimeStep;
606
607 for(MInt v = 0; v < noVariables(); v++) {
608 name.push_back(m_variablesName[v]);
609 }
610
611 this->collectVariables(&a_variable(0, 0), dbVariables, name, dbVariablesName, noVariables(), a_noCells());
612
613 this->collectParameters(globalTimeStep, idParameters, "globalTimeStep", idParametersName);
614
615 switch(string2enum(m_outputFormat)) {
616 case NETCDF: {
617 fileName << ParallelIo::fileExt();
618 // TODO: currently not working for adaptation, check save restartFile
619 // and get solver recalcIds!
620 //
621 saveGridFlowVars((fileName.str()).c_str(), grid().gridInputFileName().c_str(), a_noCells(), noInternalCells(),
622 dbVariables, dbVariablesName, 0, idVariables, idVariablesName, 0, dbParameters,
623 dbParametersName, idParameters, idParametersName, m_recalcIds, -1);
624 break;
625 }
626 case VTK:
627 case VTU:
628 case VTP: {
629 break;
630 }
631 default: {
632 stringstream errorMessage;
633 errorMessage << "PostData::saveSolverSolution(): switch variable 'm_outputFormat' with value " << m_outputFormat
634 << " not matching any case." << endl;
635 mTerm(1, AT_, errorMessage.str());
636 }
637 }
638
639 if(domainId() == 0) cerr << "ok" << endl;
640 }
641}
MString m_outputFormat
Definition: postdata.h:205
std::set< MInt > m_solutionTimeSteps
Definition: solver.h:76
MString m_solutionOutput
Definition: solver.h:82
MInt m_solutionOffset
Definition: solver.h:75
MInt m_solutionInterval
The number of timesteps before writing the next solution file.
Definition: solver.h:74
MInt string2enum(MString theString)
This global function translates strings in their corresponding enum values (integer values)....
Definition: enums.cpp:20
@ NETCDF
Definition: enums.h:18
@ VTK
Definition: enums.h:18
@ VTP
Definition: enums.h:18
@ VTU
Definition: enums.h:18
void mTerm(const MInt errorCode, const MString &location, const MString &message)
Definition: functions.cpp:29

◆ setAndAllocateSolverData()

template<MInt nDim>
void PostData< nDim >::setAndAllocateSolverData ( const MBool  fullReset)

Definition at line 150 of file postdata.cpp.

150 {
151 TRACE();
152
154
155 mAlloc(m_recalcIds, maxNoCells, "m_recalcIds", -1, AT_);
156 for(MInt i = 0; i < maxNoCells; i++) {
157 m_recalcIds[i] = i;
158 }
159
160 m_cells.setNoVariables(noVariables());
161
162 m_cells.reset(grid().raw().treeb().capacity());
163 m_cells.append(c_noCells());
164
166
167 // NOTE: setting default here
169
170 if(fullReset) {
171 for(MInt cellId = 0; cellId < noInternalCells(); cellId++) {
172 for(MInt v = 0; v < noVariables(); v++) {
173 a_variable(cellId, v) = 0;
174 }
175 }
176 }
177}
void setVariableNames()
Definition: postdata.cpp:181

◆ setCellDataDlb()

template<MInt nDim_>
void PostData< nDim_ >::setCellDataDlb ( const MInt  dataId,
const MFloat *const  data 
)
inlineoverride

Definition at line 251 of file postdata.h.

251{ setCellDataDlb_(dataId, data); };
void setCellDataDlb_(const MInt dataId, const dataType *const data)
Set the solver cell data after DLB.
Definition: postdata.h:323

◆ setCellDataDlb_()

template<MInt nDim_>
template<typename dataType >
void PostData< nDim_ >::setCellDataDlb_ ( const MInt  dataId,
const dataType *const  data 
)
inlineprivate

Definition at line 323 of file postdata.h.

323 {
324 TRACE();
325
326 // Nothing to do if solver is not active
327 if(!isActive()) {
328 return;
329 }
330
331 // Set the variables if this is the correct reinitialization stage
332 if(dataId == 0) {
334 std::copy_n(data, noInternalCells() * noVariables(), &a_variable(0, 0));
335 }
336 } else {
337 TERMM(1, "Unknown data id.");
338 }
339 }

◆ setCellWeights()

template<MInt nDim>
void PostData< nDim >::setCellWeights ( MFloat solverCellWeight)
overridevirtual
Author
Tim Wegmann

Reimplemented from Solver.

Definition at line 721 of file postdata.cpp.

721 {
722 TRACE();
723 const MInt noCellsGrid = grid().raw().treeb().size();
724 const MInt offset = noCellsGrid * solverId();
725
726 for(MInt cellId = 0; cellId < c_noCells(); cellId++) {
727 const MInt gridCellId = grid().tree().solver2grid(cellId);
728 const MInt id = gridCellId + offset;
729 // TODO: find good value for postData!
730 solverCellWeight[id] = 0.2;
731 }
732}
MInt id
Definition: maiatypes.h:71

◆ setPropertyVariableOffset()

template<MInt nDim_>
void PostData< nDim_ >::setPropertyVariableOffset ( MString  s,
MInt  start,
MInt  length 
)
inline

Definition at line 213 of file postdata.h.

213 {
215 if(index > -1) {
216 m_variableOffset[index].first = start;
217 m_variableOffset[index].second = start + length;
218 }
219 }

◆ setSensors()

template<MInt nDim>
void PostData< nDim >::setSensors ( std::vector< std::vector< MFloat > > &  sensors,
std::vector< MFloat > &  sensorWeight,
std::vector< std::bitset< 64 > > &  sensorCellFlag,
std::vector< MInt > &  sensorSolverId 
)
overridevirtual
Author
Tim Wegmann

Reimplemented from Solver.

Definition at line 815 of file postdata.cpp.

818 {
819 TRACE();
820
821 const MInt sensorOffset = (signed)sensors.size();
822 ASSERT(sensorOffset == 0 || grid().raw().treeb().noSolvers() > 1, "");
823 sensors.resize(sensorOffset + this->m_noSensors, vector<MFloat>(grid().raw().m_noInternalCells, F0));
824 sensorWeight.resize(sensorOffset + this->m_noSensors, -1);
825 sensorCellFlag.resize(grid().raw().m_noInternalCells, sensorOffset + this->m_noSensors);
826 sensorSolverId.resize(sensorOffset + this->m_noSensors, solverId());
827 ASSERT(sensorOffset + this->m_noSensors < CartesianGrid<nDim>::m_maxNoSensors, "Increase bitset size!");
828
829 for(MInt sen = 0; sen < this->m_noSensors; sen++) {
830 sensorWeight[sensorOffset + sen] = this->m_sensorWeight[sen];
831 }
832
833 ASSERT(m_freeIndices.empty(), "");
834 m_freeIndices.clear();
835
836 if(!isActive()) return;
837 if(!this->m_adapts) return;
838
839 if(domainId() == 0) {
840 cerr << "Setting " << this->m_noSensors << " sensors for post-Data adaptation." << endl;
841 }
842
843 for(MInt sen = 0; sen < this->m_noSensors; sen++) {
844 (this->*(this->m_sensorFnPtr[sen]))(sensors, sensorCellFlag, sensorWeight, sensorOffset, sen);
845 }
846}
MInt noSolvers
Definition: maiatypes.h:73

◆ setVariableNames()

template<MInt nDim>
void PostData< nDim >::setVariableNames

Definition at line 181 of file postdata.cpp.

181 {
182 TRACE();
183
184 m_variablesName.clear();
185
186 for(MInt i = 0; i < noVariables(); i++) {
188 auto it = std::find(m_variablesName.begin(), m_variablesName.end(), s);
189 if(it == m_variablesName.end()) {
190 m_variablesName.push_back(getVariableName(i));
191 }
192 }
193}
MString getVariableName(MInt offset)
Definition: postdata.cpp:197

◆ solutionStep()

template<MInt nDim_>
MBool PostData< nDim_ >::solutionStep ( )
inlineoverridevirtual

Reimplemented from Solver.

Definition at line 90 of file postdata.h.

90{ return true; };

◆ swapCells()

template<MInt nDim>
void PostData< nDim >::swapCells ( const MInt  cellId0,
const MInt  cellId1 
)
overridevirtual
Author
Tim Wegmann

Reimplemented from Solver.

Definition at line 994 of file postdata.cpp.

994 {
995 TRACE();
996
997 const MInt size = m_cells.size();
998 m_cells.append();
999 m_cells.erase(size);
1000 m_cells.copy(cellId0, size);
1001 m_cells.copy(cellId1, cellId0);
1002 m_cells.copy(size, cellId1);
1003 m_cells.erase(size);
1004 m_cells.size(size);
1005}

◆ swapProxy()

template<MInt nDim>
void PostData< nDim >::swapProxy ( const MInt  cellId0,
const MInt  cellId1 
)
overridevirtual
Author
Tim Wegmann

Reimplemented from Solver.

Definition at line 1013 of file postdata.cpp.

1013 {
1014 grid().swapGridIds(cellId0, cellId1);
1015}

◆ time()

template<MInt nDim_>
MFloat PostData< nDim_ >::time ( ) const
inlineoverridevirtual

Implements Solver.

Definition at line 86 of file postdata.h.

86{ return globalTimeStep; }

◆ timeStep()

template<MInt nDim_>
MFloat PostData< nDim_ >::timeStep ( ) const
inline

Definition at line 85 of file postdata.h.

85{ return m_timeStep; }
MFloat m_timeStep
Definition: postdata.h:201

◆ writeRestartFile() [1/2]

template<MInt nDim>
void PostData< nDim >::writeRestartFile ( const MBool  writeRestart,
const MBool  writeBackup,
const MString  gridFileName,
MInt recalcIdTree 
)
overridevirtual

Reimplemented from Solver.

Definition at line 290 of file postdata.cpp.

291 {
292 TRACE();
293
294 // post-data has no cell-data
295 if(noVariables() == 0) return;
296
297 m_currentGridFileName = gridFileName;
298
299 if(m_recalcIds != nullptr) {
300 for(MInt cellId = 0; cellId < maxNoGridCells(); cellId++) {
301 m_recalcIds[cellId] = recalcIdTree[cellId];
302 }
303 }
304
305 if(writeRestart) {
306 saveRestartFile(writeBackup);
307 }
308}
void saveRestartFile(const MBool writeBackup)
Definition: postdata.cpp:356

◆ writeRestartFile() [2/2]

template<MInt nDim_>
void PostData< nDim_ >::writeRestartFile ( MBool  )
inlineoverridevirtual

Reimplemented from Solver.

Definition at line 96 of file postdata.h.

96{};

Member Data Documentation

◆ m_adaptationLevel

template<MInt nDim_>
MInt PostData< nDim_ >::m_adaptationLevel = -1
protected

Definition at line 294 of file postdata.h.

◆ m_adaptationSinceLastRestart

template<MInt nDim_>
MBool PostData< nDim_ >::m_adaptationSinceLastRestart = false
protected

Definition at line 296 of file postdata.h.

◆ m_averagedVars

template<MInt nDim_>
MFloat** PostData< nDim_ >::m_averagedVars = nullptr

Definition at line 257 of file postdata.h.

◆ m_averageVariableName

template<MInt nDim_>
const std::vector<std::vector<MString> > PostData< nDim_ >::m_averageVariableName
staticprotected

Definition at line 288 of file postdata.h.

◆ m_cells

template<MInt nDim_>
maia::post::collector::PostCellCollector<nDim> PostData< nDim_ >::m_cells

Definition at line 34 of file postdata.h.

◆ m_currentGridFileName

template<MInt nDim_>
MString PostData< nDim_ >::m_currentGridFileName {}
protected

Definition at line 300 of file postdata.h.

◆ m_fileNoVars

template<MInt nDim_>
MInt PostData< nDim_ >::m_fileNoVars = -1
protected

Definition at line 315 of file postdata.h.

◆ m_fileVarNames

template<MInt nDim_>
std::vector<MString> PostData< nDim_ >::m_fileVarNames {}
protected

Definition at line 317 of file postdata.h.

◆ m_forceAdaptation

template<MInt nDim_>
MBool PostData< nDim_ >::m_forceAdaptation = false
protected

Definition at line 295 of file postdata.h.

◆ m_forceWriteRestart

template<MInt nDim_>
MBool PostData< nDim_ >::m_forceWriteRestart = false

Definition at line 175 of file postdata.h.

◆ m_geometry

template<MInt nDim_>
Geom* PostData< nDim_ >::m_geometry

Definition at line 79 of file postdata.h.

◆ m_isMeanFile

template<MInt nDim_>
MBool PostData< nDim_ >::m_isMeanFile = false
protected

Definition at line 313 of file postdata.h.

◆ m_loadBalancingReinitStage

template<MInt nDim_>
MInt PostData< nDim_ >::m_loadBalancingReinitStage = -1
protected

Definition at line 305 of file postdata.h.

◆ m_noVariables

template<MInt nDim_>
MInt PostData< nDim_ >::m_noVariables = 0
protected

Definition at line 293 of file postdata.h.

◆ m_outputFormat

template<MInt nDim_>
MString PostData< nDim_ >::m_outputFormat

Definition at line 205 of file postdata.h.

◆ m_propertyName

template<MInt nDim_>
const std::vector<MString> PostData< nDim_ >::m_propertyName
protected
Initial value:
= {"primitive",
"square",
"kurtosis",
"skewness",
"statisticCombustionAnalysis",
"averageVorticity",
"averageSpeedOfSound",
"lamb0",
"du",
"drho",
"dp",
"gradu",
"ugradu",
"ugradrho",
"gradprho",
"rhodivu",
"correlation"}

Definition at line 270 of file postdata.h.

◆ m_sourceVarsIndex

template<MInt nDim_>
MInt PostData< nDim_ >::m_sourceVarsIndex

Definition at line 223 of file postdata.h.

◆ m_time

template<MInt nDim_>
MFloat PostData< nDim_ >::m_time = NAN

Definition at line 202 of file postdata.h.

◆ m_timeStep

template<MInt nDim_>
MFloat PostData< nDim_ >::m_timeStep = NAN

Definition at line 201 of file postdata.h.

◆ m_variableOffset

template<MInt nDim_>
std::vector<std::pair<MInt, MInt> > PostData< nDim_ >::m_variableOffset
protected

Definition at line 290 of file postdata.h.

◆ m_variablesName

template<MInt nDim_>
std::vector<MString> PostData< nDim_ >::m_variablesName

Definition at line 254 of file postdata.h.

◆ nDim

template<MInt nDim_>
constexpr MInt PostData< nDim_ >::nDim = nDim_
staticconstexpr

Definition at line 25 of file postdata.h.


The documentation for this class was generated from the following files: