Example #1
0
void peanoclaw::interSubgridCommunication::GridLevelTransfer::updatePatchStateDuringMergeWithWorker(
  int localCellDescriptionIndex,
  int remoteCellDescriptionIndex
) {
  logTraceInWith1Argument("updatePatchStateDuringMergeWithWorker", localCellDescriptionIndex);

  assertion(localCellDescriptionIndex != -1);
  CellDescription& localCellDescription = CellDescriptionHeap::getInstance().getData(localCellDescriptionIndex).at(0);
  Patch localPatch(localCellDescription);

  if(remoteCellDescriptionIndex != -1) {
    CellDescription& remoteCellDescription = CellDescriptionHeap::getInstance().getData(remoteCellDescriptionIndex).at(0);

    assertion1(localCellDescriptionIndex != -1, localPatch);
    if(remoteCellDescription.getUIndex() != -1) {
      assertion1(localPatch.isVirtual() || localPatch.isLeaf(), localPatch);

      //Delete current content of patch
      DataHeap::getInstance().deleteData(localPatch.getUIndex());

      //Merge
      localCellDescription.setUIndex(remoteCellDescription.getUIndex());
    }

    CellDescriptionHeap::getInstance().deleteData(remoteCellDescriptionIndex);
  }

  logTraceOut("updatePatchStateDuringMergeWithWorker");
}
void tarch::plotter::griddata::unstructured::vtk::VTKTextFileWriter::VertexDataWriter::plotVertex( int index, const tarch::la::Vector<2,double>& value ) {
  assertion(_lastWriteCommandVertexNumber>=-1);
  assertion(2<=_recordsPerVertex);

  assertion1( static_cast<float>(value(0)) != std::numeric_limits<float>::infinity(), value(0) );
  assertion1( value(0) == value(0), value(0) );  // test for not a number

  assertion1( static_cast<float>(value(1)) != std::numeric_limits<float>::infinity(), value(1) );
  assertion1( value(1) == value(1), value(1) );  // test for not a number

  while (_lastWriteCommandVertexNumber<index-1) {
    plotVertex(_lastWriteCommandVertexNumber+1,0.0);
  }

  _lastWriteCommandVertexNumber = index;
  _out << static_cast<float>(value(0)) << " ";
  _out << static_cast<float>(value(1)) << " ";
  for (int i=2; i<_recordsPerVertex; i++) {
    _out << 0.0 << " ";
  }
  _out << std::endl;

  if (value(0)<_minValue) _minValue = value(0);
  if (value(0)>_maxValue) _maxValue = value(0);
  if (value(1)<_minValue) _minValue = value(1);
  if (value(1)>_maxValue) _maxValue = value(1);
}
void peano::applications::pic::demo2::mappings::RegularGrid2PlotSolution::handleCell(
  peano::applications::pic::demo2::RegularGridVertex* const vertices,
  peano::applications::pic::demo2::RegularGridCell&  cell,
  const peano::kernel::gridinterface::VertexEnumerator&  enumerator
) {
  logTraceInWith2Arguments( "handleCell()", enumerator.toString(), cell );
  // @todo Insert your code here
	assertion( DIMENSIONS==2 || DIMENSIONS==3 );
	int vertexIndex[TWO_POWER_D];
	dfor2(i)
	    tarch::la::Vector<DIMENSIONS,double> currentVertexPosition = enumerator.getVertexPosition(i);
	    assertion1 ( _vertex2IndexMap.find(currentVertexPosition) != _vertex2IndexMap.end(), currentVertexPosition );
	    assertion1( _vertex2IndexMap[currentVertexPosition]>=0, _vertex2IndexMap[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,cell.getP() );
  logTraceOut( "handleCell()" );
}
void UncoupledScheme:: initialize
(
  double startTime,
  int    startTimestep )
{
  preciceTrace2 ( "initialize()", startTime, startTimestep );
  setTime ( startTime );
  setTimesteps ( startTimestep );
  assertion1 ( tarch::la::greaterEquals(startTime, 0.0), startTime );
  assertion1 ( startTimestep >= 0, startTimestep );
  setIsInitialized(true);
}
int peano::kernel::spacetreegrid::SingleLevelEnumerator::lineariseCellIndex( const LocalVertexIntegerIndex& cellPosition ) {
    int base   = 1;
    int result = 0;
    for (int d=0; d<DIMENSIONS; d++) {
        assertion1(cellPosition(d)>=0,cellPosition);
        assertion1(cellPosition(d)<=2,cellPosition);
        result += cellPosition(d)*base;
        base   *= 3;
    }
    assertion( result>= 0 );
    assertion( result< THREE_POWER_D );
    return result;
}
int peano::kernel::spacetreegrid::SingleLevelEnumerator::lineariseVertexIndex( const LocalVertexIntegerIndex& vertexPosition ) {
    int base   = 1;
    int result = 0;
    for (int d=0; d<DIMENSIONS; d++) {
        assertion1(vertexPosition(d)>=0,vertexPosition);
        assertion1(vertexPosition(d)<=3,vertexPosition);
        result += vertexPosition(d)*base;
        base   *= 4;
    }
    assertion( result>= 0 );
    assertion( result< FOUR_POWER_D );
    return result;
}
Example #7
0
const utils::DynVector& delinearize
(
  int toDelinearize,
  int dimensions )
{
  if ( dimensions == 2 ){
    assertion1 ( (toDelinearize >= 0) && (toDelinearize < 4), toDelinearize );
    return DELINEARIZE_2D[toDelinearize];
  }
  else {
    assertion1 ( dimensions == 3, dimensions );
    assertion1 ( (toDelinearize >= 0) && (toDelinearize < 8), toDelinearize );
    return DELINEARIZE_3D[toDelinearize];
  }
}
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 );
}
Example #9
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;
}
 void peano::applications::faxen::repositories::FaxenBatchJobRepositoryStatePacked::initDatatype() {
    const int Attributes = 2;
    MPI_Datatype subtypes[Attributes] = {
       MPI_INT,		 //action
       MPI_UB		 // end/displacement flag
    };
    
    int blocklen[Attributes] = {
       1,		 //action
       1		 // end/displacement flag
    };
    
    MPI_Aint     disp[Attributes];
    FaxenBatchJobRepositoryStatePacked dummyFaxenBatchJobRepositoryStatePacked[2];
    
    MPI_Aint base;
    MPI_Address( const_cast<void*>(static_cast<const void*>(&(dummyFaxenBatchJobRepositoryStatePacked[0]))), &base);
    MPI_Address( const_cast<void*>(static_cast<const void*>(&(dummyFaxenBatchJobRepositoryStatePacked[0]._persistentRecords._action))), 		&disp[0] );
    MPI_Address( const_cast<void*>(static_cast<const void*>(&(dummyFaxenBatchJobRepositoryStatePacked[1]._persistentRecords._action))), 		&disp[1] );
    
    for (int i=1; i<Attributes; i++) {
       assertion1( disp[i] > disp[i-1], i );
    }
    for (int i=0; i<Attributes; i++) {
       disp[i] -= base;
    }
    MPI_Type_struct( Attributes, blocklen, disp, subtypes, &FaxenBatchJobRepositoryStatePacked::Datatype );
    MPI_Type_commit( &FaxenBatchJobRepositoryStatePacked::Datatype );
    
 }
