41 const cellShapeList& c
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]
132void 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];
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];
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];
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();
638 label nDefaultFaces =
nFaces - defaultPatchStart;
644 if (nDefaultFaces > 0)
647 <<
"Found " << nDefaultFaces
648 <<
" undefined faces in mesh; adding to default patch "
649 << defaultBoundaryPatchName <<
endl;
653 label patchi = boundaryPatchNames.
find(defaultBoundaryPatchName);
657 if (patchi != boundaryFaces.
size()-1 || boundary_[patchi].
size())
660 <<
"Default patch " << boundary_[patchi].
name()
661 <<
" already has faces in it or is not"
666 <<
"Reusing existing patch " << patchi
667 <<
" for undefined faces." <<
endl;
674 boundaryPatchTypes[patchi],
675 boundaryPatchNames[patchi],
676 nFaces - defaultPatchStart,
690 defaultBoundaryPatchType,
691 defaultBoundaryPatchName,
692 nFaces - defaultPatchStart,
694 boundary_.
size() - 1,
704 boundary_.
setSize(nAllPatches);
715 boundary_.calcGeometry();
736 const word& defaultBoundaryPatchName,
737 const word& defaultBoundaryPatchType,
795 clearedPrimitives_(false),
808 boundaryFaces.size() + 1
810 bounds_(points_, syncPar),
814 tetBasePtIsPtr_(nullptr),
815 cellTreePtr_(nullptr),
858 globalMeshDataPtr_(nullptr),
860 topoChanging_(false),
861 storeOldCellCentres_(false),
863 oldPointsPtr_(nullptr),
864 oldCellCentresPtr_(nullptr)
867 <<
"Constructing polyMesh from cell and boundary shapes." <<
endl;
872 label defaultPatchStart;
893 patchDict.
set(
"nFaces", patchSizes[patchi]);
894 patchDict.
set(
"startFace", patchStarts[patchi]);
902 boundaryPatchNames[patchi],
910 label nAllPatches = boundaryFaces.
size();
912 label nDefaultFaces =
nFaces - defaultPatchStart;
918 if (nDefaultFaces > 0)
921 <<
"Found " << nDefaultFaces
922 <<
" undefined faces in mesh; adding to default patch "
923 << defaultBoundaryPatchName <<
endl;
927 label patchi = boundaryPatchNames.
find(defaultBoundaryPatchName);
931 if (patchi != boundaryFaces.
size()-1 || boundary_[patchi].
size())
934 <<
"Default patch " << boundary_[patchi].
name()
935 <<
" already has faces in it or is not"
940 <<
"Reusing existing patch " << patchi
941 <<
" for undefined faces." <<
endl;
948 boundary_[patchi].
type(),
949 boundary_[patchi].
name(),
950 nFaces - defaultPatchStart,
964 defaultBoundaryPatchType,
965 defaultBoundaryPatchName,
966 nFaces - defaultPatchStart,
968 boundary_.
size() - 1,
978 boundary_.
setSize(nAllPatches);
989 boundary_.calcGeometry();
label size() const noexcept
The number of elements in table.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
const word & name() const noexcept
Return the object name.
void setSize(const label n)
Alias for resize()
void append(const T &val)
Append an element at the end of the list.
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
const T * set(const label i) const
void setSize(const label newLen)
Same as resize()
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
label find(const T &val, label pos=0) const
Find index of the first occurrence of the value.
void size(const label n)
Older name for setAddressableSize.
Inter-processor communications stream.
label size() const noexcept
The number of elements in the list.
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.
static bool sameVertices(const face &a, const face &b)
Return true if the faces have the same vertices.
Registry of regIOobjects.
void updateMesh()
Correct polyBoundaryMesh after topology update.
Mesh consisting of general polyhedral cells.
virtual const pointField & points() const
Return raw points.
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.
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.
const labelList nFaces(UPstream::listGatherValues< label >(aMesh.nFaces()))
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, false)
#define DebugInfo
Report an information message using Foam::Info.
#define WarningInFunction
Report a warning using Foam::Warning.
const dimensionedScalar c
Speed of light in a vacuum.
List< cellShape > cellShapeList
List of cellShapes and PtrList of List of cellShape.
List< word > wordList
A List of words.
List< label > labelList
A List of labels.
List< cell > cellList
A List of cells.
messageStream Info
Information stream (stdout output on master, null elsewhere)
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< labelList > labelListList
A List of labelList.
void reduce(const List< UPstream::commsStruct > &comms, T &value, const BinaryOp &bop, const int tag, const label comm)
errorManip< error > abort(error &err)
static constexpr const zero Zero
Global zero (0)
List< face > faceList
A List of faces.
List< faceList > faceListList
A List of faceList.
errorManipArg< error, int > exit(error &err, const int errNo=1)
#define forAll(list, i)
Loop across all elements in list.