TrioCFD 1.9.9_beta
TrioCFD documentation
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 DOES NOTHING To be overridden in derived classes
23 *
24 * @param (Sortie& os) an output stream
25 * @return (Sortie&) the output stream
26 */
28{
29 return os;
30}
31
32
33/*! @brief DOES NOTHING To be overridden in derived classes
34 *
35 * @param (Entree& is) an input stream
36 * @return (Entree&) the input stream
37 */
39{
40 return is;
41}
42
44{
45 /* try dimensionner_blocs(), but for pressure! */
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; /* to get the correct sign */
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()); //will be discarded
63 matrice.get_set_coeff() *= -1, ajouter_blocs({{ "pression", &matrice }}, secmem), matrice.get_set_coeff() *= -1; /* to get the correct sign */
64 }
65 else Process::exit(que_suis_je() + " : contribuer_a_avec() not coded!");
66}
67
68/*! @brief Computation without boundary conditions ?
69 *
70 */
71DoubleVect& Operateur_Grad_base::multvect(const DoubleTab& x, DoubleTab& b) const
72{
73 //
74 //Cerr << que_suis_je()<<"::multvect is not overridden!!" << finl;
75 // copy of X with zeros in the vector
76 // (we recover a result taking into account only the boundary conditions)
77#if 0
78 // Attempt at more efficient coding: does not work!
79 // discrepancy on SGE_3D_VEF
80 DoubleTrav x0(x); // copy of the structure, initialized to 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 // We have subtracted from the result the contribution of the boundary conditions.
93 return b;
94}
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
Matrice_Morse class - Represents a (sparse) matrix M, not necessarily square,.
auto & get_set_coeff()
const Equation_base & equation() const
Returns the reference to the equation pointed to by MorEqn::mon_equation.
Definition MorEqn.h:62
const Nom & que_suis_je() const
Returns the string identifying the class.
Definition Objet_U.cpp:104
virtual Entree & readOn(Entree &)
Reads an Objet_U from an input stream. Virtual method to override.
Definition Objet_U.cpp:289
virtual Sortie & printOn(Sortie &) const
Writes the object to an output stream. Virtual method to override.
Definition Objet_U.cpp:278
Classe Operateur_Grad_base This class is the base of the hierarchy of operators representing.
virtual DoubleVect & multvect(const DoubleTab &, DoubleTab &) const
Computation without boundary conditions ?
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.
class Operateur_base This class is the base of the hierarchy of objects representing an
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)
Exit routine for TRUST within a Kokkos region.
Definition Process.cpp:466
Base class for output streams.
Definition Sortie.h:52