2 #ifndef _PROTO_BOX_H___ 3 #define _PROTO_BOX_H___ 5 #include "Proto_Point.H" 6 #include "Proto_LoHiSide.H" 48 if(a_side == Side::Hi)
58 Box retval = adjCellSide(a_idir, 1, a_side);
59 if(a_side == Side::Lo)
81 inline Box (
const int* a_lo,
const int* a_hi) {
define(a_lo, a_hi); }
90 inline void define(
const int* a_lo,
const int* a_hi);
101 inline Box(
const Box& a_box);
114 inline static Box Cube(
int a_size);
145 inline static unsigned int sindex(
Point a_pt,
Point a_low,
Point a_high);
157 inline static unsigned int soffset(
const Point& a_pt,
const Point& a_low,
const Point& a_high);
193 inline std::size_t
size(
unsigned char a_dim)
const;
209 inline std::size_t
size()
const;
265 inline bool empty()
const {
return (m_size < 1);}
278 inline unsigned int index(
const Point& a_pt)
const;
293 inline Point operator()(
unsigned int a_idx,
unsigned int a_idy,
unsigned a_idz)
const;
374 bool equals = (*
this==a_rhsBox);
380 bool lt = this->
low() < a_rhsBox.
low();
434 inline Box shift(
int a_direction,
int a_offset)
const;
472 inline Box grow(
int a_numpoints)
const;
502 inline Box grow(
int a_dir,
int a_offset)
const;
547 inline Box extrude(
int a_dir,
int a_dist = 1,
bool a_upper =
true)
const;
553 inline Box growHi(
int idir,
int igrow)
const;
559 inline Box growLo(
int idir,
int igrow)
const;
584 inline Box coarsen(
unsigned int a_ratio)
const;
671 inline Box refine(
unsigned int a_ratio)
const;
692 inline Box edge(
const Point& a_dir,
int a_dist = 1)
const;
713 inline Box flatten(
const int a_dir,
bool a_upper =
false)
const;
793 inline void print()
const;
796 inline size_t linearSize()
const 799 retval += m_low.linearSize();
800 retval += m_high.linearSize();
801 retval +=
sizeof(int);
805 inline void linearOut(
char* a_buf)
const 808 char* charbuf = a_buf;
810 m_low.linearOut(charbuf);
811 charbuf += m_low.linearSize();
812 charsiz += m_low.linearSize();
814 m_high.linearOut(charbuf);
815 charbuf += m_high.linearSize();
816 charsiz += m_high.linearSize();
818 int* intbuf = (
int* ) charbuf;
820 charsiz +=
sizeof(int);
821 charbuf +=
sizeof(int);
824 inline void linearIn(
const char* a_buf)
827 const char* charbuf = a_buf;
829 m_low.linearIn(charbuf);
830 charbuf += m_low.linearSize();
831 charsiz += m_low.linearSize();
833 m_high.linearIn(charbuf);
834 charbuf += m_high.linearSize();
835 charsiz += m_high.linearSize();
837 int* intbuf = (
int* ) charbuf;
839 charsiz +=
sizeof(int);
840 charbuf +=
sizeof(int);
843 inline void recomputeSize();
852 a_os <<
"[" << a_box.
low() <<
", " << a_box.
high() <<
"]";
870 : m_box(a_box), m_pos(a_pos) {}
875 m_pos = m_box.index(a_pos);
877 inline void begin(){m_pos = 0;};
880 {
return ((m_pos < 0) || (m_pos >= m_box.size()));};
882 inline bool ok() {
return !
end(); }
892 return ((m_pos == a_iter.m_pos) && (m_box == a_iter.m_box));
898 return !((*this) == a_iter);
936 return ((m_pos < 0) || (m_pos >= m_box.size()));
945 #include "implem/Proto_BoxImplem.H" bool operator!=(const BoxIterator &a_iter) const
Inequality Operator.
Definition: Proto_Box.H:896
Definition: Proto_HDF5.H:9
Point high() const
Access High Corner.
Definition: Proto_Box.H:174
Point low() const
Access Low Corner.
Definition: Proto_Box.H:168
BoxIterator()
Constructor.
Definition: Proto_Box.H:867
Iterator for Boxes.
Definition: Proto_Box.H:863
LoHiSide
Definition: Proto_LoHiSide.H:18
BoxIterator rend() const
Iterator Reverse End.
Definition: Proto_Box.H:600
void operator &=(const Box &a_rhs)
In Place Intersection.
CUDA_DECORATION bool empty() const
Empty Query.
Definition: Proto_Box.H:265
bool operator!=(const Box &a_rhsBox) const
Inequality Operator.
Definition: Proto_Box.H:372
void define(const int *a_lo, const int *a_hi)
Define.
Definition: Proto_Box.H:50
Box(const int *a_lo, const int *a_hi)
Primitive Constructor.
Definition: Proto_Box.H:81
Point mod(const Point &a_pt) const
Modulus Function.
Definition: Proto_Box.H:286
std::ostream & operator<<(std::ostream &a_os, const Box &a_box)
OStream Operator.
Definition: Proto_Box.H:850
int operator()() const
Get Index.
Definition: Proto_Box.H:914
CUDA_DECORATION bool contains(const Point &a_pt) const
Contains Point Query.
Definition: Proto_Box.H:133
BoxIterator & operator--()
Decrement Iterator.
Definition: Proto_Box.H:927
Box flatten(const int a_dir, bool a_upper=false) const
Flatten.
Definition: Proto_Box.H:510
Box extrude(const Point &a_dir, int a_dist=1) const
Extrude.
Definition: Proto_Box.H:346
static Box Kernel(int a_radius)
Kernel Function.
Definition: Proto_Box.H:72
Box refine(const Point &a_pt) const
Anisotropic Refine Operation.
Definition: Proto_Box.H:477
Point operator%(const Point &a_pt) const
Modulus Operator.
Definition: Proto_Box.H:281
An interval in DIM dimensional space.
Definition: Proto_Box.H:26
static CUDA_DECORATION Point Basis(int a_dir, int a_scale=1)
Get Basis.
Definition: Proto_Point.H:48
Box shift(int a_direction, int a_offset) const
Shift Transformation.
Definition: Proto_Box.H:306
Point operator*() const
Dereference Iterator.
Definition: Proto_Box.H:905
bool onBoundary(const Point &a_p) const
Point on Boundry Query.
Definition: Proto_Box.H:157
Box grow(int a_numpoints) const
Isotropic Grow Operation.
Definition: Proto_Box.H:325
bool operator==(const BoxIterator &a_iter) const
Equality Operator.
Definition: Proto_Box.H:890
Box growLo(int idir, int igrow) const
Grow Low Side.
Definition: Proto_Box.H:382
static Box Cube(int a_size)
Definition: Proto_Box.H:67
Definition: Proto_Box.H:11
bool operator==(const Box &a_rhsBox) const
Equality Operator.
Definition: Proto_Box.H:275
CUDA_DECORATION Point operator[](unsigned int a_index) const
Access Point by Index.
Definition: Proto_Box.H:179
CUDA_DECORATION std::size_t size() const
Volumetric Size.
Definition: Proto_Box.H:120
Box operator &(const Box &a_rightBox) const
Intersection Operator.
Integer Valued Vector.
Definition: Proto_Point.H:21
Box growHi(int idir, int igrow) const
Grow High Side.
Definition: Proto_Box.H:377
void print() const
Print.
Definition: Proto_Box.H:605
BoxIterator begin() const
Iterator Begin.
Definition: Proto_Box.H:585
BoxIterator & operator++()
Increment Iterator.
Definition: Proto_Box.H:920
Box taperCoarsen(const Point &a_ref) const
Tapered Coarsen.
Definition: Proto_Box.H:444
BoxIterator end() const
Iterator End.
Definition: Proto_Box.H:590
Box()
Default Constructor.
Definition: Proto_Box.H:10
bool done()
Check if Done.
Definition: Proto_Box.H:934
CUDA_DECORATION unsigned int index(const Point &a_pt) const
Point to Linear Index.
Definition: Proto_Box.H:171
Box coarsen(unsigned int a_ratio) const
Isotropic Coarsen Operation.
Definition: Proto_Box.H:387
Box adjCellLo(int a_idir, int a_length) const
Lower Adjacent Cells.
Definition: Proto_Box.H:551
bool operator<(const Box &a_rhsBox) const
< Operator. Based on same operator for Point applied to low corner. Used in Copier.
Definition: Proto_Box.H:378
bool coarsenable(const int &a_ratio) const
(Isotropic) Coarsenable Query
Definition: Proto_Box.H:455
Box adjacent(const Point &a_dir, int a_dist=-1) const
Adjacent Cells.
Definition: Proto_Box.H:527
BoxIterator rbegin() const
Iterator Reverse Begin.
Definition: Proto_Box.H:595
Box edge(const Point &a_dir, int a_dist=1) const
Edge.
Definition: Proto_Box.H:498
Box adjCellHi(int a_idir, int a_length) const
Upper Adjacent Cells.
Definition: Proto_Box.H:566