Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
bitpit::DiscretizationStencilSolver< stencil_t, solver_kernel_t > Class Template Reference
Inheritance diagram for bitpit::DiscretizationStencilSolver< stencil_t, solver_kernel_t >:
Inheritance graph
[legend]
Collaboration diagram for bitpit::DiscretizationStencilSolver< stencil_t, solver_kernel_t >:
Collaboration graph
[legend]

Public Types

typedef DiscretizationStencilSolverAssembler< stencil_t, solver_kernel_t > Assembler
 
- Public Types inherited from bitpit::SystemSolver
typedef SystemMatrixAssembler Assembler
 
enum  FileFormat { FILE_BINARY , FILE_ASCII }
 

Public Member Functions

void assembly (const Assembler &assembler)
 
template<typename stencil_container_t = std::vector<stencil_t>>
void assembly (const stencil_container_t &stencils)
 
template<typename stencil_container_t = std::vector<stencil_t>>
void assembly (MPI_Comm communicator, bool partitioned, const stencil_container_t &stencils)
 
void clear () override
 
void matrixAssembly (const Assembler &assembler)
 
void matrixUpdate (long nRows, const long *rows, const Assembler &assembler)
 
void solve ()
 
template<typename stencil_container_t = std::vector<stencil_t>>
void update (const std::vector< long > &rows, const stencil_container_t &stencils)
 
template<typename stencil_container_t = std::vector<stencil_t>>
void update (const stencil_container_t &stencils)
 
void update (long nRows, const long *rows, const Assembler &assembler)
 
template<typename stencil_container_t = std::vector<stencil_t>>
void update (std::size_t nRows, const long *rows, const stencil_container_t &stencils)
 
- Public Member Functions inherited from bitpit::SystemSolver
 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 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
 
KSPOptionsgetKSPOptions ()
 
const KSPOptionsgetKSPOptions () const
 
const KSPStatusgetKSPStatus () 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
 
bool isSetUp () 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 setUp ()
 
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 Member Functions

void assembleConstants (const Assembler &assembler)
 
void updateConstants (std::size_t nRows, const long *rows, const Assembler &assembler)
 
- Protected Member Functions inherited from bitpit::SystemSolver
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

std::vector< double > m_constants
 
- Protected Attributes inherited from bitpit::SystemSolver
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
 

Additional Inherited Members

- Protected Types inherited from bitpit::SystemSolver
enum  VectorSide { VECTOR_SIDE_RIGHT , VECTOR_SIDE_LEFT }
 

Detailed Description

template<typename stencil_t, typename solver_kernel_t = SystemSolver>
class bitpit::DiscretizationStencilSolver< stencil_t, solver_kernel_t >

The DiscretizationStencilSolver class handles the solution of linear systems assembled from discretization stencils.

Definition at line 235 of file stencil_solver.hpp.

Member Typedef Documentation

◆ Assembler

template<typename stencil_t , typename solver_kernel_t = SystemSolver>
typedef DiscretizationStencilSolverAssembler<stencil_t, solver_kernel_t> bitpit::DiscretizationStencilSolver< stencil_t, solver_kernel_t >::Assembler

Definition at line 238 of file stencil_solver.hpp.

Member Function Documentation

◆ assembleConstants()

template<typename stencil_t , typename solver_kernel_t >
void bitpit::DiscretizationStencilSolver< stencil_t, solver_kernel_t >::assembleConstants ( const Assembler & assembler)
protected

Assemble the constants associated with stencil solver.

Parameters
assembleris the solver assembler

Definition at line 1208 of file stencil_solver.tpp.

◆ assembly() [1/3]

template<typename stencil_t , typename solver_kernel_t >
void bitpit::DiscretizationStencilSolver< stencil_t, solver_kernel_t >::assembly ( const Assembler & assembler)

Assembly the system.

After assembying th system solver, its options will be reset.

Parameters
assembleris the matrix assembler
reorderingis the reordering that will be applied when assembling the system

Definition at line 1082 of file stencil_solver.tpp.

◆ assembly() [2/3]

template<typename stencil_t , typename solver_kernel_t >
template<typename stencil_container_t >
void bitpit::DiscretizationStencilSolver< stencil_t, solver_kernel_t >::assembly ( const stencil_container_t & stencils)

Assembly the stencil solver.

After assembying th system solver, its options will be reset.

Parameters
stencilsare the stencils

Definition at line 1036 of file stencil_solver.tpp.

◆ assembly() [3/3]

template<typename stencil_t , typename solver_kernel_t >
template<typename stencil_container_t >
void bitpit::DiscretizationStencilSolver< stencil_t, solver_kernel_t >::assembly ( MPI_Comm communicator,
bool partitioned,
const stencil_container_t & stencils )

