void particles::pidt::mappings::MoveParticles::prepareSendToNeighbour( particles::pidt::Vertex& vertex, int toRank, const tarch::la::Vector<DIMENSIONS,double>& x, const tarch::la::Vector<DIMENSIONS,double>& h, int level ) { logTraceInWith5Arguments( "prepareSendToNeighbour(...)", vertex, toRank, x, h, level ); ParticleContainer destinationParticles = extractAllParticlesFromDualCellBelongingToOneRank( vertex.getVertexIndex(), vertex, toRank, x, h ); for ( ParticleContainer::iterator p = destinationParticles.begin(); p != destinationParticles.end(); p++ ) { p->setMovedParticle( particles::pidt::records::Particle::New ); assertion5( Vertex::isContainedInDualCell(x,h,p->_persistentRecords._x), x,h,p->toString(),p->_persistentRecords._x - x,level ); } ParticleHeap::getInstance().sendData( destinationParticles, toRank, x, level, peano::heap::NeighbourCommunication ); logTraceOutWith1Argument( "prepareSendToNeighbour(...)", destinationParticles.size() ); }
ReturnType SendCouplingMDCommand::executeProcessing() { logger->debug() << "starting SendCouplingMDCommand::executeProcessing" << std::endl; CouplingInformationType* couplingInfo = (CouplingInformationType*) this->getData(0); Simulation* theSim = (Simulation*) this->getData(1); ParticleContainer* moleculeContainer = theSim->getMolecules(); if (transferContainer == NULL) { transferContainer = new std::vector<Molecule>[couplingInfo->numberOfBoundaries]; } /* int dim = borderToLook / 2; int dir = borderToLook % 2;*/ int dim, dir; outmin = 0; outmax = 0; double rmin = moleculeContainer->getBoundingBoxMin(dim); double rmax = moleculeContainer->getBoundingBoxMax(dim); logger->debug() << "dim is " << dim << ", dir is " << dir << std::endl; logger->debug() << "halo is " << moleculeContainer->get_halo_L(dim) << std::endl; Molecule* currentMolecule; double low_limit = rmin; // particles below this limit have to be copied or moved to the lower process double high_limit = rmax; // particles above(or equal) this limit have to be copied or moved to the higher process currentMolecule = moleculeContainer->begin(); logger->debug() << "low_limit: " << low_limit << " / high_limit: " << high_limit << std::endl; while(currentMolecule!=moleculeContainer->end()){ for (int i = 0; i < couplingInfo->numberOfBoundaries; i++) { CouplingBoundary currentBoundary = couplingInfo->boundaries[i]; //const double& rd=currentMolecule->r(dim); const double& rd = currentMolecule->r(currentBoundary.outFlowDirection); const double& ro1 = currentMolecule->r(currentBoundary.otherDirection[0]); const double& ro2 = currentMolecule->r(currentBoundary.otherDirection[1]); if ((currentBoundary.lowerHigher == 1) && (rd > high_limit) && isInBounds(ro1,ro2, ¤tBoundary)) { outmax++; transferContainer[i].push_back(*currentMolecule); currentMolecule = moleculeContainer->deleteCurrent (); break; } else if ((currentBoundary.lowerHigher == 0) && (rd < low_limit) && isInBounds(ro1,ro2, ¤tBoundary)) { transferContainer[i].push_back(*currentMolecule); currentMolecule = moleculeContainer->deleteCurrent(); outmin++; break; } else { currentMolecule = moleculeContainer->next(); } } } logger->debug() << "outmin["<< dim << "] = " << outmin << std::endl; logger->debug() << "outmax["<< dim << "] = " << outmax << std::endl; //logger->debug() << "there are now " << transferContainer.size() << " molecules to transfer " << std::endl; if (getStepInterval() > 0) { return REPETITION_REQUESTED; } else { return EXECUTED; } }