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

            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_algebra_dependent.h"
      42              : 
      43              : 
      44              : #include "lib_algebra/lib_algebra.h"
      45              : 
      46              : // ordering algorithms
      47              : #include "lib_algebra/ordering_strategies/algorithms/ordering_algorithms.h"
      48              : 
      49              : using namespace std;
      50              : 
      51              : namespace ug{
      52              : namespace bridge{
      53              : namespace Ordering{
      54              : 
      55              : /**
      56              :  * \defgroup ordering_bridge Ordering Bridge
      57              :  * \ingroup ordering_bridge
      58              :  * \{
      59              :  */
      60              : 
      61              : /**
      62              :  * Class exporting the functionality. All functionality that is to
      63              :  * be used in scripts or visualization must be registered here.
      64              :  */
      65              : struct Functionality
      66              : {
      67              : 
      68              : /**
      69              :  * Function called for the registration of Algebra dependent parts.
      70              :  * All Functions and Classes depending on Algebra
      71              :  * are to be placed here when registering. The method is called for all
      72              :  * available Algebra types, based on the current build options.
      73              :  *
      74              :  * @param reg                           registry
      75              :  * @param parentGroup           group for sorting of functionality
      76              :  */
      77              : template <typename TAlgebra>
      78            3 : static void Algebra(Registry& reg, string grp)
      79              : {
      80            3 :         string suffix = GetAlgebraSuffix<TAlgebra>();
      81            3 :         string tag = GetAlgebraTag<TAlgebra>();
      82              : 
      83              :         typedef std::vector<size_t> ordering_container_type;
      84              : 
      85              :         {
      86              :                 typedef IOrderingAlgorithm<TAlgebra, ordering_container_type> TBase;
      87            3 :                 string name = string("IOrderingAlgorithm").append(suffix);
      88            9 :                 reg.add_class_<TBase>(name, grp);
      89            9 :                 reg.add_class_to_group(name, "IOrderingAlgorithm", tag);
      90              :         }
      91              : 
      92              : //      Boost Cuthill McKee
      93              :         {
      94              :                 typedef BoostCuthillMcKeeOrdering<TAlgebra, ordering_container_type> T;
      95              :                 typedef IOrderingAlgorithm<TAlgebra, ordering_container_type> TBase;
      96            3 :                 string name = string("BoostCuthillMcKeeOrdering").append(suffix);
      97            9 :                 reg.add_class_<T, TBase>(name, grp, "BoostCuthillMcKeeOrdering")
      98            3 :                         .add_constructor()
      99            6 :                         .add_method("set_reverse", &T::set_reverse)
     100            3 :                         .set_construct_as_smart_pointer(true);
     101            9 :                 reg.add_class_to_group(name, "BoostCuthillMcKeeOrdering", tag);
     102              :         }
     103              : 
     104              : //      Boost Minimum-Degree
     105              :         {
     106              :                 typedef BoostMinimumDegreeOrdering<TAlgebra, ordering_container_type> T;
     107              :                 typedef IOrderingAlgorithm<TAlgebra, ordering_container_type> TBase;
     108            3 :                 string name = string("BoostMinimumDegreeOrdering").append(suffix);
     109            9 :                 reg.add_class_<T, TBase>(name, grp, "BoostMinimumDegreeOrdering")
     110            3 :                         .add_constructor()
     111            3 :                         .set_construct_as_smart_pointer(true);
     112            9 :                 reg.add_class_to_group(name, "BoostMinimumDegreeOrdering", tag);
     113              :         }
     114              : 
     115              : //      Native Cuthill McKee
     116              :         {
     117              :                 typedef NativeCuthillMcKeeOrdering<TAlgebra, ordering_container_type> T;
     118              :                 typedef IOrderingAlgorithm<TAlgebra, ordering_container_type> TBase;
     119            3 :                 string name = string("NativeCuthillMcKeeOrdering").append(suffix);
     120            9 :                 reg.add_class_<T, TBase>(name, grp, "NativeCuthillMcKeeOrdering")
     121            3 :                         .add_constructor()
     122            6 :                         .add_method("set_reverse", &T::set_reverse)
     123            3 :                         .set_construct_as_smart_pointer(true);
     124            9 :                 reg.add_class_to_group(name, "NativeCuthillMcKeeOrdering", tag);
     125              :         }
     126              : 
     127              : //      Topological - for cycle-free matrices only
     128              :         {
     129              :                 typedef TopologicalOrdering<TAlgebra, ordering_container_type> T;
     130              :                 typedef IOrderingAlgorithm<TAlgebra, ordering_container_type> TBase;
     131            3 :                 string name = string("TopologicalOrdering").append(suffix);
     132            9 :                 reg.add_class_<T, TBase>(name, grp, "TopologicalOrdering")
     133            3 :                         .add_constructor()
     134            3 :                         .set_construct_as_smart_pointer(true);
     135            9 :                 reg.add_class_to_group(name, "TopologicalOrdering", tag);
     136              :         }
     137              : 
     138              : //      Strongly connected components ordering
     139              :         {
     140              :                 typedef SCCOrdering<TAlgebra, ordering_container_type> T;
     141              :                 typedef IOrderingAlgorithm<TAlgebra, ordering_container_type> TBase;
     142            3 :                 string name = string("SCCOrdering").append(suffix);
     143            9 :                 reg.add_class_<T, TBase>(name, grp, "SCCOrdering")
     144            3 :                         .add_constructor()
     145            6 :                         .add_method("set_ordering_subalgorithm", &T::set_ordering_subalgorithm, "", "",
     146              :                                                 "sets an ordering subalgorithm")
     147            3 :                         .set_construct_as_smart_pointer(true);
     148            9 :                 reg.add_class_to_group(name, "SCCOrdering", tag);
     149              :         }
     150            3 : }
     151              : 
     152              : }; // end Functionality
     153              : 
     154              : // end group ordering_bridge
     155              : /// \}
     156              : 
     157              : }// end Ordering
     158              : 
     159              : /// \addtogroup ordering_bridge
     160            1 : void RegisterBridge_AlgebraOrdering(Registry& reg, string grp)
     161              : {
     162            1 :         grp.append("/Algebra/Ordering");
     163              :         typedef Ordering::Functionality Functionality;
     164              : 
     165              :         try{
     166            1 :                 RegisterAlgebraDependent<Functionality>(reg,grp);
     167              :         }
     168            0 :         UG_REGISTRY_CATCH_THROW(grp);
     169            1 : }
     170              : 
     171              : } // namespace bridge
     172              : } // namespace ug
        

Generated by: LCOV version 2.0-1