Commit 12a04874 authored by GILLES Sebastien's avatar GILLES Sebastien
Browse files

#1049 - #1050 Fix ScalarParameterFromFile and Parameter/TimeDependency test...

#1049 - #1050 Fix ScalarParameterFromFile and Parameter/TimeDependency test (the latter wasn't working even prior to the ticket #1049, hence the associated #1050 in this commit).
parent cfc3d502
......@@ -136,6 +136,40 @@ Domain1 = {
geometric_element_type_list = {}
}
-- Domain2
Domain2 = {
-- Index of the geometric mesh upon which the domain is defined (as defined in the present file). Might be
-- left empty if domain not limited to one mesh; at most one value is expected here.
-- Expected format: {VALUE1, VALUE2, ...}
mesh_index = { 1 },
-- List of dimensions encompassed by the domain. Might be left empty if no restriction at all upon
-- dimensions.
-- Expected format: {VALUE1, VALUE2, ...}
-- Constraint: ops_in(v, {0, 1, 2, 3})
dimension_list = { },
-- List of mesh labels encompassed by the domain. Might be left empty if no restriction at all upon mesh
-- labels. This parameter does not make sense if no mesh is defined for the domain.
-- Expected format: {VALUE1, VALUE2, ...}
mesh_label_list = { },
-- List of geometric element types considered in the domain. Might be left empty if no restriction upon
-- these. No constraint is applied at Ops level, as some geometric element types could be added after
-- generation of current input parameter file. Current list is below; if an incorrect value is put there it
-- will be detected a bit later when the domain object is built.
-- The known types when this file was generated are:
-- . Point1
-- . Segment2, Segment3
-- . Triangle3, Triangle6
-- . Quadrangle4, Quadrangle8, Quadrangle9
-- . Tetrahedron4, Tetrahedron10
-- . Hexahedron8, Hexahedron20, Hexahedron27.
-- Expected format: {"VALUE1", "VALUE2", ...}
geometric_element_type_list = {}
}
-- FiniteElementSpace1
FiniteElementSpace1 = {
-- Index of the god of dof into which the finite element space is defined.
......
......@@ -11,7 +11,7 @@
#ifndef HAPPY_HEART_x_GEOMETRY_x_COORDS_x_INTERNAL_x_COORD_INDEXES_HPP_
# define HAPPY_HEART_x_GEOMETRY_x_COORDS_x_INTERNAL_x_COORD_INDEXES_HPP_
# include "HappyHeart/Utilities/NUmeric/Numeric.hpp"
# include "HappyHeart/Utilities/Numeric/Numeric.hpp"
namespace HappyHeart
......
......@@ -59,7 +59,8 @@ namespace HappyHeart
* of a physical parameter over time. It is assumed that is is constant over space.
*
*/
class ScalarParameterFromFile final : public Parameter<ParameterNS::Type::scalar, ParameterNS::TimeDependencyFromFile>
class ScalarParameterFromFile final
: public Parameter<ParameterNS::Type::scalar, ParameterNS::TimeDependencyFromFile>
{
public:
......@@ -106,7 +107,7 @@ namespace HappyHeart
*/
template<class T>
explicit ScalarParameterFromFile(T&& name,
const GeometricMeshRegion& geometric_mesh_region,
const Domain& domain,
const TimeManager& time_manager,
const std::string& file);
......@@ -139,16 +140,6 @@ namespace HappyHeart
*/
bool IsConstant() const override final;
//! Apply the time dependency if relevant.
void TimeUpdate() override final;
private:
/*!
* \brief Constant accessor to the object which handles if relevant the time dependancy (computation of
* the time related factor, etc...).
*/
const ParameterNS::TimeDependencyFromFile<ParameterNS::Type::scalar>& GetTimeDependency() const noexcept;
private:
......
......@@ -19,10 +19,10 @@ namespace HappyHeart
template<class T>
ScalarParameterFromFile::ScalarParameterFromFile(T&& name,
const GeometricMeshRegion& geometric_mesh_region,
const Domain& domain,
const TimeManager& time_manager,
const std::string& file)
: parent(name, geometric_mesh_region)
: parent(name, domain)
{
using parameter_type = Internal::ParameterNS::ParameterInstance
<
......@@ -32,28 +32,16 @@ namespace HappyHeart
>;
internal_parameter_ = std::make_unique<parameter_type>(std::forward<T>(name),
geometric_mesh_region,
domain,
1.);
auto time_dep = std::make_unique<ParameterNS::TimeDependencyFromFile<ParameterNS::Type::scalar>>(time_manager,
file);
GetNonCstInternalParameter().SetTimeDependency(std::move(time_dep));
SetTimeDependency(std::move(time_dep));
}
inline void ScalarParameterFromFile::TimeUpdate()
{
return GetNonCstInternalParameter().TimeUpdate();
}
inline const ParameterNS::TimeDependencyFromFile<ParameterNS::Type::scalar>& ScalarParameterFromFile::GetTimeDependency() const noexcept
{
return GetInternalParameter().GetTimeDependency();
}
inline bool ScalarParameterFromFile::IsConstant() const
{
return GetInternalParameter().IsConstant();
......
......@@ -37,7 +37,8 @@ namespace HappyHeart
enum class DomainIndex
{
domain = 1
domain = 1,
full_mesh = 2
};
......@@ -92,6 +93,7 @@ namespace HappyHeart
InputParameter::Mesh<EnumUnderlyingType(MeshIndex::mesh)>,
InputParameter::Domain<EnumUnderlyingType(DomainIndex::domain)>,
InputParameter::Domain<EnumUnderlyingType(DomainIndex::full_mesh)>,
InputParameter::FEltSpace<EnumUnderlyingType(FEltSpaceIndex::index)>,
......
......@@ -37,8 +37,6 @@ namespace HappyHeart
void Model::SupplInitialize(const InputParameterList& input_parameter_data)
{
decltype(auto) god_of_dof = GetGodOfDof(EnumUnderlyingType(MeshIndex::mesh));
decltype(auto) mesh = god_of_dof.GetGeometricMeshRegion();
output_file_ = parent::GetOutputDirectory() + "/test_values_"
+ std::to_string(parent::MpiHappyHeart().GetRank<int>()) + ".hhdata";
......@@ -48,6 +46,8 @@ namespace HappyHeart
std::ofstream out;
FilesystemNS::File::Create(out, output_file_, __FILE__, __LINE__);
decltype(auto) domain = DomainManager::GetInstance().GetDomain(EnumUnderlyingType(DomainIndex::full_mesh));
using Solid = InputParameter::Solid;
young_modulus_ =
......@@ -56,7 +56,7 @@ namespace HappyHeart
Solid::YoungModulus,
ParameterNS::TimeDependencyFunctor
>("Young modulus",
mesh,
domain,
input_parameter_data);
......@@ -79,12 +79,13 @@ namespace HappyHeart
Solid::YoungModulus,
ParameterNS::TimeDependencyNS::None
>("Poisson ratio",
mesh,
domain,
input_parameter_data);
static_pressure_ = InitScalarParameterFromInputData<InputParameter::Source::StaticPressure, ParameterNS::TimeDependencyNS::None>("StaticPressure",
mesh,
input_parameter_data);
static_pressure_ =
InitScalarParameterFromInputData<InputParameter::Source::StaticPressure, ParameterNS::TimeDependencyNS::None>("StaticPressure",
domain,
input_parameter_data);
namespace IPL = Utilities::InputParameterListNS;
......@@ -92,9 +93,10 @@ namespace HappyHeart
IPL::Extract<InputParameter::Source::PressureFromFile<EnumUnderlyingType(PressureIndex::pressure)>::FilePath>::Path(input_parameter_data);
dynamic_pressure_ = std::make_unique<ScalarParameterFromFile>("DynamicPressure",
mesh,
domain,
GetTimeManager(),
file);
using parameter_type = InputParameter::TransientSource<EnumUnderlyingType(SourceIndex::source)>;
......@@ -104,7 +106,7 @@ namespace HappyHeart
parameter_type,
ParameterNS::TimeDependencyFunctor
>("Source",
mesh,
domain,
input_parameter_data);
assert(!(!source_parameter_));
......
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