From 93529552157b1f03a457ab5adff2c694f96ba4d6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jakub=20Klinkovsk=C3=BD?= <klinkovsky@mmg.fjfi.cvut.cz>
Date: Wed, 12 Feb 2020 13:08:28 +0100
Subject: [PATCH] Removed unused methods from the grid specializations

They are implemented in MeshFunction
---
 src/TNL/Meshes/GridDetails/Grid1D.h      | 10 ---
 src/TNL/Meshes/GridDetails/Grid1D_impl.h | 45 ------------
 src/TNL/Meshes/GridDetails/Grid2D.h      | 16 -----
 src/TNL/Meshes/GridDetails/Grid2D_impl.h | 70 ------------------
 src/TNL/Meshes/GridDetails/Grid3D.h      | 16 -----
 src/TNL/Meshes/GridDetails/Grid3D_impl.h | 92 ------------------------
 6 files changed, 249 deletions(-)

diff --git a/src/TNL/Meshes/GridDetails/Grid1D.h b/src/TNL/Meshes/GridDetails/Grid1D.h
index 81811fe900..67b6e78e8c 100644
--- a/src/TNL/Meshes/GridDetails/Grid1D.h
+++ b/src/TNL/Meshes/GridDetails/Grid1D.h
@@ -180,16 +180,6 @@ class Grid< 1, Real, Device, Index > : public Object
     */
    __cuda_callable__
    inline RealType getSmallestSpaceStep() const;
-
-
-   template< typename GridFunction >
-   typename GridFunction::RealType getDifferenceAbsMax( const GridFunction& f1,
-                                                        const GridFunction& f2 ) const;
-
-   template< typename GridFunction >
-   typename GridFunction::RealType getDifferenceLpNorm( const GridFunction& f1,
-                                                        const GridFunction& f2,
-                                                        const typename GridFunction::RealType& p ) const;
    
    void setDistMesh(DistributedMeshType * distMesh);
    
diff --git a/src/TNL/Meshes/GridDetails/Grid1D_impl.h b/src/TNL/Meshes/GridDetails/Grid1D_impl.h
index 279ec98101..679b473f1c 100644
--- a/src/TNL/Meshes/GridDetails/Grid1D_impl.h
+++ b/src/TNL/Meshes/GridDetails/Grid1D_impl.h
@@ -290,51 +290,6 @@ getSmallestSpaceStep() const
    return this->spaceSteps.x();
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
-   template< typename GridFunction >
-typename GridFunction::RealType
-Grid< 1, Real, Device, Index >::getDifferenceAbsMax( const GridFunction& f1,
-                                                        const GridFunction& f2 ) const
-{
-   typename GridFunction::RealType maxDiff( -1.0 );
-
-   Cell cell( *this );
-   for( cell.getCoordinates().x() = 0;
-        cell.getCoordinates().x() < getDimensions().x();
-        cell.getCoordinates().x()++ )
-   {
-      IndexType c = this->getEntityIndex( cell );
-      maxDiff = max( maxDiff, abs( f1[ c ] - f2[ c ] ) );
-   }
-   return maxDiff;
-}
-
-template< typename Real,
-          typename Device,
-          typename Index >
-   template< typename GridFunction >
-typename GridFunction::RealType
-Grid< 1, Real, Device, Index >::getDifferenceLpNorm( const GridFunction& f1,
-                                                        const GridFunction& f2,
-                                                        const typename GridFunction::RealType& p ) const
-{
-   typedef typename GridFunction::RealType FunctionRealType;
-   FunctionRealType lpNorm( 0.0 ), cellVolume( this->getSpaceSteps().x() );
-
-   Cell cell( *this );
-   for( cell.getCoordinates().x() = 0;
-        cell.getCoordinates().x() < getDimensions().x();
-        cell.getCoordinates().x()++ )
-   {
-      IndexType c = this->getEntityIndex( cell );
-      lpNorm += ::pow( abs( f1[ c ] - f2[ c ] ), p );
-   }
-   lpNorm *= cellVolume;
-   return ::pow( lpNorm, 1.0 / p );
-}
-
 template< typename Real,
           typename Device,
           typename Index >
diff --git a/src/TNL/Meshes/GridDetails/Grid2D.h b/src/TNL/Meshes/GridDetails/Grid2D.h
index b24be9ba29..3d7335053b 100644
--- a/src/TNL/Meshes/GridDetails/Grid2D.h
+++ b/src/TNL/Meshes/GridDetails/Grid2D.h
@@ -174,22 +174,6 @@ class Grid< 2, Real, Device, Index > : public Object
    inline RealType getSmallestSpaceStep() const;
 
 
