Attention une mise à jour du service Gitlab va être effectuée le mardi 18 janvier (et non lundi 17 comme annoncé précédemment) entre 18h00 et 18h30. Cette mise à jour va générer une interruption du service dont nous ne maîtrisons pas complètement la durée mais qui ne devrait pas excéder quelques minutes.

Commit ab41a091 authored by GILLES Sebastien's avatar GILLES Sebastien
Browse files

#1049 Actually the mesh argument in Parameter is superfluous; remove it as...

#1049 Actually the mesh argument in Parameter is superfluous; remove it as Domain is much more sensible. Same remark as previous commit: only hyperelastic case is guaranteed to compile and run.
parent a5ad28f3
......@@ -44,10 +44,6 @@ namespace HappyHeart
// If tagged as activated, compute here the global variational operator.
{
const auto god_of_dof_ptr = felt_space.GetGodOfDofFromWeakPtr();
const auto& god_of_dof = *god_of_dof_ptr;
const auto& geometric_mesh_region = god_of_dof.GetGeometricMeshRegion();
constexpr auto index = SourceTypeT == SourceType::volumic ? VolumicIndexT : SurfacicIndexT;
using parameter_type = InputParameter::TransientSource<index>;
......@@ -58,7 +54,6 @@ namespace HappyHeart
parameter_type,
TimeDependencyT
>(std::forward<T>(name),
geometric_mesh_region,
felt_space.GetDomain(),
input_parameter_data);
......
......@@ -137,8 +137,7 @@ namespace HappyHeart
throw Exception("As mesh labels are very closely related to a mesh, a mesh must be defined!",
__FILE__, __LINE__);
const auto& geometric_mesh_region =
Internal::MeshNS::GeometricMeshRegionManager::GetInstance().GetMesh(GetGeometricMeshRegionIdentifier());
const auto& geometric_mesh_region = GetGeometricMeshRegion();
const auto& label_list = geometric_mesh_region.GetLabelList();
......@@ -174,5 +173,10 @@ namespace HappyHeart
}
const GeometricMeshRegion& Domain::GetGeometricMeshRegion() const
{
return Internal::MeshNS::GeometricMeshRegionManager::GetInstance().GetMesh(GetGeometricMeshRegionIdentifier());
}
} // namespace HappyHeart
......@@ -224,6 +224,32 @@ namespace HappyHeart
* \return Unique identifier of the mesh (provided Criterion::geometric_mesh_region is enforced).
*/
unsigned int GetGeometricMeshRegionIdentifier() const noexcept;
/*!
* \brief Return the \a GeometricMeshRegion.
*
* Relevant only if Criterion::geometric_mesh_region is enforced.
*
* \return \a GeometricMeshRegion into which current \a Domain is defined.
*/
const GeometricMeshRegion& GetGeometricMeshRegion() const;
public:
/*!
* \brief Whether the domain imposes a constraint upon the selected criterion.
*
* \return True if there is \a CriterionT constraint applied on the domain.
*
* \internal By all means, you should treat this as a private member: it is public only because:
* - \a Parameter needs it for a consistency check.
* - Defining a friendship to \a Parameter would be cumbersome given its template parameters, relying on
* non-types defined in Parameter library.
*/
template<DomainNS::Criterion CriterionT>
bool IsConstraintOn() const noexcept;
private:
......@@ -301,10 +327,7 @@ namespace HappyHeart
//! Tells the domain defines a specific kind of constraints.
void SetConditionType(DomainNS::Criterion constraint_type);
//! Whether the domain imposes a constraint upon the selected criterion.
template<DomainNS::Criterion CriterionT>
bool IsConstraintOn() const noexcept;
/*!
* \brief Whether a given constraint is fulfilled or not.
*
......
......@@ -156,13 +156,10 @@ namespace HappyHeart
void VariationalFormulationHyperElasticity<HyperelasticLawT, TimeSchemeT>
::SupplInit(const InputParameterList& input_parameter_data)
{
const auto& geometric_mesh_region = this->GetGodOfDof().GetGeometricMeshRegion();
// \todo #912 Internal to drop here...
decltype(auto) domain_manager = Internal::DomainNS::DomainManager::GetInstance();
solid_ = std::make_unique<Solid>(input_parameter_data,
geometric_mesh_region,
domain_manager.GetDomain(EnumUnderlyingType(DomainIndex::full_mesh)),
GetMainFEltSpace().GetQuadratureRulePerTopology());
......
......@@ -77,7 +77,6 @@ namespace HappyHeart
cauchy_green_tensor_ =
std::make_unique<cauchy_green_tensor_type>("Cauchy-Green tensor",
mesh,
felt_space.GetDomain(),
quadrature_rule_per_topology,
initial_value,
......
......@@ -144,7 +144,8 @@ namespace HappyHeart
// ======================================
// Now check numeric values at quadrature points are also consistent.
// ======================================
const auto& mesh = GetGeometricMeshRegion();
decltype(auto) domain = GetDomain();
const auto& mesh = domain.GetGeometricMeshRegion();
decltype(auto) ref_geom_elt_list = mesh.BagOfEltType();
......@@ -214,6 +215,9 @@ namespace HappyHeart
assert(!(!geom_elt_ptr));
const auto& geom_elt = *geom_elt_ptr;
if (!domain.IsGeometricEltInside(geom_elt))
continue;
for (const auto& quad_pt_ptr : quad_pt_list)
{
assert(!(!quad_pt_ptr));
......
......@@ -33,7 +33,7 @@ namespace HappyHeart
// ============================
class GeometricMeshRegion;
class Domain;
// ============================
......@@ -80,11 +80,10 @@ namespace HappyHeart
* rather than an exception thrown.
* \copydoc doxygen_hide_input_parameter_data_arg
* \copydoc doxygen_hide_quadrature_rule_per_topology_arg
* \param[in] mesh Mesh upon which the solid \a Parameter are defined.
* \param[in] domain Mesh upon which the solid \a Parameter are defined.
*/
template<class InputParameterDataT>
explicit Solid(const InputParameterDataT& input_parameter_data,
const GeometricMeshRegion& mesh,
const Domain& domain,
const QuadratureRulePerTopology& quadrature_rule_per_topology,
double relative_tolerance = 1.e-5);
......@@ -159,8 +158,8 @@ namespace HappyHeart
*/
void CheckConsistency(double relative_tolerance) const;
//! Geometric mesh region upon which the solid is described.
const GeometricMeshRegion& GetGeometricMeshRegion() const noexcept;
//! Domain upon which the solid is described.
const Domain& GetDomain() const noexcept;
//! Get access to the unique_ptr that may (or not) store a parameter.
template<param ParamT>
......@@ -171,8 +170,8 @@ namespace HappyHeart
private:
//! Geometric mesh region upon which the solid is described.
const GeometricMeshRegion& geometric_mesh_region_;
//! Domain upon which the solid is described.
const Domain& domain_;
//! Storage for all scalar parameters encompassed by the class.
scalar_parameter::array_unique_ptr<EnumUnderlyingType(param::size)> parameter_list_;
......
......@@ -18,11 +18,10 @@ namespace HappyHeart
template<class InputParameterDataT>
Solid::Solid(const InputParameterDataT& input_parameter_data,
const GeometricMeshRegion& geometric_mesh_region,
const Domain& domain,
const QuadratureRulePerTopology& quadrature_rule_per_topology,
const double relative_tolerance)
: geometric_mesh_region_(geometric_mesh_region),
: domain_(domain),
quadrature_rule_per_topology_(quadrature_rule_per_topology)
{
......@@ -32,55 +31,46 @@ namespace HappyHeart
parameter_list_[EnumUnderlyingType(param::volumic_mass)] =
InitScalarParameterFromInputData<InputParameter::Solid::VolumicMass>("Volumic mass",
geometric_mesh_region,
domain,
input_parameter_data);
parameter_list_[EnumUnderlyingType(param::lame_lambda)] =
InitScalarParameterFromInputData<InputParameter::Solid::LameLambda>("Lame lambda",
geometric_mesh_region,
domain,
input_parameter_data);
parameter_list_[EnumUnderlyingType(param::lame_mu)] =
InitScalarParameterFromInputData<InputParameter::Solid::LameMu>("Lame mu",
geometric_mesh_region,
domain,
input_parameter_data);
parameter_list_[EnumUnderlyingType(param::young_modulus)] =
InitScalarParameterFromInputData<InputParameter::Solid::YoungModulus>("Young modulus",
geometric_mesh_region,
domain,
domain,
input_parameter_data);
parameter_list_[EnumUnderlyingType(param::poisson_ratio)] =
InitScalarParameterFromInputData<InputParameter::Solid::PoissonRatio>("Poisson ratio",
geometric_mesh_region,
domain,
domain,
input_parameter_data);
parameter_list_[EnumUnderlyingType(param::kappa_1)] =
InitScalarParameterFromInputData<InputParameter::Solid::Kappa1>("Kappa_1",
geometric_mesh_region,
domain,
input_parameter_data);
parameter_list_[EnumUnderlyingType(param::kappa_2)] =
InitScalarParameterFromInputData<InputParameter::Solid::Kappa2>("Kappa_2",
geometric_mesh_region,
domain,
input_parameter_data);
parameter_list_[EnumUnderlyingType(param::hyperelastic_bulk)] =
InitScalarParameterFromInputData<InputParameter::Solid::HyperelasticBulk>("Hyperelastic bulk",
geometric_mesh_region,
domain,
input_parameter_data);
parameter_list_[EnumUnderlyingType(param::viscosity)] =
InitScalarParameterFromInputData<InputParameter::Solid::Viscosity>("Viscosity",
geometric_mesh_region,
domain,
input_parameter_data);
......@@ -116,9 +106,9 @@ namespace HappyHeart
}
inline const GeometricMeshRegion& Solid::GetGeometricMeshRegion() const noexcept
inline const Domain& Solid::GetDomain() const noexcept
{
return geometric_mesh_region_;
return domain_;
}
......
......@@ -28,12 +28,10 @@ namespace HappyHeart
::GradientBasedElasticityTensor(const scalar_parameter& young_modulus,
const scalar_parameter& poisson_ratio)
: parent("Gradient-based elasticity tensor.",
young_modulus.GetGeometricMeshRegion(),
young_modulus.GetDomain()),
young_modulus_(young_modulus),
poisson_ratio_(poisson_ratio)
{
assert(GetGeometricMeshRegion() == poisson_ratio.GetGeometricMeshRegion());
assert(GetDomain() == poisson_ratio.GetDomain());
if (IsConstant())
......
......@@ -22,12 +22,10 @@ namespace HappyHeart
LameLambda::LameLambda(const scalar_parameter& young_modulus,
const scalar_parameter& poisson_ratio)
: scalar_parameter("Lame coefficient 'lambda'",
young_modulus.GetGeometricMeshRegion(),
young_modulus.GetDomain()),
young_modulus_(young_modulus),
poisson_ratio_(poisson_ratio)
{
assert(GetGeometricMeshRegion() == poisson_ratio.GetGeometricMeshRegion());
assert(GetDomain() == poisson_ratio.GetDomain());
if (IsConstant())
......
......@@ -22,12 +22,10 @@ namespace HappyHeart
LameMu::LameMu(const scalar_parameter& young_modulus,
const scalar_parameter& poisson_ratio)
: scalar_parameter("Lame coefficient 'mu'",
young_modulus.GetGeometricMeshRegion(),
young_modulus.GetDomain()),
young_modulus_(young_modulus),
poisson_ratio_(poisson_ratio)
{
assert(young_modulus.GetGeometricMeshRegion() == poisson_ratio.GetGeometricMeshRegion());
assert(young_modulus.GetDomain() == poisson_ratio.GetDomain());
if (IsConstant())
......
......@@ -46,7 +46,6 @@ namespace HappyHeart
scalar_parameter_ptr&& y_component,
scalar_parameter_ptr&& z_component)
: parent(std::forward<T>(name),
x_component->GetGeometricMeshRegion(),
x_component->GetDomain()
),
scalar_parameter_x_(std::move(x_component)),
......@@ -55,8 +54,6 @@ namespace HappyHeart
{
assert(parent::GetDomain() == GetScalarParameterY().GetDomain());
assert(parent::GetDomain() == GetScalarParameterZ().GetDomain());
assert(parent::GetGeometricMeshRegion() == GetScalarParameterY().GetGeometricMeshRegion());
assert(parent::GetGeometricMeshRegion() == GetScalarParameterZ().GetGeometricMeshRegion());
content_.Resize(3);
......
......@@ -67,7 +67,6 @@ namespace HappyHeart
>
typename ScalarParameter<TimeDependencyT>::unique_ptr
InitScalarParameterFromInputData(StringT&& name,
const GeometricMeshRegion& mesh,
const Domain& domain,
const InputParameterDataT& input_parameter_data);
......@@ -93,7 +92,6 @@ namespace HappyHeart
>
typename Parameter<ParameterNS::Type::vector, TimeDependencyT>::unique_ptr
InitThreeDimensionalParameterFromInputData(StringT&& name,
const GeometricMeshRegion& mesh,
const Domain& domain,
const InputParameterDataT& input_parameter_data);
......
......@@ -26,7 +26,6 @@ namespace HappyHeart
>
typename ScalarParameter<TimeDependencyT>::unique_ptr
InitScalarParameterFromInputData(T&& name,
const GeometricMeshRegion& geometric_mesh_region,
const Domain& domain,
const InputParameterDataT& input_parameter_data)
{
......@@ -57,7 +56,6 @@ namespace HappyHeart
typename ParameterT::LuaFunction,
TimeDependencyT
>(std::forward<T>(name),
geometric_mesh_region,
domain,
input_parameter_data,
nature,
......@@ -76,7 +74,6 @@ namespace HappyHeart
>
typename Parameter<ParameterNS::Type::vector, TimeDependencyT>::unique_ptr
InitThreeDimensionalParameterFromInputData(T&& name,
const GeometricMeshRegion& geometric_mesh_region,
const Domain& domain,
const InputParameterDataT& input_parameter_data)
{
......@@ -125,7 +122,6 @@ namespace HappyHeart
typename ParameterT::LuaFunctionX,
ParameterNS::TimeDependencyNS::None
>("Lua function X",
geometric_mesh_region,
domain,
input_parameter_data,
nature_list[0],
......@@ -140,7 +136,6 @@ namespace HappyHeart
typename ParameterT::LuaFunctionY,
ParameterNS::TimeDependencyNS::None
>("Lua function Y",
geometric_mesh_region,
domain,
input_parameter_data,
nature_list[1],
......@@ -155,7 +150,6 @@ namespace HappyHeart
typename ParameterT::LuaFunctionZ,
ParameterNS::TimeDependencyNS::None
>("Lua function Z",
geometric_mesh_region,
domain,
input_parameter_data,
nature_list[2],
......
......@@ -90,7 +90,6 @@ namespace HappyHeart
>
typename ScalarParameter<TimeDependencyT>::unique_ptr
InitScalarParameterFromInputData(StringT&& name,
const GeometricMeshRegion& mesh,
const Domain& domain,
const InputParameterDataT& input_parameter_data,
typename TimeDependencyT<ParameterNS::Type::scalar>::const_unique_ptr&& time_dependency,
......
......@@ -33,7 +33,6 @@ namespace HappyHeart
>
typename ScalarParameter<TimeDependencyT>::unique_ptr
InitScalarParameterFromInputData(T&& name,
const GeometricMeshRegion& geometric_mesh_region,
const Domain& domain,
const InputParameterDataT& input_parameter_data,
const std::string& nature,
......@@ -57,7 +56,6 @@ namespace HappyHeart
>;
return std::make_unique<parameter_type>(std::forward<T>(name),
geometric_mesh_region,
domain,
scalar_value);
}
......@@ -75,7 +73,6 @@ namespace HappyHeart
IPL::Extract<LuaFieldT>::Value(input_parameter_data);
return std::make_unique<parameter_type>(std::forward<T>(name),
geometric_mesh_region,
domain,
value);
}
......@@ -89,7 +86,6 @@ namespace HappyHeart
>;
return std::make_unique<parameter_type>(std::forward<T>(name),
geometric_mesh_region,
domain,
domain_id,
value_by_domain);
......
......@@ -88,7 +88,6 @@ namespace HappyHeart
//! Constructor.
template<class T, typename... ConstructorArgs>
explicit ParameterInstance(T&& name,
const GeometricMeshRegion& geometric_mesh_region,
const Domain& domain,
ConstructorArgs&&... arguments);
......
......@@ -38,11 +38,10 @@ namespace HappyHeart
>
ParameterInstance<TypeT, NaturePolicyT, TimeDependencyT, Args...>
::ParameterInstance(T&& name,
const GeometricMeshRegion& geometric_mesh_region,
const Domain& domain,
ConstructorArgs&&... arguments)
: parent(std::forward<T>(name), geometric_mesh_region, domain),
nature_policy(geometric_mesh_region, std::forward<ConstructorArgs>(arguments)...)
: parent(std::forward<T>(name), domain),
nature_policy(domain, std::forward<ConstructorArgs>(arguments)...)
{ }
......
......@@ -125,8 +125,8 @@ namespace HappyHeart
*
* \param[in] name Name that will appear in outputs.
* \param[in] mesh Mesh upon which the parameter is built.
* \param[in] domain Domain upon which the \a Parameter is defined. Must belong to the \a mesh (checked in
* debug mode).
* \param[in] domain Domain upon which the \a Parameter is defined. This domain must be restricted to a
* \a GeometricMeshRegion.
*
* \tparam T Type of name, in forwarding reference idiom. It must be convertible to a std::string.
*
......@@ -135,7 +135,6 @@ namespace HappyHeart
*/
template<class T>
explicit Parameter(T&& name,
const GeometricMeshRegion& mesh,
const Domain& domain);
......@@ -224,9 +223,6 @@ namespace HappyHeart
*/
void Write(const std::string& filename) const;
//! Returns the geometric mesh region upon which the parameter is defined.
const GeometricMeshRegion& GetGeometricMeshRegion() const noexcept;
//! Returns the \a Domain upon which the parameter is defined.
const Domain& GetDomain() const noexcept;
......@@ -358,9 +354,6 @@ namespace HappyHeart
//! Name that will appear in outputs.
std::string name_;
//! Mesh upon which the parameter is defined.
const GeometricMeshRegion& geometric_mesh_region_;
//! Domain upon which the parameter is defined. Must be consistent with mesh.
const Domain& domain_;
......
......@@ -23,15 +23,13 @@ namespace HappyHeart
>
template<class T>
Parameter<TypeT, TimeDependencyT>::Parameter(T&& name,
const GeometricMeshRegion& geometric_mesh_region,
const Domain& domain)
: name_(name),
geometric_mesh_region_(geometric_mesh_region),
domain_(domain)
{
if (geometric_mesh_region.GetUniqueId() != domain.GetGeometricMeshRegionIdentifier())
throw Exception(std::string("Parameter ") + name + " is inconsistently defined: domain is not within "
"the given mesh",
if (!domain.template IsConstraintOn<DomainNS::Criterion::geometric_mesh_region>())
throw Exception(std::string("Parameter ") + name + " is inconsistently defined: domain should be "
"circumscribed to a mesh.",
__FILE__, __LINE__);
// If there is a time dependency, it must be set up through SetTimeDependency() method.
......@@ -143,18 +141,7 @@ namespace HappyHeart
return name_;
}
template
<
ParameterNS::Type TypeT,
template<ParameterNS::Type> class TimeDependencyT
>
inline const GeometricMeshRegion& Parameter<TypeT, TimeDependencyT>::GetGeometricMeshRegion() const noexcept
{
return geometric_mesh_region_;
}
template
<
ParameterNS::Type TypeT,
......
Markdown is supported
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