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

Refactoring the mean-curvature flow.

parent 4d98b186
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
add_subdirectory( heat-equation )
add_subdirectory( navier-stokes )
#add_subdirectory( mean-curvature-flow )
add_subdirectory( mean-curvature-flow )
+13 −13
Original line number Diff line number Diff line
@@ -18,14 +18,14 @@
#ifndef TNLEXACTNONLINEARDIFFUSION_H_
#define TNLEXACTNONLINEARDIFFUSION_H_

#include <functions/tnlFunction.h>
#include <functions/tnlDomain.h>

template< typename OperatorQ, int Dimensions >
class tnlExactNonlinearDiffusion
{};

template< typename OperatorQ >
class tnlExactNonlinearDiffusion< OperatorQ, 1 > : public tnlFunction< 1, SpaceDomain >
class tnlExactNonlinearDiffusion< OperatorQ, 1 > : public tnlDomain< 1, SpaceDomain >
{
   public:

@@ -40,13 +40,13 @@ class tnlExactNonlinearDiffusion< OperatorQ, 1 > : public tnlFunction< 1, SpaceD
#endif      
      
      __cuda_callable__
      static Real operator()( const Function& function,
      Real operator()( const Function& function,
                       const Vertex& v,
                            const Real& time = 0.0 );
                       const Real& time = 0.0 ) const;
};

template< typename OperatorQ >
class tnlExactNonlinearDiffusion< OperatorQ, 2 > : public tnlFunction< 2, SpaceDomain >
class tnlExactNonlinearDiffusion< OperatorQ, 2 > : public tnlDomain< 2, SpaceDomain >
{
   public:

@@ -61,13 +61,13 @@ class tnlExactNonlinearDiffusion< OperatorQ, 2 > : public tnlFunction< 2, SpaceD
#endif 

      __cuda_callable__
      static Real operator()( const Function& function,
      Real operator()( const Function& function,
                       const Vertex& v,
                            const Real& time = 0.0 );
                       const Real& time = 0.0 ) const;
};

template< typename OperatorQ >
class tnlExactNonlinearDiffusion< OperatorQ, 3 > : public tnlFunction< 3, SpaceDomain >
class tnlExactNonlinearDiffusion< OperatorQ, 3 > : public tnlDomain< 3, SpaceDomain >
{
   public:

@@ -82,9 +82,9 @@ class tnlExactNonlinearDiffusion< OperatorQ, 3 > : public tnlFunction< 3, SpaceD
#endif 

      __cuda_callable__
      static Real operator()( const Function& function,
      Real operator()( const Function& function,
                       const Vertex& v,
                            const Real& time = 0.0 );
                       const Real& time = 0.0 ) const;
};