-   template< typename GridFunction >
-   typename GridFunction::RealType getAbsMax( const GridFunction& f ) const;
-
-   template< typename GridFunction >
-   typename GridFunction::RealType getLpNorm( const GridFunction& f,
-                                              const typename GridFunction::RealType& p ) const;
-
-   template< typename GridFunction >
-   typename GridFunction::RealType getDifferenceAbsMax( const GridFunction& f1,
-                                                        const GridFunction& f2 ) const;
-
-   template< typename GridFunction >
-   typename GridFunction::RealType getDifferenceLpNorm( const GridFunction& f1,
-                                                        const GridFunction& f2,
-                                                        const typename GridFunction::RealType& p ) const;
-   
    void setDistMesh(DistributedMeshType * distGrid);
    
    DistributedMeshType * getDistributedMesh() const;
diff --git a/src/TNL/Meshes/GridDetails/Grid2D_impl.h b/src/TNL/Meshes/GridDetails/Grid2D_impl.h
index 259181688c..4f9f8fdd58 100644
--- a/src/TNL/Meshes/GridDetails/Grid2D_impl.h
+++ b/src/TNL/Meshes/GridDetails/Grid2D_impl.h
@@ -348,76 +348,6 @@ Real Grid< 2, Real, Device, Index > :: getSmallestSpaceStep() const
    return min( this->spaceSteps.x(), this->spaceSteps.y() );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
-   template< typename GridFunction >
-      typename GridFunction::RealType
-         Grid< 2, Real, Device, Index >::getAbsMax( const GridFunction& f ) const
-{
-   return f.absMax();
-}
-
-template< typename Real,
-          typename Device,
-          typename Index >
-   template< typename GridFunction >
-      typename GridFunction::RealType
-         Grid< 2, Real, Device, Index >::getLpNorm( const GridFunction& f1,
-                                                                 const typename GridFunction::RealType& p ) const
-{
-   typename GridFunction::RealType lpNorm( 0.0 );
-   Cell cell( *this );
-   for( cell.getCoordinates().y() = 0;
-        cell.getCoordinates().y() < getDimensions().y();
-        cell.getCoordinates().y()++ )
-      for( cell.getCoordinates().x() = 0;
-           cell.getCoordinates().x() < getDimensions().x();
-           cell.getCoordinates().x()++ )
-      {
-         IndexType c = this->getEntityIndex( cell );
-         lpNorm += ::pow( abs( f1[ c ] ), p );
-      }
-   lpNorm *= this->getSpaceSteps().x() * this->getSpaceSteps().y();
-   return ::pow( lpNorm, 1.0/p );
-}
-
-template< typename Real,
-          typename Device,
-          typename Index >
-   template< typename GridFunction >
-      typename GridFunction::RealType
-         Grid< 2, Real, Device, Index >::getDifferenceAbsMax( const GridFunction& f1,
-                                                              const GridFunction& f2 ) const
-{
-   return TNL::max( TNL::abs( f1.getData() - f2.getData() ) );
-}
-
-template< typename Real,
-          typename Device,
-          typename Index >
-   template< typename GridFunction >
-      typename GridFunction::RealType
-         Grid< 2, Real, Device, Index >::getDifferenceLpNorm( const GridFunction& f1,
-                                                                 const GridFunction& f2,
-                                                                 const typename GridFunction::RealType& p ) const
-{
-   typename GridFunction::RealType lpNorm( 0.0 );
-   Cell cell( *this );
-   for( cell.getCoordinates().y() = 0;
-        cell.getCoordinates().y() < getDimensions().y();
-        cell.getCoordinates().y()++ )
-      for( cell.getCoordinates().x() = 0;
-           cell.getCoordinates().x() < getDimensions().x();
-           cell.getCoordinates().x()++ )
-      {
-         IndexType c = this->getEntityIndex( cell );
-         lpNorm += ::pow( abs( f1[ c ] - f2[ c ] ), p );
-      }
-   lpNorm *= this->getSpaceSteps().x() * this->getSpaceSteps().y();
-   return ::pow( lpNorm, 1.0 / p );
-}
-
 template< typename Real,
           typename Device,
           typename Index >
diff --git a/src/TNL/Meshes/GridDetails/Grid3D.h b/src/TNL/Meshes/GridDetails/Grid3D.h
index 881fb0074b..7e3f0d5e86 100644
--- a/src/TNL/Meshes/GridDetails/Grid3D.h
+++ b/src/TNL/Meshes/GridDetails/Grid3D.h
@@ -179,22 +179,6 @@ class Grid< 3, Real, Device, Index > : public Object
    __cuda_callable__
    RealType getSmallestSpaceStep() const;
 
-   template< typename GridFunction >
-   typename GridFunction::RealType getAbsMax( const GridFunction& f ) const;
-
-   template< typename GridFunction >
-   typename GridFunction::RealType getLpNorm( const GridFunction& f,
-                                              const typename GridFunction::RealType& p ) const;
-
-   template< typename GridFunction >
-   typename GridFunction::RealType getDifferenceAbsMax( const GridFunction& f1,
-                                                        const GridFunction& f2 ) const;
-
-   template< typename GridFunction >
-   typename GridFunction::RealType getDifferenceLpNorm( const GridFunction& f1,
-                                                        const GridFunction& f2,
-                                                        const typename GridFunction::RealType& p ) const;
-
    /**
     * \brief See Grid1D::save( File& file ) const.
     */
