#include <BasisGenerator.h>
|
| BasisGenerator (Options options, bool incremental, const std::string &basis_file_name="", Database::formats file_format=Database::HDF5) |
| Constructor. More...
|
|
| ~BasisGenerator () |
| Destructor.
|
|
bool | isNextSample (double time) |
| Returns true if it is time for the next svd sample. More...
|
|
bool | updateRightSV () |
| Check whether right basis vectors will be updated. More...
|
|
bool | takeSample (double *u_in, double time, double dt, bool add_without_increase=false) |
| Sample the new state, u_in, at the given time. More...
|
|
void | endSamples (const std::string &kind="basis") |
| Signal that the final sample has been taken. More...
|
|
void | writeSnapshot () |
| Write current snapshot matrix.
|
|
void | loadSamples (const std::string &base_file_name, const std::string &kind="basis", int cut_off=1e9, Database::formats db_format=Database::HDF5) |
| Load previously saved sample (basis or state). More...
|
|
double | computeNextSampleTime (double *u_in, double *rhs_in, double time) |
| Computes next time an svd sample is needed. More...
|
|
const Matrix * | getSpatialBasis () |
| Returns the basis vectors for the current time interval as a Matrix. More...
|
|
const Matrix * | getTemporalBasis () |
| Returns the temporal basis vectors for the current time interval as a Matrix. More...
|
|
const Vector * | getSingularValues () |
| Returns the singular values for the current time interval as a Vector. More...
|
|
const Matrix * | getSnapshotMatrix () |
| Returns the snapshot matrix for the current time interval. More...
|
|
int | getNumBasisTimeIntervals () const |
| Returns the number of time intervals on which different sets of basis vectors are defined. More...
|
|
double | getBasisIntervalStartTime (int which_interval) const |
| Returns the start time for the requested time interval. More...
|
|
int | getNumSamples () const |
| Returns the number of samples taken. More...
|
|
Class BasisGenerator defines the interface for the generation of basis vectors via the SVD method. This class wraps the SVD algorithm and sampler and controls all aspects of basis vector generation.
◆ BasisGenerator()
CAROM::BasisGenerator::BasisGenerator |
( |
Options |
options, |
|
|
bool |
incremental, |
|
|
const std::string & |
basis_file_name = "" , |
|
|
Database::formats |
file_format = Database::HDF5 |
|
) |
| |
Constructor.
- Parameters
-
[in] | options | The struct containing the options for this basis generator. |
[in] | incremental | Whether to conduct static or incremental SVD |
[in] | basis_file_name | The base part of the name of the file containing the basis vectors. Each process will append its process ID to this base name. |
[in] | file_format | The format of the file containing the basis vectors. |
◆ computeNextSampleTime()
double CAROM::BasisGenerator::computeNextSampleTime |
( |
double * |
u_in, |
|
|
double * |
rhs_in, |
|
|
double |
time |
|
) |
| |
Computes next time an svd sample is needed.
- Precondition
- u_in != 0
-
rhs_in != 0
-
time >= 0.0
- Parameters
-
[in] | u_in | The state at the specified time. |
[in] | rhs_in | The right hand side at the specified time. |
[in] | time | The simulation time for the state. |
◆ endSamples()
void CAROM::BasisGenerator::endSamples |
( |
const std::string & |
kind = "basis" | ) |
|
|
inline |
Signal that the final sample has been taken.
- Parameters
-
[in] | kind | A string equal to "basis" or "snapshot", representing which one will be written. |
◆ getBasisIntervalStartTime()
double CAROM::BasisGenerator::getBasisIntervalStartTime |
( |
int |
which_interval | ) |
const |
|
inline |
Returns the start time for the requested time interval.
- Precondition
- 0 <= which_interval
-
which_interval < getNumBasisTimeIntervals()
- Parameters
-
[in] | which_interval | Time interval whose start time is needed. |
- Returns
- The start time for the requested time interval.
◆ getNumBasisTimeIntervals()
int CAROM::BasisGenerator::getNumBasisTimeIntervals |
( |
| ) |
const |
|
inline |
Returns the number of time intervals on which different sets of basis vectors are defined.
- Returns
- The number of time intervals on which there are basis vectors.
◆ getNumSamples()
int CAROM::BasisGenerator::getNumSamples |
( |
| ) |
const |
|
inline |
Returns the number of samples taken.
- Returns
- The number of samples taken.
◆ getSingularValues()
const Vector* CAROM::BasisGenerator::getSingularValues |
( |
| ) |
|
|
inline |
Returns the singular values for the current time interval as a Vector.
- Returns
- The singular values for the current time interval.
◆ getSnapshotMatrix()
const Matrix* CAROM::BasisGenerator::getSnapshotMatrix |
( |
| ) |
|
|
inline |
Returns the snapshot matrix for the current time interval.
- Returns
- The snapshot matrix for the current time interval.
◆ getSpatialBasis()
const Matrix* CAROM::BasisGenerator::getSpatialBasis |
( |
| ) |
|
|
inline |
Returns the basis vectors for the current time interval as a Matrix.
- Returns
- The basis vectors for the current time interval.
◆ getTemporalBasis()
const Matrix* CAROM::BasisGenerator::getTemporalBasis |
( |
| ) |
|
|
inline |
Returns the temporal basis vectors for the current time interval as a Matrix.
- Returns
- The temporal basis vectors for the current time interval.
◆ isNextSample()
bool CAROM::BasisGenerator::isNextSample |
( |
double |
time | ) |
|
Returns true if it is time for the next svd sample.
- Precondition
- time >= 0.0
- Parameters
-
[in] | time | Time of interest. |
- Returns
- True if it is time for the next sample to be taken.
◆ loadSamples()
void CAROM::BasisGenerator::loadSamples |
( |
const std::string & |
base_file_name, |
|
|
const std::string & |
kind = "basis" , |
|
|
int |
cut_off = 1e9 , |
|
|
Database::formats |
db_format = Database::HDF5 |
|
) |
| |
Load previously saved sample (basis or state).
- Parameters
-
[in] | base_file_name | The base part of the name of the files holding the basis / snapshot vectors. |
[in] | kind | A string equal to "basis" or "snapshot", representing which kind of data to load. |
[in] | cut_off | The maximum number of bases or snapshots to read. |
[in] | db_format | Format of the file to read. |
◆ takeSample()
bool CAROM::BasisGenerator::takeSample |
( |
double * |
u_in, |
|
|
double |
time, |
|
|
double |
dt, |
|
|
bool |
add_without_increase = false |
|
) |
| |
Sample the new state, u_in, at the given time.
- Precondition
- u_in != 0
-
time >= 0.0
- Parameters
-
[in] | u_in | The state at the specified time. |
[in] | time | The simulation time for the state. |
[in] | dt | The current simulation dt. |
[in] | add_without_increase | If true, the addLinearlyDependent is invoked. This only applies to incremental SVD. |
- Returns
- True if the sampling was successful.
◆ updateRightSV()
bool CAROM::BasisGenerator::updateRightSV |
( |
| ) |
|
|
inline |
Check whether right basis vectors will be updated.
- Returns
- True if the right basis vectors will be updated.
The documentation for this class was generated from the following files: