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 <<
" does not have neighbour cell"
122 <<
" face: " << patchFaces[fI]
131 void Foam::polyMesh::setTopology
138 label& defaultPatchStart,
151 forAll(cellsFaceShapes, celli)
153 cellsFaceShapes[celli] = cellsAsShapes[celli].faces();
161 maxFaces += cellsFaceShapes[celli].size();
171 labelListList PointCells = cellShapePointCells(cellsAsShapes);
183 const faceList& curFaces = cellsFaceShapes[celli];
189 labelList faceOfNeiCell(curFaces.size(), -1);
191 label nNeighbours = 0;
197 if (
cells[celli][facei] >= 0)
continue;
201 const face& curFace = curFaces[facei];
211 PointCells[curPoints[pointi]];
214 forAll(curNeighbours, neiI)
216 label curNei = curNeighbours[neiI];
222 const faceList& searchFaces = cellsFaceShapes[curNei];
224 forAll(searchFaces, neiFacei)
226 if (searchFaces[neiFacei] == curFace)
232 neiCells[facei] = curNei;
233 faceOfNeiCell[facei] = neiFacei;
248 for (label neiSearch = 0; neiSearch < nNeighbours; neiSearch++)
252 label minNei =
cells.size();
256 if (neiCells[ncI] > -1 && neiCells[ncI] < minNei)
259 minNei = neiCells[ncI];
266 faces_[nFaces] = curFaces[nextNei];
269 cells[celli][nextNei] = nFaces;
270 cells[neiCells[nextNei]][faceOfNeiCell[nextNei]] = nFaces;
273 neiCells[nextNei] = -1;
281 <<
"Error in internal face insertion"
288 const label nInternalFaces = nFaces;
290 patchSizes.setSize(boundaryFaces.size(), -1);
291 patchStarts.setSize(boundaryFaces.size(), -1);
293 forAll(boundaryFaces, patchi)
295 const faceList& patchFaces = boundaryFaces[patchi];
307 label curPatchStart = nFaces;
310 bool patchWarned =
false;
314 const face& curFace = patchFaces[facei];
316 const label cellInside = curPatchFaceCells[facei];
319 const faceList& facesOfCellInside = cellsFaceShapes[cellInside];
323 forAll(facesOfCellInside, cellFacei)
329 const label meshFacei =
cells[cellInside][cellFacei];
349 meshFacei < nInternalFaces
350 || meshFacei >= curPatchStart
354 <<
"Trying to specify a boundary face "
356 <<
" on the face on cell " << cellInside
357 <<
" which is either an internal face"
358 <<
" or already belongs to the same patch."
359 <<
" This is face " << facei <<
" of patch "
360 << patchi <<
" named "
361 << boundaryPatchNames[patchi] <<
"."
369 <<
"Trying to specify a boundary face "
371 <<
" on the face on cell " << cellInside
372 <<
" which is either an internal face"
373 <<
" or already belongs to some other patch."
374 <<
" This is face " << facei <<
" of patch "
375 << patchi <<
" named "
376 << boundaryPatchNames[patchi] <<
"."
382 faces_.setSize(faces_.size()+1);
385 faces_[nFaces] = facesOfCellInside[cellFacei];
392 faces_[nFaces] = facesOfCellInside[cellFacei];
394 cells[cellInside][cellFacei] = nFaces;
404 <<
"face " << facei <<
" of patch " << patchi
405 <<
" does not seem to belong to cell " << cellInside
406 <<
" which, according to the addressing, "
407 <<
"should be next to it."
415 patchSizes[patchi] = nFaces - curPatchStart;
416 patchStarts[patchi] = curPatchStart;
421 defaultPatchStart = nFaces;
427 forAll(curCellFaces, facei)
429 if (curCellFaces[facei] == -1)
431 curCellFaces[facei] = nFaces;
432 faces_[nFaces] = cellsFaceShapes[celli][facei];
440 faces_.setSize(nFaces);
444 Foam::polyMesh::polyMesh
452 const word& defaultBoundaryPatchName,
453 const word& defaultBoundaryPatchType,
454 const wordList& boundaryPatchPhysicalTypes,
512 clearedPrimitives_(
false),
525 boundaryFaces.size() + 1
527 bounds_(points_, syncPar),
531 tetBasePtIsPtr_(
nullptr),
532 cellTreePtr_(
nullptr),
575 globalMeshDataPtr_(
nullptr),
577 topoChanging_(
false),
579 oldPointsPtr_(
nullptr)
582 <<
"Constructing polyMesh from cell and boundary shapes." <<
endl;
587 label defaultPatchStart;
604 forAll(boundaryFaces, patchi)
612 boundaryPatchTypes[patchi],
613 boundaryPatchNames[patchi],
623 boundaryPatchPhysicalTypes.size()
624 && boundaryPatchPhysicalTypes[patchi].size()
627 boundary_[patchi].physicalType() =
628 boundaryPatchPhysicalTypes[patchi];
632 label nAllPatches = boundaryFaces.size();
635 label nDefaultFaces = nFaces - defaultPatchStart;
641 if (nDefaultFaces > 0)
644 <<
"Found " << nDefaultFaces
645 <<
" undefined faces in mesh; adding to default patch "
646 << defaultBoundaryPatchName <<
endl;
650 label patchi = boundaryPatchNames.find(defaultBoundaryPatchName);
654 if (patchi != boundaryFaces.size()-1 || boundary_[patchi].size())
657 <<
"Default patch " << boundary_[patchi].name()
658 <<
" already has faces in it or is not"
663 <<
"Reusing existing patch " << patchi
664 <<
" for undefined faces." <<
endl;
671 boundaryPatchTypes[patchi],
672 boundaryPatchNames[patchi],
673 nFaces - defaultPatchStart,
687 defaultBoundaryPatchType,
688 defaultBoundaryPatchName,
689 nFaces - defaultPatchStart,
691 boundary_.size() - 1,
701 boundary_.setSize(nAllPatches);
709 boundary_.updateMesh();
712 boundary_.calcGeometry();
725 Foam::polyMesh::polyMesh
733 const word& defaultBoundaryPatchName,
734 const word& defaultBoundaryPatchType,
792 clearedPrimitives_(
false),
805 boundaryFaces.size() + 1
807 bounds_(points_, syncPar),
811 tetBasePtIsPtr_(
nullptr),
812 cellTreePtr_(
nullptr),
855 globalMeshDataPtr_(
nullptr),
857 topoChanging_(
false),
859 oldPointsPtr_(
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;
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();