25#ifndef __BITPIT_SYSTEM_SOLVERS_SPLIT_HPP__
26#define __BITPIT_SYSTEM_SOLVERS_SPLIT_HPP__
31#include "system_matrix.hpp"
32#include "system_solvers_large.hpp"
36enum SystemSplitStrategy {
37 SYSTEM_SPLIT_STRATEGY_DIAGONAL,
38 SYSTEM_SPLIT_STRATEGY_FULL,
39 SYSTEM_SPLIT_STRATEGY_LOWER,
53 SystemSplitStrategy m_splitStrategy;
54 std::vector<int> m_splitSizes;
62 const std::vector<int> &splitSizes);
71 typedef SystemSplitStrategy splitStrategy;
80 SplitSystemSolver(
const std::string &prefix,
bool flatten,
bool transpose,
bool debug);
84 void assembly(
const SparseMatrix &matrix, SystemSplitStrategy splitStrategy,
const std::vector<int> &splitSizes);
85 void assembly(
const SparseMatrix &matrix, SystemSplitStrategy splitStrategy,
const std::vector<int> &splitSizes,
107 void exportMatrix(
const std::string &filePath, FileFormat exportFormat = FILE_BINARY)
const override;
110 SystemSplitStrategy m_splitStrategy;
112 std::vector<Mat> m_splitAs;
114 std::vector<KSPOptions> m_splitKSPOptions;
115 std::vector<KSPStatus> m_splitKSPStatuses;
118 using SystemSolver::update;
122 void matrixFill(
const std::string &filePath)
override;
123 void matrixDump(std::ostream &systemStream,
const std::string &directory,
const std::string &prefix)
const override;
124#if BITPIT_ENABLE_MPI==1
125 void matrixRestore(std::istream &systemStream,
const std::string &directory,
const std::string &prefix,
bool redistribute)
override;
127 void matrixRestore(std::istream &systemStream,
const std::string &directory,
const std::string &prefix)
override;
133 void vectorsRestore(std::istream &systemStream,
const std::string &directory,
const std::string &prefix)
override;
166 void dumpInfo(std::ostream &systemStream)
const override;
167 void restoreInfo(std::istream &systemStream)
override;
171#if BITPIT_ENABLE_MPI == 1
180 std::string
generateSplitPath(
const std::string &path,
const std::string &index)
const;
183 IS m_rhsSplitPermutation;
184 IS m_solutionSplitPermutation;
186 int getBlockSplitLinearIndex(
int i,
int j)
const;
187 int getBlockSplitLinearIndex(
int i,
int j,
int nSplits)
const;
The SplitSystemMatrixAssembler class is the base class for defining assemblers for split system solve...
SystemSplitStrategy getSplitStrategy() const
SplitSystemMatrixAssembler(SystemSplitStrategy splitStrategy, const std::vector< int > &splitSizes)
const std::vector< int > & getSplitSizes() const
int getSplitCount() const
The SplitSystemSolver class allows to solve a split linear system.
virtual void setupSplitKrylovs()
void resetKSPStatus() override
std::vector< int > getSplitSizes() const
SystemSplitStrategy getSplitStrategy() const
void destroyKSPOptions() override
void matrixUpdate(long nRows, const long *rows, const Assembler &assembler)
std::vector< int > getSplitOffsets() const
void generateSplitIndexes(int split, long nItems, std::vector< std::size_t > *indexes) const
void vectorsCreateSplitPermutations()
void setupPreconditioner() override
int getSplitCount() const
virtual void initializeSplitKSPStatuses()
void vectorsReorder(bool invert) override
const KSPStatus & getSplitKSPStatus(int split) const
void matrixAssembly(const Assembler &assembler)
void vectorsDestroy() override
void matrixRestore(std::istream &systemStream, const std::string &directory, const std::string &prefix, bool redistribute) override
SplitSystemSolver(bool debug=false)
virtual void destroySplitKSPOptions()
KSPOptions & getSplitKSPOptions(int split)
void vectorsRestore(std::istream &systemStream, const std::string &directory, const std::string &prefix) override
void initializeKSPStatus() override
void initializeKSPOptions() override
void assembly(const SparseMatrix &matrix, SystemSplitStrategy splitStrategy, const std::vector< int > &splitSizes)
void restoreInfo(std::istream &systemStream) override
void destroyKSPStatus() override
virtual void resetSplitKSPStatuses()
int getBlockSize() const override
virtual void initializeSplitKSPOptions()
virtual void fillSplitKSPStatuses()
void fillKSPStatus() override
void vectorsCreate() override
void setupKrylov() override
void matrixFill(const std::string &filePath) override
virtual void setupSplitPreconditioners()
std::string generateSplitPath(const std::string &path, int i) const
void generateSplitPermutation(long nItems, long itemGlobalOffset, IS *splitReordering) const
virtual void destroySplitKSPStatuses()
void update(const SparseMatrix &elements)
void matrixDump(std::ostream &systemStream, const std::string &directory, const std::string &prefix) const override
void matrixDestroy() override
void preKrylovSetupActions() override
void exportMatrix(const std::string &filePath, FileFormat exportFormat=FILE_BINARY) const override
void postKSPSolveActions() override
void dumpInfo(std::ostream &systemStream) const override
The SplitSystemSparseMatrixAssembler class allows to assembly a split system solver from a sparse mat...
SplitSystemSparseMatrixAssembler(const SparseMatrix *matrix, SystemSplitStrategy splitStrategy, const std::vector< int > &splitSizes)
The SystemMatrixAssembler class provides an interface for defining system matrix assemblers.
The SystemMatrixOrdering class provides an interface for defining classes that allows to reorder the ...
The SystemSolver class provides methods for building and solving large linear systems.
virtual void exportMatrix(const std::string &filePath, FileFormat exportFormat=FILE_BINARY) const
virtual void resetKSPOptions(KSPOptions *options) const
virtual void setupKrylov()
void assembly(const SparseMatrix &matrix)
virtual void fillKSPStatus()
virtual void resetKSPStatus()
SystemSolver(bool debug=false)
virtual void setupPreconditioner()
The SystemSparseMatrixAssembler class defines an assembler for building the system matrix form a spar...