Commit 373e8969 authored by GILLES Sebastien's avatar GILLES Sebastien
Browse files

#873 Parameters: move helper code in Private namespace.

parent 133711d2
......@@ -652,6 +652,9 @@
BE6AAE6C1AF7590F00D420CB /* NumberingSubset.hxx in Headers */ = {isa = PBXBuildFile; fileRef = BE6AAE691AF7590F00D420CB /* NumberingSubset.hxx */; };
BE6AAE871AF7726600D420CB /* NumberingSubsetForMatrix.hpp in Headers */ = {isa = PBXBuildFile; fileRef = BE6AAE841AF7726600D420CB /* NumberingSubsetForMatrix.hpp */; };
BE6AAE881AF7726600D420CB /* NumberingSubsetForMatrix.hxx in Headers */ = {isa = PBXBuildFile; fileRef = BE6AAE851AF7726600D420CB /* NumberingSubsetForMatrix.hxx */; };
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 */; };
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 */; };
......@@ -4779,6 +4782,9 @@
BE6AAE691AF7590F00D420CB /* NumberingSubset.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = NumberingSubset.hxx; sourceTree = "<group>"; };
BE6AAE841AF7726600D420CB /* NumberingSubsetForMatrix.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = NumberingSubsetForMatrix.hpp; sourceTree = "<group>"; };
BE6AAE851AF7726600D420CB /* NumberingSubsetForMatrix.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = NumberingSubsetForMatrix.hxx; sourceTree = "<group>"; };
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>"; };
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>"; };
......@@ -7001,6 +7007,9 @@
BE4DC0C91CAD14CE009E03C3 /* ApplyTimeFactor.cpp */,
BE4DC0CA1CAD14CE009E03C3 /* ApplyTimeFactor.hpp */,
BE4DC0CB1CAD14CE009E03C3 /* ApplyTimeFactor.hxx */,
BE6B01E91CAD5D310061AB93 /* InitStoredQuantity.cpp */,
BE6B01EA1CAD5D310061AB93 /* InitStoredQuantity.hpp */,
BE6B01EB1CAD5D310061AB93 /* InitStoredQuantity.hxx */,
);
name = Private;
path = TimeDependency/Private;
......@@ -10221,6 +10230,7 @@
files = (
BE6322FE1B188BF500F787CC /* LameLambda.hxx in Headers */,
BE625B371BCBB0D200FB316D /* Traits.hpp in Headers */,
BE6B01ED1CAD5D310061AB93 /* InitStoredQuantity.hpp in Headers */,
BE6199941B0F65CF00906290 /* Gradient2Strain.hxx in Headers */,
BEF567C91B1735B000AAA2AA /* ThreeDimensionalParameter.hpp in Headers */,
BE646CD91B32FD77008BD37C /* AtQuadraturePoint.hpp in Headers */,
......@@ -10250,6 +10260,7 @@
BEADAD2B1B2ED2C3001D9111 /* AtQuadraturePoint.hxx in Headers */,
BE17F3381B149A2A00EAAACE /* Configuration.hpp in Headers */,
BE01FA331BC677350080AD73 /* AtDof.hpp in Headers */,
BE6B01EE1CAD5D310061AB93 /* InitStoredQuantity.hxx in Headers */,
BE3C409A1B0F7DD900396F68 /* ComputeGradientBasedElasticityTensor.hxx in Headers */,
BE6199931B0F65CF00906290 /* Gradient2Strain.hpp in Headers */,
BEB39B831BCBDADF004C0B9D /* FiberListManager.hxx in Headers */,
......@@ -12356,6 +12367,7 @@
files = (
BE6199921B0F65CF00906290 /* Gradient2Strain.cpp in Sources */,
BE17F3371B149A2A00EAAACE /* Configuration.cpp in Sources */,
BE6B01EC1CAD5D310061AB93 /* InitStoredQuantity.cpp in Sources */,
BE625B361BCBB0D200FB316D /* Traits.cpp in Sources */,
BE01FA321BC677350080AD73 /* AtDof.cpp in Sources */,
BE6A109E1B18923100F19349 /* LameMu.cpp in Sources */,
......@@ -16,6 +16,7 @@ src = Split('''
./Instances/Private/Gradient2Strain.cpp
./Policy/Private/AtDof.cpp
./TimeDependency/Private/ApplyTimeFactor.cpp
./TimeDependency/Private/InitStoredQuantity.cpp
''')
lib = custom.HappyHeartLibrary(env, 'happy_heart_parameters', src)
......
//! \file
//
//
// InitStoredQuantity.cpp
// HappyHeart
//
// Created by Sebastien Gilles on 31/03/16.
// Copyright © 2016 Inria. All rights reserved.
//
#include "Parameters/TimeDependency/Private/InitStoredQuantity.hpp"
namespace HappyHeart
{
namespace ParameterNS
{
namespace TimeDependencyNS
{
namespace Private
{
void InitStoredQuantity<Type::scalar>::Perform(double any_value,
double& stored_value)
{
static_cast<void>(any_value);
static_cast<void>(stored_value);
}
void InitStoredQuantity<Type::vector>::Perform(const LocalVector& any_value,
LocalVector& stored_value)
{
stored_value.Resize(any_value.GetM());
}
void InitStoredQuantity<Type::matrix>::Perform(const LocalMatrix& any_value,
LocalMatrix& stored_value)
{
stored_value.Resize(any_value.GetM(), any_value.GetN());
}
} // namespace Private
} // namespace TimeDependencyNS
} // namespace ParameterNS
} // namespace HappyHeart
//! \file
//
//
// InitStoredQuantity.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_INIT_STORED_QUANTITY_HPP_
# define HAPPY_HEART_x_PARAMETERS_x_TIME_DEPENDENCY_x_PRIVATE_x_INIT_STORED_QUANTITY_HPP_
# include <memory>
# include <vector>
# include "Core/ParameterType.hpp"
namespace HappyHeart
{
namespace ParameterNS
{
namespace TimeDependencyNS
{
namespace Private
{
/*!
* \brief Helper class to mimic static if.
*
* The point is to properly allocate the object that stores the full value of a Parameter at a \a
* QuadraturePoint, once time factor has been taken into account.
*
*/
template<ParameterNS::Type TypeT>
struct InitStoredQuantity;
// ============================
//! \cond IGNORE_BLOCK_IN_DOXYGEN
// ============================
template<>
struct InitStoredQuantity<Type::scalar>
{
static void Perform(double any_value,
double& stored_value);
};
template<>
struct InitStoredQuantity<Type::vector>
{
static void Perform(const LocalVector& any_value,
LocalVector& stored_value);
};
template<>
struct InitStoredQuantity<Type::matrix>
{
static void Perform(const LocalMatrix& any_value,
LocalMatrix& stored_value);
};
// ============================
//! \endcond IGNORE_BLOCK_IN_DOXYGEN
// ============================
} // namespace Private
} // namespace TimeDependencyNS
} // namespace ParameterNS
} // namespace HappyHeart
# include "Parameters/TimeDependency/Private/InitStoredQuantity.hxx"
#endif // HAPPY_HEART_x_PARAMETERS_x_TIME_DEPENDENCY_x_PRIVATE_x_INIT_STORED_QUANTITY_HPP_
//! \file
//
//
// InitStoredQuantity.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_INIT_STORED_QUANTITY_HXX_
# define HAPPY_HEART_x_PARAMETERS_x_TIME_DEPENDENCY_x_PRIVATE_x_INIT_STORED_QUANTITY_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_INIT_STORED_QUANTITY_HXX_
......@@ -19,6 +19,7 @@
# include "Core/TimeManager/TimeManager.hpp"
# include "Parameters/TimeDependency/Private/ApplyTimeFactor.hpp"
# include "Parameters/TimeDependency/Private/InitStoredQuantity.hpp"
namespace HappyHeart
......@@ -32,9 +33,7 @@ namespace HappyHeart
namespace TimeDependencyNS
{
/*!
* \brief Base class when there is a decoupled time dependency.
......
......@@ -35,53 +35,7 @@ namespace HappyHeart
functor_(std::move(functor))
{ }
template<ParameterNS::Type TypeT>
struct InitStoredQuantity;
template<>
struct InitStoredQuantity<Type::scalar>
{
static void Perform(double any_value,
double& stored_value)
{ }
};
template<>
struct InitStoredQuantity<Type::vector>
{
static void Perform(const LocalVector& any_value,
LocalVector& stored_value)
{
stored_value.Resize(any_value.GetM());
}
};
template<>
struct InitStoredQuantity<Type::matrix>
{
static void Perform(const LocalMatrix& any_value,
LocalMatrix& stored_value)
{
stored_value.Resize(any_value.GetM(), any_value.GetN());
}
};
template
<
ParameterNS::Type TypeT,
......@@ -89,7 +43,7 @@ namespace HappyHeart
>
void Base<TypeT, FunctorT>::Init(return_type any_value)
{
InitStoredQuantity<TypeT>::Perform(any_value, GetNonCstValueWithTimeFactor());
Private::InitStoredQuantity<TypeT>::Perform(any_value, GetNonCstValueWithTimeFactor());
}
......
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