The SystemSolver class provides methods for building and solving large linear systems. More...


Public Types | |
typedef SystemMatrixAssembler | Assembler |
enum | FileFormat { FILE_BINARY , FILE_ASCII } |
Public Member Functions | |
SystemSolver (bool debug=false) | |
SystemSolver (bool flatten, bool transpose, bool debug) | |
SystemSolver (bool transpose, bool debug) | |
SystemSolver (const std::string &prefix, bool debug=false) | |
SystemSolver (const std::string &prefix, bool flatten, bool transpose, bool debug) | |
SystemSolver (const std::string &prefix, bool transpose, bool debug) | |
virtual | ~SystemSolver () |
void | assembly (const Assembler &assembler) |
void | assembly (const Assembler &assembler, const SystemMatrixOrdering &reordering) |
void | assembly (const SparseMatrix &matrix) |
void | assembly (const SparseMatrix &matrix, const SystemMatrixOrdering &reordering) |
virtual void | clear () |
virtual void | clearWorkspace () |
void | dumpSystem (const std::string &header, const std::string &directory, const std::string &prefix="") const |
void | enableForceConsistency (bool enable) |
virtual void | exportMatrix (const std::string &filePath, FileFormat exportFormat=FILE_BINARY) const |
virtual void | exportRHS (const std::string &filePath, FileFormat exportFormat=FILE_BINARY) const |
virtual void | exportSolution (const std::string &filePath, FileFormat exportFormat=FILE_BINARY) const |
virtual int | getBlockSize () const |
long | getColCount () const |
long | getColElementCount () const |
long | getColGlobalCount () const |
long | getColGlobalElementCount () const |
KSPOptions & | getKSPOptions () |
const KSPOptions & | getKSPOptions () const |
const KSPStatus & | getKSPStatus () const |
double * | getRHSRawPtr () |
const double * | getRHSRawPtr () const |
const double * | getRHSRawReadPtr () const |
long | getRowCount () const |
long | getRowElementCount () const |
long | getRowGlobalCount () const |
long | getRowGlobalElementCount () const |
double * | getSolutionRawPtr () |
const double * | getSolutionRawPtr () const |
const double * | getSolutionRawReadPtr () const |
bool | getTranspose () const |
virtual void | importMatrix (const std::string &filePath) |
virtual void | importRHS (const std::string &filePath) |
virtual void | importSolution (const std::string &filePath) |
bool | isAssembled () const |
bool | isForceConsistencyEnabled () const |
bool | isPartitioned () const |
void | restoreRHSRawPtr (double *raw_rhs) |
void | restoreRHSRawReadPtr (const double *raw_rhs) const |
void | restoreSolutionRawPtr (double *raw_solution) |
void | restoreSolutionRawReadPtr (const double *raw_solution) const |
void | restoreSystem (MPI_Comm communicator, bool redistribute, const std::string &directory, const std::string &prefix="") |
virtual void | setNullSpace () |
void | setTranspose (bool transpose) |
void | solve () |
void | solve (const std::vector< double > &rhs, std::vector< double > *solution) |
void | unsetNullSpace () |
void | update (const Assembler &assembler) |
void | update (const SparseMatrix &elements) |
void | update (long nRows, const long *rows, const Assembler &assembler) |
void | update (long nRows, const long *rows, const SparseMatrix &elements) |
Protected Types | |
enum | VectorSide { VECTOR_SIDE_RIGHT , VECTOR_SIDE_LEFT } |
Protected Member Functions | |
template<typename DerivedSystemSolver> | |
void | assembly (const typename DerivedSystemSolver::Assembler &assembler, const SystemMatrixOrdering &reordering) |
void | clearReordering () |
virtual void | createKSP () |
void | createMatrix (int rowBlockSize, int colBlockSize, int nNestRows, int nNestCols, Mat *subMatrices, Mat *matrix) const |
void | createMatrix (int rowBlockSize, int colBlockSize, Mat *matrix) const |
void | createVector (int blockSize, int nestSize, Vec *subVectors, Vec *vector) const |
void | createVector (int blockSize, Vec *vector) const |
virtual void | destroyKSP () |
virtual void | destroyKSPOptions () |
virtual void | destroyKSPStatus () |
void | destroyMatrix (Mat *matrix) const |
void | destroyVector (Vec *vector) const |
virtual void | dumpInfo (std::ostream &stream) const |
void | dumpMatrix (Mat matrix, const std::string &directory, const std::string &name) const |
void | dumpVector (Vec vector, const std::string &directory, const std::string &name) const |
void | dumpVector (Vec vector, VectorSide side, const std::string &directory, const std::string &name) const |
void | exportMatrix (Mat matrix, const std::string &filePath, FileFormat fileFormat) const |
void | exportVector (Vec vector, const std::string &filePath, FileFormat fileFormat) const |
void | exportVector (Vec vector, std::vector< double > *data) const |
virtual void | fillKSPStatus () |
virtual void | fillKSPStatus (KSP ksp, KSPStatus *status) const |
void | fillMatrix (Mat matrix, const std::string &filePath) const |
void | fillVector (Vec vector, const std::string &filePath) const |
void | fillVector (Vec vector, const std::vector< double > &data) const |
virtual void | finalizeKSP () |
const MPI_Comm & | getCommunicator () const |
std::string | getDataFilePath (const std::string &directory, const std::string &name) const |
virtual int | getDumpVersion () const |
std::string | getFilePath (const std::string &directory, const std::string &name) const |
std::string | getInfoFilePath (const std::string &directory, const std::string &name) const |
virtual void | initializeKSPOptions () |
virtual void | initializeKSPStatus () |
void | matrixAssembly (const Assembler &assembler) |
virtual void | matrixDestroy () |
virtual void | matrixDump (std::ostream &systemStream, const std::string &directory, const std::string &prefix) const |
virtual void | matrixFill (const std::string &filePath) |
virtual void | matrixRestore (std::istream &systemStream, const std::string &directory, const std::string &prefix, bool redistribute) |
void | matrixUpdate (long nRows, const long *rows, const Assembler &assembler) |
virtual void | postKrylovSetupActions () |
virtual void | postKSPSolveActions () |
virtual void | postPreconditionerSetupActions () |
virtual void | preKrylovSetupActions () |
virtual void | preKSPSolveActions () |
virtual void | prepareKSP () |
virtual void | prePreconditionerSetupActions () |
void | reorderVector (Vec vector, IS permutations, bool invert) const |
virtual void | resetKSPOptions (KSPOptions *options) const |
virtual void | resetKSPStatus () |
virtual void | resetKSPStatus (KSPStatus *status) const |
virtual void | restoreInfo (std::istream &stream) |
void | restoreMatrix (const std::string &directory, const std::string &name, bool redistribute, Mat *matrix) const |
void | restoreVector (const std::string &directory, const std::string &name, bool redistribute, Vec *vector) const |
void | restoreVector (const std::string &directory, const std::string &name, Mat matrix, VectorSide side, Vec *vector) const |
void | restoreVector (const std::string &directory, const std::string &name, std::size_t localSize, std::size_t globalSize, Vec *vector) const |
void | setReordering (long nRows, long nCols, const SystemMatrixOrdering &reordering) |
virtual void | setupKrylov () |
virtual void | setupKrylov (KSP ksp, const KSPOptions &options) const |
virtual void | setupPreconditioner () |
virtual void | setupPreconditioner (PC pc, const KSPOptions &options) const |
virtual void | solveKSP () |
template<typename DerivedSystemSolver> | |
void | update (long nRows, const long *rows, const typename DerivedSystemSolver::Assembler &assembler) |
virtual void | vectorsCreate () |
virtual void | vectorsDestroy () |
virtual void | vectorsDump (std::ostream &systemStream, const std::string &directory, const std::string &prefix) const |
virtual void | vectorsFill (const std::string &rhsFilePath, const std::string &solutionFilePath) |
virtual void | vectorsFill (const std::vector< double > &rhs, const std::vector< double > &solution) |
virtual void | vectorsReorder (bool invert) |
virtual void | vectorsRestore (std::istream &systemStream, const std::string &directory, const std::string &prefix) |
Protected Attributes | |
Mat | m_A |
IS | m_colReordering |
bool | m_convergenceMonitorEnabled |
bool | m_flatten |
KSP | m_KSP |
bool | m_KSPDirty |
KSPOptions | m_KSPOptions |
KSPStatus | m_KSPStatus |
Vec | m_rhs |
IS | m_rowReordering |
Vec | m_solution |
bool | m_transpose |
Detailed Description
The SystemSolver class provides methods for building and solving large linear systems.
Rather than working with individual elements in the system matrix, it is possible to employ blocks of elements. The size of the blocks can be defined during assembly. When a size different that one is provided, the matrix will store elements by fixed-sized dense nb × nb blocks, where nb is the size of the blocks. Blocking may be advantageous when solving PDE-based simulations that leads to matrices with a naturally blocked structure (with a block size equal to the number of degrees of freedom per cell).
When blocking is used, row and column indexes will count the number of blocks in the row/column direction, not the number of rows/columns of the matrix.
- Examples
- LA_example_00001.cpp, and RBF_example_00001.cpp.
Definition at line 259 of file system_solvers_large.hpp.
Member Typedef Documentation
◆ Assembler
Definition at line 262 of file system_solvers_large.hpp.
Member Enumeration Documentation
◆ FileFormat
enum bitpit::SystemSolver::FileFormat |
Definition at line 264 of file system_solvers_large.hpp.
◆ VectorSide
|
protected |
Definition at line 353 of file system_solvers_large.hpp.
Constructor & Destructor Documentation
◆ SystemSolver() [1/6]
bitpit::SystemSolver::SystemSolver | ( | bool | debug = false | ) |
Constructor.
- Parameters
-
debug if set to true, debug information will be printed
- Examples
- LA_example_00001.cpp.
Definition at line 770 of file system_solvers_large.cpp.
◆ SystemSolver() [2/6]
bitpit::SystemSolver::SystemSolver | ( | bool | transpose, |
bool | debug ) |
Constuctor
- Parameters
-
transpose if set to true, transposed system will be solved debug if set to true, debug information will be printed
Definition at line 781 of file system_solvers_large.cpp.
◆ SystemSolver() [3/6]
bitpit::SystemSolver::SystemSolver | ( | bool | flatten, |
bool | transpose, | ||
bool | debug ) |
Constuctor
- Parameters
-
flatten if set to true, block size will not be taken into account when allocating the internal storage of the system matrix. Even when the internal storage is flat, block size information are available and can be used by the solver to speed up the solution of the system. However, since the internal storage doesn't take blocks into account, some low level operations (e.g., matrix-matrix multiplications) cannot use block information. Some algorithms for the solution of the system (e.g., multigrid) requires a flat storage. transpose if set to true, transposed system will be solved debug if set to true, debug information will be printed
Definition at line 799 of file system_solvers_large.cpp.
◆ SystemSolver() [4/6]
bitpit::SystemSolver::SystemSolver | ( | const std::string & | prefix, |
bool | debug = false ) |
Constructor.
- Parameters
-
prefix is the prefix string to prepend to all option requests debug if set to true, debug information will be printed
Definition at line 810 of file system_solvers_large.cpp.
◆ SystemSolver() [5/6]
bitpit::SystemSolver::SystemSolver | ( | const std::string & | prefix, |
bool | transpose, | ||
bool | debug ) |
Constructor.
- Parameters
-
prefix is the prefix string to prepend to all option requests debug if set to true, debug information will be printed
Definition at line 821 of file system_solvers_large.cpp.
◆ SystemSolver() [6/6]
bitpit::SystemSolver::SystemSolver | ( | const std::string & | prefix, |
bool | flatten, | ||
bool | transpose, | ||
bool | debug ) |
Constuctor
- Parameters
-
prefix is the prefix string to prepend to all option requests flatten if set to true, block size will not be taken into account when allocating the internal storage of the system matrix. Even when the internal storage is flat, block size information are available and can be used by the solver to speed up the solution of the system. However, since the internal storage doesn't take blocks into account, some low level operations (e.g., matrix-matrix multiplications) cannot use block information. Some algorithms for the solution of the system (e.g., multigrid) requires a flat storage. transpose if set to true, transposed system will be solved debug if set to true, debug information will be printed
Definition at line 839 of file system_solvers_large.cpp.
◆ ~SystemSolver()
|
virtual |
Destructor.
Definition at line 863 of file system_solvers_large.cpp.
Member Function Documentation
◆ assembly() [1/5]
void bitpit::SystemSolver::assembly | ( | const Assembler & | assembler | ) |
Assembly the system.
After assembying th system solver, its options will be reset.
- Parameters
-
assembler is the matrix assembler
Definition at line 949 of file system_solvers_large.cpp.
◆ assembly() [2/5]
void bitpit::SystemSolver::assembly | ( | const Assembler & | assembler, |
const SystemMatrixOrdering & | reordering ) |
Assembly the system.
After assembying th system solver, its options will be reset.
- Parameters
-
assembler is the matrix assembler reordering is the reordering that will be applied when assembling the system
Definition at line 962 of file system_solvers_large.cpp.
◆ assembly() [3/5]
void bitpit::SystemSolver::assembly | ( | const SparseMatrix & | matrix | ) |
Assembly the system.
After assembying th system solver, its options will be reset.
- Parameters
-
matrix is the matrix
- Examples
- RBF_example_00001.cpp.
Definition at line 917 of file system_solvers_large.cpp.
◆ assembly() [4/5]
void bitpit::SystemSolver::assembly | ( | const SparseMatrix & | matrix, |
const SystemMatrixOrdering & | reordering ) |
Assembly the system.
After assembying th system solver, its options will be reset.
- Parameters
-
matrix is the matrix reordering is the reordering that will be applied when assembling the system
Definition at line 930 of file system_solvers_large.cpp.
◆ assembly() [5/5]
|
protected |
Assembly the system.
After assembying th system solver, its options will be reset.
- Parameters
-
assembler is the matrix assembler reordering is the reordering that will be applied when assemblying the system
Definition at line 95 of file system_solvers_large.tpp.
◆ clear()
|
virtual |
Clear the system
Reimplemented in bitpit::DiscretizationStencilSolver< stencil_t, solver_kernel_t >, bitpit::DiscretizationStencilSolver< StencilBlock >, bitpit::DiscretizationStencilSolver< StencilBlock >, bitpit::DiscretizationStencilSolver< StencilScalar >, bitpit::DiscretizationStencilSolver< StencilScalar >, bitpit::DiscretizationStencilSolver< StencilVector >, and bitpit::DiscretizationStencilSolver< StencilVector >.
Definition at line 875 of file system_solvers_large.cpp.
◆ clearReordering()
|
protected |
Clear the reordering that will be applied when assembling the matrix.
The function will clear any reordering previously set. With no reordering defined, the matrix will be assembled using its natural ordering.
Definition at line 3134 of file system_solvers_large.cpp.
◆ clearWorkspace()
|
virtual |
Clear and release the memory of all data structures needed for the solution of the system.
These data structures will be re-created the next time the system will be solved.
Definition at line 899 of file system_solvers_large.cpp.
◆ createKSP()
|
protectedvirtual |
Create the KSP.
Definition at line 3217 of file system_solvers_large.cpp.
◆ createMatrix() [1/2]
|
protected |
Create a nest matrix.
- Parameters
-
rowBlockSize is the row block size of the matrix colBlockSize is the column block size of the matrix nNestRows is the number of rows in the nest, i.e. the number of submatrices along the rows of the nest nNestCols is the number of columns in the nest, i.e. the number of submatrices along the columns of the nest subMatrices are the submatrices stored in row-major order, empty submatrices can be passed using nullptr vector on output will contain the newly created matrix
Definition at line 2309 of file system_solvers_large.cpp.
◆ createMatrix() [2/2]
|
protected |
Create a matrix.
- Parameters
-
rowBlockSize is the row block size of the matrix colBlockSize is the column block size of the matrix matrix on output will contain the newly created matrix
Definition at line 2254 of file system_solvers_large.cpp.
◆ createVector() [1/2]
|
protected |
Create a nest vector.
- Parameters
-
blockSize is the block size of the vector nestSize is the number of subvectors that will be contained in the nest subVectors are the subvectors, empty subvectors can be passed using nullptr vector on output will contain the newly created vector
Definition at line 2614 of file system_solvers_large.cpp.
◆ createVector() [2/2]
|
protected |
Create a vector.
- Parameters
-
blockSize is the block size of the vector vector on output will contain the newly created vector
Definition at line 2581 of file system_solvers_large.cpp.
◆ destroyKSP()
|
protectedvirtual |
Destroy the KSP.
Definition at line 3235 of file system_solvers_large.cpp.
◆ destroyKSPOptions()
|
protectedvirtual |
Destroy the options associated with the KSP.
Reimplemented in bitpit::SplitSystemSolver.
Definition at line 3431 of file system_solvers_large.cpp.
◆ destroyKSPStatus()
|
protectedvirtual |
Destroy the status of the KSP.
Reimplemented in bitpit::SplitSystemSolver.
Definition at line 3504 of file system_solvers_large.cpp.
◆ destroyMatrix()
|
protected |
Destroy the specified matrix.
- Parameters
-
matrix is the matrix that will be destroyed
Definition at line 2567 of file system_solvers_large.cpp.
◆ destroyVector()
|
protected |
Destroy the specified vector.
- Parameters
-
vector is the vector that will be destroyed
Definition at line 2998 of file system_solvers_large.cpp.
◆ dumpInfo()
|
protectedvirtual |
Dump system information.
- Parameters
-
systemStream is the stream in which system information is written
Reimplemented in bitpit::SplitSystemSolver.
Definition at line 2218 of file system_solvers_large.cpp.
◆ dumpMatrix()
|
protected |
Dump the specified matrix.
In addition to the file that contains the contant of the matrix, some other files will be created:
- a file with the information needed for re-creating the matrix (called "<NAME>.info");
a file with the information about the partitioning (called "<NAME>.partitioning"), this file is created only if the system is partitioned and bitpit MPI support is enabled.
- Parameters
-
matrix is the matrix that will be dumped directory is the directory in which the matrix data file will be written name is the name of the matrix that will be dumped
Definition at line 2378 of file system_solvers_large.cpp.
◆ dumpSystem()
void bitpit::SystemSolver::dumpSystem | ( | const std::string & | header, |
const std::string & | directory, | ||
const std::string & | prefix = "" ) const |
Dump the system to files.
Only the contents of the system will be dumped, this include the matrix, the RHS vector, the solution vector, and the information needed to properly restore the aforementioned data structures (e.g., the block size or the transpose flag).
- Parameters
-
header is the header that will be written in the system information archive directory is the directory where the files will be saved prefix is the prefix that will be added to the files
Definition at line 2120 of file system_solvers_large.cpp.
◆ dumpVector()
|
protected |
Dump the specified vector.
In addition to the file that contains the contant of the vector, some other files will be created:
- a file with the information needed for re-creating the vector (called "<NAME>.info");
a file with the information about the partitioning (called "<NAME>.partitioning"), this file is created only if the system is partitioned and bitpit MPI support is enabled.
- Parameters
-
vector is the vector that will be dumped directory is the directory in which the vector data file will be written name is the name of the vector that will be dumped
Definition at line 2699 of file system_solvers_large.cpp.
◆ enableForceConsistency()
void bitpit::SystemSolver::enableForceConsistency | ( | bool | enable | ) |
Enable or disable forcing right hand side consistency.
- Parameters
-
enable if set to true, right hand side consistency will be forced before solving the system
Definition at line 3583 of file system_solvers_large.cpp.
◆ exportMatrix() [1/2]
|
virtual |
Export the matrix to the specified file.
- Parameters
-
filePath is the path of the file fileFormat is the file format that will be used for exporting the matrix, note that the ASCII format may not be able to handle large matrices
Reimplemented in bitpit::SplitSystemSolver.
Definition at line 1968 of file system_solvers_large.cpp.
◆ exportMatrix() [2/2]
|
protected |
Export the given matrix to the specified file.
- Parameters
-
matrix is the matrix that will be filled filePath is the path of the file that will contain matrix data fileFormat is the file format that will be used for exporting the matrix, note that the ASCII format may not be able to handle large matrices
Definition at line 2519 of file system_solvers_large.cpp.
◆ exportRHS()
|
virtual |
Export the RHS vector to the specified file.
- Parameters
-
filePath is the path of the file fileFormat is the file format that will be used for exporting the RHS vector, note that the ASCII format may not be able to handle large vectors
Definition at line 2010 of file system_solvers_large.cpp.
◆ exportSolution()
|
virtual |
Export the solution vector to the specified file.
- Parameters
-
filePath is the path of the file fileFormat is the file format that will be used for exporting the solution vector, note that the ASCII format may not be able to handle large vectors
Definition at line 2063 of file system_solvers_large.cpp.
◆ exportVector() [1/2]
|
protected |
Export the specified vector to the file given file.
- Parameters
-
vector is the vector that will be exported filePath is the path of the file fileFormat is the file format that will be used for exporting the vector, note that the ASCII format may not be able to handle large vectors
Definition at line 2931 of file system_solvers_large.cpp.
◆ exportVector() [2/2]
|
protected |
Export the specified vector into the given container.
- Parameters
-
vector is the vector that will be exported data on output it will contain the data of the vector of the linear system
Definition at line 2980 of file system_solvers_large.cpp.
◆ fillKSPStatus() [1/2]
|
protectedvirtual |
Fill the status of the KSP.
Reimplemented in bitpit::SplitSystemSolver.
Definition at line 3463 of file system_solvers_large.cpp.
◆ fillKSPStatus() [2/2]
|
protectedvirtual |
Fill the status of the specified KSP.
- Parameters
-
ksp is the KSP the status will be fetched from status on output will contain the status of the KSP
Reimplemented in bitpit::SplitSystemSolver.
Definition at line 3474 of file system_solvers_large.cpp.
◆ fillMatrix()
|
protected |
Fill the given matrix reading its contents from the specified file.
The input file should contain a compatible matrix stored in PETSc binary format. If the data file cannot be read an exception is thrown.
- Parameters
-
matrix is the matrix that will be filled filePath is the path of the file that contains matrix data
Definition at line 2336 of file system_solvers_large.cpp.
◆ fillVector() [1/2]
|
protected |
Fill the given vector reading its contents from the specified file.
The input file should contain a compatible vector stored in PETSc binary format. If the data file cannot be read an exception is thrown.
- Parameters
-
vector is the vector that will be filled filePath is the path of the file that contains vector data
Definition at line 2638 of file system_solvers_large.cpp.
◆ fillVector() [2/2]
|
protected |
Fill the specified vector with the given data.
- Parameters
-
vector is the vector that will be filled data is the data that will be copied into the vector
Definition at line 2667 of file system_solvers_large.cpp.
◆ finalizeKSP()
|
protectedvirtual |
Finalize the KSP after the solution of the system.
Definition at line 3209 of file system_solvers_large.cpp.
◆ getBlockSize()
|
virtual |
Get the block size of the system.
- Returns
- The block size of the system.
Reimplemented in bitpit::SplitSystemSolver.
Definition at line 1022 of file system_solvers_large.cpp.
◆ getColCount()
long bitpit::SystemSolver::getColCount | ( | ) | const |
Get the number of columns of the system.
If the matrix is a block matrix (i.e., the block size is greater than one), this function will return the number of block columns, where a block column is defined as a group of block-size matrix columns.
- Returns
- The number of columns of the system.
Definition at line 1065 of file system_solvers_large.cpp.
◆ getColElementCount()
long bitpit::SystemSolver::getColElementCount | ( | ) | const |
Get the number of elements in the columns of the system.
This function will return the effective number of columns of the system matrix. This value is the same as the local size used in creating the x vector for the matrix-vector product y = Ax.
- Returns
- The number of elements in the columns of the system.
Definition at line 1108 of file system_solvers_large.cpp.
◆ getColGlobalCount()
long bitpit::SystemSolver::getColGlobalCount | ( | ) | const |
Get number of global (block) columns.
If the matrix is a block matrix (i.e., the block size is greater than one), this function will return the global number of block columns, where a block column is defined as a group of block-size matrix columns.
- Returns
- The number of global (block) columns.
Definition at line 1152 of file system_solvers_large.cpp.
◆ getColGlobalElementCount()
long bitpit::SystemSolver::getColGlobalElementCount | ( | ) | const |
Get the number of global elements in the columns of the system.
This function will return the effective global number of columns of the system matrix.
- Returns
- The number of global elements in the columns of the system.
Definition at line 1193 of file system_solvers_large.cpp.
◆ getCommunicator()
|
protected |
Gets the MPI communicator associated to the system.
- Returns
- The MPI communicator associated to the system.
Definition at line 3515 of file system_solvers_large.cpp.
◆ getDataFilePath()
|
protected |
Get the path of the specified data file.
- Parameters
-
directory is the directory that contains the file name is the name, without extension, of the file
- Returns
- The path of the data file.
Definition at line 3025 of file system_solvers_large.cpp.
◆ getDumpVersion()
|
protectedvirtual |
Get the version associated with the binary dumps.
- Returns
- The version associated with the binary dumps.
Definition at line 1322 of file system_solvers_large.cpp.
◆ getFilePath()
|
protected |
Get the path of the specified file.
- Parameters
-
directory is the directory that contains the file name is the name of the file
- Returns
- The path of the file.
Definition at line 3037 of file system_solvers_large.cpp.
◆ getInfoFilePath()
|
protected |
Get the path of the specified info file.
- Parameters
-
directory is the directory that contains the file name is the name, without extension, of the file
- Returns
- The path of the info file.
Definition at line 3013 of file system_solvers_large.cpp.
◆ getKSPOptions() [1/2]
KSPOptions & bitpit::SystemSolver::getKSPOptions | ( | ) |
Get a reference to the options associated with the Krylov solver.
The options associated with the Krylov solver can only be accessed after assembling the system.
- Returns
- A reference to the options associated with the Krylov solver.
Definition at line 3385 of file system_solvers_large.cpp.
◆ getKSPOptions() [2/2]
const KSPOptions & bitpit::SystemSolver::getKSPOptions | ( | ) | const |
Get a constant reference to the options associated with the Krylov solver.
The options associated with the Krylov solver can only be accessed after assembling the system.
- Returns
- A constant reference to the options associated with the Krylov solver.
Definition at line 3401 of file system_solvers_large.cpp.
◆ getKSPStatus()
const KSPStatus & bitpit::SystemSolver::getKSPStatus | ( | ) | const |
Get a constant reference to the status of the Krylov solver.
The status of the Krylov solver can only be accessed after assembling the system.
- Returns
- A constant reference to the status of the Krylov solver.
Definition at line 3443 of file system_solvers_large.cpp.
◆ getRHSRawPtr() [1/2]
double * bitpit::SystemSolver::getRHSRawPtr | ( | ) |
Get a raw pointer to the solution vector.
- Returns
- A raw pointer to the solution vector.
- Examples
- RBF_example_00001.cpp.
Definition at line 1850 of file system_solvers_large.cpp.
◆ getRHSRawPtr() [2/2]
const double * bitpit::SystemSolver::getRHSRawPtr | ( | ) | const |
Get a constant raw pointer to the solution vector.
- Returns
- A constant raw pointer to the solution vector.
Definition at line 1863 of file system_solvers_large.cpp.
◆ getRHSRawReadPtr()
const double * bitpit::SystemSolver::getRHSRawReadPtr | ( | ) | const |
Get a constant raw pointer to the solution vector.
- Returns
- A constant raw pointer to the solution vector.
Definition at line 1873 of file system_solvers_large.cpp.
◆ getRowCount()
long bitpit::SystemSolver::getRowCount | ( | ) | const |
Get the number of rows of the system.
If the matrix is a block matrix (i.e., the block size is greater than one), this function will return the number of block rows, where a block row is defined as a group of block-size matrix rows.
- Returns
- The number of rows of the system.
Definition at line 1043 of file system_solvers_large.cpp.
◆ getRowElementCount()
long bitpit::SystemSolver::getRowElementCount | ( | ) | const |
Get the number of elements in the rows of the system.
This function will return the effective number of rows of the system matrix. This value is the same as the local size used in creating the y vector for the matrix-vector product y = Ax.
- Returns
- The number of elements in the rows of the system.
Definition at line 1087 of file system_solvers_large.cpp.
◆ getRowGlobalCount()
long bitpit::SystemSolver::getRowGlobalCount | ( | ) | const |
Get number of global (block) rows.
If the matrix is a block matrix (i.e., the block size is greater than one), this function will return the global number of block rows, where a block row is defined as a group of block-size matrix rows.
- Returns
- The number of global rows
Definition at line 1130 of file system_solvers_large.cpp.
◆ getRowGlobalElementCount()
long bitpit::SystemSolver::getRowGlobalElementCount | ( | ) | const |
Get the number of global elements in the rows of the system.
This function will return the effective global number of rows of the system matrix.
- Returns
- The number of global elements in the rows of the system.
Definition at line 1173 of file system_solvers_large.cpp.
◆ getSolutionRawPtr() [1/2]
double * bitpit::SystemSolver::getSolutionRawPtr | ( | ) |
Get a raw pointer to the solution vector.
- Returns
- A raw pointer to the solution vector.
- Examples
- RBF_example_00001.cpp.
Definition at line 1908 of file system_solvers_large.cpp.
◆ getSolutionRawPtr() [2/2]
const double * bitpit::SystemSolver::getSolutionRawPtr | ( | ) | const |
Get a constant raw pointer to the solution vector.
- Returns
- A constant raw pointer to the solution vector.
Definition at line 1921 of file system_solvers_large.cpp.
◆ getSolutionRawReadPtr()
const double * bitpit::SystemSolver::getSolutionRawReadPtr | ( | ) | const |
Get a constant raw pointer to the solution vector.
- Returns
- A constant raw pointer to the solution vector.
- Examples
- RBF_example_00001.cpp.
Definition at line 1931 of file system_solvers_large.cpp.
◆ getTranspose()
bool bitpit::SystemSolver::getTranspose | ( | ) | const |
Get the transpose flag.
- Returns
- Returns true if the transposed system will be solved, false otherwise.
Definition at line 165 of file system_solvers_large.cpp.
◆ importMatrix()
|
virtual |
Import the matrix reading its contents form the specified file.
The input file should contain a compatible matrix stored in PETSc binary format. It's up to the caller of this routine to make sure the loaded matrix is compatible with the system. If the matrix file cannot be read an exception is thrown.
- Parameters
-
filePath is the path of the file
Definition at line 1982 of file system_solvers_large.cpp.
◆ importRHS()
|
virtual |
Import the RHS vector reading its contents from the specified file.
The input file should contain a compatible vector stored in PETSc binary format. If the size of the vector stored in the file is not compatible with the matrix, an exception is thrown. An exception is also raised if the file cannot be read.
It is possible to fill the RHS vector only after the system has been assembled.
- Parameters
-
filePath is the path of the file that contains RHS vector data
Definition at line 2026 of file system_solvers_large.cpp.
◆ importSolution()
|
virtual |
Import the solution vector reading its contents from the specified file.
The input file should contain a compatible vector stored in PETSc binary format. If the size of the vector stored in the file is not compatible with the matrix, an exception is thrown. An exception is also raised if the file cannot be read.
It is possible to fill the solution vector only after the system has been assembled.
- Parameters
-
filePath is the path of the file that contains solution vector data
Definition at line 2079 of file system_solvers_large.cpp.
◆ initializeKSPOptions()
|
protectedvirtual |
Initialize the options associated with the KSP.
Reimplemented in bitpit::SplitSystemSolver.
Definition at line 3413 of file system_solvers_large.cpp.
◆ initializeKSPStatus()
|
protectedvirtual |
Initialize the status of the KSP.
Reimplemented in bitpit::SplitSystemSolver.
Definition at line 3455 of file system_solvers_large.cpp.
◆ isAssembled()
bool bitpit::SystemSolver::isAssembled | ( | ) | const |
Check if the system is assembled.
- Returns
- Returns true if the system is assembled, false otherwise.
Definition at line 1221 of file system_solvers_large.cpp.
◆ isForceConsistencyEnabled()
bool bitpit::SystemSolver::isForceConsistencyEnabled | ( | ) | const |
Check if right hand side consistency is forced before solving the system.
In order to force right hand side consistency, null space components are removed from the right hand side before solving the system.
Definition at line 3572 of file system_solvers_large.cpp.
◆ isPartitioned()
bool bitpit::SystemSolver::isPartitioned | ( | ) | const |
Checks if the matrix is partitioned.
- Returns
- Returns true if the patch is partitioned, false otherwise.
- Examples
- LA_example_00001.cpp.
Definition at line 1210 of file system_solvers_large.cpp.
◆ matrixAssembly()
|
protected |
Assemble the matrix.
- Parameters
-
assembler is the matrix assembler
Definition at line 1334 of file system_solvers_large.cpp.
◆ matrixDestroy()
|
protectedvirtual |
Destroy the matrix.
Reimplemented in bitpit::SplitSystemSolver.
Definition at line 1731 of file system_solvers_large.cpp.
◆ matrixDump()
|
protectedvirtual |
Dump the matrix.
- Parameters
-
systemStream is the stream in which system information is written directory is the directory in which the matrix data file will be written prefix is the prefix added to the name of the file containing matrix data
Reimplemented in bitpit::SplitSystemSolver.
Definition at line 1691 of file system_solvers_large.cpp.
◆ matrixFill()
|
protectedvirtual |
Fill the matrix reading its contents form the specified file.
The input file should contain a compatible vector stored in PETSc binary format. It's up to the caller of this routine to make sure the loaded vector is compatible with the matrix. If the matrix file cannot be read an exception is thrown.
- Parameters
-
filePath is the path of the file
Reimplemented in bitpit::SplitSystemSolver.
Definition at line 1479 of file system_solvers_large.cpp.
◆ matrixRestore()
|
protectedvirtual |
Restore the matrix.
- Parameters
-
systemStream is the stream from which system information is read directory is the directory from which the matrix data file will be read prefix is the prefix that will be was added to the files during redistribute if set to true, the matrix will be redistributed among the available processes, allowing to restore the matrix with a different number of processes than those used to dump it
Reimplemented in bitpit::SplitSystemSolver.
Definition at line 1712 of file system_solvers_large.cpp.
◆ matrixUpdate()
|
protected |
Update the specified rows of the matrix.
The contents of the specified rows will be replaced by the data provided by the given assembler. If the matrix has not been assembled yet, both the pattern and the values of the matrix will be updated. After the matrix has been assembled only the values will be updated.
The block size of the assembler should be equal to the block size of the matrix.
- Parameters
-
nRows is the number of rows that will be updated rows are the local indices of the rows that will be updated, if a null pointer is passed, the rows that will be updated are the rows from 0 to (nRows - 1). assembler is the matrix assembler for the rows that will be updated
Definition at line 1506 of file system_solvers_large.cpp.
◆ postKrylovSetupActions()
|
protectedvirtual |
Perform actions after Krylov subspace method setup.
Definition at line 3374 of file system_solvers_large.cpp.
◆ postKSPSolveActions()
|
protectedvirtual |
Post-solve actions.
Reimplemented in bitpit::SplitSystemSolver.
Definition at line 1305 of file system_solvers_large.cpp.
◆ postPreconditionerSetupActions()
|
protectedvirtual |
Perform actions after preconditioner setup.
Definition at line 3317 of file system_solvers_large.cpp.
◆ preKrylovSetupActions()
|
protectedvirtual |
Perform actions before Krylov subspace method setup.
Reimplemented in bitpit::SplitSystemSolver.
Definition at line 3355 of file system_solvers_large.cpp.
◆ preKSPSolveActions()
|
protectedvirtual |
Pre-solve actions.
Definition at line 1288 of file system_solvers_large.cpp.
◆ prepareKSP()
|
protectedvirtual |
Prepare the KSP before the solution of the system.
Definition at line 3148 of file system_solvers_large.cpp.
◆ prePreconditionerSetupActions()
|
protectedvirtual |
Perform actions before preconditioner setup.
Definition at line 3309 of file system_solvers_large.cpp.
◆ reorderVector()
|
protected |
Reorder the specified vector.
- Parameters
-
invert is a flag for inverting the ordering
Definition at line 2907 of file system_solvers_large.cpp.
◆ resetKSPOptions()
|
protectedvirtual |
Reset the specified KSP options.
- Parameters
-
options are the options that will be reset
Reimplemented in bitpit::SplitSystemSolver.
Definition at line 3423 of file system_solvers_large.cpp.
◆ resetKSPStatus() [1/2]
|
protectedvirtual |
Reset the status of the KSP.
Reimplemented in bitpit::SplitSystemSolver.
Definition at line 3484 of file system_solvers_large.cpp.
◆ resetKSPStatus() [2/2]
|
protectedvirtual |
Reset the status of the specified KSP.
- Parameters
-
status on output will contain the status of the KSP
Reimplemented in bitpit::SplitSystemSolver.
Definition at line 3494 of file system_solvers_large.cpp.
◆ restoreInfo()
|
protectedvirtual |
Restore system information.
- Parameters
-
systemStream is the stream from which system information is read
Reimplemented in bitpit::SplitSystemSolver.
Definition at line 2233 of file system_solvers_large.cpp.
◆ restoreMatrix()
|
protected |
Restore the specified matrix.
- Parameters
-
directory is the directory from which the matrix data file will be read name is the name of the matrix that will be dumped redistribute if set to true, the matrix will be redistributed among the available processes, allowing to restore the matrix with a different number of processes than those used to dump it [out] matrix on output will contain the restored matrix
Definition at line 2453 of file system_solvers_large.cpp.
◆ restoreRHSRawPtr()
void bitpit::SystemSolver::restoreRHSRawPtr | ( | double * | raw_rhs | ) |
Restores the solution vector after getRHSRawPtr() has been called.
- Parameters
-
raw_rhs is the location of pointer to array obtained from getRHSRawPtr()
- Examples
- RBF_example_00001.cpp.
Definition at line 1887 of file system_solvers_large.cpp.
◆ restoreRHSRawReadPtr()
void bitpit::SystemSolver::restoreRHSRawReadPtr | ( | const double * | raw_rhs | ) | const |
Restores the solution vector after getRHSRawReadPtr() has been called.
- Parameters
-
raw_rhs is the location of pointer to array obtained from getRHSRawReadPtr()
Definition at line 1898 of file system_solvers_large.cpp.
◆ restoreSolutionRawPtr()
void bitpit::SystemSolver::restoreSolutionRawPtr | ( | double * | raw_solution | ) |
Restores the solution vector after getSolutionRawPtr() has been called.
- Parameters
-
raw_solution is the location of pointer to array obtained from getSolutionRawPtr()
- Examples
- RBF_example_00001.cpp.
Definition at line 1945 of file system_solvers_large.cpp.
◆ restoreSolutionRawReadPtr()
void bitpit::SystemSolver::restoreSolutionRawReadPtr | ( | const double * | raw_solution | ) | const |
Restores the solution vector after getSolutionRawReadPtr() has been called.
- Parameters
-
raw_solution is the location of pointer to array obtained from getSolutionRawReadPtr()
Definition at line 1956 of file system_solvers_large.cpp.
◆ restoreSystem()
void bitpit::SystemSolver::restoreSystem | ( | MPI_Comm | communicator, |
bool | redistribute, | ||
const std::string & | directory, | ||
const std::string & | prefix = "" ) |
Restore the system from files.
Only the contents of the system will be restored, this include the matrix, the RHS vector, the solution vector, and the information needed to properly create the aforementioned data structures (e.g., the block size or the transpose flag).
Matrix file is mandatory, whereas solution and RHS files are not. If no solution or RHS files are found they will be re-created from scratch (but they will not be initialized).
- Parameters
-
communicator is the MPI communicator redistribute if set to true, the system will be redistributed among the available processes, allowing to restore the system with a different number of processes than those used to dump it directory is the directory where the files will be read from prefix is the prefix that will be was added to the files during
Definition at line 2168 of file system_solvers_large.cpp.
◆ restoreVector() [1/3]
|
protected |
Restore the specified vector.
- Parameters
-
directory is the directory from which the vector data file will be read name is the name of the vector that will be dumped redistribute if set to true, the vector will be redistributed among the available processes, allowing to restore the vector with a different number of processes than those used to dump it [out] vector on output will contain the restored vector
Definition at line 2816 of file system_solvers_large.cpp.
◆ restoreVector() [2/3]
|
protected |
Restore the specified vector.
- Parameters
-
directory is the directory from which the vector data file will be read name is the name of the vector that will be dumped matrix is the matrix the vectors should be compatible with side specifies whether the vector can be multiplied by the matrix, or whether the matrix-vector product can be stored in it [out] vector on output will contain the restored vector
Definition at line 2763 of file system_solvers_large.cpp.
◆ restoreVector() [3/3]
|
protected |
Restore the specified vector.
- Parameters
-
directory is the directory from which the vector data file will be read name is the name of the vector that will be dumped localSize is the local size of the restored vector globalSize is the global size of the restored vector [out] vector on output will contain the restored vector
Definition at line 2856 of file system_solvers_large.cpp.
◆ setNullSpace()
|
virtual |
Attaches a null space to the system matrix.
Definition at line 3047 of file system_solvers_large.cpp.
◆ setReordering()
|
protected |
Set the reordering that will be applied when assembling the matrix.
Reordering will be applied when the system is assembled and its sole purpose is to speed up the resolution of the system (e.g., reorder can be used to reduce the fill-in of the LU factorization).
Reordering is only applied internally, all public functions expects row and column indices to be in natural matrix order (i.e., not reordered).
If the system is partitioned, each process can reorder only it's local part of the matrix.
- Parameters
-
nRows is the number of rows of the system matrix nCols is the number of columns of the system matrix reordering is the reordering that will be applied
Definition at line 3084 of file system_solvers_large.cpp.
◆ setTranspose()
void bitpit::SystemSolver::setTranspose | ( | bool | transpose | ) |
Set the transpose flag.
If the system is already assembled and the transpose flag needs to be changed, both the solution vector and the RHS one will be destroyed and re-created.
If the transpose flag needs to be changed, the workspaces associated wit the system will be cleared.
- Parameters
-
transpose if set to true, transposed system will be solved
Definition at line 181 of file system_solvers_large.cpp.
◆ setupKrylov() [1/2]
|
protectedvirtual |
Set up the Krylov subspace method used to solve the system.
Reimplemented in bitpit::SplitSystemSolver.
Definition at line 3325 of file system_solvers_large.cpp.
◆ setupKrylov() [2/2]
|
protectedvirtual |
Set up the Krylov subspace method using the given options.
This function is in charge of only setting the properties of the Krylov subspace method that will be used to solve the system. There is a dedicated function to set up the preconditioner.
- Parameters
-
ksp is the KSP whose Krylov subspace method will be setup options are the options that will be used to set up the KSP
Reimplemented in bitpit::SplitSystemSolver.
Definition at line 3340 of file system_solvers_large.cpp.
◆ setupPreconditioner() [1/2]
|
protectedvirtual |
Set up the preconditioner.
Reimplemented in bitpit::SplitSystemSolver.
- Examples
- LA_example_00001.cpp.
Definition at line 3245 of file system_solvers_large.cpp.
◆ setupPreconditioner() [2/2]
|
protectedvirtual |
Set up the specified preconditioner using the given options.
- Parameters
-
pc is the preconditioner to set up options are the options that will be used to set up the preconditioner
Reimplemented in AMGSplitSystemSolver, AMGSystemSolver, and bitpit::SplitSystemSolver.
Definition at line 3258 of file system_solvers_large.cpp.
◆ solve() [1/2]
void bitpit::SystemSolver::solve | ( | ) |
Solve the system
- Examples
- RBF_example_00001.cpp.
Definition at line 1229 of file system_solvers_large.cpp.
◆ solve() [2/2]
void bitpit::SystemSolver::solve | ( | const std::vector< double > & | rhs, |
std::vector< double > * | solution ) |
Solve the system
- Parameters
-
rhs is the right-hand-side of the system solution in input should contain the initial solution, on output it contains the solution of the linear system
Definition at line 1253 of file system_solvers_large.cpp.
◆ solveKSP()
|
protectedvirtual |
Solve KSP.
Definition at line 1268 of file system_solvers_large.cpp.
◆ unsetNullSpace()
void bitpit::SystemSolver::unsetNullSpace | ( | ) |
Removes the null space from the system matrix.
Definition at line 3062 of file system_solvers_large.cpp.
◆ update() [1/4]
void bitpit::SystemSolver::update | ( | const Assembler & | assembler | ) |
Update all the rows of the system.
Only the values of the system matrix can be updated, once the system is assembled its pattern cannot be modified.
- Parameters
-
assembler is the matrix assembler for the rows that will be updated
Definition at line 997 of file system_solvers_large.cpp.
◆ update() [2/4]
void bitpit::SystemSolver::update | ( | long | nRows, |
const long * | rows, | ||
const Assembler & | assembler ) |
Update the system.
Only the values of the system matrix can be updated, once the system is assembled its pattern cannot be modified.
- Parameters
-
nRows is the number of rows that will be updated rows are the indices of the rows that will be updated assembler is the matrix assembler for the rows that will be updated
Definition at line 1012 of file system_solvers_large.cpp.
◆ update() [3/4]
void bitpit::SystemSolver::update | ( | long | nRows, |
const long * | rows, | ||
const SparseMatrix & | elements ) |
Update the system.
Only the values of the system matrix can be updated, once the system is assembled its pattern cannot be modified.
- Parameters
-
nRows is the number of rows that will be updated rows are the indices of the rows that will be updated elements are the elements that will be used to update the rows
Definition at line 977 of file system_solvers_large.cpp.
◆ update() [4/4]
|
protected |
Update the system.
Only the values of the system matrix can be updated, once the system is assembled its pattern cannot be modified.
- Parameters
-
nRows is the number of rows that will be updated rows are the indices of the rows that will be updated assembler is the matrix assembler for the rows that will be updated
Definition at line 139 of file system_solvers_large.tpp.
◆ vectorsCreate()
|
protectedvirtual |
Create RHS and solution vectors.
Vectors will be created, but they will not be initialized.
Reimplemented in bitpit::SplitSystemSolver.
Definition at line 1741 of file system_solvers_large.cpp.
◆ vectorsDestroy()
|
protectedvirtual |
Destroy RHS and solution vectors.
Reimplemented in bitpit::SplitSystemSolver.
Definition at line 1839 of file system_solvers_large.cpp.
◆ vectorsDump()
|
protectedvirtual |
Dump RHS and solution vectors.
- Parameters
-
systemStream is the stream from which system information is read directory is the directory in which the vectors data file will be written prefix is the prefix added to the names of the files containing vector data
Definition at line 1811 of file system_solvers_large.cpp.
◆ vectorsFill() [1/2]
|
protectedvirtual |
Fill RHS and solution vectors reading their contents from the specified file.
- Parameters
-
rhsFilePath is the file path containing the content of the RHS vector, if the path is empty the function will leave the RHS vector unaltered solutionFilePath is the file path containing the content of the solution vector, if the path is empty the function will leave the solution vector unaltered
Definition at line 1777 of file system_solvers_large.cpp.
◆ vectorsFill() [2/2]
|
protectedvirtual |
Fill RHS and solution vectors using the given data.
- Parameters
-
rhs contains the that that will be copied into the RHS vector, if the vector is empty no data will be copied and function will leave the RHS vector unaltered solution contains the that that will be copied into the solution vector, if the vector is empty no data will be copied and function will leave the RHS vector unaltered
Definition at line 1758 of file system_solvers_large.cpp.
◆ vectorsReorder()
|
protectedvirtual |
Reorder RHS and solution vectors to match the order of the system matrix.
- Parameters
-
invert is a flag for inverting the ordering
Reimplemented in bitpit::SplitSystemSolver.
Definition at line 1793 of file system_solvers_large.cpp.
◆ vectorsRestore()
|
protectedvirtual |
Restore RHS and solution vectors.
- Parameters
-
systemStream is the stream that contains system information directory is the directory from which the vector data file will be read prefix is the prefix added to the name of the file containing vectors data
Reimplemented in bitpit::SplitSystemSolver.
Definition at line 1827 of file system_solvers_large.cpp.
Member Data Documentation
◆ m_A
|
protected |
Definition at line 361 of file system_solvers_large.hpp.
◆ m_colReordering
|
protected |
Definition at line 366 of file system_solvers_large.hpp.
◆ m_convergenceMonitorEnabled
|
protected |
Definition at line 368 of file system_solvers_large.hpp.
◆ m_flatten
|
protected |
Definition at line 358 of file system_solvers_large.hpp.
◆ m_KSP
|
protected |
Definition at line 370 of file system_solvers_large.hpp.
◆ m_KSPDirty
|
protected |
Definition at line 371 of file system_solvers_large.hpp.
◆ m_KSPOptions
|
protected |
Definition at line 372 of file system_solvers_large.hpp.
◆ m_KSPStatus
|
protected |
Definition at line 373 of file system_solvers_large.hpp.
◆ m_rhs
|
protected |
Definition at line 362 of file system_solvers_large.hpp.
◆ m_rowReordering
|
protected |
Definition at line 365 of file system_solvers_large.hpp.
◆ m_solution
|
protected |
Definition at line 363 of file system_solvers_large.hpp.
◆ m_transpose
|
protected |
Definition at line 359 of file system_solvers_large.hpp.
The documentation for this class was generated from the following files:
- src/LA/system_solvers_large.hpp
- src/LA/system_solvers_large.cpp
- src/LA/system_solvers_large.tpp
