DUNE-ACFEM (unstable)

symmetry.hh
1#ifndef __DUNE_ACFEM_MODELS_SYMMETRY_HH__
2#define __DUNE_ACFEM_MODELS_SYMMETRY_HH__
3
4#include "../expressions/storage.hh"
5#include "modeltraits.hh"
6
7namespace Dune {
8
9 namespace ACFem {
10
11 namespace PDEModel {
12
15 {};
16
17 template<class T, std::enable_if_t<!IsPDEModel<T>::value, int> = 0>
18 constexpr auto isSymmetric(T&&)
19 {
20 return TrueType{};
21 }
22
23 template<class T, std::enable_if_t<(IsPDEModel<T>::value
24 && (!IsExpression<T>::value || IsSelfExpression<T>::value)
25 ), int> = 0>
26 constexpr auto isSymmetric(T&&)
27 {
28 return BoolConstant<HasTag<T, SymmetricModel>::value || ModelTraits<T>::isLoad>{};
29 }
30
31 namespace {
32
33 template<class T, std::size_t... Idx>
34 constexpr auto isSymmetricExpander(T&& t, IndexSequence<Idx...>)
35 {
36 return BoolConstant<(... && decltype(isSymmetric(std::forward<T>(t).template operand<Idx>()))::value)>{};
37 }
38
39 }
40
41 template<class T, std::enable_if_t<(IsPDEModel<T>::value
42 && IsExpression<T>::value
43 && !IsSelfExpression<T>::value
44 ), int> = 0>
45 constexpr auto isSymmetric(T&& t)
46 {
47 if constexpr (HasTag<T, SymmetricModel>::value || ModelTraits<T>::isLoad) {
48 return TrueType{};
49 } else if constexpr (!IsExpression<T>::value || IsSelfExpression<T>::value) {
50 return FalseType{};
51 } else {
52 return isSymmetricExpander(std::forward<T>(t), MakeIndexSequence<Expressions::Arity<T>::value>{});
53 }
54 }
55
56 } // PDEModel::
57
58 } // ACFem::
59
60} // Dune::
61
62#endif // __DUNE_ACFEM_MODELS_SYMMETRY_HH__
MakeSequence< std::size_t, N, Offset, Stride, Repeat > MakeIndexSequence
Make a sequence of std::size_t elements.
Definition: generators.hh:34
Constant< bool, V > BoolConstant
Short-cut for integral constant of type bool.
Definition: types.hh:48
BoolConstant< false > FalseType
Alias for std::false_type.
Definition: types.hh:110
BoolConstant< true > TrueType
Alias for std::true_type.
Definition: types.hh:107
Tag structure identifying symmetric models.
Definition: symmetry.hh:15
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden & Uni Heidelberg  |  generated with Hugo v0.111.3 (Sep 4, 22:38, 2025)