Example #11
0
 void peano::integration::partitioncoupling::builtin::records::ForceTorquePacked::initDatatype() {
    const int Attributes = 3;
    MPI_Datatype subtypes[Attributes] = {
       MPI_DOUBLE,		 //_translationalForce
       MPI_DOUBLE,		 //_torque
       MPI_UB		 // end/displacement flag
    };
    
    int blocklen[Attributes] = {
       3,		 //_translationalForce
       3,		 //_torque
       1		 // end/displacement flag
    };
    
    MPI_Aint     disp[Attributes];
    ForceTorquePacked dummyForceTorquePacked[2];
    
    MPI_Aint base;
    MPI_Address( const_cast<void*>(static_cast<const void*>(&(dummyForceTorquePacked[0]))), &base);
    MPI_Address( const_cast<void*>(static_cast<const void*>(&(dummyForceTorquePacked[0]._persistentRecords._translationalForce[0]))), 		&disp[0] );
    MPI_Address( const_cast<void*>(static_cast<const void*>(&(dummyForceTorquePacked[0]._persistentRecords._torque[0]))), 		&disp[1] );
    MPI_Address( const_cast<void*>(static_cast<const void*>(&dummyForceTorquePacked[1]._persistentRecords._translationalForce[0])), 		&disp[2] );
    
    for (int i=1; i<Attributes; i++) {
       assertion1( disp[i] > disp[i-1], i );
    }
    for (int i=0; i<Attributes; i++) {
       disp[i] -= base;
    }
    MPI_Type_struct( Attributes, blocklen, disp, subtypes, &ForceTorquePacked::Datatype );
    MPI_Type_commit( &ForceTorquePacked::Datatype );
    
 }
 void peano::applications::latticeboltzmann::blocklatticeboltzmann::repositories::BlockLatticeBoltzmannBatchJobRepositoryState::initDatatype() {
    const int Attributes = 3;
    MPI_Datatype subtypes[Attributes] = {
       MPI_INT,		 //action
       MPI_CHAR,		 //reduceState
       MPI_UB		 // end/displacement flag
    };
    
    int blocklen[Attributes] = {
       1,		 //action
       1,		 //reduceState
       1		 // end/displacement flag
    };
    
    MPI_Aint     disp[Attributes];
    BlockLatticeBoltzmannBatchJobRepositoryState dummyBlockLatticeBoltzmannBatchJobRepositoryState[2];
    
    MPI_Aint base;
    MPI_Address( const_cast<void*>(static_cast<const void*>(&(dummyBlockLatticeBoltzmannBatchJobRepositoryState[0]))), &base);
    MPI_Address( const_cast<void*>(static_cast<const void*>(&(dummyBlockLatticeBoltzmannBatchJobRepositoryState[0]._persistentRecords._action))), 		&disp[0] );
    MPI_Address( const_cast<void*>(static_cast<const void*>(&(dummyBlockLatticeBoltzmannBatchJobRepositoryState[0]._persistentRecords._reduceState))), 		&disp[1] );
    MPI_Address( const_cast<void*>(static_cast<const void*>(&(dummyBlockLatticeBoltzmannBatchJobRepositoryState[1]._persistentRecords._action))), 		&disp[2] );
    
    for (int i=1; i<Attributes; i++) {
       assertion1( disp[i] > disp[i-1], i );
    }
    for (int i=0; i<Attributes; i++) {
       disp[i] -= base;
    }
    MPI_Type_struct( Attributes, blocklen, disp, subtypes, &BlockLatticeBoltzmannBatchJobRepositoryState::Datatype );
    MPI_Type_commit( &BlockLatticeBoltzmannBatchJobRepositoryState::Datatype );
    
 }
