Commit b70830eb authored by Jakub Klinkovský's avatar Jakub Klinkovský
Browse files

Simplified getEntitiesCount in grids

parent f37cb576
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -75,15 +75,15 @@ class Grid< 1, Real, Device, Index > : public Object
   __cuda_callable__
   inline const PointType& getProportions() const;
 
   template< typename EntityType >

   template< int EntiytDimension >
   __cuda_callable__
   IndexType getEntitiesCount() const;

   template< int EntiytDimensions >
   template< typename EntityType >
   __cuda_callable__
   IndexType getEntitiesCount() const;
   
   
   template< typename EntityType >
   __cuda_callable__
   EntityType getEntity( const IndexType& entityIndex ) const;
+7 −17
Original line number Diff line number Diff line
@@ -146,19 +146,20 @@ const typename Grid< 1, Real, Device, Index >::PointType&
   return this->proportions;
}


template< typename Real,
          typename Device,
          typename Index >
   template< typename EntityType >
   template< int EntityDimension >
__cuda_callable__  inline
Index
Grid< 1, Real, Device, Index >::
getEntitiesCount() const
{
   static_assert( EntityType::entityDimension <= 1 &&
                  EntityType::entityDimension >= 0, "Wrong grid entity dimension." );
   static_assert( EntityDimension <= 1 &&
                  EntityDimension >= 0, "Wrong grid entity dimensions." );
 
   switch( EntityType::entityDimension )
   switch( EntityDimension )
   {
      case 1:
         return this->numberOfCells;
@@ -171,25 +172,14 @@ getEntitiesCount() const
template< typename Real,
          typename Device,
          typename Index >
   template< int EntityDimensions >
   template< typename EntityType >
__cuda_callable__  inline
Index
Grid< 1, Real, Device, Index >::
getEntitiesCount() const
{
   static_assert( EntityDimensions <= 1 &&
                  EntityDimensions >= 0, "Wrong grid entity dimensions." );
 
   switch( EntityDimensions )
   {
      case 1:
         return this->numberOfCells;
      case 0:
         return this->numberOfVertices;
   return getEntitiesCount< EntityType::getDimension() >();
}
   return -1;
}


template< typename Real,
          typename Device,
+1 −1
Original line number Diff line number Diff line
@@ -80,7 +80,7 @@ class Grid< 2, Real, Device, Index > : public Object
   inline const PointType& getProportions() const;


   template< int EntityDimensions >
   template< int EntityDimension >
   __cuda_callable__
   IndexType getEntitiesCount() const;
   
+6 −18
Original line number Diff line number Diff line
@@ -196,19 +196,20 @@ const typename Grid< 2, Real, Device, Index > :: PointType&
   return this->proportions;
}


template< typename Real,
          typename Device,
          typename Index >
   template< int EntityDimensions >
   template< int EntityDimension >
__cuda_callable__ inline
Index
Grid< 2, Real, Device, Index >::
getEntitiesCount() const
{
   static_assert( EntityDimensions <= 2 &&
                  EntityDimensions >= 0, "Wrong grid entity dimensions." );
   static_assert( EntityDimension <= 2 &&
                  EntityDimension >= 0, "Wrong grid entity dimensions." );
 
   switch( EntityDimensions )
   switch( EntityDimension )
   {
      case 2:
         return this->numberOfCells;
@@ -220,7 +221,6 @@ getEntitiesCount() const
   return -1;
}


template< typename Real,
          typename Device,
          typename Index >
@@ -230,19 +230,7 @@ Index
Grid< 2, Real, Device, Index >::
getEntitiesCount() const
{
   static_assert( EntityType::entityDimension <= 2 &&
                  EntityType::entityDimension >= 0, "Wrong grid entity dimension." );
 
   switch( EntityType::entityDimension )
   {
      case 2:
         return this->numberOfCells;
      case 1:
         return this->numberOfFaces;
      case 0:
         return this->numberOfVertices;
   }
   return -1;
   return getEntitiesCount< EntityType::getDimension() >();
}

template< typename Real,
+5 −4
Original line number Diff line number Diff line
@@ -72,11 +72,12 @@ class Grid< 3, Real, Device, Index > : public Object
   __cuda_callable__
   inline const PointType& getProportions() const;

   template< typename EntityType >

   template< int EntityDimension >
   __cuda_callable__
   IndexType getEntitiesCount() const;

   template< int Dimensions >
   template< typename EntityType >
   __cuda_callable__
   IndexType getEntitiesCount() const;

Loading