2 #ifndef _PROTO_MB_BOX_PARTITION_ 3 #define _PROTO_MB_BOX_PARTITION_ 6 #include <unordered_map> 7 #include <unordered_set> 18 bool operator==(
const PatchBound &a_rhs)
const 20 if (index != a_rhs.index)
33 std::size_t operator()(
const PatchBound &key)
const 36 std::size_t hash = std::hash<uint64_t>{}(key.index);
37 for (
int ii = 0; ii < DIM; ++ii)
39 hash ^= std::hash<int>{}(key.dir[ii]) + 0x9e3779b9 + (hash << 6) + (hash >> 2);
53 struct MBPatchBoundInfo {
63 std::string typeString()
67 case PR_BLOCK_BOUNDARY:
return "BLOCK_BOUNDARY";
68 case PR_DOMAIN_BOUNDARY:
return "DOMAIN_BOUNDARY";
69 case PR_INTERIOR_BOUNDARY:
return "INTERIOR_BOUNDARY";
70 default:
return "UNKNOWN_BOUNDARY";
76 MBPatchInfo(
const MBPoint& _patch,
bool _exists)
100 const std::vector<MBPoint>& a_patches);
103 const std::vector<MBPoint>& a_patches);
105 const std::vector<MBPoint>& a_patches);
106 inline void loadBalance();
109 inline unsigned int numProcs()
const;
110 inline unsigned int numBoxes()
const;
111 inline unsigned int numBoxes(
unsigned int a_proc);
113 inline uint64_t procStartIndex(
unsigned int a_proc)
const;
114 inline uint64_t procEndIndex(
unsigned int a_proc)
const;
115 inline uint64_t localIndex(uint64_t a_globalIndex,
unsigned int a_proc)
const;
116 inline uint64_t globalIndex(uint64_t a_localIndex,
unsigned int a_proc)
const;
120 inline void validatePatch(
const MBPoint&
patch, std::string methodName)
const;
121 inline void validateIndex(uint64_t
index, std::string methodName)
const;
123 unsigned int getProc(uint64_t globalIndex)
const;
124 inline MBPoint getPatch(uint64_t globalIndex)
const;
125 inline BlockIndex getBlock(uint64_t globalIndex)
const;
126 inline Point getPoint(uint64_t globalIndex)
const;
128 inline bool isBlockBoundary(
131 inline bool isBlockBoundary(
135 inline bool isDomainBoundary(
138 inline bool isInteriorBoundary(
144 inline const MBPatchInfo&
patchInfo(
MBPoint patchID)
const {
return m_patchAdjacencies[patchID]; }
145 inline const std::vector<std::pair<MBPoint, unsigned int>>&
partition()
const 146 {
return m_partition; }
147 inline std::shared_ptr<BoxPartition> blockPartition(
BlockIndex a_block)
const;
153 std::vector<Point>& a_patches,
154 unsigned int a_globalIndex,
158 inline void buildLocalMaps();
159 inline void buildGlobalMaps();
160 inline void findAdjacencies();
161 inline void getBoundaryInfo(MBPatchInfo& patchInfo);
162 inline void updateRefinementBoundaries();
166 mutable std::unordered_map<unsigned int, std::pair<uint64_t, uint64_t>>
m_procMap;
172 #include "implem/Proto_MBBoxPartitionImplem.H" 175 #endif //end include guard Definition: Proto_MBBoxPartition.H:92
Definition: Proto_MBProblemDomain.H:10
std::unordered_map< unsigned int, std::pair< uint64_t, uint64_t > > m_procMap
Maps proc to global indices.
Definition: Proto_MBBoxPartition.H:166
int BlockIndex
Defines what type is used for indexing block entities.
Definition: Proto_MBGraph.H:9
std::set< MBPoint > adjacentPatches
Definition: Proto_MBBoxPartition.H:60
std::map< MBPoint, uint64_t > m_indexMap
Maps local to global.
Definition: Proto_MBBoxPartition.H:165
MBProblemDomain m_patchDomain
Definition: Proto_MBBoxPartition.H:164
bool exists
Definition: Proto_MBBoxPartition.H:87
const std::vector< std::pair< MBPoint, unsigned int > > & partition() const
Definition: Proto_MBBoxPartition.H:145
const MBProblemDomain & domain() const
Definition: Proto_MBBoxPartition.H:108
Mapped Multi-Block Problem Domain.
Definition: Proto_MBProblemDomain.H:76
std::unordered_map< MBPoint, MBPatchInfo, MBPoint::Hash > m_patchAdjacencies
Definition: Proto_MBBoxPartition.H:169
static std::set< Point > Directions()
static ACCEL_DECORATION Point Zeros()
Get Zeros.
Definition: Proto_Array.H:17
std::vector< std::shared_ptr< BoxPartition > > m_blockPartitions
Definition: Proto_MBBoxPartition.H:167
uint64_t index
Definition: Proto_MBBoxPartition.H:15
BoundaryType
Definition: Proto_MBBoxPartition.H:46
std::vector< std::pair< MBPoint, unsigned int > > m_partition
Definition: Proto_MBBoxPartition.H:168
Integer Valued Vector.
Definition: Proto_Point.H:24
std::map< Point, MBPatchBoundInfo > boundaries
Definition: Proto_MBBoxPartition.H:88
bool isRefinementBoundary
Definition: Proto_MBBoxPartition.H:62
const MBPatchInfo & patchInfo(MBPoint patchID) const
Definition: Proto_MBBoxPartition.H:144
MBPoint patch
Definition: Proto_MBBoxPartition.H:86
Point dir
Definition: Proto_MBBoxPartition.H:16
BoundaryType boundaryType
Definition: Proto_MBBoxPartition.H:61