DistributedSolver.hxx
1 #ifndef SELDON_FILE_DISTRIBUTED_SOLVER_HXX
2 
3 namespace Seldon
4 {
5 
7 
14  template<class T>
16  {
17  protected :
18  typedef typename ClassComplexType<T>::Treal Treal;
19 
24 
25 #ifdef SELDON_WITH_MPI
26  // data associated with distributed matrix
27  // see DistributedMatrix.hxx for a detailed description
28  int nodl_scalar_, nb_unknowns_scal_;
29  MPI_Comm comm_;
30  IVect* ProcSharingRows_;
31  Vector<IVect>* SharingRowNumbers_;
32  IVect global_col_numbers, local_col_numbers;
33 
34  template<class T2>
35  void AssembleVec(Vector<T2>& X) const;
36 
37  template<class T2>
38  void AssembleVec(Matrix<T2, General, ColMajor>& A) const;
39 #endif
40 
41  template<class MatrixSparse>
42  void ScaleMatrixRowCol(MatrixSparse& A);
43 
44  public :
45 
47 
48  void SetPrintLevel(int print);
49 
50  void Clear();
51 
52  template<class Prop0, class Storage0, class Allocator0>
54  bool keep_matrix = false, bool scale_matrix = false);
55 
56  template<class Prop0, class Storage0, class Allocator0>
57  void PerformAnalysis(Matrix<T, Prop0, Storage0, Allocator0>& A);
58 
59  template<class Prop0, class Storage0, class Allocator0>
60  void PerformFactorization(Matrix<T, Prop0, Storage0, Allocator0>& A,
61  bool scale_matrix = false);
62 
63 #ifdef SELDON_WITH_MPI
64  template<class Prop0, class Storage0, class Allocator0>
66  bool keep_matrix = false, bool scale_matrix = false);
67 
68  template<class Prop0, class Storage0, class Allocator0>
70 
71  template<class Prop0, class Storage0, class Allocator0>
72  void PerformFactorization(DistributedMatrix<T, Prop0, Storage0, Allocator0>& A,
73  bool scale_matrix = false);
74 #endif
75 
76  template<class T1>
77  void Solve(Vector<T1>& x_solution, const Vector<T1>& b_rhs);
78 
79  template<class T1>
80  void Solve(Vector<T1>& x_solution);
81 
82  template<class T1>
83  void TransSolve(Vector<T1>& x_solution);
84 
85  template<class T1>
86  void Solve(const SeldonTranspose&, Vector<T1>& x_solution, bool assemble = true);
87 
88  template<class T1>
89  void Solve(Matrix<T1, General, ColMajor>& x_solution);
90 
91  template<class T1>
92  void TransSolve(Matrix<T1, General, ColMajor>& x_solution);
93 
94  template<class T1>
95  void Solve(const SeldonTranspose&,
96  Matrix<T1, General, ColMajor>& x_solution);
97 
98  template<class MatrixSparse, class MatrixFull>
99  void GetSchurComplement(MatrixSparse& mat_direct,
100  const IVect& num, MatrixFull& mat_schur);
101 
102  size_t GetMemorySize() const;
103 
104  };
105 
106 }
107 
108 #define SELDON_FILE_DISTRIBUTED_SOLVER_HXX
109 #endif
110 
Seldon::SparseDistributedSolver::ScaleMatrixRowCol
void ScaleMatrixRowCol(MatrixSparse &A)
scales matrix with 1 / \sum a_{i, j} (rows and columns)
Definition: DistributedSolver.cxx:55
Seldon::SeldonTranspose
Definition: MatrixFlag.hxx:32
Seldon::Vector< Treal >
Seldon::SparseDistributedSolver
general class for direct solver
Definition: DistributedSolver.hxx:15
Seldon::SparseDistributedSolver::SparseDistributedSolver
SparseDistributedSolver()
Default constructor.
Definition: DistributedSolver.cxx:10
Seldon::Matrix
Definition: SeldonHeader.hxx:226
Seldon::SparseDistributedSolver::Clear
void Clear()
Clears LU matrices.
Definition: DistributedSolver.cxx:44
Seldon::SparseDirectSolver
Class grouping different direct solvers.
Definition: SparseDirectSolver.hxx:26
Seldon::SparseDistributedSolver::diagonal_scale_left
Vector< Treal > diagonal_scale_left
left scaling
Definition: DistributedSolver.hxx:22
Seldon::SparseDistributedSolver::diagonal_scale_right
Vector< Treal > diagonal_scale_right
right scaling
Definition: DistributedSolver.hxx:23
Seldon::SparseDistributedSolver::diagonal_scaling_left
bool diagonal_scaling_left
left scaling ?
Definition: DistributedSolver.hxx:20
Seldon::SparseDistributedSolver::TransSolve
void TransSolve(Vector< T1 > &x_solution)
solution of linear system A^T x = b by using LU factorization (with scaling)
Definition: DistributedSolver.cxx:502
Seldon::SparseDistributedSolver::GetSchurComplement
void GetSchurComplement(MatrixSparse &mat_direct, const IVect &num, MatrixFull &mat_schur)
Computation of a Schur Complement.
Definition: DistributedSolver.cxx:640
Seldon::DistributedMatrix
matrix distributed over all the processors
Definition: DistributedMatrix.hxx:506
Seldon::SparseDistributedSolver::GetMemorySize
size_t GetMemorySize() const
returns in bytes the memory used by the direct solver
Definition: DistributedSolver.cxx:666
Seldon::SparseDistributedSolver::SetPrintLevel
void SetPrintLevel(int print)
Changes the level of displayed messages.
Definition: DistributedSolver.cxx:31
Seldon
Seldon namespace.
Definition: Array.cxx:24
Seldon::SparseDistributedSolver::diagonal_scaling_right
bool diagonal_scaling_right
right scaling ?
Definition: DistributedSolver.hxx:21
Seldon::SparseDistributedSolver::Solve
void Solve(Vector< T1 > &x_solution, const Vector< T1 > &b_rhs)
solution of linear system Ax = b by using LU factorization (with scaling)
Definition: DistributedSolver.cxx:476