1 #ifndef _fei_LinearDecomposition_hpp_
2 #define _fei_LinearDecomposition_hpp_
9 template<
typename GlobalIDType>
13 GlobalIDType lowest_global_id,
14 GlobalIDType highest_global_id);
36 template<
typename GlobalIDType>
38 GlobalIDType lowest_global_id,
39 GlobalIDType highest_global_id)
40 : first_locally_owned_global(0),
41 last_locally_owned_global(0),
44 GlobalIDType num_global = highest_global_id - lowest_global_id + 1;
45 GlobalIDType num_local = num_global/
numProcs;
46 GlobalIDType remainder = num_global%
numProcs;
50 for(GlobalIDType i=0; i<remainder; ++i) {
56 GlobalIDType offset = 0;
69 template<
typename GlobalIDType>
72 if (id < first_global || id > last_global)
return -1;
74 for(
size_t i=1; i<proc_offsets.size(); ++i) {
75 if (first_global+proc_offsets[i] >
id)
return i-1;
78 int last_proc = proc_offsets.size() - 1;
GlobalIDType first_global_id() const
GlobalIDType last_global_id() const
LinearDecomposition(int localProc, int numProcs, GlobalIDType lowest_global_id, GlobalIDType highest_global_id)
GlobalIDType first_locally_owned_global_id() const
int which_proc(GlobalIDType id) const
GlobalIDType first_global
GlobalIDType last_locally_owned_global
GlobalIDType first_locally_owned_global
GlobalIDType last_locally_owned_global_id() const
std::vector< GlobalIDType > proc_offsets
int localProc(MPI_Comm comm)
int numProcs(MPI_Comm comm)