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

Refactoring the heat equation.

parent 06982639
Loading
Loading
Loading
Loading
+0 −13
Original line number Diff line number Diff line
@@ -50,19 +50,6 @@ bool heatEquationSolver< Mesh,Diffusion,BoundaryCondition,RightHandSide >
{
   if( ! boundaryCondition.init( parameters ) )
      return false;
   /*analyticSpaceFunction.init(parameters);
   ifLaplaceCompare = parameters.GetParameter< IndexType >( "approximation-test" );
   if((ifLaplaceCompare != 0) && (ifLaplaceCompare != 1))
   {
      cerr << "Unknown value of laplace-convergence-test parameter. Valid values are 0 or 1. You set " << ifLaplaceCompare << ". ";
      return false;
   }
   ifSolutionCompare = parameters.GetParameter< IndexType >("eoc-test");
   if((ifSolutionCompare != 0) && (ifSolutionCompare != 1))
   {
      cerr << "Unknown value of solution-convergence-test parameter. Valid values are 0 or 1. You set " << ifSolutionCompare << ". ";
      return false;
   }*/
   return true;
}

+3 −3
Original line number Diff line number Diff line
@@ -12,7 +12,7 @@ bool
tnlDirichletBoundaryConditions< tnlGrid< 1,MeshReal, Device, MeshIndex >, Function, Real, Index >::
init( const tnlParameterContainer& parameters )
{
   return function.init( parameters );
   return function.init( parameters, "boundary-conditions-" );
}

template< typename MeshReal,
@@ -45,7 +45,7 @@ bool
tnlDirichletBoundaryConditions< tnlGrid< 2,MeshReal, Device, MeshIndex >, Function, Real, Index >::
init( const tnlParameterContainer& parameters )
{
   return function.init( parameters );
   return function.init( parameters, "boundary-conditions-" );
}


@@ -79,7 +79,7 @@ bool
tnlDirichletBoundaryConditions< tnlGrid< 3,MeshReal, Device, MeshIndex >, Function, Real, Index >::
init( const tnlParameterContainer& parameters )
{
   return function.init( parameters );
   return function.init( parameters, "boundary-conditions-" );
}

template< typename MeshReal,
+5 −1
Original line number Diff line number Diff line
@@ -32,7 +32,11 @@ class tnlConstantFunction

   tnlConstantFunction();

   bool init( const tnlParameterContainer& parameters );
   static void configSetup( tnlConfigDescription& config,
                            const tnlString& prefix );

   bool init( const tnlParameterContainer& parameters,
              const tnlString& prefix );

   void setValue( const RealType& value );

+8 −7
Original line number Diff line number Diff line
@@ -28,7 +28,8 @@ class tnlExpBumpFunctionBase

      typedef Real RealType;

      bool init( const tnlParameterContainer& parameters );
      bool init( const tnlParameterContainer& parameters,
                 const tnlString& prefix );

      void setAmplitude( const RealType& amplitude );

@@ -65,12 +66,12 @@ class tnlExpBumpFunction< 1, Real > : public tnlExpBumpFunctionBase< Real >
      template< int XDiffOrder,
                int YDiffOrder,
                int ZDiffOrder >
      RealType getF( const VertexType& v ) const;
      RealType getValue( const VertexType& v ) const;
#else
      template< int XDiffOrder = 0,
                int YDiffOrder = 0,
                int ZDiffOrder = 0 >
      RealType getF( const VertexType& v ) const;
      RealType getValue( const VertexType& v ) const;
#endif   
};

@@ -89,12 +90,12 @@ class tnlExpBumpFunction< 2, Real > : public tnlExpBumpFunctionBase< Real >
      template< int XDiffOrder,
                int YDiffOrder,
                int ZDiffOrder >
      RealType getF( const VertexType& v ) const;
      RealType getValue( const VertexType& v ) const;
#else
      template< int XDiffOrder = 0,
                int YDiffOrder = 0,
                int ZDiffOrder = 0 >
      RealType getF( const VertexType& v ) const;
      RealType getValue( const VertexType& v ) const;
#endif   
};

@@ -114,12 +115,12 @@ class tnlExpBumpFunction< 3, Real > : public tnlExpBumpFunctionBase< Real >
      template< int XDiffOrder,
                int YDiffOrder,
                int ZDiffOrder >
      RealType getF( const VertexType& v ) const;
      RealType getValue( const VertexType& v ) const;
#else
      template< int XDiffOrder = 0,
                int YDiffOrder = 0,
                int ZDiffOrder = 0 >
      RealType getF( const VertexType& v ) const;
      RealType getValue( const VertexType& v ) const;
#endif   
};

+66 −59
Original line number Diff line number Diff line
@@ -21,13 +21,14 @@
#include <config/tnlParameterContainer.h>
#include <core/vectors/tnlStaticVector.h>

