TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
Domaine.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 Domaine_32_64_included
17#define Domaine_32_64_included
18
19#include <Domaine_base.h>
20
21#include <TRUST_Deriv.h>
22#include <Octree.h>
23#include <Elem_geom.h>
24
25#include <medcoupling++.h>
26
27#ifdef MEDCOUPLING_
28#include <MEDCouplingFieldTemplate.hxx>
29#include <MEDCouplingUMesh.hxx>
30#include <MEDCouplingRemapper.hxx>
31using MEDCoupling::MEDCouplingRemapper;
32using MEDCoupling::MEDCouplingUMesh;
33using MEDCoupling::MCAuto;
34using MEDCoupling::MEDCouplingFieldDouble;
35#ifdef MPI_
36#include <OverlapDEC.hxx>
37using MEDCoupling::OverlapDEC;
38#endif
39#endif
40
41// Forward decl:
43class Conds_lim;
44class Reorder_Mesh;
45
46template <typename _SIZE_> class OctreeRoot_32_64;
47template <typename _SIZE_> class Sous_Domaine_32_64;
48
49/*! @brief class Domaine_32_64 A Domain is a mesh composed of a set of geometric elements of the same type.
50 *
51 * The different types of elements are objects of classes derived from Elem_geom_base.
52 * A domain is made up of nodes, elements, boundaries, periodic boundaries,
53 * joints, connections and internal boundaries.
54 *
55 * This class is templatized on the 32/64 bit configuration.
56 * All the methods/members not sensitive to this are in Domaine_base.
57 *
58 * @sa Domaine, Domaine_64, Sous_Domaine, Frontiere, Elem_geom, Elem_geom_base, Bord, Bord_perio, Joint, Raccord, Bords_Interne
59 */
60template<typename _SIZE_>
62{
63
64 Declare_instanciable_sans_constructeur_32_64( Domaine_32_64 );
65
66public:
67 //
68 // Types
69 //
70 using int_t = _SIZE_;
71 using ArrOfInt_t = ArrOfInt_T<_SIZE_>;
72 using IntVect_t = IntVect_T<_SIZE_>;
73 using IntTab_t = IntTab_T<_SIZE_>;
74 using SmallArrOfTID_t = SmallArrOfTID_T<_SIZE_>;
75 using ArrOfDouble_t= ArrOfDouble_T<_SIZE_>;
76 using DoubleVect_t = DoubleVect_T<_SIZE_>;
77 using DoubleTab_t = DoubleTab_T<_SIZE_>;
78
79 using ArrsOfInt_t = ArrsOfInt_T<_SIZE_>;
80 using DoubleTabs_t = DoubleTabs_T<_SIZE_>;
81
95
96 //
97 // General
98 //
100 Entree& readOn_has_perio(Entree& s, bool& has_perio);
101 inline void typer(const Nom&);
102 inline const OWN_PTR(Elem_geom_base_32_64<_SIZE_>)& type_elem() const { return elem_; }
103 inline OWN_PTR(Elem_geom_base_32_64<_SIZE_>)& type_elem() { return elem_; }
104 inline void reordonner() { elem_->reordonner(); }
105
106
107 //
108 // Nodes
109 //
110 inline double coord(int_t i, int j) const { return sommets_(i,j); }
111 inline double& coord(int_t i, int j) { return sommets_(i,j); }
112 inline const DoubleTab_t& coord_sommets() const { return sommets_; }
113 inline DoubleTab_t& les_sommets() { return sommets_; }
114 inline const DoubleTab_t& les_sommets() const { return sommets_; }
117 DoubleTab getBoundingBox() const;
118 void ajouter(const DoubleTab_t& soms);
119 void ajouter(const DoubleTab_t& soms, IntVect_t& nums);
120 /// Returns the number of vertices of the domain.
121 int_t nb_som() const { return sommets_.dimension(0); }
122 /// Returns the total number of vertices of the domain i.e. the number of real and virtual vertices on the current processor.
123 int_t nb_som_tot() const { return sommets_.dimension_tot(0); }
125
126 //
127 // Elements
128 //
129 inline IntTab_t& les_elems() { return mes_elems_; }
130 inline const IntTab_t& les_elems() const { return mes_elems_; }
131 inline int_t nb_elem() const { return mes_elems_.dimension(0); }
132 inline int_t nb_elem_tot() const { return mes_elems_.dimension_tot(0); }
133 inline int nb_som_elem() const;
134 inline int nb_faces_elem(int=0) const;
135 /// @brief Returns the (global) number of the j-th vertex of the i-th element
136 inline int_t sommet_elem(int_t i, int j) const { return mes_elems_(i,j); }
137
138 //
139 // Aretes
140 //
141
142 /// Returns the number of real edges.
143 inline int_t nb_aretes() const { return aretes_som_.dimension(0); }
144 /// returns the total number of edges (real+virtual).
145 inline int_t nb_aretes_tot() const { return aretes_som_.dimension_tot(0); }
146
147 //
148 // Correspondances
149 //
150
151 /// returns the number of the j-th vertex of the i-th edge.
152 inline int_t arete_sommets(int_t i, int j) const { return aretes_som_(i, j); }
153 /// returns the number of the j-th edge of the i-th element.
154 inline int_t elem_aretes(int_t i, int j) const { return elem_aretes_(i, j); }
155 /// returns the connectivity array edges/vertices.
156 inline const IntTab_t& aretes_som() const { return aretes_som_; }
157 /// returns the connectivity array elements/edges.
158 inline const IntTab_t& elem_aretes() const { return elem_aretes_; }
159 inline IntTab_t& set_aretes_som() { return aretes_som_; }
161
162 //
163 // Faces
164 //
165 inline int_t nb_faces_bord() const { return mes_faces_bord_.nb_faces(); }
166 inline int_t nb_faces_bord(int num_bord) const { return mes_faces_bord_(num_bord).nb_faces(); }
167 inline int_t nb_faces_bord(Type_Face type) const { return mes_faces_bord_.nb_faces(type); }
168 inline int_t nb_faces_joint() const { return mes_faces_joint_.nb_faces(); }
169 inline int_t nb_faces_joint(int num_joint) const { return mes_faces_joint_(num_joint).nb_faces(); }
170 inline int_t nb_faces_joint(Type_Face type) const { return mes_faces_joint_.nb_faces(type); }
171 inline int_t nb_faces_raccord() const { return mes_faces_raccord_.nb_faces(); }
172 inline int_t nb_faces_raccord(int num_rac) const { return mes_faces_raccord_(num_rac)->nb_faces(); }
173 inline int_t nb_faces_raccord(Type_Face type) const { return mes_faces_raccord_.nb_faces(type); }
174 inline int_t nb_faces_bords_int() const { return mes_bords_int_.nb_faces(); }
175 inline int_t nb_faces_bords_int(int num_bord) const { return mes_bords_int_(num_bord).nb_faces(); }
176 inline int_t nb_faces_bords_int(Type_Face type) const { return mes_bords_int_.nb_faces(type); }
177 inline int_t nb_faces_groupes_faces() const { return mes_groupes_faces_.nb_faces(); }
178 inline int_t nb_faces_groupes_faces(int num_g) const { return mes_groupes_faces_(num_g).nb_faces(); }
179 inline int_t nb_faces_groupes_faces(Type_Face type) const { return mes_groupes_faces_.nb_faces(type); }
180
181 inline int_t nb_faces_frontiere() const;
182 inline int_t nb_faces_frontiere(Type_Face type) const;
183
185 inline int_t nb_faces_specifiques(Type_Face type) const;
186
188
189 ///
190 /// Bords
191 ///
192 inline int nb_bords() const { return mes_faces_bord_.nb_bords(); }
193 inline Bord_t& bord(int i) { return mes_faces_bord_(i); }
194 inline const Bord_t& bord(int i) const { return mes_faces_bord_(i); }
195 inline Bord_t& bord(const Nom& nom) { return mes_faces_bord_(nom); }
196 inline const Bord_t& bord(const Nom& nom) const { return mes_faces_bord_(nom); }
197
198 inline Bords_t& faces_bord() { return mes_faces_bord_; }
199 inline const Bords_t& faces_bord() const { return mes_faces_bord_; }
200
204
205 ///
206 /// Bords internes
207 ///
208 inline Bord_Interne_t& bords_interne(int i) { return mes_bords_int_(i); }
209 inline const Bord_Interne_t& bords_interne(int i) const { return mes_bords_int_(i); }
210 inline Bord_Interne_t& bords_interne(const Nom& nom) { return mes_bords_int_(nom); }
211 inline const Bord_Interne_t& bords_interne(const Nom& nom) const { return mes_bords_int_(nom); }
212
214 inline const Bords_Internes_t& bords_int() const { return mes_bords_int_; }
215
216
217 ///
218 /// Groupes_Faces
219 ///
220 inline int nb_groupes_faces() const { return mes_groupes_faces_.nb_groupes_faces(); }
221 inline Groupe_Faces_t& groupe_faces(int i) { return mes_groupes_faces_(i); }
222 inline const Groupe_Faces_t& groupe_faces(int i) const { return mes_groupes_faces_(i); }
223 inline const Groupe_Faces_t& groupe_faces(const Nom& nom) const { return mes_groupes_faces_(nom); }
225 inline const Groupes_Faces_t& groupes_faces() const { return mes_groupes_faces_; }
226
227 ///
228 /// Frontieres
229 ///
230 inline const Frontiere_t& frontiere(int i) const;
231 inline Frontiere_t& frontiere(int i);
232 int rang_frontiere(const Nom& ) const;
233 const Frontiere_t& frontiere(const Nom&) const;
235 inline int nb_frontieres_internes() const { return mes_bords_int_.nb_bords_internes(); }
236 inline int nb_front_Cl() const { return nb_bords() +nb_raccords() + nb_frontieres_internes(); }
237
238 ///
239 /// Domaines frontieres
240 ///
241 inline const LIST(OBS_PTR(Domaine_32_64))& domaines_frontieres() const { return domaines_frontieres_; }
242 inline Domaine_32_64& domaine_frontiere(int i) { return domaines_frontieres_(i).valeur(); }
243
244 ///
245 /// Raccords
246 ///
247 inline int nb_raccords() const { return mes_faces_raccord_.nb_raccords(); }
248 inline Raccord_t& raccord(int i) { return mes_faces_raccord_(i); }
249 inline const Raccord_t& raccord(int i) const { return mes_faces_raccord_(i); }
250 inline Raccord_t& raccord(const Nom& nom) { return mes_faces_raccord_(nom); }
251 inline const Raccord_t& raccord(const Nom& nom) const { return mes_faces_raccord_(nom); }
252
254 inline const Raccords_t& faces_raccord() const { return mes_faces_raccord_; }
255
256 ///
257 /// Joints
258 ///
259 inline int nb_joints() const { return mes_faces_joint_.nb_joints(); }
260
261 inline Joint_t& joint(int i) { return mes_faces_joint_(i); }
262 inline const Joint_t& joint(int i) const { return mes_faces_joint_(i); }
263 inline Joint_t& joint(const Nom& nom) { return mes_faces_joint_(nom); }
264 inline const Joint_t& joint(const Nom& nom) const { return mes_faces_joint_(nom); }
266 inline const Joints_t& faces_joint() const { return mes_faces_joint_; }
267
268 inline Joint_t& joint_of_pe(int);
269 inline const Joint_t& joint_of_pe(int) const;
271
272 void renum_joint_common_items(const IntVect_t& nums, const int_t elem_offset);
273
274
275 ///
276 /// Periodicity
277 ///
278 inline const Noms& bords_perio() const { return bords_perio_; }
279 inline Noms& bords_perio() { return bords_perio_; }
281 inline int_t get_renum_som_perio(int_t i) const { return renum_som_perio_[i]; }
285
286 //
287 // Sous Domaines
288 //
289 inline int nb_ss_domaines() const { return les_ss_domaines_.size(); }
290 inline const Sous_Domaine_t& ss_domaine(int i) const { return les_ss_domaines_[i].valeur(); }
291 inline Sous_Domaine_t& ss_domaine(int i) { return les_ss_domaines_[i].valeur(); }
292 inline const Sous_Domaine_t& ss_domaine(const Nom& nom) const { return les_ss_domaines_(nom).valeur(); }
293 inline Sous_Domaine_t& ss_domaine(const Nom& nom) { return les_ss_domaines_(nom).valeur(); }
294 void add(const Sous_Domaine_t& sd) { les_ss_domaines_.add(sd); }
295 int associer_(Objet_U&) override; // Associate sous_domaine
296 inline const LIST(OBS_PTR(Sous_Domaine_t))& ss_domaines() const { return les_ss_domaines_; }
297
298
299 ///
300 /// Geometric computations
301 ///
302 inline void calculer_centres_gravite(DoubleTab_t& xp) const;
304 virtual void calculer_volumes(DoubleVect_t& volumes, DoubleVect_t& inv_volumes) const;
305 void calculer_mon_centre_de_gravite(ArrOfDouble& c);
306 double volume_total() const;
307 inline const ArrOfDouble& cg_moments() const { return cg_moments_; }
308 inline ArrOfDouble& cg_moments() { return cg_moments_; }
309 inline void exporter_mon_centre_de_gravite(ArrOfDouble c) { cg_moments_ = c; }
310
311 ///
312 /// Lookup methods and mapping arrays
313 ///
314 SmallArrOfTID_t& chercher_elements(const DoubleTab& pos, SmallArrOfTID_t& elem, int reel=0) const;
315 SmallArrOfTID_t& chercher_elements(const DoubleVect& pos, SmallArrOfTID_t& elem, int reel=0) const;
316 int_t chercher_elements(double x, double y=0, double z=0,int reel=0) const;
317 SmallArrOfTID_t& indice_elements(const IntTab& som, SmallArrOfTID_t& elem, int reel=0) const;
318
319 SmallArrOfTID_t& chercher_sommets(const DoubleTab& pos, SmallArrOfTID_t& som, int reel=0) const;
320 int_t chercher_sommets(double x, double y=0, double z=0,int reel=0) const;
321
322 SmallArrOfTID_t& chercher_aretes(const DoubleTab& pos, SmallArrOfTID_t& arr, int reel=0) const;
323 void rang_elems_sommet(SmallArrOfTID_t& elems, double x, double y=0, double z=0) const;
324
326 const OctreeRoot_t& construit_octree(int&) const;
328
329 ///
330 /// Various
331 ///
332 virtual void clear();
333 void renum(const IntVect_t& nums);
335 void imprimer() const;
337 void read_former_domaine(Entree& s, bool& read_perio); // used in Scatter
339 void fill_from_list(std::list<Domaine_32_64*>& lst);
340
341 ///
342 /// MEDCoupling:
343 ///
344#ifdef MEDCOUPLING_
345 inline const MEDCouplingUMesh* get_mc_mesh(bool virt = false) const;
346 inline void set_mc_mesh(MCAuto<MEDCouplingUMesh> m) const { mc_mesh_ = m; }
347 // remapper with other domains
348 MEDCouplingRemapper* get_remapper(const Domaine_32_64& other_dom, bool virt=false) const;
349 // DEC with other domains
350#ifdef MPI_
351 OverlapDEC* get_dec(const Domaine_32_64& other_dom, MEDCouplingFieldDouble *dist, MEDCouplingFieldDouble *loc) const;
352#endif
353#endif
354 void build_mc_mesh(bool virt = false) const;
355 bool is_mc_mesh_ready() const { return mc_mesh_ready_; }
356 // Used in Interprete_geometrique_base for example - method is const, because mc_mesh_ready_ is mutable:
357 void set_mc_mesh_ready(bool flag) const { mc_mesh_ready_ = flag; }
358
359 ///
360 /// Parallelism and virtual items management
361 ///
362 inline const ArrOfInt_t& ind_faces_virt_bord() const { return ind_faces_virt_bord_; }
364 void construire_elem_virt_pe_num(IntTab_t& elem_virt_pe_num_cpy) const;
365 const IntTab_t& elem_virt_pe_num() const { return elem_virt_pe_num_; }
366 virtual void creer_tableau_elements(Array_base&, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT) const;
367 virtual const MD_Vector& md_vector_elements() const;
368 virtual void creer_tableau_sommets(Array_base&, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT) const;
369 virtual const MD_Vector& md_vector_sommets() const { return sommets_.get_md_vector(); }
370
371
372 ///
373 /// Methods only used in 32 bits (i.e. after Scatter)
374 ///
375 static int identifie_item_unique(IntList& item_possible, DoubleTab& coord_possible, const DoubleVect& coord_ref);
376 void init_faces_virt_bord(const MD_Vector& md_vect_faces, MD_Vector& md_vect_faces_bord);
379
380
381protected:
382 // Geometric element type of this domain
384
385 // Array of vertices
387 DoubleTab_t sommets_n; // vertex coordinates at beginning of step, needed for implicit iterations
388 // Renumbering array for periodicity
390 // Description of elements (for multi-element, the array may contain -1 values !!!)
392 // Definition of element edges (for each edge, indices of the two vertices)
393 // (this array is not always filled, depending on the discretisation)
395 // For each element, indices of its edges in Aretes_som (see Elem_geom_base::get_tab_aretes_sommets_locaux())
397 // For the virtual faces of Domaine_VF, indices of the same face in the boundary face array
398 // (see Domaine_32_64<_SIZE_>::init_faces_virt_bord())
399 ArrOfInt_t ind_faces_virt_bord_; // contains the indices of the virtual boundary faces // BigArrOfTID
400 // For each virtual element i with nb_elem<=i<nb_elem_tot:
401 // elem_virt_pe_num_(i-nb_elem,0) = number of the PE owning the element
402 // elem_virt_pe_num_(i-nb_elem,1) = local number of this element on the owning PE
404
405 // The octree is mutable: it is built on-the-fly when used in const methods
406 mutable OWN_PTR(OctreeRoot_t) deriv_octree_;
407 ArrOfDouble cg_moments_; // max dim 3
408
409 // List of references to sub domains
410 LIST(OBS_PTR(Sous_Domaine_t)) les_ss_domaines_;
411
412 // Bords, raccords and Bords_Internes form the "faces_frontiere" on which
413 // boundary conditions are defined.
417 // Groupes_Faces represent the groups of faces read from input files
419 // Joint faces are the faces shared with other processors (local domain boundaries
420 // that connect to a neighboring processor)
422
423 LIST(OBS_PTR(Domaine_32_64)) domaines_frontieres_;
424
425 Noms bords_perio_; ///< List of periodic boundaries - this is filled by Interprete 'Declarer_bord_perio'
426
427#ifdef MEDCOUPLING_
428 ///! MEDCoupling version of the domain:
429 mutable MCAuto<MEDCouplingUMesh> mc_mesh_, mc_mesh_virt_;
430 // One remapper per distant domain...
431 mutable std::map<const Domaine_32_64*, MEDCoupling::MEDCouplingRemapper> rmps;
432#ifdef MPI_
433 // ... but one DEC per (distant domain, field nature)
434 mutable std::map<std::pair<const Domaine_32_64*, MEDCoupling::NatureOfField>, OverlapDEC> decs;
435#endif
436 mutable bool mc_mesh_ready_ = false, mc_mesh_virt_ready_ = false;
437#endif
438
439private:
440 void prepare_rmp_with(const Domaine_32_64& other_dom, bool virt) const;
441 void prepare_dec_with(const Domaine_32_64& other_dom, MEDCouplingFieldDouble *dist, MEDCouplingFieldDouble *loc) const;
442
443 template<typename _BORD_TYP_>
444 void correct_type_single_border_type(std::list<_BORD_TYP_>& list);
445
446 // Cached infos to accelerate chercher_elements():
447 mutable DoubleTabs cached_positions_;
448 mutable TRUST_Vector<SmallArrOfTID_t> cached_elements_;
449};
450
451/*! @brief Sets the element type of the domain using the name passed as parameter.
452 *
453 * Associates the element type to the domain.
454 * @param (Nom& typ) the name of the geometric element type of the domain.
455 */
456template<typename _SIZE_>
457inline void Domaine_32_64<_SIZE_>::typer(const Nom& typ)
458{
459 const std::string suff = !std::is_same<_SIZE_, int>::value ? "_64" : "";
460 Nom typ_32_64 = typ + suff;
461 elem_.typer(typ_32_64); // e.g. 'Point' or 'Point_64'
462 elem_->associer_domaine(*this);
463}
464
465
466/*! @brief Returns the number of vertices of the geometric elements that make up the domain.
467 *
468 * Since all elements of the domain are of the same type they all have the same number of vertices
469 * which is the number of vertices of the type of the geometric elements of the domain.
470 *
471 * @return (int) the number of vertices per element
472 */
473template<typename _SIZE_>
474inline int Domaine_32_64<_SIZE_>::nb_som_elem() const { return elem_->nb_som(); }
475
476/*! @brief Returns the number of faces of type i of the geometric elements that make up the domain.
477 *
478 * Ex: objects of the Prism class have 2 types of faces: triangle or quadrangle.
479 *
480 * @param (int i) the type of face
481 * @return (int) the number of faces of type i of the geometric elements that make up the domain
482 */
483template<typename _SIZE_>
484inline int Domaine_32_64<_SIZE_>::nb_faces_elem(int i) const { return elem_->nb_faces(i); }
485
486/// Returns the number of boundary faces of the domain (sum of boundaries, connections, and internal boundaries)
487template<typename _SIZE_>
489
490
491/*! @brief Returns the number of special faces of the domain.
492 *
493 * It is the sum of the numbers of boundaries, connections, internal boundaries and specified face groups
494 */
495template<typename _SIZE_>
497
498/*! @brief Calculates the centers of gravity of the domain elements.
499 *
500 * @param (DoubleTab_t& xp) the array containing the centers of gravity of the domain elements
501 */
502template<typename _SIZE_>
503inline void Domaine_32_64<_SIZE_>::calculer_centres_gravite(DoubleTab_t& xp) const { elem_->calculer_centres_gravite(xp); }
504
505/*! @brief Returns the number of boundary faces of the domain of the specified type.
506 *
507 * It is the sum of the numbers of boundaries, connections and internal boundaries of the specified type.
508 *
509 * @param (Type_Face type) a type of face (some geometric elements have multiple types of faces)
510 * @return (int) the number of boundary faces of the domain of the specified type
511 */
512template<typename _SIZE_>
514{
515 return
516 nb_faces_bord(type) +
517 nb_faces_bords_int(type) +
518 nb_faces_raccord(type);
519}
520
521/*! @brief Returns the number of specific faces of the domain of the specified type.
522 *
523 * It is the sum of the numbers of boundaries, connections of internal boundaries and groups of faces of the specified type.
524 *
525 * @param (Type_Face type) a face type (some geometric elements have several types of faces)
526 * @return (int) the number of boundary faces of the domain of the specified type
527 */
528template<typename _SIZE_>
530{
531 return
532 nb_faces_bord(type) +
533 nb_faces_bords_int(type) +
534 nb_faces_raccord(type) +
536}
537
538template<typename _SIZE_>
540{
541 int fin=nb_bords();
542 if(i<fin)
543 return mes_faces_bord_(i);
544 i-=fin;
545 fin=nb_raccords();
546 if(i<fin)
547 return mes_faces_raccord_(i).valeur();
548 i-=fin;
550 if(i<fin)
551 return mes_bords_int_(i);
552 i-=fin;
553 fin=nb_groupes_faces();
554 if(i<fin)
555 return mes_groupes_faces_(i);
556 assert(0);
558 return frontiere(i);
559}
560
561
562template<typename _SIZE_>
564{
565 int fin=nb_bords();
566 if(i<fin)
567 return mes_faces_bord_(i);
568 i-=fin;
569 fin=nb_raccords();
570 if(i<fin)
571 return mes_faces_raccord_(i).valeur();
572 i-=fin;
574 if(i<fin)
575 return mes_bords_int_(i);
576 i-=fin;
577 fin=nb_groupes_faces();
578 if(i<fin)
579 return mes_groupes_faces_(i);
580 assert(0);
582 return frontiere(i);
583}
584
585template<typename _SIZE_>
587{
588 int i;
589 for(i=0; i<nb_joints(); i++)
590 if(mes_faces_joint_(i).PEvoisin()==pe)
591 break;
592 return mes_faces_joint_(i);
593}
594
595template<typename _SIZE_>
597{
598 int i;
599 for(i=0; i<nb_joints(); i++)
600 if(mes_faces_joint_(i).PEvoisin()==pe)
601 break;
602 return mes_faces_joint_(i);
603}
604
605
606#ifdef MEDCOUPLING_
607template<typename _SIZE_>
608inline const MEDCouplingUMesh* Domaine_32_64<_SIZE_>::get_mc_mesh(bool virt) const
609{
610 if (virt ? !mc_mesh_virt_ready_ : !mc_mesh_ready_)
611 build_mc_mesh(virt);
612 return virt ? mc_mesh_virt_ : mc_mesh_;
613}
614
615#endif // MEDCOUPLING_
616
617
618using Domaine = Domaine_32_64<int>;
619using Domaine_64 = Domaine_32_64<trustIdType>;
620
621#endif
Empty class used as a base for all the arrays.
Definition Array_base.h:41
Class Bord This class represents a boundary of a domain, it is a type of frontier.
Definition Bord.h:31
Class Bord_Interne The class serves to represent a set of faces that are internal.
Class Bords This class represents a list of objects of type Bord.
Definition Bords.h:28
int_t nb_faces() const
Returns the total number of faces of all boundaries in the list.
Definition Bords.cpp:42
Class Bords_Internes This class represents a list of objects of type Bords_Interne.
int_t nb_faces() const
Returns the total number of faces contained in the list of Bord_Interne, i.
class Conds_lim This class represents a vector of boundary conditions.
Definition Conds_lim.h:32
class Domaine_32_64 A Domain is a mesh composed of a set of geometric elements of the same type.
Definition Domaine.h:62
int_t nb_faces_bords_int() const
Definition Domaine.h:174
Bord_Interne_32_64< _SIZE_ > Bord_Interne_t
Definition Domaine.h:86
IntVect_T< _SIZE_ > IntVect_t
Definition Domaine.h:72
void calculer_mon_centre_de_gravite(ArrOfDouble &c)
Computes the center of gravity of the domain.
Definition Domaine.cpp:735
double volume_total() const
Definition Domaine.cpp:876
IntTab_t aretes_som_
Definition Domaine.h:394
void construire_elem_virt_pe_num()
Definition Domaine.cpp:703
Sous_Domaine_t & ss_domaine(int i)
Definition Domaine.h:291
SmallArrOfTID_t & chercher_elements(const DoubleVect &pos, SmallArrOfTID_t &elem, int reel=0) const
Searches for the elements containing the points whose coordinates are specified.
Definition Domaine.cpp:491
IntTab_t elem_aretes_
Definition Domaine.h:396
Bords_Internes_t mes_bords_int_
Definition Domaine.h:416
Domaine_32_64 & domaine_frontiere(int i)
Definition Domaine.h:242
virtual void clear()
Reset the Domaine completely except for its name.
Definition Domaine.cpp:108
ArrOfInt_t renum_som_perio_
Definition Domaine.h:389
int_t nb_faces_groupes_faces(Type_Face type) const
Definition Domaine.h:179
const Sous_Domaine_t & ss_domaine(int i) const
Definition Domaine.h:290
ArrOfDouble & cg_moments()
Definition Domaine.h:308
const Joint_t & joint(const Nom &nom) const
Definition Domaine.h:264
void rang_elems_sommet(SmallArrOfTID_t &elems, double x, double y=0, double z=0) const
Definition Domaine.cpp:802
int nb_front_Cl() const
Definition Domaine.h:236
int_t nb_faces_raccord(Type_Face type) const
Definition Domaine.h:173
const OWN_PTR(Elem_geom_base_32_64< _SIZE_ >) &type_elem() const
Definition Domaine.h:102
const Joints_t & faces_joint() const
Definition Domaine.h:266
Groupe_Faces_t & groupe_faces(int i)
Definition Domaine.h:221
const Frontiere_t & frontiere(const Nom &) const
Definition Domaine.cpp:1087
int_t nb_aretes_tot() const
returns the total number of edges (real+virtual).
Definition Domaine.h:145
Frontiere_32_64< _SIZE_ > Frontiere_t
Definition Domaine.h:90
int_t nb_faces_bord(int num_bord) const
Definition Domaine.h:166
const Raccord_t & raccord(const Nom &nom) const
Definition Domaine.h:251
virtual const MD_Vector & md_vector_sommets() const
Definition Domaine.h:369
int_t chercher_elements(double x, double y=0, double z=0, int reel=0) const
Returns the index of the element containing the point whose coordinates are specified.
Definition Domaine.cpp:648
ArrsOfInt_T< _SIZE_ > ArrsOfInt_t
Definition Domaine.h:79
Bord_t & bord(const Nom &nom)
Definition Domaine.h:195
Joints_t mes_faces_joint_
Definition Domaine.h:421
int nb_som_elem() const
Returns the number of vertices of the geometric elements that make up the domain.
Definition Domaine.h:474
void construire_elem_virt_pe_num(IntTab_t &elem_virt_pe_num_cpy) const
Definition Domaine.cpp:709
int_t nb_elem_tot() const
Definition Domaine.h:132
int_t nb_faces_specifiques() const
Returns the number of special faces of the domain.
Definition Domaine.h:496
OWN_PTR(Raccord_base_32_64< _SIZE_ >) Raccord_t
Definition Domaine.h:91
Bord_Interne_t & bords_interne(int i)
Definition Domaine.h:208
void creer_aretes()
Definition Domaine.cpp:2118
int_t nb_faces_bord() const
Definition Domaine.h:165
Frontiere_t & frontiere(int i)
Definition Domaine.h:563
ArrOfDouble cg_moments_
Definition Domaine.h:407
const Groupes_Faces_t & groupes_faces() const
Definition Domaine.h:225
SmallArrOfTID_t & chercher_elements(const DoubleTab &pos, SmallArrOfTID_t &elem, int reel=0) const
Searches for the elements containing the points whose coordinates are specified.
Definition Domaine.cpp:404
int_t nb_faces_raccord(int num_rac) const
Definition Domaine.h:172
SmallArrOfTID_T< _SIZE_ > SmallArrOfTID_t
Definition Domaine.h:74
LIST(OBS_PTR(Domaine_32_64)) domaines_frontieres_
OWN_PTR(OctreeRoot_t) deriv_octree_
Sous_Domaine_t & ss_domaine(const Nom &nom)
Definition Domaine.h:293
const IntTab_t & aretes_som() const
returns the connectivity array edges/vertices.
Definition Domaine.h:156
DoubleTab_T< _SIZE_ > DoubleTab_t
Definition Domaine.h:77
const OctreeRoot_t & construit_octree() const
Definition Domaine.cpp:816
virtual void creer_tableau_elements(Array_base &, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT) const
Creates a parallel array of values at elements.
Definition Domaine.cpp:850
LIST(OBS_PTR(Sous_Domaine_t)) les_ss_domaines_
void creer_mes_domaines_frontieres(const Domaine_VF &domaine_vf)
Definition Domaine.cpp:2172
SmallArrOfTID_t & chercher_aretes(const DoubleTab &pos, SmallArrOfTID_t &arr, int reel=0) const
Definition Domaine.cpp:676
Raccord_t & raccord(int i)
Definition Domaine.h:248
void calculer_centres_gravite(DoubleTab_t &xp) const
Calculates the centers of gravity of the domain elements.
Definition Domaine.h:503
int_t nb_faces_frontiere() const
Returns the number of boundary faces of the domain (sum of boundaries, connections,...
Definition Domaine.h:488
int_t nb_faces_bords_int(Type_Face type) const
Definition Domaine.h:176
Raccords_t mes_faces_raccord_
Definition Domaine.h:415
Bords_t mes_faces_bord_
Definition Domaine.h:414
static int identifie_item_unique(IntList &item_possible, DoubleTab &coord_possible, const DoubleVect &coord_ref)
Definition Domaine.cpp:1756
Bord_32_64< _SIZE_ > Bord_t
Definition Domaine.h:84
virtual void calculer_volumes(DoubleVect_t &volumes, DoubleVect_t &inv_volumes) const
Computes the volumes of the domain elements.
Definition Domaine.cpp:763
void init_faces_virt_bord(const MD_Vector &md_vect_faces, MD_Vector &md_vect_faces_bord)
Definition Domaine.cpp:1904
DoubleTab_t & les_sommets()
Definition Domaine.h:113
const ArrOfInt_t & ind_faces_virt_bord() const
Definition Domaine.h:362
int_t nb_faces_bord(Type_Face type) const
Definition Domaine.h:167
void set_mc_mesh_ready(bool flag) const
Definition Domaine.h:357
void set_renum_som_perio(IntTab_t &renum)
Definition Domaine.h:283
int rang_frontiere(const Nom &) const
Definition Domaine.cpp:1051
int_t nb_faces_bords_int(int num_bord) const
Definition Domaine.h:175
const Raccords_t & faces_raccord() const
Definition Domaine.h:254
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:1507
Joint_32_64< _SIZE_ > Joint_t
Definition Domaine.h:93
Entree & readOn_has_perio(Entree &s, bool &has_perio)
Reads the objects constituting a Domain from an input stream.
Definition Domaine.cpp:208
int_t get_renum_som_perio(int_t i) const
Definition Domaine.h:281
Bords_t & faces_bord()
Definition Domaine.h:198
ArrOfInt_T< _SIZE_ > ArrOfInt_t
Definition Domaine.h:71
const LIST(OBS_PTR(Sous_Domaine_t)) &ss_domaines() const
Definition Domaine.h:296
int associer_(Objet_U &) override
Associates a Sous_Domaine to the Domain.
Definition Domaine.cpp:1298
int_t nb_faces_raccord() const
Definition Domaine.h:171
double & coord(int_t i, int j)
Definition Domaine.h:111
int_t nb_faces_groupes_faces() const
Definition Domaine.h:177
const Frontiere_t & frontiere(int i) const
Definition Domaine.h:539
const DoubleTab_t & les_sommets() const
Definition Domaine.h:114
int nb_frontieres_internes() const
Definition Domaine.h:235
DoubleTab_t sommets_n
Definition Domaine.h:387
ArrOfInt_t ind_faces_virt_bord_
Definition Domaine.h:399
Noms & bords_perio()
Definition Domaine.h:279
int nb_ss_domaines() const
Definition Domaine.h:289
const Groupe_Faces_t & groupe_faces(const Nom &nom) const
Definition Domaine.h:223
int_t nb_faces_joint() const
Definition Domaine.h:168
IntTab_t & set_aretes_som()
Definition Domaine.h:159
int_t nb_faces_groupes_faces(int num_g) const
Definition Domaine.h:178
Bord_Interne_t & bords_interne(const Nom &nom)
Definition Domaine.h:210
int nb_joints() const
Definition Domaine.h:259
void add(const Sous_Domaine_t &sd)
Definition Domaine.h:294
DoubleTab getBoundingBox() const
Definition Domaine.cpp:883
_SIZE_ int_t
Definition Domaine.h:70
Frontiere_t & frontiere(const Nom &)
Definition Domaine.cpp:1094
int_t chercher_sommets(double x, double y=0, double z=0, int reel=0) const
Definition Domaine.cpp:690
Raccords_t & faces_raccord()
Definition Domaine.h:253
IntTab_t & set_elem_aretes()
Definition Domaine.h:160
IntTab_t & les_elems()
Definition Domaine.h:129
int_t nb_elem() const
Definition Domaine.h:131
const Joint_t & joint(int i) const
Definition Domaine.h:262
void resetSommetsCoordinates()
Definition Domaine.h:116
const IntTab_t & les_elems() const
Definition Domaine.h:130
void fixer_premieres_faces_frontiere()
Definition Domaine.cpp:1101
void init_renum_perio()
Initialize the renumerotation array for periodicity.
Definition Domaine.cpp:1312
int_t nb_faces_joint(int num_joint) const
Definition Domaine.h:169
Sous_Domaine_32_64< _SIZE_ > Sous_Domaine_t
Definition Domaine.h:83
const Sous_Domaine_t & ss_domaine(const Nom &nom) const
Definition Domaine.h:292
void merge_wo_vertices_with(Domaine_32_64 &z)
Merge another Domaine into this, without considering vertices which are handled separately.
Definition Domaine.cpp:1236
const OctreeRoot_t & construit_octree(int &) const
Build the octree if not already done.
Definition Domaine.cpp:832
void construire_renum_som_perio(const Conds_lim &, const Domaine_dis_base &)
Definition Domaine.cpp:2233
const Bord_Interne_t & bords_interne(const Nom &nom) const
Definition Domaine.h:211
const Bords_Internes_t & bords_int() const
Definition Domaine.h:214
Joint_t & joint(const Nom &nom)
Definition Domaine.h:263
void renum(const IntVect_t &nums)
Bords_Internes_32_64< _SIZE_ > Bords_Internes_t
Definition Domaine.h:87
Joints_32_64< _SIZE_ > Joints_t
Definition Domaine.h:94
void invalide_octree()
Definition Domaine.cpp:809
int_t nb_faces_joint(Type_Face type) const
Definition Domaine.h:170
Bords_32_64< _SIZE_ > Bords_t
Definition Domaine.h:85
int nb_faces_elem(int=0) const
Returns the number of faces of type i of the geometric elements that make up the domain.
Definition Domaine.h:484
void read_former_domaine(Entree &s, bool &read_perio)
read what was (before TRUST 1.9.2) the "domaine" part from the input stream i.e. (roughly) the elemen...
Definition Domaine.cpp:258
DoubleTabs_T< _SIZE_ > DoubleTabs_t
Definition Domaine.h:80
Bords_Internes_t & bords_int()
Definition Domaine.h:213
Bord_t & bord(int i)
Definition Domaine.h:193
void read_vertices(Entree &s)
only read vertices from the stream s
Definition Domaine.cpp:1009
int_t nb_faces_frontiere(Type_Face type) const
Returns the number of boundary faces of the domain of the specified type.
Definition Domaine.h:513
Groupes_Faces_t mes_groupes_faces_
Definition Domaine.h:418
int nb_bords() const
Definition Domaine.h:192
OWN_PTR(Elem_geom_base_32_64< _SIZE_ >) &type_elem()
Definition Domaine.h:103
Joint_t & joint(int i)
Definition Domaine.h:261
const ArrOfInt_t & get_renum_som_perio() const
Definition Domaine.h:284
int_t nb_faces_specifiques(Type_Face type) const
Returns the number of specific faces of the domain of the specified type.
Definition Domaine.h:529
OctreeRoot_32_64< _SIZE_ > OctreeRoot_t
Definition Domaine.h:82
int_t nb_aretes() const
Returns the number of real edges.
Definition Domaine.h:143
Groupes_Faces_32_64< _SIZE_ > Groupes_Faces_t
Definition Domaine.h:89
DoubleTab_t sommets_
Definition Domaine.h:386
void typer(const Nom &)
Sets the element type of the domain using the name passed as parameter.
Definition Domaine.h:457
SmallArrOfTID_t & chercher_sommets(const DoubleTab &pos, SmallArrOfTID_t &som, int reel=0) const
Definition Domaine.cpp:662
void calculer_centres_gravite_aretes(DoubleTab_t &xa) const
Computes the centers of gravity of the domain edges.
Definition Domaine.cpp:791
const Raccord_t & raccord(int i) const
Definition Domaine.h:249
Raccord_t & raccord(const Nom &nom)
Definition Domaine.h:250
const DoubleTab_t & coord_sommets() const
Definition Domaine.h:112
const ArrOfDouble & cg_moments() const
Definition Domaine.h:307
void check_domaine()
associate the read objects to the domaine and check that the reading objects are coherent
Definition Domaine.cpp:340
DoubleVect_T< _SIZE_ > DoubleVect_t
Definition Domaine.h:76
Joint_t & joint_of_pe(int)
Definition Domaine.h:596
void exporter_mon_centre_de_gravite(ArrOfDouble c)
Definition Domaine.h:309
IntTab_t elem_virt_pe_num_
Definition Domaine.h:403
const Bord_Interne_t & bords_interne(int i) const
Definition Domaine.h:209
void correct_type_of_borders_after_merge()
Correcting type of borders if they were empty before merge (ie equal to vide_0D).
Definition Domaine.cpp:1161
void ajouter(const DoubleTab_t &soms, IntVect_t &nums)
Adds nodes to the domain with elimination of duplicate nodes. On return, nums contains the new indice...
Definition Domaine.cpp:928
void saveSommetsCoordinates()
Definition Domaine.h:115
ArrOfDouble_T< _SIZE_ > ArrOfDouble_t
Definition Domaine.h:75
void build_mc_mesh(bool virt=false) const
Build the MEDCoupling mesh corresponding to the TRUST mesh.
Definition Domaine.cpp:1325
int_t arete_sommets(int_t i, int j) const
returns the number of the j-th vertex of the i-th edge.
Definition Domaine.h:152
void renum_joint_common_items(const IntVect_t &nums, const int_t elem_offset)
Renumbers the nodes and elements present in the common items of joints.
Definition Domaine.cpp:1548
int_t face_bords_interne_conjuguee(int_t face) const
Returns -1 if face is not an internal boundary face, or the index of the duplicated face otherwise.
Definition Domaine.cpp:515
SmallArrOfTID_t & indice_elements(const IntTab &som, SmallArrOfTID_t &elem, int reel=0) const
Searches the indices of elements containing the vertices specified by the "sommets" parameter.
Definition Domaine.cpp:382
OWN_PTR(Elem_geom_base_32_64< _SIZE_ >) elem_
virtual void creer_tableau_sommets(Array_base &, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT) const
Creates an array with one "row" per mesh vertex.
Definition Domaine.cpp:999
const LIST(OBS_PTR(Domaine_32_64)) &domaines_frontieres() const
Definition Domaine.h:241
virtual const MD_Vector & md_vector_elements() const
Returns the parallel descriptor of element arrays of the domain.
Definition Domaine.cpp:859
bool is_mc_mesh_ready() const
Definition Domaine.h:355
int_t elem_aretes(int_t i, int j) const
returns the number of the j-th edge of the i-th element.
Definition Domaine.h:154
Joints_t & faces_joint()
Definition Domaine.h:265
IntTab_t mes_elems_
Definition Domaine.h:391
int_t nb_som_tot() const
Returns the total number of vertices of the domain i.e. the number of real and virtual vertices on th...
Definition Domaine.h:123
Raccords_32_64< _SIZE_ > Raccords_t
Definition Domaine.h:92
double coord(int_t i, int j) const
Definition Domaine.h:110
int_t nb_som() const
Returns the number of vertices of the domain.
Definition Domaine.h:121
void ajouter(const DoubleTab_t &soms)
Adds nodes (or vertices) to the domain (without checking for duplicates).
Definition Domaine.cpp:908
int nb_groupes_faces() const
Definition Domaine.h:220
const IntTab_t & elem_aretes() const
returns the connectivity array elements/edges.
Definition Domaine.h:158
const Bords_t & faces_bord() const
Definition Domaine.h:199
const Bord_t & bord(int i) const
Definition Domaine.h:194
void ecrire_noms_bords(Sortie &) const
Writes the boundary names to an output stream.
Definition Domaine.cpp:1031
const IntTab_t & elem_virt_pe_num() const
Definition Domaine.h:365
const Joint_t & joint_of_pe(int) const
Definition Domaine.h:586
Groupes_Faces_t & groupes_faces()
Definition Domaine.h:224
Groupe_Faces_32_64< _SIZE_ > Groupe_Faces_t
Definition Domaine.h:88
IntTab_T< _SIZE_ > IntTab_t
Definition Domaine.h:73
void imprimer() const
Definition Domaine.cpp:1183
int comprimer()
Merges boundaries with the same name for: boundaries, periodic boundaries, internal boundaries and fa...
Definition Domaine.cpp:546
int nb_raccords() const
Definition Domaine.h:247
const Bord_t & bord(const Nom &nom) const
Definition Domaine.h:196
const Noms & bords_perio() const
Definition Domaine.h:278
const Groupe_Faces_t & groupe_faces(int i) const
Definition Domaine.h:222
void reordonner()
Definition Domaine.h:104
int_t sommet_elem(int_t i, int j) const
Returns the (global) number of the j-th vertex of the i-th element.
Definition Domaine.h:136
int comprimer_joints()
Merges joints with the same name.
Definition Domaine.cpp:1565
class Domaine_VF
Definition Domaine_VF.h:44
Base class for domains description. This class holds all the data shared by all domains and not sensi...
class Domaine_dis_base This class is the base of the hierarchy of discretized domains.
Class Elem_geom_base This class is the base class for the definition of elements.
Class defining operators and methods for all reading operation in an input flow (file,...
Definition Entree.h:42
Class Frontiere.
Definition Frontiere.h:32
Groupe_Face class — represents a selection of faces read from a med file.
Groupes_Faces class — represents a list of Groupe_Faces objects.
int_t nb_faces() const
Returns the total number of faces contained in the list of Groupe_Faces, i.
The Joint class is a Frontiere that contains the joint faces and vertices with the neighboring domain...
Definition Joint.h:34
Joints class — represents a list of Joint objects.
Definition Joints.h:28
int_t nb_faces() const
Returns the total number of faces in all Joints_32_64 in the list.
Definition Joints.cpp:45
: This class is an OWN_PTR but the pointed object is shared among multiple
Definition MD_Vector.h:48
class Nom: a character string for naming TRUST objects.
Definition Nom.h:31
An array of character strings (VECT(Nom)).
Definition Noms.h:26
Base class for TRUST objects (Objet_U).
Definition Objet_U.h:68
Class OctreeRoot.
Definition Octree.h:102
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
Definition Process.cpp:466
Class Raccord_base This class is simply a boundary; it is the base class of the.
Class Raccords This represents a list of Raccord type objects.
Definition Raccords.h:29
int_t nb_faces() const
Returns the total number of faces of all Raccords_32_64 in the list.
Definition Raccords.cpp:44
Reorder_Mesh allows the user to trigger the renumbering of the mesh entities.
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.
TRUST_Vector class.