Proto  3.2
Proto_MBDisjointBoxLayout.H
Go to the documentation of this file.
1 #pragma once
2 #ifndef _PROTO_MB_BOX_LAYOUT_
3 #define _PROTO_MB_BOX_LAYOUT_
4 
5 #include "Proto.H"
7 #include "Proto_MBBoxPartition.H"
8 
9 namespace Proto
10 {
13 
15  {
16  public:
18 
19  inline MBDisjointBoxLayout(){m_defined = false;}
20 
21  inline MBDisjointBoxLayout(
22  MBProblemDomain& a_domain,
23  Point a_boxSize);
24 
26  MBProblemDomain& a_domain,
27  std::vector<Point> a_boxSizes);
28 
29  inline MBDisjointBoxLayout(
30  MBProblemDomain& a_domain,
31  std::vector<MBPoint> a_patches,
32  std::vector<Point> a_boxSizes);
33 
34  inline MBDisjointBoxLayout(
35  std::shared_ptr<MBBoxPartition> a_partition,
36  std::vector<Point> a_boxSizes);
37 
38  inline void define(
39  MBProblemDomain& a_domain,
40  std::vector<Point> a_boxSizes);
41 
42  inline void define(
43  MBProblemDomain& a_domain,
44  std::vector<MBPoint> a_patches,
45  std::vector<Point> a_boxSizes);
46 
47  inline void define(
48  std::shared_ptr<MBBoxPartition> a_partition,
49  std::vector<Point> a_boxSizes);
50 
51  inline const MBProblemDomain& domainPtr() const;
52  inline const MBProblemDomain& domain() const;
53  inline unsigned int procID(const MBIndex& a_index) const;
54  inline unsigned int numBlocks() const;
55  inline unsigned int numBoxes() const;
56  inline unsigned int numBoxes(unsigned int a_proc) const;
57  inline unsigned int numProcs() const;
58  inline std::vector<MBPoint> patches() const;
59  inline DataIndex<BoxPartition> blockIndex(const MBIndex& a_index) const;
60  inline Box operator[](const MBIndex& a_index) const;
61  inline MBIterator begin() const;
62  inline MBIterator end() const;
63  inline Point point(const MBIndex& a_index) const;
64  inline Box box(const MBIndex& a_index) const;
65  inline Array<double, DIM> dx(BlockIndex a_block) const;
66  inline Array<double, DIM> dx(MBIndex a_index) const;
67  inline Box blockDomainBox(BlockIndex a_block) const { return getBlock(a_block).domain().box(); }
68  inline unsigned int block(const MBIndex& a_index) const;
69  inline MBPoint patch(const MBIndex& a_index) const;
70  inline DisjointBoxLayout& getBlock(BlockIndex a_block);
71  inline const DisjointBoxLayout& getBlock(BlockIndex a_block) const;
72  inline MBIndex find(Point a_point, BlockIndex a_block) const;
73  inline const MBBoxPartition& partition() const { return *m_partition; }
74  inline const MBProblemDomain& patchDomain() const { return partition().domain(); }
75  inline std::shared_ptr<MBBoxPartition> partitionPtr() const { return m_partition; }
76  inline size_t offset(unsigned int a_proc) const;
77  inline bool compatible(const MBDisjointBoxLayout& a_rhs) const;
78  inline bool compatible(const MBIndex& a_index) const;
79  inline Point connectivity(
80  const MBPoint& patch_1,
81  const MBPoint& patch_2) const;
82  inline Point connectivity(
83  const MBIndex& i1,
84  const MBIndex& i2) const;
85  inline bool isBlockBoundary(
86  const MBPoint& patch_1,
87  const MBPoint& patch_2) const;
88  inline bool isBlockBoundary(
89  const MBIndex& patch_1,
90  const MBIndex& patch_2) const;
91  inline bool isBlockBoundary(
92  const MBPoint& patch,
93  Point dir) const;
94  inline bool isBlockBoundary(
95  const MBIndex& patch,
96  Point dir) const;
97  inline bool isBlockBoundary(
98  const MBPoint& patch,
100  BlockIndex adjBlock) const;
101  inline bool isPatchOnBlockBoundary( const MBPoint& patch) const;
102  inline bool isPatchOnBlockBoundary(
103  const MBPoint& patch,
104  Point dir) const;
105  inline bool isPatchInBlockBoundary( const MBPoint& patch) const;
106  inline bool isPatchInBlockBoundary( const MBPoint& patch, Point dir) const;
107  inline bool isDomainBoundary(
108  const MBPoint& patch,
109  Point dir) const;
110  inline bool isDomainBoundary(
111  const MBIndex& patch,
112  Point dir) const;
113  inline bool isPatchOnDomainBoundary( const MBPoint& patch) const;
114  inline bool isPatchOnDomainBoundary(
115  const MBPoint& patch,
116  Point dir) const;
117  inline bool isPatchInDomainBoundary( const MBPoint& patch) const;
118  inline bool isPatchInDomainBoundary(
119  const MBPoint& patch,
120  Point dir) const;
121  inline bool isRefinementBoundary(
122  const MBPoint& patch,
123  Point dir) const;
124  inline bool isPatchOnRefinementBoundary( const MBPoint& patch) const;
125  inline bool isInteriorBoundary(
126  const MBPoint& patch,
127  Point dir) const;
128  inline bool isPatchInTriplePointRegion(const MBPoint& patch) const;
129  inline bool isPatchInTriplePointRegion(
130  const MBPoint& patch,
131  Point dir) const;
132  inline std::vector<MBIndex> adjacentIndices( const MBPoint& patch) const;
133  inline std::vector<MBIndex> adjacentIndices(
134  const MBPoint& patch,
135  Point dir) const;
136  inline unsigned int size() const;
137  inline unsigned int localSize() const;
138  inline std::vector<Point> boxSizes() const;
139  inline Point boxSize(BlockIndex a_block) const;
140  MBDisjointBoxLayout coarsen(const Point& a_refRatio) const;
141  MBDisjointBoxLayout coarsen(const std::vector<Point>& a_refRatios) const;
142  void validateSelf(std::string methodName) const;
143  void validateIndex(const MBIndex& index, std::string methodName) const;
144  void validateBlock(const BlockIndex& block, std::string methodName) const;
145  inline void print() const;
146  inline bool defined() const {return m_defined; }
147  private:
148  bool m_defined;
150  std::vector<DisjointBoxLayout> m_layouts;
151  std::shared_ptr<MBBoxPartition> m_partition;
152  };
153 
154  inline std::ostream& operator<< (std::ostream& os, const DataIndex<MBBoxPartition>& a_index);
155 #include "implem/Proto_MBDisjointBoxLayoutImplem.H"
156 } // end namespace Proto
157 #endif //end include guard
Array< double, DIM > dx(BlockIndex a_block) const
Definition: Proto_MBDisjointBoxLayout.H:177
DisjointBoxLayout & getBlock(BlockIndex a_block)
Definition: Proto_MBDisjointBoxLayout.H:203
void define(MBProblemDomain &a_domain, std::vector< Point > a_boxSizes)
Definition: Proto_MBDisjointBoxLayout.H:32
std::shared_ptr< MBBoxPartition > m_partition
Definition: Proto_MBDisjointBoxLayout.H:151
void validateSelf(std::string methodName) const
Definition: Proto_MBDisjointBoxLayout.H:526
bool isBlockBoundary(const MBPoint &patch_1, const MBPoint &patch_2) const
Definition: Proto_MBDisjointBoxLayout.H:264
bool isPatchInBlockBoundary(const MBPoint &patch) const
Definition: Proto_MBDisjointBoxLayout.H:332
Distributed Data Iterator.
Definition: Proto_DataIndex.H:10
bool isPatchOnRefinementBoundary(const MBPoint &patch) const
Definition: Proto_MBDisjointBoxLayout.H:402
bool isPatchOnDomainBoundary(const MBPoint &patch) const
Definition: Proto_MBDisjointBoxLayout.H:362
Definition: Proto_MBBoxPartition.H:92
Box box() const
Get Box.
Definition: Proto_ProblemDomain.H:132
std::vector< MBPoint > patches() const
Definition: Proto_MBDisjointBoxLayout.H:123
unsigned int numBoxes() const
Definition: Proto_MBDisjointBoxLayout.H:105
bool isPatchInTriplePointRegion(const MBPoint &patch) const
Definition: Proto_MBDisjointBoxLayout.H:421
Definition: Proto_MBProblemDomain.H:10
int BlockIndex
Defines what type is used for indexing block entities.
Definition: Proto_MBGraph.H:9
MBIndex find(Point a_point, BlockIndex a_block) const
Definition: Proto_MBDisjointBoxLayout.H:222
Disjoint Box Layout.
Definition: Proto_DisjointBoxLayout.H:30
unsigned int localSize() const
Definition: Proto_MBDisjointBoxLayout.H:475
MBDisjointBoxLayout coarsen(const Point &a_refRatio) const
Definition: Proto_MBDisjointBoxLayout.H:500
bool compatible(const MBDisjointBoxLayout &a_rhs) const
Definition: Proto_MBDisjointBoxLayout.H:235
Box box(const MBIndex &a_index) const
Definition: Proto_MBDisjointBoxLayout.H:169
const MBProblemDomain & domain() const
Definition: Proto_MBDisjointBoxLayout.H:87
bool m_defined
Definition: Proto_MBDisjointBoxLayout.H:148
Point connectivity(const MBPoint &patch_1, const MBPoint &patch_2) const
Definition: Proto_MBDisjointBoxLayout.H:247
An interval in DIM dimensional space.
Definition: Proto_Box.H:29
const MBProblemDomain & domain() const
Definition: Proto_MBBoxPartition.H:108
std::shared_ptr< MBBoxPartition > partitionPtr() const
Definition: Proto_MBDisjointBoxLayout.H:75
Mapped Multi-Block Problem Domain.
Definition: Proto_MBProblemDomain.H:76
size_t offset(unsigned int a_proc) const
Definition: Proto_MBDisjointBoxLayout.H:229
DataIndex< MBBoxPartition > MBIndex
Definition: Proto_MBDisjointBoxLayout.H:17
std::vector< DisjointBoxLayout > m_layouts
Definition: Proto_MBDisjointBoxLayout.H:150
bool isPatchInDomainBoundary(const MBPoint &patch) const
Definition: Proto_MBDisjointBoxLayout.H:381
ProblemDomain domain() const
Get Problem Domain.
Definition: Proto_DisjointBoxLayout.H:302
void validateBlock(const BlockIndex &block, std::string methodName) const
Definition: Proto_MBDisjointBoxLayout.H:540
DataIndex< BoxPartition > blockIndex(const MBIndex &a_index) const
Definition: Proto_MBDisjointBoxLayout.H:135
Box operator[](const MBIndex &a_index) const
Definition: Proto_MBDisjointBoxLayout.H:143
DataIndex< MBBoxPartition > MBIndex
Definition: Proto_MBDisjointBoxLayout.H:11
unsigned int numProcs() const
Definition: Proto_MBDisjointBoxLayout.H:117
unsigned int numBlocks() const
Definition: Proto_MBDisjointBoxLayout.H:99
MBIterator begin() const
Definition: Proto_MBDisjointBoxLayout.H:149
unsigned int procID(const MBIndex &a_index) const
Definition: Proto_MBDisjointBoxLayout.H:93
Point boxSize(BlockIndex a_block) const
Definition: Proto_MBDisjointBoxLayout.H:492
bool isInteriorBoundary(const MBPoint &patch, Point dir) const
Definition: Proto_MBDisjointBoxLayout.H:413
MBDisjointBoxLayout()
Definition: Proto_MBDisjointBoxLayout.H:19
Definition: Proto_Array.H:17
uint64_t index
Definition: Proto_MBBoxPartition.H:15
bool isRefinementBoundary(const MBPoint &patch, Point dir) const
Definition: Proto_MBDisjointBoxLayout.H:395
const MBBoxPartition & partition() const
Definition: Proto_MBDisjointBoxLayout.H:73
MBProblemDomain m_domain
Definition: Proto_MBDisjointBoxLayout.H:149
unsigned int block(const MBIndex &a_index) const
Definition: Proto_MBDisjointBoxLayout.H:191
bool isPatchOnBlockBoundary(const MBPoint &patch) const
Definition: Proto_MBDisjointBoxLayout.H:313
Integer Valued Vector.
Definition: Proto_Point.H:24
Definition: Proto_MBDisjointBoxLayout.H:14
Box blockDomainBox(BlockIndex a_block) const
Definition: Proto_MBDisjointBoxLayout.H:67
void print() const
Definition: Proto_MBDisjointBoxLayout.H:549
MBPoint patch(const MBIndex &a_index) const
Definition: Proto_MBDisjointBoxLayout.H:197
void validateIndex(const MBIndex &index, std::string methodName) const
Definition: Proto_MBDisjointBoxLayout.H:533
MBIterator end() const
Definition: Proto_MBDisjointBoxLayout.H:156
bool defined() const
Definition: Proto_MBDisjointBoxLayout.H:146
bool isDomainBoundary(const MBPoint &patch, Point dir) const
Definition: Proto_MBDisjointBoxLayout.H:347
Point dir
Definition: Proto_MBBoxPartition.H:16
std::vector< Point > boxSizes() const
Definition: Proto_MBDisjointBoxLayout.H:481
unsigned int size() const
Definition: Proto_MBDisjointBoxLayout.H:469
std::vector< MBIndex > adjacentIndices(const MBPoint &patch) const
Definition: Proto_MBDisjointBoxLayout.H:434
const MBProblemDomain & domainPtr() const
const MBProblemDomain & patchDomain() const
Definition: Proto_MBDisjointBoxLayout.H:74
DataIterator< MBBoxPartition > MBIterator
Definition: Proto_MBDisjointBoxLayout.H:12
Point point(const MBIndex &a_index) const
Definition: Proto_MBDisjointBoxLayout.H:163