45 template<
class Source>
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
116 void Foam::blockMesh::readPatches
118 const dictionary& meshDescription,
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);
168 tmpBlocksPatches[
nPatches] = blockMeshTools::read<face>
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);
233 if ((tmpBlocksPatches[
nPatches-1].size() % 2) != 0)
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");
263 void Foam::blockMesh::readBoundary
265 const dictionary& meshDescription,
272 dictionary varDict(meshDescription.subOrEmptyDict(
"namedVertices"));
273 varDict.merge(meshDescription.subOrEmptyDict(
"namedBlocks"));
277 const PtrList<entry> patchesInfo
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."
301 patchDicts.set(patchi,
new dictionary(patchInfo.dict()));
304 tmpBlocksPatches[patchi] = blockMeshTools::read<face>
317 tmpBlocksPatches[patchi]
325 const blockMesh& blocks = *
this;
331 shapes[blocki] = blocks[blocki].blockShape();
341 Foam::blockMesh::createTopology
343 const IOdictionary& meshDescription,
347 word defaultPatchName =
"defaultFaces";
348 word defaultPatchType = emptyPolyPatch::typeName;
353 if (
const dictionary* dictptr = meshDescription.findDict(
"defaultPatch"))
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"),
374 blockEdge::iNew(meshDescription, geometry_, vertices_)
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"),
400 blockFace::iNew(meshDescription, geometry_)
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(),
502 <<
"' with '" <<
dict.
get<word>(
"type")
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);