Go to the documentation of this file.
34 void Foam::blockDescriptor::check(
const Istream& is)
36 for (
const label pointi : blockShape_)
38 if (pointi < 0 || pointi >= vertices_.size())
41 <<
"Point label " << pointi
42 <<
" out of range 0.." << vertices_.size() - 1
43 <<
" in block " << *
this
48 const point blockCentre(blockShape_.centre(vertices_));
49 const faceList faces(blockShape_.faces());
52 label outwardFaceCount = 0;
53 boolList correctFaces(faces.size(),
true);
57 point faceCentre(faces[i].centre(vertices_));
58 vector faceNormal(faces[i].areaNormal(vertices_));
60 if (
mag(faceNormal) > SMALL)
62 if (((faceCentre - blockCentre) & faceNormal) > 0)
68 correctFaces[i] =
false;
78 if (outwardFaceCount == 0)
81 <<
"Block " << *
this <<
" is inside-out"
84 else if (outwardFaceCount != faces.size())
87 <<
"Block " << *
this <<
" has inward-pointing faces"
103 void Foam::blockDescriptor::findCurvedFaces()
105 const faceList shapeFaces(blockShape().faces());
107 forAll(shapeFaces, shapeFacei)
109 forAll(blockFaces_, facei)
116 shapeFaces[shapeFacei]
120 curvedFaces_[shapeFacei] = facei;
156 else if (expand_.size() != 12)
159 <<
"Unknown definition of expansion ratios"
191 blockMeshTools::read<label>
221 <<
"incorrect token while reading n, expected '(', found "
242 if (expRatios.size() == 1)
245 expand_ = expRatios[0];
247 else if (expRatios.size() == 3)
250 expand_[0] = expRatios[0];
251 expand_[1] = expRatios[0];
252 expand_[2] = expRatios[0];
253 expand_[3] = expRatios[0];
256 expand_[4] = expRatios[1];
257 expand_[5] = expRatios[1];
258 expand_[6] = expRatios[1];
259 expand_[7] = expRatios[1];
262 expand_[8] = expRatios[2];
263 expand_[9] = expRatios[2];
264 expand_[10] = expRatios[2];
265 expand_[11] = expRatios[2];
267 else if (expRatios.size() == 12)
274 <<
"Unknown definition of expansion ratios: " << expRatios
289 const label ni = sizes().x();
290 const label nj = sizes().y();
291 const label nk = sizes().z();
296 facePoints[0].
setSize((nj + 1)*(nk + 1));
297 facePoints[1].
setSize((nj + 1)*(nk + 1));
299 for (label j=0; j<=nj; j++)
301 for (label
k=0;
k<=nk;
k++)
303 facePoints[0][facePointLabel(0, j,
k)] =
305 facePoints[1][facePointLabel(1, j,
k)] =
310 facePoints[2].
setSize((ni + 1)*(nk + 1));
311 facePoints[3].
setSize((ni + 1)*(nk + 1));
313 for (label i=0; i<=ni; i++)
315 for (label
k=0;
k<=nk;
k++)
317 facePoints[2][facePointLabel(2, i,
k)] =
319 facePoints[3][facePointLabel(3, i,
k)] =
324 facePoints[4].
setSize((ni + 1)*(nj + 1));
325 facePoints[5].
setSize((ni + 1)*(nj + 1));
327 for (label i=0; i<=ni; i++)
329 for (label j=0; j<=nj; j++)
331 facePoints[4][facePointLabel(4, i, j)] =
332 points[pointLabel(i, j, 0)];
333 facePoints[5][facePointLabel(5, i, j)] =
334 points[pointLabel(i, j, nk)];
347 forAll(curvedFaces_, blockFacei)
349 if (curvedFaces_[blockFacei] != -1)
351 blockFaces_[curvedFaces_[blockFacei]].project
355 facePoints[blockFacei]
390 forAll(blockLabels, labeli)
396 os << blockLabels[labeli];
406 <<
" simpleGrading (";
463 os <<
"Dimensions:" << bd.
density()
465 <<
" nCells:" << bd.
nCells()
466 <<
" 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 cellShape & blockShape() const
Return the block shape.
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.
const word & zoneName() const
Return the (optional) zone name.
A token holds an item read from Istream.
List of gradingDescriptor for the sections of a block with additional IO functionality.
const Cmpt & z() const
Access to the vector z component.
punctuationToken pToken() const
Return punctuation character.
#define forAll(list, i)
Loop across all elements in list.
string expand(const std::string &s, const HashTable< string, word, string::hash > &mapping, const char sigil='$')
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
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 List< gradingDescriptors > & grading() const
Expansion ratios in all directions.
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,...
bool isWord() const
Token is WORD or DIRECTIVE word.
const word & name() const
Return model name.
pointField vertices(const blockVertexList &bvl)
label nInternalFaces() const
The number of internal faces in the i-j-k mesh.
void setSize(const label n)
Dummy setSize 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 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 token.
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.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
const labelVector & density() const
Return the mesh density (number of cells) in the i,j,k directions.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
vector point
Point is a vector.
bool isPunctuation() const
Token is PUNCTUATION.
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.