41 const cellShapeList& shapes
50 for (
const label pointi : shapes[celli])
53 pc[pointi].push_back(celli);
61 pointCellAddr[pointi].transfer(pc[pointi]);
84 const face& curFace = patchFaces[fI];
85 const labelList& facePoints = patchFaces[fI];
91 forAll(facePointCells, celli)
93 faceList cellFaces = cellsFaceShapes[facePointCells[celli]];
95 forAll(cellFaces, cellFace)
100 FaceCells[fI] = facePointCells[celli];
114 <<
"face " << fI <<
" in patch " <<
patchID
116 <<
" does not have neighbour cell"
117 <<
" face: " << patchFaces[fI]
126void Foam::polyMesh::setTopology
133 label& defaultPatchStart,
146 forAll(cellsFaceShapes, celli)
148 cellsFaceShapes[celli] = cellsAsShapes[celli].faces();
156 maxFaces += cellsFaceShapes[celli].size();
160 faces_.setSize(maxFaces);
166 labelListList PointCells = cellShapePointCells(cellsAsShapes);
178 const faceList& curFaces = cellsFaceShapes[celli];
184 labelList faceOfNeiCell(curFaces.size(), -1);
186 label nNeighbours = 0;
192 if (
cells[celli][facei] >= 0)
continue;
196 const face& curFace = curFaces[facei];
206 PointCells[curPoints[pointi]];
209 forAll(curNeighbours, neiI)
211 label curNei = curNeighbours[neiI];
217 const faceList& searchFaces = cellsFaceShapes[curNei];
219 forAll(searchFaces, neiFacei)
221 if (searchFaces[neiFacei] == curFace)
227 neiCells[facei] = curNei;
228 faceOfNeiCell[facei] = neiFacei;
243 for (label neiSearch = 0; neiSearch < nNeighbours; neiSearch++)
251 if (neiCells[ncI] > -1 && neiCells[ncI] < minNei)
254 minNei = neiCells[ncI];
261 faces_[nFaces] = curFaces[nextNei];
264 cells[celli][nextNei] = nFaces;
265 cells[neiCells[nextNei]][faceOfNeiCell[nextNei]] = nFaces;
268 neiCells[nextNei] = -1;
276 <<
"Error in internal face insertion"
283 const label nInternalFaces = nFaces;
285 patchSizes.setSize(boundaryFaces.size(), -1);
286 patchStarts.setSize(boundaryFaces.size(), -1);
288 forAll(boundaryFaces, patchi)
290 const faceList& patchFaces = boundaryFaces[patchi];
302 label curPatchStart = nFaces;
305 bool patchWarned =
false;
309 const face& curFace = patchFaces[facei];
311 const label cellInside = curPatchFaceCells[facei];
314 const faceList& facesOfCellInside = cellsFaceShapes[cellInside];
318 forAll(facesOfCellInside, cellFacei)
324 const label meshFacei =
cells[cellInside][cellFacei];
344 meshFacei < nInternalFaces
345 || meshFacei >= curPatchStart
349 <<
"Trying to specify a boundary face "
351 <<
" on the face on cell " << cellInside
352 <<
" which is either an internal face"
353 <<
" or already belongs to the same patch."
354 <<
" This is face " << facei <<
" of patch "
355 << patchi <<
" named "
356 << boundaryPatchNames[patchi] <<
"."
364 <<
"Trying to specify a boundary face "
366 <<
" on the face on cell " << cellInside
367 <<
" which is either an internal face"
368 <<
" or already belongs to some other patch."
369 <<
" This is face " << facei <<
" of patch "
370 << patchi <<
" named "
371 << boundaryPatchNames[patchi] <<
"."
377 faces_.setSize(faces_.size()+1);
380 faces_[nFaces] = facesOfCellInside[cellFacei];
387 faces_[nFaces] = facesOfCellInside[cellFacei];
389 cells[cellInside][cellFacei] = nFaces;
399 <<
"face " << facei <<
" of patch " << patchi
400 <<
" does not seem to belong to cell " << cellInside
401 <<
" which, according to the addressing, "
402 <<
"should be next to it."
410 patchSizes[patchi] = nFaces - curPatchStart;
411 patchStarts[patchi] = curPatchStart;
416 defaultPatchStart = nFaces;
422 forAll(curCellFaces, facei)
424 if (curCellFaces[facei] == -1)
426 curCellFaces[facei] = nFaces;
427 faces_[nFaces] = cellsFaceShapes[celli][facei];
439Foam::polyMesh::polyMesh
447 const word& defaultBoundaryPatchName,
448 const word& defaultBoundaryPatchType,
449 const wordList& boundaryPatchPhysicalTypes,
455 data_(static_cast<const objectRegistry&>(*this)),
508 clearedPrimitives_(false),
521 boundaryFaces.size() + 1
523 bounds_(points_, syncPar),
524 comm_(UPstream::worldComm),
570 topoChanging_(false),
571 storeOldCellCentres_(false),
575 <<
"Constructing polyMesh from cell and boundary shapes." <<
endl;
580 label defaultPatchStart;
597 forAll(boundaryFaces, patchi)
605 boundaryPatchTypes[patchi],
606 boundaryPatchNames[patchi],
616 boundaryPatchPhysicalTypes.size()
617 && boundaryPatchPhysicalTypes[patchi].size()
620 boundary_[patchi].physicalType() =
621 boundaryPatchPhysicalTypes[patchi];
625 label nAllPatches = boundaryFaces.
size();
627 label nDefaultFaces =
nFaces - defaultPatchStart;
630 reduce(nDefaultFaces, sumOp<label>());
633 if (nDefaultFaces > 0)
636 <<
"Found " << nDefaultFaces
637 <<
" undefined faces in mesh; adding to default patch "
638 << defaultBoundaryPatchName <<
endl;
642 label patchi = boundaryPatchNames.find(defaultBoundaryPatchName);
646 if (patchi != boundaryFaces.size()-1 || boundary_[patchi].size())
649 <<
"Default patch " << boundary_[patchi].name()
650 <<
" already has faces in it or is not"
655 <<
"Reusing existing patch " << patchi
656 <<
" for undefined faces." <<
endl;
663 boundaryPatchTypes[patchi],
664 boundaryPatchNames[patchi],
665 nFaces - defaultPatchStart,
679 defaultBoundaryPatchType,
680 defaultBoundaryPatchName,
681 nFaces - defaultPatchStart,
683 boundary_.size() - 1,
693 boundary_.setSize(nAllPatches);
701 boundary_.updateMesh();
704 boundary_.calcGeometry();
717Foam::polyMesh::polyMesh
725 const word& defaultBoundaryPatchName,
726 const word& defaultBoundaryPatchType,
785 clearedPrimitives_(false),
798 boundaryFaces.size() + 1
800 bounds_(points_, syncPar),
847 topoChanging_(false),
848 storeOldCellCentres_(false),
852 <<
"Constructing polyMesh from cell and boundary shapes." <<
endl;
857 label defaultPatchStart;
878 patchDict.set(
"nFaces", patchSizes[patchi]);
879 patchDict.set(
"startFace", patchStarts[patchi]);
887 boundaryPatchNames[patchi],
895 label nAllPatches = boundaryFaces.size();
897 label nDefaultFaces =
nFaces - defaultPatchStart;
900 reduce(nDefaultFaces, sumOp<label>());
903 if (nDefaultFaces > 0)
906 <<
"Found " << nDefaultFaces
907 <<
" undefined faces in mesh; adding to default patch "
908 << defaultBoundaryPatchName <<
endl;
912 label patchi = boundaryPatchNames.find(defaultBoundaryPatchName);
916 if (patchi != boundaryFaces.size()-1 || boundary_[patchi].size())
919 <<
"Default patch " << boundary_[patchi].name()
920 <<
" already has faces in it or is not"
925 <<
"Reusing existing patch " << patchi
926 <<
" for undefined faces." <<
endl;
933 boundary_[patchi].
type(),
934 boundary_[patchi].
name(),
935 nFaces - defaultPatchStart,
949 defaultBoundaryPatchType,
950 defaultBoundaryPatchName,
951 nFaces - defaultPatchStart,
953 boundary_.size() - 1,
963 boundary_.setSize(nAllPatches);
971 boundary_.updateMesh();
974 boundary_.calcGeometry();
label size() const noexcept
@ NO_READ
Nothing to be read.
@ NO_WRITE
Ignore writing from objectRegistry::writeObject().
@ AUTO_WRITE
Automatically write from objectRegistry::writeObject().
Defines the attributes of an object for which implicit objectRegistry management is supported,...
const word & name() const noexcept
Return the object name.
const fileName & instance() const noexcept
Read access to instance path component.
void append(const T &val)
Append an element at the end of the list.
void setSize(label n)
Alias for resize().
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
const T * set(const label i) const
Return const pointer to element (can be nullptr), or nullptr for out-of-range access (ie,...
A List with indirect addressing. Like IndirectList but does not store addressing.
void size(const label n)
Older name for setAddressableSize.
label find(const T &val) const
Find index of the first occurrence of the value.
Inter-processor communications stream.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
entry * set(entry *entryPtr)
Assign a new entry, overwriting any existing entry.
A face is a list of labels corresponding to mesh vertices.
static bool sameVertices(const face &a, const face &b)
True if the faces have all the same vertices.
Registry of regIOobjects.
const Time & time() const noexcept
Return time registry.
Smooth ATC in cells having a point to a set of patches supplied by type.
virtual const pointField & points() const
Return raw points.
static word meshSubDir
Return the mesh sub-directory name (usually "polyMesh").
static autoPtr< polyPatch > New(const word &patchType, const word &name, const label size, const label start, const label index, const polyBoundaryMesh &bm)
Return pointer to a new patch created on freestore from components.
Cell-face mesh analysis engine.
virtual bool checkMesh(const bool report=false) const
Check mesh for correctness. Returns false for no error.
label nFaces() const noexcept
Number of mesh faces.
const cellList & cells() const
A class for handling words, derived from Foam::string.
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
Info<< "Creating cells"<< endl;cellShapes=b.shapes();Info<< "Creating boundary faces"<< endl;boundary.setSize(b.boundaryPatches().size());forAll(boundary, patchi) { faceList faces(b.boundaryPatches()[patchi].size());forAll(faces, facei) { faces[facei]=face(b.boundaryPatches()[patchi][facei]);} boundary[patchi].transfer(faces);} points.transfer(const_cast< pointField & >(b.points()));}Info<< "Creating patch dictionaries"<< endl;wordList patchNames(boundary.size());forAll(patchNames, patchi){ patchNames[patchi]=polyPatch::defaultName(patchi);}PtrList< dictionary > boundaryDicts(boundary.size())
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
#define DebugInfo
Report an information message using Foam::Info.
#define WarningInFunction
Report a warning using Foam::Warning.
Namespace for handling debugging switches.
List< word > wordList
List of word.
List< labelList > labelListList
List of labelList.
List< label > labelList
A List of labels.
messageStream Info
Information stream (stdout output on master, null elsewhere).
List< face > faceList
List of faces.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Ostream & endl(Ostream &os)
Add newline and flush stream.
List< cell > cellList
List of cell.
List< faceList > faceListList
List of faceList.
void reduce(T &value, BinaryOp bop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Reduce inplace (cf. MPI Allreduce).
errorManip< error > abort(error &err)
static constexpr const zero Zero
Global zero (0).
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)
List< cellShape > cellShapeList
List of cellShape.
#define forAll(list, i)
Loop across all elements in list.