LCOV - code coverage report
Current view: top level - ugbase/bridge - util_domain_dependent.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 17 17
Test Date: 2025-09-21 23:31:46 Functions: 100.0 % 126 126

            Line data    Source code
       1              : /*
       2              :  * Copyright (c) 2012-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              : #ifndef UTIL_DOMAIN_DEPENDENT_H
      34              : #define UTIL_DOMAIN_DEPENDENT_H
      35              : 
      36              : 
      37              : 
      38              : #include "registry/registry.h"
      39              : #include "lib_disc/domain.h"
      40              : 
      41              : #include "suffix_tag.h"
      42              : 
      43              : #include <boost/mpl/if.hpp>
      44              : #include <boost/mpl/list.hpp>
      45              : #include <boost/mpl/empty.hpp>
      46              : #include <boost/mpl/front.hpp>
      47              : #include <boost/mpl/pop_front.hpp>
      48              : 
      49              : 
      50              : namespace ug{
      51              : namespace bridge{
      52              : 
      53              : /// \addtogroup bridge
      54              : /// \{
      55              : 
      56              : ////////////////////////////////////////////////////////////////////////////////
      57              : //      Default Domain List
      58              : ////////////////////////////////////////////////////////////////////////////////
      59              : 
      60              : typedef boost::mpl::list<
      61              : #ifdef UG_DIM_1
      62              :                 Domain1d
      63              : #endif
      64              : #if defined UG_DIM_1 && (defined UG_DIM_2 || defined UG_DIM_3)
      65              :                 ,
      66              : #endif
      67              : #ifdef UG_DIM_2
      68              :                 Domain2d
      69              : #endif
      70              : #if defined UG_DIM_2 && defined UG_DIM_3
      71              :                 ,
      72              : #endif
      73              : #ifdef UG_DIM_3
      74              :                 Domain3d
      75              : #endif
      76              : > CompileDomainList;
      77              : 
      78              : ////////////////////////////////////////////////////////////////////////////////
      79              : //  Register invokers
      80              : ////////////////////////////////////////////////////////////////////////////////
      81              : 
      82              : template <typename Functionality, typename List = CompileDomainList>
      83              : struct RegisterDomainDependent
      84              : {
      85           71 :         RegisterDomainDependent(Registry& reg, std::string grp)
      86              :         {
      87              :                 static const bool isEmpty = boost::mpl::empty<List>::value;
      88           71 :                 typename boost::mpl::if_c<isEmpty, RegEnd, RegNext>::type (reg,grp);
      89           71 :         }
      90              :         struct RegEnd{ RegEnd(Registry& reg, std::string grp){} };
      91              :         struct RegNext
      92              :         {
      93           51 :                 RegNext(Registry& reg, std::string grp)
      94              :                 {
      95              :                         typedef typename boost::mpl::front<List>::type DomainType;
      96              :                         typedef typename boost::mpl::pop_front<List>::type NextList;
      97          102 :                         Functionality::template Domain<DomainType>(reg,grp);
      98           51 :                         RegisterDomainDependent<Functionality, NextList>(reg,grp);
      99           51 :                 }
     100              :         };
     101              : };
     102              : 
     103              : template<typename Functionality>
     104              : void RegisterDomain1dDependent(Registry& reg, std::string grp)
     105              : {
     106              : #ifdef UG_DIM_1
     107              :         RegisterDomainDependent<Functionality, boost::mpl::list<Domain1d> > (reg, grp);
     108              : #endif
     109              : }
     110              : 
     111              : template<typename Functionality>
     112            2 : void RegisterDomain2dDependent(Registry& reg, std::string grp)
     113              : {
     114              : #ifdef UG_DIM_2
     115            2 :         RegisterDomainDependent<Functionality, boost::mpl::list<Domain2d> > (reg, grp);
     116              : #endif
     117            2 : }
     118              : 
     119              : template<typename Functionality>
     120            2 : void RegisterDomain3dDependent(Registry& reg, std::string grp)
     121              : {
     122              : #ifdef UG_DIM_3
     123            2 :         RegisterDomainDependent<Functionality, boost::mpl::list<Domain3d> > (reg, grp);
     124              : #endif
     125            2 : }
     126              : 
     127              : template<typename Functionality>
     128            2 : void RegisterDomain2d3dDependent(Registry& reg, std::string grp)
     129              : {
     130            4 :         RegisterDomain2dDependent<Functionality>(reg, grp);
     131            2 :         RegisterDomain3dDependent<Functionality>(reg, grp);
     132            2 : }
     133              : 
     134              : // end group bridge
     135              : /// \}
     136              : 
     137              : } // namespace bridge
     138              : } // namespace ug
     139              : 
     140              : #endif  /* UTIL_DOMAIN_DEPENDENT_H */
     141              : 
        

Generated by: LCOV version 2.0-1