The POD (Proper Orthogonal Decomposition) class provides an interface for defining POD object. More...


Public Types | |
enum class | ErrorMode { COMBINED , SINGLE , NONE } |
Mode of Error evaluation of a reconstructed fields by the POD basis. More... | |
enum class | MemoryMode { MEMORY_NORMAL , MEMORY_LIGHT } |
Memory Mode of the POD object. It defines the use of the memory resources. More... | |
enum class | MeshType { UNDEFINED , VOLOCTREE } |
Type of the Mesh used to compute the POD basis. More... | |
enum class | ReconstructionMode { PROJECTION , MINIMIZATION } |
Mode of Reconstruction of fields by using the POD basis. More... | |
enum class | RunMode { RESTORE , COMPUTE } |
Run Mode of the POD object. It defines if the POD basis has to be computed or restored. More... | |
enum class | WriteMode { DUMP , DEBUG , NONE } |
Output Write Mode of the POD object. It defines the amount of information written by the POD object. More... | |
Public Member Functions | |
POD (MPI_Comm comm=MPI_COMM_WORLD) | |
POD (POD &&other)=default | |
~POD () | |
void | adaptionAlter (const std::vector< adaption::Info > &info) |
void | adaptionCleanUp (const std::vector< adaption::Info > &info) |
void | adaptionPrepare (const std::vector< adaption::Info > &info) |
void | addReconstructionSnapshot (const pod::SnapshotFile &file) |
void | addReconstructionSnapshot (const std::string &directory, const std::string &name) |
void | addSnapshot (const pod::SnapshotFile &file) |
void | addSnapshot (const std::string &directory, const std::string &name) |
void | clear () |
void | computeMapper (const VolumeKernel *mesh) |
void | dump () |
void | dumpDecomposition () |
void | dumpField (const std::string &name, const pod::PODField &field) const |
void | evalCorrelation () |
void | evalDecomposition () |
void | evalEigen () |
void | evalErrorBoundingBox () |
void | evalMeanMesh () |
void | evalModes () |
void | evalReconstruction () |
std::vector< double > | fieldsl2norm (pod::PODField &snap) |
std::vector< double > | fieldsMax (pod::PODField &snap) |
void | fillListActiveIDs (const PiercedStorage< bool > &bfield) |
const std::string & | getDirectory () |
double | getEnergyLevel () |
ErrorMode | getErrorMode () |
double | getErrorThreshold () |
std::vector< std::string > | getFieldsNames () |
std::unique_ptr< PODKernel > & | getKernel () |
const std::unordered_set< long int > & | getListActiveIDs () |
std::size_t | getListIDInternalCount () |
const pod::PODMode & | getMean () |
MemoryMode | getMemoryMode () |
const VolumeKernel * | getMesh () |
MeshType | getMeshType () |
std::size_t | getModeCount () |
const std::vector< pod::PODMode > & | getModes () |
const std::string & | getName () |
std::vector< std::vector< double > > | getReconstructionCoeffs () |
ReconstructionMode | getReconstructionMode () |
RunMode | getRunMode () |
std::vector< std::string > | getScalarNames () |
std::size_t | getSnapshotCount () |
std::vector< std::array< std::string, 3 > > | getVectorNames () |
WriteMode | getWriteMode () |
void | leave1out () |
std::vector< std::vector< double > > | projectField (pod::PODField &field) |
void | readSnapshot (const pod::SnapshotFile &snap, pod::PODField &fieldr) |
void | reconstructFields (const std::vector< std::vector< double > > &coeffMatrix, pod::PODField &recon) |
void | reconstructFields (PiercedStorage< double > &fields, VolumeKernel *mesh, std::map< std::string, std::size_t > targetFields, const std::unordered_set< long > *targetCells) |
void | reconstructFields (pod::PODField &field, pod::PODField &recon) |
void | removeLeave1outSnapshot (const pod::SnapshotFile &file) |
void | removeLeave1outSnapshot (const std::string &directory, const std::string &name) |
void | restore () |
void | restoreDecomposition () |
void | run () |
void | setDirectory (const std::string &directory) |
void | setEnergyLevel (double energy) |
void | setErrorMode (ErrorMode mode) |
void | setErrorThreshold (double threshold) |
void | setExpert (bool mode=true) |
void | setMemoryMode (MemoryMode mode) |
void | setMesh (const pod::SnapshotFile &file) |
void | setMesh (const std::string &directory, const std::string &name) |
void | setMesh (std::unique_ptr< VolumeKernel > &&mesh) |
void | setMeshType (MeshType type) |
void | setModeCount (std::size_t nmodes) |
void | setName (const std::string &name) |
void | setReconstructionMode (ReconstructionMode mode) |
void | setRunMode (RunMode mode) |
void | setSensorMask (const PiercedStorage< bool > &mask, VolumeKernel *mesh=nullptr) |
void | setSnapshots (const std::vector< pod::SnapshotFile > &database) |
void | setStaticMesh (bool flag) |
void | setTargetErrorFields (const std::vector< std::string > &namesf, const std::vector< std::array< std::string, 3 > > &namevf) |
void | setUseMean (bool flag) |
void | setWriteMode (WriteMode mode) |
void | unsetLeave1outSnapshots () |
void | write (const pod::PODField &snap, std::string file_name) const |
void | write (int mode_index, std::string file_name) |
![]() | |
virtual void | absorbData (std::fstream &, const std::string &, VTKFormat, uint64_t, uint8_t, VTKDataType) |
virtual void | flushData (std::fstream &, const std::string &, VTKFormat) |
template<typename T> | |
void | flushValue (std::fstream &, VTKFormat, const T &value) const |
template<typename T> | |
void | flushValue (std::fstream &, VTKFormat, const T *values, int nValues) const |
Detailed Description
The POD (Proper Orthogonal Decomposition) class provides an interface for defining POD object.
POD is the base class for defining POD object.
This class provides the interface methods, as the base get/set methods.
To execute a pod work-flow of a POD object call the method run().
Note: in this version the only allowed mesh type is VolOctree. All the database fields and the reconstructed ones have to be defined on the same domain.
Member Enumeration Documentation
◆ ErrorMode
|
strong |
Mode of Error evaluation of a reconstructed fields by the POD basis.
Enumerator | |
---|---|
COMBINED | Maximum of reconstruction errors. |
SINGLE | Reconstruction errors one at a time. |
NONE | No error evaluation. |
◆ MemoryMode
|
strong |
◆ MeshType
|
strong |
◆ ReconstructionMode
|
strong |
Mode of Reconstruction of fields by using the POD basis.
Enumerator | |
---|---|
PROJECTION | Orthogonal projection of a field over the POD basis. Note: if the POD modes are not orthogonal on the active domain this is an approximation. |
MINIMIZATION | Non-orthogonal projection of a field over the POD basis.Note: if the POD modes are orthogonal on the active domain the result obtained by using PROJECTION is the same. |
◆ RunMode
|
strong |
◆ WriteMode
|
strong |
Output Write Mode of the POD object. It defines the amount of information written by the POD object.
Enumerator | |
---|---|
DUMP | Write (dump) only the files needed to restore the POD instance. |
DEBUG | Write files to debug the run (POD dumping files, POD basis in .vtu format, database fields in .vtu format, reconstrucetd fields in .vtu format...) . |
NONE | Write none. |
Constructor & Destructor Documentation
◆ POD() [1/2]
bitpit::POD::POD | ( | MPI_Comm | comm = MPI_COMM_WORLD | ) |
◆ ~POD()
◆ POD() [2/2]
|
default |
Default copy constructor.
- Parameters
-
[in] other Input POD object
Member Function Documentation
◆ adaptionAlter()
void bitpit::POD::adaptionAlter | ( | const std::vector< adaption::Info > & | info | ) |
◆ adaptionCleanUp()
void bitpit::POD::adaptionCleanUp | ( | const std::vector< adaption::Info > & | info | ) |
◆ adaptionPrepare()
void bitpit::POD::adaptionPrepare | ( | const std::vector< adaption::Info > & | info | ) |
◆ addReconstructionSnapshot() [1/2]
void bitpit::POD::addReconstructionSnapshot | ( | const pod::SnapshotFile & | file | ) |
◆ addReconstructionSnapshot() [2/2]
void bitpit::POD::addReconstructionSnapshot | ( | const std::string & | directory, |
const std::string & | name ) |
Add a snapshot to the reconstruction database.
- Parameters
-
[in] directory is the directory that contains the snapshot. [in] name is the name of the snapshot.
- Examples
- POD_application_example_00001.cpp.
◆ addSnapshot() [1/2]
void bitpit::POD::addSnapshot | ( | const pod::SnapshotFile & | file | ) |
◆ addSnapshot() [2/2]
void bitpit::POD::addSnapshot | ( | const std::string & | directory, |
const std::string & | name ) |
Add a snapshot to the POD database.
- Parameters
-
[in] directory is the directory that contains the snapshot. [in] name is the name of the snapshot.
- Examples
- POD_application_example_00001.cpp.
◆ clear()
◆ computeMapper()
void bitpit::POD::computeMapper | ( | const VolumeKernel * | mesh | ) |
◆ dump()
void bitpit::POD::dump | ( | ) |
◆ dumpDecomposition()
void bitpit::POD::dumpDecomposition | ( | ) |
◆ dumpField()
void bitpit::POD::dumpField | ( | const std::string & | name, |
const pod::PODField & | field ) const |
◆ evalCorrelation()
void bitpit::POD::evalCorrelation | ( | ) |
◆ evalDecomposition()
void bitpit::POD::evalDecomposition | ( | ) |
◆ evalEigen()
void bitpit::POD::evalEigen | ( | ) |
◆ evalErrorBoundingBox()
void bitpit::POD::evalErrorBoundingBox | ( | ) |
Evaluation of error bounding box according to a certain threshold.
- Examples
- POD_application_example_00001.cpp.
◆ evalMeanMesh()
void bitpit::POD::evalMeanMesh | ( | ) |
◆ evalModes()
◆ evalReconstruction()
void bitpit::POD::evalReconstruction | ( | ) |
◆ fieldsl2norm()
std::vector< double > bitpit::POD::fieldsl2norm | ( | pod::PODField & | snap | ) |
◆ fieldsMax()
std::vector< double > bitpit::POD::fieldsMax | ( | pod::PODField & | snap | ) |
◆ fillListActiveIDs()
void bitpit::POD::fillListActiveIDs | ( | const PiercedStorage< bool > & | mask | ) |
◆ getDirectory()
const std::string & bitpit::POD::getDirectory | ( | ) |
◆ getEnergyLevel()
double bitpit::POD::getEnergyLevel | ( | ) |
Get the percentage energy level of retained POD modes.
- Returns
- The energy level.
- Examples
- POD_application_example_00001.cpp.
◆ getErrorMode()
POD::ErrorMode bitpit::POD::getErrorMode | ( | ) |
Get the error mode of the POD object.
- Returns
- The error mode.
- Examples
- POD_application_example_00001.cpp.
◆ getErrorThreshold()
double bitpit::POD::getErrorThreshold | ( | ) |
Get the error threshold used in the subregion evaluation.
- Returns
- The threshold value.
- Examples
- POD_application_example_00001.cpp.
◆ getFieldsNames()
std::vector< std::string > bitpit::POD::getFieldsNames | ( | ) |
◆ getKernel()
std::unique_ptr< PODKernel > & bitpit::POD::getKernel | ( | ) |
◆ getListActiveIDs()
const std::unordered_set< long > & bitpit::POD::getListActiveIDs | ( | ) |
◆ getListIDInternalCount()
std::size_t bitpit::POD::getListIDInternalCount | ( | ) |
◆ getMean()
const pod::PODMode & bitpit::POD::getMean | ( | ) |
◆ getMemoryMode()
POD::MemoryMode bitpit::POD::getMemoryMode | ( | ) |
Get the memory mode of the POD object.
- Examples
- POD_application_example_00001.cpp.
◆ getMesh()
const VolumeKernel * bitpit::POD::getMesh | ( | ) |
◆ getMeshType()
POD::MeshType bitpit::POD::getMeshType | ( | ) |
◆ getModeCount()
std::size_t bitpit::POD::getModeCount | ( | ) |
Get the number of POD modes.
- Returns
- The number of POD modes.
- Examples
- POD_application_example_00001.cpp, and POD_example_00005.cpp.
◆ getModes()
const std::vector< pod::PODMode > & bitpit::POD::getModes | ( | ) |
Get a reference to the POD modes.
- Returns
- The const reference to the POD modes.
- Examples
- POD_example_00005.cpp.
◆ getName()
const std::string & bitpit::POD::getName | ( | ) |
Get the name of the pod object.
- Returns
- The name of the POD object.
- Examples
- POD_application_example_00001.cpp.
◆ getReconstructionCoeffs()
std::vector< std::vector< double > > bitpit::POD::getReconstructionCoeffs | ( | ) |
◆ getReconstructionMode()
POD::ReconstructionMode bitpit::POD::getReconstructionMode | ( | ) |
Get the reconstruction mode of the POD object.
- Returns
- The reconstruction mode.
- Examples
- POD_application_example_00001.cpp.
◆ getRunMode()
POD::RunMode bitpit::POD::getRunMode | ( | ) |
Get the execution mode of the POD object.
- Examples
- POD_application_example_00001.cpp.
◆ getScalarNames()
std::vector< std::string > bitpit::POD::getScalarNames | ( | ) |
◆ getSnapshotCount()
std::size_t bitpit::POD::getSnapshotCount | ( | ) |
◆ getVectorNames()
std::vector< std::array< std::string, 3 > > bitpit::POD::getVectorNames | ( | ) |
◆ getWriteMode()
POD::WriteMode bitpit::POD::getWriteMode | ( | ) |
Get the write mode of the POD object.
- Examples
- POD_application_example_00001.cpp.
◆ leave1out()
void bitpit::POD::leave1out | ( | ) |
Execution of leave-one-out procedure.
- Examples
- POD_application_example_00001.cpp.
◆ projectField()
std::vector< std::vector< double > > bitpit::POD::projectField | ( | pod::PODField & | field | ) |
◆ readSnapshot()
void bitpit::POD::readSnapshot | ( | const pod::SnapshotFile & | snap, |
pod::PODField & | fieldr ) |
◆ reconstructFields() [1/3]
void bitpit::POD::reconstructFields | ( | const std::vector< std::vector< double > > & | reconstructionCoeffs, |
pod::PODField & | reconi ) |
◆ reconstructFields() [2/3]
void bitpit::POD::reconstructFields | ( | PiercedStorage< double > & | fields, |
VolumeKernel * | mesh, | ||
std::map< std::string, std::size_t > | targetFields, | ||
const std::unordered_set< long > * | targetCells ) |
Field reconstruction.
- Parameters
-
[in,out] fields Original field used in the reconstruction. Only the values of targetCells
are updated.[in] mesh Pointer to snapshot field [in] targetFields Map of names/ids of fields in PiercedStorage to reconstruct [in] targetCells Pointer to list of cell to be updated with the reconstructed values (optional, default whole field).
◆ reconstructFields() [3/3]
void bitpit::POD::reconstructFields | ( | pod::PODField & | field, |
pod::PODField & | reconi ) |
◆ removeLeave1outSnapshot() [1/2]
void bitpit::POD::removeLeave1outSnapshot | ( | const pod::SnapshotFile & | file | ) |
◆ removeLeave1outSnapshot() [2/2]
void bitpit::POD::removeLeave1outSnapshot | ( | const std::string & | directory, |
const std::string & | name ) |
Remove a snapshot from the leave-1-out error computation.
- Parameters
-
[in] directory is the directory that contains the snapshot. [in] name is the name of the snapshot.
- Examples
- POD_application_example_00001.cpp.
◆ restore()
void bitpit::POD::restore | ( | ) |
Restore the POD results.
- Examples
- POD_example_00002.cpp, and POD_example_00005.cpp.
◆ restoreDecomposition()
void bitpit::POD::restoreDecomposition | ( | ) |
◆ run()
void bitpit::POD::run | ( | ) |
Execution of POD procedure. Currently it computes the complete POD for static mesh: mean field of the snapshots, correlation matrix, POD modes and reconstruction of database fields with the retained modes. Some reconstruction errors are evaluated (not yet).
- Examples
- POD_application_example_00001.cpp.
◆ setDirectory()
void bitpit::POD::setDirectory | ( | const std::string & | directory | ) |
Set the input/output directory.
- Parameters
-
[in] directory is the name of the directory.
◆ setEnergyLevel()
void bitpit::POD::setEnergyLevel | ( | double | energy | ) |
Set the energy percentage level (e%) used to retain a limited number of POD modes during POD evaluation. m_nModes such that sum(lambda[1:m_nModes])/etot >= e% and sum(lambda[1:m_nModes-1])/etot < e%.
- Parameters
-
[in] energy is the target energy percentage level.
- Examples
- POD_application_example_00001.cpp.
◆ setErrorMode()
void bitpit::POD::setErrorMode | ( | POD::ErrorMode | mode | ) |
Set the error evaluation mode of the POD object.
- Parameters
-
[in] mode is the error mode. If set to COMBINED evaluates the maximum reconstruction errors, if set to SINGLE evaluates the reconstruction errors one at a time, if set to NONE does nothing.
- Examples
- POD_application_example_00001.cpp.
◆ setErrorThreshold()
void bitpit::POD::setErrorThreshold | ( | double | threshold | ) |
Set the minimum error threshold used to identify a subregion of the original computational domain.
- Parameters
-
[in] threshold is the threshold value for the minimum error.
- Examples
- POD_application_example_00001.cpp.
◆ setExpert()
void bitpit::POD::setExpert | ( | bool | mode = true | ) |
◆ setMemoryMode()
void bitpit::POD::setMemoryMode | ( | POD::MemoryMode | mode | ) |
Set the memory mode of the POD object.
- Parameters
-
[in] mode Memory mode. If set to MEMORY_LIGHT the POD modes if present are erased and then they are read from file if needed. If set to MEMORY_NORMAL, the POD modes are kept in memory when computed or read for the first time.
- Examples
- POD_application_example_00001.cpp.
◆ setMesh() [1/3]
void bitpit::POD::setMesh | ( | const pod::SnapshotFile & | file | ) |
◆ setMesh() [2/3]
void bitpit::POD::setMesh | ( | const std::string & | directory, |
const std::string & | name ) |
Set the POD mesh by reading it from file, where the fields and modes are defined. The POD mesh is not computed during POD run. The file has to be a snapshot file format (data file + mesh file).
- Parameters
-
[in] directory is the directory that contains the snapshot. [in] name is the name of the snapshot.
- Examples
- POD_application_example_00001.cpp.
◆ setMesh() [3/3]
void bitpit::POD::setMesh | ( | std::unique_ptr< VolumeKernel > && | mesh | ) |
◆ setMeshType()
void bitpit::POD::setMeshType | ( | POD::MeshType | type | ) |
Set the type of the POD mesh, where the fields and modes are defined. Note: even if the mesh is directly set by setMesh methods, the type MUST be set before call setMesh.
- Parameters
-
[in] type Type of the POD mesh.
- Examples
- POD_application_example_00001.cpp.
◆ setModeCount()
void bitpit::POD::setModeCount | ( | std::size_t | nmodes | ) |
Set the number of retained POD modes during POD evaluation.
- Parameters
-
[in] nmodes Number of retained modes.
- Examples
- POD_application_example_00001.cpp.
◆ setName()
void bitpit::POD::setName | ( | const std::string & | name | ) |
Set the name of the pod object.
- Parameters
-
[in] name is the name that will be set.
◆ setReconstructionMode()
void bitpit::POD::setReconstructionMode | ( | POD::ReconstructionMode | mode | ) |
Set the reconstruction mode of the POD object.
- Parameters
-
[in] mode is the reconstruction mode. If set to MINIMIZATION solve the least-squares problem, if set to PROJECTION uses orthogonal projection.
- Examples
- POD_application_example_00001.cpp.
◆ setRunMode()
void bitpit::POD::setRunMode | ( | POD::RunMode | mode | ) |
◆ setSensorMask()
void bitpit::POD::setSensorMask | ( | const PiercedStorage< bool > & | mask, |
VolumeKernel * | mesh = nullptr ) |
Set the boolean field used as mask for the POD reconstruction.
- Parameters
-
[in] mask Reference to boolean field used as mask to chose the active cells. [in] mesh Pointer to mesh related to input mask (used only if dynamic mesh active). If set to true, the corresponding cell is used during the minimization [or projection], otherwise it is discarded.
◆ setSnapshots()
void bitpit::POD::setSnapshots | ( | const std::vector< pod::SnapshotFile > & | database | ) |
◆ setStaticMesh()
void bitpit::POD::setStaticMesh | ( | bool | flag | ) |
Set if the mesh, where the fields are defined, is a static mesh, fixed for the whole database, or it is an AMR mesh, i.e. differently adapted for each field in the database or during reconstruction.
- Parameters
-
[in] flag if set to true the mesh is considered static.
- Examples
- POD_application_example_00001.cpp.
◆ setTargetErrorFields()
void bitpit::POD::setTargetErrorFields | ( | const std::vector< std::string > & | namesf, |
const std::vector< std::array< std::string, 3 > > & | namevf ) |
Set the target error fields used in the error bounding box evaluation.
- Parameters
-
[in] namesf is the vector of scalar fields names. [in] namevf is the vector of vector fields names, arranged in vector components.
- Examples
- POD_application_example_00001.cpp.
◆ setUseMean()
void bitpit::POD::setUseMean | ( | bool | flag | ) |
Set if the mean fields are used during the POD basis calculation or not.
- Parameters
-
[in] flag if set to true the mean is used.
- Examples
- POD_application_example_00001.cpp, and POD_example_00005.cpp.
◆ setWriteMode()
void bitpit::POD::setWriteMode | ( | POD::WriteMode | mode | ) |
Set the write mode of the POD object.
- Parameters
-
[in] mode is the write mode.
- Examples
- POD_application_example_00001.cpp, and POD_example_00005.cpp.
◆ unsetLeave1outSnapshots()
void bitpit::POD::unsetLeave1outSnapshots | ( | ) |
◆ write() [1/2]
void bitpit::POD::write | ( | const pod::PODField & | field, |
std::string | file_name ) const |
◆ write() [2/2]
void bitpit::POD::write | ( | int | mode_index, |
std::string | file_name ) |
The documentation for this class was generated from the following files:
