TRUST 1.9.8
HPC thermohydraulic platform
Loading...
Searching...
No Matches
Sondes.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 <LecFicDiffuse_JDD.h>
17#include <Postraitement.h>
18#include <Sondes.h>
19
20Implemente_instanciable(Sondes, "Sondes|Probes", LIST(OWN_PTR(Sonde)));
21// XD sondes listobj nul BRACE sonde NO_COMMA List of probes.
22
23
24Sortie& Sondes::printOn(Sortie& s ) const { return s ; }
25
26/*! @brief Lit une liste de sondes a partir d'un flot d'entree Format:
27 *
28 * {
29 * [LIRE UNE SONDE AUTANT DE FOIS QUE NECESSAIRE]
30 * }
31 *
32 * @param (Entree& s) un flot d'entree
33 * @return (Entree&) le flot d'entree modifie
34 * @throws accolade ouvrante attendue
35 */
36Entree& Sondes::readOn(Entree& s )
37{
38 assert(mon_post);
39
40 Motcle motlu;
41 Motcle accolade_ouverte("{");
42 Motcle accolade_fermee("}");
43
44 s >> motlu;
45
46 if (motlu != accolade_ouverte)
47 {
48 Cerr << "Error while reading the probes in the postprocessing" << finl;
49 Cerr << "We expected { to start to read the probes" << finl;
50 exit();
51 }
52 s >> motlu;
53
54 if (motlu == "FICHIER")
55 {
56 Cerr<<"Error: Sondes { " << motlu << " .... } no more allowed, use Sondes_fichier { " << motlu << " .... }" <<finl;
58 }
59 else if (motlu == accolade_fermee)
60 {
61 Cerr << "Error while reading the probes in the postprocessing" << finl;
62 Cerr << "You have not defined any probe" << finl;
63 exit();
64 }
66
67 const bool is_ijk = mon_post->que_suis_je() == "Postprocessing_IJK";
68 while (motlu != accolade_fermee)
69 {
70 OWN_PTR(Sonde) une_sonde;
71 if(is_ijk)
72 une_sonde.typer("Sonde_IJK");
73 else
74 une_sonde.typer("Sonde");
75 une_sonde->nommer(motlu);
76 une_sonde->associer_post(mon_post.valeur());
77 s >> une_sonde.valeur();
78 add(une_sonde);
79 s >> motlu;
80 }
81 Cerr << "End of reading probes " << finl;
82 return s;
83}
84
86{
87 // Reconstruit noms_champs_postraitables_
88 if (mon_post)
89 {
90 Noms noms;
91 mon_post->probleme().get_noms_champs_postraitables(noms);
92 noms_champs_postraitables_.dimensionner_force(noms.size());
93 for (int i = 0; i < noms.size(); i++)
94 noms_champs_postraitables_[i] = noms[i];
95 }
96}
97
99{
101 for (auto &itr : *this) itr->completer();
102}
103
104/*! @brief Effectue le postraitement sur chacune des sondes de la liste.
105 *
106 */
108{
109 for (auto &itr : *this) itr->postraiter();
110
111 clear_cache();
112}
113
115{
116 sourceList.vide();
117 espaceStockageList.vide();
118 sourceNoms.reset();
119}
120
121OBS_PTR(Champ_base) Sondes::get_from_cache(OBS_PTR(Champ_Generique_base)& mon_champ, const Nom& nom_champ_lu_)
122{
124 int num = sourceNoms.rang(nom_champ_lu_);
125 if (num < 0)
126 {
127 OWN_PTR(Champ_base) espace_stockage;
128 const Champ_base& ma_source = mon_champ->get_champ(espace_stockage);
129 sourceList.add(ma_source);
130 espaceStockageList.add(espace_stockage);
131 sourceNoms.add(nom_champ_lu_);
132 // Voir Champ_Generique_base pour la definition de l'espace stockage
133 return espace_stockage ? espaceStockageList.dernier().valeur() : ma_source;
134 }
135 else if (espaceStockageList(num))
136 return espaceStockageList(num).valeur();
137 else
138 return sourceList(num);
139}
140
141/*! @brief Effectue une mise a jour en temps de chacune des sondes de la liste.
142 *
143 * @param (double temps) le temps de mise a jour
144 * @param (double tinit) le temps initial des sondes
145 */
146void Sondes::mettre_a_jour(double temps, double tinit)
147{
148 for (auto &itr : *this) itr->mettre_a_jour(temps, tinit);
149
150 clear_cache();
151}
152
153/*! @brief Associe un postraitement a la liste des sondes.
154 *
155 */
157{
158 mon_post = post;
159}
160
161/*! @brief Modifie le parametrage des sondes mobiles
162 *
163 */
164void Sondes::set_update_positions(bool update_positions_)
165{
166 update_positions=update_positions_;
167}
168
169/*! @brief Renvoie le parametrage des sondes mobiles
170 *
171 */
class Champ_Generique_base
virtual const Champ_base & get_champ(OWN_PTR(Champ_base) &espace_stockage) const =0
void fixer_identifiant_appel(const Nom &identifiant)
classe Champ_base Cette classe est la base de la hierarchie des champs.
Definition Champ_base.h:43
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
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
int rang(const char *const ch) const
Definition Noms.cpp:65
classe Postraitement La classe est dotee -d une liste de champs generiques champs_post_complet_ qui c...
static void exit(int exit_code=-1)
Routine de sortie de TRUST dans une region Kokkos.
Definition Process.cpp:455
classe Sonde Cette classe permet d'effectuer l'evolution d'un champ au cours du temps.
Definition Sonde.h:41
classe Sondes Cette classe represente une liste de sondes.
Definition Sondes.h:31
void set_update_positions(bool update_positions)
Modifie le parametrage des sondes mobiles.
Definition Sondes.cpp:164
void mettre_a_jour(double temps, double tinit)
Effectue une mise a jour en temps de chacune des sondes de la liste.
Definition Sondes.cpp:146
void postraiter()
Effectue le postraitement sur chacune des sondes de la liste.
Definition Sondes.cpp:107
void clear_cache()
Definition Sondes.cpp:114
void set_noms_champs_postraitables()
Definition Sondes.cpp:85
void completer()
Definition Sondes.cpp:98
void associer_post(const Postraitement &)
Associe un postraitement a la liste des sondes.
Definition Sondes.cpp:156
const Nom & nom_champ_lu_
Definition Sondes.h:41
bool get_update_positions()
Renvoie le parametrage des sondes mobiles.
Definition Sondes.cpp:172
bool update_positions
Definition Sondes.h:45
Classe de base des flux de sortie.
Definition Sortie.h:52