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;
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_);
139 for (
const hexCell& blockCell : blocks[blocki].
cells())
141 forAll(cellPoints, cellPointi)
143 cellPoints[cellPointi] =
146 blockCell[cellPointi]
147 + blockOffsets_[blocki]
152 cells_[celli].reset(
hex, cellPoints,
true);
161 const polyPatch& patchTopologyFaces
166 labelList blockLabels = patchTopologyFaces.polyPatch::faceCells();
170 forAll(patchTopologyFaces, patchTopologyFaceLabel)
172 const label blocki = blockLabels[patchTopologyFaceLabel];
174 faceList blockFaces = blocks[blocki].blockShape().faces();
176 forAll(blockFaces, blockFaceLabel)
180 blockFaces[blockFaceLabel]
181 == patchTopologyFaces[patchTopologyFaceLabel]
185 blocks[blocki].boundaryPatches()[blockFaceLabel].
size();
195 forAll(patchTopologyFaces, patchTopologyFaceLabel)
197 const label blocki = blockLabels[patchTopologyFaceLabel];
199 faceList blockFaces = blocks[blocki].blockShape().faces();
201 forAll(blockFaces, blockFaceLabel)
205 blockFaces[blockFaceLabel]
206 == patchTopologyFaces[patchTopologyFaceLabel]
209 const List<FixedList<label, 4>>& blockPatchFaces =
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())
320 inplacePointTransforms(newPoints);
325 std::move(newPoints),
340 newPatches.
set(patchi, pbmOld[patchi].clone(pbmNew));
361 Info<<
nl <<
"Creating polyMesh from blockMesh" <<
endl;
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(),
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.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
bool registerObject() const noexcept
Should object created with this IOobject be registered?
SubList< label > subList
Declare type of subList.
void append(const T &val)
Append an element at the end of the list.
void resize(const label len)
Adjust allocated size of list.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
const T * set(const label i) const
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
void size(const label n)
Older name for setAddressableSize.
label size() const noexcept
The number of elements in the list.
void clear()
Clear the zones.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
A multi-block mesh generator.
const faceListList & patches() const
Return the patch face lists.
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
PtrList< dictionary > patchDicts() const
Patch information from the topology mesh.
const polyMesh & topology() const
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...
reference ref() const
A reference to the entry (Error if not found)
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO.
Mesh consisting of general polyhedral cells.
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 polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
const cellZoneMesh & cellZones() const noexcept
Return cell zone mesh.
virtual const labelList & faceNeighbour() const
Return face neighbour.
void addZones(const List< pointZone * > &pz, const List< faceZone * > &fz, const List< cellZone * > &cz)
Add mesh zones.
const pointZoneMesh & pointZones() const noexcept
Return point zone mesh.
virtual const pointField & points() const
Return raw points.
A class for managing references or pointers (no reference counting)
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
A class for handling words, derived from Foam::string.
Foam::autoPtr< Foam::dynamicFvMesh > meshPtr
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const labelList nFaces(UPstream::listGatherValues< label >(aMesh.nFaces()))
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, false)
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)
vectorField pointField
pointField is a vectorField.
PtrList< block > blockList
A PtrList of blocks.
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.
List< face > faceList
A List of faces.
errorManipArg< error, int > exit(error &err, const int errNo=1)
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.
static const char *const typeName
The type name used in ensight case files.