LCOV - code coverage report
Current view: top level - ugbase/bridge/algebra_bridges - obstacle_bridge.cpp (source / functions) Coverage Total Hit
Test: coverage.info Lines: 98.4 % 64 63
Test Date: 2025-09-21 23:31:46 Functions: 100.0 % 10 10

            Line data    Source code
       1              : /*
       2              :  * Copyright (c) 2013-2015:  G-CSC, Goethe University Frankfurt
       3              :  * Author: Raphael Prohl
       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              : // preconditioner
      44              : #include "lib_algebra/lib_algebra.h"
      45              : #include "lib_algebra/operator/preconditioner/projected_gauss_seidel/obstacles/obstacles.h"
      46              : #include "lib_disc/operator/non_linear_operator/truncated_monotone_mg/truncated_monotone_transfer.h"
      47              : 
      48              : using namespace std;
      49              : 
      50              : namespace ug{
      51              : namespace bridge{
      52              : namespace Obstacle{
      53              : 
      54              : /**
      55              :  * \defgroup obstacle_bridge Obstacle Bridge
      56              :  * \ingroup algebra_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              : 
      65              : 
      66              : struct Functionality
      67              : {
      68              : 
      69              : template <typename TDomain, typename TAlgebra>
      70            9 : static void DomainAlgebra(Registry& reg, string grp)
      71              : {
      72              :         string suffix = GetDomainAlgebraSuffix<TDomain,TAlgebra>();
      73              :         string tag = GetDomainAlgebraTag<TDomain,TAlgebra>();
      74              : 
      75              :         typedef GridFunction<TDomain, TAlgebra> function_type;
      76              :         static const int dim = TDomain::dim;
      77              : 
      78              : //      Obstacle Classes
      79              : 
      80              :         //      IObstacleConstraint
      81              :         {
      82              :                 typedef IObstacleConstraint<TDomain,TAlgebra> T;
      83              :                 typedef IDomainConstraint<TDomain, TAlgebra> TBase;
      84            9 :                 string name = string("IObstacleConstraint").append(suffix);
      85           27 :                 reg.add_class_<T,TBase>(name, grp)
      86           18 :                         .add_method("add", static_cast<void (T::*)(SmartPtr<UserData<number, dim, bool> >, const char*)>(&T::add),
      87              :                                                 "", "Value#Function")
      88           18 :                         .add_method("add", static_cast<void (T::*)(SmartPtr<UserData<number, dim, bool> >, const char*, const char*)>(&T::add),
      89              :                                                 "", "Value#Function#Subsets")
      90           18 :                         .add_method("add", static_cast<void (T::*)(SmartPtr<UserData<number, dim> >, const char*)>(&T::add),
      91              :                                                         "", "Value#Function")
      92           18 :                         .add_method("add", static_cast<void (T::*)(SmartPtr<UserData<number, dim> >, const char*, const char*)>(&T::add),
      93              :                                                 "", "Value#Function#Subsets")
      94           18 :                         .add_method("add", static_cast<void (T::*)(SmartPtr<UserData<MathVector<dim>, dim> >, const char*)>(&T::add),
      95              :                                                 "", "Vector#Functions")
      96           18 :                         .add_method("add", static_cast<void (T::*)(SmartPtr<UserData<MathVector<dim>, dim> >, const char*, const char*)>(&T::add),
      97              :                                                 "", "Vector#Functions#Subsets")
      98           18 :                         .add_method("add",static_cast<void (T::*)(number, const char*)>(&T::add),
      99              :                                                 "", "ConstantValue#Function")
     100           18 :                         .add_method("add",static_cast<void (T::*)(number, const char*, const char*)>(&T::add),
     101              :                                                 "", "ConstantValue#Function#Subsets")
     102              : #ifdef UG_FOR_LUA
     103           18 :                         .add_method("add",static_cast<void (T::*)(const char*, const char*)>(&T::add),
     104              :                                                 "", "LuaCallback#Function")
     105           18 :                         .add_method("add",static_cast<void (T::*)(const char*, const char*, const char*)>(&T::add),
     106              :                                                 "", "LuaCallback#Function#Subsets")
     107              : #endif
     108            9 :                         .set_construct_as_smart_pointer(true);
     109           27 :                 reg.add_class_to_group(name, "IObstacleConstraint", tag);
     110              :         }
     111              : 
     112              :         //      ScalarLowerObstacle
     113              :         {
     114              :                 typedef ScalarLowerObstacle<TDomain,TAlgebra> T;
     115              :                 typedef IObstacleConstraint<TDomain,TAlgebra> TBase;
     116            9 :                 string name = string("ScalarLowerObstacle").append(suffix);
     117           27 :                 reg.add_class_<T,TBase>(name, grp)
     118           18 :                         .template add_constructor<void (*)(const function_type&)>()
     119            9 :                         .add_constructor()
     120            9 :                         .set_construct_as_smart_pointer(true);
     121           27 :                 reg.add_class_to_group(name, "ScalarLowerObstacle", tag);
     122              :         }
     123              : 
     124              :         //      ScalarUpperObstacle
     125              :         {
     126              :                 typedef ScalarUpperObstacle<TDomain,TAlgebra> T;
     127              :                 typedef IObstacleConstraint<TDomain,TAlgebra> TBase;
     128            9 :                 string name = string("ScalarUpperObstacle").append(suffix);
     129           27 :                 reg.add_class_<T,TBase>(name, grp)
     130           18 :                         .template add_constructor<void (*)(const function_type&)>()
     131            9 :                         .add_constructor()
     132            9 :                         .set_construct_as_smart_pointer(true);
     133           27 :                 reg.add_class_to_group(name, "ScalarUpperObstacle", tag);
     134              :         }
     135              : 
     136              :         //      ObstacleInNormalDir
     137              :         {
     138              :                 typedef ObstacleInNormalDir<TDomain,TAlgebra> T;
     139              :                 typedef IObstacleConstraint<TDomain,TAlgebra> TBase;
     140            9 :                 string name = string("ObstacleInNormalDir").append(suffix);
     141           27 :                 reg.add_class_<T,TBase>(name, grp)
     142           18 :                         .template add_constructor<void (*)(const function_type&)>()
     143            9 :                         .add_constructor()
     144            9 :                         .set_construct_as_smart_pointer(true);
     145           27 :                 reg.add_class_to_group(name, "ObstacleInNormalDir", tag);
     146              :         }
     147              : 
     148              : 
     149              : //      Projected Preconditioners
     150              : 
     151              :         //      IProjGaussSeidel
     152              :         {
     153              :                 typedef IProjGaussSeidel<TDomain, TAlgebra> T;
     154              :                 typedef GaussSeidelBase<TAlgebra> TBase;
     155            9 :                 string name = string("IProjGaussSeidel").append(suffix);
     156           27 :                 reg.add_class_<T,TBase>(name, grp)
     157           18 :                         .add_method("add_obstacle_constraint", &T::add_obstacle_constraint,
     158              :                                 "", "obstacle constraint", "adds an obstacle constraint")
     159            9 :                         .set_construct_as_smart_pointer(true);
     160           27 :                 reg.add_class_to_group(name, "IProjGaussSeidel", tag);
     161              :         }
     162              : 
     163              :         //      ProjGaussSeidel
     164              :         {
     165              :                 typedef ProjGaussSeidel<TDomain,TAlgebra> T;
     166              :                 typedef IProjGaussSeidel<TDomain,TAlgebra> TBase;
     167            9 :                 string name = string("ProjGaussSeidel").append(suffix);
     168           27 :                 reg.add_class_<T,TBase>(name, grp)
     169            9 :                         .add_constructor()
     170            9 :                         .set_construct_as_smart_pointer(true);
     171           27 :                 reg.add_class_to_group(name, "ProjGaussSeidel", tag);
     172              :         }
     173              : 
     174              :         //      ProjBackwardGaussSeidel
     175              :         {
     176              :                 typedef ProjBackwardGaussSeidel<TDomain,TAlgebra> T;
     177              :                 typedef IProjGaussSeidel<TDomain,TAlgebra> TBase;
     178            9 :                 string name = string("ProjBackwardGaussSeidel").append(suffix);
     179           27 :                 reg.add_class_<T,TBase>(name, grp)
     180            9 :                         .add_constructor()
     181            9 :                         .set_construct_as_smart_pointer(true);
     182           27 :                 reg.add_class_to_group(name, "ProjBackwardGaussSeidel", tag);
     183              :         }
     184              : 
     185              :         //      ProjSymmetricGaussSeidel
     186              :         {
     187              :                 typedef ProjSymmetricGaussSeidel<TDomain,TAlgebra> T;
     188              :                 typedef IProjGaussSeidel<TDomain,TAlgebra> TBase;
     189            9 :                 string name = string("ProjSymmetricGaussSeidel").append(suffix);
     190           27 :                 reg.add_class_<T,TBase>(name, grp)
     191            9 :                         .add_constructor()
     192            9 :                         .set_construct_as_smart_pointer(true);
     193           27 :                 reg.add_class_to_group(name, "ProjSymmetricGaussSeidel", tag);
     194              :         }
     195              : 
     196              : 
     197              : //      transfer operators for truncated monotone multigrid
     198              :         {
     199              :                 typedef TruncatedMonotoneTransfer<TDomain,TAlgebra> T;
     200              :                 typedef StdTransfer<TDomain,TAlgebra> TBase;
     201            9 :                 string name = string("TruncatedMonotoneTransfer").append(suffix);
     202           27 :                 reg.add_class_<T,TBase>(name, grp)
     203            9 :                         .add_constructor()
     204            9 :                         .set_construct_as_smart_pointer(true);
     205           27 :                 reg.add_class_to_group(name, "TruncatedMonotoneTransfer", tag);
     206              :         }
     207            9 : };
     208              : 
     209              : }; // end Functionality
     210              : 
     211              : // end group obstacle_bridge
     212              : /// \}
     213              : 
     214              : }// end Obstacle
     215              : 
     216              : /// \addtogroup obstacle_bridge
     217            1 : void RegisterBridge_Obstacle(Registry& reg, string grp)
     218              : {
     219            1 :         grp.append("/Algebra/Obstacle");
     220              :         typedef Obstacle::Functionality Functionality;
     221              : 
     222              :         try{
     223            1 :                 RegisterDomainAlgebraDependent<Functionality>(reg,grp);
     224              :         }
     225            0 :         UG_REGISTRY_CATCH_THROW(grp);
     226            1 : }
     227              : 
     228              : } // namespace bridge
     229              : } // namespace ug
        

Generated by: LCOV version 2.0-1