Line data Source code
1 : /*
2 : * Copyright (c) 2012-2015: G-CSC, Goethe University Frankfurt
3 : * Author: Martin Rupp
4 : *
5 : * This file is part of UG4.
6 : *
7 : * UG4 is free software: you can redistribute it and/or modify it under the
8 : * terms of the GNU Lesser General Public License version 3 (as published by the
9 : * Free Software Foundation) with the following additional attribution
10 : * requirements (according to LGPL/GPL v3 §7):
11 : *
12 : * (1) The following notice must be displayed in the Appropriate Legal Notices
13 : * of covered and combined works: "Based on UG4 (www.ug4.org/license)".
14 : *
15 : * (2) The following notice must be displayed at a prominent place in the
16 : * terminal output of covered works: "Based on UG4 (www.ug4.org/license)".
17 : *
18 : * (3) The following bibliography is recommended for citation and must be
19 : * preserved in all covered files:
20 : * "Reiter, S., Vogel, A., Heppner, I., Rupp, M., and Wittum, G. A massively
21 : * parallel geometric multigrid solver on hierarchically distributed grids.
22 : * Computing and visualization in science 16, 4 (2013), 151-164"
23 : * "Vogel, A., Reiter, S., Rupp, M., Nägel, A., and Wittum, G. UG4 -- a novel
24 : * flexible software system for simulating pde based models on high performance
25 : * computers. Computing and visualization in science 16, 4 (2013), 165-179"
26 : *
27 : * This program is distributed in the hope that it will be useful,
28 : * but WITHOUT ANY WARRANTY; without even the implied warranty of
29 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 : * GNU Lesser General Public License for more details.
31 : */
32 :
33 :
34 : #ifndef UTIL_DOMAIN_ALGEBRA_DEPENDENT_H
35 : #define UTIL_DOMAIN_ALGEBRA_DEPENDENT_H
36 :
37 : #include "util_algebra_dependent.h"
38 : #include "util_domain_dependent.h"
39 :
40 : namespace ug{
41 : namespace bridge{
42 :
43 : /// \addtogroup bridge
44 : /// \{
45 :
46 : template < typename Functionality,
47 : typename DomainList = CompileDomainList,
48 : typename AlgebraList = CompileAlgebraList>
49 : struct RegisterDomainAlgebraDependent
50 : {
51 60 : RegisterDomainAlgebraDependent(Registry& reg, std::string grp)
52 : {
53 : static const bool domainIsEmpty = boost::mpl::empty<DomainList>::value;
54 60 : typename boost::mpl::if_c<domainIsEmpty, RegEnd, RegNextDomain>::type (reg,grp);
55 60 : }
56 : struct RegEnd{ RegEnd(Registry& reg, std::string grp){} };
57 :
58 : template <typename CurrAlgebraList>
59 : struct RegNextDomainAlgebra
60 : {
61 135 : RegNextDomainAlgebra(Registry& reg, std::string grp)
62 : {
63 : typedef typename boost::mpl::front<DomainList>::type DomainType;
64 : typedef typename boost::mpl::front<CurrAlgebraList>::type AlgebraType;
65 : typedef typename boost::mpl::pop_front<CurrAlgebraList>::type NextAlgebraList;
66 :
67 270 : Functionality::template DomainAlgebra<DomainType, AlgebraType>(reg,grp);
68 135 : RegAlgebra<NextAlgebraList>(reg,grp);
69 135 : }
70 : };
71 :
72 : template <typename CurrAlgebraList>
73 : struct RegAlgebra
74 : {
75 180 : RegAlgebra(Registry& reg, std::string grp)
76 : {
77 : static const bool algebraIsEmpty = boost::mpl::empty<CurrAlgebraList>::value;
78 180 : typename boost::mpl::if_c<algebraIsEmpty, RegEnd, RegNextDomainAlgebra<CurrAlgebraList> >::type (reg,grp);
79 180 : }
80 : };
81 :
82 : struct RegNextDomain
83 : {
84 45 : RegNextDomain(Registry& reg, std::string grp)
85 : {
86 : typedef typename boost::mpl::pop_front<DomainList>::type NextDomainList;
87 :
88 90 : RegAlgebra<AlgebraList>(reg,grp);
89 45 : RegisterDomainAlgebraDependent<Functionality, NextDomainList, AlgebraList>(reg,grp);
90 45 : }
91 : };
92 : };
93 :
94 :
95 : template < typename Functionality, typename AlgebraList = CompileAlgebraList>
96 : struct RegisterDomain1dAlgebraDependent
97 : {
98 : RegisterDomain1dAlgebraDependent(Registry& reg, std::string grp)
99 : {
100 : #ifdef UG_DIM_1
101 : RegisterDomainAlgebraDependent<Functionality, boost::mpl::list<Domain1d>, AlgebraList>(reg, grp);
102 : #endif
103 : }
104 : };
105 :
106 : template < typename Functionality, typename AlgebraList = CompileAlgebraList>
107 : struct RegisterDomain2dAlgebraDependent
108 : {
109 : RegisterDomain2dAlgebraDependent(Registry& reg, std::string grp)
110 : {
111 : #ifdef UG_DIM_2
112 : RegisterDomainAlgebraDependent<Functionality, boost::mpl::list<Domain2d>, AlgebraList>(reg, grp);
113 : #endif
114 : }
115 : };
116 :
117 :
118 : template < typename Functionality, typename AlgebraList = CompileAlgebraList>
119 : struct RegisterDomain3dAlgebraDependent
120 : {
121 : RegisterDomain3dAlgebraDependent(Registry& reg, std::string grp)
122 : {
123 : #ifdef UG_DIM_3
124 : RegisterDomainAlgebraDependent<Functionality, boost::mpl::list<Domain3d>, AlgebraList>(reg, grp);
125 : #endif
126 : }
127 : };
128 :
129 : template < typename Functionality, typename AlgebraList = CompileAlgebraList>
130 : struct RegisterDomain2d3dAlgebraDependent
131 : {
132 : RegisterDomain2d3dAlgebraDependent(Registry& reg, std::string grp)
133 : {
134 : RegisterDomain2dAlgebraDependent<Functionality, AlgebraList>(reg, grp);
135 : RegisterDomain3dAlgebraDependent<Functionality, AlgebraList>(reg, grp);
136 : }
137 : };
138 :
139 : // end group bridge
140 : /// \}
141 :
142 : }
143 : }
144 : #endif /* UTIL_DOMAIN_ALGEBRA_DEPENDENT_H */
145 :
|