Commit 51667a20 authored by Tomáš Oberhuber's avatar Tomáš Oberhuber
Browse files

Finishing finite differences operators test.

parent 5f7a2ebf
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@

template< typename Operator,
          typename Function >
class tnlExactOperatorFunction : public tnlDomain< Operator::Dimensions, SpaceDomain >
class tnlExactOperatorFunction : public tnlDomain< Operator::getDimensions(), SpaceDomain >
{   
   static_assert( Operator::getDimensions() == Function::getDimensions(),
      "Operator and function have different number of domain dimensions." );
@@ -34,7 +34,7 @@ class tnlExactOperatorFunction : public tnlDomain< Operator::Dimensions, SpaceDo
      typedef typename FunctionType::RealType RealType;
      typedef typename FunctionType::VertexType VertexType;
      
      static constexpr int getDimensions(){ return Operator::Dimensions; };
      static constexpr int getDimensions(){ return Operator::getDimensions(); };
      
      tnlExactOperatorFunction(
         const OperatorType& operator_,
+20 −20
Original line number Diff line number Diff line
@@ -247,7 +247,7 @@ Real
tnlGrid< 1, Real, Device, Index >::
getCellMeasure() const
{
   
   return this->template getSpaceStepsProducts< 1 >();
}

template< typename Real,
+25 −2
Original line number Diff line number Diff line
@@ -40,7 +40,7 @@ template< int Dimensions,
          typename Real,
          typename Index >
class tnlBackwardFiniteDifference< tnlGrid< Dimensions, MeshReal, MeshDevice, MeshIndex >, XDifference, YDifference, ZDifference, Real, Index >
: tnlDomain< Dimensions, MeshInteriorDomain >
: public tnlDomain< Dimensions, MeshInteriorDomain >
{
   public:
      
@@ -51,6 +51,17 @@ class tnlBackwardFiniteDifference< tnlGrid< Dimensions, MeshReal, MeshDevice, Me
      
      static constexpr int getMeshDimensions() { return Dimensions; }
      
      static tnlString getType()
      {
         return tnlString( "tnlBackwardFiniteDifference< " ) +
            MeshType::getType() + ", " +
            tnlString( XDifference ) + ", " +
            tnlString( YDifference ) + ", " +
            tnlString( ZDifference ) + ", " +
            ::getType< RealType >() + ", " +
            ::getType< IndexType >() + " >";
      }
      
      template< typename MeshFunction, typename MeshEntity >
      __cuda_callable__
      inline Real operator()( const MeshFunction& u,
@@ -59,7 +70,19 @@ class tnlBackwardFiniteDifference< tnlGrid< Dimensions, MeshReal, MeshDevice, Me
      {
         static_assert( MeshFunction::getMeshEntityDimensions() == Dimensions,
            "Finite differences can be evaluate only on mesh cells, i.e. the dimensions count of the mesh entities of mesh function must be the same as mesh dimensions count." );
         return tnlFiniteDifferences< MeshType, Real, Index, XDifference, YDifference, ZDifference, -1, -1, -1 >::getValue( u, entity );
         const int XDirection = -1 * ( XDifference != 0 );
         const int YDirection = -1 * ( YDifference != 0 );
         const int ZDirection = -1 * ( ZDifference != 0 );
         return tnlFiniteDifferences<
            MeshType,
            Real,
            Index,
            XDifference,
            YDifference,
            ZDifference,
            XDirection,
            YDirection,
            ZDirection >::getValue( u, entity );
      };
};

+15 −3
Original line number Diff line number Diff line
@@ -40,7 +40,7 @@ template< int Dimensions,
          typename Real,
          typename Index >
class tnlCentralFiniteDifference< tnlGrid< Dimensions, MeshReal, MeshDevice, MeshIndex >, XDifference, YDifference, ZDifference, Real, Index >
: tnlDomain< Dimensions, MeshInteriorDomain >
: public tnlDomain< Dimensions, MeshInteriorDomain >
{
   public:
      
@@ -49,7 +49,19 @@ class tnlCentralFiniteDifference< tnlGrid< Dimensions, MeshReal, MeshDevice, Mes
      typedef MeshDevice DeviceType;
      typedef Index IndexType;
            
      static constexpr int getMeshDimensions() { return Dimensions; }
      //static constexpr int getMeshDimensions() { return Dimensions; }
      
      static tnlString getType()
      {
         return tnlString( "tnlCentralFiniteDifference< " ) +
            MeshType::getType() + ", " +
            tnlString( XDifference ) + ", " +
            tnlString( YDifference ) + ", " +
            tnlString( ZDifference ) + ", " +
            ::getType< RealType >() + ", " +
            ::getType< IndexType >() + " >";
      }

      
      template< typename MeshFunction, typename MeshEntity >
      __cuda_callable__
+9 −1
Original line number Diff line number Diff line
@@ -31,11 +31,19 @@ class tnlExactDifference
      typedef typename Function::RealType RealType;
      typedef typename Function::VertexType VertexType;
      
      static tnlString getType()
      {
         return tnlString( "tnlExactDifference< " ) +
            Function::getType() + ", " +
            tnlString( XDerivative ) + ", " +
            tnlString( YDerivative ) + ", " +
            tnlString( ZDerivative ) + " >";
      }
      
      RealType operator()( 
         const FunctionType& function,
         const VertexType& vertex,
         const RealType& time = 0 )
         const RealType& time = 0 ) const
      {
         return function.template getPartialDerivative<
            XDerivative,
Loading