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;
198 const cellShape& bshape,
203 const UList<gradingDescriptors>&
expand,
218 if (!assignGradings(
expand))
221 <<
"Unknown definition of expansion ratios: " <<
expand
231 const dictionary&
dict,
232 const label blockIndex,
252 blockShape_ = cellShape
255 blockMeshTools::read<label>
258 dict.subOrEmptyDict(
"namedVertices")
268 zoneName_ = t.wordToken();
275 if (t.isPunctuation())
285 <<
"Incorrect token while reading n, expected '(', found "
294 <<
"Encountered old-style specification of mesh divisions"
308 List<gradingDescriptors>
expand(is);
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)];
383 FixedList<pointField, 6>& facePoints
386 forAll(curvedFaces_, blockFacei)
388 if (curvedFaces_[blockFacei] >= 0)
390 blockFaces_[curvedFaces_[blockFacei]].project
394 facePoints[blockFacei]
408 const dictionary* varDictPtr = d.findDict(
"namedBlocks");
424 const cellShape& bshape = bd.blockShape();
427 os << bshape.model().
name() <<
" (";
429 forAll(blockLabels, labeli)
435 os << blockLabels[labeli];
439 if (bd.zoneName().size())
441 os <<
' ' << bd.zoneName();
444 os <<
' ' << bd.density()
448 const List<gradingDescriptors>&
expand = bd.grading();
496 const InfoProxy<blockDescriptor>& iproxy
499 const blockDescriptor& bd = iproxy.t_;
501 os <<
"Dimensions:" << bd.density()
502 <<
" nPoints:" << bd.nPoints()
503 <<
" nCells:" << bd.nCells()
504 <<
" nFaces:" << bd.nFaces()
505 <<
" nInternalFaces:" << bd.nInternalFaces()
dictionary * findDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX)
List< label > labelList
A List of labels.
vectorField pointField
pointField is a vectorField.
A class for handling words, derived from Foam::string.
A helper class for outputting values to Ostream.
virtual const fileName & name() const
const List< gradingDescriptors > & grading() const noexcept
const word & zoneName() const noexcept
static void write(Ostream &, const label blocki, const dictionary &)
static bool sameVertices(const face &a, const face &b)
List< bool > boolList
A List of bools.
Ostream & endl(Ostream &os)
A token holds an item read from Istream.
punctuationToken pToken() const
bool isWord() const noexcept
Vector< label > labelVector
Vector of labels.
PtrList< blockEdge > blockEdgeList
A PtrList of blockEdges.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
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...
Generic templated field type.
InfoProxy< token > info() const
const labelVector & sizes() const
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
const labelVector & density() const noexcept
bool isPunctuation() const noexcept
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
FixedList< pointField, 6 > facePoints(const pointField &points) const
void correctFacePoints(FixedList< pointField, 6 > &) const
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
void setSize(const label n)
An analytical geometric cellShape.
Vector< scalar > vector
A scalar version of the templated Vector.
const word & wordToken() const
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)
PtrList< blockFace > blockFaceList
A PtrList of blockFaces.
const word & name() const noexcept
#define FatalErrorInFunction
List< face > faceList
A List of faces.
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)
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...
blockDescriptor(const blockDescriptor &)=default
const cellShape & blockShape() const noexcept
#define FatalIOErrorInFunction(ios)
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
#define IOWarningInFunction(ios)
vector point
Point is a vector.
string expand(const std::string &s, const HashTable< string > &mapping, const char sigil='$')
@ BEGIN_LIST
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