diff --git a/applications/test/nearWallDist-wave/testWallDist2.C b/applications/test/nearWallDist-wave/testWallDist2.C index 364a73279f..45690a33f4 100644 --- a/applications/test/nearWallDist-wave/testWallDist2.C +++ b/applications/test/nearWallDist-wave/testWallDist2.C @@ -29,7 +29,7 @@ Description #include "fvCFD.H" #include "wallFvPatch.H" -#include "MeshWave.H" +#include "FaceCellWave.H" #include "wallPoint.H" @@ -158,7 +158,7 @@ int main(int argc, char *argv[]) forAll(allCellInfo, cellI) { scalar dist = allCellInfo[cellI].distSqr(); - if (allCellInfo[cellI].valid()) + if (allCellInfo[cellI].valid(wallDistCalc.data())) { wallDistUncorrected[cellI] = Foam::sqrt(dist); } @@ -180,7 +180,7 @@ int main(int argc, char *argv[]) const label meshFaceI = patchField.patch().start() + patchFaceI; scalar dist = allFaceInfo[meshFaceI].distSqr(); - if (allFaceInfo[meshFaceI].valid()) + if (allFaceInfo[meshFaceI].valid(wallDistCalc.data())) { patchField[patchFaceI] = Foam::sqrt(dist); } diff --git a/applications/utilities/mesh/advanced/selectCells/selectCells.C b/applications/utilities/mesh/advanced/selectCells/selectCells.C index 827449c02c..8f86a145d5 100644 --- a/applications/utilities/mesh/advanced/selectCells/selectCells.C +++ b/applications/utilities/mesh/advanced/selectCells/selectCells.C @@ -299,7 +299,7 @@ label selectOutsideCells mesh, outsideFaces.shrink(), outsideFacesInfo.shrink(), - mesh.globalData().nTotalCells()+1 // max iterations + mesh.globalData().nTotalCells()+1 // max iterations ); // Now regionCalc should hold info on cells that are reachable from diff --git a/src/OpenFOAM/algorithms/MeshWave/FaceCellWave.C b/src/OpenFOAM/algorithms/MeshWave/FaceCellWave.C index 3a9155614f..a653afd688 100644 --- a/src/OpenFOAM/algorithms/MeshWave/FaceCellWave.C +++ b/src/OpenFOAM/algorithms/MeshWave/FaceCellWave.C @@ -35,75 +35,16 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -template -const Foam::scalar Foam::FaceCellWave::geomTol_ = 1e-6; +template +const Foam::scalar +Foam::FaceCellWave::geomTol_ = 1e-6; -template -Foam::scalar Foam::FaceCellWave::propagationTol_ = 0.01; +template +const Foam::scalar +Foam::FaceCellWave::propagationTol_ = 0.01; -// Write to ostream -template -Foam::Ostream& Foam::FaceCellWave::writeFaces -( - const label nFaces, - const labelList& faceLabels, - const List& faceInfo, - Ostream& os -) -{ - // Write list contents depending on data format - if (os.format() == IOstream::ASCII) - { - os << nFaces; - - for (label i = 0; i < nFaces; i++) - { - os << ' ' << faceLabels[i]; - } - for (label i = 0; i < nFaces; i++) - { - os << ' ' << faceInfo[i]; - } - } - else - { - os << nFaces; - - for (label i = 0; i < nFaces; i++) - { - os << faceLabels[i]; - } - for (label i = 0; i < nFaces; i++) - { - os << faceInfo[i]; - } - } - return os; -} - - -// Read from istream -template -Foam::Istream& Foam::FaceCellWave::readFaces -( - label& nFaces, - labelList& faceLabels, - List& faceInfo, - Istream& is -) -{ - is >> nFaces; - - for (label i = 0; i < nFaces; i++) - { - is >> faceLabels[i]; - } - for (label i = 0; i < nFaces; i++) - { - is >> faceInfo[i]; - } - return is; -} +template +Foam::label Foam::FaceCellWave::dummyTrackData_ = 12345; // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -113,8 +54,8 @@ Foam::Istream& Foam::FaceCellWave::readFaces // Updates: // - changedCell_, changedCells_, nChangedCells_, // - statistics: nEvals_, nUnvisitedCells_ -template -bool Foam::FaceCellWave::updateCell +template +bool Foam::FaceCellWave::updateCell ( const label cellI, const label neighbourFaceI, @@ -125,7 +66,7 @@ bool Foam::FaceCellWave::updateCell { nEvals_++; - bool wasValid = cellInfo.valid(); + bool wasValid = cellInfo.valid(td_); bool propagate = cellInfo.updateCell @@ -134,7 +75,8 @@ bool Foam::FaceCellWave::updateCell cellI, neighbourFaceI, neighbourInfo, - tol + tol, + td_ ); if (propagate) @@ -146,7 +88,7 @@ bool Foam::FaceCellWave::updateCell } } - if (!wasValid && cellInfo.valid()) + if (!wasValid && cellInfo.valid(td_)) { --nUnvisitedCells_; } @@ -160,8 +102,8 @@ bool Foam::FaceCellWave::updateCell // Updates: // - changedFace_, changedFaces_, nChangedFaces_, // - statistics: nEvals_, nUnvisitedFaces_ -template -bool Foam::FaceCellWave::updateFace +template +bool Foam::FaceCellWave::updateFace ( const label faceI, const label neighbourCellI, @@ -172,7 +114,7 @@ bool Foam::FaceCellWave::updateFace { nEvals_++; - bool wasValid = faceInfo.valid(); + bool wasValid = faceInfo.valid(td_); bool propagate = faceInfo.updateFace @@ -181,7 +123,8 @@ bool Foam::FaceCellWave::updateFace faceI, neighbourCellI, neighbourInfo, - tol + tol, + td_ ); if (propagate) @@ -193,7 +136,7 @@ bool Foam::FaceCellWave::updateFace } } - if (!wasValid && faceInfo.valid()) + if (!wasValid && faceInfo.valid(td_)) { --nUnvisitedFaces_; } @@ -207,8 +150,8 @@ bool Foam::FaceCellWave::updateFace // Updates: // - changedFace_, changedFaces_, nChangedFaces_, // - statistics: nEvals_, nUnvisitedFaces_ -template -bool Foam::FaceCellWave::updateFace +template +bool Foam::FaceCellWave::updateFace ( const label faceI, const Type& neighbourInfo, @@ -218,7 +161,7 @@ bool Foam::FaceCellWave::updateFace { nEvals_++; - bool wasValid = faceInfo.valid(); + bool wasValid = faceInfo.valid(td_); bool propagate = faceInfo.updateFace @@ -226,7 +169,8 @@ bool Foam::FaceCellWave::updateFace mesh_, faceI, neighbourInfo, - tol + tol, + td_ ); if (propagate) @@ -238,7 +182,7 @@ bool Foam::FaceCellWave::updateFace } } - if (!wasValid && faceInfo.valid()) + if (!wasValid && faceInfo.valid(td_)) { --nUnvisitedFaces_; } @@ -248,8 +192,11 @@ bool Foam::FaceCellWave::updateFace // For debugging: check status on both sides of cyclic -template -void Foam::FaceCellWave::checkCyclic(const polyPatch& patch) const +template +void Foam::FaceCellWave::checkCyclic +( + const polyPatch& patch +) const { const cyclicPolyPatch& nbrPatch = refCast(patch).neighbPatch(); @@ -259,10 +206,22 @@ void Foam::FaceCellWave::checkCyclic(const polyPatch& patch) const label i1 = patch.start() + patchFaceI; label i2 = nbrPatch.start() + patchFaceI; - if (!allFaceInfo_[i1].sameGeometry(mesh_, allFaceInfo_[i2], geomTol_)) + if + ( + !allFaceInfo_[i1].sameGeometry + ( + mesh_, + allFaceInfo_[i2], + geomTol_, + td_ + ) + ) { - FatalErrorIn("FaceCellWave::checkCyclic(const polyPatch&)") - << "problem: i:" << i1 << " otheri:" << i2 + FatalErrorIn + ( + "FaceCellWave" + "::checkCyclic(const polyPatch&)" + ) << "problem: i:" << i1 << " otheri:" << i2 << " faceInfo:" << allFaceInfo_[i1] << " otherfaceInfo:" << allFaceInfo_[i2] << abort(FatalError); @@ -270,8 +229,11 @@ void Foam::FaceCellWave::checkCyclic(const polyPatch& patch) const if (changedFace_[i1] != changedFace_[i2]) { - FatalErrorIn("FaceCellWave::checkCyclic(const polyPatch&)") - << " problem: i:" << i1 << " otheri:" << i2 + FatalErrorIn + ( + "FaceCellWave" + "::checkCyclic(const polyPatch&)" + ) << " problem: i:" << i1 << " otheri:" << i2 << " faceInfo:" << allFaceInfo_[i1] << " otherfaceInfo:" << allFaceInfo_[i2] << " changedFace:" << changedFace_[i1] @@ -283,8 +245,8 @@ void Foam::FaceCellWave::checkCyclic(const polyPatch& patch) const // Check if has cyclic patches -template -bool Foam::FaceCellWave::hasCyclicPatch() const +template +bool Foam::FaceCellWave::hasCyclicPatch() const { forAll(mesh_.boundaryMesh(), patchI) { @@ -298,8 +260,8 @@ bool Foam::FaceCellWave::hasCyclicPatch() const // Copy face information into member data -template -void Foam::FaceCellWave::setFaceInfo +template +void Foam::FaceCellWave::setFaceInfo ( const labelList& changedFaces, const List& changedFacesInfo @@ -309,13 +271,13 @@ void Foam::FaceCellWave::setFaceInfo { label faceI = changedFaces[changedFaceI]; - bool wasValid = allFaceInfo_[faceI].valid(); + bool wasValid = allFaceInfo_[faceI].valid(td_); // Copy info for faceI allFaceInfo_[faceI] = changedFacesInfo[changedFaceI]; // Maintain count of unset faces - if (!wasValid && allFaceInfo_[faceI].valid()) + if (!wasValid && allFaceInfo_[faceI].valid(td_)) { --nUnvisitedFaces_; } @@ -329,8 +291,8 @@ void Foam::FaceCellWave::setFaceInfo // Merge face information into member data -template -void Foam::FaceCellWave::mergeFaceInfo +template +void Foam::FaceCellWave::mergeFaceInfo ( const polyPatch& patch, const label nFaces, @@ -347,7 +309,7 @@ void Foam::FaceCellWave::mergeFaceInfo Type& currentWallInfo = allFaceInfo_[meshFaceI]; - if (currentWallInfo != neighbourWallInfo) + if (!currentWallInfo.equal(neighbourWallInfo, td_)) { updateFace ( @@ -364,8 +326,8 @@ void Foam::FaceCellWave::mergeFaceInfo // Construct compact patchFace change arrays for a (slice of a) single patch. // changedPatchFaces in local patch numbering. // Return length of arrays. -template -Foam::label Foam::FaceCellWave::getChangedPatchFaces +template +Foam::label Foam::FaceCellWave::getChangedPatchFaces ( const polyPatch& patch, const label startFaceI, @@ -394,8 +356,8 @@ Foam::label Foam::FaceCellWave::getChangedPatchFaces // Handle leaving domain. Implementation referred to Type -template -void Foam::FaceCellWave::leaveDomain +template +void Foam::FaceCellWave::leaveDomain ( const polyPatch& patch, const label nFaces, @@ -410,14 +372,14 @@ void Foam::FaceCellWave::leaveDomain label patchFaceI = faceLabels[i]; label meshFaceI = patch.start() + patchFaceI; - faceInfo[i].leaveDomain(mesh_, patch, patchFaceI, fc[meshFaceI]); + faceInfo[i].leaveDomain(mesh_, patch, patchFaceI, fc[meshFaceI], td_); } } // Handle entering domain. Implementation referred to Type -template -void Foam::FaceCellWave::enterDomain +template +void Foam::FaceCellWave::enterDomain ( const polyPatch& patch, const label nFaces, @@ -432,14 +394,14 @@ void Foam::FaceCellWave::enterDomain label patchFaceI = faceLabels[i]; label meshFaceI = patch.start() + patchFaceI; - faceInfo[i].enterDomain(mesh_, patch, patchFaceI, fc[meshFaceI]); + faceInfo[i].enterDomain(mesh_, patch, patchFaceI, fc[meshFaceI], td_); } } // Transform. Implementation referred to Type -template -void Foam::FaceCellWave::transform +template +void Foam::FaceCellWave::transform ( const tensorField& rotTensor, const label nFaces, @@ -452,22 +414,22 @@ void Foam::FaceCellWave::transform for (label faceI = 0; faceI < nFaces; faceI++) { - faceInfo[faceI].transform(mesh_, T); + faceInfo[faceI].transform(mesh_, T, td_); } } else { for (label faceI = 0; faceI < nFaces; faceI++) { - faceInfo[faceI].transform(mesh_, rotTensor[faceI]); + faceInfo[faceI].transform(mesh_, rotTensor[faceI], td_); } } } // Offset mesh face. Used for transferring from one cyclic half to the other. -template -void Foam::FaceCellWave::offset +template +void Foam::FaceCellWave::offset ( const polyPatch&, const label cycOffset, @@ -483,8 +445,8 @@ void Foam::FaceCellWave::offset // Tranfer all the information to/from neighbouring processors -template -void Foam::FaceCellWave::handleProcPatches() +template +void Foam::FaceCellWave::handleProcPatches() { // Send all @@ -532,7 +494,11 @@ void Foam::FaceCellWave::handleProcPatches() } UOPstream toNeighbour(procPatch.neighbProcNo(), pBufs); - writeFaces(nSendFaces, sendFaces, sendFacesInfo, toNeighbour); + //writeFaces(nSendFaces, sendFaces, sendFacesInfo, toNeighbour); + toNeighbour + << SubList