LCOV - code coverage report
Current view: top level - ugbase/lib_disc/spatial_disc/elem_disc/dirac_source - lagrange_dirac_source.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 25 0
Test Date: 2026-06-01 23:54:59 Functions: 0.0 % 39 0

            Line data    Source code
       1              : /*
       2              :  * Copyright (c) 2019-2020:  G-CSC, Goethe University Frankfurt
       3              :  * Author: Arne Naegel
       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              :  * Finite Volume Element Discretization for an inner BndCond that depends on the unknowns (on the bnd)
      35              :  *
      36              :  * This class implements the IElemDisc interface to provide element local
      37              :  * assemblings for the unknown-dependent Neumann-flux over an inner boundary.
      38              :  * The equation of this flux and its derivative should be given
      39              :  * in a concretization of this class.
      40              :  * 
      41              :  * \tparam      TDomain         Domain
      42              :  * \tparam      TAlgebra        Algebra
      43              :  */
      44              : 
      45              : #ifndef __H__UG__LIB_DISC__SPACIAL_DISCRETIZATION__ELEM_DISC__DIRAC_SOURCE__LAGRANGE_DIRAC_SOURCE_H__
      46              : #define __H__UG__LIB_DISC__SPACIAL_DISCRETIZATION__ELEM_DISC__DIRAC_SOURCE__LAGRANGE_DIRAC_SOURCE_H__
      47              : 
      48              : #include <vector>
      49              : #include <string>
      50              : #include <utility>      // std::pair
      51              : 
      52              : // other ug4 modules
      53              : #include "common/common.h"
      54              : 
      55              : // library intern headers
      56              : #include "lib_disc/spatial_disc/elem_disc/elem_disc_interface.h"
      57              : #include "lib_disc/spatial_disc/user_data/data_export.h"
      58              : #include "lib_disc/spatial_disc/user_data/data_import.h"
      59              : #include "lib_disc/spatial_disc/disc_util/fv1_geom.h"
      60              : 
      61              : 
      62              : 
      63              : 
      64              : namespace ug
      65              : {
      66              : 
      67              : 
      68              : 
      69              : template<typename TDomain>
      70              : class DiracSourceDisc
      71              : : public IElemDisc<TDomain>
      72              : {
      73              : 
      74              :         public:
      75              :         ///     Base class type
      76              :                 typedef IElemDisc<TDomain> base_type;
      77              : 
      78              :         ///     Domain type
      79              :                 typedef typename base_type::domain_type domain_type;
      80              : 
      81              :         ///     World dimension
      82              :                 static const int dim = base_type::dim;
      83              : 
      84              :                 static const int _C_ = 0;
      85              : 
      86              :         ///     Position type
      87              :                 typedef typename base_type::position_type position_type;
      88              : 
      89              :         private:
      90              :         ///     own type
      91              :                 typedef DiracSourceDisc<TDomain> this_type;
      92              : 
      93              : 
      94              :         public:
      95              : 
      96              :         /// Constructor with c-strings
      97            0 :                 DiracSourceDisc(const char* functions = "", const char* subsets = "")
      98            0 :                         : IElemDisc<TDomain>(functions, subsets), m_bNonRegularGrid(false) /*, m_bCurrElemIsHSlave(false)*/
      99              :                 {
     100              :                         register_all_funcs();
     101            0 :                 }
     102              : 
     103              :         /// Constructor with functions
     104            0 :                 DiracSourceDisc(const std::vector<std::string>& functions, const std::vector<std::string>& subsets)
     105            0 :                         : IElemDisc<TDomain>(functions, subsets), m_bNonRegularGrid(false) /*, m_bCurrElemIsHSlave(false)*/
     106              :                 {
     107              :                         register_all_funcs();
     108            0 :                 }
     109              : 
     110              :         /// Destructor
     111            0 :                 virtual ~DiracSourceDisc() {};
     112              : 
     113              : 
     114              :         
     115              :         /// Setting a scaling factor for the flux
     116              :                 void add_source(number scale, MathVector<dim> &srcCoord);
     117              :                 void add_source(SmartPtr<UserData<number, dim> > srcData, MathVector<dim> &srcCoord);
     118              : #ifdef UG_FOR_LUA
     119              :                 void add_source(const char* luaScaleFctName, MathVector<dim> &srcCoord);
     120              : #endif
     121              : 
     122              :                 /// Setting a scaling factor for the flux
     123              :                 void add_transport_sink(SmartPtr<UserData<number, dim> > snkData);
     124              :                 void add_transport_sink(number snk);
     125              : 
     126              : #ifdef UG_FOR_LUA
     127              :                 void add_transport_sink(const char* luaScaleFctName);
     128              : #endif
     129              : 
     130              :         public: // inherited from IElemDisc
     131              :         ///     type of trial space for each function used
     132              :                 virtual void prepare_setting(const std::vector<LFEID>& vLfeID, bool bNonRegularGrid);
     133              : 
     134              :         ///     returns if hanging nodes are used
     135              :                 virtual bool use_hanging() const;
     136              : 
     137              :         protected:
     138              :         
     139              :         
     140              :         ///     prepares the loop over all elements
     141              :         /**
     142              :          * This method prepares the loop over all elements. It resizes the Position
     143              :          * array for the corner coordinates and schedules the local ip positions
     144              :          * at the data imports.
     145              :          */
     146              :                 template<typename TElem, typename TFVGeom>
     147            0 :                 void prep_elem_loop(const ReferenceObjectID roid, const int si)
     148            0 :                 {}
     149              : 
     150              :         ///     prepares the element for assembling
     151              :         /**
     152              :          * This methods prepares an element for the assembling. The Positions of
     153              :          * the Element Corners are read and the Finite Volume Geometry is updated.
     154              :          * The global ip positions are scheduled at the data imports.
     155              :          */
     156              :                 template<typename TElem, typename TFVGeom>
     157            0 :                 void prep_elem(const LocalVector& u, GridObject* elem, const ReferenceObjectID roid, const MathVector<dim> vCornerCoords[])
     158            0 :                 {}
     159              : 
     160              :         ///     finishes the loop over all elements
     161              :                 template<typename TElem, typename TFVGeom>
     162            0 :                 void fsh_elem_loop()
     163            0 :                 {}
     164              : 
     165              :         ///     assembles the local stiffness matrix using a finite volume scheme
     166              :                 template<typename TElem, typename TFVGeom>
     167              :                 void add_jac_A_elem(LocalMatrix& J, const LocalVector& u, GridObject* elem, const MathVector<dim> vCornerCoords[]);
     168              : 
     169              :         ///     assembles the local mass matrix using a finite volume scheme
     170              :                 template<typename TElem, typename TFVGeom>
     171            0 :                 void add_jac_M_elem(LocalMatrix& J, const LocalVector& u, GridObject* elem, const MathVector<dim> vCornerCoords[])
     172            0 :                 {}
     173              : 
     174              :         ///     assembles the stiffness part of the local defect
     175              :                 template<typename TElem, typename TFVGeom>
     176              :                 void add_def_A_elem(LocalVector& d, const LocalVector& u, GridObject* elem, const MathVector<dim> vCornerCoords[]);
     177              : 
     178              :         ///     assembles the mass part of the local defect
     179              :                 template<typename TElem, typename TFVGeom>
     180            0 :                 void add_def_M_elem(LocalVector& d, const LocalVector& u, GridObject* elem, const MathVector<dim> vCornerCoords[])
     181            0 :                 {}
     182              : 
     183              :         ///     assembles the local right hand side
     184              :                 template<typename TElem, typename TFVGeom>
     185              :                 void add_rhs_elem(LocalVector& rhs, GridObject* elem, const MathVector<dim> vCornerCoords[]);
     186              : 
     187              : 
     188              : 
     189              :         ///     prepares the loop over all elements of one type for the computation of the error estimator
     190              :                 template <typename TElem, typename TFVGeom>
     191            0 :                 void prep_err_est_elem_loop(const ReferenceObjectID roid, const int si)
     192            0 :                 { UG_THROW("Not Implemented!"); }
     193              : 
     194              :         ///     prepares the element for assembling the error estimator
     195              :                 template <typename TElem, typename TFVGeom>
     196            0 :                 void prep_err_est_elem(const LocalVector& u, GridObject* elem, const MathVector<dim> vCornerCoords[])
     197            0 :                 { UG_THROW("Not Implemented!"); }
     198              : 
     199              :         ///     computes the error estimator contribution for one element
     200              :                 template <typename TElem, typename TFVGeom>
     201            0 :                 void compute_err_est_A_elem(const LocalVector& u, GridObject* elem, const MathVector<dim> vCornerCoords[], const number& scale)
     202            0 :                 { UG_THROW("Not Implemented!"); }
     203              : 
     204              :         ///     postprocesses the loop over all elements of one type in the computation of the error estimator
     205              :                 template <typename TElem, typename TFVGeom>
     206            0 :                 void fsh_err_est_elem_loop()
     207            0 :                 { UG_THROW("Not Implemented!"); }
     208              : 
     209              :         private:
     210              :                 SmartPtr<UserData<number, dim> > m_srcData;  // source/sink: adding 'source' to rhs
     211              :                 SmartPtr<UserData<number, dim> > m_snkTransportData;  // transport sink: subtracting u*sink
     212              :                 MathVector<dim> m_srcCoord;
     213              : 
     214              :         private:
     215              :                 void register_all_funcs();
     216              : 
     217              :                 template <typename TElem, typename TFVGeom>
     218              :                 void register_func();
     219              :         public:
     220              :                 typedef SmartPtr<CplUserData<number, dim> > NumberExport;
     221              : 
     222              :         protected:
     223              :                 ///     Export for the concentration
     224              :                 SmartPtr<DataExport<number, dim> > m_exRate;
     225              : 
     226              :         private:
     227              :                 bool m_bNonRegularGrid;
     228              :         //      bool m_bCurrElemIsHSlave;
     229              : };
     230              : 
     231              : } // namespace ug
     232              : 
     233              : #include "lagrange_dirac_source_impl.h"
     234              : 
     235              : 
     236              : #endif /*__H__UG__LIB_DISC__SPACIAL_DISCRETIZATION__ELEM_DISC__DIRAC_SOURCE__LAGRANGE_DIRAC_SOURCE__*/
        

Generated by: LCOV version 2.0-1