LCOV - code coverage report
Current view: top level - ugbase/bridge/disc_bridges - domain_dependent_preconditioner_bridge.cpp (source / functions) Coverage Total Hit
Test: coverage.info Lines: 96.9 % 32 31
Test Date: 2025-09-21 23:31:46 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              : 
      34              : // extern headers
      35              : #include <iostream>
      36              : #include <sstream>
      37              : #include <string>
      38              : 
      39              : // include bridge
      40              : #include "bridge/bridge.h"
      41              : #include "bridge/util.h"
      42              : #include "bridge/util_domain_algebra_dependent.h"
      43              : 
      44              : // preconditioner
      45              : #include "lib_algebra/lib_algebra.h"
      46              : #include "lib_algebra/operator/preconditioner/preconditioners.h"
      47              : #include "lib_disc/operator/preconditioner/line_smoothers.h"
      48              : 
      49              : #include "../util_overloaded.h" // ADD_CONSTRUCTOR
      50              : 
      51              : using namespace std;
      52              : 
      53              : namespace ug{
      54              : namespace bridge{
      55              : namespace Preconditioner{
      56              : 
      57              : /**
      58              :  * \defgroup domdepprecond_bridge Domain Dependend Preconditioner Bridge
      59              :  * \ingroup precond_bridge
      60              :  * \{
      61              :  */
      62              : 
      63              : /**
      64              :  * Class exporting the functionality. All functionality that is to
      65              :  * be used in scripts or visualization must be registered here.
      66              :  */
      67              : struct Functionality
      68              : {
      69              : 
      70              :         
      71              : template <typename TDomain, typename TAlgebra>
      72            9 : static void DomainAlgebra(Registry& reg, string grp)
      73              : {
      74              :         string suffix = GetDomainAlgebraSuffix<TDomain,TAlgebra>();
      75              :         string tag = GetDomainAlgebraTag<TDomain,TAlgebra>();
      76              :                 
      77              : //      Line Gauss-Seidel
      78              :         {
      79              :                 typedef LineGaussSeidel<TDomain,TAlgebra> T;
      80              :                 typedef IPreconditioner<TAlgebra> TBase;
      81            9 :                 string name = string("LineGaussSeidel").append(suffix);
      82           27 :                 reg.add_class_<T,TBase>(name, grp, "Line Gauss-Seidel Preconditioner")
      83           18 :                 .template add_constructor<void (*)(SmartPtr<ApproximationSpace<TDomain> >)>("Approximation Space")
      84           27 :                 .add_method("update", &T::update, "", "update")
      85           27 :                 .add_method("set_num_steps", static_cast<void (T::*)(size_t,size_t,size_t,size_t,size_t,size_t)>(&T::set_num_steps), "", "set_num_steps")
      86           18 :                 .add_method("set_num_steps", static_cast<void (T::*)(size_t,size_t,size_t,size_t)>(&T::set_num_steps), "", "set_num_steps")
      87           18 :                 .add_method("set_num_steps", static_cast<void (T::*)(size_t,size_t)>(&T::set_num_steps), "", "set_num_steps")
      88            9 :                 .set_construct_as_smart_pointer(true);
      89           27 :                 reg.add_class_to_group(name, "LineGaussSeidel", tag);
      90              :         }
      91              :         
      92              : //      Line Vanka
      93              :         {
      94              :                 typedef LineVanka<TDomain,TAlgebra> T;
      95              :                 typedef IPreconditioner<TAlgebra> TBase;
      96            9 :                 string name = string("LineVanka").append(suffix);
      97           27 :                 reg.add_class_<T,TBase>(name, grp, "LineVanka Preconditioner")
      98           18 :                 .template add_constructor<void (*)(SmartPtr<ApproximationSpace<TDomain> >)>("Approximation Space")
      99           27 :                 .add_method("update", &T::update, "", "update")
     100           27 :                 .add_method("set_num_steps", static_cast<void (T::*)(size_t,size_t,size_t,size_t,size_t,size_t)>(&T::set_num_steps), "", "set_num_steps")
     101           18 :                 .add_method("set_num_steps", static_cast<void (T::*)(size_t,size_t,size_t,size_t)>(&T::set_num_steps), "", "set_num_steps")
     102           18 :                 .add_method("set_num_steps", static_cast<void (T::*)(size_t,size_t)>(&T::set_num_steps), "", "set_num_steps")
     103           18 :                 .add_method("set_relax", &T::set_relax, "", "relax")
     104            9 :                 .set_construct_as_smart_pointer(true);
     105           27 :                 reg.add_class_to_group(name, "LineVanka",  tag);
     106              :         }
     107              :         
     108              : 
     109              :         //      AssembledTransformingSmoother
     110              :                 {
     111              :                         typedef AssembledTransformingSmoother<TDomain, TAlgebra> T;
     112              :                         typedef ILinearIterator<typename TAlgebra::vector_type> TBase;
     113              :                         typedef DebugWritingObject<TAlgebra> TBase2;
     114            9 :                         string name = string("AssembledTransformingSmoother").append(suffix);
     115           27 :                         reg.add_class_<T, TBase, TBase2>(name, grp)
     116              :                     .ADD_CONSTRUCTOR((SmartPtr<IAssemble<TAlgebra> >,
     117              :                                   SmartPtr<ILinearIterator<typename TAlgebra::vector_type> >,
     118              :                                   SmartPtr<IAssemble<TAlgebra> >))
     119           18 :                                   ("TrafoSystemAss, TrafoSystemSmoother, RightTrafoAss")
     120              :                     .ADD_CONSTRUCTOR((SmartPtr<IAssemble<TAlgebra> >,
     121              :                                       SmartPtr<ILinearIterator<typename TAlgebra::vector_type> >,
     122              :                                       SmartPtr<IAssemble<TAlgebra> >,
     123              :                                       SmartPtr<ILinearIterator<typename TAlgebra::vector_type> >))
     124           18 :                                     ("TrafoSystemAss, TrafoSystemSmoother, RightTrafoAss, RightTrafoSmoother")
     125            9 :                     .set_construct_as_smart_pointer(true);
     126           27 :                 reg.add_class_to_group(name, "AssembledTransformingSmoother", tag);
     127              :                 }
     128            9 : };
     129              : 
     130              : }; // end Functionality
     131              : 
     132              : // end group domdepprecond_bridge
     133              : /// \}
     134              : 
     135              : }// end Preconditioner
     136              : 
     137              : /// \addtogroup domdepprecond_bridge
     138            1 : void RegisterBridge_DomainDependentPreconditioner(Registry& reg, string grp)
     139              : {
     140            1 :         grp.append("/Disc/Preconditioner");
     141              :         typedef Preconditioner::Functionality Functionality;
     142              : 
     143              :         try{            
     144            1 :                 RegisterDomainAlgebraDependent<Functionality>(reg,grp);
     145              :         }
     146            0 :         UG_REGISTRY_CATCH_THROW(grp);
     147            1 : }
     148              : 
     149              : } // namespace bridge
     150              : } // namespace ug
        

Generated by: LCOV version 2.0-1