28 #include "primitiveMesh.H"
53 label curPoint = labels[j];
66 pointCellAddr[pointI].
transfer(pc[pointI]);
94 const labelList& facePointCells = pointCells[facePoints[pointI]];
96 forAll(facePointCells, cellI)
98 faceList cellFaces = cellsFaceShapes[facePointCells[cellI]];
100 forAll(cellFaces, cellFace)
102 if (face::sameVertices(cellFaces[cellFace], curFace))
105 FaceCells[fI] = facePointCells[cellI];
119 <<
"face " << fI <<
" in patch " << patchID
120 <<
" does not have neighbour cell"
138 label& defaultPatchStart,
151 forAll(cellsFaceShapes, cellI)
153 cellsFaceShapes[cellI] = cellsAsShapes[cellI].faces();
155 cells[cellI].setSize(cellsFaceShapes[cellI].size());
161 maxFaces += cellsFaceShapes[cellI].
size();
165 faces_.setSize(maxFaces);
171 labelListList PointCells = cellShapePointCells(cellsAsShapes);
183 const faceList& curFaces = cellsFaceShapes[cellI];
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"
292 forAll(boundaryFaces, patchI)
306 label curPatchStart = nFaces;
312 const label cellInside = curPatchFaceCells[faceI];
315 const faceList& facesOfCellInside = cellsFaceShapes[cellInside];
319 forAll(facesOfCellInside, cellFaceI)
321 if (face::sameVertices(facesOfCellInside[cellFaceI], curFace))
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];
400 const word& defaultBoundaryPatchName,
401 const word& defaultBoundaryPatchType,
402 const wordList& boundaryPatchPhysicalTypes,
460 clearedPrimitives_(
false),
473 boundaryFaces.
size() + 1
475 bounds_(points_, syncPar),
476 comm_(UPstream::worldComm),
479 tetBasePtIsPtr_(NULL),
523 globalMeshDataPtr_(NULL),
525 topoChanging_(
false),
531 Info<<
"Constructing polyMesh from cell and boundary shapes." <<
endl;
535 removeFiles(instance());
540 label defaultPatchStart;
557 forAll(boundaryFaces, patchI)
565 boundaryPatchTypes[patchI],
566 boundaryPatchNames[patchI],
576 boundaryPatchPhysicalTypes.
size()
577 && boundaryPatchPhysicalTypes[patchI].
size()
580 boundary_[patchI].physicalType() =
581 boundaryPatchPhysicalTypes[patchI];
585 label nAllPatches = boundaryFaces.
size();
588 label nDefaultFaces = nFaces - defaultPatchStart;
594 if (nDefaultFaces > 0)
597 <<
"Found " << nDefaultFaces
598 <<
" undefined faces in mesh; adding to default patch." <<
endl;
602 label patchI =
findIndex(boundaryPatchNames, defaultBoundaryPatchName);
606 if (patchI != boundaryFaces.
size()-1 || boundary_[patchI].size())
609 <<
"Default patch " << boundary_[patchI].name()
610 <<
" already has faces in it or is not"
615 <<
"Reusing existing patch " << patchI
616 <<
" for undefined faces." <<
endl;
623 boundaryPatchTypes[patchI],
624 boundaryPatchNames[patchI],
625 nFaces - defaultPatchStart,
639 defaultBoundaryPatchType,
640 defaultBoundaryPatchName,
641 nFaces - defaultPatchStart,
643 boundary_.size() - 1,
653 boundary_.setSize(nAllPatches);
661 boundary_.updateMesh();
664 boundary_.calcGeometry();
685 const word& defaultBoundaryPatchName,
686 const word& defaultBoundaryPatchType,
744 clearedPrimitives_(
false),
757 boundaryFaces.
size() + 1
759 bounds_(points_, syncPar),
760 comm_(UPstream::worldComm),
763 tetBasePtIsPtr_(NULL),
807 globalMeshDataPtr_(NULL),
809 topoChanging_(
false),
815 Info<<
"Constructing polyMesh from cell and boundary shapes." <<
endl;
819 removeFiles(instance());
824 label defaultPatchStart;
841 forAll(boundaryDicts, patchI)
845 patchDict.
set(
"nFaces", patchSizes[patchI]);
846 patchDict.
set(
"startFace", patchStarts[patchI]);
854 boundaryPatchNames[patchI],
862 label nAllPatches = boundaryFaces.
size();
864 label nDefaultFaces = nFaces - defaultPatchStart;
870 if (nDefaultFaces > 0)
873 <<
"Found " << nDefaultFaces
874 <<
" undefined faces in mesh; adding to default patch." <<
endl;
878 label patchI =
findIndex(boundaryPatchNames, defaultBoundaryPatchName);
882 if (patchI != boundaryFaces.
size()-1 || boundary_[patchI].size())
885 <<
"Default patch " << boundary_[patchI].name()
886 <<
" already has faces in it or is not"
891 <<
"Reusing existing patch " << patchI
892 <<
" for undefined faces." <<
endl;
899 boundary_[patchI].
type(),
900 boundary_[patchI].
name(),
901 nFaces - defaultPatchStart,
915 defaultBoundaryPatchType,
916 defaultBoundaryPatchName,
917 nFaces - defaultPatchStart,
919 boundary_.size() - 1,
929 boundary_.setSize(nAllPatches);
937 boundary_.updateMesh();
940 boundary_.calcGeometry();