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

Implementing mesh function.

Refactoring the Dirichlet and the Neumann boundary conditions.
parent b114885f
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -21,12 +21,12 @@
#include <solvers/tnlSolver.h>
#include <solvers/tnlFastBuildConfigTag.h>
#include <solvers/tnlBuildConfigTags.h>
#include <functors/tnlTestFunction.h>
#include <functions/tnlTestFunction.h>
#include <operators/diffusion/tnlLinearDiffusion.h>
#include <operators/diffusion/tnlExactLinearDiffusion.h>
#include <operators/tnlAnalyticDirichletBoundaryConditions.h>
#include <problems/tnlHeatEquationEocRhs.h>
#include <problems/tnlHeatEquationEocProblem.h>
#include <operators/tnlDirichletBoundaryConditions.h>

//typedef tnlDefaultBuildMeshConfig BuildConfig;
typedef tnlFastBuildConfig BuildConfig;
@@ -67,7 +67,7 @@ class heatEquationSetter
      typedef tnlTestFunction< MeshType::meshDimensions, Real, Device > TestFunction;
      typedef tnlHeatEquationEocRhs< ExactOperator, TestFunction > RightHandSide;
      typedef tnlStaticVector < MeshType::meshDimensions, Real > Vertex;
      typedef tnlAnalyticDirichletBoundaryConditions< MeshType, TestFunction, Real, Index > BoundaryConditions;
      typedef tnlDirichletBoundaryConditions< MeshType, TestFunction, Real, Index > BoundaryConditions;
      typedef tnlHeatEquationEocProblem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Solver;
      SolverStarter solverStarter;
      return solverStarter.template run< Solver >( parameters );
+12 −8
Original line number Diff line number Diff line
@@ -22,12 +22,12 @@
#include <solvers/tnlFastBuildConfigTag.h>
#include <solvers/tnlBuildConfigTags.h>
#include <operators/diffusion/tnlLinearDiffusion.h>
#include <operators/tnlAnalyticDirichletBoundaryConditions.h>
#include <operators/tnlDirichletBoundaryConditions.h>
#include <operators/tnlAnalyticNeumannBoundaryConditions.h>
#include <operators/tnlNeumannBoundaryConditions.h>
#include <functors/tnlConstantFunction.h>
#include <functions/tnlConstantFunction.h>
#include <functions/tnlMeshFunction.h>
#include <problems/tnlHeatEquationProblem.h>
#include <mesh/tnlGrid.h>

//typedef tnlDefaultBuildMeshConfig BuildConfig;
typedef tnlFastBuildConfig BuildConfig;
@@ -43,6 +43,10 @@ class heatEquationConfig
            config.addEntryEnum< tnlString >( "dirichlet" );
            config.addEntryEnum< tnlString >( "neumann" );

         typedef tnlGrid< 1, double, tnlHost, int > Mesh;
         typedef tnlMeshFunction< Mesh > MeshFunction;
         tnlDirichletBoundaryConditions< Mesh, MeshFunction >::configSetup( config );
         tnlDirichletBoundaryConditions< Mesh, tnlConstantFunction< 1 > >::configSetup( config );
         config.addEntry< tnlString >( "boundary-conditions-file", "File with the values of the boundary conditions.", "boundary.tnl" );
         config.addEntry< double >( "boundary-conditions-constant", "This sets a value in case of the constant boundary conditions." );
         config.addEntry< double >( "right-hand-side-constant", "This sets a constant value for the right-hand side.", 0.0 );
@@ -79,25 +83,25 @@ class heatEquationSetter
         typedef tnlConstantFunction< Dimensions, Real > ConstantFunction;
         if( boundaryConditionsType == "dirichlet" )
         {
            typedef tnlAnalyticDirichletBoundaryConditions< MeshType, ConstantFunction, Real, Index > BoundaryConditions;
            typedef tnlDirichletBoundaryConditions< MeshType, ConstantFunction > BoundaryConditions;
            typedef tnlHeatEquationProblem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Problem;
            SolverStarter solverStarter;
            return solverStarter.template run< Problem >( parameters );
         }
         typedef tnlAnalyticNeumannBoundaryConditions< MeshType, ConstantFunction, Real, Index > BoundaryConditions;
         typedef tnlNeumannBoundaryConditions< MeshType, ConstantFunction, Real, Index > BoundaryConditions;
         typedef tnlHeatEquationProblem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Problem;
         SolverStarter solverStarter;
         return solverStarter.template run< Problem >( parameters );
      }
      typedef tnlVector< Real, Device, Index > VectorType;
      typedef tnlMeshFunction< MeshType > MeshFunction;
      if( boundaryConditionsType == "dirichlet" )
      {
         typedef tnlDirichletBoundaryConditions< MeshType, VectorType, Real, Index > BoundaryConditions;
         typedef tnlDirichletBoundaryConditions< MeshType, MeshFunction > BoundaryConditions;
         typedef tnlHeatEquationProblem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Problem;
         SolverStarter solverStarter;
         return solverStarter.template run< Problem >( parameters );
      }
      typedef tnlNeumannBoundaryConditions< MeshType, VectorType, Real, Index > BoundaryConditions;
      typedef tnlNeumannBoundaryConditions< MeshType, MeshFunction, Real, Index > BoundaryConditions;
      typedef tnlHeatEquationProblem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Problem;
      SolverStarter solverStarter;
      return solverStarter.template run< Problem >( parameters );
+3 −3
Original line number Diff line number Diff line
INCLUDE_DIRECTORIES( config )
ADD_SUBDIRECTORY( functors )
ADD_SUBDIRECTORY( functions )
ADD_SUBDIRECTORY( config )
ADD_SUBDIRECTORY( core )
ADD_SUBDIRECTORY( debug )
@@ -10,7 +10,7 @@ ADD_SUBDIRECTORY( problems )
ADD_SUBDIRECTORY( solvers )
ADD_SUBDIRECTORY( legacy )

set( tnl_SOURCES ${tnl_functors_SOURCES}
set( tnl_SOURCES ${tnl_functions_SOURCES}
                 ${tnl_config_SOURCES}
                 ${tnl_core_SOURCES}
                 ${tnl_legacy_SOURCES}
@@ -21,7 +21,7 @@ set( tnl_SOURCES ${tnl_functors_SOURCES}
                 ${tnl_problems_SOURCES}
                  )

set( tnl_CUDA__SOURCES ${tnl_functors_CUDA__SOURCES}
set( tnl_CUDA__SOURCES ${tnl_functions_CUDA__SOURCES}
                       ${tnl_config_CUDA__SOURCES}
                       ${tnl_core_CUDA__SOURCES}
                       ${tnl_legacy_CUDA__SOURCES}
+1 −4
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@

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

class tnlHost;

@@ -37,9 +37,6 @@ 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; }
   enum { functionType = tnlDiscreteFunction };

   tnlSharedVector();

   tnlSharedVector( Real* data,
+1 −4
Original line number Diff line number Diff line
@@ -19,7 +19,7 @@
#define TNLVECTOR_H_

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

class tnlHost;

@@ -36,9 +36,6 @@ 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; }
   enum { functionType = tnlDiscreteFunction };

   tnlVector();

   tnlVector( const Index size );
Loading