TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Format_Post_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#include <Format_Post_base.h>
16#include <Domaine_VF.h>
17#include <Param.h>
18
19Implemente_base(Format_Post_base,"Format_Post_base",Objet_U);
20
21/*! @brief erreur => exit
22 *
23 */
25{
26 Cerr << "Format_Post_base::printOn : error" << finl;
27 exit();
28 return os;
29}
30
32{
33 Cerr<<"Reading of data for a "<<que_suis_je()<<" post-processing format object"<<finl;
34 Param param(que_suis_je());
35 set_param(param);
36 param.lire_avec_accolades_depuis(is);
37 return is;
38}
39
40void Format_Post_base::resetTime(double t, const std::string dirname)
41{
42 if (dirname.empty())
43 {
44 Cerr << "Format '" << que_suis_je() << " does not support resetTime()!!" << finl;
45 Process::exit(-1);
46 // but LATA does :-)
47 }
48}
49
51{
52 return -1;
53}
54
55/*! @brief Initialise le fichier avec des parametres appropries pour son format (exemple: format ascii, efface le fichier existant, un
56 *
57 * fichier unique pour tous les processeurs etc...)
58 * Methode a surcharger dans les classes derivees.
59 * Valeur de retour: 1 si l'operation a reussi, 0 sinon.
60 *
61 */
63{
64 Cerr << "Format_Post_base::initialize_by_default(" << file_basename
65 << ")\n method not coded for " << que_suis_je() << finl;
66 return 0;
67}
68
69int Format_Post_base::initialize(const Nom& file_basename, const int format, const Nom& option_para)
70{
71 Cerr << "Format_Post_base::initialize(" << file_basename
72 << ")\n method not coded for " << que_suis_je() << finl;
73 return 0;
74}
75
76/*! @brief Modification of the post processing file name.
77 * For save/restart this might also move and rename files around to avoid overriding existing files.
78 */
79int Format_Post_base::modify_file_basename(const Nom file_basename, bool for_restart, const double tinit)
80{
81 return 0;
82}
83
84int Format_Post_base::ecrire_entete(const double temps_courant,const int reprise,const int est_le_premier_post)
85{
86 Cerr << "Format_Post_base::ecrire_entete method not coded for " << que_suis_je() << finl;
87 return 0;
88}
89
90int Format_Post_base::finir(const int est_le_dernier_post)
91{
92 Cerr << "Format_Post_base::finir method not coded for " << que_suis_je() << finl;
93 return 0;
94}
95
96int Format_Post_base::init_ecriture(double temps_courant,double temps_post,
97 int est_le_premier_postraitement_pour_nom_fich_,const Domaine& domaine)
98{
99 return 1;
100}
101
102int Format_Post_base::finir_ecriture(double temps_courant)
103{
104 return 1;
105}
106
107
108
109int Format_Post_base::completer_post(const Domaine& dom,const int is_axi,
110 const Nature_du_champ& nature,const int nb_compo,const Noms& noms_compo,
111 const Motcle& loc_post,const Nom& le_nom_champ_post)
112{
113
114 Cerr << "Format_Post_base::preparer_post_champ(...)\n"
115 << " method not coded for " << que_suis_je() << finl;
116 return 0;
117
118}
119
120int Format_Post_base::preparer_post(const Nom& id_du_domaine,const int est_le_premier_post,
121 const int reprise,
122 const double t_init)
123{
124
125 Cerr << "Format_Post_base::preparer_post(...)\n"
126 << " method not coded for " << que_suis_je() << finl;
127 return 0;
128
129}
130
131
132/*! @brief Ecriture d'un maillage.
133 *
134 * L'ecriture du domaine a lieu soit au debut, avant le premier appel a ecrire_temps, soit plus tard (maillage dynamique),
135 * mais ce n'est pas forcement supporte par le postraitement.
136 *
137 *
138 * @param (id_domaine) le nom affecte au domaine dans le fichier lata.
139 * @param (type_elem) le type de l'element geometrique (un type supporte par la classe derivee, en general on comprend au moins "TETRAEDRE", "HEXAEDRE", "TRIANGLE" et "RECTANGLE")
140 * @param (dimension) la dimension du domaine (nombre de coordonnees des sommets) On peut avoir un domaine de dimension 3 et des elements de type triangle (postraitement d'une interface ou du bord d'un domaine volumique).
141 * @param (sommets) Coordonnees des sommets. S'il n'est pas vide, il faut que dimension(1)==dimension
142 * @param (elements) Indices des sommets de chaque element. dimension(1) doit correspondre au type de l'element (3 pour un triangle, 4 pour un rectangle ou un tetraedre, etc...)
143 */
144
145int Format_Post_base::ecrire_domaine(const Domaine& domaine,const int est_le_premier_post)
146{
147 Cerr << "Format_Post_base::ecrire_domaine(...)\n"
148 << " method not coded for " << que_suis_je() << finl;
149 return 0;
150}
151
152void Format_Post_base::ecrire_domaine_dual(const Domaine& domaine,const int est_le_premier_post)
153{
154 Cerr << "ERROR: Format_Post_base::ecrire_domaine_dual(...) method not coded for " << que_suis_je() << finl;
156}
157
158int Format_Post_base::ecrire_domaine_dis(const Domaine& domaine,const OBS_PTR(Domaine_dis_base)& domaine_dis_base,const int est_le_premier_post)
159{
160 domaine_dis_ = domaine_dis_base;
161 return ecrire_domaine(domaine, est_le_premier_post);
162}
163
164/*! @brief Commence l'ecriture d'un pas de temps.
165 *
166 * La classe derivee doit accepter de recevoir plusieurs appels consecutifs a cette methode avec le meme temps.
167 *
168 */
169
170int Format_Post_base::ecrire_temps(const double temps)
171{
172 Cerr << "Format_Post_base::ecrire_temps(const double temps)\n"
173 << " method not coded for " << que_suis_je() << finl;
174 return 0;
175}
176
177/*! @brief Ecriture d'un champ dans le fichier de postraitement.
178 *
179 * @param (id_du_champ) identifiant du champ (permet d'identifier un champ unique si on donne en plus un numero de pas de temps)
180 * @param (id_du_domaine) identifiant du domaine sur lequel le champ est defini Ce domaine doit avoir ete ecrit avant par "ecrire_domaine".
181 * @param (localisation) localisation des valeurs du champ (SOMMETS, ELEMENTS, ou tout autre id. de tableau deja ecrit) (tout n'est pas obligatoirement supporte par tous les postraitements)
182 * @param (data) tableau de valeurs a postraiter. Le nombre de lignes du tableau doit etre egal au nombre de lignes du tableau "localisation" (nombre de sommets, d'elements ou de faces ou autre). Valeur de retour: 1 si operation reussie, 0 sinon (par exemple, preconditions non remplies ou fonctionnalite non supportee par le format).
183 */
184
185int Format_Post_base::ecrire_champ(const Domaine& domaine,const Noms& unite_,const Noms& noms_compo,
186 int ncomp, double temps_,
187 const Nom& id_du_champ,
188 const Nom& id_du_domaine,
189 const Nom& localisation,
190 const Nom& nature,
191 const DoubleTab& data)
192{
193 Cerr << "Format_Post_base::ecrire_champ(...)\n"
194 << " method not coded for " << que_suis_je() << finl;
195 return 0;
196}
197
198/*! @brief Ecriture d'un tableau d'entiers dans le fichier de postraitement
199 *
200 * @sa ecrire_champ
201 *
202 * @param (reference) Nom d'un autre tableau deja ecrit. data[i] est un indice dans ce tableau (exemple: on peut ecrire le tableau FACES_VOISINS, localisation=FACES, reference=ELEMENTS car le tableau est indexe par un numero de face et contient des indices d'elements) L'ecriture d'un domaine entraine automatiquement l'existence d'une tableau SOMMETS et d'un tableau ELEMENTS
203 * @param (reference_size) la taille (locale) du tableau cite en reference (dimension(0) du tableau). Cette dimension est utilisee pour renumeroter le contenu du tableau data afin de creer une numerotation globale lorsque tous les processeurs ecrivent dans un fichier unique.
204 */
206 const Nom& id_du_domaine,
207 const Nom& id_domaine,
208 const Nom& localisation,
209 const Nom& reference,
210 const IntVect& data,
211 const int reference_size)
212{
213 Cerr << "Format_Post_base::ecrire_champ_int(...)\n"
214 << " method not coded for " << que_suis_je() << finl;
215 return 0;
216}
217
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
Classe de base des formats de postraitements pour les champs (lata, med, cgns, lml,...
virtual int initialize(const Nom &file_basename, const int format, const Nom &option_para)
virtual int finir(const int est_le_dernier_post)
virtual int modify_file_basename(const Nom file_basename, bool for_restart, const double tinit)
Modification of the post processing file name. For save/restart this might also move and rename files...
int lire_motcle_non_standard(const Motcle &, Entree &) override
Lecture des parametres de type non simple d'un objet_U a partir d'un flot d'entree.
virtual void ecrire_domaine_dual(const Domaine &domaine, const int est_le_premier_post)
virtual int completer_post(const Domaine &dom, const int axi, const Nature_du_champ &nature, const int nb_compo, const Noms &noms_compo, const Motcle &loc_post, const Nom &le_nom_champ_post)
virtual int init_ecriture(double temps_courant, double temps_post, int est_le_premier_postraitement_pour_nom_fich_, const Domaine &domaine)
virtual int ecrire_champ(const Domaine &domaine, const Noms &unite_, const Noms &noms_compo, int ncomp, double temps_, const Nom &id_du_champ, const Nom &id_du_domaine, const Nom &localisation, const Nom &nature, const DoubleTab &data)
Ecriture d'un champ dans le fichier de postraitement.
virtual int initialize_by_default(const Nom &file_basename)
Initialise le fichier avec des parametres appropries pour son format (exemple: format ascii,...
virtual int ecrire_temps(const double temps)
Commence l'ecriture d'un pas de temps.
virtual int ecrire_entete(const double temps_courant, const int reprise, const int est_le_premier_post)
virtual int ecrire_domaine_dis(const Domaine &domaine, const OBS_PTR(Domaine_dis_base)&domaine_dis_base, const int est_le_premier_post)
virtual int ecrire_domaine(const Domaine &domaine, const int est_le_premier_post)
Ecriture d'un maillage.
virtual int ecrire_item_int(const Nom &id_item, const Nom &id_du_domaine, const Nom &id_domaine, const Nom &localisation, const Nom &reference, const IntVect &data, const int reference_size)
Ecriture d'un tableau d'entiers dans le fichier de postraitement.
virtual int preparer_post(const Nom &id_du_domaine, const int est_le_premier_post, const int reprise, const double t_init)
OBS_PTR(Domaine_dis_base) domaine_dis_
Reference to the discretized domain - used for face fields.
virtual void set_param(Param &param) const override=0
virtual void resetTime(double t, const std::string dirname)
virtual int finir_ecriture(double temps_courant)
Une chaine de caractere (Nom) en majuscules.
Definition Motcle.h:26
class Nom Une chaine de caractere pour nommer les objets de TRUST
Definition Nom.h:31
Un tableau de chaine de caracteres (VECT(Nom)).
Definition Noms.h:26
classe Objet_U Cette classe est la classe de base des Objets de TRUST
Definition Objet_U.h:73
friend class Entree
Definition Objet_U.h:76
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 Sortie & printOn(Sortie &) const
Ecriture de l'objet sur un flot de sortie Methode a surcharger.
Definition Objet_U.cpp:282
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