Пример #1
0
double scenario::diffusionequation::CornerPointField::getPorosityFromDataSet(const tarch::la::Vector<3,double>& x) const {
  logTraceInWith3Arguments( "getPorosityFromDataSet(vector)", x, _hexahedron.getBoundingBox(), _hexahedron.getOffset() );
  const double depth = x(2);

  const double pillarSizeX = getCornerPointPillarWidth()(0);
  assertion1( pillarSizeX>0.0, pillarSizeX );
  int    inArrayX    = std::floor( (x(0)-_hexahedron.getOffset()(0)) / pillarSizeX );
  if (inArrayX==_pillars(0)) inArrayX--;
  assertion3( inArrayX>=0, pillarSizeX, inArrayX, _pillars );
  assertion3( inArrayX<_pillars(0), pillarSizeX, inArrayX, _pillars );

  #if defined(Dim3)
  const double pillarSizeY = getCornerPointPillarWidth()(1);
  assertion4( pillarSizeY>0.0, pillarSizeX, pillarSizeY, inArrayX, _pillars );
  int    inArrayY    = std::floor( (x(1)-_hexahedron.getOffset()(1)) / pillarSizeY );
  if (inArrayY==_pillars(1)) inArrayY--;
  assertion5( inArrayY>=0, pillarSizeX, pillarSizeY, inArrayX, inArrayY, _pillars );
  assertion5( inArrayY<_pillars(1), pillarSizeX, pillarSizeY, inArrayX, inArrayY, _pillars );
  #elif defined(Dim2)
  const int    inArrayY    = _pillars(1) / 2;
  #endif

  const int entry = inArrayX + inArrayY * _pillars(0);
  assertion6( entry < static_cast<int>(_entries.size()), pillarSizeX, inArrayX, inArrayY, _pillars, entry, _entries.size() );

  double result = _entries[entry].getPermeability(depth);
  logTraceOutWith1Argument( "getPorosityFromDataSet(vector)", result );
  return result;
}
Пример #2
0
int peano::kernel::spacetreegrid::SingleLevelEnumerator::operator() (int localVertexNumber) const {
    peano::kernel::spacetreegrid::SingleLevelEnumerator::LocalVertexIntegerIndex localOffset;
    int base   = TWO_POWER_D_DIVIDED_BY_TWO;
    for (int d=DIMENSIONS-1; d>=0; d--) {
        localOffset(d)     = localVertexNumber / base;
        assertion5( localOffset(d)>=0, localOffset, localVertexNumber, d, base, _discreteOffset );
        assertion5( localOffset(d)<=1, localOffset, localVertexNumber, d, base, _discreteOffset );
        localVertexNumber -= localOffset(d) * base;
        base              /= 2;
    }
    localOffset += _discreteOffset;
    return peano::kernel::spacetreegrid::SingleLevelEnumerator::lineariseVertexIndex( localOffset );
}
void tarch::logging::CommandLineLogger::indent( bool indent, const std::string& trace, const std::string& message ) {
  #ifdef Debug

  tarch::multicore::Lock lockCout( _semaphore );
  if (indent) {
    _indent+=NumberOfIndentSpaces;
     #if !defined(SharedMemoryParallelisation)
    _indentTraces.push(trace);
     #endif
  }
  else {
    #if !defined(SharedMemoryParallelisation)
    assertionEquals2(
      _indentTraces.top(),
      trace,
      message,
      indent
    );
    _indentTraces.pop();
    #endif
    assertion5(
      _indent >= NumberOfIndentSpaces,
      _indent, NumberOfIndentSpaces,
      "more logTraceOut calls than logTraceIn calls invoked before",
      trace, message
    );
    _indent-=NumberOfIndentSpaces;
  }
  #endif
}
Пример #4
0
void particles::pidt::mappings::MoveParticles::prepareSendToNeighbour(
  particles::pidt::Vertex&                      vertex,
  int                                           toRank,
  const tarch::la::Vector<DIMENSIONS,double>&   x,
  const tarch::la::Vector<DIMENSIONS,double>&   h,
  int                                           level
) {
  logTraceInWith5Arguments( "prepareSendToNeighbour(...)", vertex, toRank, x, h, level );

  ParticleContainer  destinationParticles = extractAllParticlesFromDualCellBelongingToOneRank(
    vertex.getVertexIndex(),
    vertex,
    toRank,
    x,
    h
  );

  for (
    ParticleContainer::iterator p = destinationParticles.begin();
    p != destinationParticles.end();
    p++
  ) {
    p->setMovedParticle( particles::pidt::records::Particle::New );

    assertion5(
      Vertex::isContainedInDualCell(x,h,p->_persistentRecords._x),
      x,h,p->toString(),p->_persistentRecords._x - x,level
    );
  }

  ParticleHeap::getInstance().sendData(
    destinationParticles,
    toRank,
    x,
    level,
    peano::heap::NeighbourCommunication
  );

  logTraceOutWith1Argument( "prepareSendToNeighbour(...)", destinationParticles.size() );
}