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 : // extern headers
35 : #include <iostream>
36 : #include <sstream>
37 : #include <string>
38 :
39 : // include bridge
40 : #include "bridge/bridge.h"
41 : #include "bridge/util.h"
42 : #include "bridge/util_algebra_dependent.h"
43 :
44 : // operator interfaces
45 : #include "lib_algebra/operator/fixed_convergence_check.h"
46 : #include "lib_algebra/operator/interface/operator.h"
47 : #include "lib_algebra/operator/interface/matrix_operator.h"
48 : #include "lib_algebra/operator/interface/matrix_operator_inverse.h"
49 : #include "lib_algebra/operator/interface/preconditioner.h"
50 : #include "lib_algebra/operator/interface/preconditioned_linear_operator_inverse.h"
51 : #include "lib_algebra/operator/interface/operator_inverse.h"
52 : #include "lib_algebra/operator/interface/linear_iterator.h"
53 :
54 : #include "lib_algebra/operator/debug_writer.h"
55 :
56 : // operator util
57 : #include "lib_algebra/operator/preconditioner/iterator_product.h"
58 : #include "lib_algebra/operator/operator_util.h"
59 : #include "lib_algebra/operator/vector_writer.h"
60 : #include "../util_overloaded.h"
61 :
62 : #include "bridge_mat_vec_operations.h"
63 : #include "matrix_diagonal.h"
64 :
65 : #include "lib_algebra/operator/energy_convergence_check.h"
66 :
67 : using namespace std;
68 :
69 : namespace ug{
70 :
71 : namespace bridge{
72 : namespace AlgebraCommon{
73 :
74 : /// \addtogroup algebracommon_bridge
75 : /// \{
76 :
77 :
78 :
79 : /**
80 : * Class exporting the functionality. All functionality that is to
81 : * be used in scripts or visualization must be registered here.
82 : */
83 : struct Functionality
84 : {
85 :
86 :
87 :
88 : /**
89 : * Function called for the registration of Algebra dependent parts.
90 : * All Functions and Classes depending on Algebra
91 : * are to be placed here when registering. The method is called for all
92 : * available Algebra types, based on the current build options.
93 : *
94 : * @param reg registry
95 : * @param parentGroup group for sorting of functionality
96 : */
97 : template <typename TAlgebra>
98 3 : static void Algebra(Registry& reg, string grp)
99 : {
100 : // typedefs for this algebra
101 : typedef typename TAlgebra::vector_type vector_type;
102 : typedef typename TAlgebra::matrix_type matrix_type;
103 :
104 : // suffix and tag
105 3 : string suffix = GetAlgebraSuffix<TAlgebra>();
106 3 : string tag = GetAlgebraTag<TAlgebra>();
107 :
108 : // MatrixDiagonal
109 : {
110 : typedef MatrixOperator<matrix_type, vector_type> T2;
111 : typedef MatrixDiagonal<matrix_type, vector_type> T;
112 3 : string name = string("MatrixDiagonal").append(suffix);
113 9 : reg.add_class_<T, ILinearOperator<vector_type> >(name, grp)
114 6 : .ADD_CONSTRUCTOR( (SmartPtr<T2> mo) )()
115 3 : .set_construct_as_smart_pointer(true);
116 :
117 9 : reg.add_class_to_group(name, "MatrixDiagonal", tag);
118 : }
119 :
120 : // MatrixDiagonalInverse
121 : {
122 : typedef MatrixOperator<matrix_type, vector_type> T2;
123 : typedef MatrixDiagonalInverse<matrix_type, vector_type> T;
124 3 : string name = string("MatrixDiagonalInverse").append(suffix);
125 9 : reg.add_class_<T, ILinearOperator<vector_type> >(name, grp)
126 6 : .ADD_CONSTRUCTOR( (SmartPtr<T2> mo) )()
127 3 : .set_construct_as_smart_pointer(true);
128 :
129 9 : reg.add_class_to_group(name, "MatrixDiagonalInverse", tag);
130 : }
131 : // Vector
132 : {
133 3 : string name = string("Vector").append(suffix);
134 9 : reg.add_class_<vector_type>(name, grp)
135 3 : .add_constructor()
136 6 : .add_method("set|hide=true", (void (vector_type::*)(number))&vector_type::set,
137 : "Success", "Number")
138 6 : .add_method("size|hide=true", (size_t (vector_type::*)() const)&vector_type::size,
139 : "Size", "")
140 6 : .add_method("set_random|hide=true", (void (vector_type::*)(number, number))&vector_type::set_random,
141 : "Success", "Number")
142 6 : .add_method("print|hide=true", &vector_type::p)
143 : #ifdef UG_PARALLEL
144 : .add_method("check_storage_type", &vector_type::check_storage_type)
145 : .add_method("enforce_consistent_type", &vector_type::enforce_consistent_type)
146 : #endif
147 3 : .set_construct_as_smart_pointer(true);
148 9 : reg.add_class_to_group(name, "Vector", tag);
149 :
150 9 : reg.add_function("VecAssign",
151 : (void (*)(vector_type&,const vector_type &)) &VecAssign<vector_type>, grp, "", "dest#vec", "dest <- vec");
152 9 : reg.add_function("VecScaleAssign",
153 : (void (*)(vector_type&, number, const vector_type &)) &VecScaleAssign<vector_type>, grp, "", "dest#alpha#vec", "dest <- alpha * vec");
154 9 : reg.add_function("VecScaleAdd2", /*(void (*)(vector_type&, number, const vector_type&, number, const vector_type &)) */
155 : &VecScaleAdd2<vector_type>, grp, "alpha1*vec1 + alpha2*vec2",
156 : "dest#alpha1#vec1#alpha2#vec2");
157 9 : reg.add_function("VecScaleAdd3", /*(void (*)(vector_type&, number, const vector_type&, number, const vector_type &, number, const vector_type &))*/
158 : &VecScaleAdd3<vector_type>, grp, "alpha1*vec1 + alpha2*vec2 + alpha3*vec3",
159 : "dest#alpha1#vec1#alpha2#vec2#alpha3#vec3");
160 6 : reg.add_function("VecProd", &VecProd2<TAlgebra>);
161 6 : reg.add_function("VecProd", &VecProdOp<vector_type>);
162 6 : reg.add_function("VecProd", &VecScaleAddProd1<TAlgebra>);
163 6 : reg.add_function("VecProd", &VecScaleAddProd2<TAlgebra>);
164 6 : reg.add_function("VecNorm", &VecNorm<TAlgebra>);
165 6 : reg.add_function("VecMaxNorm", &VecMaxNorm<TAlgebra>);
166 6 : reg.add_function("VecNorm", &VecScaleAddNorm<TAlgebra>);
167 9 : reg.add_function("VecHadamardProd", (void (*)(vector_type&, const vector_type &, const vector_type &))
168 : &VecHadamardProd<vector_type>, grp, "", "dst#vec1#vec2", "vec1 * vec2 (elementwise)");
169 9 : reg.add_function("VecExp", (void (*)(vector_type&, const vector_type &))
170 : &VecExp<vector_type>, grp, "", "dst#vec", "exp(vec) (elementwise)");
171 9 : reg.add_function("VecLog", (void (*)(vector_type&, const vector_type &))
172 : &VecLog<vector_type>, grp, "", "dst#vec", "log(vec) (elementwise)");
173 : }
174 :
175 : // VecScaleAddClass
176 : {
177 3 : string name = string("VecScaleAddClass").append(suffix);
178 : typedef VecScaleAddClass<TAlgebra> T;
179 9 : reg.add_class_<T>(name, grp)
180 3 : .add_constructor()
181 6 : .ADD_CONSTRUCTOR( (double scale1, SmartPtr<vector_type> v1) ) ()
182 6 : .ADD_CONSTRUCTOR( (double scale1, SmartPtr<vector_type> v1, double scale2, SmartPtr<vector_type> v2) ) ()
183 6 : .ADD_CONSTRUCTOR( (double scale, SmartPtr<VecScaleAddClass<TAlgebra > > vsac, double scale1, SmartPtr<vector_type> v1) ) ()
184 6 : .ADD_CONSTRUCTOR( (double scale1, SmartPtr<vector_type> v1, double scale, SmartPtr<VecScaleAddClass<TAlgebra > > vsac) ) ()
185 6 : .ADD_CONSTRUCTOR( (double scale, SmartPtr<VecScaleAddClass<TAlgebra > > vsac) ) ()
186 9 : .add_method("eval", &T::eval)
187 9 : .add_method("assign", &T::assign)
188 3 : .set_construct_as_smart_pointer(true);
189 9 : reg.add_class_to_group(name, "VecScaleAddClass", tag);
190 :
191 9 : reg.add_function("Eval", &Eval<TAlgebra>, grp);
192 9 : reg.add_function("Assign", &Assign<TAlgebra>, grp);
193 : }
194 : // Matrix
195 : {
196 3 : string name = string("Matrix").append(suffix);
197 9 : reg.add_class_<matrix_type>(name, grp)
198 3 : .add_constructor()
199 6 : .add_method("print|hide=true", &matrix_type::p)
200 3 : .set_construct_as_smart_pointer(true);
201 9 : reg.add_class_to_group(name, "Matrix", tag);
202 : }
203 :
204 : // ApplyLinearSolver
205 : {
206 9 : reg.add_function( "ApplyLinearSolver",
207 : &ApplyLinearSolver<vector_type>, grp);
208 : }
209 :
210 : // Vector Debug Writer (abstract base class)
211 : {
212 : typedef IVectorDebugWriter<vector_type> T;
213 3 : string name = string("IVectorDebugWriter").append(suffix);
214 9 : reg.add_class_<T>(name, grp)
215 6 : .add_method("get_context", static_cast<SmartPtr<DebugWriterContext> (T::*) ()>(&T::get_context), "Gets the debugger writer context", "")
216 9 : .add_method("set_context", &T::set_context, "Sets the debugger writer context", "context")
217 12 : .add_method("set_base_dir", &T::set_base_dir, "Sets the base directory for output", "dir")
218 12 : .add_method("enter_section", &T::enter_section, "Enters a debugging section", "dirName")
219 9 : .add_method("leave_section", &T::leave_section, "Leaves the current debugging section", "")
220 : ;
221 9 : reg.add_class_to_group(name, "IVectorDebugWriter", tag);
222 : }
223 :
224 : // Debug Writer (abstract base class)
225 : {
226 : typedef IDebugWriter<TAlgebra> T;
227 : typedef IVectorDebugWriter<vector_type> TBase;
228 3 : string name = string("IDebugWriter").append(suffix);
229 9 : reg.add_class_<T, TBase>(name, grp);
230 9 : reg.add_class_to_group(name, "IDebugWriter", tag);
231 : }
232 :
233 : // VectorDebugWritingObject
234 : {
235 : typedef VectorDebugWritingObject<vector_type> T;
236 3 : string name = string("VectorDebugWritingObject").append(suffix);
237 9 : reg.add_class_<T>(name, grp)
238 6 : .template add_constructor<void (*) (SmartPtr<IVectorDebugWriter<vector_type> >)> ("VectorDebugWriter")
239 9 : .add_method("set_debug", &T::set_debug, "", "dbgWriter", "sets a debug writer")
240 9 : .add_method("vector_debug_writer", static_cast<SmartPtr<IVectorDebugWriter<vector_type> > (T::*)()>(&T::vector_debug_writer))
241 6 : .add_method("vector_debug_writer", static_cast<ConstSmartPtr<IVectorDebugWriter<vector_type> > (T::*)() const>(&T::vector_debug_writer))
242 6 : .add_method("write_debug", static_cast<void (T::*) (const vector_type&, const char*)> (&T::write_debug))
243 3 : .set_construct_as_smart_pointer(true);
244 9 : reg.add_class_to_group(name, "VectorDebugWritingObject", tag);
245 : }
246 :
247 : // DebugWritingObject
248 : {
249 : typedef DebugWritingObject<TAlgebra> T;
250 : typedef VectorDebugWritingObject<vector_type> TBase;
251 3 : string name = string("DebugWritingObject").append(suffix);
252 9 : reg.add_class_<T, TBase>(name, grp)
253 6 : .add_method("set_debug", static_cast<void (T::*)(SmartPtr<IDebugWriter<TAlgebra> >)>(&T::set_debug), "", "dbgWriter", "sets a debug writer")
254 6 : .add_method("debug_writer", static_cast<SmartPtr<IDebugWriter<TAlgebra> > (T::*)()>(&T::debug_writer))
255 6 : .add_method("debug_writer", static_cast<ConstSmartPtr<IDebugWriter<TAlgebra> > (T::*)() const>(&T::debug_writer));
256 9 : reg.add_class_to_group(name, "DebugWritingObject", tag);
257 : }
258 :
259 : // IVectorWriter (abstract base class)
260 : {
261 : typedef IVectorWriter<vector_type> T;
262 3 : string name = string("IVectorWriter").append(suffix);
263 9 : reg.add_class_<T>(name, grp)
264 6 : .add_method("update", &T::update, "", "v", "updates the vector v");
265 9 : reg.add_class_to_group(name, "IVectorWriter", tag);
266 : }
267 :
268 : /////////////////////////
269 : // Base Classes
270 : /////////////////////////
271 :
272 : // ILinearOperator
273 : {
274 : typedef ILinearOperator<vector_type> T;
275 : typedef IOperator<vector_type> TBase;
276 3 : string name = string("ILinearOperator").append(suffix);
277 9 : reg.add_class_<T, TBase>(name, grp)
278 6 : .add_method("init", static_cast<void (T::*)()>(&T::init))
279 9 : .add_method("apply", &T::apply, "f#u", "", "calculates f = Op(u)")
280 9 : .add_method("apply_sub", &T::apply_sub, "f#u", "", "calculates f -= Op(u)");
281 9 : reg.add_class_to_group(name, "ILinearOperator", tag);
282 : }
283 :
284 : // MatrixOperator
285 : {
286 : typedef ILinearOperator<vector_type> TBase;
287 : typedef MatrixOperator<matrix_type, vector_type> T;
288 3 : string name = string("MatrixOperator").append(suffix);
289 9 : reg.add_class_<T, TBase, matrix_type>(name, grp)
290 3 : .add_constructor()
291 3 : .set_construct_as_smart_pointer(true);
292 9 : reg.add_class_to_group(name, "MatrixOperator", tag);
293 : }
294 :
295 : // ILinearIterator
296 : {
297 : typedef ILinearIterator<vector_type> T;
298 3 : string name = string("ILinearIterator").append(suffix);
299 9 : reg.add_class_<T>(name, grp)
300 6 : .add_method("set_damp", static_cast<void (T::*)(number)>(&T::set_damp), "", "damp", "set the damping to a number")
301 6 : .add_method("set_damp", static_cast<void (T::*)(SmartPtr<IDamping<vector_type> >)>(&T::set_damp), "", "damp", "set the damping to a damping object")
302 9 : .add_method("config_string", &T::config_string, "strConfiguration", "", "string to display configuration of the linear iterator")
303 12 : .add_method("clone", &T::clone, "SmartPointer to a copy of this object", "", "returns a clone of the object which can be modified independently")
304 12 : .add_method("apply", &T::apply)
305 12 : .add_method("apply_update_defect", &T::apply_update_defect)
306 9 : .add_method("init", OVERLOADED_METHOD_PTR(bool, T, init, (SmartPtr<ILinearOperator<vector_type,vector_type> > L) ))
307 6 : .add_method("init", OVERLOADED_METHOD_PTR(bool, T, init, (SmartPtr<ILinearOperator<vector_type,vector_type> > L, const vector_type &u) ))
308 6 : .add_method("name", &T::name);
309 9 : reg.add_class_to_group(name, "ILinearIterator", tag);
310 : }
311 :
312 : // IPreconditioner
313 : {
314 : typedef IPreconditioner<TAlgebra> T;
315 : typedef ILinearIterator<vector_type> TBase;
316 : typedef DebugWritingObject<TAlgebra> TBase2;
317 3 : string name = string("IPreconditioner").append(suffix);
318 9 : reg.add_class_<T, TBase, TBase2>(name, grp);
319 9 : reg.add_class_to_group(name, "IPreconditioner", tag);
320 : }
321 :
322 : // ILinearOperatorInverse
323 : {
324 : typedef ILinearOperatorInverse<vector_type> T;
325 : typedef ILinearIterator<vector_type> TBase;
326 3 : string name = string("ILinearOperatorInverse").append(suffix);
327 9 : reg.add_class_<T, TBase>(name, grp)
328 6 : .add_method("init", static_cast<bool (T::*)(SmartPtr<ILinearOperator<vector_type> >)>(&T::init))
329 6 : .add_method("init", static_cast<bool (T::*)(SmartPtr<ILinearOperator<vector_type> >,const vector_type&)>(&T::init))
330 9 : .add_method("apply_return_defect", &T::apply_return_defect, "Success", "u#f",
331 : "Solve A*u = f, such that u = A^{-1} f by iterating u := u + B(f - A*u), f := f - A*u becomes new defect")
332 12 : .add_method("apply", &T::apply, "Success", "u#f", "Solve A*u = f, such that u = A^{-1} f by iterating u := u + B(f - A*u), f remains constant")
333 12 : .add_method("set_convergence_check", &T::set_convergence_check)
334 9 : .add_method("convergence_check", static_cast<ConstSmartPtr<IConvergenceCheck<vector_type> > (T::*)() const>(&T::convergence_check))
335 9 : .add_method("defect", &T::defect, "the current defect")
336 12 : .add_method("step", &T::step, "the current number of steps")
337 12 : .add_method("reduction", &T::reduction, "the current relative reduction")
338 9 : .add_method("config_string", &T::config_string);
339 9 : reg.add_class_to_group(name, "ILinearOperatorInverse", tag);
340 : }
341 :
342 : // IPreconditionedLinearOperatorInverse
343 : {
344 : typedef IPreconditionedLinearOperatorInverse<vector_type> T;
345 : typedef ILinearOperatorInverse<vector_type> TBase;
346 : typedef VectorDebugWritingObject<vector_type> TBase2;
347 3 : string name = string("IPreconditionedLinearOperatorInverse").append(suffix);
348 9 : reg.add_class_<T, TBase, TBase2>(name, grp)
349 9 : .add_method("set_preconditioner", &T::set_preconditioner,
350 : "", "Preconditioner")
351 9 : .add_method("set_compute_fresh_defect_when_finished", &T::set_compute_fresh_defect_when_finished);
352 9 : reg.add_class_to_group(name, "IPreconditionedLinearOperatorInverse", tag);
353 : }
354 :
355 : // IMatrixOperatorInverse
356 : {
357 : typedef ILinearOperatorInverse<vector_type> TBase;
358 : typedef IMatrixOperatorInverse<matrix_type, vector_type> T;
359 3 : string name = string("IMatrixOperatorInverse").append(suffix);
360 9 : reg.add_class_<T, TBase>(name, grp);
361 9 : reg.add_class_to_group(name, "IMatrixOperatorInverse", tag);
362 : }
363 :
364 : // IOperator
365 : {
366 : typedef IOperator<vector_type> T;
367 3 : string name = string("IOperator").append(suffix);
368 9 : reg.add_class_<T>(name, grp);
369 9 : reg.add_class_to_group(name, "IOperator", tag);
370 : }
371 :
372 : // IOperatorInverse
373 : {
374 : typedef IOperatorInverse<vector_type> T;
375 3 : string name = string("IOperatorInverse").append(suffix);
376 9 : reg.add_class_<T>(name, grp);
377 9 : reg.add_class_to_group(name, "IOperatorInverse", tag);
378 : }
379 :
380 :
381 : // IConvergenceCheck
382 : {
383 : typedef IConvergenceCheck<vector_type> T;
384 3 : string name = string("IConvergenceCheck").append(suffix);
385 9 : reg.add_class_<T>(name, grp)
386 9 : .add_method("config_string", &T::config_string)
387 12 : .add_method("defect", &T::defect, "defect", "", "returns the current defect")
388 12 : .add_method("step", &T::step, "step", "", "returns the current number of steps")
389 12 : .add_method("reduction", &T::reduction, "reduction", "", "returns the current relative reduction")
390 12 : .add_method("iteration_ended", &T::iteration_ended)
391 9 : .add_method("avg_rate", &T::avg_rate, "", "returns the average convergence rate")
392 : ;
393 9 : reg.add_class_to_group(name, "IConvergenceCheck", tag);
394 : }
395 :
396 : // StandardConvCheck
397 : {
398 : typedef StdConvCheck<vector_type> T;
399 : typedef IConvergenceCheck<vector_type> TBase;
400 3 : string name = string("ConvCheck").append(suffix);
401 9 : reg.add_class_<T, TBase>(name, grp, "Convergence Check")
402 3 : .add_constructor()
403 : .template add_constructor<void (*)(int, number, number, bool)>
404 6 : ("Maximum Steps|default|min=0;value=100#"
405 : "Minimum Defect|default|min=0D;value=1e-10#"
406 : "Relative Reduction|default|min=0D;value=1e-12#"
407 : "Verbosity")
408 : .template add_constructor<void (*)(int, number, number, bool, bool)>
409 6 : ("Maximum Steps|default|min=0;value=100#"
410 : "Minimum Defect|default|min=0D;value=1e-10#"
411 : "Relative Reduction|default|min=0D;value=1e-12#"
412 : "Verbosity"
413 : "supress unsuccessful return")
414 : .template add_constructor<void (*)(int, number, number)>
415 6 : ("Maximum Steps|default|min=0;value=100#"
416 : "Minimum Defect|default|min=0D;value=1e-10#"
417 : "Relative Reduction|default|min=0D;value=1e-12")
418 9 : .add_method("set_maximum_steps", &T::set_maximum_steps, "", "Maximum Steps|default|min=0;value=100", "maximum number of steps to do")
419 12 : .add_method("set_minimum_defect", &T::set_minimum_defect, "", "Minimum Defect|default|min=0D;value=1e-10")
420 12 : .add_method("set_reduction", &T::set_reduction, "", "Relative Reduction|default|min=0D;value=1e-12")
421 12 : .add_method("set_verbose", &T::set_verbose, "", "Verbosity")
422 12 : .add_method("set_supress_unsuccessful", &T::set_supress_unsuccessful,"", "supress false return")
423 12 : .add_method("defect", &T::defect)
424 12 : .add_method("get_defect", &T::get_defect)
425 9 : .add_method("previous_defect", &T::previous_defect)
426 3 : .set_construct_as_smart_pointer(true);
427 9 : reg.add_class_to_group(name, "ConvCheck", tag);
428 : }
429 :
430 :
431 : {
432 : typedef EnergyConvCheck<vector_type> T;
433 : typedef IConvergenceCheck<vector_type> TBase;
434 3 : string name = string("EnergyConvCheck").append(suffix);
435 9 : reg.add_class_<T, TBase>(name, grp, "Energy Convergence Check")
436 9 : .add_method("set_linear_operator", &T::set_linear_operator)
437 : .template add_constructor<void (*)(int, number, number, bool)>
438 9 : ("Maximum Steps|default|min=0;value=100#"
439 : "Minimum Defect|default|min=0D;value=1e-10#"
440 : "Relative Reduction|default|min=0D;value=1e-12#"
441 : "Verbosity")
442 : .template add_constructor<void (*)(int, number, number, bool, bool)>
443 6 : ("Maximum Steps|default|min=0;value=100#"
444 : "Minimum Defect|default|min=0D;value=1e-10#"
445 : "Relative Reduction|default|min=0D;value=1e-12#"
446 : "Verbosity"
447 : "supress unsuccessful return")
448 : .template add_constructor<void (*)(int, number, number)>
449 6 : ("Maximum Steps|default|min=0;value=100#"
450 : "Minimum Defect|default|min=0D;value=1e-10#"
451 : "Relative Reduction|default|min=0D;value=1e-12")
452 3 : .set_construct_as_smart_pointer(true);
453 9 : reg.add_class_to_group(name, "EnergyConvCheck", tag);
454 : }
455 :
456 : // FixedConvCheck
457 : {
458 : typedef FixedConvergenceCheck<vector_type> T;
459 : typedef IConvergenceCheck<vector_type> TBase;
460 3 : string name = string("FixedConvergenceCheck").append(suffix);
461 9 : reg.add_class_<T, TBase>(name, grp, "Convergence Check")
462 : // .add_constructor()
463 6 : .template add_constructor<void (*)(number)>("")
464 3 : .set_construct_as_smart_pointer(true);
465 9 : reg.add_class_to_group(name, "FixedConvergenceCheck", tag);
466 : }
467 :
468 3 : }
469 :
470 :
471 : /**
472 : * Function called for the registration of Domain and Algebra independent parts.
473 : * All Functions and Classes not depending on Domain and Algebra
474 : * are to be placed here when registering.
475 : *
476 : * @param reg registry
477 : * @param parentGroup group for sorting of functionality
478 : */
479 1 : static void Common(Registry& reg, string grp)
480 : {
481 :
482 : // IPositionProvider (abstract base class)
483 : {
484 3 : reg.add_class_<IPositionProvider<1> >("IPositionProvider1d", grp);
485 3 : reg.add_class_<IPositionProvider<2> >("IPositionProvider2d", grp);
486 3 : reg.add_class_<IPositionProvider<3> >("IPositionProvider3d", grp);
487 2 : reg.add_class_to_group("IPositionProvider1d", "IPositionProvider", GetDimensionTag<1>());
488 2 : reg.add_class_to_group("IPositionProvider2d", "IPositionProvider", GetDimensionTag<2>());
489 2 : reg.add_class_to_group("IPositionProvider3d", "IPositionProvider", GetDimensionTag<3>());
490 : }
491 :
492 : // Debug Writer Context
493 : {
494 : typedef DebugWriterContext T;
495 3 : reg.add_class_<T>("DebugWriterContext", grp)
496 1 : .add_constructor()
497 2 : .add_method("set_base_dir", &T::set_base_dir)
498 2 : .add_method("get_base_dir", &T::get_base_dir)
499 2 : .add_method("enter_section", &T::enter_section)
500 2 : .add_method("leave_section", &T::leave_section)
501 2 : .add_method("print_message", &T::leave_section)
502 2 : .add_method("compose_file_path", &T::leave_section)
503 1 : .set_construct_as_smart_pointer(true);
504 : }
505 1 : }
506 :
507 : }; // end Functionality
508 :
509 : // end group algebracommon_bridge
510 : /// \}
511 :
512 : }// end AlgebraCommon
513 :
514 : /// \addtogroup algebracommon_bridge
515 1 : void RegisterBridge_AlgebraCommon(Registry& reg, string grp)
516 : {
517 1 : grp.append("/Algebra");
518 : typedef AlgebraCommon::Functionality Functionality;
519 :
520 : try{
521 2 : RegisterCommon<Functionality>(reg,grp);
522 1 : RegisterAlgebraDependent<Functionality>(reg,grp);
523 : }
524 0 : UG_REGISTRY_CATCH_THROW(grp);
525 1 : }
526 :
527 : } // end namespace bridge
528 : } // end namespace ug
|