Initialize the stencil solver.

Parameters
partitionedcontrols if the matrix is partitioned
communicatoris the MPI communicator
stencilsare the stencils

Definition at line 1050 of file stencil_solver.tpp.

◆ clear()

template<typename stencil_t , typename solver_kernel_t >
void bitpit::DiscretizationStencilSolver< stencil_t, solver_kernel_t >::clear ( )
overridevirtual

Clear the stencil solver

Reimplemented from bitpit::SystemSolver.

Definition at line 1019 of file stencil_solver.tpp.

◆ matrixAssembly()

template<typename stencil_t , typename solver_kernel_t >
void bitpit::DiscretizationStencilSolver< stencil_t, solver_kernel_t >::matrixAssembly ( const Assembler & assembler)

Assembly the matrix.

Parameters
assembleris the matrix assembler

Definition at line 1093 of file stencil_solver.tpp.

◆ matrixUpdate()

template<typename stencil_t , typename solver_kernel_t >
void bitpit::DiscretizationStencilSolver< stencil_t, solver_kernel_t >::matrixUpdate ( long nRows,
const long * rows,
const Assembler & assembler )

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
nRowsis the number of rows that will be updated
rowsare 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).
assembleris the matrix assembler for the rows that will be updated

Definition at line 1119 of file stencil_solver.tpp.

◆ solve()

template<typename stencil_t , typename solver_kernel_t >
void bitpit::DiscretizationStencilSolver< stencil_t, solver_kernel_t >::solve ( )

Solve the system.

Definition at line 1252 of file stencil_solver.tpp.

◆ update() [1/4]

template<typename stencil_t , typename solver_kernel_t >
template<typename stencil_container_t >
void bitpit::DiscretizationStencilSolver< stencil_t, solver_kernel_t >::update ( const std::vector< long > & rows,
const stencil_container_t & stencils )

Update the stencil solver.

Only the values of the system matrix and the values of the constants can be updated, once the system is initialized its pattern cannot be modified.

Parameters
rowsare the global indices of the rows that will be updated
stencilsare the stencils that will be used to update the rows

Definition at line 1154 of file stencil_solver.tpp.

◆ update() [2/4]

template<typename stencil_t , typename solver_kernel_t >
template<typename stencil_container_t >
void bitpit::DiscretizationStencilSolver< stencil_t, solver_kernel_t >::update ( const stencil_container_t & stencils)

Update all the stencil solver.

Only the values of the system matrix and the values of the constants can be updated, once the system is initialized its pattern cannot be modified.

Parameters
stencilsare the stencils that will be used to update the rows

Definition at line 1138 of file stencil_solver.tpp.

◆ update() [3/4]

template<typename stencil_t , typename solver_kernel_t >
void bitpit::DiscretizationStencilSolver< stencil_t, solver_kernel_t >::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
nRowsis the number of rows that will be updated
rowsare the indices of the rows that will be updated
assembleris the matrix assembler for the rows that will be updated

Definition at line 1197 of file stencil_solver.tpp.

◆ update() [4/4]

template<typename stencil_t , typename solver_kernel_t >
template<typename stencil_container_t >
void bitpit::DiscretizationStencilSolver< stencil_t, solver_kernel_t >::update ( std::size_t nRows,
const long * rows,
const stencil_container_t & stencils )

Update the stencil solver.

Only the values of the system matrix and the values of the constants can be updated, once the system is initialized its pattern cannot be modified.

Parameters
nRowsis the number of stencils that will be updated
rowsare the rows of the stencils that will be updated, if a null pointer is passed, the stencils that will be updated are the stencils from 0 to (nRows - 1).
stencilsare the stencils that will be used to update the rows

Definition at line 1173 of file stencil_solver.tpp.

◆ updateConstants()

template<typename stencil_t , typename solver_kernel_t >
void bitpit::DiscretizationStencilSolver< stencil_t, solver_kernel_t >::updateConstants ( std::size_t nRows,
const long * rows,
const Assembler & assembler )
protected

Update the constants associated with stencil solver.

Parameters
nRowsis the number of stencils that will be updated
rowsare the rows of the stencils that will be updated, if a null pointer is passed, the stencils that will be updated are the stencils from 0 to (nRows - 1).
assembleris the solver assembler

Definition at line 1230 of file stencil_solver.tpp.

Member Data Documentation

◆ m_constants

template<typename stencil_t , typename solver_kernel_t = SystemSolver>
std::vector<double> bitpit::DiscretizationStencilSolver< stencil_t, solver_kernel_t >::m_constants
protected

Definition at line 266 of file stencil_solver.hpp.


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