Make point wave work with GGI
This commit is contained in:
parent
5891662bc3
commit
929414b804
3 changed files with 282 additions and 5 deletions
|
@ -28,6 +28,7 @@ License
|
||||||
#include "polyMesh.H"
|
#include "polyMesh.H"
|
||||||
#include "processorPolyPatch.H"
|
#include "processorPolyPatch.H"
|
||||||
#include "cyclicPolyPatch.H"
|
#include "cyclicPolyPatch.H"
|
||||||
|
#include "ggiPolyPatch.H"
|
||||||
#include "OPstream.H"
|
#include "OPstream.H"
|
||||||
#include "IPstream.H"
|
#include "IPstream.H"
|
||||||
#include "PstreamCombineReduceOps.H"
|
#include "PstreamCombineReduceOps.H"
|
||||||
|
@ -359,6 +360,9 @@ void Foam::PointEdgeWave<Type>::getChangedPatchPoints
|
||||||
if (changedPoint_[meshPointI])
|
if (changedPoint_[meshPointI])
|
||||||
{
|
{
|
||||||
patchInfo.append(allPointInfo_[meshPointI]);
|
patchInfo.append(allPointInfo_[meshPointI]);
|
||||||
|
|
||||||
|
//Pout << "Sending " << meshPointI << " " << mesh_.points()[meshPointI] << " o = " << patchInfo[patchInfo.size()-1].origin() << " " << allPointInfo_[meshPointI] << endl;
|
||||||
|
|
||||||
patchPoints.append(patchPointI);
|
patchPoints.append(patchPointI);
|
||||||
|
|
||||||
label patchFaceI = pointFaces[patchPointI][0];
|
label patchFaceI = pointFaces[patchPointI][0];
|
||||||
|
@ -678,6 +682,235 @@ void Foam::PointEdgeWave<Type>::handleCyclicPatches()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Update overall for changed patch points
|
||||||
|
template <class Type>
|
||||||
|
void Foam::PointEdgeWave<Type>::updateFromPatchInfo
|
||||||
|
(
|
||||||
|
const ggiPolyPatch& to,
|
||||||
|
const labelListList& shadowAddr,
|
||||||
|
const labelList& owner,
|
||||||
|
const labelList& ownerIndex,
|
||||||
|
List<Type>& patchInfo
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//const labelList& meshPoints = to.meshPoints();
|
||||||
|
const pointField& points = to.points();
|
||||||
|
const List<face>& allFaces = mesh_.allFaces();
|
||||||
|
|
||||||
|
forAll(patchInfo, i)
|
||||||
|
{
|
||||||
|
label fID = to.shadow().zone()[owner[i]];
|
||||||
|
label pID = allFaces[fID][ownerIndex[i]];
|
||||||
|
point p = points[pID];
|
||||||
|
|
||||||
|
// Update in sending zone without propagation
|
||||||
|
if(fID >= mesh_.nFaces())
|
||||||
|
{
|
||||||
|
allPointInfo_[pID].updatePoint
|
||||||
|
(
|
||||||
|
mesh_,
|
||||||
|
pID,
|
||||||
|
patchInfo[i],
|
||||||
|
propagationTol_
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const labelList& addr = shadowAddr[owner[i]];
|
||||||
|
|
||||||
|
if(addr.size() > 0)
|
||||||
|
{
|
||||||
|
label nearestPoint = -1;
|
||||||
|
label nearestFace = -1;
|
||||||
|
scalar dist = GREAT;
|
||||||
|
|
||||||
|
forAll(addr, saI)
|
||||||
|
{
|
||||||
|
label fID2 = to.zone()[addr[saI]];
|
||||||
|
|
||||||
|
const face& f = allFaces[fID2];
|
||||||
|
forAll(f, pI)
|
||||||
|
{
|
||||||
|
label pID2 = f[pI];
|
||||||
|
|
||||||
|
scalar d = magSqr(points[pID2] - p);
|
||||||
|
|
||||||
|
if(d < dist)
|
||||||
|
{
|
||||||
|
nearestFace = fID2;
|
||||||
|
nearestPoint = pID2;
|
||||||
|
dist = d;
|
||||||
|
}
|
||||||
|
else if(nearestPoint == pID2 && fID2 < mesh_.nFaces())
|
||||||
|
{
|
||||||
|
// Choose face in patch over face in zone
|
||||||
|
nearestFace = fID2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
patchInfo[i].enterDomain(to, nearestPoint, points[nearestPoint]);
|
||||||
|
|
||||||
|
if(nearestFace < mesh_.nFaces())
|
||||||
|
{
|
||||||
|
// Update in receiving patch with propagation
|
||||||
|
updatePoint
|
||||||
|
(
|
||||||
|
nearestPoint,
|
||||||
|
patchInfo[i],
|
||||||
|
propagationTol_,
|
||||||
|
allPointInfo_[nearestPoint]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Update in receiving zone without propagation
|
||||||
|
allPointInfo_[nearestPoint].updatePoint
|
||||||
|
(
|
||||||
|
mesh_,
|
||||||
|
nearestPoint,
|
||||||
|
patchInfo[i],
|
||||||
|
propagationTol_
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Transfer all the information to/from neighbouring processors
|
||||||
|
template <class Type>
|
||||||
|
void Foam::PointEdgeWave<Type>::handleGgiPatches()
|
||||||
|
{
|
||||||
|
forAll(mesh_.boundaryMesh(), patchI)
|
||||||
|
{
|
||||||
|
const polyPatch& patch = mesh_.boundaryMesh()[patchI];
|
||||||
|
|
||||||
|
if (isA<ggiPolyPatch>(patch))
|
||||||
|
{
|
||||||
|
const ggiPolyPatch& master = refCast<const ggiPolyPatch>(patch);
|
||||||
|
const ggiPolyPatch& slave = master.shadow();
|
||||||
|
|
||||||
|
if(master.master() && (master.localParallel() || master.size()))
|
||||||
|
{
|
||||||
|
// 1. Collect all point info on master side
|
||||||
|
DynamicList<Type> masterInfo(master.nPoints());
|
||||||
|
DynamicList<label> masterOwner(master.nPoints());
|
||||||
|
DynamicList<label> masterOwnerIndex(master.nPoints());
|
||||||
|
|
||||||
|
{
|
||||||
|
DynamicList<label> patchPoints(master.nPoints());
|
||||||
|
|
||||||
|
// Get all changed points in relative addressing
|
||||||
|
getChangedPatchPoints
|
||||||
|
(
|
||||||
|
master,
|
||||||
|
masterInfo,
|
||||||
|
patchPoints,
|
||||||
|
masterOwner,
|
||||||
|
masterOwnerIndex
|
||||||
|
);
|
||||||
|
|
||||||
|
forAll(masterOwner, i)
|
||||||
|
{
|
||||||
|
masterOwner[i] =
|
||||||
|
master.zoneAddressing()[masterOwner[i]];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Adapt for leaving domain
|
||||||
|
leaveDomain(master, master, patchPoints, masterInfo);
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Pout<< "Ggi patch " << master.index() << ' ' << master.name()
|
||||||
|
<< " Sending:" << masterInfo.size() << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. Collect all point info on slave side
|
||||||
|
DynamicList<Type> slaveInfo(slave.nPoints());
|
||||||
|
DynamicList<label> slaveOwner(slave.nPoints());
|
||||||
|
DynamicList<label> slaveOwnerIndex(slave.nPoints());
|
||||||
|
|
||||||
|
{
|
||||||
|
DynamicList<label> patchPoints(slave.nPoints());
|
||||||
|
|
||||||
|
// Get all changed points in relative addressing
|
||||||
|
getChangedPatchPoints
|
||||||
|
(
|
||||||
|
slave,
|
||||||
|
slaveInfo,
|
||||||
|
patchPoints,
|
||||||
|
slaveOwner,
|
||||||
|
slaveOwnerIndex
|
||||||
|
);
|
||||||
|
|
||||||
|
forAll(slaveOwner, i)
|
||||||
|
{
|
||||||
|
slaveOwner[i] =
|
||||||
|
slave.zoneAddressing()[slaveOwner[i]];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Adapt for leaving domain
|
||||||
|
leaveDomain(slave, slave, patchPoints, slaveInfo);
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Pout<< "Ggi patch " << slave.index() << ' ' << slave.name()
|
||||||
|
<< " Sending:" << slaveInfo.size() << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!master.localParallel())
|
||||||
|
{
|
||||||
|
combineReduce(masterInfo, listAppendOp<Type>());
|
||||||
|
combineReduce(slaveInfo, listAppendOp<Type>());
|
||||||
|
combineReduce(masterOwner, listAppendOp<label>());
|
||||||
|
combineReduce(slaveOwner, listAppendOp<label>());
|
||||||
|
combineReduce(masterOwnerIndex, listAppendOp<label>());
|
||||||
|
combineReduce(slaveOwnerIndex, listAppendOp<label>());
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. Apply point info on master & slave side
|
||||||
|
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Pout<< "Ggi patch " << slave.index() << ' ' << slave.name()
|
||||||
|
<< " Received:" << masterInfo.size() << endl;
|
||||||
|
Pout<< "Ggi patch " << master.index() << ' ' << master.name()
|
||||||
|
<< " Received:" << slaveInfo.size() << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Apply transform to received data for non-parallel planes
|
||||||
|
if (!master.parallel())
|
||||||
|
{
|
||||||
|
transform(master.forwardT(), masterInfo);
|
||||||
|
transform(slave.forwardT(), slaveInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
updateFromPatchInfo
|
||||||
|
(
|
||||||
|
slave,
|
||||||
|
master.patchToPatch().masterAddr(),
|
||||||
|
masterOwner,
|
||||||
|
masterOwnerIndex,
|
||||||
|
masterInfo
|
||||||
|
);
|
||||||
|
|
||||||
|
updateFromPatchInfo
|
||||||
|
(
|
||||||
|
master,
|
||||||
|
master.patchToPatch().slaveAddr(),
|
||||||
|
slaveOwner,
|
||||||
|
slaveOwnerIndex,
|
||||||
|
slaveInfo
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
// Iterate, propagating changedPointsInfo across mesh, until no change (or
|
// Iterate, propagating changedPointsInfo across mesh, until no change (or
|
||||||
|
@ -705,12 +938,17 @@ Foam::PointEdgeWave<Type>::PointEdgeWave
|
||||||
changedEdges_(mesh_.nEdges()),
|
changedEdges_(mesh_.nEdges()),
|
||||||
nChangedEdges_(0),
|
nChangedEdges_(0),
|
||||||
nCyclicPatches_(countPatchType<cyclicPolyPatch>()),
|
nCyclicPatches_(countPatchType<cyclicPolyPatch>()),
|
||||||
|
nGgiPatches_(countPatchType<ggiPolyPatch>()),
|
||||||
cycHalves_(2*nCyclicPatches_),
|
cycHalves_(2*nCyclicPatches_),
|
||||||
nEvals_(0),
|
nEvals_(0),
|
||||||
nUnvisitedPoints_(mesh_.nPoints()),
|
nUnvisitedPoints_(mesh_.nPoints()),
|
||||||
nUnvisitedEdges_(mesh_.nEdges())
|
nUnvisitedEdges_(mesh_.nEdges())
|
||||||
{
|
{
|
||||||
if (allPointInfo_.size() != mesh_.nPoints())
|
if
|
||||||
|
(
|
||||||
|
allPointInfo_.size() != mesh_.nPoints()
|
||||||
|
&& allPointInfo_.size() != mesh_.allPoints().size()
|
||||||
|
)
|
||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
|
@ -887,6 +1125,11 @@ Foam::label Foam::PointEdgeWave<Type>::edgeToPoint()
|
||||||
// Transfer changed points across cyclic halves
|
// Transfer changed points across cyclic halves
|
||||||
handleCyclicPatches();
|
handleCyclicPatches();
|
||||||
}
|
}
|
||||||
|
if (nGgiPatches_ > 0)
|
||||||
|
{
|
||||||
|
// Transfer changed points across cyclic halves
|
||||||
|
handleGgiPatches();
|
||||||
|
}
|
||||||
if (Pstream::parRun())
|
if (Pstream::parRun())
|
||||||
{
|
{
|
||||||
// Transfer changed points from neighbouring processors.
|
// Transfer changed points from neighbouring processors.
|
||||||
|
@ -985,6 +1228,11 @@ Foam::label Foam::PointEdgeWave<Type>::iterate(const label maxIter)
|
||||||
// Transfer changed points across cyclic halves
|
// Transfer changed points across cyclic halves
|
||||||
handleCyclicPatches();
|
handleCyclicPatches();
|
||||||
}
|
}
|
||||||
|
if (nGgiPatches_ > 0)
|
||||||
|
{
|
||||||
|
// Transfer changed points across ggi patches
|
||||||
|
handleGgiPatches();
|
||||||
|
}
|
||||||
if (Pstream::parRun())
|
if (Pstream::parRun())
|
||||||
{
|
{
|
||||||
// Transfer changed points from neighbouring processors.
|
// Transfer changed points from neighbouring processors.
|
||||||
|
|
|
@ -74,7 +74,7 @@ namespace Foam
|
||||||
|
|
||||||
// Forward declaration of classes
|
// Forward declaration of classes
|
||||||
class polyMesh;
|
class polyMesh;
|
||||||
|
class ggiPolyPatch;
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class PointEdgeWaveName Declaration
|
Class PointEdgeWaveName Declaration
|
||||||
|
@ -128,6 +128,9 @@ class PointEdgeWave
|
||||||
//- Number of cyclic patches
|
//- Number of cyclic patches
|
||||||
bool nCyclicPatches_;
|
bool nCyclicPatches_;
|
||||||
|
|
||||||
|
//- Number of cyclic patches
|
||||||
|
bool nGgiPatches_;
|
||||||
|
|
||||||
//- For every cyclic patch two primitivePatches
|
//- For every cyclic patch two primitivePatches
|
||||||
PtrList<primitivePatch> cycHalves_;
|
PtrList<primitivePatch> cycHalves_;
|
||||||
|
|
||||||
|
@ -228,6 +231,16 @@ class PointEdgeWave
|
||||||
List<Type>& patchInfo
|
List<Type>& patchInfo
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//- Merge data from patch into overall data
|
||||||
|
void updateFromPatchInfo
|
||||||
|
(
|
||||||
|
const ggiPolyPatch& to,
|
||||||
|
const labelListList& addr,
|
||||||
|
const labelList& owner,
|
||||||
|
const labelList& ownerIndex,
|
||||||
|
List<Type>& patchInfo
|
||||||
|
);
|
||||||
|
|
||||||
//- Merge data from across processor boundaries
|
//- Merge data from across processor boundaries
|
||||||
void handleProcPatches();
|
void handleProcPatches();
|
||||||
|
|
||||||
|
@ -237,6 +250,9 @@ class PointEdgeWave
|
||||||
//- Merge data from across cyclic boundaries
|
//- Merge data from across cyclic boundaries
|
||||||
void handleCyclicPatches();
|
void handleCyclicPatches();
|
||||||
|
|
||||||
|
//- Merge data from across cyclic boundaries
|
||||||
|
void handleGgiPatches();
|
||||||
|
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
//- Disallow default bitwise copy construct
|
||||||
PointEdgeWave(const PointEdgeWave&);
|
PointEdgeWave(const PointEdgeWave&);
|
||||||
|
@ -351,8 +367,21 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
|
//- List update operation
|
||||||
|
template <class Type>
|
||||||
|
class listAppendOp
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
void operator()(List<Type>& x, const List<Type>& y) const
|
||||||
|
{
|
||||||
|
x.append(y);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|
|
@ -232,7 +232,7 @@ inline bool Foam::pointEdgePoint::updatePoint
|
||||||
return
|
return
|
||||||
update
|
update
|
||||||
(
|
(
|
||||||
mesh.points()[pointI],
|
mesh.allPoints()[pointI],
|
||||||
edgeInfo,
|
edgeInfo,
|
||||||
tol
|
tol
|
||||||
);
|
);
|
||||||
|
@ -251,7 +251,7 @@ inline bool Foam::pointEdgePoint::updatePoint
|
||||||
return
|
return
|
||||||
update
|
update
|
||||||
(
|
(
|
||||||
mesh.points()[pointI],
|
mesh.allPoints()[pointI],
|
||||||
newPointInfo,
|
newPointInfo,
|
||||||
tol
|
tol
|
||||||
);
|
);
|
||||||
|
|
Reference in a new issue