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

            Line data    Source code
       1              : /*
       2              :  * Copyright (c) 2012-2015:  G-CSC, Goethe University Frankfurt
       3              :  * Author: Andreas Vogel
       4              :  * 
       5              :  * This file is part of UG4.
       6              :  * 
       7              :  * UG4 is free software: you can redistribute it and/or modify it under the
       8              :  * terms of the GNU Lesser General Public License version 3 (as published by the
       9              :  * Free Software Foundation) with the following additional attribution
      10              :  * requirements (according to LGPL/GPL v3 §7):
      11              :  * 
      12              :  * (1) The following notice must be displayed in the Appropriate Legal Notices
      13              :  * of covered and combined works: "Based on UG4 (www.ug4.org/license)".
      14              :  * 
      15              :  * (2) The following notice must be displayed at a prominent place in the
      16              :  * terminal output of covered works: "Based on UG4 (www.ug4.org/license)".
      17              :  * 
      18              :  * (3) The following bibliography is recommended for citation and must be
      19              :  * preserved in all covered files:
      20              :  * "Reiter, S., Vogel, A., Heppner, I., Rupp, M., and Wittum, G. A massively
      21              :  *   parallel geometric multigrid solver on hierarchically distributed grids.
      22              :  *   Computing and visualization in science 16, 4 (2013), 151-164"
      23              :  * "Vogel, A., Reiter, S., Rupp, M., Nägel, A., and Wittum, G. UG4 -- a novel
      24              :  *   flexible software system for simulating pde based models on high performance
      25              :  *   computers. Computing and visualization in science 16, 4 (2013), 165-179"
      26              :  * 
      27              :  * This program is distributed in the hope that it will be useful,
      28              :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      29              :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
      30              :  * GNU Lesser General Public License for more details.
      31              :  */
      32              : 
      33              : // extern headers
      34              : #include <iostream>
      35              : #include <sstream>
      36              : #include <string>
      37              : 
      38              : // include bridge
      39              : #include "bridge/bridge.h"
      40              : #include "bridge/util.h"
      41              : #include "bridge/util_domain_algebra_dependent.h"
      42              : 
      43              : // lib_disc includes
      44              : #include "lib_disc/function_spaces/grid_function.h"
      45              : #include "lib_disc/function_spaces/approximation_space.h"
      46              : #include "lib_disc/function_spaces/grid_function_util.h"
      47              : #include "lib_disc/function_spaces/grid_function_user_data.h"
      48              : #include "lib_disc/function_spaces/dof_position_util.h"
      49              : #include "lib_disc/function_spaces/grid_function_global_user_data.h"
      50              : #include "lib_disc/function_spaces/grid_function_user_data_explicit.h"
      51              : #include "lib_disc/function_spaces/grid_function_coordinate_util.h"
      52              : #include "lib_disc/function_spaces/metric_spaces.h"
      53              : using namespace std;
      54              : 
      55              : namespace ug{
      56              : namespace bridge{
      57              : namespace GridFunction{
      58              : 
      59              : /**
      60              :  * \defgroup gridfnct_bridge Grid Function Bridge
      61              :  * \ingroup disc_bridge
      62              :  * \{
      63              :  */
      64              : 
      65              : /**
      66              :  * Class exporting the functionality. All functionality that is to
      67              :  * be used in scripts or visualization must be registered here.
      68              :  */
      69              : struct Functionality
      70              : {
      71              : 
      72              : /**
      73              :  * Function called for the registration of Domain and Algebra dependent parts.
      74              :  * All Functions and Classes depending on both Domain and Algebra
      75              :  * are to be placed here when registering. The method is called for all
      76              :  * available Domain and Algebra types, based on the current build options.
      77              :  *
      78              :  * @param reg                           registry
      79              :  * @param parentGroup           group for sorting of functionality
      80              :  */
      81              : template <typename TDomain, typename TAlgebra>
      82            9 : static void DomainAlgebra(Registry& reg, string grp)
      83              : {
      84              :         string suffix = GetDomainAlgebraSuffix<TDomain,TAlgebra>();
      85              :         string tag = GetDomainAlgebraTag<TDomain,TAlgebra>();
      86              : 
      87              : //      typedef
      88              :         static const int dim = TDomain::dim;
      89              :         typedef typename TAlgebra::vector_type vector_type;
      90              :         typedef ApproximationSpace<TDomain> approximation_space_type;
      91              :         typedef ug::GridFunction<TDomain, TAlgebra> TFct;
      92              : 
      93              : //      group string
      94            9 :         grp.append("/ApproximationSpace");
      95              : 
      96              : //      GridFunction
      97              :         {
      98            9 :                 string name = string("GridFunction").append(suffix);
      99           27 :                 reg.add_class_<TFct, vector_type>(name, grp)
     100           18 :                         .template add_constructor<void (*)(SmartPtr<approximation_space_type>)>("ApproximationSpace")
     101           18 :                         .template add_constructor<void (*)(SmartPtr<approximation_space_type>, int)>("ApproximationSpace#Level")
     102           18 :                         .add_method("assign", static_cast<void (TFct::*)(const vector_type&)>(&TFct::assign),
     103              :                                                 "Success", "Vector")
     104           27 :                         .add_method("clone", &TFct::clone)
     105           36 :                         .add_method("set_consistent_storage_type", &TFct::SetConsistentStorageType)
     106           36 :                         .add_method("grid_level", &TFct::grid_level)
     107           27 :                         .add_method("num_dofs", static_cast<size_t (TFct::*)() const>(&TFct::num_dofs))
     108           18 :                         .add_method("approx_space", static_cast<SmartPtr<approximation_space_type> (TFct::*)()>(&TFct::approx_space))
     109           27 :                         .add_method("redistribution_enabled", &TFct::redistribution_enabled)
     110           27 :                         .add_method("enable_redistribution", &TFct::enable_redistribution)
     111            9 :                         .set_construct_as_smart_pointer(true);
     112           27 :                 reg.add_class_to_group(name, "GridFunction", tag);
     113              :         }
     114              : 
     115              : //      ExplicitGridFunctionValue
     116              :         {
     117            9 :                 string name = string("ExplicitGridFunctionValue").append(suffix);
     118              :                 typedef ExplicitGridFunctionValue<TFct> T;
     119              :                 typedef CplUserData<number, dim> TBase;
     120           27 :                 reg.add_class_<T, TBase>(name, grp)
     121           18 :                    .template add_constructor<void (*)(SmartPtr<TFct>, const char*)>("GridFunction#Component")
     122            9 :                    .set_construct_as_smart_pointer(true);
     123           27 :                 reg.add_class_to_group(name, "ExplicitGridFunctionValue", tag);
     124              :         }
     125              : 
     126              : //      ExplicitGridFunctionVector
     127              :         {
     128            9 :                 string name = string("ExplicitGridFunctionVector").append(suffix);
     129              :                 typedef ExplicitGridFunctionVector<TFct> T;
     130              :                 typedef CplUserData<MathVector<dim>, dim> TBase;
     131           27 :                 reg.add_class_<T, TBase>(name, grp)
     132           18 :                    .template add_constructor<void (*)(SmartPtr<TFct>, const char*)>("GridFunction#Components")
     133            9 :                    .set_construct_as_smart_pointer(true);
     134           27 :                 reg.add_class_to_group(name, "ExplicitGridFunctionVector", tag);
     135              :         }
     136              : 
     137              : //      ExplicitGridFunctionGradient
     138              :         {
     139            9 :                 string name = string("ExplicitGridFunctionGradient").append(suffix);
     140              :                 typedef ExplicitGridFunctionGradient<TFct> T;
     141              :                 typedef CplUserData<MathVector<dim>, dim> TBase;
     142           27 :                 reg.add_class_<T, TBase>(name, grp)
     143           18 :                    .template add_constructor<void (*)(SmartPtr<TFct>, const char*)>("GridFunction#Component")
     144           27 :             .add_method("add_subset_coeff", &T::add_subset_coeff)
     145           27 :                         .add_method("get_subset_coeff", &T::get_subset_coeff)
     146            9 :                    .set_construct_as_smart_pointer(true);
     147           27 :                 reg.add_class_to_group(name, "ExplicitGridFunctionGradient", tag);
     148              :         }
     149              : 
     150              : //      GridFunctionNumberData
     151              :         {
     152            9 :                 string name = string("GridFunctionNumberData").append(suffix);
     153              :                 typedef GridFunctionNumberData<TFct> T;
     154              :                 typedef CplUserData<number, dim> TBase;
     155           27 :                 reg.add_class_<T, TBase>(name, grp)
     156           18 :                         .template add_constructor<void (*)(SmartPtr<TFct>, const char*)>("GridFunction#Component")
     157            9 :                         .set_construct_as_smart_pointer(true);
     158           27 :                 reg.add_class_to_group(name, "GridFunctionNumberData", tag);
     159              :         }
     160              : 
     161              : //      GridFunctionVectorData
     162              :         {
     163            9 :                 string name = string("GridFunctionVectorData").append(suffix);
     164              :                 typedef GridFunctionVectorData<TFct> T;
     165              :                 typedef CplUserData<MathVector<dim>, dim> TBase;
     166           27 :                 reg.add_class_<T, TBase>(name, grp)
     167           18 :                         .template add_constructor<void (*)(SmartPtr<TFct>, const char*)>("GridFunction#Components")
     168            9 :                         .set_construct_as_smart_pointer(true);
     169           27 :                 reg.add_class_to_group(name, "GridFunctionVectorData", tag);
     170              :         }
     171              : 
     172              : //      GridFunctionGradientData
     173              :         {
     174            9 :                 string name = string("GridFunctionGradientData").append(suffix);
     175              :                 typedef GridFunctionGradientData<TFct> T;
     176              :                 typedef CplUserData<MathVector<dim>, dim> TBase;
     177           27 :                 reg.add_class_<T, TBase>(name, grp)
     178           18 :                         .template add_constructor<void (*)(SmartPtr<TFct>, const char*)>("GridFunction#Component")
     179            9 :                         .set_construct_as_smart_pointer(true);
     180           27 :                 reg.add_class_to_group(name, "GridFunctionGradientData", tag);
     181              :         }
     182              : 
     183              : //      GridFunctionGradientComponentData
     184              :         {
     185            9 :                 string name = string("GridFunctionGradientComponentData").append(suffix);
     186              :                 typedef GridFunctionGradientComponentData<TFct> T;
     187              :                 typedef CplUserData<number, dim> TBase;
     188           27 :                 reg.add_class_<T, TBase>(name, grp)
     189           18 :                         .template add_constructor<void (*)(SmartPtr<TFct>, const char*, size_t)>("GridFunction#Components")
     190            9 :                         .set_construct_as_smart_pointer(true);
     191           27 :                 reg.add_class_to_group(name, "GridFunctionGradientComponentData", tag);
     192              :         }
     193              : //      GlobalGridFunctionNumberData
     194              :         {
     195            9 :                 string name = string("GlobalGridFunctionNumberData").append(suffix);
     196              :                 typedef GlobalGridFunctionNumberData<TFct> T;
     197              :                 typedef CplUserData<number, dim> TBase;
     198           27 :                 reg.add_class_<T, TBase>(name, grp)
     199           18 :                         .template add_constructor<void (*)(SmartPtr<TFct>, const char*)>("GridFunction#Component")
     200           18 :                         .add_method("evaluate", static_cast<number (T::*)(const MathVector<dim>&) const>(&T::evaluate))
     201           18 :                         .add_method("evaluate_global", static_cast<number (T::*)(std::vector<number>)>(&T::evaluate_global))
     202            9 :                         .set_construct_as_smart_pointer(true);
     203           27 :                 reg.add_class_to_group(name, "GlobalGridFunctionNumberData", tag);
     204              :         }
     205              : 
     206              : //      GlobalGridFunctionNumberData for lower-dim elem geometries (here: edges)
     207              :         if (dim > EDGE)
     208              :         {
     209            6 :                 string name = string("GlobalEdgeGridFunctionNumberData").append(suffix);
     210              :                 typedef GlobalGridFunctionNumberData<TFct, 1> T;
     211              :                 typedef CplUserData<number, dim> TBase;
     212           18 :                 reg.add_class_<T, TBase>(name, grp)
     213           12 :                         .template add_constructor<void (*)(SmartPtr<TFct>, const char*)>("GridFunction#Component")
     214           12 :                         .add_method("evaluate", static_cast<number (T::*)(const MathVector<dim>&) const>(&T::evaluate))
     215           12 :                         .add_method("evaluate_global", static_cast<number (T::*)(std::vector<number>)>(&T::evaluate_global))
     216            6 :                         .set_construct_as_smart_pointer(true);
     217           18 :                 reg.add_class_to_group(name, "GlobalEdgeGridFunctionNumberData", tag);
     218              :         }
     219              : 
     220              : 
     221              : //      GlobalGridFunctionGradientData
     222              :         {
     223            9 :                 string name = string("GlobalGridFunctionGradientData").append(suffix);
     224              :                 typedef GlobalGridFunctionGradientData<TFct> T;
     225              :                 typedef CplUserData<MathVector<dim>, dim> TBase;
     226           27 :                 reg.add_class_<T, TBase>(name, grp)
     227           18 :                         .template add_constructor<void (*)(SmartPtr<TFct>, const char*)>("GridFunction#Component")
     228           18 :                         .add_method("evaluate_global", static_cast<std::vector<number> (T::*)(std::vector<number>)>(&T::evaluate_global))
     229            9 :                         .set_construct_as_smart_pointer(true);
     230           27 :                 reg.add_class_to_group(name, "GlobalGridFunctionGradientData", tag);
     231              :         }
     232              : 
     233              :         // IGridFunctionSpace (abstract base class)
     234              :         {
     235              :                         typedef IGridFunctionSpace<TFct> T;
     236            9 :                         string name = string("IGridFunctionSpace").append(suffix);
     237           27 :                         reg.add_class_<T>(name, grp)
     238           18 :                            .add_method("config_string", &T::config_string);
     239           27 :                         reg.add_class_to_group(name, "IGridFunctionSpace", tag);
     240              :         }
     241              : 
     242              :         // IComponentSpace (abstract base class for scalar component)
     243              :         {
     244              :                 typedef IComponentSpace<TFct> T;
     245              :                 typedef IGridFunctionSpace<TFct> TBase;
     246              : 
     247            9 :                 string name = string("IComponentSpace").append(suffix);
     248           27 :                 reg.add_class_<T, TBase>(name, grp)
     249           18 :                    .add_method("norm", static_cast<number (T::*)(TFct&) > (&T::norm))
     250           18 :                    .add_method("distance", static_cast<number (T::*)(TFct&, TFct&) > (&T::distance));
     251              : 
     252           27 :                 reg.add_class_to_group(name, "IComponentSpace", tag);
     253              :         }
     254              : 
     255              :         // GridFunctionComponentSpace
     256              :         {
     257              :                 typedef GridFunctionComponentSpace<TFct> T;
     258              :                 typedef IComponentSpace<TFct> TBase;
     259              : 
     260            9 :                 string name = string("GridFunctionComponentSpace").append(suffix);
     261           27 :                 reg.add_class_<T, TBase>(name, grp)
     262           18 :                         .template add_constructor<void (*)(const char *) >("function names")
     263           18 :                         .template add_constructor<void (*)(const char *, const char *) >("function names, subset names")
     264            9 :                         .set_construct_as_smart_pointer(true);
     265           27 :                 reg.add_class_to_group(name, "GridFunctionComponentSpace", tag);
     266              :         }
     267              : 
     268              :         // L2ComponentSpace
     269              :         {
     270              :                 typedef L2ComponentSpace<TFct> T;
     271              :                 typedef IComponentSpace<TFct> TBase;
     272              :                 typedef typename L2Integrand<TFct>::weight_type TWeight;
     273              : 
     274            9 :                 string name = string("L2ComponentSpace").append(suffix);
     275           27 :                 reg.add_class_<T, TBase>(name, grp)
     276           18 :                    .template add_constructor<void (*)(const char *) >("fctNames")
     277           18 :                    .template add_constructor<void (*)(const char *, int) >("fctNames, order")
     278           18 :                    .template add_constructor<void (*)(const char *, int, double) >("fctNames, order, weight")
     279           18 :                    .template add_constructor<void (*)(const char *, int, double, const char *) >("fctNames, order, weight, ssNames")
     280           18 :                    .template add_constructor<void (*)(const char *, int, ConstSmartPtr<TWeight>) >("fctNames, order, weight")
     281           18 :                    .template add_constructor<void (*)(const char *, int, ConstSmartPtr<TWeight>, const char *) >("fctNames, order, weight, ssNames")
     282              :                  //  .template add_constructor<void (*)(const char *, const char *, int, ConstSmartPtr<TWeight>) >("fctNames, ssNames, order, weight")
     283              : 
     284            9 :                    .set_construct_as_smart_pointer(true);
     285           27 :                 reg.add_class_to_group(name, "L2ComponentSpace", tag);
     286              :         }
     287              : 
     288              :         // L2QuotientSpace (= L2ComponentSpace factoring out constants)
     289              :         {
     290              :                 typedef L2QuotientSpace<TFct> T;
     291              :                 typedef IComponentSpace<TFct> TBase;
     292              :                 typedef typename L2Integrand<TFct>::weight_type TWeight;
     293              : 
     294            9 :                 string name = string("L2QuotientSpace").append(suffix);
     295           27 :                 reg.add_class_<T, TBase>(name, grp)
     296           18 :                         .template add_constructor<void (*)(const char *) >("fctNames")
     297           18 :                         .template add_constructor<void (*)(const char *, int) >("fctNames, order")
     298           18 :                         .template add_constructor<void (*)(const char *, int, double) >("fctNames, order, weight")
     299           18 :                         .template add_constructor<void (*)(const char *, int, double, const char *) >("fctNames, order, weight, ssNames")
     300           18 :                         .template add_constructor<void (*)(const char *, int, ConstSmartPtr<TWeight>) >("fctNames, order, weight")
     301           18 :                         .template add_constructor<void (*)(const char *, int, ConstSmartPtr<TWeight>, const char *) >("fctNames, order, weight, ssNames")
     302            9 :                         .set_construct_as_smart_pointer(true);
     303           27 :                 reg.add_class_to_group(name, "L2QuotientSpace", tag);
     304              :         }
     305              : 
     306              :         // H1SemiComponentSpace
     307              :         {
     308              :                 typedef H1SemiComponentSpace<TFct> T;
     309              :                 typedef IComponentSpace<TFct> TBase;
     310              :                 typedef typename H1SemiIntegrand<TFct>::weight_type TWeight;
     311              : 
     312            9 :                 string name = string("H1SemiComponentSpace").append(suffix);
     313           27 :                 reg.add_class_<T, TBase>(name, grp)
     314           18 :                    .template add_constructor<void (*)(const char *) >("fctNames")
     315           18 :                    .template add_constructor<void (*)(const char *, int) >("fctNames, order")
     316           18 :                    .template add_constructor<void (*)(const char *, int, number) >("fctNames, order, weight")
     317           18 :                    .template add_constructor<void (*)(const char *, int, number, const char *) >("fctNames, order, weight, ssNames")
     318           18 :                    .template add_constructor<void (*)(const char *, int, ConstSmartPtr<TWeight>) >("fctNames, order, weight")
     319           18 :                    .template add_constructor<void (*)(const char *, int, const char *, ConstSmartPtr<TWeight>) >("fctNames, order, weight, ssNames")
     320           27 :                    .add_method("set_weight", &T::set_weight)
     321           36 :                    .add_method("get_weight", &T::get_weight)
     322           36 :                    .add_method("norm", static_cast<number (T::*)(TFct&) > (&T::norm))
     323           27 :                    .add_method("distance", static_cast<number (T::*)(TFct&, TFct&) > (&T::distance))
     324            9 :                    .set_construct_as_smart_pointer(true);
     325           27 :                 reg.add_class_to_group(name, "H1SemiComponentSpace", tag);
     326              :         }
     327              : /*
     328              :         // KineticEnergyComponentSpace
     329              :                         {
     330              :                                 typedef KineticEnergyComponentSpace<TFct> T;
     331              :                                 typedef IComponentSpace<TFct> TBase;
     332              :                                 typedef typename T::weight_type TWeight;
     333              :                                 typedef typename T::velocity_type TVelocity;
     334              : 
     335              :                                 string name = string("KineticEnergyComponentSpace").append(suffix);
     336              :                                 reg.add_class_<T, TBase>(name, grp)
     337              :                                    .template add_constructor<void (*)(SmartPtr<TVelocity>, const char *) >("fctNames")
     338              :                                    .template add_constructor<void (*)(SmartPtr<TVelocity>,const char *, int) >("fctNames, order")
     339              :                                    .template add_constructor<void (*)(SmartPtr<TVelocity>,const char *, int, number) >("fctNames, order, weight")
     340              :                                    .template add_constructor<void (*)(SmartPtr<TVelocity>,const char *, int, number, const char *) >("fctNames, order, weight, ssNames")
     341              :                                    .template add_constructor<void (*)(SmartPtr<TVelocity>,const char *, int, ConstSmartPtr<TWeight>) >("fctNames, order, weight")
     342              :                                    .template add_constructor<void (*)(SmartPtr<TVelocity>,const char *, int, const char *, ConstSmartPtr<TWeight>) >("fctNames, order, weight, ssNames")
     343              :                                    .add_method("set_weight", &T::set_weight)
     344              :                                    .add_method("get_weight", &T::get_weight)
     345              :                                    .set_construct_as_smart_pointer(true);
     346              :                                 reg.add_class_to_group(name, "KineticEnergyComponentSpace", tag);
     347              :                         }
     348              : */
     349              :         // H1EnergyComponentSpace
     350              :                 {
     351              :                         typedef H1EnergyComponentSpace<TFct> T;
     352              :                         typedef IComponentSpace<TFct> TBase;
     353              :                         typedef typename H1EnergyIntegrand<TFct>::weight_type TWeight;
     354              : 
     355            9 :                         string name = string("VelEnergyComponentSpace").append(suffix);
     356           27 :                         reg.add_class_<T, TBase>(name, grp)
     357           18 :                            .template add_constructor<void (*)(const char *) >("fctNames")
     358           18 :                            .template add_constructor<void (*)(const char *, int) >("fctNames, order")
     359           18 :                            .template add_constructor<void (*)(const char *, int, number) >("fctNames, order, weight")
     360           18 :                            .template add_constructor<void (*)(const char *, int, number, const char *) >("fctNames, order, weight, ssNames")
     361           18 :                            .template add_constructor<void (*)(const char *, int, ConstSmartPtr<TWeight>) >("fctNames, order, weight")
     362              :                            //.template add_constructor<void (*)(const char *, int, const char *, ConstSmartPtr<TWeight>) >("fctNames, order, ssNames, weight")
     363           18 :                            .template add_constructor<void (*)(const char *, int, ConstSmartPtr<TWeight>, const char*) >("fctNames, order, weight, ssNames")
     364           27 :                            .add_method("set_weight", &T::set_weight)
     365           36 :                            .add_method("get_weight", &T::get_weight)
     366           36 :                            .add_method("norm", static_cast<number (T::*)(TFct&) > (&T::norm))
     367           36 :                            .add_method("distance", static_cast<number (T::*)(TFct&, TFct&) > (&T::distance))
     368           27 :                            .add_method("set_velocity", &T::set_velocity)
     369            9 :                            .set_construct_as_smart_pointer(true);
     370           27 :                         reg.add_class_to_group(name, "VelEnergyComponentSpace", tag);
     371              :                 }
     372              : 
     373              :         // H1ComponentSpace
     374              :         {
     375              :                 typedef H1ComponentSpace<TFct> T;
     376              :                 typedef IComponentSpace<TFct> TBase;
     377              : 
     378            9 :                 string name = string("H1ComponentSpace").append(suffix);
     379           27 :                 reg.add_class_<T, TBase>(name, grp)
     380           18 :                    .template add_constructor<void (*)(const char *) >("fctNames")
     381           18 :                    .template add_constructor<void (*)(const char *, int) >("fctNames, order")
     382           18 :                    .template add_constructor<void (*)(const char *, const char*, int) >("fctNames, subsetNames, order")
     383              :                    //.template add_constructor<void (*)(const char *, int, number) >("fctNames, order, scale")
     384            9 :                    .set_construct_as_smart_pointer(true);
     385           27 :                 reg.add_class_to_group(name, "H1ComponentSpace", tag);
     386              :         }
     387              : 
     388              :         // TimeDependentSpace
     389              :         /*{
     390              :                 typedef TimeDependentSpace<TFct> T;
     391              :                 typedef IGridFunctionSpace<TFct> TBase;
     392              : 
     393              :                 typedef IComponentSpace<TFct> TCompSpace;
     394              : 
     395              :                 string name = string("TimeDependentSpace").append(suffix);
     396              :                 reg.add_class_<T, TBase>(name, grp)
     397              :                                 .template add_constructor<void (*)(SmartPtr<TCompSpace>, number) >("component space")
     398              :                                 .add_method("update_time_data", &T::update_time_data)
     399              :                                 .set_construct_as_smart_pointer(true);
     400              :                 reg.add_class_to_group(name, "TimeDependentSpace", tag);
     401              :         }
     402              : */
     403              : 
     404              :         // CompositeSpace
     405              :         {
     406              :                         typedef CompositeSpace<TFct> T;
     407              :                         typedef IComponentSpace<TFct> TCompSpace;
     408              :                         typedef IGridFunctionSpace<TFct> TBase;
     409              : 
     410            9 :                         string name = string("CompositeSpace").append(suffix);
     411           27 :                         reg.add_class_<T, TBase>(name, grp)
     412           18 :                            .template add_constructor<void (*)() >("")
     413           18 :                            .add_method("add", static_cast<void (T::*)(SmartPtr<TCompSpace>) > (&T::add))
     414           18 :                            .add_method("add", static_cast<void (T::*)(SmartPtr<TCompSpace>, number) > (&T::add))
     415           27 :                            .add_method("update_time_data", &T::update_time_data)
     416           27 :                            .add_method("is_time_dependent", &T::is_time_dependent)
     417            9 :                            .set_construct_as_smart_pointer(true);
     418           27 :                         reg.add_class_to_group(name, "CompositeSpace", tag);
     419              :         }
     420              : 
     421              : //      AverageFunctionDifference
     422              :         {
     423            9 :                 string name = string("AverageFunctionDifference");
     424              :                 typedef ug::GridFunction<TDomain, TAlgebra> grid_function;
     425              :                 typedef SmartPtr< grid_function > function_pointer;
     426           27 :                 reg.add_function(name, static_cast<number (*)(function_pointer, std::string, std::string, std::string)>(&AverageFunctionDifference<TDomain, TAlgebra>), grp);
     427              :         }
     428              : 
     429              : //      CheckDoFPositions
     430              :         {
     431           27 :                 reg.add_function("CheckDoFPositions", static_cast<bool (*)(const TFct&)>(CheckDoFPositions<TFct>), grp);
     432              :         }
     433              : 
     434              : //      ScaleGF
     435              :         {
     436           27 :                 reg.add_function("ScaleGF", ScaleGF<TFct>, grp, "",
     437              :                         "scaled output vector # input vector # vector of scaling factors for each function",
     438              :                         "Scales the input vector using the given scaling factors for each function and writes "
     439              :                         "the result to the output vector");
     440              :         }
     441              : 
     442              : //      AverageFunctionDifference
     443              :         {
     444              :                 typedef ug::GridFunction<TDomain, TAlgebra> GF;
     445           27 :                 reg.add_function("AdjustMeanValue", static_cast<void (*)(SmartPtr<GF>, const std::vector<std::string>&, number)>(&AdjustMeanValue<GF>), grp);
     446           27 :                 reg.add_function("AdjustMeanValue", static_cast<void (*)(SmartPtr<GF>, const std::vector<std::string>&)>(&AdjustMeanValue<GF>), grp);
     447           27 :                 reg.add_function("AdjustMeanValue", static_cast<void (*)(SmartPtr<GF>, const std::string&, number)>(&AdjustMeanValue<GF>), grp);
     448           27 :                 reg.add_function("AdjustMeanValue", static_cast<void (*)(SmartPtr<GF>, const std::string&)>(&AdjustMeanValue<GF>), grp);
     449              :         }
     450              :         
     451              : //      SumGFValuesAt
     452              :         {
     453              :                 typedef ug::GridFunction<TDomain, TAlgebra> GF;
     454           27 :                 reg.add_function ("SumGFValuesAtVertices", static_cast<number (*) (GF*, const char *)> (&SumGFValuesAt<GF,Vertex>), grp);
     455           27 :                 reg.add_function ("SumGFValuesAtVertices", static_cast<number (*) (GF*, const char *, const char *)> (&SumGFValuesAt<GF,Vertex>), grp);
     456              :         }
     457              :         
     458              : //      CheckGFforNaN
     459              :         {
     460              :                 typedef ug::GridFunction<TDomain, TAlgebra> GF;
     461           27 :                 reg.add_function ("CheckGFValuesAtVertices", static_cast<bool (*) (const GF*, const char *)> (&CheckGFforNaN<GF,Vertex>), grp);
     462           27 :                 reg.add_function ("CheckGFValuesAtEdges", static_cast<bool (*) (const GF*, const char *)> (&CheckGFforNaN<GF,Edge>), grp);
     463           27 :                 reg.add_function ("CheckGFValuesAtFaces", static_cast<bool (*) (const GF*, const char *)> (&CheckGFforNaN<GF,Face>), grp);
     464           27 :                 reg.add_function ("CheckGFValuesAtVolumes", static_cast<bool (*) (const GF*, const char *)> (&CheckGFforNaN<GF,Volume>), grp);
     465              :         }
     466              : 
     467              : //      CheckGFValuesWithinBounds
     468              :         {
     469              :                 typedef ug::GridFunction<TDomain, TAlgebra> GF;
     470           27 :                 reg.add_function("CheckGFValuesWithinBounds", static_cast<bool (*) (ConstSmartPtr<GF>, size_t, number, number)> (&CheckGFValuesWithinBounds<GF>), grp);
     471           27 :                 reg.add_function("CheckGFValuesWithinBounds", static_cast<bool (*) (ConstSmartPtr<GF>, const char*, number, number)> (&CheckGFValuesWithinBounds<GF>), grp);
     472              :         }
     473              : 
     474              : //      Move Domain by GridFunction
     475              :         {
     476              :                 typedef ug::GridFunction<TDomain, TAlgebra> GF;
     477           27 :                 reg.add_function (
     478              :                         "AddFunctionValuesToGridCoordinatesP1", static_cast<void (*) (SmartPtr<GF>, const char*, size_t)>
     479              :                                 (&AddFunctionValuesToGridCoordinatesP1<GF>), grp);
     480           27 :                 reg.add_function (
     481              :                         "AddFunctionValuesToGridCoordinatesP1", static_cast<void (*) (SmartPtr<GF>, const char*, size_t, number)>
     482              :                                 (&AddFunctionValuesToGridCoordinatesP1<GF>), grp);
     483              :         }
     484            9 : }
     485              : 
     486              : /**
     487              :  * Function called for the registration of Domain dependent parts.
     488              :  * All Functions and Classes depending on the Domain
     489              :  * are to be placed here when registering. The method is called for all
     490              :  * available Domain types, based on the current build options.
     491              :  *
     492              :  * @param reg                           registry
     493              :  * @param parentGroup           group for sorting of functionality
     494              :  */
     495              : template <typename TDomain>
     496            3 : static void Domain(Registry& reg, string grp)
     497              : {
     498              :         string suffix = GetDomainSuffix<TDomain>();
     499              :         string tag = GetDomainTag<TDomain>();
     500              : 
     501              : //      group string
     502            3 :         grp.append("/ApproximationSpace");
     503              : 
     504              : //  ApproximationSpace
     505              :         {
     506              :                 typedef ApproximationSpace<TDomain> T;
     507              :                 typedef IApproximationSpace TBase;
     508            3 :                 string name = string("ApproximationSpace").append(suffix);
     509            9 :                 reg.add_class_<T, TBase>(name, grp)
     510            6 :                         .template add_constructor<void (*)(SmartPtr<TDomain>)>("Domain")
     511            6 :                         .template add_constructor<void (*)(SmartPtr<TDomain>, const AlgebraType&)>("Domain#AlgebraType")
     512            6 :                         .add_method("domain", static_cast<SmartPtr<TDomain> (T::*)()>(&T::domain))
     513            9 :                         .add_method("surface_view", static_cast<ConstSmartPtr<SurfaceView> (T::*)() const>(&T::surface_view))
     514            9 :                         .add_method("get_dim", &T::get_dim)
     515            3 :                         .set_construct_as_smart_pointer(true);
     516            9 :                 reg.add_class_to_group(name, "ApproximationSpace", tag);
     517              :         }
     518            3 : }
     519              : 
     520              : /**
     521              :  * Function called for the registration of Dimension dependent parts.
     522              :  * All Functions and Classes depending on the Dimension
     523              :  * are to be placed here when registering. The method is called for all
     524              :  * available Dimension types, based on the current build options.
     525              :  *
     526              :  * @param reg                           registry
     527              :  * @param parentGroup           group for sorting of functionality
     528              :  */
     529              : template <int dim>
     530              : static void Dimension(Registry& reg, string grp)
     531              : {
     532              :         string suffix = GetDimensionSuffix<dim>();
     533              :         string tag = GetDimensionTag<dim>();
     534              : 
     535              : }
     536              : 
     537              : /**
     538              :  * Function called for the registration of Algebra dependent parts.
     539              :  * All Functions and Classes depending on Algebra
     540              :  * are to be placed here when registering. The method is called for all
     541              :  * available Algebra types, based on the current build options.
     542              :  *
     543              :  * @param reg                           registry
     544              :  * @param parentGroup           group for sorting of functionality
     545              :  */
     546              : template <typename TAlgebra>
     547              : static void Algebra(Registry& reg, string grp)
     548              : {
     549              :         string suffix = GetAlgebraSuffix<TAlgebra>();
     550              :         string tag = GetAlgebraTag<TAlgebra>();
     551              : 
     552              : }
     553              : 
     554              : /**
     555              :  * Function called for the registration of Domain and Algebra independent parts.
     556              :  * All Functions and Classes not depending on Domain and Algebra
     557              :  * are to be placed here when registering.
     558              :  *
     559              :  * @param reg                           registry
     560              :  * @param parentGroup           group for sorting of functionality
     561              :  */
     562            1 : static void Common(Registry& reg, string grp)
     563              : {
     564              : //      GridLevel
     565            3 :         reg.add_class_<GridLevel>("GridLevel", grp)
     566            1 :                 .add_constructor()
     567            2 :                 .add_constructor<void (*)(int)>("Level")
     568            2 :                 .add_constructor<void (*)(int, std::string)>("Level#Type")
     569            1 :                 .set_construct_as_smart_pointer(true);
     570              : 
     571              : //      LFEID
     572              :         {
     573              :                 typedef LFEID T;
     574            3 :                 reg.add_class_<T>("LFEID", grp)
     575            2 :                         .add_method("order", &T::order)
     576            2 :                         .add_method("dim", &T::dim);
     577              :         }
     578              : 
     579              : //      DoFDistributionInfoProvider
     580              :         {
     581              :         typedef DoFDistributionInfoProvider T;
     582            3 :         reg.add_class_<T>("DoFDistributionInfoProvider", grp)
     583            2 :                 .add_method("print_local_dof_statistic", static_cast<void (T::*)(int) const>(&T::print_local_dof_statistic))
     584            2 :                 .add_method("print_local_dof_statistic", static_cast<void (T::*)() const>(&T::print_local_dof_statistic))
     585            2 :                 .add_method("num_fct", static_cast<size_t (T::*)() const>(&T::num_fct))
     586            2 :                 .add_method("name", &T::name)
     587            2 :                 .add_method("names", &T::names)
     588            2 :                 .add_method("dim", &T::dim)
     589            2 :                 .add_method("lfeid", &T::lfeid);
     590              :         }
     591              : 
     592              : //      IApproximationSpace
     593              :         {
     594              :         typedef IApproximationSpace T;
     595              :         typedef DoFDistributionInfoProvider TBase;
     596            3 :         reg.add_class_<T, TBase>("IApproximationSpace", grp)
     597            2 :                 .add_method("print_statistic", static_cast<void (T::*)(std::string) const>(&T::print_statistic))
     598            2 :                 .add_method("print_statistic", static_cast<void (T::*)() const>(&T::print_statistic))
     599            2 :                 .add_method("print_layout_statistic", static_cast<void (T::*)() const>(&T::print_layout_statistic))
     600            2 :                 .add_method("might_contain_ghosts", static_cast<bool (T::*)() const>(&T::might_contain_ghosts))
     601            2 :                 .add_method("num_levels", &T::num_levels)
     602            2 :                 .add_method("init_levels", &T::init_levels)
     603            2 :                 .add_method("init_surfaces", &T::init_surfaces)
     604            2 :                 .add_method("init_top_surface", &T::init_top_surface)
     605              : 
     606            2 :                 .add_method("clear", &T::clear)
     607            2 :                 .add_method("add_fct", static_cast<void (T::*)(const char*, const char*, int, const char*)>(&T::add),
     608              :                                         "", "Name#Type|selection|value=[\"Lagrange\",\"DG\"]#Order#Subsets", "Adds a function to the Function Pattern",
     609              :                                         "currently no help available")
     610            2 :                 .add_method("add_fct", static_cast<void (T::*)(const char*, const char*, int)>(&T::add),
     611              :                                         "", "Name#Type|selection|value=[\"Lagrange\",\"DG\"]#Order", "Adds a function to the Function Pattern",
     612              :                                         "currently no help available")
     613            2 :                 .add_method("add_fct", static_cast<void (T::*)(const char*, const char*)>(&T::add),
     614              :                                         "", "Name#Type|selection|value=[\"crouzeix-raviart\",\"piecewise-constant\"] ", "Adds a function to the Function Pattern",
     615              :                                         "currently no help available")
     616            2 :                 .add_method("add_fct", static_cast<void (T::*)(const std::vector<std::string>&, const char*, int, const std::vector<std::string>&)>(&T::add),
     617              :                                         "", "Name#Type|selection|value=[\"Lagrange\",\"DG\"]#Order#Subsets", "Adds a function to the Function Pattern",
     618              :                                         "currently no help available")
     619            2 :                 .add_method("add_fct", static_cast<void (T::*)(const std::vector<std::string>&, const char*, int)>(&T::add),
     620              :                                         "", "Name#Type|selection|value=[\"Lagrange\",\"DG\"]#Order", "Adds a function to the Function Pattern",
     621              :                                         "currently no help available")
     622            2 :                 .add_method("add_fct", static_cast<void (T::*)(const std::vector<std::string>&, const char*)>(&T::add),
     623              :                                         "", "Name#Type|selection|value=[\"crouzeix-raviart\",\"piecewise-constant\"]", "Adds a function to the Function Pattern",
     624              :                                         "currently no help available");
     625              : 
     626              :         }
     627            1 : }
     628              : 
     629              : }; // end Functionality
     630              : 
     631              : // end group gridfnct_bridge
     632              : /// \}
     633              : 
     634              : }// namespace GridFunction
     635              : 
     636              : /// \addtogroup gridfnct_bridge
     637            1 : void RegisterBridge_GridFunction(Registry& reg, string grp)
     638              : {
     639            1 :         grp.append("/Discretization");
     640              :         typedef GridFunction::Functionality Functionality;
     641              : 
     642              :         try{
     643            2 :                 RegisterCommon<Functionality>(reg,grp);
     644              :                 //RegisterDimensionDependent<Functionality>(reg,grp);
     645            2 :                 RegisterDomainDependent<Functionality>(reg,grp);
     646              :                 //RegisterAlgebraDependent<Functionality>(reg,grp);
     647            1 :                 RegisterDomainAlgebraDependent<Functionality>(reg,grp);
     648              :         }
     649            0 :         UG_REGISTRY_CATCH_THROW(grp);
     650            1 : }
     651              : 
     652              : }//     end of namespace bridge
     653              : }//     end of namespace ug
        

Generated by: LCOV version 2.0-1