#include "tnlExactNonlinearDiffusion_impl.h"
+3 −3
Original line number Diff line number Diff line
@@ -33,7 +33,7 @@ Real
tnlExactNonlinearDiffusion< OperatorQ, 1 >::
operator()( const Function& function,
          const Vertex& v,
          const Real& time )
          const Real& time ) const
{
   return function.template getPartialDerivative< 2, 0, 0 >( v, time ) - function.template getPartialDerivative< 1, 0, 0 >( v, time ) 
          * OperatorQ::template getPartialDerivative<1, 0, 0>(function, v, time ) / OperatorQ::template getPartialDerivative<0, 0, 0>(function, v, time );
@@ -54,7 +54,7 @@ Real
tnlExactNonlinearDiffusion< OperatorQ, 2 >::
operator()( const Function& function,
          const Vertex& v,
          const Real& time )
          const Real& time ) const
{
   return  function.template getPartialDerivative< 2, 0, 0 >( v, time ) +  function.template getPartialDerivative< 0, 2, 0 >( v, time )
           -( OperatorQ::template getPartialDerivative<1, 0, 0> (function, v, time) * function.template getPartialDerivative< 1, 0, 0 >( v, time ) 
@@ -77,7 +77,7 @@ Real
tnlExactNonlinearDiffusion< OperatorQ, 3 >::
operator()( const Function& function,
          const Vertex& v,
          const Real& time )
          const Real& time ) const
{
   return  function.template getPartialDerivative< 2, 0, 0 >( v, time ) +  function.template getPartialDerivative< 0, 2, 0 >( v, time )
           +  function.template getPartialDerivative< 0, 0, 2 >( v, time )
+3 −3
Original line number Diff line number Diff line
@@ -38,7 +38,7 @@ getValue( const MeshEntity& entity,
          const Vector& u,
          const Real& time ) const
{
    return nonlinearDiffusionOperator.getValue( entity, u, time );
    return nonlinearDiffusionOperator.getValue( u, entity, time );
}

template< typename MeshReal,
@@ -115,7 +115,7 @@ getValue( const MeshEntity& entity,
          const Vector& u,
          const Real& time ) const
{
    return nonlinearDiffusionOperator.getValue( entity, u, time );
    return nonlinearDiffusionOperator.getValue( u, entity, time );
}
       
template< typename MeshReal,
@@ -192,7 +192,7 @@ getValue( const MeshEntity& entity,
          const Vector& u,
          const Real& time ) const
{
    return nonlinearDiffusionOperator.getValue( entity, u, time );
    return nonlinearDiffusionOperator.getValue( u, entity, time );
}

template< typename MeshReal,
+19 −20
Original line number Diff line number Diff line
@@ -4,14 +4,14 @@
#include <core/vectors/tnlVector.h>
#include <core/vectors/tnlSharedVector.h>
#include <mesh/tnlGrid.h>
#include <functions/tnlFunction.h>
#include <functions/tnlDomain.h>

template< int Dimensions >
class tnlExactOperatorQ
{};

template<>
class tnlExactOperatorQ< 1 >
class tnlExactOperatorQ< 1 > : public tnlDomain< 1, SpaceDomain >
{
   public:

@@ -24,12 +24,11 @@ class tnlExactOperatorQ< 1 >
#else   
      template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0, typename Function, typename Vertex, typename Real = typename Vertex::RealType >
#endif
#ifdef HAVE_CUDA
      __device__ __host__
#endif
      static Real getValue( const Function& function,
      __cuda_callable__
      static Real getPartialDerivative( const Function& function,
                                        const Vertex& v,
                            const Real& time = 0.0, const Real& eps = 1.0 );
                                        const Real& time = 0.0,
                                        const Real& eps = 1.0 );
      
};

@@ -47,12 +46,12 @@ class tnlExactOperatorQ< 2 >
#else   
      template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0, typename Function, typename Vertex, typename Real = typename Vertex::RealType >
#endif
#ifdef HAVE_CUDA
      __device__ __host__
#endif      
      static Real getValue( const Function& function,

      __cuda_callable__
      static Real getPartialDerivative( const Function& function,
                                        const Vertex& v,
                            const Real& time = 0.0, const Real& eps = 1.0 );
                                        const Real& time = 0.0,
                                        const Real& eps = 1.0 );
};

template<>
@@ -69,12 +68,12 @@ class tnlExactOperatorQ< 3 >
#else   
      template< int XDiffOrder = 0, int YDiffOrder = 0, int ZDiffOrder = 0, typename Function, typename Vertex, typename Real = typename Vertex::RealType >
#endif
#ifdef HAVE_CUDA
      __device__ __host__
#endif
      static Real getValue( const Function& function,

      __cuda_callable__
      static Real getPartialDerivative( const Function& function,
                                        const Vertex& v,
                            const Real& time = 0.0, const Real& eps = 1.0 );
                                        const Real& time = 0.0,
                                        const Real& eps = 1.0 );
};

#include <operators/operator-Q/tnlExactOperatorQ_impl.h>
Loading