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

Implementing Co FVM gradient norm test.

parent 44365ddf
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -46,6 +46,8 @@ class tnlOperatorFunction : public tnlDomain< Operator::getDimensions(), Operato
      typedef typename OperatorType::DeviceType DeviceType;
      typedef typename OperatorType::IndexType IndexType;
      
      static constexpr int getEntitiesDimensions() { return OperatorType::getImageEntitiesDimensions(); };
      
      tnlOperatorFunction(
         const OperatorType& operator_,
         const FunctionType& function )
+11 −4
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@
#define	TNLCOFVMGRADIENTNORM_H

#include <mesh/tnlGrid.h>
#include <operators/geometric/tnlExactGradientNorm.h>

template< typename Mesh,
          typename Real = typename Mesh::RealType,
@@ -42,8 +43,10 @@ class tnlCoFVMGradientNorm< tnlGrid< 1,MeshReal, Device, MeshIndex >, Real, Inde
   typedef Real RealType;
   typedef Device DeviceType;
   typedef Index IndexType;
   typedef tnlExactGradientNorm< 1, RealType > ExactOperatorType;
   
   constexpr static int getImageMeshEntitiesDimensions() { return MeshType::getDimensionsCount() - 1; };
   constexpr static int getDomainEntitiesDimensions() { return MeshType::getDimensionsCount(); };
   constexpr static int getImageEntitiesDimensions() { return MeshType::getDimensionsCount() - 1; };
   
   tnlCoFVMGradientNorm()
   : epsSquare( 0.0 ){}
@@ -100,8 +103,10 @@ class tnlCoFVMGradientNorm< tnlGrid< 2, MeshReal, Device, MeshIndex >, Real, Ind
   typedef Real RealType;
   typedef Device DeviceType;
   typedef Index IndexType;
   typedef tnlExactGradientNorm< 2, RealType > ExactOperatorType;
   
   constexpr static int getImageMeshEntitiesDimensions() { return MeshType::getDimensionsCount() - 1; };
   constexpr static int getDomainEntitiesDimensions() { return MeshType::getDimensionsCount(); };
   constexpr static int getImageEntitiesDimensions() { return MeshType::getDimensionsCount() - 1; };
   
   tnlCoFVMGradientNorm()
   : epsSquare( 0.0 ){}
@@ -216,8 +221,10 @@ class tnlCoFVMGradientNorm< tnlGrid< 3, MeshReal, Device, MeshIndex >, Real, Ind
   typedef Real RealType;
   typedef Device DeviceType;
   typedef Index IndexType;
   typedef tnlExactGradientNorm< 3, RealType > ExactOperatorType;
   
   constexpr static int getImageMeshEntitiesDimensions() { return MeshType::getDimensionsCount() - 1; };
   constexpr static int getDomainEntitiesDimensions() { return MeshType::getDimensionsCount(); };
   constexpr static int getImageEntitiesDimensions() { return MeshType::getDimensionsCount() - 1; };
   
   tnlCoFVMGradientNorm()
   : epsSquare( 0.0 ){}   
+2 −2
Original line number Diff line number Diff line
@@ -288,13 +288,13 @@ class tnlMeshEntitiesInterpolants< tnlGrid< 3, Real, Device, Index >, 2, 3 >
                       const MeshEntity& entity,
                       const Real& time = 0.0 ) const
      {
         static_assert( MeshFunction::getEntityDimensions() == 3,
         static_assert( MeshFunction::getEntitiesDimensions() == 2,
            "Mesh function must be defined on faces." );

         static_assert( std::is_same< typename MeshEntity::MeshType, MeshType >::value,
            "The mesh entity belongs to other mesh type then the interpolants." );         
         
         const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.getNeighbourEntities();      
         const typename MeshEntity::template NeighbourEntities< 2 >& neighbourEntities = entity.template getNeighbourEntities< 2 >();      
                  
         return 1.0 / 6.0 * ( u[ neighbourEntities.template getEntityIndex< -1,  0,  0 >() ] + 
                              u[ neighbourEntities.template getEntityIndex<  1,  0,  0 >() ] +
+55 −0
Original line number Diff line number Diff line
/***************************************************************************
                          tnlIdentityOperator.h  -  description
                             -------------------
    begin                : Feb 9, 2016
    copyright            : (C) 2016 by Tomas Oberhuber
    email                : tomas.oberhuber@fjfi.cvut.cz
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef TNLIDENTITYOPERATOR_H
#define	TNLIDENTITYOPERATOR_H

#include<functions/tnlMeshFunction.h>

template< typename MeshFunction >
class tnlIdentityOperator
   : public tnlDomain< MeshFunction::getDimensions(), MeshFunction::getDomainType() >
{
   public:
      
      typedef typename MeshFunction::MeshType MeshType;
      typedef typename MeshFunction::RealType RealType;
      typedef typename MeshFunction::IndexType IndexType;
      
      tnlOperatorComposition( const MeshFunction& meshFunction )
      : meshFunction( meshFunction ) {};
      
      template< typename MeshEntity >
      __cuda_callable__
      RealType operator()(
         const MeshFunction& function,
         const MeshEntity& meshEntity,
         const RealType& time = 0 ) const
      {
         static_assert( MeshFunction::getDimensions() == InnerOperator::getDimensions(),
            "Mesh function and operator have both different number of dimensions." );
         return this->meshFunction( meshEntity, time );
      }
      
   
   protected:
      
      const MeshFunction& meshFunction;      
};

#endif	/* TNLIDENTITYOPERATOR_H */
+2 −2
Original line number Diff line number Diff line
@@ -31,13 +31,13 @@ class tnlOperatorComposition
   public:
      
      typedef typename InnerOperator::MeshType MeshType;
      typedef tnlOperatorFunction< InnerOperator, tnlMeshFunction< MeshType, InnerOperator::getImageMeshEntitiesDimensions() > > InnerOperatorFunction;
      typedef tnlOperatorFunction< InnerOperator, tnlMeshFunction< MeshType, InnerOperator::getDomainEntitiesDimensions() > > InnerOperatorFunction;
      typedef typename InnerOperator::RealType RealType;
      typedef typename InnerOperator::IndexType IndexType;
      
      tnlOperatorComposition( const OuterOperator& outerOperator,
                              const InnerOperator& innerOperator )
      : outerOperator( &outerOperator ), innerOperator( &innerOperator ) {};
      : outerOperator( outerOperator ), innerOperator( innerOperator ) {};
      
      template< typename MeshFunction, typename MeshEntity >
      __cuda_callable__
Loading