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]
132 void Foam::polyMesh::setTopology
139 label& defaultPatchStart,
152 forAll(cellsFaceShapes, celli)
154 cellsFaceShapes[celli] = cellsAsShapes[celli].faces();
162 maxFaces += cellsFaceShapes[celli].size();
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++)
253 label minNei =
cells.size();
257 if (neiCells[ncI] > -1 && neiCells[ncI] < minNei)
260 minNei = neiCells[ncI];
267 faces_[nFaces] = curFaces[nextNei];
270 cells[celli][nextNei] = nFaces;
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];
395 cells[cellInside][cellFacei] = nFaces;
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];
441 faces_.setSize(nFaces);
445 Foam::polyMesh::polyMesh
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);
712 boundary_.updateMesh();
715 boundary_.calcGeometry();
728 Foam::polyMesh::polyMesh
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);
986 boundary_.updateMesh();
989 boundary_.calcGeometry();