TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Domaine_dis_base.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 <Build_Map_to_Structured.h>
17#include <Discretisation_base.h>
18#include <Frontiere_dis_base.h>
19#include <Domaine_dis_base.h>
20#include <Probleme_base.h>
21#include <Sous_Domaine.h>
22#include <Domaine.h>
23
24Implemente_base(Domaine_dis_base,"Domaine_dis_base",Objet_U);
25
27{
28 return os ;
29}
30
32{
33 return is ;
34}
35
40
42{
43 return les_sous_domaines_dis_[i].valeur();
44}
45
50
51/*! @brief Associe un Domaine a l'objet.
52 *
53 * @param (Domaine& un_domaine) le domaine a associer au domaine discretise
54 */
55void Domaine_dis_base::associer_domaine(const Domaine& un_domaine)
56{
57 le_dom_=un_domaine;
58}
59
60/*! @brief Renvoie la frontiere de Nom nom.
61 *
62 * (On indexe les frontiere avec leur nom)
63 *
64 * @param (Nom& nom) le nom de la frontiere a indexer
65 * @return (Frontiere_dis_base&) la frontiere discretisee indexee
66 * @throws frontiere de nom inconnu leve par rang_frontiere(Nom&)
67 */
69{
70 return frontiere_dis(rang_frontiere(nom));
71}
72
77
78/*! @brief Renvoie le rang de la frontiere de Nom nom Renvoie -1 si aucune frontiere ne s'appelle nom.
79 *
80 * @param (Nom& nom) le nom de la frontiere dont cherche le rang
81 * @return (int) le rang de la frontiere si elle existe -1 sinon
82 * @throws pas de frontiere de Nom nom trouvee
83 */
85{
86 for(int i=0; i<nb_front_Cl(); i++)
87 if (frontiere_dis(i).le_nom()==nom)
88 return i;
89 Cerr << "We did not find the boundary name " << nom << " on the domain " << domaine().le_nom() << finl;
90 Cerr << "Check the given boundary name or the domain." << finl;
91 exit();
92 return -1;
93}
94
96{
97 for(int i=0; i<nb_front_Cl(); i++)
98 if (frontiere_dis(i).le_nom()==nom)
99 return i;
100 Cerr << "We did not find the boundary name " << nom << " on the domain " << domaine().le_nom() << finl;
101 Cerr << "Check the given boundary name or the domain." << finl;
102 exit();
103 return -1;
104}
105
106/*! @brief Ecriture des noms des bords sur un flot de sortie.
107 *
108 * @param (Sortie& os) un flot de sortie
109 */
114
116{
117 Cerr << "Domaine_dis_base::creer_elements_fictifs should be overloaded by "<< que_suis_je() <<finl;
118 assert(0);
119 exit();
120}
121
123{
124 Cerr << que_suis_je() << "does not implement the method face_sommets()"
125 << finl;
126 exit();
127 throw;
128}
129
131{
132 Cerr << que_suis_je() << "does not implement the method face_sommets()"
133 << finl;
134 exit();
135 throw;
136}
137
139{
140 Cerr << que_suis_je() << "does not implement the method face_aretes()"
141 << finl;
142 exit();
143 throw;
144}
145
146const IntTab& Domaine_dis_base::face_aretes() const
147{
148 Cerr << que_suis_je() << "does not implement the method face_aretes()"
149 << finl;
150 exit();
151 throw;
152}
153
155{
156 Cerr << que_suis_je() << "does not implement the method face_voisins()"
157 << finl;
158 exit();
159 throw;
160}
161
163{
164 Cerr << que_suis_je() << "does not implement the method face_voisins()"
165 << finl;
166 exit();
167 throw;
168}
169
170/**! Make sure the reordering option passed to the discretisation options is known to the Domaine_dis_base:
171 */
173{
174 reorder_ = disc.get_reorder();
175}
176
178{
179 // Should we handle faces
180 Nom ze_typ(typ);
181 ze_typ.suffix("NO_FACE_");
182 bool face_ok = (ze_typ == typ);
183
184 const Domaine& dom = le_dom_.valeur();
185
186 if (face_ok)
187 discretiser();
188 else
190
192 build_map_mc_Cmesh(face_ok); /* ici pour avoir l'info sur face_normals */
193
194 // Remplit les sous_domaines_dis, les type, et leur associe les domaine_dis et les sous_domaine correspondantes.
195 les_sous_domaines_dis_.dimensionner(dom.nb_ss_domaines());
196
197 for (int i=0; i<dom.nb_ss_domaines(); i++)
198 {
199 const Domaine& domaine_from_ss_domaine = dom.ss_domaine(i).domaine();
200 if (!domaine_from_ss_domaine.est_egal_a(dom))
201 {
202 Cerr << "In Domaine_dis_base::discretiser(), impossible to find a Domain corresponding to sous_domaine " << i << finl;
203 exit();
204 }
205 if (face_ok)
207 }
208}
209
211{
212 if (motlu == "VOLUME_MAILLE" && !volume_maille_)
213 {
214 pb.discretisation().volume_maille(pb.schema_temps(), pb.domaine_dis(), volume_maille_);
215 champs_compris_.ajoute_champ(volume_maille_);
216 }
217 else if (motlu == "MESH_NUMBERING" && !mesh_numbering_)
218 {
219 pb.discretisation().mesh_numbering(pb.schema_temps(), pb.domaine_dis(), mesh_numbering_);
220 champs_compris_.ajoute_champ(mesh_numbering_);
221 }
222}
223
225{
226 if (un_nom == "VOLUME_MAILLE")
227 return volume_maille();
228 else if (un_nom == "MESH_NUMBERING")
229 return mesh_numbering();
230
231 throw std::runtime_error(std::string("Field ") + un_nom.getString() + std::string(" not found !"));
232}
233
234bool Domaine_dis_base::has_champ(const Motcle& un_nom, OBS_PTR(Champ_base) &ref_champ) const
235{
236 if (un_nom == "VOLUME_MAILLE")
237 {
238 ref_champ = volume_maille();
239 return true;
240 }
241 else if (un_nom == "MESH_NUMBERING")
242 {
243 ref_champ = mesh_numbering();
244 return true;
245 }
246 return false;
247}
248
249bool Domaine_dis_base::has_champ(const Motcle& un_nom) const
250{
251 if (un_nom == "VOLUME_MAILLE" || un_nom == "MESH_NUMBERING")
252 return true;
253 else
254 return false;
255}
256
258{
259 Noms noms_compris = champs_compris_.liste_noms_compris();
260 noms_compris.add("VOLUME_MAILLE");
261 noms_compris.add("MESH_NUMBERING");
262 if (opt==DESCRIPTION)
263 Cerr<<que_suis_je()<<" : "<< noms_compris <<finl;
264 else
265 nom.add(noms_compris);
266}
267
classe Champ_base Cette classe est la base de la hierarchie des champs.
Definition Champ_base.h:43
classe Discretisation_base Cette classe represente un schema de discretisation en espace,...
void mesh_numbering(const Schema_Temps_base &sch, const Domaine_dis_base &z, OWN_PTR(Champ_Fonc_base)&ch) const
void volume_maille(const Schema_Temps_base &sch, const Domaine_dis_base &z, OWN_PTR(Champ_Fonc_base)&ch) const
const Reorder_Mesh & get_reorder() const
const Sous_Domaine_t & ss_domaine(int i) const
Definition Domaine.h:290
int nb_ss_domaines() const
Definition Domaine.h:289
void ecrire_noms_bords(Sortie &) const
Ecriture des noms des bords sur un flot de sortie.
Definition Domaine.cpp:1032
classe Domaine_Cl_dis_base Les objets Domaine_Cl_dis_base representent les conditions aux limites
const Nom & le_nom() const override
Donne le nom de l'Objet_U Methode a surcharger : renvoie "neant" dans cette implementation.
classe Domaine_dis_base Cette classe est la base de la hierarchie des domaines discretisees.
const Frontiere_dis_base & frontiere_dis(const Nom &) const
Renvoie la frontiere de Nom nom.
virtual void build_map_mc_Cmesh(const bool with_faces)
bool has_champ(const Motcle &nom, OBS_PTR(Champ_base) &ref_champ) const override
Champs_compris champs_compris_
virtual IntTab & face_voisins()
int nombre_de_sous_domaines_dis() const
int nb_front_Cl() const
void get_noms_champs_postraitables(Noms &nom, Option opt=NONE) const override
virtual void discretiser_no_face()=0
int rang_frontiere(const Nom &)
const Champ_Fonc_base & mesh_numbering() const
virtual IntTab & face_sommets()
void completer(const Discretisation_base &disc)
const Sous_domaine_dis_base & sous_domaine_dis(int i) const
void creer_champ(const Motcle &motlu) override
virtual void discretiser()
const Domaine & domaine() const
const Champ_base & get_champ(const Motcle &) const override
void associer_domaine(const Domaine &)
Associe un Domaine a l'objet.
TRUST_Vector< OWN_PTR(Sous_domaine_dis_base)> les_sous_domaines_dis_
virtual IntTab & face_aretes()
void discretiser_root(const Nom &typ)
const Champ_Fonc_base & volume_maille() const
void ecrire_noms_bords(Sortie &) const
Ecriture des noms des bords sur un flot de sortie.
virtual void typer_discretiser_ss_domaine(int i)=0
virtual void creer_elements_fictifs(const Domaine_Cl_dis_base &)
OBS_PTR(Domaine) le_dom_
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
classe Frontiere_dis_base Classe representant une frontiere discretisee.
Une chaine de caractere (Nom) en majuscules.
Definition Motcle.h:26
class Nom Une chaine de caractere pour nommer les objets de TRUST
Definition Nom.h:31
Nom & suffix(const char *const)
Extraction de suffixe : Nom x("azerty");.
Definition Nom.cpp:271
const std::string & getString() const
Definition Nom.h:92
Un tableau de chaine de caracteres (VECT(Nom)).
Definition Noms.h:26
classe Objet_U Cette classe est la classe de base des Objets de TRUST
Definition Objet_U.h:73
friend class Sortie
Definition Objet_U.h:75
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
virtual int est_egal_a(const Objet_U &) const
Renvoie 1 si l'objet x et *this sont une seule et meme instance (meme adresse en memoire).
Definition Objet_U.cpp:301
virtual const Nom & le_nom() const
Donne le nom de l'Objet_U Methode a surcharger : renvoie "neant" dans cette implementation.
Definition Objet_U.cpp:319
virtual Sortie & printOn(Sortie &) const
Ecriture de l'objet sur un flot de sortie Methode a surcharger.
Definition Objet_U.cpp:282
classe Probleme_base C'est un Probleme_U qui n'est pas un couplage.
const Discretisation_base & discretisation() const
Renvoie la discretisation associee au probleme.
const Schema_Temps_base & schema_temps() const
Renvoie le schema en temps associe au probleme.
const Domaine_dis_base & domaine_dis() const
Renvoie le domaine discretise associe au probleme.
static void exit(int exit_code=-1)
Routine de sortie de TRUST dans une region Kokkos.
Definition Process.cpp:455
Classe de base des flux de sortie.
Definition Sortie.h:52
Domaine_t & domaine()
Cette classe est a la base de la hierarchie des sous-domaines discretises. Au moment de la discretisa...