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++)
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"
289 patchSizes.setSize(boundaryFaces.size(), -1);
290 patchStarts.setSize(boundaryFaces.size(), -1);
292 forAll(boundaryFaces, patchi)
294 const faceList& patchFaces = boundaryFaces[patchi];
306 label curPatchStart = nFaces;
310 const face& curFace = patchFaces[facei];
312 const label cellInside = curPatchFaceCells[facei];
315 const faceList& facesOfCellInside = cellsFaceShapes[cellInside];
319 forAll(facesOfCellInside, cellFacei)
323 if (
cells[cellInside][cellFacei] >= 0)
326 <<
"Trying to specify a boundary face " << curFace
327 <<
" on the face on cell " << cellInside
328 <<
" which is either an internal face or already "
329 <<
"belongs to some other patch. This is face "
330 << facei <<
" of patch "
331 << patchi <<
" named "
332 << boundaryPatchNames[patchi] <<
"."
339 faces_[nFaces] = facesOfCellInside[cellFacei];
341 cells[cellInside][cellFacei] = nFaces;
350 <<
"face " << facei <<
" of patch " << patchi
351 <<
" does not seem to belong to cell " << cellInside
352 <<
" which, according to the addressing, "
353 <<
"should be next to it."
361 patchSizes[patchi] = nFaces - curPatchStart;
362 patchStarts[patchi] = curPatchStart;
367 defaultPatchStart = nFaces;
373 forAll(curCellFaces, facei)
375 if (curCellFaces[facei] == -1)
377 curCellFaces[facei] = nFaces;
378 faces_[nFaces] = cellsFaceShapes[celli][facei];
386 faces_.setSize(nFaces);
392 Foam::polyMesh::polyMesh
400 const word& defaultBoundaryPatchName,
401 const word& defaultBoundaryPatchType,
402 const wordList& boundaryPatchPhysicalTypes,
460 clearedPrimitives_(
false),
473 boundaryFaces.size() + 1
475 bounds_(points_, syncPar),
479 tetBasePtIsPtr_(
nullptr),
480 cellTreePtr_(
nullptr),
523 globalMeshDataPtr_(
nullptr),
525 topoChanging_(
false),
527 oldPointsPtr_(
nullptr)
531 Info<<
"Constructing polyMesh from cell and boundary shapes." <<
endl;
537 label defaultPatchStart;
554 forAll(boundaryFaces, patchi)
562 boundaryPatchTypes[patchi],
563 boundaryPatchNames[patchi],
573 boundaryPatchPhysicalTypes.size()
574 && boundaryPatchPhysicalTypes[patchi].size()
577 boundary_[patchi].physicalType() =
578 boundaryPatchPhysicalTypes[patchi];
582 label nAllPatches = boundaryFaces.size();
585 label nDefaultFaces = nFaces - defaultPatchStart;
591 if (nDefaultFaces > 0)
594 <<
"Found " << nDefaultFaces
595 <<
" undefined faces in mesh; adding to default patch "
596 << defaultBoundaryPatchName <<
endl;
600 label patchi = boundaryPatchNames.find(defaultBoundaryPatchName);
604 if (patchi != boundaryFaces.size()-1 || boundary_[patchi].size())
607 <<
"Default patch " << boundary_[patchi].name()
608 <<
" already has faces in it or is not"
613 <<
"Reusing existing patch " << patchi
614 <<
" for undefined faces." <<
endl;
621 boundaryPatchTypes[patchi],
622 boundaryPatchNames[patchi],
623 nFaces - defaultPatchStart,
637 defaultBoundaryPatchType,
638 defaultBoundaryPatchName,
639 nFaces - defaultPatchStart,
641 boundary_.size() - 1,
651 boundary_.setSize(nAllPatches);
659 boundary_.updateMesh();
662 boundary_.calcGeometry();
675 Foam::polyMesh::polyMesh
683 const word& defaultBoundaryPatchName,
684 const word& defaultBoundaryPatchType,
742 clearedPrimitives_(
false),
755 boundaryFaces.size() + 1
757 bounds_(points_, syncPar),
761 tetBasePtIsPtr_(
nullptr),
762 cellTreePtr_(
nullptr),
805 globalMeshDataPtr_(
nullptr),
807 topoChanging_(
false),
809 oldPointsPtr_(
nullptr)
813 Info<<
"Constructing polyMesh from cell and boundary shapes." <<
endl;
819 label defaultPatchStart;
840 patchDict.
set(
"nFaces", patchSizes[patchi]);
841 patchDict.
set(
"startFace", patchStarts[patchi]);
849 boundaryPatchNames[patchi],
857 label nAllPatches = boundaryFaces.size();
859 label nDefaultFaces = nFaces - defaultPatchStart;
865 if (nDefaultFaces > 0)
868 <<
"Found " << nDefaultFaces
869 <<
" undefined faces in mesh; adding to default patch "
870 << defaultBoundaryPatchName <<
endl;
874 label patchi = boundaryPatchNames.find(defaultBoundaryPatchName);
878 if (patchi != boundaryFaces.size()-1 || boundary_[patchi].size())
881 <<
"Default patch " << boundary_[patchi].name()
882 <<
" already has faces in it or is not"
887 <<
"Reusing existing patch " << patchi
888 <<
" for undefined faces." <<
endl;
895 boundary_[patchi].
type(),
896 boundary_[patchi].
name(),
897 nFaces - defaultPatchStart,
911 defaultBoundaryPatchType,
912 defaultBoundaryPatchName,
913 nFaces - defaultPatchStart,
915 boundary_.size() - 1,
925 boundary_.setSize(nAllPatches);
933 boundary_.updateMesh();
936 boundary_.calcGeometry();