LCOV - code coverage report
Current view: top level - ugbase/bridge/disc_bridges - elem_discs_bridge.cpp (source / functions) Coverage Total Hit
Test: coverage.info Lines: 99.0 % 102 101
Test Date: 2025-09-21 23:31:46 Functions: 100.0 % 4 4

            Line data    Source code
       1              : /*
       2              :  * Copyright (c) 2011-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_domain_dependent.h"
      42              : 
      43              : // lib_disc includes
      44              : #include "lib_disc/domain.h"
      45              : 
      46              : #include "lib_disc/spatial_disc/disc_util/conv_shape_interface.h"
      47              : #include "lib_disc/spatial_disc/disc_util/conv_shape.h"
      48              : 
      49              : #include "lib_disc/spatial_disc/elem_disc/neumann_boundary/neumann_boundary_base.h"
      50              : #include "lib_disc/spatial_disc/elem_disc/neumann_boundary/fv1/neumann_boundary_fv1.h"
      51              : #include "lib_disc/spatial_disc/elem_disc/neumann_boundary/fv/neumann_boundary_fv.h"
      52              : #include "lib_disc/spatial_disc/elem_disc/neumann_boundary/fe/neumann_boundary_fe.h"
      53              : #include "lib_disc/spatial_disc/elem_disc/inner_boundary/inner_boundary.h"
      54              : #include "lib_disc/spatial_disc/elem_disc/dirac_source/lagrange_dirac_source.h"
      55              : 
      56              : using namespace std;
      57              : 
      58              : namespace ug{
      59              : namespace bridge{
      60              : namespace ElemDiscs{
      61              : 
      62              : /**
      63              :  * \defgroup elemdisc_bridge Element Discretization Bridge
      64              :  * \ingroup disc_bridge
      65              :  * \{
      66              :  */
      67              : 
      68              : /**
      69              :  * Class exporting the functionality. All functionality that is to
      70              :  * be used in scripts or visualization must be registered here.
      71              :  */
      72              : struct Functionality
      73              : {
      74              : 
      75              : /**
      76              :  * Function called for the registration of Domain dependent parts.
      77              :  * All Functions and Classes depending on the Domain
      78              :  * are to be placed here when registering. The method is called for all
      79              :  * available Domain types, based on the current build options.
      80              :  *
      81              :  * @param reg                           registry
      82              :  * @param parentGroup           group for sorting of functionality
      83              :  */
      84              : template <typename TDomain>
      85            3 : static void Domain(Registry& reg, string grp)
      86              : {
      87              :         string suffix = GetDomainSuffix<TDomain>();
      88              :         string tag = GetDomainTag<TDomain>();
      89              :         static const int dim = TDomain::dim;
      90              : 
      91            3 :         string approxGrp = grp; approxGrp.append("/ApproximationSpace");
      92            3 :         string elemGrp = grp; elemGrp.append("/SpatialDisc/ElemDisc");
      93              : 
      94              : //      ElemDiscModifier base class
      95              :         {
      96              :                 typedef IElemDiscModifier<TDomain> T;
      97            3 :                 string name = string("IElemDiscModifier").append(suffix);
      98            9 :                 reg.add_class_<T>(name, elemGrp);
      99            9 :                 reg.add_class_to_group(name, "IElemDiscModifier", tag);
     100              :         }
     101              : 
     102              :         //      IElemError base class
     103              :         {
     104              :                         typedef IElemError<TDomain> T;
     105            3 :                         string name = string("IElemError").append(suffix);
     106            9 :                         reg.add_class_<T>(name, elemGrp)
     107            9 :                                 .add_method("set_stationary", static_cast<void (T::*)()>(&T::set_stationary))
     108              :                         //      .add_method("add_elem_modifier", &T::add_elem_modifier, "", "")
     109            9 :                                 .add_method("set_error_estimator", static_cast<void (T::*)(SmartPtr<IErrEstData<TDomain> >)>(&T::set_error_estimator));
     110            9 :                         reg.add_class_to_group(name, "IElemError", tag);
     111              :         }
     112              : 
     113              : 
     114              : //      IElemDisc base class
     115              :         {
     116              :                 typedef IElemDisc<TDomain> T;
     117              :                 typedef IElemError<TDomain> TBase;
     118            3 :                 string name = string("IElemDisc").append(suffix);
     119            9 :                 reg.add_class_<T, TBase>(name, elemGrp)
     120              :                 //      .add_method("set_stationary", static_cast<void (T::*)()>(&T::set_stationary))
     121            6 :                         .add_method("add_elem_modifier", &T::add_elem_modifier, "", "");
     122              :                 //      .add_method("set_error_estimator", static_cast<void (T::*)(SmartPtr<IErrEstData<TDomain> >)>(&T::set_error_estimator));
     123            9 :                 reg.add_class_to_group(name, "IElemDisc", tag);
     124              :         }
     125              : 
     126              : //      Neumann Boundary Base
     127              :         {
     128              :                 typedef NeumannBoundaryBase<TDomain> T;
     129              :                 typedef IElemDisc<TDomain> TBase;
     130            3 :                 string name = string("NeumannBoundaryBase").append(suffix);
     131            9 :                 reg.add_class_<T, TBase >(name, elemGrp)
     132            6 :                         .add_method("add", static_cast<void (T::*)(SmartPtr<CplUserData<number, dim> >, const char*, const char*)>(&T::add))
     133            6 :                         .add_method("add", static_cast<void (T::*)(SmartPtr<CplUserData<number, dim> >, const std::vector<std::string>&, const std::vector<std::string>&)>(&T::add))
     134            6 :                         .add_method("add", static_cast<void (T::*)(SmartPtr<CplUserData<number, dim, bool> >, const char*, const char*)>(&T::add))
     135            6 :                         .add_method("add", static_cast<void (T::*)(SmartPtr<CplUserData<number, dim, bool> >, const std::vector<std::string>&, const std::vector<std::string>&)>(&T::add))
     136            6 :                         .add_method("add", static_cast<void (T::*)(SmartPtr<CplUserData<MathVector<dim>, dim> >, const char*, const char*)>(&T::add))
     137            6 :                         .add_method("add", static_cast<void (T::*)(SmartPtr<CplUserData<MathVector<dim>, dim> >, const std::vector<std::string>&, const std::vector<std::string>&)>(&T::add))
     138            6 :                         .add_method("add", static_cast<void (T::*)(number, const char*, const char*)>(&T::add))
     139            6 :                         .add_method("add", static_cast<void (T::*)(number, const std::vector<std::string>&, const std::vector<std::string>&)>(&T::add))
     140              : #ifdef UG_FOR_LUA
     141            6 :                         .add_method("add", static_cast<void (T::*)(const char*, const char*, const char*)>(&T::add))
     142            6 :                         .add_method("add", static_cast<void (T::*)(const char*, const std::vector<std::string>&, const std::vector<std::string>&)>(&T::add))
     143            6 :                         .add_method("add", static_cast<void (T::*)(LuaFunctionHandle, const char*, const char*)>(&T::add))
     144            6 :                         .add_method("add", static_cast<void (T::*)(LuaFunctionHandle, const std::vector<std::string>&, const std::vector<std::string>&)>(&T::add))
     145              : #endif
     146            6 :                         .add_method("add", static_cast<void (T::*)(const vector<number>&, const char*, const char*)>(&T::add))
     147            6 :                         .add_method("add", static_cast<void (T::*)(const vector<number>&, const std::vector<std::string>&, const std::vector<std::string>&)>(&T::add));
     148            9 :                 reg.add_class_to_group(name, "NeumannBoundaryBase", tag);
     149              :         }
     150              : 
     151              : //      Neumann Boundary FV1
     152              :         {
     153              :                 typedef NeumannBoundaryFV1<TDomain> T;
     154              :                 typedef NeumannBoundaryBase<TDomain> TBase;
     155            3 :                 string name = string("NeumannBoundaryFV1").append(suffix);
     156            9 :                 reg.add_class_<T, TBase >(name, elemGrp)
     157            6 :                         .template add_constructor<void (*)(const char*)>("Function")
     158            3 :                         .set_construct_as_smart_pointer(true);
     159            9 :                 reg.add_class_to_group(name, "NeumannBoundaryFV1", tag);
     160              :         }
     161              : 
     162              : //      Neumann Boundary FV
     163              :         {
     164              :                 typedef NeumannBoundaryFV<TDomain> T;
     165              :                 typedef NeumannBoundaryBase<TDomain> TBase;
     166            3 :                 string name = string("NeumannBoundaryFV").append(suffix);
     167            9 :                 reg.add_class_<T, TBase >(name, elemGrp)
     168            6 :                         .template add_constructor<void (*)(const char*)>("Function")
     169            3 :                         .set_construct_as_smart_pointer(true);
     170            9 :                 reg.add_class_to_group(name, "NeumannBoundaryFV", tag);
     171              :         }
     172              : 
     173              : //      Neumann Boundary FE
     174              :         {
     175              :                 typedef NeumannBoundaryFE<TDomain> T;
     176              :                 typedef NeumannBoundaryBase<TDomain> TBase;
     177            3 :                 string name = string("NeumannBoundaryFE").append(suffix);
     178            9 :                 reg.add_class_<T, TBase >(name, elemGrp)
     179            6 :                         .template add_constructor<void (*)(const char*)>("Function")
     180            3 :                         .set_construct_as_smart_pointer(true);
     181            9 :                 reg.add_class_to_group(name, "NeumannBoundaryFE", tag);
     182              :         }
     183              : 
     184              : #if 0
     185              : //      Inner Boundaries
     186              :         {
     187              :                 typedef FV1InnerBoundaryElemDisc<TDomain> T;
     188              :                 typedef IElemDisc<TDomain> TBase;
     189              :                 string name = string("FV1InnerBoundary").append(suffix);
     190              :                 reg.add_class_<T, TBase >(name, elemGrp)
     191              :                         .add_method("set_flux_scale", static_cast<void (T::*)(number)>(&T::set_flux_scale),
     192              :                                 "", "scale", "Set scale to scale (all) fluxes with.")
     193              :                         .add_method("set_flux_scale", static_cast<void (T::*)(SmartPtr<CplUserData<number, dim> >)>(&T::set_flux_scale),
     194              :                                 "", "scale", "Set scale to scale (all) fluxes with.")
     195              : #ifdef UG_FOR_LUA
     196              :                         .add_method("set_flux_scale", static_cast<void (T::*)(const char*)>(&T::set_flux_scale),
     197              :                                 "", "scale", "Set scale to scale (all) fluxes with.")
     198              : #endif
     199              :                         ;
     200              :                 reg.add_class_to_group(name, "FV1InnerBoundary", tag);
     201              :         }
     202              : #endif
     203              : 
     204              :         //      DiracSourceDisc
     205              :                 {
     206              :                         typedef DiracSourceDisc<TDomain> T;
     207              :                         typedef IElemDisc<TDomain> TBase;
     208            3 :                         string name = string("DiracSourceDisc").append(suffix);
     209            9 :                         reg.add_class_<T, TBase >(name, elemGrp)
     210            6 :                                 .template add_constructor<void (*)(const char*, const char*)>("Function")
     211            6 :                                 .add_method("add_source", static_cast<void (T::*)(number, MathVector<dim> &)>(&T::add_source),
     212              :                                         "", "scale", "Set scale to scale (all) fluxes with.")
     213            6 :                                 .add_method("add_source", static_cast<void (T::*)(SmartPtr<UserData<number, dim> >, MathVector<dim> &)>(&T::add_source),
     214              :                                         "", "scale", "Set scale to scale (all) fluxes with.")
     215              : #ifdef UG_FOR_LUA
     216            6 :                                 .add_method("add_source", static_cast<void (T::*)(const char*, MathVector<dim> &)>(&T::add_source),
     217              :                                         "", "scale", "Set scale to scale (all) fluxes with.")
     218              : #endif
     219            6 :                                 .add_method("add_transport_sink", static_cast<void (T::*)(number)>(&T::add_transport_sink),
     220              :                                                         "", "scale", "Set scale to scale (all) fluxes with.")
     221            6 :                                 .add_method("add_transport_sink", static_cast<void (T::*)(SmartPtr<UserData<number, dim> >)>(&T::add_transport_sink),
     222              :                                                         "", "scale", "Set scale to scale (all) fluxes with.")
     223              : #ifdef UG_FOR_LUA
     224            6 :                                 .add_method("add_transport_sink", static_cast<void (T::*)(const char*)>(&T::add_transport_sink),
     225              :                                                         "", "scale", "Set scale to scale (all) fluxes with.")
     226              : #endif
     227              : 
     228              : 
     229            3 :                                         .set_construct_as_smart_pointer(true);
     230            9 :                         reg.add_class_to_group(name, "DiracSourceDisc", tag);
     231              :                 }
     232              : 
     233              : 
     234              : /////////////////////////////////////////////////////////////////////////////
     235              : // Convection Shapes
     236              : /////////////////////////////////////////////////////////////////////////////
     237              : 
     238            3 :         string upGrp = grp; upGrp.append("/SpatialDisc/Upwind");
     239              : 
     240              : //      IConvectionShapes
     241              :         {
     242              :                 typedef IConvectionShapes<dim> T;
     243            3 :                 string name = string("IConvectionShapes").append(suffix);
     244            9 :                 reg.add_class_<T>(name, upGrp);
     245            9 :                 reg.add_class_to_group(name, "IConvectionShapes", tag);
     246              :         }
     247              : 
     248              : //      ConvectionShapesNoUpwind
     249              :         {
     250              :                 typedef ConvectionShapesNoUpwind<dim> T;
     251              :                 typedef IConvectionShapes<dim> TBase;
     252            3 :                 string name = string("NoUpwind").append(suffix);
     253            9 :                 reg.add_class_<T, TBase>(name, upGrp)
     254            3 :                         .add_constructor()
     255            3 :                         .set_construct_as_smart_pointer(true);
     256            9 :                 reg.add_class_to_group(name, "NoUpwind", tag);
     257              :         }
     258              : 
     259              : //      ConvectionShapesFullUpwind
     260              :         {
     261              :                 typedef ConvectionShapesFullUpwind<dim> T;
     262              :                 typedef IConvectionShapes<dim> TBase;
     263            3 :                 string name = string("FullUpwind").append(suffix);
     264            9 :                 reg.add_class_<T, TBase>(name, upGrp)
     265            3 :                         .add_constructor()
     266            3 :                         .set_construct_as_smart_pointer(true);
     267            9 :                 reg.add_class_to_group(name, "FullUpwind", tag);
     268              :         }
     269              : 
     270              : //      ConvectionShapesWeightedUpwind
     271              :         {
     272              :                 typedef ConvectionShapesWeightedUpwind<dim> T;
     273              :                 typedef IConvectionShapes<dim> TBase;
     274            3 :                 string name = string("WeightedUpwind").append(suffix);
     275            9 :                 reg.add_class_<T, TBase>(name, upGrp)
     276            9 :                         .add_method("set_weight", &T::set_weight)
     277            6 :                         .add_constructor()
     278            6 :                         .template add_constructor<void (*)(number)>("weight")
     279            3 :                         .set_construct_as_smart_pointer(true);
     280            9 :                 reg.add_class_to_group(name, "WeightedUpwind", tag);
     281              :         }
     282              : 
     283              : //      ConvectionShapesPartialUpwind
     284              :         {
     285              :                 typedef ConvectionShapesPartialUpwind<dim> T;
     286              :                 typedef IConvectionShapes<dim> TBase;
     287            3 :                 string name = string("PartialUpwind").append(suffix);
     288            9 :                 reg.add_class_<T, TBase>(name, upGrp)
     289            3 :                         .add_constructor()
     290            3 :                         .set_construct_as_smart_pointer(true);
     291            9 :                 reg.add_class_to_group(name, "PartialUpwind", tag);
     292              :         }
     293              : 
     294              : //      ConvectionShapesSkewedUpwind
     295              :         {
     296              :                 typedef ConvectionShapesSkewedUpwind<dim> T;
     297              :                 typedef IConvectionShapes<dim> TBase;
     298            3 :                 string name = string("SkewedUpwind").append(suffix);
     299            9 :                 reg.add_class_<T, TBase>(name, upGrp)
     300            3 :                         .add_constructor()
     301            3 :                         .set_construct_as_smart_pointer(true);
     302            9 :                 reg.add_class_to_group(name, "SkewedUpwind", tag);
     303              :         }
     304              : 
     305              : //      ConvectionShapesLinearProfileSkewedUpwind
     306              :         {
     307              :                 typedef ConvectionShapesLinearProfileSkewedUpwind<dim> T;
     308              :                 typedef IConvectionShapes<dim> TBase;
     309            3 :                 string name = string("LinearProfileSkewedUpwind").append(suffix);
     310            9 :                 reg.add_class_<T, TBase>(name, upGrp)
     311            3 :                         .add_constructor()
     312            3 :                         .set_construct_as_smart_pointer(true);
     313            9 :                 reg.add_class_to_group(name, "LinearProfileSkewedUpwind", tag);
     314              :         }
     315            3 : }
     316              : 
     317              : /**
     318              :  * Function called for the registration of Domain and Algebra independent parts.
     319              :  * All Functions and Classes not depending on Domain and Algebra
     320              :  * are to be placed here when registering.
     321              :  *
     322              :  * @param reg                           registry
     323              :  * @param parentGroup           group for sorting of functionality
     324              :  */
     325              : static void Common(Registry& reg, string grp)
     326              : {
     327              : //      get group string
     328            1 :         grp.append("/Discretization");
     329            1 : }
     330              : };
     331              : 
     332              : // end group elemdisc_bridge
     333              : /// \}
     334              : 
     335              : }// namespace ElemDiscs
     336              : 
     337              : /// \addtogroup elemdisc_bridge
     338            1 : void RegisterBridge_ElemDiscs(Registry& reg, string grp)
     339              : {
     340              :         typedef ElemDiscs::Functionality Functionality;
     341              : 
     342              :         try{
     343            2 :                 RegisterCommon<Functionality>(reg,grp);
     344            1 :                 RegisterDomainDependent<Functionality>(reg,grp);
     345              :         }
     346            0 :         UG_REGISTRY_CATCH_THROW(grp);
     347            1 : }
     348              : 
     349              : }//     end of namespace bridge
     350              : }//     end of namespace ug
        

Generated by: LCOV version 2.0-1