void particles::pidt::mappings::MoveParticles::touchVertexFirstTime( particles::pidt::Vertex& fineGridVertex, const tarch::la::Vector<DIMENSIONS,double>& fineGridX, const tarch::la::Vector<DIMENSIONS,double>& fineGridH, particles::pidt::Vertex * const coarseGridVertices, const peano::grid::VertexEnumerator& coarseGridVerticesEnumerator, particles::pidt::Cell& coarseGridCell, const tarch::la::Vector<DIMENSIONS,int>& fineGridPositionOfVertex ) { logTraceInWith6Arguments( "touchVertexFirstTime(...)", fineGridVertex, fineGridX, fineGridH, coarseGridVerticesEnumerator.toString(), coarseGridCell, fineGridPositionOfVertex ); #ifdef Parallel if (fineGridVertex.isAdjacentToRemoteRank()) { fineGridVertex.particlesWereAddedToThisVertex(); } else { fineGridVertex.noParticlesWereAddedToThisVertex(); } #else fineGridVertex.noParticlesWereAddedToThisVertex(); #endif const int vertexIndex = fineGridVertex.getVertexIndex(); typedef std::vector<particles::pidt::records::Particle> ParticleContainer; ParticleContainer& sourceVertexParticles = ParticleHeap::getInstance().getData(vertexIndex); pfor(i,0,static_cast<int>(sourceVertexParticles.size()),100) particles::pidt::records::Particle& currentParticle = sourceVertexParticles.at(i); assertion( currentParticle.getMovedParticle() == particles::pidt::records::Particle::New || currentParticle.getMovedParticle() == particles::pidt::records::Particle::Moved ); assertion1( tarch::la::allGreaterEquals(currentParticle._persistentRecords._x,0.0), currentParticle.toString() ); assertion1( tarch::la::allSmallerEquals(currentParticle._persistentRecords._x,1.0), currentParticle.toString() ); currentParticle.setMovedParticle( particles::pidt::records::Particle::NotMovedYet ); endpfor logTraceOutWith1Argument( "touchVertexFirstTime(...)", fineGridVertex ); }
static const char * pfor_list(struct action *act, gfarm_list *list, int parallel, struct gfrep_arg *gfrep_arg) { struct file_info **finfo; int nfinfo; const char *errmsg; finfo = gfarm_array_alloc_from_list(list); nfinfo = gfarm_list_length(list); errmsg = pfor(act, nfinfo, finfo, parallel, gfrep_arg); gfarm_array_free_deeply(nfinfo, finfo, (void (*)(void *))file_info_free); return (errmsg); }
int particles::pidt::mappings::MoveParticles::moveParticlesOfOneVertexWithinCell( int vertexIndex, const peano::grid::VertexEnumerator& fineGridVerticesEnumerator ) { #if defined(SharedTBB) && !defined(__WIN32__) tbb::atomic<int> numberOfParticlesMoved; #elif SharedOMP #error not implemented yet #else int numberOfParticlesMoved; #endif numberOfParticlesMoved = 0; ParticleHeap::HeapEntries& sourceVertexParticles = ParticleHeap::getInstance().getData(vertexIndex); pfor(i,0,static_cast<int>(sourceVertexParticles.size()),200) particles::pidt::records::Particle& currentParticle = sourceVertexParticles.at(i); const bool particleHasNotBeenMovedYet = currentParticle.getMovedParticle() != particles::pidt::records::Particle::Moved; const bool particleIsContainedInCell = fineGridVerticesEnumerator.overlaps( currentParticle._persistentRecords._x, 0.0 ); if (particleHasNotBeenMovedYet && particleIsContainedInCell) { currentParticle._persistentRecords._x += (_state.getTimeStepSize() * currentParticle._persistentRecords._v); currentParticle.setMovedParticle( particles::pidt::records::Particle::Moved ); reflectParticle(currentParticle); numberOfParticlesMoved++; } endpfor return numberOfParticlesMoved; }