TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Format_Post_base.h
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#ifndef Format_Post_base_included
17#define Format_Post_base_included
18
19#include <TRUSTTabs_forward.h>
20#include <TRUST_Deriv.h>
21#include <Champ_base.h>
22#include <TRUST_Ref.h>
23#include <Domaine.h>
24
26class Motcle;
27class Param;
28
29/*! @brief Base class for post-processing output formats for fields (lata, med, cgns, lml, single_lata).
30 *
31 * Using the class through the generic interface:
32 * - type a post-processing format object
33 * - initialize the post-processing format object
34 * - perform completion and verification operations
35 * - write a domain
36 * - ecrire_temps
37 * - ecrire_champ (supported field types: at elements or at nodes,
38 * or at faces if the domain faces have been written
39 * and if faces are supported by the post-processing format)
40 *
41 */
42
43// Parameters involved (possibly) in a post-processing operation
44////////////////////////////////////////////////////////////////////////////////////////////////////////////////
45// Nom nom_fichier : name of the file being written
46// int champ : 1 if field post-processing, 0 otherwise
47// int stat : 1 if statistics post-processing, 0 otherwise
48// double dt_ch : period for field post-processing
49// double dt_stat : period for statistics post-processing
50// int reprise : 1 if restart was performed, 0 otherwise
51// int axi : 1 if axisymmetric calculation, 0 otherwise
52// int est_le_premier_post : 1 if first post-processing for a given output file, 0 otherwise
53// int est_le_dernier_post : 1 if last post-processing for a given output file, 0 otherwise
54// Domaine dom : computation domain
55// Nom id_domaine : domain name
56// IntVect faces_som : face-to-vertex connectivity
57// IntVect elem_faces : element-to-face connectivity
58// int nb_som : number of domain vertices
59// int nb_faces : number of domain faces
60
61// double t_init : initial time of the computation
62// double temps_courant : current time of the computation
63// double temps_champ : target field time
64// double temps_post : time of the post-processing object (write if temps_post<temps_courant)
65
66// Nom id_champ_post : identifier of the generic field (name or component)
67// Nature_du_champ nature_champ : scalar, multi_scalar, vector
68// int nb_compo : number of field components
69// Noms nom_compos : vector containing the component names of the field
70// Noms unites : vector containing the units of the field to write
71// Motcle loc_post : location: ELEM, SOM, FACES
72// int ncomp : component number (-1 if not a component)
73// DoubleTab data : array of values to write to file
74//////////////////////////////////////////////////////////////////////////////////////////////////////////////
75
76// Note: data
77// If post-processing the full field and not a component of a field:
78// If the field value array has a single entry, data must be dimensioned as data(nb_ddl,1)
79// If post-processing a component of a field:
80// If the supplied value array has multiple entries, data must be dimensioned as data(nb_ddl)
81
82
83// Using the generic interface to perform a post-processing operation.
84// The sequence of interface method calls to post-process an array of values of a discrete field at a given instant
85// is presented below (not every method is necessarily required depending on the format used)
86///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
87// format_post.initialize_by_default(nom_fichier)
88// format_post.ecrire_entete(temps_courant,reprise,est_le_premier_post)
89// format_post.preparer_post(id_domaine,est_le_premier_post,reprise,t_init)
90// format_post.completer_post(dom,axi,nature_champ,nb_compo,noms_compo,loc_post,id_champ_post)
91// format_post.ecrire_domaine(dom,est_le_premier_post)
92// format_post.ecrire_item_int("FACES",id_domaine,id_domaine,"FACES","SOMMETS",faces_som,nb_som);
93// format_post.ecrire_item_int("ELEM_FACES",id_domaine,id_domaine,"ELEMENTS","FACES",elem_faces,nb_faces);
94// format_post.ecrire_temps(temps_courant)
95// format_post.init_ecriture(temps_courant,temps_post,est_le_premier_post,dom)
96// format_post.ecrire_champ(dom,unites,noms_compo,ncomp,temps_champ,temps_courant,id_champ_post,id_domaine,loc_post,data)
97// format_post.finir_ecriture(temps_courant)
98// format_post.finir(est_le_dernier_post)
99///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
101{
102 Declare_base(Format_Post_base);
103public:
104 // Resets the object to the initial state obtained after the default constructor
105 virtual void reset() = 0;
106 virtual void resetTime(double t, const std::string dirname);
107 virtual void set_param(Param& param) const override=0;
108 int lire_motcle_non_standard(const Motcle&, Entree&) override;
109 virtual int initialize_by_default(const Nom& file_basename);
110 virtual int initialize(const Nom& file_basename, const int format, const Nom& option_para);
111 virtual int modify_file_basename(const Nom file_basename, bool for_restart, const double tinit);
112 virtual int ecrire_entete(const double temps_courant, const int reprise, const int est_le_premier_post);
113 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);
114
115 virtual int preparer_post(const Nom& id_du_domaine, const int est_le_premier_post, const int reprise, const double t_init);
116
117 virtual int init_ecriture(double temps_courant, double temps_post, int est_le_premier_postraitement_pour_nom_fich_, const Domaine& domaine);
118
119 virtual int finir_ecriture(double temps_courant);
120 virtual int finir(const int est_le_dernier_post);
121
122 virtual int ecrire_domaine(const Domaine& domaine,const int est_le_premier_post);
123 virtual void ecrire_domaine_dual(const Domaine& domaine,const int est_le_premier_post);
124 virtual int ecrire_domaine_dis(const Domaine& domaine,const OBS_PTR(Domaine_dis_base)& domaine_dis_base,const int est_le_premier_post);
125 virtual int ecrire_temps(const double temps);
126
127 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,
128 const Nom& localisation, const Nom& nature, const DoubleTab& data);
129
130 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);
131
132 virtual void set_single_lata_option(const bool ) { /* Do nothing */ }
133 virtual void set_postraiter_domain() { /* Do nothing */ }
134 virtual void set_deformable_domain() { /* Do nothing */ }
135 virtual void set_lagrangian_domain() { /* Do nothing */ }
136 virtual void set_discr_type(const Nom&) { /* Do nothing */ }
137 virtual void set_loc_vector(const std::vector<std::string>&) { /* Do nothing */ }
138
139protected:
140 OBS_PTR(Domaine_dis_base) domaine_dis_; ///< Reference to the discretized domain - used for face fields.
141};
142
143#endif /* Format_Post_base_included */
class Domaine_dis_base This class is the base of the hierarchy of discretized domains.
Base class for post-processing output formats for fields (lata, med, cgns, lml, single_lata).
virtual void set_single_lata_option(const bool)
virtual int initialize(const Nom &file_basename, const int format, const Nom &option_para)
virtual void reset()=0
virtual int finir(const int est_le_dernier_post)
virtual void set_loc_vector(const std::vector< std::string > &)
virtual void set_postraiter_domain()
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...
virtual void set_lagrangian_domain()
int lire_motcle_non_standard(const Motcle &, Entree &) override
Reads non-simple-type parameters of an Objet_U from an input stream.
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)
Writing a field to the post-processing file.
virtual int initialize_by_default(const Nom &file_basename)
Initializes the file with parameters appropriate to its format (e.g. ascii format,...
virtual int ecrire_temps(const double temps)
Starts writing a time step.
virtual void set_deformable_domain()
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)
Writing a mesh.
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)
Writing an integer array to the post-processing file.
virtual void set_discr_type(const Nom &)
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)
A character string (Nom) in uppercase.
Definition Motcle.h:26
class Nom: a character string for naming TRUST objects.
Definition Nom.h:31
An array of character strings (VECT(Nom)).
Definition Noms.h:26
friend class Entree
Definition Objet_U.h:71
Objet_U()
Default constructor: assigns a unique identifier to the object (object_id_) and registers the object ...
Definition Objet_U.cpp:54
static int axi
Definition Objet_U.h:96
Helper class to factorize the readOn method of Objet_U classes.
Definition Param.h:112