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];
89 const labelList& facePointCells = pointCells[facePoints[pointi]];
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 115 <<
" vertices " << UIndirectList<point>(
points(), curFace)
116 <<
" does not have neighbour cell" 117 <<
" face: " << patchFaces[fI]
126 void 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];
435 faces_.setSize(nFaces);
439 Foam::polyMesh::polyMesh
447 const word& defaultBoundaryPatchName,
448 const word& defaultBoundaryPatchType,
449 const wordList& boundaryPatchPhysicalTypes,
508 clearedPrimitives_(
false),
521 boundaryFaces.size() + 1
523 bounds_(points_, syncPar),
527 tetBasePtIsPtr_(
nullptr),
528 cellTreePtr_(
nullptr),
571 globalMeshDataPtr_(
nullptr),
573 topoChanging_(
false),
574 storeOldCellCentres_(
false),
576 oldPointsPtr_(
nullptr),
577 oldCellCentresPtr_(
nullptr)
580 <<
"Constructing polyMesh from cell and boundary shapes." <<
endl;
585 label defaultPatchStart;
602 forAll(boundaryFaces, patchi)
610 boundaryPatchTypes[patchi],
611 boundaryPatchNames[patchi],
621 boundaryPatchPhysicalTypes.
size()
622 && boundaryPatchPhysicalTypes[patchi].
size()
625 boundary_[patchi].physicalType() =
626 boundaryPatchPhysicalTypes[patchi];
630 label nAllPatches = boundaryFaces.
size();
632 label nDefaultFaces = nFaces - defaultPatchStart;
635 reduce(nDefaultFaces, sumOp<label>());
638 if (nDefaultFaces > 0)
641 <<
"Found " << nDefaultFaces
642 <<
" undefined faces in mesh; adding to default patch " 643 << defaultBoundaryPatchName <<
endl;
647 label patchi = boundaryPatchNames.find(defaultBoundaryPatchName);
651 if (patchi != boundaryFaces.size()-1 || boundary_[patchi].size())
654 <<
"Default patch " << boundary_[patchi].name()
655 <<
" already has faces in it or is not" 660 <<
"Reusing existing patch " << patchi
661 <<
" for undefined faces." <<
endl;
668 boundaryPatchTypes[patchi],
669 boundaryPatchNames[patchi],
670 nFaces - defaultPatchStart,
684 defaultBoundaryPatchType,
685 defaultBoundaryPatchName,
686 nFaces - defaultPatchStart,
688 boundary_.size() - 1,
698 boundary_.setSize(nAllPatches);
706 boundary_.updateMesh();
709 boundary_.calcGeometry();
722 Foam::polyMesh::polyMesh
730 const word& defaultBoundaryPatchName,
731 const word& defaultBoundaryPatchType,
737 data_(static_cast<const objectRegistry&>(*this)),
790 clearedPrimitives_(
false),
803 boundaryFaces.size() + 1
805 bounds_(points_, syncPar),
809 tetBasePtIsPtr_(
nullptr),
810 cellTreePtr_(
nullptr),
853 globalMeshDataPtr_(
nullptr),
855 topoChanging_(
false),
856 storeOldCellCentres_(
false),
858 oldPointsPtr_(
nullptr),
859 oldCellCentresPtr_(
nullptr)
862 <<
"Constructing polyMesh from cell and boundary shapes." <<
endl;
867 label defaultPatchStart;
888 patchDict.set(
"nFaces", patchSizes[patchi]);
889 patchDict.set(
"startFace", patchStarts[patchi]);
897 boundaryPatchNames[patchi],
905 label nAllPatches = boundaryFaces.size();
907 label nDefaultFaces = nFaces - defaultPatchStart;
910 reduce(nDefaultFaces, sumOp<label>());
913 if (nDefaultFaces > 0)
916 <<
"Found " << nDefaultFaces
917 <<
" undefined faces in mesh; adding to default patch " 918 << defaultBoundaryPatchName <<
endl;
922 label patchi = boundaryPatchNames.find(defaultBoundaryPatchName);
926 if (patchi != boundaryFaces.size()-1 || boundary_[patchi].size())
929 <<
"Default patch " << boundary_[patchi].name()
930 <<
" already has faces in it or is not" 935 <<
"Reusing existing patch " << patchi
936 <<
" for undefined faces." <<
endl;
943 boundary_[patchi].
type(),
944 boundary_[patchi].
name(),
945 nFaces - defaultPatchStart,
959 defaultBoundaryPatchType,
960 defaultBoundaryPatchName,
961 nFaces - defaultPatchStart,
963 boundary_.size() - 1,
973 boundary_.setSize(nAllPatches);
981 boundary_.updateMesh();
984 boundary_.calcGeometry();
List< faceList > faceListList
List of faceList.
void size(const label n)
Older name for setAddressableSize.
List< cell > cellList
List of cell.
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.
Cell-face mesh analysis engine.
Ostream & endl(Ostream &os)
Add newline and flush stream.
List< cellShape > cellShapeList
List of cellShape.
Ignore writing from objectRegistry::writeObject()
static label worldComm
Communicator for all ranks. May differ from commGlobal() if local worlds are in use.
List< labelList > labelListList
List of labelList.
virtual const pointField & points() const
Return raw points.
#define forAll(list, i)
Loop across all elements in list.
List< face > faceList
List of faces.
label size() const noexcept
The number of elements in table.
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.
void setSize(const label n)
Alias for resize()
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
A class for handling words, derived from Foam::string.
errorManip< error > abort(error &err)
#define DebugInfo
Report an information message using Foam::Info.
int debug
Static debugging option.
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
List of word.
#define WarningInFunction
Report a warning using Foam::Warning.
Automatically write from objectRegistry::writeObject()
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)
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
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.
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, IOobject::NO_REGISTER)
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...
static constexpr const zero Zero
Global zero (0)