diff --git a/src/meshTools/algorithms/MeshWave/FaceCellWave.C b/src/meshTools/algorithms/MeshWave/FaceCellWave.C index d073ee572b..8518350e80 100644 --- a/src/meshTools/algorithms/MeshWave/FaceCellWave.C +++ b/src/meshTools/algorithms/MeshWave/FaceCellWave.C @@ -49,10 +49,11 @@ int Foam::FaceCellWave::dummyTrackData_ = 12345; namespace Foam { - //- Combine operator for AMIInterpolation template class combine { + //- Combine operator for AMIInterpolation + FaceCellWave& solver_; const cyclicAMIPolyPatch& patch_; @@ -103,14 +104,8 @@ namespace Foam } - // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -// Update info for celli, at position pt, with information from -// neighbouring face/cell. -// Updates: -// - changedCell_, changedCells_, nChangedCells_, -// - statistics: nEvals_, nUnvisitedCells_ template bool Foam::FaceCellWave::updateCell ( @@ -121,6 +116,12 @@ bool Foam::FaceCellWave::updateCell Type& cellInfo ) { + // Update info for celli, at position pt, with information from + // neighbouring face/cell. + // Updates: + // - changedCell_, changedCells_ + // - statistics: nEvals_, nUnvisitedCells_ + nEvals_++; bool wasValid = cellInfo.valid(td_); @@ -141,7 +142,7 @@ bool Foam::FaceCellWave::updateCell if (!changedCell_[celli]) { changedCell_[celli] = true; - changedCells_[nChangedCells_++] = celli; + changedCells_.append(celli); } } @@ -154,11 +155,6 @@ bool Foam::FaceCellWave::updateCell } -// Update info for facei, at position pt, with information from -// neighbouring face/cell. -// Updates: -// - changedFace_, changedFaces_, nChangedFaces_, -// - statistics: nEvals_, nUnvisitedFaces_ template bool Foam::FaceCellWave::updateFace ( @@ -169,6 +165,12 @@ bool Foam::FaceCellWave::updateFace Type& faceInfo ) { + // Update info for facei, at position pt, with information from + // neighbouring face/cell. + // Updates: + // - changedFace_, changedFaces_, + // - statistics: nEvals_, nUnvisitedFaces_ + nEvals_++; bool wasValid = faceInfo.valid(td_); @@ -189,7 +191,7 @@ bool Foam::FaceCellWave::updateFace if (!changedFace_[facei]) { changedFace_[facei] = true; - changedFaces_[nChangedFaces_++] = facei; + changedFaces_.append(facei); } } @@ -202,11 +204,6 @@ bool Foam::FaceCellWave::updateFace } -// Update info for facei, at position pt, with information from -// same face. -// Updates: -// - changedFace_, changedFaces_, nChangedFaces_, -// - statistics: nEvals_, nUnvisitedFaces_ template bool Foam::FaceCellWave::updateFace ( @@ -216,6 +213,12 @@ bool Foam::FaceCellWave::updateFace Type& faceInfo ) { + // Update info for facei, at position pt, with information from + // same face. + // Updates: + // - changedFace_, changedFaces_, + // - statistics: nEvals_, nUnvisitedFaces_ + nEvals_++; bool wasValid = faceInfo.valid(td_); @@ -235,7 +238,7 @@ bool Foam::FaceCellWave::updateFace if (!changedFace_[facei]) { changedFace_[facei] = true; - changedFaces_[nChangedFaces_++] = facei; + changedFaces_.append(facei); } } @@ -248,13 +251,14 @@ bool Foam::FaceCellWave::updateFace } -// For debugging: check status on both sides of cyclic template void Foam::FaceCellWave::checkCyclic ( const polyPatch& patch ) const { + // For debugging: check status on both sides of cyclic + const cyclicPolyPatch& nbrPatch = refCast(patch).neighbPatch(); @@ -293,7 +297,6 @@ void Foam::FaceCellWave::checkCyclic } -// Check if has cyclic patches template template bool Foam::FaceCellWave::hasPatch() const @@ -309,7 +312,6 @@ bool Foam::FaceCellWave::hasPatch() const } -// Copy face information into member data template void Foam::FaceCellWave::setFaceInfo ( @@ -335,12 +337,11 @@ void Foam::FaceCellWave::setFaceInfo // Mark facei as changed, both on list and on face itself. changedFace_[facei] = true; - changedFaces_[nChangedFaces_++] = facei; + changedFaces_.append(facei); } } -// Merge face information into member data template void Foam::FaceCellWave::mergeFaceInfo ( @@ -350,6 +351,8 @@ void Foam::FaceCellWave::mergeFaceInfo const List& changedFacesInfo ) { + // Merge face information into member data + for (label changedFacei = 0; changedFacei < nFaces; changedFacei++) { const Type& neighbourWallInfo = changedFacesInfo[changedFacei]; @@ -373,9 +376,6 @@ 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 ( @@ -386,6 +386,9 @@ Foam::label Foam::FaceCellWave::getChangedPatchFaces List& changedPatchFacesInfo ) const { + // Construct compact patchFace change arrays for a (slice of a) single + // patch. changedPatchFaces in local patch numbering. + // Return length of arrays. label nChangedPatchFaces = 0; for (label i = 0; i < nFaces; i++) @@ -405,7 +408,6 @@ Foam::label Foam::FaceCellWave::getChangedPatchFaces } -// Handle leaving domain. Implementation referred to Type template void Foam::FaceCellWave::leaveDomain ( @@ -415,6 +417,8 @@ void Foam::FaceCellWave::leaveDomain List& faceInfo ) const { + // Handle leaving domain. Implementation referred to Type + const vectorField& fc = mesh_.faceCentres(); for (label i = 0; i < nFaces; i++) @@ -427,7 +431,6 @@ void Foam::FaceCellWave::leaveDomain } -// Handle entering domain. Implementation referred to Type template void Foam::FaceCellWave::enterDomain ( @@ -437,6 +440,8 @@ void Foam::FaceCellWave::enterDomain List& faceInfo ) const { + // Handle entering domain. Implementation referred to Type + const vectorField& fc = mesh_.faceCentres(); for (label i = 0; i < nFaces; i++) @@ -449,7 +454,6 @@ void Foam::FaceCellWave::enterDomain } -// Transform. Implementation referred to Type template void Foam::FaceCellWave::transform ( @@ -458,6 +462,8 @@ void Foam::FaceCellWave::transform List& faceInfo ) { + // Transform. Implementation referred to Type + if (rotTensor.size() == 1) { const tensor& T = rotTensor[0]; @@ -477,7 +483,6 @@ void Foam::FaceCellWave::transform } -// Offset mesh face. Used for transferring from one cyclic half to the other. template void Foam::FaceCellWave::offset ( @@ -487,6 +492,9 @@ void Foam::FaceCellWave::offset labelList& faces ) { + // Offset mesh face. Used for transferring from one cyclic half to the + // other. + for (label facei = 0; facei < nFaces; facei++) { faces[facei] += cycOffset; @@ -494,10 +502,11 @@ void Foam::FaceCellWave::offset } -// Tranfer all the information to/from neighbouring processors template void Foam::FaceCellWave::handleProcPatches() { + // Tranfer all the information to/from neighbouring processors + const globalMeshData& pData = mesh_.globalData(); // Which patches are processor patches @@ -613,10 +622,11 @@ void Foam::FaceCellWave::handleProcPatches() } -// Transfer information across cyclic halves. template void Foam::FaceCellWave::handleCyclicPatches() { + // Transfer information across cyclic halves. + forAll(mesh_.boundaryMesh(), patchi) { const polyPatch& patch = mesh_.boundaryMesh()[patchi]; @@ -698,10 +708,11 @@ void Foam::FaceCellWave::handleCyclicPatches() } -// Transfer information across cyclic halves. template void Foam::FaceCellWave::handleAMICyclicPatches() { + // Transfer information across cyclicAMI halves. + forAll(mesh_.boundaryMesh(), patchi) { const polyPatch& patch = mesh_.boundaryMesh()[patchi]; @@ -802,9 +813,81 @@ void Foam::FaceCellWave::handleAMICyclicPatches() } +template +void Foam::FaceCellWave::handleExplicitConnections() +{ + // Collect changed information + + DynamicList