17 #ifndef __UT_MultigridArray__
18 #define __UT_MultigridArray__
99 return myVec.isInit();
105 return myVec(i + j * myYStride + k * myZStride);
110 return myVec(i + j * myYStride + k * myZStride);
115 return myVec(idx[0] + idx[1] * myYStride + idx[2] * myZStride);
120 return myVec(idx[0] + idx[1] * myYStride + idx[2] * myZStride);
129 return myBoundModNeg[axis] * (*this)(idx) +
130 myBoundAdjModNeg[axis] * (*
this)(idxadj);
139 return myBoundModPos[axis] * (*this)(idx) +
140 myBoundAdjModPos[axis] * (*
this)(idxadj);
148 return myBoundModNeg[axis] * U + myBoundAdjModNeg[axis] * Uadj;
156 return myBoundModPos[axis] * U + myBoundAdjModPos[axis] * Uadj;
170 return myVec.norm(n);
190 return myBoundariesNeg;
195 return myBoundariesPos;
206 for (
int i=0; i < 3; i++)
207 parity[i] = getRes(i) % 2;
214 return myRes[0] * myRes[1] * myRes[2];
225 for (
int i=0; i < 3; i++)
233 return numElements() > 1000;
238 return myVec.getData();
243 return myVec.getData();
256 subtractApplyLaplacian,
268 smoothLaplacianGaussSeidel,
270 UT_MultigridArrayT&, x)
271 void smoothLaplacianGaussSeidelPartial(
int parity, UT_MultigridArrayT& x,
278 UT_MultigridArrayT&, uh,
280 void coarsenAlongAxisPartial(UT_MultigridArrayT& uh,
int axis,
287 interpolateAlongAxis,
288 UT_MultigridArrayT&, u,
290 void interpolateAlongAxisPartial(UT_MultigridArrayT& u,
int axis,
296 template <typename
S>
302 void directSolve(UT_MultigridArrayT &x) const;
315 UT_MultigridArrayT &u) const;
327 void vcycle(
exint minPerAxis,
int nSmoothDown,
int nSmoothUp,
328 UT_MultigridArrayT &x,
bool smoothTopLevelDown = true) const;
333 void fullMultigrid(
exint minPerAxis,
int nSmoothDown,
334 int nSmoothUp, UT_MultigridArrayT &x) const;
345 int solvePoisson(
fpreal64 abstol,
fpreal64 reltol,
int miniter,
int maxiter,
346 UT_MultigridArrayT &x,
349 bool startFMG = true) const;
358 bool solvePoissonCholesky(UT_MultigridArrayT &x) const;
365 bool solvePoissonLU(UT_MultigridArrayT &x) const;
371 bool solvePoissonSVD(UT_MultigridArrayT &x) const;
374 void initLaplacian();
377 computeNormsInternal,
380 void computeNormsInternalPartial(fpreal64 *norminf, fpreal64 *norm2,
384 computeResidualNormsInternal,
385 const UT_MultigridArrayT&, x,
388 void computeResidualNormsInternalPartial(const UT_MultigridArrayT& x,
389 fpreal64 *norminf, fpreal64 *norm2,
394 static const
exint PARALLEL_BLOCK_SIZE_VEC = 512;
398 static const
exint PARALLEL_BLOCK_SIZE_Z = 8;
413 T myInvdx2, myInvdy2, myInvdz2, myDiag, myOmega;
419 bool myAllOpen, myAllClosed;
T operator()(const UT_Vector3I &idx) const
UT_Vector3I getRes() const
bool shouldMultiThread() const
const UT_Vector3I & getBoundariesPos() const
T ghostValueNeg(int axis, const UT_Vector3I &idx, const UT_Vector3I &idxadj) const
UT_MultigridArrayT(const UT_MultigridArrayT &a)
Construct as copy.
exint numElements() const
Returns the total number of elements in the array.
exint getRes(int axis) const
GLboolean GLboolean GLboolean GLboolean a
UT_Vector3I getParity() const
UT_Vector3T< int64 > UT_Vector3I
bool isInit()
Whether this array has been initialized - default constructor does not.
const UT_Vector3I & getBoundariesNeg() const
T & operator()(const UT_Vector3I &idx)
OIIO_FORCEINLINE const vint4 & operator+=(vint4 &a, const vint4 &b)
T & operator()(int i, int j, int k)
T ghostValueNeg(int axis, T U, T Uadj) const
const UT_Vector3T< T > & getSpacing() const
#define THREADED_METHOD2_CONST(CLASSNAME, DOMULTI, METHOD, PARMTYPE1, PARMNAME1, PARMTYPE2, PARMNAME2)
LeafData & operator=(const LeafData &)=delete
bool is1D() const
Returns whether this is a 1-D array.
T operator()(int i, int j, int k) const
#define THREADED_METHOD3_CONST(CLASSNAME, DOMULTI, METHOD, PARMTYPE1, PARMNAME1, PARMTYPE2, PARMNAME2, PARMTYPE3, PARMNAME3)
T ghostValuePos(int axis, const UT_Vector3I &idx, const UT_Vector3I &idxadj) const
T ghostValuePos(int axis, T U, T Uadj) const