31 #include "NamespaceHeader.H" 68 D_EXPR6(vect[0]=vi[0], vect[1]=vi[1], vect[2] = vi[2],
69 vect[3]=vi[3], vect[4]=vi[4], vect[5] = vi[5]);
86 int l,
int m,
int n));
93 explicit IntVect (
const int* a);
119 int& operator[] (
int i);
126 int operator[] (
int i)
const;
147 const int* getVect ()
const;
153 const int* dataPtr()
const;
173 bool operator== (
const IntVect& p)
const;
180 bool operator!= (
const IntVect& p)
const;
200 bool operator<= (
const IntVect& p)
const;
210 bool operator> (
const IntVect& p)
const;
221 bool operator>= (
const IntVect& p)
const;
237 bool lexLT (
const IntVect& s)
const;
253 bool lexGT (
const IntVect& s)
const;
284 int product ()
const;
473 int retval = vect[0];
474 for(
int idir = 1; idir <
SpaceDim; idir++)
476 retval =
Max(retval, vect[idir]);
484 int retval = vect[0];
485 for(
int idir = 1; idir <
SpaceDim; idir++)
487 retval =
Min(retval, vect[idir]);
605 void printOn (std::ostream& os)
const;
617 void dumpOn (std::ostream& os)
const;
623 friend std::ostream&
operator<< (std::ostream& os,
630 friend std::istream&
operator>> (std::istream& os,
664 static int InitStatics();
670 inline uint64_t hash(
const IntVect& origin,
const IntVect& blockingFactor)
const;
681 friend class BLfacade::IntVect;
692 static const uint32_t morton256_x[256];
693 static const uint32_t morton256_y[256];
694 static const uint32_t morton256_z[256];
697 #include "NamespaceFooter.H" 700 namespace std {
template <>
inline bool less<CH_XD::IntVect>::operator()(
const CH_XD::IntVect& a,
const CH_XD::IntVect& b)
const {
return a.lexLT(b);}
718 void linearIn(CH_XDIR::IntVect& a_iv,
const void* a_inBuf);
722 void linearOut(
void* a_outBuf,
const CH_XDIR::IntVect& a_iv);
742 #include "NamespaceHeader.H" 773 int l,
int m,
int n))
775 D_EXPR6(vect[0] = i, vect[1] = j, vect[2] = k, vect[3] = l, vect[4] = m, vect[5] = n);
781 D_EXPR6(vect[0] = a[0], vect[1] = a[1], vect[2] = a[2],
782 vect[3] = a[3], vect[4] = a[4], vect[5] = a[5]);
852 return D_TERM6(vect[0] == p[0], && vect[1] == p[1], && vect[2] == p[2],
853 && vect[3] == p[3], && vect[4] == p[4], && vect[5] == p[5]);
860 return D_TERM6(vect[0] != p[0], || vect[1] != p[1], || vect[2] != p[2],
861 || vect[3] != p[3], || vect[4] != p[4], || vect[5] != p[5]);
868 return D_TERM6(vect[0] < p[0], && vect[1] < p[1], && vect[2] < p[2],
869 && vect[3] < p[3], && vect[4] < p[4], && vect[5] < p[5]);
876 return D_TERM6(vect[0] <= p[0], && vect[1] <= p[1], && vect[2] <= p[2],
877 && vect[3] <= p[3], && vect[4] <= p[4], && vect[5] <= p[5]);
884 return D_TERM6(vect[0] > p[0], && vect[1] > p[1], && vect[2] > p[2],
885 && vect[3] > p[3], && vect[4] > p[4], && vect[5] > p[5]);
892 return D_TERM6(vect[0] >= p[0], && vect[1] >= p[1], && vect[2] >= p[2],
893 && vect[3] >= p[3], && vect[4] >= p[4], && vect[5] >= p[5]);
901 if (vect[0] < s[0])
return true;
903 if (vect[0] > s[0])
return false;
904 if (vect[1] < s[1])
return true;
907 if (vect[1] > s[1])
return false;
908 if (vect[2] < s[2])
return true;
911 if (vect[2] > s[2])
return false;
912 if (vect[3] < s[3])
return true;
915 if (vect[3] > s[3])
return false;
916 if (vect[4] < s[4])
return true;
919 if (vect[4] > s[4])
return false;
920 if (vect[5] < s[5])
return true;
930 if (vect[0] > s[0])
return true;
932 if (vect[0] < s[0])
return false;
933 if (vect[1] > s[1])
return true;
936 if (vect[1] < s[1])
return false;
937 if (vect[2] > s[2])
return true;
940 if (vect[2] < s[2])
return false;
941 if (vect[3] > s[3])
return true;
944 if (vect[3] < s[3])
return false;
945 if (vect[4] > s[4])
return true;
948 if (vect[4] < s[4])
return false;
949 if (vect[5] > s[5])
return true;
967 -vect[3], -vect[4], -vect[5] ));
974 return D_TERM6(vect[0], + vect[1], + vect[2],
975 + vect[3], + vect[4], + vect[5]);
982 return D_TERM6(vect[0], * vect[1], * vect[2],
983 * vect[3], * vect[4], * vect[5]);
990 D_EXPR6(vect[0] += s, vect[1] += s, vect[2] += s,
991 vect[3] += s, vect[4] += s, vect[5] += s);
999 D_EXPR6(vect[0] += p[0], vect[1] += p[1], vect[2] += p[2],
1000 vect[3] += p[3], vect[4] += p[4], vect[5] += p[5]);
1008 D_EXPR6(vect[0] *= s, vect[1] *= s, vect[2] *= s,
1009 vect[3] *= s, vect[4] *= s, vect[5] *= s);
1017 D_EXPR6(vect[0] *= p[0], vect[1] *= p[1], vect[2] *= p[2],
1018 vect[3] *= p[3], vect[4] *= p[4], vect[5] *= p[5]);
1026 D_EXPR6(vect[0] /= s, vect[1] /= s, vect[2] /= s,
1027 vect[3] /= s, vect[4] /= s, vect[5] /= s);
1035 D_EXPR6(vect[0] /= p[0], vect[1] /= p[1], vect[2] /= p[2],
1036 vect[3] /= p[3], vect[4] /= p[4], vect[5] /= p[5]);
1044 D_EXPR6(vect[0] -= s, vect[1] -= s, vect[2] -= s,
1045 vect[3] -= s, vect[4] -= s, vect[5] -= s);
1053 D_EXPR6(vect[0] -= p[0], vect[1] -= p[1], vect[2] -= p[2],
1054 vect[3] -= p[3], vect[4] -= p[4], vect[5] -= p[5]);
1062 return IntVect(
D_DECL6(vect[0] + p[0], vect[1] + p[1], vect[2] + p[2],
1063 vect[3] + p[3], vect[4] + p[4], vect[5] + p[5]));
1071 vect[3] + s, vect[4] + s, vect[5] + s));
1078 return IntVect(
D_DECL6(vect[0] - p[0], vect[1] - p[1], vect[2] - p[2],
1079 vect[3] - p[3], vect[4] - p[4], vect[5] - p[5]));
1087 vect[3] - s, vect[4] - s, vect[5] - s));
1094 return IntVect(
D_DECL6(vect[0] * p[0], vect[1] * p[1], vect[2] * p[2],
1095 vect[3] * p[3], vect[4] * p[4], vect[5] * p[5]));
1103 vect[3] * s, vect[4] * s, vect[5] * s));
1110 return IntVect(
D_DECL6(vect[0] / p[0], vect[1] / p[1], vect[2] / p[2],
1111 vect[3] / p[3], vect[4] / p[4], vect[5] / p[5]));
1119 vect[3] / s, vect[4] / s, vect[5] / s));
1126 D_EXPR6(vect[0] =
Min(vect[0], p.
vect[0]),
1127 vect[1] =
Min(vect[1], p.
vect[1]),
1128 vect[2] =
Min(vect[2], p.
vect[2]),
1129 vect[3] =
Min(vect[3], p.
vect[3]),
1130 vect[4] =
Min(vect[4], p.
vect[4]),
1131 vect[5] =
Min(vect[5], p.
vect[5]));
1139 D_EXPR6(vect[0] =
Max(vect[0], p.
vect[0]),
1140 vect[1] =
Max(vect[1], p.
vect[1]),
1141 vect[2] =
Max(vect[2], p.
vect[2]),
1142 vect[3] =
Max(vect[3], p.
vect[3]),
1143 vect[4] =
Max(vect[4], p.
vect[4]),
1144 vect[5] =
Max(vect[5], p.
vect[5]));
1152 D_EXPR6(vect[0] *= s, vect[1] *= s, vect[2] *= s,
1153 vect[3] *= s, vect[4] *= s, vect[5] *= s);
1163 vect[idir] = -vect[idir] + 2*ref_ix;
1189 D_EXPR6(vect[0] += s, vect[1] += s, vect[2] += s,
1190 vect[3] += s, vect[4] += s, vect[5] += s);
1200 p[3] + s, p[4] + s, p[5] + s));
1209 s - p[3], s - p[4], s - p[5]));
1218 s * p[3], s * p[4], s * p[5]));
1227 s * p[3], s * p[4], s * p[5]));
1235 abs(p[3]), abs(p[4]), abs(p[5])));
1243 p[3] + s, p[4] + s, p[5] + s));
1282 b.
vect[idir] = -b.
vect[idir] + 2*ref_ix;
1298 (p.
vect[5]<0) ? -abs(p.
vect[5]+1)/s-1 : p.
vect[5]/s ));
1324 vect[i] = ((vect[i]<0) ? -abs(vect[i]+1)/s-1 : vect[i]/s);
1335 const int s = p.
vect[i];
1336 vect[i] = ((vect[i]<0) ? -abs(vect[i]+1)/s-1 : vect[i]/s);
1344 uint64_t answer = 0;
1345 #if CH_SPACEDIM >= 4 1350 for(
int jdir = 0; jdir < idir; jdir++)
1352 bfact *= blockingFactor[jdir];
1354 answer += origin[idir]*bfact;
1357 uint32_t z=0, y=0, x;
1359 z = (vect[2]-origin[2])/blockingFactor[2];
1362 y = (vect[1]-origin[1])/blockingFactor[1];
1364 x = (vect[0]-origin[0])/blockingFactor[0];
1365 answer = morton256_z[(z >> 16) & 0xFF ] |
1366 morton256_y[(y >> 16) & 0xFF ] |
1367 morton256_x[(x >> 16) & 0xFF ];
1368 answer = answer << 48 | morton256_z[(z >> 8) & 0xFF ] |
1369 morton256_y[(y >> 8) & 0xFF ] |
1370 morton256_x[(x >> 8) & 0xFF ];
1371 answer = answer << 24 |
1372 morton256_z[(z) & 0xFF ] |
1373 morton256_y[(y) & 0xFF ] |
1374 morton256_x[(x) & 0xFF ];
1380 #include "NamespaceFooter.H" IntVect min(const IntVect &p1, const IntVect &p2)
Definition: IntVect.H:1248
IntVect & operator*=(int s)
Definition: IntVect.H:1006
#define D_DECL6(a, b, c, d, e, f)
Definition: CHArray.H:39
IntVect & min(const IntVect &p)
Definition: IntVect.H:1124
const int * getVect() const
Definition: IntVect.H:843
#define D_TERM6(a, b, c, d, e, f)
Definition: CHArray.H:40
static const size_t IntVectSize
Definition: IntVect.H:691
#define CH_SPACEDIM
Definition: SPACE.H:51
#define CH_assert(cond)
Definition: CHArray.H:37
IntVect & scale(int s)
Definition: IntVect.H:1150
IntVect scale(const IntVect &p, int s)
Definition: IntVect.H:1223
IntVect operator*(const IntVect &p) const
Definition: IntVect.H:1092
static size_t io_offset
Definition: IntVect.H:668
Definition: FaceIndex.H:28
int max() const
return the maximum value in the intvect
Definition: IntVect.H:471
IntVect operator*(int s, const IntVect &p)
Definition: IntVect.H:1214
static int s_dummyForIntVectH
Definition: IntVect.H:754
IntVect & operator/=(int s)
Definition: IntVect.H:1024
Definition: IntVect.H:700
IntVect max(const IntVect &p1, const IntVect &p2)
Definition: IntVect.H:1257
IntVect BASISV(int dir)
Definition: IntVect.H:1266
IntVect & operator-=(int s)
Definition: IntVect.H:1042
int linearSize(const CH_XDIR::IntVect &a_iv)
functions for linearization
bool operator<(const IntVect &p) const
Definition: IntVect.H:866
IntVect diagShift(const IntVect &p, int s)
Definition: IntVect.H:1240
const int SpaceDim
Definition: SPACE.H:38
void setVal(int i, int val)
Definition: IntVect.H:819
IntVect coarsen(const IntVect &p, int s)
Definition: IntVect.H:1288
std::ostream & operator<<(std::ostream &a_os, const IndexTM< T, N > &a_iv)
IntVect & shift(int coord, int s)
Definition: IntVect.H:1169
static const IntVect Unit
Definition: IntVect.H:659
bool operator==(const IntVect &p) const
Definition: IntVect.H:850
int vect[CH_SPACEDIM]
Definition: IntVect.H:686
std::istream & operator>>(std::istream &a_os, IndexTM< T, N > &a_iv)
bool operator<(const FaceIndex &f1, const FaceIndex &f2)
Definition: FaceIndex.H:212
void linearOut(void *a_outBuf, const CH_XDIR::IntVect &a_iv)
functions for linearization
IntVect & reflect(int ref_ix, int idir)
Definition: IntVect.H:1159
IntVect & max(const IntVect &p)
Definition: IntVect.H:1137
void linearIn(CH_XDIR::IntVect &a_iv, const void *a_inBuf)
functions for linearization
IntVect operator/(const IntVect &p) const
Definition: IntVect.H:1108
bool operator!=(const IntVect &p) const
Definition: IntVect.H:858
IntVect & operator+=(int s)
Definition: IntVect.H:988
int & operator[](const int i)
Definition: CHArray.H:56
IntVect(const Vector< int > &vi)
Definition: IntVect.H:66
IntVect operator+() const
Definition: IntVect.H:957
static const IntVect Zero
Definition: IntVect.H:654
C::self_type operator/(const C &, const C &)
Definition: GenericArithmeticI.H:132
A Rectangular Domain on an Integer Lattice.
Definition: Box.H:465
IntVect & diagShift(int s)
Definition: IntVect.H:1187
IntVect reflect(const IntVect &a, int ref_ix, int idir)
Definition: IntVect.H:1276
int product() const
Definition: CHArray.H:64
const IntVect absolute(const IntVect &p)
Definition: IntVect.H:1232
bool operator<=(const IntVect &p) const
Definition: IntVect.H:874
bool operator>(const IntVect &p) const
Definition: IntVect.H:882
Handle to a particular group in an HDF file.
Definition: CH_HDF5.H:294
T Min(const T &a_a, const T &a_b)
Definition: Misc.H:26
An integer Vector in SpaceDim-dimensional space.
Definition: CHArray.H:42
IntVect operator-(int s, const IntVect &p)
Definition: IntVect.H:1205
int sum() const
Definition: IntVect.H:972
Volume of Fluid Index.
Definition: VolIndex.H:31
const int * dataPtr() const
Definition: IntVect.H:829
T Max(const T &a_a, const T &a_b)
Definition: Misc.H:39
int min() const
return the minimum value in the intvect
Definition: IntVect.H:482
IntVect & coarsen(const IntVect &p)
Definition: IntVect.H:1330
IntVect operator-() const
Definition: IntVect.H:964
bool lexGT(const IntVect &s) const
Definition: IntVect.H:928
IntVect operator+(int s, const IntVect &p)
Definition: IntVect.H:1196
IntVect copy() const
Definition: IntVect.H:103
uint64_t hash(const IntVect &origin, const IntVect &blockingFactor) const
Definition: IntVect.H:1341
bool lexLT(const IntVect &s) const
Definition: IntVect.H:898
IntVect()
Definition: IntVect.H:63
bool operator>=(const IntVect &p) const
Definition: IntVect.H:890