TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Interprete_geometrique_base.cpp
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#include <Interprete_geometrique_base.h>
17#include <Sous_Domaine.h>
18#include <Domaine.h>
19#include <EChaine.h>
20
21Implemente_base_32_64(Interprete_geometrique_base_32_64, "Interprete_geometrique_base", Interprete);
22// XD interprete_geometrique_base interprete interprete_geometrique_base INHERITS_BRACE Class for interpreting a data
23// XD_CONT file
24
25template <typename _SIZE_>
27
28template <typename _SIZE_>
30
31template <typename _SIZE_>
37
38template <typename _SIZE_>
40{
41 Cerr << "Association of the domain on which the interpreter applies " << que_suis_je() << finl;
42 Nom nom_dom;
43 is >> nom_dom;
44 if(!sub_type(Domaine_t, objet(nom_dom)))
45 {
46 Cerr << nom_dom << " is of type " << objet(nom_dom).que_suis_je() << finl;
47 Cerr << "we know to treat only one domain with the interpreter " << que_suis_je() << finl;
48 exit();
49 }
50 domains_.add(ref_cast(Domaine_t, objet(nom_dom)));
51}
52
53template <typename _SIZE_>
55{
56 Cerr << "Association of the domain object on which the interpreter applies " << que_suis_je() << finl;
57 domains_.add(dom);
58}
59
60template <typename _SIZE_>
62{
63 Cerr << "Execution of the interpreter " << que_suis_je() << finl;
65 // Call the child interpreter
66 interpreter_(is);
67
68 // Update a number of things
69 // following the modification of the domains
70 for (int j=0; j<domains_.size(); j++)
71 {
72 Domaine_t& dom = domaine(j);
73 dom.invalide_octree();
77 dom.bords_int().associer_domaine(dom);
79 dom.type_elem()->associer_domaine(dom);
81 // MEDCouplingUMesh object in domaine is now invalid:
82 dom.set_mc_mesh_ready(false);
83 }
84 return is;
85}
86
87/*! @brief Adds the new elements into the sub-domains.
88 *
89 */
90template <typename _SIZE_>
92{
93 Domaine_t& dom=domaine;
94 for (int ssz=0; ssz<dom.nb_ss_domaines(); ssz++)
95 {
96 Sous_Domaine_32_64<_SIZE_>& sous_domaine=dom.ss_domaine(ssz);
97 if ((que_suis_je()=="Raffiner_anisotrope")
98 || (que_suis_je()=="Raffiner_isotrope")
99 || (que_suis_je()=="Remove_elem")
100 || (que_suis_je()=="Tetraedriser_homogene")
101 || (que_suis_je()=="Tetraedriser_homogene_compact")
102 || (que_suis_je()=="Tetraedriser_homogene_fin")
103 || (que_suis_je()=="Tetraedriser_par_prisme")
104 || (que_suis_je()=="Tetraedriser")
105 || (que_suis_je()=="Trianguler")
106 || (que_suis_je()=="Trianguler_fin")
107 || (que_suis_je()=="Trianguler_H")
108 || (que_suis_je()=="VerifierCoin"))
109 {
110 const int_t nb_poly=sous_domaine.nb_elem_tot();
111 for (int_t nb_p=0; nb_p<nb_poly; nb_p++)
112 {
113 if (elem==sous_domaine[nb_p])
114 {
115 Cerr << " The element " << elem << " which will be modified, is included to the subarea \"" << sous_domaine.le_nom() << "\". So the element";
116 if (nb_elem>1) Cerr << "s";
117 Cerr << " generated [";
118 for(int_t num_elem=num_premier_elem; num_elem<num_premier_elem+nb_elem; num_elem++)
119 {
120 sous_domaine.add_elem(num_elem);
121 if (num_elem!=num_premier_elem) Cerr << " ";
122 Cerr << num_elem;
123 }
124 Cerr << "] will be added to this subarea." << finl;
125 }
126 }
127 }
128 else
129 {
130 Cerr << finl;
131 Cerr << "You have defined the subarea \"" << sous_domaine.le_nom() << "\" before using the interpreter \"" << que_suis_je() << "\"." << finl;
132 Cerr << "To correctly mark the good elements, set the subarea after to have used the interpreter." << finl;
133 exit();
134 }
135 }
136}
137
138
139
141#if INT_is_64_ == 2
143#endif
144
void associer_domaine(const Domaine_t &)
Associates a domain to all boundaries in the list.
Definition Bords.cpp:32
void associer_domaine(const Domaine_t &)
Associates a domain to all Bord_Interne objects in the list.
const Sous_Domaine_t & ss_domaine(int i) const
Definition Domaine.h:290
void set_mc_mesh_ready(bool flag) const
Definition Domaine.h:357
Bords_t & faces_bord()
Definition Domaine.h:198
int nb_ss_domaines() const
Definition Domaine.h:289
Raccords_t & faces_raccord()
Definition Domaine.h:253
void fixer_premieres_faces_frontiere()
Definition Domaine.cpp:1101
void invalide_octree()
Definition Domaine.cpp:809
Bords_Internes_t & bords_int()
Definition Domaine.h:213
Joints_t & faces_joint()
Definition Domaine.h:265
Groupes_Faces_t & groupes_faces()
Definition Domaine.h:224
An input stream whose source is a character string.
Definition EChaine.h:31
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
void associer_domaine(const Domaine_t &)
Associates a domain to all Groupe_Faces objects in the list.
Class Interprete_geometrique_base.
void mettre_a_jour_sous_domaine(Domaine_t &domaine, int_t &elem, int_t num_premier_elem, int_t nb_elem) const
Adds the new elements into the sub-domains.
virtual Entree & interpreter_(Entree &is)=0
Base class for "interpreter" objects.
Definition Interprete.h:38
static Objet_U & objet(const Nom &)
See Interprete_bloc::objet_global(). BM: the Interprete class is not the best place for this.
void associer_domaine(const Domaine_t &)
Associates a domain with all joints in the list.
Definition Joints.cpp:33
class Nom: a character string for naming TRUST objects.
Definition Nom.h:31
friend class Entree
Definition Objet_U.h:71
const Nom & que_suis_je() const
Returns the string identifying the class.
Definition Objet_U.cpp:104
virtual Entree & readOn(Entree &)
Reads an Objet_U from an input stream. Virtual method to override.
Definition Objet_U.cpp:289
virtual Sortie & printOn(Sortie &) const
Writes the object to an output stream. Virtual method to override.
Definition Objet_U.cpp:278
static void imprimer_ram_totale(int all_process=0)
Definition Process.cpp:655
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
Definition Process.cpp:466
void associer_domaine(const Domaine_t &)
Associates a domain with all connectors in the list.
Definition Raccords.cpp:31
Base class for output streams.
Definition Sortie.h:52
Sous_Domaine represents a volumic sub-domain i.e. a sub set of elements of a Domaine.
void add_elem(const int_t poly)
Adds a polyhedron to the subdomain.
const Nom & le_nom() const override
Returns the name of the Objet_U. Virtual method to override: returns "neant" in this implementation.
int_t nb_elem_tot() const