Line data Source code
1 : /*
2 : * Copyright (c) 2012-2015: G-CSC, Goethe University Frankfurt
3 : * Author: Andreas Vogel
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 : // extern headers
34 : #include <iostream>
35 : #include <sstream>
36 : #include <string>
37 :
38 : // include bridge
39 : #include "bridge/bridge.h"
40 : #include "bridge/util.h"
41 : #include "bridge/util_domain_algebra_dependent.h"
42 :
43 : // lib_disc includes
44 : #include "lib_disc/function_spaces/grid_function.h"
45 : #include "lib_disc/function_spaces/interpolate.h"
46 : #include "lib_disc/function_spaces/interpolate_inner.h"
47 :
48 : using namespace std;
49 :
50 : namespace ug{
51 : namespace bridge{
52 : namespace Interpolate{
53 :
54 : /**
55 : * \defgroup interpolate_bridge Interpolation Bridge
56 : * \ingroup disc_bridge
57 : * \{
58 : */
59 :
60 : /**
61 : * Class exporting the functionality. All functionality that is to
62 : * be used in scripts or visualization must be registered here.
63 : */
64 : struct Functionality
65 : {
66 :
67 : /**
68 : * Function called for the registration of Domain and Algebra dependent parts.
69 : * All Functions and Classes depending on both Domain and Algebra
70 : * are to be placed here when registering. The method is called for all
71 : * available Domain and Algebra types, based on the current build options.
72 : *
73 : * @param reg registry
74 : * @param parentGroup group for sorting of functionality
75 : */
76 : template <typename TDomain, typename TAlgebra>
77 9 : static void DomainAlgebra(Registry& reg, string grp)
78 : {
79 : string suffix = GetDomainAlgebraSuffix<TDomain,TAlgebra>();
80 : string tag = GetDomainAlgebraTag<TDomain,TAlgebra>();
81 :
82 : // typedef
83 : static const int dim = TDomain::dim;
84 : typedef ug::GridFunction<TDomain, TAlgebra> TFct;
85 :
86 : // Interpolate
87 : {
88 27 : reg.add_function("Interpolate", static_cast<void (*)(SmartPtr<UserData<number, dim> >, SmartPtr<TFct>, const char*, const char*, number)>(&ug::Interpolate<TFct>),grp, "Integral", "Data#GridFunction#Component#Subsets#Time");
89 27 : reg.add_function("Interpolate", static_cast<void (*)(SmartPtr<UserData<number, dim> >, SmartPtr<TFct>, const char*, number)>(&ug::Interpolate<TFct>),grp, "Integral", "Data#GridFunction#Component#Time");
90 27 : reg.add_function("Interpolate", static_cast<void (*)(SmartPtr<UserData<number, dim> >, SmartPtr<TFct>, const char*, const char*)>(&ug::Interpolate<TFct>), grp, "Integral", "Data#GridFunction#Component#Subsets");
91 27 : reg.add_function("Interpolate", static_cast<void (*)(SmartPtr<UserData<number, dim> >, SmartPtr<TFct>, const char*)>(&ug::Interpolate<TFct>),grp, "Integral", "Data#GridFunction#Component");
92 :
93 27 : reg.add_function("Interpolate", static_cast<void (*)(number, SmartPtr<TFct>, const char*, const char*, number)>(&ug::Interpolate<TFct>),grp, "Integral", "ConstantValue#GridFunction#Component#Subsets#Time");
94 27 : reg.add_function("Interpolate", static_cast<void (*)(number, SmartPtr<TFct>, const char*, number)>(&ug::Interpolate<TFct>),grp, "Integral", "ConstantValue#GridFunction#Component#Time");
95 27 : reg.add_function("Interpolate", static_cast<void (*)(number, SmartPtr<TFct>, const char*, const char*)>(&ug::Interpolate<TFct>), grp, "Integral", "ConstantValue#GridFunction#Component#Subsets");
96 27 : reg.add_function("Interpolate", static_cast<void (*)(number, SmartPtr<TFct>, const char*)>(&ug::Interpolate<TFct>),grp, "Integral", "ConstantValue#GridFunction#Component");
97 :
98 : #ifdef UG_FOR_LUA
99 : // function-string
100 27 : reg.add_function("Interpolate", static_cast<void (*)(const char*, SmartPtr<TFct>, const char*, const char*, number)>(&ug::Interpolate<TFct>),grp, "Integral", "LuaFunction#GridFunction#Component#Subsets#Time");
101 27 : reg.add_function("Interpolate", static_cast<void (*)(const char*, SmartPtr<TFct>, const char*, number)>(&ug::Interpolate<TFct>),grp, "Integral", "LuaFunction#GridFunction#Component#Time");
102 27 : reg.add_function("Interpolate", static_cast<void (*)(const char*, SmartPtr<TFct>, const char*, const char*)>(&ug::Interpolate<TFct>), grp, "Integral", "LuaFunction#GridFunction#Component#Subsets");
103 27 : reg.add_function("Interpolate", static_cast<void (*)(const char*, SmartPtr<TFct>, const char*)>(&ug::Interpolate<TFct>),grp, "Integral", "LuaFunction#GridFunction#Component");
104 :
105 : // function-handle
106 27 : reg.add_function("Interpolate", static_cast<void (*)(LuaFunctionHandle, SmartPtr<TFct>, const char*, const char*, number)>(&ug::Interpolate<TFct>),grp, "Integral", "LuaFunction#GridFunction#Component#Subsets#Time");
107 27 : reg.add_function("Interpolate", static_cast<void (*)(LuaFunctionHandle, SmartPtr<TFct>, const char*, number)>(&ug::Interpolate<TFct>),grp, "Integral", "LuaFunction#GridFunction#Component#Time");
108 27 : reg.add_function("Interpolate", static_cast<void (*)(LuaFunctionHandle, SmartPtr<TFct>, const char*, const char*)>(&ug::Interpolate<TFct>), grp, "Integral", "LuaFunction#GridFunction#Component#Subsets");
109 27 : reg.add_function("Interpolate", static_cast<void (*)(LuaFunctionHandle, SmartPtr<TFct>, const char*)>(&ug::Interpolate<TFct>),grp, "Integral", "LuaFunction#GridFunction#Component");
110 : #endif
111 : }
112 :
113 : //IterpolateDiff
114 : {
115 :
116 27 : reg.add_function("Interpolate", static_cast<void (*)(SmartPtr<UserData<number, dim> >, SmartPtr<TFct>, const char*, const MathVector<dim>&)>(&ug::Interpolate<TFct>),grp, "Integral", "Data#GridFunction#Component#MoveVector");
117 : #ifdef UG_FOR_LUA
118 : //reg.add_function("Interpolate", static_cast<void (*)(LuaFunctionHandle, SmartPtr<TFct>, const char*,const SmartPtr<CplUserData<MathVector<dim>, dim> >)>(&ug::Interpolate<TFct>),grp, "Integral", "LuaFunction#GridFunction#Component#DiffVector");
119 : #endif
120 : }
121 :
122 : // InterpolateInner
123 : {
124 27 : reg.add_function("InterpolateInner", static_cast<void (*)(SmartPtr<UserData<number, dim> >, SmartPtr<TFct>, const char*, const char*, number)>(&ug::InterpolateInner<TFct>),grp, "Integral", "Data#GridFunction#Component#Subsets#Time");
125 27 : reg.add_function("InterpolateInner", static_cast<void (*)(SmartPtr<UserData<number, dim> >, SmartPtr<TFct>, const char*, number)>(&ug::InterpolateInner<TFct>),grp, "Integral", "Data#GridFunction#Component#Time");
126 27 : reg.add_function("InterpolateInner", static_cast<void (*)(SmartPtr<UserData<number, dim> >, SmartPtr<TFct>, const char*, const char*)>(&ug::InterpolateInner<TFct>), grp, "Integral", "Data#GridFunction#Component#Subsets");
127 27 : reg.add_function("InterpolateInner", static_cast<void (*)(SmartPtr<UserData<number, dim> >, SmartPtr<TFct>, const char*)>(&ug::InterpolateInner<TFct>),grp, "Integral", "Data#GridFunction#Component");
128 :
129 27 : reg.add_function("InterpolateInner", static_cast<void (*)(number, SmartPtr<TFct>, const char*, const char*, number)>(&ug::InterpolateInner<TFct>),grp, "Integral", "ConstantValue#GridFunction#Component#Subsets#Time");
130 27 : reg.add_function("InterpolateInner", static_cast<void (*)(number, SmartPtr<TFct>, const char*, number)>(&ug::InterpolateInner<TFct>),grp, "Integral", "ConstantValue#GridFunction#Component#Time");
131 27 : reg.add_function("InterpolateInner", static_cast<void (*)(number, SmartPtr<TFct>, const char*, const char*)>(&ug::InterpolateInner<TFct>), grp, "Integral", "ConstantValue#GridFunction#Component#Subsets");
132 27 : reg.add_function("InterpolateInner", static_cast<void (*)(number, SmartPtr<TFct>, const char*)>(&ug::InterpolateInner<TFct>),grp, "Integral", "ConstantValue#GridFunction#Component");
133 :
134 : #ifdef UG_FOR_LUA
135 27 : reg.add_function("InterpolateInner", static_cast<void (*)(const char*, SmartPtr<TFct>, const char*, const char*, number)>(&ug::InterpolateInner<TFct>),grp, "Integral", "LuaFunction#GridFunction#Component#Subsets#Time");
136 27 : reg.add_function("InterpolateInner", static_cast<void (*)(const char*, SmartPtr<TFct>, const char*, number)>(&ug::InterpolateInner<TFct>),grp, "Integral", "LuaFunction#GridFunction#Component#Time");
137 27 : reg.add_function("InterpolateInner", static_cast<void (*)(const char*, SmartPtr<TFct>, const char*, const char*)>(&ug::InterpolateInner<TFct>), grp, "Integral", "LuaFunction#GridFunction#Component#Subsets");
138 27 : reg.add_function("InterpolateInner", static_cast<void (*)(const char*, SmartPtr<TFct>, const char*)>(&ug::InterpolateInner<TFct>),grp, "Integral", "LuaFunction#GridFunction#Component");
139 : #endif
140 : }
141 9 : }
142 :
143 : /**
144 : * Function called for the registration of Domain dependent parts.
145 : * All Functions and Classes depending on the Domain
146 : * are to be placed here when registering. The method is called for all
147 : * available Domain types, based on the current build options.
148 : *
149 : * @param reg registry
150 : * @param parentGroup group for sorting of functionality
151 : */
152 : template <typename TDomain>
153 : static void Domain(Registry& reg, string grp)
154 : {
155 : string suffix = GetDomainSuffix<TDomain>();
156 : string tag = GetDomainTag<TDomain>();
157 : }
158 :
159 : /**
160 : * Function called for the registration of Dimension dependent parts.
161 : * All Functions and Classes depending on the Dimension
162 : * are to be placed here when registering. The method is called for all
163 : * available Dimension types, based on the current build options.
164 : *
165 : * @param reg registry
166 : * @param parentGroup group for sorting of functionality
167 : */
168 : template <int dim>
169 : static void Dimension(Registry& reg, string grp)
170 : {
171 : string suffix = GetDimensionSuffix<dim>();
172 : string tag = GetDimensionTag<dim>();
173 :
174 : }
175 :
176 : /**
177 : * Function called for the registration of Algebra dependent parts.
178 : * All Functions and Classes depending on Algebra
179 : * are to be placed here when registering. The method is called for all
180 : * available Algebra types, based on the current build options.
181 : *
182 : * @param reg registry
183 : * @param parentGroup group for sorting of functionality
184 : */
185 : template <typename TAlgebra>
186 : static void Algebra(Registry& reg, string grp)
187 : {
188 : string suffix = GetAlgebraSuffix<TAlgebra>();
189 : string tag = GetAlgebraTag<TAlgebra>();
190 :
191 : }
192 :
193 : /**
194 : * Function called for the registration of Domain and Algebra independent parts.
195 : * All Functions and Classes not depending on Domain and Algebra
196 : * are to be placed here when registering.
197 : *
198 : * @param reg registry
199 : * @param parentGroup group for sorting of functionality
200 : */
201 : static void Common(Registry& reg, string grp)
202 : {
203 : }
204 :
205 : }; // end Functionality
206 :
207 : // end group interpolate_bridge
208 : /// \}
209 :
210 : }// namespace Interpolate
211 :
212 : /// \addtogroup interpolate_bridge
213 1 : void RegisterBridge_Interpolate(Registry& reg, string grp)
214 : {
215 1 : grp.append("/Discretization");
216 : typedef Interpolate::Functionality Functionality;
217 :
218 : try{
219 : // RegisterCommon<Functionality>(reg,grp);
220 : // RegisterDimensionDependent<Functionality>(reg,grp);
221 : // RegisterDomainDependent<Functionality>(reg,grp);
222 : // RegisterAlgebraDependent<Functionality>(reg,grp);
223 1 : RegisterDomainAlgebraDependent<Functionality>(reg,grp);
224 : }
225 0 : UG_REGISTRY_CATCH_THROW(grp);
226 1 : }
227 :
228 : }// end of namespace bridge
229 : }// end of namespace ug
|