LCOV - code coverage report
Current view: top level - ugbase/bridge/disc_bridges - interpolate_bridge.cpp (source / functions) Coverage Total Hit
Test: coverage.info Lines: 97.2 % 36 35
Test Date: 2026-02-07 08:49:52 Functions: 100.0 % 10 10

            Line data    Source code
       1              : /*
       2              :  * Copyright (c) 2012-2015:  G-CSC, Goethe University Frankfurt
       3              :  * Author: Andreas Vogel
       4              :  * 
       5              :  * This file is part of UG4.
       6              :  * 
       7              :  * UG4 is free software: you can redistribute it and/or modify it under the
       8              :  * terms of the GNU Lesser General Public License version 3 (as published by the
       9              :  * Free Software Foundation) with the following additional attribution
      10              :  * requirements (according to LGPL/GPL v3 §7):
      11              :  * 
      12              :  * (1) The following notice must be displayed in the Appropriate Legal Notices
      13              :  * of covered and combined works: "Based on UG4 (www.ug4.org/license)".
      14              :  * 
      15              :  * (2) The following notice must be displayed at a prominent place in the
      16              :  * terminal output of covered works: "Based on UG4 (www.ug4.org/license)".
      17              :  * 
      18              :  * (3) The following bibliography is recommended for citation and must be
      19              :  * preserved in all covered files:
      20              :  * "Reiter, S., Vogel, A., Heppner, I., Rupp, M., and Wittum, G. A massively
      21              :  *   parallel geometric multigrid solver on hierarchically distributed grids.
      22              :  *   Computing and visualization in science 16, 4 (2013), 151-164"
      23              :  * "Vogel, A., Reiter, S., Rupp, M., Nägel, A., and Wittum, G. UG4 -- a novel
      24              :  *   flexible software system for simulating pde based models on high performance
      25              :  *   computers. Computing and visualization in science 16, 4 (2013), 165-179"
      26              :  * 
      27              :  * This program is distributed in the hope that it will be useful,
      28              :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      29              :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
      30              :  * GNU Lesser General Public License for more details.
      31              :  */
      32              : 
      33              : // extern headers
      34              : #include <iostream>
      35              : #include <sstream>
      36              : #include <string>
      37              : 
      38              : // include bridge
      39              : #include "bridge/bridge.h"
      40              : #include "bridge/util.h"
      41              : #include "bridge/util_domain_algebra_dependent.h"
      42              : 
      43              : // lib_disc includes
      44              : #include "lib_disc/function_spaces/grid_function.h"
      45              : #include "lib_disc/function_spaces/interpolate.h"
      46              : #include "lib_disc/function_spaces/interpolate_inner.h"
      47              : 
      48              : using namespace std;
      49              : 
      50              : namespace ug{
      51              : namespace bridge{
      52              : namespace Interpolate{
      53              : 
      54              : /**
      55              :  * \defgroup interpolate_bridge Interpolation Bridge
      56              :  * \ingroup disc_bridge
      57              :  * \{
      58              :  */
      59              : 
      60              : /**
      61              :  * Class exporting the functionality. All functionality that is to
      62              :  * be used in scripts or visualization must be registered here.
      63              :  */
      64              : struct Functionality
      65              : {
      66              : 
      67              : /**
      68              :  * Function called for the registration of Domain and Algebra dependent parts.
      69              :  * All Functions and Classes depending on both Domain and Algebra
      70              :  * are to be placed here when registering. The method is called for all
      71              :  * available Domain and Algebra types, based on the current build options.
      72              :  *
      73              :  * @param reg                           registry
      74              :  * @param parentGroup           group for sorting of functionality
      75              :  */
      76              : template <typename TDomain, typename TAlgebra>
      77            9 : static void DomainAlgebra(Registry& reg, string grp)
      78              : {
      79              :         string suffix = GetDomainAlgebraSuffix<TDomain,TAlgebra>();
      80              :         string tag = GetDomainAlgebraTag<TDomain,TAlgebra>();
      81              : 
      82              : //      typedef
      83              :         static const int dim = TDomain::dim;
      84              :         typedef ug::GridFunction<TDomain, TAlgebra> TFct;
      85              : 
      86              : //      Interpolate
      87              :         {
      88           27 :                 reg.add_function("Interpolate", static_cast<void (*)(SmartPtr<UserData<number, dim> >, SmartPtr<TFct>, const char*, const char*, number)>(&ug::Interpolate<TFct>),grp, "Integral", "Data#GridFunction#Component#Subsets#Time");
      89           27 :                 reg.add_function("Interpolate", static_cast<void (*)(SmartPtr<UserData<number, dim> >, SmartPtr<TFct>, const char*, number)>(&ug::Interpolate<TFct>),grp, "Integral", "Data#GridFunction#Component#Time");
      90           27 :                 reg.add_function("Interpolate", static_cast<void (*)(SmartPtr<UserData<number, dim> >, SmartPtr<TFct>, const char*, const char*)>(&ug::Interpolate<TFct>), grp, "Integral", "Data#GridFunction#Component#Subsets");
      91           27 :                 reg.add_function("Interpolate", static_cast<void (*)(SmartPtr<UserData<number, dim> >, SmartPtr<TFct>, const char*)>(&ug::Interpolate<TFct>),grp, "Integral", "Data#GridFunction#Component");
      92              : 
      93           27 :                 reg.add_function("Interpolate", static_cast<void (*)(number, SmartPtr<TFct>, const char*, const char*, number)>(&ug::Interpolate<TFct>),grp, "Integral", "ConstantValue#GridFunction#Component#Subsets#Time");
      94           27 :                 reg.add_function("Interpolate", static_cast<void (*)(number, SmartPtr<TFct>, const char*, number)>(&ug::Interpolate<TFct>),grp, "Integral", "ConstantValue#GridFunction#Component#Time");
      95           27 :                 reg.add_function("Interpolate", static_cast<void (*)(number, SmartPtr<TFct>, const char*, const char*)>(&ug::Interpolate<TFct>), grp, "Integral", "ConstantValue#GridFunction#Component#Subsets");
      96           27 :                 reg.add_function("Interpolate", static_cast<void (*)(number, SmartPtr<TFct>, const char*)>(&ug::Interpolate<TFct>),grp, "Integral", "ConstantValue#GridFunction#Component");
      97              : 
      98              :                 #ifdef UG_FOR_LUA
      99              :                 // function-string
     100           27 :                 reg.add_function("Interpolate", static_cast<void (*)(const char*, SmartPtr<TFct>, const char*, const char*, number)>(&ug::Interpolate<TFct>),grp, "Integral", "LuaFunction#GridFunction#Component#Subsets#Time");
     101           27 :                 reg.add_function("Interpolate", static_cast<void (*)(const char*, SmartPtr<TFct>, const char*, number)>(&ug::Interpolate<TFct>),grp, "Integral", "LuaFunction#GridFunction#Component#Time");
     102           27 :                 reg.add_function("Interpolate", static_cast<void (*)(const char*, SmartPtr<TFct>, const char*, const char*)>(&ug::Interpolate<TFct>), grp, "Integral", "LuaFunction#GridFunction#Component#Subsets");
     103           27 :                 reg.add_function("Interpolate", static_cast<void (*)(const char*, SmartPtr<TFct>, const char*)>(&ug::Interpolate<TFct>),grp, "Integral", "LuaFunction#GridFunction#Component");
     104              : 
     105              :                 // function-handle
     106           27 :                 reg.add_function("Interpolate", static_cast<void (*)(LuaFunctionHandle, SmartPtr<TFct>, const char*, const char*, number)>(&ug::Interpolate<TFct>),grp, "Integral", "LuaFunction#GridFunction#Component#Subsets#Time");
     107           27 :                 reg.add_function("Interpolate", static_cast<void (*)(LuaFunctionHandle, SmartPtr<TFct>, const char*, number)>(&ug::Interpolate<TFct>),grp, "Integral", "LuaFunction#GridFunction#Component#Time");
     108           27 :                 reg.add_function("Interpolate", static_cast<void (*)(LuaFunctionHandle, SmartPtr<TFct>, const char*, const char*)>(&ug::Interpolate<TFct>), grp, "Integral", "LuaFunction#GridFunction#Component#Subsets");
     109           27 :                 reg.add_function("Interpolate", static_cast<void (*)(LuaFunctionHandle, SmartPtr<TFct>, const char*)>(&ug::Interpolate<TFct>),grp, "Integral", "LuaFunction#GridFunction#Component");
     110              :                 #endif
     111              :         }
     112              : 
     113              :         //IterpolateDiff
     114              :         {
     115              : 
     116           27 :                 reg.add_function("Interpolate", static_cast<void (*)(SmartPtr<UserData<number, dim> >, SmartPtr<TFct>, const char*, const MathVector<dim>&)>(&ug::Interpolate<TFct>),grp, "Integral", "Data#GridFunction#Component#MoveVector");
     117              :         #ifdef UG_FOR_LUA
     118              :                 //reg.add_function("Interpolate", static_cast<void (*)(LuaFunctionHandle, SmartPtr<TFct>, const char*,const SmartPtr<CplUserData<MathVector<dim>, dim> >)>(&ug::Interpolate<TFct>),grp, "Integral", "LuaFunction#GridFunction#Component#DiffVector");
     119              :         #endif
     120              :         }
     121              : #ifdef UG_PARALLEL
     122              :         {
     123              : 
     124              :                 reg.add_function("Interpolate", static_cast<void (*)(SmartPtr<TFct>, SmartPtr<TFct>, const char*, number)>(&ug::Interpolate<TFct>),grp, "Integral", "Data#GridFunction#Component#MoveVector");
     125              : 
     126              :         }
     127              : #endif
     128              :         // InterpolateInner
     129              :         {
     130           27 :                 reg.add_function("InterpolateInner", static_cast<void (*)(SmartPtr<UserData<number, dim> >, SmartPtr<TFct>, const char*, const char*, number)>(&ug::InterpolateInner<TFct>),grp, "Integral", "Data#GridFunction#Component#Subsets#Time");
     131           27 :                 reg.add_function("InterpolateInner", static_cast<void (*)(SmartPtr<UserData<number, dim> >, SmartPtr<TFct>, const char*, number)>(&ug::InterpolateInner<TFct>),grp, "Integral", "Data#GridFunction#Component#Time");
     132           27 :                 reg.add_function("InterpolateInner", static_cast<void (*)(SmartPtr<UserData<number, dim> >, SmartPtr<TFct>, const char*, const char*)>(&ug::InterpolateInner<TFct>), grp, "Integral", "Data#GridFunction#Component#Subsets");
     133           27 :                 reg.add_function("InterpolateInner", static_cast<void (*)(SmartPtr<UserData<number, dim> >, SmartPtr<TFct>, const char*)>(&ug::InterpolateInner<TFct>),grp, "Integral", "Data#GridFunction#Component");
     134              : 
     135           27 :                 reg.add_function("InterpolateInner", static_cast<void (*)(number, SmartPtr<TFct>, const char*, const char*, number)>(&ug::InterpolateInner<TFct>),grp, "Integral", "ConstantValue#GridFunction#Component#Subsets#Time");
     136           27 :                 reg.add_function("InterpolateInner", static_cast<void (*)(number, SmartPtr<TFct>, const char*, number)>(&ug::InterpolateInner<TFct>),grp, "Integral", "ConstantValue#GridFunction#Component#Time");
     137           27 :                 reg.add_function("InterpolateInner", static_cast<void (*)(number, SmartPtr<TFct>, const char*, const char*)>(&ug::InterpolateInner<TFct>), grp, "Integral", "ConstantValue#GridFunction#Component#Subsets");
     138           27 :                 reg.add_function("InterpolateInner", static_cast<void (*)(number, SmartPtr<TFct>, const char*)>(&ug::InterpolateInner<TFct>),grp, "Integral", "ConstantValue#GridFunction#Component");
     139              : 
     140              :                 #ifdef UG_FOR_LUA
     141           27 :                 reg.add_function("InterpolateInner", static_cast<void (*)(const char*, SmartPtr<TFct>, const char*, const char*, number)>(&ug::InterpolateInner<TFct>),grp, "Integral", "LuaFunction#GridFunction#Component#Subsets#Time");
     142           27 :                 reg.add_function("InterpolateInner", static_cast<void (*)(const char*, SmartPtr<TFct>, const char*, number)>(&ug::InterpolateInner<TFct>),grp, "Integral", "LuaFunction#GridFunction#Component#Time");
     143           27 :                 reg.add_function("InterpolateInner", static_cast<void (*)(const char*, SmartPtr<TFct>, const char*, const char*)>(&ug::InterpolateInner<TFct>), grp, "Integral", "LuaFunction#GridFunction#Component#Subsets");
     144           27 :                 reg.add_function("InterpolateInner", static_cast<void (*)(const char*, SmartPtr<TFct>, const char*)>(&ug::InterpolateInner<TFct>),grp, "Integral", "LuaFunction#GridFunction#Component");
     145              :                 #endif
     146              :         }
     147            9 : }
     148              : 
     149              : /**
     150              :  * Function called for the registration of Domain dependent parts.
     151              :  * All Functions and Classes depending on the Domain
     152              :  * are to be placed here when registering. The method is called for all
     153              :  * available Domain types, based on the current build options.
     154              :  *
     155              :  * @param reg                           registry
     156              :  * @param parentGroup           group for sorting of functionality
     157              :  */
     158              : template <typename TDomain>
     159              : static void Domain(Registry& reg, string grp)
     160              : {
     161              :         string suffix = GetDomainSuffix<TDomain>();
     162              :         string tag = GetDomainTag<TDomain>();
     163              : }
     164              : 
     165              : /**
     166              :  * Function called for the registration of Dimension dependent parts.
     167              :  * All Functions and Classes depending on the Dimension
     168              :  * are to be placed here when registering. The method is called for all
     169              :  * available Dimension types, based on the current build options.
     170              :  *
     171              :  * @param reg                           registry
     172              :  * @param parentGroup           group for sorting of functionality
     173              :  */
     174              : template <int dim>
     175              : static void Dimension(Registry& reg, string grp)
     176              : {
     177              :         string suffix = GetDimensionSuffix<dim>();
     178              :         string tag = GetDimensionTag<dim>();
     179              : 
     180              : }
     181              : 
     182              : /**
     183              :  * Function called for the registration of Algebra dependent parts.
     184              :  * All Functions and Classes depending on Algebra
     185              :  * are to be placed here when registering. The method is called for all
     186              :  * available Algebra types, based on the current build options.
     187              :  *
     188              :  * @param reg                           registry
     189              :  * @param parentGroup           group for sorting of functionality
     190              :  */
     191              : template <typename TAlgebra>
     192              : static void Algebra(Registry& reg, string grp)
     193              : {
     194              :         string suffix = GetAlgebraSuffix<TAlgebra>();
     195              :         string tag = GetAlgebraTag<TAlgebra>();
     196              : 
     197              : }
     198              : 
     199              : /**
     200              :  * Function called for the registration of Domain and Algebra independent parts.
     201              :  * All Functions and Classes not depending on Domain and Algebra
     202              :  * are to be placed here when registering.
     203              :  *
     204              :  * @param reg                           registry
     205              :  * @param parentGroup           group for sorting of functionality
     206              :  */
     207              : static void Common(Registry& reg, string grp)
     208              : {
     209              : }
     210              : 
     211              : }; // end Functionality
     212              : 
     213              : // end group interpolate_bridge
     214              : /// \}
     215              : 
     216              : }// namespace Interpolate
     217              : 
     218              : /// \addtogroup interpolate_bridge
     219            1 : void RegisterBridge_Interpolate(Registry& reg, string grp)
     220              : {
     221            1 :         grp.append("/Discretization");
     222              :         typedef Interpolate::Functionality Functionality;
     223              : 
     224              :         try{
     225              : //              RegisterCommon<Functionality>(reg,grp);
     226              : //              RegisterDimensionDependent<Functionality>(reg,grp);
     227              : //              RegisterDomainDependent<Functionality>(reg,grp);
     228              : //              RegisterAlgebraDependent<Functionality>(reg,grp);
     229            1 :                 RegisterDomainAlgebraDependent<Functionality>(reg,grp);
     230              :         }
     231            0 :         UG_REGISTRY_CATCH_THROW(grp);
     232            1 : }
     233              : 
     234              : }//     end of namespace bridge
     235              : }//     end of namespace ug
        

Generated by: LCOV version 2.0-1