diff --git a/src/TNL/Meshes/GridDetails/Grid1D.h b/src/TNL/Meshes/GridDetails/Grid1D.h index 81811fe9005c44bb1239f06fe423f4d566c7c77c..67b6e78e8c7f0c3a243abc80dab2fe4d319ac8b1 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 279ec9810184ea097212e45984183ad1ddc97e70..679b473f1cebdc9e95a515676aec7bbceeb13229 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 b24be9ba29503f4f6b80f2c3ad0ada1097d89844..3d7335053b062baa7e92514acd1cb360b8bade00 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 259181688c0566abdd3025bac1cbda1429a60d10..4f9f8fdd580f17a8e88c596127216e57e916bfee 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 881fb0074bf642ca6fdcd1300df849c93d205792..7e3f0d5e86781d70a79bb7ef5ac83f19cd7404db 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 f4707a8ce34654544f9d7455122ebc3a340d690b..dd91a7ed852c0d961be8c3cb0811d5c687735280 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 >