11 #ifndef _INDICESTRANSFORMATION_H_ 12 #define _INDICESTRANSFORMATION_H_ 21 #include "NamespaceHeader.H" 106 friend std::ostream&
operator<< (std::ostream& a_os,
157 bool a_forward =
true)
const;
188 a_dstIntvl, a_srcIntvl,
true);
202 a_dstIntvl, a_srcIntvl,
false);
214 bool a_forward =
true)
const 221 int dstComp = a_dstIntvl.
begin();
222 int srcComp = a_srcIntvl.
begin();
223 int srcCompHi = a_srcIntvl.
end();
224 for (; srcComp <= srcCompHi; ++srcComp, ++dstComp)
230 a_dstFab(ivDst, dstComp) =
231 a_srcFab(ivSrc, srcComp);
237 if (a_dstIntvl.
size() == 0)
247 const Box& dstAllBox = a_dstFab.
box();
248 const Box& srcAllBox = a_srcFab.
box();
255 CH_assert(dstAllBox.contains(dstSetBox));
259 const size_t dstIndexLo =
261 const size_t srcIndexLo =
265 for (
int idir = 0; idir <
SpaceDim; idir++)
269 if ( ! (dstAllBox.contains(dst1dir)) )
276 size_t dstIndex1dirAll =
279 if (dstIndex1dirAll >= dstIndexLo)
281 dstInc[idir] = dstIndex1dirAll - dstIndexLo;
285 dstInc[idir] = -(dstIndexLo - dstIndex1dirAll);
291 srcAllInc[idir] = srcInc[idir] * srcSetDims[idir];
298 size_t srcIndex, dstIndex;
300 for (
int srcComp = a_srcIntvl.
begin(), dstComp = a_dstIntvl.
begin();
301 srcComp <= a_srcIntvl.
end();
302 ++srcComp, ++dstComp)
304 Interval src1Intvl(srcComp, srcComp);
305 Interval dst1Intvl(dstComp, dstComp);
309 const T* src1Array = src1Fab.
dataPtr();
310 T* dst1Array = dst1Fab.
dataPtr();
313 srcEnd[5] = srcBegin[5] + srcAllInc[5];
314 for (srcBegin[4] = srcBegin[5], dstBegin[4] = dstBegin[5];
315 srcBegin[4] < srcEnd[5];
316 srcBegin[4] += srcInc[5], dstBegin[4] += dstInc[5])
320 srcEnd[4] = srcBegin[4] + srcAllInc[4];
321 for (srcBegin[3] = srcBegin[4], dstBegin[3] = dstBegin[4];
322 srcBegin[3] < srcEnd[4];
323 srcBegin[3] += srcInc[4], dstBegin[3] += dstInc[4])
327 srcEnd[3] = srcBegin[3] + srcAllInc[3];
328 for (srcBegin[2] = srcBegin[3], dstBegin[2] = dstBegin[3];
329 srcBegin[2] < srcEnd[3];
330 srcBegin[2] += srcInc[3], dstBegin[2] += dstInc[3])
334 srcEnd[2] = srcBegin[2] + srcAllInc[2];
335 for (srcBegin[1] = srcBegin[2], dstBegin[1] = dstBegin[2];
336 srcBegin[1] < srcEnd[2];
337 srcBegin[1] += srcInc[2], dstBegin[1] += dstInc[2])
341 srcEnd[1] = srcBegin[1] + srcAllInc[1];
342 for (srcBegin[0] = srcBegin[1], dstBegin[0] = dstBegin[1];
343 srcBegin[0] < srcEnd[1];
344 srcBegin[0] += srcInc[1], dstBegin[0] += dstInc[1])
347 srcEnd[0] = srcBegin[0] + srcAllInc[0];
348 for (srcIndex = srcBegin[0], dstIndex = dstBegin[0];
349 srcIndex < srcEnd[0];
350 srcIndex += srcInc[0], dstIndex += dstInc[0])
356 CH_assert(dstIndex < dstAllBox.numPts());
358 dst1Array[dstIndex] = src1Array[srcIndex];
456 #include "NamespaceFooter.H" 458 #endif // include guard bool ok()
Definition: BoxIterator.H:281
IntVect size() const
size functions
Definition: Box.H:1819
#define CH_SPACEDIM
Definition: SPACE.H:51
#define CH_assert(cond)
Definition: CHArray.H:37
int size() const
Definition: Interval.H:75
int begin() const
Definition: Interval.H:99
IntVect type() const
Definition: Box.H:1805
bool contains(const IntVect &p) const
Definition: Box.H:1887
IntVect BASISV(int dir)
Definition: IntVect.H:1285
iterates through the IntVects of a Box
Definition: BoxIterator.H:37
const Box & box() const
Definition: BaseFabImplem.H:271
const int SpaceDim
Definition: SPACE.H:38
size_t FortranArrayIndex(IntVect a_iv, IntVect a_dims)
Definition: IndicesFunctions.H:18
Structure for passing component ranges in code.
Definition: Interval.H:23
static const IntVect Unit
Definition: IntVect.H:663
const IntVect & smallEnd() const
{ Accessors}
Definition: Box.H:1770
Ordered Tuples for Types T.
Definition: Tuple.H:30
LoHiSide
Definition: LoHiSide.H:27
T * dataPtr(int a_n=0)
Definition: BaseFabImplem.H:373
A Rectangular Domain on an Integer Lattice.
Definition: Box.H:469
A Real vector in SpaceDim-dimensional space.
Definition: RealVect.H:41
An integer Vector in SpaceDim-dimensional space.
Definition: CHArray.H:42
int end() const
Definition: Interval.H:104
bool isEmpty() const
{ Comparison Functions}
Definition: Box.H:1862