41 List<DynamicList<label, primitiveMesh::cellsPerPoint_> >
53 label curPoint = labels[j];
54 DynamicList<label, primitiveMesh::cellsPerPoint_>& curPointCells =
58 curPointCells.append(i);
66 pointCellAddr[pointI].transfer(
pc[pointI]);
89 const face& curFace = patchFaces[fI];
90 const labelList& facePoints = patchFaces[fI];
94 const labelList& facePointCells = pointCells[facePoints[pointI]];
96 forAll(facePointCells, cellI)
98 faceList cellFaces = cellsFaceShapes[facePointCells[cellI]];
100 forAll(cellFaces, cellFace)
102 if (cellFaces[cellFace] == curFace)
105 FaceCells[fI] = facePointCells[cellI];
120 "polyMesh::facePatchFaceCells(const faceList& patchFaces,"
121 "const labelListList& pointCells,"
122 "const faceListList& cellsFaceShapes,"
123 "const label patchID)"
124 ) <<
"face " << fI <<
" in patch " << patchID
125 <<
" does not have neighbour cell"
126 <<
" face: " << patchFaces[fI]
135 Foam::polyMesh::polyMesh
143 const word& defaultBoundaryPatchName,
144 const word& defaultBoundaryPatchType,
145 const wordList& boundaryPatchPhysicalTypes,
203 clearedPrimitives_(
false),
216 boundaryFaces.
size() + 1
218 bounds_(points_, syncPar),
263 globalMeshDataPtr_(NULL),
270 Info<<
"Constructing polyMesh from cell and boundary shapes." <<
endl;
274 removeFiles(instance());
284 forAll(cellsFaceShapes, cellI)
286 cellsFaceShapes[cellI] = cellsAsShapes[cellI].faces();
294 maxFaces += cellsFaceShapes[cellI].
size();
298 faces_.setSize(maxFaces);
304 labelListList PointCells = cellShapePointCells(cellsAsShapes);
316 const faceList& curFaces = cellsFaceShapes[cellI];
324 label nNeighbours = 0;
330 if (
cells[cellI][faceI] >= 0)
continue;
334 const face& curFace = curFaces[faceI];
344 PointCells[curPoints[pointI]];
347 forAll(curNeighbours, neiI)
349 label curNei = curNeighbours[neiI];
355 const faceList& searchFaces = cellsFaceShapes[curNei];
357 forAll(searchFaces, neiFaceI)
359 if (searchFaces[neiFaceI] == curFace)
365 neiCells[faceI] = curNei;
366 faceOfNeiCell[faceI] = neiFaceI;
381 for (label neiSearch = 0; neiSearch < nNeighbours; neiSearch++)
389 if (neiCells[ncI] > -1 && neiCells[ncI] < minNei)
392 minNei = neiCells[ncI];
399 faces_[nFaces] = curFaces[nextNei];
402 cells[cellI][nextNei] = nFaces;
403 cells[neiCells[nextNei]][faceOfNeiCell[nextNei]] = nFaces;
406 neiCells[nextNei] = -1;
415 "polyMesh::polyMesh\n"
417 " const IOobject&,\n"
418 " const Xfer<pointField>&,\n"
419 " const cellShapeList& cellsAsShapes,\n"
420 " const faceListList& boundaryFaces,\n"
421 " const wordList& boundaryPatchTypes,\n"
422 " const wordList& boundaryPatchNames,\n"
423 " const word& defaultBoundaryPatchType\n"
425 ) <<
"Error in internal face insertion"
436 forAll (boundaryFaces, patchI)
438 const faceList& patchFaces = boundaryFaces[patchI];
450 label curPatchStart = nFaces;
452 forAll (patchFaces, faceI)
454 const face& curFace = patchFaces[faceI];
456 const label cellInside = curPatchFaceCells[faceI];
458 faces_[nFaces] = curFace;
461 const faceList& facesOfCellInside = cellsFaceShapes[cellInside];
465 forAll (facesOfCellInside, cellFaceI)
467 if (facesOfCellInside[cellFaceI] == curFace)
469 if (
cells[cellInside][cellFaceI] >= 0)
473 "polyMesh::polyMesh\n"
475 " const IOobject&,\n"
476 " const Xfer<pointField>&,\n"
477 " const cellShapeList& cellsAsShapes,\n"
478 " const faceListList& boundaryFaces,\n"
479 " const wordList& boundaryPatchTypes,\n"
480 " const wordList& boundaryPatchNames,\n"
481 " const word& defaultBoundaryPatchType\n"
483 ) <<
"Trying to specify a boundary face " << curFace
484 <<
" on the face on cell " << cellInside
485 <<
" which is either an internal face or already "
486 <<
"belongs to some other patch. This is face "
487 << faceI <<
" of patch "
488 << patchI <<
" named "
489 << boundaryPatchNames[patchI] <<
"."
495 cells[cellInside][cellFaceI] = nFaces;
503 FatalErrorIn(
"polyMesh::polyMesh(... construct from shapes...)")
504 <<
"face " << faceI <<
" of patch " << patchI
505 <<
" does not seem to belong to cell " << cellInside
506 <<
" which, according to the addressing, "
507 <<
"should be next to it."
515 patchSizes[patchI] = nFaces - curPatchStart;
516 patchStarts[patchI] = curPatchStart;
521 label defaultPatchStart = nFaces;
527 forAll(curCellFaces, faceI)
529 if (curCellFaces[faceI] == -1)
531 curCellFaces[faceI] = nFaces;
532 faces_[nFaces] = cellsFaceShapes[cellI][faceI];
544 forAll (boundaryFaces, patchI)
552 boundaryPatchTypes[patchI],
553 boundaryPatchNames[patchI],
563 boundaryPatchPhysicalTypes.
size()
564 && boundaryPatchPhysicalTypes[patchI].
size()
567 boundary_[patchI].physicalType() =
568 boundaryPatchPhysicalTypes[patchI];
572 label nAllPatches = boundaryFaces.
size();
574 if (nFaces > defaultPatchStart)
576 WarningIn(
"polyMesh::polyMesh(... construct from shapes...)")
577 <<
"Found " << nFaces - defaultPatchStart
578 <<
" undefined faces in mesh; adding to default patch." <<
endl;
585 defaultBoundaryPatchType,
586 defaultBoundaryPatchName,
587 nFaces - defaultPatchStart,
589 boundary_.size() - 1,
598 boundary_.setSize(nAllPatches);
606 boundary_.updateMesh();
609 boundary_.calcGeometry();