const Foam::labelListList& Foam::primitiveMesh::cellPoints() const { if (!cpPtr_) { if (debug) { Pout<< "primitiveMesh::cellPoints() : " << "calculating cellPoints" << endl; if (debug == -1) { // For checking calls:abort so we can quickly hunt down // origin of call FatalErrorIn("primitiveMesh::cellPoints()") << abort(FatalError); } } // Invert pointCells cpPtr_ = new labelListList(nCells()); invertManyToMany(nCells(), pointCells(), *cpPtr_); } return *cpPtr_; }
forAll(boundary_, patchi) { faceList& patchFaces = boundary_[patchi]; const labelListList& PointCells = pointCells(); forAll(patchFaces, facei) { bool found = false; face& curFace = patchFaces[facei]; const labelList& facePoints = curFace; forAll(facePoints, pointI) { const labelList& facePointCells = PointCells[facePoints[pointI]]; forAll(facePointCells, celli) { const faceList& curCellFaces = cellFaces_[facePointCells[celli]]; forAll(curCellFaces, cellFacei) { if (sammEqualFace(curCellFaces[cellFacei], curFace)) { // Found the cell face corresponding to this face found = true; // Set boundary face to the corresponding cell face // which guarantees it is outward-pointing curFace = curCellFaces[cellFacei]; } if (found) break; } if (found) break; } if (found) break; } if (!found) { FatalErrorInFunction << "Face " << facei << " does not have neighbour cell." << endl << " face : " << endl << curFace << abort(FatalError); } }
curCell.setSize(cellFaces_[celli].size()); forAll(curCell, fI) { curCell[fI] = -1; } maxFaces += cellFaces_[celli].size(); } Info<< "Maximum possible number of faces in mesh: " << maxFaces << endl; meshFaces_.setSize(maxFaces); // set reference to point-cell addressing const labelListList& PointCells = pointCells(); bool found = false; nInternalFaces_ = 0; forAll(cellFaces_, celli) { // Note: // Insertion cannot be done in one go as the faces need to be // added into the list in the increasing order of neighbour // cells. Therefore, all neighbours will be detected first // and then added in the correct order. const faceList& curFaces = cellFaces_[celli];
void Foam::starMesh::markBoundaryFaces() { // set size of mark lists for the boundary boundaryCellIDs_.setSize(boundary_.size()); boundaryCellFaceIDs_.setSize(boundary_.size()); forAll(boundary_, patchi) { const faceList& patchFaces = boundary_[patchi]; // set size of patch lists labelList& curBoundaryCellIDs = boundaryCellIDs_[patchi]; labelList& curBoundaryCellFaceIDs = boundaryCellFaceIDs_[patchi]; curBoundaryCellIDs.setSize(patchFaces.size()); curBoundaryCellFaceIDs.setSize(patchFaces.size()); const labelListList& PointCells = pointCells(); forAll(patchFaces, facei) { bool found = false; const face& curFace = patchFaces[facei]; const labelList& facePoints = curFace; forAll(facePoints, pointi) { const labelList& facePointCells = PointCells[facePoints[pointi]]; forAll(facePointCells, celli) { const label curCellIndex = facePointCells[celli]; const faceList& curCellFaces = cellFaces_[curCellIndex]; forAll(curCellFaces, cellFacei) { if (starEqualFace(curFace, curCellFaces[cellFacei])) { // Found the cell face corresponding to this face found = true; // Set boundary face to the corresponding cell face curBoundaryCellIDs[facei] = curCellIndex; curBoundaryCellFaceIDs[facei] = cellFacei; } if (found) break; } if (found) break; } if (found) break; } if (!found) { FatalErrorInFunction << "Face " << facei << " does not have neighbour cell." << " Face : " << endl << curFace << endl << "PROSTAR Command: vset,news,vlis"; forAll(curFace, spI) { if (curFace[spI] > -1 && curFace[spI] < starPointID_.size()) { Info<< "," << starPointID_[curFace[spI]]; } else { Info<< ",???"; } } FatalError << " $ bset,add,vset,all" << abort(FatalError); } }
void Foam::starMesh::createPolyBoundary() { label nBoundaryFacesFound = 0; polyBoundaryPatchStartIndices_.setSize(boundary_.size()); label nCreatedFaces = nInternalFaces_; const labelListList& PointCells = pointCells(); forAll(boundary_, patchi) { const faceList& curShapePatch = boundary_[patchi]; polyBoundaryPatchStartIndices_[patchi] = nCreatedFaces; forAll(curShapePatch, facei) { bool found = false; const face& curFace = curShapePatch[facei]; meshFaces_[nCreatedFaces] = curFace; // Must find which cell this face belongs to in order to // mark it in the cellPolys_ const labelList& facePoints = curFace; forAll(facePoints, pointi) { const labelList& facePointCells = PointCells[facePoints[pointi]]; forAll(facePointCells, celli) { const faceList& curCellFaces = cellFaces_[facePointCells[celli]]; forAll(curCellFaces, cellFacei) { if (curCellFaces[cellFacei] == curFace) { // Found the cell face corresponding to this face found = true; // Debugging if ( cellPolys_[facePointCells[celli]][cellFacei] != -1 ) { if ( cellPolys_[facePointCells[celli]][cellFacei] > nInternalFaces_ ) { InfoInFunction << "Problem with face: " << curFace << "\nProbably multiple definitions " << "of a single boundary face. " << endl << "Other boundary face: " << curCellFaces[cellFacei] << endl; Info<< "PROSTAR Command: vset,news,vlis"; forAll(curCellFaces[cellFacei], spI) { // check if the point is given by STAR // or created locally if ( curCellFaces[cellFacei][spI] > -1 && curCellFaces[cellFacei][spI] < starPointID_.size() ) { Info<< "," << starPointID_ [curCellFaces[cellFacei][spI]]; } else { Info<< ",???"; } } Info<< " $ bset,add,vset,all" << endl; } else { InfoInFunction << "Problem with face: " << curFace << "\nProbably trying to define a " << "boundary face on a previously " << "matched internal face. " << endl << "Internal face: " << curCellFaces[cellFacei] << endl; Info<< "PROSTAR Command: vset,news,vlis"; forAll(curCellFaces[cellFacei], spI) { // check if the point is given by STAR // or created locally if ( curCellFaces[cellFacei][spI] > -1 && curCellFaces[cellFacei][spI] < starPointID_.size() ) { Info<< "," << starPointID_ [curCellFaces[cellFacei][spI]]; } else { Info<< ",???"; } } Info<< " $ bset,add,vset,all" << endl; } } cellPolys_[facePointCells[celli]][cellFacei] = nCreatedFaces; nBoundaryFacesFound++; } if (found) break; } if (found) break; }
void sammMesh::createPolyBoundary() { label nBoundaryFacesFound = 0; polyBoundaryPatchStartIndices_.setSize(boundary_.size()); label nCreatedFaces = nInternalFaces_; const labelListList& PointCells = pointCells(); forAll(boundary_, patchI) { const faceList& curShapePatch = boundary_[patchI]; polyBoundaryPatchStartIndices_[patchI] = nCreatedFaces; forAll(curShapePatch, faceI) { bool found = false; const face& curFace = curShapePatch[faceI]; meshFaces_[nCreatedFaces] = curFace; // Must find which cell this face belongs to in order to // mark it in the cellPolys_ const labelList& facePoints = curFace; forAll(facePoints, pointI) { const labelList& facePointCells = PointCells[facePoints[pointI]]; forAll(facePointCells, cellI) { const faceList& curCellFaces = cellFaces_[facePointCells[cellI]]; forAll(curCellFaces, cellFaceI) { if (curCellFaces[cellFaceI] == curFace) { // Found the cell face corresponding to this face found = true; // Debugging if ( cellPolys_[facePointCells[cellI]][cellFaceI] != -1 ) { FatalErrorIn ( "void sammMesh::createPolyBoundary()" ) << "This looks like an already detected " << "internal face" << abort(FatalError); } cellPolys_[facePointCells[cellI]][cellFaceI] = nCreatedFaces; nBoundaryFacesFound++; } if (found) break; } if (found) break; } if (found) break; } nCreatedFaces++; } }