TRUST 1.9.8
HPC thermohydraulic platform
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 Classe outil permettant de generer des sous-domaines pour un calcul parallele a partir
28 * d'un domaine de depart (domaine_global) et d'un tableau de decoupage des elements de ce domaine (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 // Ne pas utiliser ces deux methodes:
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 au domaine global
93 OBS_PTR(Domaine_t) ref_domaine_;
94 // Reference au tableau de decoupage
95 // (pour chaque element du domaine global, numero de sous-domaine)
96 OBS_PTR(BigIntVect_t) ref_elem_part_;
97 // Nombre total de parties (>= a max_array(elem_part) + 1)
98 int nb_parties_ = -1;
99 // Epaisseur du joint
100 int epaisseur_joint_ = -1;
101 // Connectivite sommets_elements du domaine global:
102 Static_Int_Lists_t som_elem_;
103 // Pour chaque partie, liste des elements du domaine source de cette partie
104 Static_Int_Lists_t liste_elems_sous_domaines_;
105 // Pour chaque frontiere du domaine source, liste des elements adjacent a
106 // chaque face de la frontiere
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
Classe outil permettant de generer des sous-domaines pour un calcul parallele a partir d'un domaine d...
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 de tous les sous-domaines du calcul et ecriture sur disque des fichiers basename_000n.
void reset()
annule toutes les references et vide les tableaux
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)
Prepare les structures de donnees pour la construction des sous-domaines en fonction d'un decoupage f...
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
Remplit la structure "correspondance" et le "sous_domaine" pour la partie "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
Structure outil contenant la correspondance entre les indices de sommets et d'elements du domaine glo...
classe Domaine_32_64 un Domaine est un maillage compose d'un ensemble d'elements geometriques de meme...
Definition Domaine.h:62
Classe Frontiere.
Definition Frontiere.h:32
class Nom Une chaine de caractere pour nommer les objets de TRUST
Definition Nom.h:31
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
Objet_U()
Constructeur par defaut : attribue un numero d'identifiant unique a l'objet (object_id_),...
Definition Objet_U.cpp:55
static void abort()
Routine de sortie de Trio-U sur une erreur abort().
Definition Process.cpp:570
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
Sous_Domaine represents a volumic sub-domain i.e. a sub set of elements of a Domaine.
Cette classe permet de stocker des listes d'entiers accessibles en temps constant.
Represents a an array of int/int64/double/... values.
Definition TRUSTArray.h:81