TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Operateur_Grad.cpp
1/****************************************************************************
2* Copyright (c) 2025, 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 <Discretisation_base.h>
17#include <Operateur_Grad.h>
18#include <Probleme_base.h>
19#include <Perf_counters.h>
20
21Implemente_instanciable(Operateur_Grad,"Operateur_Grad",OWN_PTR(Operateur_Grad_base));
22
23Sortie& Operateur_Grad::printOn(Sortie& os) const
24{
25 return Operateur::ecrire(os);
26}
27
28Entree& Operateur_Grad::readOn(Entree& is)
29{
30 return Operateur::lire(is);
31}
32
33/*! @brief Types the operator: types as "Op_Grad_"+discretisation()+
34 *
35 * "_"+inconnue().suffix
36 *
37 */
39{
41 Nom inut;
42 Nom nom_type=eqn.discretisation().get_name_of_type_for(que_suis_je(),inut,eqn);
43 OWN_PTR(Operateur_Grad_base)::typer(nom_type);
44 Cerr << "Construction of the gradient operator type : ";
45 Cerr << valeur().que_suis_je() << finl ;
46}
47
49{
50 OWN_PTR(Operateur_Grad_base)::typer(un_type);
51}
52
53/*! @brief Adds the contribution of the operator to the array passed as parameter
54 *
55 * @param (DoubleTab& donnee) array containing the data on which the operator is applied.
56 * @param (DoubleTab& resu) array to which the contribution of the operator is added
57 * @return (DoubleTab&) the array containing the result
58 */
59DoubleTab& Operateur_Grad::ajouter(const DoubleTab& donnee,
60 DoubleTab& resu) const
61{
62 statistics().begin_count(STD_COUNTERS::gradient,statistics().get_last_opened_counter_level()+1);
63 DoubleTab& tmp = valeur().ajouter(donnee, resu);
64 statistics().end_count(STD_COUNTERS::gradient);
65 return tmp;
66}
67
68
69/*! @brief Initializes the array passed as parameter with the contribution of the operator.
70 *
71 * @param (DoubleTab& donnee) array containing the data on which the operator is applied.
72 * @param (DoubleTab& resu) array in which the contribution of the operator is stored
73 * @return (DoubleTab&) the array containing the result
74 */
75DoubleTab& Operateur_Grad::calculer(const DoubleTab& donnee,
76 DoubleTab& resu) const
77{
78 statistics().begin_count(STD_COUNTERS::gradient,statistics().get_last_opened_counter_level()+1);
79 DoubleTab& tmp = valeur().calculer(donnee, resu);
80 statistics().end_count(STD_COUNTERS::gradient);
81 return tmp;
82}
virtual Nom get_name_of_type_for(const Nom &class_operateur, const Nom &type_operteur, const Equation_base &eqn, const OBS_PTR(Champ_base)&champ_supp=OBS_PTR(Champ_base)()) const
Fills the Nom type depending on the class of operator, the type of operator and the equation.
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
class Equation_base The role of an equation is the calculation of one or more fields....
const Discretisation_base & discretisation() const
Returns the discretization associated with the equation.
const Equation_base & equation() const
Returns the reference to the equation pointed to by MorEqn::mon_equation.
Definition MorEqn.h:62
class Nom: a character string for naming TRUST objects.
Definition Nom.h:31
Classe Operateur_Grad_base This class is the base of the hierarchy of operators representing.
Classe Operateur_Grad Generic class of the hierarchy of operators computing the gradient.
DoubleTab & calculer(const DoubleTab &, DoubleTab &) const override
Initializes the array passed as parameter with the contribution of the operator.
void typer_direct(const Nom &)
DoubleTab & ajouter(const DoubleTab &, DoubleTab &) const override
Adds the contribution of the operator to the array passed as parameter.
void typer() override
Types the operator: types as "Op_Grad_"+discretisation()+.
Entree & lire(Entree &)
Reads an operator from an input stream.
Definition Operateur.cpp:44
Sortie & ecrire(Sortie &) const
Definition Operateur.cpp:24
Base class for output streams.
Definition Sortie.h:52