rheolef  6.5
hack_array_mpi_tst.cc
Go to the documentation of this file.
1 // alloues dynamiquement => la memoire n'est pas contigue globalement
2 #include "rheolef/hack_array.h"
3 #include "rheolef/geo_element.h"
4 using namespace rheolef;
5 using namespace std;
6 
7 int main(int argc, char**argv)
8 {
9  environment env (argc, argv);
10  check_macro (communicator().size() == 2, "expect nproc = 2");
11  size_t dis_size = 50;
12  distributor ownership (dis_size, communicator(), distributor::decide);
13  check_macro (sizeof(geo_element_hack) == sizeof(geo_element::size_type), "portability problem");
14  size_t order = 1;
15  geo_element::parameter_type param (reference_element::e, order); // edge, order 1
16  hack_array<geo_element_hack> ge_e (ownership,param);
18  size_t jproc = (communicator().rank() == 0) ? 1 : 0;
19  if (communicator().rank() == 0) {
20  E[0] = 5;
21  E[1] = 18;
22  } else {
23  E[0] = 6;
24  E[1] = 19;
25  }
26  for (size_t dis_i = ownership.first_index(jproc), dis_n = ownership.last_index(jproc); dis_i < dis_n; dis_i++) {
27  ge_e.dis_entry(dis_i) = E;
28  }
29  ge_e.dis_entry_assembly();
30  ge_e.put_values (dout);
31 }
32