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

Refactoring operator approximation tests.

parent 003245ef
Loading
Loading
Loading
Loading
+30 −0
Original line number Diff line number Diff line
/***************************************************************************
                          terminal-colors.h  -  description
                             -------------------
    begin                : Feb 7, 2015
    copyright            : (C) 2015 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 TERMINAL_COLORS_H
#define	TERMINAL_COLORS_H

const std::string red( "\033[0;31m" );
const std::string green( "\033[1;32m" );
const std::string yellow( "\033[1;33m" );
const std::string cyan( "\033[0;36m" );
const std::string magenta( "\033[0;35m" );
const std::string reset( "\033[0m" );


#endif	/* TERMINAL_COLORS_H */
+4 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@
#include <functions/tnlMeshFunction.h>
#include <mesh/tnlGrid.h>
#include <functions/tnlDomain.h>
#include <operators/diffusion/tnlExactLinearDiffusion.h>

template< typename Mesh,
          typename Real = typename Mesh::RealType,
@@ -47,6 +48,7 @@ class tnlLinearDiffusion< tnlGrid< 1,MeshReal, Device, MeshIndex >, Real, Index
      typedef Real RealType;
      typedef Device DeviceType;
      typedef Index IndexType;      
      typedef tnlExactLinearDiffusion< 1 > ExactOperatorType;
      
      static const int Dimensions = MeshType::meshDimensions;
      
@@ -100,6 +102,7 @@ class tnlLinearDiffusion< tnlGrid< 2, MeshReal, Device, MeshIndex >, Real, Index
      typedef Real RealType;
      typedef Device DeviceType;
      typedef Index IndexType;      
      typedef tnlExactLinearDiffusion< 2 > ExactOperatorType;
      
      static const int Dimensions = MeshType::meshDimensions;
      
@@ -153,6 +156,7 @@ class tnlLinearDiffusion< tnlGrid< 3, MeshReal, Device, MeshIndex >, Real, Index
      typedef Real RealType;
      typedef Device DeviceType;
      typedef Index IndexType;
      typedef tnlExactLinearDiffusion< 3 > ExactOperatorType;

      static const int Dimensions = MeshType::meshDimensions;
      
+4 −2
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@
#define	TNLBACKWARDFINITEDIFFERENCE_H

#include<operators/fdm/tnlFiniteDifferences.h>
#include<operators/fdm/tnlExactDifference.h>

template< typename Mesh,
          int Xdifference = 0,
@@ -48,6 +49,7 @@ class tnlBackwardFiniteDifference< tnlGrid< Dimensions, MeshReal, MeshDevice, Me
      typedef Real RealType;
      typedef MeshDevice DeviceType;
      typedef Index IndexType;
      typedef tnlExactDifference< Dimensions, XDifference, YDifference, ZDifference > ExactOperatorType;
      
      static constexpr int getMeshDimensions() { return Dimensions; }
      
+3 −1
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@
#define	TNLCENTRALFINITEDIFFERENCE_H

#include<operators/fdm/tnlFiniteDifferences.h>
#include<operators/fdm/tnlExactDifference.h>

template< typename Mesh,
          int Xdifference = 0,
@@ -48,6 +49,7 @@ class tnlCentralFiniteDifference< tnlGrid< Dimensions, MeshReal, MeshDevice, Mes
      typedef Real RealType;
      typedef MeshDevice DeviceType;
      typedef Index IndexType;
      typedef tnlExactDifference< XDifference, YDifference, ZDifference > ExactOperatorType;
            
      //static constexpr int getMeshDimensions() { return Dimensions; }
      
+8 −11
Original line number Diff line number Diff line
@@ -18,32 +18,29 @@
#ifndef TNLEXACTDIFFERENCE_H
#define	TNLEXACTDIFFERENCE_H

template< typename Function,
template< int Dimensions,
          int XDerivative,
          int YDerivative,
          int ZDerivative >
class tnlExactDifference
   : public tnlDomain< Function::getDimensions(), SpaceDomain >
   : public tnlDomain< Dimensions, SpaceDomain >
{
   public:
      
      typedef Function FunctionType;
      typedef typename Function::RealType RealType;
      typedef typename Function::VertexType VertexType;
      
      static tnlString getType()
      {
         return tnlString( "tnlExactDifference< " ) +
            Function::getType() + ", " +
            tnlString( Dimensions ) + ", " +
            tnlString( XDerivative ) + ", " +
            tnlString( YDerivative ) + ", " +
            tnlString( ZDerivative ) + " >";
      }
      
      RealType operator()( 
         const FunctionType& function,
         const VertexType& vertex,
         const RealType& time = 0 ) const
      template< typename Function >
      typename Function::RealType operator()( 
         const Function& function,
         const typename Function::VertexType& vertex,
         const typename Function::RealType& time = 0 ) const
      {
         return function.template getPartialDerivative<
            XDerivative,
Loading