16#include <Partitionneur_Sous_Domaines.h>
17#include <Synonyme_info.h>
19#include <Sous_Domaines.h>
21#include <Interprete.h>
32Partitionneur_Sous_Domaines::Partitionneur_Sous_Domaines()
39 Cerr <<
"Partitionneur_Sous_Domaines::printOn invalid\n" << finl;
56 Cerr <<
" Error: the domain has not been associated" << finl;
59 param.
ajouter(
"sous_zones",&noms_sous_domaines_);
61 param.
ajouter(
"domaines",&noms_domaines_);
70 ref_domaine_ = domaine;
81 noms_sous_domaines_ = noms_sous_domaines;
100 const Domaine& dom = ref_domaine_.valeur();
102 elem_part.
resize(nb_elem);
104 if (noms_domaines_.size()!=0 && noms_sous_domaines_.size())
106 Cerr <<
"Can't mix sous_domaines and domaines yet in sous_domaines partitionner." << finl;
112 if (noms_domaines_.size()!=0)
114 for (
int i=0; i<noms_domaines_.size(); i++)
116 const Nom& nom_domaine = noms_domaines_[i];
117 if (!
interprete().objet_existant(nom_domaine) || !sub_type(Domaine,
interprete().objet(nom_domaine)))
120 Cerr <<
"Domain " << nom_domaine <<
" is not existing." << finl;
124 const Domaine& domaine = ref_cast(Domaine,
interprete().objet(nom_domaine));
125 DoubleTab domaine_xp;
126 domaine.calculer_centres_gravite(domaine_xp);
127 IntVect dom_cells_containing_domaine_cells;
129 Cerr <<
" Allocation of elements of the domain " << domaine.
le_nom() <<
" to the processor " << pe << finl;
130 for (
int cell = 0; cell < dom_cells_containing_domaine_cells.
size(); cell++)
132 int elem = dom_cells_containing_domaine_cells[cell];
133 if (elem_part[elem] < 0)
136 elem_part[elem] = pe;
139 Cerr <<
" Number of elements attributed to the processor " << pe <<
" : " << count << finl;
145 Noms noms_sous_domaines(noms_sous_domaines_);
150 noms_sous_domaines.dimensionner_force(liste.size());
151 for (
int i=0; i<liste.size(); i++) noms_sous_domaines[i]=liste[i].
le_nom();
154 const int toutes_sous_domaines = (noms_sous_domaines.size() == 0);
155 if (toutes_sous_domaines)
156 Cerr <<
" No subarea specified, we use all existing subareas." << finl;
157 for (
int i_sous_domaine = 0; i_sous_domaine < nb_sous_domaines; i_sous_domaine++)
159 const Sous_Domaine& sous_domaine = dom.
ss_domaine(i_sous_domaine);
161 bool sous_domaine_trouvee = noms_sous_domaines.
contient_(nom);
162 if (!toutes_sous_domaines && !sous_domaine_trouvee)
166 const int nb_elem_ssz = sous_domaine.
nb_elem_tot();
167 for (
int i = 0; i < nb_elem_ssz; i++)
169 const int elem = sous_domaine[i];
170 if (elem_part[elem] < 0)
173 elem_part[elem] = pe;
176 Cerr <<
" Allocation of " << count <<
" elements from the subarea " << nom <<
" to the processor " << pe << finl;
181 for (
int elem = 0; elem < nb_elem; elem++)
183 if (elem_part[elem] < 0)
186 elem_part[elem] = pe;
189 if (count>0) Cerr <<
" Allocation of the remaining " << count <<
" elements to the processor " << pe << finl;
197 if (ref_domaine_->bords_perio().size() > 0)
const Sous_Domaine_t & ss_domaine(int i) const
int_t nb_elem_tot() const
SmallArrOfTID_t & chercher_elements(const DoubleTab &pos, SmallArrOfTID_t &elem, int reel=0) const
Recherche des elements contenant les points dont les coordonnees sont specifiees.
int nb_ss_domaines() const
static Objet_U & objet(const Nom &)
Voir Interprete_bloc::objet_global() BM: la classe Interprete n'est pas le meilleur endroit pour cett...
class Nom Une chaine de caractere pour nommer les objets de TRUST
Un tableau de chaine de caracteres (VECT(Nom)).
int contient_(const char *const ch) const
virtual void set_param(Param &) const
const Interprete & interprete() const
virtual const Nom & le_nom() const
Donne le nom de l'Objet_U Methode a surcharger : renvoie "neant" dans cette implementation.
virtual Sortie & printOn(Sortie &) const
Ecriture de l'objet sur un flot de sortie Methode a surcharger.
Helper class to factorize the readOn method of Objet_U classes.
void ajouter(const char *keyword, const int *value, Param::Nature nat=Param::OPTIONAL)
Register an integer parameter.
Partitionneur de domaine a partir de sous-domaines du domaine Voir construire_partition().
void associer_domaine(const Domaine &domaine) override
Premiere etape d'initialisation du partitionneur: on associe un domaine.
void initialiser(const Noms &noms_sous_domaines)
Deuxieme etape d'initialisation: on definit les sous_domaines a utiliser.
void construire_partition(IntVect &elem_part, int &nb_parts_tot) const override
Chaque sous-domaine de noms_sous_domaines_ definit les elements attribues a un processeur.
static void corriger_bords_avec_liste(const Domaine_t &dom, const int_t my_offset, BigIntVect_ &elem_part)
static void exit(int exit_code=-1)
Routine de sortie de TRUST dans une region Kokkos.
Classe de base des flux de sortie.
const Nom & le_nom() const override
Donne le nom de l'Objet_U Methode a surcharger : renvoie "neant" dans cette implementation.
int_t nb_elem_tot() const
Un vecteur de Sous_Domaine (VECT(Sous_Domaine)).
void resize(_SIZE_, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)