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),
578 storeOldCellCentres_(
false),
580 oldPointsPtr_(
nullptr),
581 oldCellCentresPtr_(
nullptr)
584 <<
"Constructing polyMesh from cell and boundary shapes." <<
endl;
589 label defaultPatchStart;
606 forAll(boundaryFaces, patchi)
614 boundaryPatchTypes[patchi],
615 boundaryPatchNames[patchi],
625 boundaryPatchPhysicalTypes.size()
626 && boundaryPatchPhysicalTypes[patchi].size()
629 boundary_[patchi].physicalType() =
630 boundaryPatchPhysicalTypes[patchi];
634 label nAllPatches = boundaryFaces.size();
637 label nDefaultFaces = nFaces - defaultPatchStart;
643 if (nDefaultFaces > 0)
646 <<
"Found " << nDefaultFaces
647 <<
" undefined faces in mesh; adding to default patch "
648 << defaultBoundaryPatchName <<
endl;
652 label patchi = boundaryPatchNames.find(defaultBoundaryPatchName);
656 if (patchi != boundaryFaces.size()-1 || boundary_[patchi].size())
659 <<
"Default patch " << boundary_[patchi].name()
660 <<
" already has faces in it or is not"
665 <<
"Reusing existing patch " << patchi
666 <<
" for undefined faces." <<
endl;
673 boundaryPatchTypes[patchi],
674 boundaryPatchNames[patchi],
675 nFaces - defaultPatchStart,
689 defaultBoundaryPatchType,
690 defaultBoundaryPatchName,
691 nFaces - defaultPatchStart,
693 boundary_.size() - 1,
703 boundary_.setSize(nAllPatches);
711 boundary_.updateMesh();
714 boundary_.calcGeometry();
727 Foam::polyMesh::polyMesh
735 const word& defaultBoundaryPatchName,
736 const word& defaultBoundaryPatchType,
794 clearedPrimitives_(
false),
807 boundaryFaces.size() + 1
809 bounds_(points_, syncPar),
813 tetBasePtIsPtr_(
nullptr),
814 cellTreePtr_(
nullptr),
857 globalMeshDataPtr_(
nullptr),
859 topoChanging_(
false),
860 storeOldCellCentres_(
false),
862 oldPointsPtr_(
nullptr),
863 oldCellCentresPtr_(
nullptr)
866 <<
"Constructing polyMesh from cell and boundary shapes." <<
endl;
871 label defaultPatchStart;
892 patchDict.
set(
"nFaces", patchSizes[patchi]);
893 patchDict.
set(
"startFace", patchStarts[patchi]);
901 boundaryPatchNames[patchi],
909 label nAllPatches = boundaryFaces.size();
911 label nDefaultFaces = nFaces - defaultPatchStart;
917 if (nDefaultFaces > 0)
920 <<
"Found " << nDefaultFaces
921 <<
" undefined faces in mesh; adding to default patch "
922 << defaultBoundaryPatchName <<
endl;
926 label patchi = boundaryPatchNames.find(defaultBoundaryPatchName);
930 if (patchi != boundaryFaces.size()-1 || boundary_[patchi].size())
933 <<
"Default patch " << boundary_[patchi].name()
934 <<
" already has faces in it or is not"
939 <<
"Reusing existing patch " << patchi
940 <<
" for undefined faces." <<
endl;
947 boundary_[patchi].
type(),
948 boundary_[patchi].
name(),
949 nFaces - defaultPatchStart,
963 defaultBoundaryPatchType,
964 defaultBoundaryPatchName,
965 nFaces - defaultPatchStart,
967 boundary_.size() - 1,
977 boundary_.setSize(nAllPatches);
985 boundary_.updateMesh();
988 boundary_.calcGeometry();