Commit 08444e9e authored by GILLES Sebastien's avatar GILLES Sebastien
Browse files

#875 ParameterAtDof: improve the syntax.

parent 08140c8b
......@@ -90,7 +90,7 @@ namespace HappyHeart
using parent = Parameter<TypeT>;
//! Alias to underlying parameter.
using parameter_type = ParameterAtDof<TypeT>;
using parameter_type = typename ParameterAtDof<TypeT>::type;
//! 'Inherit' alias from parent.
using return_type = typename parent::return_type;
......
......@@ -46,13 +46,28 @@ namespace HappyHeart
* at dofs may evolve should this vector change.
*
*/
template<ParameterNS::Type TypeT>
using ParameterAtDof = Private::ParameterInstance<TypeT, ParameterNS::Policy::AtDof>;
template
<
ParameterNS::Type TypeT,
unsigned int NfeltSpace = 1
>
struct ParameterAtDof
{
private:
template<ParameterNS::Type TypeTT>
using intermediate_policy_type = ParameterNS::Policy::AtDofImpl<TypeTT, NfeltSpace>;
public:
using type = Private::ParameterInstance<TypeT, intermediate_policy_type>;
};
template<ParameterNS::Type TypeT>
using ParameterAtDof_2FEltSpace = Private::ParameterInstance<TypeT, ParameterNS::Policy::AtDof_2FEltSpace>;
//
// template<ParameterNS::Type TypeT>
// using ParameterAtDof_2FEltSpace = Private::ParameterInstance<TypeT, ParameterNS::Policy::AtDof_2FEltSpace>;
//
} // namespace HappyHeart
......
......@@ -106,13 +106,11 @@ namespace HappyHeart
/// \name Special members.
///@{
/*!
* \brief Constructor.
/*!
* \class doxygen_hide_at_dof_impl_constructor_args
*
* \param[in] mesh Geometric mesh region considered. It is actually unused in this policy, but this is
* a staple of policy usage and must be provided.
* \param[in] felt_space Finite element space that covers the area upon which the parameter should be
* defined. This finite element space should cover the underlying \a NumberingSubset of \a global_vector.
* \param[in] unknown A scalar or vectorial unknown that acts a bit as a strawman: dofs are defined only
* in relationship to an unknown, so you must create one if none fulfill your purposes (for instance
* if you deal with a vectorial unknown and need a scalar Dof field, you must create another unknown
......@@ -120,9 +118,22 @@ namespace HappyHeart
* but this is not mandatory.
* \param[in] global_vector The vector which includes the actual values at the dofs. The values
* at dofs may evolve should this vector change.
* \todo #700 Introduce a policy here so that constant values in time may be addressed with more
* efficiency (currently values at quadrature points are recomputed each time a value is required
*
* \todo #700 Introduce a policy here so that constant values in time may be addressed with more
* efficiency (currently values at quadrature points are recomputed each time a value is required
* there).
*/
/*!
* \brief Constructor when Parameter cover only one \a FEltSpace.
*
* This should be the more frequent case.
*
* \copydetails doxygen_hide_at_dof_impl_constructor_args
* \param[in] felt_space Finite element space that covers the area upon which the parameter should be
* defined. This finite element space should cover the underlying \a NumberingSubset of \a global_vector.
*
*/
explicit AtDofImpl(const GeometricMeshRegion& mesh,
......@@ -131,6 +142,20 @@ namespace HappyHeart
const GlobalVector& global_vector);
/*!
* \brief Constructor when Parameter cover two \a FEltSpace: one for mesh dimension and another for
* the dimension immediately below.
*
* This should be the more frequent case.
*
* \copydetails doxygen_hide_at_dof_impl_constructor_args
* \param[in] felt_space_dim Finite element space that covers the area upon which the parameter should be
* defined for the dimension of the mesh. This finite element space should cover the underlying
* \a NumberingSubset of \a global_vector.
* \param[in] felt_space_dim_minus_1 Same as \a felt_space_dim except it covers the dimension minus 1
* (e.g. finite element space that cover borders on a 2D mesh).
*
*/
explicit AtDofImpl(const GeometricMeshRegion& mesh,
const FEltSpace& felt_space_dim,
const FEltSpace& felt_space_dim_minus_1,
......@@ -234,6 +259,10 @@ namespace HappyHeart
};
// template<ParameterNS::Type TypeT, unsigned int NfeltSpace>
// using AtDof = AtDofImpl<TypeT, NfeltSpace>;
template<ParameterNS::Type TypeT>
using AtDof = AtDofImpl<TypeT, 1>;
......
......@@ -38,6 +38,8 @@ namespace HappyHeart
unknown_(unknown),
global_vector_(global_vector)
{
static_assert(Ndim == 1, "This specific constructor should be called only in this case!");
static_cast<void>(mesh);
static_assert(ParameterNS::Type::matrix != TypeT,
......@@ -72,6 +74,8 @@ namespace HappyHeart
unknown_(unknown),
global_vector_(global_vector)
{
static_assert(Ndim == 2, "This specific constructor should be called only in this case!");
static_cast<void>(mesh);
static_assert(ParameterNS::Type::matrix != TypeT,
......
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