68 return (idx.
x() >= 0 && idx.
y() >= 0 && idx.
z() >= 0);
79 const PDRblock& pdrBlock
86 const label maxPointId =
cmptMax(pdrBlock.sizes())+1;
89 <<
" nPoints:" <<
mesh.nPoints()
90 <<
" nCells:" <<
mesh.nCells()
91 <<
" nFaces:" <<
mesh.nFaces() <<
nl;
94 <<
" nPoints:" << pdrBlock.nPoints()
95 <<
" nCells:" << pdrBlock.nCells()
96 <<
" nFaces:" << pdrBlock.nFaces() <<
nl 97 <<
" min-edge:" << pdrBlock.edgeLimits().min() <<
nl;
99 Info<<
"Classifying ijk indexing... " <<
nl;
110 for (label celli = 0; celli <
mesh.nCells(); ++celli)
112 cellIndex[celli] = pdrBlock.findCell(cc[celli]);
119 IjkField<bool> cellFound(pdrBlock.sizes(),
false);
121 for (label celli=0; celli <
cellIndex.size(); ++celli)
125 if (isGoodIndex(cellIdx))
127 cellFound(cellIdx) =
true;
131 const label firstMiss = cellFound.find(
false);
136 for (label celli = firstMiss; celli < cellFound.size(); ++celli)
138 if (!cellFound[celli])
145 <<
"No ijk location found for " 146 << nMissing <<
" cells.\nFirst miss at: " 147 << pdrBlock.index(firstMiss)
155 List<labelVector> pointIndex(
mesh.nPoints());
157 for (label pointi = 0; pointi <
mesh.nPoints(); ++pointi)
164 const labelMinMax invertedLimits(maxPointId, -maxPointId);
165 Vector<labelMinMax> faceLimits;
167 const Vector<direction> faceBits
177 for (label facei=0; facei <
mesh.nFaces(); ++facei)
182 const label own =
mesh.faceOwner()[facei];
185 facei <
mesh.nInternalFaces()
186 ?
mesh.faceNeighbour()[facei]
193 faceIdx.x() = faceIdx.y() = faceIdx.z() = -1;
199 faceLimits.x() = faceLimits.y() = faceLimits.z() = invertedLimits;
201 for (
const label pointi :
mesh.faces()[facei])
205 faceLimits[cmpt].add(pointIndex[pointi][cmpt]);
213 const auto& limits = faceLimits[cmpt];
219 <<
"Unexpected search failure for " << facei <<
" in " 220 << vector::componentNames[cmpt] <<
"-direction" <<
nl 224 if (limits.min() < 0)
227 <<
"Face " << facei <<
" contains non-grid point in " 228 << vector::componentNames[cmpt] <<
"-direction" <<
nl 229 <<
mesh.faces()[facei] <<
' ' 230 <<
mesh.faces()[facei].points(
mesh.points())
233 else if (limits.min() == limits.max())
236 inPlane |= faceBits[cmpt];
238 else if (limits.min() + 1 != limits.max())
241 <<
"Face " << facei <<
" not in " 242 << vector::componentNames[cmpt] <<
"-plane" <<
nl 263 <<
"Face " << facei <<
" not in an x/y/z plane?" <<
nl 268 faceIdx.x() = faceLimits.x().min();
269 faceIdx.y() = faceLimits.y().min();
270 faceIdx.z() = faceLimits.z().min();
278 const PDRblock& pdrBlock
282 classify(
mesh, pdrBlock);
void cmptMax(FieldField< Field, typename FieldField< Field, Type >::cmptType > &cf, const FieldField< Field, Type > &f)
errorManipArg< error, int > exit(error &err, const int errNo=1)
void resize(const label len)
Adjust allocated size of list.
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.
labelVector faceDims
The face i-j-k addressing range.
List< labelVector > cellIndex
For each cell, the corresponding i-j-k address.
constexpr char nl
The newline '\n' character (0x0a)
static scalar gridPointRelTol
Relative tolerance when matching grid points. Default = 0.02.
const Cmpt & y() const noexcept
Access to the vector y component.
vectorField pointField
pointField is a vectorField.
List< labelVector > faceIndex
For each face, the corresponding i-j-k address.
void read(const Time &runTime, const PDRblock &pdrBlock)
Read OpenFOAM mesh and determine i-j-k indices for faces/cells.
List< direction > faceOrient
For each face, the x/y/z orientation.
MinMax< label > labelMinMax
A label min/max range.
static constexpr direction nComponents
Number of components in this vector space.
const Cmpt & x() const noexcept
Access to the vector x component.
4: z-direction. Same as (1 << vector::Z)
const Cmpt & z() const noexcept
Access to the vector z component.
vector point
Point is a vector.
PtrList< volScalarField > & Y
1: x-direction. Same as (1 << vector::X)
static const Vector< label > one
messageStream Info
Information stream (stdout output on master, null elsewhere)
void classify(const polyMesh &mesh, const PDRblock &pdrBlock)
Determine i-j-k indices for faces/cells.
Vector< label > labelVector
Vector of labels.
2: y-direction. Same as (1 << vector::Y)
labelVector cellDims
The cell i-j-k addressing range.