Commit 143ba017 authored by grandper's avatar grandper
Browse files

first work on templatization

parent 916f1fde
...@@ -72,7 +72,7 @@ const Int NavierStokesCavity::TOPCORNER3 = 25; ...@@ -72,7 +72,7 @@ const Int NavierStokesCavity::TOPCORNER3 = 25;
const Int NavierStokesCavity::TOPCORNER4 = 26; const Int NavierStokesCavity::TOPCORNER4 = 26;
NavierStokesCavity::NavierStokesCavity() NavierStokesCavity::NavierStokesCavity()
: NavierStokesProblem() : NavierStokesProblem< RegionMesh< LinearTetra > >()
{ {
} }
......
...@@ -35,12 +35,13 @@ ...@@ -35,12 +35,13 @@
#ifndef NAVIERSTOKESCAVITY_HPP #ifndef NAVIERSTOKESCAVITY_HPP
#define NAVIERSTOKESCAVITY_HPP #define NAVIERSTOKESCAVITY_HPP
#include <lifev/core/mesh/RegionMesh.hpp>
#include <lifev/navier_stokes/solver/NavierStokesSolver/NavierStokesProblem.hpp> #include <lifev/navier_stokes/solver/NavierStokesSolver/NavierStokesProblem.hpp>
namespace LifeV namespace LifeV
{ {
class NavierStokesCavity : public NavierStokesProblem class NavierStokesCavity : public NavierStokesProblem< RegionMesh< LinearTetra > >
{ {
private: private:
......
...@@ -74,7 +74,7 @@ const Int NavierStokesEthierSteinman::TOPCORNER3 = 25; ...@@ -74,7 +74,7 @@ const Int NavierStokesEthierSteinman::TOPCORNER3 = 25;
const Int NavierStokesEthierSteinman::TOPCORNER4 = 26; const Int NavierStokesEthierSteinman::TOPCORNER4 = 26;
NavierStokesEthierSteinman::NavierStokesEthierSteinman() NavierStokesEthierSteinman::NavierStokesEthierSteinman()
: NavierStokesProblem() : NavierStokesProblem< RegionMesh< LinearTetra > >()
{ {
RossEthierSteinmanUnsteadyDec::setA ( 1.0 ); RossEthierSteinmanUnsteadyDec::setA ( 1.0 );
RossEthierSteinmanUnsteadyDec::setD ( 1.0 ); RossEthierSteinmanUnsteadyDec::setD ( 1.0 );
......
...@@ -35,12 +35,13 @@ ...@@ -35,12 +35,13 @@
#ifndef NAVIERSTOKESETHIERSTEINMAN_HPP #ifndef NAVIERSTOKESETHIERSTEINMAN_HPP
#define NAVIERSTOKESETHIERSTEINMAN_HPP #define NAVIERSTOKESETHIERSTEINMAN_HPP
#include <lifev/core/mesh/RegionMesh.hpp>
#include <lifev/navier_stokes/solver/NavierStokesSolver/NavierStokesProblem.hpp> #include <lifev/navier_stokes/solver/NavierStokesSolver/NavierStokesProblem.hpp>
namespace LifeV namespace LifeV
{ {
class NavierStokesEthierSteinman : public NavierStokesProblem class NavierStokesEthierSteinman : public NavierStokesProblem< RegionMesh< LinearTetra > >
{ {
private: private:
......
...@@ -110,7 +110,7 @@ typedef InitPolicyInterpolation InitInter; ...@@ -110,7 +110,7 @@ typedef InitPolicyInterpolation InitInter;
typedef InitPolicyProjection<SolverPolicyLinearSolver> InitProj; typedef InitPolicyProjection<SolverPolicyLinearSolver> InitProj;
typedef ExporterPolicyNoExporter NoExporter; typedef ExporterPolicyNoExporter NoExporter;
typedef ExporterPolicyHDF5 HDF5Exporter; typedef ExporterPolicyHDF5 HDF5Exporter;
typedef NavierStokesSolver< InitStokes, SemiImplicit, HDF5Exporter > nsSolver_Type; typedef NavierStokesSolver< mesh_Type, InitStokes, SemiImplicit, HDF5Exporter > nsSolver_Type;
void setPreconditioner ( basePrecPtr_Type& precPtr, void setPreconditioner ( basePrecPtr_Type& precPtr,
const std::string& preconditionerName, const std::string& preconditionerName,
......
...@@ -37,88 +37,102 @@ ...@@ -37,88 +37,102 @@
namespace LifeV namespace LifeV
{ {
template< class mesh_Type >
Real Real
NavierStokesProblem::nullFunction( const Real&, const Real&, const Real&, NavierStokesProblem< mesh_Type >::nullFunction( const Real&, const Real&, const Real&,
const Real&, const ID& ) const Real&, const ID& )
{ {
return 0.0; return 0.0;
} }
NavierStokesProblem::NavierStokesProblem() template< class mesh_Type >
NavierStokesProblem< mesh_Type >::NavierStokesProblem()
: M_refinement ( 0 ), M_resourcesPath ( "" ), M_viscosity ( 1.0 ), M_density ( 1.0 ) : M_refinement ( 0 ), M_resourcesPath ( "" ), M_viscosity ( 1.0 ), M_density ( 1.0 )
{ {
} }
NavierStokesProblem::~NavierStokesProblem() template< class mesh_Type >
NavierStokesProblem< mesh_Type >::~NavierStokesProblem()
{ {
} }
template< class mesh_Type >
bool bool
NavierStokesProblem::hasExactSolution() const NavierStokesProblem< mesh_Type >::hasExactSolution() const
{ {
return false; return false;
} }
NavierStokesProblem::function_Type template< class mesh_Type >
NavierStokesProblem::xexact() NavierStokesProblem< mesh_Type >::function_Type
NavierStokesProblem< mesh_Type >::xexact()
{ {
return 0; return 0;
} }
NavierStokesProblem::function_Type template< class mesh_Type >
NavierStokesProblem::uexact() NavierStokesProblem< mesh_Type >::function_Type
NavierStokesProblem< mesh_Type >::uexact()
{ {
return 0; return 0;
} }
NavierStokesProblem::function_Type template< class mesh_Type >
NavierStokesProblem::uderexact() NavierStokesProblem< mesh_Type >::function_Type
NavierStokesProblem< mesh_Type >::uderexact()
{ {
return 0; return 0;
} }
NavierStokesProblem::function_Type template< class mesh_Type >
NavierStokesProblem::pexact() NavierStokesProblem< mesh_Type >::function_Type
NavierStokesProblem< mesh_Type >::pexact()
{ {
return 0; return 0;
} }
template< class mesh_Type >
void void
NavierStokesProblem::setMesh ( const UInt& refinement, NavierStokesProblem< mesh_Type >::setMesh ( const UInt& refinement,
const std::string& resourcesPath ) const std::string& resourcesPath )
{ {
M_refinement = refinement; M_refinement = refinement;
M_resourcesPath = resourcesPath; M_resourcesPath = resourcesPath;
} }
template< class mesh_Type >
void void
NavierStokesProblem::setViscosity ( const Real& viscosity ) NavierStokesProblem< mesh_Type >::setViscosity ( const Real& viscosity )
{ {
M_viscosity = viscosity; M_viscosity = viscosity;
} }
template< class mesh_Type >
void void
NavierStokesProblem::setDensity ( const Real& density ) NavierStokesProblem< mesh_Type >::setDensity ( const Real& density )
{ {
M_density = density; M_density = density;
} }
template< class mesh_Type >
Real Real
NavierStokesProblem::viscosity() const NavierStokesProblem< mesh_Type >::viscosity() const
{ {
return M_viscosity; return M_viscosity;
} }
template< class mesh_Type >
Real Real
NavierStokesProblem::density() const NavierStokesProblem< mesh_Type >::density() const
{ {
return M_density; return M_density;
} }
NavierStokesProblem::function_Type template< class mesh_Type >
NavierStokesProblem::force() NavierStokesProblem< mesh_Type >::function_Type
NavierStokesProblem< mesh_Type >::force()
{ {
return nullFunction; return nullFunction;
} }
......
...@@ -39,13 +39,13 @@ ...@@ -39,13 +39,13 @@
#include <iostream> #include <iostream>
#include <lifev/core/LifeV.hpp> #include <lifev/core/LifeV.hpp>
#include <lifev/core/fem/BCHandler.hpp> #include <lifev/core/fem/BCHandler.hpp>
#include <lifev/core/mesh/RegionMesh.hpp>
#include <lifev/core/mesh/MeshPartitioner.hpp> #include <lifev/core/mesh/MeshPartitioner.hpp>
#include <lifev/core/fem/BCBase.hpp> #include <lifev/core/fem/BCBase.hpp>
namespace LifeV namespace LifeV
{ {
template< class mesh_Type >
class NavierStokesProblem class NavierStokesProblem
{ {
public: public:
...@@ -116,7 +116,7 @@ public: ...@@ -116,7 +116,7 @@ public:
//@{ //@{
//! Getter for the problem mesh //! Getter for the problem mesh
virtual void mesh ( boost::shared_ptr< RegionMesh<LinearTetra> >& mesh ) const = 0; virtual void mesh ( boost::shared_ptr<mesh_Type>& mesh ) const = 0;
//! Getter for the boundary conditions in the provided BCHandler //! Getter for the boundary conditions in the provided BCHandler
/*! /*!
......
...@@ -78,7 +78,7 @@ ...@@ -78,7 +78,7 @@
namespace LifeV namespace LifeV
{ {
template< class InitPolicy, class TimeIterationPolicy, class ExporterPolicy = ExporterPolicyNoExporter > template< class mesh_Type, class InitPolicy, class TimeIterationPolicy, class ExporterPolicy = ExporterPolicyNoExporter >
class NavierStokesSolver : private InitPolicy, public virtual TimeIterationPolicy, private ExporterPolicy class NavierStokesSolver : private InitPolicy, public virtual TimeIterationPolicy, private ExporterPolicy
{ {
...@@ -91,7 +91,7 @@ public: ...@@ -91,7 +91,7 @@ public:
typedef boost::shared_ptr<VectorEpetra> vectorPtr_Type; typedef boost::shared_ptr<VectorEpetra> vectorPtr_Type;
typedef MapEpetra map_Type; typedef MapEpetra map_Type;
typedef boost::shared_ptr<map_Type> mapPtr_Type; typedef boost::shared_ptr<map_Type> mapPtr_Type;
typedef RegionMesh<LinearTetra> mesh_Type; // typedef RegionMesh<LinearTetra> mesh_Type;
typedef boost::shared_ptr<mesh_Type> meshPtr_Type; typedef boost::shared_ptr<mesh_Type> meshPtr_Type;
typedef FESpace< mesh_Type, map_Type > fespace_Type; typedef FESpace< mesh_Type, map_Type > fespace_Type;
typedef boost::shared_ptr< fespace_Type > fespacePtr_Type; typedef boost::shared_ptr< fespace_Type > fespacePtr_Type;
...@@ -221,22 +221,22 @@ private: ...@@ -221,22 +221,22 @@ private:
}; };
template< class InitPolicy, class TimeIterationPolicy, class ExporterPolicy > template< class mesh_Type, class InitPolicy, class TimeIterationPolicy, class ExporterPolicy >
NavierStokesSolver<InitPolicy, TimeIterationPolicy, ExporterPolicy>::NavierStokesSolver ( commPtr_Type comm ) : NavierStokesSolver<mesh_Type, InitPolicy, TimeIterationPolicy, ExporterPolicy>::NavierStokesSolver ( commPtr_Type comm ) :
M_comm ( comm ), M_displayer ( comm ) M_comm ( comm ), M_displayer ( comm )
{ {
} }
template< class InitPolicy, class TimeIterationPolicy, class ExporterPolicy > template< class mesh_Type, class InitPolicy, class TimeIterationPolicy, class ExporterPolicy >
NavierStokesSolver<InitPolicy, TimeIterationPolicy, ExporterPolicy>::~NavierStokesSolver() NavierStokesSolver<mesh_Type, InitPolicy, TimeIterationPolicy, ExporterPolicy>::~NavierStokesSolver()
{ {
} }
template< class InitPolicy, class TimeIterationPolicy, class ExporterPolicy > template< class mesh_Type, class InitPolicy, class TimeIterationPolicy, class ExporterPolicy >
void void
NavierStokesSolver<InitPolicy, TimeIterationPolicy, ExporterPolicy>::printErrors() NavierStokesSolver<mesh_Type, InitPolicy, TimeIterationPolicy, ExporterPolicy>::printErrors()
{ {
ASSERT ( M_nsProblem->hasExactSolution(), "The problem does not have an exact solution" ); ASSERT ( M_nsProblem->hasExactSolution(), "The problem does not have an exact solution" );
...@@ -256,16 +256,16 @@ NavierStokesSolver<InitPolicy, TimeIterationPolicy, ExporterPolicy>::printErrors ...@@ -256,16 +256,16 @@ NavierStokesSolver<InitPolicy, TimeIterationPolicy, ExporterPolicy>::printErrors
M_displayer.leaderPrint ( " Relative error: ", pRelativeError, "\n" ); M_displayer.leaderPrint ( " Relative error: ", pRelativeError, "\n" );
} }
template< class InitPolicy, class TimeIterationPolicy, class ExporterPolicy > template< class mesh_Type, class InitPolicy, class TimeIterationPolicy, class ExporterPolicy >
void void
NavierStokesSolver<InitPolicy, TimeIterationPolicy, ExporterPolicy>::setProblem ( NSProblemPtr_Type nsProblem ) NavierStokesSolver<mesh_Type, InitPolicy, TimeIterationPolicy, ExporterPolicy>::setProblem ( NSProblemPtr_Type nsProblem )
{ {
M_nsProblem = nsProblem; M_nsProblem = nsProblem;
} }
template< class InitPolicy, class TimeIterationPolicy, class ExporterPolicy > template< class mesh_Type, class InitPolicy, class TimeIterationPolicy, class ExporterPolicy >
void void
NavierStokesSolver<InitPolicy, TimeIterationPolicy, ExporterPolicy>::setup ( Teuchos::ParameterList& list ) NavierStokesSolver<mesh_Type, InitPolicy, TimeIterationPolicy, ExporterPolicy>::setup ( Teuchos::ParameterList& list )
{ {
ASSERT ( M_nsProblem.get() != 0, "NavierStokesSolver::init : Error: You must set a Navier-Stokes problem first." ); ASSERT ( M_nsProblem.get() != 0, "NavierStokesSolver::init : Error: You must set a Navier-Stokes problem first." );
...@@ -362,9 +362,9 @@ NavierStokesSolver<InitPolicy, TimeIterationPolicy, ExporterPolicy>::setup ( Teu ...@@ -362,9 +362,9 @@ NavierStokesSolver<InitPolicy, TimeIterationPolicy, ExporterPolicy>::setup ( Teu
} }
template< class InitPolicy, class TimeIterationPolicy, class ExporterPolicy > template< class mesh_Type, class InitPolicy, class TimeIterationPolicy, class ExporterPolicy >
void void
NavierStokesSolver<InitPolicy, TimeIterationPolicy, ExporterPolicy>::init() NavierStokesSolver<mesh_Type, InitPolicy, TimeIterationPolicy, ExporterPolicy>::init()
{ {
// Find an initial solution // Find an initial solution
InitPolicy::initSimulation ( M_bcHandler, InitPolicy::initSimulation ( M_bcHandler,
...@@ -381,9 +381,9 @@ NavierStokesSolver<InitPolicy, TimeIterationPolicy, ExporterPolicy>::init() ...@@ -381,9 +381,9 @@ NavierStokesSolver<InitPolicy, TimeIterationPolicy, ExporterPolicy>::init()
ExporterPolicy::exportSolution (); ExporterPolicy::exportSolution ();
} }
template< class InitPolicy, class TimeIterationPolicy, class ExporterPolicy > template< class mesh_Type, class InitPolicy, class TimeIterationPolicy, class ExporterPolicy >
void void
NavierStokesSolver<InitPolicy, TimeIterationPolicy, ExporterPolicy>::solve() NavierStokesSolver<mesh_Type, InitPolicy, TimeIterationPolicy, ExporterPolicy>::solve()
{ {
// Solving the problem // Solving the problem
M_displayer.leaderPrint ( "\n[Solving the problem]\n" ); M_displayer.leaderPrint ( "\n[Solving the problem]\n" );
...@@ -436,58 +436,58 @@ NavierStokesSolver<InitPolicy, TimeIterationPolicy, ExporterPolicy>::solve() ...@@ -436,58 +436,58 @@ NavierStokesSolver<InitPolicy, TimeIterationPolicy, ExporterPolicy>::solve()
ExporterPolicy::finalizeExporter(); ExporterPolicy::finalizeExporter();
} }
template< class InitPolicy, class TimeIterationPolicy, class ExporterPolicy > template< class mesh_Type, class InitPolicy, class TimeIterationPolicy, class ExporterPolicy >
typename NavierStokesSolver<InitPolicy, TimeIterationPolicy, ExporterPolicy>::NSProblemPtr_Type typename NavierStokesSolver< mesh_Type, InitPolicy, TimeIterationPolicy, ExporterPolicy>::NSProblemPtr_Type
NavierStokesSolver<InitPolicy, TimeIterationPolicy, ExporterPolicy>::problem() const NavierStokesSolver<mesh_Type, InitPolicy, TimeIterationPolicy, ExporterPolicy>::problem() const
{ {
return M_nsProblem; return M_nsProblem;
} }
template< class InitPolicy, class TimeIterationPolicy, class ExporterPolicy > template< class mesh_Type, class InitPolicy, class TimeIterationPolicy, class ExporterPolicy >
typename NavierStokesSolver<InitPolicy, TimeIterationPolicy, ExporterPolicy>::bcContainerPtr_Type typename NavierStokesSolver< mesh_Type, InitPolicy, TimeIterationPolicy, ExporterPolicy>::bcContainerPtr_Type
NavierStokesSolver<InitPolicy, TimeIterationPolicy, ExporterPolicy>::bcHandler() const NavierStokesSolver<mesh_Type, InitPolicy, TimeIterationPolicy, ExporterPolicy>::bcHandler() const
{ {
return M_bcHandler; return M_bcHandler;
} }
template< class InitPolicy, class TimeIterationPolicy, class ExporterPolicy > template< class mesh_Type, class InitPolicy, class TimeIterationPolicy, class ExporterPolicy >
typename NavierStokesSolver<InitPolicy, TimeIterationPolicy, ExporterPolicy>::fespacePtr_Type typename NavierStokesSolver< mesh_Type, InitPolicy, TimeIterationPolicy, ExporterPolicy>::fespacePtr_Type
NavierStokesSolver<InitPolicy, TimeIterationPolicy, ExporterPolicy>::uFESpace() const NavierStokesSolver<mesh_Type, InitPolicy, TimeIterationPolicy, ExporterPolicy>::uFESpace() const
{ {
return M_uFESpace; return M_uFESpace;
} }
template< class InitPolicy, class TimeIterationPolicy, class ExporterPolicy > template< class mesh_Type, class InitPolicy, class TimeIterationPolicy, class ExporterPolicy >
typename NavierStokesSolver<InitPolicy, TimeIterationPolicy, ExporterPolicy>::fespacePtr_Type typename NavierStokesSolver< mesh_Type, InitPolicy, TimeIterationPolicy, ExporterPolicy>::fespacePtr_Type
NavierStokesSolver<InitPolicy, TimeIterationPolicy, ExporterPolicy>::pFESpace() const NavierStokesSolver<mesh_Type, InitPolicy, TimeIterationPolicy, ExporterPolicy>::pFESpace() const
{ {
return M_pFESpace; return M_pFESpace;
} }
template< class InitPolicy, class TimeIterationPolicy, class ExporterPolicy > template< class mesh_Type, class InitPolicy, class TimeIterationPolicy, class ExporterPolicy >
Real Real
NavierStokesSolver<InitPolicy, TimeIterationPolicy, ExporterPolicy>::initialTime() const NavierStokesSolver<mesh_Type, InitPolicy, TimeIterationPolicy, ExporterPolicy>::initialTime() const
{ {
return M_initialTime; return M_initialTime;
} }
template< class InitPolicy, class TimeIterationPolicy, class ExporterPolicy > template< class mesh_Type, class InitPolicy, class TimeIterationPolicy, class ExporterPolicy >
Real Real
NavierStokesSolver<InitPolicy, TimeIterationPolicy, ExporterPolicy>::endTime() const NavierStokesSolver<mesh_Type, InitPolicy, TimeIterationPolicy, ExporterPolicy>::endTime() const
{ {
return M_endTime; return M_endTime;
} }
template< class InitPolicy, class TimeIterationPolicy, class ExporterPolicy > template< class mesh_Type, class InitPolicy, class TimeIterationPolicy, class ExporterPolicy >
Real Real
NavierStokesSolver<InitPolicy, TimeIterationPolicy, ExporterPolicy>::timestep() const NavierStokesSolver<mesh_Type, InitPolicy, TimeIterationPolicy, ExporterPolicy>::timestep() const
{ {
return M_timestep; return M_timestep;
} }
template< class InitPolicy, class TimeIterationPolicy, class ExporterPolicy > template< class mesh_Type, class InitPolicy, class TimeIterationPolicy, class ExporterPolicy >
Real Real
NavierStokesSolver<InitPolicy, TimeIterationPolicy, ExporterPolicy>::currentTime() const NavierStokesSolver<mesh_Type, InitPolicy, TimeIterationPolicy, ExporterPolicy>::currentTime() const
{ {
return M_currentTime; return M_currentTime;
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment