void peano::applications::poisson::multigrid::mappings::SpacetreeGrid2SetupExperiment::createBoundaryVertex(
  peano::applications::poisson::multigrid::SpacetreeGridVertex&               fineGridVertex,
  const tarch::la::Vector<DIMENSIONS,double>&                                 fineGridX,
  const tarch::la::Vector<DIMENSIONS,double>&                                 fineGridH,
  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>&                                    fineGridPositionOfVertex
) {
  logTraceInWith6Arguments( "createBoundaryVertex(...)", fineGridVertex, fineGridX, fineGridH, coarseGridVerticesEnumerator.toString(), coarseGridCell, fineGridPositionOfVertex );
  //  if (tarch::la::volume(fineGridH) > _refinementThreshold) {
  //    fineGridVertex.refine();
  //  }
    if (coarseGridVerticesEnumerator.getLevel() < 3) {
      fineGridVertex.refine();
    }

    peano::toolbox::stencil::Stencil stencil(0.0);
    fineGridVertex.setStencil(stencil);

    peano::toolbox::stencil::ProlongationMatrix prolongation (0.0);
    fineGridVertex.setP(prolongation);

    peano::toolbox::stencil::RestrictionMatrix restriction(0.0);
    fineGridVertex.setR(restriction);

    fineGridVertex.clearTempAP();
    fineGridVertex.clearTempP();

  logTraceOutWith1Argument( "createBoundaryVertex(...)", fineGridVertex );
}
Ejemplo n.º 2
0
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 );
}
Ejemplo n.º 3
0
void peanoclaw::mappings::Cleanup::mergeWithNeighbour(
    peanoclaw::Vertex&  vertex,
    const peanoclaw::Vertex&  neighbour,
    int                                           fromRank,
    const tarch::la::Vector<DIMENSIONS,double>&   fineGridX,
    const tarch::la::Vector<DIMENSIONS,double>&   fineGridH,
    int                                           level
) {
    logTraceInWith6Arguments( "mergeWithNeighbour(...)", vertex, neighbour, fromRank, fineGridX, fineGridH, level );
    // @todo Insert your code here
    logTraceOut( "mergeWithNeighbour(...)" );
}
Ejemplo n.º 4
0
void peanoclaw::mappings::Cleanup::mergeWithRemoteDataDueToForkOrJoin(
    peanoclaw::Vertex&  localVertex,
    const peanoclaw::Vertex&  masterOrWorkerVertex,
    int                                       fromRank,
    const tarch::la::Vector<DIMENSIONS,double>&  x,
    const tarch::la::Vector<DIMENSIONS,double>&  h,
    int                                       level
) {
    logTraceInWith6Arguments( "mergeWithRemoteDataDueToForkOrJoin(...)", localVertex, masterOrWorkerVertex, fromRank, x, h, level );
    // @todo Insert your code here
    logTraceOut( "mergeWithRemoteDataDueToForkOrJoin(...)" );
}
void peano::applications::poisson::multigrid::mappings::SpacetreeGrid2PlotSolution::destroyVertex(
  const peano::applications::poisson::multigrid::SpacetreeGridVertex&   fineGridVertex,
  const tarch::la::Vector<DIMENSIONS,double>&                    fineGridX,
  const tarch::la::Vector<DIMENSIONS,double>&                    fineGridH,
  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>&                       fineGridPositionOfVertex
) {
  logTraceInWith6Arguments( "destroyVertex(...)", fineGridVertex, fineGridX, fineGridH, coarseGridVerticesEnumerator.toString(), coarseGridCell, fineGridPositionOfVertex );
  logTraceOutWith1Argument( "destroyVertex(...)", fineGridVertex );
}
void peano::applications::faxen::lbf::mappings::SpacetreeGrid2CorrectDensity4LB::touchVertexFirstTime(
      peano::applications::faxen::lbf::SpacetreeGridBlockVertex&               fineGridVertex,
      const tarch::la::Vector<DIMENSIONS,double>&                          fineGridX,
      const tarch::la::Vector<DIMENSIONS,double>&                          fineGridH,
      peano::applications::faxen::lbf::SpacetreeGridBlockVertex const * const  coarseGridVertices,
      const peano::kernel::gridinterface::VertexEnumerator&                coarseGridVerticesEnumerator,
      const peano::applications::faxen::lbf::SpacetreeGridBlockCell&           coarseGridCell,
      const tarch::la::Vector<DIMENSIONS,int>&                             fineGridPositionOfVertex
) {
  logTraceInWith6Arguments( "touchVertexFirstTime(...)", fineGridVertex, fineGridX, fineGridH, coarseGridVerticesEnumerator.toString(), coarseGridCell, fineGridPositionOfVertex );
  // @todo Insert your code here
  logTraceOutWith1Argument( "touchVertexFirstTime(...)", fineGridVertex );
}
void peano::applications::faxen::lbf::mappings::SpacetreeGrid2SetVelocitiesBoundary::createHangingVertex(
      peano::applications::faxen::lbf::SpacetreeGridBlockVertex&               fineGridVertex,
      const tarch::la::Vector<DIMENSIONS,double>&                          fineGridX,
      const tarch::la::Vector<DIMENSIONS,double>&                          fineGridH,
      peano::applications::faxen::lbf::SpacetreeGridBlockVertex const * const  coarseGridVertices,
      const peano::kernel::gridinterface::VertexEnumerator&                coarseGridVerticesEnumerator,
      const peano::applications::faxen::lbf::SpacetreeGridBlockCell&            coarseGridCell,
      const tarch::la::Vector<DIMENSIONS,int>&                             fineGridPositionOfVertex
) {
  logTraceInWith6Arguments( "createHangingVertex(...)", fineGridVertex, fineGridX, fineGridH, coarseGridVerticesEnumerator.toString(), coarseGridCell, fineGridPositionOfVertex );
  // @todo Insert your code here
  logTraceOutWith1Argument( "createHangingVertex(...)", fineGridVertex );
}
Ejemplo n.º 8
0
void peanoclaw::mappings::Cleanup::createHangingVertex(
    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( "createHangingVertex(...)", fineGridVertex, fineGridX, fineGridH, coarseGridVerticesEnumerator.toString(), coarseGridCell, fineGridPositionOfVertex );
    // @todo Insert your code here
    logTraceOutWith1Argument( "createHangingVertex(...)", fineGridVertex );
}
void peano::applications::pic::demo2::mappings::SpacetreeGrid2PlotSolution::destroyHangingVertex(
      const peano::applications::pic::demo2::SpacetreeGridVertex&   fineGridVertex,
      const tarch::la::Vector<DIMENSIONS,double>&                    fineGridX,
      const tarch::la::Vector<DIMENSIONS,double>&                    fineGridH,
      peano::applications::pic::demo2::SpacetreeGridVertex * const  coarseGridVertices,
      const peano::kernel::gridinterface::VertexEnumerator&          coarseGridVerticesEnumerator,
      peano::applications::pic::demo2::SpacetreeGridCell&           coarseGridCell,
      const tarch::la::Vector<DIMENSIONS,int>&                       fineGridPositionOfVertex
) {
  logTraceInWith6Arguments( "destroyHangingVertex(...)", fineGridVertex, fineGridX, fineGridH, coarseGridVerticesEnumerator.toString(), coarseGridCell, fineGridPositionOfVertex );
  // @todo Insert your code here
  logTraceOutWith1Argument( "destroyHangingVertex(...)", fineGridVertex );
}
void peano::applications::faxen::mappings::SpacetreeGrid2ComputeVelocitiesDerivatives::destroyVertex(
      const peano::applications::faxen::SpacetreeGridVertex&   fineGridVertex,
      const tarch::la::Vector<DIMENSIONS,double>&                    fineGridX,
      const tarch::la::Vector<DIMENSIONS,double>&                    fineGridH,
      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>&                       fineGridPositionOfVertex
) {
  logTraceInWith6Arguments( "destroyVertex(...)", fineGridVertex, fineGridX, fineGridH, coarseGridVerticesEnumerator.toString(), coarseGridCell, fineGridPositionOfVertex );
  // @todo Insert your code here
  logTraceOutWith1Argument( "destroyVertex(...)", fineGridVertex );
}
void peano::applications::navierstokes::prototype1::mappings::SpacetreeGrid2CalculatePPERHS::destroyVertex(
      const peano::applications::navierstokes::prototype1::SpacetreeGridFluidVertexEnhancedDivFreeEulerExplicit&   fineGridVertex,
      const tarch::la::Vector<DIMENSIONS,double>&                    fineGridX,
      const tarch::la::Vector<DIMENSIONS,double>&                    fineGridH,
      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>&                       fineGridPositionOfVertex
) {
  logTraceInWith6Arguments( "destroyVertex(...)", fineGridVertex, fineGridX, fineGridH, coarseGridVerticesEnumerator.toString(), coarseGridCell, fineGridPositionOfVertex );
  // @todo Insert your code here
  logTraceOutWith1Argument( "destroyVertex(...)", fineGridVertex );
}
void peano::applications::poisson::multigrid::mappings::SpacetreeGrid2SetupExperiment::touchVertexLastTime(
      peano::applications::poisson::multigrid::SpacetreeGridVertex&         fineGridVertex,
      const tarch::la::Vector<DIMENSIONS,double>&                    fineGridX,
      const tarch::la::Vector<DIMENSIONS,double>&                    fineGridH,
      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>&                       fineGridPositionOfVertex
) {
  logTraceInWith6Arguments( "touchVertexLastTime(...)", fineGridVertex, fineGridX, fineGridH, coarseGridVerticesEnumerator.toString(), coarseGridCell, fineGridPositionOfVertex );
  // @todo Insert your code here
  logTraceOutWith1Argument( "touchVertexLastTime(...)", fineGridVertex );
}
Ejemplo n.º 13
0
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 peano::applications::heatequation::timestepping::mappings::SpacetreeGrid2ComputeImplicitSolutionWithJacobi::touchVertexFirstTime(
  peano::applications::heatequation::timestepping::SpacetreeGridSingleStepVertex&               fineGridVertex,
  const tarch::la::Vector<DIMENSIONS,double>&                                                   fineGridX,
  const tarch::la::Vector<DIMENSIONS,double>&                                                   fineGridH,
  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>&                                                      fineGridPositionOfVertex
) {
  logTraceInWith6Arguments( "touchVertexFirstTime(...)", fineGridVertex, fineGridX, fineGridH, coarseGridVerticesEnumerator.toString(), coarseGridCell, fineGridPositionOfVertex );

  fineGridVertex.clearResidual();

  logTraceOutWith1Argument( "touchVertexFirstTime(...)", fineGridVertex );
}
Ejemplo n.º 15
0
void peano::applications::poisson::multigrid::mappings::SpacetreeGrid2Smooth::touchVertexFirstTime(
  peano::applications::poisson::multigrid::SpacetreeGridVertex&               fineGridVertex,
  const tarch::la::Vector<DIMENSIONS,double>&                                 fineGridX,
  const tarch::la::Vector<DIMENSIONS,double>&                                 fineGridH,
  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>&                                    fineGridPositionOfVertex
){
  logTraceInWith6Arguments( "touchVertexFirstTime(...)", fineGridVertex, fineGridX, fineGridH, coarseGridVerticesEnumerator.toString(), coarseGridCell, fineGridPositionOfVertex );

  fineGridVertex.clearResidual();

  logTraceOutWith1Argument( "touchVertexFirstTime(...)", fineGridVertex );
}
Ejemplo n.º 16
0
void particles::pidt::mappings::MoveParticles::mergeWithNeighbour(
  particles::pidt::Vertex&                      vertex,
  const particles::pidt::Vertex&                neighbour,
  int                                           fromRank,
  const tarch::la::Vector<DIMENSIONS,double>&   fineGridX,
  const tarch::la::Vector<DIMENSIONS,double>&   fineGridH,
  int                                           level
) {
  logTraceInWith6Arguments( "mergeWithNeighbour(...)", vertex, neighbour, fromRank, fineGridX, fineGridH, level );

  #if defined(Asserts) || defined(Asserts)
  const int receiveEntries =
  #endif
  ParticleHeap::getInstance().receiveData(
    vertex.getVertexIndex(),
    fromRank,
    fineGridX,
    level,
    peano::heap::NeighbourCommunication
  );

  #ifdef Asserts
  for (
    ParticleHeap::HeapEntries::const_iterator p = ParticleHeap::getInstance().getData(vertex.getVertexIndex()).begin();
    p != ParticleHeap::getInstance().getData(vertex.getVertexIndex()).end();
    p++
  ) {
    assertion8(
      Vertex::isContainedInDualCell(fineGridX,fineGridH,p->_persistentRecords._x),
      fineGridX,fineGridH,p->toString(),p->_persistentRecords._x - fineGridX,level,
      vertex.toString(), fromRank, receiveEntries
    );

    const int  whichAdjacentCellHoldsParticle =
      peano::utils::dLinearised(Vertex::getDualCellOfParticle(fineGridX,p->_persistentRecords._x),2);

    const bool particleIsOnLocalRank = vertex.getAdjacentRanks()(whichAdjacentCellHoldsParticle)==tarch::parallel::Node::getInstance().getRank();

    assertion8(
      particleIsOnLocalRank,
      fineGridX,fineGridH,p->toString(),p->_persistentRecords._x - fineGridX,level,
      vertex.toString(), fromRank, receiveEntries
    );
  }
  #endif

  logTraceOutWith1Argument( "mergeWithNeighbour(...)", receiveEntries );
}
Ejemplo n.º 17
0
void peano::applications::heatequation::timestepping::adapters::SpacetreeGrid2PlotGrid::touchVertexFirstTime(
      peano::applications::heatequation::timestepping::SpacetreeGridSingleStepVertex&               fineGridVertex,
      const tarch::la::Vector<DIMENSIONS,double>&                          fineGridX,
      const tarch::la::Vector<DIMENSIONS,double>&                          fineGridH,
      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>&                             fineGridPositionOfVertex
) {
  logTraceInWith6Arguments( "touchVertexFirstTime(...)", fineGridVertex, fineGridX, fineGridH, coarseGridVerticesEnumerator.toString(), coarseGridCell, fineGridPositionOfVertex );



  plotVertex( fineGridVertex, fineGridX );

  logTraceOutWith1Argument( "touchVertexFirstTime(...)", _vertex2IndexMap.size() );
}
Ejemplo n.º 18
0
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 );
}
Ejemplo n.º 19
0
void particles::pidt::mappings::Redistribute::mergeWithRemoteDataDueToForkOrJoin(
  particles::pidt::Vertex&                     localVertex,
  const particles::pidt::Vertex&               masterOrWorkerVertex,
  int                                          fromRank,
  const tarch::la::Vector<DIMENSIONS,double>&  x,
  const tarch::la::Vector<DIMENSIONS,double>&  h,
  int                                          level
) {
  logTraceInWith6Arguments( "mergeWithRemoteDataDueToForkOrJoin(...)", localVertex, masterOrWorkerVertex, fromRank, x, h, level );

  ParticleHeap::getInstance().receiveData(
    localVertex.getVertexIndex(),
    fromRank,
    x,
    level,
    peano::heap::ForkOrJoinCommunication
  );

  logTraceOut( "mergeWithRemoteDataDueToForkOrJoin(...)" );
}
Ejemplo n.º 20
0
void peano::applications::poisson::multigrid::mappings::SpacetreeGrid2Smooth::touchVertexLastTime(
  peano::applications::poisson::multigrid::SpacetreeGridVertex&         fineGridVertex,
  const tarch::la::Vector<DIMENSIONS,double>&                           fineGridX,
  const tarch::la::Vector<DIMENSIONS,double>&                           fineGridH,
  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>&                              fineGridPositionOfVertex
){
  logTraceInWith6Arguments( "touchVertexLastTime(...)", fineGridVertex, fineGridX, fineGridH, coarseGridVerticesEnumerator.toString(), coarseGridCell, fineGridPositionOfVertex );

  if (fineGridVertex.isInside()) {
    fineGridVertex.setU(smoother.getNewValueOfJacobiStep(
      fineGridVertex.getU(),
      fineGridVertex.getResidual(),
      fineGridVertex.getDiagonalElementOfStencil())
    );
  }

  logTraceOutWith1Argument( "touchVertexLastTime(...)", fineGridVertex );
}
Ejemplo n.º 21
0
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 peano::applications::heatequation::timestepping::mappings::SpacetreeGrid2ComputeImplicitSolutionWithJacobi::touchVertexLastTime(
  peano::applications::heatequation::timestepping::SpacetreeGridSingleStepVertex&         fineGridVertex,
  const tarch::la::Vector<DIMENSIONS,double>&                                             fineGridX,
  const tarch::la::Vector<DIMENSIONS,double>&                                             fineGridH,
  peano::applications::heatequation::timestepping::SpacetreeGridSingleStepVertex * const  coarseGridVertices,
  const peano::kernel::gridinterface::VertexEnumerator&                                   coarseGridVerticesEnumerator,
  peano::applications::heatequation::timestepping::SpacetreeGridCell&                     coarseGridCell,
  const tarch::la::Vector<DIMENSIONS,int>&                                                fineGridPositionOfVertex
) {
  logTraceInWith6Arguments( "touchVertexLastTime(...)", fineGridVertex, fineGridX, fineGridH, coarseGridVerticesEnumerator.toString(), coarseGridCell, fineGridPositionOfVertex );

  if (fineGridVertex.getRefinementControl()==peano::applications::heatequation::timestepping::SpacetreeGridSingleStepVertex::Records::Unrefined) {
    fineGridVertex.setTemperature(
      _solver.getNewTemperatureForImplicitEulerStep(
        fineGridH,
        fineGridVertex.getResidual(),
        fineGridVertex.getStencil(),
        fineGridVertex.getTemperature()
      )
    );
  }

  logTraceOutWith1Argument( "touchVertexLastTime(...)", fineGridVertex );
}
Ejemplo n.º 23
0
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 peano::applications::poisson::multigrid::mappings::SpacetreeGrid2SetupExperiment::createInnerVertex(
  peano::applications::poisson::multigrid::SpacetreeGridVertex&               fineGridVertex,
  const tarch::la::Vector<DIMENSIONS,double>&                                 fineGridX,
  const tarch::la::Vector<DIMENSIONS,double>&                                 fineGridH,
  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>&                                    fineGridPositionOfVertex
) {
  logTraceInWith6Arguments( "createInnerVertex(...)", fineGridVertex, fineGridX, fineGridH, coarseGridVerticesEnumerator.toString(), coarseGridCell, fineGridPositionOfVertex );
//  if (tarch::la::volume(fineGridH) > _refinementThreshold) {
//    fineGridVertex.refine();
//  }

  if (coarseGridVerticesEnumerator.getLevel() < 3) {
    fineGridVertex.refine();
  }

  peano::toolbox::stencil::Stencil stencil;

  #ifdef Dim2
  //if(fineGridVertex.getLevel() == 4){
  stencil =
//    kappa_x *
    peano::toolbox::stencil::StencilFactory::stencilProduct(
      peano::toolbox::stencil::StencilFactory::get1DLaplaceStencil(fineGridH(0)),
      peano::toolbox::stencil::StencilFactory::get1DMassStencil(fineGridH(1))
    ) +
//    kappa-y *
    peano::toolbox::stencil::StencilFactory::stencilProduct(
      peano::toolbox::stencil::StencilFactory::get1DMassStencil(fineGridH(0)),
      peano::toolbox::stencil::StencilFactory::get1DLaplaceStencil(fineGridH(1))
    );
  assertionNumericalEquals(stencil(0), -1.0/3.0);
  assertionNumericalEquals(stencil(1), -1.0/3.0);
  assertionNumericalEquals(stencil(2), -1.0/3.0);
  assertionNumericalEquals(stencil(3), -1.0/3.0);
  assertionNumericalEquals(stencil(4),  8.0/3.0);
  assertionNumericalEquals(stencil(5), -1.0/3.0);
  assertionNumericalEquals(stencil(6), -1.0/3.0);
  assertionNumericalEquals(stencil(7), -1.0/3.0);
  assertionNumericalEquals(stencil(8), -1.0/3.0);

  #if defined(Asserts)
  peano::toolbox::stencil::ElementMatrix elementMatrix;
  peano::toolbox::stencil::ElementWiseAssemblyMatrix testMatrix = elementMatrix.getElementWiseAssemblyMatrix( stencil );

  assertionNumericalEquals(testMatrix(0,0),  2.0/3.0);
  assertionNumericalEquals(testMatrix(0,1), -0.5/3.0);
  assertionNumericalEquals(testMatrix(0,2), -0.5/3.0);
  assertionNumericalEquals(testMatrix(0,3), -1.0/3.0);

  assertionNumericalEquals(testMatrix(1,0), -0.5/3.0);
  assertionNumericalEquals(testMatrix(1,1),  2.0/3.0);
  assertionNumericalEquals(testMatrix(1,2), -1.0/3.0);
  assertionNumericalEquals(testMatrix(1,3), -0.5/3.0);

  assertionNumericalEquals(testMatrix(2,0), -0.5/3.0);
  assertionNumericalEquals(testMatrix(2,1), -1.0/3.0);
  assertionNumericalEquals(testMatrix(2,2),  2.0/3.0);
  assertionNumericalEquals(testMatrix(2,3), -0.5/3.0);

  assertionNumericalEquals(testMatrix(3,0), -1.0/3.0);
  assertionNumericalEquals(testMatrix(3,1), -0.5/3.0);
  assertionNumericalEquals(testMatrix(3,2), -0.5/3.0);
  assertionNumericalEquals(testMatrix(3,3),  2.0/3.0);

  //logDebug( "createInnerVertex(...)", testMatrix );
  #endif
//  tarch::la::assignList(stencil) = -1.0/3.0, -1.0/3.0, -1.0/3.0, -1.0/3.0, 8.0/3.0, -1.0/3.0, -1.0/3.0, -1.0/3.0, -1.0/3.0;
  //}
  //else{
  //  tarch::la::assignList(stencil) = 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0;
  //}

  fineGridVertex.setStencil(stencil);

//  double squaredDistanceFromCenter = 0.0;
//  for (int d=0; d<DIMENSIONS; d++) {
//    squaredDistanceFromCenter += (0.5 - fineGridX(d)) * (0.5 - fineGridX(d));
//  }
//  if (squaredDistanceFromCenter<0.24*0.24) {
//    stencil *= 4.2;
//  }

  peano::toolbox::stencil::ProlongationMatrix prolongation;
  tarch::la::assignList(prolongation) = 1.0/9.0, 2.0/9.0, 3.0/9.0, 2.0/9.0, 1.0/9.0,
                                        2.0/9.0, 4.0/9.0, 6.0/9.0, 4.0/9.0, 2.0/9.0,
                                        3.0/9.0, 6.0/9.0, 9.0/9.0, 6.0/9.0, 3.0/9.0,
                                        2.0/9.0, 4.0/9.0, 6.0/9.0, 4.0/9.0, 2.0/9.0,
                                        1.0/9.0, 2.0/9.0, 3.0/9.0, 2.0/9.0, 1.0/9.0;
  fineGridVertex.setP(prolongation);

  peano::toolbox::stencil::RestrictionMatrix restriction;
  tarch::la::assignList(restriction) = 1.0/9.0, 2.0/9.0, 3.0/9.0, 2.0/9.0, 1.0/9.0,
                                       2.0/9.0, 4.0/9.0, 6.0/9.0, 4.0/9.0, 2.0/9.0,
                                       3.0/9.0, 6.0/9.0, 9.0/9.0, 6.0/9.0, 3.0/9.0,
                                       2.0/9.0, 4.0/9.0, 6.0/9.0, 4.0/9.0, 2.0/9.0,
                                       1.0/9.0, 2.0/9.0, 3.0/9.0, 2.0/9.0, 1.0/9.0;
  fineGridVertex.setR(restriction);

  fineGridVertex.setRhs(1.0, fineGridH);

  #else
  assertionMsg( false, "not implemented yet" );
  #endif

  logTraceOutWith1Argument( "createInnerVertex(...)", fineGridVertex );
}