libROM  v1.0
Data-driven physical simulation library
Public Member Functions | List of all members
CAROM::BasisReader Class Reference

#include <BasisReader.h>

Public Member Functions

 BasisReader (const std::string &base_file_name, Database::formats db_format=Database::formats::HDF5, const int dim=-1)
 The constructor for the BasisReader class takes the base part of the name of the files holding the basis vectors and the file format. More...
 
 ~BasisReader ()
 Destructor.
 
MatrixgetSpatialBasis ()
 Returns the spatial basis vectors as a Matrix. More...
 
MatrixgetSpatialBasis (int n)
 Returns the first n spatial basis vectors for the requested time as a Matrix. More...
 
MatrixgetSpatialBasis (int start_col, int end_col)
 Returns spatial basis vectors from start_col to end_col for the requested time as a Matrix. More...
 
MatrixgetSpatialBasis (double ef)
 Returns the first n spatial basis vectors for the requested time as a Matrix that capture the given energy fraction. More...
 
MatrixgetTemporalBasis ()
 Returns the temporal basis vectors for the requested time as a Matrix. More...
 
MatrixgetTemporalBasis (int n)
 Returns the first n temporal basis vectors for the requested time as a Matrix. More...
 
MatrixgetTemporalBasis (int start_col, int end_col)
 Returns temporal basis vectors from start_col to end_col for the requested time as a Matrix. More...
 
MatrixgetTemporalBasis (double ef)
 Returns the first n temporal basis vectors for the requested time as a Matrix that capture the given energy fraction. More...
 
VectorgetSingularValues ()
 Returns the singular values for the requested time. More...
 
VectorgetSingularValues (double ef)
 Returns the largest singular values for the requested time that capture the given energy fraction. More...
 
int getDim (const std::string kind)
 Returns the dimension of the system on this processor. More...
 
int getNumSamples (const std::string kind)
 Returns the number of samples (columns) in file. More...
 
MatrixgetSnapshotMatrix ()
 Returns the snapshot matrix for the requested time. More...
 
MatrixgetSnapshotMatrix (int n)
 Returns the first n columns of the snapshot matrix for the requested time. More...
 
MatrixgetSnapshotMatrix (int start_col, int end_col)
 Returns the snapshot matrix from start_col to end_col for the requested time. More...
 

Detailed Description

Class BasisReader reads the basis vectors from a file written by class BasisWriter.

See also
BasisWriter

Definition at line 33 of file BasisReader.h.

Constructor & Destructor Documentation

◆ BasisReader()

CAROM::BasisReader::BasisReader ( const std::string &  base_file_name,
Database::formats  db_format = Database::formats::HDF5,
const int  dim = -1 
)

The constructor for the BasisReader class takes the base part of the name of the files holding the basis vectors and the file format.

Precondition
!base_file_name.empty()
Parameters
[in]base_file_nameThe base part of the name of the files holding the basis vectors.
[in]db_formatFormat of the file to read. One of the implemented file formats defined in Database.
[in]dimNumber of rows of basis that will be read from a file. If negative, will use the dimension from the rank-specific local file.

Definition at line 23 of file BasisReader.cpp.

Member Function Documentation

◆ getDim()

int CAROM::BasisReader::getDim ( const std::string  kind)

Returns the dimension of the system on this processor.

Parameters
[in]kindType of matrix whose row-dimension is returned. "basis" - local dimension of spatial basis "snapshot" - local dimension of snapshot matrix "temporal_basis" - global dimension of temporal basis
Returns
The dimension of the system on this processor.

Definition at line 273 of file BasisReader.cpp.

◆ getNumSamples()

int CAROM::BasisReader::getNumSamples ( const std::string  kind)

Returns the number of samples (columns) in file.

Returns
The number of samples in file.

Definition at line 304 of file BasisReader.cpp.

◆ getSingularValues() [1/2]

Vector * CAROM::BasisReader::getSingularValues ( )

Returns the singular values for the requested time.

Returns
The temporal basis vectors for the requested time.

Definition at line 223 of file BasisReader.cpp.

◆ getSingularValues() [2/2]

Vector * CAROM::BasisReader::getSingularValues ( double  ef)

Returns the largest singular values for the requested time that capture the given energy fraction.

Precondition
0 <= ef <= 1.0
Parameters
[in]efThe desired energy fraction.
Returns
The temporal basis vectors for the requested time.

