LCOV - code coverage report
Current view: top level - ugbase/lib_disc/spatial_disc/user_data/linker - inverse_linker.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 3 0
Test Date: 2025-09-21 23:31:46 Functions: 0.0 % 6 0

            Line data    Source code
       1              : /*
       2              :  * Copyright (c) 2013-2015:  G-CSC, Goethe University Frankfurt
       3              :  * Authors: Ivo Muha, 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              : /*
      34              :  * andreasvogel used scale_add_linker ass template
      35              :  */
      36              : 
      37              : #ifndef __H__UG__LIB_DISC__SPATIAL_DISC__INVERSE_LINKER__
      38              : #define __H__UG__LIB_DISC__SPATIAL_DISC__INVERSE_LINKER__
      39              : 
      40              : #include "linker.h"
      41              : 
      42              : namespace ug{
      43              : 
      44              : 
      45              : ////////////////////////////////////////////////////////////////////////////////
      46              : // Scaled adding of Data
      47              : ////////////////////////////////////////////////////////////////////////////////
      48              : 
      49              : /**
      50              :  * This linker recombines the data like
      51              :  *
      52              :  * l = a / b
      53              :  *
      54              :  * \tparam              dim                     world dimension
      55              :  * \tparam              TDataScale      type of scaling data
      56              :  */
      57              : template <int dim>
      58              : class InverseLinker
      59              :         : public StdDataLinker<InverseLinker<dim>, number, dim>
      60              : {
      61              :         public:
      62              :         //      type of base class
      63              :                 typedef StdDataLinker<InverseLinker<dim>, number, dim> base_type;
      64              : 
      65              :         public:
      66              :         ///     constructor
      67            0 :                 InverseLinker() {}
      68              : 
      69              :         ///     constructor
      70              :                 InverseLinker(const InverseLinker& linker);
      71              : 
      72              :                 void divide(SmartPtr<CplUserData<number, dim> > dividend,
      73              :                          SmartPtr<CplUserData<number, dim> > divisor);
      74              :                 void divide(number dividend,
      75              :                          SmartPtr<CplUserData<number, dim> > divisor);
      76              :                 void divide(SmartPtr<CplUserData<number, dim> > dividend,
      77              :                          number divisor);
      78              :                 void divide(number dividend,
      79              :                          number divisor);
      80              : 
      81              :                 inline void evaluate (number& value,
      82              :                                       const MathVector<dim>& globIP,
      83              :                                       number time, int si) const;
      84              : 
      85              :                 template <int refDim>
      86              :                 inline void evaluate(number vValue[],
      87              :                                      const MathVector<dim> vGlobIP[],
      88              :                                      number time, int si,
      89              :                                      GridObject* elem,
      90              :                                      const MathVector<dim> vCornerCoords[],
      91              :                                      const MathVector<refDim> vLocIP[],
      92              :                                      const size_t nip,
      93              :                                      LocalVector* u,
      94              :                                      const MathMatrix<refDim, dim>* vJT = NULL) const;
      95              : 
      96              :                 template <int refDim>
      97              :                 void eval_and_deriv(number vValue[],
      98              :                                     const MathVector<dim> vGlobIP[],
      99              :                                     number time, int si,
     100              :                                     GridObject* elem,
     101              :                                     const MathVector<dim> vCornerCoords[],
     102              :                                     const MathVector<refDim> vLocIP[],
     103              :                                     const size_t nip,
     104              :                                     LocalVector* u,
     105              :                                     bool bDeriv,
     106              :                                     int s,
     107              :                                     std::vector<std::vector<number> > vvvDeriv[],
     108              :                                     const MathMatrix<refDim, dim>* vJT = NULL) const;
     109              : 
     110              :         protected:
     111              :         ///     divisor at ip of input
     112              :                 const number& divisor_value(size_t i, size_t s, size_t ip) const
     113              :                 {
     114              :                         UG_ASSERT(i < m_vpDivisorData.size(), "Input not needed");
     115              :                         UG_ASSERT(m_vpDivisorData[i].valid(), "Input invalid");
     116              :                         return m_vpDivisorData[i]->value(this->series_id(2*i,s), ip);
     117              :                 }
     118              : 
     119              :         ///     divisor of data at input at ip
     120              :                 const number& divisor_deriv(size_t i, size_t s, size_t ip, size_t fct, size_t dof) const
     121              :                 {
     122              :                         UG_ASSERT(i < m_vpDependData.size(), "Input not needed");
     123              :                         UG_ASSERT(m_vpDependData[i].valid(), "Input invalid");
     124              :                         return m_vpDependData[i]->deriv(this->series_id(2*i,s), ip, fct, dof);
     125              :                 }
     126              : 
     127              :         ///     dividend at ip of input
     128              :                 const number& dividend_value(size_t i, size_t s, size_t ip) const
     129              :                 {
     130              :                         UG_ASSERT(i < m_vpDividendData.size(), "Input not needed");
     131              :                         UG_ASSERT(m_vpDividendData[i].valid(), "Input invalid");
     132              :                         return m_vpDividendData[i]->value(this->series_id(2*i+1,s), ip);
     133              :                 }
     134              : 
     135              :         ///     derivative of dividend at input at ip
     136            0 :                 const number& dividend_deriv(size_t i, size_t s, size_t ip, size_t fct, size_t dof) const
     137              :                 {
     138              :                         UG_ASSERT(i < m_vpDividendDependData.size(), "Input not needed");
     139              :                         UG_ASSERT(m_vpDividendDependData[i].valid(), "Input invalid");
     140            0 :                         return m_vpDividendDependData[i]->deriv(this->series_id(2*i+1,s), ip, fct, dof);
     141              :                 }
     142              : 
     143              :         ///     returns number of functions the divisor depends on
     144              :                 size_t divisor_num_fct(size_t i) const {return base_type::input_num_fct(2*i);}
     145              : 
     146              :         ///     returns the number in the common FctGrp for a fct of an divisor
     147              :                 size_t divisor_common_fct(size_t i, size_t fct) const   {return base_type::input_common_fct(2*i, fct);}
     148              : 
     149              :         ///     returns number of functions the dividend depends on
     150              :                 size_t dividend_num_fct(size_t i) const {return base_type::input_num_fct(2*i+1);}
     151              : 
     152              :         ///     returns the number in the common FctGrp for a fct of a dividend
     153              :                 size_t dividend_common_fct(size_t i, size_t fct) const  {return base_type::input_common_fct(2*i+1, fct);}
     154              : 
     155              :         protected:
     156              :         ///     data Dividend
     157              :                 std::vector<SmartPtr<CplUserData<number, dim> > > m_vpDividendData;
     158              : 
     159              :         ///     data Dividend casted to dependend data
     160              :                 std::vector<SmartPtr<DependentUserData<number, dim> > > m_vpDividendDependData;
     161              : 
     162              :         ///     data Divisor
     163              :                 std::vector<SmartPtr<CplUserData<number, dim> > > m_vpDivisorData;
     164              : 
     165              :         ///     data Divisor casted to dependend data
     166              :                 std::vector<SmartPtr<DependentUserData<number, dim> > > m_vpDependData;
     167              : };
     168              : 
     169              : } // end namespace ug
     170              : 
     171              : #include "inverse_linker_impl.h"
     172              : 
     173              : #endif /* __H__UG__LIB_DISC__SPATIAL_DISC__INVERSE_LINKER__ */
        

Generated by: LCOV version 2.0-1