~ubuntu-branches/ubuntu/saucy/rheolef/saucy

« back to all changes in this revision

Viewing changes to skit/ptst2/array_of_idxset_scatter_tst.cc

  • Committer: Package Import Robot
  • Author(s): Pierre Saramito, Pierre Saramito, Sylvestre Ledru
  • Date: 2012-05-14 14:02:09 UTC
  • mfrom: (1.1.6)
  • Revision ID: package-import@ubuntu.com-20120514140209-dzbdlidkotyflf9e
Tags: 6.1-1
[ Pierre Saramito ]
* New upstream release 6.1 (minor changes):
  - support arbitrarily polynomial order Pk
  - source code supports g++-4.7 (closes: #671996)

[ Sylvestre Ledru ]
* update of the watch file

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
#include "rheolef/array.h"
27
27
#include "rheolef/index_set.h"
28
28
using namespace rheolef;
29
 
using namespace std;
30
 
 
31
29
int main(int argc, char**argv) {
32
30
  environment rheolef(argc, argv);
33
31
  communicator comm;
36
34
  din >> dis_n;
37
35
  array<index_set> x (dis_n);
38
36
  x.get_values (din);
39
 
  set<size_t> ext_idx_set;
 
37
  std::set<size_t> ext_idx_set;
40
38
  switch (comm.rank()) {
41
39
       case 0:
42
40
                ext_idx_set.insert (3);
52
50
                break;
53
51
       default: error_macro ("unsupported np >= 4");
54
52
  }
55
 
  map <size_t,index_set> ext_idx_map;
 
53
  std::map <size_t,index_set> ext_idx_map;
56
54
  x.get_dis_entry (ext_idx_set, ext_idx_map);
57
55
  // print in rank-dependent files:
58
56
  std::string filename = "array_of_idxset_scatter_tst-" + itos(comm.rank());
59
57
  std::ofstream out (filename.c_str());
60
 
  for (map <size_t,index_set>::const_iterator iter = ext_idx_map.begin(), last = ext_idx_map.end();
 
58
  for (std::map<size_t,index_set>::const_iterator iter = ext_idx_map.begin(), last = ext_idx_map.end();
61
59
        iter != last; iter++) {
62
 
      out << "proc " << comm.rank() << ": x[" << (*iter).first << "] = " << (*iter).second << endl;
 
60
      out << "proc " << comm.rank() << ": x[" << (*iter).first << "] = " << (*iter).second << std::endl;
63
61
  }
64
62
}
65
63
#endif // _RHEOLEF_HAVE_MPI