49 const word& patchName,
55 const label nBlocks =
blocks.size();
59 face&
f = patchFaces[facei];
65 const label bi =
f[0];
66 const label fi =
f[1];
68 if (bi < 0 || bi >= nBlocks)
71 <<
"Block index out of range."
72 <<
" Patch face (" << bi <<
' ' << fi <<
")\n"
73 <<
" Number of blocks = " << nBlocks
74 <<
", block index = " << bi <<
nl
75 <<
" on patch " << patchName <<
", face " << facei
78 else if (fi >=
blocks[bi].blockShape().nFaces())
81 <<
"Block face index out of range."
82 <<
" Patch face (" << bi <<
' ' << fi <<
")\n"
83 <<
" Number of block faces = "
84 <<
blocks[bi].blockShape().nFaces()
85 <<
", face index = " << fi <<
nl
86 <<
" on patch " << patchName <<
", face " << facei
91 f =
blocks[bi].blockShape().face(fi);
96 for (
const label pointi :
f)
98 if (pointi < 0 || pointi >=
nPoints)
101 <<
"Point label " << pointi
102 <<
" out of range 0.." << (
nPoints - 1) <<
nl
103 <<
" on patch " << patchName <<
", face " << facei
116void Foam::blockMesh::readPatches
119 faceListList& tmpBlocksPatches,
122 wordList& nbrPatchNames
126 dictionary varDict(meshDescription.subOrEmptyDict(
"namedVertices"));
127 varDict.merge(meshDescription.subOrEmptyDict(
"namedBlocks"));
130 ITstream& patchStream = meshDescription.lookup(
"patches");
135 if (patchStream.peek().isLabel())
146 patchStream.readBegin(
"patches");
150 token lastToken(patchStream);
153 if (tmpBlocksPatches.size() <=
nPatches)
155 tmpBlocksPatches.setSize(
nPatches + 1);
158 nbrPatchNames.setSize(
nPatches + 1);
161 patchStream.putBack(lastToken);
176 for (label i = 0; i <
nPatches; i++)
182 <<
" at line " << patchStream.lineNumber()
207 <<
"Old-style cyclic definition."
208 <<
" Splitting patch "
210 << halfA <<
" and " << halfB <<
endl
211 <<
" Alternatively use new 'boundary' dictionary syntax."
215 if (tmpBlocksPatches.size() <=
nPatches)
217 tmpBlocksPatches.setSize(
nPatches + 1);
220 nbrPatchNames.setSize(
nPatches + 1);
236 <<
"Size of cyclic faces is not a multiple of 2 :"
240 label sz = tmpBlocksPatches[
nPatches-1].size()/2;
244 SubList<face>(unsplitFaces, sz)
248 SubList<face>(unsplitFaces, sz, sz)
254 patchStream >> lastToken;
256 patchStream.putBack(lastToken);
259 patchStream.readEnd(
"patches");
263void Foam::blockMesh::readBoundary
272 dictionary varDict(meshDescription.subOrEmptyDict(
"namedVertices"));
273 varDict.merge(meshDescription.subOrEmptyDict(
"namedBlocks"));
279 meshDescription.lookup(
"boundary")
283 tmpBlocksPatches.setSize(patchesInfo.size());
286 forAll(tmpBlocksPatches, patchi)
288 const entry& patchInfo = patchesInfo[patchi];
290 if (!patchInfo.isDict())
293 <<
"Entry " << patchInfo <<
" in boundary section is not a"
294 <<
" valid dictionary."
317 tmpBlocksPatches[patchi]
331 shapes[blocki] =
blocks[blocki].blockShape();
340Foam::autoPtr<Foam::polyMesh>
341Foam::blockMesh::createTopology
347 word defaultPatchName =
"defaultFaces";
348 word defaultPatchType = emptyPolyPatch::typeName;
355 dictptr->readIfPresent(
"name", defaultPatchName);
356 dictptr->readIfPresent(
"type", defaultPatchType);
361 readPointTransforms(meshDescription);
364 if (meshDescription.found(
"edges"))
368 Info<<
"Creating block edges" <<
endl;
373 meshDescription.lookup(
"edges"),
377 edges_.transfer(edges);
384 Info<<
"No non-linear block edges defined" <<
endl;
390 if (meshDescription.found(
"faces"))
394 Info<<
"Creating block faces" <<
endl;
399 meshDescription.lookup(
"faces"),
403 faces_.transfer(faces);
410 Info<<
"No non-planar block faces defined" <<
endl;
418 Info<<
"Creating topology blocks" <<
endl;
423 meshDescription.lookup(
"blocks"),
424 block::iNew(meshDescription, vertices_, edges_, faces_)
440 Info<<
nl <<
"Creating topology patches - ";
443 if (meshDescription.found(
"patches"))
447 Info<<
"from patches section" <<
endl;
465 <<
"Reading physicalType from existing boundary file" <<
endl;
472 meshDescription.time(),
473 meshDescription.time().constant(),
503 <<
"' (read from boundary file)"
508 if (!nbrPatchNames[patchi].empty())
510 dict.
set(
"neighbourPatch", nbrPatchNames[patchi]);
514 else if (meshDescription.found(
"boundary"))
518 Info<<
"from boundary section" <<
endl;
533 Info<<
"with default boundary only!!" <<
endl;
540 Info<<
nl <<
"Creating block mesh topology";
541 if (hasPointTransforms())
543 Info<<
" - scaling/transform applied later";
553 meshDescription.time().constant(),
554 meshDescription.time(),
568 check(*blockMeshPtr, meshDescription);
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
@ NO_REGISTER
Do not request registration (bool: false).
@ NO_READ
Nothing to be read.
@ NO_WRITE
Ignore writing from objectRegistry::writeObject().
Defines the attributes of an object for which implicit objectRegistry management is supported,...
bool set(const label i, bool val=true)
A bitSet::set() method for a list of bool.
void setSize(label n)
Alias for resize().
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
void size(const label n)
Older name for setAddressableSize.
label size() const noexcept
The number of entries in the list.
static autoPtr< T > New(Args &&... args)
Construct autoPtr with forwarding arguments.
Class used for the read-construction of.
Class used for the read-construction of.
A multi-block mesh generator.
wordList patchNames() const
Return the patch names.
Class used for the read-construction of.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a T. FatalIOError if not found, or if the number of tokens is incorrect.
const dictionary * findDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary pointer if present (and it is a dictionary) otherwise return nullptr...
bool found(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find an entry (const access) with the given keyword.
entry * add(entry *entryPtr, bool mergeEntry=false)
Add a new entry.
entry * set(entry *entryPtr)
Assign a new entry, overwriting any existing entry.
A keyword and a list of tokens is an 'entry'.
A face is a list of labels corresponding to mesh vertices.
static word meshSubDir
Return the mesh sub-directory name (usually "polyMesh").
Lookup type of boundary radiation properties.
@ END_LIST
End list [isseparator].
A class for handling words, derived from Foam::string.
Foam::word regionName(args.getOrDefault< word >("region", Foam::polyMesh::defaultRegion))
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
List< word > wordList
List of word.
messageStream Info
Information stream (stdout output on master, null elsewhere).
List< face > faceList
List of faces.
static void check(const int retVal, const char *what)
Ostream & endl(Ostream &os)
Add newline and flush stream.
List< faceList > faceListList
List of faceList.
void preservePatchTypes(const objectRegistry &obr, const word &meshInstance, const fileName &meshDir, const wordList &patchNames, PtrList< dictionary > &patchDicts, const word &defaultFacesName, word &defaultFacesType)
Preserve patch types.
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...
PtrList< blockFace > blockFaceList
A PtrList of blockFaces.
PtrList< blockEdge > blockEdgeList
A PtrList of blockEdges.
vectorField pointField
pointField is a vectorField.
errorManipArg< error, int > exit(error &err, const int errNo=1)
static void rewritePatchLabels(const Source &source, const word &patchName, const PtrList< block > &blocks, const label nPoints, faceList &patchFaces)
List< cellShape > cellShapeList
List of cellShape.
PtrList< block > blockList
A PtrList of blocks.
constexpr char nl
The newline '\n' character (0x0a).
wordList patchTypes(nPatches)
wordList patchNames(nPatches)
PtrList< dictionary > patchDicts
#define forAll(list, i)
Loop across all elements in list.