Commit 50f91836 authored by Jakub Klinkovský's avatar Jakub Klinkovský
Browse files

Small changes in grids

parent 9e0691e2
Loading
Loading
Loading
Loading
+15 −20
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@
#include <TNL/Devices/Cuda.h>
#include <TNL/Meshes/MeshDimensionsTag.h>
#include <TNL/Meshes/GridEntityConfig.h>
#include <TNL/Meshes/GridDetails/NeighbourGridEntityGetter.h>

namespace TNL {
namespace Meshes {
@@ -54,7 +55,7 @@ class NeighbourGridEntityLayer< GridEntity, NeighbourEntityDimensions, GridEntit
      {
         BaseType::refresh( grid, entityIndex );
         neighbourEntities.refresh( grid, entityIndex );
      };
      }
 
   protected:
 
@@ -85,12 +86,11 @@ class NeighbourGridEntityLayer< GridEntity, 0, GridEntityConfig, true >
                    const typename GridEntity::GridType::IndexType& entityIndex )
      {
         neighbourEntities.refresh( grid, entityIndex );
      };
      }
 
   protected:
 
      NeighbourEntityGetterType neighbourEntities;
 
};

template< typename GridEntity,
@@ -109,14 +109,14 @@ class NeighbourGridEntityLayer< GridEntity, NeighbourEntityDimensions, GridEntit
      __cuda_callable__
      NeighbourGridEntityLayer( const GridEntity& entity )
      : BaseType( entity )
      {};
      {}

      __cuda_callable__
      const NeighbourEntityGetterType& getNeighbourEntities( const MeshDimensionsTag< NeighbourEntityDimensions >& tag ) const {};
      const NeighbourEntityGetterType& getNeighbourEntities( const MeshDimensionsTag< NeighbourEntityDimensions >& tag ) const {}
 
      __cuda_callable__
      void refresh( const typename GridEntity::GridType& grid,
                    const typename GridEntity::GridType::IndexType& entityIndex ) {};
                    const typename GridEntity::GridType::IndexType& entityIndex ) {}
};

template< typename GridEntity,
@@ -131,14 +131,16 @@ class NeighbourGridEntityLayer< GridEntity, 0, GridEntityConfig, false >
      NeighbourGridEntityLayer( const GridEntity& entity ){}

      __cuda_callable__
      const NeighbourEntityGetterType& getNeighbourEntities( const MeshDimensionsTag< 0 >& tag ) const {};
      const NeighbourEntityGetterType& getNeighbourEntities( const MeshDimensionsTag< 0 >& tag ) const {}
 
      __cuda_callable__
      void refresh( const typename GridEntity::GridType& grid,
                    const typename GridEntity::GridType::IndexType& entityIndex ) {};

                    const typename GridEntity::GridType::IndexType& entityIndex ) {}
};




template< typename GridEntity,
          typename GridEntityConfig >
class NeighbourGridEntitiesStorage
@@ -149,13 +151,13 @@ class NeighbourGridEntitiesStorage
   public:
 
      using BaseType::getNeighbourEntities;
      using BaseType::refresh;
 
      __cuda_callable__
      NeighbourGridEntitiesStorage( const GridEntity& entity )
      : BaseType( entity )
      {}
 
 
      template< int EntityDimensions >
      __cuda_callable__
      const NeighbourGridEntityGetter< GridEntity, EntityDimensions >&
@@ -163,13 +165,6 @@ class NeighbourGridEntitiesStorage
      {
         return BaseType::getNeighbourEntities( MeshDimensionsTag< EntityDimensions >() );
      }

      __cuda_callable__
      void refresh( const typename GridEntity::GridType& grid,
                    const typename GridEntity::GridType::IndexType& entityIndex )
      {
         BaseType::refresh( grid, entityIndex );
      };      
};


+3 −17
Original line number Diff line number Diff line
@@ -11,25 +11,11 @@
#pragma once

#include <TNL/Assert.h>
#include <TNL/Meshes/GridEntityConfig.h>

namespace TNL {
namespace Meshes {

/*enum GridEntityStencilStorage
{ 
   GridEntityNoStencil = 0,
   GridEntityCrossStencil,
   GridEntityFullStencil
};*/

template< int storage >
class GridEntityStencilStorageTag
{
   public:
 
      static const int stencilStorage = storage;
};

template< typename GridEntity,
          int NeighbourEntityDimensions,
          typename EntityStencilTag =
@@ -44,14 +30,14 @@ class NeighbourGridEntityGetter
      NeighbourGridEntityGetter( const GridEntity& entity )
      {
         //Assert( false, );
      };
      }
 
      __cuda_callable__
      void refresh( const typename GridEntity::GridType& grid,
                    const typename GridEntity::IndexType& entityIndex )
      {
         //Assert( false, );
      };
      }

};

+10 −2
Original line number Diff line number Diff line
@@ -20,6 +20,14 @@ enum GridEntityStencilStorage
   GridEntityFullStencil
};

template< int storage >
class GridEntityStencilStorageTag
{
   public:
 
      static const int stencilStorage = storage;
};

/****
 * This class says what neighbour grid entity indexes shall be pre-computed and stored in the
 * grid entity structure. If neighbourEntityStorage() returns false, nothing is stored.
@@ -47,7 +55,7 @@ class GridEntityNoStencilStorage
      template< typename GridEntity >
      constexpr static bool neighbourEntityStorage( int neighbourEntityStorage )
      {
         return GridEntityNoStencil;
         return false;
      }
 
      constexpr static int getStencilSize()
@@ -64,9 +72,9 @@ class GridEntityCrossStencilStorage
      template< typename GridEntity >
      constexpr static bool neighbourEntityStorage( const int neighbourEntityDimensions )
      {
         //return GridEntityNoStencil;
         return ( GridEntity::entityDimensions == GridEntity::GridType::meshDimensions &&
                  neighbourEntityDimensions == GridEntity::GridType::meshDimensions )
               // FIXME: how is GridEntityCrossStencil cast to int?
                * GridEntityCrossStencil;
      }
 
+2 −2
Original line number Diff line number Diff line
@@ -17,7 +17,7 @@ namespace Meshes {

/***
 * This tag or integer wrapper is necessary for C++ templates specializations.
 * As th C++ standard says:
 * As the C++ standard says:
 *
 *   A partially specialized non-type argument expression shall not involve
 *   a template parameter of the partial specialization except when the argument
@@ -26,7 +26,7 @@ namespace Meshes {
 * Therefore one cannot specialize the mesh layers just by integers saying the mesh
 * layer dimensions but instead this tag must be used. This makes the code more difficult
 * to read and we would like to avoid it if it is possible sometime.
 * On the other hand, tnlDimensionTag is also used for method overloading when
 * On the other hand, MeshDimensionsTag is also used for method overloading when
 * asking for different mesh entities. In this case it makes sense and it cannot be
 * replaced.
 */