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 );
}
Exemple #2
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 );
}