16#include <Probleme_U.h>
17#include <Perf_counters.h>
18#include <ICoCoExceptions.h>
19#include <Ch_front_input_uniforme.h>
20#include <Ch_input_uniforme.h>
21#include <Champ_input_P0.h>
27#include <Champ_Generique_base.h>
28#include <Convert_ICoCoTrioField.h>
32using ICoCo::WrongArgument;
33using ICoCo::TrioField;
245 Cerr<<
"First postprocessing, this can take some minutes"<<finl;
247 Cerr<<
"First postprocessing OK"<<finl;
254 statistics().end_count(STD_COUNTERS::computation_start_up);
256 statistics().print_TU_files(
"Computation start-up statistics");
261 VT_USER_START(
"Resolution");
265 statistics().start_timeloop();
269 statistics().start_time_step();
270 statistics().begin_count(STD_COUNTERS::timeloop);
297 statistics().end_count(STD_COUNTERS::timeloop);
298 statistics().end_time_step(tstep);
312 std::string newDirectory = stop ?
newCompute() :
"";
313 if (!newDirectory.empty())
332 double temps = statistics().get_time_since_last_open(STD_COUNTERS::timeloop);
333 Cout << finl <<
"clock: Time of the last time step: " << temps <<
" s" << finl << finl;
336 statistics().end_count(STD_COUNTERS::timeloop);
337 statistics().end_time_step(tstep);
343 statistics().end_timeloop();
345 VT_USER_END(
"Resolution");
348 statistics().print_TU_files(
"Time loop statistics");
370 statistics().start_timeloop();
375 statistics().start_time_step();
376 statistics().begin_count(STD_COUNTERS::timeloop);
416 double temps = statistics().get_time_since_last_open(STD_COUNTERS::timeloop);
417 Cout << finl <<
"clock: Total time of the time loop: " << temps <<
" s" << finl << finl;
419 statistics().end_count(STD_COUNTERS::timeloop);
422 statistics().end_timeloop();
423 statistics().print_TU_files(
"Time loop statistics");
432 bool converged =
false;
435 while (!converged && ok)
474OBS_PTR(
Field_base) Probleme_U::findInputField(
const Nom& name)
const
493 OBS_PTR(Champ_Generique_base) ch;
504 OBS_PTR(Field_base) ch=findInputField(name);
506 throw WrongArgument(
le_nom().getChar(),
"getInputFieldTemplate",name.
getString(),
"no input field of that name");
509 Champ_Input_Proto * chip =
dynamic_cast<Champ_Input_Proto *
>(ch.operator->());
511 throw WrongArgument(
le_nom().getChar(),
"getInputFieldTemplate",name.
getString(),
"field of this name is not an input field");
521 OBS_PTR(Field_base) ch=findInputField(name);
523 throw WrongArgument(
le_nom().getChar(),
"setInputField",name.
getString(),
"no input field of that name");
525 throw WrongArgument(
le_nom().getChar(),
"setInputField",
"afield",
"Should be defined on current time interval");
527 throw WrongArgument(
le_nom().getChar(),
"setInputField",
"afield",
"Should be defined on current time interval");
528 if (strcmp(name.
getChar(),afield.getCharName()))
529 throw WrongArgument(
le_nom().getChar(),
"setInputField",
"afield",
"Should have the same name as the argument name ");
532 Champ_Input_Proto * chip =
dynamic_cast<Champ_Input_Proto *
>(ch.operator->());
534 throw WrongArgument(
le_nom().getChar(),
"setInputField",name.
getString(),
"field of this name is not an input field");
544 throw WrongArgument(
le_nom().getChar(),
"getOutputField",name.
getString(),
"no output field of that name");
547 build_triofield(ch, afield);
556 throw WrongArgument(
le_nom().getChar(),
"setInputDoubleValue",name.
getString(),
"no input field of that name");
557 if (ch->nb_comp() != 1)
558 throw WrongArgument(
le_nom().getChar(),
"getOutputDoubleValue",name.
getString(),
"invalid field size!!");
563 throw WrongArgument(
le_nom().getChar(),
"setInputField",name.
getString(),
"field of this name is not an input field");
571 WrongArgument(name,
"getOutputStringValue",name,
"no string parameter with that name");
579 reg_.setInputIntValue(name, val);
584 return reg_.getOutputIntValue(name);
589 return reg_.checkOutputIntEntry(name);
594 std::vector<double> xx, yy, zz, vals;
class Champ_Generique_base
Class defining operators and methods for all reading operation in an input flow (file,...
class Nom Une chaine de caractere pour nommer les objets de TRUST
const char * getChar() const
const std::string & getString() const
Un tableau de chaine de caracteres (VECT(Nom)).
classe Objet_U Cette classe est la classe de base des Objets de TRUST
virtual Entree & readOn(Entree &)
Lecture d'un Objet_U sur un flot d'entree Methode a surcharger.
virtual Sortie & printOn(Sortie &) const
Ecriture de l'objet sur un flot de sortie Methode a surcharger.
virtual void sauver() const
Sauvegarder l'etat du probleme sur disque.
virtual int postraiter(int force=1)
Demande au probleme de postraiter ses champs, sondes,.
virtual void getInputFieldsNames(Noms &noms) const
This method is used to find the names of input fields understood by the Problem.
virtual bool initTimeStep(double dt)
This method allocates and initializes the unknown and given fields for the future time step.
virtual std::string newCompute()
virtual OBS_PTR(Field_base) findInputField(const Nom &name) const
virtual void validateTimeStep()
Validates the calculated unknown by moving the present time at the end of the time step.
virtual int limpr() const
Doit-on imprimer les statistiques d'execution maintenant ?
const Nom & le_nom() const override
Donne le nom de l'Objet_U Methode a surcharger : renvoie "neant" dans cette implementation.
virtual void setInputField(const Nom &name, const ICoCo::TrioField &afield)
virtual bool iterateTimeStep(bool &converged)
In the case solveTimeStep uses an iterative process, this method executes a single iteration.
virtual void setInputDoubleValue(const Nom &name, const double val)
virtual void getOutputPointValues(const Nom &name, const std::vector< double > &x, const std::vector< double > &y, const std::vector< double > &z, std::vector< double > &vals, int compo)
virtual void setInputStringValue(const std::string &name, const std::string &val)
virtual void terminate()
This method is called once at the end, after any other one.
virtual void abortTimeStep()
Aborts the resolution of the current time step.
virtual double futureTime() const
Returns the future time (end of current computing interval) This value is valid between initTimeStep ...
virtual bool checkOutputIntEntry(const Nom &name) const
virtual bool runUntil(double time)
This method has the same role as the method run, but it stops when reaching the time given in paramet...
virtual int lsauv() const
Doit-on sauvegarder l'etat du probleme sur disque maintenant ?
virtual bool run()
Cette methode est une sorte de main() du Problem Elle peut etre utilisee si le probleme n'est couple ...
virtual bool solveTimeStep()
pour recodage eventuel et appel unifie en python
virtual std::string getOutputStringValue(const std::string &name)
virtual bool isStationary() const
Tells if the Problem unknowns have changed during the last time step.
virtual double presentTime() const
Returns the present time.
virtual void setStationary(bool)
Tells to the Problem that stationary is reached or not.
virtual void getOutputFieldsNames(Noms &noms) const
std::map< std::string, std::string > str_params_
virtual void setInputIntValue(const Nom &name, const int &val)
virtual int getOutputIntValue(const Nom &name) const
virtual void getOutputField(const Nom &nameField, ICoCo::TrioField &afield) const
virtual void resetTime(double time)
Reset the current time of the Problem to a given value.
virtual void getInputFieldTemplate(const Nom &name, ICoCo::TrioField &afield) const
virtual bool updateGivenFields()
ATTENTION :
virtual void initialize()
This method is called once at the beginning, before any other one of the interface Problem.
virtual double computeTimeStep(bool &stop) const
Compute the value the Problem would like for the next time step.
static int je_suis_maitre()
renvoie 1 si on est sur le processeur maitre du groupe courant (c'est a dire me() == 0),...
Classe de base des flux de sortie.