41 List<DynamicList<label, primitiveMesh::cellsPerPoint_>>
53 label curPoint = labels[j];
54 DynamicList<label, primitiveMesh::cellsPerPoint_>& curPointCells =
58 curPointCells.append(i);
66 pointCellAddr[pointi].transfer(pc[pointi]);
89 const face& curFace = patchFaces[fI];
90 const labelList& facePoints = patchFaces[fI];
94 const labelList& facePointCells = pointCells[facePoints[pointi]];
96 forAll(facePointCells, celli)
98 faceList cellFaces = cellsFaceShapes[facePointCells[celli]];
100 forAll(cellFaces, cellFace)
105 FaceCells[fI] = facePointCells[celli];
119 <<
"face " << fI <<
" in patch " << patchID
120 <<
" does not have neighbour cell" 121 <<
" face: " << patchFaces[fI]
130 void Foam::polyMesh::setTopology
137 label& defaultPatchStart,
148 cells.
setSize(cellsAsShapes.size());
150 forAll(cellsFaceShapes, celli)
152 cellsFaceShapes[celli] = cellsAsShapes[celli].faces();
154 cells[celli].setSize(cellsFaceShapes[celli].
size());
157 static_cast<labelList&
>(cells[celli]) = -1;
160 maxFaces += cellsFaceShapes[celli].
size();
170 labelListList PointCells = cellShapePointCells(cellsAsShapes);
182 const faceList& curFaces = cellsFaceShapes[celli];
188 labelList faceOfNeiCell(curFaces.size(), -1);
190 label nNeighbours = 0;
196 if (cells[celli][facei] >= 0)
continue;
200 const face& curFace = curFaces[facei];
210 PointCells[curPoints[pointi]];
213 forAll(curNeighbours, neiI)
215 label curNei = curNeighbours[neiI];
221 const faceList& searchFaces = cellsFaceShapes[curNei];
223 forAll(searchFaces, neiFacei)
225 if (searchFaces[neiFacei] == curFace)
231 neiCells[facei] = curNei;
232 faceOfNeiCell[facei] = neiFacei;
247 for (
label neiSearch = 0; neiSearch < nNeighbours; neiSearch++)
251 label minNei = cells.size();
255 if (neiCells[ncI] > -1 && neiCells[ncI] < minNei)
258 minNei = neiCells[ncI];
265 faces_[
nFaces] = curFaces[nextNei];
268 cells[celli][nextNei] =
nFaces;
269 cells[neiCells[nextNei]][faceOfNeiCell[nextNei]] =
nFaces;
272 neiCells[nextNei] = -1;
280 <<
"Error in internal face insertion" 288 patchSizes.setSize(boundaryFaces.size(), -1);
289 patchStarts.setSize(boundaryFaces.size(), -1);
309 const face& curFace = patchFaces[facei];
311 const label cellInside = curPatchFaceCells[facei];
314 const faceList& facesOfCellInside = cellsFaceShapes[cellInside];
318 forAll(facesOfCellInside, cellFacei)
322 if (cells[cellInside][cellFacei] >= 0)
325 <<
"Trying to specify a boundary face " << curFace
326 <<
" on the face on cell " << cellInside
327 <<
" which is either an internal face or already " 328 <<
"belongs to some other patch. This is face " 329 << facei <<
" of patch " 331 << boundaryPatchNames[
patchi] <<
"." 338 faces_[
nFaces] = facesOfCellInside[cellFacei];
340 cells[cellInside][cellFacei] =
nFaces;
349 <<
"face " << facei <<
" of patch " <<
patchi 350 <<
" does not seem to belong to cell " << cellInside
351 <<
" which, according to the addressing, " 352 <<
"should be next to it." 360 patchSizes[
patchi] = nFaces - curPatchStart;
361 patchStarts[
patchi] = curPatchStart;
366 defaultPatchStart =
nFaces;
372 forAll(curCellFaces, facei)
374 if (curCellFaces[facei] == -1)
376 curCellFaces[facei] =
nFaces;
377 faces_[
nFaces] = cellsFaceShapes[celli][facei];
397 const word& defaultBoundaryPatchName,
398 const word& defaultBoundaryPatchType,
399 const wordList& boundaryPatchPhysicalTypes,
457 clearedPrimitives_(
false),
470 boundaryFaces.
size() + 1
472 bounds_(points_, syncPar),
476 tetBasePtIsPtr_(
nullptr),
477 cellTreePtr_(
nullptr),
520 globalMeshDataPtr_(
nullptr),
522 topoChanging_(
false),
523 curMotionTimeIndex_(-1),
524 oldPointsPtr_(
nullptr),
525 oldCellCentresPtr_(
nullptr),
526 storeOldCellCentres_(
false)
530 Info<<
"Constructing polyMesh from cell and boundary shapes." <<
endl;
539 label defaultPatchStart;
564 boundaryPatchTypes[
patchi],
565 boundaryPatchNames[patchi],
575 boundaryPatchPhysicalTypes.
size()
579 boundary_[
patchi].physicalType() =
580 boundaryPatchPhysicalTypes[
patchi];
584 label nAllPatches = boundaryFaces.
size();
587 label nDefaultFaces = nFaces - defaultPatchStart;
593 if (nDefaultFaces > 0)
596 <<
"Found " << nDefaultFaces
597 <<
" undefined faces in mesh; adding to default patch." <<
endl;
608 <<
"Default patch " << boundary_[
patchi].
name()
609 <<
" already has faces in it or is not" 614 <<
"Reusing existing patch " << patchi
615 <<
" for undefined faces." <<
endl;
622 boundaryPatchTypes[patchi],
623 boundaryPatchNames[patchi],
624 nFaces - defaultPatchStart,
638 defaultBoundaryPatchType,
639 defaultBoundaryPatchName,
640 nFaces - defaultPatchStart,
642 boundary_.
size() - 1,
652 boundary_.
setSize(nAllPatches);
663 boundary_.calcGeometry();
684 const word& defaultBoundaryPatchName,
685 const word& defaultBoundaryPatchType,
743 clearedPrimitives_(
false),
756 boundaryFaces.
size() + 1
758 bounds_(points_, syncPar),
762 tetBasePtIsPtr_(
nullptr),
763 cellTreePtr_(
nullptr),
806 globalMeshDataPtr_(
nullptr),
808 topoChanging_(
false),
809 curMotionTimeIndex_(-1),
810 oldPointsPtr_(
nullptr),
811 oldCellCentresPtr_(
nullptr),
812 storeOldCellCentres_(
false)
816 Info<<
"Constructing polyMesh from cell and boundary shapes." <<
endl;
825 label defaultPatchStart;
846 patchDict.
set(
"nFaces", patchSizes[patchi]);
847 patchDict.
set(
"startFace", patchStarts[patchi]);
855 boundaryPatchNames[patchi],
863 label nAllPatches = boundaryFaces.
size();
865 label nDefaultFaces = nFaces - defaultPatchStart;
871 if (nDefaultFaces > 0)
874 <<
"Found " << nDefaultFaces
875 <<
" undefined faces in mesh; adding to default patch." <<
endl;
886 <<
"Default patch " << boundary_[
patchi].
name()
887 <<
" already has faces in it or is not" 892 <<
"Reusing existing patch " << patchi
893 <<
" for undefined faces." <<
endl;
900 boundary_[patchi].
type(),
901 boundary_[patchi].
name(),
902 nFaces - defaultPatchStart,
916 defaultBoundaryPatchType,
917 defaultBoundaryPatchName,
918 nFaces - defaultPatchStart,
920 boundary_.
size() - 1,
930 boundary_.
setSize(nAllPatches);
941 boundary_.calcGeometry();
List< labelList > labelListList
A List of labelList.
List< faceList > faceListList
#define forAll(list, i)
Loop across all elements in list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
const word & name() const
Return name.
bool set(const label) const
Is element set.
errorManipArg< error, int > exit(error &err, const int errNo=1)
A list of keyword definitions, which are a keyword followed by any number of values (e...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
static word meshSubDir
Return the mesh sub-directory name (usually "polyMesh")
void size(const label)
Override size to be inconsistent with allocated storage.
Ostream & endl(Ostream &os)
Add newline and flush stream.
primitiveMesh()
Construct null.
const cellList & cells() const
static label worldComm
Default communicator (all processors)
label size() const
Return number of elements in table.
virtual const pointField & points() const
Return raw points.
objectRegistry(const Time &db, const label nIoObjects=128)
Construct the time objectRegistry given an initial estimate.
List< cellShape > cellShapeList
List of cellShapes and PtrList of List of cellShape.
void removeFiles() const
Remove all files from mesh instance()
bool found(const word &) const
Return true if hashedEntry is found in table.
A class for handling words, derived from string.
virtual bool checkMesh(const bool report=false) const
Check mesh for correctness. Returns false for no error.
List< label > labelList
A List of labels.
errorManip< error > abort(error &err)
void setSize(const label)
Reset size of PtrList. If extending the PtrList, new entries are.
void updateMesh()
Correct polyBoundaryMesh after topology update.
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurrence of given element and return index,.
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
label size() const
Return the number of elements in the UPtrList.
static bool sameVertices(const face &, const face &)
Return true if the faces have the same vertices.
List< word > wordList
A List of words.
void setSize(const label)
Reset size of List.
const fileName & instance() const
#define WarningInFunction
Report a warning using Foam::Warning.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
void set(entry *)
Assign a new entry, overwrite any existing entry.
static autoPtr< polyPatch > New(const word &patchType, const word &name, const label size, const label start, const label index, const polyBoundaryMesh &bm)
Return a pointer to a new patch created on freestore from.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
List< cell > cellList
list of cells
polyMesh(const IOobject &io)
Construct from IOobject.