Commit 3af66e0b authored by GILLES Sebastien's avatar GILLES Sebastien
Browse files

#873 Parameters: move yet others helper classes into Private namespace.

parent 373e8969
......@@ -655,6 +655,9 @@
BE6B01EC1CAD5D310061AB93 /* InitStoredQuantity.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE6B01E91CAD5D310061AB93 /* InitStoredQuantity.cpp */; };
BE6B01ED1CAD5D310061AB93 /* InitStoredQuantity.hpp in Headers */ = {isa = PBXBuildFile; fileRef = BE6B01EA1CAD5D310061AB93 /* InitStoredQuantity.hpp */; };
BE6B01EE1CAD5D310061AB93 /* InitStoredQuantity.hxx in Headers */ = {isa = PBXBuildFile; fileRef = BE6B01EB1CAD5D310061AB93 /* InitStoredQuantity.hxx */; };
BE6B01F41CAD5FD40061AB93 /* StaticIf.hpp in Headers */ = {isa = PBXBuildFile; fileRef = BE6B01F11CAD5FD40061AB93 /* StaticIf.hpp */; };
BE6B01F51CAD5FD40061AB93 /* StaticIf.hxx in Headers */ = {isa = PBXBuildFile; fileRef = BE6B01F21CAD5FD40061AB93 /* StaticIf.hxx */; };
BE6B01F91CAD60DF0061AB93 /* Parameter.hpp in Headers */ = {isa = PBXBuildFile; fileRef = BE6B01F81CAD60DF0061AB93 /* Parameter.hpp */; };
BE6B1AD11B0A1FFF00CC2135 /* libOps.a in Frameworks */ = {isa = PBXBuildFile; fileRef = BE43AD351AFB9ADB0082AF43 /* libOps.a */; };
BE6BE4E31A665A90009AC2F3 /* IOFormat.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE6BE4E01A665A90009AC2F3 /* IOFormat.cpp */; };
BE6C215F19AF2FDB00CC674B /* libUtilities.a in Frameworks */ = {isa = PBXBuildFile; fileRef = BEA8A379177AD4FE009436C9 /* libUtilities.a */; };
......@@ -4785,8 +4788,10 @@
BE6B01E91CAD5D310061AB93 /* InitStoredQuantity.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InitStoredQuantity.cpp; sourceTree = "<group>"; };
BE6B01EA1CAD5D310061AB93 /* InitStoredQuantity.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = InitStoredQuantity.hpp; sourceTree = "<group>"; };
BE6B01EB1CAD5D310061AB93 /* InitStoredQuantity.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = InitStoredQuantity.hxx; sourceTree = "<group>"; };
BE6B01F11CAD5FD40061AB93 /* StaticIf.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = StaticIf.hpp; path = Private/StaticIf.hpp; sourceTree = "<group>"; };
BE6B01F21CAD5FD40061AB93 /* StaticIf.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = StaticIf.hxx; path = Private/StaticIf.hxx; sourceTree = "<group>"; };
BE6B01F81CAD60DF0061AB93 /* Parameter.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Parameter.hpp; sourceTree = "<group>"; };
BE6B1AD21B0A202600CC2135 /* demo_input_test.lua */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = demo_input_test.lua; path = Data/Lua/demo_input_test.lua; sourceTree = SOURCE_ROOT; };
BE6B1AF21B0A343D00CC2135 /* Parameter.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Parameter.hpp; sourceTree = "<group>"; };
BE6B1AF31B0A343D00CC2135 /* Parameter.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Parameter.hxx; sourceTree = "<group>"; };
BE6B1B041B0A354700CC2135 /* Constant.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Constant.hpp; sourceTree = "<group>"; };
BE6B1B051B0A354700CC2135 /* Constant.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Constant.hxx; sourceTree = "<group>"; };
......@@ -7606,6 +7611,8 @@
BE6199301B0F538900906290 /* ParameterInstance.hxx */,
BEF567D41B1741B000AAA2AA /* InitParameter.hpp */,
BEF567D51B1741B000AAA2AA /* InitParameter.hxx */,
BE6B01F11CAD5FD40061AB93 /* StaticIf.hpp */,
BE6B01F21CAD5FD40061AB93 /* StaticIf.hxx */,
);
name = Private;
sourceTree = "<group>";
......@@ -7931,7 +7938,7 @@
BECA4DA61B17598300DC7265 /* SConscript */,
BE6199261B0F2D4300906290 /* InitParameter.hpp */,
BE6199271B0F2D4300906290 /* InitParameter.hxx */,
BE6B1AF21B0A343D00CC2135 /* Parameter.hpp */,
BE6B01F81CAD60DF0061AB93 /* Parameter.hpp */,
BE6B1AF31B0A343D00CC2135 /* Parameter.hxx */,
BE9EA61A1C89F50900836E0E /* ParameterAtDof.hpp */,
135A9AC81C9C5EE200C66720 /* ParameterAtQuadraturePoint.hpp */,
......@@ -10246,6 +10253,7 @@
BE625B311BCBB0D200FB316D /* FiberList.hxx in Headers */,
BE3C40991B0F7DD900396F68 /* ComputeGradientBasedElasticityTensor.hpp in Headers */,
BE44E3B51CAA7775006DDE6F /* TimeDependency.hpp in Headers */,
BE6B01F41CAD5FD40061AB93 /* StaticIf.hpp in Headers */,
BE625B351BCBB0D200FB316D /* ReadFiberFile.hxx in Headers */,
BEB39B881BCBE15E004C0B9D /* ParameterType.hpp in Headers */,
BEF567D71B1741B000AAA2AA /* InitParameter.hpp in Headers */,
......@@ -10256,6 +10264,7 @@
BE6322FD1B188BF500F787CC /* LameLambda.hpp in Headers */,
BE44E3AF1CAA7748006DDE6F /* None.hpp in Headers */,
BE44E3B61CAA7775006DDE6F /* TimeDependency.hxx in Headers */,
BE6B01F51CAD5FD40061AB93 /* StaticIf.hxx in Headers */,
BEB39B821BCBDADF004C0B9D /* FiberListManager.hpp in Headers */,
BEADAD2B1B2ED2C3001D9111 /* AtQuadraturePoint.hxx in Headers */,
BE17F3381B149A2A00EAAACE /* Configuration.hpp in Headers */,
......@@ -10263,6 +10272,7 @@
BE6B01EE1CAD5D310061AB93 /* InitStoredQuantity.hxx in Headers */,
BE3C409A1B0F7DD900396F68 /* ComputeGradientBasedElasticityTensor.hxx in Headers */,
BE6199931B0F65CF00906290 /* Gradient2Strain.hpp in Headers */,
BE6B01F91CAD60DF0061AB93 /* Parameter.hpp in Headers */,
BEB39B831BCBDADF004C0B9D /* FiberListManager.hxx in Headers */,
BEF567D81B1741B000AAA2AA /* InitParameter.hxx in Headers */,
BE625B321BCBB0D200FB316D /* FillGlobalVector.hpp in Headers */,
......@@ -28,6 +28,7 @@
# include "FiniteElement/QuadratureRules/QuadraturePoint.hpp"
# include "Parameters/TimeDependency/None.hpp"
# include "Parameters/Private/StaticIf.hpp"
namespace HappyHeart
......
......@@ -14,65 +14,7 @@
namespace HappyHeart
{
template
<
ParameterNS::Type TypeT,
template<ParameterNS::Type> class TimeDependencyT
>
struct InitNoTimeDependencyHelper
{
static void Perform(typename TimeDependencyT<TypeT>::unique_ptr& time_dependency);
};
template
<
ParameterNS::Type TypeT
>
struct InitNoTimeDependencyHelper<TypeT, ParameterNS::TimeDependencyNS::None>
{
static void Perform(typename ParameterNS::TimeDependencyNS::None<TypeT>::unique_ptr& time_dependency);
};
template
<
ParameterNS::Type TypeT,
template<ParameterNS::Type> class TimeDependencyT
>
void InitNoTimeDependencyHelper<TypeT, TimeDependencyT>
::Perform(typename TimeDependencyT<TypeT>::unique_ptr& time_dependency)
{
// Do nothing!
static_cast<void>(time_dependency);
}
template
<
ParameterNS::Type TypeT
>
void InitNoTimeDependencyHelper<TypeT, ParameterNS::TimeDependencyNS::None>
::Perform(typename ParameterNS::TimeDependencyNS::None<TypeT>::unique_ptr& ptr)
{
ptr = std::make_unique<ParameterNS::TimeDependencyNS::None<TypeT>>();
}
template
<
......@@ -87,7 +29,7 @@ namespace HappyHeart
{
// If there is a time dependency, it must be set up through SetTimeDependency() method.
// If not, I need an empty object for conveniency; let's define it here.
InitNoTimeDependencyHelper<TypeT, TimeDependencyT>::Perform(time_dependency_);
ParameterNS::Private::StaticIf<TypeT, TimeDependencyT>::InitNoTimeDependencyHelper(time_dependency_);
}
......@@ -126,63 +68,7 @@ namespace HappyHeart
}
template
<
ParameterNS::Type TypeT,
class TimeDependencyT
>
struct ApplyTimeFactorHelper
{
using return_type = typename ParameterNS::Traits<TypeT>::return_type;
static return_type Perform(return_type value_without_time_contribution,
const TimeDependencyT& time_dependency_object);
};
template<ParameterNS::Type TypeT>
struct ApplyTimeFactorHelper<TypeT, ParameterNS::TimeDependencyNS::None<TypeT>>
{
using return_type = typename ParameterNS::Traits<TypeT>::return_type;
static return_type Perform(return_type value_without_time_contribution,
const ParameterNS::TimeDependencyNS::None<TypeT>& unused);
};
template
<
ParameterNS::Type TypeT,
class TimeDependencyT
>
typename ApplyTimeFactorHelper<TypeT, TimeDependencyT>::return_type
ApplyTimeFactorHelper<TypeT, TimeDependencyT>
::Perform(return_type value_without_time_factor,
const TimeDependencyT& time_dependency_object)
{
return time_dependency_object.ApplyTimeFactor(value_without_time_factor);
}
template<ParameterNS::Type TypeT>
typename ApplyTimeFactorHelper<TypeT, ParameterNS::TimeDependencyNS::None<TypeT>>::return_type
ApplyTimeFactorHelper<TypeT, ParameterNS::TimeDependencyNS::None<TypeT>>
::Perform(return_type value_without_time_factor,
const ParameterNS::TimeDependencyNS::None<TypeT>& unused)
{
static_cast<void>(unused);
return value_without_time_factor;
}
template
<
ParameterNS::Type TypeT,
......@@ -192,8 +78,9 @@ namespace HappyHeart
Parameter<TypeT, TimeDependencyT>
::ApplyTimeDependancyFactor(typename Parameter<TypeT, TimeDependencyT>::return_type value_without_time) const
{
return ApplyTimeFactorHelper<TypeT, TimeDependencyT<TypeT>>::Perform(value_without_time,
GetTimeDependency());
return ParameterNS::Private::StaticIf<TypeT, TimeDependencyT>
::ApplyTimeFactor(value_without_time,
GetTimeDependency());
}
......
//! \file
//
//
// StaticIf.hpp
// HappyHeart
//
// Created by Sebastien Gilles on 31/03/16.
// Copyright © 2016 Inria. All rights reserved.
//
#ifndef HAPPY_HEART_x_PARAMETERS_x_PRIVATE_x_STATIC_IF_HPP_
# define HAPPY_HEART_x_PARAMETERS_x_PRIVATE_x_STATIC_IF_HPP_
# include <memory>
# include <vector>
# include "Core/ParameterType.hpp"
# include "Parameters/TimeDependency/None.hpp"
namespace HappyHeart
{
namespace ParameterNS
{
namespace Private
{
template
<
ParameterNS::Type TypeT,
template<ParameterNS::Type> class TimeDependencyT
>
struct StaticIf
{
static void InitNoTimeDependencyHelper(typename TimeDependencyT<TypeT>::unique_ptr& time_dependency);
using return_type = typename ParameterNS::Traits<TypeT>::return_type;
static return_type ApplyTimeFactor(return_type value_without_time_contribution,
const TimeDependencyT<TypeT>& time_dependency_object);
};
template
<
ParameterNS::Type TypeT
>
struct StaticIf<TypeT, ParameterNS::TimeDependencyNS::None>
{
static void InitNoTimeDependencyHelper(typename TimeDependencyNS::None<TypeT>::unique_ptr& time_dependency);
using return_type = typename ParameterNS::Traits<TypeT>::return_type;
static return_type ApplyTimeFactor(return_type value_without_time_contribution,
const TimeDependencyNS::None<TypeT>& time_dependency_object);
};
} // namespace Private
} // namespace ParameterNS
} // namespace HappyHeart
# include "Parameters/Private/StaticIf.hxx"
#endif // HAPPY_HEART_x_PARAMETERS_x_PRIVATE_x_STATIC_IF_HPP_
//! \file
//
//
// StaticIf.hxx
// HappyHeart
//
// Created by Sebastien Gilles on 31/03/16.
// Copyright © 2016 Inria. All rights reserved.
//
#ifndef HAPPY_HEART_x_PARAMETERS_x_PRIVATE_x_STATIC_IF_HXX_
# define HAPPY_HEART_x_PARAMETERS_x_PRIVATE_x_STATIC_IF_HXX_
namespace HappyHeart
{
namespace ParameterNS
{
namespace Private
{
template
<
ParameterNS::Type TypeT,
template<ParameterNS::Type> class TimeDependencyT
>
void StaticIf<TypeT, TimeDependencyT>
::InitNoTimeDependencyHelper(typename TimeDependencyT<TypeT>::unique_ptr& time_dependency)
{
// Do nothing!
static_cast<void>(time_dependency);
}
template
<
ParameterNS::Type TypeT
>
void StaticIf<TypeT, ParameterNS::TimeDependencyNS::None>
::InitNoTimeDependencyHelper(typename ParameterNS::TimeDependencyNS::None<TypeT>::unique_ptr& time_dependency)
{
time_dependency = std::make_unique<ParameterNS::TimeDependencyNS::None<TypeT>>();
}
template
<
ParameterNS::Type TypeT,
template<ParameterNS::Type> class TimeDependencyT
>
typename StaticIf<TypeT, TimeDependencyT>::return_type
StaticIf<TypeT, TimeDependencyT>
::ApplyTimeFactor(return_type value_without_time_factor,
const TimeDependencyT<TypeT>& time_dependency_object)
{
return time_dependency_object.ApplyTimeFactor(value_without_time_factor);
}
template<ParameterNS::Type TypeT>
typename StaticIf<TypeT, ParameterNS::TimeDependencyNS::None>::return_type
StaticIf<TypeT, ParameterNS::TimeDependencyNS::None>
::ApplyTimeFactor(return_type value_without_time_factor,
const ParameterNS::TimeDependencyNS::None<TypeT>& unused)
{
static_cast<void>(unused);
return value_without_time_factor;
}
} // namespace Private
} // namespace ParameterNS
} // namespace HappyHeart
#endif // HAPPY_HEART_x_PARAMETERS_x_PRIVATE_x_STATIC_IF_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