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),
521 curMotionTimeIndex_(-1),
522 oldPointsPtr_(
nullptr),
523 oldCellCentresPtr_(
nullptr),
524 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)
598 <<
"Found " << nDefaultFaces
599 <<
" undefined faces in mesh; adding to default patch." <<
endl;
611 <<
"Default patch " << boundary_[
patchi].
name()
612 <<
" already has faces in it or is not" 617 <<
"Reusing existing patch " << patchi
618 <<
" for undefined faces." <<
endl;
625 boundaryPatchTypes[patchi],
626 boundaryPatchNames[patchi],
627 nFaces - defaultPatchStart,
641 defaultBoundaryPatchType,
642 defaultBoundaryPatchName,
643 nFaces - defaultPatchStart,
645 boundary_.
size() - 1,
655 boundary_.
setSize(nAllPatches);
666 boundary_.calcGeometry();
687 const word& defaultBoundaryPatchName,
688 const word& defaultBoundaryPatchType,
746 clearedPrimitives_(
false),
759 boundaryFaces.
size() + 1
761 bounds_(points_, syncPar),
765 tetBasePtIsPtr_(
nullptr),
766 cellTreePtr_(
nullptr),
809 globalMeshDataPtr_(
nullptr),
810 curMotionTimeIndex_(-1),
811 oldPointsPtr_(
nullptr),
812 oldCellCentresPtr_(
nullptr),
813 storeOldCellCentres_(
false),
819 Info<<
"Constructing polyMesh from cell and boundary shapes." <<
endl;
828 label defaultPatchStart;
849 patchDict.
set(
"nFaces", patchSizes[patchi]);
850 patchDict.
set(
"startFace", patchStarts[patchi]);
858 boundaryPatchNames[patchi],
866 label nAllPatches = boundaryFaces.
size();
868 label nDefaultFaces = nFaces - defaultPatchStart;
874 if (nDefaultFaces > 0)
879 <<
"Found " << nDefaultFaces
880 <<
" undefined faces in mesh; adding to default patch." <<
endl;
892 <<
"Default patch " << boundary_[
patchi].
name()
893 <<
" already has faces in it or is not" 898 <<
"Reusing existing patch " << patchi
899 <<
" for undefined faces." <<
endl;
906 boundary_[patchi].
type(),
907 boundary_[patchi].
name(),
908 nFaces - defaultPatchStart,
922 defaultBoundaryPatchType,
923 defaultBoundaryPatchName,
924 nFaces - defaultPatchStart,
926 boundary_.
size() - 1,
936 boundary_.
setSize(nAllPatches);
947 boundary_.calcGeometry();
bool moving_
Member data pending transfer to fvMesh.
List< labelList > labelListList
A List of labelList.
List< faceList > faceListList
#define forAll(list, i)
Loop across all elements in list.
FvWallInfoData< WallInfo, label > 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.
bool topoChanged_
Is the mesh topology changing.
void topoChange()
Correct polyBoundaryMesh after topology update.
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.
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.
#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.
fileName & instance() const
Return the instance directory, constant, system, <time> etc.
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.