Commit 238133c4 authored by Tomáš Oberhuber's avatar Tomáš Oberhuber
Browse files

Implementing operator functions.

parent b43a9719
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -53,6 +53,8 @@ class tnlBoundaryOperatorFunction
      const BoundaryOperator* boundaryOperator;
      
      const FunctionType* function;
      
      template< typename, typename > friend class tnlMeshFunctionEvaluator;
};


+3 −1
Original line number Diff line number Diff line
@@ -18,9 +18,11 @@
#ifndef TNLEXACTOPERATORFUNCTION_H
#define	TNLEXACTOPERATORFUNCTION_H

#include <functions/tnlFunction.h>

template< typename Operator,
          typename Function >
class tnlExactOperatorFunction
class tnlExactOperatorFunction : public tnlFunction< Operator::Dimensions, AnalyticFunction >
{   
   public:
      
+1 −0
Original line number Diff line number Diff line
@@ -49,6 +49,7 @@ class tnlFunctionEvaluatorTraverserUserData
        functionCoefficient( &functionCoefficient ),
        dofVectorCoefficient( &dofVectorCoefficient )
      {};
            
};


+4 −2
Original line number Diff line number Diff line
@@ -101,7 +101,7 @@ class tnlMeshFunction :
      
      RealType getLpNorm( const RealType& p ) const;
      
      RealType getMaxMorm() const;
      RealType getMaxNorm() const;
      
      bool save( tnlFile& file ) const;

@@ -120,6 +120,8 @@ class tnlMeshFunction :
      const MeshType* mesh;
      
      VectorType data;
      
      template< typename, typename > friend class tnlMeshFunctionEvaluator;
};

#include <functions/tnlMeshFunction_impl.h>
+24 −19
Original line number Diff line number Diff line
@@ -34,18 +34,18 @@
 */
template< typename OutMeshFunction,
          typename InFunction >
class tnlMeshFunctionEvaluator
class tnlMeshFunctionEvaluator : public tnlFunction< OutMeshFunction::getMeshEntityDimensions(), MeshFunction >
{
   public:
      typedef typename OutMeshFunction::MeshType MeshType;
      typedef typename MeshType::RealType MeshRealType;
      typedef typename MeshType::DeviceType MeshDeviceType;
      typedef typename MeshType::IndexType MeshIndexType;
      typedef typename OutMeshFunction::Real RealType;
      typedef typename OutMeshFunction::RealType RealType;
      
      const static int meshEntityDimensions = OutMeshFunction::entityDimensions;
      
      static_assert( MeshType::meshDimensions == InFunction::Dimensions, 
      static_assert( MeshType::meshDimensions == InFunction::getDimensions(), 
         "Input function and the mesh of the mesh function have both different number of dimensions." );
      
      static void evaluate( OutMeshFunction& meshFunction,
@@ -111,6 +111,7 @@ template< typename OutMeshFunction,
          typename Operator,
          typename Function >
class tnlMeshFunctionEvaluator< OutMeshFunction, tnlOperatorFunction< Operator, Function > >
 : public tnlFunction< OutMeshFunction::getMeshEntityDimensions(), MeshFunction >
{
   public:
      
@@ -118,7 +119,7 @@ class tnlMeshFunctionEvaluator< OutMeshFunction, tnlOperatorFunction< Operator,
      typedef typename MeshType::RealType MeshRealType;
      typedef typename MeshType::DeviceType MeshDeviceType;
      typedef typename MeshType::IndexType MeshIndexType;
      typedef typename OutMeshFunction::Real RealType;
      typedef typename OutMeshFunction::RealType RealType;
      typedef tnlOperatorFunction< Operator, Function > OperatorFunctionType;
      
      static_assert( std::is_same< MeshType, typename OperatorFunctionType::MeshType >::value, 
@@ -136,9 +137,10 @@ class tnlMeshFunctionEvaluator< OutMeshFunction, tnlOperatorFunction< Operator,
            
      class TraverserUserData
      {
         public:
            
            typedef OperatorFunctionType InFunctionType;
         
         public:
            TraverserUserData( const OperatorFunctionType* operatorFunction,              
                               const RealType* time,
                               OutMeshFunction* meshFunction,
@@ -167,6 +169,7 @@ template< typename OutMeshFunction,
          typename BoundaryOperator,
          typename Function >
class tnlMeshFunctionEvaluator< OutMeshFunction, tnlBoundaryOperatorFunction< BoundaryOperator, Function > >
 : public tnlFunction< OutMeshFunction::getMeshEntityDimensions(), MeshFunction >
{
   public:
      
@@ -174,7 +177,7 @@ class tnlMeshFunctionEvaluator< OutMeshFunction, tnlBoundaryOperatorFunction< Bo
      typedef typename MeshType::RealType MeshRealType;
      typedef typename MeshType::DeviceType MeshDeviceType;
      typedef typename MeshType::IndexType MeshIndexType;
      typedef typename OutMeshFunction::Real RealType;
      typedef typename OutMeshFunction::RealType RealType;
      typedef tnlBoundaryOperatorFunction< BoundaryOperator, Function > BoundaryOperatorFunctionType;
      
      static_assert( std::is_same < MeshType, typename BoundaryOperatorFunctionType::MeshType >::value, 
@@ -222,13 +225,15 @@ template< typename MeshType,
          typename UserData > 
class tnlMeshFunctionEvaluatorEntitiesProcessor
{
   public:

      template< typename EntityType >
      __cuda_callable__
      static inline void processEntity( const MeshType& mesh,
                                        UserData& userData,
                                        const EntityType& entity )
      {
      typedef tnlFunctionAdapter< MeshType, typename UserData::InFunction > FunctionAdapter;
         typedef tnlFunctionAdapter< MeshType, typename UserData::InFunctionType > FunctionAdapter;
         ( *userData.meshFunction )( entity ) = 
            *userData.outFunctionMultiplicator * ( *userData.meshFunction )( entity ) +
            *userData.inFunctionMultiplicator *
Loading