1#ifndef _RHEOLEF_SOLVER_PASTIX_H
2#define _RHEOLEF_SOLVER_PASTIX_H
25#include "rheolef/config.h"
27#ifdef _RHEOLEF_HAVE_PASTIX
29#include "rheolef/solver.h"
33#ifndef _RHEOLEF_HAVE_MPI
38#include "cscd_utils.h"
48template<
class T,
class M>
49class solver_pastix_base_rep :
public solver_abstract_rep<T,M> {
54 solver_pastix_base_rep ();
55 explicit solver_pastix_base_rep (
const csr<T,M>& a,
const solver_option& opt = solver_option());
56 bool initialized()
const {
return true; }
57 void update_values (
const csr<T,M>& a);
58 ~solver_pastix_base_rep ();
62 vec<T,M> trans_solve (
const vec<T,M>& rhs)
const;
63 vec<T,M>
solve (
const vec<T,M>& rhs)
const;
68 void load (
const csr<T,M>& a,
const solver_option& opt = solver_option());
69 bool is_symmetric ()
const {
return _is_sym; }
70 void resize (pastix_int_t n, pastix_int_t nnz);
71 void load_symmetric (
const csr<T,M>& a);
72 void load_unsymmetric (
const csr<T,M>& a);
73 void load_both_continued (
const csr<T,M>& a);
75 void symbolic_factorization ();
76 void numeric_factorization ();
81 static const pastix_int_t _base = 1;
84 mutable std::vector<pastix_int_t> _ptr;
85 mutable std::vector<pastix_int_t> _idx;
86 mutable std::vector<T> _val;
88 size_t _pattern_dimension;
89 mutable pastix_data_t* _pastix_data;
90 mutable pastix_int_t _iparm [IPARM_SIZE];
91 mutable T _dparm [DPARM_SIZE];
92 distributor _csr_row_ownership;
93 distributor _csr_col_ownership;
95 mutable std::vector<T> _new_rhs;
96 mutable std::vector<pastix_int_t> _new_i2dis_i_base;
97 mutable std::vector<pastix_int_t> _i2new_dis_i;
98 bool _have_pastix_bug_small_matrix;
102 pastix_data_t** pp_data()
const {
return &_pastix_data; }
108template<
class T,
class M>
109class solver_pastix_rep {};
115class solver_pastix_rep<
T,sequential> :
public solver_pastix_base_rep<T,sequential> {
117 typedef solver_pastix_base_rep<T,sequential> base;
121 solver_pastix_rep () : base() {}
122 explicit solver_pastix_rep (
const csr<T,sequential>& a,
const solver_option& opt = solver_option())
124 void update_values (
const csr<T,sequential>& a) { base::update_values(a); }
128 vec<T,sequential> trans_solve (
const vec<T,sequential>& rhs)
const {
return base::trans_solve(rhs); }
129 vec<T,sequential>
solve (
const vec<T,sequential>& rhs)
const {
return base::solve(rhs); }
134 void load (
const csr<T,sequential>& a,
const solver_option& opt = solver_option()) {
load(a,opt); }
135 bool is_symmetric ()
const {
return base::is_symmetric(); }
136 void resize (pastix_int_t n, pastix_int_t nnz) { resize (n,nnz); }
137 void load_symmetric (
const csr<T,sequential>& a) { load_symmetric(a); }
138 void load_unsymmetric (
const csr<T,sequential>& a) { load_unsymmetric(a); }
139 void load_both_continued (
const csr<T,sequential>& a) { load_both_continued(a); }
141 void symbolic_factorization () { symbolic_factorization(); }
142 void numeric_factorization () { numeric_factorization(); }
147#ifdef _RHEOLEF_HAVE_MPI
149class solver_pastix_rep<
T,
distributed> :
public solver_pastix_base_rep<T,distributed> {
150 typedef solver_pastix_base_rep<T,distributed> base;
156 solver_pastix_rep ();
157 explicit solver_pastix_rep (
const csr<T,distributed>& a,
const solver_option& opt = solver_option());
158 void update_values (
const csr<T,distributed>& a);
159 ~solver_pastix_rep ();
164 vec<T,distributed> trans_solve (
const vec<T,distributed>& rhs)
const;
165 vec<T,distributed>
solve (
const vec<T,distributed>& rhs)
const;
170 void load (
const csr<T,distributed>& a,
const solver_option& opt = solver_option());
171 bool is_symmetric ()
const {
return base::_is_sym; }
172 void resize (pastix_int_t n, pastix_int_t nnz);
173 void load_symmetric (
const csr<T,distributed>& a);
174 void load_unsymmetric (
const csr<T,distributed>& a);
175 void load_both_continued (
const csr<T,distributed>& a);
177 void symbolic_factorization ();
178 void numeric_factorization ();
183 std::vector<pastix_int_t> _i2dis_i_base;
185 pastix_int_t* _new_ptr;
186 pastix_int_t* _new_idx;
see the communicator page for the full documentation
This file is part of Rheolef.
void solve(tiny_matrix< T > &a, tiny_vector< size_t > &piv, const tiny_vector< T > &b, tiny_vector< T > &x)
void check(Float p, const field &uh)
void load(idiststream &in, Float &p, field &uh)