int peanoclaw::ParallelSubgrid::getNumberOfSharedAdjacentVertices(int remoteRank) const {
  #ifdef Parallel
  for(int i = 0; i < THREE_POWER_D_MINUS_ONE; i++) {
    if(_cellDescription->getAdjacentRanks(i) == remoteRank) {
     return _cellDescription->getNumberOfSharedAdjacentVertices(i);
    }
  }
  assertionFail("Should not occur! remoteRank=" << remoteRank << ", adjacentRanks=" << _cellDescription->getAdjacentRanks());
  #endif
  return -1;
}
void peano::applications::navierstokes::prototype1::fluidnumerics::tests::CalculatePPERHSTest::loadCalculateF(
  const peano::applications::navierstokes::prototype1::ElementType elementType,
  const double      rho,
  const double      eta
) {
  assertion(
      (elementType==peano::applications::navierstokes::prototype1::Dlinear
          || elementType==peano::applications::navierstokes::prototype1::DivergenceFree
          || elementType==peano::applications::navierstokes::prototype1::EnhancedDivergenceFree)
  );

  deleteCalculateF();

  switch(elementType){
  case peano::applications::navierstokes::prototype1::DivergenceFree:
    _log.debug("setCalculateF","AbstractCalculateF pointer is set to CalculateFDivFree");
    _myCalculateF = new CalculateFDivFree(
        eta/rho,
        rho
    );
    break;
  case peano::applications::navierstokes::prototype1::Dlinear:
    _log.debug("setCalculateF","AbstractCalculateF pointer is set to CalculateFDlinear");
    _myCalculateF = new CalculateFDlinear(
        eta/rho,
        rho
    );
    break;
    _log.error("peano::applications::navierstokes::prototype1::mappings::RegularGrid2CalculateF::setCalculateF", "Element type not implemented, yet.");
    exit(ASSERTION_EXIT_CODE);
  default:
    assertionFail("Wrong element type in state. Method RegularGrid2CalculateF::setCalculateF(...)");
    _log.error("peano::applications::navierstokes::prototype1::mappings::RegularGrid2CalculateF::setCalculateF", "Wrong element type in state. Method RegularGrid2CalculateF::setCalculateF(...)");
    exit(ASSERTION_EXIT_CODE);
  }

  validate(_myCalculateF !=0);
}
void peanoclaw::interSubgridCommunication::BathymetryInterpolation::performDefaultInterpolation(
  const tarch::la::Vector<DIMENSIONS, int>&    destinationSize,
  const tarch::la::Vector<DIMENSIONS, int>&    destinationOffset,
  peanoclaw::Patch& source,
  peanoclaw::Patch& destination,
  bool interpolateToUOld,
  bool interpolateToCurrentTime,
  bool useTimeUNewOrTimeUOld
) {
  switch(source.getUnknownsPerSubcell()) {
    case 1:
      {
        peanoclaw::interSubgridCommunication::DefaultInterpolationTemplate<1> transfer1;
        transfer1.interpolateSolution(destinationSize, destinationOffset, source, destination, interpolateToUOld, interpolateToCurrentTime, useTimeUNewOrTimeUOld);
      }
      break;
    case 2:
      {
        peanoclaw::interSubgridCommunication::DefaultInterpolationTemplate<2> transfer2;
        transfer2.interpolateSolution(destinationSize, destinationOffset, source, destination, interpolateToUOld, interpolateToCurrentTime, useTimeUNewOrTimeUOld);
      }
      break;
    case 3:
      {
        peanoclaw::interSubgridCommunication::DefaultInterpolationTemplate<3> transfer3;
        transfer3.interpolateSolution(destinationSize, destinationOffset, source, destination, interpolateToUOld, interpolateToCurrentTime, useTimeUNewOrTimeUOld);
      }
      break;
    case 4:
      {
        peanoclaw::interSubgridCommunication::DefaultInterpolationTemplate<4> transfer4;
        transfer4.interpolateSolution(destinationSize, destinationOffset, source, destination, interpolateToUOld, interpolateToCurrentTime, useTimeUNewOrTimeUOld);
      }
      break;
    case 5:
      {
        peanoclaw::interSubgridCommunication::DefaultInterpolationTemplate<5> transfer5;
        transfer5.interpolateSolution(destinationSize, destinationOffset, source, destination, interpolateToUOld, interpolateToCurrentTime, useTimeUNewOrTimeUOld);
      }
      break;
    case 6:
      {
        peanoclaw::interSubgridCommunication::DefaultInterpolationTemplate<6> transfer6;
        transfer6.interpolateSolution(destinationSize, destinationOffset, source, destination, interpolateToUOld, interpolateToCurrentTime, useTimeUNewOrTimeUOld);
      }
      break;
    case 7:
      {
        peanoclaw::interSubgridCommunication::DefaultInterpolationTemplate<7> transfer7;
        transfer7.interpolateSolution(destinationSize, destinationOffset, source, destination, interpolateToUOld, interpolateToCurrentTime, useTimeUNewOrTimeUOld);
      }
      break;
    case 8:
      {
        peanoclaw::interSubgridCommunication::DefaultInterpolationTemplate<8> transfer8;
        transfer8.interpolateSolution(destinationSize, destinationOffset, source, destination, interpolateToUOld, interpolateToCurrentTime, useTimeUNewOrTimeUOld);
      }
      break;
    case 9:
      {
        peanoclaw::interSubgridCommunication::DefaultInterpolationTemplate<9> transfer9;
        transfer9.interpolateSolution(destinationSize, destinationOffset, source, destination, interpolateToUOld, interpolateToCurrentTime, useTimeUNewOrTimeUOld);
      }
      break;
    case 10:
      {
        peanoclaw::interSubgridCommunication::DefaultInterpolationTemplate<10> transfer10;
        transfer10.interpolateSolution(destinationSize, destinationOffset, source, destination, interpolateToUOld, interpolateToCurrentTime, useTimeUNewOrTimeUOld);
      }
      break;
    default:
      assertionFail("Number of unknowns " << source.getUnknownsPerSubcell() << " not supported!");
  }
}