Commit 735da4f5 authored by Tomáš Oberhuber's avatar Tomáš Oberhuber
Browse files

Fixing passing of grid neighbour entities by reference, not by value.

parent 7f46cab3
Loading
Loading
Loading
Loading
+30 −9
Original line number Diff line number Diff line
@@ -66,6 +66,14 @@ class tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, EntityDimension
      
      typedef tnlNeighbourGridEntitiesStorage< ThisType > NeighbourGridEntitiesStorageType;
      
      template< int NeighbourEntityDimensions = entityDimensions >
      using NeighbourEntities = 
         tnlNeighbourGridEntityGetter<
            tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >,
                           EntityDimensions,
                           Config >,
            NeighbourEntityDimensions >;
      
      __cuda_callable__ inline
      tnlGridEntity( const GridType& grid );
      
@@ -113,11 +121,7 @@ class tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, EntityDimension
      
      template< int NeighbourEntityDimensions = entityDimensions >
      __cuda_callable__ inline
      tnlNeighbourGridEntityGetter<
         tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >,
                        EntityDimensions,
                        Config >,
         NeighbourEntityDimensions >
      const NeighbourEntities< NeighbourEntityDimensions >&
      getNeighbourEntities() const;
      
      __cuda_callable__ inline
@@ -178,6 +182,15 @@ class tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, Dimensions, Con
      typedef tnlGridEntity< GridType, entityDimensions, Config > ThisType;
      typedef tnlNeighbourGridEntitiesStorage< ThisType > NeighbourGridEntitiesStorageType;
      
      template< int NeighbourEntityDimensions = entityDimensions >
      using NeighbourEntities = 
         tnlNeighbourGridEntityGetter<
            tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >,
                           entityDimensions,
                           Config >,
            NeighbourEntityDimensions >;


      __cuda_callable__ inline
      tnlGridEntity( const GridType& grid );
      
@@ -216,9 +229,7 @@ class tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, Dimensions, Con
      
      template< int NeighbourEntityDimensions = Dimensions >
      __cuda_callable__ inline
      tnlNeighbourGridEntityGetter<
         tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, Dimensions, Config >,
         NeighbourEntityDimensions >
      const NeighbourEntities< NeighbourEntityDimensions >&
      getNeighbourEntities() const;
      
      __cuda_callable__ inline
@@ -282,6 +293,15 @@ class tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, 0, Config >
      typedef tnlGridEntity< GridType, entityDimensions, Config > ThisType;
      typedef tnlNeighbourGridEntitiesStorage< ThisType > NeighbourGridEntitiesStorageType;
      
      template< int NeighbourEntityDimensions = entityDimensions >
      using NeighbourEntities = 
         tnlNeighbourGridEntityGetter<
            tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >,
                           entityDimensions,
                           Config >,
            NeighbourEntityDimensions >;


      __cuda_callable__ inline
      tnlGridEntity( const GridType& grid );
      
@@ -320,7 +340,8 @@ class tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, 0, Config >
      
      template< int NeighbourEntityDimensions = entityDimensions >
      __cuda_callable__ inline
      tnlNeighbourGridEntityGetter< ThisType, NeighbourEntityDimensions > getNeighbourEntities() const;
      const NeighbourEntities< NeighbourEntityDimensions >&
      getNeighbourEntities() const;
      
      __cuda_callable__ inline
      bool isBoundaryEntity() const;
+4 −10
Original line number Diff line number Diff line
@@ -218,9 +218,7 @@ template< int Dimensions,
          typename Config >
   template< int NeighbourEntityDimensions >
__cuda_callable__ inline
tnlNeighbourGridEntityGetter< 
   tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, EntityDimensions, Config >, 
   NeighbourEntityDimensions >
