LCOV - code coverage report
Current view: top level - ugbase/lib_disc/local_finite_element/piecewise_constant - piecewise_constant.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 9 0
Test Date: 2025-09-21 23:31:46 Functions: 0.0 % 8 0

            Line data    Source code
       1              : /*
       2              :  * Copyright (c) 2012-2015:  G-CSC, Goethe University Frankfurt
       3              :  * Author: Christian Wehner
       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 __H__UG__LIB_DISC__LOCAL_SHAPE_FUNCTION_SET__PIECEWISE_CONSTANT__
      34              : #define __H__UG__LIB_DISC__LOCAL_SHAPE_FUNCTION_SET__PIECEWISE_CONSTANT__
      35              : 
      36              : #include "common/util/provider.h"
      37              : #include "lib_grid/grid/grid_base_objects.h"
      38              : #include "lib_disc/local_finite_element/local_dof_set.h"
      39              : #include "lib_disc/reference_element/reference_element_util.h"
      40              : 
      41              : namespace ug{
      42              : 
      43              : /// Elementwise constant shape functions
      44              : template <typename TRefElem>
      45              : class PiecewiseConstantLSFS
      46              :         : public BaseLSFS<PiecewiseConstantLSFS<TRefElem>, TRefElem::dim>
      47              : {
      48              :         public:
      49              :         ///     Dimension, where shape functions are defined
      50              :                 static const int dim = TRefElem::dim;
      51              : 
      52              :         public:
      53              :         ///     Constructor
      54            0 :                 PiecewiseConstantLSFS()
      55              :                 {
      56            0 :                         const TRefElem& rRef = Provider<TRefElem>::get();
      57              : 
      58              :                         bary = rRef.corner(0);
      59            0 :             for (size_t j=1; j < rRef.num(0); ++j){
      60              :                 bary += rRef.corner(j);
      61              :             }
      62            0 :             bary *= 1./rRef.num(0);
      63              : 
      64            0 :             m_vLocalDoF = LocalDoF(dim, 0, 0);
      65            0 :                 }
      66              : 
      67              :         public:
      68              :         ///     \copydoc ug::DimLocalDoFSet::roid()
      69              :                 ReferenceObjectID roid() const {return TRefElem::REFERENCE_OBJECT_ID;}
      70              : 
      71              :         ///     \copydoc ug::DimLocalDoFSet::num_dof()
      72              :                 size_t num_dof() const {return 1;};
      73              : 
      74              :         ///     \copydoc ug::DimLocalDoFSet::num_dof()
      75              :                 size_t num_dof(ReferenceObjectID type) const
      76              :                 {
      77            0 :                         if (type == TRefElem::REFERENCE_OBJECT_ID)   return 1;
      78            0 :                         else return 0;
      79              :                 }
      80              : 
      81              :         ///     \copydoc ug::DimLocalDoFSet::local_dof()
      82            0 :                 const LocalDoF& local_dof(size_t dof) const {return m_vLocalDoF;}
      83              : 
      84              :         ///     \copydoc ug::DimLocalDoFSet::position()
      85              :                 inline bool position(size_t i, MathVector<dim>& pos) const
      86              :                 {
      87              :                         pos = bary; return true;
      88              :                 }
      89              : 
      90              :         ///     \copydoc ug::DimLocalDoFSet::exact_position_available()
      91              :                 bool exact_position_available() const {return true;};
      92              : 
      93              :         public:
      94              :         ///     \copydoc ug::LocalShapeFunctionSet::continuous()
      95              :                 bool continuous() const {return false;}
      96              : 
      97              :         ///     \copydoc ug::LocalShapeFunctionSet::num_sh()
      98              :                 size_t num_sh() const {return 1;}
      99              : 
     100              :         ///     \copydoc ug::LocalShapeFunctionSet::shape()
     101              :                 number shape(const size_t i, const MathVector<dim>& x) const
     102              :                 {
     103              :                         return 1;
     104              :                 }
     105              : 
     106              :         ///     \copydoc ug::LocalShapeFunctionSet::shape()
     107              :                 void grad(MathVector<dim>& g, const size_t i, const MathVector<dim>& x) const
     108              :                 {
     109              :                         TRefElem::check_position(x);
     110              :                         VecSet(g, 0.0);
     111              :                 }
     112              : 
     113              :         protected:
     114              :                 MathVector<dim> bary; ///< Barycenter
     115              :                 LocalDoF m_vLocalDoF; ///< association to elements
     116              : };
     117              : 
     118              : } //namespace ug
     119              : 
     120              : #endif /* __H__UG__LIB_DISC__LOCAL_SHAPE_FUNCTION_SET__PIECEWISE_CONSTANT__ */
     121              : 
        

Generated by: LCOV version 2.0-1