Commit 9b0fca53 authored by Tomáš Oberhuber's avatar Tomáš Oberhuber
Browse files

Refactoring system for function types.

parent 2e46d567
Loading
Loading
Loading
Loading
+2 −11
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@

#include <core/arrays/tnlSharedArray.h>
#include <core/vectors/tnlVector.h>
#include <functors/tnlFunctionType.h>
#include <functors/tnlFunction.h>

class tnlHost;

@@ -37,6 +37,7 @@ class tnlSharedVector : public tnlSharedArray< Real, Device, Index >
   typedef tnlSharedVector< Real, tnlHost, Index > HostType;
   typedef tnlSharedVector< Real, tnlCuda, Index > CudaType;

   static constexpr tnlFunctionType getFunctionType() { return tnlDiscreteFunction; }

   tnlSharedVector();

@@ -147,16 +148,6 @@ class tnlSharedVector : public tnlSharedArray< Real, Device, Index >

};

template< typename Real,
          typename Device,
          typename Index >
class tnlFunctionType< tnlSharedVector< Real, Device, Index > >
{
   public:

      enum { Type = tnlDiscreteFunction };
};

#include <core/vectors/tnlSharedVector_impl.h>

#endif /* TNLSHAREDVECTOR_H_ */
+2 −11
Original line number Diff line number Diff line
@@ -19,7 +19,7 @@
#define TNLVECTOR_H_

#include <core/arrays/tnlArray.h>
#include <functors/tnlFunctionType.h>
#include <functors/tnlFunction.h>

class tnlHost;

@@ -36,6 +36,7 @@ class tnlVector : public tnlArray< Real, Device, Index >
   typedef tnlVector< Real, tnlHost, Index > HostType;
   typedef tnlVector< Real, tnlCuda, Index > CudaType;

   static constexpr tnlFunctionType getFunctionType() { return tnlDiscreteFunction; }

   tnlVector();

@@ -137,16 +138,6 @@ class tnlVector : public tnlArray< Real, Device, Index >
   void computeExclusivePrefixSum( const IndexType begin, const IndexType end );
};

template< typename Real,
          typename Device,
          typename Index >
class tnlFunctionType< tnlVector< Real, Device, Index > >
{
   public:

      enum { Type = tnlDiscreteFunction };
};

#include <core/vectors/tnlVector_impl.h>

#endif /* TNLVECTOR_H_ */
+1 −1
Original line number Diff line number Diff line
@@ -12,7 +12,7 @@ SET( headers tnlFunctionDiscretizer.h
             tnlSinWaveFunction.h
             tnlSinWaveFunction_impl.h
             tnlTestFunction.h
             tnlFunctionType.h
             tnlFunction.h
             tnlTestFunction_impl.h )

SET( CURRENT_DIR ${CMAKE_SOURCE_DIR}/src/functors )
+4 −11
Original line number Diff line number Diff line
@@ -20,14 +20,16 @@

#include <iostream>
#include <core/vectors/tnlStaticVector.h>
#include <functors/tnlFunctionType.h>
#include <functors/tnlFunction.h>

template< int FunctionDimensions,
          typename Real = double >
class tnlConstantFunction
class tnlConstantFunction : public tnlFunction
{
   public:

   static constexpr tnlFunctionType getFunctionType() { return tnlAnalyticFunction; }

   enum { Dimensions = FunctionDimensions };
   typedef Real RealType;
   typedef tnlStaticVector< Dimensions, Real > VertexType;
@@ -80,15 +82,6 @@ std::ostream& operator << ( std::ostream& str, const tnlConstantFunction< Functi
   return str;
}

template< int FunctionDimensions,
          typename Real >
class tnlFunctionType< tnlConstantFunction< FunctionDimensions, Real > >
{
   public:

      enum { Type = tnlAnalyticFunction };
};

#include <functors/tnlConstantFunction_impl.h>

#endif /* TNLCONSTANTFUNCTION_H_ */
+4 −12
Original line number Diff line number Diff line
@@ -20,13 +20,15 @@

#include <config/tnlParameterContainer.h>
#include <core/vectors/tnlStaticVector.h>
#include <functors/tnlFunctionType.h>
#include <functors/tnlFunction.h>

template< typename Real >
class tnlExpBumpFunctionBase
class tnlExpBumpFunctionBase : public tnlFunction
{
   public:

      static constexpr tnlFunctionType getFunctionType() { return tnlAnalyticFunction; };
      
      typedef Real RealType;

      bool setup( const tnlParameterContainer& parameters,
@@ -143,16 +145,6 @@ ostream& operator << ( ostream& str, const tnlExpBumpFunction< Dimensions, Real
   return str;
}

template< int FunctionDimensions,
          typename Real >
class tnlFunctionType< tnlExpBumpFunction< FunctionDimensions, Real > >
{
   public:

      enum { Type = tnlAnalyticFunction };
};


#include <functors/tnlExpBumpFunction_impl.h>


Loading