34bool Foam::blockDescriptor::assignGradings
36 const UList<gradingDescriptors>& ratios
41 switch (ratios.size())
46 expand_ = gradingDescriptors();
61 expand_[0] = ratios[0];
62 expand_[1] = ratios[0];
63 expand_[2] = ratios[0];
64 expand_[3] = ratios[0];
67 expand_[4] = ratios[1];
68 expand_[5] = ratios[1];
69 expand_[6] = ratios[1];
70 expand_[7] = ratios[1];
73 expand_[8] = ratios[2];
74 expand_[9] = ratios[2];
75 expand_[10] = ratios[2];
76 expand_[11] = ratios[2];
95void Foam::blockDescriptor::check(
const Istream& is)
97 for (
const label pointi : blockShape_)
99 if (pointi < 0 || pointi >= vertices_.size())
102 <<
"Point label (" << pointi
103 <<
") out of range 0.." << vertices_.size() - 1
104 <<
" in block " << *
this
109 const point blockCentre(blockShape_.centre(vertices_));
110 const faceList faces(blockShape_.faces());
113 label outwardFaceCount = 0;
114 boolList correctFaces(faces.size(),
true);
118 point faceCentre(faces[i].centre(vertices_));
119 vector faceNormal(faces[i].areaNormal(vertices_));
121 if (
mag(faceNormal) > SMALL)
123 if (((faceCentre - blockCentre) & faceNormal) > 0)
129 correctFaces[i] =
false;
139 if (outwardFaceCount == 0)
142 <<
"Block " << *
this <<
" is inside-out"
145 else if (outwardFaceCount != faces.size())
148 <<
"Block " << *
this <<
" has inward-pointing faces"
153 if (!correctFaces[i])
164void Foam::blockDescriptor::findCurvedFaces(
const label blockIndex)
166 const faceList shapeFaces(blockShape().faces());
168 forAll(shapeFaces, shapeFacei)
170 forAll(blockFaces_, facei)
172 const face&
f = blockFaces_[facei].vertices();
179 &&
f[0] == blockIndex
180 &&
f[1] == shapeFacei
185 curvedFaces_[shapeFacei] = facei;
218 if (!assignGradings(expand))
221 <<
"Unknown definition of expansion ratios: " << expand
232 const label blockIndex,
255 blockMeshTools::read<label>
285 <<
"Incorrect token while reading n, expected '(', found "
294 <<
"Encountered old-style specification of mesh divisions"
310 if (!assignGradings(expand))
313 <<
"Unknown definition of expansion ratios: " << expand
319 findCurvedFaces(blockIndex);
328 const label ni = sizes().x();
329 const label nj = sizes().y();
330 const label nk = sizes().z();
335 facePoints[0].
setSize((nj + 1)*(nk + 1));
336 facePoints[1].
setSize((nj + 1)*(nk + 1));
338 for (label j=0; j<=nj; j++)
340 for (label
k=0;
k<=nk;
k++)
342 facePoints[0][facePointLabel(0, j,
k)] =
344 facePoints[1][facePointLabel(1, j,
k)] =
349 facePoints[2].
setSize((ni + 1)*(nk + 1));
350 facePoints[3].
setSize((ni + 1)*(nk + 1));
352 for (label i=0; i<=ni; i++)
354 for (label
k=0;
k<=nk;
k++)
356 facePoints[2][facePointLabel(2, i,
k)] =
358 facePoints[3][facePointLabel(3, i,
k)] =
363 facePoints[4].
setSize((ni + 1)*(nj + 1));
364 facePoints[5].
setSize((ni + 1)*(nj + 1));
366 for (label i=0; i<=ni; i++)
368 for (label j=0; j<=nj; j++)
370 facePoints[4][facePointLabel(4, i, j)] =
371 points[pointLabel(i, j, 0)];
372 facePoints[5][facePointLabel(5, i, j)] =
373 points[pointLabel(i, j, nk)];
386 forAll(curvedFaces_, blockFacei)
388 if (curvedFaces_[blockFacei] >= 0)
390 blockFaces_[curvedFaces_[blockFacei]].project
394 facePoints[blockFacei]
429 forAll(blockLabels, labeli)
435 os << blockLabels[labeli];
455 expand[0] == expand[1]
456 && expand[0] == expand[2]
457 && expand[0] == expand[3]
461 expand[4] == expand[5]
462 && expand[4] == expand[6]
463 && expand[4] == expand[7]
467 expand[8] == expand[9]
468 && expand[8] == expand[10]
469 && expand[8] == expand[11]
473 os << expand[0] <<
' ' << expand[4] <<
' ' << expand[8];
503 <<
" nCells:" << bd.
nCells()
504 <<
" nFaces:" << bd.
nFaces()
A 1D vector of objects of type <T> with a fixed length <N>.
void setSize(const label n)
Dummy function, to make FixedList consistent with List.
A helper class for outputting values to Ostream.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
void putBack(const token &tok)
Put back a token. Only a single put back is permitted.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
void size(const label n)
Older name for setAddressableSize.
Takes the description of the block and the list of curved edges and creates a list of points on edges...
const List< gradingDescriptors > & grading() const noexcept
Expansion ratios in all directions.
const cellShape & blockShape() const noexcept
Return the block shape.
const labelVector & density() const noexcept
The mesh density (number of cells) in the i,j,k directions.
const word & zoneName() const noexcept
Return the (optional) zone name.
void correctFacePoints(FixedList< pointField, 6 > &) const
Correct the location of the given face-points.
const word & name() const noexcept
Return model name.
An analytical geometric cellShape.
const cellModel & model() const
Model reference.
const DynamicList< point > & facePoints()
Returns the points of the cutting PLICface.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
dictionary subOrEmptyDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX, const bool mandatory=false) const
dictionary * findDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX)
Find and return a sub-dictionary pointer if present.
FixedList< label, nTypes > sizes() const
Processor-local sizes per element type.
static bool sameVertices(const face &a, const face &b)
Return true if the faces have the same vertices.
virtual bool write()
Write the output fields.
A simple i-j-k (row-major order) to linear addressing for a rectilinear mesh. Since the underlying me...
label nInternalFaces() const
The number of internal faces in the i-j-k mesh.
label nCells() const
The number of mesh cells (nx*ny*nz) in the i-j-k mesh.
label nPoints() const
The number of mesh points (nx+1)*(ny+1)*(nz+1) in the i-j-k mesh.
label nFaces() const
The total number of mesh faces in the i-j-k mesh.
A token holds an item read from Istream.
bool isPunctuation() const noexcept
Token is PUNCTUATION.
@ BEGIN_LIST
Begin list [isseparator].
punctuationToken pToken() const
Return punctuation character.
InfoProxy< token > info() const
Return info proxy for printing token information to a stream.
const word & wordToken() const
Return const reference to the word contents.
bool isWord() const noexcept
Token is word-variant (WORD, DIRECTIVE)
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
A class for handling words, derived from Foam::string.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
OBJstream os(runTime.globalPath()/outputName)
#define IOWarningInFunction(ios)
Report an IO warning using Foam::Warning.
vector point
Point is a vector.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
pointField vertices(const blockVertexList &bvl)
List< bool > boolList
A List of bools.
List< face > faceList
A List of faces.
errorManipArg< error, int > exit(error &err, const int errNo=1)
constexpr char nl
The newline '\n' character (0x0a)
#define forAll(list, i)
Loop across all elements in list.