escript
Revision_
|
Represents an escript dataset including a domain and data variables for one timestep. More...
#include <EscriptDataset.h>
Public Member Functions | |
EscriptDataset () | |
Default constructor. More... | |
~EscriptDataset () | |
Destructor. More... | |
bool | setDomain (const escript::AbstractDomain *domain) |
Sets the escript domain for this dataset. This method can only be called once and should be the first call unless loading from dump files. More... | |
bool | addData (escript::Data &data, const std::string name, const std::string units="") |
Adds an escript data instance to this dataset. You must ensure that the data is defined on the domain that was used in. More... | |
bool | loadNetCDF (const std::string domainFilePattern, const StringVec &varFiles, const StringVec &varNames, int nChunks) |
Loads domain and variables from escript NetCDF files. More... | |
bool | loadNetCDF (const DomainChunks &domain, const StringVec &varFiles, const StringVec &varNames) |
Loads only variables from escript NetCDF files using the domain provided. More... | |
void | setCycleAndTime (int c, double t) |
Sets the cycle number and time value for this dataset. More... | |
int | getCycle () const |
Returns the cycle number. More... | |
double | getTime () const |
Returns the time value. More... | |
void | setMeshLabels (const std::string x, const std::string y, const std::string z="") |
Sets labels for the mesh axes. More... | |
void | setMeshUnits (const std::string x, const std::string y, const std::string z="") |
Sets units for the mesh axes. More... | |
void | setMetadataSchemaString (const std::string schema, const std::string metadata) |
Sets a metadata schema and content. More... | |
void | setSaveMeshData (bool flag) |
Enables/Disables saving of mesh-related data. More... | |
bool | saveSilo (const std::string fileName, bool useMultiMesh=true) |
Saves the dataset in the Silo file format. More... | |
bool | saveVTK (const std::string fileName) |
Saves the dataset in the VTK XML file format. More... | |
DomainChunks | getConvertedDomain () |
Returns the dataset's converted domain so it can be reused. More... | |
const VarVector & | getVariables () const |
Returns a vector with the dataset's variables. More... | |
const VarVector & | getMeshVariables () const |
Returns a vector with the mesh variables. More... | |
void * | getMPIComm () |
Private Member Functions | |
bool | loadDomain (const std::string filePattern, int nChunks) |
bool | setExternalDomain (const DomainChunks &domain) |
bool | loadData (const std::string filePattern, const std::string name, const std::string units) |
void | convertMeshVariables () |
void | updateSampleDistribution (VarInfo &vi) |
void | putSiloMultiMesh (DBfile *dbfile, const std::string &meshName) |
void | putSiloMultiTensor (DBfile *dbfile, const VarInfo &vi) |
void | putSiloMultiVar (DBfile *dbfile, const VarInfo &vi, bool useMeshFile=false) |
bool | saveVTKsingle (const std::string &fileName, const std::string &meshName, const VarVector &vars) |
void | writeVarToVTK (const VarInfo &varInfo, std::ostream &os) |
Private Attributes | |
int | cycle |
double | time |
std::string | mdSchema |
std::string | mdString |
StringVec | meshLabels |
StringVec | meshUnits |
bool | externalDomain |
bool | wantsMeshVars |
DomainChunks | domainChunks |
VarVector | variables |
VarVector | meshVariables |
int | mpiRank |
int | mpiSize |
void * | mpiComm |
Represents an escript dataset including a domain and data variables for one timestep.
This class represents an escript dataset complete with domain and variable data. It can read the dataset from files generated by the dump() methods within escript or through an escript domain instance plus a number of escript::Data instances. Subsequently, the dataset can be saved in the Silo or VTK file format or accessed through a number of accessor methods.
If the data is distributed via MPI then all ranks should create an instance of this class and call the respective methods. Dump files that stem from a parallel run can be read on one processor or on the same number of MPI processes as they were created with.
weipa::EscriptDataset::EscriptDataset | ( | ) |
Default constructor.
References cycle, externalDomain, mpiComm, mpiRank, mpiSize, time, and wantsMeshVars.
weipa::EscriptDataset::~EscriptDataset | ( | ) |
Destructor.
bool weipa::EscriptDataset::addData | ( | escript::Data & | data, |
const std::string | name, | ||
const std::string | units = "" |
||
) |
Adds an escript data instance to this dataset. You must ensure that the data is defined on the domain that was used in.
References weipa::VarInfo::dataChunks, domainChunks, weipa::VarInfo::units, updateSampleDistribution(), weipa::VarInfo::valid, variables, and weipa::VarInfo::varName.
Referenced by BOOST_PYTHON_MODULE().
|
private |
References weipa::VarInfo::dataChunks, domainChunks, meshVariables, updateSampleDistribution(), weipa::VarInfo::valid, and weipa::VarInfo::varName.
Referenced by loadDomain(), and setDomain().
|
inline |
Returns the dataset's converted domain so it can be reused.
|
inline |
Returns the cycle number.
|
inline |
Returns a vector with the mesh variables.
|
inline |
|
inline |
Returns the time value.
|
inline |
Returns a vector with the dataset's variables.
|
private |
References weipa::VarInfo::dataChunks, domainChunks, MPI_INT, MPI_MAX, mpiComm, mpiRank, mpiSize, weipa::VarInfo::units, updateSampleDistribution(), weipa::VarInfo::valid, variables, and weipa::VarInfo::varName.
Referenced by loadNetCDF().
|
private |
References convertMeshVariables(), domainChunks, MPI_INT, MPI_MAX, mpiComm, mpiRank, and mpiSize.
Referenced by loadNetCDF().
bool weipa::EscriptDataset::loadNetCDF | ( | const std::string | domainFilePattern, |
const StringVec & | varFiles, | ||
const StringVec & | varNames, | ||
int | nChunks | ||
) |
Loads domain and variables from escript NetCDF files.
domainFilePattern | a printf-style pattern for the domain file names (e.g. "dom.%02d.nc") |
varFiles | a vector of file name patterns for variables |
varNames | a vector of variable names |
nChunks | number of chunks to load |
References loadData(), and loadDomain().
bool weipa::EscriptDataset::loadNetCDF | ( | const DomainChunks & | domain, |
const StringVec & | varFiles, | ||
const StringVec & | varNames | ||
) |
Loads only variables from escript NetCDF files using the domain provided.
References loadData(), and setExternalDomain().
|
private |
References cycle, domainChunks, meshVariables, time, and variables.
Referenced by saveSilo().
|
private |
References cycle, weipa::VarInfo::dataChunks, weipa::VarInfo::sampleDistribution, time, and weipa::VarInfo::varName.
Referenced by saveSilo().
|
private |
References cycle, domainChunks, weipa::VarInfo::sampleDistribution, time, and weipa::VarInfo::varName.
Referenced by saveSilo().
bool weipa::EscriptDataset::saveSilo | ( | const std::string | fileName, |
bool | useMultiMesh = true |
||
) |
Saves the dataset in the Silo file format.
References cycle, domainChunks, externalDomain, meshLabels, meshUnits, meshVariables, mpiComm, mpiRank, mpiSize, putSiloMultiMesh(), putSiloMultiTensor(), putSiloMultiVar(), time, variables, and wantsMeshVars.
Referenced by BOOST_PYTHON_MODULE().
bool weipa::EscriptDataset::saveVTK | ( | const std::string | fileName | ) |
Saves the dataset in the VTK XML file format.
References domainChunks, mpiComm, mpiRank, mpiSize, saveVTKsingle(), and variables.
Referenced by BOOST_PYTHON_MODULE().
|
private |
References cycle, domainChunks, mdSchema, mdString, meshVariables, MPI_INT, MPI_MAX, MPI_SUM, mpiComm, mpiRank, mpiSize, time, weipa::VarInfo::varName, wantsMeshVars, and writeVarToVTK().
Referenced by saveVTK().
|
inline |
Sets the cycle number and time value for this dataset.
Referenced by BOOST_PYTHON_MODULE().
bool weipa::EscriptDataset::setDomain | ( | const escript::AbstractDomain * | domain | ) |
Sets the escript domain for this dataset. This method can only be called once and should be the first call unless loading from dump files.
References convertMeshVariables(), domainChunks, escript::AbstractDomain::getMPIComm(), escript::AbstractDomain::getMPIRank(), escript::AbstractDomain::getMPISize(), MPI_INT, MPI_MAX, mpiComm, mpiRank, and mpiSize.
Referenced by BOOST_PYTHON_MODULE().
|
private |
References domainChunks, externalDomain, MPI_INT, MPI_MAX, mpiComm, and mpiSize.
Referenced by loadNetCDF().
void weipa::EscriptDataset::setMeshLabels | ( | const std::string | x, |
const std::string | y, | ||
const std::string | z = "" |
||
) |
Sets labels for the mesh axes.
References meshLabels.
Referenced by BOOST_PYTHON_MODULE().
void weipa::EscriptDataset::setMeshUnits | ( | const std::string | x, |
const std::string | y, | ||
const std::string | z = "" |
||
) |
Sets units for the mesh axes.
References meshUnits.
Referenced by BOOST_PYTHON_MODULE().
|
inline |
Sets a metadata schema and content.
Referenced by BOOST_PYTHON_MODULE().
|
inline |
Enables/Disables saving of mesh-related data.
Referenced by BOOST_PYTHON_MODULE().
|
private |
References weipa::VarInfo::dataChunks, MPI_INT, mpiComm, mpiSize, and weipa::VarInfo::sampleDistribution.
Referenced by addData(), convertMeshVariables(), and loadData().
|
private |
References weipa::VarInfo::dataChunks, mpiRank, mpiSize, and weipa::VarInfo::varName.
Referenced by saveVTKsingle().
|
private |
Referenced by EscriptDataset(), putSiloMultiMesh(), putSiloMultiTensor(), putSiloMultiVar(), saveSilo(), and saveVTKsingle().
|
private |
Referenced by addData(), convertMeshVariables(), loadData(), loadDomain(), putSiloMultiMesh(), putSiloMultiVar(), saveSilo(), saveVTK(), saveVTKsingle(), setDomain(), and setExternalDomain().
|
private |
Referenced by EscriptDataset(), saveSilo(), and setExternalDomain().
|
private |
Referenced by saveVTKsingle().
|
private |
Referenced by saveVTKsingle().
|
private |
Referenced by saveSilo(), and setMeshLabels().
|
private |
Referenced by saveSilo(), and setMeshUnits().
|
private |
Referenced by convertMeshVariables(), putSiloMultiMesh(), saveSilo(), and saveVTKsingle().
|
private |
Referenced by EscriptDataset(), loadData(), loadDomain(), saveSilo(), saveVTK(), saveVTKsingle(), setDomain(), setExternalDomain(), and updateSampleDistribution().
|
private |
Referenced by EscriptDataset(), loadData(), loadDomain(), saveSilo(), saveVTK(), saveVTKsingle(), setDomain(), and writeVarToVTK().
|
private |
Referenced by EscriptDataset(), loadData(), loadDomain(), saveSilo(), saveVTK(), saveVTKsingle(), setDomain(), setExternalDomain(), updateSampleDistribution(), and writeVarToVTK().
|
private |
Referenced by EscriptDataset(), putSiloMultiMesh(), putSiloMultiTensor(), putSiloMultiVar(), saveSilo(), and saveVTKsingle().
|
private |
Referenced by addData(), loadData(), putSiloMultiMesh(), saveSilo(), and saveVTK().
|
private |
Referenced by EscriptDataset(), saveSilo(), and saveVTKsingle().