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 ); }
void peanoclaw::mappings::Cleanup::touchVertexLastTime( peanoclaw::Vertex& fineGridVertex, const tarch::la::Vector<DIMENSIONS,double>& fineGridX, const tarch::la::Vector<DIMENSIONS,double>& fineGridH, peanoclaw::Vertex * const coarseGridVertices, const peano::grid::VertexEnumerator& coarseGridVerticesEnumerator, peanoclaw::Cell& coarseGridCell, const tarch::la::Vector<DIMENSIONS,int>& fineGridPositionOfVertex ) { logTraceInWith6Arguments( "touchVertexLastTime(...)", fineGridVertex, fineGridX, fineGridH, coarseGridVerticesEnumerator.toString(), coarseGridCell, fineGridPositionOfVertex ); // @todo Insert your code here logTraceOutWith1Argument( "touchVertexLastTime(...)", fineGridVertex ); }
void peanoclaw::mappings::ValidateGrid::touchVertexLastTime( peanoclaw::Vertex& fineGridVertex, const tarch::la::Vector<DIMENSIONS,double>& fineGridX, const tarch::la::Vector<DIMENSIONS,double>& fineGridH, peanoclaw::Vertex * const coarseGridVertices, const peano::grid::VertexEnumerator& coarseGridVerticesEnumerator, peanoclaw::Cell& coarseGridCell, const tarch::la::Vector<DIMENSIONS,int>& fineGridPositionOfVertex ) { logTraceInWith6Arguments( "touchVertexLastTime(...)", fineGridVertex, fineGridX, fineGridH, coarseGridVerticesEnumerator.toString(), coarseGridCell, fineGridPositionOfVertex ); _validator.findAdjacentPatches( fineGridVertex, fineGridX, coarseGridVerticesEnumerator.getLevel() + 1, #ifdef Parallel tarch::parallel::Node::getInstance().getRank() #else 0 #endif ); logTraceOutWith1Argument( "touchVertexLastTime(...)", fineGridVertex ); }
void peanoclaw::mappings::ValidateGrid::prepareSendToMaster( peanoclaw::Cell& localCell, peanoclaw::Vertex * vertices, const peano::grid::VertexEnumerator& verticesEnumerator, const peanoclaw::Vertex * const coarseGridVertices, const peano::grid::VertexEnumerator& coarseGridVerticesEnumerator, const peanoclaw::Cell& coarseGridCell, const tarch::la::Vector<DIMENSIONS,int>& fineGridPositionOfCell ) { logTraceInWith2Arguments( "prepareSendToMaster(...)", localCell, verticesEnumerator.toString() ); //Assemble vector to send to master std::vector<PatchDescription>& workerAndLocalData = PatchDescriptionHeap::getInstance().getData(_patchDescriptionsIndex); std::vector<PatchDescription> localData = _validator.getAllPatches(); for(int i = 0; i < (int)localData.size(); i++) { //TODO unterweg debug // assertion(localData[i].getIsReferenced()); workerAndLocalData.push_back(localData[i]); } // for(size_t i = 0; i < PatchDescriptionHeap::getInstance().getData(_patchDescriptionsIndex).size(); i++) { // //TODO unterweg debug //// logError("", "Prepare Send to " << tarch::parallel::NodePool::getInstance().getMasterRank() << " -- " << i << ": " << PatchDescriptionHeap::getInstance().getData(_patchDescriptionsIndex)[i].toString()); // assertion(PatchDescriptionHeap::getInstance().getData(_patchDescriptionsIndex)[i].getIsReferenced()); // } //Add non-referenced patches // int index = 0; // int numberOfEntries = 0; // while(numberOfEntries < CellDescriptionHeap::getInstance().getNumberOfAllocatedEntries()) { // if(CellDescriptionHeap::getInstance().isValidIndex(index)) { // if(_descriptions.find(index) == _descriptions.end()) { // //Found non-referenced patch // CellDescription& cellDescription = CellDescriptionHeap::getInstance().getData(index).at(0); // PatchDescription patchDescription; // patchDescription.setPosition(cellDescription.getPosition()); // patchDescription.setSize(cellDescription.getSize()); // patchDescription.setLevel(cellDescription.getLevel()); // patchDescription.setIsRemote(cellDescription.getIsRemote()); // patchDescription.setIsReferenced(false); // patchDescription.setCellDescriptionIndex(index); // patchDescription.setRank(tarch::parallel::Node::getInstance().getRank()); // descriptionVector.push_back(patchDescription); // } // numberOfEntries++; // } // index++; // } //Send PatchDescriptionHeap::getInstance().sendData( _patchDescriptionsIndex, tarch::parallel::NodePool::getInstance().getMasterRank(), verticesEnumerator.getVertexPosition(0), verticesEnumerator.getLevel(), peano::heap::MasterWorkerCommunication ); #ifdef Parallel PatchDescriptionHeap::getInstance().finishedToSendSynchronousData(); #endif logTraceOut( "prepareSendToMaster(...)" ); }
void peanoclaw::mappings::ValidateGrid::destroyVertex( const peanoclaw::Vertex& fineGridVertex, const tarch::la::Vector<DIMENSIONS,double>& fineGridX, const tarch::la::Vector<DIMENSIONS,double>& fineGridH, peanoclaw::Vertex * const coarseGridVertices, const peano::grid::VertexEnumerator& coarseGridVerticesEnumerator, peanoclaw::Cell& coarseGridCell, const tarch::la::Vector<DIMENSIONS,int>& fineGridPositionOfVertex ) { logTraceInWith6Arguments( "destroyVertex(...)", fineGridVertex, fineGridX, fineGridH, coarseGridVerticesEnumerator.toString(), coarseGridCell, fineGridPositionOfVertex ); //TODO unterweg debug // std::cout<< "Destroying vertex " << fineGridX << ", " // << fineGridH // << ", level=" << (coarseGridVerticesEnumerator.getLevel()+1) // #ifdef Parallel // << ", rank=" << tarch::parallel::Node::getInstance().getRank() // #endif // << fineGridVertex.toString() // << std::endl; //We need to call this method here, since it seems that touchVertexLastTime //is not called in the iteration where a vertex is destroyed. _validator.findAdjacentPatches( fineGridVertex, fineGridX, coarseGridVerticesEnumerator.getLevel() + 1, #ifdef Parallel tarch::parallel::Node::getInstance().getRank() #else 0 #endif ); // if(fineGridVertex.isRemote(_state, true, true)) { // _validator.deleteNonRemoteAdjacentPatches( // fineGridVertex, // fineGridX, // coarseGridVerticesEnumerator.getLevel() + 1, // #ifdef Parallel // tarch::parallel::Node::getInstance().getRank() // #else // 0 // #endif // ); // } logTraceOutWith1Argument( "destroyVertex(...)", fineGridVertex ); }
void peanoclaw::mappings::ValidateGrid::createInnerVertex( peanoclaw::Vertex& fineGridVertex, const tarch::la::Vector<DIMENSIONS,double>& fineGridX, const tarch::la::Vector<DIMENSIONS,double>& fineGridH, peanoclaw::Vertex * const coarseGridVertices, const peano::grid::VertexEnumerator& coarseGridVerticesEnumerator, peanoclaw::Cell& coarseGridCell, const tarch::la::Vector<DIMENSIONS,int>& fineGridPositionOfVertex ) { logTraceInWith6Arguments( "createInnerVertex(...)", fineGridVertex, fineGridX, fineGridH, coarseGridVerticesEnumerator.toString(), coarseGridCell, fineGridPositionOfVertex ); //TODO unterweg debug // std::cout<< "Create inner vertex " << fineGridX << ", " // << fineGridH // #ifdef Parallel // << ", rank=" << tarch::parallel::Node::getInstance().getRank() // #endif // << std::endl; logTraceOutWith1Argument( "createInnerVertex(...)", fineGridVertex ); }
void peanoclaw::mappings::ValidateGrid::destroyHangingVertex( const peanoclaw::Vertex& fineGridVertex, const tarch::la::Vector<DIMENSIONS,double>& fineGridX, const tarch::la::Vector<DIMENSIONS,double>& fineGridH, peanoclaw::Vertex * const coarseGridVertices, const peano::grid::VertexEnumerator& coarseGridVerticesEnumerator, peanoclaw::Cell& coarseGridCell, const tarch::la::Vector<DIMENSIONS,int>& fineGridPositionOfVertex ) { logTraceInWith6Arguments( "destroyHangingVertex(...)", fineGridVertex, fineGridX, fineGridH, coarseGridVerticesEnumerator.toString(), coarseGridCell, fineGridPositionOfVertex ); if(tarch::la::allGreaterEquals(fineGridX, _domainOffset) && tarch::la::allGreaterEquals(_domainOffset+_domainSize, fineGridX)) { _validator.findAdjacentPatches( fineGridVertex, fineGridX, coarseGridVerticesEnumerator.getLevel() + 1, #ifdef Parallel tarch::parallel::Node::getInstance().getRank() #else 0 #endif ); } logTraceOutWith1Argument( "destroyHangingVertex(...)", fineGridVertex ); }