TRUST 1.9.8
HPC thermohydraulic platform
Loading...
Searching...
No Matches
ProblemTrio.h
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#ifndef ProblemTrio_included
17#define ProblemTrio_included
18
19#include <ICoCoProblem.h>
20#include <vector>
21#include <string>
22
23class mon_main;
24class Objet_U;
25
26class Probleme_U;
27
28namespace ICoCo
29{
30
31class TrioField;
32class MEDDoubleField;
33class MEDIntField;
34class Init_Params;
35
36/*! @brief class ProblemTrio
37 *
38 * This class defines the API a problem has to implement in order to be coupled.
39 * For precise specifications and possible use of this API, See NT
40 * SSTH/LMDL_2006_001
41 * Implements IterativeUnsteadyProblem and FieldIO
42 *
43 *
44 */
45class ProblemTrio : public Problem
46{
47
48public :
49 // interface specifique
52
53 // interface Problem
55 void setDataFile(const std::string& datafile) override;
56 void setMPIComm(void*) override;
57 ~ProblemTrio() override ;
58
59 bool initialize() override;
60 void terminate() override;
61
62 // interface UnsteadyProblem
63
64 double presentTime() const override;
65 double computeTimeStep(bool& stop) const override;
66 bool initTimeStep(double dt) override;
67 bool solveTimeStep() override;
68 void validateTimeStep() override;
69 void setStationaryMode(bool stationary) override; // new in V2
70 bool getStationaryMode() const override; // new in V2
71 bool isStationary() const override;
72 void abortTimeStep() override;
73 void resetTime(double time) override; // new in ICoCo V2
74
75 // interface IterativeUnsteadyProblem
76
77 bool iterateTimeStep(bool& converged) override;
78
79 // Field I/O methods. Those methods are **optional**, and not all of them need to be implemented!
80 //
81 std::vector<std::string> getInputFieldsNames() const override;
82 std::vector<std::string> getOutputFieldsNames() const override;
83 ValueType getFieldType(const std::string& name) const override;
84
85 // TrioField fields I/O
86 void getInputFieldTemplate(const std::string& name, TrioField& afield) const override;
87 void setInputField(const std::string& name, const TrioField& afield) override;
88 void getOutputField(const std::string& name, TrioField& afield) const override;
89 void updateOutputField(const std::string& name, TrioField& afield) const override;
90
91 //
92 // MED fields I/O: double, int and string.
93 //
94 void getInputMEDDoubleFieldTemplate(const std::string& name, MEDDoubleField& afield) const override;
95 void setInputMEDDoubleField(const std::string& name, const MEDDoubleField& afield) override;
96 void getOutputMEDDoubleField(const std::string& name, MEDDoubleField& afield) const override;
97 void updateOutputMEDDoubleField(const std::string& name, MEDDoubleField& afield) const override;
98
99
100 // Specific to MEDCoupling:
101 int getMEDCouplingMajorVersion() const override;
102 bool isMEDCoupling64Bits() const override;
103
104 //
105 // Scalar I/O: double and int.
106 //
107 void setInputIntValue(const std::string& name, const int& val) override;
108 int getOutputIntValue(const std::string& name) const override;
109 double getOutputDoubleValue(const std::string& name) const override;
110 void setInputDoubleValue(const std::string& name, const double& val) override;
111
112 //
113 // Get output point values : double
114 //
115 void getOutputPointValues(const std::string& name,
116 const std::vector<double>& x,
117 const std::vector<double>& y,
118 const std::vector<double>& z,
119 std::vector<double>& vals, int compo = 0);
120
121 double getOutputPointValues(const std::string& name, const double x, const double y, const double z, int compo = 0);
122
123 // I/O for strings:
124 void setInputStringValue(const std::string& name, const std::string& val) override;
125 std::string getOutputStringValue(const std::string& name) const override;
126
127 ////////////////////////////////////////////////////////////////////////////////////
128 // Specific to TRUST, and outside the ICoCo standard
129 ////////////////////////////////////////////////////////////////////////////////////
130
131 // Get a direct access to the TRUST underlying array holding the unknown of a given
132 // equation.
133 MEDDoubleField getDirectAccessToUnknown(const std::string& unk_name, bool isFuture);
134
135protected :
136
141
142};
143} // namespace ICoCo
144Objet_U& get_obj(const char *) ;
145#endif
146
void setMPIComm(void *) override
void updateOutputMEDDoubleField(const std::string &name, MEDDoubleField &afield) const override
void terminate() override
This method is called once at the end, after any other one.
Init_Params * my_params
void getOutputPointValues(const std::string &name, const std::vector< double > &x, const std::vector< double > &y, const std::vector< double > &z, std::vector< double > &vals, int compo=0)
bool iterateTimeStep(bool &converged) override
In the case solveTimeStep uses an iterative process, this method executes a single iteration.
double getOutputDoubleValue(const std::string &name) const override
bool getStationaryMode() const override
double computeTimeStep(bool &stop) const override
Compute the value the Problem would like for the next time step.
ValueType getFieldType(const std::string &name) const override
int getMEDCouplingMajorVersion() const override
std::vector< std::string > getInputFieldsNames() const override
This method is used to find the names of input fields understood by the Problem.
void getInputMEDDoubleFieldTemplate(const std::string &name, MEDDoubleField &afield) const override
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.
void setInputDoubleValue(const std::string &name, const double &val) override
void getInputFieldTemplate(const std::string &name, TrioField &afield) const override
This method is used to get a template of a field expected for the given name.
bool initialize() override
This method is called once at the beginning, before any other one of the interface Problem.
std::string getOutputStringValue(const std::string &name) const override
void resetTime(double time) override
Reset the current time of the Problem to a given value.
bool isMEDCoupling64Bits() const override
void setInputField(const std::string &name, const TrioField &afield) override
This method is used to provide the Problem with an input field.
bool initialize_pb(Probleme_U &pb)
void getOutputField(const std::string &name, TrioField &afield) const override
void getOutputMEDDoubleField(const std::string &name, MEDDoubleField &afield) const override
std::vector< std::string > getOutputFieldsNames() const override
void setInputMEDDoubleField(const std::string &name, const MEDDoubleField &afield) override
bool initTimeStep(double dt) override
This method allocates and initializes the unknown and given fields for the future time step.
void setDataFile(const std::string &datafile) override
void updateOutputField(const std::string &name, TrioField &afield) const override
void setStationaryMode(bool stationary) override
void setInputStringValue(const std::string &name, const std::string &val) override
bool solveTimeStep() override
Calculates the unknown fields for the next time step.
MEDDoubleField getDirectAccessToUnknown(const std::string &unk_name, bool isFuture)
int getOutputIntValue(const std::string &name) const override
~ProblemTrio() override
bool isStationary() const override
Tells if the Problem unknowns have changed during the last time step.
Probleme_U * pb
void abortTimeStep() override
Aborts the resolution of the current time step.
void setInputIntValue(const std::string &name, const int &val) override
void deactivate_multiple_runs()
classe Objet_U Cette classe est la classe de base des Objets de TRUST
Definition Objet_U.h:73
classe Probleme_U
Definition Probleme_U.h:46
Classe creee et executee par main() et lors d'une execution TRUST a travers Python.
Definition mon_main.h:39