35void Foam::blockMesh::createPoints()
const
41 prescaling_.x() * scaling_.x(),
42 prescaling_.y() * scaling_.y(),
43 prescaling_.z() * scaling_.z()
48 Info<<
"Creating points with scale " << scaleTot <<
endl;
51 points_.resize(nPoints_);
55 const pointField& blockPoints = blocks[blocki].points();
64 UIndirectList<point>(points_, pointAddr) = blockPoints;
68 Info<<
" Block " << blocki <<
" cell size :" <<
nl;
70 const label v0 = blocks[blocki].pointLabel(0, 0, 0);
73 const label nx = blocks[blocki].density().x();
74 const label v1 = blocks[blocki].pointLabel(1, 0, 0);
75 const label vn = blocks[blocki].pointLabel(nx, 0, 0);
76 const label vn1 = blocks[blocki].pointLabel(nx-1, 0, 0);
78 const scalar cwBeg =
mag(blockPoints[v1] - blockPoints[v0]);
79 const scalar cwEnd =
mag(blockPoints[vn] - blockPoints[vn1]);
82 << cwBeg*scaleTot.x() <<
" .. "
83 << cwEnd*scaleTot.x() <<
nl;
87 const label ny = blocks[blocki].density().y();
88 const label v1 = blocks[blocki].pointLabel(0, 1, 0);
89 const label vn = blocks[blocki].pointLabel(0, ny, 0);
90 const label vn1 = blocks[blocki].pointLabel(0, ny-1, 0);
92 const scalar cwBeg =
mag(blockPoints[v1] - blockPoints[v0]);
93 const scalar cwEnd =
mag(blockPoints[vn] - blockPoints[vn1]);
96 << cwBeg*scaleTot.y() <<
" .. "
97 << cwEnd*scaleTot.y() <<
nl;
101 const label nz = blocks[blocki].density().z();
102 const label v1 = blocks[blocki].pointLabel(0, 0, 1);
103 const label vn = blocks[blocki].pointLabel(0, 0, nz);
104 const label vn1 = blocks[blocki].pointLabel(0, 0, nz-1);
106 const scalar cwBeg =
mag(blockPoints[v1] - blockPoints[v0]);
107 const scalar cwEnd =
mag(blockPoints[vn] - blockPoints[vn1]);
110 << cwBeg*scaleTot.z() <<
" .. "
111 << cwEnd*scaleTot.z() <<
nl;
121void Foam::blockMesh::createCells()
const
131 cells_.resize(nCells_);
141 forAll(cellPoints, cellPointi)
143 cellPoints[cellPointi] =
146 blockCell[cellPointi]
147 + blockOffsets_[blocki]
152 cells_[celli].reset(
hex, cellPoints,
true);
166 const labelUList& blockLabels = patchTopologyFaces.polyPatch::faceCells();
170 forAll(patchTopologyFaces, patchTopologyFaceLabel)
172 const label blocki = blockLabels[patchTopologyFaceLabel];
181 == patchTopologyFaces[patchTopologyFaceLabel]
185 blocks[blocki].boundaryPatches()[blockFaceLabel].size();
195 forAll(patchTopologyFaces, patchTopologyFaceLabel)
197 const label blocki = blockLabels[patchTopologyFaceLabel];
206 == patchTopologyFaces[patchTopologyFaceLabel]
210 blocks[blocki].boundaryPatches()[blockFaceLabel];
212 forAll(blockPatchFaces, blockFaceLabel)
220 blockPatchFaces[blockFaceLabel][0]
221 + blockOffsets_[blocki]
228 label facePointLabel = 1;
236 blockPatchFaces[blockFaceLabel][facePointLabel]
237 + blockOffsets_[blocki]
240 if (quad[nUnique] != quad[nUnique-1])
246 if (quad[nUnique-1] == quad[0])
253 patchFaces[faceLabel++] = quad;
255 else if (nUnique == 3)
257 patchFaces[faceLabel++] =
face
268 patchFaces.resize(faceLabel);
274void Foam::blockMesh::createPatches()
const
276 const polyPatchList& topoPatches = topology().boundaryMesh();
283 patches_.resize(topoPatches.size());
285 forAll(topoPatches, patchi)
287 patches_[patchi] = createPatchFaces(topoPatches[patchi]);
299 <<
"topology not allocated"
303 return *topologyPtr_;
310 const polyMesh& origTopo = topology();
312 if (applyTransform && hasPointTransforms())
317 newIO.registerObject(
false);
320 inplacePointTransforms(newPoints);
325 std::move(newPoints),
333 const polyBoundaryMesh& pbmOld = origTopo.boundaryMesh();
334 const polyBoundaryMesh& pbmNew =
topoMesh.boundaryMesh();
340 newPatches.set(patchi, pbmOld[patchi].clone(pbmNew));
357 const blockMesh& blkMesh = *
this;
361 Info<<
nl <<
"Creating polyMesh from blockMesh" <<
endl;
370 blkMesh.patchNames(),
371 blkMesh.patchDicts(),
373 emptyPolyPatch::typeName
378 const label nZones = blkMesh.numZonedBlocks();
401 for (
const block&
b : blkMesh)
403 const word& zoneName =
b.zoneName();
404 const label nCellsInBlock =
b.cells().
size();
408 const auto iter = zoneMap.cfind(zoneName);
410 label zonei = freeZonei;
418 zoneMap.insert(zoneName, zonei);
423 Info<<
" " << zonei <<
'\t' << zoneName <<
endl;
430 zoneCells[zonei].reserve
432 zoneCells[zonei].size() + nCellsInBlock
435 const label endOfFill = celli + nCellsInBlock;
437 for (; celli < endOfFill; ++celli)
439 zoneCells[zonei].append(celli);
444 celli += nCellsInBlock;
451 const word& zoneName = iter.key();
452 const label zonei = iter.val();
457 zoneCells[zonei].shrink(),
463 pmesh.pointZones().clear();
464 pmesh.faceZones().clear();
465 pmesh.cellZones().clear();
const polyMesh & topoMesh
A HashTable similar to std::unordered_map.
const_iterator cfind(const Key &key) const
Find and return an const_iterator set at the hashed entry.
bool insert(const Key &key, const T &obj)
Copy insert a new entry, not overwriting existing entries.
label size() const noexcept
The number of elements in table.
bool registerObject() const noexcept
Should objects created with this IOobject be registered?
@ 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,...
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
void append(const T &val)
Append an element at the end of the list.
const T * set(const label i) const
Return const pointer to element (can be nullptr), or nullptr for out-of-range access (ie,...
PtrList< block > clone(Args &&... args) const
void size(const label n)
Older name for setAddressableSize.
label size() const noexcept
The number of entries in the list.
void clear()
Clear the zones.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
static autoPtr< T > New(Args &&... args)
Construct autoPtr with forwarding arguments.
const faceListList & patches() const
Return the patch face lists.
bool hasPointTransforms() const noexcept
True if scaling and/or transformations are needed.
wordList patchNames() const
Return the patch names.
label numZonedBlocks() const
Number of blocks with specified zones.
bool inplacePointTransforms(pointField &pts) const
Apply coordinate transforms and scaling.
const cellShapeList & cells() const
Return cell shapes list.
const pointField & points() const
The points for the entire mesh. These points are scaled and transformed.
autoPtr< polyMesh > mesh(const IOobject &io) const
Create polyMesh, with cell zones.
PtrList< dictionary > patchDicts() const
Patch information from the topology mesh.
const polyMesh & topology() const
The blockMesh topology as a polyMesh unscaled and non-transformed.
PtrList< block > blockList
The list of blocks is stored as a PtrList.
Creates a single block of cells from point coordinates, numbers of cells in each direction and an exp...
Maps a geometry to a set of cell primitives.
static const cellModel & ref(const modelType model)
Look up reference to cellModel by enumeration. Fatal on failure.
A face is a list of labels corresponding to mesh vertices.
A hexahedral cell primitive.
A polyBoundaryMesh is a polyPatch list with registered IO, a reference to the associated polyMesh,...
Mesh consisting of general polyhedral cells.
const polyBoundaryMesh & boundaryMesh() const noexcept
Return boundary mesh.
const faceZoneMesh & faceZones() const noexcept
Return face zone mesh.
void addPatches(polyPatchList &plist, const bool validBoundary=true)
Add boundary patches.
virtual const faceList & faces() const
Return raw faces.
virtual const labelList & faceOwner() const
Return face owner.
const cellZoneMesh & cellZones() const noexcept
Return cell zone mesh.
void addZones(PtrList< pointZone > &&pz, PtrList< faceZone > &&fz, PtrList< cellZone > &&cz)
Add mesh zones.
virtual const labelList & faceNeighbour() const
Return face neighbour.
const pointZoneMesh & pointZones() const noexcept
Return point zone mesh.
virtual const pointField & points() const
Return raw points.
A patch is a list of labels that address the faces in the global face list.
A class for managing references or pointers (no reference counting).
static refPtr< T > New(Args &&... args)
Construct refPtr with forwarding arguments.
A class for handling words, derived from Foam::string.
Foam::autoPtr< Foam::dynamicFvMesh > meshPtr
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
PtrList< polyPatch > polyPatchList
Store lists of polyPatch as a PtrList.
List< label > labelList
A List of labels.
messageStream Info
Information stream (stdout output on master, null elsewhere).
List< face > faceList
List of faces.
IOstream & hex(IOstream &io)
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
SubList< label > labelSubList
A SubList of labels.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
vectorField pointField
pointField is a vectorField.
errorManipArg< error, int > exit(error &err, const int errNo=1)
UList< label > labelUList
A UList of labels.
PtrList< block > blockList
A PtrList of blocks.
constexpr char nl
The newline '\n' character (0x0a).
#define forAll(list, i)
Loop across all elements in list.
#define forAllConstIters(container, iter)
Iterate across all elements of the container object with const access.