template< int Dimensions, typename Vertex = tnlStaticVector< Dimensions, double >, typename Device = tnlHost >
template< typename Vertex >
class tnlSinBumpsFunctionBase
{
   public:

      typedef Vertex VertexType;
   typedef typename VertexType::RealType RealType;
      typedef typename Vertex::RealType RealType;
      enum { Dimensions = VertexType::size };

      void setWaveLength( const VertexType& waveLength );

@@ -48,86 +49,92 @@ class tnlSinBumpsFunctionBase
      VertexType waveLength, phase;
};

template< int Dimensions, typename Vertex = tnlStaticVector< Dimensions, double >, typename Device = tnlHost >
template< int Dimensions, typename Real >
class tnlSinBumpsFunction
{
};

template< typename Vertex, typename Device >
class tnlSinBumpsFunction< 1, Vertex, Device > : public tnlSinBumpsFunctionBase< 1, Vertex, Device >
template< typename Real >
class tnlSinBumpsFunction< 1, Real  > : public tnlSinBumpsFunctionBase< tnlStaticVector< 1, Real > >
{
   public:

      enum { Dimensions = 1 };
   typedef Vertex VertexType;
   typedef typename VertexType::RealType RealType;
      typedef tnlSinBumpsFunctionBase< tnlStaticVector< 1, Real > > BaseType;
      typedef typename BaseType::VertexType VertexType;
      typedef Real RealType;

      tnlSinBumpsFunction();

   bool init( const tnlParameterContainer& parameters );
      bool init( const tnlParameterContainer& parameters,
                const tnlString& prefix );

#ifdef HAVE_NOT_CXX11
      template< int XDiffOrder,
                int YDiffOrder,
                int ZDiffOrder >
   RealType getF( const VertexType& v ) const;
      RealType getValue( const VertexType& v ) const;
#else
      template< int XDiffOrder = 0,
                int YDiffOrder = 0,
                int ZDiffOrder = 0 >
   RealType getF( const VertexType& v ) const;
      RealType getValue( const VertexType& v ) const;
#endif
};

template< typename Vertex, typename Device >
class tnlSinBumpsFunction< 2, Vertex, Device > : public tnlSinBumpsFunctionBase< 2, Vertex, Device >
template< typename Real >
class tnlSinBumpsFunction< 2, Real > : public tnlSinBumpsFunctionBase< tnlStaticVector< 2, Real > >
{
   public:

      enum { Dimensions = 2 };
   typedef Vertex VertexType;
   typedef typename VertexType::RealType RealType;
      typedef tnlSinBumpsFunctionBase< tnlStaticVector< 2, Real > > BaseType;
      typedef typename BaseType::VertexType VertexType;
      typedef Real RealType;

      tnlSinBumpsFunction();

   bool init( const tnlParameterContainer& parameters );
      bool init( const tnlParameterContainer& parameters,
                 const tnlString& prefix );

#ifdef HAVE_NOT_CXX11
      template< int XDiffOrder,
                int YDiffOrder,
                int ZDiffOrder >
   RealType getF( const VertexType& v ) const;
      RealType getValue( const VertexType& v ) const;
#else
      template< int XDiffOrder = 0,
                int YDiffOrder = 0,
                int ZDiffOrder = 0 >
   RealType getF( const VertexType& v ) const;
      RealType getValue( const VertexType& v ) const;
#endif
};

template< typename Vertex, typename Device >
class tnlSinBumpsFunction< 3, Vertex, Device > : public tnlSinBumpsFunctionBase< 3, Vertex, Device >
template< typename Real >
class tnlSinBumpsFunction< 3, Real > : public tnlSinBumpsFunctionBase< tnlStaticVector< 3, Real > >
{
   public:

      enum { Dimensions = 3 };
   typedef Vertex VertexType;
   typedef typename VertexType::RealType RealType;
      typedef tnlSinBumpsFunctionBase< tnlStaticVector< 3, Real > > BaseType;
      typedef typename BaseType::VertexType VertexType;
      typedef Real RealType;

      tnlSinBumpsFunction();

   bool init( const tnlParameterContainer& parameters );
      bool init( const tnlParameterContainer& parameters,
                 const tnlString& prefix );

#ifdef HAVE_NOT_CXX11
      template< int XDiffOrder,
                int YDiffOrder,
                int ZDiffOrder >
   RealType getF( const VertexType& v ) const;
      RealType getValue( const VertexType& v ) const;
#else
      template< int XDiffOrder = 0,
                int YDiffOrder = 0,
                int ZDiffOrder = 0 >
   RealType getF( const VertexType& v ) const;
      RealType getValue( const VertexType& v ) const;
#endif   
};

Loading