Newer
Older
const labelPair& wfiat = wallFaceIndexAndTransformToDistribute_[rWVI];
label wallFaceIndex = globalTransforms_.index(wfiat);
const vectorTensorTransform& transform = globalTransforms_.transform
(
globalTransforms_.transformIndex(wfiat)
);
label patchI = mesh_.boundaryMesh().patchID()
[
wallFaceIndex - mesh_.nInternalFaces()
];
label patchFaceI =
wallFaceIndex
- mesh_.boundaryMesh()[patchI].start();
// Need to transform velocity when tensor transforms are
// supported
referredWallData_[rWVI] = U.boundaryField()[patchI][patchFaceI];
if (transform.hasR())
{
referredWallData_[rWVI] =
transform.R().T() & referredWallData_[rWVI];
}
template<class ParticleType>
void Foam::InteractionLists<ParticleType>::writeReferredWallFaces() const
{
if (referredWallFaces_.empty())
{
return;
}
fileName objDir = mesh_.time().timePath()/cloud::prefix;
mkDir(objDir);
fileName objFileName = "referredWallFaces.obj";
OFstream str(objDir/objFileName);
Info<< " Writing "
<< mesh_.time().timeName()/cloud::prefix/objFileName
<< endl;
forAll(referredWallFaces_, rWFI)
const referredWallFace& rwf = referredWallFaces_[rWFI];
meshTools::writeOBJ(str, rwf.points()[rwf[fPtI]]);
str<< ' ' << fPtI + offset;
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
template<class ParticleType>
Foam::InteractionLists<ParticleType>::InteractionLists(const polyMesh& mesh)
:
mesh_(mesh),
cloud_(mesh_, "NULL_Cloud", IDLList<ParticleType>()),
writeCloud_(false),
cellMapPtr_(),
wallFaceMapPtr_(),
globalTransforms_(mesh_),
maxDistance_(0.0),
dil_(),
dwfil_(),
ril_(),
rilInverse_(),
cellIndexAndTransformToDistribute_(),
wallFaceIndexAndTransformToDistribute_(),
referredWallFaces_(),
UName_("unknown_UName"),
referredWallData_(),
referredParticles_()
{}
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
template<class ParticleType>
Foam::InteractionLists<ParticleType>::InteractionLists
(
const polyMesh& mesh,
scalar maxDistance,
Switch writeCloud,
const word& UName
)
:
mesh_(mesh),
cloud_(mesh_, "referredParticleCloud", IDLList<ParticleType>()),
writeCloud_(writeCloud),
cellMapPtr_(),
wallFaceMapPtr_(),
globalTransforms_(mesh_),
maxDistance_(maxDistance),
dil_(),
dwfil_(),
ril_(),
rilInverse_(),
cellIndexAndTransformToDistribute_(),
wallFaceIndexAndTransformToDistribute_(),
referredWallFaces_(),
UName_(UName),
referredWallData_(),
referredParticles_()
{
buildInteractionLists();
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class ParticleType>
Foam::InteractionLists<ParticleType>::~InteractionLists()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
template<class ParticleType>
void Foam::InteractionLists<ParticleType>::sendReferredData
const List<DynamicList<ParticleType*> >& cellOccupancy,
PstreamBuffers& pBufs
if (mesh_.changing())
{
WarningIn
(
"void Foam::InteractionLists<ParticleType>::sendReferredData"
"("
"const List<DynamicList<ParticleType*> >& cellOccupancy,"
"PstreamBuffers& pBufs"
")"
)
<< "Mesh changing, rebuilding InteractionLists form scratch."
<< endl;
buildInteractionLists();
}
prepareWallDataToRefer();
prepareParticlesToRefer(cellOccupancy);
for (label domain = 0; domain < Pstream::nProcs(); domain++)
const labelList& subMap = cellMap().subMap()[domain];
if (subMap.size())
UOPstream toDomain(domain, pBufs);
UIndirectList<IDLList<ParticleType> > subMappedParticles
(
referredParticles_,
subMap
);
forAll(subMappedParticles, i)
{
toDomain << subMappedParticles[i];
}
}
}
// Using the mapDistribute to start sending and receiving the
// buffer but not block, i.e. it is calling
// pBufs.finishedSends(false);
wallFaceMap().send(pBufs, referredWallData_);
template<class ParticleType>
void Foam::InteractionLists<ParticleType>::receiveReferredData
(
PstreamBuffers& pBufs
)
{
Pstream::waitRequests();
referredParticles_.setSize(cellMap().constructSize());
for (label domain = 0; domain < Pstream::nProcs(); domain++)
const labelList& constructMap = cellMap().constructMap()[domain];
if (constructMap.size())
UIPstream str(domain, pBufs);
forAll(constructMap, i)
referredParticles_[constructMap[i]] = IDLList<ParticleType>
(
str,
typename ParticleType::iNew(cloud_)
);
fillReferredParticleCloud();
wallFaceMap().receive(pBufs, referredWallData_);