void peano::applications::pic::demo2::mappings::SpacetreeGrid2PlotSolution::enterCell(
      peano::applications::pic::demo2::SpacetreeGridCell&                 fineGridCell,
      peano::applications::pic::demo2::SpacetreeGridVertex * const        fineGridVertices,
      const peano::kernel::gridinterface::VertexEnumerator&                fineGridVerticesEnumerator,
      peano::applications::pic::demo2::SpacetreeGridVertex const * const  coarseGridVertices,
      const peano::kernel::gridinterface::VertexEnumerator&                coarseGridVerticesEnumerator,
      const peano::applications::pic::demo2::SpacetreeGridCell&            coarseGridCell,
      const tarch::la::Vector<DIMENSIONS,int>&                             fineGridPositionOfCell
) {
  logTraceInWith4Arguments( "enterCell(...)", fineGridCell, fineGridVerticesEnumerator.toString(), coarseGridCell, fineGridPositionOfCell );
   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);
	    }

	    _cellPWriter->plotCell( cellIndex,fineGridCell.getP() );
	  }
  logTraceOutWith1Argument( "enterCell(...)", fineGridCell );
}
void peano::applications::poisson::multigrid::mappings::SpacetreeGrid2PlotSolution::enterCell(
      peano::applications::poisson::multigrid::SpacetreeGridCell&                 fineGridCell,
      peano::applications::poisson::multigrid::SpacetreeGridVertex * const        fineGridVertices,
      const peano::kernel::gridinterface::VertexEnumerator&                fineGridVerticesEnumerator,
      peano::applications::poisson::multigrid::SpacetreeGridVertex const * const  coarseGridVertices,
      const peano::kernel::gridinterface::VertexEnumerator&                coarseGridVerticesEnumerator,
      const peano::applications::poisson::multigrid::SpacetreeGridCell&            coarseGridCell,
      const tarch::la::Vector<DIMENSIONS,int>&                             fineGridPositionOfCell
) {
  logTraceInWith4Arguments( "enterCell(...)", fineGridCell, fineGridVerticesEnumerator.toString(), coarseGridCell, fineGridPositionOfCell );

  if (!fineGridCell.isRefined()) {
    #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

    assertion( DIMENSIONS==2 || DIMENSIONS==3 );
    int vertexIndex[TWO_POWER_D];
    dfor2(i)
      tarch::la::Vector<DIMENSIONS,double> currentVertexPosition = fineGridVerticesEnumerator.getVertexPosition(i);
      assertion2 ( _vertex2IndexMap.find(currentVertexPosition) != _vertex2IndexMap.end(), currentVertexPosition, fineGridVertices[fineGridVerticesEnumerator(i)].toString() );
      vertexIndex[iScalar] = _vertex2IndexMap[currentVertexPosition];
    enddforx

    if (DIMENSIONS==2) {
      _cellWriter->plotQuadrangle(vertexIndex);
    }
    if (DIMENSIONS==3) {
      _cellWriter->plotHexahedron(vertexIndex);
    }
  }
Пример #3
0
void dem::repositories::RepositorySTDStack::restart(
  const tarch::la::Vector<DIMENSIONS,double>&  domainSize,
  const tarch::la::Vector<DIMENSIONS,double>&  domainOffset,
  int                                          domainLevel,
  const tarch::la::Vector<DIMENSIONS,int>&     positionOfCentralElementWithRespectToCoarserRemoteLevel
) {
  logTraceInWith4Arguments( "restart(...)", domainSize, domainOffset, domainLevel, positionOfCentralElementWithRespectToCoarserRemoteLevel );
  #ifdef Parallel
  assertion( !tarch::parallel::Node::getInstance().isGlobalMaster());
  #endif
  
  logInfo( "restart(...)", "start node for subdomain " << domainOffset << "x" << domainSize << " on level " << domainLevel << " with master " << tarch::parallel::NodePool::getInstance().getMasterRank() );
  
  assertion( _repositoryState.getAction() == dem::records::RepositoryState::Terminate );

  _vertexStack.clear();
  _cellStack.clear();

  _gridWithCreateGrid.restart(domainSize,domainOffset,domainLevel, positionOfCentralElementWithRespectToCoarserRemoteLevel);
  _gridWithCreateGridAndPlot.restart(domainSize,domainOffset,domainLevel, positionOfCentralElementWithRespectToCoarserRemoteLevel);
  _gridWithTimeStep.restart(domainSize,domainOffset,domainLevel, positionOfCentralElementWithRespectToCoarserRemoteLevel);
  _gridWithTimeStepAndPlot.restart(domainSize,domainOffset,domainLevel, positionOfCentralElementWithRespectToCoarserRemoteLevel);
  _gridWithTimeStepOnDynamicGrid.restart(domainSize,domainOffset,domainLevel, positionOfCentralElementWithRespectToCoarserRemoteLevel);
  _gridWithTimeStepAndPlotOnDynamicGrid.restart(domainSize,domainOffset,domainLevel, positionOfCentralElementWithRespectToCoarserRemoteLevel);
  _gridWithTimeStepOnReluctantDynamicGrid.restart(domainSize,domainOffset,domainLevel, positionOfCentralElementWithRespectToCoarserRemoteLevel);
  _gridWithTimeStepAndPlotOnReluctantDynamicGrid.restart(domainSize,domainOffset,domainLevel, positionOfCentralElementWithRespectToCoarserRemoteLevel);


  _solverState.restart();

  logTraceOut( "restart(...)" );
}
Пример #4
0
void peanoclaw::mappings::ValidateGrid::destroyCell(
      const peanoclaw::Cell&           fineGridCell,
      peanoclaw::Vertex * const        fineGridVertices,
      const peano::grid::VertexEnumerator&                fineGridVerticesEnumerator,
      peanoclaw::Vertex * const        coarseGridVertices,
      const peano::grid::VertexEnumerator&                coarseGridVerticesEnumerator,
      peanoclaw::Cell&                 coarseGridCell,
      const tarch::la::Vector<DIMENSIONS,int>&                             fineGridPositionOfCell
) {
  logTraceInWith4Arguments( "destroyCell(...)", fineGridCell, fineGridVerticesEnumerator.toString(), coarseGridCell, fineGridPositionOfCell );

  //TODO unterweg debug
//  std::cout<< "Destroying cell " << fineGridVerticesEnumerator.getVertexPosition(0) << ", "
//      << fineGridVerticesEnumerator.getCellSize()
//      << ", index=" << fineGridCell.getCellDescriptionIndex()
//      #ifdef Parallel
//      << ", rank=" << tarch::parallel::Node::getInstance().getRank()
//      #endif
//      << std::endl;

  _validator.deletePatchIfNotRemote(
    fineGridVerticesEnumerator.getVertexPosition(0),
    fineGridVerticesEnumerator.getLevel()
  );

  logTraceOutWith1Argument( "destroyCell(...)", fineGridCell );
}
Пример #5
0
void scenario::diffusionequation::CornerPointField::CornerPointPillar::addLayerData( double permeability, double cellsUpperLayer, double cellsLowerLayer, bool sortLayersIfNecessary) {
  logTraceInWith4Arguments( "CornerPointPillar::addLayerData(...)", permeability, cellsUpperLayer, cellsLowerLayer, toString() );

  if (sortLayersIfNecessary && cellsUpperLayer<cellsLowerLayer) {
    double tmp = cellsUpperLayer;
    cellsUpperLayer = cellsLowerLayer;
    cellsLowerLayer = tmp;
  }

  if (tarch::la::greater(permeability,0.0) && tarch::la::greater(cellsUpperLayer,cellsLowerLayer)) {
    if (cellsUpperLayer>0.0) {
      logWarning( "CornerPointPillar::addLayerData(...)", "upper layer of cell segmented is greater than 0.0, i.e. model perhaps is not a subsurface model. upper layer-depth=" << cellsUpperLayer );
    }
    if (cellsLowerLayer>0.0) {
      logWarning( "CornerPointPillar::addLayerData(...)", "lower layer of cell segmented is greater than 0.0, i.e. model perhaps is not a subsurface model. lower layer-depth=" << cellsLowerLayer );
    }

    Cell newCell;
    newCell._permeability    = permeability;
    newCell._cellsLowerLayer = cellsLowerLayer;
    newCell._cellsUpperLayer = cellsUpperLayer;

    std::vector<Cell>::iterator p = _cells.begin();

    while (p!=_cells.end() && p->_cellsLowerLayer>=newCell._cellsUpperLayer) {
      p++;
    }

    _cells.insert(p,newCell);
  }

  logTraceOutWith1Argument( "CornerPointPillar::addLayerData(...)", toString() );
}
Пример #6
0
void peano::applications::poisson::multigrid::mappings::SpacetreeGrid2Smooth::enterCell(
  peano::applications::poisson::multigrid::SpacetreeGridCell&                  fineGridCell,
  peano::applications::poisson::multigrid::SpacetreeGridVertex * const         fineGridVertices,
  const peano::kernel::gridinterface::VertexEnumerator&                        fineGridVerticesEnumerator,
  peano::applications::poisson::multigrid::SpacetreeGridVertex const * const   coarseGridVertices,
  const peano::kernel::gridinterface::VertexEnumerator&                        coarseGridVerticesEnumerator,
  const peano::applications::poisson::multigrid::SpacetreeGridCell&            coarseGridCell,
  const tarch::la::Vector<DIMENSIONS,int>&                                     fineGridPositionOfCell
) {
  logTraceInWith4Arguments("enterCell(...)", fineGridCell, fineGridVerticesEnumerator.toString(), coarseGridCell, fineGridPositionOfCell);

  if (!fineGridCell.isRefined()) {
    tarch::la::Matrix<NUMBER_OF_VERTICES_PER_ELEMENT,NUMBER_OF_VERTICES_PER_ELEMENT, double>
      elementWiseAssemblyMatrix = _elementMatrix.getElementWiseAssemblyMatrix(SpacetreeGridVertex::readStencil(fineGridVerticesEnumerator, fineGridVertices));

#ifdef Asserts
  if(fineGridVertices[fineGridVerticesEnumerator(0)].isInside()){
    peano::toolbox::stencil::Stencil teststencil =
        _elementMatrix.reconstructStencil(elementWiseAssemblyMatrix);

    assertionVectorNumericalEquals(teststencil, fineGridVertices[fineGridVerticesEnumerator(0)].getStencil());
  }
#endif

    tarch::la::Vector<TWO_POWER_D,double> residual = SpacetreeGridVertex::readResidual(fineGridVerticesEnumerator, fineGridVertices);
    tarch::la::Vector<TWO_POWER_D,double> u        = SpacetreeGridVertex::readU(fineGridVerticesEnumerator, fineGridVertices);

    residual -= elementWiseAssemblyMatrix * u;

    SpacetreeGridVertex::writeResidual(fineGridVerticesEnumerator, fineGridVertices, residual);
  }

  logTraceOutWith1Argument("enterCell(...)", fineGridCell);
}
Пример #7
0
void peano::applications::heatequation::timestepping::mappings::SpacetreeGrid2Smooth::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
) {
    bool isCurrentActiveGrid =
        fineGridVerticesEnumerator.getLevel()==_activeLevel;
    bool isCoarserLevelThanCurrentFineGridButBelongsToFineGrid =
        !fineGridCell.isRefined() &&
        fineGridVerticesEnumerator.getLevel()<_activeLevel;
    bool isCoarserLevelThanCurrentFineGridButIsAdjacentToFineGrid =
        fineGridCell.isRefined() &&
        peano::kernel::spacetreegrid::aspects::VertexStateAnalysis::doesOneVertexCarryRefinementFlag(fineGridVertices,fineGridVerticesEnumerator,peano::applications::heatequation::timestepping::SpacetreeGridSingleStepVertex::Records::Unrefined) &&
        fineGridVerticesEnumerator.getLevel()<_activeLevel;
    if ( isCurrentActiveGrid || isCoarserLevelThanCurrentFineGridButBelongsToFineGrid || isCoarserLevelThanCurrentFineGridButIsAdjacentToFineGrid ) {
        logTraceInWith4Arguments( "enterCell(...)", fineGridCell, fineGridVerticesEnumerator.toString(), coarseGridCell, fineGridPositionOfCell );
#ifdef Debug
        dfor2(k)
        logDebug( "enterCell(...)", "  - vertex " << kScalar << "=" << fineGridVertices[fineGridVerticesEnumerator(k)] );
        enddforx
#endif

        _solver.computeResidualOnCell(fineGridVertices,fineGridVerticesEnumerator);

        logTraceOutWith1Argument( "enterCell(...)", fineGridCell );
#ifdef Debug
        dfor2(k)
        logDebug( "enterCell(...)", "  - vertex " << kScalar << "=" << fineGridVertices[fineGridVerticesEnumerator(k)] );
        enddforx
#endif
    }
Пример #8
0
void particles::pidt::mappings::MoveParticles::enterCell(
  particles::pidt::Cell&                    fineGridCell,
  particles::pidt::Vertex * const           fineGridVertices,
  const peano::grid::VertexEnumerator&      fineGridVerticesEnumerator,
  particles::pidt::Vertex * const           coarseGridVertices,
  const peano::grid::VertexEnumerator&      coarseGridVerticesEnumerator,
  particles::pidt::Cell&                    coarseGridCell,
  const tarch::la::Vector<DIMENSIONS,int>&  fineGridPositionOfCell
) {
  logTraceInWith4Arguments( "enterCell(...)", fineGridCell, fineGridVerticesEnumerator.toString(), coarseGridCell, fineGridPositionOfCell );

  if (fineGridCell.isRefined()) {
    fineGridCell.clearMaxVComponent();
  }
  else {
    #if defined(SharedTBB) && !defined(__WIN32__)
    tbb::atomic<int>     numberOfParticlesMoved;
    #elif defined(SharedTBB) && defined(__WIN32__)
    static tarch::multicore::BooleanSemaphore  semaphore;
    int    numberOfParticlesMoved;
    #elif SharedOMP
      #error not implemented yet
    #else
    int    numberOfParticlesMoved;
    #endif
    numberOfParticlesMoved = 0;

    pdfor2(k)
      const int sourceVertexIndex = fineGridVertices[ fineGridVerticesEnumerator(k) ].getVertexIndex();

      #ifdef MOVE_USES_SORTED_PARTICLES
      const int resultOfOneVertex = moveParticlesOfOneVertexWithinCellIfTheyAreSorted(
        sourceVertexIndex,
        fineGridVerticesEnumerator
      );
      #else
      const int resultOfOneVertex = moveParticlesOfOneVertexWithinCell(
        sourceVertexIndex,
        fineGridVerticesEnumerator
      );
      #endif

      #if defined(SharedTBB) && defined(__WIN32__)
      tarch::multicore::Lock lock(semaphore);
      #endif
      numberOfParticlesMoved += resultOfOneVertex;
    endpdforx

    _state.updateParticleStatisticsInLeaf(numberOfParticlesMoved,fineGridVerticesEnumerator.getCellSize());
  }

  logTraceOutWith1Argument( "enterCell(...)", fineGridCell );
}
void peano::applications::poisson::multigrid::mappings::SpacetreeGrid2PlotSolution::destroyCell(
  const peano::applications::poisson::multigrid::SpacetreeGridCell&           fineGridCell,
  peano::applications::poisson::multigrid::SpacetreeGridVertex const * const  fineGridVertices,
  const peano::kernel::gridinterface::VertexEnumerator&                       fineGridVerticesEnumerator,
  peano::applications::poisson::multigrid::SpacetreeGridVertex * const        coarseGridVertices,
  const peano::kernel::gridinterface::VertexEnumerator&                       coarseGridVerticesEnumerator,
  peano::applications::poisson::multigrid::SpacetreeGridCell&                 coarseGridCell,
  const tarch::la::Vector<DIMENSIONS,int>&                                    fineGridPositionOfCell
) {
  logTraceInWith4Arguments( "destroyCell(...)", fineGridCell, fineGridVerticesEnumerator.toString(), coarseGridCell, fineGridPositionOfCell );
  logTraceOutWith1Argument( "destroyCell(...)", fineGridCell );
}
void peano::applications::faxen::mappings::SpacetreeGrid2ComputeVelocitiesDerivatives::createCell(
      peano::applications::faxen::SpacetreeGridCell&                 fineGridCell,
      peano::applications::faxen::SpacetreeGridVertex *              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
) {
  logTraceInWith4Arguments( "createCell(...)", fineGridCell, fineGridVerticesEnumerator.toString(), coarseGridCell, fineGridPositionOfCell );
  // @todo Insert your code here
  logTraceOutWith1Argument( "createCell(...)", fineGridCell );
}
void peano::applications::navierstokes::prototype1::mappings::SpacetreeGrid2CalculatePPERHS::createCell(
      peano::applications::navierstokes::prototype1::SpacetreeGridFluidCellEnhancedDivFreeEulerExplicit&                 fineGridCell,
      peano::applications::navierstokes::prototype1::SpacetreeGridFluidVertexEnhancedDivFreeEulerExplicit *              fineGridVertices,
      const peano::kernel::gridinterface::VertexEnumerator&                fineGridVerticesEnumerator,
      peano::applications::navierstokes::prototype1::SpacetreeGridFluidVertexEnhancedDivFreeEulerExplicit const * const  coarseGridVertices,
      const peano::kernel::gridinterface::VertexEnumerator&                coarseGridVerticesEnumerator,
      const peano::applications::navierstokes::prototype1::SpacetreeGridFluidCellEnhancedDivFreeEulerExplicit&           coarseGridCell,
      const tarch::la::Vector<DIMENSIONS,int>&                             fineGridPositionOfCell
) {
  logTraceInWith4Arguments( "createCell(...)", fineGridCell, fineGridVerticesEnumerator.toString(), coarseGridCell, fineGridPositionOfCell );
  // @todo Insert your code here
  logTraceOutWith1Argument( "createCell(...)", fineGridCell );
}
Пример #12
0
void peanoclaw::mappings::Cleanup::leaveCell(
    peanoclaw::Cell&           fineGridCell,
    peanoclaw::Vertex * const  fineGridVertices,
    const peano::grid::VertexEnumerator&          fineGridVerticesEnumerator,
    peanoclaw::Vertex * const  coarseGridVertices,
    const peano::grid::VertexEnumerator&          coarseGridVerticesEnumerator,
    peanoclaw::Cell&           coarseGridCell,
    const tarch::la::Vector<DIMENSIONS,int>&                       fineGridPositionOfCell
) {
    logTraceInWith4Arguments( "leaveCell(...)", fineGridCell, fineGridVerticesEnumerator.toString(), coarseGridCell, fineGridPositionOfCell );
    // @todo Insert your code here
    logTraceOutWith1Argument( "leaveCell(...)", fineGridCell );
}
void peano::applications::poisson::multigrid::mappings::SpacetreeGrid2SetupExperiment::leaveCell(
      peano::applications::poisson::multigrid::SpacetreeGridCell&           fineGridCell,
      peano::applications::poisson::multigrid::SpacetreeGridVertex * const  fineGridVertices,
      const peano::kernel::gridinterface::VertexEnumerator&          fineGridVerticesEnumerator,
      peano::applications::poisson::multigrid::SpacetreeGridVertex * const  coarseGridVertices,
      const peano::kernel::gridinterface::VertexEnumerator&          coarseGridVerticesEnumerator,
      peano::applications::poisson::multigrid::SpacetreeGridCell&           coarseGridCell,
      const tarch::la::Vector<DIMENSIONS,int>&                       fineGridPositionOfCell
) {
  logTraceInWith4Arguments( "leaveCell(...)", fineGridCell, fineGridVerticesEnumerator.toString(), coarseGridCell, fineGridPositionOfCell );
  // @todo Insert your code here
  logTraceOutWith1Argument( "leaveCell(...)", fineGridCell );
}
void peano::applications::faxen::lbf::mappings::SpacetreeGrid2SetVelocitiesBoundary::destroyCell(
      const peano::applications::faxen::lbf::SpacetreeGridBlockCell&           fineGridCell,
      peano::applications::faxen::lbf::SpacetreeGridBlockVertex const * const  fineGridVertices,
      const peano::kernel::gridinterface::VertexEnumerator&                fineGridVerticesEnumerator,
      peano::applications::faxen::lbf::SpacetreeGridBlockVertex * const        coarseGridVertices,
      const peano::kernel::gridinterface::VertexEnumerator&                coarseGridVerticesEnumerator,
      peano::applications::faxen::lbf::SpacetreeGridBlockCell&                 coarseGridCell,
      const tarch::la::Vector<DIMENSIONS,int>&                             fineGridPositionOfCell
) {
  logTraceInWith4Arguments( "destroyCell(...)", fineGridCell, fineGridVerticesEnumerator.toString(), coarseGridCell, fineGridPositionOfCell );
  // @todo Insert your code here
  logTraceOutWith1Argument( "destroyCell(...)", fineGridCell );
}
Пример #15
0
void particles::pidt::mappings::MoveParticles::leaveCell(
  particles::pidt::Cell&                    fineGridCell,
  particles::pidt::Vertex * const           fineGridVertices,
  const peano::grid::VertexEnumerator&      fineGridVerticesEnumerator,
  particles::pidt::Vertex * const           coarseGridVertices,
  const peano::grid::VertexEnumerator&      coarseGridVerticesEnumerator,
  particles::pidt::Cell&                    coarseGridCell,
  const tarch::la::Vector<DIMENSIONS,int>&  fineGridPositionOfCell
) {
  logTraceInWith4Arguments( "leaveCell(...)", fineGridCell, fineGridVerticesEnumerator.toString(), coarseGridCell, fineGridPositionOfCell );

  double maxVComponentInCell = 0.0;

  dfor2(k)
    const int sourceVertexIndex = fineGridVertices[ fineGridVerticesEnumerator(k) ].getVertexIndex();

    ParticleHeap::HeapEntries& sourceVertexParticles = ParticleHeap::getInstance().getData(sourceVertexIndex);

    for (
      ParticleHeap::HeapEntries::iterator p = sourceVertexParticles.begin();
      p!=sourceVertexParticles.end();
    ) {
      const tarch::la::Vector<DIMENSIONS,int> newDualCellOfParticle = Vertex::getDualCellOfParticle(
        fineGridVerticesEnumerator,
        p->_persistentRecords._x
      );

      const double maxVComponentOfParticle = tarch::la::maxAbs(p->_persistentRecords._v);
      maxVComponentInCell = maxVComponentInCell > maxVComponentOfParticle ? maxVComponentInCell : maxVComponentOfParticle;

      const bool MoveParticleToDifferentDualCell = newDualCellOfParticle!=k;
      if (MoveParticleToDifferentDualCell) {
        Vertex& newVertexOfParticles = fineGridVertices[ fineGridVerticesEnumerator(newDualCellOfParticle) ];
        newVertexOfParticles.particlesWereAddedToThisVertex();
        const int destinationVertexIndex = newVertexOfParticles.getVertexIndex();
        ParticleHeap::getInstance().getData(destinationVertexIndex).push_back(*p);
        p = ParticleHeap::getInstance().getData(sourceVertexIndex).erase(p);
        logDebug( "leaveCell(...)", "reassign particle " << p->toString() << " to vertex " << newDualCellOfParticle );
      }
      else {
        p++;
      }
    }
  enddforx

  if (!fineGridCell.isRefined()) {
    fineGridCell.setMaxVComponent( maxVComponentInCell );
  }

  logTraceOut( "leaveCell(...)" );
}
Пример #16
0
void peanoclaw::mappings::ValidateGrid::createCell(
      peanoclaw::Cell&                 fineGridCell,
      peanoclaw::Vertex * const        fineGridVertices,
      const peano::grid::VertexEnumerator&                fineGridVerticesEnumerator,
      peanoclaw::Vertex * const        coarseGridVertices,
      const peano::grid::VertexEnumerator&                coarseGridVerticesEnumerator,
      peanoclaw::Cell&                 coarseGridCell,
      const tarch::la::Vector<DIMENSIONS,int>&                             fineGridPositionOfCell
) {
  logTraceInWith4Arguments( "createCell(...)", fineGridCell, fineGridVerticesEnumerator.toString(), coarseGridCell, fineGridPositionOfCell );

  //TODO unterweg debug
  logInfo("", "Creating cell " << fineGridVerticesEnumerator.getVertexPosition(0) << ", "
      << fineGridVerticesEnumerator.getCellSize()
      << ", index=" << fineGridCell.getCellDescriptionIndex()
      << ",level=" << fineGridVerticesEnumerator.getLevel()
      );

  logTraceOutWith1Argument( "createCell(...)", fineGridCell );
}
void peano::applications::heatequation::timestepping::mappings::SpacetreeGrid2ComputeImplicitSolutionWithJacobi::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
) {
  bool belongsToFineGrid =
    !fineGridCell.isRefined();
  bool isCoarserLevelButIsAdjacentToFineGrid =
    fineGridCell.isRefined() &&
    peano::kernel::spacetreegrid::aspects::VertexStateAnalysis::doesOneVertexCarryRefinementFlag(fineGridVertices,fineGridVerticesEnumerator,peano::applications::heatequation::timestepping::SpacetreeGridSingleStepVertex::Records::Unrefined);
  if ( belongsToFineGrid || isCoarserLevelButIsAdjacentToFineGrid ) {
    logTraceInWith4Arguments( "enterCell(...)", fineGridCell, fineGridVerticesEnumerator.toString(), coarseGridCell, fineGridPositionOfCell );
    _solver.computeResidualOnCell(fineGridVertices,fineGridVerticesEnumerator);
    logTraceOutWith1Argument( "enterCell(...)", fineGridCell );
  }
}
Пример #18
0
void peanoclaw::repositories::RepositoryArrayStack::restart(
  const tarch::la::Vector<DIMENSIONS,double>&  domainSize,
  const tarch::la::Vector<DIMENSIONS,double>&  domainOffset,
  int                                          domainLevel,
  const tarch::la::Vector<DIMENSIONS,int>&     positionOfCentralElementWithRespectToCoarserRemoteLevel
) {
  logTraceInWith4Arguments( "restart(...)", domainSize, domainOffset, domainLevel, positionOfCentralElementWithRespectToCoarserRemoteLevel );
  #ifdef Parallel
  assertion( !tarch::parallel::Node::getInstance().isGlobalMaster());
  #endif
  
  logInfo( "restart(...)", "start node for subdomain " << domainOffset << "x" << domainSize << " on level " << domainLevel );
  
  assertion( _repositoryState.getAction() == peanoclaw::records::RepositoryState::Terminate );

  _vertexStack.clear();
  _cellStack.clear();

  _gridWithInitialiseGrid.restart(domainSize,domainOffset,domainLevel,positionOfCentralElementWithRespectToCoarserRemoteLevel);
  _gridWithInitialiseAndValidateGrid.restart(domainSize,domainOffset,domainLevel,positionOfCentralElementWithRespectToCoarserRemoteLevel);
  _gridWithPlot.restart(domainSize,domainOffset,domainLevel,positionOfCentralElementWithRespectToCoarserRemoteLevel);
  _gridWithPlotAndValidateGrid.restart(domainSize,domainOffset,domainLevel,positionOfCentralElementWithRespectToCoarserRemoteLevel);
  _gridWithRemesh.restart(domainSize,domainOffset,domainLevel,positionOfCentralElementWithRespectToCoarserRemoteLevel);
  _gridWithSolveTimestep.restart(domainSize,domainOffset,domainLevel,positionOfCentralElementWithRespectToCoarserRemoteLevel);
  _gridWithSolveTimestepAndValidateGrid.restart(domainSize,domainOffset,domainLevel,positionOfCentralElementWithRespectToCoarserRemoteLevel);
  _gridWithSolveTimestepAndPlot.restart(domainSize,domainOffset,domainLevel,positionOfCentralElementWithRespectToCoarserRemoteLevel);
  _gridWithSolveTimestepAndPlotAndValidateGrid.restart(domainSize,domainOffset,domainLevel,positionOfCentralElementWithRespectToCoarserRemoteLevel);
  _gridWithGatherCurrentSolution.restart(domainSize,domainOffset,domainLevel,positionOfCentralElementWithRespectToCoarserRemoteLevel);
  _gridWithGatherCurrentSolutionAndValidateGrid.restart(domainSize,domainOffset,domainLevel,positionOfCentralElementWithRespectToCoarserRemoteLevel);
  _gridWithCleanup.restart(domainSize,domainOffset,domainLevel,positionOfCentralElementWithRespectToCoarserRemoteLevel);

 
   _solverState.restart();
 
  logTraceOut( "restart(...)" );
}