mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
COMP: Multiple changes - first clean build after latest merge - UNTESTED
This commit is contained in:
@ -2,8 +2,8 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -49,10 +49,11 @@ int Foam::FaceCellWave<Type, TrackingData>::dummyTrackData_ = 12345;
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
//- Combine operator for AMIInterpolation
|
||||
template<class Type, class TrackingData>
|
||||
class combine
|
||||
{
|
||||
//- Combine operator for AMIInterpolation
|
||||
|
||||
FaceCellWave<Type, TrackingData>& solver_;
|
||||
|
||||
const cyclicAMIPolyPatch& patch_;
|
||||
@ -73,26 +74,26 @@ namespace Foam
|
||||
void operator()
|
||||
(
|
||||
Type& x,
|
||||
const label faceI,
|
||||
const label facei,
|
||||
const Type& y,
|
||||
const scalar weight
|
||||
) const
|
||||
{
|
||||
if (y.valid(solver_.data()))
|
||||
{
|
||||
label meshFaceI = -1;
|
||||
label meshFacei = -1;
|
||||
if (patch_.owner())
|
||||
{
|
||||
meshFaceI = patch_.start() + faceI;
|
||||
meshFacei = patch_.start() + facei;
|
||||
}
|
||||
else
|
||||
{
|
||||
meshFaceI = patch_.neighbPatch().start() + faceI;
|
||||
meshFacei = patch_.neighbPatch().start() + facei;
|
||||
}
|
||||
x.updateFace
|
||||
(
|
||||
solver_.mesh(),
|
||||
meshFaceI,
|
||||
meshFacei,
|
||||
y,
|
||||
solver_.propagationTol(),
|
||||
solver_.data()
|
||||
@ -103,24 +104,24 @@ 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<class Type, class TrackingData>
|
||||
bool Foam::FaceCellWave<Type, TrackingData>::updateCell
|
||||
(
|
||||
const label cellI,
|
||||
const label neighbourFaceI,
|
||||
const label celli,
|
||||
const label neighbourFacei,
|
||||
const Type& neighbourInfo,
|
||||
const scalar tol,
|
||||
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_);
|
||||
@ -129,8 +130,8 @@ bool Foam::FaceCellWave<Type, TrackingData>::updateCell
|
||||
cellInfo.updateCell
|
||||
(
|
||||
mesh_,
|
||||
cellI,
|
||||
neighbourFaceI,
|
||||
celli,
|
||||
neighbourFacei,
|
||||
neighbourInfo,
|
||||
tol,
|
||||
td_
|
||||
@ -138,10 +139,10 @@ bool Foam::FaceCellWave<Type, TrackingData>::updateCell
|
||||
|
||||
if (propagate)
|
||||
{
|
||||
if (!changedCell_[cellI])
|
||||
if (!changedCell_[celli])
|
||||
{
|
||||
changedCell_[cellI] = true;
|
||||
changedCells_[nChangedCells_++] = cellI;
|
||||
changedCell_[celli] = true;
|
||||
changedCells_.append(celli);
|
||||
}
|
||||
}
|
||||
|
||||
@ -154,21 +155,22 @@ bool Foam::FaceCellWave<Type, TrackingData>::updateCell
|
||||
}
|
||||
|
||||
|
||||
// Update info for faceI, at position pt, with information from
|
||||
// neighbouring face/cell.
|
||||
// Updates:
|
||||
// - changedFace_, changedFaces_, nChangedFaces_,
|
||||
// - statistics: nEvals_, nUnvisitedFaces_
|
||||
template<class Type, class TrackingData>
|
||||
bool Foam::FaceCellWave<Type, TrackingData>::updateFace
|
||||
(
|
||||
const label faceI,
|
||||
const label neighbourCellI,
|
||||
const label facei,
|
||||
const label neighbourCelli,
|
||||
const Type& neighbourInfo,
|
||||
const scalar tol,
|
||||
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_);
|
||||
@ -177,8 +179,8 @@ bool Foam::FaceCellWave<Type, TrackingData>::updateFace
|
||||
faceInfo.updateFace
|
||||
(
|
||||
mesh_,
|
||||
faceI,
|
||||
neighbourCellI,
|
||||
facei,
|
||||
neighbourCelli,
|
||||
neighbourInfo,
|
||||
tol,
|
||||
td_
|
||||
@ -186,10 +188,10 @@ bool Foam::FaceCellWave<Type, TrackingData>::updateFace
|
||||
|
||||
if (propagate)
|
||||
{
|
||||
if (!changedFace_[faceI])
|
||||
if (!changedFace_[facei])
|
||||
{
|
||||
changedFace_[faceI] = true;
|
||||
changedFaces_[nChangedFaces_++] = faceI;
|
||||
changedFace_[facei] = true;
|
||||
changedFaces_.append(facei);
|
||||
}
|
||||
}
|
||||
|
||||
@ -202,20 +204,21 @@ bool Foam::FaceCellWave<Type, TrackingData>::updateFace
|
||||
}
|
||||
|
||||
|
||||
// Update info for faceI, at position pt, with information from
|
||||
// same face.
|
||||
// Updates:
|
||||
// - changedFace_, changedFaces_, nChangedFaces_,
|
||||
// - statistics: nEvals_, nUnvisitedFaces_
|
||||
template<class Type, class TrackingData>
|
||||
bool Foam::FaceCellWave<Type, TrackingData>::updateFace
|
||||
(
|
||||
const label faceI,
|
||||
const label facei,
|
||||
const Type& neighbourInfo,
|
||||
const scalar tol,
|
||||
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_);
|
||||
@ -224,7 +227,7 @@ bool Foam::FaceCellWave<Type, TrackingData>::updateFace
|
||||
faceInfo.updateFace
|
||||
(
|
||||
mesh_,
|
||||
faceI,
|
||||
facei,
|
||||
neighbourInfo,
|
||||
tol,
|
||||
td_
|
||||
@ -232,10 +235,10 @@ bool Foam::FaceCellWave<Type, TrackingData>::updateFace
|
||||
|
||||
if (propagate)
|
||||
{
|
||||
if (!changedFace_[faceI])
|
||||
if (!changedFace_[facei])
|
||||
{
|
||||
changedFace_[faceI] = true;
|
||||
changedFaces_[nChangedFaces_++] = faceI;
|
||||
changedFace_[facei] = true;
|
||||
changedFaces_.append(facei);
|
||||
}
|
||||
}
|
||||
|
||||
@ -248,20 +251,21 @@ bool Foam::FaceCellWave<Type, TrackingData>::updateFace
|
||||
}
|
||||
|
||||
|
||||
// For debugging: check status on both sides of cyclic
|
||||
template<class Type, class TrackingData>
|
||||
void Foam::FaceCellWave<Type, TrackingData>::checkCyclic
|
||||
(
|
||||
const polyPatch& patch
|
||||
) const
|
||||
{
|
||||
// For debugging: check status on both sides of cyclic
|
||||
|
||||
const cyclicPolyPatch& nbrPatch =
|
||||
refCast<const cyclicPolyPatch>(patch).neighbPatch();
|
||||
|
||||
forAll(patch, patchFaceI)
|
||||
forAll(patch, patchFacei)
|
||||
{
|
||||
label i1 = patch.start() + patchFaceI;
|
||||
label i2 = nbrPatch.start() + patchFaceI;
|
||||
label i1 = patch.start() + patchFacei;
|
||||
label i2 = nbrPatch.start() + patchFacei;
|
||||
|
||||
if
|
||||
(
|
||||
@ -293,14 +297,13 @@ void Foam::FaceCellWave<Type, TrackingData>::checkCyclic
|
||||
}
|
||||
|
||||
|
||||
// Check if has cyclic patches
|
||||
template<class Type, class TrackingData>
|
||||
template<class PatchType>
|
||||
bool Foam::FaceCellWave<Type, TrackingData>::hasPatch() const
|
||||
{
|
||||
forAll(mesh_.boundaryMesh(), patchI)
|
||||
forAll(mesh_.boundaryMesh(), patchi)
|
||||
{
|
||||
if (isA<PatchType>(mesh_.boundaryMesh()[patchI]))
|
||||
if (isA<PatchType>(mesh_.boundaryMesh()[patchi]))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -309,7 +312,6 @@ bool Foam::FaceCellWave<Type, TrackingData>::hasPatch() const
|
||||
}
|
||||
|
||||
|
||||
// Copy face information into member data
|
||||
template<class Type, class TrackingData>
|
||||
void Foam::FaceCellWave<Type, TrackingData>::setFaceInfo
|
||||
(
|
||||
@ -317,30 +319,29 @@ void Foam::FaceCellWave<Type, TrackingData>::setFaceInfo
|
||||
const List<Type>& changedFacesInfo
|
||||
)
|
||||
{
|
||||
forAll(changedFaces, changedFaceI)
|
||||
forAll(changedFaces, changedFacei)
|
||||
{
|
||||
label faceI = changedFaces[changedFaceI];
|
||||
label facei = changedFaces[changedFacei];
|
||||
|
||||
bool wasValid = allFaceInfo_[faceI].valid(td_);
|
||||
bool wasValid = allFaceInfo_[facei].valid(td_);
|
||||
|
||||
// Copy info for faceI
|
||||
allFaceInfo_[faceI] = changedFacesInfo[changedFaceI];
|
||||
// Copy info for facei
|
||||
allFaceInfo_[facei] = changedFacesInfo[changedFacei];
|
||||
|
||||
// Maintain count of unset faces
|
||||
if (!wasValid && allFaceInfo_[faceI].valid(td_))
|
||||
if (!wasValid && allFaceInfo_[facei].valid(td_))
|
||||
{
|
||||
--nUnvisitedFaces_;
|
||||
}
|
||||
|
||||
// Mark faceI as changed, both on list and on face itself.
|
||||
// Mark facei as changed, both on list and on face itself.
|
||||
|
||||
changedFace_[faceI] = true;
|
||||
changedFaces_[nChangedFaces_++] = faceI;
|
||||
changedFace_[facei] = true;
|
||||
changedFaces_.append(facei);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Merge face information into member data
|
||||
template<class Type, class TrackingData>
|
||||
void Foam::FaceCellWave<Type, TrackingData>::mergeFaceInfo
|
||||
(
|
||||
@ -350,20 +351,22 @@ void Foam::FaceCellWave<Type, TrackingData>::mergeFaceInfo
|
||||
const List<Type>& changedFacesInfo
|
||||
)
|
||||
{
|
||||
for (label changedFaceI = 0; changedFaceI < nFaces; changedFaceI++)
|
||||
// Merge face information into member data
|
||||
|
||||
for (label changedFacei = 0; changedFacei < nFaces; changedFacei++)
|
||||
{
|
||||
const Type& neighbourWallInfo = changedFacesInfo[changedFaceI];
|
||||
label patchFaceI = changedFaces[changedFaceI];
|
||||
const Type& neighbourWallInfo = changedFacesInfo[changedFacei];
|
||||
label patchFacei = changedFaces[changedFacei];
|
||||
|
||||
label meshFaceI = patch.start() + patchFaceI;
|
||||
label meshFacei = patch.start() + patchFacei;
|
||||
|
||||
Type& currentWallInfo = allFaceInfo_[meshFaceI];
|
||||
Type& currentWallInfo = allFaceInfo_[meshFacei];
|
||||
|
||||
if (!currentWallInfo.equal(neighbourWallInfo, td_))
|
||||
{
|
||||
updateFace
|
||||
(
|
||||
meshFaceI,
|
||||
meshFacei,
|
||||
neighbourWallInfo,
|
||||
propagationTol_,
|
||||
currentWallInfo
|
||||
@ -373,31 +376,31 @@ void Foam::FaceCellWave<Type, TrackingData>::mergeFaceInfo
|
||||
}
|
||||
|
||||
|
||||
// Construct compact patchFace change arrays for a (slice of a) single patch.
|
||||
// changedPatchFaces in local patch numbering.
|
||||
// Return length of arrays.
|
||||
template<class Type, class TrackingData>
|
||||
Foam::label Foam::FaceCellWave<Type, TrackingData>::getChangedPatchFaces
|
||||
(
|
||||
const polyPatch& patch,
|
||||
const label startFaceI,
|
||||
const label startFacei,
|
||||
const label nFaces,
|
||||
labelList& changedPatchFaces,
|
||||
List<Type>& 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++)
|
||||
{
|
||||
label patchFaceI = i + startFaceI;
|
||||
label patchFacei = i + startFacei;
|
||||
|
||||
label meshFaceI = patch.start() + patchFaceI;
|
||||
label meshFacei = patch.start() + patchFacei;
|
||||
|
||||
if (changedFace_[meshFaceI])
|
||||
if (changedFace_[meshFacei])
|
||||
{
|
||||
changedPatchFaces[nChangedPatchFaces] = patchFaceI;
|
||||
changedPatchFacesInfo[nChangedPatchFaces] = allFaceInfo_[meshFaceI];
|
||||
changedPatchFaces[nChangedPatchFaces] = patchFacei;
|
||||
changedPatchFacesInfo[nChangedPatchFaces] = allFaceInfo_[meshFacei];
|
||||
nChangedPatchFaces++;
|
||||
}
|
||||
}
|
||||
@ -405,7 +408,6 @@ Foam::label Foam::FaceCellWave<Type, TrackingData>::getChangedPatchFaces
|
||||
}
|
||||
|
||||
|
||||
// Handle leaving domain. Implementation referred to Type
|
||||
template<class Type, class TrackingData>
|
||||
void Foam::FaceCellWave<Type, TrackingData>::leaveDomain
|
||||
(
|
||||
@ -415,19 +417,20 @@ void Foam::FaceCellWave<Type, TrackingData>::leaveDomain
|
||||
List<Type>& faceInfo
|
||||
) const
|
||||
{
|
||||
// Handle leaving domain. Implementation referred to Type
|
||||
|
||||
const vectorField& fc = mesh_.faceCentres();
|
||||
|
||||
for (label i = 0; i < nFaces; i++)
|
||||
{
|
||||
label patchFaceI = faceLabels[i];
|
||||
label patchFacei = faceLabels[i];
|
||||
|
||||
label meshFaceI = patch.start() + patchFaceI;
|
||||
faceInfo[i].leaveDomain(mesh_, patch, patchFaceI, fc[meshFaceI], td_);
|
||||
label meshFacei = patch.start() + patchFacei;
|
||||
faceInfo[i].leaveDomain(mesh_, patch, patchFacei, fc[meshFacei], td_);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Handle entering domain. Implementation referred to Type
|
||||
template<class Type, class TrackingData>
|
||||
void Foam::FaceCellWave<Type, TrackingData>::enterDomain
|
||||
(
|
||||
@ -437,19 +440,20 @@ void Foam::FaceCellWave<Type, TrackingData>::enterDomain
|
||||
List<Type>& faceInfo
|
||||
) const
|
||||
{
|
||||
// Handle entering domain. Implementation referred to Type
|
||||
|
||||
const vectorField& fc = mesh_.faceCentres();
|
||||
|
||||
for (label i = 0; i < nFaces; i++)
|
||||
{
|
||||
label patchFaceI = faceLabels[i];
|
||||
label patchFacei = faceLabels[i];
|
||||
|
||||
label meshFaceI = patch.start() + patchFaceI;
|
||||
faceInfo[i].enterDomain(mesh_, patch, patchFaceI, fc[meshFaceI], td_);
|
||||
label meshFacei = patch.start() + patchFacei;
|
||||
faceInfo[i].enterDomain(mesh_, patch, patchFacei, fc[meshFacei], td_);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Transform. Implementation referred to Type
|
||||
template<class Type, class TrackingData>
|
||||
void Foam::FaceCellWave<Type, TrackingData>::transform
|
||||
(
|
||||
@ -458,26 +462,27 @@ void Foam::FaceCellWave<Type, TrackingData>::transform
|
||||
List<Type>& faceInfo
|
||||
)
|
||||
{
|
||||
// Transform. Implementation referred to Type
|
||||
|
||||
if (rotTensor.size() == 1)
|
||||
{
|
||||
const tensor& T = rotTensor[0];
|
||||
|
||||
for (label faceI = 0; faceI < nFaces; faceI++)
|
||||
for (label facei = 0; facei < nFaces; facei++)
|
||||
{
|
||||
faceInfo[faceI].transform(mesh_, T, td_);
|
||||
faceInfo[facei].transform(mesh_, T, td_);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (label faceI = 0; faceI < nFaces; faceI++)
|
||||
for (label facei = 0; facei < nFaces; facei++)
|
||||
{
|
||||
faceInfo[faceI].transform(mesh_, rotTensor[faceI], td_);
|
||||
faceInfo[facei].transform(mesh_, rotTensor[facei], td_);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Offset mesh face. Used for transferring from one cyclic half to the other.
|
||||
template<class Type, class TrackingData>
|
||||
void Foam::FaceCellWave<Type, TrackingData>::offset
|
||||
(
|
||||
@ -487,17 +492,21 @@ void Foam::FaceCellWave<Type, TrackingData>::offset
|
||||
labelList& faces
|
||||
)
|
||||
{
|
||||
for (label faceI = 0; faceI < nFaces; faceI++)
|
||||
// Offset mesh face. Used for transferring from one cyclic half to the
|
||||
// other.
|
||||
|
||||
for (label facei = 0; facei < nFaces; facei++)
|
||||
{
|
||||
faces[faceI] += cycOffset;
|
||||
faces[facei] += cycOffset;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Tranfer all the information to/from neighbouring processors
|
||||
template<class Type, class TrackingData>
|
||||
void Foam::FaceCellWave<Type, TrackingData>::handleProcPatches()
|
||||
{
|
||||
// Tranfer all the information to/from neighbouring processors
|
||||
|
||||
const globalMeshData& pData = mesh_.globalData();
|
||||
|
||||
// Which patches are processor patches
|
||||
@ -509,10 +518,10 @@ void Foam::FaceCellWave<Type, TrackingData>::handleProcPatches()
|
||||
|
||||
forAll(procPatches, i)
|
||||
{
|
||||
label patchI = procPatches[i];
|
||||
label patchi = procPatches[i];
|
||||
|
||||
const processorPolyPatch& procPatch =
|
||||
refCast<const processorPolyPatch>(mesh_.boundaryMesh()[patchI]);
|
||||
refCast<const processorPolyPatch>(mesh_.boundaryMesh()[patchi]);
|
||||
|
||||
// Allocate buffers
|
||||
label nSendFaces;
|
||||
@ -540,7 +549,7 @@ void Foam::FaceCellWave<Type, TrackingData>::handleProcPatches()
|
||||
|
||||
if (debug & 2)
|
||||
{
|
||||
Pout<< " Processor patch " << patchI << ' ' << procPatch.name()
|
||||
Pout<< " Processor patch " << patchi << ' ' << procPatch.name()
|
||||
<< " communicating with " << procPatch.neighbProcNo()
|
||||
<< " Sending:" << nSendFaces
|
||||
<< endl;
|
||||
@ -559,10 +568,10 @@ void Foam::FaceCellWave<Type, TrackingData>::handleProcPatches()
|
||||
|
||||
forAll(procPatches, i)
|
||||
{
|
||||
label patchI = procPatches[i];
|
||||
label patchi = procPatches[i];
|
||||
|
||||
const processorPolyPatch& procPatch =
|
||||
refCast<const processorPolyPatch>(mesh_.boundaryMesh()[patchI]);
|
||||
refCast<const processorPolyPatch>(mesh_.boundaryMesh()[patchi]);
|
||||
|
||||
// Allocate buffers
|
||||
labelList receiveFaces;
|
||||
@ -575,7 +584,7 @@ void Foam::FaceCellWave<Type, TrackingData>::handleProcPatches()
|
||||
|
||||
if (debug & 2)
|
||||
{
|
||||
Pout<< " Processor patch " << patchI << ' ' << procPatch.name()
|
||||
Pout<< " Processor patch " << patchi << ' ' << procPatch.name()
|
||||
<< " communicating with " << procPatch.neighbProcNo()
|
||||
<< " Receiving:" << receiveFaces.size()
|
||||
<< endl;
|
||||
@ -613,13 +622,14 @@ void Foam::FaceCellWave<Type, TrackingData>::handleProcPatches()
|
||||
}
|
||||
|
||||
|
||||
// Transfer information across cyclic halves.
|
||||
template<class Type, class TrackingData>
|
||||
void Foam::FaceCellWave<Type, TrackingData>::handleCyclicPatches()
|
||||
{
|
||||
forAll(mesh_.boundaryMesh(), patchI)
|
||||
// Transfer information across cyclic halves.
|
||||
|
||||
forAll(mesh_.boundaryMesh(), patchi)
|
||||
{
|
||||
const polyPatch& patch = mesh_.boundaryMesh()[patchI];
|
||||
const polyPatch& patch = mesh_.boundaryMesh()[patchi];
|
||||
|
||||
if (isA<cyclicPolyPatch>(patch))
|
||||
{
|
||||
@ -666,7 +676,7 @@ void Foam::FaceCellWave<Type, TrackingData>::handleCyclicPatches()
|
||||
|
||||
if (debug & 2)
|
||||
{
|
||||
Pout<< " Cyclic patch " << patchI << ' ' << cycPatch.name()
|
||||
Pout<< " Cyclic patch " << patchi << ' ' << cycPatch.name()
|
||||
<< " Changed : " << nReceiveFaces
|
||||
<< endl;
|
||||
}
|
||||
@ -698,13 +708,14 @@ void Foam::FaceCellWave<Type, TrackingData>::handleCyclicPatches()
|
||||
}
|
||||
|
||||
|
||||
// Transfer information across cyclic halves.
|
||||
template<class Type, class TrackingData>
|
||||
void Foam::FaceCellWave<Type, TrackingData>::handleAMICyclicPatches()
|
||||
{
|
||||
forAll(mesh_.boundaryMesh(), patchI)
|
||||
// Transfer information across cyclicAMI halves.
|
||||
|
||||
forAll(mesh_.boundaryMesh(), patchi)
|
||||
{
|
||||
const polyPatch& patch = mesh_.boundaryMesh()[patchI];
|
||||
const polyPatch& patch = mesh_.boundaryMesh()[patchi];
|
||||
|
||||
if (isA<cyclicAMIPolyPatch>(patch))
|
||||
{
|
||||
@ -778,9 +789,9 @@ void Foam::FaceCellWave<Type, TrackingData>::handleAMICyclicPatches()
|
||||
// Merge into global storage
|
||||
forAll(receiveInfo, i)
|
||||
{
|
||||
label meshFaceI = cycPatch.start()+i;
|
||||
label meshFacei = cycPatch.start()+i;
|
||||
|
||||
Type& currentWallInfo = allFaceInfo_[meshFaceI];
|
||||
Type& currentWallInfo = allFaceInfo_[meshFacei];
|
||||
|
||||
if
|
||||
(
|
||||
@ -790,7 +801,7 @@ void Foam::FaceCellWave<Type, TrackingData>::handleAMICyclicPatches()
|
||||
{
|
||||
updateFace
|
||||
(
|
||||
meshFaceI,
|
||||
meshFacei,
|
||||
receiveInfo[i],
|
||||
propagationTol_,
|
||||
currentWallInfo
|
||||
@ -877,7 +888,6 @@ void Foam::FaceCellWave<Type, TrackingData>::handleExplicitConnections()
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
// Set up only. Use setFaceInfo and iterate() to do actual calculation.
|
||||
template<class Type, class TrackingData>
|
||||
Foam::FaceCellWave<Type, TrackingData>::FaceCellWave
|
||||
(
|
||||
@ -894,10 +904,8 @@ Foam::FaceCellWave<Type, TrackingData>::FaceCellWave
|
||||
td_(td),
|
||||
changedFace_(mesh_.nFaces(), false),
|
||||
changedFaces_(mesh_.nFaces()),
|
||||
nChangedFaces_(0),
|
||||
changedCell_(mesh_.nCells(), false),
|
||||
changedCells_(mesh_.nCells()),
|
||||
nChangedCells_(0),
|
||||
hasCyclicPatches_(hasPatch<cyclicPolyPatch>()),
|
||||
hasCyclicAMIPatches_
|
||||
(
|
||||
@ -925,8 +933,6 @@ Foam::FaceCellWave<Type, TrackingData>::FaceCellWave
|
||||
}
|
||||
|
||||
|
||||
// Iterate, propagating changedFacesInfo across mesh, until no change (or
|
||||
// maxIter reached). Initial cell values specified.
|
||||
template<class Type, class TrackingData>
|
||||
Foam::FaceCellWave<Type, TrackingData>::FaceCellWave
|
||||
(
|
||||
@ -946,10 +952,8 @@ Foam::FaceCellWave<Type, TrackingData>::FaceCellWave
|
||||
td_(td),
|
||||
changedFace_(mesh_.nFaces(), false),
|
||||
changedFaces_(mesh_.nFaces()),
|
||||
nChangedFaces_(0),
|
||||
changedCell_(mesh_.nCells(), false),
|
||||
changedCells_(mesh_.nCells()),
|
||||
nChangedCells_(0),
|
||||
hasCyclicPatches_(hasPatch<cyclicPolyPatch>()),
|
||||
hasCyclicAMIPatches_
|
||||
(
|
||||
@ -986,20 +990,18 @@ Foam::FaceCellWave<Type, TrackingData>::FaceCellWave
|
||||
FatalErrorInFunction
|
||||
<< "Maximum number of iterations reached. Increase maxIter." << endl
|
||||
<< " maxIter:" << maxIter << endl
|
||||
<< " nChangedCells:" << nChangedCells_ << endl
|
||||
<< " nChangedFaces:" << nChangedFaces_ << endl
|
||||
<< " nChangedCells:" << changedCells_.size() << endl
|
||||
<< " nChangedFaces:" << changedFaces_.size() << endl
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Iterate, propagating changedFacesInfo across mesh, until no change (or
|
||||
// maxIter reached). Initial cell values specified.
|
||||
template<class Type, class TrackingData>
|
||||
Foam::FaceCellWave<Type, TrackingData>::FaceCellWave
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const List<labelPair>& explicitConnections,
|
||||
const labelPairList& explicitConnections,
|
||||
const bool handleCyclicAMI,
|
||||
const labelList& changedFaces,
|
||||
const List<Type>& changedFacesInfo,
|
||||
@ -1016,10 +1018,8 @@ Foam::FaceCellWave<Type, TrackingData>::FaceCellWave
|
||||
td_(td),
|
||||
changedFace_(mesh_.nFaces(), false),
|
||||
changedFaces_(mesh_.nFaces()),
|
||||
nChangedFaces_(0),
|
||||
changedCell_(mesh_.nCells(), false),
|
||||
changedCells_(mesh_.nCells()),
|
||||
nChangedCells_(0),
|
||||
hasCyclicPatches_(hasPatch<cyclicPolyPatch>()),
|
||||
hasCyclicAMIPatches_
|
||||
(
|
||||
@ -1057,8 +1057,8 @@ Foam::FaceCellWave<Type, TrackingData>::FaceCellWave
|
||||
FatalErrorInFunction
|
||||
<< "Maximum number of iterations reached. Increase maxIter." << endl
|
||||
<< " maxIter:" << maxIter << endl
|
||||
<< " nChangedCells:" << nChangedCells_ << endl
|
||||
<< " nChangedFaces:" << nChangedFaces_ << endl
|
||||
<< " nChangedCells:" << changedCells_.size() << endl
|
||||
<< " nChangedFaces:" << changedFaces_.size() << endl
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
@ -1066,7 +1066,6 @@ Foam::FaceCellWave<Type, TrackingData>::FaceCellWave
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
template<class Type, class TrackingData>
|
||||
Foam::label Foam::FaceCellWave<Type, TrackingData>::getUnsetCells() const
|
||||
{
|
||||
@ -1081,46 +1080,41 @@ Foam::label Foam::FaceCellWave<Type, TrackingData>::getUnsetFaces() const
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Propagate cell to face
|
||||
template<class Type, class TrackingData>
|
||||
Foam::label Foam::FaceCellWave<Type, TrackingData>::faceToCell()
|
||||
{
|
||||
// Propagate face to cell
|
||||
|
||||
const labelList& owner = mesh_.faceOwner();
|
||||
const labelList& neighbour = mesh_.faceNeighbour();
|
||||
label nInternalFaces = mesh_.nInternalFaces();
|
||||
|
||||
for
|
||||
(
|
||||
label changedFaceI = 0;
|
||||
changedFaceI < nChangedFaces_;
|
||||
changedFaceI++
|
||||
)
|
||||
forAll(changedFaces_, changedFacei)
|
||||
{
|
||||
label faceI = changedFaces_[changedFaceI];
|
||||
if (!changedFace_[faceI])
|
||||
label facei = changedFaces_[changedFacei];
|
||||
if (!changedFace_[facei])
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Face " << faceI
|
||||
<< "Face " << facei
|
||||
<< " not marked as having been changed"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
|
||||
const Type& neighbourWallInfo = allFaceInfo_[faceI];
|
||||
const Type& neighbourWallInfo = allFaceInfo_[facei];
|
||||
|
||||
// Evaluate all connected cells
|
||||
|
||||
// Owner
|
||||
label cellI = owner[faceI];
|
||||
Type& currentWallInfo = allCellInfo_[cellI];
|
||||
label celli = owner[facei];
|
||||
Type& currentWallInfo = allCellInfo_[celli];
|
||||
|
||||
if (!currentWallInfo.equal(neighbourWallInfo, td_))
|
||||
{
|
||||
updateCell
|
||||
(
|
||||
cellI,
|
||||
faceI,
|
||||
celli,
|
||||
facei,
|
||||
neighbourWallInfo,
|
||||
propagationTol_,
|
||||
currentWallInfo
|
||||
@ -1128,17 +1122,17 @@ Foam::label Foam::FaceCellWave<Type, TrackingData>::faceToCell()
|
||||
}
|
||||
|
||||
// Neighbour.
|
||||
if (faceI < nInternalFaces)
|
||||
if (facei < nInternalFaces)
|
||||
{
|
||||
cellI = neighbour[faceI];
|
||||
Type& currentWallInfo2 = allCellInfo_[cellI];
|
||||
celli = neighbour[facei];
|
||||
Type& currentWallInfo2 = allCellInfo_[celli];
|
||||
|
||||
if (!currentWallInfo2.equal(neighbourWallInfo, td_))
|
||||
{
|
||||
updateCell
|
||||
(
|
||||
cellI,
|
||||
faceI,
|
||||
celli,
|
||||
facei,
|
||||
neighbourWallInfo,
|
||||
propagationTol_,
|
||||
currentWallInfo2
|
||||
@ -1147,19 +1141,19 @@ Foam::label Foam::FaceCellWave<Type, TrackingData>::faceToCell()
|
||||
}
|
||||
|
||||
// Reset status of face
|
||||
changedFace_[faceI] = false;
|
||||
changedFace_[facei] = false;
|
||||
}
|
||||
|
||||
// Handled all changed faces by now
|
||||
nChangedFaces_ = 0;
|
||||
changedFaces_.clear();
|
||||
|
||||
if (debug & 2)
|
||||
{
|
||||
Pout<< " Changed cells : " << nChangedCells_ << endl;
|
||||
Pout<< " Changed cells : " << changedCells_.size() << endl;
|
||||
}
|
||||
|
||||
// Sum nChangedCells over all procs
|
||||
label totNChanged = nChangedCells_;
|
||||
// Sum changedCells over all procs
|
||||
label totNChanged = changedCells_.size();
|
||||
|
||||
reduce(totNChanged, sumOp<label>());
|
||||
|
||||
@ -1167,43 +1161,39 @@ Foam::label Foam::FaceCellWave<Type, TrackingData>::faceToCell()
|
||||
}
|
||||
|
||||
|
||||
// Propagate cell to face
|
||||
template<class Type, class TrackingData>
|
||||
Foam::label Foam::FaceCellWave<Type, TrackingData>::cellToFace()
|
||||
{
|
||||
// Propagate cell to face
|
||||
|
||||
const cellList& cells = mesh_.cells();
|
||||
|
||||
for
|
||||
(
|
||||
label changedCellI = 0;
|
||||
changedCellI < nChangedCells_;
|
||||
changedCellI++
|
||||
)
|
||||
forAll(changedCells_, changedCelli)
|
||||
{
|
||||
label cellI = changedCells_[changedCellI];
|
||||
if (!changedCell_[cellI])
|
||||
label celli = changedCells_[changedCelli];
|
||||
if (!changedCell_[celli])
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Cell " << cellI << " not marked as having been changed"
|
||||
<< "Cell " << celli << " not marked as having been changed"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
const Type& neighbourWallInfo = allCellInfo_[cellI];
|
||||
const Type& neighbourWallInfo = allCellInfo_[celli];
|
||||
|
||||
// Evaluate all connected faces
|
||||
|
||||
const labelList& faceLabels = cells[cellI];
|
||||
const labelList& faceLabels = cells[celli];
|
||||
forAll(faceLabels, faceLabelI)
|
||||
{
|
||||
label faceI = faceLabels[faceLabelI];
|
||||
Type& currentWallInfo = allFaceInfo_[faceI];
|
||||
label facei = faceLabels[faceLabelI];
|
||||
Type& currentWallInfo = allFaceInfo_[facei];
|
||||
|
||||
if (!currentWallInfo.equal(neighbourWallInfo, td_))
|
||||
{
|
||||
updateFace
|
||||
(
|
||||
faceI,
|
||||
cellI,
|
||||
facei,
|
||||
celli,
|
||||
neighbourWallInfo,
|
||||
propagationTol_,
|
||||
currentWallInfo
|
||||
@ -1212,11 +1202,11 @@ Foam::label Foam::FaceCellWave<Type, TrackingData>::cellToFace()
|
||||
}
|
||||
|
||||
// Reset status of cell
|
||||
changedCell_[cellI] = false;
|
||||
changedCell_[celli] = false;
|
||||
}
|
||||
|
||||
// Handled all changed cells by now
|
||||
nChangedCells_ = 0;
|
||||
changedCells_.clear();
|
||||
|
||||
|
||||
// Transfer across any explicitly provided internal connections
|
||||
@ -1241,11 +1231,11 @@ Foam::label Foam::FaceCellWave<Type, TrackingData>::cellToFace()
|
||||
|
||||
if (debug & 2)
|
||||
{
|
||||
Pout<< " Changed faces : " << nChangedFaces_ << endl;
|
||||
Pout<< " Changed faces : " << changedFaces_.size() << endl;
|
||||
}
|
||||
|
||||
// Sum nChangedFaces over all procs
|
||||
label totNChanged = nChangedFaces_;
|
||||
label totNChanged = changedFaces_.size();
|
||||
|
||||
reduce(totNChanged, sumOp<label>());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user