Commit 213fecc2 authored by GILLES Sebastien's avatar GILLES Sebastien
Browse files

#531 Make the code more generic with metaprogramming: new Assemble531() calls...

#531 Make the code more generic with metaprogramming: new Assemble531() calls correctly Assembly531() for all elements of the tuple.
parent eed35e5c
......@@ -830,6 +830,8 @@
BEA3FA7E1AF10AA000D3F871 /* Recursivity.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BEA3FA7B1AF10AA000D3F871 /* Recursivity.cpp */; };
BEA3FA7F1AF10AA000D3F871 /* Recursivity.hpp in Headers */ = {isa = PBXBuildFile; fileRef = BEA3FA7C1AF10AA000D3F871 /* Recursivity.hpp */; };
BEA3FA801AF10AA000D3F871 /* Recursivity.hxx in Headers */ = {isa = PBXBuildFile; fileRef = BEA3FA7D1AF10AA000D3F871 /* Recursivity.hxx */; };
BEA3FA8C1AF10CFB00D3F871 /* Recursivity.hpp in Headers */ = {isa = PBXBuildFile; fileRef = BEA3FA891AF10CFB00D3F871 /* Recursivity.hpp */; };
BEA3FA8D1AF10CFB00D3F871 /* Recursivity.hxx in Headers */ = {isa = PBXBuildFile; fileRef = BEA3FA8A1AF10CFB00D3F871 /* Recursivity.hxx */; };
BEA9CB9F1A1E26A8003A6276 /* libCore.a in Frameworks */ = {isa = PBXBuildFile; fileRef = BE05B52916D238FE000E248D /* libCore.a */; };
BEA9CBA01A1E26A8003A6276 /* libGeometry.a in Frameworks */ = {isa = PBXBuildFile; fileRef = BE05B4DD16D23573000E248D /* libGeometry.a */; };
BEA9CBA11A1E26A8003A6276 /* libUtilities.a in Frameworks */ = {isa = PBXBuildFile; fileRef = BEA8A379177AD4FE009436C9 /* libUtilities.a */; };
......@@ -2173,6 +2175,8 @@
BEA3FA7B1AF10AA000D3F871 /* Recursivity.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Recursivity.cpp; sourceTree = "<group>"; };
BEA3FA7C1AF10AA000D3F871 /* Recursivity.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Recursivity.hpp; sourceTree = "<group>"; };
BEA3FA7D1AF10AA000D3F871 /* Recursivity.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Recursivity.hxx; sourceTree = "<group>"; };
BEA3FA891AF10CFB00D3F871 /* Recursivity.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Recursivity.hpp; sourceTree = "<group>"; };
BEA3FA8A1AF10CFB00D3F871 /* Recursivity.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Recursivity.hxx; sourceTree = "<group>"; };
BEA4FC2A18214B6A002B2EA1 /* TransientParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TransientParameters.cpp; sourceTree = "<group>"; };
BEA4FC2B18214B6A002B2EA1 /* TransientParameters.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = TransientParameters.hpp; sourceTree = "<group>"; };
BEA4FC4418214D8F002B2EA1 /* VariationalFormulation.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; lineEnding = 0; path = VariationalFormulation.hpp; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.cpp; };
......@@ -3340,7 +3344,6 @@
BE4DDE851AE1332900D60CCC /* Private */ = {
isa = PBXGroup;
children = (
BE4DDE861AE1332900D60CCC /* Crtp */,
BE4DDE891AE1332900D60CCC /* GlobalLinearAlgebraHelper.cpp */,
BE4DDE8A1AE1332900D60CCC /* GlobalLinearAlgebraHelper.hpp */,
BE4DDE8B1AE1332900D60CCC /* GlobalLinearAlgebraHelper.hxx */,
......@@ -3350,6 +3353,8 @@
BEA3FA7B1AF10AA000D3F871 /* Recursivity.cpp */,
BEA3FA7C1AF10AA000D3F871 /* Recursivity.hpp */,
BEA3FA7D1AF10AA000D3F871 /* Recursivity.hxx */,
BEA3FA811AF10CD000D3F871 /* Impl */,
BE4DDE861AE1332900D60CCC /* Crtp */,
);
path = Private;
sourceTree = "<group>";
......@@ -4069,6 +4074,15 @@
path = Private;
sourceTree = "<group>";
};
BEA3FA811AF10CD000D3F871 /* Impl */ = {
isa = PBXGroup;
children = (
BEA3FA891AF10CFB00D3F871 /* Recursivity.hpp */,
BEA3FA8A1AF10CFB00D3F871 /* Recursivity.hxx */,
);
path = Impl;
sourceTree = "<group>";
};
BEA4FC4118214D62002B2EA1 /* FormulationSolver */ = {
isa = PBXGroup;
children = (
......@@ -5251,6 +5265,7 @@
BEB03EB61A36056B00E99AAC /* Force.hpp in Headers */,
BE90E0F71A2491AE00CCAFDE /* FiniteElt.hpp in Headers */,
BE4B47071AE107730078955C /* LocalVariationalOperator.hxx in Headers */,
BEA3FA8D1AF10CFB00D3F871 /* Recursivity.hxx in Headers */,
BEB03EB71A36056B00E99AAC /* Force.hxx in Headers */,
BE90E0A11A2491AE00CCAFDE /* ScalarDivVectorial.hxx in Headers */,
BEDAC3C81AD7FBB500AA2156 /* NdofHolder.hpp in Headers */,
......@@ -5428,6 +5443,7 @@
BE90E0A51A2491AE00CCAFDE /* GradOnGradientBasedHyperelasticityTensor.hpp in Headers */,
BE2B66501A2778C700E80864 /* BasicRefFEltFactory.hpp in Headers */,
BE90E1031A2491AE00CCAFDE /* QuadratureRuleList.hxx in Headers */,
BEA3FA8C1AF10CFB00D3F871 /* Recursivity.hpp in Headers */,
BE90E13A1A2491AE00CCAFDE /* DirichletBoundaryCondition.hxx in Headers */,
BE4DDE931AE1332900D60CCC /* GlobalLinearAlgebraHelper.hxx in Headers */,
BE90E1371A2491AE00CCAFDE /* ComponentManager.hxx in Headers */,
......
......@@ -29,7 +29,7 @@
# include "FiniteElement/FiniteElement/LocalFEltSpace.hpp"
# include "FiniteElement/Operators/GlobalVariationalOperator/Private/GlobalVariationalOperator.hpp"
# include "FiniteElement/Operators/GlobalVariationalOperator/Private/GlobalLinearAlgebraHelper.hpp"
# include "FiniteElement/Operators/GlobalVariationalOperator/Private/Recursivity.hpp"
namespace HappyHeart
......
......@@ -305,7 +305,7 @@ namespace HappyHeart
}
}
std::get<0>(linear_algebra_tuple).first.Assembly(__FILE__, __LINE__);
Private::Assembly531(linear_algebra_tuple);
}
......
//
// Recursivity.hpp
// HappyHeart
//
// Created by Sebastien Gilles on 29/04/15.
// Copyright (c) 2015 Inria. All rights reserved.
//
#ifndef _HAPPY_HEART__FINITE_ELEMENT__OPERATORS__GLOBAL_VARIATIONAL_OPERATOR__PRIVATE__IMPL__RECURSIVITY_HPP_
# define _HAPPY_HEART__FINITE_ELEMENT__OPERATORS__GLOBAL_VARIATIONAL_OPERATOR__PRIVATE__IMPL__RECURSIVITY_HPP_
# include <memory>
# include <vector>
namespace HappyHeart
{
namespace Private
{
namespace Impl
{
template<class LinearAlgebraTupleT, std::size_t I, std::size_t TupleSizeT>
struct Assembly531
{
using current_type = typename std::tuple_element<I, LinearAlgebraTupleT>::type;
static void Perform(const LinearAlgebraTupleT& linear_algebra_tuple);
};
template<class LinearAlgebraTupleT, std::size_t TupleSizeT>
struct Assembly531<LinearAlgebraTupleT, TupleSizeT, TupleSizeT>
{
static void Perform(const LinearAlgebraTupleT& linear_algebra_tuple);
};
} //namespace Impl
} //namespace Private
} // namespace HappyHeart
# include "FiniteElement/Operators/GlobalVariationalOperator/Private/Impl/Recursivity.hxx"
#endif // _HAPPY_HEART__FINITE_ELEMENT__OPERATORS__GLOBAL_VARIATIONAL_OPERATOR__PRIVATE__IMPL__RECURSIVITY_HPP_
//
// Recursivity.hxx
// HappyHeart
//
// Created by Sebastien Gilles on 29/04/15.
// Copyright (c) 2015 Inria. All rights reserved.
//
#ifndef _HAPPY_HEART__FINITE_ELEMENT__OPERATORS__GLOBAL_VARIATIONAL_OPERATOR__PRIVATE__IMPL__RECURSIVITY_HXX_
# define _HAPPY_HEART__FINITE_ELEMENT__OPERATORS__GLOBAL_VARIATIONAL_OPERATOR__PRIVATE__IMPL__RECURSIVITY_HXX_
namespace HappyHeart
{
namespace Private
{
namespace Impl
{
template<class LinearAlgebraTupleT, std::size_t I, std::size_t TupleSizeT>
void Assembly531<LinearAlgebraTupleT, I, TupleSizeT>
::Perform(const LinearAlgebraTupleT& linear_algebra_tuple)
{
static_assert(I < TupleSizeT, "Otherwise endless recursion!");
auto& current_linear_algebra = std::get<I>(linear_algebra_tuple).first;
current_linear_algebra.Assembly(__FILE__, __LINE__);
Assembly531<LinearAlgebraTupleT, I + 1, TupleSizeT>::Perform(linear_algebra_tuple);
}
template<class LinearAlgebraTupleT, std::size_t TupleSizeT>
void Assembly531<LinearAlgebraTupleT, TupleSizeT, TupleSizeT>
::Perform(const LinearAlgebraTupleT& linear_algebra_tuple)
{
// End recursion.
}
} //namespace Impl
} //namespace Private
} // namespace HappyHeart
#endif // _HAPPY_HEART__FINITE_ELEMENT__OPERATORS__GLOBAL_VARIATIONAL_OPERATOR__PRIVATE__IMPL__RECURSIVITY_HXX_
......@@ -6,11 +6,12 @@
// Copyright (c) 2015 Inria. All rights reserved.
//
#ifndef __HappyHeart__Recursivity__HPP
# define __HappyHeart__Recursivity__HPP
#ifndef _HAPPY_HEART__FINITE_ELEMENT__OPERATORS__GLOBAL_VARIATIONAL_OPERATOR__PRIVATE__RECURSIVITY_HPP_
# define _HAPPY_HEART__FINITE_ELEMENT__OPERATORS__GLOBAL_VARIATIONAL_OPERATOR__PRIVATE__RECURSIVITY_HPP_
# include <memory>
# include <vector>
# include <tuple>
# include "FiniteElement/Operators/GlobalVariationalOperator/Private/Impl/Recursivity.hpp"
namespace HappyHeart
......@@ -21,6 +22,9 @@ namespace HappyHeart
{
template<class LinearAlgebraTupleT>
void Assembly531(const LinearAlgebraTupleT& linear_algebra_tuple);
} //namespace Private
......@@ -32,4 +36,4 @@ namespace HappyHeart
# include "FiniteElement/Operators/GlobalVariationalOperator/Private/Recursivity.hxx"
#endif /* defined(__HappyHeart__Recursivity__HPP) */
#endif // _HAPPY_HEART__FINITE_ELEMENT__OPERATORS__GLOBAL_VARIATIONAL_OPERATOR__PRIVATE__RECURSIVITY_HPP_
......@@ -6,8 +6,8 @@
// Copyright (c) 2015 Inria. All rights reserved.
//
#ifndef __HappyHeart__Recursivity__HXX
#define __HappyHeart__Recursivity__HXX
#ifndef _HAPPY_HEART__FINITE_ELEMENT__OPERATORS__GLOBAL_VARIATIONAL_OPERATOR__PRIVATE__RECURSIVITY_HXX_
# define _HAPPY_HEART__FINITE_ELEMENT__OPERATORS__GLOBAL_VARIATIONAL_OPERATOR__PRIVATE__RECURSIVITY_HXX_
namespace HappyHeart
......@@ -18,6 +18,16 @@ namespace HappyHeart
{
template<class LinearAlgebraTupleT>
void Assembly531(const LinearAlgebraTupleT& linear_algebra_tuple)
{
Impl::Assembly531<LinearAlgebraTupleT, 0, std::tuple_size<LinearAlgebraTupleT>::value>
::Perform(linear_algebra_tuple);
}
} //namespace Private
......@@ -25,4 +35,4 @@ namespace HappyHeart
} // namespace HappyHeart
#endif /* defined(__HappyHeart__Recursivity__HXX) */
#endif // _HAPPY_HEART__FINITE_ELEMENT__OPERATORS__GLOBAL_VARIATIONAL_OPERATOR__PRIVATE__RECURSIVITY_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