Commit 4d98b186 authored by Tomáš Oberhuber's avatar Tomáš Oberhuber
Browse files

Refactoring functions and operators.

parent 50b21e23
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
ADD_SUBDIRECTORY( initial_conditions )

SET( headers tnlFunctionDiscretizer.h
             tnlFunctionDiscretizer_impl.h
             tnlFunctionEvaluator.h
SET( headers tnlFunctionEvaluator.h
             tnlFunctionEvaluator_impl.h
             tnlFunctionAdapter.h
             tnlConstantFunction.h
@@ -14,7 +12,7 @@ SET( headers tnlFunctionDiscretizer.h
             tnlSinWaveFunction.h
             tnlSinWaveFunction_impl.h
             tnlTestFunction.h
             tnlFunction.h
             tnlDomain.h
             tnlTestFunction_impl.h )

SET( CURRENT_DIR ${CMAKE_SOURCE_DIR}/src/functions )
+25 −18
Original line number Diff line number Diff line
@@ -61,16 +61,18 @@ class tnlBlobFunction< 1, Real > : public tnlBlobFunctionBase< Real, 1 >
#ifdef HAVE_NOT_CXX11
      template< int XDiffOrder,
                int YDiffOrder,
                int ZDiffOrder,
                typename Vertex >
                int ZDiffOrder >
#else
      template< int XDiffOrder = 0,
                int YDiffOrder = 0,
                int ZDiffOrder = 0,
                typename Vertex = VertexType >
                int ZDiffOrder = 0 >
#endif   
      __cuda_callable__
      RealType getValue( const Vertex& v,
      RealType getPartialDerivative( const VertexType& v,
                                     const Real& time = 0.0 ) const;
      
      __cuda_callable__
      RealType operator()( const VertexType& v,
                           const Real& time = 0.0 ) const;      
};

@@ -90,17 +92,20 @@ class tnlBlobFunction< 2, Real > : public tnlBlobFunctionBase< Real, 2 >
#ifdef HAVE_NOT_CXX11
      template< int XDiffOrder,
                int YDiffOrder,
                int ZDiffOrder,
                typename Vertex >
                int ZDiffOrder >
#else
      template< int XDiffOrder = 0,
                int YDiffOrder = 0,
                int ZDiffOrder = 0,
                typename Vertex = VertexType >
                int ZDiffOrder = 0 >
#endif
      __cuda_callable__
      RealType getValue( const Vertex& v,
      RealType getPartialDerivative( const VertexType& v,
                                     const Real& time = 0.0 ) const;

      __cuda_callable__
      RealType operator()( const VertexType& v,
                           const Real& time = 0.0 ) const;
      
};

template< typename Real >
@@ -119,16 +124,18 @@ class tnlBlobFunction< 3, Real > : public tnlBlobFunctionBase< Real, 3 >
#ifdef HAVE_NOT_CXX11
      template< int XDiffOrder,
                int YDiffOrder,
                int ZDiffOrder,
                typename Vertex >
                int ZDiffOrder >
#else
      template< int XDiffOrder = 0,
                int YDiffOrder = 0,
                int ZDiffOrder = 0,
                typename Vertex = VertexType >
                int ZDiffOrder = 0 >
#endif   
      __cuda_callable__
      RealType getValue( const Vertex& v,
      RealType getPartialDerivative( const VertexType& v,
                                     const Real& time = 0.0 ) const;
      
      __cuda_callable__
      RealType operator()( const VertexType& v,
                           const Real& time = 0.0 ) const;      
};

+41 −14
Original line number Diff line number Diff line
@@ -51,11 +51,11 @@ tnlBlobFunction< 1, Real >::tnlBlobFunction()
template< typename Real >
   template< int XDiffOrder, 
             int YDiffOrder,
             int ZDiffOrder,
             typename Vertex >
             int ZDiffOrder >
__cuda_callable__
Real
tnlBlobFunction< 1, Real >::getValue( const Vertex& v,
tnlBlobFunction< 1, Real >::
getPartialDerivative( const VertexType& v,
                      const Real& time ) const
{
   const RealType& x = v.x();
@@ -66,10 +66,19 @@ tnlBlobFunction< 1, Real >::getValue( const Vertex& v,
   return 0.0;
}

template< typename Real >
__cuda_callable__
Real
tnlBlobFunction< 1, Real >::
operator()( const VertexType& v,
            const Real& time ) const
{
   return this->template getPartialDerivative< 0, 0, 0 >( v, time );
}

/****
 * 2D
 */

template< typename Real >
tnlString
tnlBlobFunction< 2, Real >::getType()
@@ -85,12 +94,11 @@ tnlBlobFunction< 2, Real >::tnlBlobFunction()
template< typename Real >
   template< int XDiffOrder,
             int YDiffOrder,
             int ZDiffOrder,
             typename Vertex >
             int ZDiffOrder >
__cuda_callable__
Real
tnlBlobFunction< 2, Real >::
getValue( const Vertex& v,
getPartialDerivative( const VertexType& v,
                      const Real& time ) const
{
   const RealType& x = v.x();
@@ -102,10 +110,19 @@ getValue( const Vertex& v,
   return 0.0;
}

template< typename Real >
__cuda_callable__
Real
tnlBlobFunction< 2, Real >::
operator()( const VertexType& v,
            const Real& time ) const
{
   return this->template getPartialDerivative< 0, 0, 0 >( v, time );
}

/****
 * 3D
 */

template< typename Real >
tnlString
tnlBlobFunction< 3, Real >::getType()
@@ -121,12 +138,11 @@ tnlBlobFunction< 3, Real >::tnlBlobFunction()
template< typename Real >
   template< int XDiffOrder,
             int YDiffOrder,
             int ZDiffOrder,
             typename Vertex >
             int ZDiffOrder >
__cuda_callable__
Real
tnlBlobFunction< 3, Real >::
getValue( const Vertex& v,
getPartialDerivative( const VertexType& v,
                      const Real& time ) const
{
   const RealType& x = v.x();
@@ -137,4 +153,15 @@ getValue( const Vertex& v,
   return 0.0;
}

template< typename Real >
__cuda_callable__
Real
tnlBlobFunction< 3, Real >::
operator()( const VertexType& v,
            const Real& time ) const
{
   return this->template getPartialDerivative< 0, 0, 0 >( v, time );
}


#endif /* TNLBLOBFUNCTION_IMPL_H_ */
+25 −18
Original line number Diff line number Diff line
@@ -61,16 +61,18 @@ class tnlPseudoSquareFunction< 1, Real > : public tnlPseudoSquareFunctionBase< R
#ifdef HAVE_NOT_CXX11
      template< int XDiffOrder,
                int YDiffOrder,
                int ZDiffOrder,
                typename Vertex >
                int ZDiffOrder >
#else
      template< int XDiffOrder = 0,
                int YDiffOrder = 0,
                int ZDiffOrder = 0,
                typename Vertex = VertexType >
                int ZDiffOrder = 0 >
#endif   
      __cuda_callable__
      RealType getValue( const Vertex& v,
      RealType getPartialDerivative( const VertexType& v,
                                     const Real& time = 0.0 ) const;
      
      __cuda_callable__
      RealType operator()( const VertexType& v,
                           const Real& time = 0.0 ) const;      
};

@@ -90,16 +92,18 @@ class tnlPseudoSquareFunction< 2, Real > : public tnlPseudoSquareFunctionBase< R
#ifdef HAVE_NOT_CXX11
      template< int XDiffOrder,
                int YDiffOrder,
                int ZDiffOrder,
                typename Vertex >
                int ZDiffOrder >
#else
      template< int XDiffOrder = 0,
                int YDiffOrder = 0,
                int ZDiffOrder = 0,
                typename Vertex = VertexType >
                int ZDiffOrder = 0 >
#endif
      __cuda_callable__
      RealType getValue( const Vertex& v,
      RealType getPartialDerivative( const VertexType& v,
                                     const Real& time = 0.0 ) const;
      
      __cuda_callable__
      RealType operator()( const VertexType& v,
                           const Real& time = 0.0 ) const;      
};

@@ -119,17 +123,20 @@ class tnlPseudoSquareFunction< 3, Real > : public tnlPseudoSquareFunctionBase< R
#ifdef HAVE_NOT_CXX11
      template< int XDiffOrder,
                int YDiffOrder,
                int ZDiffOrder,
                typename Vertex >
                int ZDiffOrder >
#else
      template< int XDiffOrder = 0,
                int YDiffOrder = 0,
                int ZDiffOrder = 0,
                typename Vertex = VertexType >
                int ZDiffOrder = 0 >
#endif   
      __cuda_callable__
      RealType getValue( const Vertex& v,
      RealType getPartialDerivative( const VertexType& v,
                                     const Real& time = 0.0 ) const;
      
      __cuda_callable__
      RealType operator()( const VertexType& v,
                           const Real& time = 0.0 ) const;
      
};

template< int Dimensions,
+39 −14
Original line number Diff line number Diff line
@@ -52,11 +52,11 @@ tnlPseudoSquareFunction< 1, Real >::tnlPseudoSquareFunction()
template< typename Real >
   template< int XDiffOrder, 
             int YDiffOrder,
             int ZDiffOrder,
             typename Vertex >
             int ZDiffOrder >
__cuda_callable__
Real
tnlPseudoSquareFunction< 1, Real >::getValue( const Vertex& v,
tnlPseudoSquareFunction< 1, Real >::
getPartialDerivative( const VertexType& v,
                      const Real& time ) const
{
   const RealType& x = v.x();
@@ -67,10 +67,19 @@ tnlPseudoSquareFunction< 1, Real >::getValue( const Vertex& v,
   return 0.0;
}

template< typename Real >
__cuda_callable__
Real
tnlPseudoSquareFunction< 1, Real >::
operator()( const VertexType& v,
            const Real& time ) const
{
   return this->template getPartialDerivative< 0, 0, 0 >( v, time );
}

/****
 * 2D
 */

template< typename Real >
tnlString
tnlPseudoSquareFunction< 2, Real >::getType()
@@ -86,12 +95,11 @@ tnlPseudoSquareFunction< 2, Real >::tnlPseudoSquareFunction()
template< typename Real >
   template< int XDiffOrder,
             int YDiffOrder,
             int ZDiffOrder,
             typename Vertex >
             int ZDiffOrder >
__cuda_callable__
Real
tnlPseudoSquareFunction< 2, Real >::
getValue( const Vertex& v,
getPartialDerivative( const VertexType& v,
                      const Real& time ) const
{
   const RealType& x = v.x();
@@ -103,10 +111,19 @@ getValue( const Vertex& v,
   return 0.0;
}

template< typename Real >
__cuda_callable__
Real
tnlPseudoSquareFunction< 2, Real >::
operator()( const VertexType& v,
            const Real& time ) const
{
   return this->template getPartialDerivative< 0, 0, 0 >( v, time );
}

/****
 * 3D
 */

template< typename Real >
tnlString
tnlPseudoSquareFunction< 3, Real >::getType()
@@ -122,12 +139,11 @@ tnlPseudoSquareFunction< 3, Real >::tnlPseudoSquareFunction()
template< typename Real >
   template< int XDiffOrder,
             int YDiffOrder,
             int ZDiffOrder,
             typename Vertex >
             int ZDiffOrder >
__cuda_callable__
Real
tnlPseudoSquareFunction< 3, Real >::
getValue( const Vertex& v,
getPartialDerivative( const VertexType& v,
                      const Real& time ) const
{
   const RealType& x = v.x();
@@ -138,5 +154,14 @@ getValue( const Vertex& v,
   return 0.0;
}

template< typename Real >
__cuda_callable__
Real
tnlPseudoSquareFunction< 3, Real >::
operator()( const VertexType& v,
            const Real& time ) const
{
   return this->template getPartialDerivative< 0, 0, 0 >( v, time );
}

#endif /* TNLPSEUDOSQUAREFUNCTION_IMPL_H_ */
Loading