text: #include "exahype/adapters/Broadcast.h"
  
  
  peano::CommunicationSpecification   exahype::adapters::Broadcast::communicationSpecification() const {
    return peano::CommunicationSpecification::getMinimalSpecification()
      &  _map2Broadcast.communicationSpecification()
  
    ;
  }
  
  
  peano::MappingSpecification   exahype::adapters::Broadcast::touchVertexLastTimeSpecification(int level) const {
    return peano::MappingSpecification::getMinimalSpecification()
      &  _map2Broadcast.touchVertexLastTimeSpecification(level)
  
    ;
  }
  
  
  peano::MappingSpecification   exahype::adapters::Broadcast::touchVertexFirstTimeSpecification(int level) const { 
    return peano::MappingSpecification::getMinimalSpecification()
      &  _map2Broadcast.touchVertexFirstTimeSpecification(level)
  
    ;
  }
  
  
  peano::MappingSpecification   exahype::adapters::Broadcast::enterCellSpecification(int level) const {
    return peano::MappingSpecification::getMinimalSpecification()
      &  _map2Broadcast.enterCellSpecification(level)
  
    ;
  }
  
  
  peano::MappingSpecification   exahype::adapters::Broadcast::leaveCellSpecification(int level) const {
    return peano::MappingSpecification::getMinimalSpecification()
      &  _map2Broadcast.leaveCellSpecification(level)
  
    ;
  }
  
  
  peano::MappingSpecification   exahype::adapters::Broadcast::ascendSpecification(int level) const {
    return peano::MappingSpecification::getMinimalSpecification()
      &  _map2Broadcast.ascendSpecification(level)
  
    ;
  }
  
  
  peano::MappingSpecification   exahype::adapters::Broadcast::descendSpecification(int level) const {
    return peano::MappingSpecification::getMinimalSpecification()
      &  _map2Broadcast.descendSpecification(level)
  
    ;
  }
  
  
  exahype::adapters::Broadcast::Broadcast() {
  }
  
  
  exahype::adapters::Broadcast::~Broadcast() {
  }
  
  
  #if defined(SharedMemoryParallelisation)
  exahype::adapters::Broadcast::Broadcast(const Broadcast&  masterThread):
    _map2Broadcast(masterThread._map2Broadcast) 
  
  {
  }
  
  
  void exahype::adapters::Broadcast::mergeWithWorkerThread(const Broadcast& workerThread) {
    _map2Broadcast.mergeWithWorkerThread(workerThread._map2Broadcast);
  
  }
  #endif
  
  
  void exahype::adapters::Broadcast::createHangingVertex(
        exahype::Vertex&     fineGridVertex,
        const tarch::la::Vector<DIMENSIONS,double>&                fineGridX,
        const tarch::la::Vector<DIMENSIONS,double>&                fineGridH,
        exahype::Vertex * const   coarseGridVertices,
        const peano::grid::VertexEnumerator&      coarseGridVerticesEnumerator,
        exahype::Cell&       coarseGridCell,
        const tarch::la::Vector<DIMENSIONS,int>&                   fineGridPositionOfVertex
  ) {
    _map2Broadcast.createHangingVertex(fineGridVertex, fineGridX, fineGridH, coarseGridVertices, coarseGridVerticesEnumerator, coarseGridCell, fineGridPositionOfVertex );
  
  
  }
  
  
  void exahype::adapters::Broadcast::destroyHangingVertex(
        const exahype::Vertex&   fineGridVertex,
        const tarch::la::Vector<DIMENSIONS,double>&                    fineGridX,
        const tarch::la::Vector<DIMENSIONS,double>&                    fineGridH,
        exahype::Vertex * const  coarseGridVertices,
        const peano::grid::VertexEnumerator&          coarseGridVerticesEnumerator,
        exahype::Cell&           coarseGridCell,
        const tarch::la::Vector<DIMENSIONS,int>&                       fineGridPositionOfVertex
  ) {
    _map2Broadcast.destroyHangingVertex(fineGridVertex, fineGridX, fineGridH, coarseGridVertices, coarseGridVerticesEnumerator, coarseGridCell, fineGridPositionOfVertex );
  
  }
  
  
  void exahype::adapters::Broadcast::createInnerVertex(
        exahype::Vertex&               fineGridVertex,
        const tarch::la::Vector<DIMENSIONS,double>&                          fineGridX,
        const tarch::la::Vector<DIMENSIONS,double>&                          fineGridH,
        exahype::Vertex * const        coarseGridVertices,
        const peano::grid::VertexEnumerator&                coarseGridVerticesEnumerator,
        exahype::Cell&                 coarseGridCell,
        const tarch::la::Vector<DIMENSIONS,int>&                             fineGridPositionOfVertex
  ) {
    _map2Broadcast.createInnerVertex(fineGridVertex, fineGridX, fineGridH, coarseGridVertices, coarseGridVerticesEnumerator, coarseGridCell, fineGridPositionOfVertex );
  
  }
  
  
  void exahype::adapters::Broadcast::createBoundaryVertex(
        exahype::Vertex&               fineGridVertex,
        const tarch::la::Vector<DIMENSIONS,double>&                          fineGridX,
        const tarch::la::Vector<DIMENSIONS,double>&                          fineGridH,
        exahype::Vertex * const        coarseGridVertices,
        const peano::grid::VertexEnumerator&                coarseGridVerticesEnumerator,
        exahype::Cell&                 coarseGridCell,
        const tarch::la::Vector<DIMENSIONS,int>&                             fineGridPositionOfVertex
  ) {
    _map2Broadcast.createBoundaryVertex( fineGridVertex, fineGridX, fineGridH, coarseGridVertices, coarseGridVerticesEnumerator, coarseGridCell, fineGridPositionOfVertex );
  
  }
  
  
  void exahype::adapters::Broadcast::destroyVertex(
        const exahype::Vertex&   fineGridVertex,
        const tarch::la::Vector<DIMENSIONS,double>&                    fineGridX,
        const tarch::la::Vector<DIMENSIONS,double>&                    fineGridH,
        exahype::Vertex * const  coarseGridVertices,
        const peano::grid::VertexEnumerator&          coarseGridVerticesEnumerator,
        exahype::Cell&           coarseGridCell,
        const tarch::la::Vector<DIMENSIONS,int>&                       fineGridPositionOfVertex
  ) {
    _map2Broadcast.destroyVertex( fineGridVertex, fineGridX, fineGridH, coarseGridVertices, coarseGridVerticesEnumerator, coarseGridCell, fineGridPositionOfVertex );
  
  }
  
  
  void exahype::adapters::Broadcast::createCell(
        exahype::Cell&                 fineGridCell,
        exahype::Vertex * const        fineGridVertices,
        const peano::grid::VertexEnumerator&                fineGridVerticesEnumerator,
        exahype::Vertex * const        coarseGridVertices,
        const peano::grid::VertexEnumerator&                coarseGridVerticesEnumerator,
        exahype::Cell&                 coarseGridCell,
        const tarch::la::Vector<DIMENSIONS,int>&                             fineGridPositionOfCell
  ) {
    _map2Broadcast.createCell( fineGridCell, fineGridVertices, fineGridVerticesEnumerator, coarseGridVertices, coarseGridVerticesEnumerator, coarseGridCell, fineGridPositionOfCell );
  
  }
  
  
  void exahype::adapters::Broadcast::destroyCell(
        const exahype::Cell&           fineGridCell,
        exahype::Vertex * const        fineGridVertices,
        const peano::grid::VertexEnumerator&                fineGridVerticesEnumerator,
        exahype::Vertex * const        coarseGridVertices,
        const peano::grid::VertexEnumerator&                coarseGridVerticesEnumerator,
        exahype::Cell&                 coarseGridCell,
        const tarch::la::Vector<DIMENSIONS,int>&                             fineGridPositionOfCell
  ) {
    _map2Broadcast.destroyCell( fineGridCell, fineGridVertices, fineGridVerticesEnumerator, coarseGridVertices, coarseGridVerticesEnumerator, coarseGridCell, fineGridPositionOfCell );
  
  }
  
  
  #ifdef Parallel
  void exahype::adapters::Broadcast::mergeWithNeighbour(
    exahype::Vertex&  vertex,
    const exahype::Vertex&  neighbour,
    int                                           fromRank,
    const tarch::la::Vector<DIMENSIONS,double>&   fineGridX,
    const tarch::la::Vector<DIMENSIONS,double>&   fineGridH,
    int                                           level
  ) {
     _map2Broadcast.mergeWithNeighbour( vertex, neighbour, fromRank, fineGridX, fineGridH, level );
  
  }
  
  
  void exahype::adapters::Broadcast::prepareSendToNeighbour(
    exahype::Vertex&  vertex,
    int                                           toRank,
    const tarch::la::Vector<DIMENSIONS,double>&   x,
    const tarch::la::Vector<DIMENSIONS,double>&   h,
    int                                           level
  ) {
     _map2Broadcast.prepareSendToNeighbour( vertex, toRank, x, h, level );
  
  }
  
  
  void exahype::adapters::Broadcast::prepareCopyToRemoteNode(
    exahype::Vertex&  localVertex,
    int                                           toRank,
    const tarch::la::Vector<DIMENSIONS,double>&   x,
    const tarch::la::Vector<DIMENSIONS,double>&   h,
    int                                           level
  ) {
     _map2Broadcast.prepareCopyToRemoteNode( localVertex, toRank, x, h, level );
  
  }
  
  
  void exahype::adapters::Broadcast::prepareCopyToRemoteNode(
    exahype::Cell&  localCell,
        int                                           toRank,
        const tarch::la::Vector<DIMENSIONS,double>&   x,
        const tarch::la::Vector<DIMENSIONS,double>&   h,
        int                                           level
  ) {
     _map2Broadcast.prepareCopyToRemoteNode( localCell, toRank, x, h, level );
  
  }
  
  
  void exahype::adapters::Broadcast::mergeWithRemoteDataDueToForkOrJoin(
    exahype::Vertex&  localVertex,
    const exahype::Vertex&  masterOrWorkerVertex,
    int                                       fromRank,
    const tarch::la::Vector<DIMENSIONS,double>&  x,
    const tarch::la::Vector<DIMENSIONS,double>&  h,
    int                                       level
  ) {
     _map2Broadcast.mergeWithRemoteDataDueToForkOrJoin( localVertex, masterOrWorkerVertex, fromRank, x, h, level );
  
  }
  
  
  void exahype::adapters::Broadcast::mergeWithRemoteDataDueToForkOrJoin(
    exahype::Cell&  localCell,
    const exahype::Cell&  masterOrWorkerCell,
    int                                       fromRank,
    const tarch::la::Vector<DIMENSIONS,double>&  x,
    const tarch::la::Vector<DIMENSIONS,double>&  h,
    int                                       level
  ) {
     _map2Broadcast.mergeWithRemoteDataDueToForkOrJoin( localCell, masterOrWorkerCell, fromRank, x, h, level );
  
  }
  
  
  bool exahype::adapters::Broadcast::prepareSendToWorker(
    exahype::Cell&                 fineGridCell,
    exahype::Vertex * const        fineGridVertices,
    const peano::grid::VertexEnumerator&                fineGridVerticesEnumerator,
    exahype::Vertex * const        coarseGridVertices,
    const peano::grid::VertexEnumerator&                coarseGridVerticesEnumerator,
    exahype::Cell&                 coarseGridCell,
    const tarch::la::Vector<DIMENSIONS,int>&                             fineGridPositionOfCell,
    int                                                                  worker
  ) {
    bool result = false;
     result |= _map2Broadcast.prepareSendToWorker( fineGridCell, fineGridVertices, fineGridVerticesEnumerator, coarseGridVertices, coarseGridVerticesEnumerator, coarseGridCell, fineGridPositionOfCell, worker );
  
    return result;
  }
  
  
  void exahype::adapters::Broadcast::prepareSendToMaster(
    exahype::Cell&                       localCell,
    exahype::Vertex *                    vertices,
    const peano::grid::VertexEnumerator&       verticesEnumerator, 
    const exahype::Vertex * const        coarseGridVertices,
    const peano::grid::VertexEnumerator&       coarseGridVerticesEnumerator,
    const exahype::Cell&                 coarseGridCell,
    const tarch::la::Vector<DIMENSIONS,int>&   fineGridPositionOfCell
  ) {
     _map2Broadcast.prepareSendToMaster( localCell, vertices, verticesEnumerator, coarseGridVertices, coarseGridVerticesEnumerator, coarseGridCell, fineGridPositionOfCell );
  
  }
  
  
  void exahype::adapters::Broadcast::mergeWithMaster(
    const exahype::Cell&           workerGridCell,
    exahype::Vertex * const        workerGridVertices,
    const peano::grid::VertexEnumerator& workerEnumerator,
    exahype::Cell&                 fineGridCell,
    exahype::Vertex * const        fineGridVertices,
    const peano::grid::VertexEnumerator&                fineGridVerticesEnumerator,
    exahype::Vertex * const        coarseGridVertices,
    const peano::grid::VertexEnumerator&                coarseGridVerticesEnumerator,
    exahype::Cell&                 coarseGridCell,
    const tarch::la::Vector<DIMENSIONS,int>&                             fineGridPositionOfCell,
    int                                                                  worker,
      const exahype::State&          workerState,
    exahype::State&                masterState
  ) {
     _map2Broadcast.mergeWithMaster( workerGridCell, workerGridVertices, workerEnumerator, fineGridCell, fineGridVertices, fineGridVerticesEnumerator, coarseGridVertices, coarseGridVerticesEnumerator, coarseGridCell, fineGridPositionOfCell, worker, workerState, masterState );
  
  }
  
  
  void exahype::adapters::Broadcast::receiveDataFromMaster(
        exahype::Cell&                        receivedCell, 
        exahype::Vertex *                     receivedVertices,
        const peano::grid::VertexEnumerator&        receivedVerticesEnumerator,
        exahype::Vertex * const               receivedCoarseGridVertices,
        const peano::grid::VertexEnumerator&        receivedCoarseGridVerticesEnumerator,
        exahype::Cell&                        receivedCoarseGridCell,
        exahype::Vertex * const               workersCoarseGridVertices,
        const peano::grid::VertexEnumerator&        workersCoarseGridVerticesEnumerator,
        exahype::Cell&                        workersCoarseGridCell,
        const tarch::la::Vector<DIMENSIONS,int>&    fineGridPositionOfCell
  ) {
     _map2Broadcast.receiveDataFromMaster( receivedCell, receivedVertices, receivedVerticesEnumerator, receivedCoarseGridVertices, receivedCoarseGridVerticesEnumerator, receivedCoarseGridCell, workersCoarseGridVertices, workersCoarseGridVerticesEnumerator, workersCoarseGridCell, fineGridPositionOfCell );
  
  }
  
  
  void exahype::adapters::Broadcast::mergeWithWorker(
    exahype::Cell&           localCell, 
    const exahype::Cell&     receivedMasterCell,
    const tarch::la::Vector<DIMENSIONS,double>&  cellCentre,
    const tarch::la::Vector<DIMENSIONS,double>&  cellSize,
    int                                          level
  ) {
     _map2Broadcast.mergeWithWorker( localCell, receivedMasterCell, cellCentre, cellSize, level );
  
  }
  
  
  void exahype::adapters::Broadcast::mergeWithWorker(
    exahype::Vertex&        localVertex,
    const exahype::Vertex&  receivedMasterVertex,
    const tarch::la::Vector<DIMENSIONS,double>&   x,
    const tarch::la::Vector<DIMENSIONS,double>&   h,
    int                                           level
  ) {
     _map2Broadcast.mergeWithWorker( localVertex, receivedMasterVertex, x, h, level );
  
  }
  #endif
  
  
  void exahype::adapters::Broadcast::touchVertexFirstTime(
        exahype::Vertex&               fineGridVertex,
        const tarch::la::Vector<DIMENSIONS,double>&                          fineGridX,
        const tarch::la::Vector<DIMENSIONS,double>&                          fineGridH,
        exahype::Vertex * const        coarseGridVertices,
        const peano::grid::VertexEnumerator&                coarseGridVerticesEnumerator,
        exahype::Cell&                 coarseGridCell,
        const tarch::la::Vector<DIMENSIONS,int>&                             fineGridPositionOfVertex
  ) {
    _map2Broadcast.touchVertexFirstTime( fineGridVertex, fineGridX, fineGridH, coarseGridVertices, coarseGridVerticesEnumerator, coarseGridCell, fineGridPositionOfVertex );
  
  }
  
  
  void exahype::adapters::Broadcast::touchVertexLastTime(
        exahype::Vertex&         fineGridVertex,
        const tarch::la::Vector<DIMENSIONS,double>&                    fineGridX,
        const tarch::la::Vector<DIMENSIONS,double>&                    fineGridH,
        exahype::Vertex * const  coarseGridVertices,
        const peano::grid::VertexEnumerator&          coarseGridVerticesEnumerator,
        exahype::Cell&           coarseGridCell,
        const tarch::la::Vector<DIMENSIONS,int>&                       fineGridPositionOfVertex
  ) {
    _map2Broadcast.touchVertexLastTime( fineGridVertex, fineGridX, fineGridH, coarseGridVertices, coarseGridVerticesEnumerator, coarseGridCell, fineGridPositionOfVertex );
  
  }
  
  
  void exahype::adapters::Broadcast::enterCell(
        exahype::Cell&                 fineGridCell,
        exahype::Vertex * const        fineGridVertices,
        const peano::grid::VertexEnumerator&                fineGridVerticesEnumerator,
        exahype::Vertex * const        coarseGridVertices,
        const peano::grid::VertexEnumerator&                coarseGridVerticesEnumerator,
        exahype::Cell&                 coarseGridCell,
        const tarch::la::Vector<DIMENSIONS,int>&                             fineGridPositionOfCell
  ) {
    _map2Broadcast.enterCell( fineGridCell, fineGridVertices, fineGridVerticesEnumerator, coarseGridVertices, coarseGridVerticesEnumerator, coarseGridCell, fineGridPositionOfCell );
  
  }
  
  
  void exahype::adapters::Broadcast::leaveCell(
        exahype::Cell&           fineGridCell,
        exahype::Vertex * const  fineGridVertices,
        const peano::grid::VertexEnumerator&          fineGridVerticesEnumerator,
        exahype::Vertex * const  coarseGridVertices,
        const peano::grid::VertexEnumerator&          coarseGridVerticesEnumerator,
        exahype::Cell&           coarseGridCell,
        const tarch::la::Vector<DIMENSIONS,int>&                       fineGridPositionOfCell
  ) {
    _map2Broadcast.leaveCell( fineGridCell, fineGridVertices, fineGridVerticesEnumerator, coarseGridVertices, coarseGridVerticesEnumerator, coarseGridCell, fineGridPositionOfCell );
  
  }
  
  
  void exahype::adapters::Broadcast::beginIteration(
    exahype::State&  solverState
  ) {
    _map2Broadcast.beginIteration( solverState );
  
  }
  
  
  void exahype::adapters::Broadcast::endIteration(
    exahype::State&  solverState
  ) {
    _map2Broadcast.endIteration( solverState );
  
  }
  
  
  
  
  void exahype::adapters::Broadcast::descend(
    exahype::Cell * const          fineGridCells,
    exahype::Vertex * const        fineGridVertices,
    const peano::grid::VertexEnumerator&                fineGridVerticesEnumerator,
    exahype::Vertex * const        coarseGridVertices,
    const peano::grid::VertexEnumerator&                coarseGridVerticesEnumerator,
    exahype::Cell&                 coarseGridCell
  ) {
    _map2Broadcast.descend( fineGridCells, fineGridVertices, fineGridVerticesEnumerator, coarseGridVertices, coarseGridVerticesEnumerator, coarseGridCell );
  
  }
  
  
  void exahype::adapters::Broadcast::ascend(
    exahype::Cell * const    fineGridCells,
    exahype::Vertex * const  fineGridVertices,
    const peano::grid::VertexEnumerator&          fineGridVerticesEnumerator,
    exahype::Vertex * const  coarseGridVertices,
    const peano::grid::VertexEnumerator&          coarseGridVerticesEnumerator,
    exahype::Cell&           coarseGridCell
  ) {
    _map2Broadcast.ascend( fineGridCells, fineGridVertices, fineGridVerticesEnumerator, coarseGridVertices, coarseGridVerticesEnumerator, coarseGridCell );
  
  }
  