const typename tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, EntityDimensions, Config >::template NeighbourEntities< NeighbourEntityDimensions >&
tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, EntityDimensions, Config >::
getNeighbourEntities() const 
{
@@ -425,9 +423,7 @@ template< int Dimensions,
          typename Config >
   template< int NeighbourEntityDimensions >
__cuda_callable__ inline
tnlNeighbourGridEntityGetter< 
   tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, Dimensions, Config >, 
   NeighbourEntityDimensions >
const typename tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, Dimensions, Config >::template NeighbourEntities< NeighbourEntityDimensions >&
tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, Dimensions, Config >::
getNeighbourEntities() const
{
@@ -641,9 +637,7 @@ template< int Dimensions,
          typename Config >
   template< int NeighbourEntityDimensions >
__cuda_callable__ inline
tnlNeighbourGridEntityGetter< 
   tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, 0, Config >, 
   NeighbourEntityDimensions >
const typename tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, 0, Config >::template NeighbourEntities< NeighbourEntityDimensions >&
tnlGridEntity< tnlGrid< Dimensions, Real, Device, Index >, 0, Config >::
getNeighbourEntities() const
{
+10 −10
Original line number Diff line number Diff line
@@ -59,7 +59,7 @@ class tnlNeighbourGridEntityGetter<
      
      template< int step >
      __cuda_callable__ inline
      NeighbourGridEntityType getEntity()
      NeighbourGridEntityType getEntity() const
      {
         tnlAssert( this->entity.getCoordinates() >= CoordinatesType( 0 ) &&
                    this->entity.getCoordinates() < this->entity.getGrid().getDimensions(),
@@ -76,7 +76,7 @@ class tnlNeighbourGridEntityGetter<
      
      template< int step >
      __cuda_callable__ inline
      IndexType getEntityIndex()
      IndexType getEntityIndex() const
      {
         tnlAssert( entity.getCoordinates() >= CoordinatesType( 0 ) &&
                    entity.getCoordinates() < entity.getGrid().getDimensions(),
@@ -139,7 +139,7 @@ class tnlNeighbourGridEntityGetter<
      
      template< int step >
      __cuda_callable__ inline
      NeighbourGridEntityType getEntity()
      NeighbourGridEntityType getEntity() const
      {
         tnlAssert( this->entity.getCoordinates() >= CoordinatesType( 0 ) &&
                    this->entity.getCoordinates() < this->entity.getGrid().getDimensions(),
@@ -156,7 +156,7 @@ class tnlNeighbourGridEntityGetter<
      
      template< int step >
      __cuda_callable__ inline
      IndexType getEntityIndex()
      IndexType getEntityIndex() const
      {
         tnlAssert( entity.getCoordinates() >= CoordinatesType( 0 ) &&
                    entity.getCoordinates() < entity.getGrid().getDimensions(),
@@ -240,7 +240,7 @@ class tnlNeighbourGridEntityGetter<
      
      template< int step >
      __cuda_callable__ inline
      NeighbourGridEntityType getEntity()
      NeighbourGridEntityType getEntity() const
      {
         tnlAssert( entity.getCoordinates() >= CoordinatesType( 0 ) &&
                    entity.getCoordinates() < entity.getGrid().getDimensions(),
@@ -257,7 +257,7 @@ class tnlNeighbourGridEntityGetter<
      
      template< int step >
      __cuda_callable__ inline
      IndexType getEntityIndex()
      IndexType getEntityIndex() const
      {
         tnlAssert( entity.getCoordinates() >= CoordinatesType( 0 ) &&
                    entity.getCoordinates() < entity.getGrid().getDimensions(),
@@ -319,7 +319,7 @@ class tnlNeighbourGridEntityGetter<
      
      template< int step >
      __cuda_callable__ inline
      NeighbourGridEntityType getEntity()
      NeighbourGridEntityType getEntity() const
      {
         tnlAssert( entity.getCoordinates() >= CoordinatesType( 0 ) &&
                    entity.getCoordinates() <= entity.getGrid().getDimensions(),
@@ -336,7 +336,7 @@ class tnlNeighbourGridEntityGetter<
      
      template< int step >
      __cuda_callable__ inline
      IndexType getEntityIndex()
      IndexType getEntityIndex() const
      {
         tnlAssert( entity.getCoordinates() >= CoordinatesType( 0 ) &&
                    entity.getCoordinates() <= entity.getGrid().getDimensions(),
@@ -397,7 +397,7 @@ class tnlNeighbourGridEntityGetter<
      
      template< int step >
      __cuda_callable__ inline
      NeighbourGridEntityType getEntity()
      NeighbourGridEntityType getEntity() const
      {
         tnlAssert( entity.getCoordinates() >= CoordinatesType( 0 ) &&
                    entity.getCoordinates() <= entity.getGrid().getDimensions(),
@@ -414,7 +414,7 @@ class tnlNeighbourGridEntityGetter<
      
      template< int step >
      __cuda_callable__ inline
      IndexType getEntityIndex()
      IndexType getEntityIndex() const
      {
         tnlAssert( entity.getCoordinates() >= CoordinatesType( 0 ) &&
                    entity.getCoordinates() <= entity.getGrid().getDimensions(),
+12 −12
Original line number Diff line number Diff line
@@ -59,7 +59,7 @@ class tnlNeighbourGridEntityGetter<
      
      template< int stepX, int stepY >
      __cuda_callable__ inline
      NeighbourGridEntityType getEntity()
      NeighbourGridEntityType getEntity() const
      {
         tnlAssert( entity.getCoordinates() >= CoordinatesType( 0, 0 ) &&
                    entity.getCoordinates() < entity.getGrid().getDimensions(),
@@ -78,7 +78,7 @@ class tnlNeighbourGridEntityGetter<
      
      template< int stepX, int stepY >
      __cuda_callable__ inline
      IndexType getEntityIndex()
      IndexType getEntityIndex() const
      {
         tnlAssert( entity.getCoordinates() >= CoordinatesType( 0, 0 ) &&
                    entity.getCoordinates() < entity.getGrid().getDimensions(),
@@ -143,7 +143,7 @@ class tnlNeighbourGridEntityGetter<
      
      template< int stepX, int stepY >
      __cuda_callable__ inline
      NeighbourGridEntityType getEntity()
      NeighbourGridEntityType getEntity() const
      {
         tnlAssert( entity.getCoordinates() >= CoordinatesType( 0, 0 ) &&
                    entity.getCoordinates() < entity.getGrid().getDimensions(),
@@ -162,7 +162,7 @@ class tnlNeighbourGridEntityGetter<
      
      template< int stepX, int stepY >
      __cuda_callable__ inline
      IndexType getEntityIndex()
      IndexType getEntityIndex() const
      {
         tnlAssert( entity.getCoordinates() >= CoordinatesType( 0, 0 ) &&
                    entity.getCoordinates() < entity.getGrid().getDimensions(),
@@ -272,7 +272,7 @@ class tnlNeighbourGridEntityGetter<
      
      template< int stepX, int stepY >
      __cuda_callable__ inline
      NeighbourGridEntityType getEntity()
      NeighbourGridEntityType getEntity() const
      {
         tnlAssert( ! stepX + ! stepY == 1,
                    cerr << "Only one of the steps can be non-zero: stepX = " << stepX << " stepY = " << stepY );
@@ -302,7 +302,7 @@ class tnlNeighbourGridEntityGetter<
      
      template< int stepX, int stepY >
      __cuda_callable__ inline
      IndexType getEntityIndex()
      IndexType getEntityIndex() const
      {
         return GridEntityGetter::getEntityIndex( this->entity.getGrid(), this->template getEntity< stepX, stepY >() );
      }
@@ -354,7 +354,7 @@ class tnlNeighbourGridEntityGetter<
      
      template< int stepX, int stepY >
      __cuda_callable__ inline
      NeighbourGridEntityType getEntity()
      NeighbourGridEntityType getEntity() const
      {
         tnlAssert( stepX != 0 && stepY != 0,
                    cerr << " stepX = " << stepX << " stepY = " << stepY );
@@ -380,7 +380,7 @@ class tnlNeighbourGridEntityGetter<
      
      template< int stepX, int stepY >
      __cuda_callable__ inline
      IndexType getEntityIndex()
      IndexType getEntityIndex() const
      {
         return GridEntityGetter::getEntityIndex( this->entity.getGrid(), this->template getEntity< stepX, stepY >() );
      }
@@ -432,7 +432,7 @@ class tnlNeighbourGridEntityGetter<
      
      template< int stepX, int stepY >
      __cuda_callable__ inline
      NeighbourGridEntityType getEntity()
      NeighbourGridEntityType getEntity() const
      {
         tnlAssert( ( ( !! stepX ) == ( !! entity.getOrientation().x() ) ) &&
                    ( ( !! stepY ) == ( !! entity.getOrientation().y() ) ),
@@ -458,7 +458,7 @@ class tnlNeighbourGridEntityGetter<
      
      template< int stepX, int stepY >
      __cuda_callable__ inline
      IndexType getEntityIndex()
      IndexType getEntityIndex() const
      {
         return GridEntityGetter::getEntityIndex( this->entity.getGrid(), this->template getEntity< stepX, stepY >() );
      }
@@ -509,7 +509,7 @@ class tnlNeighbourGridEntityGetter<
            
      template< int stepX, int stepY >
      __cuda_callable__ inline
      NeighbourGridEntityType getEntity()
      NeighbourGridEntityType getEntity() const
      {
         tnlAssert( entity.getCoordinates() >= CoordinatesType( 0, 0 ) &&
                    entity.getCoordinates() <= entity.getGrid().getDimensions(),
@@ -528,7 +528,7 @@ class tnlNeighbourGridEntityGetter<
      
      template< int stepX, int stepY >
      __cuda_callable__ inline
      IndexType getEntityIndex()
      IndexType getEntityIndex() const
      {
         tnlAssert( entity.getCoordinates() >= CoordinatesType( 0, 0 ) &&
                    entity.getCoordinates() <= entity.getGrid().getDimensions(),
+14 −14
Original line number Diff line number Diff line
@@ -60,7 +60,7 @@ class tnlNeighbourGridEntityGetter<
      
      template< int stepX, int stepY, int stepZ >
      __cuda_callable__ inline
      NeighbourGridEntityType getEntity()
      NeighbourGridEntityType getEntity() const
      {
         tnlAssert( entity.getCoordinates() >= CoordinatesType( 0, 0, 0 ) &&
                    entity.getCoordinates() < entity.getGrid().getDimensions(),
@@ -79,7 +79,7 @@ class tnlNeighbourGridEntityGetter<
      
      template< int stepX, int stepY, int stepZ >
      __cuda_callable__ inline
      IndexType getEntityIndex()
      IndexType getEntityIndex() const
      {
         tnlAssert( entity.getCoordinates() >= CoordinatesType( 0, 0, 0 ) &&
                    entity.getCoordinates() < entity.getGrid().getDimensions(),
@@ -146,7 +146,7 @@ class tnlNeighbourGridEntityGetter<
      
      template< int stepX, int stepY, int stepZ >
      __cuda_callable__ inline
      NeighbourGridEntityType getEntity()
      NeighbourGridEntityType getEntity() const
      {
         tnlAssert( entity.getCoordinates() >= CoordinatesType( 0, 0, 0 ) &&
                    entity.getCoordinates() < entity.getGrid().getDimensions(),
@@ -165,7 +165,7 @@ class tnlNeighbourGridEntityGetter<
      
      template< int stepX, int stepY, int stepZ >
      __cuda_callable__ inline
      IndexType getEntityIndex()
      IndexType getEntityIndex() const
      {
         tnlAssert( entity.getCoordinates() >= CoordinatesType( 0, 0, 0 ) &&
                    entity.getCoordinates() < entity.getGrid().getDimensions(),
@@ -294,7 +294,7 @@ class tnlNeighbourGridEntityGetter<
      
      template< int stepX, int stepY, int stepZ >
      __cuda_callable__ inline
      NeighbourGridEntityType getEntity()
      NeighbourGridEntityType getEntity() const
      {
         tnlAssert( ! stepX + ! stepY + ! stepZ == 2,
                    cerr << "Only one of the steps can be non-zero: stepX = " << stepX 
@@ -331,7 +331,7 @@ class tnlNeighbourGridEntityGetter<
      
      template< int stepX, int stepY, int stepZ >
      __cuda_callable__ inline
      IndexType getEntityIndex()
      IndexType getEntityIndex() const
      {
         return GridEntityGetter::getEntityIndex( this->entity.getGrid(), getEntity< stepX, stepY, stepZ >() );
      }
@@ -383,7 +383,7 @@ class tnlNeighbourGridEntityGetter<
      
      template< int stepX, int stepY, int stepZ >
      __cuda_callable__ inline
      NeighbourGridEntityType getEntity()
      NeighbourGridEntityType getEntity() const
      {
         tnlAssert( ! stepX + ! stepY + ! stepZ == 1,
                    cerr << "Exactly two of the steps must be non-zero: stepX = " << stepX 
@@ -417,7 +417,7 @@ class tnlNeighbourGridEntityGetter<
      
      template< int stepX, int stepY, int stepZ >
      __cuda_callable__ inline
      IndexType getEntityIndex()
      IndexType getEntityIndex() const
      {
         return GridEntityGetter::getEntityIndex( this->entity.getGrid(), getEntity< stepX, stepY, stepZ >( entity ) );
      }
@@ -469,7 +469,7 @@ class tnlNeighbourGridEntityGetter<
      
      template< int stepX, int stepY,int stepZ >
      __cuda_callable__ inline
      NeighbourGridEntityType getEntity()
      NeighbourGridEntityType getEntity() const
      {
         tnlAssert( stepX != 0 && stepY != 0 && stepZ != 0,
                    cerr << " stepX = " << stepX 
@@ -502,7 +502,7 @@ class tnlNeighbourGridEntityGetter<
      
      template< int stepX, int stepY, int stepZ >
      __cuda_callable__ inline
      IndexType getEntityIndex()
      IndexType getEntityIndex() const
      {
         return GridEntityGetter::getEntityIndex( entity.getGrid(), getEntity< stepX, stepY, stepZ >( entity ) );
      }
@@ -553,7 +553,7 @@ class tnlNeighbourGridEntityGetter<
      
      template< int stepX, int stepY, int stepZ >
      __cuda_callable__ inline
      NeighbourGridEntityType getEntity()
      NeighbourGridEntityType getEntity() const
      {
         tnlAssert( ( ( !! stepX ) == ( !! entity.getOrientation().x() ) ) &&
                    ( ( !! stepY ) == ( !! entity.getOrientation().y() ) ) &&
@@ -586,7 +586,7 @@ class tnlNeighbourGridEntityGetter<
      
      template< int stepX, int stepY, int stepZ >
      __cuda_callable__ inline
      IndexType getEntityIndex()
      IndexType getEntityIndex() const
      {
         return GridEntityGetter::getEntityIndex( entity.getGrid(), getEntity< stepX, stepY, stepZ >() );
      }
@@ -636,7 +636,7 @@ class tnlNeighbourGridEntityGetter<
      
      template< int stepX, int stepY, int stepZ >
      __cuda_callable__ inline
      NeighbourGridEntityType getEntity()
      NeighbourGridEntityType getEntity() const
      {
         tnlAssert( entity.getCoordinates() >= CoordinatesType( 0, 0, 0 ) &&
                    entity.getCoordinates() <= entity.getGrid().getDimensions(),
@@ -656,7 +656,7 @@ class tnlNeighbourGridEntityGetter<
      
      template< int stepX, int stepY, int stepZ >
      __cuda_callable__ inline
      IndexType getEntityIndex()
      IndexType getEntityIndex() const
      {
         tnlAssert( entity.getCoordinates() >= CoordinatesType( 0, 0, 0 ) &&
                    entity.getCoordinates() <= entity.getGrid().getDimensions(),
Loading