15#include <Partitionneur_Ptscotch.h>
17#include <Static_Int_Lists.h>
18#include <ptscotch++.h>
20#include <Domain_Graph.h>
21#include <communications.h>
22#include <Poly_geom_base.h>
23#include <Matrix_tools.h>
24#include <Matrice_Morse.h>
25#include <Array_tools.h>
26#include <Comm_Group_MPI.h>
27#include <MD_Vector_tools.h>
30inline void not_implemented(
const Nom& chaine)
32 Cerr << chaine <<
" is not implemented yet to the Ptscotch API." << finl;
36Implemente_instanciable_sans_constructeur(
Partitionneur_Ptscotch,
"Partitionneur_Ptscotch",Partitionneur_base);
38Partitionneur_Ptscotch::Partitionneur_Ptscotch()
44 Cerr <<
"Partitionneur_Ptscotch::printOn invalid\n" << finl;
53 param.
ajouter_condition(
"(value_of_nb_parts_ge_1)_and_(value_of_nb_parts_le_100000)",
"The following condition must be satisfied : 1 <= nb_parties <= 100000");
64 ref_domaine_ = domaine;
75 Cerr <<
"Ptscotch is not compiled with this version. Use another partition tool like Tranche." << finl;
80 Cerr <<
"Error in Partitionneur_Ptscotch::construire_partition\n";
81 Cerr <<
" The domain has not been associated" << finl;
86 Cerr <<
"Error in Partitionneur_Ptscotch::construire_partition\n";
87 Cerr <<
" The parts number has not been initialized" << finl;
96 int nb_elem = ref_domaine_->nb_elem();
102 if (ref_domaine_->nb_elem() == 0)
105 Cerr <<
"Partitionneur_Ptscotch::construire_partition" << finl;
106 Cerr <<
" Construction of graph connectivity..." << finl;
107 Static_Int_Lists graph_elements_perio;
112 graph_elements_perio);
115 const int n = ref_domaine_->nb_elem();
116 SCOTCH_Num* partition =
new SCOTCH_Num[n];
118 SCOTCH_randomReset();
119 SCOTCH_Dgraph scotch_graph;
120 SCOTCH_dgraphInit(&scotch_graph, Comm_Group_MPI::get_trio_u_world());
121 SCOTCH_dgraphBuild(&scotch_graph,
134 SCOTCH_Strat scotch_strategy;
135 SCOTCH_stratInit(&scotch_strategy);
137 SCOTCH_dgraphPart(&scotch_graph,nb_parties_,&scotch_strategy,partition);
139 SCOTCH_stratExit(&scotch_strategy);
140 SCOTCH_dgraphExit(&scotch_graph);
143 for (
int i = 0; i < n; i++)
144 elem_part[i] =
static_cast<int>(partition[i]);
151 Cerr <<
"Correction of the partition for the periodicity" << finl;
155 Cerr <<
" If this number is high, we can improve the splitting with the option use_weights\n"
156 <<
" but it takes more memory)" << finl;
159 Cerr <<
"Correction elem0 on processor 0" << finl;
Build the graph of the domain that the METIS/PARMETIS/PTSCOTCH libraries need.
void construire_graph_elem_elem(const Domaine_32_64< _SIZE_ > &dom, bool use_weights, Static_Int_Lists_32_64< _SIZE_ > &graph_elements_perio)
Une chaine de caractere (Nom) en majuscules.
class Nom Une chaine de caractere pour nommer les objets de TRUST
virtual void set_param(Param &) const
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_flag(const char *keyword, const bool *value)
Register a boolean flag whose mere presence switches it to true.
void ajouter_condition(const char *condition, const char *message, const char *name=0)
Declare a post-read logical condition that must hold on the parameter values.
void ajouter(const char *keyword, const int *value, Param::Nature nat=Param::OPTIONAL)
Register an integer parameter.
Partition d'un domaine en nb_parties parties equilibrees en utilisant la librairie Ptscotch.
void associer_domaine(const Domaine &domaine) override
int lire_motcle_non_standard(const Motcle &, Entree &) override
Lecture des parametres de type non simple d'un objet_U a partir d'un flot d'entree.
void construire_partition(IntVect &elem_part, int &nb_parts_tot) const override
Calcule le graphe de connectivite, appelle le partitionneur et remplit elem_part (pour chaque element...
int lire_motcle_non_standard(const Motcle &, Entree &) override
static void corriger_bords_avec_liste(const Domaine_t &dom, const int_t my_offset, BigIntVect_ &elem_part)
static void corriger_elem0_sur_proc0(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.
int_t get_nb_lists() const
renvoie le nombre de listes stockees
void resize_array(_SIZE_ new_size, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)
virtual void echange_espace_virtuel(IsExchangeBlocking exchange_type=IsExchangeBlocking::DefaultBlocking, const std::string kernel_name="noname")