void Structure0815:: timestep(double dt)
{
  STRUCTURE_DEBUG("Adding value changes to values.");
  _oldVelocities = _velocities;
  _oldDisplacements = _displacements;
  _time += dt;
  _timesteps++;

  DynVector centerOfGravity(_dim, 0.0);
  double totalMass = 0.0;
  double totalVolume = 0.0;
  if (not _fixedCharacteristics){
    computeCharacteristics(centerOfGravity, totalMass, totalVolume);
    STRUCTURE_INFO("Center of gravity delta: " << _centerOfGravity - centerOfGravity);
    STRUCTURE_INFO("Total mass delta: " << _totalMass - totalMass);
    STRUCTURE_INFO("Total volume delta: " << _totalMass/_density - totalVolume);
  }

  _statisticsWriter.writeData(TIMESTEPS, _timesteps);
  _statisticsWriter.writeData(TIME, _time);
  if (_dim == 2){
    precice::utils::Vector2D centerOfGravity2D(centerOfGravity);
    _statisticsWriter.writeData(CENTEROFGRAVITY, centerOfGravity2D);
  }
  else {
    assertion1(_dim == 3, _dim);
    precice::utils::Vector3D centerOfGravity3D(centerOfGravity);
    _statisticsWriter.writeData(CENTEROFGRAVITY, centerOfGravity3D);
  }
  _statisticsWriter.writeData(TOTALMASS, totalMass);
  _statisticsWriter.writeData(TOTALVOLUME, totalVolume);
}
void NearestNeighborMapping:: computeMapping()
{
  preciceTrace1("computeMapping()", input()->vertices().size());
  assertion(input().get() != NULL);
  assertion(output().get() != NULL);
  if (getConstraint() == CONSISTENT){
    preciceDebug("Compute consistent mapping");
    size_t verticesSize = output()->vertices().size();
    _vertexIndices.resize(verticesSize);
    const mesh::Mesh::VertexContainer& outputVertices = output()->vertices();
    for ( size_t i=0; i < verticesSize; i++ ){
      const utils::DynVector& coords = outputVertices[i].getCoords();
      query::FindClosestVertex find(coords);
      find(*input());
      assertion(find.hasFound());
      _vertexIndices[i] = find.getClosestVertex().getID();
    }
  }
  else {
    assertion1(getConstraint() == CONSERVATIVE, getConstraint());
    preciceDebug("Compute conservative mapping");
    size_t verticesSize = input()->vertices().size();
    _vertexIndices.resize(verticesSize);
    const mesh::Mesh::VertexContainer& inputVertices = input()->vertices();
    for ( size_t i=0; i < verticesSize; i++ ){
      const utils::DynVector& coords = inputVertices[i].getCoords();
      query::FindClosestVertex find(coords);
      find(*output());
      assertion(find.hasFound());
      _vertexIndices[i] = find.getClosestVertex().getID();
    }
  }
  _hasComputedMapping = true;
}
Example #15
0
 void peano::kernel::regulargrid::tests::records::TestCell::initDatatype() {
    const int Attributes = 1;
    MPI_Datatype subtypes[Attributes] = {
       MPI_UB		 // end/displacement flag
    };
    
    int blocklen[Attributes] = {
       1		 // end/displacement flag
    };
    
    MPI_Aint     disp[Attributes];
    TestCell dummyTestCell[2];
    
    MPI_Aint base;
    MPI_Address( const_cast<void*>(static_cast<const void*>(&(dummyTestCell[0]))), &base);
    for (int i=1; i<Attributes; i++) {
       assertion1( disp[i] > disp[i-1], i );
    }
    for (int i=0; i<Attributes; i++) {
       disp[i] -= base;
    }
    MPI_Type_struct( Attributes, blocklen, disp, subtypes, &TestCell::Datatype );
    MPI_Type_commit( &TestCell::Datatype );
    
 }
