TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Champ_Generique_Statistiques_base.cpp
1/****************************************************************************
2* Copyright (c) 2026, 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 <Champ_Generique_Statistiques_base.h>
17#include <Operateur_Statistique_tps_base.h>
18#include <TRUST_2_PDI.h>
19#include <Param.h>
20
21Implemente_base_sans_constructeur(Champ_Generique_Statistiques_base,"Champ_Generique_Statistiques_base",Champ_Gen_de_Champs_Gen);
22
23// XD champ_post_statistiques_base champ_post_de_champs_post champ_post_statistiques_base INHERITS_BRACE not_set
24
30
32{
33 return s << que_suis_je() << " " << le_nom();
34}
35
37{
39}
40
42{
44 //We do not set t_deb and t_fin as mandatory reading (Param::REQUIRED)
45 //because these attributes can be set by fixer_tdeb_tfin()
46 //ex: Postraitement::creer_champ_post_stat()
47 //But the mandatory specification should be kept in the documentation for the user
48 //who specifies their statistical field in the standard way in definition_champs.
49 param.ajouter("t_deb",&tstat_deb_); // XD attr t_deb floattant t_deb REQ Start of integration time
50 param.ajouter("t_fin",&tstat_fin_); // XD attr t_fin floattant t_fin REQ End of integration time
51}
52
54{
55
56 const Nom nom_post = le_nom();
57
58 Nom localisation;
59 const Entity& loc = get_localisation(0);
60 if (loc==Entity::ELEMENT)
61 localisation = "ELEM";
62 else if (loc==Entity::NODE)
63 localisation = "SOM";
64 else
65 {
66 Cerr<<"This localization is not valid for postprocessing"<<finl;
67 exit();
68 }
69
70 OWN_PTR(Champ_base) espace_stockage_source;
71 const Champ_base& source = integrale().le_champ()->get_champ(espace_stockage_source);
72 source.completer_post_champ(dom,is_axi,localisation,nom_post,format);
73 return 1;
74
75}
76
77void Champ_Generique_Statistiques_base::fixer_tdeb_tfin(const double t_deb,const double t_fin)
78{
79 tstat_deb_ = t_deb;
80 tstat_fin_ = t_fin;
81}
82
83/*! @brief for PDI IO: retrieve name, type and dimensions of the field to save/restore
84 *
85 */
87{
88 std::vector<YAML_data> data;
89 std::vector<YAML_data> ch = Champ_Gen_de_Champs_Gen::data_a_sauvegarder();
90 std::vector<YAML_data> stat = Operateur_Statistique().data_a_sauvegarder();
91 data.insert(data.end(), ch.begin(), ch.end());
92 data.insert(data.end(), stat.begin(), stat.end());
93 return data;
94}
95
97{
98 int bytes=0;
100 bytes += Operateur_Statistique().sauvegarder(os);
101 return bytes;
102}
103
105{
108 {
109 Nom bidon;
110 is >> bidon >> bidon; // We skip the identifier and field type
111 }
113 return 1;
114}
115
121
122
123//Methods to change t_deb and t_fin for statistics restarts
124//and for series statistics
133
139
141{
142 Nom bidon;
143 double dbidon;
144 DoubleTab tab_bidon;
145
147
148 is >> bidon >> bidon;
149 is >> dbidon;
150 tab_bidon.jump(is);
151
152}
Base class of generic fields having other generic fields as source. The use of the class methods reli...
void mettre_a_jour(double temps) override
int sauvegarder(Sortie &os) const override
save the different sources
Entity get_localisation(const int index=-1) const override
Returns the type of geometric entities on which the discrete values are attached (NODE for a P1 field...
virtual void lire_bidon(Entree &is) const
virtual void fixer_tstat_deb(const double t1, const double t2)
virtual OWN_PTR(Champ_Fonc_base) &creer_espace_stockage(const Nature_du_champ &nature
int reprendre(Entree &is) override
resume the different sources
std::vector< YAML_data > data_a_sauvegarder() const override
for PDI IO: retrieve name, type and dimensions of the field to save/restore
void set_param(Param &param) const override
virtual void fixer_serie(const double t1, const double t2)
Classe Champ_Generique_Statistiques_base Base class for generic field classes dedicated to statistics...
virtual int completer_post_statistiques(const Domaine &dom, const int is_axi, Format_Post_base &format)
std::vector< YAML_data > data_a_sauvegarder() const override
for PDI IO: retrieve name, type and dimensions of the field to save/restore
virtual const Integrale_tps_Champ & integrale() const =0
int reprendre(Entree &is) override
resume the different sources
void fixer_tstat_deb(const double t1, const double t2) override
void fixer_serie(const double t1, const double t2) override
virtual const Operateur_Statistique_tps_base & Operateur_Statistique() const =0
int sauvegarder(Sortie &os) const override
save the different sources
void fixer_tdeb_tfin(const double t_deb, const double t_fin)
class Champ_base This class is the base of the fields hierarchy.
Definition Champ_base.h:43
virtual int completer_post_champ(const Domaine &dom, const int axi, const Nom &loc_post, const Nom &le_nom_champ_post, Format_Post_base &format) const
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
Base class for post-processing output formats for fields (lata, med, cgns, lml, single_lata).
class Nom: a character string for naming TRUST objects.
Definition Nom.h:31
friend class Entree
Definition Objet_U.h:71
friend class Sortie
Definition Objet_U.h:70
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 const Nom & le_nom() const
Returns the name of the Objet_U. Virtual method to override: returns "neant" in this implementation.
Definition Objet_U.cpp:317
virtual int reprendre(Entree &)
Restores an Objet_U from an input stream. Virtual method to override.
Definition Objet_U.cpp:336
virtual Sortie & printOn(Sortie &) const
Writes the object to an output stream. Virtual method to override.
Definition Objet_U.cpp:278
virtual int sauvegarder(Sortie &) const
Saves an Objet_U to an output stream. Virtual method to override.
Definition Objet_U.cpp:350
virtual std::vector< YAML_data > data_a_sauvegarder() const
virtual void fixer_tstat_fin(double)=0
virtual void initialiser(double val)=0
virtual void fixer_tstat_deb(double, double)=0
virtual void mettre_a_jour(double temps)=0
Helper class to factorize the readOn method of Objet_U classes.
Definition Param.h:112
void ajouter(const char *keyword, const int *value, Param::Nature nat=Param::OPTIONAL)
Register an integer parameter.
Definition Param.cpp:364
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
void jump(Entree &) override
Definition TRUSTTab.tpp:701
static int is_PDI_restart()