diff --git a/src/lagrangian/intermediate/interactionLists/referredCell/referredCell.C b/src/lagrangian/intermediate/interactionLists/referredCell/referredCell.C index 248d27c17c..6de6d98064 100644 --- a/src/lagrangian/intermediate/interactionLists/referredCell/referredCell.C +++ b/src/lagrangian/intermediate/interactionLists/referredCell/referredCell.C @@ -389,43 +389,22 @@ Foam::vectorList Foam::referredCell::rotateVectors } -template -void Foam::referredCell::referInParticles -( - const IDLList& incomingParticles -) -{ - // this->clear(); - - // Try using this = incomingParticles then transform positions - - // forAllConstIter - // ( - // typename IDLList, - // incomingParticles, - // incomingParticle - // ) - // { - // // this->append(incomingParticle); - // } - - // Info<< "NEED TO REFER POSITIONS ON ARRIVAL" << endl; -} - - template void Foam::referredCell::referInParticle ( - const ParticleType& incomingParticle + ParticleType* incomingParticlePtr ) { - // Pout<< "Referring in " << incomingParticle << endl; + ParticleType& p = *incomingParticlePtr; - // Try using this = incomingParticles then transform positions + p.position() = referPosition + ( + p.position() + ); - // // this->append(incomingParticle); + p.transformProperties(rotation_); - // Info<< "NEED TO REFER POSITIONS ON ARRIVAL" << endl; + this->append(incomingParticlePtr); } diff --git a/src/lagrangian/intermediate/interactionLists/referredCell/referredCell.H b/src/lagrangian/intermediate/interactionLists/referredCell/referredCell.H index 77aff3a373..fbe07dd38f 100644 --- a/src/lagrangian/intermediate/interactionLists/referredCell/referredCell.H +++ b/src/lagrangian/intermediate/interactionLists/referredCell/referredCell.H @@ -229,10 +229,9 @@ public: // list of vectors vectorList rotateVectors(const vectorList& vectorsToRotate) const; - //- referInParticle(s) takes a referred particle from a source + //- referInParticle takes a referred particle from a source // processor, transforming its position and properties - void referInParticles(const IDLList& incomingParticles); - void referInParticle(const ParticleType& incomingParticle); + void referInParticle(ParticleType* incomingParticlePtr); //- duplicate() function to test whether a referred or real cell // supplied by arguement is a duplicate of this referredCell. diff --git a/src/lagrangian/intermediate/interactionLists/referredCellList/referredCellList.C b/src/lagrangian/intermediate/interactionLists/referredCellList/referredCellList.C index 262106a29a..cfadc68965 100644 --- a/src/lagrangian/intermediate/interactionLists/referredCellList/referredCellList.C +++ b/src/lagrangian/intermediate/interactionLists/referredCellList/referredCellList.C @@ -32,8 +32,6 @@ License #include "globalMeshData.H" #include "processorPolyPatch.H" #include "cyclicPolyPatch.H" -#include "sendingReferralList.H" -#include "receivingReferralList.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -1423,6 +1421,44 @@ void Foam::referredCellList::buildReferredCellList } +template +void Foam::referredCellList::storeParticles +( + const receivingReferralList& rRL, + const labelList& destinationReferredCell, + IDLList& particlesToReferIn +) +{ + label particleI = 0; + + forAllIter + ( + typename IDLList, + particlesToReferIn, + referInIter + ) + { + ParticleType& p = referInIter(); + + labelList refCellsToReferTo = + rRL[destinationReferredCell[particleI]]; + + forAll(refCellsToReferTo, refCellI) + { + referredCell& refCellToRefParticlesTo = + (*this)[refCellsToReferTo[refCellI]]; + + refCellToRefParticlesTo.referInParticle + ( + particlesToReferIn.remove(&p) + ); + } + + particleI++; + } +} + + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template @@ -1434,7 +1470,7 @@ Foam::referredCellList::referredCellList : List >(), il_(il), - cloud_(il_.mesh(), "referredCellListDummyCloud", IDLList()) + cloud_(il_.mesh(), "referredParticleCloud", IDLList()) { buildReferredCellList(pointPointListBuild); @@ -1477,8 +1513,6 @@ void Foam::referredCellList::referParticles (*this)[i].clear(); } - cloud_.clear(); - // Create referred particles for sending using cell occupancy and // cellSendingReferralLists @@ -1534,54 +1568,7 @@ void Foam::referredCellList::referParticles il_.cellReceivingReferralLists()[cSRL] ); - // forAll(rRL, rRLI) - // { - // forAll(rRL[rRLI], rC) - // { - // // referredCell& refCellToRefParticlesTo = - // // (*this)[rRL[rRLI][rC]]; - - // // refCellToRefParticlesTo.referInParticles - // // ( - // // particlesToReferOut[rRLI] - // // ); - // } - // } - - forAllConstIter - ( - typename IDLList, - particlesToReferOut, - iter - ) - { - cloud_.addParticle(iter().clone().ptr()); - } - - label particleI = 0; - - forAllIter - ( - typename IDLList, - particlesToReferOut, - iter - ) - { - ParticleType& p = iter(); - - labelList refCellsToReferTo = - rRL[destinationReferredCell[particleI]]; - - forAll(refCellsToReferTo, refCellI) - { - referredCell& refCellToRefParticlesTo = - (*this)[refCellsToReferTo[refCellI]]; - - refCellToRefParticlesTo.referInParticle(p); - } - - particleI++; - } + storeParticles(rRL, destinationReferredCell, particlesToReferOut); } } @@ -1598,7 +1585,7 @@ void Foam::referredCellList::referParticles IDLList particlesToReferIn; - List