29 #if GETFEM_PARA_LEVEL > 1 40 void mesh_fem::enumerate_dof_para(
void)
const {
44 GMM_TRACE2(
"Enumeration dof para !!!!!!!!!!!!!!!!");
45 GMM_ASSERT1(linked_mesh_ != 0,
"Uninitialized mesh_fem");
47 if (fe_convex.card() == 0) {
48 dof_enumeration_made =
true;
53 dof_structure.clear();
59 MPI_Comm_rank(MPI_COMM_WORLD, &num_rg);
60 MPI_Comm_size(MPI_COMM_WORLD, &nb_rg);
63 cout<<
"nb total region : "<<nb_rg<<
" et nb_points = "<<linked_mesh().nb_points()<<endl;
71 std::vector<size_type> list_of_dof_numeration;
72 std::vector<size_type> list_of_dof_num_rg;
73 dal::bit_vector enumeration_of_dof_made;
75 list_of_dof_numeration.resize(100000);
76 list_of_dof_num_rg.resize(100000);
80 std::vector<size_type> list_of_dof_linkable_index;
81 std::vector<size_type> list_of_dof_linkable_to;
83 list_of_dof_linkable_index.resize(10000);
84 list_of_dof_linkable_to.resize(10000);
87 std::vector<size_type> list_of_global_dof_index;
88 std::vector<size_type> list_of_global_dof_local_index;
90 list_of_global_dof_index.resize(10000);
91 list_of_global_dof_local_index.resize(10000);
98 std::vector<size_type> list_of_cv_num_rg;
100 std::vector<size_type> list_of_cv_first_index;
102 std::vector<size_type> list_of_icv;
103 std::vector<size_type> icv_in_list;
105 list_of_cv_num_rg.resize(10000);
106 list_of_cv_first_index.resize(10000);
107 list_of_icv.resize(1000);
108 icv_in_list.resize(1000);
112 const std::vector<size_type> &cmk = linked_mesh().cuthill_mckee_ordering();
115 cout<<
"cmk.size = "<<cmk.size()<<endl;
116 cout<<
"cmk[0] = "<<cmk[0]<<endl;
117 cout<<
"cml[10] = "<<cmk[10]<<endl;
118 cout<<
"nb_cv = "<<linked_mesh().convex_index().card()<<endl;
121 std::vector<size_type> neighbours;
122 bgeot::pgeotrans_precomp pgp = 0;
124 bgeot::pgeotrans_precomp pgpj = 0;
128 GMM_TRACE2(
"Initialisation of lists cv");
130 cout<<
"me = "<<num_rg<<endl;
134 cout<<
"bool avant : "<<entre<<endl;
136 for(
size_type i = cmk[0]; i<cmk.size(); i++)
139 if(linked_mesh().region(num_rg).is_in(icv))
144 list_of_cv_num_rg[nb_cv] = num_rg;
146 list_of_cv_first_index[nb_cv] = iter_dof;
148 list_of_icv[nb_cv] = icv;
149 icv_in_list[icv] = nb_cv;
151 pfem pf = fem_of_element(icv);
160 list_of_cv_num_rg[nb_cv] = 0;
161 list_of_cv_first_index[nb_cv] = 0;
162 list_of_icv[nb_cv]=0;
165 pfem pf = fem_of_element(icv);
175 cout<<
"bool : "<<entre<<endl;
182 cout<<
"nb_cv_tot = "<<nb_cv<<endl;
187 std::vector<size_type> list_of_cv_num_rg_Recv;
188 std::vector<size_type> list_of_cv_first_index_Recv;
189 std::vector<size_type> list_of_icv_Recv;
190 std::vector<size_type> icv_in_list_Recv;
192 cout<<
"size(cv_num_rg) = "<<list_of_cv_num_rg.size()<<endl;
194 list_of_cv_num_rg.resize(nb_cv);
195 list_of_cv_num_rg_Recv.resize(nb_cv);
196 list_of_cv_first_index_Recv.resize(nb_cv);
197 list_of_icv_Recv.resize(nb_cv);
198 icv_in_list_Recv.resize(nb_cv);
200 MPI_Barrier(MPI_COMM_WORLD);
203 GMM_TRACE2(
"Echange MPI 2");
204 MPI_Allreduce (&list_of_cv_num_rg[0], &list_of_cv_num_rg_Recv, nb_cv,
205 MPI_UNSIGNED, MPI_SUM, MPI_COMM_WORLD);
207 cout<<
"num_rg[10] = "<<list_of_cv_num_rg[10]<<endl;
208 cout<<
"num_rg_Recv[10] = "<<list_of_cv_num_rg_Recv[10]<<endl;
210 GMM_TRACE2(
"Echange 3");
212 MPI_Allreduce (&list_of_cv_first_index[0], &list_of_cv_first_index_Recv, nb_cv,
213 MPI_UNSIGNED, MPI_SUM, MPI_COMM_WORLD);
215 GMM_TRACE2(
"Echange 4");
216 MPI_Allreduce (&list_of_icv[0], &list_of_icv_Recv, nb_cv,
217 MPI_UNSIGNED, MPI_SUM, MPI_COMM_WORLD);
219 GMM_TRACE2(
"Echange 5");
221 MPI_Allreduce (&icv_in_list[0], &icv_in_list_Recv, nb_cv,
222 MPI_UNSIGNED, MPI_SUM, MPI_COMM_WORLD);
233 GMM_TRACE2(
"Attributions des ddl aux rg");
234 for(
size_type cv = 0; cv < list_of_cv_num_rg_Recv.size(); ++cv)
237 if (list_of_cv_num_rg_Recv[cv] == num_rg)
239 pfem pf = fem_of_element(icv);
245 for (
size_type i = list_of_cv_first_index_Recv[cv];
246 i <= list_of_cv_first_index_Recv[cv] + nbd; i++)
248 fd.pnd = pf->dof_types()[i];
249 fd.part = get_dof_partition(icv);
256 P.resize(linked_mesh().dim());
257 pgp->transform(linked_mesh().points_of_convex(icv), i, P);
260 neighbours = linked_mesh().convex_to_point(i);
261 for (
size_type jcv = neighbours[0]; jcv < neighbours.size(); ++jcv)
264 if (list_of_cv_num_rg_Recv[icv_in_list_Recv[jcv]] == num_rg)
269 else if (list_of_cv_num_rg_Recv[icv_in_list_Recv[jcv]] > num_rg)
275 if (bool_rg == neighbours.size() || bool_inter+bool_rg == neighbours.size())
289 list_of_dof_num_rg[i] = num_rg;
290 for (
size_type jcv = neighbours[0]; jcv < neighbours.size(); ++jcv)
293 pfem pfj = fem_of_element(jcv);
297 Pj.resize(linked_mesh().dim());
298 pgpj->transform(linked_mesh().points_of_convex(jcv), j, Pj);
301 list_of_dof_linkable_index[nb_dof_linkable] =
302 list_of_cv_first_index_Recv[icv_in_list_Recv[jcv]]+j;
303 list_of_dof_linkable_to[nb_dof_linkable] = i;
305 list_of_dof_num_rg[list_of_cv_first_index_Recv
306 [icv_in_list_Recv[jcv]]+j] = num_rg;
314 else if(fd.pnd == andof)
317 size_type num = pf->index_of_global_dof(icv, i);
318 list_of_global_dof_index[nb_global_dof] = num;
319 list_of_global_dof_local_index [nb_global_dof] = i;
320 list_of_dof_num_rg[i] = num_rg;
327 list_of_dof_num_rg[i] = num_rg;
339 MPI_Allreduce (&nb_dof_rg, &nb_dof_tot, 1, MPI_UNSIGNED, MPI_SUM, MPI_COMM_WORLD);
342 for (
int p = 0; p < nb_rg; p++)
347 MPI_Recv(&nbd_p, 1, MPI_UNSIGNED, p, 100, MPI_COMM_WORLD, &mstatus);
353 MPI_Send(&nb_dof_rg, 1, MPI_UNSIGNED, p, 100, MPI_COMM_WORLD);
358 std::vector<size_type> list_of_dof_num_rg_Recv;
359 list_of_dof_num_rg_Recv.resize(nb_dof_tot);
362 MPI_Allreduce(&list_of_dof_num_rg[0], &list_of_dof_num_rg_Recv, nb_dof_tot,
363 MPI_UNSIGNED, MPI_SUM, MPI_COMM_WORLD);
366 std::vector<size_type> list_of_global_dof_index_Recv;
367 std::vector<size_type> list_of_global_dof_local_index_Recv;
371 MPI_Allreduce (&nb_global_dof, &nb_global_dof_tot, 1, MPI_UNSIGNED, MPI_SUM, MPI_COMM_WORLD);
373 list_of_global_dof_index_Recv.resize(nb_global_dof_tot);
374 list_of_global_dof_local_index_Recv.resize(nb_global_dof_tot);
376 for (
int p = 0; p<nb_rg; p++)
378 MPI_Send (&nb_global_dof, 1, MPI_UNSIGNED, p, 200, MPI_COMM_WORLD);
379 MPI_Recv (&nb_global_dof_Recv, 1, MPI_UNSIGNED, p, 200, MPI_COMM_WORLD, &mstatus);
381 MPI_Send(&list_of_global_dof_index[0], nb_global_dof, MPI_UNSIGNED, p, 300, MPI_COMM_WORLD);
383 MPI_Recv (&list_of_global_dof_index_Recv[0], nb_global_dof_Recv,
384 MPI_UNSIGNED, p, 300, MPI_COMM_WORLD, &mstatus);
386 MPI_Send(&list_of_global_dof_local_index[0], nb_global_dof, MPI_UNSIGNED, p, 400, MPI_COMM_WORLD);
388 MPI_Recv (&list_of_global_dof_local_index_Recv[0], nb_global_dof_Recv,
389 MPI_UNSIGNED, p, 400, MPI_COMM_WORLD, &mstatus);
396 GMM_TRACE2(
"Numerotation des ddl");
398 for(
size_type icv = 0; icv < list_of_cv_num_rg_Recv.size(); ++icv)
400 pfem pf = fem_of_element(icv);
404 for (
size_type i = list_of_cv_first_index_Recv[icv];
405 i <= list_of_cv_first_index_Recv[icv] + nbd; i++)
407 if (list_of_dof_num_rg_Recv[i] == num_rg && !enumeration_of_dof_made[i])
411 list_of_dof_numeration[i] = numerot;
412 numerot += Qdim / pf->target_dim();
418 while (list_of_dof_linkable_to[ind_linkable] == i)
421 list_of_dof_numeration[list_of_dof_linkable_index[ind_linkable]] = numerot;
422 enumeration_of_dof_made[list_of_dof_linkable_index[ind_linkable]] =
true;
425 list_of_dof_numeration[i] = numerot;
426 enumeration_of_dof_made[i] =
true;
427 numerot += Qdim / pf->target_dim();
444 for (size_type j = i; j < list_of_global_dof_index_Recv.size(); j++)
447 if (list_of_global_dof_index_Recv[j] == list_of_global_dof_index_Recv[i]
448 && !enumeration_of_dof_made[j])
450 list_of_dof_numeration[list_of_global_dof_local_index_Recv[j]] = numerot;
451 enumeration_of_dof_made[list_of_gloabl_dof_local_index_Recv[j]] = true;
454 list_of_dof_numeration[list_of_global_dof_local_index[i]] = numerot;
455 enumeration_of_dof_made[list_of_global_dof_local_index[i]] = true;
456 numerot += Qdim / pf->target_dim();
463 std::vector<size_type> list_of_dof_numeration_Recv;
464 list_of_dof_numeration_Recv.resize(nb_dof_tot);
466 MPI_Allreduce(&list_of_dof_numeration[0], &list_of_dof_numeration_Recv, numerot,
467 MPI_UNSIGNED, MPI_SUM, MPI_COMM_WORLD);
470 GMM_TRACE2(
"Envoi de la numerotation");
471 std::vector<size_type> tab;
473 for(
size_type icv = 0; icv < list_of_cv_num_rg.size(); ++icv)
475 pfem pf = fem_of_element(icv);
476 if (list_of_cv_num_rg[icv] == num_rg)
480 for (
size_type i = list_of_cv_first_index_Recv[icv]; i < list_of_cv_first_index_Recv[icv] + nbd; i++)
482 tab[ind_tab] = list_of_dof_numeration[i];
486 dof_structure.add_convex_noverif(pf->structure(icv), tab.begin(), icv);
489 nb_total_dof = nb_dof_tot;
dof_description * pdof_description
Type representing a pointer on a dof_description.
Define the getfem::mesh_fem class.
size_t size_type
used as the common size type in the library
A simple singleton implementation.
GEneric Tool for Finite Element Methods.
std::shared_ptr< const getfem::virtual_fem > pfem
type of pointer on a fem description
bool dof_linkable(pdof_description)
Says if the dof is linkable.
pdof_description global_dof(dim_type d)
Description of a global dof, i.e.