17#include <Champ_Fonc_MED.h>
19#include <Postraitement.h>
20#include <Interprete_bloc.h>
21#include <Domaine_dis_cache.h>
22#include <TRUST_2_MED.h>
23#include <Perf_counters.h>
45 sch_.typer(
"Schema_Euler_explicite");
47 Schema_Temps_base& sch=ref_cast(Schema_Temps_base,sch_.valeur());
52 DerObjU* listob =
new DerObjU[nmax];
53 Motcle accouv(
"{"),accfer(
"}"),virg(
","),motlu;
57 Cerr<<
" One expects { to begin the read of Pbc_Med"<<finl;
60 Interprete_bloc inter;
63 assert((motlu==virg)||(motlu==accouv));
66 Cerr<<
"The number of coupled problems is to large"<<finl;
72 DerObjU& ob= listob[npb];
84 if ((motlu!=accfer)&&(motlu!=virg))
86 Cerr<<
"One expects } or , between the problems "<<finl;
87 Cerr<<
"and not "<<motlu<<finl;
93 ref_cast(Probleme_base,
probleme(i)).init_postraitements();
101 Nom name_spe(
"pbMED_0");
102 const ArrOfDouble& temps_sauv=ref_cast(Pb_MED,inter.
objet_global(name_spe)).temps_sauv();
104 Cerr<<
"nbpasdetemps "<<nbpasdetemps<<finl;
105 for (
int i=0; i<nbpasdetemps; i++)
107 statistics().
begin_count(STD_COUNTERS::update_variables,statistics().get_last_opened_counter_level()+1);
109 statistics().
end_count(STD_COUNTERS::update_variables);
115 ref_cast(Probleme_base,
probleme(i)).finir();
130 dis_bidon.typer(
"VF_inst");
131 la_discretisation_=dis_bidon.valeur();
137 traite_nom_fichier_med(nom_fic);
143 LireMED lire(nom_fic, nom_dom);
144 lire.associer_domaine(dom);
145 lire.lire_geom(
true);
148 Nom typ =
"NO_FACE_Domaine_VF_inst";
151 Cerr<<
"Reading the name of existing fields in "<<nom_fic<<finl;
152 read_med_field_names(nom_fic, nomschampmed, temps_sauv_);
153 Cerr<<
"temps_sauv "<<temps_sauv_<<finl;
208 int nbchampmed=nomschampmed.size();
210 for (
int ch=0; ch<nbchampmed; ch++)
212 if (mot==nomschampmed[ch]) ind= 1;
220 Cerr <<
"Error when reading the data for post-processing" << finl;
221 Cerr <<
"The field " << mot <<
" is not recognized by the problem" << finl;
222 Cerr <<
"recognized words are "<<nomschampmed<<finl;
230 Cerr<<
"Pb_MED::creer_champ "<< motlu<<finl;
235 le_ch_fonc.typer(
"Champ_Fonc_MED");
236 int nbchampmed=nomschampmed.size();
240 le_ch_fonc->
nommer(motlu);
246 for (
int ch=0; ch<nbchampmed; ch++)
248 Nom pp(nomschampmed[ch]);
263 Cerr<<
"One wishes to read the field "<<es<<
" choice "<<localisation<<
" readen word in the data set "<<motlu<<finl;
269 const Domaine& dom_med =
domaine();
270 chmed.
creer(nom_fic,dom_med,localisation, temps_sauv_);
279 le_ch_fonc->nommer(motlu);
283 Cerr <<
"Error when reading data for post-processing" << finl;
284 Cerr <<
"The creation of the field " << motlu <<
" has failed." << finl;
293 if (
Motcle(itr->le_nom()) == un_nom)
299 for (
int i = 0; i < itr->nb_comp(); i++)
300 if (
Motcle(itr->nom_compo(i)) == un_nom)
314 if (
Motcle(itr->le_nom()) == un_nom)
317 for (
int i = 0; i < itr->nb_comp(); i++)
318 if (
Motcle(itr->nom_compo(i)) == un_nom)
332 if (
Motcle(itr->le_nom()) == un_nom)
334 if (ch_med.
temps() != temps_courant)
341 for (
int i = 0; i < itr->nb_comp(); i++)
342 if (
Motcle(itr->nom_compo(i)) == un_nom)
344 if (ch_med.
temps() != temps_courant)
352 Cerr<<
"The indicated name "<<un_nom<<
" do not correspond to a field understood by the problem"<<finl;
353 Cerr<<
"Check the field name to indicate in the post-processing set"<<finl;
356 throw std::runtime_error(std::string(
"Field ") + un_nom.
getString() + std::string(
" not found !"));
362 if (opt == DESCRIPTION)
363 Cerr <<
"Pb_MED : " << nomschampmed << finl;
365 noms.add(nomschampmed);
class Champ_Fonc_MED Load a field from a MED file for a given time.
int creer(const Nom &, const Domaine &dom, const Motcle &localisation, ArrOfDouble &temps_sauv)
void mettre_a_jour(double) override
Time update of the field.
virtual const Champ_Fonc_base & le_champ() const
class Champ_Fonc_base Base class of fields that are functions of a calculated quantity
class Champ_base This class is the base of the fields hierarchy.
double temps() const
Returns the time of the field.
void corriger_unite_nom_compo()
This method will set the units and the name of components, it is not actually const!...
int postraiter(int force=1) override
Asks the problem to post-process its fields, probes, etc.
const Probleme_U & probleme(int i) const
const Nom & le_nom() const override
Returns the name of the Objet_U. Virtual method to override: returns "neant" in this implementation.
static Domaine_dis_base & Build_or_get(const Nom &type, const Domaine &dom, const Discretisation_base *disc=nullptr)
Class defining operators and methods for all reading operation in an input flow (file,...
class Equation_base The role of an equation is the calculation of one or more fields....
void nommer(const Nom &) override
Gives a name to the field.
Objet_U & ajouter(const Nom &nom, DerObjU &object_to_add)
Adds object ob to the interpreter's object list and names it with nom.
static Objet_U & objet_global(const Nom &nom)
Searches for the requested object in the current Interprete_bloc (Interprete_bloc::interprete_courant...
static Objet_U & objet(const Nom &)
See Interprete_bloc::objet_global(). BM: the Interprete class is not the best place for this.
A character string (Nom) in uppercase.
class Nom: a character string for naming TRUST objects.
Nom & prefix(const char *const)
const std::string & getString() const
An array of character strings (VECT(Nom)).
Objet_U * typer(const char *nom_type)
Tries to create an instance of type "type".
virtual void nommer(const Nom &)
Assigns a name to the Objet_U. Virtual method to override.
virtual Entree & readOn(Entree &)
Reads an Objet_U from an input stream. Virtual method to override.
virtual Sortie & printOn(Sortie &) const
Writes the object to an output stream. Virtual method to override.
class Pb_MED Class for re-reading MED files and post-processing them.
const Champ_base & get_champ(const Motcle &nom) const override
const Equation_base & equation(int) const override
Returns the MED-type equation if i = 0,.
Champs_Fonc champs_fonc_post
bool has_champ(const Motcle &nom, OBS_PTR(Champ_base) &ref_champ) const override
int nombre_d_equations() const override
Returns the number of equations in the problem.
int comprend_champ(const Motcle &) const
void get_noms_champs_postraitables(Noms &nom, Option opt=NONE) const override
void creer_champ(const Motcle &motlu) override
void begin_count(const STD_COUNTERS &std_cnt, int counter_lvl=-100000)
void end_count(const std::string &custom_count_name, int count_increment=1, long int quantity_increment=0)
End the count of a counter and update the counter values.
Probleme_Couple This is the historical coupling class of TRUST.
virtual void associer_sch_tps_base(Schema_Temps_base &)
Associates a copy of the time scheme with each problem of the coupled problem.
int associer_(Objet_U &) override
Overrides Objet_U::associer_(Objet_U&): associates an object with the coupled problem,...
virtual const Schema_Temps_base & schema_temps() const
Returns the time scheme associated with the coupled problems (const version).
void nommer(const Nom &name) override
Assigns a name to the Objet_U. Virtual method to override.
class Probleme_base It is a Probleme_U that is not a coupling.
virtual void associer_domaine(const Domaine &)
Associates a domain with the problem.
const Domaine & domaine() const
Returns the domain associated with the problem.
Save_Restart save_restart_
virtual void associer_sch_tps_base(const Schema_Temps_base &)
Associates a time scheme with the problem.
const Schema_Temps_base & schema_temps() const
Returns the time scheme associated with the problem.
OBS_PTR(Field_base) findInputField(const Nom &name) const override
virtual const Equation_base & equation(int) const =0
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
double temps_courant() const
Returns the current time.
virtual void changer_temps_courant(const double)
Changes the current time.
virtual int mettre_a_jour()
Updates the current time (t+=dt) and the number of time steps performed (nb_pas_dt_++).
Base class for output streams.
_SIZE_ size_array() const