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;
243 Cerr<<
"First postprocessing, this can take some minutes"<<finl;
245 Cerr<<
"First postprocessing OK"<<finl;
252 statistics().end_count(STD_COUNTERS::computation_start_up);
254 statistics().print_TU_files(
"Computation start-up statistics");
259 VT_USER_START(
"Resolution");
263 statistics().start_timeloop();
267 statistics().start_time_step();
268 statistics().begin_count(STD_COUNTERS::timeloop);
295 statistics().end_count(STD_COUNTERS::timeloop);
296 statistics().end_time_step(tstep);
310 std::string newDirectory = stop ?
newCompute() :
"";
311 if (!newDirectory.empty())
330 double temps = statistics().get_time_since_last_open(STD_COUNTERS::timeloop);
331 Cout << finl <<
"clock: Time of the last time step: " << temps <<
" s" << finl << finl;
334 statistics().end_count(STD_COUNTERS::timeloop);
335 statistics().end_time_step(tstep);
341 statistics().end_timeloop();
343 VT_USER_END(
"Resolution");
346 statistics().print_TU_files(
"Time loop statistics");
368 statistics().start_timeloop();
373 statistics().start_time_step();
374 statistics().begin_count(STD_COUNTERS::timeloop);
414 double temps = statistics().get_time_since_last_open(STD_COUNTERS::timeloop);
415 Cout << finl <<
"clock: Total time of the time loop: " << temps <<
" s" << finl << finl;
417 statistics().end_count(STD_COUNTERS::timeloop);
420 statistics().end_timeloop();
421 statistics().print_TU_files(
"Time loop statistics");
430 bool converged =
false;
433 while (!converged && ok)
472OBS_PTR(
Field_base) Probleme_U::findInputField(
const Nom& name)
const
491 OBS_PTR(Champ_Generique_base) ch;
502 OBS_PTR(Field_base) ch=findInputField(name);
504 throw WrongArgument(
le_nom().getChar(),
"getInputFieldTemplate",name.
getString(),
"no input field of that name");
507 Champ_Input_Proto * chip =
dynamic_cast<Champ_Input_Proto *
>(ch.operator->());
509 throw WrongArgument(
le_nom().getChar(),
"getInputFieldTemplate",name.
getString(),
"field of this name is not an input field");
519 OBS_PTR(Field_base) ch=findInputField(name);
521 throw WrongArgument(
le_nom().getChar(),
"setInputField",name.
getString(),
"no input field of that name");
523 throw WrongArgument(
le_nom().getChar(),
"setInputField",
"afield",
"Should be defined on current time interval");
525 throw WrongArgument(
le_nom().getChar(),
"setInputField",
"afield",
"Should be defined on current time interval");
526 if (strcmp(name.
getChar(),afield.getCharName()))
527 throw WrongArgument(
le_nom().getChar(),
"setInputField",
"afield",
"Should have the same name as the argument name ");
530 Champ_Input_Proto * chip =
dynamic_cast<Champ_Input_Proto *
>(ch.operator->());
532 throw WrongArgument(
le_nom().getChar(),
"setInputField",name.
getString(),
"field of this name is not an input field");
542 throw WrongArgument(
le_nom().getChar(),
"getOutputField",name.
getString(),
"no output field of that name");
545 build_triofield(ch, afield);
554 throw WrongArgument(
le_nom().getChar(),
"setInputDoubleValue",name.
getString(),
"no input field of that name");
555 if (ch->nb_comp() != 1)
556 throw WrongArgument(
le_nom().getChar(),
"getOutputDoubleValue",name.
getString(),
"invalid field size!!");
561 throw WrongArgument(
le_nom().getChar(),
"setInputField",name.
getString(),
"field of this name is not an input field");
569 WrongArgument(name,
"getOutputStringValue",name,
"no string parameter with that name");
577 reg_.setInputIntValue(name, val);
582 return reg_.getOutputIntValue(name);
587 return reg_.checkOutputIntEntry(name);
592 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: a character string for naming TRUST objects.
const char * getChar() const
const std::string & getString() const
An array of character strings (VECT(Nom)).
Base class for TRUST objects (Objet_U).
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.
virtual void sauver() const
Save the problem state to disk.
virtual int postraiter(int force=1)
Asks the problem to post-process its fields, probes, etc.
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
Should we print the execution statistics now?
const Nom & le_nom() const override
Returns the name of the Objet_U. Virtual method to override: returns "neant" in this 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
Should we save the problem state to disk now?
virtual bool run()
This method is a sort of main() for the Problem. It can be used if the problem is not coupled with an...
virtual bool solveTimeStep()
For possible re-implementation and unified call from 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()
WARNING:
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()
Returns 1 if on the master processor of the current group (i.e. me() == 0), 0 otherwise.
Base class for output streams.