rheolef  6.5
msg_from_context_indices.h
Go to the documentation of this file.
1 #ifndef RHEO_MSG_FROM_CONTEXT_INDICES_H
2 #define RHEO_MSG_FROM_CONTEXT_INDICES_H
3 
4 # include "rheolef/msg_util.h"
5 namespace rheolef {
6 
48 template <
49  class InputIterator1,
50  class InputIterator2,
51  class InputRandomIterator,
52  class Proc,
53  class Size,
54  class MutableRandomIterator,
55  class OutputIterator>
56 void
58  InputIterator1 owner, // nidx
59  InputIterator1 last_owner,
60  InputIterator2 idy, // nidx
61  InputRandomIterator proc2from_proc, // nproc
62  Proc my_proc,
63  Size idy_maxval,
64  MutableRandomIterator ptr, // send_nproc+1
65  OutputIterator from_idx) // nidx
66 {
67  Size nidx = distance(owner,last_owner);
68  for (Size i = 0; i < nidx; i++) {
69  if (owner[i] != my_proc) {
70  assert_macro (idy[i] < idy_maxval, "Scattering past end of TO vector: idy="
71  << idy[i] << " out of range 0.." << idy_maxval-1);
72  Size p = ptr[proc2from_proc[owner[i]]]++;
73  from_idx[p] = idy[i];
74  }
75  }
76 }
77 @endcode
78 } // namespace rheolef
79 #endif // RHEO_MSG_FROM_CONTEXT_INDICES_H
80