16#include <Operateur_Statistique_tps_base.h>
17#include <Ecrire_fichier_xyz_valeur.h>
18#include <Domaine_Cl_dis_base.h>
19#include <Schema_Temps_base.h>
20#include <Postraitement.h>
21#include <Equation_base.h>
22#include <EcrFicPartage.h>
23#include <Champ_base.h>
39 param.lire_avec_accolades_depuis(is);
43 for(
auto fname : fields_names_ )
44 eqn_->probleme().creer_champ(fname);
55 param.
ajouter(
"fields", &fields_names_);
57 param.
ajouter(
"boundaries", &boundary_names_);
62bool Ecrire_fichier_xyz_valeur::write_field_during_current_timestep_()
const
64 const double timestep = eqn_->schema_temps().temps_courant();
65 const double scheme_dt = eqn_->schema_temps().pas_de_temps();
66 const double tmax = eqn_->schema_temps().temps_max();
67 const int nb_pas_dt_max = eqn_->schema_temps().nb_pas_dt_max();
68 const int nb_pas_dt = eqn_->schema_temps().nb_pas_dt();
69 const int stationnaire_atteint = eqn_->schema_temps().stationnaire_atteint();
71 if (dt_<=scheme_dt || tmax<=timestep || nb_pas_dt_max<=nb_pas_dt || nb_pas_dt<=1 || stationnaire_atteint || eqn_->schema_temps().stop_lu())
76 double i, j, epsilon = 1.e-8;
77 modf(timestep/dt_ + epsilon, &i);
78 modf((timestep-scheme_dt)/dt_ + epsilon, &j);
86 bool champ_stat =
false;
89 for (
auto &itr : eqn_->probleme().postraitements())
90 if (sub_type(Postraitement, itr.valeur()))
92 const Postraitement& post = ref_cast(Postraitement, itr.valeur());
94 Motcle nom_test = fname;
109void Ecrire_fichier_xyz_valeur::writeValuesOnBoundary_(
const Nom& fname,
const std::string& bname,
const DoubleTab& pos,
const DoubleTab& val)
const
113 const double timestep = eqn_->schema_temps().temps_courant();
115 Nom nom_fic(eqn_->probleme().le_nom());
121 nom_fic+=Nom(timestep);
128 fic.
setf(ios::scientific);
137 fic <<
"binary" << finl;
138 fic << nb_val_tot << finl;
144 for (
int i2=0; i2<nb_val; i2++)
148 fic << pos(i2,j2) <<
" ";
150 for (
int nb=0; nb<nb_compo; nb++)
151 fic << val(i2,nb) <<
" " ;
165 if (!write_field_during_current_timestep_())
168 for (
auto fname : fields_names_ )
172 bool champ_stat = getStatField_(fname, field, op_stat);
177 field = eqn_->probleme().get_champ(fname);
180 const int nb_bords_post = (int)boundary_names_.size();
183 int nb_cl = eqn_->domaine_Cl_dis().nb_cond_lim();
184 for (
auto bname : boundary_names_ )
186 int boundary_found = 0 ;
187 for (
int i=0; i<nb_cl && !boundary_found; i++)
191 if (la_frontiere.
le_nom() == bname)
200 const int nb_val = la_frontiere.
nb_faces();
201 int nb_compo = field->
nb_comp();
202 DoubleTab val(nb_val,nb_compo);
206 DoubleTab copie(field->
valeurs());
220 Cerr <<
"You try to use the method Ecrire_fichier_xyz_valeur with an unknown boundary name" << finl;
221 Cerr <<
"The boundary named " << bname <<
" is not recognized"<< finl;
228 Cerr <<
"The option of post processing the entire domain with Ecrire_fichier_xyz_valeur is now obsolete." <<finl;
virtual DoubleTab & valeurs()=0
class Champ_base This class is the base of the fields hierarchy.
virtual DoubleTab & valeur_aux(const DoubleTab &positions, DoubleTab &valeurs) const
Causes an error! Must be overridden by derived classes.
class Cond_lim_base Base class for the hierarchy of classes that represent the different boundary con...
Domaine_Cl_dis_base & domaine_Cl_dis()
Returns the domain of discretized boundary conditions to which the object belongs.
virtual Frontiere_dis_base & frontiere_dis()
Returns the discretized boundary to which the boundary conditions apply.
const Cond_lim & les_conditions_limites(int) const
Returns the i-th boundary condition.
Sortie & unlockfile() override
Releases the critical resource for the next process.
Sortie & lockfile() override
Allows the calling process to block waiting for the common resource shared by all processes,...
void set_bin(bool bin) override
int ouvrir(const char *name, IOS_OPEN_MODE mode=ios::out) override
Opens the file with the given mode and prot parameters. These parameters are the parameters of the st...
Sortie & syncfile() override
Triggers writing to disk of the data accumulated on the different processors since the last call to s...
void precision(int) override
class Ecrire_fichier_xyz_valeur This class allows to dump fields values on some boundaries into a ded...
void set_param(Param ¶m) const override
void write_fields() const
Class defining operators and methods for all reading operation in an input flow (file,...
void calculer_centres_gravite(DoubleTab_t &xv) const
Computes the centers of gravity of each face.
virtual int nb_comp() const
const Nom & le_nom() const override
Returns the name of the Objet_U. Virtual method to override: returns "neant" in this implementation.
int_t nb_faces() const
Returns the number of faces of the boundary.
const Faces_t & faces() const
const Frontiere & frontiere() const
Returns the associated geometric boundary.
class Nom: a character string for naming TRUST objects.
Nom & majuscule()
Converts the name to uppercase. Only letters 'a'-'z' are modified.
const std::string & getString() const
Base class for TRUST objects (Objet_U).
const Nom & que_suis_je() const
Returns the string identifying the class.
virtual Entree & readOn(Entree &)
Reads an Objet_U from an input stream. Virtual method to override.
static int format_precision_geom
virtual Sortie & printOn(Sortie &) const
Writes the object to an output stream. Virtual method to override.
class Operateur_Statistique_tps_base
virtual DoubleTab calculer_valeurs() const =0
Helper class to factorize the readOn method of Objet_U classes.
void ajouter_flag(const char *keyword, const bool *value)
Register a boolean flag whose mere presence switches it to true.
void ajouter(const char *keyword, const int *value, Param::Nature nat=Param::OPTIONAL)
Register an integer parameter.
int champ_fonc(Motcle &nom_champ, OBS_PTR(Champ_base)&mon_champ, OBS_PTR(Operateur_Statistique_tps_base)&operateur_statistique) const
static double mp_sum(double)
Computes the sum of x over all processors in the current group.
static void barrier()
Synchronizes all processors in the current group (waits until all processors have reached the barrier...
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
static int je_suis_maitre()
Returns 1 if on the master processor of the current group (i.e. me() == 0), 0 otherwise.
void setf(IOS_FORMAT code) override
Base class for output streams.
_SIZE_ dimension(int d) const