TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Mailler.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 <NettoieNoeuds.h>
17#include <TRUST_Deriv.h>
18#include <Mailler.h>
19#include <Domaine.h>
20#include <Scatter.h>
21
22#include <list>
23#include <memory>
24
25Implemente_instanciable_32_64(Mailler_32_64,"Mailler",Interprete_geometrique_base_32_64<_T_>);
26// XD mailler interprete mailler INHERITS_BRACE The Mailler (Mesh) interpretor allows a Domain type object domaine to be
27// XD_CONT meshed with objects objet_1, objet_2, etc...
28// XD attr domaine ref_domaine domaine REQ Name of domain.
29// XD attr bloc list_bloc_mailler bloc REQ Instructions to mesh.
30
31// XD mailler_64 mailler mailler_64 INHERITS_BRACE The Mailler (Mesh) interpretor allows a big (64b) domain type object
32// XD_CONT domaine to be meshed with objects objet_1, objet_2, etc...
33
34template <typename _SIZE_>
36{
37 return Interprete::printOn(os);
38}
39
40template <typename _SIZE_>
42{
43 return Interprete::readOn(is);
44}
45
46inline void verifie_syntaxe(Motcle& motlu)
47{
48 if (motlu!="}" && motlu!=",")
49 {
50 Cerr << "We expected , or }" << finl;
52 }
53}
54/*! @brief Fonction principale de l'interprete Mailler Structure du jeu de donnee (en dimension 2) :
55 *
56 * Mailler dom
57 * {
58 * [Epsilon eps]
59 * [objet1]
60 * ,
61 * [objet2]
62 * ...
63 * }
64 * Deux points seront confondus des que la distance entre eux est
65 * inferieure a Epsilon.
66 *
67 * @param (Entree& is) un flot d'entree
68 * @return (Entree&) le flot d'entree
69 * @throws l'objet a mailler n'est pas du type Domaine_t
70 * @throws accolade ouvrante attendue
71 * @throws accolade fermante ou virgule attendue
72 */
73template <typename _SIZE_>
75{
77 {
78 Cerr << "Mailler keyword can't be used in parallel calculation!" << finl;
79 Cerr << "Use only Scatter keyword to read partitioned mesh." << finl;
81 }
82 double precision_geom_sa = this->precision_geom;
83 this->associer_domaine(is);
84 Domaine_t& dom = this->domaine();
85
86 // On debloque les structures pour modifier le domaine
88
89 Motcle motlu;
90 is >> motlu;
91 if (motlu != "{")
92 {
93 Cerr << "We expected a {" << finl;
95 }
96 Nom typ_domaine;
97 std::list<Domaine_t*> dom_lst; // the list of domains we will merge later when calling comprimer()
98 std::list<OWN_PTR(Domaine_t)> dom_lst2; // just for memory management
99 do
100 {
101 is >> typ_domaine;
102 motlu = typ_domaine;
103 if(motlu=="epsilon")
104 {
105 double eps;
106 is >> eps;
107 dom.fixer_epsilon(eps);
108 // GF le eps du domaine ne sert plus quand on cherche les sommets doubles;
109 this->precision_geom=eps;
110 is >> motlu;
111 verifie_syntaxe(motlu);
112 }
113 else if(motlu=="Domain")
114 {
115 Nom nom_dom;
116 is >> nom_dom;
117 Cerr << "Adding a domain " << nom_dom << finl;
118 Domaine_t& added_dom=ref_cast(Domaine_t, this->objet(nom_dom));
119 dom_lst.push_back(&added_dom);
120 is >> motlu;
121 verifie_syntaxe(motlu);
122 }
123 else
124 {
125 dom_lst2.push_back(OWN_PTR(Domaine_t)()); // to keep them alive till the end of the method
126 OWN_PTR(Domaine_t)& un_domaine = dom_lst2.back();
127 un_domaine.typer(typ_domaine); // Most likely a Pave ...
128 Domaine_t& ze_domaine = un_domaine.valeur();
129 is >> ze_domaine;
130 dom_lst.push_back(&ze_domaine);
131 is >> motlu;
132 verifie_syntaxe(motlu);
133 }
134 }
135 while(motlu != "}");
136
137 // Dans le cas ou on a modifie precision geom, on le remet a la valeur d'origine
138 this->precision_geom=precision_geom_sa;
139 dom.fill_from_list(dom_lst);
141
143
145 return is;
146}
147
148template class Mailler_32_64<int>;
149#if INT_is_64_ == 2
150template class Mailler_32_64<trustIdType>;
151#endif
void fill_from_list(std::list< Domaine_32_64 * > &lst)
Fills the Domaine from a list of Domaine objects by aggregating them.
Definition Domaine.cpp:1509
void fixer_premieres_faces_frontiere()
Definition Domaine.cpp:1102
void fixer_epsilon(double eps)
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
classe Interprete_geometrique_base .
static Objet_U & objet(const Nom &)
Voir Interprete_bloc::objet_global() BM: la classe Interprete n'est pas le meilleur endroit pour cett...
Classe Mailler Un mailleur par agglomeration de domaines (paves en 2D et blocks en 3D).
Definition Mailler.h:48
Domaine_32_64< _SIZE_ > Domaine_t
Definition Mailler.h:51
Entree & interpreter_(Entree &) override
Fonction principale de l'interprete Mailler Structure du jeu de donnee (en dimension 2) :
Definition Mailler.cpp:74
Une chaine de caractere (Nom) en majuscules.
Definition Motcle.h:26
static void nettoie(Domaine_t &)
class Nom Une chaine de caractere pour nommer les objets de TRUST
Definition Nom.h:31
friend class Entree
Definition Objet_U.h:76
virtual Entree & readOn(Entree &)
Lecture d'un Objet_U sur un flot d'entree Methode a surcharger.
Definition Objet_U.cpp:293
static double precision_geom
Definition Objet_U.h:86
virtual Sortie & printOn(Sortie &) const
Ecriture de l'objet sur un flot de sortie Methode a surcharger.
Definition Objet_U.cpp:282
static bool is_parallel()
Definition Process.cpp:110
static void exit(int exit_code=-1)
Routine de sortie de TRUST dans une region Kokkos.
Definition Process.cpp:455
static void init_sequential_domain(Domaine_32_64< _SIZE_ > &dom)
Create parallel descriptors for the vertex and element arrays of the domain (necessary because Scatte...
Definition Scatter.cpp:2742
static void uninit_sequential_domain(Domaine_32_64< _SIZE_ > &dom)
methode utilisee par les interpretes qui modifient le domaine (sequentiel), detruit les descripteurs ...
Definition Scatter.cpp:2757
Classe de base des flux de sortie.
Definition Sortie.h:52