Example #16
0
 void peano::applications::latticeboltzmann::blocklatticeboltzmann::forcerecords::BlockPositionPacked::initDatatype() {
    const int Attributes = 2;
    MPI_Datatype subtypes[Attributes] = {
       MPI_DOUBLE,		 //_blockPosition
       MPI_UB		 // end/displacement flag
    };
    
    int blocklen[Attributes] = {
       DIMENSIONS,		 //_blockPosition
       1		 // end/displacement flag
    };
    
    MPI_Aint     disp[Attributes];
    BlockPositionPacked dummyBlockPositionPacked[2];
    
    MPI_Aint base;
    MPI_Address( const_cast<void*>(static_cast<const void*>(&(dummyBlockPositionPacked[0]))), &base);
    MPI_Address( const_cast<void*>(static_cast<const void*>(&(dummyBlockPositionPacked[0]._persistentRecords._blockPosition[0]))), 		&disp[0] );
    MPI_Address( const_cast<void*>(static_cast<const void*>(&dummyBlockPositionPacked[1]._persistentRecords._blockPosition[0])), 		&disp[1] );
    
    for (int i=1; i<Attributes; i++) {
       assertion1( disp[i] > disp[i-1], i );
    }
    for (int i=0; i<Attributes; i++) {
       disp[i] -= base;
    }
    MPI_Type_struct( Attributes, blocklen, disp, subtypes, &BlockPositionPacked::Datatype );
    MPI_Type_commit( &BlockPositionPacked::Datatype );
    
 }
 void tarch::parallel::messages::RegisterAtNodePoolMessagePacked::initDatatype() {
    const int Attributes = 2;
    MPI_Datatype subtypes[Attributes] = {
       MPI_SHORT,		 //nodeName
       MPI_UB		 // end/displacement flag
    };
    
    int blocklen[Attributes] = {
       MPI_MAX_NAME_STRING_ADDED_ONE,		 //nodeName
       1		 // end/displacement flag
    };
    
    MPI_Aint     disp[Attributes];
    RegisterAtNodePoolMessagePacked dummyRegisterAtNodePoolMessagePacked[2];
    
    MPI_Aint base;
    MPI_Address( const_cast<void*>(static_cast<const void*>(&(dummyRegisterAtNodePoolMessagePacked[0]))), &base);
    MPI_Address( const_cast<void*>(static_cast<const void*>(&(dummyRegisterAtNodePoolMessagePacked[0]._persistentRecords._nodeName[0]))), 		&disp[0] );
    MPI_Address( const_cast<void*>(static_cast<const void*>(&dummyRegisterAtNodePoolMessagePacked[1]._persistentRecords._nodeName[0])), 		&disp[1] );
    
    for (int i=1; i<Attributes; i++) {
       assertion1( disp[i] > disp[i-1], i );
    }
    for (int i=0; i<Attributes; i++) {
       disp[i] -= base;
    }
    MPI_Type_struct( Attributes, blocklen, disp, subtypes, &RegisterAtNodePoolMessagePacked::Datatype );
    MPI_Type_commit( &RegisterAtNodePoolMessagePacked::Datatype );
    
 }
