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,
150 forAll(cellsFaceShapes, celli)
152 cellsFaceShapes[celli] = cellsAsShapes[celli].faces();
160 maxFaces += cellsFaceShapes[celli].
size();
164 faces_.setSize(maxFaces);
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++)
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);
305 label curPatchStart = nFaces;
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];
385 faces_.setSize(nFaces);
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();
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),
818 Info<<
"Constructing polyMesh from cell and boundary shapes." <<
endl;
827 label defaultPatchStart;
848 patchDict.
set(
"nFaces", patchSizes[
patchi]);
849 patchDict.
set(
"startFace", patchStarts[
patchi]);
857 boundaryPatchNames[
patchi],
865 label nAllPatches = boundaryFaces.
size();
873 if (nDefaultFaces > 0)
878 <<
"Found " << nDefaultFaces
879 <<
" undefined faces in mesh; adding to default patch." <<
endl;
891 <<
"Default patch " << boundary_[
patchi].
name()
892 <<
" already has faces in it or is not"
897 <<
"Reusing existing patch " <<
patchi
898 <<
" for undefined faces." <<
endl;
907 nFaces - defaultPatchStart,
921 defaultBoundaryPatchType,
922 defaultBoundaryPatchName,
923 nFaces - defaultPatchStart,
925 boundary_.
size() - 1,
935 boundary_.
setSize(nAllPatches);
946 boundary_.calcGeometry();
#define forAll(list, i)
Loop across all elements in list.
label size() const
Return number of elements in table.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
fileName & instance() const
Return the instance directory, constant, system, <time> etc.
const word & name() const
Return name.
void size(const label)
Override size to be inconsistent with allocated storage.
void setSize(const label)
Reset size of List.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
bool set(const label) const
Is element set.
void setSize(const label)
Reset size of PtrList. If extending the PtrList, new entries are.
Inter-processor communications stream.
label size() const
Return the number of elements in the UPtrList.
A list of keyword definitions, which are a keyword followed by any number of values (e....
void set(entry *)
Assign a new entry, overwrite any existing entry.
static bool sameVertices(const face &, const face &)
Return true if the faces have the same vertices.
Registry of regIOobjects.
void topoChange()
Correct polyBoundaryMesh after topology update.
polyMesh(const IOobject &io)
Construct from IOobject.
virtual const pointField & points() const
Return raw points.
void removeFiles() const
Remove all files from mesh instance()
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.
Cell-face mesh analysis engine.
virtual bool checkMesh(const bool report=false) const
Check mesh for correctness. Returns false for no error.
const cellList & cells() const
A class for handling words, derived from string.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
#define WarningInFunction
Report a warning using Foam::Warning.
const dimensionedScalar c
Speed of light in a vacuum.
errorManipArg< error, int > exit(error &err, const int errNo=1)
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.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
List< cell > cellList
list of cells
Ostream & endl(Ostream &os)
Add newline and flush stream.
errorManip< error > abort(error &err)
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
List< labelList > labelListList
A List of labelList.
List< faceList > faceListList
label findIndex(const ListType &, typename ListType::const_reference, const label start=0)
Find first occurrence of given element and return index,.
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.