void peano::applications::poisson::jacobitutorial::mappings::RegularGrid2PlotSolution::touchVertexFirstTime(
  peano::applications::poisson::jacobitutorial::RegularGridVertex&  vertex,
  const tarch::la::Vector<DIMENSIONS,double>&  x
) {
  logTraceInWith2Arguments( "touchVertexFirstTime()", x, vertex );

  /**
   * --- inserted manually ---
   *
   * This is now the interesting part. The first few lines in the block resemble
   * the one inserted by the generated grid plotter. It brings the vertex to
   * your screen (or vtk file respectively. The lines afterwards then set
   */
  tarch::multicore::Lock localLock( _outputStreamSemaphore );

  if ( _vertex2IndexMap.find(x) == _vertex2IndexMap.end() ) {
    #if defined(Dim2) || defined(Dim3)
    _vertex2IndexMap[x] = _vertexWriter->plotVertex(x);
    #else
    _vertex2IndexMap[x] = _vertexWriter->plotVertex(tarch::la::Vector<3,double>(x.data()));
    #endif

    _vertexResidualWriter->plotVertex(_vertex2IndexMap[x],vertex.getResidual());
    _vertexValueWriter->plotVertex(_vertex2IndexMap[x],vertex.getU());
    _vertexRhsWriter->plotVertex(_vertex2IndexMap[x],vertex.getRhs());
  }

  logTraceOutWith1Argument( "touchVertexFirstTime()", vertex );
}
int peano::integration::dataqueries::CartesianGridWriterProxy::getVertexIndex( const tarch::la::Vector<3,double>& position ) {
  assertion((int)_positionList.size()<_bufferSize);

  for (unsigned int i=0; i<_positionList.size(); i+=3) {
      if (position[0]==_positionList[i]&&position[0]==_positionList[i+1]&&position[0]==_positionList[i+2]) {
          return i;
      }
  }
  for(int i=0;i<position.size();i++)
    _positionList.push_back(position[i]);
  return (_positionList.size()-1)/3;
}
void peano::applications::pic::demo2::mappings::RegularGrid2PlotSolution::plotVertex(
		const peano::applications::pic::demo2::RegularGridVertex&  GridVertex,
		      const tarch::la::Vector<DIMENSIONS,double>&      GridX
) {

  if (
    _vertex2IndexMap.find(GridX) == _vertex2IndexMap.end()
  ) {
    #if defined(Dim2) || defined(Dim3)
    _vertex2IndexMap[GridX] = _vertexWriter->plotVertex(GridX);
    #else
    _vertex2IndexMap[GridX] = _vertexWriter->plotVertex(tarch::la::Vector<3,double>(GridX.data()));
    #endif


   // _vertexWriter->plotVertex(_vertex2IndexMap[ridX],GridVertex.getP() );
  }
}
void particles::pit::adapters::InitGridAndPlot2VTKGridVisualiser_1::plotVertex(
  const particles::pit::Vertex&                 fineGridVertex,
  const tarch::la::Vector<DIMENSIONS,double>&  fineGridX
) {
  if ( _vertex2IndexMap.find(fineGridX) == _vertex2IndexMap.end() ) {  
    #if defined(Dim2) || defined(Dim3)
    _vertex2IndexMap[fineGridX] = _vertexWriter->plotVertex(fineGridX);
    #else
    _vertex2IndexMap[fineGridX] = _vertexWriter->plotVertex(tarch::la::Vector<3,double>(fineGridX.data()));
    #endif
    const int boundaryFlag = fineGridVertex.isHangingNode() ? -1 : fineGridVertex.isBoundary() ? 1 : 0;
    _vertexTypeWriter->plotVertex             (_vertex2IndexMap[fineGridX], boundaryFlag);
    _vertexRefinementControlWriter->plotVertex(_vertex2IndexMap[fineGridX],fineGridVertex.getRefinementControl() );
    _vertexAdjacentCellsHeight->plotVertex    (_vertex2IndexMap[fineGridX],fineGridVertex.getAdjacentCellsHeightOfPreviousIteration() );
  }
}
Exemplo n.º 5
0
void peano::applications::heatequation::timestepping::adapters::SpacetreeGrid2PlotGrid::plotVertex(
  const peano::applications::heatequation::timestepping::SpacetreeGridSingleStepVertex& fineGridVertex,
  const tarch::la::Vector<DIMENSIONS,double>&                  fineGridX
) {
  #ifdef SharedTBB
  Vertex2IndexMapSemaphore::scoped_lock localLock(_vertex2IndexMapSemaphore);
  #elif SharedOMP
  #pragma omp critical
  #endif

  if ( 
    fineGridVertex.getRefinementControl() != peano::applications::heatequation::timestepping::SpacetreeGridSingleStepVertex::Records::Refined &&
    fineGridVertex.getRefinementControl() != peano::applications::heatequation::timestepping::SpacetreeGridSingleStepVertex::Records::Refining &&
    _vertex2IndexMap.find(fineGridX) == _vertex2IndexMap.end() 
  ) {  
    #if defined(Dim2) || defined(Dim3)
    _vertex2IndexMap[fineGridX] = _vertexWriter->plotVertex(fineGridX);
    #else
    _vertex2IndexMap[fineGridX] = _vertexWriter->plotVertex(tarch::la::Vector<3,double>(fineGridX.data()));
    #endif
    _vertexTypeWriter->plotVertex             (_vertex2IndexMap[fineGridX],fineGridVertex.isBoundary() );
    _vertexRefinementControlWriter->plotVertex(_vertex2IndexMap[fineGridX],fineGridVertex.getRefinementControl() );
    _vertexMaximumSubtreeWriter->plotVertex   (_vertex2IndexMap[fineGridX],fineGridVertex.getMaximumSubtreeHeight() );
  }
}
void peano::applications::pic::demo2::mappings::SpacetreeGrid2PlotSolution::plotVertex(
  const peano::applications::pic::demo2::SpacetreeGridVertex& fineGridVertex,
  const tarch::la::Vector<DIMENSIONS,double>&                  fineGridX
) {

  if (
    fineGridVertex.getRefinementControl() != peano::applications::pic::demo2::SpacetreeGridVertex::Records::Refined &&
    fineGridVertex.getRefinementControl() != peano::applications::pic::demo2::SpacetreeGridVertex::Records::Refining &&
    _vertex2IndexMap.find(fineGridX) == _vertex2IndexMap.end()
  ) {
    #if defined(Dim2) || defined(Dim3)
    _vertex2IndexMap[fineGridX] = _vertexWriter->plotVertex(fineGridX);
    #else
    _vertex2IndexMap[fineGridX] = _vertexWriter->plotVertex(tarch::la::Vector<3,double>(fineGridX.data()));
    #endif
  }
}
Exemplo n.º 7
0
void peano::applications::faxen::adapters::SpacetreeGrid2PlotGrid::plotVertex(
  const peano::applications::faxen::SpacetreeGridVertex& fineGridVertex,
  const tarch::la::Vector<DIMENSIONS,double>&                  fineGridX
) {
  #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 ( 
    fineGridVertex.getRefinementControl() != peano::applications::faxen::SpacetreeGridVertex::Records::Refined &&
    fineGridVertex.getRefinementControl() != peano::applications::faxen::SpacetreeGridVertex::Records::Refining &&
    _vertex2IndexMap.find(fineGridX) == _vertex2IndexMap.end() 
  ) {
    #if defined(Dim2) || defined(Dim3)
    _vertex2IndexMap[fineGridX] = _vertexWriter->plotVertex(fineGridX);
    #else
    _vertex2IndexMap[fineGridX] = _vertexWriter->plotVertex(tarch::la::Vector<3,double>(fineGridX.data()));
    #endif
    _vertexTypeWriter->plotVertex             (_vertex2IndexMap[fineGridX],fineGridVertex.isBoundary() );
    _vertexRefinementControlWriter->plotVertex(_vertex2IndexMap[fineGridX],fineGridVertex.getRefinementControl() );
    _vertexMaximumSubtreeWriter->plotVertex   (_vertex2IndexMap[fineGridX],fineGridVertex.getMaximumSubtreeHeight() );
  }
}
void dem::adapters::TimeStepAndPlotOnReluctantDynamicGrid2VTKGridVisualiser_4::plotVertex(
  const dem::Vertex&                 fineGridVertex,
  const tarch::la::Vector<DIMENSIONS,double>&  fineGridX
) {
  if ( _vertex2IndexMap.find(fineGridX) == _vertex2IndexMap.end() ) {
    assertion( _vertexWriter                  != nullptr );
    assertion( _vertexTypeWriter              != nullptr );
    assertion( _vertexRefinementControlWriter != nullptr );
    assertion( _vertexAdjacentCellsHeight     != nullptr );
    
    #if defined(Dim2) || defined(Dim3)
    _vertex2IndexMap[fineGridX] = _vertexWriter->plotVertex(fineGridX);
    #else
    _vertex2IndexMap[fineGridX] = _vertexWriter->plotVertex(tarch::la::Vector<3,double>(fineGridX.data()));
    #endif
    const int boundaryFlag = fineGridVertex.isHangingNode() ? -1 : fineGridVertex.isBoundary() ? 1 : 0;
    _vertexTypeWriter->plotVertex             (_vertex2IndexMap[fineGridX], boundaryFlag);
    _vertexRefinementControlWriter->plotVertex(_vertex2IndexMap[fineGridX],fineGridVertex.getRefinementControl() );
    _vertexAdjacentCellsHeight->plotVertex    (_vertex2IndexMap[fineGridX],fineGridVertex.getAdjacentCellsHeightOfPreviousIteration() );
  }
}
void peano::applications::poisson::multigrid::mappings::SpacetreeGrid2PlotSolution::plotVertex(
  peano::applications::poisson::multigrid::SpacetreeGridVertex&  fineGridVertex,
  const tarch::la::Vector<DIMENSIONS,double>&                    fineGridX
) {
  if ( fineGridVertex.getRefinementControl() == SpacetreeGridVertex::Records::Unrefined ) {
    #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 ( _vertex2IndexMap.find(fineGridX) == _vertex2IndexMap.end() ) {
      #if defined(Dim2) || defined(Dim3)
      _vertex2IndexMap[fineGridX] = _vertexWriter->plotVertex(fineGridX);
      #else
      _vertex2IndexMap[fineGridX] = _vertexWriter->plotVertex(tarch::la::Vector<3,double>(fineGridX.data()));
      #endif

      if (fineGridVertex.isHangingNode()) {
        _vertexResidualWriter->plotVertex(_vertex2IndexMap[fineGridX],0.0);
        _vertexValueWriter->plotVertex(_vertex2IndexMap[fineGridX],0.0);
        // @todo For a smooth plot, it might make sense to set the 'right' rhs, i.e.
        //       the rhs belonging to a persistent vertex at this very position.
        _vertexRhsWriter->plotVertex(_vertex2IndexMap[fineGridX],0.0);
      }
      else {
        _vertexResidualWriter->plotVertex(_vertex2IndexMap[fineGridX],fineGridVertex.getResidual());
        _vertexValueWriter->plotVertex(_vertex2IndexMap[fineGridX],fineGridVertex.getU());
        _vertexRhsWriter->plotVertex(_vertex2IndexMap[fineGridX],fineGridVertex.getRhs());
      }
    }
  }
}