From de4b3e26da1153251775df0900c38bcd4ed951f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Oberhuber?= <oberhuber.tomas@gmail.com> Date: Wed, 14 Sep 2016 10:41:34 +0200 Subject: [PATCH] Fixing tnl-quickstart. --- examples/advection/advectionBuildConfigTag.h | 8 +-- .../inviscid-flow/1d/eulerBuildConfigTag.h | 8 +-- examples/inviscid-flow/1d/eulerRhs.h | 2 +- .../inviscid-flow/2d/eulerBuildConfigTag.h | 8 +-- src/TNL/Solvers/BuildConfigTags.h | 22 ++++---- src/TNL/Solvers/FastBuildConfigTag.h | 8 +-- src/TNL/Solvers/SolverConfig_impl.h | 54 +++++++++---------- src/TNL/Solvers/SolverStarter_impl.h | 28 +++++----- .../tnl-quickstart/build-config-tag.h.in | 34 +++++++----- src/Tools/tnl-quickstart/main.h.in | 6 +-- .../operator-grid-specialization.h.in | 8 +-- .../operator-grid-specialization_impl.h.in | 18 +++---- src/Tools/tnl-quickstart/problem.h.in | 2 +- src/Tools/tnl-quickstart/problem_impl.h.in | 25 ++++----- src/Tools/tnl-quickstart/rhs.h.in | 6 +-- .../HeatEquationBenchmarkBuildConfigTag.h | 10 ++-- 16 files changed, 127 insertions(+), 120 deletions(-) diff --git a/examples/advection/advectionBuildConfigTag.h b/examples/advection/advectionBuildConfigTag.h index e117781155..98371b43a3 100644 --- a/examples/advection/advectionBuildConfigTag.h +++ b/examples/advection/advectionBuildConfigTag.h @@ -35,14 +35,14 @@ template< int Dimensions, typename Real, typename Device, typename Index > /**** * Please, chose your preferred time discretisation here. */ -template<> struct ConfigTagTimeDiscretisation< advectionBuildConfigTag, tnlExplicitTimeDiscretisationTag >{ enum { enabled = true }; }; -template<> struct ConfigTagTimeDiscretisation< advectionBuildConfigTag, tnlSemiImplicitTimeDiscretisationTag >{ enum { enabled = true }; }; -template<> struct ConfigTagTimeDiscretisation< advectionBuildConfigTag, tnlImplicitTimeDiscretisationTag >{ enum { enabled = true }; }; +template<> struct ConfigTagTimeDiscretisation< advectionBuildConfigTag, ExplicitTimeDiscretisationTag >{ enum { enabled = true }; }; +template<> struct ConfigTagTimeDiscretisation< advectionBuildConfigTag, SemiImplicitTimeDiscretisationTag >{ enum { enabled = true }; }; +template<> struct ConfigTagTimeDiscretisation< advectionBuildConfigTag, ImplicitTimeDiscretisationTag >{ enum { enabled = true }; }; /**** * Only the Runge-Kutta-Merson solver is enabled by default. */ -template<> struct ConfigTagExplicitSolver< advectionBuildConfigTag, Solvers::tnlExplicitEulerSolverTag >{ enum { enabled = true }; }; +template<> struct ConfigTagExplicitSolver< advectionBuildConfigTag, Solvers::ExplicitEulerSolverTag >{ enum { enabled = true }; }; } // namespace Solvers } // namespace TNL diff --git a/examples/inviscid-flow/1d/eulerBuildConfigTag.h b/examples/inviscid-flow/1d/eulerBuildConfigTag.h index de74a6874e..abede16343 100644 --- a/examples/inviscid-flow/1d/eulerBuildConfigTag.h +++ b/examples/inviscid-flow/1d/eulerBuildConfigTag.h @@ -36,14 +36,14 @@ template< int Dimensions, typename Real, typename Device, typename Index > /**** * Please, chose your preferred time discretisation here. */ -template<> struct ConfigTagTimeDiscretisation< eulerBuildConfigTag, tnlExplicitTimeDiscretisationTag >{ enum { enabled = true }; }; -template<> struct ConfigTagTimeDiscretisation< eulerBuildConfigTag, tnlSemiImplicitTimeDiscretisationTag >{ enum { enabled = false }; }; -template<> struct ConfigTagTimeDiscretisation< eulerBuildConfigTag, tnlImplicitTimeDiscretisationTag >{ enum { enabled = false }; }; +template<> struct ConfigTagTimeDiscretisation< eulerBuildConfigTag, ExplicitTimeDiscretisationTag >{ enum { enabled = true }; }; +template<> struct ConfigTagTimeDiscretisation< eulerBuildConfigTag, SemiImplicitTimeDiscretisationTag >{ enum { enabled = false }; }; +template<> struct ConfigTagTimeDiscretisation< eulerBuildConfigTag, ImplicitTimeDiscretisationTag >{ enum { enabled = false }; }; /**** * Only the Runge-Kutta-Merson solver is enabled by default. */ -template<> struct ConfigTagExplicitSolver< eulerBuildConfigTag, tnlExplicitEulerSolverTag >{ enum { enabled = true }; }; +template<> struct ConfigTagExplicitSolver< eulerBuildConfigTag, ExplicitEulerSolverTag >{ enum { enabled = true }; }; } // namespace Solvers } // namespace TNL diff --git a/examples/inviscid-flow/1d/eulerRhs.h b/examples/inviscid-flow/1d/eulerRhs.h index 7cbe7e2ff9..1b46dc831f 100644 --- a/examples/inviscid-flow/1d/eulerRhs.h +++ b/examples/inviscid-flow/1d/eulerRhs.h @@ -27,7 +27,7 @@ template< typename Mesh, typename Real >class eulerRhs typedef typename MeshEntity::MeshType::VertexType VertexType; VertexType v = entity.getCenter(); return 0.0; - }; + } }; } //namespace TNL diff --git a/examples/inviscid-flow/2d/eulerBuildConfigTag.h b/examples/inviscid-flow/2d/eulerBuildConfigTag.h index 6b400ddad9..fef4dfffce 100644 --- a/examples/inviscid-flow/2d/eulerBuildConfigTag.h +++ b/examples/inviscid-flow/2d/eulerBuildConfigTag.h @@ -36,14 +36,14 @@ template< int Dimensions, typename Real, typename Device, typename Index > /**** * Please, chose your preferred time discretisation here. */ -template<> struct ConfigTagTimeDiscretisation< eulerBuildConfigTag, tnlExplicitTimeDiscretisationTag >{ enum { enabled = true }; }; -template<> struct ConfigTagTimeDiscretisation< eulerBuildConfigTag, tnlSemiImplicitTimeDiscretisationTag >{ enum { enabled = false }; }; -template<> struct ConfigTagTimeDiscretisation< eulerBuildConfigTag, tnlImplicitTimeDiscretisationTag >{ enum { enabled = false }; }; +template<> struct ConfigTagTimeDiscretisation< eulerBuildConfigTag, ExplicitTimeDiscretisationTag >{ enum { enabled = true }; }; +template<> struct ConfigTagTimeDiscretisation< eulerBuildConfigTag, SemiImplicitTimeDiscretisationTag >{ enum { enabled = false }; }; +template<> struct ConfigTagTimeDiscretisation< eulerBuildConfigTag, ImplicitTimeDiscretisationTag >{ enum { enabled = false }; }; /**** * Only the Runge-Kutta-Merson solver is enabled by default. */ -template<> struct ConfigTagExplicitSolver< eulerBuildConfigTag, tnlExplicitEulerSolverTag >{ enum { enabled = false }; }; +template<> struct ConfigTagExplicitSolver< eulerBuildConfigTag, ExplicitEulerSolverTag >{ enum { enabled = false }; }; } // namespace Solvers } // namespace TNL diff --git a/src/TNL/Solvers/BuildConfigTags.h b/src/TNL/Solvers/BuildConfigTags.h index fd463c649c..b3ba1f7ed4 100644 --- a/src/TNL/Solvers/BuildConfigTags.h +++ b/src/TNL/Solvers/BuildConfigTags.h @@ -74,23 +74,23 @@ template< typename ConfigTag, int Dimensions, typename Real, typename Device, ty * All time discretisations (explicit, semi-impicit and implicit ) are * enabled by default. */ -class tnlExplicitTimeDiscretisationTag{}; -class tnlSemiImplicitTimeDiscretisationTag{}; -class tnlImplicitTimeDiscretisationTag{}; +class ExplicitTimeDiscretisationTag{}; +class SemiImplicitTimeDiscretisationTag{}; +class ImplicitTimeDiscretisationTag{}; template< typename ConfigTag, typename TimeDiscretisation > struct ConfigTagTimeDiscretisation{ enum { enabled = true }; }; /**** * All explicit solvers are enabled by default */ -class tnlExplicitEulerSolverTag +class ExplicitEulerSolverTag { public: template< typename Problem > using Template = ODE::Euler< Problem >; }; -class tnlExplicitMersonSolverTag +class ExplicitMersonSolverTag { public: template< typename Problem > @@ -102,7 +102,7 @@ template< typename ConfigTag, typename ExplicitSolver > struct ConfigTagExplicit /**** * All semi-implicit solvers are enabled by default */ -class tnlSemiImplicitSORSolverTag +class SemiImplicitSORSolverTag { public: template< typename Matrix, typename Preconditioner = Linear::Preconditioners::Dummy< typename Matrix::RealType, @@ -111,7 +111,7 @@ public: using Template = Linear::SOR< Matrix, Preconditioner >; }; -class tnlSemiImplicitCGSolverTag +class SemiImplicitCGSolverTag { public: template< typename Matrix, typename Preconditioner = Linear::Preconditioners::Dummy< typename Matrix::RealType, @@ -120,7 +120,7 @@ public: using Template = Linear::CG< Matrix, Preconditioner >; }; -class tnlSemiImplicitBICGStabSolverTag +class SemiImplicitBICGStabSolverTag { public: template< typename Matrix, typename Preconditioner = Linear::Preconditioners::Dummy< typename Matrix::RealType, @@ -129,7 +129,7 @@ public: using Template = Linear::BICGStab< Matrix, Preconditioner >; }; -class tnlSemiImplicitGMRESSolverTag +class SemiImplicitGMRESSolverTag { public: template< typename Matrix, typename Preconditioner = Linear::Preconditioners::Dummy< typename Matrix::RealType, @@ -138,7 +138,7 @@ public: using Template = Linear::GMRES< Matrix, Preconditioner >; }; -class tnlSemiImplicitTFQMRSolverTag +class SemiImplicitTFQMRSolverTag { public: template< typename Matrix, typename Preconditioner = Linear::Preconditioners::Dummy< typename Matrix::RealType, @@ -148,7 +148,7 @@ public: }; #ifdef HAVE_UMFPACK -class tnlSemiImplicitUmfpackSolverTag +class SemiImplicitUmfpackSolverTag { public: template< typename Matrix, typename Preconditioner = Linear::Preconditioners::Dummy< typename Matrix::RealType, diff --git a/src/TNL/Solvers/FastBuildConfigTag.h b/src/TNL/Solvers/FastBuildConfigTag.h index 1838b77587..0786a446f2 100644 --- a/src/TNL/Solvers/FastBuildConfigTag.h +++ b/src/TNL/Solvers/FastBuildConfigTag.h @@ -47,14 +47,14 @@ template< int Dimensions, typename Real, typename Device, typename Index > /**** * Please, chose your preferred time discretisation here. */ -template<> struct ConfigTagTimeDiscretisation< tnlFastBuildConfig, tnlExplicitTimeDiscretisationTag >{ enum { enabled = true }; }; -template<> struct ConfigTagTimeDiscretisation< tnlFastBuildConfig, tnlSemiImplicitTimeDiscretisationTag >{ enum { enabled = true }; }; -template<> struct ConfigTagTimeDiscretisation< tnlFastBuildConfig, tnlImplicitTimeDiscretisationTag >{ enum { enabled = false }; }; +template<> struct ConfigTagTimeDiscretisation< tnlFastBuildConfig, ExplicitTimeDiscretisationTag >{ enum { enabled = true }; }; +template<> struct ConfigTagTimeDiscretisation< tnlFastBuildConfig, SemiImplicitTimeDiscretisationTag >{ enum { enabled = true }; }; +template<> struct ConfigTagTimeDiscretisation< tnlFastBuildConfig, ImplicitTimeDiscretisationTag >{ enum { enabled = false }; }; /**** * Only the Runge-Kutta-Merson solver is enabled by default. */ -//template<> struct ConfigTagExplicitSolver< tnlFastBuildConfig, tnlExplicitEulerSolverTag >{ enum { enabled = false }; }; +template<> struct ConfigTagExplicitSolver< tnlFastBuildConfig, ExplicitEulerSolverTag >{ enum { enabled = false }; }; } // namespace Solvers } // namespace TNL diff --git a/src/TNL/Solvers/SolverConfig_impl.h b/src/TNL/Solvers/SolverConfig_impl.h index 8743daf1e0..fb21d205ee 100644 --- a/src/TNL/Solvers/SolverConfig_impl.h +++ b/src/TNL/Solvers/SolverConfig_impl.h @@ -81,75 +81,75 @@ bool SolverConfig< ConfigTag, ProblemConfig >::configSetup( Config::ConfigDescri typedef PDE::ExplicitTimeStepper< DummyProblemType, ODE::Euler > ExplicitTimeStepper; PDE::PDESolver< DummyProblemType, ExplicitTimeStepper >::configSetup( config ); ExplicitTimeStepper::configSetup( config ); - if( ConfigTagTimeDiscretisation< ConfigTag, tnlExplicitTimeDiscretisationTag >::enabled || - ConfigTagTimeDiscretisation< ConfigTag, tnlSemiImplicitTimeDiscretisationTag >::enabled || - ConfigTagTimeDiscretisation< ConfigTag, tnlImplicitTimeDiscretisationTag >::enabled ) + if( ConfigTagTimeDiscretisation< ConfigTag, ExplicitTimeDiscretisationTag >::enabled || + ConfigTagTimeDiscretisation< ConfigTag, SemiImplicitTimeDiscretisationTag >::enabled || + ConfigTagTimeDiscretisation< ConfigTag, ImplicitTimeDiscretisationTag >::enabled ) { config.addRequiredEntry< String >( "time-discretisation", "Discratisation in time."); - if( ConfigTagTimeDiscretisation< ConfigTag, tnlExplicitTimeDiscretisationTag >::enabled ) + if( ConfigTagTimeDiscretisation< ConfigTag, ExplicitTimeDiscretisationTag >::enabled ) config.addEntryEnum( "explicit" ); - if( ConfigTagTimeDiscretisation< ConfigTag, tnlSemiImplicitTimeDiscretisationTag >::enabled ) + if( ConfigTagTimeDiscretisation< ConfigTag, SemiImplicitTimeDiscretisationTag >::enabled ) config.addEntryEnum( "semi-implicit" ); - if( ConfigTagTimeDiscretisation< ConfigTag, tnlImplicitTimeDiscretisationTag >::enabled ) + if( ConfigTagTimeDiscretisation< ConfigTag, ImplicitTimeDiscretisationTag >::enabled ) config.addEntryEnum( "implicit" ); } config.addRequiredEntry< String >( "discrete-solver", "The solver of the discretised problem:" ); - if( ConfigTagTimeDiscretisation< ConfigTag, tnlExplicitTimeDiscretisationTag >::enabled ) + if( ConfigTagTimeDiscretisation< ConfigTag, ExplicitTimeDiscretisationTag >::enabled ) { - if( ConfigTagExplicitSolver< ConfigTag, tnlExplicitEulerSolverTag >::enabled ) + if( ConfigTagExplicitSolver< ConfigTag, ExplicitEulerSolverTag >::enabled ) config.addEntryEnum( "euler" ); - if( ConfigTagExplicitSolver< ConfigTag, tnlExplicitMersonSolverTag >::enabled ) + if( ConfigTagExplicitSolver< ConfigTag, ExplicitMersonSolverTag >::enabled ) config.addEntryEnum( "merson" ); } - if( ConfigTagTimeDiscretisation< ConfigTag, tnlSemiImplicitTimeDiscretisationTag >::enabled ) + if( ConfigTagTimeDiscretisation< ConfigTag, SemiImplicitTimeDiscretisationTag >::enabled ) { - if( ConfigTagSemiImplicitSolver< ConfigTag, tnlSemiImplicitCGSolverTag >::enabled ) + if( ConfigTagSemiImplicitSolver< ConfigTag, SemiImplicitCGSolverTag >::enabled ) config.addEntryEnum( "cg" ); - if( ConfigTagSemiImplicitSolver< ConfigTag, tnlSemiImplicitBICGStabSolverTag >::enabled ) + if( ConfigTagSemiImplicitSolver< ConfigTag, SemiImplicitBICGStabSolverTag >::enabled ) config.addEntryEnum( "bicgstab" ); - if( ConfigTagSemiImplicitSolver< ConfigTag, tnlSemiImplicitGMRESSolverTag >::enabled ) + if( ConfigTagSemiImplicitSolver< ConfigTag, SemiImplicitGMRESSolverTag >::enabled ) config.addEntryEnum( "gmres" ); - if( ConfigTagSemiImplicitSolver< ConfigTag, tnlSemiImplicitTFQMRSolverTag >::enabled ) + if( ConfigTagSemiImplicitSolver< ConfigTag, SemiImplicitTFQMRSolverTag >::enabled ) config.addEntryEnum( "tfqmr" ); - if( ConfigTagSemiImplicitSolver< ConfigTag, tnlSemiImplicitSORSolverTag >::enabled ) + if( ConfigTagSemiImplicitSolver< ConfigTag, SemiImplicitSORSolverTag >::enabled ) config.addEntryEnum( "sor" ); #ifdef HAVE_UMFPACK - if( MeshConfigSemiImplicitSolver< MeshConfig, tnlSemiImplicitUmfpackSolverTag >::enabled ) + if( MeshConfigSemiImplicitSolver< MeshConfig, SemiImplicitUmfpackSolverTag >::enabled ) config.addEntryEnum( "umfpack" ); #endif } config.addEntry< String >( "preconditioner", "The preconditioner for the discrete solver:", "none" ); config.addEntryEnum( "none" ); config.addEntryEnum( "diagonal" ); - if( ConfigTagTimeDiscretisation< ConfigTag, tnlExplicitTimeDiscretisationTag >::enabled || - ConfigTagTimeDiscretisation< ConfigTag, tnlSemiImplicitTimeDiscretisationTag >::enabled ) + if( ConfigTagTimeDiscretisation< ConfigTag, ExplicitTimeDiscretisationTag >::enabled || + ConfigTagTimeDiscretisation< ConfigTag, SemiImplicitTimeDiscretisationTag >::enabled ) { config.addDelimiter( " === Iterative solvers parameters === " ); IterativeSolver< double, int >::configSetup( config ); } - if( ConfigTagTimeDiscretisation< ConfigTag, tnlExplicitTimeDiscretisationTag >::enabled ) + if( ConfigTagTimeDiscretisation< ConfigTag, ExplicitTimeDiscretisationTag >::enabled ) { config.addDelimiter( " === Explicit solvers parameters === " ); ODE::ExplicitSolver< DummyProblem< double, Devices::Host, int > >::configSetup( config ); - if( ConfigTagExplicitSolver< ConfigTag, tnlExplicitEulerSolverTag >::enabled ) + if( ConfigTagExplicitSolver< ConfigTag, ExplicitEulerSolverTag >::enabled ) ODE::Euler< DummyProblem< double, Devices::Host, int > >::configSetup( config ); - if( ConfigTagExplicitSolver< ConfigTag, tnlExplicitMersonSolverTag >::enabled ) + if( ConfigTagExplicitSolver< ConfigTag, ExplicitMersonSolverTag >::enabled ) ODE::Merson< DummyProblem< double, Devices::Host, int > >::configSetup( config ); } - if( ConfigTagTimeDiscretisation< ConfigTag, tnlSemiImplicitTimeDiscretisationTag >::enabled ) + if( ConfigTagTimeDiscretisation< ConfigTag, SemiImplicitTimeDiscretisationTag >::enabled ) { config.addDelimiter( " === Semi-implicit solvers parameters === " ); typedef Matrices::CSR< double, Devices::Host, int > MatrixType; - if( ConfigTagSemiImplicitSolver< ConfigTag, tnlSemiImplicitCGSolverTag >::enabled ) + if( ConfigTagSemiImplicitSolver< ConfigTag, SemiImplicitCGSolverTag >::enabled ) Linear::CG< MatrixType >::configSetup( config ); - if( ConfigTagSemiImplicitSolver< ConfigTag, tnlSemiImplicitBICGStabSolverTag >::enabled ) + if( ConfigTagSemiImplicitSolver< ConfigTag, SemiImplicitBICGStabSolverTag >::enabled ) Linear::BICGStab< MatrixType >::configSetup( config ); - if( ConfigTagSemiImplicitSolver< ConfigTag, tnlSemiImplicitGMRESSolverTag >::enabled ) + if( ConfigTagSemiImplicitSolver< ConfigTag, SemiImplicitGMRESSolverTag >::enabled ) Linear::GMRES< MatrixType >::configSetup( config ); - if( ConfigTagSemiImplicitSolver< ConfigTag, tnlSemiImplicitTFQMRSolverTag >::enabled ) + if( ConfigTagSemiImplicitSolver< ConfigTag, SemiImplicitTFQMRSolverTag >::enabled ) Linear::TFQMR< MatrixType >::configSetup( config ); - if( ConfigTagSemiImplicitSolver< ConfigTag, tnlSemiImplicitSORSolverTag >::enabled ) + if( ConfigTagSemiImplicitSolver< ConfigTag, SemiImplicitSORSolverTag >::enabled ) Linear::SOR< MatrixType >::configSetup( config ); } diff --git a/src/TNL/Solvers/SolverStarter_impl.h b/src/TNL/Solvers/SolverStarter_impl.h index bbe447f36e..25f704b845 100644 --- a/src/TNL/Solvers/SolverStarter_impl.h +++ b/src/TNL/Solvers/SolverStarter_impl.h @@ -132,11 +132,11 @@ class tnlUserDefinedTimeDiscretisationSetter< Problem, ConfigTag, void > */ const String& timeDiscretisation = parameters. getParameter< String>( "time-discretisation" ); if( timeDiscretisation == "explicit" ) - return SolverStarterTimeDiscretisationSetter< Problem, tnlExplicitTimeDiscretisationTag, ConfigTag >::run( problem, parameters ); + return SolverStarterTimeDiscretisationSetter< Problem, ExplicitTimeDiscretisationTag, ConfigTag >::run( problem, parameters ); if( timeDiscretisation == "semi-implicit" ) - return SolverStarterTimeDiscretisationSetter< Problem, tnlSemiImplicitTimeDiscretisationTag, ConfigTag >::run( problem, parameters ); + return SolverStarterTimeDiscretisationSetter< Problem, SemiImplicitTimeDiscretisationTag, ConfigTag >::run( problem, parameters ); if( timeDiscretisation == "implicit" ) - return SolverStarterTimeDiscretisationSetter< Problem, tnlImplicitTimeDiscretisationTag, ConfigTag >::run( problem, parameters ); + return SolverStarterTimeDiscretisationSetter< Problem, ImplicitTimeDiscretisationTag, ConfigTag >::run( problem, parameters ); std::cerr << "Uknown time discretisation: " << timeDiscretisation << "." << std::endl; return false; } @@ -162,7 +162,7 @@ class SolverStarterTimeDiscretisationSetter< Problem, TimeDiscretisation, Config template< typename Problem, typename ConfigTag > -class SolverStarterTimeDiscretisationSetter< Problem, tnlExplicitTimeDiscretisationTag, ConfigTag, true > +class SolverStarterTimeDiscretisationSetter< Problem, ExplicitTimeDiscretisationTag, ConfigTag, true > { public: static bool run( Problem& problem, @@ -176,16 +176,16 @@ class SolverStarterTimeDiscretisationSetter< Problem, tnlExplicitTimeDiscretisat return false; } if( discreteSolver == "euler" ) - return SolverStarterExplicitSolverSetter< Problem, tnlExplicitEulerSolverTag, ConfigTag >::run( problem, parameters ); + return SolverStarterExplicitSolverSetter< Problem, ExplicitEulerSolverTag, ConfigTag >::run( problem, parameters ); if( discreteSolver == "merson" ) - return SolverStarterExplicitSolverSetter< Problem, tnlExplicitMersonSolverTag, ConfigTag >::run( problem, parameters ); + return SolverStarterExplicitSolverSetter< Problem, ExplicitMersonSolverTag, ConfigTag >::run( problem, parameters ); return false; } }; template< typename Problem, typename ConfigTag > -class SolverStarterTimeDiscretisationSetter< Problem, tnlSemiImplicitTimeDiscretisationTag, ConfigTag, true > +class SolverStarterTimeDiscretisationSetter< Problem, SemiImplicitTimeDiscretisationTag, ConfigTag, true > { public: static bool run( Problem& problem, @@ -216,18 +216,18 @@ class SolverStarterTimeDiscretisationSetter< Problem, tnlSemiImplicitTimeDiscret #endif if( discreteSolver == "sor" ) - return SolverStarterPreconditionerSetter< Problem, tnlSemiImplicitSORSolverTag, ConfigTag >::run( problem, parameters ); + return SolverStarterPreconditionerSetter< Problem, SemiImplicitSORSolverTag, ConfigTag >::run( problem, parameters ); if( discreteSolver == "cg" ) - return SolverStarterPreconditionerSetter< Problem, tnlSemiImplicitCGSolverTag, ConfigTag >::run( problem, parameters ); + return SolverStarterPreconditionerSetter< Problem, SemiImplicitCGSolverTag, ConfigTag >::run( problem, parameters ); if( discreteSolver == "bicgstab" ) - return SolverStarterPreconditionerSetter< Problem, tnlSemiImplicitBICGStabSolverTag, ConfigTag >::run( problem, parameters ); + return SolverStarterPreconditionerSetter< Problem, SemiImplicitBICGStabSolverTag, ConfigTag >::run( problem, parameters ); if( discreteSolver == "gmres" ) - return SolverStarterPreconditionerSetter< Problem, tnlSemiImplicitGMRESSolverTag, ConfigTag >::run( problem, parameters ); + return SolverStarterPreconditionerSetter< Problem, SemiImplicitGMRESSolverTag, ConfigTag >::run( problem, parameters ); if( discreteSolver == "tfqmr" ) - return SolverStarterPreconditionerSetter< Problem, tnlSemiImplicitTFQMRSolverTag, ConfigTag >::run( problem, parameters ); + return SolverStarterPreconditionerSetter< Problem, SemiImplicitTFQMRSolverTag, ConfigTag >::run( problem, parameters ); #ifdef HAVE_UMFPACK if( discreteSolver == "umfpack" ) - return SolverStarterPreconditionerSetter< Problem, tnlSemiImplicitUmfpackSolverTag, ConfigTag >::run( problem, parameters ); + return SolverStarterPreconditionerSetter< Problem, SemiImplicitUmfpackSolverTag, ConfigTag >::run( problem, parameters ); #endif return false; } @@ -235,7 +235,7 @@ class SolverStarterTimeDiscretisationSetter< Problem, tnlSemiImplicitTimeDiscret template< typename Problem, typename ConfigTag > -class SolverStarterTimeDiscretisationSetter< Problem, tnlImplicitTimeDiscretisationTag, ConfigTag, true > +class SolverStarterTimeDiscretisationSetter< Problem, ImplicitTimeDiscretisationTag, ConfigTag, true > { public: static bool run( Problem& problem, diff --git a/src/Tools/tnl-quickstart/build-config-tag.h.in b/src/Tools/tnl-quickstart/build-config-tag.h.in index baf3eb443b..395f53acc9 100644 --- a/src/Tools/tnl-quickstart/build-config-tag.h.in +++ b/src/Tools/tnl-quickstart/build-config-tag.h.in @@ -4,41 +4,47 @@ class {problemBaseName}BuildConfigTag{{}}; + +namespace TNL {{ +namespace Solvers {{ /**** * Turn off support for float and long double. */ -template<> struct tnlConfigTagReal< {problemBaseName}BuildConfigTag, float > {{ enum {{ enabled = false }}; }}; -template<> struct tnlConfigTagReal< {problemBaseName}BuildConfigTag, long double > {{ enum {{ enabled = false }}; }}; +template<> struct ConfigTagReal< {problemBaseName}BuildConfigTag, float > {{ enum {{ enabled = false }}; }}; +template<> struct ConfigTagReal< {problemBaseName}BuildConfigTag, long double > {{ enum {{ enabled = false }}; }}; /**** * Turn off support for short int and long int indexing. */ -template<> struct tnlConfigTagIndex< {problemBaseName}BuildConfigTag, short int >{{ enum {{ enabled = false }}; }}; -template<> struct tnlConfigTagIndex< {problemBaseName}BuildConfigTag, long int >{{ enum {{ enabled = false }}; }}; +template<> struct ConfigTagIndex< {problemBaseName}BuildConfigTag, short int >{{ enum {{ enabled = false }}; }}; +template<> struct ConfigTagIndex< {problemBaseName}BuildConfigTag, long int >{{ enum {{ enabled = false }}; }}; /**** * With how many dimensions may have the problem to be solved... */ -template< int Dimensions > struct tnlConfigTagDimensions< {problemName}BuildConfigTag, Dimensions >{{ enum {{ enabled = ( Dimensions == 1 ) }}; }}; +template< int Dimensions > struct ConfigTagDimensions< {problemBaseName}BuildConfigTag, Dimensions >{{ enum {{ enabled = ( Dimensions == 1 ) }}; }}; /**** * Use of tnlGrid is enabled for allowed dimensions and Real, Device and Index types. */ template< int Dimensions, typename Real, typename Device, typename Index > - struct tnlConfigTagMesh< {problemBaseName}BuildConfigTag, tnlGrid< Dimensions, Real, Device, Index > > - {{ enum {{ enabled = tnlConfigTagDimensions< {problemBaseName}BuildConfigTag, Dimensions >::enabled && - tnlConfigTagReal< {problemBaseName}BuildConfigTag, Real >::enabled && - tnlConfigTagDevice< {problemBaseName}BuildConfigTag, Device >::enabled && - tnlConfigTagIndex< {problemBaseName}BuildConfigTag, Index >::enabled }}; }}; + struct ConfigTagMesh< {problemBaseName}BuildConfigTag, Meshes::Grid< Dimensions, Real, Device, Index > > + {{ enum {{ enabled = ConfigTagDimensions< {problemBaseName}BuildConfigTag, Dimensions >::enabled && + ConfigTagReal< {problemBaseName}BuildConfigTag, Real >::enabled && + ConfigTagDevice< {problemBaseName}BuildConfigTag, Device >::enabled && + ConfigTagIndex< {problemBaseName}BuildConfigTag, Index >::enabled }}; }}; /**** * Please, chose your preferred time discretization here. */ -template<> struct tnlConfigTagTimeDiscretisation< {problemBaseName}BuildConfigTag, tnlExplicitTimeDiscretisationTag >{{ enum {{ enabled = true }}; }}; -template<> struct tnlConfigTagTimeDiscretisation< {problemBaseName}BuildConfigTag, tnlSemiImplicitTimeDiscretisationTag >{{ enum {{ enabled = true }}; }}; -template<> struct tnlConfigTagTimeDiscretisation< {problemBaseName}BuildConfigTag, tnlImplicitTimeDiscretisationTag >{{ enum {{ enabled = false }}; }}; +template<> struct ConfigTagTimeDiscretisation< {problemBaseName}BuildConfigTag, tnlExplicitTimeDiscretisationTag >{{ enum {{ enabled = true }}; }}; +template<> struct ConfigTagTimeDiscretisation< {problemBaseName}BuildConfigTag, tnlSemiImplicitTimeDiscretisationTag >{{ enum {{ enabled = true }}; }}; +template<> struct ConfigTagTimeDiscretisation< {problemBaseName}BuildConfigTag, tnlImplicitTimeDiscretisationTag >{{ enum {{ enabled = false }}; }}; /**** * Only the Runge-Kutta-Merson solver is enabled by default. */ -template<> struct tnlConfigTagExplicitSolver< {problemBaseName}BuildConfigTag, tnlExplicitEulerSolverTag >{{ enum {{ enabled = false }}; }}; \ No newline at end of file +template<> struct ConfigTagExplicitSolver< {problemBaseName}BuildConfigTag, tnlExplicitEulerSolverTag >{{ enum {{ enabled = false }}; }}; + +}} // namespace Solvers +}} // namespace TNL \ No newline at end of file diff --git a/src/Tools/tnl-quickstart/main.h.in b/src/Tools/tnl-quickstart/main.h.in index 494aec1b56..52fc833532 100644 --- a/src/Tools/tnl-quickstart/main.h.in +++ b/src/Tools/tnl-quickstart/main.h.in @@ -59,8 +59,8 @@ class {problemBaseName}Setter static bool run( const Config::ParameterContainer & parameters ) {{ enum {{ Dimensions = MeshType::getMeshDimensions() }}; - typedef " + operatorName + "< MeshType, Real, Index > ApproximateOperator; - typedef " + problemBaseName + "Rhs< MeshType, Real > RightHandSide; + typedef {operatorName}< MeshType, Real, Index > ApproximateOperator; + typedef {problemBaseName}Rhs< MeshType, Real > RightHandSide; typedef Containers::StaticVector < MeshType::getMeshDimensions(), Real > Vertex; /**** @@ -93,7 +93,7 @@ class {problemBaseName}Setter return solverStarter.template run< Problem >( parameters ); }} typedef Operators::NeumannBoundaryConditions< MeshType, MeshFunction, Real, Index > BoundaryConditions; - typedef " + problemBaseName + "Problem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Problem; + typedef {problemBaseName}Problem< MeshType, BoundaryConditions, RightHandSide, ApproximateOperator > Problem; SolverStarter solverStarter; return solverStarter.template run< Problem >( parameters ); }} diff --git a/src/Tools/tnl-quickstart/operator-grid-specialization.h.in b/src/Tools/tnl-quickstart/operator-grid-specialization.h.in index e2b84bc63d..a65f3f9548 100644 --- a/src/Tools/tnl-quickstart/operator-grid-specialization.h.in +++ b/src/Tools/tnl-quickstart/operator-grid-specialization.h.in @@ -3,18 +3,18 @@ template< typename MeshReal, typename MeshIndex, typename Real, typename Index > -class {operatorName}< tnlGrid< {meshDimensions}, MeshReal, Device, MeshIndex >, Real, Index > +class {operatorName}< TNL::Meshes::Grid< {meshDimensions}, MeshReal, Device, MeshIndex >, Real, Index > {{ public: - typedef tnlGrid< {meshDimensions}, MeshReal, Device, MeshIndex > MeshType; + typedef TNL::Meshes::Grid< {meshDimensions}, MeshReal, Device, MeshIndex > MeshType; typedef typename MeshType::CoordinatesType CoordinatesType; typedef Real RealType; typedef Device DeviceType; typedef Index IndexType; - typedef tnlMeshFunction< MeshType > MeshFunctionType; + typedef TNL::Functions::MeshFunction< MeshType > MeshFunctionType; enum {{ Dimensions = MeshType::getMeshDimensions() }}; - static tnlString getType(); + static TNL::String getType(); template< typename MeshFunction, typename MeshEntity > __cuda_callable__ diff --git a/src/Tools/tnl-quickstart/operator-grid-specialization_impl.h.in b/src/Tools/tnl-quickstart/operator-grid-specialization_impl.h.in index 1839fdc376..2e975772fc 100644 --- a/src/Tools/tnl-quickstart/operator-grid-specialization_impl.h.in +++ b/src/Tools/tnl-quickstart/operator-grid-specialization_impl.h.in @@ -6,14 +6,14 @@ template< typename MeshReal, typename MeshIndex, typename Real, typename Index > -tnlString -{operatorName}< tnlGrid< {meshDimensions}, MeshReal, Device, MeshIndex >, Real, Index >:: +TNL::String +{operatorName}< TNL::Meshes::Grid< {meshDimensions}, MeshReal, Device, MeshIndex >, Real, Index >:: getType() {{ return TNL::String( "{operatorName}< " ) + MeshType::getType() + ", " + - ::getType< Real >() + ", " + - ::getType< Index >() + " >"; + TNL::getType< Real >() + ", " + + TNL::getType< Index >() + " >"; }} template< typename MeshReal, @@ -24,7 +24,7 @@ template< typename MeshReal, template< typename MeshFunction, typename MeshEntity > __cuda_callable__ Real -{operatorName}< tnlGrid< {meshDimensions}, MeshReal, Device, MeshIndex >, Real, Index >:: +{operatorName}< TNL::Meshes::Grid< {meshDimensions}, MeshReal, Device, MeshIndex >, Real, Index >:: operator()( const MeshFunction& u, const MeshEntity& entity, const Real& time ) const @@ -34,8 +34,8 @@ 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." ); \n' ) - static_assert( MeshFunction::getEntitiesDimensions() == {meshDimensions}, "Wrong preimage function" ); \n' ) + 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(); {explicitScheme} @@ -49,7 +49,7 @@ template< typename MeshReal, template< typename MeshEntity > __cuda_callable__ Index -{operatorName}< tnlGrid< {meshDimensions}, MeshReal, Device, MeshIndex >, Real, Index >:: +{operatorName}< TNL::Meshes::Grid< {meshDimensions}, MeshReal, Device, MeshIndex >, Real, Index >:: getLinearSystemRowLength( const MeshType& mesh, const IndexType& index, const MeshEntity& entity ) const @@ -72,7 +72,7 @@ template< typename MeshReal, template< typename MeshEntity, typename Vector, typename MatrixRow > __cuda_callable__ void -{operatorName}< tnlGrid< {meshDimensions}, MeshReal, Device, MeshIndex >, Real, Index >:: +{operatorName}< TNL::Meshes::Grid< {meshDimensions}, MeshReal, Device, MeshIndex >, Real, Index >:: updateLinearSystem( const RealType& time, const RealType& tau, const MeshType& mesh, diff --git a/src/Tools/tnl-quickstart/problem.h.in b/src/Tools/tnl-quickstart/problem.h.in index 57b14ae66e..d5df0a9aad 100644 --- a/src/Tools/tnl-quickstart/problem.h.in +++ b/src/Tools/tnl-quickstart/problem.h.in @@ -8,7 +8,7 @@ template< typename Mesh, typename RightHandSide, typename DifferentialOperator > class {problemBaseName}Problem: - public tnlPDEProblem< Mesh, + public TNL::Problems::PDEProblem< Mesh, typename DifferentialOperator::RealType, typename Mesh::DeviceType, typename DifferentialOperator::IndexType > diff --git a/src/Tools/tnl-quickstart/problem_impl.h.in b/src/Tools/tnl-quickstart/problem_impl.h.in index 9a2153a949..1180acf52e 100644 --- a/src/Tools/tnl-quickstart/problem_impl.h.in +++ b/src/Tools/tnl-quickstart/problem_impl.h.in @@ -4,28 +4,29 @@ #include <TNL/Matrices/MatrixSetter.h> #include <TNL/Solvers/PDE/ExplicitUpdater.h> #include <TNL/Solvers/PDE/LinearSystemAssembler.h> +#include <TNL/Solvers/PDE/BoundaryConditionsSetter.h> #include <TNL/Solvers/PDE/BackwardTimeDiscretisation.h> template< typename Mesh, typename BoundaryCondition, typename RightHandSide, typename DifferentialOperator > -String +TNL::String {problemBaseName}Problem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >:: getTypeStatic() {{ - return String( "{problemBaseName}Problem< " ) + Mesh :: getTypeStatic() + " >"; + return TNL::String( "{problemBaseName}Problem< " ) + Mesh :: getTypeStatic() + " >"; }} template< typename Mesh, typename BoundaryCondition, typename RightHandSide, typename DifferentialOperator > -String +TNL::String {problemBaseName}Problem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >:: getPrologHeader() const {{ - return String( "{problemName}" ); + return TNL::String( "{problemName}" ); }} template< typename Mesh, @@ -48,7 +49,7 @@ template< typename Mesh, typename DifferentialOperator > bool {problemBaseName}Problem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >:: -setup( const tnlParameterContainer& parameters ) +setup( const TNL::Config::ParameterContainer& parameters ) {{ if( ! this->boundaryCondition.setup( parameters, "boundary-conditions-" ) || ! this->rightHandSide.setup( parameters, "right-hand-side-" ) ) @@ -88,16 +89,16 @@ template< typename Mesh, typename DifferentialOperator > bool {problemBaseName}Problem< Mesh, BoundaryCondition, RightHandSide, DifferentialOperator >:: -setInitialCondition( const tnlParameterContainer& parameters, +setInitialCondition( const TNL::Config::ParameterContainer& parameters, const MeshType& mesh, DofVectorType& dofs, MeshDependentDataType& meshDependentData ) {{ - const String& initialConditionFile = parameters.getParameter< String >( "initial-condition" ); + const TNL::String& initialConditionFile = parameters.getParameter< TNL::String >( "initial-condition" ); TNL::Functions::MeshFunction< Mesh > u( mesh, dofs ); if( ! u.boundLoad( initialConditionFile ) ) {{ - cerr << "I am not able to load the initial condition from the file " << initialConditionFile << "." << endl; + std::cerr << "I am not able to load the initial condition from the file " << initialConditionFile << "." << std::endl; return false; }} return true; @@ -141,9 +142,9 @@ makeSnapshot( const RealType& time, DofVectorType& dofs, MeshDependentDataType& meshDependentData ) {{ - cout << endl << "Writing output at time " << time << " step " << step << "." << endl; + std::cout << std::endl << "Writing output at time " << time << " step " << step << "." << std::endl; this->bindDofs( mesh, dofs ); - FileName fileName; + TNL::FileName fileName; fileName.setFileNameBase( "u-" ); fileName.setExtension( "tnl" ); fileName.setIndex( step ); @@ -185,7 +186,7 @@ getExplicitRHS( const RealType& time, this->rightHandSide, u, fu ); - tnlBoundaryConditionsSetter< MeshFunctionType, BoundaryCondition > boundaryConditionsSetter; + TNL::Solvers::PDE::BoundaryConditionsSetter< MeshFunctionType, BoundaryCondition > boundaryConditionsSetter; boundaryConditionsSetter.template apply< typename Mesh::Cell >( this->boundaryCondition, time + tau, @@ -212,7 +213,7 @@ assemblyLinearSystem( const RealType& time, DifferentialOperator, BoundaryCondition, RightHandSide, - tnlBackwardTimeDiscretisation, + TNL::Solvers::PDE::BackwardTimeDiscretisation, Matrix, DofVectorType > systemAssembler; diff --git a/src/Tools/tnl-quickstart/rhs.h.in b/src/Tools/tnl-quickstart/rhs.h.in index 295b5ea17c..71f3d1e79e 100644 --- a/src/Tools/tnl-quickstart/rhs.h.in +++ b/src/Tools/tnl-quickstart/rhs.h.in @@ -4,15 +4,15 @@ template< typename Mesh, typename Real > class {problemBaseName}Rhs - : public tnlDomain< Mesh::meshDimensions, MeshDomain > + : public TNL::Functions::Domain< Mesh::meshDimensions, TNL::Functions::MeshDomain > {{ public: typedef Mesh MeshType; typedef Real RealType; - bool setup( const tnlParameterContainer& parameters, - const tnlString& prefix = "" ) + bool setup( const TNL::Config::ParameterContainer& parameters, + const TNL::String& prefix = "" ) {{ return true; }} diff --git a/tests/benchmarks/heat-equation-benchmark/HeatEquationBenchmarkBuildConfigTag.h b/tests/benchmarks/heat-equation-benchmark/HeatEquationBenchmarkBuildConfigTag.h index 7f38e2b4ee..d80f2293d8 100644 --- a/tests/benchmarks/heat-equation-benchmark/HeatEquationBenchmarkBuildConfigTag.h +++ b/tests/benchmarks/heat-equation-benchmark/HeatEquationBenchmarkBuildConfigTag.h @@ -33,15 +33,15 @@ template< int Dimensions, typename Real, typename Device, typename Index > /**** * Please, chose your preferred time discretisation here. */ -template<> struct ConfigTagTimeDiscretisation< HeatEquationBenchmarkBuildConfigTag, tnlExplicitTimeDiscretisationTag >{ enum { enabled = true }; }; -template<> struct ConfigTagTimeDiscretisation< HeatEquationBenchmarkBuildConfigTag, tnlSemiImplicitTimeDiscretisationTag >{ enum { enabled = false }; }; -template<> struct ConfigTagTimeDiscretisation< HeatEquationBenchmarkBuildConfigTag, tnlImplicitTimeDiscretisationTag >{ enum { enabled = false }; }; +template<> struct ConfigTagTimeDiscretisation< HeatEquationBenchmarkBuildConfigTag, ExplicitTimeDiscretisationTag >{ enum { enabled = true }; }; +template<> struct ConfigTagTimeDiscretisation< HeatEquationBenchmarkBuildConfigTag, SemiImplicitTimeDiscretisationTag >{ enum { enabled = false }; }; +template<> struct ConfigTagTimeDiscretisation< HeatEquationBenchmarkBuildConfigTag, ImplicitTimeDiscretisationTag >{ enum { enabled = false }; }; /**** * Only the Runge-Kutta-Merson solver is enabled by default. */ -template<> struct ConfigTagExplicitSolver< HeatEquationBenchmarkBuildConfigTag, tnlExplicitEulerSolverTag >{ enum { enabled = true }; }; -template<> struct ConfigTagExplicitSolver< HeatEquationBenchmarkBuildConfigTag, tnlExplicitMersonSolverTag >{ enum { enabled = false }; }; +template<> struct ConfigTagExplicitSolver< HeatEquationBenchmarkBuildConfigTag, ExplicitEulerSolverTag >{ enum { enabled = true }; }; +template<> struct ConfigTagExplicitSolver< HeatEquationBenchmarkBuildConfigTag, ExplicitMersonSolverTag >{ enum { enabled = false }; }; } // namespace Solvers } // namespace TNL -- GitLab