LCOV - code coverage report
Current view: top level - ugbase/bridge/disc_bridges - algebra_bridge.cpp (source / functions) Coverage Total Hit
Test: coverage.info Lines: 99.7 % 365 364
Test Date: 2025-09-21 23:31:46 Functions: 100.0 % 14 14

            Line data    Source code
       1              : /*
       2              :  * Copyright (c) 2011-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 libraries
      34              : #include <iostream>
      35              : #include <sstream>
      36              : #include <string>
      37              : 
      38              : #include "../../lib_disc/time_disc/composite_time_disc.h"
      39              : // include bridge
      40              : #include "bridge/bridge.h"
      41              : #include "bridge/util.h"
      42              : #include "bridge/util_domain_algebra_dependent.h"
      43              : #include "bridge/util_overloaded.h"
      44              : 
      45              : // discretization interfaces
      46              : #include "lib_algebra/active_set/active_set.h"
      47              : #include "lib_algebra/active_set/lagrange_multiplier_disc_interface.h"
      48              : #include "lib_algebra/operator/convergence_check.h"
      49              : #include "lib_algebra/operator/matrix_operator_functions.h"
      50              : #include "lib_disc/spatial_disc/domain_disc_interface.h"
      51              : #include "lib_disc/spatial_disc/elem_disc/elem_disc_interface.h"
      52              : #include "lib_disc/spatial_disc/constraints/constraint_interface.h"
      53              : #include "lib_disc/time_disc/time_disc_interface.h"
      54              : #include "lib_disc/time_disc/theta_time_step.h"
      55              : #include "lib_disc/time_disc/finished_conditions.hpp"
      56              : #include "lib_disc/time_disc/time_integrator_observers/time_integrator_observer_interface.h"
      57              : #include "lib_disc/time_disc/time_integrator_observers/lua_callback_observer.hpp"
      58              : #include "lib_disc/time_disc/time_integrator_subject.hpp"
      59              : #include "lib_disc/operator/linear_operator/assembled_linear_operator.h"
      60              : #include "lib_disc/operator/non_linear_operator/assembled_non_linear_operator.h"
      61              : #include "lib_disc/operator/non_linear_operator/line_search.h"
      62              : #include "lib_disc/operator/linear_operator/nested_iteration/nested_iteration.h"
      63              : #include "lib_disc/operator/non_linear_operator/newton_solver/newton.h"
      64              : #include "lib_disc/operator/non_linear_operator/nl_gauss_seidel/nl_gauss_seidel.h"
      65              : #include "lib_disc/operator/non_linear_operator/nl_jacobi/nl_jacobi.h"
      66              : #include "lib_disc/operator/composite_conv_check.h"
      67              : #include "lib_disc/spatial_disc/local_to_global/local_to_global_mapper.h"
      68              : 
      69              : //#include "lib_disc/operator/non_linear_operator/newton_solver/nestedNewtonRFSwitch.h"
      70              : 
      71              : //#if ENABLE_NESTED_NEWTON_RESOLFUNC_UPDATE
      72              : 
      73              : #include "lib_disc/operator/non_linear_operator/newton_solver/newtonUpdaterGeneric.h"
      74              : 
      75              : //#endif
      76              : 
      77              : using namespace std;
      78              : 
      79              : 
      80              : namespace ug{
      81              : namespace bridge{
      82              : namespace DiscAlgebra{
      83              : 
      84              : /**
      85              :  * \defgroup discalgebra_bridge Discretization Algebra Bridge
      86              :  * \ingroup disc_bridge
      87              :  * \{
      88              :  */
      89              : 
      90              : /**
      91              :  * Class exporting the functionality. All functionality that is to
      92              :  * be used in scripts or visualization must be registered here.
      93              :  */
      94              : struct Functionality
      95              : {
      96              : 
      97              : /**
      98              :  * Function called for the registration of Algebra dependent parts.
      99              :  * All Functions and Classes depending on Algebra
     100              :  * are to be placed here when registering. The method is called for all
     101              :  * available Algebra types, based on the current build options.
     102              :  *
     103              :  * @param reg                           registry
     104              :  * @param parentGroup           group for sorting of functionality
     105              :  */
     106              : template <typename TAlgebra>
     107            3 : static void Algebra(Registry& reg, string parentGroup)
     108              : {
     109              : //      typedefs for Vector and Matrix
     110              :         typedef typename TAlgebra::vector_type vector_type;
     111              :         typedef typename TAlgebra::matrix_type matrix_type;
     112              : 
     113              : //      suffix and tag
     114            3 :         string suffix = GetAlgebraSuffix<TAlgebra>();
     115            3 :         string tag = GetAlgebraTag<TAlgebra>();
     116              : 
     117              : //      IConstraint
     118              :         {
     119            3 :                 std::string grp = parentGroup; grp.append("/Discretization/SpatialDisc");
     120              :                 typedef IConstraint<TAlgebra> T;
     121            3 :                 string name = string("IConstraint").append(suffix);
     122            9 :                 reg.add_class_<T>(name, grp);
     123            9 :                 reg.add_class_to_group(name, "IConstraint", tag);
     124              :         }
     125              : 
     126              : //      IAssemble
     127              :         {
     128            3 :                 std::string grp = parentGroup; grp.append("/Discretization/SpatialDisc");
     129              :                 typedef IAssemble<TAlgebra> T;
     130            3 :                 string name = string("IAssemble").append(suffix);
     131            9 :                 reg.add_class_<T>(name, grp)
     132            6 :                         .add_method("assemble_jacobian", static_cast<void (T::*)(matrix_type&, const vector_type&)>(&T::assemble_jacobian),"", "J(u)#u", "assembles jacobian on surface grid")
     133            6 :                         .add_method("assemble_jacobian", static_cast<void (T::*)(matrix_type&, const vector_type&, const GridLevel&)>(&T::assemble_jacobian),"", "J(u)#u#GridLevel", "assembles jacobian on grid level")
     134            6 :                         .add_method("assemble_defect", static_cast<void (T::*)(vector_type&, const vector_type&)>(&T::assemble_defect),"", "d(u)#u", "Assembles Defect on surface grid.")
     135            6 :                         .add_method("assemble_defect", static_cast<void (T::*)(vector_type&, const vector_type&, const GridLevel&)>(&T::assemble_defect),"", "d(u)#u#GridLevel", "Assembles Defect on grid level")
     136            6 :                         .add_method("assemble_linear", static_cast<void (T::*)(matrix_type&, vector_type&)>(&T::assemble_linear),"", "A#b", "Assembles Matrix and rhs on surface grid.")
     137            6 :                         .add_method("assemble_linear", static_cast<void (T::*)(matrix_type&, vector_type&, const GridLevel&)>(&T::assemble_linear),"", "A#b#GridLevel", "Assembles Matrix and rhs on grid level.")
     138            6 :                         .add_method("assemble_rhs", static_cast<void (T::*)(vector_type&, const vector_type&)>(&T::assemble_rhs),"", "rhs#u", "assembles right-hand side on surface grid")
     139            6 :                         .add_method("assemble_rhs", static_cast<void (T::*)(vector_type&, const vector_type&, const GridLevel&)>(&T::assemble_rhs),"", "rhs#u#GridLevel", "assembles right-hand side on grid level")
     140            6 :                         .add_method("assemble_rhs", static_cast<void (T::*)(vector_type&)>(&T::assemble_rhs),"", "rhs#GridLevel", "assembles right-hand side on surface grid for linear case")
     141            6 :                         .add_method("assemble_rhs", static_cast<void (T::*)(vector_type&, const GridLevel&)>(&T::assemble_rhs),"", "rhs", "assembles right-hand side on grid level for linear case")
     142            6 :                         .add_method("assemble_stiffness_matrix", static_cast<void (T::*)(matrix_type&, const vector_type&)>(&T::assemble_stiffness_matrix),"", "A#u", "assembles stiffness matrix on surface grid")
     143            6 :                         .add_method("assemble_mass_matrix", static_cast<void (T::*)(matrix_type&, const vector_type&)>(&T::assemble_mass_matrix),"", "M#u", "assembles mass matrix on surface grid")
     144            6 :                         .add_method("adjust_solution", static_cast<void (T::*)(vector_type&)>(&T::adjust_solution))
     145            6 :                         .add_method("adjust_solution", static_cast<void (T::*)(vector_type&, const GridLevel&)>(&T::adjust_solution));
     146            9 :                 reg.add_class_to_group(name, "IAssemble", tag);
     147              :         }
     148              : 
     149              : //      IDomainDiscretization
     150              :         {
     151            3 :                 std::string grp = parentGroup; grp.append("/Discretization/SpatialDisc");
     152              :                 typedef IAssemble<TAlgebra> TBase;
     153              :                 typedef IDomainDiscretization<TAlgebra> T;
     154            3 :                 string name = string("IDomainDiscretization").append(suffix);
     155            9 :                 reg.add_class_<T, TBase>(name, grp)
     156            6 :                         .add_method("assemble_jacobian", static_cast<void (T::*)
     157              :                                     (matrix_type&, ConstSmartPtr<VectorTimeSeries<vector_type> >,
     158              :                                      number)>(&T::assemble_jacobian));
     159            9 :                 reg.add_class_to_group(name, "IDomainDiscretization", tag);
     160              :         }
     161              : 
     162              : //      ITimeDiscretization
     163              :         {
     164            3 :                 std::string grp = parentGroup; grp.append("/Discretization/TimeDisc");
     165              :                 typedef IAssemble<TAlgebra>  TBase;
     166              :                 typedef ITimeDiscretization<TAlgebra> T;
     167            3 :                 string name = string("ITimeDiscretization").append(suffix);
     168            9 :                 reg.add_class_<T,TBase>(name, grp)
     169            9 :                         .add_method("prepare_step", &T::prepare_step, "", "", "prepares the assembling of defect/Jacobian for a time step")
     170            9 :                         .add_method("prepare_step_elem", static_cast<void (T::*)(SmartPtr<VectorTimeSeries<vector_type> >, number)>(&T::prepare_step_elem))
     171            9 :                         .add_method("finish_step", &T::finish_step, "", "", "finishes the assembling of defect/Jacobian for a time step")
     172            9 :                         .add_method("finish_step_elem", static_cast<void (T::*)(SmartPtr<VectorTimeSeries<vector_type> >)>(&T::finish_step_elem))
     173            6 :                         .add_method("finish_step_elem", static_cast<void (T::*)(SmartPtr<VectorTimeSeries<vector_type> >, const GridLevel&)>(&T::finish_step_elem))
     174            9 :                         .add_method("num_stages", &T::num_stages, "the number of stages")
     175           12 :                         .add_method("set_stage", &T::set_stage, "", "stage")
     176           12 :                         .add_method("future_time", &T::future_time, "the future time point (i.e. the one that will be computed)")
     177            9 :                         .add_method("num_prev_steps", &T::num_prev_steps);
     178            9 :                 reg.add_class_to_group(name, "ITimeDiscretization", tag);
     179              :         }
     180              : 
     181              : //      MultiStepTimeDiscretization
     182              :         {
     183            3 :                 std::string grp = parentGroup; grp.append("/Discretization/TimeDisc");
     184              :                 typedef ITimeDiscretization<TAlgebra> TBase;
     185              :                 typedef MultiStepTimeDiscretization<TAlgebra> T;
     186            3 :                 string name = string("MultiStepTimeDiscretization").append(suffix);
     187            9 :                 reg.add_class_<T,TBase>(name, grp)
     188            6 :                         .add_method("calc_error", static_cast<void (T::*)(const vector_type&)>(&T::calc_error), "", "",
     189              :                                 "calculate error indicators for elements from error estimators of the elemDiscs")
     190            6 :                         .add_method("calc_error", static_cast<void (T::*)(const vector_type&, CPUAlgebra::vector_type&)>(&T::calc_error), "", "",
     191              :                                 "calculate error indicators for elements from error estimators of the elemDiscs")
     192            9 :                         .add_method("invalidate_error", &T::invalidate_error, "", "Marks error indicators as invalid, "
     193              :                                 "which will prohibit refining and coarsening before a new call to calc_error.")
     194            9 :                         .add_method("is_error_valid", &T::is_error_valid, "", "Returns whether error indicators are valid");
     195            9 :                 reg.add_class_to_group(name, "MultiStepTimeDiscretization", tag);
     196              :         }
     197              : 
     198              : //      ThetaTimeStep
     199              :         {
     200            3 :                 std::string grp = parentGroup; grp.append("/Discretization/TimeDisc");
     201              :                 typedef MultiStepTimeDiscretization<TAlgebra> TBase;
     202              :                 typedef ThetaTimeStep<TAlgebra> T;
     203            3 :                 string name = string("ThetaTimeStep").append(suffix);
     204            9 :                 reg.add_class_<T, TBase>(name, grp)
     205            6 :                                 .template add_constructor<void (*)(SmartPtr<IDomainDiscretization<TAlgebra> >)>("Domain Discretization")
     206            6 :                                 .template add_constructor<void (*)(SmartPtr<IDomainDiscretization<TAlgebra> >,number)>("Domain Discretization#Theta")
     207            6 :                                 .template add_constructor<void (*)(SmartPtr<IDomainDiscretization<TAlgebra> >,const char*)>("Domain Discretization#Scheme")
     208            9 :                                 .add_method("set_theta", &T::set_theta, "", "Theta", "Theta value 1 = Impl; 0 = Expl")
     209           12 :                                 .add_method("set_scheme", &T::set_scheme, "", "Scheme|selection|value=[\"Theta\",\"Alexander\",\"FracStep\"]")
     210            9 :                                 .add_method("set_stage", &T::set_stage, "", "Stage")
     211            3 :                                 .set_construct_as_smart_pointer(true);
     212            9 :                 reg.add_class_to_group(name, "ThetaTimeStep", tag);
     213              :         }
     214              : 
     215              : //      BDF
     216              :         {
     217            3 :                 std::string grp = parentGroup; grp.append("/Discretization/TimeDisc");
     218              :                 typedef MultiStepTimeDiscretization<TAlgebra> TBase;
     219              :                 typedef BDF<TAlgebra> T;
     220            3 :                 string name = string("BDF").append(suffix);
     221            9 :                 reg.add_class_<T, TBase>(name, grp)
     222            6 :                                 .template add_constructor<void (*)(SmartPtr<IDomainDiscretization<TAlgebra> >)>("Domain Discretization")
     223            6 :                                 .template add_constructor<void (*)(SmartPtr<IDomainDiscretization<TAlgebra> >,int)>("Domain Discretization#Order")
     224            6 :                                 .add_method("set_order", &T::set_order, "", "Order")
     225            3 :                                 .set_construct_as_smart_pointer(true);
     226            9 :                 reg.add_class_to_group(name, "BDF", tag);
     227              :         }
     228              : 
     229              : //      SDIRK
     230              :         {
     231            3 :                 std::string grp = parentGroup; grp.append("/Discretization/TimeDisc");
     232              :                 typedef MultiStepTimeDiscretization<TAlgebra> TBase;
     233              :                 typedef SDIRK<TAlgebra> T;
     234            3 :                 string name = string("SDIRK").append(suffix);
     235            9 :                 reg.add_class_<T, TBase>(name, grp)
     236            6 :                                 .template add_constructor<void (*)(SmartPtr<IDomainDiscretization<TAlgebra> >)>("Domain Discretization")
     237            6 :                                 .template add_constructor<void (*)(SmartPtr<IDomainDiscretization<TAlgebra> >,int)>("Domain Discretization#Order")
     238            9 :                                 .add_method("set_order", &T::set_order, "", "Order")
     239            9 :                                 .add_method("set_stage", &T::set_stage, "", "Stage")
     240            3 :                                 .set_construct_as_smart_pointer(true);
     241            9 :                 reg.add_class_to_group(name, "SDIRK", tag);
     242              :         }
     243              : 
     244              : //      CompositeTimeDiscretization
     245              :         {
     246            3 :                 std::string grp = parentGroup; grp.append("/Discretization/TimeDisc");
     247              :                 typedef IAssemble<TAlgebra> TBase;
     248              :                 typedef CompositeTimeDiscretization<TAlgebra> T;
     249            3 :                 string name = string("CompositeTimeDiscretization").append(suffix);
     250            9 :                 reg.add_class_<T, TBase>(name, grp)
     251            3 :                         .add_constructor()
     252            9 :                         .add_method("add_time_disc", &T::add_time_disc, "", "time discretization")
     253            9 :                         .add_method("prepare_step", &T::prepare_step, "", "", "prepares the assembling of defect/Jacobian for a time step")
     254            3 :                         .set_construct_as_smart_pointer(true);
     255            9 :                 reg.add_class_to_group(name, "CompositeTimeDiscretization", tag);
     256              :         }
     257              : 
     258              : //      AssembledLinearOperator
     259              :         {
     260            3 :                 std::string grp = parentGroup; grp.append("/Discretization");
     261              :                 typedef AssembledLinearOperator<TAlgebra> T;
     262              :                 typedef MatrixOperator<matrix_type, vector_type> TBase;
     263            3 :                 string name = string("AssembledLinearOperator").append(suffix);
     264            9 :                 reg.add_class_<T, TBase>(name, grp)
     265            3 :                         .add_constructor()
     266            6 :                         .template add_constructor<void (*)(SmartPtr<IAssemble<TAlgebra> >)>("Assembling Routine")
     267            6 :                         .template add_constructor<void (*)(SmartPtr<IAssemble<TAlgebra> >, const GridLevel&)>("AssemblingRoutine#GridLevel")
     268            9 :                         .add_method("set_discretization", &T::set_discretization)
     269           12 :                         .add_method("set_level", &T::set_level)
     270           12 :                         .add_method("set_dirichlet_values", &T::set_dirichlet_values)
     271           12 :                         .add_method("init_op_and_rhs", &T::init_op_and_rhs)
     272            9 :                         .add_method("level", &T::level)
     273            3 :                         .set_construct_as_smart_pointer(true);
     274            9 :                 reg.add_class_to_group(name, "AssembledLinearOperator", tag);
     275              :         }
     276              : 
     277              : 
     278              : //#if ENABLE_NESTED_NEWTON_RESOLFUNC_UPDATE
     279              :         //      generic Newton updater
     280              :         {
     281            3 :                 std::string grp = parentGroup; grp.append("/Discretization");
     282              :                 using T = NewtonUpdaterGeneric<vector_type>;
     283            3 :                 string name = string("NewtonUpdaterGeneric").append(suffix);
     284            9 :                 reg.add_class_<T>(name, grp)
     285            3 :                         .add_constructor()
     286            3 :                         .set_construct_as_smart_pointer(true);
     287            9 :                 reg.add_class_to_group(name, "NewtonUpdaterGeneric", tag);
     288              :         }
     289              : //#endif
     290              :         
     291              : 
     292              : //      NewtonSolver
     293              :         {
     294            3 :                 std::string grp = parentGroup; grp.append("/Discretization/Nonlinear");
     295              :                 typedef NewtonSolver<TAlgebra> T;
     296              :                 typedef IOperatorInverse<vector_type> TBase;
     297              :                 typedef DebugWritingObject<TAlgebra> TBase2;
     298            3 :                 string name = string("NewtonSolver").append(suffix);
     299            9 :                 reg.add_class_<T, TBase, TBase2>(name, grp)
     300            3 :                         .add_constructor()
     301            6 :                         .template add_constructor<void (*)(SmartPtr<IOperator<vector_type> >)>("Operator")
     302            6 :                         .template add_constructor<void (*)(SmartPtr<IAssemble<TAlgebra> >)>("AssemblingRoutine")
     303            9 :                         .add_method("set_linear_solver", &T::set_linear_solver, "", "linSolver")
     304           12 :                         .add_method("set_convergence_check", &T::set_convergence_check, "", "convCheck")
     305           12 :                         .add_method("set_line_search", &T::set_line_search, "", "lineSeach")
     306           12 :                         .add_method("disable_line_search", &T::disable_line_search)
     307           12 :                         .add_method("line_search", &T::line_search, "lineSeach", "")
     308           12 :                         .add_method("set_reassemble_J_freq", &T::set_reassemble_J_freq, "reassemble freq. for Jacobian")
     309           12 :                         .add_method("init", &T::init, "success", "op")
     310           12 :                         .add_method("prepare", &T::prepare, "success", "u")
     311           12 :                         .add_method("apply", &T::apply, "success", "u")
     312           12 :                         .add_method("print_average_convergence", &T::print_average_convergence)
     313           12 :                         .add_method("clear_average_convergence", &T::clear_average_convergence)
     314           12 :                         .add_method("num_newton_steps", &T::num_newton_steps, "number of newton steps in history")
     315           12 :                         .add_method("num_linsolver_calls", &T::num_linsolver_calls, "number of linsolver calls in iNewtonStep", "iNewtonStep")
     316           12 :                         .add_method("num_linsolver_steps", &T::num_linsolver_steps, "number of linsolver steps in newton step iNewtonStep", "iNewtonStep")
     317           12 :                         .add_method("average_linear_steps", &T::average_linear_steps, "average number of linsolver steps per linsolver call in newton step iNewtonStep", "iNewtonStep")
     318           12 :                         .add_method("total_linsolver_calls", &T::total_linsolver_calls, "total number of linsolver calls", "")
     319           12 :                         .add_method("total_linsolver_steps", &T::total_linsolver_steps, "total number of linsolver steps", "")
     320           12 :                         .add_method("total_average_linear_steps", &T::total_average_linear_steps, "total average number of linsolver steps per linsolver call", "")
     321           12 :                         .add_method("last_num_newton_steps", &T::last_num_newton_steps, "Number of newton steps performed in last iteration")
     322           12 :                         .add_method("add_inner_step_update", &T::add_inner_step_update, "data update called before every linsolver step", "")
     323           12 :                         .add_method("clear_inner_step_update", &T::clear_inner_step_update, "clear inner step update", "")
     324           12 :                         .add_method("add_step_update", &T::add_step_update, "data update called before every Newton step", "")
     325           12 :                         .add_method("clear_step_update", &T::clear_step_update, "clear step update", "")
     326              : //#if ENABLE_NESTED_NEWTON_RESOLFUNC_UPDATE
     327           12 :                         .add_method("setNewtonUpdater", &T::setNewtonUpdater, "set the Newton updater", "")
     328              : //#endif
     329           12 :                         .add_method("createNewtonUpdater", &T::createNewtonUpdater, "create a Newton updater", "")
     330            9 :                         .add_method("config_string", &T::config_string)
     331            3 :                         .set_construct_as_smart_pointer(true);
     332            9 :                 reg.add_class_to_group(name, "NewtonSolver", tag);
     333              :         }
     334              : 
     335              :         //      NonlinearJacobiSolver
     336              :         {
     337            3 :                 std::string grp = parentGroup; grp.append("/Discretization/Nonlinear");
     338              :                 typedef NLJacobiSolver<TAlgebra> T;
     339              :                 typedef IOperatorInverse<vector_type> TBase;
     340              :                 typedef DebugWritingObject<TAlgebra> TBase2;
     341            3 :                 string name = string("NLJacobiSolver").append(suffix);
     342            9 :                 reg.add_class_<T, TBase, TBase2>(name, grp)
     343            3 :                         .add_constructor()
     344            6 :                         .template add_constructor<void (*)(SmartPtr<IConvergenceCheck<vector_type> >)>("ConvCheck")
     345            9 :                         .add_method("set_convergence_check", &T::set_convergence_check, "", "convCheck")
     346           12 :                         .add_method("set_damp", &T::set_damp, "", "setDampingFactor")
     347           12 :                         .add_method("init", &T::init, "success", "op")
     348           12 :                         .add_method("prepare", &T::prepare, "success", "u")
     349           12 :                         .add_method("apply", &T::apply, "success", "u")
     350            9 :                         .add_method("config_string", &T::config_string)
     351            3 :                         .set_construct_as_smart_pointer(true);
     352            9 :                 reg.add_class_to_group(name, "NLJacobiSolver", tag);
     353              :         }
     354              : 
     355              : //      AssembledOperator
     356              :         {
     357            3 :                 std::string grp = parentGroup; grp.append("/Discretization/Nonlinear");
     358              :                 typedef AssembledOperator<TAlgebra> T;
     359              :                 typedef IOperator<vector_type> TBase;
     360            3 :                 string name = string("AssembledOperator").append(suffix);
     361            9 :                 reg.add_class_<T, TBase>(name, grp)
     362            3 :                         .add_constructor()
     363            6 :                         .template add_constructor<void (*)(SmartPtr<IAssemble<TAlgebra> >)>("AssemblingRoutine")
     364            6 :                         .template add_constructor<void (*)(SmartPtr<IAssemble<TAlgebra> >, const GridLevel&)>("AssemblingRoutine#GridLevel")
     365            9 :                         .add_method("set_discretization", &T::set_discretization, "", "ass")
     366           12 :                         .add_method("set_level", &T::set_level, "", "gridLevel")
     367           12 :                         .add_method("level", &T::level, "gridLevel", "")
     368            9 :                         .add_method("init", &T::init)
     369            3 :                         .set_construct_as_smart_pointer(true);
     370            9 :                 reg.add_class_to_group(name, "AssembledOperator", tag);
     371              :         }
     372              : 
     373              : 
     374              : //      ILocalToGlobalMapper
     375              :         {
     376            3 :                 std::string grp = parentGroup; grp.append("/Discretization/SpatialDisc");
     377              :                 typedef ILocalToGlobalMapper<TAlgebra> T;
     378            3 :                 string name = string("ILocalToGlobalMapper").append(suffix);
     379            9 :                 reg.add_class_<T>(name, grp);
     380            9 :                 reg.add_class_to_group(name, "ILocalToGlobalMapper", tag);
     381              :         }
     382              : 
     383              : //      some functions
     384              :         {
     385            3 :                 std::string grp = parentGroup; grp.append("/Discretization");
     386            9 :                 reg.add_function("AssembleLinearOperatorRhsAndSolution",
     387              :                                                  &ug::AssembleLinearOperatorRhsAndSolution<TAlgebra>, grp);
     388              :         }
     389              : 
     390              : //      some functions
     391              :         {
     392            3 :                 std::string grp = parentGroup; grp.append("/Algebra/Operation");
     393            9 :                 reg.add_function("MatIdentity", &MatIdentity<vector_type, vector_type, matrix_type>, grp,
     394              :                                 "", "opOut", "sets matrix to identity");
     395            9 :                 reg.add_function("MatAdd", &MatAdd<vector_type, vector_type, matrix_type>, grp,
     396              :                                 "", "res#alpha1#A1#alpha2#A2", "calculates res = alpha1*A1 + alpha2*A2");
     397            9 :                 reg.add_function("MatScale", &MatScale<vector_type, vector_type, matrix_type>, grp,
     398              :                                 "", "mat#alpha", "calculates mat = mat*alpha");
     399            9 :                 reg.add_function("MatTranspose", &MatTranspose<vector_type, vector_type, matrix_type>, grp,
     400              :                                 "", "matTranspose#mat", "calculates matTranspose = mat^T");
     401              :         }
     402              : 
     403              : //      ILineSearch
     404              :         {
     405            3 :                 std::string grp = parentGroup; grp.append("/Discretization/Nonlinear");
     406              :                 typedef ILineSearch<vector_type> T;
     407            3 :                 string name = string("ILineSearch").append(suffix);
     408            9 :                 reg.add_class_<T>(name, grp);
     409            9 :                 reg.add_class_to_group(name, "ILineSearch", tag);
     410              :         }
     411              : 
     412              : //      StandardLineSearch
     413              :         {
     414            3 :                 std::string grp = parentGroup; grp.append("/Discretization/Nonlinear");
     415              :                 typedef StandardLineSearch<vector_type> T;
     416              :                 typedef ILineSearch<vector_type> TBase;
     417            3 :                 string name = string("StandardLineSearch").append(suffix);
     418            9 :                 reg.add_class_<T, TBase>(name, grp)
     419            3 :                         .add_constructor()
     420            6 :                         .template add_constructor<void (*)(int, number, number, bool)>()
     421            6 :                         .template add_constructor<void (*)(int, number, number, bool, bool)>()
     422            9 :                         .add_method("set_maximum_steps", &T::set_maximum_steps, "Max. steps of the line search", "steps")
     423           12 :                         .add_method("set_lambda_start", &T::set_lambda_start, "Initial step scaling factor", "start")
     424           12 :                         .add_method("set_reduce_factor", &T::set_reduce_factor, "Step reduction factor", "factor")
     425           12 :                         .add_method("set_suff_descent_factor", &T::set_suff_descent_factor, "Sufficient descent", "factor")
     426           12 :                         .add_method("set_accept_best", &T::set_accept_best, "If to accept the best", "bAcceptBest")
     427           12 :                         .add_method("set_check_all", &T::set_check_all, "If to test all the steps", "bCheckAll")
     428           12 :                         .add_method("set_maximum_defect", &T::set_maximum_defect, "Max. norm of the defect", "maxDef")
     429           12 :                         .add_method("set_verbose", &T::set_verbose, "Verbosity level", "verboseLevel")
     430            9 :                         .add_method("set_offset", &T::set_offset, "Indentation", "strOffset")
     431            3 :                         .set_construct_as_smart_pointer(true);
     432            9 :                 reg.add_class_to_group(name, "StandardLineSearch", tag);
     433              :         }
     434              : 
     435              : // PreviousSolutions
     436              :         {
     437            3 :                 std::string grp = parentGroup; grp.append("/Discretization/TimeDisc");
     438            3 :                 string name = string("SolutionTimeSeries").append(suffix);
     439              :                 typedef VectorTimeSeries<vector_type> T;
     440            9 :                 reg.add_class_<T>(name, grp)
     441            3 :                         .add_constructor()
     442            9 :                         .add_method("size", &T::size, "number of time steps handled")
     443           12 :                         .add_method("push_discard_oldest", &T::push_discard_oldest, "oldest solution", "vec#time", "adds new time point, oldest solution is discarded and returned")
     444           12 :                         .add_method("push", &T::push, "", "vec#time", "adds new time point, not discarding the oldest")
     445            9 :                         .add_method("solution", static_cast<ConstSmartPtr<vector_type> (T::*)(size_t) const>(&T::solution),
     446              :                                         "the local vector for the i'th time point", "i")
     447            6 :                         .add_method("oldest", static_cast<SmartPtr<vector_type> (T::*)()>(&T::oldest),
     448              :                                         "oldest solution")
     449            6 :                         .add_method("latest", static_cast<SmartPtr<vector_type> (T::*)()>(&T::latest),
     450              :                                         "latest solution")
     451            6 :                         .add_method("time", &T::time, "point in time for solution", "i")
     452            3 :                         .set_construct_as_smart_pointer(true);
     453            9 :                 reg.add_class_to_group(name, "SolutionTimeSeries", tag);
     454              :         }
     455            3 : }
     456              : 
     457              : /**
     458              :  * Function called for the registration of Domain and Algebra dependent parts.
     459              :  * All Functions and Classes depending on both Domain and Algebra
     460              :  * are to be placed here when registering. The method is called for all
     461              :  * available Domain and Algebra types, based on the current build options.
     462              :  *
     463              :  * @param reg                           registry
     464              :  * @param parentGroup           group for sorting of functionality
     465              :  */
     466              : template <typename TDomain, typename TAlgebra>
     467            9 : static void DomainAlgebra(Registry& reg, string parentGroup)
     468              : {
     469              :         //      typedefs for Vector and Matrix
     470              :         typedef typename TAlgebra::vector_type vector_type;
     471              : 
     472              :         string suffix = GetDomainAlgebraSuffix<TDomain,TAlgebra>();
     473              :         string tag = GetDomainAlgebraTag<TDomain,TAlgebra>();
     474              : 
     475              :         //      CompositeConvCheck
     476              :         {
     477              :                 std::string &grp = parentGroup;
     478              :                 typedef CompositeConvCheck<vector_type, TDomain> T;
     479              :                 typedef IConvergenceCheck<vector_type> TBase;
     480            9 :                 string name = string("CompositeConvCheck").append(suffix);
     481           27 :                 reg.add_class_<T, TBase>(name, grp)
     482           18 :                         .template add_constructor<void (*)(SmartPtr<ApproximationSpace<TDomain> >)>("ApproximationSpace")
     483           18 :                         .template add_constructor<void (*)(SmartPtr<ApproximationSpace<TDomain> >, int, number, number)>("ApproximationSpace#maxSteps#minDefect#relReduction")
     484           18 :                         .add_method("set_level", (void (T::*)(int)) &T::set_level,
     485              :                                     "", "grid_level", "sets grid level where defect vectors come from")
     486           27 :                         .add_method("set_time_measurement", &T::set_time_measurement,
     487              :                                                 "", "", "whether to perform a time measurement or not")
     488           36 :                         .add_method("set_adaptive", &T::set_adaptive,
     489              :                                                 "", "", "whether adaptive meshing is used or not")
     490           36 :                         .add_method("set_maximum_steps", &T::set_maximum_steps, 
     491              :                                     "", "maximum steps|default|min=0;value=100")
     492           27 :                         .add_method("set_component_check", (void (T::*)(const std::string&,const std::vector<number>&,const std::vector<number>&)) &T::set_component_check,
     493              :                                                 "", "Components#minDefect#relReduction")
     494           18 :                         .add_method("set_component_check", (void (T::*)(const std::vector<std::string>&,const std::vector<number>&,const std::vector<number>&)) &T::set_component_check,
     495              :                                                 "", "Components#minDefect#relReduction")
     496           18 :                         .add_method("set_component_check", (void (T::*)(const std::vector<std::string>&,const number,const number)) &T::set_component_check,
     497              :                                                 "", "Components#minDefect#relReduction")
     498           18 :                         .add_method("set_component_check", (void (T::*)(const std::string&,const number,const number)) &T::set_component_check,
     499              :                                                 "", "Components#minDefect#relReduction")
     500           18 :                         .add_method("set_all_component_check", (void (T::*)(const number,const number)) &T::set_all_component_check,
     501              :                                                 "", "minDefect#relReduction")
     502           18 :                         .add_method("set_group_check", (void (T::*)(const std::vector<std::string>&,const number,const number)) &T::set_group_check,
     503              :                                                 "", "ComponentGroup#minDefect#relReduction")
     504           18 :                         .add_method("set_group_check", (void (T::*)(const std::string&,const number,const number)) &T::set_group_check,
     505              :                                                 "", "ComponentGroup#minDefect#relReduction")
     506           27 :                         .add_method("disable_rest_check", &T::disable_rest_check,
     507              :                                                 "", "")
     508           36 :                         .add_method("set_rest_check", &T::set_rest_check,
     509              :                                                 "", "minDefect#relReduction")
     510           36 :                         .add_method("set_verbose", &T::set_verbose, "", "verbosity")
     511           36 :                         .add_method("set_supress_unsuccessful", &T::set_supress_unsuccessful,
     512              :                                                 "", "", "whether to always report success when iteration is finished")
     513           27 :                         .add_method("defect", (number (T::*)(size_t) const) &T::defect, 
     514              :                                     "defect", "function index", "returns the current defect")
     515           27 :                         .add_method("step", &T::step,  
     516              :                                     "step", "", "returns the current number of steps")
     517           27 :                         .add_method("reduction", (number (T::*)(size_t) const) &T::reduction, 
     518              :                                     "reduction", "function index", "returns the current relative reduction for a function")
     519           18 :                         .add_method("rate", (number (T::*)(size_t) const) &T::rate, 
     520              :                                     "rate", "function index", "returns the current convergence rate for a function")
     521           18 :                         .add_method("avg_rate", (number (T::*)(size_t) const) &T::avg_rate, 
     522              :                                     "avg_rate", "function index", "returns the averaged convergence rate for a function")
     523           18 :                         .add_method("iteration_ended", &T::iteration_ended)
     524            9 :                         .set_construct_as_smart_pointer(true);
     525           27 :                 reg.add_class_to_group(name, "CompositeConvCheck", tag);
     526              :         }
     527              : 
     528              :         //      NonlinearGaussSeidelSolver
     529              :         {
     530            9 :                 std::string grp = parentGroup; grp.append("/Discretization/Nonlinear");
     531              :                 typedef NLGaussSeidelSolver<TDomain, TAlgebra> T;
     532              :                 typedef IOperatorInverse<vector_type> TBase;
     533              :                 typedef DebugWritingObject<TAlgebra> TBase2;
     534            9 :                 string name = string("NLGaussSeidelSolver").append(suffix);
     535           27 :                 reg.add_class_<T, TBase, TBase2>(name, grp)
     536            9 :                         .add_constructor()
     537              :                         .template add_constructor<void (*)(SmartPtr<ApproximationSpace<TDomain> >,
     538           18 :                                 SmartPtr<IConvergenceCheck<vector_type> >)> ("ApproxSpaceConvCheck")
     539           27 :                         .add_method("set_approximation_space", &T::set_approximation_space, "", "approxSpace")
     540           36 :                         .add_method("set_convergence_check", &T::set_convergence_check, "", "convCheck")
     541           36 :                         .add_method("set_damp", &T::set_damp, "", "setDampingFactor")
     542           36 :                         .add_method("set_constraint", &T::set_constraint, "", "setConstraint")
     543           36 :                         .add_method("init", &T::init, "success", "op")
     544           36 :                         .add_method("prepare", &T::prepare, "success", "u")
     545           36 :                         .add_method("apply", &T::apply, "success", "u")
     546           27 :                         .add_method("config_string", &T::config_string)
     547            9 :                         .set_construct_as_smart_pointer(true);
     548           27 :                 reg.add_class_to_group(name, "NLGaussSeidelSolver", tag);
     549              :         }
     550              : 
     551              :         //      NestedIterationSolver
     552              :         {
     553            9 :                 std::string grp = parentGroup; grp.append("/Discretization");
     554              :                 typedef NestedIterationSolver<TDomain, TAlgebra> T;
     555              :                 typedef IOperatorInverse<vector_type> TBase;
     556              :                 typedef DebugWritingObject<TAlgebra> TBase2;
     557            9 :                 string name = string("NestedIterationSolver").append(suffix);
     558           27 :                 reg.add_class_<T, TBase, TBase2>(name, grp)
     559            9 :                                                         .add_constructor()
     560           18 :                                                         .template add_constructor<void (*)(SmartPtr<IOperator<vector_type> >)>("Operator")
     561           18 :                                                         .template add_constructor<void (*)(SmartPtr<IAssemble<TAlgebra> >)>("AssemblingRoutine")
     562           18 :                                                         .template add_constructor<void (*)(SmartPtr<IAssemble<TAlgebra> >, SmartPtr<IAssemble<TAlgebra> >)>("AssemblingRoutine#ErrorRoutine")
     563           27 :                                                         .add_method("set_linear_solver", &T::set_linear_solver, "", "linSolver")
     564              :                                                 //      .add_method("set_convergence_check", &T::set_convergence_check, "", "convCheck")
     565           36 :                                                         .add_method("init", &T::init, "success", "op")
     566           36 :                                                         .add_method("prepare", &T::prepare, "success", "u")
     567           36 :                                                         .add_method("apply", &T::apply, "success", "u")
     568           36 :                                                         .add_method("top_level", &T::top_level)
     569           36 :                                                         .add_method("set_top_level", &T::set_top_level)
     570           36 :                                                         .add_method("base_level", &T::base_level)
     571           36 :                                                         .add_method("set_base_level", &T::set_base_level)
     572           36 :                                                         .add_method("set_refiner", &T::set_refiner)
     573           36 :                                                         .add_method("set_refinement_marking", &T::set_refinement_marking)
     574           36 :                                                         .add_method("set_tolerance", &T::set_tolerance)
     575           36 :                                                         .add_method("set_max_steps", &T::set_max_steps)
     576           36 :                                                         .add_method("last_error", &T::last_error)
     577              : #ifdef UG_CPU_1
     578           36 :                                                         .add_method("set_debug_elem_error", &T::set_debug_elem_error)
     579              : #endif
     580           36 :                                                         .add_method("use_adaptive_refinement", &T::use_adaptive_refinement)
     581           36 :                                                         .add_method("enable_adaptive_refinement", &T::enable_adaptive_refinement)
     582           36 :                                                         .add_method("disable_adaptive_refinement", &T::disable_adaptive_refinement)
     583           36 :                                                         .add_method("config_string", &T::config_string)
     584              : 
     585           36 :                                                         .add_method("set_associated_space", &T::set_associated_space)
     586           27 :                                                         .add_method("set_absolute_tolerance", &T::set_absolute_tolerance)
     587            9 :                                                         .set_construct_as_smart_pointer(true);
     588           27 :                 reg.add_class_to_group(name, "NestedIterationSolver", tag);
     589              :         }
     590              : 
     591              :         //      LagrangeMultiplierDisc base class
     592              :         typedef GridFunction<TDomain, TAlgebra> function_type;
     593              :         {
     594              :                 std::string &grp = parentGroup;
     595              :                 typedef ILagrangeMultiplierDisc<TDomain, function_type> T;
     596            9 :                 string name = string("ILagrangeMultiplierDisc").append(suffix);
     597           27 :                 reg.add_class_<T>(name, grp)
     598            9 :                         .set_construct_as_smart_pointer(true);
     599           27 :                 reg.add_class_to_group(name, "ILagrangeMultiplierDisc", tag);
     600              :         }
     601              : 
     602              :         //      ActiveSet
     603              :         {
     604              :                 std::string &grp = parentGroup;
     605              :                 typedef ActiveSet<TDomain, TAlgebra> T;
     606            9 :                 string name = string("ActiveSet").append(suffix);
     607           27 :                 reg.add_class_<T>(name, grp)
     608            9 :                         .add_constructor()
     609           27 :                         .add_method("set_obstacle", &T::set_obstacle, "", "sets limiting "
     610              :                                         "obstacle constraint")
     611           36 :                         .add_method("set_lagrange_multiplier_disc", &T::set_lagrange_multiplier_disc, "",
     612              :                                         "discretization to compute the lagrange multiplier")
     613           36 :                         .add_method("prepare", &T::prepare, "", "prepare")
     614           36 :                         .add_method("active_index", &T::active_index, "", "",
     615              :                                         "is index active or not, stores activeSetList")
     616           36 :                         .add_method("set_dirichlet_rows", &T::set_dirichlet_rows, "", "",
     617              :                                         "sets dirichlet rows for active DoFs")
     618           36 :                         .add_method("lagrange_multiplier", &T::lagrange_multiplier, "", "",
     619              :                                         "computes lagrange multiplier")
     620           36 :                         .add_method("residual_lagrange_mult", &T::residual_lagrange_mult, "", "",
     621              :                                         "computes lagrange multiplier")
     622           36 :                         .add_method("check_conv", &T::check_conv, "", "",
     623              :                                         "activeIndexSet changed or not")
     624           27 :                         .add_method("check_ineq", &T::check_inequ, "", "",
     625              :                                                 "check if all inequalities are fulfilled")
     626            9 :                         .set_construct_as_smart_pointer(true);
     627           27 :                 reg.add_class_to_group(name, "ActiveSet", tag);
     628              :         }
     629              : 
     630              : 
     631              :         {
     632            9 :                 std::string grp = parentGroup; grp.append("/Discretization/TimeIntegratorObservers");
     633              :                 // LuaCallbackObserver
     634              :                 typedef LuaCallbackObserver<TDomain, TAlgebra> T;
     635              :                 typedef ITimeIntegratorObserver<TDomain, TAlgebra> TBase;
     636              : 
     637              :                 typedef GridFunction<TDomain, TAlgebra> TGF;
     638              : 
     639            9 :                 string name = string("LuaCallbackObserver").append(suffix);
     640           27 :                 reg.add_class_<T, TBase>(name, grp)
     641           18 :                         .template add_constructor<void (*)() >("internal id=0")
     642           18 :                         .template add_constructor<void (*)(int) >("internal id")
     643           27 :                         .add_method("set_callback", &T::set_callback)
     644           27 :                         .add_method("get_current_solution", static_cast<SmartPtr<TGF> (T::*)() > (&T::get_current_solution))
     645            9 :                         .set_construct_as_smart_pointer(true);
     646           27 :                 reg.add_class_to_group(name, "LuaCallbackObserver", tag);
     647              :         }
     648              : 
     649              :         {
     650            9 :                 std::string grp = parentGroup; grp.append("/Discretization");
     651              :                 typedef TimeIntegratorSubject<TDomain, TAlgebra> T;
     652              :                 typedef GridFunction<TDomain, TAlgebra> TGF;
     653              : 
     654            9 :                 string name = string("TimeIntegratorSubject").append(suffix);
     655           27 :                 reg.add_class_<T>(name, grp)
     656           18 :                                   .template add_constructor<void (*)() >("")
     657           27 :                                   .add_method("attach_observer", &T::attach_observer)
     658              :                                   //.add_method("attach_to_group", &T::attach_to_group)
     659           36 :                                   .add_method("attach_init_observer", &T::attach_init_observer)
     660           36 :                                   .add_method("attach_rewind_observer", &T::attach_rewind_observer)
     661           36 :                                   .add_method("attach_finalize_observer", &T::attach_finalize_observer)
     662           36 :                                   .add_method("attach_preprocess_observer", &T::attach_preprocess_observer)
     663           36 :                                   .add_method("attach_postprocess_observer", &T::attach_postprocess_observer)
     664           36 :                                   .add_method("attach_start_observer", &T::attach_start_observer)
     665           36 :                                   .add_method("attach_end_observer", &T::attach_end_observer)
     666           36 :                                   .add_method("reset_observers", &T::reset_observers)
     667           36 :                                   .add_method("notify_init_step", &T::notify_init_step)
     668           36 :                                   .add_method("notify_rewind_step", &T::notify_rewind_step)
     669           36 :                                   .add_method("notify_finalize_step", &T::notify_finalize_step)
     670           36 :                                   .add_method("notify_preprocess_step", &T::notify_preprocess_step)
     671           36 :                                   .add_method("notify_postprocess_step", &T::notify_postprocess_step)
     672           36 :                                   .add_method("notify_start", &T::notify_start)
     673           27 :                                   .add_method("notify_end", &T::notify_end)
     674            9 :                                   .set_construct_as_smart_pointer(true);
     675           27 :                 reg.add_class_to_group(name, "TimeIntegratorSubject", tag);
     676              : 
     677              :         }
     678              : 
     679              : 
     680              :         {
     681            9 :                 std::string grp = parentGroup; grp.append("/Discretization/TimeIntegratorObservers");
     682              :                 // ITimeIntegratorObserver (virtual base class)
     683              :                 typedef ITimeIntegratorObserver<TDomain, TAlgebra> T;
     684            9 :                 string name = string("ITimeIntegratorObserver").append(suffix);
     685           27 :                 reg.add_class_<T>(name, grp);
     686           27 :                 reg.add_class_to_group(name, "ITimeIntegratorObserver", tag);
     687              :         }
     688              : 
     689              :         // {
     690              :         //      std::string grp = parentGroup; grp.append("/Discretization/TimeIntegratorObservers");
     691              :         //      // ProxyTimeIntegratorObserver
     692              :         //      typedef ProxyTimeIntegratorObserver<TDomain, TAlgebra> T;
     693              :         //      typedef ITimeIntegratorObserver<TDomain, TAlgebra> TBase;
     694              :         //      string name = string("ProxyTimeIntegratorObserver").append(suffix);
     695              :         //      reg.add_class_<T, TBase>(name, grp);
     696              :         //      reg.add_class_to_group(name, "ProxyTimeIntegratorObserver", tag);
     697              :         // }
     698              : 
     699            9 : }
     700              : 
     701            1 : static void Common(Registry& reg, string parentGroup)
     702              : {
     703            1 :         std::string grp = parentGroup; grp.append("/Discretization/Nonlinear");
     704              :         //  INewtonUpdate
     705              :         {
     706              :                 typedef INewtonUpdate T;
     707            1 :                 string name = string("INewtonUpdate");
     708            3 :                 reg.add_class_<T>(name, grp);
     709              :         }
     710              : 
     711            1 :         grp = parentGroup; grp.append("/Discretization/Util");
     712              : 
     713              :         {
     714              :                 // IFinishedCondition (virtual base class)
     715            3 :                 reg.add_class_<IFinishedCondition>(string("IFinishedCondition"), grp);
     716              :         }
     717              : 
     718              : 
     719              :         {
     720              :                 typedef FinishedTester T;
     721            1 :                 string name = string("FinishedTester");
     722            3 :                 reg.add_class_<T>(name, grp)
     723            2 :                         .add_constructor<void (*) ()> ()
     724            2 :                         .add_method("is_finished", static_cast<bool (T::*) (number,int)> (&T::is_finished), "time, step", "Tests if all conditions are fulfilled")
     725            2 :                         .add_method("add_condition", static_cast<void (T::*) (SmartPtr<IFinishedCondition>)> (&T::add_condition), "condition", "Adds a new condition to the list of conditions")
     726            1 :                         .set_construct_as_smart_pointer(true);
     727              :         }
     728              : 
     729              :         {
     730              :                 typedef MaxStepsFinishedCondition T;
     731              :                 typedef IFinishedCondition TBase;
     732            1 :                 string name = string("MaxStepsFinishedCondition");
     733            3 :                 reg.add_class_<T, TBase>(name, grp)
     734            2 :                         .add_constructor<void (*) (int)> ("max_steps")
     735            1 :                         .set_construct_as_smart_pointer(true);
     736              :         }
     737              : 
     738              : 
     739              :         {
     740              :                 typedef TemporalFinishedCondition T;
     741              :                 typedef IFinishedCondition TBase;
     742            1 :                 string name = string("TemporalFinishedCondition");
     743            3 :                 reg.add_class_<T, TBase>(name, grp)
     744            2 :                         .add_constructor<void (*) (number, number, number)> ("end_time, max_step_size, relative_precision_bound")
     745            2 :                         .add_method("set_max_step_size", static_cast<void (T::*) (number)> (&T::set_max_step_size), "max_step_size", "Sets maximum step size")
     746            1 :                         .set_construct_as_smart_pointer(true);
     747              :         }
     748              : 
     749              : 
     750            1 : }
     751              : 
     752              : }; // end Functionality
     753              : 
     754              : // end group discalgebra_bridge
     755              : /// \}
     756              : 
     757              : }// end DiscAlgebra
     758              : 
     759              : /// \addtogroup discalgebra_bridge
     760            1 : void RegisterBridge_DiscAlgebra(Registry& reg, string grp)
     761              : {
     762              :         typedef DiscAlgebra::Functionality Functionality;
     763              : 
     764              :         try{
     765            2 :                 RegisterAlgebraDependent<Functionality>(reg,grp);
     766            2 :                 RegisterDomainAlgebraDependent<Functionality>(reg,grp);
     767            1 :                 RegisterCommon<Functionality>(reg,grp);
     768              :         }
     769            0 :         UG_REGISTRY_CATCH_THROW(grp);
     770            1 : }
     771              : 
     772              : } // end namespace ug
     773              : } // end namespace ug
        

Generated by: LCOV version 2.0-1