METHOD
ParallelSaveData Class Reference

#include <parallelSaveData.h>

Inheritance diagram for ParallelSaveData:
Collaboration diagram for ParallelSaveData:

Public Member Functions

void saveCons ()
 
void savePrims ()
 
void saveAux ()
 
void saveDomain ()
 
void saveConsts ()
 
 ParallelSaveData (Data *data, ParallelEnv *env, int test=0)
 
virtual ~ParallelSaveData ()
 
void saveAll (bool timeSeries=false)
 
void saveVar (string variable, int num=1)
 
- Public Member Functions inherited from SaveData
 SaveData (Data *data, int test=0)
 
virtual ~SaveData ()
 

Public Attributes

ParallelEnvenv
 
- Public Attributes inherited from SaveData
Datad
 
int Nouts
 
int Ncount
 
int test
 
char dir [50]
 
char app [50]
 

Private Member Functions

void packStateVectorBuffer (double *buffer, double *stateVector, int nVars)
 
void sendStateVectorBufferToMaster (double *buffer, int numCellsSent, int rank)
 
void unpackStateVectorBuffer (double *buffer, double *stateVector, int nVars, int rank)
 
void copyMasterStateVectorToFullStateVector (double *fullStateVector, double *stateVector, int nVars)
 
void writeStateVectorToFile (FILE *f, double *fullStateVector, int nVars)
 

Detailed Description

Class used to save simulation data to a text format using multiple processes

Write outputs through the simple system of collecting all simulation data onto process 0 and writing out from process 0. This is easy to code but has the downside of limiting the problem size to one that will fit onto one node.

Class is initialized with the data that is to be saved. Saves the simulation data in the Data directory, located within the Project folder. All data is saved automatically, including all constant data (xmin, ymax, endTime etc) and and the values of all prims, aux and cons variables.

Definition at line 27 of file parallelSaveData.h.

Constructor & Destructor Documentation

◆ ParallelSaveData()

ParallelSaveData::ParallelSaveData ( Data data,
ParallelEnv env,
int  test = 0 
)
inline

Constructor.

The constructor take a pointer to the data class which the user wants to save. All this data is automatically saved in the Data directory, located in the Project folder.
Parameters
*datapointer to the Data class
testintegar flagging if we are in the 'Examples' directory or not, Only used for running the given examples, can ignore otherwise.

Definition at line 103 of file parallelSaveData.h.

◆ ~ParallelSaveData()

virtual ParallelSaveData::~ParallelSaveData ( )
inlinevirtual

Destructor.

Definition at line 105 of file parallelSaveData.h.

Member Function Documentation

◆ copyMasterStateVectorToFullStateVector()

void ParallelSaveData::copyMasterStateVectorToFullStateVector ( double *  fullStateVector,
double *  stateVector,
int  nVars 
)
private

Process 0 already holds the values for its own subdomain, so does not need to send them anywhere. Instead, it needs to copy its subdomain values (cons, prims, aux) to the vector containing the full simulation domain

Parameters
[in,out]*fullStateVectorpointer to cons, prims or aux array of size equal to the full simulation domain
[in]*stateVectorpointer to cons, prims or aux array for process 0's subdomain
[in]nVarsnumber of variables in the cons, prims or aux array

◆ packStateVectorBuffer()

void ParallelSaveData::packStateVectorBuffer ( double *  buffer,
double *  stateVector,
int  nVars 
)
private

For each particular state vector (cons, prims, aux) packs a buffer containing all cells in a subdomain (not including ghost values) to be sent to process 0

Parameters
[out]*bufferpointer to the buffer to pack
[in]*stateVectorpointer to cons, prims or aux array
[in]nVarsnumber of variables in the cons, prims or aux array

◆ saveAll()

void ParallelSaveData::saveAll ( bool  timeSeries = false)
virtual

Saves all cons, prims, aux and constant data.

This calls the other member functions to save their respective simulation data.
Parameters
[in]timeSeriesflags whether the saved data is final or transient

Implements SaveData.

◆ saveAux()

void ParallelSaveData::saveAux ( )
virtual

Saves the auxiliary vector state.

Implements SaveData.

◆ saveCons()

void ParallelSaveData::saveCons ( )
virtual

Saves the conserved vector state.

Implements SaveData.

◆ saveConsts()

void ParallelSaveData::saveConsts ( )
virtual

Saves the constant data.

Implements SaveData.

◆ saveDomain()

void ParallelSaveData::saveDomain ( )
virtual

Saves the domain coordinates.

Implements SaveData.

◆ savePrims()

void ParallelSaveData::savePrims ( )
virtual

Saves the primitive vector state.

Implements SaveData.

◆ saveVar()

void ParallelSaveData::saveVar ( string  variable,
int  num = 1 
)
virtual

Saves user specified variable.

Function saves the data for the variable specified by the string var
Parameters
[in]variableDefines the variable the user wants to save. Should match a variable label
[in]numnumber of user-specified variables to save in total (required for consistent numbering of files)

Implements SaveData.

◆ sendStateVectorBufferToMaster()

void ParallelSaveData::sendStateVectorBufferToMaster ( double *  buffer,
int  numCellsSent,
int  rank 
)
private

For each subdomain, send a buffer containing the non-ghost cells in that subdomain to a buffer on process 0.

Parameters
[in,out]*bufferpointer to the buffer to send or receive
[in]numCellsSentnumber of cells in the buffer
[in]rankglobal id of the process sending its buffer to process 0

◆ unpackStateVectorBuffer()

void ParallelSaveData::unpackStateVectorBuffer ( double *  buffer,
double *  stateVector,
int  nVars,
int  rank 
)
private

For each particular state vector (cons, prims, aux) unpacks a buffer containing all cells (not including ghost values) received from a particular subdomain into a vector containing the full simulation domain

Parameters
[in]*bufferpointer to the buffer to unpack
[in,out]*stateVectorpointer to cons, prims or aux array of size equal to the full simulation domain
[in]rankglobal id of the process that sent its buffer to process 0

◆ writeStateVectorToFile()

void ParallelSaveData::writeStateVectorToFile ( FILE *  f,
double *  fullStateVector,
int  nVars 
)
private

Member Data Documentation

◆ env

ParallelEnv* ParallelSaveData::env

Pointer to PlatformEnv class containing platform specific info such as MPI details.

Definition at line 30 of file parallelSaveData.h.


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