TrioCFD 1.9.9_beta
TrioCFD documentation
Loading...
Searching...
No Matches
DomaineCutter.h
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#ifndef DomaineCutter_included
17#define DomaineCutter_included
18
19#include <DomaineCutter_Correspondance.h>
20#include <Static_Int_Lists.h>
21#include <TRUST_Ref.h>
22#include <Decouper.h>
23#include <Noms.h>
24
25#include <Domaine_forward.h>
26
27/*! @brief Tool class to generate sub-domains for a parallel computation from
28 * a starting domain (domaine_global) and an element partitioning array (elem_part).
29 *
30 * @sa Partitionneur_base.
31 */
32template <typename _SIZE_>
33class DomaineCutter_32_64: public Objet_U
34{
35 Declare_instanciable_32_64(DomaineCutter_32_64);
36public:
37
38 using int_t = _SIZE_;
40 using BigArrOfInt_t = BigArrOfInt_T<_SIZE_>; // always storing 'int' (=proc num) but might have a lot of entries
41 using BigIntVect_t = BigIntVect_T<_SIZE_>; // same as above, but parallel
42 using SmallArrOfTID_t = SmallArrOfTID_T<_SIZE_>;
43 using IntTab_t = IntTab_T<_SIZE_>;
45
47 using Domaine32 = Domaine_32_64<int>; // To insist on the fact that we are using *both* variant of Domains. This type is typically for (small) partial domains.
52
53 void initialiser(const Domaine_t& domaine_global, const BigIntVect_t& elem_part, const int nb_parts, const int epaisseur_joint,
54 const bool permissif=false);
55 void reset();
56
57 // NOTE: in the API below we use both
58 // - Domain_t -> which might be 64b. THis is typically the initial (big) unsplitted domain.
59 // - Domaine32 -> which is always a 32b type. This is typically used for sub-domains, which will always fit in the 32b limit
60 void construire_sous_domaine(const int part, DomaineCutter_Correspondance_t& correspondance, Domaine32& sous_domaine, const Static_Int_Lists_t *som_raccord=nullptr) const;
61 void construire_sous_domaine(const int part, Domaine32& sous_domaine) const
62 {
63 DomaineCutter_Correspondance_t correspondance;
64 construire_sous_domaine(part, correspondance, sous_domaine);
65 }
66
67 void ecrire_domaines(const Nom& basename, const DomainesFileOutputType format, const int reorder, const Static_Int_Lists_t *som_raccord=nullptr);
68 inline const Noms& bords_internes() const { return bords_a_pb_; }
69
70private:
71 void construire_faces_bords_ssdom(const BigArrOfInt_t& liste_inverse_sommets, const int partie, Domaine32& domaine_partie) const;
72 void construire_faces_raccords_ssdom(const BigArrOfInt_t& liste_inverse_sommets, const int partie, Domaine32& domaine_partie) const;
73 void construire_frontieres_internes_ssdom(const BigArrOfInt_t& liste_inverse_sommets, const int partie, Domaine32& domaine_partie) const;
74 void construire_groupe_faces_ssdom(const BigArrOfInt_t& liste_inverse_sommets, const int partie, Domaine32& domaine_partie) const;
75 void construire_sommets_joints_ssdom(const SmallArrOfTID_t& liste_sommets, const BigArrOfInt_t& liste_inverse_sommets, const int partie,
76 const Static_Int_Lists_t *som_raccord, Domaine32& domaine_partie) const;
77
78 void construire_faces_joints_ssdom(const int partie, const DomaineCutter_Correspondance_t& correspondance, Domaine32& domaine_partie) const;
79
80 void construire_elements_distants_ssdom(const int partie, const SmallArrOfTID_t& liste_sommets, const BigArrOfInt_t& liste_inverse_elements, Domaine32& domaine_partie) const;
81
82 void writeData(const Domaine32& sous_domaine, Sortie& os) const;
83
84 void ajouter_joints(Domaine32& domaine, const ArrOfInt& voisins) const;
85 void parcourir_epaisseurs_elements(SmallArrOfTID_t liste_sommets_depart, const int partie_a_ignorer, SmallArrOfTID_t& liste_elements_trouves) const;
86
87
88 // Do not use these two methods:
89 const DomaineCutter_32_64& operator=(const DomaineCutter_32_64& dc) = delete;
90 DomaineCutter_32_64(const DomaineCutter_32_64& dc) : Objet_U() { abort(); Process::exit(-1); } // Can't use delete because of TRUST macros ...
91
92 // Reference to the global domain
93 OBS_PTR(Domaine_t) ref_domaine_;
94 // Reference to the partitioning array
95 // (for each element of the global domain, sub-domain number)
96 OBS_PTR(BigIntVect_t) ref_elem_part_;
97 // Total number of parts (>= max_array(elem_part) + 1)
98 int nb_parties_ = -1;
99 // Joint thickness
100 int epaisseur_joint_ = -1;
101 // Vertex-element connectivity of the global domain:
102 Static_Int_Lists_t som_elem_;
103 // For each part, list of elements of the source domain belonging to this part
104 Static_Int_Lists_t liste_elems_sous_domaines_;
105 // For each boundary of the source domain, list of elements adjacent to
106 // each face of the boundary
107 Static_Int_Lists_t voisins_bords_;
108 Noms bords_a_pb_;
109};
110
111using DomaineCutter = DomaineCutter_32_64<int>;
112using DomaineCutter_64 = DomaineCutter_32_64<trustIdType>;
113
114#endif
Interprete Decouper.
Definition Decouper.h:36
Tool class to generate sub-domains for a parallel computation from a starting domain (domaine_global)...
Domaine_32_64< _SIZE_ > Domaine_t
BigArrOfInt_T< _SIZE_ > BigArrOfInt_t
BigIntVect_T< _SIZE_ > BigIntVect_t
void ecrire_domaines(const Nom &basename, const DomainesFileOutputType format, const int reorder, const Static_Int_Lists_t *som_raccord=nullptr)
Generation of all sub-domains of the computation and writing to disk of the files basename_000n.
void reset()
cancels all references and empties the arrays
void construire_sous_domaine(const int part, Domaine32 &sous_domaine) const
IntTab_T< _SIZE_ > IntTab_t
const Noms & bords_internes() const
void initialiser(const Domaine_t &domaine_global, const BigIntVect_t &elem_part, const int nb_parts, const int epaisseur_joint, const bool permissif=false)
Prepares the data structures for building sub-domains based on a partitioning provided in elem_part.
Domaine_32_64< int > Domaine32
void construire_sous_domaine(const int part, DomaineCutter_Correspondance_t &correspondance, Domaine32 &sous_domaine, const Static_Int_Lists_t *som_raccord=nullptr) const
Fills the "correspondance" structure and the "sous_domaine" for part "part".
SmallArrOfTID_T< _SIZE_ > SmallArrOfTID_t
Static_Int_Lists_32_64< _SIZE_ > Static_Int_Lists_t
Frontiere_32_64< _SIZE_ > Frontiere_t
DomaineCutter_Correspondance_32_64< _SIZE_ > DomaineCutter_Correspondance_t
TRUSTArray< _SIZE_, _SIZE_ > ArrOfInt_t
Decouper_32_64< _SIZE_ > Decouper_t
Sous_Domaine_32_64< _SIZE_ > Sous_Domaine_t
Helper structure holding the correspondence between vertex and element indices of the global domain a...
class Domaine_32_64 A Domain is a mesh composed of a set of geometric elements of the same type.
Definition Domaine.h:62
Class Frontiere.
Definition Frontiere.h:32
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
Objet_U()
Default constructor: assigns a unique identifier to the object (object_id_) and registers the object ...
Definition Objet_U.cpp:54
static void abort()
Abort routine for TRUST on a fatal error.
Definition Process.cpp:573
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
Definition Process.cpp:466
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.
This class allows storing lists of integers accessible in constant time.
Represents a an array of int/int64/double/... values.
Definition TRUSTArray.h:81