Go to the documentation of this file.
34 bool 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];
95 void 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])
164 void 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];
503 <<
" nCells:" << bd.
nCells()
504 <<
" nFaces:" << bd.
nFaces()
label nFaces() const
The total number of mesh faces in the i-j-k mesh.
dictionary * findDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX)
Find and return a sub-dictionary pointer if present.
const Cmpt & x() const
Access to the vector x component.
A class for handling words, derived from Foam::string.
A helper class for outputting values to Ostream.
const List< gradingDescriptors > & grading() const noexcept
Expansion ratios in all directions.
const word & zoneName() const noexcept
Return the (optional) zone name.
static void write(Ostream &, const label blocki, const dictionary &)
Write block index with dictionary lookup.
const labelVector & sizes() const
The (i,j,k) addressing dimensions.
static bool sameVertices(const face &a, const face &b)
Return true if the faces have the same vertices.
List< bool > boolList
A List of bools.
Ostream & endl(Ostream &os)
Add newline and flush stream.
A token holds an item read from Istream.
const Cmpt & z() const
Access to the vector z component.
punctuationToken pToken() const
Return punctuation character.
bool isWord() const noexcept
Token is word-variant (WORD, DIRECTIVE)
#define forAll(list, i)
Loop across all elements in list.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
static void check(const int retVal, const char *what)
A simple i-j-k (row-major order) to linear addressing for a rectilinear mesh. Since the underlying me...
InfoProxy< token > info() const
Return info proxy for printing token information to a stream.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
const labelVector & density() const noexcept
The mesh density (number of cells) in the i,j,k directions.
bool isPunctuation() const noexcept
Token is PUNCTUATION.
FixedList< pointField, 6 > facePoints(const pointField &points) const
Return the list of face-points for all of the faces of the block.
void correctFacePoints(FixedList< pointField, 6 > &) const
Correct the location of the given face-points.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
pointField vertices(const blockVertexList &bvl)
OBJstream os(runTime.globalPath()/outputName)
label nInternalFaces() const
The number of internal faces in the i-j-k mesh.
void setSize(const label n)
Dummy function, to make FixedList consistent with List.
An analytical geometric cellShape.
Vector< scalar > vector
A scalar version of the templated Vector.
const word & wordToken() const
Return const reference to the word contents.
dictionary subOrEmptyDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX, const bool mandatory=false) const
errorManipArg< error, int > exit(error &err, const int errNo=1)
const word & name() const noexcept
Return model name.
const Cmpt & y() const
Access to the vector y component.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
label nCells() const
The number of mesh cells (nx*ny*nz) in the i-j-k mesh.
List< face > faceList
A List of faces.
label nPoints() const
The number of mesh points (nx+1)*(ny+1)*(nz+1) in the i-j-k mesh.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void putBack(const token &tok)
Put back a token. Only a single put back is permitted.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
A 1D vector of objects of type <T> with a fixed length <N>.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
label k
Boltzmann constant.
blockDescriptor(const blockDescriptor &)=default
Copy construct.
const cellShape & blockShape() const noexcept
Return the block shape.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
#define IOWarningInFunction(ios)
Report an IO warning using Foam::Warning.
vector point
Point is a vector.
string expand(const std::string &s, const HashTable< string > &mapping, const char sigil='$')
Begin list [isseparator].
Takes the description of the block and the list of curved edges and creates a list of points on edges...
const cellModel & model() const
Model reference.