void peano::applications::poisson::jacobitutorial::mappings::RegularGrid2PlotSolution::handleCell(
  peano::applications::poisson::jacobitutorial::RegularGridVertex* const vertices,
  peano::applications::poisson::jacobitutorial::RegularGridCell&  cell,
  const peano::kernel::gridinterface::VertexEnumerator&  enumerator
) {
  logTraceInWith2Arguments( "handleCell()", enumerator.toString(), cell );

  /**
   * --- inserted manually ---
   *
   * This is just cell plot mechanics. As the cells have no properties, it is
   * exactly the same what the grid plotter which is generated does.
   */
  tarch::multicore::Lock localLock( _outputStreamSemaphore );

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

  if (DIMENSIONS==2) {
    _cellWriter->plotQuadrangle(vertexIndex);
  }
  if (DIMENSIONS==3) {
    _cellWriter->plotHexahedron(vertexIndex);
  }

  logTraceOut( "handleCell()" );
}
tarch::logging::CommandLineLogger::FilterListEntry::FilterListEntry( const std::string& targetName, int rank, const std::string& className, bool isBlackListEntry ):
  _targetName(targetName),
  _rank(rank),
  _namespaceName(className),
  _isBlackEntry(isBlackListEntry) {
  assertion1( targetName==std::string("info") || targetName==std::string("debug") || targetName==std::string(""), targetName );
}
 void peano::applications::navierstokes::prototype1::repositories::PrototypeRepositoryStatePacked::initDatatype() {
    const int Attributes = 3;
    MPI_Datatype subtypes[Attributes] = {
       MPI_INT,		 //action
       MPI_CHAR,		 //reduceState
       MPI_UB		 // end/displacement flag
    };
    
    int blocklen[Attributes] = {
       1,		 //action
       1,		 //reduceState
       1		 // end/displacement flag
    };
    
    MPI_Aint     disp[Attributes];
    PrototypeRepositoryStatePacked dummyPrototypeRepositoryStatePacked[2];
    
    MPI_Aint base;
    MPI_Address( const_cast<void*>(static_cast<const void*>(&(dummyPrototypeRepositoryStatePacked[0]))), &base);
    MPI_Address( const_cast<void*>(static_cast<const void*>(&(dummyPrototypeRepositoryStatePacked[0]._persistentRecords._action))), 		&disp[0] );
    MPI_Address( const_cast<void*>(static_cast<const void*>(&(dummyPrototypeRepositoryStatePacked[0]._persistentRecords._reduceState))), 		&disp[1] );
    MPI_Address( const_cast<void*>(static_cast<const void*>(&(dummyPrototypeRepositoryStatePacked[1]._persistentRecords._action))), 		&disp[2] );
    
    for (int i=1; i<Attributes; i++) {
       assertion1( disp[i] > disp[i-1], i );
    }
    for (int i=0; i<Attributes; i++) {
       disp[i] -= base;
    }
    MPI_Type_struct( Attributes, blocklen, disp, subtypes, &PrototypeRepositoryStatePacked::Datatype );
    MPI_Type_commit( &PrototypeRepositoryStatePacked::Datatype );
    
 }
Example #21
0
 void peano::applications::poisson::jacobitutorial::records::RegularGridCell::initDatatype() {
    const int Attributes = 1;
    MPI_Datatype subtypes[Attributes] = {
       MPI_UB		 // end/displacement flag
    };
    
    int blocklen[Attributes] = {
       1		 // end/displacement flag
    };
    
    MPI_Aint     disp[Attributes];
    RegularGridCell dummyRegularGridCell[2];
    
    MPI_Aint base;
    MPI_Address( const_cast<void*>(static_cast<const void*>(&(dummyRegularGridCell[0]))), &base);
    for (int i=1; i<Attributes; i++) {
       assertion1( disp[i] > disp[i-1], i );
    }
    for (int i=0; i<Attributes; i++) {
       disp[i] -= base;
    }
    MPI_Type_struct( Attributes, blocklen, disp, subtypes, &RegularGridCell::Datatype );
    MPI_Type_commit( &RegularGridCell::Datatype );
    
 }
