TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Couplage_U.h
1/****************************************************************************
2* Copyright (c) 2025, 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#ifndef Couplage_U_included
17#define Couplage_U_included
18
19#include <Probleme_U.h>
20#include <TRUST_List.h>
21#include <TRUST_Ref.h>
22
23/*! @brief class Couplage_U
24 *
25 * Cette classe implemente Probleme_U dans le cas d'un probleme composite
26 * couplant plusieurs Probleme_U.
27 *
28 *
29 */
30class Couplage_U : public Probleme_U
31{
32 Declare_instanciable(Couplage_U);
33
34public:
35
36 //////////////////////////////////////////////////
37 // //
38 // Implementation de l'interface de Probleme_U //
39 // //
40 //////////////////////////////////////////////////
41
42 // interface Problem
43
44 void initialize() override;
45 void terminate() override;
46
47 // interface UnsteadyProblem
48
49 double presentTime() const override;
50 bool initTimeStep(double dt) override;
51 // virtual bool solveTimeStep();
52 void validateTimeStep() override;
53 bool isStationary() const override;
54 std::string newCompute() override;
55 void setStationary(bool) override;
56 void abortTimeStep() override;
57 void resetTime(double t) override;
58
59 // interface IterativeUnsteadyProblem
60
61 bool iterateTimeStep(bool& converged) override;
62
63 // interface FieldIO
64
65 void getInputFieldsNames(Noms& noms) const override;
66 void getOutputFieldsNames(Noms& noms) const override;
67
68 // interface Probleme_U
69
70 int postraiter(int force=1) override;
71 int limpr()const override ;
72 int lsauv() const override;
73 void sauver() const override;
74 bool updateGivenFields() override;
75 double futureTime()const override;
76
77 OBS_PTR(Field_base) findInputField(const Nom& name) const override;
78 OBS_PTR(Champ_Generique_base) findOutputField(const Nom& name) const override;
79
80 ///////////////////////////////////////////////////////////
81 // //
82 // Fin de l'implementation de l'interface de Probleme_U //
83 // //
84 ///////////////////////////////////////////////////////////
85
86
87 // Access methods to the problem list
88
89 void suppProblem(Probleme_U&); // Deleted a problem from the list
90 void addProblem(Probleme_U&); // Append a problem to the list
91 int nb_problemes() const; // Number of problems
92
93 const Probleme_U& probleme(int i) const; // Access by index (const)
94 Probleme_U& probleme(int i); // Access by index
95 const Probleme_U& probleme(const Nom& nom_pb) const; // Access by name (const)
96 Probleme_U& probleme(const Nom& nom_pb); // Access by name
97 int indice_probleme(const Nom& nom_pb) const; // Index from name
98
99private:
100
101 LIST(OBS_PTR(Probleme_U)) problems;
102
103};
104
105// inline access methods
106
108{
109 problems.suppr(pb);
110}
111
113{
114 problems.add(pb);
115}
116
117inline int Couplage_U::nb_problemes() const
118{
119 return problems.size();
120}
121
123{
124 return problems(i);
125}
126
127inline const Probleme_U& Couplage_U::probleme(int i) const
128{
129 return problems(i);
130}
131
132
133inline const Probleme_U& Couplage_U::probleme(const Nom& nom_pb) const
134{
135 return probleme(indice_probleme(nom_pb));
136}
137
138inline Probleme_U& Couplage_U::probleme(const Nom& nom_pb)
139{
140 return probleme(indice_probleme(nom_pb));
141}
142
143#endif
class Champ_Generique_base
class Couplage_U
Definition Couplage_U.h:31
void validateTimeStep() override
Validates the calculated unknown by moving the present time at the end of the time step.
double presentTime() const override
Returns the present time.
int postraiter(int force=1) override
Demande au probleme de postraiter ses champs, sondes,.
const Probleme_U & probleme(int i) const
Definition Couplage_U.h:127
void initialize() override
This method is called once at the beginning, before any other one of the interface Problem.
OBS_PTR(Field_base) findInputField(const Nom &name) const override
bool iterateTimeStep(bool &converged) override
In the case solveTimeStep uses an iterative process, this method executes a single iteration.
void sauver() const override
Sauvegarder l'etat du probleme sur disque.
int lsauv() const override
Doit-on sauvegarder l'etat du probleme sur disque maintenant ?
void resetTime(double t) override
Reset the current time of the Problem to a given value.
bool initTimeStep(double dt) override
This method allocates and initializes the unknown and given fields for the future time step.
void setStationary(bool) override
Tells to the Problem that stationary is reached or not.
void abortTimeStep() override
Aborts the resolution of the current time step.
int limpr() const override
Doit-on imprimer les statistiques d'execution maintenant ?
void suppProblem(Probleme_U &)
Definition Couplage_U.h:107
bool updateGivenFields() override
ATTENTION :
void terminate() override
This method is called once at the end, after any other one.
void addProblem(Probleme_U &)
Definition Couplage_U.h:112
int indice_probleme(const Nom &nom_pb) const
void getOutputFieldsNames(Noms &noms) const override
double futureTime() const override
Returns the future time (end of current computing interval) This value is valid between initTimeStep ...
std::string newCompute() override
int nb_problemes() const
Definition Couplage_U.h:117
bool isStationary() const override
Tells if the Problem unknowns have changed during the last time step.
void getInputFieldsNames(Noms &noms) const override
This method is used to find the names of input fields understood by the Problem.
OBS_PTR(Champ_Generique_base) findOutputField(const Nom &name) const override
class Nom Une chaine de caractere pour nommer les objets de TRUST
Definition Nom.h:31
Un tableau de chaine de caracteres (VECT(Nom)).
Definition Noms.h:26
classe Probleme_U
Definition Probleme_U.h:46