ENH: InteractionLists. Adding referred walls. Not interacting with

them yet, nor are they transferring data (i.e. velocity field value).
This commit is contained in:
graham
2010-04-12 15:51:58 +01:00
parent 0f47cc05eb
commit 33fa12519d
4 changed files with 388 additions and 89 deletions

View File

@ -224,6 +224,7 @@ void Foam::InteractionLists<ParticleType>::findExtendedProcBbsInRange
template<class ParticleType> template<class ParticleType>
void Foam::InteractionLists<ParticleType>::buildMap void Foam::InteractionLists<ParticleType>::buildMap
( (
autoPtr<mapDistribute>& mapPtr,
const List<label>& toProc const List<label>& toProc
) )
{ {
@ -295,7 +296,7 @@ void Foam::InteractionLists<ParticleType>::buildMap
} }
} }
mapPtr_.reset mapPtr.reset
( (
new mapDistribute new mapDistribute
( (
@ -328,9 +329,9 @@ void Foam::InteractionLists<ParticleType>::prepareParticlesToRefer
forAll(cellIndexAndTransformToDistribute_, i) forAll(cellIndexAndTransformToDistribute_, i)
{ {
const labelPair giat = cellIndexAndTransformToDistribute_[i]; const labelPair ciat = cellIndexAndTransformToDistribute_[i];
label cellIndex = globalTransforms_.index(giat); label cellIndex = globalTransforms_.index(ciat);
List<ParticleType*> realParticles = cellOccupancy[cellIndex]; List<ParticleType*> realParticles = cellOccupancy[cellIndex];
@ -342,7 +343,7 @@ void Foam::InteractionLists<ParticleType>::prepareParticlesToRefer
particlesToRefer.append(particle.clone().ptr()); particlesToRefer.append(particle.clone().ptr());
prepareParticleToBeReferred(particlesToRefer.last(), giat); prepareParticleToBeReferred(particlesToRefer.last(), ciat);
} }
} }
} }
@ -352,12 +353,12 @@ template<class ParticleType>
void Foam::InteractionLists<ParticleType>::prepareParticleToBeReferred void Foam::InteractionLists<ParticleType>::prepareParticleToBeReferred
( (
ParticleType* particle, ParticleType* particle,
labelPair giat labelPair ciat
) )
{ {
const vector& transform = globalTransforms_.transform const vector& transform = globalTransforms_.transform
( (
globalTransforms_.transformIndex(giat) globalTransforms_.transformIndex(ciat)
); );
particle->position() -= transform; particle->position() -= transform;
@ -382,6 +383,40 @@ void Foam::InteractionLists<ParticleType>::fillReferredParticleCloud()
} }
template<class ParticleType>
void Foam::InteractionLists<ParticleType>::writeReferredWallFaces() const
{
OFstream str(mesh_.time().path()/"referredWallFaces.obj");
label offset = 1;
forAll(referredWallFaces_, rWFI)
{
const Tuple2<face, pointField>& rwf = referredWallFaces_[rWFI];
forAll(rwf.first(), fPtI)
{
meshTools::writeOBJ
(
str,
rwf.second()[rwf.first()[fPtI]]
);
}
str<< 'f';
forAll(rwf.first(), fPtI)
{
str<< ' ' << fPtI + offset;
}
str<< nl;
offset += rwf.first().size();
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class ParticleType> template<class ParticleType>
@ -395,14 +430,17 @@ Foam::InteractionLists<ParticleType>::InteractionLists
mesh_(mesh), mesh_(mesh),
cloud_(mesh_, "referredParticleCloud", IDLList<ParticleType>()), cloud_(mesh_, "referredParticleCloud", IDLList<ParticleType>()),
writeCloud_(writeCloud), writeCloud_(writeCloud),
mapPtr_(), cellMapPtr_(),
wallFaceMapPtr_(),
globalTransforms_(mesh_), globalTransforms_(mesh_),
maxDistance_(maxDistance), maxDistance_(maxDistance),
dil_(), dil_(),
directWallFaces_(), dwfil_(),
ril_(), ril_(),
rilInverse_(), rilInverse_(),
cellIndexAndTransformToDistribute_(), cellIndexAndTransformToDistribute_(),
wallFaceIndexAndTransformToDistribute_(),
referredWallFaces_(),
referredParticles_() referredParticles_()
{ {
Info<< "Building InteractionLists" << endl; Info<< "Building InteractionLists" << endl;
@ -461,11 +499,11 @@ Foam::InteractionLists<ParticleType>::InteractionLists
PackedBoolList cellInRangeOfCoupledPatch(mesh_.nCells(), false); PackedBoolList cellInRangeOfCoupledPatch(mesh_.nCells(), false);
// IAndT: index and transform // IAndT: index and transform
DynamicList<labelPair> globalIAndTToExchange; DynamicList<labelPair> cellIAndTToExchange;
DynamicList<treeBoundBox> bbsToExchange; DynamicList<treeBoundBox> cellBbsToExchange;
DynamicList<label> procToDistributeTo; DynamicList<label> procToDistributeCellTo;
forAll(extendedProcBbsInRange, ePBIRI) forAll(extendedProcBbsInRange, ePBIRI)
{ {
@ -487,26 +525,26 @@ Foam::InteractionLists<ParticleType>::InteractionLists
cellInRangeOfCoupledPatch[cellI] = true; cellInRangeOfCoupledPatch[cellI] = true;
globalIAndTToExchange.append cellIAndTToExchange.append
( (
globalTransforms_.encode(cellI, transformIndex) globalTransforms_.encode(cellI, transformIndex)
); );
bbsToExchange.append(cellBb); cellBbsToExchange.append(cellBb);
procToDistributeTo.append(origProc); procToDistributeCellTo.append(origProc);
} }
} }
} }
buildMap(procToDistributeTo); buildMap(cellMapPtr_, procToDistributeCellTo);
// Needed for reverseDistribute // Needed for reverseDistribute
label preDistributionSize = procToDistributeTo.size(); label preDistributionCellMapSize = procToDistributeCellTo.size();
map().distribute(bbsToExchange); cellMap().distribute(cellBbsToExchange);
map().distribute(globalIAndTToExchange); cellMap().distribute(cellIAndTToExchange);
// Determine labelList specifying only cells that are in range of // Determine labelList specifying only cells that are in range of
// a coupled boundary to build an octree limited to these cells. // a coupled boundary to build an octree limited to these cells.
@ -534,27 +572,27 @@ Foam::InteractionLists<ParticleType>::InteractionLists
100.0 100.0
); );
ril_.setSize(bbsToExchange.size()); ril_.setSize(cellBbsToExchange.size());
// This needs to be a boolList, not PackedBoolList if // This needs to be a boolList, not PackedBoolList if
// reverseDistribute is called. // reverseDistribute is called.
boolList bbRequiredByAnyCell(bbsToExchange.size(), false); boolList cellBbRequiredByAnyCell(cellBbsToExchange.size(), false);
Info<< " Building referred interaction lists" << endl; Info<< " Building referred interaction lists" << endl;
forAll(bbsToExchange, bbI) forAll(cellBbsToExchange, bbI)
{ {
const labelPair& giat = globalIAndTToExchange[bbI]; const labelPair& ciat = cellIAndTToExchange[bbI];
const vector& transform = globalTransforms_.transform const vector& transform = globalTransforms_.transform
( (
globalTransforms_.transformIndex(giat) globalTransforms_.transformIndex(ciat)
); );
treeBoundBox extendedBb treeBoundBox extendedBb
( (
bbsToExchange[bbI].min() - interactionVec - transform, cellBbsToExchange[bbI].min() - interactionVec - transform,
bbsToExchange[bbI].max() + interactionVec - transform cellBbsToExchange[bbI].max() + interactionVec - transform
); );
// Find all elements intersecting box. // Find all elements intersecting box.
@ -565,7 +603,7 @@ Foam::InteractionLists<ParticleType>::InteractionLists
if (!interactingElems.empty()) if (!interactingElems.empty())
{ {
bbRequiredByAnyCell[bbI] = true; cellBbRequiredByAnyCell[bbI] = true;
} }
ril_[bbI].setSize(interactingElems.size(), -1); ril_[bbI].setSize(interactingElems.size(), -1);
@ -593,47 +631,47 @@ Foam::InteractionLists<ParticleType>::InteractionLists
// i.e. it, is as if the cell had never been referred in the first // i.e. it, is as if the cell had never been referred in the first
// place. // place.
inplaceSubset(bbRequiredByAnyCell, ril_); inplaceSubset(cellBbRequiredByAnyCell, ril_);
// Send information about which cells are actually required back // Send information about which cells are actually required back
// to originating processors. // to originating processors.
// At this point, bbsToExchange does not need to be maintained // At this point, cellBbsToExchange does not need to be maintained
// or distributed as it is not longer needed. // or distributed as it is not longer needed.
bbsToExchange.setSize(0); cellBbsToExchange.setSize(0);
map().reverseDistribute cellMap().reverseDistribute
( (
preDistributionSize, preDistributionCellMapSize,
bbRequiredByAnyCell cellBbRequiredByAnyCell
); );
map().reverseDistribute cellMap().reverseDistribute
( (
preDistributionSize, preDistributionCellMapSize,
globalIAndTToExchange cellIAndTToExchange
); );
// Perform ordering of cells to send, this invalidates the // Perform ordering of cells to send, this invalidates the
// previous value of preDistributionSize. // previous value of preDistributionCellMapSize.
preDistributionSize = -1; preDistributionCellMapSize = -1;
// Move all of the used cells to refer to the start of the list // Move all of the used cells to refer to the start of the list
// and truncate it // and truncate it
inplaceSubset(bbRequiredByAnyCell, globalIAndTToExchange); inplaceSubset(cellBbRequiredByAnyCell, cellIAndTToExchange);
inplaceSubset(bbRequiredByAnyCell, procToDistributeTo); inplaceSubset(cellBbRequiredByAnyCell, procToDistributeCellTo);
preDistributionSize = procToDistributeTo.size(); preDistributionCellMapSize = procToDistributeCellTo.size();
// Rebuild mapDistribute with only required referred cells // Rebuild mapDistribute with only required referred cells
buildMap(procToDistributeTo); buildMap(cellMapPtr_, procToDistributeCellTo);
// Store cellIndexAndTransformToDistribute // Store cellIndexAndTransformToDistribute
cellIndexAndTransformToDistribute_.transfer(globalIAndTToExchange); cellIndexAndTransformToDistribute_.transfer(cellIAndTToExchange);
// Determine inverse addressing for referred cells // Determine inverse addressing for referred cells
@ -662,9 +700,78 @@ Foam::InteractionLists<ParticleType>::InteractionLists
rilInverse_[cellI].transfer(rilInverseTemp[cellI]); rilInverse_[cellI].transfer(rilInverseTemp[cellI]);
} }
// Direct interaction list and direct wall faces // Determine which wall faces to refer
Info<< " Building direct interaction lists" << endl; // Determine the index of all of the wall faces on this processor
DynamicList<label> localWallFaces;
forAll(mesh_.boundaryMesh(), patchI)
{
const polyPatch& patch = mesh_.boundaryMesh()[patchI];
if (isA<wallPolyPatch>(patch))
{
localWallFaces.append(identity(patch.size()) + patch.start());
}
}
treeBoundBoxList wallFaceBbs(localWallFaces.size());
forAll(wallFaceBbs, i)
{
wallFaceBbs[i] = treeBoundBox
(
mesh_.faces()[localWallFaces[i]].points(mesh_.points())
);
}
// IAndT: index and transform
DynamicList<labelPair> wallFaceIAndTToExchange;
DynamicList<treeBoundBox> wallFaceBbsToExchange;
DynamicList<label> procToDistributeWallFaceTo;
forAll(extendedProcBbsInRange, ePBIRI)
{
const treeBoundBox& otherExtendedProcBb =
extendedProcBbsInRange[ePBIRI];
label transformIndex = extendedProcBbsTransformIndex[ePBIRI];
label origProc = extendedProcBbsOrigProc[ePBIRI];
forAll(wallFaceBbs, i)
{
const treeBoundBox& wallFaceBb = wallFaceBbs[i];
if (wallFaceBb.overlaps(otherExtendedProcBb))
{
// This wall face is in range of the Bb of the other
// processor Bb, and so needs to be referred to it
label wallFaceI = localWallFaces[i];
wallFaceIAndTToExchange.append
(
globalTransforms_.encode(wallFaceI, transformIndex)
);
wallFaceBbsToExchange.append(wallFaceBb);
procToDistributeWallFaceTo.append(origProc);
}
}
}
buildMap(wallFaceMapPtr_, procToDistributeWallFaceTo);
// Needed for reverseDistribute
label preDistributionWallFaceMapSize = procToDistributeWallFaceTo.size();
wallFaceMap().distribute(wallFaceBbsToExchange);
wallFaceMap().distribute(wallFaceIAndTToExchange);
indexedOctree<treeDataCell> allCellsTree indexedOctree<treeDataCell> allCellsTree
( (
@ -675,21 +782,145 @@ Foam::InteractionLists<ParticleType>::InteractionLists
100.0 100.0
); );
DynamicList<label> localWallFaces; rwfil_.setSize(wallFaceBbsToExchange.size());
forAll(mesh.boundaryMesh(), patchI) // This needs to be a boolList, not PackedBoolList if
// reverseDistribute is called.
boolList wallFaceBbRequiredByAnyCell(wallFaceBbsToExchange.size(), false);
forAll(wallFaceBbsToExchange, bbI)
{ {
const polyPatch& patch = mesh.boundaryMesh()[patchI]; const labelPair& wfiat = wallFaceIAndTToExchange[bbI];
if (isA<wallPolyPatch>(patch)) const vector& transform = globalTransforms_.transform
(
globalTransforms_.transformIndex(wfiat)
);
treeBoundBox extendedBb
(
wallFaceBbsToExchange[bbI].min() - interactionVec - transform,
wallFaceBbsToExchange[bbI].max() + interactionVec - transform
);
// Find all elements intersecting box.
labelList interactingElems
(
coupledPatchRangeTree.findBox(extendedBb)
);
if (!interactingElems.empty())
{ {
localWallFaces.append(identity(patch.size()) + patch.start()); wallFaceBbRequiredByAnyCell[bbI] = true;
}
rwfil_[bbI].setSize(interactingElems.size(), -1);
forAll(interactingElems, i)
{
label elemI = interactingElems[i];
// Here, a more detailed geometric test could be applied,
// i.e. a more accurate bounding volume like a OBB or
// convex hull or an exact geometrical test.
label c = coupledPatchRangeTree.shapes().cellLabels()[elemI];
rwfil_[bbI][i] = c;
} }
} }
// Perform subset of rwfil_, to remove any referred wallFaces that do
// not interact. They will not be sent from originating
// processors. This assumes that the disappearance of the wallFace
// from the sending list of the source processor, simply removes
// the referred wallFace from the rwfil_, all of the subsequent indices
// shuffle down one, but the order and structure is preserved,
// i.e. it, is as if the wallFace had never been referred in the first
// place.
inplaceSubset(wallFaceBbRequiredByAnyCell, rwfil_);
// Send information about which wallFaces are actually required
// back to originating processors.
// At this point, wallFaceBbsToExchange does not need to be
// maintained or distributed as it is not longer needed.
wallFaceBbsToExchange.setSize(0);
wallFaceMap().reverseDistribute
(
preDistributionWallFaceMapSize,
wallFaceBbRequiredByAnyCell
);
wallFaceMap().reverseDistribute
(
preDistributionWallFaceMapSize,
wallFaceIAndTToExchange
);
// Perform ordering of wallFaces to send, this invalidates the
// previous value of preDistributionWallFaceMapSize.
preDistributionWallFaceMapSize = -1;
// Move all of the used wallFaces to refer to the start of the
// list and truncate it
inplaceSubset(wallFaceBbRequiredByAnyCell, wallFaceIAndTToExchange);
inplaceSubset(wallFaceBbRequiredByAnyCell, procToDistributeWallFaceTo);
preDistributionWallFaceMapSize = procToDistributeWallFaceTo.size();
// Rebuild mapDistribute with only required referred wallFaces
buildMap(wallFaceMapPtr_, procToDistributeWallFaceTo);
// Store wallFaceIndexAndTransformToDistribute
wallFaceIndexAndTransformToDistribute_.transfer(wallFaceIAndTToExchange);
// Refer wall faces to the appropriate processor
referredWallFaces_.setSize(wallFaceIndexAndTransformToDistribute_.size());
forAll(referredWallFaces_, rwfI)
{
const labelPair& wfiat = wallFaceIndexAndTransformToDistribute_[rwfI];
label wallFaceIndex = globalTransforms_.index(wfiat);
const vector& transform = globalTransforms_.transform
(
globalTransforms_.transformIndex(wfiat)
);
Tuple2<face, pointField>& referredWallFace = referredWallFaces_[rwfI];
const labelList& facePts = mesh_.faces()[wallFaceIndex];
referredWallFace.first() = face(identity(facePts.size()));
referredWallFace.second().setSize(facePts.size());
forAll(facePts, fPtI)
{
referredWallFace.second()[fPtI] =
mesh_.points()[facePts[fPtI]] - transform;
}
}
wallFaceMap().distribute(referredWallFaces_);
writeReferredWallFaces();
// Direct interaction list and direct wall faces
Info<< " Building direct interaction lists" << endl;
indexedOctree<treeDataFace> wallFacesTree indexedOctree<treeDataFace> wallFacesTree
( (
treeDataFace(true, mesh, localWallFaces), treeDataFace(true, mesh_, localWallFaces),
procBbRndExt, procBbRndExt,
8, // maxLevel, 8, // maxLevel,
10, // leafSize, 10, // leafSize,
@ -698,7 +929,7 @@ Foam::InteractionLists<ParticleType>::InteractionLists
dil_.setSize(mesh_.nCells()); dil_.setSize(mesh_.nCells());
directWallFaces_.setSize(mesh.nCells()); dwfil_.setSize(mesh_.nCells());
forAll(cellBbs, cellI) forAll(cellBbs, cellI)
{ {
@ -742,7 +973,7 @@ Foam::InteractionLists<ParticleType>::InteractionLists
// Find all wall faces intersecting extendedBb // Find all wall faces intersecting extendedBb
interactingElems = wallFacesTree.findBox(extendedBb); interactingElems = wallFacesTree.findBox(extendedBb);
directWallFaces_[cellI].setSize(interactingElems.size(), -1); dwfil_[cellI].setSize(interactingElems.size(), -1);
forAll(interactingElems, i) forAll(interactingElems, i)
{ {
@ -750,7 +981,7 @@ Foam::InteractionLists<ParticleType>::InteractionLists
label f = wallFacesTree.shapes().faceLabels()[elemI]; label f = wallFacesTree.shapes().faceLabels()[elemI];
directWallFaces_[cellI][i] = f; dwfil_[cellI][i] = f;
} }
} }
} }
@ -766,7 +997,7 @@ Foam::InteractionLists<ParticleType>::~InteractionLists()
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
template<class ParticleType> template<class ParticleType>
void Foam::InteractionLists<ParticleType>::sendReferredParticles void Foam::InteractionLists<ParticleType>::sendReferredData
( (
const List<DynamicList<ParticleType*> >& cellOccupancy, const List<DynamicList<ParticleType*> >& cellOccupancy,
PstreamBuffers& pBufs PstreamBuffers& pBufs
@ -774,14 +1005,12 @@ void Foam::InteractionLists<ParticleType>::sendReferredParticles
{ {
prepareParticlesToRefer(cellOccupancy); prepareParticlesToRefer(cellOccupancy);
// Stream data into buffer
for (label domain = 0; domain < Pstream::nProcs(); domain++) for (label domain = 0; domain < Pstream::nProcs(); domain++)
{ {
const labelList& subMap = map().subMap()[domain]; const labelList& subMap = cellMap().subMap()[domain];
if (subMap.size()) if (subMap.size())
{ {
// Put data into send buffer
UOPstream toDomain(domain, pBufs); UOPstream toDomain(domain, pBufs);
UIndirectList<IDLList<ParticleType> > subMappedParticles UIndirectList<IDLList<ParticleType> > subMappedParticles
@ -803,18 +1032,18 @@ void Foam::InteractionLists<ParticleType>::sendReferredParticles
template<class ParticleType> template<class ParticleType>
void Foam::InteractionLists<ParticleType>::receiveReferredParticles void Foam::InteractionLists<ParticleType>::receiveReferredData
( (
PstreamBuffers& pBufs PstreamBuffers& pBufs
) )
{ {
Pstream::waitRequests(); Pstream::waitRequests();
referredParticles_.setSize(map().constructSize()); referredParticles_.setSize(cellMap().constructSize());
for (label domain = 0; domain < Pstream::nProcs(); domain++) for (label domain = 0; domain < Pstream::nProcs(); domain++)
{ {
const labelList& constructMap = map().constructMap()[domain]; const labelList& constructMap = cellMap().constructMap()[domain];
if (constructMap.size()) if (constructMap.size())
{ {

View File

@ -38,9 +38,9 @@ Description
@verbatim @verbatim
PstreamBuffers pBufs(Pstream::nonBlocking); PstreamBuffers pBufs(Pstream::nonBlocking);
il_.sendReferredParticles(cellOccupancy_, pBufs); il_.sendReferredData(cellOccupancy_, pBufs);
// Do other things // Do other things
il_.receiveReferredParticles(pBufs); il_.receiveReferredData(pBufs);
@endverbatim @endverbatim
Requiring data: Requiring data:
@ -62,6 +62,7 @@ SourceFiles
#include "polyMesh.H" #include "polyMesh.H"
#include "globalIndexAndTransform.H" #include "globalIndexAndTransform.H"
#include "indexedOctree.H" #include "indexedOctree.H"
#include "Tuple2.H"
#include "treeDataCell.H" #include "treeDataCell.H"
#include "treeDataFace.H" #include "treeDataFace.H"
#include "mapDistribute.H" #include "mapDistribute.H"
@ -91,8 +92,11 @@ class InteractionLists
// with the referred particles, hence gets written out // with the referred particles, hence gets written out
const Switch writeCloud_; const Switch writeCloud_;
//- mapDistribute to exchange particles //- mapDistribute to exchange referred particles into referred cells
autoPtr<mapDistribute> mapPtr_; autoPtr<mapDistribute> cellMapPtr_;
//- mapDistribute to exchange wall face data
autoPtr<mapDistribute> wallFaceMapPtr_;
//- Storage and encoding/decoding for all possible transforms //- Storage and encoding/decoding for all possible transforms
// of the geometry // of the geometry
@ -105,12 +109,12 @@ class InteractionLists
labelListList dil_; labelListList dil_;
//- Wall faces on this processor that are in interaction range //- Wall faces on this processor that are in interaction range
// of each each cell // of each each cell (direct wall face interaction list)
labelListList directWallFaces_; labelListList dwfil_;
//- Referred interaction list - which real cells are to be //- Referred interaction list - which real cells are to be
// supplied with particles from the referred particle // supplied with particle interactions from the referred
// container with the same index. // particle container with the same index.
labelListList ril_; labelListList ril_;
//- Inverse addressing for referred cells, specifies which //- Inverse addressing for referred cells, specifies which
@ -119,10 +123,22 @@ class InteractionLists
// indexed in this container. // indexed in this container.
labelListList rilInverse_; labelListList rilInverse_;
//- Which cells are to be sent via the map, and an index //- Which real cells on this on this processor are in
// interaction range of each referred wall face (referred
// wall face interaction list)
labelListList rwfil_;
//- Which cells are to be sent via the cellMap, and an index
// specifying how they should be transformed. // specifying how they should be transformed.
List<labelPair> cellIndexAndTransformToDistribute_; List<labelPair> cellIndexAndTransformToDistribute_;
//- Which wallFaces are to be sent via the wallFaceMap, and an index
// specifying how they should be transformed.
List<labelPair> wallFaceIndexAndTransformToDistribute_;
//- Referred wall faces
List<Tuple2<face, pointField> > referredWallFaces_;
//- Referred particle container //- Referred particle container
List<IDLList<ParticleType> > referredParticles_; List<IDLList<ParticleType> > referredParticles_;
@ -141,8 +157,13 @@ class InteractionLists
List<label>& extendedProcBbsOrigProc List<label>& extendedProcBbsOrigProc
); );
//- Build the mapDistribute //- Build the mapDistribute from information about which entry
void buildMap(const List<label>& toProc); // is to be sent to which processor
void buildMap
(
autoPtr<mapDistribute>& mapPtr,
const List<label>& toProc
);
//- Fill the referredParticles container with particles that //- Fill the referredParticles container with particles that
// will be referred // will be referred
@ -155,12 +176,15 @@ class InteractionLists
void prepareParticleToBeReferred void prepareParticleToBeReferred
( (
ParticleType* particle, ParticleType* particle,
labelPair giat labelPair iat
); );
//- Fill the referredParticles so that it will be written out //- Fill the referredParticles so that it will be written out
void fillReferredParticleCloud(); void fillReferredParticleCloud();
//- Write the referred wall faces out for debug
void writeReferredWallFaces() const;
//- Disallow default bitwise copy construct //- Disallow default bitwise copy construct
InteractionLists(const InteractionLists&); InteractionLists(const InteractionLists&);
@ -187,23 +211,28 @@ public:
// Member Functions // Member Functions
//- Prepare and send referred particles, nonBlocking communication //- Prepare and send referred particles and wall data,
void sendReferredParticles // nonBlocking communication
void sendReferredData
( (
const List<DynamicList<ParticleType*> >& cellOccupancy, const List<DynamicList<ParticleType*> >& cellOccupancy,
PstreamBuffers& pBufs PstreamBuffers& pBufs
); );
//- Receive referred particles //- Receive referred data
void receiveReferredParticles(PstreamBuffers& pBufs); void receiveReferredData(PstreamBuffers& pBufs);
// Access // Access
//- Return access to the mesh //- Return access to the mesh
inline const polyMesh& mesh() const; inline const polyMesh& mesh() const;
//- Return access to the mapDistribute //- Return access to the cellMap
inline const mapDistribute& map() const; inline const mapDistribute& cellMap() const;
//- Return access to the wallFaceMap
inline const mapDistribute& wallFaceMap() const;
//- Return access to the globalTransforms //- Return access to the globalTransforms
inline const globalIndexAndTransform& globalTransforms() const; inline const globalIndexAndTransform& globalTransforms() const;
@ -211,8 +240,8 @@ public:
//- Return access to the direct interaction list //- Return access to the direct interaction list
inline const labelListList& dil() const; inline const labelListList& dil() const;
//- Return access to the direct wall faces //- Return access to the direct wall face interaction list
inline const labelListList& directWallFaces() const; inline const labelListList& dwfil() const;
//- Return access to the referred interaction list //- Return access to the referred interaction list
inline const labelListList& ril() const; inline const labelListList& ril() const;
@ -220,16 +249,27 @@ public:
//- Return access to the inverse referred interaction list //- Return access to the inverse referred interaction list
inline const labelListList& rilInverse() const; inline const labelListList& rilInverse() const;
//- Return access to the referred wall face interaction list
inline const labelListList& rwfil() const;
//- Return access to the cellIndexAndTransformToDistribute list //- Return access to the cellIndexAndTransformToDistribute list
inline const List<labelPair>& inline const List<labelPair>&
cellIndexAndTransformToDistribute() const; cellIndexAndTransformToDistribute() const;
//- Return access to the wallFaceIndexAndTransformToDistribute list
inline const List<labelPair>&
wallFaceIndexAndTransformToDistribute() const;
//- Return access to the referred wall faces
const List<Tuple2<face, pointField> >& referredWallFaces() const;
//- Return access to the referred particle container //- Return access to the referred particle container
inline const List<IDLList<ParticleType> >& inline const List<IDLList<ParticleType> >&
referredParticles() const; referredParticles() const;
//- Return non-const access to the referred particle container //- Return non-const access to the referred particle container
inline List<IDLList<ParticleType> >& referredParticles(); inline List<IDLList<ParticleType> >& referredParticles();
}; };

View File

@ -36,9 +36,17 @@ const Foam::polyMesh& Foam::InteractionLists<ParticleType>::mesh() const
template<class ParticleType> template<class ParticleType>
const Foam::mapDistribute& const Foam::mapDistribute&
Foam::InteractionLists<ParticleType>::map() const Foam::InteractionLists<ParticleType>::cellMap() const
{ {
return mapPtr_(); return cellMapPtr_();
}
template<class ParticleType>
const Foam::mapDistribute&
Foam::InteractionLists<ParticleType>::wallFaceMap() const
{
return wallFaceMapPtr_();
} }
@ -59,9 +67,9 @@ const Foam::labelListList& Foam::InteractionLists<ParticleType>::dil() const
template<class ParticleType> template<class ParticleType>
const Foam::labelListList& const Foam::labelListList&
Foam::InteractionLists<ParticleType>::directWallFaces() const Foam::InteractionLists<ParticleType>::dwfil() const
{ {
return directWallFaces_; return dwfil_;
} }
@ -72,6 +80,13 @@ const Foam::labelListList& Foam::InteractionLists<ParticleType>::ril() const
} }
template<class ParticleType>
const Foam::labelListList& Foam::InteractionLists<ParticleType>::rwfil() const
{
return rwfil_;
}
template<class ParticleType> template<class ParticleType>
const Foam::List<Foam::labelPair>& const Foam::List<Foam::labelPair>&
Foam::InteractionLists<ParticleType>::cellIndexAndTransformToDistribute() const Foam::InteractionLists<ParticleType>::cellIndexAndTransformToDistribute() const
@ -80,6 +95,15 @@ Foam::InteractionLists<ParticleType>::cellIndexAndTransformToDistribute() const
} }
template<class ParticleType>
const Foam::List<Foam::labelPair>&
Foam::InteractionLists<ParticleType>::
wallFaceIndexAndTransformToDistribute() const
{
return wallFaceIndexAndTransformToDistribute_;
}
template<class ParticleType> template<class ParticleType>
const Foam::labelListList& const Foam::labelListList&
Foam::InteractionLists<ParticleType>::rilInverse() const Foam::InteractionLists<ParticleType>::rilInverse() const
@ -88,6 +112,14 @@ Foam::InteractionLists<ParticleType>::rilInverse() const
} }
template<class ParticleType>
const Foam::List<Foam::Tuple2<Foam::face, Foam::pointField> >&
Foam::InteractionLists<ParticleType>::referredWallFaces() const
{
return referredWallFaces_;
}
template<class ParticleType> template<class ParticleType>
const Foam::List<Foam::IDLList<ParticleType> >& const Foam::List<Foam::IDLList<ParticleType> >&
Foam::InteractionLists<ParticleType>::referredParticles() const Foam::InteractionLists<ParticleType>::referredParticles() const
@ -104,6 +136,4 @@ Foam::InteractionLists<ParticleType>::referredParticles()
} }
// ************************************************************************* // // ************************************************************************* //

View File

@ -61,11 +61,11 @@ void Foam::PairCollision<CloudType>::parcelInteraction()
{ {
PstreamBuffers pBufs(Pstream::nonBlocking); PstreamBuffers pBufs(Pstream::nonBlocking);
il_.sendReferredParticles(cellOccupancy_, pBufs); il_.sendReferredData(cellOccupancy_, pBufs);
realRealInteraction(); realRealInteraction();
il_.receiveReferredParticles(pBufs); il_.receiveReferredData(pBufs);
realReferredInteraction(); realReferredInteraction();
} }
@ -173,7 +173,7 @@ void Foam::PairCollision<CloudType>::wallInteraction()
const labelListList& dil = il_.dil(); const labelListList& dil = il_.dil();
const labelListList directWallFaces = il_.directWallFaces(); const labelListList directWallFaces = il_.dwfil();
// const ReferredCellList<typename CloudType::parcelType>& ril = il_.ril(); // const ReferredCellList<typename CloudType::parcelType>& ril = il_.ril();