Example #22
0
double peanoclaw::grid::TimeIntervals::getTimeUOld() const {
  assertion1(Patch::isLeaf(_cellDescription) || Patch::isVirtual(_cellDescription), toString());
  if (Patch::isLeaf(_cellDescription)) {
    return _cellDescription->getTime();
  } else {
    return _cellDescription->getMinimalNeighborTime();
  }
}
Example #23
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 );
}
Example #24
0
void ImportSTL:: doImport
(
    const std::string& name,
    mesh::Mesh&        mesh )
{
    preciceTrace1("doImport()", name);
    assertion1(mesh.getDimensions() == 3, mesh.getDimensions());
    // TODO
}
Example #25
0
const std::string& XMLTag:: getStringAttributeValue
(
  const std::string& name ) const
{
  std::map<std::string,XMLAttribute<std::string> >::const_iterator iter;
  iter = _stringAttributes.find(name);
  assertion1 (iter != _stringAttributes.end(), name);
  return iter->second.getValue();
}
int tarch::plotter::griddata::unstructured::binaryvtu::BinaryVTUTextFileWriter::VertexWriter::plotVertex(const tarch::la::Vector<2,double>& position) {
  assertion1( _currentVertexNumber>=0, _currentVertexNumber );

  tarch::la::Vector<3,double> p;
  p(0) = position(0);
  p(1) = position(1);
  p(2) = 0.0;

  return plotVertex(p);
}
Example #27
0
double peano::applications::diffusionequation::Solver::getNewTemperatureForExplicitEulerStep(
  const tarch::la::Vector<DIMENSIONS,double>&  h,
  double                                       residual,
  const double &                               oldTemperature
) {
  const double cellVolume = tarch::la::volume(h);

  assertion1( _timeStepSize>0.0, _timeStepSize );
  assertion1( cellVolume>0.0, cellVolume );

  residual *= _timeStepSize / cellVolume;

  const double diagonalValue = 1.0;
  assertion1( _smoother.getOmega(), 1.0 );

  tarch::multicore::Lock  localLock(_normSemaphore);

  return _smoother.getNewValueOfJacobiStep(oldTemperature,residual,diagonalValue,cellVolume);
}
Example #28
0
int peanoclaw::Area::linearizeManifoldPosition(
  const tarch::la::Vector<DIMENSIONS, int>& manifoldPosition
) {
  assertion1(tarch::la::allSmaller(manifoldPosition, 2), manifoldPosition);

  int entry = peano::utils::dLinearised(manifoldPosition + 1, 3);
  if(entry > THREE_POWER_D_MINUS_ONE/2) {
    entry--;
  }
  return entry;
}
void peano::geometry::builtin::configurations::BuiltinGeometryObjectConfiguration::readGeometryID(
tarch::irr::io::IrrXMLReader* xmlReader){
  // if available, parse geometry ID
  if (xmlReader->getAttributeValue(GEOMETRY_ID.c_str()) != 0){
    _geometryID = xmlReader->getAttributeValueAsInt(GEOMETRY_ID.c_str());
    if (_geometryID < 0){
      assertion1(false, "Read negative geometry ID!");
      exit(EXIT_FAILURE);
    }
    logDebug("readGeometryID()", "Geometry ID: " << _geometryID);
  }
}
Example #30
0
double peano::applications::diffusionequation::Solver::getNewTemperatureForImplicitEulerStep(
  const tarch::la::Vector<DIMENSIONS,double>&  h,
  double                                       residual,
  const peano::toolbox::stencil::Stencil&      stencil,
  const double &                               newTemperatureSoFar
) {
  assertion1( _timeStepSize>0.0, _timeStepSize );
  assertion1( tarch::la::volume(h)>0.0, h );

  double diagonalElement = tarch::la::volume(h) * _elementMatrix.getDiagonalElement(_massMatrixWithoutHScaling) + _timeStepSize * _elementMatrix.getDiagonalElement(stencil);
  assertion( diagonalElement>0.0 );

  tarch::multicore::Lock  localLock(_normSemaphore);

  return _smoother.getNewValueOfJacobiStep(
    newTemperatureSoFar,
    residual,
    diagonalElement,
    tarch::la::volume(h)
  );
}