28 #if GETFEM_PARA_LEVEL > 1
39 void mesh_fem::enumerate_dof_para(
void)
const {
43 GMM_TRACE2(
"Enumeration dof para !!!!!!!!!!!!!!!!");
44 GMM_ASSERT1(linked_mesh_ != 0,
"Uninitialized mesh_fem");
46 if (fe_convex.card() == 0) {
47 dof_enumeration_made =
true;
52 dof_structure.
clear();
58 MPI_Comm_rank(MPI_COMM_WORLD, &num_rg);
59 MPI_Comm_size(MPI_COMM_WORLD, &nb_rg);
70 std::vector<size_type> list_of_dof_numeration;
71 std::vector<size_type> list_of_dof_num_rg;
72 dal::bit_vector enumeration_of_dof_made;
74 list_of_dof_numeration.resize(100000);
75 list_of_dof_num_rg.resize(100000);
79 std::vector<size_type> list_of_dof_linkable_index;
80 std::vector<size_type> list_of_dof_linkable_to;
82 list_of_dof_linkable_index.resize(10000);
83 list_of_dof_linkable_to.resize(10000);
86 std::vector<size_type> list_of_global_dof_index;
87 std::vector<size_type> list_of_global_dof_local_index;
89 list_of_global_dof_index.resize(10000);
90 list_of_global_dof_local_index.resize(10000);
97 std::vector<size_type> list_of_cv_num_rg;
99 std::vector<size_type> list_of_cv_first_index;
101 std::vector<size_type> list_of_icv;
102 std::vector<size_type> icv_in_list;
104 list_of_cv_num_rg.resize(10000);
105 list_of_cv_first_index.resize(10000);
106 list_of_icv.resize(1000);
107 icv_in_list.resize(1000);
114 cout<<
"cmk.size = "<<cmk.size()<<endl;
115 cout<<
"cmk[0] = "<<cmk[0]<<endl;
116 cout<<
"cml[10] = "<<cmk[10]<<endl;
120 std::vector<size_type> neighbors;
121 bgeot::pgeotrans_precomp pgp = 0;
123 bgeot::pgeotrans_precomp pgpj = 0;
127 GMM_TRACE2(
"Initialisation of lists cv");
129 cout<<
"me = "<<num_rg<<endl;
133 cout<<
"bool avant : "<<entre<<endl;
135 for(
size_type i = cmk[0]; i<cmk.size(); i++)
143 list_of_cv_num_rg[nb_cv] = num_rg;
145 list_of_cv_first_index[nb_cv] = iter_dof;
147 list_of_icv[nb_cv] = icv;
148 icv_in_list[icv] = nb_cv;
159 list_of_cv_num_rg[nb_cv] = 0;
160 list_of_cv_first_index[nb_cv] = 0;
161 list_of_icv[nb_cv]=0;
174 cout<<
"bool : "<<entre<<endl;
181 cout<<
"nb_cv_tot = "<<nb_cv<<endl;
186 std::vector<size_type> list_of_cv_num_rg_Recv;
187 std::vector<size_type> list_of_cv_first_index_Recv;
188 std::vector<size_type> list_of_icv_Recv;
189 std::vector<size_type> icv_in_list_Recv;
191 cout<<
"size(cv_num_rg) = "<<list_of_cv_num_rg.size()<<endl;
193 list_of_cv_num_rg.resize(nb_cv);
194 list_of_cv_num_rg_Recv.resize(nb_cv);
195 list_of_cv_first_index_Recv.resize(nb_cv);
196 list_of_icv_Recv.resize(nb_cv);
197 icv_in_list_Recv.resize(nb_cv);
199 MPI_Barrier(MPI_COMM_WORLD);
202 GMM_TRACE2(
"Echange MPI 2");
203 MPI_Allreduce (&list_of_cv_num_rg[0], &list_of_cv_num_rg_Recv, nb_cv,
204 MPI_UNSIGNED, MPI_SUM, MPI_COMM_WORLD);
206 cout<<
"num_rg[10] = "<<list_of_cv_num_rg[10]<<endl;
207 cout<<
"num_rg_Recv[10] = "<<list_of_cv_num_rg_Recv[10]<<endl;
209 GMM_TRACE2(
"Echange 3");
211 MPI_Allreduce (&list_of_cv_first_index[0], &list_of_cv_first_index_Recv, nb_cv,
212 MPI_UNSIGNED, MPI_SUM, MPI_COMM_WORLD);
214 GMM_TRACE2(
"Echange 4");
215 MPI_Allreduce (&list_of_icv[0], &list_of_icv_Recv, nb_cv,
216 MPI_UNSIGNED, MPI_SUM, MPI_COMM_WORLD);
218 GMM_TRACE2(
"Echange 5");
220 MPI_Allreduce (&icv_in_list[0], &icv_in_list_Recv, nb_cv,
221 MPI_UNSIGNED, MPI_SUM, MPI_COMM_WORLD);
232 GMM_TRACE2(
"Attributions des ddl aux rg");
233 for(
size_type cv = 0; cv < list_of_cv_num_rg_Recv.size(); ++cv)
236 if (list_of_cv_num_rg_Recv[cv] == num_rg)
244 for (
size_type i = list_of_cv_first_index_Recv[cv];
245 i <= list_of_cv_first_index_Recv[cv] + nbd; i++)
247 fd.pnd = pf->dof_types()[i];
248 fd.part = get_dof_partition(icv);
256 pgp->transform(
linked_mesh().points_of_convex(icv), i, P);
260 for (
size_type jcv = neighbors[0]; jcv < neighbors.size(); ++jcv)
263 if (list_of_cv_num_rg_Recv[icv_in_list_Recv[jcv]] == num_rg)
268 else if (list_of_cv_num_rg_Recv[icv_in_list_Recv[jcv]] > num_rg)
274 if (bool_rg == neighbors.size() || bool_inter+bool_rg == neighbors.size())
288 list_of_dof_num_rg[i] = num_rg;
289 for (
size_type jcv = neighbors[0]; jcv < neighbors.size(); ++jcv)
297 pgpj->transform(
linked_mesh().points_of_convex(jcv), j, Pj);
300 list_of_dof_linkable_index[nb_dof_linkable] =
301 list_of_cv_first_index_Recv[icv_in_list_Recv[jcv]]+j;
302 list_of_dof_linkable_to[nb_dof_linkable] = i;
304 list_of_dof_num_rg[list_of_cv_first_index_Recv
305 [icv_in_list_Recv[jcv]]+j] = num_rg;
313 else if(fd.pnd == andof)
316 size_type num = pf->index_of_global_dof(icv, i);
317 list_of_global_dof_index[nb_global_dof] = num;
318 list_of_global_dof_local_index [nb_global_dof] = i;
319 list_of_dof_num_rg[i] = num_rg;
326 list_of_dof_num_rg[i] = num_rg;
338 MPI_Allreduce (&nb_dof_rg, &nb_dof_tot, 1, MPI_UNSIGNED, MPI_SUM, MPI_COMM_WORLD);
341 for (
int p = 0; p < nb_rg; p++)
346 MPI_Recv(&nbd_p, 1, MPI_UNSIGNED, p, 100, MPI_COMM_WORLD, &mstatus);
352 MPI_Send(&nb_dof_rg, 1, MPI_UNSIGNED, p, 100, MPI_COMM_WORLD);
357 std::vector<size_type> list_of_dof_num_rg_Recv;
358 list_of_dof_num_rg_Recv.resize(nb_dof_tot);
361 MPI_Allreduce(&list_of_dof_num_rg[0], &list_of_dof_num_rg_Recv, nb_dof_tot,
362 MPI_UNSIGNED, MPI_SUM, MPI_COMM_WORLD);
365 std::vector<size_type> list_of_global_dof_index_Recv;
366 std::vector<size_type> list_of_global_dof_local_index_Recv;
370 MPI_Allreduce (&nb_global_dof, &nb_global_dof_tot, 1, MPI_UNSIGNED, MPI_SUM, MPI_COMM_WORLD);
372 list_of_global_dof_index_Recv.resize(nb_global_dof_tot);
373 list_of_global_dof_local_index_Recv.resize(nb_global_dof_tot);
375 for (
int p = 0; p<nb_rg; p++)
377 MPI_Send (&nb_global_dof, 1, MPI_UNSIGNED, p, 200, MPI_COMM_WORLD);
378 MPI_Recv (&nb_global_dof_Recv, 1, MPI_UNSIGNED, p, 200, MPI_COMM_WORLD, &mstatus);
380 MPI_Send(&list_of_global_dof_index[0], nb_global_dof, MPI_UNSIGNED, p, 300, MPI_COMM_WORLD);
382 MPI_Recv (&list_of_global_dof_index_Recv[0], nb_global_dof_Recv,
383 MPI_UNSIGNED, p, 300, MPI_COMM_WORLD, &mstatus);
385 MPI_Send(&list_of_global_dof_local_index[0], nb_global_dof, MPI_UNSIGNED, p, 400, MPI_COMM_WORLD);
387 MPI_Recv (&list_of_global_dof_local_index_Recv[0], nb_global_dof_Recv,
388 MPI_UNSIGNED, p, 400, MPI_COMM_WORLD, &mstatus);
395 GMM_TRACE2(
"Numerotation des ddl");
397 for(
size_type icv = 0; icv < list_of_cv_num_rg_Recv.size(); ++icv)
403 for (
size_type i = list_of_cv_first_index_Recv[icv];
404 i <= list_of_cv_first_index_Recv[icv] + nbd; i++)
406 if (list_of_dof_num_rg_Recv[i] == num_rg && !enumeration_of_dof_made[i])
410 list_of_dof_numeration[i] = numerot;
411 numerot += Qdim / pf->target_dim();
417 while (list_of_dof_linkable_to[ind_linkable] == i)
420 list_of_dof_numeration[list_of_dof_linkable_index[ind_linkable]] = numerot;
421 enumeration_of_dof_made[list_of_dof_linkable_index[ind_linkable]] =
true;
424 list_of_dof_numeration[i] = numerot;
425 enumeration_of_dof_made[i] =
true;
426 numerot += Qdim / pf->target_dim();
443 for (size_type j = i; j < list_of_global_dof_index_Recv.size(); j++)
446 if (list_of_global_dof_index_Recv[j] == list_of_global_dof_index_Recv[i]
447 && !enumeration_of_dof_made[j])
449 list_of_dof_numeration[list_of_global_dof_local_index_Recv[j]] = numerot;
450 enumeration_of_dof_made[list_of_gloabl_dof_local_index_Recv[j]] = true;
453 list_of_dof_numeration[list_of_global_dof_local_index[i]] = numerot;
454 enumeration_of_dof_made[list_of_global_dof_local_index[i]] = true;
455 numerot += Qdim / pf->target_dim();
462 std::vector<size_type> list_of_dof_numeration_Recv;
463 list_of_dof_numeration_Recv.resize(nb_dof_tot);
465 MPI_Allreduce(&list_of_dof_numeration[0], &list_of_dof_numeration_Recv, numerot,
466 MPI_UNSIGNED, MPI_SUM, MPI_COMM_WORLD);
469 GMM_TRACE2(
"Envoi de la numerotation");
470 std::vector<size_type> tab;
472 for(
size_type icv = 0; icv < list_of_cv_num_rg.size(); ++icv)
475 if (list_of_cv_num_rg[icv] == num_rg)
479 for (
size_type i = list_of_cv_first_index_Recv[icv]; i < list_of_cv_first_index_Recv[icv] + nbd; i++)
481 tab[ind_tab] = list_of_dof_numeration[i];
485 dof_structure.add_convex_noverif(pf->structure(icv), tab.begin(), icv);
488 nb_total_dof = nb_dof_tot;
const dal::bit_vector & convex_index() const
Return the list of valid convex IDs.
void clear()
erase the mesh
const ind_cv_ct & convex_to_point(size_type ip) const
Return a container of the convexes attached to point ip.
bool context_check() const
return true if update_from_context was called
const mesh & linked_mesh() const
Return a reference to the underlying mesh.
virtual pfem fem_of_element(size_type cv) const
Return the basic fem associated with an element (if no fem is associated, the function will crash!...
const std::vector< size_type > & cuthill_mckee_ordering() const
Return the list of convex IDs for a Cuthill-McKee ordering.
size_type nb_points() const
Give the number of geometrical nodes in the mesh.
A simple singleton implementation.
Define the getfem::mesh_fem class.
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.
dof_description * pdof_description
Type representing a pointer on a dof_description.
std::shared_ptr< const getfem::virtual_fem > pfem
type of pointer on a fem description
size_t size_type
used as the common size type in the library
GEneric Tool for Finite Element Methods.