Line data Source code
1 : /*
2 : * Copyright (c) 2013-2015: G-CSC, Goethe University Frankfurt
3 : * Authors: Andreas Vogel, Christian Wehner
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/max_error.h"
46 :
47 : using namespace std;
48 :
49 : namespace ug{
50 : namespace bridge{
51 : namespace MaxError{
52 :
53 : /**
54 : * Class exporting the functionality. All functionality that is to
55 : * be used in scripts or visualization must be registered here.
56 : */
57 : struct Functionality
58 : {
59 :
60 : /**
61 : * Function called for the registration of Domain and Algebra dependent parts.
62 : * All Functions and Classes depending on both Domain and Algebra
63 : * are to be placed here when registering. The method is called for all
64 : * available Domain and Algebra types, based on the current build options.
65 : *
66 : * @param reg registry
67 : * @param parentGroup group for sorting of functionality
68 : */
69 : template <typename TDomain, typename TAlgebra>
70 9 : static void DomainAlgebra(Registry& reg, string grp)
71 : {
72 : string suffix = GetDomainAlgebraSuffix<TDomain,TAlgebra>();
73 : string tag = GetDomainAlgebraTag<TDomain,TAlgebra>();
74 :
75 : // typedef
76 : static const int dim = TDomain::dim;
77 : typedef ug::GridFunction<TDomain, TAlgebra> TFct;
78 :
79 : // Maximum error
80 : {
81 27 : reg.add_function("MaxError", static_cast<number (*)(SmartPtr<UserData<number, dim> >, SmartPtr<TFct>, const char*, const char*, number)>(&ug::MaxError<TFct>),grp, "Integral", "Data#GridFunction#Component#Subsets#Time");
82 27 : reg.add_function("MaxError", static_cast<number (*)(SmartPtr<UserData<number, dim> >, SmartPtr<TFct>, const char*, number)>(&ug::MaxError<TFct>),grp, "Integral", "Data#GridFunction#Component#Time");
83 27 : reg.add_function("MaxError", static_cast<number (*)(SmartPtr<UserData<number, dim> >, SmartPtr<TFct>, const char*, const char*)>(&ug::MaxError<TFct>), grp, "Integral", "Data#GridFunction#Component#Subsets");
84 27 : reg.add_function("MaxError", static_cast<number (*)(SmartPtr<UserData<number, dim> >, SmartPtr<TFct>, const char*)>(&ug::MaxError<TFct>),grp, "Integral", "Data#GridFunction#Component");
85 :
86 27 : reg.add_function("MaxError", static_cast<number (*)(number, SmartPtr<TFct>, const char*, const char*, number)>(&ug::MaxError<TFct>),grp, "Integral", "ConstantValue#GridFunction#Component#Subsets#Time");
87 27 : reg.add_function("MaxError", static_cast<number (*)(number, SmartPtr<TFct>, const char*, number)>(&ug::MaxError<TFct>),grp, "Integral", "ConstantValue#GridFunction#Component#Time");
88 27 : reg.add_function("MaxError", static_cast<number (*)(number, SmartPtr<TFct>, const char*, const char*)>(&ug::MaxError<TFct>), grp, "Integral", "ConstantValue#GridFunction#Component#Subsets");
89 27 : reg.add_function("MaxError", static_cast<number (*)(number, SmartPtr<TFct>, const char*)>(&ug::MaxError<TFct>),grp, "Integral", "ConstantValue#GridFunction#Component");
90 :
91 : #ifdef UG_FOR_LUA
92 27 : reg.add_function("MaxError", static_cast<number (*)(const char*, SmartPtr<TFct>, const char*, const char*, number)>(&ug::MaxError<TFct>),grp, "Integral", "LuaFunction#GridFunction#Component#Subsets#Time");
93 27 : reg.add_function("MaxError", static_cast<number (*)(const char*, SmartPtr<TFct>, const char*, number)>(&ug::MaxError<TFct>),grp, "Integral", "LuaFunction#GridFunction#Component#Time");
94 27 : reg.add_function("MaxError", static_cast<number (*)(const char*, SmartPtr<TFct>, const char*, const char*)>(&ug::MaxError<TFct>), grp, "Integral", "LuaFunction#GridFunction#Component#Subsets");
95 27 : reg.add_function("MaxError", static_cast<number (*)(const char*, SmartPtr<TFct>, const char*)>(&ug::MaxError<TFct>),grp, "Integral", "LuaFunction#GridFunction#Component");
96 : #endif
97 : }
98 9 : }
99 :
100 : /**
101 : * Function called for the registration of Domain dependent parts.
102 : * All Functions and Classes depending on the Domain
103 : * are to be placed here when registering. The method is called for all
104 : * available Domain types, based on the current build options.
105 : *
106 : * @param reg registry
107 : * @param parentGroup group for sorting of functionality
108 : */
109 : template <typename TDomain>
110 : static void Domain(Registry& reg, string grp)
111 : {
112 : string suffix = GetDomainSuffix<TDomain>();
113 : string tag = GetDomainTag<TDomain>();
114 : }
115 :
116 : /**
117 : * Function called for the registration of Dimension dependent parts.
118 : * All Functions and Classes depending on the Dimension
119 : * are to be placed here when registering. The method is called for all
120 : * available Dimension types, based on the current build options.
121 : *
122 : * @param reg registry
123 : * @param parentGroup group for sorting of functionality
124 : */
125 : template <int dim>
126 : static void Dimension(Registry& reg, string grp)
127 : {
128 : string suffix = GetDimensionSuffix<dim>();
129 : string tag = GetDimensionTag<dim>();
130 :
131 : }
132 :
133 : /**
134 : * Function called for the registration of Algebra dependent parts.
135 : * All Functions and Classes depending on Algebra
136 : * are to be placed here when registering. The method is called for all
137 : * available Algebra types, based on the current build options.
138 : *
139 : * @param reg registry
140 : * @param parentGroup group for sorting of functionality
141 : */
142 : template <typename TAlgebra>
143 : static void Algebra(Registry& reg, string grp)
144 : {
145 : string suffix = GetAlgebraSuffix<TAlgebra>();
146 : string tag = GetAlgebraTag<TAlgebra>();
147 :
148 : }
149 :
150 : /**
151 : * Function called for the registration of Domain and Algebra independent parts.
152 : * All Functions and Classes not depending on Domain and Algebra
153 : * are to be placed here when registering.
154 : *
155 : * @param reg registry
156 : * @param parentGroup group for sorting of functionality
157 : */
158 : static void Common(Registry& reg, string grp)
159 : {
160 : }
161 :
162 : }; // end Functionality
163 :
164 : }// namespace MaxError
165 :
166 1 : void RegisterBridge_MaxError(Registry& reg, string grp)
167 : {
168 1 : grp.append("/Discretization");
169 : typedef MaxError::Functionality Functionality;
170 :
171 : try{
172 : // RegisterCommon<Functionality>(reg,grp);
173 : // RegisterDimensionDependent<Functionality>(reg,grp);
174 : // RegisterDomainDependent<Functionality>(reg,grp);
175 : // RegisterAlgebraDependent<Functionality>(reg,grp);
176 1 : RegisterDomainAlgebraDependent<Functionality>(reg,grp);
177 : }
178 0 : UG_REGISTRY_CATCH_THROW(grp);
179 1 : }
180 :
181 : }// end of namespace bridge
182 : }// end of namespace ug
|