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

Generated by: LCOV version 2.0-1