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>
75 return le_domaine.valeur();
81void dump_lata(
const Domaine& dom)
84 Nom nom_fichier_lata(
"espaces_virtuels");
87 constexpr int IS_FIRST = 1;
94 Noms units, noms_compo;
98 for(
int ij = 0; ij < nb_joints; ij++)
103 for (
int i = 0; i < nt1; i++) data[t1[i]] += 1;
136 if (n !=
";" && n !=
"unlock;")
138 Cerr <<
"Error ! You ran a sequential calculation and can't use Scatter keyword here. Run a parallel calculation or remove this keyword." << finl;
141 Cerr <<
"Scatter: preparing domain structure\n"
142 <<
" (this is workaround for bugged domain operators that don't do it)" << finl;
146 if(!sub_type(Domaine, obj))
148 Cerr <<
"obj : " << obj <<
" is not an object of type Domain !" << finl;
151 Domaine& dom = ref_cast(Domaine, obj);
160 static int gdb_non_lance=1;
161 char* TRUST_GDB=getenv(
"TRUST_GDB");
162 if (gdb_non_lance && ((
Motcle)nomentree==
"DEBUG" || TRUST_GDB!=
nullptr))
165 if ((
Motcle)nomentree==
"DEBUG") is >> nomentree;
168 Cerr <<
"Enter \"return\" to this window after" << finl;
169 Cerr <<
"typing \"cont\" in other gdb windows." << finl;
170 Cerr << (int)system (
"sh -c read ok") << finl;
174 Nom getpidn((
int)getpid());
176 Nom command0=
"echo attach ";
180 Cerr << (int)system(command0) << finl;
181 command0=
" ls -l /proc/";
183 command0+=
"/exe | awk '{print $NF}' > execname";
184 Cerr << (int)system(command0) << finl;
185 Nom command=
"[ -f /usr/X11R6/bin/xterm ] && x=\"/usr/X11R6/bin/xterm -exec gdb -x \";";
186 command+=
"[ -f /usr/bin/konsole ] && x=\"/usr/bin/konsole -e gdb -x \";";
189 command+=
" `cat execname` ";
191 Cerr<<
"command: " <<command<<finl;
192 Cerr << (int)system(command) << finl;
199 Cerr <<
"Execution of the Scatter module." << finl;
201 statistics().begin_count(STD_COUNTERS::interprete_scatter,statistics().get_last_opened_counter_level()+1);
206 if(!sub_type(Domaine, obj))
208 Cerr <<
"Error in Scatter: object of type '" << obj.
que_suis_je() <<
"' when Domaine was expected!" << finl;
211 Domaine& dom = ref_cast(Domaine, obj);
217 Cerr <<
"Reading the domain" << finl;
222 Cerr <<
"Calculation of renum_items_communs for the nodes" << finl;
230 Cerr <<
"Construire_structures_paralleles" << finl;
237 Cerr <<
"End Distribue_domaines" << finl;
239 Cerr <<
"\nQuality of partitioning --------------------------------------------" << finl;
241 Cerr <<
"\nTotal nb of elements = " << total_nb_elem << finl;
245 double mean_element_domaine = (double)(total_nb_elem /
Process::nproc());
246 Cerr <<
"Min number of elements on a Domaine = " << min_element_domaine << finl;
247 Cerr <<
"Max number of elements on a Domaine = " << max_element_domaine << finl;
248 Cerr <<
"Mean number of elements per Domaine = " << (int)(mean_element_domaine) << finl;
249 double load_imbalance = max_element_domaine / mean_element_domaine;
250 Cerr <<
"Load imbalance = " << load_imbalance <<
"\n" << finl;
252 Elem_geom_base& elem=dom.type_elem().valeur();
253 if (sub_type(Poly_geom_base,elem))
254 ref_cast(Poly_geom_base,elem).compute_virtual_index();
257 double temps = statistics().get_time_since_last_open(STD_COUNTERS::interprete_scatter);
258 Cerr <<
"Scatter time : " << temps << finl;
260 statistics().end_count(STD_COUNTERS::interprete_scatter);
273 const int nb_joints = joints.size();
282 const int myDomaineWasMerged = mergedDomaines[moi];
284 for (
int i_joint = 0; i_joint < nb_joints; i_joint++)
287 const int pe_voisin = joints[i_joint].PEvoisin();
288 const int neighbourDomaineWasMerged = mergedDomaines[pe_voisin];
289 if(myDomaineWasMerged && neighbourDomaineWasMerged)
296 else if(myDomaineWasMerged && !neighbourDomaineWasMerged)
298 else if(!myDomaineWasMerged && neighbourDomaineWasMerged)
306 DoubleTabs coord_items_locaux(nb_joints);
307 DoubleTabs coord_items_distants(nb_joints);
308 for (
int i_joint = 0; i_joint < nb_joints; i_joint++)
310 const Joint& joint = joints[i_joint];
312 const int nb_items_communs = items_communs.
size_array();
314 DoubleTab& coord = coord_items_locaux[i_joint];
316 for (
int i = 0; i < nb_items_communs; i++)
318 coord(i,j) = coords(items_communs[i], j);
326 for (
int i = 0; i < nb_joints; i++)
328 const int pe_voisin = joints[i].PEvoisin();
329 const int neighbourDomaineWasMerged = mergedDomaines[pe_voisin];
330 if( neighbourDomaineWasMerged && !(myDomaineWasMerged && pe_voisin<moi) )
333 buffer << coord_items_locaux[i];
338 if(myDomaineWasMerged)
340 for (
int i = 0; i < nb_joints; i++)
342 const int pe_voisin = joints[i].PEvoisin();
343 const int neighbourDomaineWasMerged = mergedDomaines[pe_voisin];
344 if(!(neighbourDomaineWasMerged && pe_voisin>moi))
347 buffer >> coord_items_distants[i];
356 if(myDomaineWasMerged)
358 for (
int i_joint = 0; i_joint < nb_joints; i_joint++)
361 const int pe_voisin = joints[i_joint].PEvoisin();
362 const int neighbourDomaineWasMerged = mergedDomaines[pe_voisin];
363 if(neighbourDomaineWasMerged && pe_voisin>moi)
365 ArrOfInt& items_communs = dom.
faces_joint()[i_joint].set_joint_item(JOINT_ITEM::SOMMET).set_items_communs();
366 const ArrOfInt old_items_communs = joints[i_joint].joint_item(JOINT_ITEM::SOMMET).items_communs();
367 const int nb_items = items_communs.
size_array();
368 const DoubleTab& coord_voisin = coord_items_distants[i_joint];
369 const DoubleTab& my_coord = coord_items_locaux[i_joint];
371 for(
int i=0; i<nb_items; i++)
373 for(
int j=0; j<nb_items; j++)
377 ok=ok&&(est_egal(coord_voisin(i,dir),my_coord(j,dir)));
380 items_communs[i] = old_items_communs[j];
396 Domaine& dom = le_domaine.valeur();
398 Cerr <<
"\treading vertices..." << finl;
399 Domaine dom_tmp_for_vertices;
402 Cerr <<
"\tDone !\n\treading elem infos (domaines)..." << finl;
407 Domaine domaine_read;
408 if(nom!=(
const char*)
"vide")
411 Process::exit(
"Error: Scatter::read_domain_no_comm() -- One expected an opened bracket { to start.");
415 Process::exit(
"Error: Scatter::read_domain_no_comm() -- Empty list ?! Should not happen?");
416 Cerr <<
"Done!" << finl;
428 domaine_read.
renum(nums);
439 const int nb_joints = domaine_read.
nb_joints();
440 for (
int i_joint = 0; i_joint < nb_joints; i_joint++)
442 const Joint& joint_to_add = domaine_read.
faces_joint()[i_joint];
444 int my_joint_index = 0;
449 ArrOfInt& items_communs = dom.
faces_joint()[my_joint_index].set_joint_item(JOINT_ITEM::SOMMET).set_items_communs();
451 for(
int index=0; index<sommets_to_add.
size_array(); index++)
453 array_trier_retirer_doublons(items_communs);
456 ArrOfInt& items_distants = dom.
faces_joint()[my_joint_index].set_joint_item(JOINT_ITEM::ELEMENT).set_items_distants();
458 for(
int index=0; index<elements_to_add.
size_array(); index++)
472 Cerr <<
"Reading geometry from .Zones file(s) ..." << finl;
488 Cerr <<
"Error: You probably made a single_hdf partitioning and using the wrong name of .Zones files in the scatter" << finl;
489 Cerr <<
"You should remove '_p" <<
Process::nproc() <<
"' from the name of .Zones file (" << nomentree <<
") in your datafile" << finl;
493 statistics().begin_count(STD_COUNTERS::read_scatter,statistics().get_last_opened_counter_level()+1);
496 bool domain_not_built =
true;
497 bool read_perio =
false;
503 fic_hdf.
open(nomentree,
true);
505 std::string dname =
"/zone_" + std::to_string(
Process::me());
506 bool ok = fic_hdf.
exists(dname.c_str());
513 std::string tmp = dname +
"_" + std::to_string(i);
515 bool exists = fic_hdf.
exists(tmp.c_str());
518 Nom dataset_name(dname);
526 data_part >> liste_bords_periodiques;
527 domain_not_built =
false;
543 data >> liste_bords_periodiques;
544 domain_not_built =
false;
552 int isSingleDomaine = fichier_binaire.
ouvrir(nomentree);
553 if (!isSingleDomaine)
562 tmp += std::to_string(i);
564 Nom nomentree_part(tmp);
565 int ok = fichier_binaire_part.
ouvrir(nomentree_part);
573 fichier_binaire_part >> liste_bords_periodiques;
574 fichier_binaire_part.
close();
575 domain_not_built =
false;
588 fichier_binaire >> liste_bords_periodiques;
589 fichier_binaire.
close();
590 domain_not_built =
false;
596 Cerr <<
"Error in Scatter::lire_domaine\n";
597 Cerr <<
"The domain on the current process hasn't been built" << finl;
598 Cerr <<
"The number of processes you mentionned is probaly higher than the number of domaines" << finl;
609 const int nb_joints = joints.size();
610 int max_pe_voisin = 0;
611 for (
int i = 0; i < nb_joints; i++)
613 const int pe_voisin = joints[i].PEvoisin();
614 if (pe_voisin >= max_pe_voisin)
615 max_pe_voisin = pe_voisin;
618 max_pe_voisin = (int)
mp_max(max_pe_voisin);
620 if (max_pe_voisin >=
nproc()) ok=0;
623 Cerr <<
"Error in Scatter::lire_domaine\n"
624 <<
"The domain has been partitioned with at least " << max_pe_voisin <<
" "
625 <<
"domaines whereas the number of processes asked is " <<
Process::nproc() <<
"." << finl;
626 Cerr <<
"The number of domaines and number of processes must match." << finl;
634 envoyer_all_to_all(mergedDomaines, mergedDomaines);
640 Cerr <<
" Number of nodes: " << nbsom << finl;
645 const int myDomaineWasMerged = mergedDomaines[
Process::me()];
646 if(myDomaineWasMerged)
648 for(
auto& itr : liste_bords_periodiques)
651 Bord& bord = dom.
bord(bp_nom);
662 statistics().end_count(STD_COUNTERS::read_scatter);
686 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]);
1082static void calculer_espace_distant_item(Domaine& le_dom,
1083 const JOINT_ITEM type_item,
1084 const IntTab& connectivite_elem_item,
1085 const int nb_items_reels,
1086 const ArrOfInt& items_lies)
1092 const int nb_joints = joints.size();
1094 const int nb_items_par_element = connectivite_elem_item.
dimension(1);
1096 ArrsOfInt items_to_send(nproc);
1098 ArrOfInt liste_items;
1102 const int flag_items_lies = (items_lies.
size_array() > 0);
1103 assert(flag_items_lies == 0 || items_lies.
size_array() == nb_items_reels);
1106 for (
int i_joint = 0; i_joint < nb_joints; i_joint++)
1108 const Joint& joint = joints[i_joint];
1109 const int pe_voisin = joint.
PEvoisin();
1111 const int nb_elems_dist = esp_dist_elems.
size_array();
1115 for (
int i_elem = 0; i_elem < nb_elems_dist; i_elem++)
1117 const int elem = esp_dist_elems[i_elem];
1118 for (
int i_item = 0; i_item < nb_items_par_element; i_item++)
1120 const int item = connectivite_elem_item(elem, i_item);
1125 if (flag_items_lies)
1127 const int item_lie = items_lies[item];
1128 if (item_lie != item)
1130 assert(item_lie >= 0 && item_lie < nb_items_reels);
1131 assert(items_lies[item_lie] == item_lie);
1138 array_trier_retirer_doublons(liste_items);
1140 items_to_send[pe_voisin] = liste_items;
1160 Cerr <<
"Scatter::calculer_espace_distant_sommets : start" << finl;
1162 const IntTab& connectivite_elem_som = dom.
les_elems();
1163 const int nb_sommets_reels = dom.
nb_som();
1165 ArrOfInt renum_som_perio(nb_sommets_reels);
1167 for (
int i = 0; i < nb_sommets_reels; i++)
1168 renum_som_perio[i] = i;
1172 calculer_espace_distant_item(dom,
1174 connectivite_elem_som,
1183 const int nb_faces_reelles,
1184 const IntTab& elem_faces)
1187 Cerr <<
"Scatter::calculer_espace_distant_faces : start" << finl;
1189 ArrOfInt tableau_vide;
1191 calculer_espace_distant_item(
domaine,
1202 const int nb_aretes_reelles,
1203 const IntTab& elem_aretes)
1206 Cerr <<
"Scatter::calculer_espace_distant_aretes : start" << finl;
1207 ArrOfInt tableau_vide;
1208 calculer_espace_distant_item(
domaine,
1223 const JOINT_ITEM type_item)
1228 const int nb_joints = joints.size();
1231 ArrOfInt liste_voisins(nb_joints);
1232 for (i_joint = 0; i_joint < nb_joints; i_joint++)
1233 liste_voisins[i_joint] = joints[i_joint].PEvoisin();
1238 for (i_joint = 0; i_joint < nb_joints; i_joint++)
1240 const Joint& joint = joints[i_joint];
1241 const int pe_voisin = joint.
PEvoisin();
1242 const ArrOfInt& items_communs =
1244 schema_comm.
send_buffer(pe_voisin) << items_communs;
1250 ArrOfInt items_communs_voisin;
1253 for (i_joint = 0; i_joint < nb_joints; i_joint++)
1255 Joint& joint = joints[i_joint];
1256 const int pe_voisin = joint.
PEvoisin();
1258 const int nb_items = items_communs.
size_array();
1259 schema_comm.
recv_buffer(pe_voisin) >> items_communs_voisin;
1261 assert(nb_items == items_communs_voisin.
size_array());
1264 renum_items_communs.
resize(nb_items, 2);
1266 for (
int i = 0; i < nb_items; i++)
1268 renum_items_communs(i,0) = items_communs_voisin[i];
1269 renum_items_communs(i,1) = items_communs[i];
1284 md_vector.
copy(mdseq);
1289 const int nb_joints = joints.size();
1291 ArrOfInt pe_voisins(nb_joints);
1292 ArrsOfInt items_to_send(nb_joints);
1293 ArrsOfInt items_to_recv(nb_joints);
1294 ArrsOfInt blocs_to_recv(nb_joints);
1297 ArrOfBit flags(nb_items_reels);
1300 int nitems_tot = nb_items_reels;
1301 const int moi =
me();
1303 for (
int i_joint = 0; i_joint < nb_joints; i_joint++)
1305 const int pe = joints[i_joint].PEvoisin();
1306 pe_voisins[i_joint] = pe;
1307 const Joint_Items& joint = joints[i_joint].joint_item(type_item);
1315 assert((i_joint == 0) || (pe > joints[i_joint-1].PEvoisin()));
1319 ArrOfInt& dest = items_to_send[i_joint];
1321 for (
int i = 0; i < n; i++)
1323 const int item = items_communs[i];
1334 ArrOfInt& dest = items_to_recv[i_joint];
1336 for (
int i = 0; i < n; i++)
1338 const int item = items_communs[i];
1350 ArrOfInt& dest = blocs_to_recv[i_joint];
1351 if (nitems_virt > 0)
1355 dest[0] = nitems_tot;
1356 dest[1] = nitems_tot + nitems_virt;
1357 nitems_tot += nitems_virt;
1363 ArrOfInt& dest = items_to_send[i_joint];
1365 dest.
resize_array(index + n, RESIZE_OPTIONS::COPY_NOINIT);
1370 MD_Vector_std md(nitems_tot, nb_items_reels, pe_voisins, items_to_send, items_to_recv, blocs_to_recv);
1374 if (comm_check_enabled())
1404 trustIdType premier_indice_global_ = -100;
1414 TIDTab table_inverse_;
1424 md_items_ = md_items;
1436 premier_indice_global_ = decal;
1438 for (
int i = 0; i < nb_entites; i++)
1439 table_[i] = i + decal;
1440 table_.echange_espace_virtuel();
1445 const int nb_entites_tot = table_.size_totale();
1446 table_inverse_.resize(0, 2);
1448 for (
int i = 0; i < nb_entites_tot; i++)
1450 if (table_[i] != i + decal)
1451 table_inverse_.append_line(table_[i], i);
1454 if (table_inverse_.size_array()>0)
1456 tri_lexicographique_tableau(table_inverse_);
1464 table_inverse_.reset();
1478 int imax = table_inverse_.dimension(0) - 1;
1485 valeur = table_inverse_(0, 0);
1487 valeur = sommet_global - 1;
1491 const int milieu = (imin + imax) >> 1;
1492 valeur = table_inverse_(milieu, 0);
1493 const trustIdType compare = valeur - sommet_global;
1496 else if (compare > 0)
1499 imin = imax = milieu;
1502 valeur = table_inverse_(imin, 0);
1503 if (valeur == sommet_global)
1504 resu =
static_cast<int>(table_inverse_(imin, 1));
1517 ArrOfTID& indices_globaux,
int nb_items_a_traiter)
const
1519 for (
int i = 0; i < nb_items_a_traiter; i++)
1521 const int i_loc = indices_locaux[i];
1522 const trustIdType i_glob = (i_loc < 0) ? -1 : table_[i_loc];
1523 indices_globaux[i] = i_glob;
1533 ArrOfInt& indices_locaux)
const
1538 const int nb_indices = indices_globaux.
size_array();
1539 const int size_table = table_.size_array();
1540 for (i = 0; i < nb_indices; i++)
1542 const trustIdType i_glob = indices_globaux[i];
1553 i_loc =
static_cast<int>(i_glob - premier_indice_global_);
1554 if (i_loc < 0 || i_loc >= size_table || table_[i_loc] != i_glob)
1562 indices_locaux[i] = i_loc;
1584 TIDTab ind_glob_tab;
1585 ArrOfInt sz(tab.
nb_dim());
1587 ind_glob_tab.
resize(sz, RESIZE_OPTIONS::NOCOPY_NOINIT);
1590 IntVect& tableau = tab;
1591 TIDVect& indices_globaux = ind_glob_tab;
1595 const int nb_items_virtuels = nb_items_tot - nb_items_reels;
1605 src.
ref_array(indices_globaux, nb_items_reels , nb_items_virtuels );
1606 dest.
ref_array(tableau, nb_items_reels , nb_items_virtuels );
1627 const int error_is_fatal)
1643 <<
"] Error in Scatter::construire_espace_virtuel_traduction\n"
1644 <<
" the array does not have the good dimension on input" << finl;
1659 if (nb_erreurs > 0 && error_is_fatal)
1662 <<
"] Error in Scatter::construire_espace_virtuel_traduction\n"
1663 <<
" some indices of values were not found in\n"
1664 <<
" the local area : it missing virtual items"
1687 const int nb_joints = joints.size();
1698 for (i_joint = 0; i_joint < nb_joints; i_joint++)
1700 const int pe_voisin = joints[i_joint].PEvoisin();
1701 if (pe_voisin > moi)
1711 TIDTab faces_num_global;
1713 for (i_joint = 0; i_joint < nb_joints; i_joint++)
1715 const Joint& joint = joints[i_joint];
1716 const int pe_voisin = joint.
PEvoisin();
1717 if (pe_voisin > moi)
1728 faces_num_global.
resize(0);
1730 schema_comm.
send_buffer(pe_voisin) << faces_num_global;
1735 for (i_joint = 0; i_joint < nb_joints; i_joint++)
1737 Joint& joint = joints[i_joint];
1738 const int pe_voisin = joint.
PEvoisin();
1739 if (pe_voisin < moi)
1742 schema_comm.
recv_buffer(pe_voisin) >> faces_num_global;
1745 Cerr <<
"[PE " << moi
1746 <<
"] Error in Scatter::reordonner_faces_de_joint:\n"
1747 <<
" the number of joint faces is not identical to the PE "
1748 << pe_voisin << finl;
1751 const int nb_erreurs =
1756 Cerr <<
"[PE " << moi
1757 <<
"] Error in Scatter::reordonner_faces_de_joint:\n"
1758 <<
" The faces of the joint with PE " << pe_voisin
1759 <<
" use of unknown nodes" << finl;
1772static void calculer_liste_complete_sommets_joint(
const Joint& joint, ArrOfInt& liste_sommets)
1779 liste_sommets = ref_cast(ArrOfInt,som_faces);
1781 const ArrOfInt& som_isoles = joint.sommets();
1783 for (
int i = 0; i < n; i++)
1786 array_trier_retirer_doublons(liste_sommets);
1790inline int arete_de_sommets_Si_et_Sj(
const int Si,
const int Sj,
const int arete,
const IntTab& aretes_som)
1792 if ( (aretes_som(arete,0) == Si && aretes_som(arete,1) == Sj)
1793 || (aretes_som(arete,1) == Si && aretes_som(arete,0) == Sj) )
1804static void calculer_liste_complete_aretes_joint(
const Joint& joint, ArrOfInt& liste_aretes)
1814 const Domaine& dom=joint.
domaine();
1820 ArrOfInt som_faces(nb_faces_joint*nb_som_faces);
1822 for (
int face=0; face<nb_faces_joint; face++)
1823 for (
int i=0; i<nb_som_faces; i++)
1825 int Si = sommet(face,i);
1826 som_faces[face*nb_som_faces+i]=Si;
1827 for (
int j=i; j<nb_som_faces; j++)
1829 int Sj = sommet(face,j);
1832 positions(0,comp)=0.5*(coord(Si,comp)+coord(Sj,comp));
1836 if (aretes[0]>=0 && arete_de_sommets_Si_et_Sj(Si, Sj, aretes[0], aretes_som))
1843 Process::Journal() <<
"common edges found on faces of joint with " << joint.
PEvoisin() <<
" :" << compteur << finl;
1849 ArrOfInt som_isoles;
1851 calculer_liste_complete_sommets_joint(joint, som_isoles);
1853 array_trier_retirer_doublons(som_faces);
1855 array_retirer_elements(som_isoles, som_faces);
1863 for (
int i = 0; i < n; i++)
1864 for (
int j = i; j < n; j++)
1867 int Si = som_isoles[i];
1868 int Sj = som_isoles[j];
1870 positions(0,comp)=0.5*(coord(Si,comp)+coord(Sj,comp));
1874 if (aretes[0]>=0 && arete_de_sommets_Si_et_Sj(Si, Sj, aretes[0], aretes_som))
1880 Process::Journal() <<
"common edges found isolated on joint with " << joint.
PEvoisin() <<
" :" << compteur << finl;
1882 array_trier_retirer_doublons(liste_aretes);
1885static void calculer_liste_complete_items_joint(
const Joint& joint,
const JOINT_ITEM type_item, ArrOfInt& liste_items)
1889 case JOINT_ITEM::SOMMET:
1890 calculer_liste_complete_sommets_joint(joint, liste_items);
1892 case JOINT_ITEM::ARETE:
1893 calculer_liste_complete_aretes_joint(joint, liste_items);
1896 Cerr <<
"Error in Scatter::calculer_liste_complete_items_joint" << finl;
1897 Cerr <<
"Type of item not expected." << finl;
1914 Cerr <<
"Correction of remote spaces of the elements for the periodic faces" << finl;
1918 const int nb_elem = dom.
nb_elem();
1919 const IntTab& les_elems = dom.
les_elems();
1926 ArrOfInt element_oppose(nb_elem);
1928 Static_Int_Lists connectivite_som_elem;
1929 const int nb_sommets = dom.
nb_som();
1930 construire_connectivite_som_elem(nb_sommets,
1932 connectivite_som_elem,
1935 const int nb_som_face = dom.type_elem()->nb_som_face();
1936 ArrOfInt une_face(nb_som_face);
1937 ArrOfInt elems_voisins;
1943 ArrOfBit marqueurs_elements_distants(nb_elem);
1944 marqueurs_elements_distants = 0;
1950 int nb_elements_ajoutes = 0;
1953 nb_elements_ajoutes = 0;
1954 for (
auto& itr : liste_bords_periodiques)
1956 const Nom& nom_bord = itr;
1957 const Bord& bord = dom.
bord(nom_bord);
1959 const int nb_faces = bord.
nb_faces();
1965 element_oppose = -1;
1967 for (
int i_face = 0; i_face < nb_faces / 2; i_face++)
1973 for (
int quel_cote = 0; quel_cote < 2; quel_cote++)
1975 const int face = i_face + quel_cote * nb_faces / 2;
1977 for (i = 0; i < nb_som_face; i++)
1978 une_face[i] = faces_sommets(face, i);
1979 find_adjacent_elements(connectivite_som_elem, une_face, elems_voisins);
1983 Cerr <<
"Error in Scatter::corriger_espace_distant_elements_perio: \n"
1984 <<
" The face " << i_face <<
" of boundary " << nom_bord <<
" has "
1985 << n <<
" neighbors." << finl;
1989 elem0 = elems_voisins[0];
1991 elem1 = elems_voisins[0];
1993 element_oppose[elem0] = elem1;
1994 element_oppose[elem1] = elem0;
1998 for (
int i_joint = 0; i_joint < nb_joints; i_joint++)
2004 for (i = 0; i < n; i++)
2006 const int elem = elements_distants[i];
2007 marqueurs_elements_distants.
setbit(elem);
2010 for (i = 0; i < n; i++)
2012 const int elem = elements_distants[i];
2013 const int elem_oppose = element_oppose[elem];
2014 if (elem_oppose >= 0 && (!marqueurs_elements_distants.
testsetbit(elem_oppose)))
2017 nb_elements_ajoutes++;
2022 for (i = 0; i < n; i++)
2024 const int elem = elements_distants[i];
2025 marqueurs_elements_distants.
clearbit(elem);
2031 while (nb_elements_ajoutes > 0);
2033 for (
int i_joint = 0; i_joint < nb_joints; i_joint++)
2065 const IntTab& les_elems = dom.
les_elems();
2074 Cerr <<
"Calculation of remote space of elements : thickness " << epaisseur_joint << finl;
2083 ArrsOfInt liste_sommets(
nproc);
2086 ArrsOfInt elements_distants(
nproc);
2089 for (
int i = 0; i <
nproc; i++)
2096 Static_Int_Lists som_elem;
2099 Cerr <<
"Nodes-elements connectivity ..." << finl;
2100 const int nb_sommets = dom.
nb_som();
2101 construire_connectivite_som_elem(nb_sommets,
2107 ArrOfInt liste_pe_voisins(nbjoints);
2116 for (
int i_joint = 0; i_joint < nbjoints; i_joint++)
2118 const Joint& joint = dom.
joint(i_joint);
2120 liste_pe_voisins[i_joint] = pe;
2122 liste_sommets[pe] = sommets_joint;
2137 Static_Int_Lists data_sommets_communs;
2139 if (epaisseur_joint > 1)
2141 ArrOfInt count(dom.
nb_som());
2143 for (
int ijoint = 0; ijoint < nbjoints; ijoint++)
2145 const Joint& joint = dom.
joint(ijoint);
2148 for (
int i = 0; i < n; i++)
2150 const int som = sommets_joint[i];
2157 for (
int ijoint = 0; ijoint < nbjoints; ijoint++)
2159 const Joint& joint = dom.
joint(ijoint);
2162 const int n = renum_sommets.
dimension(0);
2163 for (
int i = 0; i < n; i++)
2166 const int i_sommet_distant = renum_sommets(i, 0);
2168 const int i_sommet_local = renum_sommets(i, 1);
2169 const int j = count[i_sommet_local]++;
2170 data_sommets_communs.
set_value(i_sommet_local, j*2, pe);
2171 data_sommets_communs.
set_value(i_sommet_local, j*2+1, i_sommet_distant);
2179 for (
int epaisseur = 1; ; epaisseur++)
2182 Cerr <<
" Calculation of the thickness " << epaisseur << finl;
2187 for (pe = 0; pe <
nproc; pe++)
2189 ArrOfInt& elems_dist = elements_distants[pe];
2190 const ArrOfInt& sommets = liste_sommets[pe];
2192 const int nb_som_liste = sommets.
size_array();
2193 for (
int isom = 0; isom < nb_som_liste; isom++)
2195 const int som = sommets[isom];
2199 for (
int ielem = 0; ielem < nb_elem_som; ielem++)
2201 const int elem = som_elem(som, ielem);
2205 array_trier_retirer_doublons(elems_dist);
2210 if (epaisseur == epaisseur_joint)
2214 for (pe = 0; pe <
nproc; pe++)
2216 ArrOfInt& sommets = liste_sommets[pe];
2217 const ArrOfInt& elems_dist = elements_distants[pe];
2219 const int nb_elems_dist = elems_dist.
size_array();
2220 for (
int ielem = 0; ielem < nb_elems_dist; ielem++)
2222 const int elem = elems_dist[ielem];
2223 for (
int isom = 0; isom < nb_som_elem; isom++)
2225 const int som = les_elems(elem, isom);
2229 array_trier_retirer_doublons(sommets);
2238 for (pe = 0; pe <
nproc; pe++)
2240 const ArrOfInt& sommets = liste_sommets[pe];
2241 const int nb_som_liste = sommets.
size_array();
2242 for (
int isom = 0; isom < nb_som_liste; isom++)
2244 const int i_sommet_local = sommets[isom];
2245 if (i_sommet_local<0)
2247 const int nb_pe_voisins = data_sommets_communs.
get_list_size(i_sommet_local) / 2;
2248 for (
int i = 0; i < nb_pe_voisins; i++)
2250 const int pe_voisin = data_sommets_communs(i_sommet_local, i*2);
2252 const int i_sommet_distant = data_sommets_communs(i_sommet_local, i*2+1);
2253 if (pe_voisin != pe)
2257 schema_comm.
send_buffer(pe_voisin) << pe << i_sommet_distant;
2263 for (
int i_pevoisin = 0; i_pevoisin < nbjoints; i_pevoisin++)
2265 const int pe_voisin = liste_pe_voisins[i_pevoisin];
2271 buffer >> pe2 >> sommet;
2274 liste_sommets[pe2].append_array(sommet);
2279 for (pe = 0; pe <
nproc; pe++)
2281 ArrOfInt& sommets = liste_sommets[pe];
2282 array_trier_retirer_doublons(sommets);
2291 for (
int pe = 0; pe <
nproc; pe++)
2292 if (elements_distants[pe].size_array() > 0)
2296#ifdef CHECK_ALGO_ESPACE_VIRTUEL
2302 bool erreur =
false;
2303 const int nbjoints = dom.nbjoints();
2304 for (
int i = 0; i < nbjoints; i++)
2306 Joint& joint = dom.
joint(i);
2310 Cerr <<
"Error in Scatter, PE " <<
Process::me() << finl;
2313 <<
" Scatter algorithm : " << elements_distants[pe] << finl;
2323 for (
int i = 0; i < nb_joints; i++)
2325 Joint& joint = dom.
joint(i);
2333static inline int fct_cmp_coordonnees(
const double * s1,
const double *s2,
int dim,
const double epsilon)
2335 assert(dim==2 || dim==3);
2336 if (s1[0] < s2[0] - epsilon)
2338 else if (s1[0] > s2[0] + epsilon)
2340 else if (s1[1] < s2[1] - epsilon)
2342 else if (s1[1] > s2[1] + epsilon)
2346 else if (s1[2] < s2[2] - epsilon)
2348 else if (s1[2] > s2[2] + epsilon)
2371 ArrOfInt& correspondance,
const double epsilon)
2373 const int nb_sommets1 = sommets1.
dimension(0);
2374 const int nb_sommets2 = sommets2.
dimension(0);
2376 assert(sommets1.
nb_dim() == 2);
2377 assert(sommets2.
nb_dim() == 2);
2378 assert(correspondance.
size_array() == nb_sommets2);
2379 if (nb_sommets1 < 1)
2381 correspondance = -1;
2387 ArrOfInt index(nb_sommets1);
2390 for (i = 0; i < nb_sommets1; i++)
2402 tri_lexicographique_tableau_indirect(sommets1, index);
2406 int nb_sommets_non_trouves = 0;
2407 int nb_echec_dichotomie = 0;
2411 for (i = 0; i < nb_sommets2; i++)
2413 const double * s2 = & sommets2(i,0);
2414 int num_sommet = -1;
2418 int imax = nb_sommets1 - 1;
2423 const int milieu = (imin + imax) >> 1;
2425 const double * s1 = & sommets1(k, 0);
2426 resu_cmp = fct_cmp_coordonnees(s1, s2, nb_dim, epsilon);
2436 imin = imax = milieu;
2443 const double * s1 = & sommets1(k, 0);
2444 resu_cmp = fct_cmp_coordonnees(s1, s2, nb_dim, epsilon);
2452 nb_echec_dichotomie++;
2456 for (j = 0; j < nb_sommets1; j++)
2458 const double * s1 = & sommets1(j,0);
2459 resu_cmp = fct_cmp_coordonnees(s1, s2, nb_dim, epsilon);
2463 if (j < nb_sommets1)
2466 nb_sommets_non_trouves++;
2469 correspondance[i] = num_sommet;
2473 if (nb_echec_dichotomie > 0)
2475 << nb_echec_dichotomie <<
" / " << nb_sommets2 << finl;
2477 return nb_sommets_non_trouves;
2487 const DoubleTab& coord_items,
bool allow_resize)
2491 case JOINT_ITEM::SOMMET:
2493 case JOINT_ITEM::ARETE:
2496 Cerr <<
"Scatter::construire_correspondance_items_par_coordonnees unusable for item "
2502 const int nb_joints = joints.size();
2505 ArrsOfInt indices_items_locaux(nb_joints);
2507 ArrsOfInt indices_items_distants(nb_joints);
2509 DoubleTabs coord_items_locaux(nb_joints);
2510 DoubleTabs coord_items_distants(nb_joints);
2514 for (
int i_joint = 0; i_joint < nb_joints; i_joint++)
2516 const Joint& joint = joints[i_joint];
2517 ArrOfInt& items = indices_items_locaux[i_joint];
2520 calculer_liste_complete_items_joint(joint, type_item, items);
2523 DoubleTab& coord = coord_items_locaux[i_joint];
2525 for (
int i = 0; i < n; i++)
2526 for (
int j = 0; j < dim; j++)
2527 coord(i,j) = coord_items(items[i], j);
2533 ArrOfInt liste_pe_voisins(nb_joints);
2535 for (i = 0; i < nb_joints; i++)
2536 liste_pe_voisins[i] = joints[i].PEvoisin();
2539 for (i = 0; i < nb_joints; i++)
2541 const int pe = liste_pe_voisins[i];
2543 buffer << indices_items_locaux[i];
2544 buffer << coord_items_locaux[i];
2547 for (i = 0; i < nb_joints; i++)
2549 const int pe = liste_pe_voisins[i];
2551 buffer >> indices_items_distants[i];
2552 buffer >> coord_items_distants[i];
2560 for (
int i_joint = 0; i_joint < nb_joints; i_joint++)
2562 Joint& joint = joints[i_joint];
2563 const int PEvoisin = joint.
PEvoisin();
2564 const ArrOfInt& indices_locaux = indices_items_locaux[i_joint];
2565 const DoubleTab& coord_locaux = coord_items_locaux[i_joint];
2566 const DoubleTab& coord_distants = coord_items_distants[i_joint];
2570 ArrOfInt corresp(n);
2574 int nb_items_communs_trouves=0;
2575 for (
int k = 0; k < n; k++)
2576 if (corresp[k]>=0) nb_items_communs_trouves++;
2583 assert(items_communs.
size_array() == nb_items_communs_trouves);
2588 int n_dist = coord_distants.
dimension(0);
2589 std::vector<bool> corres_ok(n_dist,
false);
2590 std::vector<int> offset(n_dist, 0);
2594 for(
int k = 0; k < n; k++)
2595 if (corresp[k] >= 0)
2596 corres_ok[corresp[k]] =
true;
2600 for(
int k = 0; k < n_dist; k++)
2601 offset[k] = corres_ok[k] ? nb_holes : nb_holes++;
2605 for (
int k = 0; k < n; k++)
2607 const int i_local = indices_locaux[k];
2609 const int j = corresp[k];
2616 Cerr <<
"Error in Scatter::remplir_renum_virt_loc on PE " << moi << finl
2617 <<
"The item of type " << (int)type_item <<
" number " << i_local <<
" with coordinates ";
2618 for (
int k2 = 0; k2 < dim; k2++)
2619 Cerr << coord_locaux(i, k2) <<
" ";
2620 Cerr << finl <<
"was not found in the joint with the PE " << PEvoisin << finl;
2621 if (type_item==JOINT_ITEM::ARETE)
2623 Cerr <<
"The searching algorithm of the isolated edges on a joint" << finl;
2624 Cerr <<
"does not work yet in some cases. Two isolated nodes of a joint (example below" << finl;
2625 Cerr <<
"joint between 0 and 2) can be those of an edge not belonging to this joint (below" << finl;
2626 Cerr <<
"the edge belongs to the joint 0-1 but not 0-2):" << finl;
2632 Cerr <<
" ________ " << finl;
2633 Cerr <<
"1\\ 2/1\\2 /1\\ " << finl;
2634 Cerr <<
"__\\/___\\/___\\" << finl;
2635 Cerr <<
" 0/\\ 0 /\\ 0 " << finl;
2636 Cerr <<
" / 0\\ / 0\\ " << finl;
2638 Cerr <<
"One way to by-pass this problem is to split again your domain with" << finl;
2639 Cerr <<
"different options of splitting or with another splitter to do not fall" << finl;
2640 Cerr <<
"on the same configuration." << finl;
2650 items_communs[i] = i_local;
2653 assert(i==0 || items_communs[i] > items_communs[i-1]);
2657 int j2 = j - offset[j];
2659 assert(items_communs[j2] < 0);
2660 items_communs[j2] = i_local;
2665 assert(i==nb_items_communs_trouves);
2699 const JOINT_ITEM type_item)
2702 const int nb_joints = joints.size();
2703 ArrOfInt liste_voisins(nb_joints);
2705 for (i_joint = 0; i_joint < nb_joints; i_joint++)
2706 liste_voisins[i_joint] = joints[i_joint].PEvoisin();
2711 for (i_joint = 0; i_joint < nb_joints; i_joint++)
2713 const Joint& joint = joints[i_joint];
2714 const Joint_Items& items = joint.
joint_item(type_item);
2722 for (i_joint = 0; i_joint < nb_joints; i_joint++)
2724 Joint& joint = joints[i_joint];
2741template <
typename _SIZE_>
2749 md.
copy(mdseq_elem);
2756template <
typename _SIZE_>
int testsetbit(int_t i) const
Renvoie la valeur du bit e, puis met le bit e a 1.
void setbit(int_t i) const
Met le bit e a 1.
void clearbit(int_t i) const
Met le bit e a 0.
classe Domaine_32_64 un Domaine est un maillage compose d'un ensemble d'elements geometriques de meme...
virtual void clear()
Reset the Domaine completely except for its name.
int nb_som_elem() const
Renvoie le nombre de sommets des elements geometriques constituants le domaine.
const IntTab_t & aretes_som() const
renvoie le tableau de connectivite aretes/sommets.
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)
Renumerotation des noeuds: Le noeud de numero k devient le noeud de numero 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)
Renumerotation des noeuds et des elements presents dans les items communs des joints.
int_t nb_som() const
Renvoie le nombre de sommets du domaine.
void ajouter(const DoubleTab_t &soms)
Ajoute des noeuds (ou sommets) au domaine (sans verifier les doublons).
const Noms & bords_perio() const
double xa(int num_arete, int k) const
const Nom & le_nom() const override
Donne le nom de l'Objet_U Methode a surcharger : renvoie "neant" dans cette implementation.
void set_fichier_lu(Nom &nom)
const Domaine & domaine() const
Lecture dans un fichier d'objets ecrits au format binaire.
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
Renvoie le tableau des sommets de toutes les faces.
int nb_som_faces() const
Renvoie le nombre de sommet par 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)
: Classe de postraitement des champs euleriens au format lata
int ecrire_entete(const double temps_courant, const int reprise, const int est_le_premier_post) override
Ouvre le fichier maitre en mode ERASE et ecrit l'entete du fichier lata (sur le processeur maitre seu...
virtual int initialize_lata(const Nom &file_basename, const Format format=ASCII, const Options_Para options_para=SINGLE_FILE)
Initialisation de la classe, ouverture du fichier et ecriture de l'entete.
int ecrire_domaine(const Domaine &domaine, const int est_le_premier_post) override
voir Format_Post_base::ecrire_domaine On accepte l'ecriture d'un domaine dans un pas de temps,...
int ecrire_temps(const double temps) override
commence l'ecriture d'un nouveau pas de temps En l'occurence pour le format LATA:
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
Donne un nom a la frontiere.
const Domaine_t & domaine() const
Renvoie le domaine associe a la frontiere.
int_t nb_faces() const
Renvoie le nombre de faces de la frontiere.
void associer_domaine(const Domaine_t &)
Associe la frontiere au domaine dont elle depend.
IntTab_t & les_sommets_des_faces()
Renvoie les sommets des faces de la frontiere.
const Faces_t & faces() const
Classe de base des objets "interprete".
static Objet_U & objet(const Nom &)
Voir Interprete_bloc::objet_global() BM: la classe Interprete n'est pas le meilleur endroit pour cett...
void affecte_epaisseur(int ep)
const Joint_Items_t & joint_item(JOINT_ITEM type) const
Renvoie les informations de joint pour le type demande.
void affecte_PEvoisin(int num)
Joint_Items_t & set_joint_item(JOINT_ITEM type)
Renvoie les informations de joint pour un type d'item geometrique donne, pour remplissage des structu...
const ArrOfInt_t & items_communs() const
const IntTab_t & renum_items_communs() const
Voir renum_items_communs_.
IntTab_t & set_renum_items_communs()
Voir renum_items_communs_ Voir Scatter::calculer_colonne0_renum_faces_communes.
ArrOfInt_t & set_items_communs()
Renvoie le tableau items_communs_ pour le remplir.
int nb_items_virtuels() const
Voir nb_items_virtuels_.
void set_nb_items_virtuels(int n)
Voir nb_items_virtuels_ Voir Scatter::calculer_nb_items_virtuels.
const ArrOfInt_t & items_distants() const
Voir items_distants_.
ArrOfInt_t & set_items_distants()
Renvoie le tableau items_distants_ pour le remplir Voir Scatter::calculer_espace_distant,...
Cette classe implemente les operateurs et les methodes virtuelles de la classe EFichier de la facon s...
int ouvrir(const char *name, IOS_OPEN_MODE mode=ios::in) override
Ouverture du fichier.
Lecture dans un fichier au format binaire.
int ouvrir(const char *name, IOS_OPEN_MODE mode=ios::in) override
Ouvre le fichier avec les parametres mode et prot donnes Ces parametres sont les parametres de la met...
virtual int get_nb_items_tot() const
virtual int get_nb_items_reels() const
Dummy parallel descriptor used for sequential computations.
C'est le plus simple des descripteurs, utilise pour les tableaux de valeurs aux sommets,...
: Cette classe est un OWN_PTR mais l'objet pointe est partage entre plusieurs
void copy(const MD_Vector_base &)
construction d'un objet MD_Vector par copie d'un objet existant.
const MD_Vector_base & valeur() const
Une chaine de caractere (Nom) en majuscules.
class Nom Une chaine de caractere pour nommer les objets de TRUST
const Nom getPrefix(const char *const) const
Nom nom_me(int, const char *prefix=0, int without_padding=0) const
Insere _prefix000n (n=me() ou nproc()) dans un nom de fichier (par ex:toto.
const std::string & getString() const
Un tableau de chaine de caracteres (VECT(Nom)).
const Nom & que_suis_je() const
renvoie la chaine identifiant la classe.
virtual Entree & readOn(Entree &)
Lecture d'un Objet_U sur un flot d'entree Methode a surcharger.
static double precision_geom
Objet_U()
Constructeur par defaut : attribue un numero d'identifiant unique a l'objet (object_id_),...
virtual Sortie & printOn(Sortie &) const
Ecriture de l'objet sur un flot de sortie Methode a surcharger.
static double mp_min(double)
static trustIdType mppartial_sum(trustIdType i)
Calul de la somme partielle de i sur les processeurs 0 a me()-1 (renvoie 0 sur le processeur 0).
static double mp_max(double)
static Sortie & Journal(int message_level=0)
Renvoie un objet statique de type Sortie qui sert de journal d'evenements.
static int nproc()
renvoie le nombre de processeurs dans le groupe courant Voir Comm_Group::nproc() et PE_Groups::curren...
static double mp_sum(double)
Calcule la somme de x sur tous les processeurs du groupe courant.
static void barrier()
Synchronise tous les processeurs du groupe courant (attend que tous les processeurs soient arrives a ...
static int me()
renvoie mon rang dans le groupe de communication courant.
static void exit(int exit_code=-1)
Routine de sortie de TRUST dans une region Kokkos.
static int je_suis_maitre()
renvoie 1 si on est sur le processeur maitre du groupe courant (c'est a dire me() == 0),...
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)
Reordonne les faces de joint de sorte qu'elles apparaissent dans le meme ordre sur chaque couple de p...
static int Chercher_Correspondance(const DoubleTab &sommets1, const DoubleTab &sommets2, ArrOfInt &correspondance, const double epsilon)
Construit le tableau "correspondance" tel que Pour 0 <= i < sommets2.
static void ajouter_joints(Domaine &domaine, ArrOfInt &pe_voisins)
Ajoute des joints avec tous les pe de 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)
Construit la structure items_communs + espaces virtuels d'un tableau contenant des indices d'items ge...
static void calculer_espace_distant_sommets(Domaine &dom)
En fonction de l'espace distant des elements, calcule l'espace distant des sommets.
Entree & interpreter(Entree &) override
Lit et complete un domaine parallele selon les motcles lus dans le jeu de donnees.
static void calculer_espace_distant_aretes(Domaine &domaine, const int nb_aretes_reelles, const IntTab &elem_aretes)
Idem que Scatter::calculer_espace_distant_sommets pour les aretes.
static void calculer_espace_distant_elements(Domaine &dom)
Remplissage du tableau "espace_distant()" des elements dans les joints.
static void calculer_espace_distant(Domaine &domaine, const int nb_items_reels, const ArrsOfInt &items_to_send, const JOINT_ITEM type_item)
Determination des items distants en fonction d'une liste d'items a envoyer et de listes d'items commu...
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)
Construction des structures paralleles du domaine et du domaine (determination des elements distants ...
static void calculer_nb_items_virtuels(Joints &joints, const JOINT_ITEM type_item)
Pour un item geometrique "type_item", remplit le champ nb_items_virtuels_ des joints en fonction du n...
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)
On suppose que chaque joint[i].joint_item(type_item).items_communs() contient les indices locaux des ...
static void construire_correspondance_sommets_par_coordonnees(Domaine &dom, bool allow_resize=false)
Construction des tableaux joint_item(JOINT_ITEM::SOMMET).items_communs de tous les joints du domaine(...
static void construire_md_vector(const Domaine &, int nb_items_reels, const JOINT_ITEM, MD_Vector &)
construction d'un MD_Vector_std a partir des informations de joint du domaine pour le type d'item dem...
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)
Les algorithmes actuels pour le periodique (assembleur P1B, OpDivElem P1B) ont besoin que pour chaque...
Domaine & domaine()
Renvoi le domaine associe.
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)
Idem que Scatter::calculer_espace_distant_sommets pour les faces.
virtual void lire_domaine(Nom &fil)
Lit le domaine dans le fichier de nom "nomentree", de type LecFicDistribueBin ou LecFicDistribue.
static void uninit_sequential_domain(Domaine_32_64< _SIZE_ > &dom)
methode utilisee par les interpretes qui modifient le domaine (sequentiel), detruit les descripteurs ...
static void construire_correspondance_aretes_par_coordonnees(Domaine_VF &zvf)
Construction des tableaux joint_item(JOINT_ITEM::ARETE).items_communs de tous les joints du domaine.
void echange_taille_et_messages() const
Cette methode lance l'echange de donnees entre tous les processeurs.
Sortie & send_buffer(int num_PE) const
renvoie le buffer correspondant au processeur num_PE pour y entasser des donnees a envoyer.
void end_comm() const
Vide les buffers et libere les ressources: on a fini de lire les donnees recues dans les buffers.
Entree & recv_buffer(int num_PE) const
renvoie le buffer correspondant au processeur num_PE pour y lire les donnees recues.
void begin_comm() const
Reserve les buffers de comm pour une nouvelle communication.
void set_send_recv_pe_list(const ArrOfInt &send_pe_list, const ArrOfInt &recv_pe_list, const int me_to_me=0)
Definit la liste des processeurs a qui on va envoyer et de qui on va recevoir des donnees.
Classe de base des flux de sortie.
void set_value(int_t i_liste, int_t i_element, int_t valeur)
affecte la "valeur" au j-ieme element de la i-ieme liste avec 0 <= i < get_nb_lists() et 0 <= j < get...
int_t get_list_size(int_t i_liste) const
renvoie le nombre d'elements de la liste i
void set_list_sizes(const ArrOfInt_t &sizes)
detruit les listes existantes et en cree de nouvelles.
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")
Cette classe fournit les outils pour construire l'espace virtuel d'un tableau contenant des indices d...
int chercher_table_inverse(const trustIdType sommet_global) const
Cherche i tel que table_inverse(i, 0) == sommet_global, et renvoie table_inverse(i,...
int traduire_espace_virtuel(IntTab &tableau) const
A partir d'un tableau dont la structure d'espace virtuel est initialisee (descripteurs elements dista...
void traduire_indice_local_vers_global(const ArrOfInt &indices_locaux, ArrOfTID &indices_globaux, int n) const
Transforme les indices locaux en indices globaux a l'aide la "table_" (voir initialiser).
int traduire_indice_global_vers_local(const ArrOfTID &indices_globaux, ArrOfInt &indices_locaux) const
Pour debut <= i < debut+nb indices_locaux[i] = chercher l'indice local de "indices_globaux[i]".
Traduction_Indice_Global_Local()
void initialiser(const MD_Vector &md_items)
Initialise le dictionnaire Precontition: