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

Adding user defined time stepper.

parent 42811b4b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@

TARGET=TNL
INSTALL_PREFIX=${HOME}/local
WITH_CUDA=yes
WITH_CUDA=no
TEMPLATE_EXPLICIT_INSTANTIATION=yes
#VERBOSE="VERBOSE=1"

+5 −0
Original line number Diff line number Diff line
@@ -38,6 +38,11 @@ class tnlPDEProblem : public tnlProblem< Real, Device, Index >
      typedef tnlVector< RealType, DeviceType, IndexType> DofVectorType;
      typedef tnlCSRMatrix< RealType, DeviceType, IndexType > MatrixType;

      /****
       * This means that the time stepper will be set from the command line arguments.
       */
      typedef void TimeStepper;

      static tnlString getTypeStatic();

      tnlString getPrologHeader() const;
+49 −12
Original line number Diff line number Diff line
@@ -33,6 +33,11 @@
#include <solvers/tnlIterativeSolverMonitor.h>
#include <solvers/ode/tnlODESolverMonitor.h>

template< typename Problem,
          typename ConfigTag,
          typename TimeStepper = typename Problem::TimeStepper >
class tnlUserDefinedTimeDiscretisationSetter;

template< typename Problem,
          typename TimeDiscretisation,
          typename ConfigTag,
@@ -83,6 +88,37 @@ bool tnlSolverStarter< ConfigTag > :: run( const tnlParameterContainer& paramete
      return false;
   }

   return tnlUserDefinedTimeDiscretisationSetter< Problem, ConfigTag >::run( problem, parameters );
}

template< typename Problem,
          typename ConfigTag,
          typename TimeStepper >
class tnlUserDefinedTimeDiscretisationSetter
{
   public:
      static bool run( Problem& problem,
                       const tnlParameterContainer& parameters )
      {
         TimeStepper timeStepper;
         if( ! timeStepper.setup( parameters ) )
         {
            cerr << "The time stepper initiation failed!" << endl;
            return false;
         }
         tnlSolverStarter< ConfigTag > solverStarter;
         return solverStarter.template runPDESolver< Problem, TimeStepper >( problem, parameters, timeStepper );
      }
};

template< typename Problem,
          typename ConfigTag >
class tnlUserDefinedTimeDiscretisationSetter< Problem, ConfigTag, void >
{
   public:
      static bool run( Problem& problem,
                       const tnlParameterContainer& parameters )
      {
         /****
          * Set-up the time discretisation
          */
@@ -96,6 +132,7 @@ bool tnlSolverStarter< ConfigTag > :: run( const tnlParameterContainer& paramete
         cerr << "Uknown time discretisation: " << timeDiscretisation << "." << endl;
         return false;
      }
};

/****
 * Setting the time discretisation
+1 −1

File changed.

Contains only whitespace changes.