Loading examples/heat-equation/heatEquationSetter.h +3 −3 Original line number Diff line number Diff line Loading @@ -21,9 +21,9 @@ #include <config/tnlParameterContainer.h> #include <mesh/tnlGrid.h> #include "heatEquationSolver.h" #include <generators/functions/tnlSinWaveFunction.h> #include <generators/functions/tnlExpBumpFunction.h> #include <generators/functions/tnlSinBumpsFunction.h> #include <functions/tnlSinWaveFunction.h> #include <functions/tnlExpBumpFunction.h> #include <functions/tnlSinBumpsFunction.h> #include "tnlTimeFunction.h" #include "tnlDirichletBoundaryConditions.h" #include <schemes/diffusion/tnlLinearDiffusion.h> Loading examples/heat-equation/heatEquationSetter_impl.h +6 −4 Original line number Diff line number Diff line Loading @@ -20,9 +20,9 @@ #include "heatEquationSetter.h" #include "heatEquationSolver.h" #include <generators/functions/tnlSinWaveFunction.h> #include <generators/functions/tnlSinBumpsFunction.h> #include <generators/functions/tnlExpBumpFunction.h> #include <functions/tnlSinWaveFunction.h> #include <functions/tnlSinBumpsFunction.h> #include <functions/tnlExpBumpFunction.h> #include <schemes/diffusion/tnlLinearDiffusion.h> #include "tnlDirichletBoundaryConditions.h" #include "tnlRightHandSide.h" Loading @@ -43,7 +43,9 @@ bool heatEquationSetter< Real, Device, Index, MeshType, ConfigTag, SolverStarter const tnlString& analyticSpaceFunctionParameter = parameters.GetParameter<tnlString>("test-function"); typedef tnlLinearDiffusion< MeshType, Real, Index > Scheme; typedef tnlDirichletBoundaryConditions< MeshType, Real, Index > BoundaryConditions; typedef tnlStaticVector < MeshType::Dimensions, Real > Vertex; typedef tnlConstantFunction< MeshType::Dimensions, Vertex, Device > BCFunction; typedef tnlDirichletBoundaryConditions< MeshType, BCFunction, Real, Index > BoundaryConditions; typedef tnlRightHandSide< MeshType, Real, Index > RightHandSide; if (analyticSpaceFunctionParameter == "sin-wave") { Loading examples/heat-equation/heatEquationSolver_impl.h +2 −0 Original line number Diff line number Diff line Loading @@ -48,6 +48,8 @@ template< typename Mesh, typename Diffusion, typename BoundaryCondition, typenam bool heatEquationSolver< Mesh,Diffusion,BoundaryCondition,RightHandSide > :: init( const tnlParameterContainer& parameters ) { if( ! boundaryCondition.init( parameters ) ) return false; /*analyticSpaceFunction.init(parameters); ifLaplaceCompare = parameters.GetParameter< IndexType >( "approximation-test" ); if((ifLaplaceCompare != 0) && (ifLaplaceCompare != 1)) Loading examples/heat-equation/tnlDirichletBoundaryConditions.h +31 −5 Original line number Diff line number Diff line Loading @@ -2,10 +2,15 @@ #define TNLDIRICHLETBOUNDARYCONDITIONS_H #include <core/vectors/tnlStaticVector.h> #include <config/tnlParameterContainer.h> #include <functions/tnlConstantFunction.h> template< typename Mesh, typename Real, // = typename Mesh::RealType, typename Index > //= typename Mesh::IndexType > typename Function = tnlConstantFunction< Mesh::Dimensions, typename Mesh::VertexType, typename Mesh::DeviceType >, typename Real = typename Mesh::RealType, typename Index = typename Mesh::IndexType > class tnlDirichletBoundaryConditions { Loading @@ -14,9 +19,10 @@ class tnlDirichletBoundaryConditions template< typename MeshReal, typename Device, typename MeshIndex, typename Function, typename Real, typename Index > class tnlDirichletBoundaryConditions< tnlGrid< 1, MeshReal, Device, MeshIndex >, Real, Index > class tnlDirichletBoundaryConditions< tnlGrid< 1, MeshReal, Device, MeshIndex >, Function, Real, Index > { public: Loading @@ -30,6 +36,8 @@ class tnlDirichletBoundaryConditions< tnlGrid< 1, MeshReal, Device, MeshIndex >, typedef tnlStaticVector< 1, RealType > VertexType; typedef typename MeshType::CoordinatesType CoordinatesType; bool init( const tnlParameterContainer& parameters ); void setBoundaryConditions( const RealType& time, const RealType& tau, const MeshType& mesh, Loading @@ -37,14 +45,19 @@ class tnlDirichletBoundaryConditions< tnlGrid< 1, MeshReal, Device, MeshIndex >, const CoordinatesType& coordinates, DofVectorType& u, DofVectorType& fu ); protected: Function function; }; template< typename MeshReal, typename Device, typename MeshIndex, typename Function, typename Real, typename Index > class tnlDirichletBoundaryConditions< tnlGrid< 2, MeshReal, Device, MeshIndex >, Real, Index > class tnlDirichletBoundaryConditions< tnlGrid< 2, MeshReal, Device, MeshIndex >, Function, Real, Index > { public: Loading @@ -58,6 +71,8 @@ class tnlDirichletBoundaryConditions< tnlGrid< 2, MeshReal, Device, MeshIndex >, typedef tnlStaticVector< 2, RealType > VertexType; typedef typename MeshType::CoordinatesType CoordinatesType; bool init( const tnlParameterContainer& parameters ); void setBoundaryConditions( const RealType& time, const RealType& tau, const MeshType& mesh, Loading @@ -65,14 +80,20 @@ class tnlDirichletBoundaryConditions< tnlGrid< 2, MeshReal, Device, MeshIndex >, const CoordinatesType& coordinates, DofVectorType& u, DofVectorType& fu ); protected: Function function; }; template< typename MeshReal, typename Device, typename MeshIndex, typename Function, typename Real, typename Index > class tnlDirichletBoundaryConditions< tnlGrid< 3, MeshReal, Device, MeshIndex >, Real, Index > class tnlDirichletBoundaryConditions< tnlGrid< 3, MeshReal, Device, MeshIndex >, Function, Real, Index > { public: Loading @@ -86,6 +107,8 @@ class tnlDirichletBoundaryConditions< tnlGrid< 3, MeshReal, Device, MeshIndex >, typedef tnlStaticVector< 3, RealType > VertexType; typedef typename MeshType::CoordinatesType CoordinatesType; bool init( const tnlParameterContainer& parameters ); void setBoundaryConditions( const RealType& time, const RealType& tau, const MeshType& mesh, Loading @@ -94,6 +117,9 @@ class tnlDirichletBoundaryConditions< tnlGrid< 3, MeshReal, Device, MeshIndex >, DofVectorType& u, DofVectorType& fu ); protected: Function function; }; #include "tnlDirichletBoundaryConditions_impl.h" Loading examples/heat-equation/tnlDirichletBoundaryConditions_impl.h +49 −7 Original line number Diff line number Diff line #ifndef TNLDIRICHLETBOUNDARYCONDITIONS_IMPL_H #define TNLDIRICHLETBOUNDARYCONDITIONS_IMPL_H #include "tnlDirichletBoundaryConditions.h" template< typename MeshReal, typename Device, typename MeshIndex, typename Function, typename Real, typename Index > bool tnlDirichletBoundaryConditions< tnlGrid< 1,MeshReal, Device, MeshIndex >, Function, Real, Index >:: init( const tnlParameterContainer& parameters ) { return function.init( parameters ); } template< typename MeshReal, typename Device, typename MeshIndex, typename Function, typename Real, typename Index > void tnlDirichletBoundaryConditions< tnlGrid< 1,MeshReal, Device, MeshIndex >, Real, Index >:: tnlDirichletBoundaryConditions< tnlGrid< 1,MeshReal, Device, MeshIndex >, Function, Real, Index >:: setBoundaryConditions( const RealType& time, const RealType& tau, const MeshType& mesh, Loading @@ -19,16 +32,31 @@ setBoundaryConditions( const RealType& time, DofVectorType& fu ) { fu[ index ] = 0; u[ index ] = 0; u[ index ] = function.getValue( mesh.getVertex( coordinates ) ); } template< typename MeshReal, typename Device, typename MeshIndex, typename Function, typename Real, typename Index > bool tnlDirichletBoundaryConditions< tnlGrid< 2,MeshReal, Device, MeshIndex >, Function, Real, Index >:: init( const tnlParameterContainer& parameters ) { return function.init( parameters ); } template< typename MeshReal, typename Device, typename MeshIndex, typename Function, typename Real, typename Index > void tnlDirichletBoundaryConditions< tnlGrid< 2, MeshReal, Device, MeshIndex >, Real, Index >:: tnlDirichletBoundaryConditions< tnlGrid< 2, MeshReal, Device, MeshIndex >, Function, Real, Index >:: setBoundaryConditions( const RealType& time, const RealType& tau, const MeshType& mesh, Loading @@ -38,16 +66,30 @@ setBoundaryConditions( const RealType& time, DofVectorType& fu ) { fu[ index ] = 0; u[ index ] = 0; u[ index ] = function.getValue( mesh.getVertex( coordinates ) );; } template< typename MeshReal, typename Device, typename MeshIndex, typename Function, typename Real, typename Index > bool tnlDirichletBoundaryConditions< tnlGrid< 3,MeshReal, Device, MeshIndex >, Function, Real, Index >:: init( const tnlParameterContainer& parameters ) { return function.init( parameters ); } template< typename MeshReal, typename Device, typename MeshIndex, typename Function, typename Real, typename Index > void tnlDirichletBoundaryConditions< tnlGrid< 3, MeshReal, Device, MeshIndex >, Real, Index >:: tnlDirichletBoundaryConditions< tnlGrid< 3, MeshReal, Device, MeshIndex >, Function, Real, Index >:: setBoundaryConditions( const RealType& time, const RealType& tau, const MeshType& mesh, Loading @@ -57,7 +99,7 @@ setBoundaryConditions( const RealType& time, DofVectorType& fu ) { fu[ index ] = 0; u[ index ] = 0; u[ index ] = function.getValue( mesh.getVertex( coordinates ) );; } Loading Loading
examples/heat-equation/heatEquationSetter.h +3 −3 Original line number Diff line number Diff line Loading @@ -21,9 +21,9 @@ #include <config/tnlParameterContainer.h> #include <mesh/tnlGrid.h> #include "heatEquationSolver.h" #include <generators/functions/tnlSinWaveFunction.h> #include <generators/functions/tnlExpBumpFunction.h> #include <generators/functions/tnlSinBumpsFunction.h> #include <functions/tnlSinWaveFunction.h> #include <functions/tnlExpBumpFunction.h> #include <functions/tnlSinBumpsFunction.h> #include "tnlTimeFunction.h" #include "tnlDirichletBoundaryConditions.h" #include <schemes/diffusion/tnlLinearDiffusion.h> Loading
examples/heat-equation/heatEquationSetter_impl.h +6 −4 Original line number Diff line number Diff line Loading @@ -20,9 +20,9 @@ #include "heatEquationSetter.h" #include "heatEquationSolver.h" #include <generators/functions/tnlSinWaveFunction.h> #include <generators/functions/tnlSinBumpsFunction.h> #include <generators/functions/tnlExpBumpFunction.h> #include <functions/tnlSinWaveFunction.h> #include <functions/tnlSinBumpsFunction.h> #include <functions/tnlExpBumpFunction.h> #include <schemes/diffusion/tnlLinearDiffusion.h> #include "tnlDirichletBoundaryConditions.h" #include "tnlRightHandSide.h" Loading @@ -43,7 +43,9 @@ bool heatEquationSetter< Real, Device, Index, MeshType, ConfigTag, SolverStarter const tnlString& analyticSpaceFunctionParameter = parameters.GetParameter<tnlString>("test-function"); typedef tnlLinearDiffusion< MeshType, Real, Index > Scheme; typedef tnlDirichletBoundaryConditions< MeshType, Real, Index > BoundaryConditions; typedef tnlStaticVector < MeshType::Dimensions, Real > Vertex; typedef tnlConstantFunction< MeshType::Dimensions, Vertex, Device > BCFunction; typedef tnlDirichletBoundaryConditions< MeshType, BCFunction, Real, Index > BoundaryConditions; typedef tnlRightHandSide< MeshType, Real, Index > RightHandSide; if (analyticSpaceFunctionParameter == "sin-wave") { Loading
examples/heat-equation/heatEquationSolver_impl.h +2 −0 Original line number Diff line number Diff line Loading @@ -48,6 +48,8 @@ template< typename Mesh, typename Diffusion, typename BoundaryCondition, typenam bool heatEquationSolver< Mesh,Diffusion,BoundaryCondition,RightHandSide > :: init( const tnlParameterContainer& parameters ) { if( ! boundaryCondition.init( parameters ) ) return false; /*analyticSpaceFunction.init(parameters); ifLaplaceCompare = parameters.GetParameter< IndexType >( "approximation-test" ); if((ifLaplaceCompare != 0) && (ifLaplaceCompare != 1)) Loading
examples/heat-equation/tnlDirichletBoundaryConditions.h +31 −5 Original line number Diff line number Diff line Loading @@ -2,10 +2,15 @@ #define TNLDIRICHLETBOUNDARYCONDITIONS_H #include <core/vectors/tnlStaticVector.h> #include <config/tnlParameterContainer.h> #include <functions/tnlConstantFunction.h> template< typename Mesh, typename Real, // = typename Mesh::RealType, typename Index > //= typename Mesh::IndexType > typename Function = tnlConstantFunction< Mesh::Dimensions, typename Mesh::VertexType, typename Mesh::DeviceType >, typename Real = typename Mesh::RealType, typename Index = typename Mesh::IndexType > class tnlDirichletBoundaryConditions { Loading @@ -14,9 +19,10 @@ class tnlDirichletBoundaryConditions template< typename MeshReal, typename Device, typename MeshIndex, typename Function, typename Real, typename Index > class tnlDirichletBoundaryConditions< tnlGrid< 1, MeshReal, Device, MeshIndex >, Real, Index > class tnlDirichletBoundaryConditions< tnlGrid< 1, MeshReal, Device, MeshIndex >, Function, Real, Index > { public: Loading @@ -30,6 +36,8 @@ class tnlDirichletBoundaryConditions< tnlGrid< 1, MeshReal, Device, MeshIndex >, typedef tnlStaticVector< 1, RealType > VertexType; typedef typename MeshType::CoordinatesType CoordinatesType; bool init( const tnlParameterContainer& parameters ); void setBoundaryConditions( const RealType& time, const RealType& tau, const MeshType& mesh, Loading @@ -37,14 +45,19 @@ class tnlDirichletBoundaryConditions< tnlGrid< 1, MeshReal, Device, MeshIndex >, const CoordinatesType& coordinates, DofVectorType& u, DofVectorType& fu ); protected: Function function; }; template< typename MeshReal, typename Device, typename MeshIndex, typename Function, typename Real, typename Index > class tnlDirichletBoundaryConditions< tnlGrid< 2, MeshReal, Device, MeshIndex >, Real, Index > class tnlDirichletBoundaryConditions< tnlGrid< 2, MeshReal, Device, MeshIndex >, Function, Real, Index > { public: Loading @@ -58,6 +71,8 @@ class tnlDirichletBoundaryConditions< tnlGrid< 2, MeshReal, Device, MeshIndex >, typedef tnlStaticVector< 2, RealType > VertexType; typedef typename MeshType::CoordinatesType CoordinatesType; bool init( const tnlParameterContainer& parameters ); void setBoundaryConditions( const RealType& time, const RealType& tau, const MeshType& mesh, Loading @@ -65,14 +80,20 @@ class tnlDirichletBoundaryConditions< tnlGrid< 2, MeshReal, Device, MeshIndex >, const CoordinatesType& coordinates, DofVectorType& u, DofVectorType& fu ); protected: Function function; }; template< typename MeshReal, typename Device, typename MeshIndex, typename Function, typename Real, typename Index > class tnlDirichletBoundaryConditions< tnlGrid< 3, MeshReal, Device, MeshIndex >, Real, Index > class tnlDirichletBoundaryConditions< tnlGrid< 3, MeshReal, Device, MeshIndex >, Function, Real, Index > { public: Loading @@ -86,6 +107,8 @@ class tnlDirichletBoundaryConditions< tnlGrid< 3, MeshReal, Device, MeshIndex >, typedef tnlStaticVector< 3, RealType > VertexType; typedef typename MeshType::CoordinatesType CoordinatesType; bool init( const tnlParameterContainer& parameters ); void setBoundaryConditions( const RealType& time, const RealType& tau, const MeshType& mesh, Loading @@ -94,6 +117,9 @@ class tnlDirichletBoundaryConditions< tnlGrid< 3, MeshReal, Device, MeshIndex >, DofVectorType& u, DofVectorType& fu ); protected: Function function; }; #include "tnlDirichletBoundaryConditions_impl.h" Loading
examples/heat-equation/tnlDirichletBoundaryConditions_impl.h +49 −7 Original line number Diff line number Diff line #ifndef TNLDIRICHLETBOUNDARYCONDITIONS_IMPL_H #define TNLDIRICHLETBOUNDARYCONDITIONS_IMPL_H #include "tnlDirichletBoundaryConditions.h" template< typename MeshReal, typename Device, typename MeshIndex, typename Function, typename Real, typename Index > bool tnlDirichletBoundaryConditions< tnlGrid< 1,MeshReal, Device, MeshIndex >, Function, Real, Index >:: init( const tnlParameterContainer& parameters ) { return function.init( parameters ); } template< typename MeshReal, typename Device, typename MeshIndex, typename Function, typename Real, typename Index > void tnlDirichletBoundaryConditions< tnlGrid< 1,MeshReal, Device, MeshIndex >, Real, Index >:: tnlDirichletBoundaryConditions< tnlGrid< 1,MeshReal, Device, MeshIndex >, Function, Real, Index >:: setBoundaryConditions( const RealType& time, const RealType& tau, const MeshType& mesh, Loading @@ -19,16 +32,31 @@ setBoundaryConditions( const RealType& time, DofVectorType& fu ) { fu[ index ] = 0; u[ index ] = 0; u[ index ] = function.getValue( mesh.getVertex( coordinates ) ); } template< typename MeshReal, typename Device, typename MeshIndex, typename Function, typename Real, typename Index > bool tnlDirichletBoundaryConditions< tnlGrid< 2,MeshReal, Device, MeshIndex >, Function, Real, Index >:: init( const tnlParameterContainer& parameters ) { return function.init( parameters ); } template< typename MeshReal, typename Device, typename MeshIndex, typename Function, typename Real, typename Index > void tnlDirichletBoundaryConditions< tnlGrid< 2, MeshReal, Device, MeshIndex >, Real, Index >:: tnlDirichletBoundaryConditions< tnlGrid< 2, MeshReal, Device, MeshIndex >, Function, Real, Index >:: setBoundaryConditions( const RealType& time, const RealType& tau, const MeshType& mesh, Loading @@ -38,16 +66,30 @@ setBoundaryConditions( const RealType& time, DofVectorType& fu ) { fu[ index ] = 0; u[ index ] = 0; u[ index ] = function.getValue( mesh.getVertex( coordinates ) );; } template< typename MeshReal, typename Device, typename MeshIndex, typename Function, typename Real, typename Index > bool tnlDirichletBoundaryConditions< tnlGrid< 3,MeshReal, Device, MeshIndex >, Function, Real, Index >:: init( const tnlParameterContainer& parameters ) { return function.init( parameters ); } template< typename MeshReal, typename Device, typename MeshIndex, typename Function, typename Real, typename Index > void tnlDirichletBoundaryConditions< tnlGrid< 3, MeshReal, Device, MeshIndex >, Real, Index >:: tnlDirichletBoundaryConditions< tnlGrid< 3, MeshReal, Device, MeshIndex >, Function, Real, Index >:: setBoundaryConditions( const RealType& time, const RealType& tau, const MeshType& mesh, Loading @@ -57,7 +99,7 @@ setBoundaryConditions( const RealType& time, DofVectorType& fu ) { fu[ index ] = 0; u[ index ] = 0; u[ index ] = function.getValue( mesh.getVertex( coordinates ) );; } Loading