16#include <Solv_GCP_NS.h>
17#include <Matrice_Bloc_Sym.h>
18#include <TRUSTTab_parts.h>
21#include <Perf_counters.h>
37 param.lire_avec_accolades_depuis(is);
47 param.
ajouter(
"precond", &le_precond_);
57 else if (mot ==
"quiet")
59 else if (mot ==
"solveur0")
64 else if (mot ==
"solveur1")
75static inline void corriger(DoubleVect& X,
double alpha,
double beta,
const DoubleVect& X1,
const DoubleVect& X0,
int prems,
int n)
79 for (; i < prems; i++)
82 X(i) += alpha * X1(i - prems);
85static inline void injecter(
const DoubleVect& X, DoubleVect& tmp,
int prems,
int n)
88 for (
int i = prems; i < sz; i++)
89 tmp(i) = X(i - prems);
91static inline void extraire(DoubleVect& X,
const DoubleVect& tmp,
int prems,
int n)
94 for (
int i = prems; i < sz; i++)
95 X(i - prems) = tmp(i);
100 Cerr <<
"The dedicated solver GCP_NS can be used only for blocks symetric matrixes" << finl;
101 Cerr <<
"containing 2*2 blocks for VEF discretization P0+P1." << finl;
129 const trustIdType nmax_min = 100, nmaxmax=10000000;
131 int nmax =
static_cast<int>(std::min(nmax0, nmaxmax));
133 double dold, dnew, alfa;
137 ConstDoubleTab_parts mo_solution(solution);
138 DoubleVect X1 = mo_solution[1];
151 DoubleVect X0 = mo_solution[0];
157 extraire(F0, secmem, 0, n0);
158 DoubleVect residu(F0);
160 extraire(F1, secmem, n0, n1);
163 injecter(X1, solution, n0, n1);
170 double norme = mp_norme_vect(residu);
172 le_precond_->preconditionner(A00, residu, g);
179 dold = mp_prodscal(residu, g);
182 Cout <<
"GCP NS residue = " << norme <<
" " << finl;
184 while ((norme >
seuil_) && (niter++ < nmax))
191 Cout <<
"Solveur1: ";
198 s = mp_prodscal(F0, p);
200 corriger(solution, alfa, alfa, X1, p, n0, n1);
202 norme = mp_norme_vect(residu);
203 if (norme >
seuil_ && dnew > 0)
206 Cout <<
"Solveur0: ";
208 le_precond_->preconditionner(A00, residu, g);
211 dnew = mp_prodscal(residu, g);
217 Cerr <<
"Error : dnew<0 in GCP NS solver." << finl;
218 Cerr <<
"Try to reduce the threshold value of solveur0" << finl;
219 Cerr <<
"to a value inferior to those of the GCP NS solver." << finl;
225 Cout <<
"GCP NS residue = " << norme <<
" " << finl;
226 if ((niter % 15) == 0)
232 Cerr <<
"No convergence after : " << niter <<
" iterations\n";
233 Cerr <<
" Residue : " << norme <<
"\n";
241 statistics().end_count(STD_COUNTERS::system_solver,-1,0);
243 statistics().begin_count(STD_COUNTERS::system_solver,statistics().get_last_opened_counter_level()+1);
Class defining operators and methods for all reading operation in an input flow (file,...
Classe Matrice_Base Classe de base de la hierarchie des matrices.
virtual DoubleVect & multvectT(const DoubleVect &, DoubleVect &) const
Multiplication d'un vecteur par la matrice transposee.
virtual int nb_lignes() const =0
Return local number of lines (=size on the current proc).
virtual DoubleVect & multvect(const DoubleVect &, DoubleVect &) const
Multiplication d'un vecteur par la matrice.
virtual DoubleVect & ajouter_multvect(const DoubleVect &x, DoubleVect &r) const
Operation de multiplication-accumulation (saxpy) matrice vecteur.
const Matrice & get_bloc(int i, int j) const override
int nb_bloc_lignes() const
int nb_bloc_colonnes(void) const
Une chaine de caractere (Nom) en majuscules.
const Nom & que_suis_je() const
renvoie la chaine identifiant la classe.
virtual Entree & readOn(Entree &)
Lecture d'un Objet_U sur un flot d'entree Methode a surcharger.
virtual Sortie & printOn(Sortie &) const
Ecriture de l'objet sur un flot de sortie Methode a surcharger.
Helper class to factorize the readOn method of Objet_U classes.
void ajouter(const char *keyword, const int *value, Param::Nature nat=Param::OPTIONAL)
Register an integer parameter.
void ajouter_non_std(const char *keyword, const Objet_U *value, Param::Nature nat=Param::OPTIONAL)
Register a keyword handled by Objet_U::lire_motcle_non_standard.
static double mp_sum(double)
Calcule la somme de x sur tous les processeurs du groupe courant.
static void exit(int exit_code=-1)
Routine de sortie de TRUST dans une region Kokkos.
static int je_suis_maitre()
renvoie 1 si on est sur le processeur maitre du groupe courant (c'est a dire me() == 0),...
SolveurSys solveur_poisson0
int lire_motcle_non_standard(const Motcle &, Entree &) override
Lecture des parametres de type non simple d'un objet_U a partir d'un flot d'entree.
int resoudre_systeme(const Matrice_Base &, const DoubleVect &, DoubleVect &) override
void set_param(Param ¶m) const override
SolveurSys solveur_poisson1
Classe de base des flux de sortie.
_SIZE_ size_totale() const
void ajoute(_SCALAR_TYPE_ alpha, const TRUSTVect &y, Mp_vect_options opt=VECT_ALL_ITEMS)
virtual void echange_espace_virtuel(IsExchangeBlocking exchange_type=IsExchangeBlocking::DefaultBlocking, const std::string kernel_name="noname")