Definition at line 239 of file BasisReader.cpp.

◆ getSnapshotMatrix() [1/3]

Matrix * CAROM::BasisReader::getSnapshotMatrix ( )

Returns the snapshot matrix for the requested time.

Returns
The snapshot matrix for the requested time.

Definition at line 324 of file BasisReader.cpp.

◆ getSnapshotMatrix() [2/3]

Matrix * CAROM::BasisReader::getSnapshotMatrix ( int  n)

Returns the first n columns of the snapshot matrix for the requested time.

Precondition
0 < n <= numColumns()
Parameters
[in]nThe number of basis vectors desired.
Returns
The snapshot matrix for the requested time.

Definition at line 340 of file BasisReader.cpp.

◆ getSnapshotMatrix() [3/3]

Matrix * CAROM::BasisReader::getSnapshotMatrix ( int  start_col,
int  end_col 
)

Returns the snapshot matrix from start_col to end_col for the requested time.

Precondition
0 < start_col <= numColumns()
start_col <= end_col <= numColumns()
Parameters
[in]start_colThe starting column desired.
[in]end_colThe starting column desired.
Returns
The snapshot matrix for the requested time.

Definition at line 347 of file BasisReader.cpp.

◆ getSpatialBasis() [1/4]

Matrix * CAROM::BasisReader::getSpatialBasis ( )

Returns the spatial basis vectors as a Matrix.

Returns
The spatial basis vectors.

Definition at line 76 of file BasisReader.cpp.

◆ getSpatialBasis() [2/4]

Matrix * CAROM::BasisReader::getSpatialBasis ( double  ef)

Returns the first n spatial basis vectors for the requested time as a Matrix that capture the given energy fraction.

Precondition
0 <= ef <= 1.0
Parameters
[in]efThe desired energy fraction.
Returns
The spatial basis vectors for the requested time.

Definition at line 123 of file BasisReader.cpp.

◆ getSpatialBasis() [3/4]

Matrix * CAROM::BasisReader::getSpatialBasis ( int  n)

Returns the first n spatial basis vectors for the requested time as a Matrix.

Precondition
0 < n <= numColumns()
Parameters
[in]nThe number of spatial basis vectors desired.
Returns
The spatial basis vectors for the requested time.

Definition at line 91 of file BasisReader.cpp.

◆ getSpatialBasis() [4/4]

Matrix * CAROM::BasisReader::getSpatialBasis ( int  start_col,
int  end_col 
)

Returns spatial basis vectors from start_col to end_col for the requested time as a Matrix.

Precondition
0 < start_col <= numColumns()
start_col <= end_col <= numColumns()
Parameters
[in]start_colThe starting column desired.
[in]end_colThe starting column desired.
Returns
The spatial basis vectors for the requested time.

Definition at line 98 of file BasisReader.cpp.

◆ getTemporalBasis() [1/4]

Matrix * CAROM::BasisReader::getTemporalBasis ( )

Returns the temporal basis vectors for the requested time as a Matrix.

Returns
The temporal basis vectors for the requested time.

Definition at line 150 of file BasisReader.cpp.

◆ getTemporalBasis() [2/4]

Matrix * CAROM::BasisReader::getTemporalBasis ( double  ef)

Returns the first n temporal basis vectors for the requested time as a Matrix that capture the given energy fraction.

Precondition
0 <= ef <= 1.0
Parameters
[in]efThe desired energy fraction.
Returns
The temporal basis vectors for the requested time.

Definition at line 196 of file BasisReader.cpp.

◆ getTemporalBasis() [3/4]

Matrix * CAROM::BasisReader::getTemporalBasis ( int  n)

Returns the first n temporal basis vectors for the requested time as a Matrix.

Precondition
0 < n <= numColumns()
Parameters
[in]nThe number of temporal basis vectors desired.
Returns
The temporal basis vectors for the requested time.

Definition at line 165 of file BasisReader.cpp.

◆ getTemporalBasis() [4/4]

Matrix * CAROM::BasisReader::getTemporalBasis ( int  start_col,
int  end_col 
)

Returns temporal basis vectors from start_col to end_col for the requested time as a Matrix.

Precondition
0 < start_col <= numColumns()
start_col <= end_col <= numColumns()
Parameters
[in]start_colThe starting column desired.
[in]end_colThe starting column desired.
Returns
The temporal basis vectors for the requested time.

Definition at line 172 of file BasisReader.cpp.


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