33 template<
class Container,
class Type>
46 for (
direction cmpt = 0; cmpt < 3; cmpt++)
48 if (maxIds[cmpt] < 0 || minIds[cmpt] >=
nDivs[cmpt])
53 maxIds[cmpt] =
min(maxIds[cmpt],
nDivs[cmpt]-1);
54 minIds[cmpt] =
max(minIds[cmpt], 0);
59 for (label
k = minIds[2];
k <= maxIds[2];
k++)
61 const label start1 = voxeli;
62 for (label j = minIds[1]; j <= maxIds[1]; j++)
64 const label start0 = voxeli;
65 for (label i = minIds[0]; i <= maxIds[0]; i++)
70 voxeli = start0 + off[1];
72 voxeli = start1 + off[2];
77 template<
class Container,
class Type,
class CombineOp>
83 const boundBox& subBb,
91 for (
direction cmpt = 0; cmpt < 3; cmpt++)
93 if (maxIds[cmpt] < 0 || minIds[cmpt] >= nDivs[cmpt])
98 maxIds[cmpt] =
min(maxIds[cmpt], nDivs[cmpt]-1);
99 minIds[cmpt] =
max(minIds[cmpt], 0);
103 label voxeli = index(nDivs, minIds);
104 for (label
k = minIds[2];
k <= maxIds[2];
k++)
106 const label start1 = voxeli;
107 for (label j = minIds[1]; j <= maxIds[1]; j++)
109 const label start0 = voxeli;
110 for (label i = minIds[0]; i <= maxIds[0]; i++)
112 cop(elems[voxeli], val);
115 voxeli = start0 + off[1];
117 voxeli = start1 + off[2];
122 template<
class Container,
class Type>
127 const boundBox& subBb,
128 const Container& elems,
135 labelVector minIds(index3(bb, nDivs, subBb.min()));
136 labelVector maxIds(index3(bb, nDivs, subBb.max()));
138 for (
direction cmpt = 0; cmpt < 3; cmpt++)
140 if (maxIds[cmpt] < 0 || minIds[cmpt] >= nDivs[cmpt])
145 maxIds[cmpt] =
min(maxIds[cmpt], nDivs[cmpt]-1);
146 minIds[cmpt] =
max(minIds[cmpt], 0);
152 <<
"sizes:" << elems.size() <<
" and " << nDivs
158 label voxeli = index(nDivs, minIds);
159 for (label
k = minIds[2];
k <= maxIds[2];
k++)
161 const label start1 = voxeli;
162 for (label j = minIds[1]; j <= maxIds[1]; j++)
164 const label start0 = voxeli;
165 for (label i = minIds[0]; i <= maxIds[0]; i++)
167 const Type elemVal = elems[voxeli];
168 if (isNot != (elemVal == val))
174 voxeli = start0 + off[1];
176 voxeli = start1 + off[2];
182 template<
class Container,
class Type>
188 const Container& elems,
196 <<
"sizes:" << elems.size() <<
" and " << nDivs
202 for (label
k = 0;
k < nDivs[2];
k++)
204 const label start1 = voxeli;
205 for (label j = 0; j < nDivs[1]; j++)
207 const label start0 = voxeli;
208 for (label i = 0; i < nDivs[0]; i++)
210 const Type& elemVal = elems[voxeli];
211 if (isNot != (elemVal == val))
217 voxeli = start0 + off[1];
219 voxeli = start1 + off[2];
static labelVector offset(const labelVector &nDivs)
Change in combined voxel index for change in components.
Cmpt cmptProduct(const VectorSpace< Form, Cmpt, Ncmpts > &vs)
errorManipArg< error, int > exit(error &err, const int errNo=1)
virtual Ostream & write(const char c) override
Write character.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
A bounding box defined in terms of min/max extrema points.
label k
Boltzmann constant.
const point & min() const noexcept
Minimum describing the bounding box.
const labelVector & nDivs() const
Number of voxels for local mesh.
const point & max() const noexcept
Maximum describing the bounding box.
static label index(const labelVector &nDivs, const labelVector &voxel)
Find cells. Returns number of cells found.
static bool overlaps(const boundBox &bb, const labelVector &nDivs, const boundBox &subBb, const Container &elems, const Type val, const bool isNot=false)
Check if any voxel inside bounding box is set to val or.
static labelVector index3(const labelVector &nDivs, const label voxeli)
Combined voxel index to individual indices.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
OBJstream os(runTime.globalPath()/outputName)
static void fill(Container &elems, const boundBox &bb, const labelVector &nDivs, const boundBox &subBb, const Type val)
Fill voxels indicated by bounding box.
Vector< label > labelVector
Vector of labels.
static void write(OBJstream &, const boundBox &bb, const labelVector &nDivs, const Container &elems, const Type val, const bool isNot=false)
Debug: write points for every set element.