void particles::pidt::mappings::Redistribute::prepareCopyToRemoteNode( particles::pidt::Vertex& localVertex, int toRank, const tarch::la::Vector<DIMENSIONS,double>& x, const tarch::la::Vector<DIMENSIONS,double>& h, int level ) { logTraceInWith5Arguments( "prepareCopyToRemoteNode(...)", localVertex, toRank, x, h, level ); const ParticleContainer destinationParticles = MoveParticles::extractAllParticlesFromDualCellBelongingToOneRank( localVertex.getVertexIndex(), localVertex, toRank, x, h ); ParticleHeap::getInstance().sendData( destinationParticles, toRank, x, level, peano::heap::ForkOrJoinCommunication ); logTraceOut( "prepareCopyToRemoteNode(...)" ); }
void peanoclaw::mappings::Cleanup::prepareCopyToRemoteNode( peanoclaw::Cell& localCell, int toRank, const tarch::la::Vector<DIMENSIONS,double>& cellCentre, const tarch::la::Vector<DIMENSIONS,double>& cellSize, int level ) { logTraceInWith5Arguments( "prepareCopyToRemoteNode(...)", localCell, toRank, cellCentre, cellSize, level ); // @todo Insert your code here logTraceOut( "prepareCopyToRemoteNode(...)" ); }
void peanoclaw::mappings::ValidateGrid::prepareCopyToRemoteNode( peanoclaw::Vertex& localVertex, int toRank, const tarch::la::Vector<DIMENSIONS,double>& x, const tarch::la::Vector<DIMENSIONS,double>& h, int level ) { logTraceInWith5Arguments( "prepareCopyToRemoteNode(...)", localVertex, toRank, x, h, level ); _validator.findAdjacentPatches( localVertex, x, level, toRank ); logTraceOut( "prepareCopyToRemoteNode(...)" ); }
void peano::applications::heatequation::timestepping::adapters::SpacetreeGrid2PlotGrid::enterCell( peano::applications::heatequation::timestepping::SpacetreeGridCell& fineGridCell, peano::applications::heatequation::timestepping::SpacetreeGridSingleStepVertex * const fineGridVertices, const peano::kernel::gridinterface::VertexEnumerator& fineGridVerticesEnumerator, peano::applications::heatequation::timestepping::SpacetreeGridSingleStepVertex const * const coarseGridVertices, const peano::kernel::gridinterface::VertexEnumerator& coarseGridVerticesEnumerator, const peano::applications::heatequation::timestepping::SpacetreeGridCell& coarseGridCell, const tarch::la::Vector<DIMENSIONS,int>& fineGridPositionOfCell ) { logTraceInWith5Arguments( "enterCell(...)", fineGridCell, fineGridVerticesEnumerator.toString(), coarseGridVerticesEnumerator.toString(), coarseGridCell, fineGridPositionOfCell ); #ifdef SharedTBB Vertex2IndexMapSemaphore::scoped_lock localLock(_vertex2IndexMapSemaphore); #elif SharedOMP #pragma omp critical #endif if ( fineGridCell.isLeaf() ) { assertion( DIMENSIONS==2 || DIMENSIONS==3 ); int vertexIndex[TWO_POWER_D]; dfor2(i) tarch::la::Vector<DIMENSIONS,double> currentVertexPosition = fineGridVerticesEnumerator.getVertexPosition(i); assertion1 ( _vertex2IndexMap.find(currentVertexPosition) != _vertex2IndexMap.end(), currentVertexPosition ); vertexIndex[iScalar] = _vertex2IndexMap[currentVertexPosition]; enddforx int cellIndex; if (DIMENSIONS==2) { cellIndex = _cellWriter->plotQuadrangle(vertexIndex); } if (DIMENSIONS==3) { cellIndex = _cellWriter->plotHexahedron(vertexIndex); } #ifdef Parallel _cellDeltaWriter->plotCell( cellIndex,fineGridCell.getDelta() ); _cellWeightWriter->plotCell( cellIndex,fineGridCell.getWeight() ); #endif } logTraceOut( "enterCell(...)" ); }
void peano::applications::faxen::adapters::SpacetreeGrid2PlotGrid::enterCell( peano::applications::faxen::SpacetreeGridCell& fineGridCell, peano::applications::faxen::SpacetreeGridVertex * const fineGridVertices, const peano::kernel::gridinterface::VertexEnumerator& fineGridVerticesEnumerator, peano::applications::faxen::SpacetreeGridVertex const * const coarseGridVertices, const peano::kernel::gridinterface::VertexEnumerator& coarseGridVerticesEnumerator, const peano::applications::faxen::SpacetreeGridCell& coarseGridCell, const tarch::la::Vector<DIMENSIONS,int>& fineGridPositionOfCell ) { logTraceInWith5Arguments( "enterCell(...)", fineGridCell, fineGridVerticesEnumerator.toString(), coarseGridVerticesEnumerator.toString(), coarseGridCell, fineGridPositionOfCell ); #ifdef SharedTBB Vertex2IndexMapSemaphore::scoped_lock localLock(_vertex2IndexMapSemaphore); #elif SharedOMP assertionMsg( false, "here should be a critical section, but I don't know how to implement this. If you implement it, please add it to the templates, too." ); #endif if ( fineGridCell.isLeaf() ) { assertion( DIMENSIONS==2 || DIMENSIONS==3 ); int vertexIndex[TWO_POWER_D]; dfor2(i) tarch::la::Vector<DIMENSIONS,double> currentVertexPosition = fineGridVerticesEnumerator.getVertexPosition(i); assertion1 ( _vertex2IndexMap.find(currentVertexPosition) != _vertex2IndexMap.end(), currentVertexPosition ); vertexIndex[iScalar] = _vertex2IndexMap[currentVertexPosition]; enddforx int cellIndex; if (DIMENSIONS==2) { cellIndex = _cellWriter->plotQuadrangle(vertexIndex); } if (DIMENSIONS==3) { cellIndex = _cellWriter->plotHexahedron(vertexIndex); } #ifdef Parallel _cellDeltaWriter->plotCell( cellIndex,fineGridCell.getDelta() ); _cellWeightWriter->plotCell( cellIndex,fineGridCell.getWeight() ); #endif } logTraceOut( "enterCell(...)" ); }
void peanoclaw::mappings::ValidateGrid::prepareCopyToRemoteNode( peanoclaw::Cell& localCell, int toRank, const tarch::la::Vector<DIMENSIONS,double>& cellCentre, const tarch::la::Vector<DIMENSIONS,double>& cellSize, int level ) { logTraceInWith5Arguments( "prepareCopyToRemoteNode(...)", localCell, toRank, cellCentre, cellSize, level ); //TODO unterweg debug // std::cout<< "Copying cell " << (cellCentre-0.5*cellSize) << ", " // << cellSize // << ", index=" << localCell.getCellDescriptionIndex() // #ifdef Parallel // << ", from=" << tarch::parallel::Node::getInstance().getRank() // << ", to=" << toRank // #endif // << std::endl; logTraceOut( "prepareCopyToRemoteNode(...)" ); }
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() ); }
void tarch::plotter::griddata::regular::vtk::VTKTextFileWriter::writeToFile( const std::string& filename ) { logTraceInWith5Arguments( "writeToFile(filename)", filename, _writtenToFile, _numberOfGridPoints, _domainSize, _origin ); std::ofstream out; out.open( filename.c_str() ); if ( (!out.fail()) && out.is_open() ) { _log.debug( "close()", "opened data file " + filename ); out << HEADER << std::endl << std::endl; out << "DATASET STRUCTURED_POINTS" << std::endl << "DIMENSIONS " << _numberOfGridPoints(0) << " " << _numberOfGridPoints(1) << " " << _numberOfGridPoints(2) << std::endl << std::endl; out << "ORIGIN " << static_cast<float>(_origin(0)) << " " << static_cast<float>(_origin(1)) << " " << static_cast<float>(_origin(2)) << std::endl << std::endl; out << "SPACING " << static_cast<float>(getH()(0)) << " " << static_cast<float>(getH()(1)) << " " << static_cast<float>(getH()(2)) << std::endl << std::endl; assertion(static_cast<float>(getH()(0))>0); assertion(static_cast<float>(getH()(1))>0); assertion(static_cast<float>(getH()(2))>=0); if (!_vertexData.empty()) { out << "POINT_DATA " << tarch::la::volume(_numberOfGridPoints) << std::endl << std::endl; for (int i=0; i<static_cast<int>(_vertexData.size()); i++) { if (_vertexData[i]._recordsPerEntry == 3) { out << "VECTORS " << _vertexData[i]._identifier << " float " << std::endl; } else { out << "SCALARS " << _vertexData[i]._identifier << " float " << _vertexData[i]._recordsPerEntry << std::endl; out << "LOOKUP_TABLE default" << std::endl; } for (int j=0; j<tarch::la::volume(_numberOfGridPoints); j++) { for (int k=0; k<_vertexData[i]._recordsPerEntry; k++) { out << static_cast<float>(_vertexData[i]._data[j*_vertexData[i]._recordsPerEntry+k]) << " "; } out << std::endl; } out << std::endl << std::endl; } } if (!_cellData.empty()) { out << "CELL_DATA " << tarch::la::volume(_numberOfGridPoints-1) << std::endl << std::endl; for (int i=0; i<static_cast<int>(_cellData.size()); i++) { if (_cellData[i]._recordsPerEntry == 3) { out << "VECTORS " << _cellData[i]._identifier << " float " << std::endl; } else { out << "SCALARS " << _cellData[i]._identifier << " float " << _cellData[i]._recordsPerEntry << std::endl; } for (int j=0; j<tarch::la::volume(_numberOfGridPoints-1); j++) { for (int k=0; k<_cellData[i]._recordsPerEntry; k++) { out << static_cast<float>(_cellData[i]._data[j*_cellData[i]._recordsPerEntry+k]) << " "; } out << std::endl; } out << std::endl << std::endl; } } _writtenToFile = true; } logTraceOut( "writeToFile(filename)" ); }