ug4
util_domain_dependent.h
Go to the documentation of this file.
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 #ifndef UTIL_DOMAIN_DEPENDENT_H
34 #define UTIL_DOMAIN_DEPENDENT_H
35 
36 
37 
38 #include "registry/registry.h"
39 #include "lib_disc/domain.h"
40 
41 #include "suffix_tag.h"
42 
43 #include <boost/mpl/if.hpp>
44 #include <boost/mpl/list.hpp>
45 #include <boost/mpl/empty.hpp>
46 #include <boost/mpl/front.hpp>
47 #include <boost/mpl/pop_front.hpp>
48 
49 
50 namespace ug{
51 namespace bridge{
52 
55 
57 // Default Domain List
59 
60 typedef boost::mpl::list<
61 #ifdef UG_DIM_1
62  Domain1d
63 #endif
64 #if defined UG_DIM_1 && (defined UG_DIM_2 || defined UG_DIM_3)
65  ,
66 #endif
67 #ifdef UG_DIM_2
68  Domain2d
69 #endif
70 #if defined UG_DIM_2 && defined UG_DIM_3
71  ,
72 #endif
73 #ifdef UG_DIM_3
74  Domain3d
75 #endif
77 
79 // Register invokers
81 
82 template <typename Functionality, typename List = CompileDomainList>
84 {
85  RegisterDomainDependent(Registry& reg, std::string grp)
86  {
87  static const bool isEmpty = boost::mpl::empty<List>::value;
88  typename boost::mpl::if_c<isEmpty, RegEnd, RegNext>::type (reg,grp);
89  }
90  struct RegEnd{ RegEnd(Registry& reg, std::string grp){} };
91  struct RegNext
92  {
93  RegNext(Registry& reg, std::string grp)
94  {
95  typedef typename boost::mpl::front<List>::type DomainType;
96  typedef typename boost::mpl::pop_front<List>::type NextList;
97  Functionality::template Domain<DomainType>(reg,grp);
99  }
100  };
101 };
102 
103 template<typename Functionality>
104 void RegisterDomain1dDependent(Registry& reg, std::string grp)
105 {
106 #ifdef UG_DIM_1
108 #endif
109 }
110 
111 template<typename Functionality>
112 void RegisterDomain2dDependent(Registry& reg, std::string grp)
113 {
114 #ifdef UG_DIM_2
116 #endif
117 }
118 
119 template<typename Functionality>
120 void RegisterDomain3dDependent(Registry& reg, std::string grp)
121 {
122 #ifdef UG_DIM_3
124 #endif
125 }
126 
127 template<typename Functionality>
128 void RegisterDomain2d3dDependent(Registry& reg, std::string grp)
129 {
130  RegisterDomain2dDependent<Functionality>(reg, grp);
131  RegisterDomain3dDependent<Functionality>(reg, grp);
132 }
133 
134 // end group bridge
136 
137 } // namespace bridge
138 } // namespace ug
139 
140 #endif /* UTIL_DOMAIN_DEPENDENT_H */
141 
Definition: domain.h:287
Registry for functions and classes that are exported to scripts and visualizations.
Definition: registry.h:138
void RegisterDomain2dDependent(Registry &reg, std::string grp)
Definition: util_domain_dependent.h:112
void RegisterDomain3dDependent(Registry &reg, std::string grp)
Definition: util_domain_dependent.h:120
void RegisterDomain1dDependent(Registry &reg, std::string grp)
Definition: util_domain_dependent.h:104
boost::mpl::list<> CompileDomainList
Definition: util_domain_dependent.h:76
void RegisterDomain2d3dDependent(Registry &reg, std::string grp)
Definition: util_domain_dependent.h:128
Domain< 3, MultiGrid, MGSubsetHandler > Domain3d
Definition: domain.h:348
Domain< 1, MultiGrid, MGSubsetHandler > Domain1d
Definition: domain.h:346
Domain< 2, MultiGrid, MGSubsetHandler > Domain2d
Definition: domain.h:347
the ug namespace
Definition: util_domain_dependent.h:90
RegEnd(Registry &reg, std::string grp)
Definition: util_domain_dependent.h:90
Definition: util_domain_dependent.h:92
RegNext(Registry &reg, std::string grp)
Definition: util_domain_dependent.h:93
Definition: util_domain_dependent.h:84
RegisterDomainDependent(Registry &reg, std::string grp)
Definition: util_domain_dependent.h:85