2 #ifndef _PROTO_BOX_PARTITION_ 3 #define _PROTO_BOX_PARTITION_ 6 #include <unordered_map> 41 const std::vector<Point>& a_patches);
55 const std::vector<Point>& a_patches,
56 unsigned int a_startProc,
57 unsigned int a_endProc);
62 const std::vector<std::pair<Point,unsigned int>>& a_assignedPatches);
76 const std::vector<Point>& a_patches,
77 unsigned int a_startProc,
78 unsigned int a_endProc);
90 const std::vector<std::pair<Point,unsigned int>>& a_assignedPatches);
96 inline std::shared_ptr<BoxPartition>
sortByProc()
const;
110 std::vector<Point>& a_patches,
111 unsigned int a_startProc,
112 unsigned int a_endProc);
125 template<
typename... vals>
127 std::vector<Point>& a_patches,
141 std::vector<std::pair<int, unsigned int>>& a_assignment,
142 std::vector<Point>& a_patches);
155 std::vector<std::pair<int, unsigned int>>& a_assignment);
168 inline unsigned int numProcs()
const;
174 inline unsigned int numBoxes()
const;
180 inline unsigned int numBoxes(
unsigned int a_proc)
const;
187 inline const std::vector<std::pair<Point, unsigned int>>&
partition()
const 202 inline unsigned int procEndIndex(
unsigned int a_proc)
const;
209 inline unsigned int globalIndex(
unsigned int a_localIndex,
unsigned int a_proc);
216 inline unsigned int localIndex(
unsigned int a_globalIndex,
unsigned int a_proc);
227 inline void print()
const;
233 inline bool checkProcSorting(
const std::vector<std::pair<Point, unsigned int>> a_data);
235 template<
typename... vals>
237 std::vector<Point>& a_patches,
238 unsigned int a_globalIndex,
244 std::vector<Point>& a_patches,
245 unsigned int a_globalIndex,
253 std::unordered_map<unsigned int, std::pair<unsigned int, unsigned int>>
m_procMap;
258 #include "implem/Proto_BoxPartitionImplem.H" 260 #endif //end include guard void define(const ProblemDomain &a_patchDomain, const std::vector< std::pair< Point, unsigned int >> &a_assignedPatches)
Define.
Definition: Proto_BoxPartition.H:70
unsigned int find(Point a_pt)
Get Patch Index.
Definition: Proto_BoxPartition.H:324
bool doLoadBalance() const
Check If This Controls Load Balancing.
Definition: Proto_BoxPartition.H:230
const std::vector< std::pair< Point, unsigned int > > & partition() const
Access Partition.
Definition: Proto_BoxPartition.H:187
unsigned int globalIndex(unsigned int a_localIndex, unsigned int a_proc)
Get Global Index.
Definition: Proto_BoxPartition.H:299
void loadAssign(std::vector< Point > &a_patches, vals... args)
Load Assign.
Definition: Proto_BoxPartition.H:151
Point PatchID
Definition: Proto_BoxPartition.H:9
unsigned int numProcs() const
Number of Processes.
Definition: Proto_BoxPartition.H:251
Box Partition.
Definition: Proto_BoxPartition.H:21
std::vector< std::pair< Point, unsigned int > > m_partition
Maps each patch to a proc.
Definition: Proto_BoxPartition.H:254
ProblemDomain m_patchDomain
Domain in patch space.
Definition: Proto_BoxPartition.H:251
std::unordered_map< unsigned int, std::pair< unsigned int, unsigned int > > m_procMap
Maps processor number to global index.
Definition: Proto_BoxPartition.H:253
unsigned int procEndIndex(unsigned int a_proc) const
Get Processor Ending Index.
Definition: Proto_BoxPartition.H:290
bool isSorted() const
Definition: Proto_BoxPartition.H:98
void assign(std::vector< Point > &a_patches, unsigned int a_globalIndex, int a_proc, unsigned int a_num)
Definition: Proto_BoxPartition.H:133
std::shared_ptr< BoxPartition > sortByProc() const
Sort By Processor.
Definition: Proto_BoxPartition.H:121
unsigned int numBoxes() const
Number of Boxes (Global)
Definition: Proto_BoxPartition.H:261
bool checkProcSorting(const std::vector< std::pair< Point, unsigned int >> a_data)
Definition: Proto_BoxPartition.H:58
void unpack(std::vector< Point > &a_patches, unsigned int a_globalIndex, int a_proc, unsigned int a_num, vals... a_args)
Definition: Proto_BoxPartition.H:364
bool compatible(const BoxPartition &a_rhs)
Compatibility Query.
Definition: Proto_BoxPartition.H:226
void loadBalance(std::vector< Point > &a_patches, unsigned int a_startProc, unsigned int a_endProc)
Load Balance.
Definition: Proto_BoxPartition.H:197
Definition: Proto_Array.H:17
void define(const ProblemDomain &a_patchDomain, const std::vector< Point > &a_patches, unsigned int a_startProc, unsigned int a_endProc)
Define.
Definition: Proto_BoxPartition.H:37
std::unordered_map< unsigned int, std::vector< unsigned int > > m_procMapUnsorted
Same as procMap for unsorted data.
Definition: Proto_BoxPartition.H:255
Integer Valued Vector.
Definition: Proto_Point.H:24
bool m_doLoadBalance
Definition: Proto_BoxPartition.H:250
void print() const
Print.
Definition: Proto_BoxPartition.H:339
BoxPartition(const ProblemDomain &a_patchDomain)
Definition: Proto_BoxPartition.H:2
unsigned int procStartIndex(unsigned int a_proc) const
Get Processor Starting Index.
Definition: Proto_BoxPartition.H:281
unsigned int localIndex(unsigned int a_globalIndex, unsigned int a_proc)
Get Local Index.
Definition: Proto_BoxPartition.H:309
bool m_procSorted
Definition: Proto_BoxPartition.H:249
Represents a rectangular domain over which a problem can be defined, including periodic images...
Definition: Proto_ProblemDomain.H:22
std::unordered_map< uint64_t, int > m_indexMap
Maps Morton index to global index.
Definition: Proto_BoxPartition.H:252
const ProblemDomain & domain() const
Definition: Proto_BoxPartition.H:224