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

Fixed tnl-quickstart.

parent 28b18c26
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -22,14 +22,14 @@ template<> struct ConfigTagIndex< {problemBaseName}BuildConfigTag, long int >{{
/****
 * With how many dimensions may have the problem to be solved...
 */    
template< int Dimensions > struct ConfigTagDimensions< {problemBaseName}BuildConfigTag, Dimensions >{{ enum {{ enabled = ( Dimensions == 1 ) }}; }};
template< int Dimension > struct ConfigTagDimension< {problemBaseName}BuildConfigTag, Dimension >{{ enum {{ enabled = ( Dimension == 1 ) }}; }};

/****
 * Use of Meshes::Grid is enabled for allowed dimensions and Real, Device and Index types.
 */
template< int Dimensions, typename Real, typename Device, typename Index >
   struct ConfigTagMesh< {problemBaseName}BuildConfigTag, Meshes::Grid< Dimensions, Real, Device, Index > >
      {{ enum {{ enabled = ConfigTagDimensions< {problemBaseName}BuildConfigTag, Dimensions >::enabled  &&
template< int Dimension, typename Real, typename Device, typename Index >
   struct ConfigTagMesh< {problemBaseName}BuildConfigTag, Meshes::Grid< Dimension, Real, Device, Index > >
      {{ enum {{ enabled = ConfigTagDimension< {problemBaseName}BuildConfigTag, Dimension >::enabled  &&
                         ConfigTagReal< {problemBaseName}BuildConfigTag, Real >::enabled &&
                         ConfigTagDevice< {problemBaseName}BuildConfigTag, Device >::enabled &&
                         ConfigTagIndex< {problemBaseName}BuildConfigTag, Index >::enabled }}; }};
+6 −6
Original line number Diff line number Diff line
@@ -58,10 +58,10 @@ class {problemBaseName}Setter

      static bool run( const Config::ParameterContainer & parameters )
      {{
          enum {{ Dimensions = MeshType::getMeshDimensions() }};
          enum {{ Dimension = MeshType::getMeshDimension() }};
          typedef {operatorName}< MeshType, Real, Index > ApproximateOperator;
          typedef {problemBaseName}Rhs< MeshType, Real > RightHandSide;    
          typedef Containers::StaticVector < MeshType::getMeshDimensions(), Real > Vertex;
          typedef Containers::StaticVector < MeshType::getMeshDimension(), Real > Vertex;

         /****
          * Resolve the template arguments of your solver here.
@@ -71,10 +71,10 @@ class {problemBaseName}Setter
          String boundaryConditionsType = parameters.getParameter< String >( "boundary-conditions-type" );
          if( parameters.checkParameter( "boundary-conditions-constant" ) )
          {{
             typedef Functions::Analytic::Constant< Dimensions, Real > ConstantFunction;
             typedef Functions::Analytic::Constant< Dimension, Real > ConstantFunction;
             if( boundaryConditionsType == "dirichlet" )
             {{
                typedef Operators::DirichletBoundaryConditions< MeshType, ConstantFunction, MeshType::getMeshDimensions(), Real, Index > BoundaryConditions;
                typedef Operators::DirichletBoundaryConditions< MeshType, ConstantFunction, MeshType::getMeshDimension(), Real, Index > BoundaryConditions;
                typedef {problemBaseName}Problem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Problem;
                SolverStarter solverStarter;
                return solverStarter.template run< Problem >( parameters );
@@ -87,7 +87,7 @@ class {problemBaseName}Setter
          typedef Functions::MeshFunction< MeshType > MeshFunction;
          if( boundaryConditionsType == "dirichlet" )
          {{    
             typedef Operators::DirichletBoundaryConditions< MeshType, MeshFunction, MeshType::getMeshDimensions(), Real, Index > BoundaryConditions;
             typedef Operators::DirichletBoundaryConditions< MeshType, MeshFunction, MeshType::getMeshDimension(), Real, Index > BoundaryConditions;
             typedef {problemBaseName}Problem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Problem;
             SolverStarter solverStarter;
             return solverStarter.template run< Problem >( parameters );
+4 −4
Original line number Diff line number Diff line
@@ -3,16 +3,16 @@ template< typename MeshReal,
          typename MeshIndex,
          typename Real,
          typename Index >
class {operatorName}< TNL::Meshes::Grid< {meshDimensions}, MeshReal, Device, MeshIndex >, Real, Index >
class {operatorName}< TNL::Meshes::Grid< {meshDimension}, MeshReal, Device, MeshIndex >, Real, Index >
{{
   public:
      typedef TNL::Meshes::Grid< {meshDimensions}, MeshReal, Device, MeshIndex > MeshType;
      typedef TNL::Meshes::Grid< {meshDimension}, MeshReal, Device, MeshIndex > MeshType;
      typedef typename MeshType::CoordinatesType CoordinatesType;
      typedef Real RealType;
      typedef Device DeviceType;
      typedef Index IndexType;
      typedef TNL::Functions::MeshFunction< MeshType > MeshFunctionType;
      enum {{ Dimensions = MeshType::getMeshDimensions() }};
      enum {{ Dimension = MeshType::getMeshDimension() }};

      static TNL::String getType();

@@ -22,8 +22,8 @@ class {operatorName}< TNL::Meshes::Grid< {meshDimensions}, MeshReal, Device, Mes
                       const MeshEntity& entity,
                       const RealType& time = 0.0 ) const;

      __cuda_callable__
      template< typename MeshEntity >    
      __cuda_callable__
      Index getLinearSystemRowLength( const MeshType& mesh,
                                      const IndexType& index,
                                      const MeshEntity& entity ) const;
+12 −12
Original line number Diff line number Diff line
/****
 * {meshDimensions}D problem
 * {meshDimension}D problem
 */
template< typename MeshReal,
          typename Device,
@@ -7,7 +7,7 @@ template< typename MeshReal,
          typename Real,
          typename Index >
TNL::String
{operatorName}< TNL::Meshes::Grid< {meshDimensions}, MeshReal, Device, MeshIndex >, Real, Index >::
{operatorName}< TNL::Meshes::Grid< {meshDimension}, MeshReal, Device, MeshIndex >, Real, Index >::
getType()
{{
   return TNL::String( "{operatorName}< " ) +
@@ -24,7 +24,7 @@ template< typename MeshReal,
template< typename MeshFunction, typename MeshEntity >
__cuda_callable__
Real
{operatorName}< TNL::Meshes::Grid< {meshDimensions}, MeshReal, Device, MeshIndex >, Real, Index >::
{operatorName}< TNL::Meshes::Grid< {meshDimension}, MeshReal, Device, MeshIndex >, Real, Index >::
operator()( const MeshFunction& u,
            const MeshEntity& entity,
            const Real& time ) const
@@ -34,9 +34,9 @@ operator()( const MeshFunction& u,
    * The following example is the Laplace operator approximated 
    * by the Finite difference method.
    */  
   static_assert( MeshEntity::entityDimensions == {meshDimensions}, "Wrong mesh entity dimensions." );
   static_assert( MeshFunction::getEntitiesDimensions() == {meshDimensions}, "Wrong preimage function" );
   const typename MeshEntity::template NeighbourEntities< {meshDimensions} >& neighbourEntities = entity.getNeighbourEntities(); 
   static_assert( MeshEntity::entityDimension == {meshDimension}, "Wrong mesh entity dimensions." );
   static_assert( MeshFunction::getEntitiesDimension() == {meshDimension}, "Wrong preimage function" );
   const typename MeshEntity::template NeighbourEntities< {meshDimension} >& neighbourEntities = entity.getNeighbourEntities(); 

{explicitScheme}
}}
@@ -49,7 +49,7 @@ template< typename MeshReal,
template< typename MeshEntity >
__cuda_callable__
Index
{operatorName}< TNL::Meshes::Grid< {meshDimensions}, MeshReal, Device, MeshIndex >, Real, Index >::
{operatorName}< TNL::Meshes::Grid< {meshDimension}, MeshReal, Device, MeshIndex >, Real, Index >::
getLinearSystemRowLength( const MeshType& mesh,
                          const IndexType& index,
                          const MeshEntity& entity ) const
@@ -61,7 +61,7 @@ getLinearSystemRowLength( const MeshType& mesh,
    * by the Finite difference method.
    */

   return 2*Dimensions + 1;
   return 2*Dimension + 1;
}}

template< typename MeshReal,
@@ -76,7 +76,7 @@ template< typename MeshReal,
__cuda_callable__
inline
void
{operatorName}< TNL::Meshes::Grid< {meshDimensions}, MeshReal, Device, MeshIndex >, Real, Index >::
{operatorName}< TNL::Meshes::Grid< {meshDimension}, MeshReal, Device, MeshIndex >, Real, Index >::
setMatrixElements( const PreimageFunction& u,
                   const MeshEntity& entity,
                   const RealType& time,
@@ -84,15 +84,15 @@ setMatrixElements( const PreimageFunction& u,
                   Matrix& matrix,
                   Vector& b ) const
{{
   static_assert( MeshEntity::entityDimensions == {meshDimensions}, "Wrong mesh entity dimensions." );
   static_assert( PreimageFunction::getEntitiesDimensions() == {meshDimensions}, "Wrong preimage function" );
   static_assert( MeshEntity::entityDimension == {meshDimension}, "Wrong mesh entity dimensions." );
   static_assert( PreimageFunction::getEntitiesDimension() == {meshDimension}, "Wrong preimage function" );

   /****
    * Setup the non-zero elements of the linear system here.
    * The following example is the Laplace operator approximated 
    * by the Finite difference method.
    */    
   const typename MeshEntity::template NeighbourEntities< {meshDimensions} >& neighbourEntities = entity.getNeighbourEntities();
   const typename MeshEntity::template NeighbourEntities< {meshDimension} >& neighbourEntities = entity.getNeighbourEntities();
   const IndexType& index = entity.getIndex();
   typename Matrix::MatrixRow matrixRow = matrix.getRow( index );
{semiimplicitScheme}
+14 −0
Original line number Diff line number Diff line
@@ -2,6 +2,10 @@

#include <TNL/Problems/PDEProblem.h>
#include <TNL/Functions/MeshFunction.h>
#include <TNL/Solvers/PDE/ExplicitUpdater.h>
#include <TNL/Solvers/PDE/LinearSystemAssembler.h>
#include <TNL/Solvers/PDE/BackwardTimeDiscretisation.h>


template< typename Mesh,
          typename BoundaryCondition,
@@ -85,6 +89,16 @@ class {problemBaseName}Problem:
      DifferentialOperatorPointer differentialOperator;
      BoundaryConditionPointer boundaryCondition;
      RightHandSidePointer rightHandSide;
   
      TNL::Solvers::PDE::ExplicitUpdater< Mesh, MeshFunctionType, DifferentialOperator, BoundaryCondition, RightHandSide > explicitUpdater;

      TNL::Solvers::PDE::LinearSystemAssembler< Mesh, 
                                                MeshFunctionType,
                                                DifferentialOperator,
                                                BoundaryCondition,
                                                RightHandSide,
                                                TNL::Solvers::PDE::BackwardTimeDiscretisation,
                                                DofVectorType > systemAssembler;
}};

#include "{problemBaseName}Problem_impl.h"
Loading