diff --git a/src/TNL/Meshes/GridDetails/Grid3D_impl.h b/src/TNL/Meshes/GridDetails/Grid3D_impl.h
index f4707a8ce3..dd91a7ed85 100644
--- a/src/TNL/Meshes/GridDetails/Grid3D_impl.h
+++ b/src/TNL/Meshes/GridDetails/Grid3D_impl.h
@@ -407,98 +407,6 @@ Real Grid< 3, Real, Device, Index > :: getSmallestSpaceStep() const
    return min( this->spaceSteps.x(), min( this->spaceSteps.y(), this->spaceSteps.z() ) );
 }
 
-template< typename Real,
-          typename Device,
-          typename Index >
-   template< typename GridFunction >
-typename GridFunction::RealType
-   Grid< 3, Real, Device, Index >::getAbsMax( const GridFunction& f ) const
-{
-   return f.absMax();
-}
-
-template< typename Real,
-          typename Device,
-          typename Index >
-   template< typename GridFunction >
-typename GridFunction::RealType
-   Grid< 3, Real, Device, Index >::getLpNorm( const GridFunction& f1,
-                                                 const typename GridFunction::RealType& p ) const
-{
-   typename GridFunction::RealType lpNorm( 0.0 );
-   Cell cell;
-   for( cell.getCoordinates().z() = 0;
-        cell.getCoordinates().z() < getDimensions().z();
-        cell.getCoordinates().z()++ )
-      for( cell.getCoordinates().y() = 0;
-           cell.getCoordinates().y() < getDimensions().y();
-           cell.getCoordinates().y()++ )
-         for( cell.getCoordinates().x() = 0;
-              cell.getCoordinates().x() < getDimensions().x();
-              cell.getCoordinates().x()++ )
-         {
-            IndexType c = this->getEntityIndex( cell );
-            lpNorm += ::pow( abs( f1[ c ] ), p );;
-         }
-   lpNorm *= this->getSpaceSteps()().x() * this->getSpaceSteps()().y() * this->getSpaceSteps()().z();
-   return ::pow( lpNorm, 1.0/p );
-}
-
-
-template< typename Real,
-          typename Device,
-          typename Index >
-   template< typename GridFunction >
-      typename GridFunction::RealType
-         Grid< 3, Real, Device, Index >::getDifferenceAbsMax( const GridFunction& f1,
-                                                                           const GridFunction& f2 ) const
-{
-   typename GridFunction::RealType maxDiff( -1.0 );
-   Cell cell( *this );
-   for( cell.getCoordinates().z() = 0;
-        cell.getCoordinates().z() < getDimensions().z();
-        cell.getCoordinates().z()++ )
-      for( cell.getCoordinates().y() = 0;
-           cell.getCoordinates().y() < getDimensions().y();
-           cell.getCoordinates().y()++ )
-         for( cell.getCoordinates().x() = 0;
-              cell.getCoordinates().x() < getDimensions().x();
-              cell.getCoordinates().x()++ )
-         {
-            IndexType c = this->getEntityIndex( cell );
-            maxDiff = max( maxDiff, abs( f1[ c ] - f2[ c ] ) );
-         }
-   return maxDiff;
-}
-
-template< typename Real,
-          typename Device,
-          typename Index >
-   template< typename GridFunction >
-      typename GridFunction::RealType
-         Grid< 3, Real, Device, Index >::getDifferenceLpNorm( const GridFunction& f1,
-                                                                 const GridFunction& f2,
-                                                                 const typename GridFunction::RealType& p ) const
-{
-   typename GridFunction::RealType lpNorm( 0.0 );
-   Cell cell( *this );
-   for( cell.getCoordinates().z() = 0;
-        cell.getCoordinates().z() < getDimensions().z();
-        cell.getCoordinates().z()++ )
-      for( cell.getCoordinates().y() = 0;
-           cell.getCoordinates().y() < getDimensions().y();
-           cell.getCoordinates().y()++ )
-         for( cell.getCoordinates().x() = 0;
-              cell.getCoordinates().x() < getDimensions().x();
-              cell.getCoordinates().x()++ )
-         {
-            IndexType c = this->getEntityIndex( cell );
-            lpNorm += ::pow( abs( f1[ c ] - f2[ c ] ), p );
-         }
-   lpNorm *= this->getSpaceSteps().x() * this->getSpaceSteps().y() * this->getSpaceSteps().z();
-   return ::pow( lpNorm, 1.0 / p );
-}
-
 template< typename Real,
           typename Device,
           typename Index >
-- 
GitLab