TrioCFD 1.9.8
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 //On ne fixe pas t_deb et t_fin en lecture obligatoire (Param::REQUIRED)
45 //car ces attributs peuvent etre fixes par fixer_tdeb_tfin()
46 //ex : Postraitement::creer_champ_post_stat()
47 //Mais specification obligatoire a conserver dans la doc pour l utilisateur
48 //qui specifie son champ statistique de facon standard dans 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; // On saute l'identificateur et le type des champs
111 }
113 return 1;
114}
115
121
122
123//Methodes pour changer t_deb et t_fin pour des reprises de statistiques
124//et pour des statistiques en serie
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}
Classe de base des champs generiques ayant comme source d'autres champs generiques L'utilisation des ...
void mettre_a_jour(double temps) override
int sauvegarder(Sortie &os) const override
sauvegarde des differentes sources
Entity get_localisation(const int index=-1) const override
Renvoie le type des entites geometriques sur auxquelles les valeurs discretes sont attachees (NODE po...
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
reprise des differentes 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 Classe de base des classes de champs generiques dedies aux s...
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
reprise des differentes 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
sauvegarde des differentes sources
void fixer_tdeb_tfin(const double t_deb, const double t_fin)
classe Champ_base Cette classe est la base de la hierarchie des champs.
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
Classe de base des formats de postraitements pour les champs (lata, med, cgns, lml,...
class Nom Une chaine de caractere pour nommer les objets de TRUST
Definition Nom.h:31
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
virtual Entree & readOn(Entree &)
Lecture d'un Objet_U sur un flot d'entree Methode a surcharger.
Definition Objet_U.cpp:293
virtual const Nom & le_nom() const
Donne le nom de l'Objet_U Methode a surcharger : renvoie "neant" dans cette implementation.
Definition Objet_U.cpp:319
virtual int reprendre(Entree &)
Reprise d'un Objet_U sur un flot d'entree Methode a surcharger.
Definition Objet_U.cpp:338
virtual Sortie & printOn(Sortie &) const
Ecriture de l'objet sur un flot de sortie Methode a surcharger.
Definition Objet_U.cpp:282
virtual int sauvegarder(Sortie &) const
Sauvegarde d'un Objet_U sur un flot de sortie Methode a surcharger.
Definition Objet_U.cpp:352
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)
Routine de sortie de TRUST dans une region Kokkos.
Definition Process.cpp:455
Classe de base des flux de sortie.
Definition Sortie.h:52
void jump(Entree &) override
Definition TRUSTTab.tpp:701
static int is_PDI_restart()