TRUST 1.9.8
HPC thermohydraulic platform
Loading...
Searching...
No Matches
Resoudre.cpp
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#include <Resoudre.h>
17#include <Probleme_U.h>
18#include <Catch_SIGINIT.h>
19#include <signal.h>
20#include <Perf_counters.h>
21
22Implemente_instanciable(Resoudre,"Resoudre|Solve",Interprete);
23// XD solve interprete resoudre NO_BRACE Interpretor to start calculation with TRUST.
24// XD attr pb ref_pb_gen_base pb REQ Name of problem to be solved.
25
26/*! @brief Simple appel a: Interprete::printOn(Sortie&)
27 *
28 * Imprime l'interprete sur un flot de sortie
29 *
30 * @param (Sortie& os) un flot de sortie
31 * @return (Sortie&) le flot de sortie modifie
32 */
34{
35 return Interprete::printOn(os);
36}
37
38
39/*! @brief Simple appel a: Interprete::readOn(Entree&)
40 *
41 * @param (Entree& is) un flot d'entree
42 * @return (Entree&) le flot d'entree modifie
43 */
45{
46 return Interprete::readOn(is);
47}
48
49
50/*! @brief Task of the interpretor: Solve a problem (name read from the input stream)
51 *
52 */
54{
55 Nom problem_name;
56 is >> problem_name;
57 Probleme_U& pb=ref_cast(Probleme_U,objet(problem_name));
58 statistics().begin_count(STD_COUNTERS::computation_start_up);
59 Nom string("=====================================================");
60 Cerr << string << finl;
61 Cerr << "Initialization of the problem " << pb.le_nom() << " ("<<que_suis_je()<<") in progress ... " << finl;
62 Cerr << string << finl;
63 // Initialize the problem
64 pb.initialize();
65
66 // Register signal and signal handler (SIGINT) if user presses ctrl-c during exec
68 {
69 Catch_SIGINIT sig;
72 }
73
74 Cerr << string << finl;
75 Cerr << "Solving of the problem " << pb.le_nom() << " ("<<que_suis_je()<<") in progress ... " << finl;
76 Cerr << string << finl;
77 // Run the problem
78 bool ok = pb.run();
79
80 // Terminate the problem
81 pb.terminate();
82 Cerr << string << finl;
83 Cerr << "End of solving of the problem " << pb.le_nom() << " ("<<que_suis_je()<<")" << finl;
84 Cerr << string << finl;
85 if (!ok)
86 {
87 Cerr << "Error while solving!" << finl;
88 exit();
89 }
90
91 return is;
92}
93
static void signal_callback_handler(int signum)
void set_nom_cas_pour_signal(const Nom &cas)
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
Classe de base des objets "interprete".
Definition Interprete.h:38
static Objet_U & objet(const Nom &)
Voir Interprete_bloc::objet_global() BM: la classe Interprete n'est pas le meilleur endroit pour cett...
class Nom Une chaine de caractere pour nommer les objets de TRUST
Definition Nom.h:31
friend class Entree
Definition Objet_U.h:76
const Nom & que_suis_je() const
renvoie la chaine identifiant la classe.
Definition Objet_U.cpp:104
virtual Entree & readOn(Entree &)
Lecture d'un Objet_U sur un flot d'entree Methode a surcharger.
Definition Objet_U.cpp:293
static const Nom & nom_du_cas()
Renvoie une reference constante vers le nom du cas.
Definition Objet_U.cpp:146
static int DEACTIVATE_SIGINT_CATCH
Definition Objet_U.h:103
virtual Sortie & printOn(Sortie &) const
Ecriture de l'objet sur un flot de sortie Methode a surcharger.
Definition Objet_U.cpp:282
classe Probleme_U
Definition Probleme_U.h:46
const Nom & le_nom() const override
Donne le nom de l'Objet_U Methode a surcharger : renvoie "neant" dans cette implementation.
Definition Probleme_U.h:109
virtual void terminate()
This method is called once at the end, after any other one.
virtual bool run()
Cette methode est une sorte de main() du Problem Elle peut etre utilisee si le probleme n'est couple ...
virtual void initialize()
This method is called once at the beginning, before any other one of the interface Problem.
static void exit(int exit_code=-1)
Routine de sortie de TRUST dans une region Kokkos.
Definition Process.cpp:455
classe Resoudre Interprete qui resoud un probleme:
Definition Resoudre.h:31
Entree & interpreter(Entree &) override
Task of the interpretor: Solve a problem (name read from the input stream).
Definition Resoudre.cpp:53
Classe de base des flux de sortie.
Definition Sortie.h:52