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;
const Int NavierStokesCavity::TOPCORNER4 = 26;
NavierStokesCavity::NavierStokesCavity()
: NavierStokesProblem()
: NavierStokesProblem< RegionMesh< LinearTetra > >()
{
}
......
......@@ -35,12 +35,13 @@
#ifndef NAVIERSTOKESCAVITY_HPP
#define NAVIERSTOKESCAVITY_HPP
#include <lifev/core/mesh/RegionMesh.hpp>
#include <lifev/navier_stokes/solver/NavierStokesSolver/NavierStokesProblem.hpp>
namespace LifeV
{
class NavierStokesCavity : public NavierStokesProblem
class NavierStokesCavity : public NavierStokesProblem< RegionMesh< LinearTetra > >
{
private:
......
......@@ -74,7 +74,7 @@ const Int NavierStokesEthierSteinman::TOPCORNER3 = 25;
const Int NavierStokesEthierSteinman::TOPCORNER4 = 26;
NavierStokesEthierSteinman::NavierStokesEthierSteinman()
: NavierStokesProblem()
: NavierStokesProblem< RegionMesh< LinearTetra > >()
{
RossEthierSteinmanUnsteadyDec::setA ( 1.0 );
RossEthierSteinmanUnsteadyDec::setD ( 1.0 );
......
......@@ -35,12 +35,13 @@
#ifndef NAVIERSTOKESETHIERSTEINMAN_HPP
#define NAVIERSTOKESETHIERSTEINMAN_HPP
#include <lifev/core/mesh/RegionMesh.hpp>
#include <lifev/navier_stokes/solver/NavierStokesSolver/NavierStokesProblem.hpp>
namespace LifeV
{
class NavierStokesEthierSteinman : public NavierStokesProblem
class NavierStokesEthierSteinman : public NavierStokesProblem< RegionMesh< LinearTetra > >
{
private:
......
......@@ -110,7 +110,7 @@ typedef InitPolicyInterpolation InitInter;
typedef InitPolicyProjection<SolverPolicyLinearSolver> InitProj;
typedef ExporterPolicyNoExporter NoExporter;
typedef ExporterPolicyHDF5 HDF5Exporter;
typedef NavierStokesSolver< InitStokes, SemiImplicit, HDF5Exporter > nsSolver_Type;
typedef NavierStokesSolver< mesh_Type, InitStokes, SemiImplicit, HDF5Exporter > nsSolver_Type;
void setPreconditioner ( basePrecPtr_Type& precPtr,
const std::string& preconditionerName,
......
......@@ -37,88 +37,102 @@
namespace LifeV
{
template< class mesh_Type >
Real
NavierStokesProblem::nullFunction( const Real&, const Real&, const Real&,
NavierStokesProblem< mesh_Type >::nullFunction( const Real&, const Real&, const Real&,
const Real&, const ID& )
{
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 )
{
}
NavierStokesProblem::~NavierStokesProblem()
template< class mesh_Type >
NavierStokesProblem< mesh_Type >::~NavierStokesProblem()
{
}
template< class mesh_Type >
bool
NavierStokesProblem::hasExactSolution() const
NavierStokesProblem< mesh_Type >::hasExactSolution() const
{
return false;
}
NavierStokesProblem::function_Type
NavierStokesProblem::xexact()
template< class mesh_Type >
NavierStokesProblem< mesh_Type >::function_Type
NavierStokesProblem< mesh_Type >::xexact()
{
return 0;
}
NavierStokesProblem::function_Type
NavierStokesProblem::uexact()
template< class mesh_Type >
NavierStokesProblem< mesh_Type >::function_Type
NavierStokesProblem< mesh_Type >::uexact()
{
return 0;
}
NavierStokesProblem::function_Type
NavierStokesProblem::uderexact()
template< class mesh_Type >
NavierStokesProblem< mesh_Type >::function_Type
NavierStokesProblem< mesh_Type >::uderexact()
{
return 0;
}
NavierStokesProblem::function_Type
NavierStokesProblem::pexact()
template< class mesh_Type >
NavierStokesProblem< mesh_Type >::function_Type
NavierStokesProblem< mesh_Type >::pexact()
{
return 0;
}
template< class mesh_Type >
void
NavierStokesProblem::setMesh ( const UInt& refinement,
NavierStokesProblem< mesh_Type >::setMesh ( const UInt& refinement,
const std::string& resourcesPath )
{
M_refinement = refinement;
M_resourcesPath = resourcesPath;
}
template< class mesh_Type >
void
NavierStokesProblem::setViscosity ( const Real& viscosity )
NavierStokesProblem< mesh_Type >::setViscosity ( const Real& viscosity )
{
M_viscosity = viscosity;
}
template< class mesh_Type >
void
NavierStokesProblem::setDensity ( const Real& density )
NavierStokesProblem< mesh_Type >::setDensity ( const Real& density )
{
M_density = density;
}
template< class mesh_Type >
Real
NavierStokesProblem::viscosity() const
NavierStokesProblem< mesh_Type >::viscosity() const
{
return M_viscosity;
}
template< class mesh_Type >
Real
NavierStokesProblem::density() const
NavierStokesProblem< mesh_Type >::density() const
{
return M_density;
}
NavierStokesProblem::function_Type
NavierStokesProblem::force()
template< class mesh_Type >
NavierStokesProblem< mesh_Type >::function_Type
NavierStokesProblem< mesh_Type >::force()
{
return nullFunction;
}
......
......@@ -39,13 +39,13 @@
#include <iostream>
#include <lifev/core/LifeV.hpp>
#include <lifev/core/fem/BCHandler.hpp>
#include <lifev/core/mesh/RegionMesh.hpp>
#include <lifev/core/mesh/MeshPartitioner.hpp>
#include <lifev/core/fem/BCBase.hpp>
namespace LifeV
{
template< class mesh_Type >
class NavierStokesProblem
{
public:
......@@ -116,7 +116,7 @@ public:
//@{
//! 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
/*!
......
......@@ -78,7 +78,7 @@
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
{
......@@ -91,7 +91,7 @@ public:
typedef boost::shared_ptr<VectorEpetra> vectorPtr_Type;
typedef MapEpetra map_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 FESpace< mesh_Type, map_Type > fespace_Type;
typedef boost::shared_ptr< fespace_Type > fespacePtr_Type;
......@@ -221,22 +221,22 @@ private:
};
template< class InitPolicy, class TimeIterationPolicy, class ExporterPolicy >
NavierStokesSolver<InitPolicy, TimeIterationPolicy, ExporterPolicy>::NavierStokesSolver ( commPtr_Type comm ) :
template< class mesh_Type, class InitPolicy, class TimeIterationPolicy, class ExporterPolicy >
NavierStokesSolver<mesh_Type, InitPolicy, TimeIterationPolicy, ExporterPolicy>::NavierStokesSolver ( commPtr_Type comm ) :
M_comm ( comm ), M_displayer ( comm )
{
}
template< class InitPolicy, class TimeIterationPolicy, class ExporterPolicy >
NavierStokesSolver<InitPolicy, TimeIterationPolicy, ExporterPolicy>::~NavierStokesSolver()
template< class mesh_Type, class InitPolicy, class TimeIterationPolicy, class ExporterPolicy >
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
NavierStokesSolver<InitPolicy, TimeIterationPolicy, ExporterPolicy>::printErrors()
NavierStokesSolver<mesh_Type, InitPolicy, TimeIterationPolicy, ExporterPolicy>::printErrors()
{
ASSERT ( M_nsProblem->hasExactSolution(), "The problem does not have an exact solution" );
......@@ -256,16 +256,16 @@ NavierStokesSolver<InitPolicy, TimeIterationPolicy, ExporterPolicy>::printErrors
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
NavierStokesSolver<InitPolicy, TimeIterationPolicy, ExporterPolicy>::setProblem ( NSProblemPtr_Type nsProblem )
NavierStokesSolver<mesh_Type, InitPolicy, TimeIterationPolicy, ExporterPolicy>::setProblem ( NSProblemPtr_Type nsProblem )
{
M_nsProblem = nsProblem;
}
template< class InitPolicy, class TimeIterationPolicy, class ExporterPolicy >
template< class mesh_Type, class InitPolicy, class TimeIterationPolicy, class ExporterPolicy >
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." );
......@@ -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
NavierStokesSolver<InitPolicy, TimeIterationPolicy, ExporterPolicy>::init()
NavierStokesSolver<mesh_Type, InitPolicy, TimeIterationPolicy, ExporterPolicy>::init()
{
// Find an initial solution
InitPolicy::initSimulation ( M_bcHandler,
......@@ -381,9 +381,9 @@ NavierStokesSolver<InitPolicy, TimeIterationPolicy, ExporterPolicy>::init()
ExporterPolicy::exportSolution ();
}
template< class InitPolicy, class TimeIterationPolicy, class ExporterPolicy >
template< class mesh_Type, class InitPolicy, class TimeIterationPolicy, class ExporterPolicy >
void
NavierStokesSolver<InitPolicy, TimeIterationPolicy, ExporterPolicy>::solve()
NavierStokesSolver<mesh_Type, InitPolicy, TimeIterationPolicy, ExporterPolicy>::solve()
{
// Solving the problem
M_displayer.leaderPrint ( "\n[Solving the problem]\n" );
......@@ -436,58 +436,58 @@ NavierStokesSolver<InitPolicy, TimeIterationPolicy, ExporterPolicy>::solve()
ExporterPolicy::finalizeExporter();
}
template< class InitPolicy, class TimeIterationPolicy, class ExporterPolicy >
typename NavierStokesSolver<InitPolicy, TimeIterationPolicy, ExporterPolicy>::NSProblemPtr_Type
NavierStokesSolver<InitPolicy, TimeIterationPolicy, ExporterPolicy>::problem() const
template< class mesh_Type, class InitPolicy, class TimeIterationPolicy, class ExporterPolicy >
typename NavierStokesSolver< mesh_Type, InitPolicy, TimeIterationPolicy, ExporterPolicy>::NSProblemPtr_Type
NavierStokesSolver<mesh_Type, InitPolicy, TimeIterationPolicy, ExporterPolicy>::problem() const
{
return M_nsProblem;
}
template< class InitPolicy, class TimeIterationPolicy, class ExporterPolicy >
typename NavierStokesSolver<InitPolicy, TimeIterationPolicy, ExporterPolicy>::bcContainerPtr_Type
NavierStokesSolver<InitPolicy, TimeIterationPolicy, ExporterPolicy>::bcHandler() const
template< class mesh_Type, class InitPolicy, class TimeIterationPolicy, class ExporterPolicy >
typename NavierStokesSolver< mesh_Type, InitPolicy, TimeIterationPolicy, ExporterPolicy>::bcContainerPtr_Type
NavierStokesSolver<mesh_Type, InitPolicy, TimeIterationPolicy, ExporterPolicy>::bcHandler() const
{
return M_bcHandler;
}
template< class InitPolicy, class TimeIterationPolicy, class ExporterPolicy >
typename NavierStokesSolver<InitPolicy, TimeIterationPolicy, ExporterPolicy>::fespacePtr_Type
NavierStokesSolver<InitPolicy, TimeIterationPolicy, ExporterPolicy>::uFESpace() const
template< class mesh_Type, class InitPolicy, class TimeIterationPolicy, class ExporterPolicy >
typename NavierStokesSolver< mesh_Type, InitPolicy, TimeIterationPolicy, ExporterPolicy>::fespacePtr_Type
NavierStokesSolver<mesh_Type, InitPolicy, TimeIterationPolicy, ExporterPolicy>::uFESpace() const
{
return M_uFESpace;
}
template< class InitPolicy, class TimeIterationPolicy, class ExporterPolicy >
typename NavierStokesSolver<InitPolicy, TimeIterationPolicy, ExporterPolicy>::fespacePtr_Type
NavierStokesSolver<InitPolicy, TimeIterationPolicy, ExporterPolicy>::pFESpace() const
template< class mesh_Type, class InitPolicy, class TimeIterationPolicy, class ExporterPolicy >
typename NavierStokesSolver< mesh_Type, InitPolicy, TimeIterationPolicy, ExporterPolicy>::fespacePtr_Type
NavierStokesSolver<mesh_Type, InitPolicy, TimeIterationPolicy, ExporterPolicy>::pFESpace() const
{
return M_pFESpace;
}
template< class InitPolicy, class TimeIterationPolicy, class ExporterPolicy >
template< class mesh_Type, class InitPolicy, class TimeIterationPolicy, class ExporterPolicy >
Real
NavierStokesSolver<InitPolicy, TimeIterationPolicy, ExporterPolicy>::initialTime() const
NavierStokesSolver<mesh_Type, InitPolicy, TimeIterationPolicy, ExporterPolicy>::initialTime() const
{
return M_initialTime;
}
template< class InitPolicy, class TimeIterationPolicy, class ExporterPolicy >
template< class mesh_Type, class InitPolicy, class TimeIterationPolicy, class ExporterPolicy >
Real
NavierStokesSolver<InitPolicy, TimeIterationPolicy, ExporterPolicy>::endTime() const
NavierStokesSolver<mesh_Type, InitPolicy, TimeIterationPolicy, ExporterPolicy>::endTime() const
{
return M_endTime;
}
template< class InitPolicy, class TimeIterationPolicy, class ExporterPolicy >
template< class mesh_Type, class InitPolicy, class TimeIterationPolicy, class ExporterPolicy >
Real
NavierStokesSolver<InitPolicy, TimeIterationPolicy, ExporterPolicy>::timestep() const
NavierStokesSolver<mesh_Type, InitPolicy, TimeIterationPolicy, ExporterPolicy>::timestep() const
{
return M_timestep;
}
template< class InitPolicy, class TimeIterationPolicy, class ExporterPolicy >
template< class mesh_Type, class InitPolicy, class TimeIterationPolicy, class ExporterPolicy >
Real
NavierStokesSolver<InitPolicy, TimeIterationPolicy, ExporterPolicy>::currentTime() const
NavierStokesSolver<mesh_Type, InitPolicy, TimeIterationPolicy, ExporterPolicy>::currentTime() const
{
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