TRUST 1.9.8
HPC thermohydraulic platform
Loading...
Searching...
No Matches
Precond_base.h
1/****************************************************************************
2* Copyright (c) 2022, CEA
3* All rights reserved.
4*
5* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6* 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7* 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8* 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
9*
10* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
11* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
12* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
13*
14*****************************************************************************/
15
16#ifndef Precond_base_included
17#define Precond_base_included
18
19#include <TRUSTTabs_forward.h>
20#include <Objet_U.h>
21
22class Matrice_Base;
23class Champ_Inc_base;
24
25class Precond_base : public Objet_U
26{
27 Declare_base_sans_constructeur(Precond_base);
28public:
29 // Order is important (we test for example if status_>=REINIT_COEFF)
30 enum Init_Status { READY = 0, REINIT_COEFF = 1, REINIT_ALL = 2 };
31
33
36 int preconditionner(const Matrice_Base&, const DoubleVect& src, DoubleVect& solution);
37 void prepare(const Matrice_Base&, const DoubleVect& src);
38
39 virtual int supporte_matrice_morse_sym();
40 Init_Status get_status() { return status_; }
41 // Call this to know if "src" must have an updated virtual space before calling preconditionner
42 virtual int get_flag_updated_input() const { return 1; }
43
44protected:
45 // implementations of preconditionner_ must take care of echange_ev_solution_ and update
46 // the virtual space if needed.
47 virtual int preconditionner_(const Matrice_Base&, const DoubleVect& src, DoubleVect& solution) = 0;
48 virtual void prepare_(const Matrice_Base&, const DoubleVect&);
49
50 // Should the preconditionner_ method update the virtual space of the result ?
52
53private:
54 Init_Status status_;
55};
56
57#endif
Classe Champ_Inc_base.
Classe Matrice_Base Classe de base de la hierarchie des matrices.
Objet_U()
Constructeur par defaut : attribue un numero d'identifiant unique a l'objet (object_id_),...
Definition Objet_U.cpp:55
int preconditionner(const Matrice_Base &, const DoubleVect &src, DoubleVect &solution)
Call to the prepare() method if reinit() has been called previously, then call to preconditionner_().
void prepare(const Matrice_Base &, const DoubleVect &src)
prepares the preconditionner if needed after a matrix change (reinit() call).
void set_echange_espace_virtuel_resultat(int flag)
Call this method to change the behaviour of the preconditionner() method 0-> result will not have an ...
int echange_ev_solution_
virtual int get_flag_updated_input() const
virtual void prepare_(const Matrice_Base &, const DoubleVect &)
this method must be overloaded if some preparation is necessary.
Init_Status get_status()
void reinit(Init_Status x=REINIT_ALL)
this method must be called before preconditionner() whenever the matrix changes (coefficients only or...
virtual int preconditionner_(const Matrice_Base &, const DoubleVect &src, DoubleVect &solution)=0
virtual int supporte_matrice_morse_sym()
returns 1 if the implementation accepts Matrice_Morse_Sym matrices, otherwise 0.