// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- // vi: set et ts=4 sw=2 sts=2: // SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file LICENSE.md in module root // SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception #ifndef DUNE_P0LOCALBASIS_HH #define DUNE_P0LOCALBASIS_HH #include #include #include namespace Dune { /** \brief Constant shape function Defines the constant scalar shape function in d dimensions. Is valid on any type of reference element. \tparam D Type to represent the field in the domain. \tparam R Type to represent the field in the range. \tparam d Domain dimension * \ingroup LagrangeImpl \nosubgrouping */ template class P0LocalBasis { public: //! \brief export type traits for function signature typedef LocalBasisTraits,R,1,Dune::FieldVector, Dune::FieldMatrix > Traits; //! \brief number of shape functions unsigned int size () const { return 1; } //! \brief Evaluate all shape functions inline void evaluateFunction (const typename Traits::DomainType&, std::vector& out) const { out.resize(1); out[0] = 1; } //! \brief Evaluate Jacobian of all shape functions inline void evaluateJacobian (const typename Traits::DomainType&, // position std::vector& out) const // return value { out.resize(1); for (int i=0; i& order, const typename Traits::DomainType& in, std::vector& out) const { auto totalOrder = std::accumulate(order.begin(), order.end(), 0); if (totalOrder == 0) { evaluateFunction(in, out); } else { out.resize(1); out[0] = 0; } } //! \brief Polynomial order of the shape functions unsigned int order () const { return 0; } }; } #endif