TRUST 1.9.8
HPC thermohydraulic platform
Loading...
Searching...
No Matches
Op_Ecart_type.h
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#ifndef Op_Ecart_type_included
17#define Op_Ecart_type_included
18
19#include <TRUSTTabs_forward.h>
20#include <Op_Moyenne.h>
21#include <TRUST_Ref.h>
22
24
26{
27 Declare_instanciable(Op_Ecart_type);
28public:
29 inline const Nom& le_nom() const override { return integrale_carre_champ_.le_champ_calcule().le_nom(); }
30 inline double temps() const override { return integrale_carre_champ_.le_champ_calcule().temps(); }
31 inline const Integrale_tps_Champ& integrale() const override { return integrale_carre_champ_; }
32 inline const Op_Moyenne& moyenne() const { return la_moyenne_.valeur(); }
33 inline DoubleTab& valeurs() { return integrale_champ_->le_champ_calcule().valeurs(); }
34 inline const DoubleTab& valeurs() const { return integrale_champ_->le_champ_calcule().valeurs(); }
35
36 inline DoubleTab& valeurs_carre() { return integrale_carre_champ_.le_champ_calcule().valeurs(); }
37 inline const DoubleTab& valeurs_carre() const { return integrale_carre_champ_.le_champ_calcule().valeurs(); }
38 inline double dt_integration() const { return integrale_champ_->dt_integration(); }
39 inline double dt_integration_carre() const { return integrale_carre_champ_.dt_integration(); }
40 inline void mettre_a_jour(double tps) override;
41 inline void initialiser(double val) override;
42 inline void associer(const Domaine_dis_base&, const Champ_Generique_base&, double t1, double t2) override;
43 inline void fixer_tstat_deb(double, double) override;
44 inline void fixer_tstat_fin(double) override;
45 inline void associer_op_stat(const Operateur_Statistique_tps_base&) override;
46 void completer(const Probleme_base&, const Nom&) override;
47 DoubleTab calculer_valeurs() const override;
48 inline std::vector<YAML_data> data_a_sauvegarder() const override;
49 inline int sauvegarder(Sortie& os) const override;
50 inline int reprendre(Entree& is) override;
51
52protected:
53 OBS_PTR(Op_Moyenne) la_moyenne_;
54 OBS_PTR(Integrale_tps_Champ) integrale_champ_;
56};
57
59{
60 la_moyenne_ = ref_cast(Op_Moyenne, un_op_stat);
61}
62
63inline void Op_Ecart_type::mettre_a_jour(double tps)
64{
65 integrale_carre_champ_.mettre_a_jour(tps);
66}
67
68inline void Op_Ecart_type::initialiser(double val_init)
69{
70 integrale_carre_champ_.le_champ_calcule().valeurs() = val_init;
71}
72
73inline void Op_Ecart_type::associer(const Domaine_dis_base& une_zdis, const Champ_Generique_base& le_champ, double t1, double t2)
74{
75 OWN_PTR(Champ_base) espace_stockage_source;
76 const Champ_base& source = le_champ.get_champ(espace_stockage_source);
77 Nom type_le_champ = source.que_suis_je();
78
79 int renomme;
80 renomme = 0;
81 if (type_le_champ.debute_par("Champ"))
82 renomme = 1;
83
84 type_le_champ.suffix("Champ_");
85 type_le_champ.suffix("Fonc_");
86 Nom type("Champ_Fonc_");
87
88 if (renomme == 1)
89 type += type_le_champ;
90 else
91 type = type_le_champ;
92
93 integrale_carre_champ_.typer_champ(type);
94 integrale_carre_champ_.le_champ_calcule().associer_domaine_dis_base(une_zdis);
95 integrale_carre_champ_.associer(le_champ, 2, t1, t2);
96}
97
98/*! @brief for PDI IO: retrieve name, type and dimensions of the field to save/restore
99 *
100 */
101inline std::vector<YAML_data> Op_Ecart_type::data_a_sauvegarder() const
102{
103 const Nom& name = integrale_carre_champ_.le_champ_calcule().get_pdi_name();
104 int nb_dim = integrale_carre_champ_.le_champ_calcule().valeurs().nb_dim();
105 YAML_data d(name.getString(), "double", nb_dim);
106
107 std::vector<YAML_data> data;
108 data.push_back(d);
109 return data;
110}
111
113{
114 return integrale_carre_champ_.le_champ_calcule().sauvegarder(os);
115}
116
118{
119 return integrale_carre_champ_.le_champ_calcule().reprendre(is);
120}
121
122inline void Op_Ecart_type::fixer_tstat_deb(double tdeb, double tps)
123{
124 integrale_carre_champ_.fixer_t_debut(tdeb);
125 integrale_carre_champ_.fixer_tps_integrale(tps);
126 integrale_carre_champ_.fixer_dt_integr(tps - tdeb);
127}
128
129inline void Op_Ecart_type::fixer_tstat_fin(double tps)
130{
131 integrale_carre_champ_.fixer_t_fin(tps);
132}
133
134#endif
class Champ_Generique_base
virtual const Champ_base & get_champ(OWN_PTR(Champ_base) &espace_stockage) const =0
classe Champ_base Cette classe est la base de la hierarchie des champs.
Definition Champ_base.h:43
classe Domaine_dis_base Cette classe est la base de la hierarchie des domaines discretisees.
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
class Nom Une chaine de caractere pour nommer les objets de TRUST
Definition Nom.h:31
virtual int debute_par(const char *const n) const
Definition Nom.cpp:319
Nom & suffix(const char *const)
Extraction de suffixe : Nom x("azerty");.
Definition Nom.cpp:271
const std::string & getString() const
Definition Nom.h:92
friend class Entree
Definition Objet_U.h:76
friend class Sortie
Definition Objet_U.h:75
const Nom & que_suis_je() const
renvoie la chaine identifiant la classe.
Definition Objet_U.cpp:104
OBS_PTR(Integrale_tps_Champ) integrale_champ_
const DoubleTab & valeurs() const
void fixer_tstat_fin(double) override
const DoubleTab & valeurs_carre() const
const Nom & le_nom() const override
Donne le nom de l'Objet_U Methode a surcharger : renvoie "neant" dans cette implementation.
int sauvegarder(Sortie &os) const override
Sauvegarde d'un Objet_U sur un flot de sortie Methode a surcharger.
DoubleTab & valeurs_carre()
double temps() const override
int reprendre(Entree &is) override
Reprise d'un Objet_U sur un flot d'entree Methode a surcharger.
std::vector< YAML_data > data_a_sauvegarder() const override
for PDI IO: retrieve name, type and dimensions of the field to save/restore
void associer(const Domaine_dis_base &, const Champ_Generique_base &, double t1, double t2) override
double dt_integration_carre() const
void initialiser(double val) override
void associer_op_stat(const Operateur_Statistique_tps_base &) override
Integrale_tps_Champ integrale_carre_champ_
double dt_integration() const
void fixer_tstat_deb(double, double) override
OBS_PTR(Op_Moyenne) la_moyenne_
void completer(const Probleme_base &, const Nom &) override
DoubleTab & valeurs()
DoubleTab calculer_valeurs() const override
const Op_Moyenne & moyenne() const
const Integrale_tps_Champ & integrale() const override
void mettre_a_jour(double tps) override
classe Operateur_Statistique_tps_base Represente des operations statistiques sur les champs.
classe Probleme_base C'est un Probleme_U qui n'est pas un couplage.
Classe de base des flux de sortie.
Definition Sortie.h:52
classe YAML_data : collection of all needed information for data to save/restore in order to write th...
Definition YAML_data.h:26