LCOV - code coverage report
Current view: top level - ugbase/bridge/algebra_bridges - schur_bridge.cpp (source / functions) Coverage Total Hit
Test: coverage.info Lines: 88.9 % 9 8
Test Date: 2025-09-21 23:31:46 Functions: 100.0 % 4 4

            Line data    Source code
       1              : /*
       2              :  * Copyright (c) 2014-2015:  G-CSC, Goethe University Frankfurt
       3              :  * Author: Martin Rupp
       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_algebra_dependent.h"
      42              : 
      43              : // preconditioner
      44              : #include "lib_algebra/lib_algebra.h"
      45              : #ifdef UG_PARALLEL
      46              : #include "lib_algebra/operator/preconditioner/schur/schur.h"
      47              : #include "lib_algebra/operator/preconditioner/schur/schur_precond.h"
      48              : #include "lib_algebra/operator/preconditioner/schur/schur_complement_inverse.h"
      49              : #endif
      50              : 
      51              : #include "../util_overloaded.h"
      52              : using namespace std;
      53              : 
      54              : namespace ug{
      55              : 
      56              : namespace bridge{
      57              : namespace Schur{
      58              : 
      59              : /**
      60              :  * \defgroup precond_bridge Preconditioner Bridge
      61              :  * \ingroup algebra_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              : 
      70              : 
      71              : 
      72              : struct Functionality
      73              : {
      74              : 
      75              : 
      76              : /**
      77              :  * Function called for the registration of Algebra dependent parts.
      78              :  * All Functions and Classes depending on Algebra
      79              :  * are to be placed here when registering. The method is called for all
      80              :  * available Algebra types, based on the current build options.
      81              :  *
      82              :  * @param reg                           registry
      83              :  * @param parentGroup           group for sorting of functionality
      84              :  */
      85              : template <typename TAlgebra>
      86            3 : static void Algebra(Registry& reg, string grp)
      87              : {
      88            3 :         string suffix = GetAlgebraSuffix<TAlgebra>();
      89            3 :         string tag = GetAlgebraTag<TAlgebra>();
      90              : 
      91              : //      typedefs for this algebra
      92              : 
      93              : #ifdef UG_PARALLEL
      94              : typedef typename TAlgebra::vector_type vector_type;
      95              : 
      96              :         {
      97              :                 string name = string("ISchurComplementInverse").append(suffix);
      98              :                 reg.add_class_< ISchurComplementInverse<TAlgebra> >(name, grp) ;
      99              :                 reg.add_class_to_group(name, "ISchurComplementInverse", tag);
     100              :         }
     101              : 
     102              :         //      Schur complement preconditioner
     103              :         {
     104              :                 typedef SchurPrecond<TAlgebra> T;
     105              :                 typedef IPreconditioner<TAlgebra> TBase;
     106              :                 string name = string("SchurComplement").append(suffix);
     107              :                 reg.add_class_<T,TBase>(name, grp, "Schur complement preconditioner")
     108              :                         .add_constructor()
     109              :                         .add_method("set_dirichlet_solver", &T::set_dirichlet_solver, "","Dirichlet solver")
     110              :                         .add_method("set_skeleton_solver", &T::set_skeleton_solver, "","Skeleton solver")
     111              :                         .add_method("num_global_skeleton", &T::num_global_skeleton)
     112              :                         .add_method("num_local_skeleton", &T::num_local_skeleton)
     113              :                         .set_construct_as_smart_pointer(true);
     114              :                 reg.add_class_to_group(name, "SchurComplement", tag);
     115              :         }
     116              : 
     117              : 
     118              : 
     119              :         {
     120              :                 typedef SchurInverseWithOperator<TAlgebra> T;
     121              :                 typedef ISchurComplementInverse<TAlgebra> TBase;
     122              :                 string name = string("SchurInverseWithOperator").append(suffix);
     123              :                 reg.add_class_<T,TBase>(name, grp, "SchurInverseWithOperator")
     124              :                         .ADD_CONSTRUCTOR( (SmartPtr<ILinearOperatorInverse<vector_type> > ) )("linOpInverse")
     125              :                         .set_construct_as_smart_pointer(true);
     126              :                 reg.add_class_to_group(name, "SchurInverseWithOperator", tag);
     127              :         }
     128              : 
     129              :         {
     130              :                 typedef SchurInverseWithFullMatrix<TAlgebra> T;
     131              :                 typedef ISchurComplementInverse<TAlgebra> TBase;
     132              :                 string name = string("SchurInverseWithFullMatrix").append(suffix);
     133              :                 reg.add_class_<T,TBase>(name, grp, "SchurInverseWithFullMatrix")
     134              :                         .ADD_CONSTRUCTOR( (SmartPtr<ILinearOperatorInverse<vector_type> > ) )("linOpInverse")
     135              :                         .set_construct_as_smart_pointer(true);
     136              :                 reg.add_class_to_group(name, "SchurInverseWithFullMatrix", tag);
     137              :         }
     138              : 
     139              : 
     140              :         {
     141              :                 typedef SchurInverseWithAGammaGamma<TAlgebra> T;
     142              :                 typedef ISchurComplementInverse<TAlgebra> TBase;
     143              :                 string name = string("SchurInverseWithAGammaGamma").append(suffix);
     144              :                 reg.add_class_<T,TBase>(name, grp, "SchurInverseWithAGammaGamma")
     145              :                         .ADD_CONSTRUCTOR( (SmartPtr<IPreconditionedLinearOperatorInverse<vector_type> > ) )("precLinOpInv")
     146              :                         .set_construct_as_smart_pointer(true);
     147              :                 reg.add_class_to_group(name, "SchurInverseWithAGammaGamma", tag);
     148              :         }
     149              : 
     150              : 
     151              :         {
     152              :                 typedef SchurInverseWithAutoFullMatrix<TAlgebra> T;
     153              :                 typedef ISchurComplementInverse<TAlgebra> TBase;
     154              :                 string name = string("SchurInverseWithAutoFullMatrix").append(suffix);
     155              :                 reg.add_class_<T,TBase>(name, grp, "SchurInverseWithAutoFullMatrix")
     156              :                         .ADD_CONSTRUCTOR( (SmartPtr<ILinearOperatorInverse<vector_type> > ) )("linOpInverse")
     157              :                         .set_construct_as_smart_pointer(true);
     158              :                 reg.add_class_to_group(name, "SchurInverseWithAutoFullMatrix", tag);
     159              :         }
     160              : 
     161              : 
     162              : 
     163              : #endif
     164            3 : }
     165              : 
     166              : 
     167              : }; // end Functionality
     168              : 
     169              : // end group precond_bridge
     170              : /// \}
     171              : 
     172              : }// end Preconditioner
     173              : 
     174              : /// \addtogroup precond_bridge
     175            1 : void RegisterBridge_Schur(Registry& reg, string grp)
     176              : {
     177            1 :         grp.append("/Algebra/Preconditioner");
     178              :         typedef Schur::Functionality Functionality;
     179              : 
     180              :         try{
     181            1 :                 RegisterAlgebraDependent<Functionality>(reg,grp);
     182              :         }
     183            0 :         UG_REGISTRY_CATCH_THROW(grp);
     184            1 : }
     185              : 
     186              : } // namespace bridge
     187              : } // namespace ug
        

Generated by: LCOV version 2.0-1