Commit 18e1a179 authored by GILLES Sebastien's avatar GILLES Sebastien
Browse files

#873 [DOES NOT COMPILE EVERYTHING] Parameters: time update correctly...

#873 [DOES NOT COMPILE EVERYTHING] Parameters: time update correctly implemented for scalar parameters.
parent 6dac85de
......@@ -417,6 +417,9 @@
BE4CAB021BB00A62005D3362 /* SourceOrTargetData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE4CAAFF1BB00A62005D3362 /* SourceOrTargetData.cpp */; };
BE4CAB031BB00A62005D3362 /* SourceOrTargetData.hpp in Headers */ = {isa = PBXBuildFile; fileRef = BE4CAB001BB00A62005D3362 /* SourceOrTargetData.hpp */; };
BE4CAB041BB00A62005D3362 /* SourceOrTargetData.hxx in Headers */ = {isa = PBXBuildFile; fileRef = BE4CAB011BB00A62005D3362 /* SourceOrTargetData.hxx */; };
BE4DC0CC1CAD14CE009E03C3 /* ApplyTimeFactor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE4DC0C91CAD14CE009E03C3 /* ApplyTimeFactor.cpp */; };
BE4DC0CD1CAD14CE009E03C3 /* ApplyTimeFactor.hpp in Headers */ = {isa = PBXBuildFile; fileRef = BE4DC0CA1CAD14CE009E03C3 /* ApplyTimeFactor.hpp */; };
BE4DC0CE1CAD14CE009E03C3 /* ApplyTimeFactor.hxx in Headers */ = {isa = PBXBuildFile; fileRef = BE4DC0CB1CAD14CE009E03C3 /* ApplyTimeFactor.hxx */; };
BE4ED3171A2CA7FF00DE374E /* ComputeBarycenter.hpp in Headers */ = {isa = PBXBuildFile; fileRef = BE4ED3141A2CA7FF00DE374E /* ComputeBarycenter.hpp */; };
BE4ED3181A2CA7FF00DE374E /* ComputeBarycenter.hxx in Headers */ = {isa = PBXBuildFile; fileRef = BE4ED3151A2CA7FF00DE374E /* ComputeBarycenter.hxx */; };
BE4ED31C1A2CBAC400DE374E /* MatrixOperations.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE4ED3191A2CBAC400DE374E /* MatrixOperations.cpp */; };
......@@ -1456,7 +1459,6 @@
BEF2829F1A850E3200857342 /* libUtilities.a in Frameworks */ = {isa = PBXBuildFile; fileRef = BEA8A379177AD4FE009436C9 /* libUtilities.a */; };
BEF282A21A850E3200857342 /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BEC37E0617DDC0210021BFB7 /* Accelerate.framework */; };
BEF2F0051C995B23005F1095 /* libSeldon.a in Frameworks */ = {isa = PBXBuildFile; fileRef = BEF2F0041C995B23005F1095 /* libSeldon.a */; };
BEF567C81B1735B000AAA2AA /* ThreeDimensionalParameter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BEF567C51B1735B000AAA2AA /* ThreeDimensionalParameter.cpp */; };
BEF567C91B1735B000AAA2AA /* ThreeDimensionalParameter.hpp in Headers */ = {isa = PBXBuildFile; fileRef = BEF567C61B1735B000AAA2AA /* ThreeDimensionalParameter.hpp */; };
BEF567CA1B1735B000AAA2AA /* ThreeDimensionalParameter.hxx in Headers */ = {isa = PBXBuildFile; fileRef = BEF567C71B1735B000AAA2AA /* ThreeDimensionalParameter.hxx */; };
BEF567D71B1741B000AAA2AA /* InitParameter.hpp in Headers */ = {isa = PBXBuildFile; fileRef = BEF567D41B1741B000AAA2AA /* InitParameter.hpp */; };
......@@ -4474,6 +4476,9 @@
BE4CAAFF1BB00A62005D3362 /* SourceOrTargetData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SourceOrTargetData.cpp; path = Private/SourceOrTargetData.cpp; sourceTree = "<group>"; };
BE4CAB001BB00A62005D3362 /* SourceOrTargetData.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = SourceOrTargetData.hpp; path = Private/SourceOrTargetData.hpp; sourceTree = "<group>"; };
BE4CAB011BB00A62005D3362 /* SourceOrTargetData.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = SourceOrTargetData.hxx; path = Private/SourceOrTargetData.hxx; sourceTree = "<group>"; };
BE4DC0C91CAD14CE009E03C3 /* ApplyTimeFactor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ApplyTimeFactor.cpp; sourceTree = "<group>"; };
BE4DC0CA1CAD14CE009E03C3 /* ApplyTimeFactor.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = ApplyTimeFactor.hpp; sourceTree = "<group>"; };
BE4DC0CB1CAD14CE009E03C3 /* ApplyTimeFactor.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = ApplyTimeFactor.hxx; sourceTree = "<group>"; };
BE4ED3141A2CA7FF00DE374E /* ComputeBarycenter.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = ComputeBarycenter.hpp; sourceTree = "<group>"; };
BE4ED3151A2CA7FF00DE374E /* ComputeBarycenter.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = ComputeBarycenter.hxx; sourceTree = "<group>"; };
BE4ED3191A2CBAC400DE374E /* MatrixOperations.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MatrixOperations.cpp; sourceTree = "<group>"; };
......@@ -5495,7 +5500,6 @@
BEF282961A850E2800857342 /* HeatVariationalFormulation.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = HeatVariationalFormulation.hpp; sourceTree = "<group>"; };
BEF282971A850E2800857342 /* HeatVariationalFormulation.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = HeatVariationalFormulation.hxx; sourceTree = "<group>"; };
BEF2F0041C995B23005F1095 /* libSeldon.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libSeldon.a; path = "../../../../../Users/sebastien/Library/Developer/Xcode/DerivedData/HappyHeart-dqmtrohnwfmlptcdglbypyuhxipw/Build/Products/Debug/libSeldon.a"; sourceTree = "<group>"; };
BEF567C51B1735B000AAA2AA /* ThreeDimensionalParameter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ThreeDimensionalParameter.cpp; sourceTree = "<group>"; };
BEF567C61B1735B000AAA2AA /* ThreeDimensionalParameter.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = ThreeDimensionalParameter.hpp; sourceTree = "<group>"; };
BEF567C71B1735B000AAA2AA /* ThreeDimensionalParameter.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = ThreeDimensionalParameter.hxx; sourceTree = "<group>"; };
BEF567D41B1741B000AAA2AA /* InitParameter.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = InitParameter.hpp; path = Private/InitParameter.hpp; sourceTree = "<group>"; };
......@@ -6907,6 +6911,7 @@
BE44E3AC1CAA7748006DDE6F /* None.hpp */,
BE44E3B21CAA7775006DDE6F /* TimeDependency.hpp */,
BE44E3B31CAA7775006DDE6F /* TimeDependency.hxx */,
BE4DC0C71CAD148B009E03C3 /* Private */,
);
name = TimeDependency;
sourceTree = "<group>";
......@@ -6990,6 +6995,17 @@
path = Private;
sourceTree = "<group>";
};
BE4DC0C71CAD148B009E03C3 /* Private */ = {
isa = PBXGroup;
children = (
BE4DC0C91CAD14CE009E03C3 /* ApplyTimeFactor.cpp */,
BE4DC0CA1CAD14CE009E03C3 /* ApplyTimeFactor.hpp */,
BE4DC0CB1CAD14CE009E03C3 /* ApplyTimeFactor.hxx */,
);
name = Private;
path = TimeDependency/Private;
sourceTree = "<group>";
};
BE4FC35018F2A6CA007B6DED /* Exceptions */ = {
isa = PBXGroup;
children = (
......@@ -7590,7 +7606,6 @@
children = (
BE6199491B0F628C00906290 /* GradientBasedElasticityTensor.hpp */,
BE61994A1B0F628C00906290 /* GradientBasedElasticityTensor.hxx */,
BEF567C51B1735B000AAA2AA /* ThreeDimensionalParameter.cpp */,
BEF567C61B1735B000AAA2AA /* ThreeDimensionalParameter.hpp */,
BEF567C71B1735B000AAA2AA /* ThreeDimensionalParameter.hxx */,
BE6322F91B188BF500F787CC /* LameLambda.cpp */,
......@@ -10214,8 +10229,10 @@
BE6A11BA1BBE7EAF00107942 /* AtDof.hpp in Headers */,
BE625B301BCBB0D200FB316D /* FiberList.hpp in Headers */,
BE17F3391B149A2A00EAAACE /* Configuration.hxx in Headers */,
BE4DC0CD1CAD14CE009E03C3 /* ApplyTimeFactor.hpp in Headers */,
BE01FA341BC677350080AD73 /* AtDof.hxx in Headers */,
BEED7BBB1C7C9670002C4C15 /* Solid.hpp in Headers */,
BE4DC0CE1CAD14CE009E03C3 /* ApplyTimeFactor.hxx in Headers */,
BE625B311BCBB0D200FB316D /* FiberList.hxx in Headers */,
BE3C40991B0F7DD900396F68 /* ComputeGradientBasedElasticityTensor.hpp in Headers */,
BE44E3B51CAA7775006DDE6F /* TimeDependency.hpp in Headers */,
......@@ -12342,7 +12359,7 @@
BE625B361BCBB0D200FB316D /* Traits.cpp in Sources */,
BE01FA321BC677350080AD73 /* AtDof.cpp in Sources */,
BE6A109E1B18923100F19349 /* LameMu.cpp in Sources */,
BEF567C81B1735B000AAA2AA /* ThreeDimensionalParameter.cpp in Sources */,
BE4DC0CC1CAD14CE009E03C3 /* ApplyTimeFactor.cpp in Sources */,
BE3C40981B0F7DD900396F68 /* ComputeGradientBasedElasticityTensor.cpp in Sources */,
BE6322FC1B188BF500F787CC /* LameLambda.cpp in Sources */,
13A3989E1BD63DD100913E2C /* RectangularSourceTimeParameter.cpp in Sources */,
......@@ -188,6 +188,8 @@ namespace HappyHeart
*/
virtual void SupplWrite(std::ostream& out) const override final;
//! \copydoc doxygen_hide_parameter_suppl_time_update
virtual void SupplTimeUpdate() override final;
private:
......
......@@ -122,6 +122,14 @@ namespace HappyHeart
return *underlying_parameter_;
}
template<ParameterNS::Type TypeT>
void FiberList<TypeT>::SupplTimeUpdate()
{
assert(!GetUnderlyingParameter().IsTimeDependent());
}
} // namespace HappyHeart
......
......@@ -113,6 +113,9 @@ namespace HappyHeart
//! Returns the constant value (and compute it if first call).
return_type SupplGetConstantValue() const override;
//! \copydoc doxygen_hide_parameter_suppl_time_update
void SupplTimeUpdate() override;
private:
......
......@@ -125,7 +125,17 @@ namespace HappyHeart
GetPoissonRatio().Write(out);
}
template
<
GradientBasedElasticityTensorConfiguration ConfigurationT
>
void GradientBasedElasticityTensor<ConfigurationT>::SupplTimeUpdate()
{
assert(!GetYoungModulus().IsTimeDependent());
assert(!GetPoissonRatio().IsTimeDependent());
}
} // namespace ParameterNS
......
......@@ -45,6 +45,14 @@ namespace HappyHeart
}
void LameLambda::SupplTimeUpdate()
{
assert(!GetYoungModulus().IsTimeDependent());
assert(!GetPoissonRatio().IsTimeDependent());
}
} // namespace ParameterNS
......
......@@ -98,6 +98,11 @@ namespace HappyHeart
* \brief Write the content of the Parameter in a stream.
*/
void SupplWrite(std::ostream& out) const override;
//! \copydoc doxygen_hide_parameter_suppl_time_update
void SupplTimeUpdate() override;
private:
......
......@@ -45,6 +45,14 @@ namespace HappyHeart
}
void LameMu::SupplTimeUpdate()
{
assert(!GetYoungModulus().IsTimeDependent());
assert(!GetPoissonRatio().IsTimeDependent());
}
} // namespace ParameterNS
......
......@@ -71,6 +71,10 @@ namespace HappyHeart
*/
void SupplWrite(std::ostream& out) const override;
//! \copydoc doxygen_hide_parameter_suppl_time_update
void SupplTimeUpdate() override;
private:
//! Get the value of the parameter.
......
//! \file
//
//
// ThreeDimensionalParameter.cpp
// HappyHeart
//
// Created by Sebastien Gilles on 28/05/15.
// Copyright (c) 2015 Inria. All rights reserved.
//
#include "Parameters/Instances/ThreeDimensionalParameter.hpp"
namespace HappyHeart
{
namespace ParameterNS
{
} // namespace ParameterNS
} // namespace HappyHeart
......@@ -101,7 +101,9 @@ namespace HappyHeart
*/
void SupplWrite(std::ostream& out) const override;
//! \copydoc doxygen_hide_parameter_suppl_time_update
void SupplTimeUpdate() override;
private:
......
......@@ -146,6 +146,18 @@ namespace HappyHeart
return content_;
}
template
<
template<ParameterNS::Type> class TimeDependencyT
>
void ThreeDimensionalParameter<TimeDependencyT>::SupplTimeUpdate()
{
GetScalarParameterX().TimeUpdate();
GetScalarParameterY().TimeUpdate();
GetScalarParameterZ().TimeUpdate();
}
} // namespace ParameterNS
......
......@@ -149,6 +149,10 @@ namespace HappyHeart
public:
//! Apply the time dependency if relevant.
void TimeUpdate();
/*!
* \brief Set the time dependency functor.
*
......@@ -201,6 +205,9 @@ namespace HappyHeart
//! Returns the geometric mesh region upon which the parameter is defined.
const GeometricMeshRegion& GetGeometricMeshRegion() const noexcept;
//! Whether the class is time-dependent or not.
constexpr bool IsTimeDependent() const noexcept;
protected:
......@@ -249,11 +256,22 @@ namespace HappyHeart
/*!
* \brief Write the content of the Parameter in a stream.
*
* \para,
* \param[in,out] out Stream to which Parameter is written.
*/
virtual void SupplWrite(std::ostream& out) const = 0;
/*!
* \class doxygen_hide_parameter_suppl_time_update
*
* \brief Add here any additional TimeUpdate that might be relevant.
*
* For instance, if a Parameter depends on other parameters, you must make sure those are correctly updated,
* and possibly some internals might have to be recomputed.
*/
virtual void SupplTimeUpdate() = 0;
private:
//! Name that will appear in outputs.
......
......@@ -56,6 +56,7 @@ namespace HappyHeart
::Perform(typename TimeDependencyT<TypeT>::unique_ptr& time_dependency)
{
// Do nothing!
static_cast<void>(time_dependency);
}
......@@ -164,7 +165,7 @@ namespace HappyHeart
const TimeDependencyT& time_dependency_object)
{
std::cout << "Time factor should be applied here." << std::endl;
return value_without_time_factor;
return time_dependency_object.ApplyTimeFactor(value_without_time_factor);
}
......@@ -174,6 +175,7 @@ namespace HappyHeart
::Perform(return_type value_without_time_factor,
const ParameterNS::TimeDependencyNS::None<TypeT>& unused)
{
static_cast<void>(unused);
std::cout << "No time factor to apply." << std::endl;
return value_without_time_factor;
}
......@@ -279,6 +281,31 @@ namespace HappyHeart
{
return const_cast<TimeDependencyT<TypeT>&>(GetTimeDependency());
}
template
<
ParameterNS::Type TypeT,
template<ParameterNS::Type> class TimeDependencyT
>
inline void Parameter<TypeT, TimeDependencyT>::TimeUpdate()
{
GetNonCstTimeDependency().Update();
SupplTimeUpdate();
}
template
<
ParameterNS::Type TypeT,
template<ParameterNS::Type> class TimeDependencyT
>
constexpr bool Parameter<TypeT, TimeDependencyT>::IsTimeDependent() const noexcept
{
return !std::is_same<TimeDependencyT<TypeT>, ParameterNS::TimeDependencyNS::None<TypeT>>();
}
} // namespace HappyHeart
......
......@@ -109,6 +109,9 @@ namespace HappyHeart
void SupplWrite(std::ostream& out) const override;
//! \copydoc doxygen_hide_parameter_suppl_time_update
void SupplTimeUpdate() override;
/*
* \brief Whether the parameter varies spatially or not.
*/
......
......@@ -98,6 +98,18 @@ namespace HappyHeart
}
template
<
ParameterNS::Type TypeT,
template<ParameterNS::Type, typename... Args> class NaturePolicyT,
template<ParameterNS::Type> class TimeDependencyT,
typename... Args
>
inline void ParameterInstance<TypeT, NaturePolicyT, TimeDependencyT, Args...>::SupplTimeUpdate()
{
// Do nothing in general case.
}
} // namespace Private
......
......@@ -14,8 +14,8 @@ src = Split('''
./Instances/Private/ComputeGradientBasedElasticityTensor.cpp
./Instances/Private/Configuration.cpp
./Instances/Private/Gradient2Strain.cpp
./Instances/ThreeDimensionalParameter.cpp
./Policy/Private/AtDof.cpp
./TimeDependency/Private/ApplyTimeFactor.cpp
''')
lib = custom.HappyHeartLibrary(env, 'happy_heart_parameters', src)
......
//! \file
//
//
// ApplyTimeFactor.cpp
// HappyHeart
//
// Created by Sebastien Gilles on 31/03/16.
// Copyright © 2016 Inria. All rights reserved.
//
#include "Parameters/TimeDependency/Private/ApplyTimeFactor.hpp"
namespace HappyHeart
{
namespace ParameterNS
{
namespace TimeDependencyNS
{
namespace Private
{
double ApplyTimeFactor(double value_without_time_factor, double time_factor)
{
return value_without_time_factor * time_factor;
}
} // namespace Private
} // namespace TimeDependencyNS
} // namespace ParameterNS
} // namespace HappyHeart
//! \file
//
//
// ApplyTimeFactor.hpp
// HappyHeart
//
// Created by Sebastien Gilles on 31/03/16.
// Copyright © 2016 Inria. All rights reserved.
//
#ifndef HAPPY_HEART_x_PARAMETERS_x_TIME_DEPENDENCY_x_PRIVATE_x_APPLY_TIME_FACTOR_HPP_
# define HAPPY_HEART_x_PARAMETERS_x_TIME_DEPENDENCY_x_PRIVATE_x_APPLY_TIME_FACTOR_HPP_
# include <memory>
# include <vector>
namespace HappyHeart
{
namespace ParameterNS
{
namespace TimeDependencyNS
{
namespace Private
{
double ApplyTimeFactor(double value_without_time_factor, double time_factor);
} // namespace Private
} // namespace TimeDependencyNS
} // namespace ParameterNS
} // namespace HappyHeart
# include "Parameters/TimeDependency/Private/ApplyTimeFactor.hxx"
#endif // HAPPY_HEART_x_PARAMETERS_x_TIME_DEPENDENCY_x_PRIVATE_x_APPLY_TIME_FACTOR_HPP_
//! \file
//
//
// ApplyTimeFactor.hxx
// HappyHeart
//
// Created by Sebastien Gilles on 31/03/16.
// Copyright © 2016 Inria. All rights reserved.
//
#ifndef HAPPY_HEART_x_PARAMETERS_x_TIME_DEPENDENCY_x_PRIVATE_x_APPLY_TIME_FACTOR_HXX_
# define HAPPY_HEART_x_PARAMETERS_x_TIME_DEPENDENCY_x_PRIVATE_x_APPLY_TIME_FACTOR_HXX_
namespace HappyHeart
{
namespace ParameterNS
{
namespace TimeDependencyNS
{
namespace Private
{
} // namespace Private
} // namespace TimeDependencyNS
} // namespace ParameterNS
} // namespace HappyHeart
#endif // HAPPY_HEART_x_PARAMETERS_x_TIME_DEPENDENCY_x_PRIVATE_x_APPLY_TIME_FACTOR_HXX_
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