19#include <LecFicDistribueBin.h>
21#include <Connectivite_som_elem.h>
22#include <Schema_Comm.h>
23#include <Faces_builder.h>
24#include <Domaine_VF.h>
25#include <Reordonner_faces_periodiques.h>
26#include <communications.h>
27#include <MD_Vector_tools.h>
28#include <MD_Vector_std.h>
29#include <MD_Vector_seq.h>
31#include <Poly_geom_base.h>
32#include <Entree_Brute.h>
33#include <Comm_Group_MPI.h>
34#include <FichierHDFPar.h>
35#include <LecFicDiffuse.h>
36#include <Format_Post_Lata.h>
37#include <EFichierBin.h>
38#include <Array_tools.h>
39#include <Perf_counters.h>
76 return le_domaine.valeur();
82void dump_lata(
const Domaine& dom)
85 Nom nom_fichier_lata(
"espaces_virtuels");
88 constexpr int IS_FIRST = 1;
95 Noms units, noms_compo;
99 for(
int ij = 0; ij < nb_joints; ij++)
104 for (
int i = 0; i < nt1; i++) data[t1[i]] += 1;
137 if (n !=
";" && n !=
"unlock;")
139 Cerr <<
"Error ! You ran a sequential calculation and can't use Scatter keyword here. Run a parallel calculation or remove this keyword." << finl;
142 Cerr <<
"Scatter: preparing domain structure\n"
143 <<
" (this is workaround for bugged domain operators that don't do it)" << finl;
147 if(!sub_type(Domaine, obj))
149 Cerr <<
"obj : " << obj <<
" is not an object of type Domain !" << finl;
152 Domaine& dom = ref_cast(Domaine, obj);
161 static int gdb_non_lance=1;
162 char* TRUST_GDB=getenv(
"TRUST_GDB");
163 if (gdb_non_lance && ((
Motcle)nomentree==
"DEBUG" || TRUST_GDB!=
nullptr))
166 if ((
Motcle)nomentree==
"DEBUG") is >> nomentree;
169 Cerr <<
"Enter \"return\" to this window after" << finl;
170 Cerr <<
"typing \"cont\" in other gdb windows." << finl;
171 Cerr << (int)system (
"sh -c read ok") << finl;
175 Nom getpidn((
int)getpid());
177 Nom command0=
"echo attach ";
181 Cerr << (int)system(command0) << finl;
182 command0=
" ls -l /proc/";
184 command0+=
"/exe | awk '{print $NF}' > execname";
185 Cerr << (int)system(command0) << finl;
186 Nom command=
"[ -f /usr/X11R6/bin/xterm ] && x=\"/usr/X11R6/bin/xterm -exec gdb -x \";";
187 command+=
"[ -f /usr/bin/konsole ] && x=\"/usr/bin/konsole -e gdb -x \";";
190 command+=
" `cat execname` ";
192 Cerr<<
"command: " <<command<<finl;
193 Cerr << (int)system(command) << finl;
200 Cerr <<
"Execution of the Scatter module." << finl;
202 statistics().begin_count(STD_COUNTERS::interprete_scatter,statistics().get_last_opened_counter_level()+1);
207 if(!sub_type(Domaine, obj))
209 Cerr <<
"Error in Scatter: object of type '" << obj.
que_suis_je() <<
"' when Domaine was expected!" << finl;
212 Domaine& dom = ref_cast(Domaine, obj);
218 Cerr <<
"Reading the domain" << finl;
223 Cerr <<
"Calculation of renum_items_communs for the nodes" << finl;
231 Cerr <<
"Construire_structures_paralleles" << finl;
238 Cerr <<
"End Distribue_domaines" << finl;
240 Cerr <<
"\nQuality of partitioning --------------------------------------------" << finl;
242 Cerr <<
"\nTotal nb of elements = " << total_nb_elem << finl;
246 double mean_element_domaine = (double)(total_nb_elem /
Process::nproc());
247 Cerr <<
"Min number of elements on a Domaine = " << min_element_domaine << finl;
248 Cerr <<
"Max number of elements on a Domaine = " << max_element_domaine << finl;
249 Cerr <<
"Mean number of elements per Domaine = " << (int)(mean_element_domaine) << finl;
250 double load_imbalance = max_element_domaine / mean_element_domaine;
251 Cerr <<
"Load imbalance = " << load_imbalance <<
"\n" << finl;
253 Elem_geom_base& elem=dom.type_elem().valeur();
254 if (sub_type(Poly_geom_base,elem))
255 ref_cast(Poly_geom_base,elem).compute_virtual_index();
258 double temps = statistics().get_time_since_last_open(STD_COUNTERS::interprete_scatter);
259 Cerr <<
"Scatter time : " << temps << finl;
261 statistics().end_count(STD_COUNTERS::interprete_scatter);
274 const int nb_joints = joints.size();
283 const int myDomaineWasMerged = mergedDomaines[moi];
285 for (
int i_joint = 0; i_joint < nb_joints; i_joint++)
288 const int pe_voisin = joints[i_joint].PEvoisin();
289 const int neighbourDomaineWasMerged = mergedDomaines[pe_voisin];
290 if(myDomaineWasMerged && neighbourDomaineWasMerged)
297 else if(myDomaineWasMerged && !neighbourDomaineWasMerged)
299 else if(!myDomaineWasMerged && neighbourDomaineWasMerged)
307 DoubleTabs coord_items_locaux(nb_joints);
308 DoubleTabs coord_items_distants(nb_joints);
309 for (
int i_joint = 0; i_joint < nb_joints; i_joint++)
311 const Joint& joint = joints[i_joint];
313 const int nb_items_communs = items_communs.
size_array();
315 DoubleTab& coord = coord_items_locaux[i_joint];
317 for (
int i = 0; i < nb_items_communs; i++)
319 coord(i,j) = coords(items_communs[i], j);
327 for (
int i = 0; i < nb_joints; i++)
329 const int pe_voisin = joints[i].PEvoisin();
330 const int neighbourDomaineWasMerged = mergedDomaines[pe_voisin];
331 if( neighbourDomaineWasMerged && !(myDomaineWasMerged && pe_voisin<moi) )
334 buffer << coord_items_locaux[i];
339 if(myDomaineWasMerged)
341 for (
int i = 0; i < nb_joints; i++)
343 const int pe_voisin = joints[i].PEvoisin();
344 const int neighbourDomaineWasMerged = mergedDomaines[pe_voisin];
345 if(!(neighbourDomaineWasMerged && pe_voisin>moi))
348 buffer >> coord_items_distants[i];
357 if(myDomaineWasMerged)
359 for (
int i_joint = 0; i_joint < nb_joints; i_joint++)
362 const int pe_voisin = joints[i_joint].PEvoisin();
363 const int neighbourDomaineWasMerged = mergedDomaines[pe_voisin];
364 if(neighbourDomaineWasMerged && pe_voisin>moi)
366 ArrOfInt& items_communs = dom.
faces_joint()[i_joint].set_joint_item(JOINT_ITEM::SOMMET).set_items_communs();
367 const ArrOfInt old_items_communs = joints[i_joint].joint_item(JOINT_ITEM::SOMMET).items_communs();
368 const int nb_items = items_communs.
size_array();
369 const DoubleTab& coord_voisin = coord_items_distants[i_joint];
370 const DoubleTab& my_coord = coord_items_locaux[i_joint];
372 for(
int i=0; i<nb_items; i++)
374 for(
int j=0; j<nb_items; j++)
378 ok=ok&&(est_egal(coord_voisin(i,dir),my_coord(j,dir)));
381 items_communs[i] = old_items_communs[j];
397 Domaine& dom = le_domaine.valeur();
399 Cerr <<
"\treading vertices..." << finl;
400 Domaine dom_tmp_for_vertices;
403 Cerr <<
"\tDone !\n\treading elem infos (domaines)..." << finl;
408 Domaine domaine_read;
409 if(nom!=(
const char*)
"vide")
412 Process::exit(
"Error: Scatter::read_domain_no_comm() -- One expected an opened bracket { to start.");
416 Process::exit(
"Error: Scatter::read_domain_no_comm() -- Empty list ?! Should not happen?");
417 Cerr <<
"Done!" << finl;
429 domaine_read.
renum(nums);
440 const int nb_joints = domaine_read.
nb_joints();
441 for (
int i_joint = 0; i_joint < nb_joints; i_joint++)
443 const Joint& joint_to_add = domaine_read.
faces_joint()[i_joint];
445 int my_joint_index = 0;
450 ArrOfInt& items_communs = dom.
faces_joint()[my_joint_index].set_joint_item(JOINT_ITEM::SOMMET).set_items_communs();
452 for(
int index=0; index<sommets_to_add.
size_array(); index++)
454 array_trier_retirer_doublons(items_communs);
457 ArrOfInt& items_distants = dom.
faces_joint()[my_joint_index].set_joint_item(JOINT_ITEM::ELEMENT).set_items_distants();
459 for(
int index=0; index<elements_to_add.
size_array(); index++)
473 Cerr <<
"Reading geometry from .Zones file(s) ..." << finl;
489 Cerr <<
"Error: You probably made a single_hdf partitioning and using the wrong name of .Zones files in the scatter" << finl;
490 Cerr <<
"You should remove '_p" <<
Process::nproc() <<
"' from the name of .Zones file (" << nomentree <<
") in your datafile" << finl;
494 statistics().begin_count(STD_COUNTERS::read_scatter,statistics().get_last_opened_counter_level()+1);
497 bool domain_not_built =
true;
498 bool read_perio =
false;
504 fic_hdf.
open(nomentree,
true);
506 std::string dname =
"/zone_" + std::to_string(
Process::me());
507 bool ok = fic_hdf.
exists(dname.c_str());
514 std::string tmp = dname +
"_" + std::to_string(i);
516 bool exists = fic_hdf.
exists(tmp.c_str());
519 Nom dataset_name(dname);
527 data_part >> liste_bords_periodiques;
528 domain_not_built =
false;
544 data >> liste_bords_periodiques;
545 domain_not_built =
false;
553 int isSingleDomaine = fichier_binaire.
ouvrir(nomentree);
554 if (!isSingleDomaine)
563 tmp += std::to_string(i);
565 Nom nomentree_part(tmp);
566 int ok = fichier_binaire_part.
ouvrir(nomentree_part);
574 fichier_binaire_part >> liste_bords_periodiques;
575 fichier_binaire_part.
close();
576 domain_not_built =
false;
589 fichier_binaire >> liste_bords_periodiques;
590 fichier_binaire.
close();
591 domain_not_built =
false;
597 Cerr <<
"Error in Scatter::lire_domaine\n";
598 Cerr <<
"The domain on the current process hasn't been built" << finl;
599 Cerr <<
"The number of processes you mentionned is probaly higher than the number of domaines" << finl;
610 const int nb_joints = joints.size();
611 int max_pe_voisin = 0;
612 for (
int i = 0; i < nb_joints; i++)
614 const int pe_voisin = joints[i].PEvoisin();
615 if (pe_voisin >= max_pe_voisin)
616 max_pe_voisin = pe_voisin;
619 max_pe_voisin = (int)
mp_max(max_pe_voisin);
621 if (max_pe_voisin >=
nproc()) ok=0;
624 Cerr <<
"Error in Scatter::lire_domaine\n"
625 <<
"The domain has been partitioned with at least " << max_pe_voisin <<
" "
626 <<
"domaines whereas the number of processes asked is " <<
Process::nproc() <<
"." << finl;
627 Cerr <<
"The number of domaines and number of processes must match." << finl;
635 envoyer_all_to_all(mergedDomaines, mergedDomaines);
641 Cerr <<
" Number of nodes: " << nbsom << finl;
646 const int myDomaineWasMerged = mergedDomaines[
Process::me()];
647 if(myDomaineWasMerged)
649 for(
auto& itr : liste_bords_periodiques)
652 Bord& bord = dom.
bord(bp_nom);
663 statistics().end_count(STD_COUNTERS::read_scatter);
687 if (liste_bords_periodiques.size() > 0)
714 const int nb_joints = joints.size();
715 ArrOfInt pe_voisins(nb_joints);
716 for (
int i = 0; i < nb_joints; i++)
717 pe_voisins[i] = joints[i].PEvoisin();
720 Joints anciens_joints(joints);
721 for (
int i = 0; i < nb_joints; i++)
724 const int pe_voisin = pe_voisins[i];
727 for (i_old = 0; i_old < nb_joints; i_old++)
728 if (anciens_joints[i_old].PEvoisin() == pe_voisin)
730 assert(i_old < nb_joints);
731 joints[i] = anciens_joints[i_old];
737static int ajouter_joint(Domaine& domaine,
int pe)
739 Joints& joints = domaine.faces_joint();
740 const int i_joint = joints.size();
743 for (
int i = 0; i < i_joint; i++)
744 if (joints[i].PEvoisin() == pe)
748 Joint& joint = joints.add(Joint());
751 int ep = (i_joint > 0) ? joints[0].epaisseur() : 1;
760 for (
int t = 0; t < 5; t++)
766 type = JOINT_ITEM::SOMMET;
769 type = JOINT_ITEM::ELEMENT;
772 type = JOINT_ITEM::FACE;
775 type = JOINT_ITEM::ARETE;
778 type = JOINT_ITEM::FACE_FRONT;
781 Cerr <<
"Error in Scatter.cpp : ajouter_joint" << finl;
784 type = JOINT_ITEM::SOMMET;
820 const int nb_items_reels,
821 const ArrsOfInt& items_to_send,
822 const JOINT_ITEM type_item)
827 << (int)type_item << finl;
829 Joints& joints =
domaine.faces_joint();
835 IntTab num_global_items(nb_items_reels, 2);
839 for (i = 0; i < nb_items_reels; i++)
841 num_global_items(i, 0) = i;
842 num_global_items(i, 1) = moi;
844 const int nb_joints = joints.size();
845 for (
int i_joint = 0; i_joint < nb_joints; i_joint++)
847 const Joint& joint = joints[i_joint];
848 const int pe_voisin = joint.
PEvoisin();
850 const int nb_items_communs = renum_items_communs.
dimension(0);
851 for (i = 0; i < nb_items_communs; i++)
853 const int num_item_distant = renum_items_communs(i, 0);
854 const int num_item_local = renum_items_communs(i, 1);
855 const int pe_actuel = num_global_items(num_item_local, 1);
856 if (pe_voisin < pe_actuel)
858 num_global_items(num_item_local, 0) = num_item_distant;
859 num_global_items(num_item_local, 1) = pe_voisin;
880 const int nb_joints = joints.size();
881 ArrOfInt liste_voisins(nb_joints);
883 for (
int i_joint = 0; i_joint < nb_joints; i_joint++)
884 liste_voisins[i_joint] = joints[i_joint].PEvoisin();
893 for (
int pe_destination = 0; pe_destination < nb_procs; pe_destination++)
895 const ArrOfInt& items = items_to_send[pe_destination];
897 for (
int i_item = 0; i_item < nb_items; i_item++)
899 const int item = items[i_item];
900 const int item_distant = num_global_items(item, 0);
901 const int pe_item_owner = num_global_items(item, 1);
906 if (pe_item_owner != pe_destination)
907 schema_comm.
send_buffer(pe_item_owner) << item_distant << pe_destination;
918 ArrsOfInt items_distants(
nproc);
922 for (
int i_source = 0; i_source < nb_joints + 1; i_source++)
924 const int pe_source =
925 (i_source < nb_joints) ? liste_voisins[i_source] :
Process::me();
933 buffer >> item_distant >> pe_distant;
937 ArrOfInt& array = items_distants[pe_distant];
946 ArrOfInt joint_of_pe(
nproc);
948 for (
int i_joint = 0; i_joint < nb_joints; i_joint++)
950 const int pe = joints[i_joint].PEvoisin();
951 joint_of_pe[pe] = i_joint;
955 ArrOfInt items_communs_tri;
957 for (
int pe = 0; pe <
nproc; pe++)
959 ArrOfInt& items = items_distants[pe];
961 array_trier_retirer_doublons(items);
963 const int i_joint = joint_of_pe[pe];
967 joints[i_joint].joint_item(type_item).items_communs();
969 array_retirer_elements(items, items_communs_tri);
981 ArrOfInt nouveaux_voisins;
984 for (i = 0; i <
nproc; i++)
985 if (items_distants[i].size_array() > 0)
991 << nouveaux_voisins << finl;
994 Joints& joints_non_const =
domaine.faces_joint();
995 const int nb_new_joints = joints_non_const.size();
997 for (
int i_joint = 0; i_joint < nb_new_joints; i_joint++)
999 Joint& joint = joints_non_const[i_joint];
1002 joint_items_distants = items_distants[pe];
1004 <<
" Number of remote items : "
1005 << joint_items_distants.
size_array() << finl;
1013 if(*(
char *)&x == 1)
1014 return "little-endian";
1016 return "big-endian";
1029 ArrOfInt& pe_voisins)
1031 Joints& joints =
domaine.faces_joint();
1039 reverse_send_recv_pe_list(pe_voisins, liste_pe);
1042 for (
int i = 0; i < n; i++)
1044 array_trier_retirer_doublons(pe_voisins);
1049 const int n = joints.size();
1051 for (
int i = 0; i < n; i++)
1052 liste_pe[i] = joints[i].PEvoisin();
1053 array_retirer_elements(pe_voisins, liste_pe);
1060 for (
int i = 0; i < n; i++)
1061 ajouter_joint(
domaine, pe_voisins[i]);
1081static void calculer_espace_distant_item(Domaine& le_dom,
1082 const JOINT_ITEM type_item,
1083 const IntTab& connectivite_elem_item,
1084 const int nb_items_reels,
1085 const ArrOfInt& items_lies)
1091 const int nb_joints = joints.size();
1093 const int nb_items_par_element = connectivite_elem_item.
dimension(1);
1095 ArrsOfInt items_to_send(nproc);
1097 ArrOfInt liste_items;
1101 const int flag_items_lies = (items_lies.
size_array() > 0);
1102 assert(flag_items_lies == 0 || items_lies.
size_array() == nb_items_reels);
1105 for (
int i_joint = 0; i_joint < nb_joints; i_joint++)
1107 const Joint& joint = joints[i_joint];
1108 const int pe_voisin = joint.
PEvoisin();
1110 const int nb_elems_dist = esp_dist_elems.
size_array();
1114 for (
int i_elem = 0; i_elem < nb_elems_dist; i_elem++)
1116 const int elem = esp_dist_elems[i_elem];
1117 for (
int i_item = 0; i_item < nb_items_par_element; i_item++)
1119 const int item = connectivite_elem_item(elem, i_item);
1124 if (flag_items_lies)
1126 const int item_lie = items_lies[item];
1127 if (item_lie != item)
1129 assert(item_lie >= 0 && item_lie < nb_items_reels);
1130 assert(items_lies[item_lie] == item_lie);
1137 array_trier_retirer_doublons(liste_items);
1139 items_to_send[pe_voisin] = liste_items;
1158 Cerr <<
"Scatter::calculer_espace_distant_sommets : start" << finl;
1160 const IntTab& connectivite_elem_som = dom.
les_elems();
1161 const int nb_sommets_reels = dom.
nb_som();
1163 ArrOfInt renum_som_perio(nb_sommets_reels);
1165 for (
int i = 0; i < nb_sommets_reels; i++)
1166 renum_som_perio[i] = i;
1170 calculer_espace_distant_item(dom,
1172 connectivite_elem_som,
1181 const int nb_faces_reelles,
1182 const IntTab& elem_faces)
1185 Cerr <<
"Scatter::calculer_espace_distant_faces : start" << finl;
1187 ArrOfInt tableau_vide;
1189 calculer_espace_distant_item(
domaine,
1200 const int nb_aretes_reelles,
1201 const IntTab& elem_aretes)
1204 Cerr <<
"Scatter::calculer_espace_distant_aretes : start" << finl;
1205 ArrOfInt tableau_vide;
1206 calculer_espace_distant_item(
domaine,
1221 const JOINT_ITEM type_item)
1226 const int nb_joints = joints.size();
1229 ArrOfInt liste_voisins(nb_joints);
1230 for (i_joint = 0; i_joint < nb_joints; i_joint++)
1231 liste_voisins[i_joint] = joints[i_joint].PEvoisin();
1236 for (i_joint = 0; i_joint < nb_joints; i_joint++)
1238 const Joint& joint = joints[i_joint];
1239 const int pe_voisin = joint.
PEvoisin();
1240 const ArrOfInt& items_communs =
1242 schema_comm.
send_buffer(pe_voisin) << items_communs;
1248 ArrOfInt items_communs_voisin;
1251 for (i_joint = 0; i_joint < nb_joints; i_joint++)
1253 Joint& joint = joints[i_joint];
1254 const int pe_voisin = joint.
PEvoisin();
1256 const int nb_items = items_communs.
size_array();
1257 schema_comm.
recv_buffer(pe_voisin) >> items_communs_voisin;
1259 assert(nb_items == items_communs_voisin.
size_array());
1262 renum_items_communs.
resize(nb_items, 2);
1264 for (
int i = 0; i < nb_items; i++)
1266 renum_items_communs(i,0) = items_communs_voisin[i];
1267 renum_items_communs(i,1) = items_communs[i];
1282 md_vector.
copy(mdseq);
1287 const int nb_joints = joints.size();
1289 ArrOfInt pe_voisins(nb_joints);
1290 ArrsOfInt items_to_send(nb_joints);
1291 ArrsOfInt items_to_recv(nb_joints);
1292 ArrsOfInt blocs_to_recv(nb_joints);
1295 ArrOfBit flags(nb_items_reels);
1298 int nitems_tot = nb_items_reels;
1299 const int moi =
me();
1301 for (
int i_joint = 0; i_joint < nb_joints; i_joint++)
1303 const int pe = joints[i_joint].PEvoisin();
1304 pe_voisins[i_joint] = pe;
1305 const Joint_Items& joint = joints[i_joint].joint_item(type_item);
1313 assert((i_joint == 0) || (pe > joints[i_joint-1].PEvoisin()));
1317 ArrOfInt& dest = items_to_send[i_joint];
1319 for (
int i = 0; i < n; i++)
1321 const int item = items_communs[i];
1332 ArrOfInt& dest = items_to_recv[i_joint];
1334 for (
int i = 0; i < n; i++)
1336 const int item = items_communs[i];
1348 ArrOfInt& dest = blocs_to_recv[i_joint];
1349 if (nitems_virt > 0)
1353 dest[0] = nitems_tot;
1354 dest[1] = nitems_tot + nitems_virt;
1355 nitems_tot += nitems_virt;
1361 ArrOfInt& dest = items_to_send[i_joint];
1363 dest.
resize_array(index + n, RESIZE_OPTIONS::COPY_NOINIT);
1368 MD_Vector_std md(nitems_tot, nb_items_reels, pe_voisins, items_to_send, items_to_recv, blocs_to_recv);
1372 if (comm_check_enabled())
1402 trustIdType premier_indice_global_ = -100;
1411 TIDTab table_inverse_;
1421 md_items_ = md_items;
1433 premier_indice_global_ = decal;
1435 for (
int i = 0; i < nb_entites; i++)
1436 table_[i] = i + decal;
1437 table_.echange_espace_virtuel();
1442 const int nb_entites_tot = table_.size_totale();
1443 table_inverse_.resize(0, 2);
1445 for (
int i = 0; i < nb_entites_tot; i++)
1447 if (table_[i] != i + decal)
1448 table_inverse_.append_line(table_[i], i);
1451 if (table_inverse_.size_array()>0)
1453 tri_lexicographique_tableau(table_inverse_);
1461 table_inverse_.reset();
1475 int imax = table_inverse_.dimension(0) - 1;
1482 valeur = table_inverse_(0, 0);
1484 valeur = sommet_global - 1;
1488 const int milieu = (imin + imax) >> 1;
1489 valeur = table_inverse_(milieu, 0);
1490 const trustIdType compare = valeur - sommet_global;
1493 else if (compare > 0)
1496 imin = imax = milieu;
1499 valeur = table_inverse_(imin, 0);
1500 if (valeur == sommet_global)
1501 resu =
static_cast<int>(table_inverse_(imin, 1));
1514 ArrOfTID& indices_globaux,
int nb_items_a_traiter)
const
1516 for (
int i = 0; i < nb_items_a_traiter; i++)
1518 const int i_loc = indices_locaux[i];
1519 const trustIdType i_glob = (i_loc < 0) ? -1 : table_[i_loc];
1520 indices_globaux[i] = i_glob;
1530 ArrOfInt& indices_locaux)
const
1535 const int nb_indices = indices_globaux.
size_array();
1536 const int size_table = table_.size_array();
1537 for (i = 0; i < nb_indices; i++)
1539 const trustIdType i_glob = indices_globaux[i];
1550 i_loc =
static_cast<int>(i_glob - premier_indice_global_);
1551 if (i_loc < 0 || i_loc >= size_table || table_[i_loc] != i_glob)
1559 indices_locaux[i] = i_loc;
1581 TIDTab ind_glob_tab;
1582 ArrOfInt sz(tab.
nb_dim());
1584 ind_glob_tab.
resize(sz, RESIZE_OPTIONS::NOCOPY_NOINIT);
1587 IntVect& tableau = tab;
1588 TIDVect& indices_globaux = ind_glob_tab;
1592 const int nb_items_virtuels = nb_items_tot - nb_items_reels;
1602 src.
ref_array(indices_globaux, nb_items_reels , nb_items_virtuels );
1603 dest.
ref_array(tableau, nb_items_reels , nb_items_virtuels );
1624 const int error_is_fatal)
1640 <<
"] Error in Scatter::construire_espace_virtuel_traduction\n"
1641 <<
" the array does not have the good dimension on input" << finl;
1656 if (nb_erreurs > 0 && error_is_fatal)
1659 <<
"] Error in Scatter::construire_espace_virtuel_traduction\n"
1660 <<
" some indices of values were not found in\n"
1661 <<
" the local area : it missing virtual items"
1684 const int nb_joints = joints.size();
1695 for (i_joint = 0; i_joint < nb_joints; i_joint++)
1697 const int pe_voisin = joints[i_joint].PEvoisin();
1698 if (pe_voisin > moi)
1708 TIDTab faces_num_global;
1710 for (i_joint = 0; i_joint < nb_joints; i_joint++)
1712 const Joint& joint = joints[i_joint];
1713 const int pe_voisin = joint.
PEvoisin();
1714 if (pe_voisin > moi)
1725 faces_num_global.
resize(0);
1727 schema_comm.
send_buffer(pe_voisin) << faces_num_global;
1732 for (i_joint = 0; i_joint < nb_joints; i_joint++)
1734 Joint& joint = joints[i_joint];
1735 const int pe_voisin = joint.
PEvoisin();
1736 if (pe_voisin < moi)
1739 schema_comm.
recv_buffer(pe_voisin) >> faces_num_global;
1742 Cerr <<
"[PE " << moi
1743 <<
"] Error in Scatter::reordonner_faces_de_joint:\n"
1744 <<
" the number of joint faces is not identical to the PE "
1745 << pe_voisin << finl;
1748 const int nb_erreurs =
1753 Cerr <<
"[PE " << moi
1754 <<
"] Error in Scatter::reordonner_faces_de_joint:\n"
1755 <<
" The faces of the joint with PE " << pe_voisin
1756 <<
" use of unknown nodes" << finl;
1769static void calculer_liste_complete_sommets_joint(
const Joint& joint, ArrOfInt& liste_sommets)
1776 liste_sommets = ref_cast(ArrOfInt,som_faces);
1778 const ArrOfInt& som_isoles = joint.sommets();
1780 for (
int i = 0; i < n; i++)
1783 array_trier_retirer_doublons(liste_sommets);
1787inline int arete_de_sommets_Si_et_Sj(
const int Si,
const int Sj,
const int arete,
const IntTab& aretes_som)
1789 if ( (aretes_som(arete,0) == Si && aretes_som(arete,1) == Sj)
1790 || (aretes_som(arete,1) == Si && aretes_som(arete,0) == Sj) )
1801static void calculer_liste_complete_aretes_joint(
const Joint& joint, ArrOfInt& liste_aretes)
1811 const Domaine& dom=joint.
domaine();
1817 ArrOfInt som_faces(nb_faces_joint*nb_som_faces);
1819 for (
int face=0; face<nb_faces_joint; face++)
1820 for (
int i=0; i<nb_som_faces; i++)
1822 int Si = sommet(face,i);
1823 som_faces[face*nb_som_faces+i]=Si;
1824 for (
int j=i; j<nb_som_faces; j++)
1826 int Sj = sommet(face,j);
1829 positions(0,comp)=0.5*(coord(Si,comp)+coord(Sj,comp));
1833 if (aretes[0]>=0 && arete_de_sommets_Si_et_Sj(Si, Sj, aretes[0], aretes_som))
1840 Process::Journal() <<
"common edges found on faces of joint with " << joint.
PEvoisin() <<
" :" << compteur << finl;
1846 ArrOfInt som_isoles;
1848 calculer_liste_complete_sommets_joint(joint, som_isoles);
1850 array_trier_retirer_doublons(som_faces);
1852 array_retirer_elements(som_isoles, som_faces);
1860 for (
int i = 0; i < n; i++)
1861 for (
int j = i; j < n; j++)
1864 int Si = som_isoles[i];
1865 int Sj = som_isoles[j];
1867 positions(0,comp)=0.5*(coord(Si,comp)+coord(Sj,comp));
1871 if (aretes[0]>=0 && arete_de_sommets_Si_et_Sj(Si, Sj, aretes[0], aretes_som))
1877 Process::Journal() <<
"common edges found isolated on joint with " << joint.
PEvoisin() <<
" :" << compteur << finl;
1879 array_trier_retirer_doublons(liste_aretes);
1882static void calculer_liste_complete_items_joint(
const Joint& joint,
const JOINT_ITEM type_item, ArrOfInt& liste_items)
1886 case JOINT_ITEM::SOMMET:
1887 calculer_liste_complete_sommets_joint(joint, liste_items);
1889 case JOINT_ITEM::ARETE:
1890 calculer_liste_complete_aretes_joint(joint, liste_items);
1893 Cerr <<
"Error in Scatter::calculer_liste_complete_items_joint" << finl;
1894 Cerr <<
"Type of item not expected." << finl;
1911 Cerr <<
"Correction of remote spaces of the elements for the periodic faces" << finl;
1915 const int nb_elem = dom.
nb_elem();
1916 const IntTab& les_elems = dom.
les_elems();
1923 ArrOfInt element_oppose(nb_elem);
1925 Static_Int_Lists connectivite_som_elem;
1926 const int nb_sommets = dom.
nb_som();
1927 construire_connectivite_som_elem(nb_sommets,
1929 connectivite_som_elem,
1932 const int nb_som_face = dom.type_elem()->nb_som_face();
1933 ArrOfInt une_face(nb_som_face);
1934 ArrOfInt elems_voisins;
1940 ArrOfBit marqueurs_elements_distants(nb_elem);
1941 marqueurs_elements_distants = 0;
1947 int nb_elements_ajoutes = 0;
1950 nb_elements_ajoutes = 0;
1951 for (
auto& itr : liste_bords_periodiques)
1953 const Nom& nom_bord = itr;
1954 const Bord& bord = dom.
bord(nom_bord);
1956 const int nb_faces = bord.
nb_faces();
1962 element_oppose = -1;
1964 for (
int i_face = 0; i_face < nb_faces / 2; i_face++)
1970 for (
int quel_cote = 0; quel_cote < 2; quel_cote++)
1972 const int face = i_face + quel_cote * nb_faces / 2;
1974 for (i = 0; i < nb_som_face; i++)
1975 une_face[i] = faces_sommets(face, i);
1976 find_adjacent_elements(connectivite_som_elem, une_face, elems_voisins);
1980 Cerr <<
"Error in Scatter::corriger_espace_distant_elements_perio: \n"
1981 <<
" The face " << i_face <<
" of boundary " << nom_bord <<
" has "
1982 << n <<
" neighbors." << finl;
1986 elem0 = elems_voisins[0];
1988 elem1 = elems_voisins[0];
1990 element_oppose[elem0] = elem1;
1991 element_oppose[elem1] = elem0;
1995 for (
int i_joint = 0; i_joint < nb_joints; i_joint++)
2001 for (i = 0; i < n; i++)
2003 const int elem = elements_distants[i];
2004 marqueurs_elements_distants.
setbit(elem);
2007 for (i = 0; i < n; i++)
2009 const int elem = elements_distants[i];
2010 const int elem_oppose = element_oppose[elem];
2011 if (elem_oppose >= 0 && (!marqueurs_elements_distants.
testsetbit(elem_oppose)))
2014 nb_elements_ajoutes++;
2019 for (i = 0; i < n; i++)
2021 const int elem = elements_distants[i];
2022 marqueurs_elements_distants.
clearbit(elem);
2028 while (nb_elements_ajoutes > 0);
2030 for (
int i_joint = 0; i_joint < nb_joints; i_joint++)
2062 const IntTab& les_elems = dom.
les_elems();
2071 Cerr <<
"Calculation of remote space of elements : thickness " << epaisseur_joint << finl;
2080 ArrsOfInt liste_sommets(
nproc);
2083 ArrsOfInt elements_distants(
nproc);
2086 for (
int i = 0; i <
nproc; i++)
2093 Static_Int_Lists som_elem;
2096 Cerr <<
"Nodes-elements connectivity ..." << finl;
2097 const int nb_sommets = dom.
nb_som();
2098 construire_connectivite_som_elem(nb_sommets,
2104 ArrOfInt liste_pe_voisins(nbjoints);
2113 for (
int i_joint = 0; i_joint < nbjoints; i_joint++)
2115 const Joint& joint = dom.
joint(i_joint);
2117 liste_pe_voisins[i_joint] = pe;
2119 liste_sommets[pe] = sommets_joint;
2134 Static_Int_Lists data_sommets_communs;
2136 if (epaisseur_joint > 1)
2138 ArrOfInt count(dom.
nb_som());
2140 for (
int ijoint = 0; ijoint < nbjoints; ijoint++)
2142 const Joint& joint = dom.
joint(ijoint);
2145 for (
int i = 0; i < n; i++)
2147 const int som = sommets_joint[i];
2154 for (
int ijoint = 0; ijoint < nbjoints; ijoint++)
2156 const Joint& joint = dom.
joint(ijoint);
2159 const int n = renum_sommets.
dimension(0);
2160 for (
int i = 0; i < n; i++)
2163 const int i_sommet_distant = renum_sommets(i, 0);
2165 const int i_sommet_local = renum_sommets(i, 1);
2166 const int j = count[i_sommet_local]++;
2167 data_sommets_communs.
set_value(i_sommet_local, j*2, pe);
2168 data_sommets_communs.
set_value(i_sommet_local, j*2+1, i_sommet_distant);
2176 for (
int epaisseur = 1; ; epaisseur++)
2179 Cerr <<
" Calculation of the thickness " << epaisseur << finl;
2184 for (pe = 0; pe <
nproc; pe++)
2186 ArrOfInt& elems_dist = elements_distants[pe];
2187 const ArrOfInt& sommets = liste_sommets[pe];
2189 const int nb_som_liste = sommets.
size_array();
2190 for (
int isom = 0; isom < nb_som_liste; isom++)
2192 const int som = sommets[isom];
2196 for (
int ielem = 0; ielem < nb_elem_som; ielem++)
2198 const int elem = som_elem(som, ielem);
2202 array_trier_retirer_doublons(elems_dist);
2207 if (epaisseur == epaisseur_joint)
2211 for (pe = 0; pe <
nproc; pe++)
2213 ArrOfInt& sommets = liste_sommets[pe];
2214 const ArrOfInt& elems_dist = elements_distants[pe];
2216 const int nb_elems_dist = elems_dist.
size_array();
2217 for (
int ielem = 0; ielem < nb_elems_dist; ielem++)
2219 const int elem = elems_dist[ielem];
2220 for (
int isom = 0; isom < nb_som_elem; isom++)
2222 const int som = les_elems(elem, isom);
2226 array_trier_retirer_doublons(sommets);
2235 for (pe = 0; pe <
nproc; pe++)
2237 const ArrOfInt& sommets = liste_sommets[pe];
2238 const int nb_som_liste = sommets.
size_array();
2239 for (
int isom = 0; isom < nb_som_liste; isom++)
2241 const int i_sommet_local = sommets[isom];
2242 if (i_sommet_local<0)
2244 const int nb_pe_voisins = data_sommets_communs.
get_list_size(i_sommet_local) / 2;
2245 for (
int i = 0; i < nb_pe_voisins; i++)
2247 const int pe_voisin = data_sommets_communs(i_sommet_local, i*2);
2249 const int i_sommet_distant = data_sommets_communs(i_sommet_local, i*2+1);
2250 if (pe_voisin != pe)
2254 schema_comm.
send_buffer(pe_voisin) << pe << i_sommet_distant;
2260 for (
int i_pevoisin = 0; i_pevoisin < nbjoints; i_pevoisin++)
2262 const int pe_voisin = liste_pe_voisins[i_pevoisin];
2268 buffer >> pe2 >> sommet;
2271 liste_sommets[pe2].append_array(sommet);
2276 for (pe = 0; pe <
nproc; pe++)
2278 ArrOfInt& sommets = liste_sommets[pe];
2279 array_trier_retirer_doublons(sommets);
2288 for (
int pe = 0; pe <
nproc; pe++)
2289 if (elements_distants[pe].size_array() > 0)
2293#ifdef CHECK_ALGO_ESPACE_VIRTUEL
2298 bool erreur =
false;
2299 const int nbjoints = dom.nbjoints();
2300 for (
int i = 0; i < nbjoints; i++)
2302 Joint& joint = dom.
joint(i);
2306 Cerr <<
"Error in Scatter, PE " <<
Process::me() << finl;
2309 <<
" Scatter algorithm : " << elements_distants[pe] << finl;
2319 for (
int i = 0; i < nb_joints; i++)
2321 Joint& joint = dom.
joint(i);
2329static inline int fct_cmp_coordonnees(
const double * s1,
const double *s2,
int dim,
const double epsilon)
2331 assert(dim==2 || dim==3);
2332 if (s1[0] < s2[0] - epsilon)
2334 else if (s1[0] > s2[0] + epsilon)
2336 else if (s1[1] < s2[1] - epsilon)
2338 else if (s1[1] > s2[1] + epsilon)
2342 else if (s1[2] < s2[2] - epsilon)
2344 else if (s1[2] > s2[2] + epsilon)
2367 ArrOfInt& correspondance,
const double epsilon)
2369 const int nb_sommets1 = sommets1.
dimension(0);
2370 const int nb_sommets2 = sommets2.
dimension(0);
2372 assert(sommets1.
nb_dim() == 2);
2373 assert(sommets2.
nb_dim() == 2);
2374 assert(correspondance.
size_array() == nb_sommets2);
2375 if (nb_sommets1 < 1)
2377 correspondance = -1;
2383 ArrOfInt index(nb_sommets1);
2386 for (i = 0; i < nb_sommets1; i++)
2398 tri_lexicographique_tableau_indirect(sommets1, index);
2402 int nb_sommets_non_trouves = 0;
2403 int nb_echec_dichotomie = 0;
2407 for (i = 0; i < nb_sommets2; i++)
2409 const double * s2 = & sommets2(i,0);
2410 int num_sommet = -1;
2414 int imax = nb_sommets1 - 1;
2419 const int milieu = (imin + imax) >> 1;
2421 const double * s1 = & sommets1(k, 0);
2422 resu_cmp = fct_cmp_coordonnees(s1, s2, nb_dim, epsilon);
2432 imin = imax = milieu;
2439 const double * s1 = & sommets1(k, 0);
2440 resu_cmp = fct_cmp_coordonnees(s1, s2, nb_dim, epsilon);
2448 nb_echec_dichotomie++;
2452 for (j = 0; j < nb_sommets1; j++)
2454 const double * s1 = & sommets1(j,0);
2455 resu_cmp = fct_cmp_coordonnees(s1, s2, nb_dim, epsilon);
2459 if (j < nb_sommets1)
2462 nb_sommets_non_trouves++;
2465 correspondance[i] = num_sommet;
2469 if (nb_echec_dichotomie > 0)
2471 << nb_echec_dichotomie <<
" / " << nb_sommets2 << finl;
2473 return nb_sommets_non_trouves;
2483 const DoubleTab& coord_items,
bool allow_resize)
2487 case JOINT_ITEM::SOMMET:
2489 case JOINT_ITEM::ARETE:
2492 Cerr <<
"Scatter::construire_correspondance_items_par_coordonnees unusable for item "
2498 const int nb_joints = joints.size();
2501 ArrsOfInt indices_items_locaux(nb_joints);
2503 ArrsOfInt indices_items_distants(nb_joints);
2505 DoubleTabs coord_items_locaux(nb_joints);
2506 DoubleTabs coord_items_distants(nb_joints);
2510 for (
int i_joint = 0; i_joint < nb_joints; i_joint++)
2512 const Joint& joint = joints[i_joint];
2513 ArrOfInt& items = indices_items_locaux[i_joint];
2516 calculer_liste_complete_items_joint(joint, type_item, items);
2519 DoubleTab& coord = coord_items_locaux[i_joint];
2521 for (
int i = 0; i < n; i++)
2522 for (
int j = 0; j < dim; j++)
2523 coord(i,j) = coord_items(items[i], j);
2529 ArrOfInt liste_pe_voisins(nb_joints);
2531 for (i = 0; i < nb_joints; i++)
2532 liste_pe_voisins[i] = joints[i].PEvoisin();
2535 for (i = 0; i < nb_joints; i++)
2537 const int pe = liste_pe_voisins[i];
2539 buffer << indices_items_locaux[i];
2540 buffer << coord_items_locaux[i];
2543 for (i = 0; i < nb_joints; i++)
2545 const int pe = liste_pe_voisins[i];
2547 buffer >> indices_items_distants[i];
2548 buffer >> coord_items_distants[i];
2556 for (
int i_joint = 0; i_joint < nb_joints; i_joint++)
2558 Joint& joint = joints[i_joint];
2559 const int PEvoisin = joint.
PEvoisin();
2560 const ArrOfInt& indices_locaux = indices_items_locaux[i_joint];
2561 const DoubleTab& coord_locaux = coord_items_locaux[i_joint];
2562 const DoubleTab& coord_distants = coord_items_distants[i_joint];
2566 ArrOfInt corresp(n);
2570 int nb_items_communs_trouves=0;
2571 for (
int k = 0; k < n; k++)
2572 if (corresp[k]>=0) nb_items_communs_trouves++;
2579 assert(items_communs.
size_array() == nb_items_communs_trouves);
2584 int n_dist = coord_distants.
dimension(0);
2585 std::vector<bool> corres_ok(n_dist,
false);
2586 std::vector<int> offset(n_dist, 0);
2590 for(
int k = 0; k < n; k++)
2591 if (corresp[k] >= 0)
2592 corres_ok[corresp[k]] =
true;
2596 for(
int k = 0; k < n_dist; k++)
2597 offset[k] = corres_ok[k] ? nb_holes : nb_holes++;
2601 for (
int k = 0; k < n; k++)
2603 const int i_local = indices_locaux[k];
2605 const int j = corresp[k];
2612 Cerr <<
"Error in Scatter::remplir_renum_virt_loc on PE " << moi << finl
2613 <<
"The item of type " << (int)type_item <<
" number " << i_local <<
" with coordinates ";
2614 for (
int k2 = 0; k2 < dim; k2++)
2615 Cerr << coord_locaux(i, k2) <<
" ";
2616 Cerr << finl <<
"was not found in the joint with the PE " << PEvoisin << finl;
2617 if (type_item==JOINT_ITEM::ARETE)
2619 Cerr <<
"The searching algorithm of the isolated edges on a joint" << finl;
2620 Cerr <<
"does not work yet in some cases. Two isolated nodes of a joint (example below" << finl;
2621 Cerr <<
"joint between 0 and 2) can be those of an edge not belonging to this joint (below" << finl;
2622 Cerr <<
"the edge belongs to the joint 0-1 but not 0-2):" << finl;
2628 Cerr <<
" ________ " << finl;
2629 Cerr <<
"1\\ 2/1\\2 /1\\ " << finl;
2630 Cerr <<
"__\\/___\\/___\\" << finl;
2631 Cerr <<
" 0/\\ 0 /\\ 0 " << finl;
2632 Cerr <<
" / 0\\ / 0\\ " << finl;
2634 Cerr <<
"One way to by-pass this problem is to split again your domain with" << finl;
2635 Cerr <<
"different options of splitting or with another splitter to do not fall" << finl;
2636 Cerr <<
"on the same configuration." << finl;
2646 items_communs[i] = i_local;
2649 assert(i==0 || items_communs[i] > items_communs[i-1]);
2653 int j2 = j - offset[j];
2655 assert(items_communs[j2] < 0);
2656 items_communs[j2] = i_local;
2661 assert(i==nb_items_communs_trouves);
2696 const JOINT_ITEM type_item)
2699 const int nb_joints = joints.size();
2700 ArrOfInt liste_voisins(nb_joints);
2702 for (i_joint = 0; i_joint < nb_joints; i_joint++)
2703 liste_voisins[i_joint] = joints[i_joint].PEvoisin();
2708 for (i_joint = 0; i_joint < nb_joints; i_joint++)
2710 const Joint& joint = joints[i_joint];
2711 const Joint_Items& items = joint.
joint_item(type_item);
2719 for (i_joint = 0; i_joint < nb_joints; i_joint++)
2721 Joint& joint = joints[i_joint];
2738template <
typename _SIZE_>
2746 md.
copy(mdseq_elem);
2753template <
typename _SIZE_>
int testsetbit(int_t i) const
Returns the value of bit e, then sets bit e to 1.
void setbit(int_t i) const
Set bit e to 1.
void clearbit(int_t i) const
Set bit e to 0.
class Domaine_32_64 A Domain is a mesh composed of a set of geometric elements of the same type.
virtual void clear()
Reset the Domaine completely except for its name.
int nb_som_elem() const
Returns the number of vertices of the geometric elements that make up the domain.
const IntTab_t & aretes_som() const
returns the connectivity array edges/vertices.
SmallArrOfTID_t & chercher_aretes(const DoubleTab &pos, SmallArrOfTID_t &arr, int reel=0) const
DoubleTab_t & les_sommets()
void merge_wo_vertices_with(Domaine_32_64 &z)
Merge another Domaine into this, without considering vertices which are handled separately.
void renum(const IntVect_t &nums)
Renumbering of nodes: node number k becomes node number Les_Nums[k].
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...
void read_vertices(Entree &s)
only read vertices from the stream s
const DoubleTab_t & coord_sommets() const
void check_domaine()
associate the read objects to the domaine and check that the reading objects are coherent
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.
int_t nb_som() const
Returns the number of vertices of the domain.
void ajouter(const DoubleTab_t &soms)
Adds nodes (or vertices) to the domain (without checking for duplicates).
const Noms & bords_perio() const
double xa(int num_arete, int k) const
const Nom & le_nom() const override
Returns the name of the Objet_U. Virtual method to override: returns "neant" in this implementation.
void set_fichier_lu(Nom &nom)
const Domaine & domaine() const
Reading from a file of objects written in binary format.
An Entree whose main source of data is an arbitrary binary buffer set using the set_data() method.
virtual int ouvrir(const char *name, IOS_OPEN_MODE mode=ios::in)
Class defining operators and methods for all reading operation in an input flow (file,...
const IntTab_t & les_sommets() const
Returns the array of vertices of all faces.
int nb_som_faces() const
Returns the number of vertices per face.
Parallel collective version of FichierHDF, to be used for all concurrent reading/writing on HDF files...
static bool is_hdf5(const char *file_name)
virtual void read_dataset(Nom dataset_basename, int proc_rank, Entree_Brute &entree)
virtual void open(Nom filename, bool readOnly)
virtual bool exists(const char *dataset_name)
: Post-processing class for Eulerian fields in LATA format.
int ecrire_entete(const double temps_courant, const int reprise, const int est_le_premier_post) override
Opens the master file in ERASE mode and writes the lata file header (on the master processor only).
virtual int initialize_lata(const Nom &file_basename, const Format format=ASCII, const Options_Para options_para=SINGLE_FILE)
Initializes the class, opens the file and writes the header.
int ecrire_domaine(const Domaine &domaine, const int est_le_premier_post) override
See Format_Post_base::ecrire_domaine. Writing a domain within a time step is accepted,...
int ecrire_temps(const double temps) override
Starts writing a new time step. For the LATA format specifically:
int ecrire_champ(const Domaine &domaine, const Noms &unite_, const Noms &noms_compo, int ncomp, double temps_, const Nom &id_du_champ, const Nom &id_du_domaine, const Nom &localisation, const Nom &nature, const DoubleTab &data) override
voir Format_Post_base::ecrire_champ
void nommer(const Nom &) override
Gives a name to the boundary.
const Domaine_t & domaine() const
Returns the domain associated with the boundary (const version).
int_t nb_faces() const
Returns the number of faces of the boundary.
void associer_domaine(const Domaine_t &)
Associates the boundary to the domain it belongs to.
IntTab_t & les_sommets_des_faces()
Returns the vertices of the boundary faces.
const Faces_t & faces() const
Base class for "interpreter" objects.
static Objet_U & objet(const Nom &)
See Interprete_bloc::objet_global(). BM: the Interprete class is not the best place for this.
void affecte_epaisseur(int ep)
const Joint_Items_t & joint_item(JOINT_ITEM type) const
Returns the joint information for the requested type (read-only).
void affecte_PEvoisin(int num)
Joint_Items_t & set_joint_item(JOINT_ITEM type)
Returns the joint information for a given geometric item type, for filling the structures.
const ArrOfInt_t & items_communs() const
const IntTab_t & renum_items_communs() const
Returns the renum_items_communs_ array (read-only). See renum_items_communs_.
IntTab_t & set_renum_items_communs()
Returns the renum_items_communs_ array for filling. See renum_items_communs_.
ArrOfInt_t & set_items_communs()
Returns the items_communs_ array for filling.
int nb_items_virtuels() const
Returns the number of virtual items. See nb_items_virtuels_.
void set_nb_items_virtuels(int n)
Sets the number of virtual items. See nb_items_virtuels_.
const ArrOfInt_t & items_distants() const
Returns the items_distants_ array (read-only). See items_distants_.
ArrOfInt_t & set_items_distants()
Returns the items_distants_ array for filling.
This class implements the operators and virtual methods of the EFichier class as follows: The file to...
int ouvrir(const char *name, IOS_OPEN_MODE mode=ios::in) override
Opens the file.
Reading from a file in binary format.
int ouvrir(const char *name, IOS_OPEN_MODE mode=ios::in) override
Opens the file with the given mode and prot parameters. These parameters are the parameters of the st...
virtual int get_nb_items_tot() const
virtual int get_nb_items_reels() const
Dummy parallel descriptor used for sequential computations.
This is the simplest descriptor, used for arrays of values at vertices, elements, faces,...
: This class is an OWN_PTR but the pointed object is shared among multiple
void copy(const MD_Vector_base &)
Constructs an MD_Vector object by copying an existing object.
const MD_Vector_base & valeur() const
A character string (Nom) in uppercase.
class Nom: a character string for naming TRUST objects.
const Nom getPrefix(const char *const) const
Nom nom_me(int, const char *prefix=0, int without_padding=0) const
Inserts _prefix000n (n=me() or nproc()) into a file name (e.g. toto.titi) to produce toto_prefix000n....
const std::string & getString() const
An array of character strings (VECT(Nom)).
const Nom & que_suis_je() const
Returns the string identifying the class.
virtual Entree & readOn(Entree &)
Reads an Objet_U from an input stream. Virtual method to override.
static double precision_geom
Objet_U()
Default constructor: assigns a unique identifier to the object (object_id_) and registers the object ...
virtual Sortie & printOn(Sortie &) const
Writes the object to an output stream. Virtual method to override.
static double mp_min(double)
static trustIdType mppartial_sum(trustIdType i)
Computes the partial sum of x over processors 0 to me()-1 (returns 0 on processor 0).
static double mp_max(double)
static Sortie & Journal(int message_level=0)
Returns a static Sortie object used as an event journal.
static int nproc()
Returns the number of processors in the current group. See Comm_Group::nproc() and PE_Groups::current...
static double mp_sum(double)
Computes the sum of x over all processors in the current group.
static void barrier()
Synchronizes all processors in the current group (waits until all processors have reached the barrier...
static int me()
Returns the rank of the local processor in the current communication group. See Comm_Group::rank() an...
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
static int je_suis_maitre()
Returns 1 if on the master processor of the current group (i.e. me() == 0), 0 otherwise.
static bool is_sequential()
static void chercher_direction_perio(ArrOfDouble &direction_perio, const Domaine_32_64< int > &dom, const Nom &bord)
static int reordonner_faces_periodiques(const Domaine_32_64< int > &domaine, IntTab_T< int > &faces, const ArrOfDouble &direction_perio, const double epsilon)
static void renum_som_perio(const Domaine_32_64< int > &dom, ArrOfInt_T< int > &renum_som_perio, bool calculer_espace_virtuel)
static void reordonner_faces_de_joint(Domaine &dom)
Reorders joint faces so that they appear in the same order on each pair of neighboring processors.
static int Chercher_Correspondance(const DoubleTab &sommets1, const DoubleTab &sommets2, ArrOfInt &correspondance, const double epsilon)
Builds the "correspondance" array such that for 0 <= i < sommets2.
static void ajouter_joints(Domaine &domaine, ArrOfInt &pe_voisins)
Adds joints with all PEs in pe_voisins.
static void init_sequential_domain(Domaine_32_64< _SIZE_ > &dom)
Create parallel descriptors for the vertex and element arrays of the domain (necessary because Scatte...
static void construire_espace_virtuel_traduction(const MD_Vector &md_indice, const MD_Vector &md_valeur, IntTab &tableau, const int error_is_fatal=1)
Builds the items_communs + virtual space structure of an array containing indices of geometric items,...
static void calculer_espace_distant_sommets(Domaine &dom)
Based on the remote space of elements, computes the remote space of vertices.
Entree & interpreter(Entree &) override
Reads and completes a parallel domain according to the keywords read in the data set.
static void calculer_espace_distant_aretes(Domaine &domaine, const int nb_aretes_reelles, const IntTab &elem_aretes)
Same as Scatter::calculer_espace_distant_sommets for edges.
static void calculer_espace_distant_elements(Domaine &dom)
Fills the "espace_distant()" array of elements in the joints.
static void calculer_espace_distant(Domaine &domaine, const int nb_items_reels, const ArrsOfInt &items_to_send, const JOINT_ITEM type_item)
Determines the distant items from a list of items to send and lists of common items.
static void construire_correspondance_items_par_coordonnees(Joints &joints, const JOINT_ITEM type_item, const DoubleTab &coord_items, bool allow_resize=false)
Generic method to build geometrical item correspondance between the local and the remote processor ar...
static void construire_structures_paralleles(Domaine &dom)
Builds the parallel structures of the domain (determination of distant elements as a function of join...
static void calculer_nb_items_virtuels(Joints &joints, const JOINT_ITEM type_item)
For a geometric item "type_item", fills the nb_items_virtuels_ field of joints based on the number of...
void read_domain_no_comm(Entree &fic, bool &read_perio)
Does the exact same thing as the readOn of the class Domaine but without collective communication.
static void calculer_renum_items_communs(Joints &joints, const JOINT_ITEM type_item)
Assumes that each joint[i].joint_item(type_item).items_communs() contains the local indices of common...
static void construire_correspondance_sommets_par_coordonnees(Domaine &dom, bool allow_resize=false)
Builds the joint_item(JOINT_ITEM::SOMMET).items_communs arrays for all joints of the domain dom.
static void construire_md_vector(const Domaine &, int nb_items_reels, const JOINT_ITEM, MD_Vector &)
Builds an MD_Vector_std from the joint information of the domain for the requested item type.
static void check_consistancy_remote_items(Domaine &dom, const ArrOfInt &mergedDomaines)
Merged domains receive joint information from their neighbours to ensure that their common items (ver...
static void corriger_espace_distant_elements_perio(Domaine &dom)
Current periodic algorithms (P1B assembler, OpDivElem P1B) require that for each virtual periodic fac...
Domaine & domaine()
Returns the associated domain.
static void trier_les_joints(Joints &joints)
Sort joints by increasing neighbor proc number.
static void calculer_espace_distant_faces(Domaine &domaine, const int nb_faces_reelles, const IntTab &elem_faces)
Same as Scatter::calculer_espace_distant_sommets for faces.
virtual void lire_domaine(Nom &fil)
Reads the domain from the file named "nomentree", of type LecFicDistribueBin or LecFicDistribue.
static void uninit_sequential_domain(Domaine_32_64< _SIZE_ > &dom)
Method used by interpreters that modify the domain (sequential), destroys the descriptors of vertices...
static void construire_correspondance_aretes_par_coordonnees(Domaine_VF &zvf)
Builds the joint_item(JOINT_ITEM::ARETE).items_communs arrays for all joints of the domain.
void echange_taille_et_messages() const
Launches the data exchange between all processors.
Sortie & send_buffer(int num_PE) const
Returns the buffer corresponding to processor num_PE to stack data to send.
void end_comm() const
Clears the buffers and releases resources: reading of received data from buffers is complete.
Entree & recv_buffer(int num_PE) const
Returns the buffer corresponding to processor num_PE to read received data.
void begin_comm() const
Reserves communication buffers for a new communication.
void set_send_recv_pe_list(const ArrOfInt &send_pe_list, const ArrOfInt &recv_pe_list, const int me_to_me=0)
Defines the list of processors to send data to and receive data from.
Base class for output streams.
void set_value(int_t i_liste, int_t i_element, int_t valeur)
Assigns "valeur" to the j-th element of the i-th list with 0 <= i < get_nb_lists() and 0 <= j < get_l...
int_t get_list_size(int_t i_liste) const
Returns the number of elements in list i.
void set_list_sizes(const ArrOfInt_t &sizes)
Destroys existing lists and creates new ones.
void append_array(_TYPE_ valeur)
_SIZE_ size_array() const
virtual void ref_array(TRUSTArray &, _SIZE_ start=0, _SIZE_ sz=-1)
TRUSTArray & inject_array(const TRUSTArray &source, _SIZE_ nb_elements=-1, _SIZE_ first_element_dest=0, _SIZE_ first_element_source=0)
void resize_array(_SIZE_ new_size, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)
void set_md_vector(const MD_Vector &) override
void resize(_SIZE_ n, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)
_SIZE_ dimension_tot(int) const override
_SIZE_ dimension(int d) const
_SIZE_ size_totale() const
_SIZE_ size_reelle() const
virtual const MD_Vector & get_md_vector() const
virtual void echange_espace_virtuel(IsExchangeBlocking exchange_type=IsExchangeBlocking::DefaultBlocking, const std::string kernel_name="noname")
This class provides tools to build the virtual space of an array containing indices of geometric enti...
int chercher_table_inverse(const trustIdType sommet_global) const
Searches for i such that table_inverse(i, 0) == sommet_global, and returns table_inverse(i,...
int traduire_espace_virtuel(IntTab &tableau) const
Starting from an array whose virtual space structure is initialized (remote and virtual element descr...
void traduire_indice_local_vers_global(const ArrOfInt &indices_locaux, ArrOfTID &indices_globaux, int n) const
Transforms local indices into global indices using "table_" (see initialiser).
int traduire_indice_global_vers_local(const ArrOfTID &indices_globaux, ArrOfInt &indices_locaux) const
For debut <= i < debut+nb, indices_locaux[i] = look up the local index of "indices_globaux[i]".
Traduction_Indice_Global_Local()
void initialiser(const MD_Vector &md_items)
Initializes the dictionary. Precondition: