55 label curPoint = labels[j];
56 DynamicList<label>& curPointCells = pc[curPoint];
59 curPointCells.append(i);
67 pointCellAddr[pointi].transfer(pc[pointi]);
90 const face& curFace = patchFaces[fI];
91 const labelList& facePoints = patchFaces[fI];
95 const labelList& facePointCells = pointCells[facePoints[pointi]];
97 forAll(facePointCells, celli)
99 faceList cellFaces = cellsFaceShapes[facePointCells[celli]];
101 forAll(cellFaces, cellFace)
106 FaceCells[fI] = facePointCells[celli];
120 <<
"face " << fI <<
" in patch " <<
patchID 121 <<
" vertices " << UIndirectList<point>(
points(), curFace)
122 <<
" does not have neighbour cell" 123 <<
" face: " << patchFaces[fI]
132 void Foam::polyMesh::setTopology
139 label& defaultPatchStart,
152 forAll(cellsFaceShapes, celli)
154 cellsFaceShapes[celli] = cellsAsShapes[celli].faces();
162 maxFaces += cellsFaceShapes[celli].
size();
166 faces_.setSize(maxFaces);
172 labelListList PointCells = cellShapePointCells(cellsAsShapes);
184 const faceList& curFaces = cellsFaceShapes[celli];
190 labelList faceOfNeiCell(curFaces.size(), -1);
192 label nNeighbours = 0;
198 if (
cells[celli][facei] >= 0)
continue;
202 const face& curFace = curFaces[facei];
212 PointCells[curPoints[pointi]];
215 forAll(curNeighbours, neiI)
217 label curNei = curNeighbours[neiI];
223 const faceList& searchFaces = cellsFaceShapes[curNei];
225 forAll(searchFaces, neiFacei)
227 if (searchFaces[neiFacei] == curFace)
233 neiCells[facei] = curNei;
234 faceOfNeiCell[facei] = neiFacei;
249 for (label neiSearch = 0; neiSearch < nNeighbours; neiSearch++)
257 if (neiCells[ncI] > -1 && neiCells[ncI] < minNei)
260 minNei = neiCells[ncI];
267 faces_[nFaces] = curFaces[nextNei];
270 cells[celli][nextNei] = nFaces;
271 cells[neiCells[nextNei]][faceOfNeiCell[nextNei]] = nFaces;
274 neiCells[nextNei] = -1;
282 <<
"Error in internal face insertion" 289 const label nInternalFaces = nFaces;
291 patchSizes.setSize(boundaryFaces.size(), -1);
292 patchStarts.setSize(boundaryFaces.size(), -1);
294 forAll(boundaryFaces, patchi)
296 const faceList& patchFaces = boundaryFaces[patchi];
308 label curPatchStart = nFaces;
311 bool patchWarned =
false;
315 const face& curFace = patchFaces[facei];
317 const label cellInside = curPatchFaceCells[facei];
320 const faceList& facesOfCellInside = cellsFaceShapes[cellInside];
324 forAll(facesOfCellInside, cellFacei)
330 const label meshFacei =
cells[cellInside][cellFacei];
350 meshFacei < nInternalFaces
351 || meshFacei >= curPatchStart
355 <<
"Trying to specify a boundary face " 357 <<
" on the face on cell " << cellInside
358 <<
" which is either an internal face" 359 <<
" or already belongs to the same patch." 360 <<
" This is face " << facei <<
" of patch " 361 << patchi <<
" named " 362 << boundaryPatchNames[patchi] <<
"." 370 <<
"Trying to specify a boundary face " 372 <<
" on the face on cell " << cellInside
373 <<
" which is either an internal face" 374 <<
" or already belongs to some other patch." 375 <<
" This is face " << facei <<
" of patch " 376 << patchi <<
" named " 377 << boundaryPatchNames[patchi] <<
"." 383 faces_.setSize(faces_.size()+1);
386 faces_[nFaces] = facesOfCellInside[cellFacei];
393 faces_[nFaces] = facesOfCellInside[cellFacei];
395 cells[cellInside][cellFacei] = nFaces;
405 <<
"face " << facei <<
" of patch " << patchi
406 <<
" does not seem to belong to cell " << cellInside
407 <<
" which, according to the addressing, " 408 <<
"should be next to it." 416 patchSizes[patchi] = nFaces - curPatchStart;
417 patchStarts[patchi] = curPatchStart;
422 defaultPatchStart = nFaces;
428 forAll(curCellFaces, facei)
430 if (curCellFaces[facei] == -1)
432 curCellFaces[facei] = nFaces;
433 faces_[nFaces] = cellsFaceShapes[celli][facei];
441 faces_.setSize(nFaces);
445 Foam::polyMesh::polyMesh
453 const word& defaultBoundaryPatchName,
454 const word& defaultBoundaryPatchType,
455 const wordList& boundaryPatchPhysicalTypes,
513 clearedPrimitives_(false),
526 boundaryFaces.size() + 1
528 bounds_(points_, syncPar),
532 tetBasePtIsPtr_(nullptr),
533 cellTreePtr_(nullptr),
576 globalMeshDataPtr_(nullptr),
578 topoChanging_(false),
579 storeOldCellCentres_(false),
581 oldPointsPtr_(nullptr),
582 oldCellCentresPtr_(nullptr)
585 <<
"Constructing polyMesh from cell and boundary shapes." <<
endl;
590 label defaultPatchStart;
607 forAll(boundaryFaces, patchi)
615 boundaryPatchTypes[patchi],
616 boundaryPatchNames[patchi],
626 boundaryPatchPhysicalTypes.
size()
627 && boundaryPatchPhysicalTypes[patchi].
size()
630 boundary_[patchi].physicalType() =
631 boundaryPatchPhysicalTypes[patchi];
635 label nAllPatches = boundaryFaces.
size();
637 label nDefaultFaces =
nFaces - defaultPatchStart;
640 reduce(nDefaultFaces, sumOp<label>());
643 if (nDefaultFaces > 0)
646 <<
"Found " << nDefaultFaces
647 <<
" undefined faces in mesh; adding to default patch " 648 << defaultBoundaryPatchName <<
endl;
652 label patchi = boundaryPatchNames.
find(defaultBoundaryPatchName);
656 if (patchi != boundaryFaces.
size()-1 || boundary_[patchi].
size())
659 <<
"Default patch " << boundary_[patchi].
name()
660 <<
" already has faces in it or is not" 665 <<
"Reusing existing patch " << patchi
666 <<
" for undefined faces." <<
endl;
673 boundaryPatchTypes[patchi],
674 boundaryPatchNames[patchi],
675 nFaces - defaultPatchStart,
689 defaultBoundaryPatchType,
690 defaultBoundaryPatchName,
691 nFaces - defaultPatchStart,
693 boundary_.
size() - 1,
703 boundary_.
setSize(nAllPatches);
714 boundary_.calcGeometry();
727 Foam::polyMesh::polyMesh
735 const word& defaultBoundaryPatchName,
736 const word& defaultBoundaryPatchType,
794 clearedPrimitives_(false),
807 boundaryFaces.size() + 1
809 bounds_(points_, syncPar),
810 comm_(UPstream::worldComm),
813 tetBasePtIsPtr_(nullptr),
814 cellTreePtr_(nullptr),
857 globalMeshDataPtr_(nullptr),
859 topoChanging_(false),
860 storeOldCellCentres_(false),
862 oldPointsPtr_(nullptr),
863 oldCellCentresPtr_(nullptr)
866 <<
"Constructing polyMesh from cell and boundary shapes." <<
endl;
871 label defaultPatchStart;
892 patchDict.set(
"nFaces", patchSizes[patchi]);
893 patchDict.set(
"startFace", patchStarts[patchi]);
901 boundaryPatchNames[patchi],
909 label nAllPatches = boundaryFaces.size();
911 label nDefaultFaces =
nFaces - defaultPatchStart;
914 reduce(nDefaultFaces, sumOp<label>());
917 if (nDefaultFaces > 0)
920 <<
"Found " << nDefaultFaces
921 <<
" undefined faces in mesh; adding to default patch " 922 << defaultBoundaryPatchName <<
endl;
926 label patchi = boundaryPatchNames.find(defaultBoundaryPatchName);
930 if (patchi != boundaryFaces.size()-1 || boundary_[patchi].
size())
933 <<
"Default patch " << boundary_[patchi].
name()
934 <<
" already has faces in it or is not" 939 <<
"Reusing existing patch " << patchi
940 <<
" for undefined faces." <<
endl;
947 boundary_[patchi].
type(),
948 boundary_[patchi].
name(),
949 nFaces - defaultPatchStart,
963 defaultBoundaryPatchType,
964 defaultBoundaryPatchName,
965 nFaces - defaultPatchStart,
967 boundary_.
size() - 1,
977 boundary_.
setSize(nAllPatches);
988 boundary_.calcGeometry();
List< labelList > labelListList
A List of labelList.
void size(const label n)
Older name for setAddressableSize.
errorManipArg< error, int > exit(error &err, const int errNo=1)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
void append(const T &val)
Append an element at the end of the list.
label find(const T &val, label pos=0) const
Find index of the first occurrence of the value.
const word & name() const noexcept
Return the object name.
Cell-face mesh analysis engine.
List< face > faceList
A List of faces.
Ostream & endl(Ostream &os)
Add newline and flush stream.
label size() const noexcept
The number of elements in table.
const cellList & cells() const
label nFaces() const noexcept
Number of mesh faces.
List< faceList > faceListList
A List of faceList.
virtual const pointField & points() const
Return raw points.
#define forAll(list, i)
Loop across all elements in list.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
vectorField pointField
pointField is a vectorField.
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, false)
void setSize(const label n)
Alias for resize()
List< cellShape > cellShapeList
List of cellShapes and PtrList of List of cellShape.
A class for handling words, derived from Foam::string.
label size() const noexcept
The number of elements in the list.
virtual bool checkMesh(const bool report=false) const
Check mesh for correctness. Returns false for no error.
errorManip< error > abort(error &err)
const T * set(const label i) const
Return const pointer to element (can be nullptr), or nullptr for out-of-range access (ie...
#define DebugInfo
Report an information message using Foam::Info.
int debug
Static debugging option.
void updateMesh()
Correct polyBoundaryMesh after topology update.
void setSize(const label newLen)
Same as resize()
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())
List< word > wordList
A List of words.
#define WarningInFunction
Report a warning using Foam::Warning.
const dimensionedScalar c
Speed of light in a vacuum.
void reduce(const List< UPstream::commsStruct > &comms, T &value, const BinaryOp &bop, const int tag, const label comm)
Reduce inplace (cf. MPI Allreduce) using specified communication schedule.
messageStream Info
Information stream (stdout output on master, null elsewhere)
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.
List< label > labelList
A List of labels.
Registry of regIOobjects.
static bool sameVertices(const face &a, const face &b)
True if the faces have all the same vertices.
Defines the attributes of an object for which implicit objectRegistry management is supported...
List< cell > cellList
A List of cells.
Inter-processor communications stream.
static constexpr const zero Zero
Global zero (0)