TRUST 1.9.8
HPC thermohydraulic platform
Loading...
Searching...
No Matches
Operateur_Grad_base.cpp
1/****************************************************************************
2* Copyright (c) 2024, 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#include <Operateur_Grad_base.h>
17#include <TRUSTTrav.h>
18
19Implemente_base(Operateur_Grad_base,"Operateur_Grad_base",Operateur_base);
20
21
22/*! @brief NE FAIT RIEN A surcharger dans les classes derivees
23 *
24 * @param (Sortie& os) un flot de sortie
25 * @return (Sortie&) le flot de sortie
26 */
28{
29 return os;
30}
31
32
33/*! @brief NE FAIT RIEN A surcharger dans les classes derivees
34 *
35 * @param (Entree& is) un flot d'entree
36 * @return (Entree&) le flot d'entree
37 */
39{
40 return is;
41}
42
44{
45 /* on tente dimensionner_blocs(), mais en pression! */
46 if (has_interface_blocs()) dimensionner_blocs({{ "pression", &mat }});
47 else Process::exit(que_suis_je() + " : dimensionner() not coded!");
48}
49
50DoubleTab& Operateur_Grad_base::ajouter(const DoubleTab& inco, DoubleTab& secmem) const
51{
53 secmem *= -1, ajouter_blocs({}, secmem, {{ "pression", inco }}), secmem *= -1; /* pour avoir le bon signe */
54 else Process::exit(que_suis_je() + " : ajouter() not coded!");
55 return secmem;
56}
57
58void Operateur_Grad_base::contribuer_a_avec(const DoubleTab& inco, Matrice_Morse& matrice) const
59{
61 {
62 DoubleTrav secmem(equation().inconnue().valeurs()); //on va le jeter
63 matrice.get_set_coeff() *= -1, ajouter_blocs({{ "pression", &matrice }}, secmem), matrice.get_set_coeff() *= -1; /* pour avoir le bon signe */
64 }
65 else Process::exit(que_suis_je() + " : contribuer_a_avec() not coded!");
66}
67
68/*! @brief Calcul sans les conditions aux limites ?
69 *
70 */
71DoubleVect& Operateur_Grad_base::multvect(const DoubleTab& x, DoubleTab& b) const
72{
73 //
74 //Cerr << que_suis_je()<<"::multvect n'est surcharge!!" << finl;
75 // copie de X en mettant 0 dans le vecteur
76 // (on recupere un resultat tenant compte uniquement des conditions aux limites)
77#if 0
78 // Tentative de codage plus efficace: ne marche pas !
79 // ecart sur SGE_3D_VEF
80 DoubleTrav x0(x); // copie de la structure, initialisee a zero
81 calculer(x0, b);
82 operator_negate(b);
83 ajouter(x, b);
84#endif
85 DoubleTrav x0(x);
86 DoubleTrav b0(b);
87
88 calculer(x0, b0);
89 calculer(x,b);
90 b-=b0;
91
92 // On a soustrait au resultat la contribution des conditions aux limites.
93 return b;
94}
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
Classe Matrice_Morse Represente une matrice M (creuse), non necessairement carree.
auto & get_set_coeff()
const Equation_base & equation() const
Renvoie la reference sur l'equation pointe par MorEqn::mon_equation.
Definition MorEqn.h:62
const Nom & que_suis_je() const
renvoie la chaine identifiant la classe.
Definition Objet_U.cpp:104
virtual Entree & readOn(Entree &)
Lecture d'un Objet_U sur un flot d'entree Methode a surcharger.
Definition Objet_U.cpp:293
virtual Sortie & printOn(Sortie &) const
Ecriture de l'objet sur un flot de sortie Methode a surcharger.
Definition Objet_U.cpp:282
Classe Operateur_Grad_base Cette classe est la base de la hierarchie des operateurs representant.
virtual DoubleVect & multvect(const DoubleTab &, DoubleTab &) const
Calcul sans les conditions aux limites ?
void contribuer_a_avec(const DoubleTab &, Matrice_Morse &) const override
DOES NOTHING - to override in derived classes.
DoubleTab & ajouter(const DoubleTab &inco, DoubleTab &secmem) const override
void dimensionner(Matrice_Morse &) const override
DOES NOTHING - to override in derived classes.
classe Operateur_base Classe est la base de la hierarchie des objets representant un
virtual DoubleTab & calculer(const DoubleTab &, DoubleTab &) const
virtual int has_interface_blocs() const
virtual void dimensionner_blocs(matrices_t matrices, const tabs_t &semi_impl={ }) const
virtual void ajouter_blocs(matrices_t matrices, DoubleTab &secmem, const tabs_t &semi_impl={ }) const
static void exit(int exit_code=-1)
Routine de sortie de TRUST dans une region Kokkos.
Definition Process.cpp:455
Classe de base des flux de sortie.
Definition Sortie.h:52