diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a1bf8b1..98611ac4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception # Master (will become release 2.9) +* The implementation of the Raviart-Thomas element now also includes 0th order shape functions on prisms and pyramids. + ## Deprecations and removals - Deprecated many of the Lagrange headers, use diff --git a/dune/localfunctions/raviartthomas.hh b/dune/localfunctions/raviartthomas.hh index 4e49f9a4..d3cdb863 100644 --- a/dune/localfunctions/raviartthomas.hh +++ b/dune/localfunctions/raviartthomas.hh @@ -19,5 +19,7 @@ #include #include #include +#include +#include #endif // #ifndef DUNE_RAVIARTTHOMASFINITEELEMENT_HH diff --git a/dune/localfunctions/raviartthomas/CMakeLists.txt b/dune/localfunctions/raviartthomas/CMakeLists.txt index f02a4650..f2187536 100644 --- a/dune/localfunctions/raviartthomas/CMakeLists.txt +++ b/dune/localfunctions/raviartthomas/CMakeLists.txt @@ -12,6 +12,8 @@ add_subdirectory(raviartthomas2cube2d) add_subdirectory(raviartthomas3cube2d) add_subdirectory(raviartthomas4cube2d) add_subdirectory(raviartthomassimplex) +add_subdirectory(raviartthomas0pyramid) +add_subdirectory(raviartthomas0prism) install(FILES raviartthomas02d.hh @@ -27,4 +29,6 @@ install(FILES raviartthomascube.hh raviartthomaslfecache.hh raviartthomassimplex.hh + raviartthomas0pyramid.hh + raviartthomas0prism.hh DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/dune/localfunctions/raviartthomas) diff --git a/dune/localfunctions/raviartthomas/raviartthomas0prism.hh b/dune/localfunctions/raviartthomas/raviartthomas0prism.hh new file mode 100644 index 00000000..282d8740 --- /dev/null +++ b/dune/localfunctions/raviartthomas/raviartthomas0prism.hh @@ -0,0 +1,82 @@ +// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- +// vi: set et ts=4 sw=2 sts=2: +// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root +// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception +#ifndef DUNE_LOCALFUNCTIONS_RAVIARTTHOMAS0_PRISM_HH +#define DUNE_LOCALFUNCTIONS_RAVIARTTHOMAS0_PRISM_HH + +#include + +#include "../common/localfiniteelementtraits.hh" +#include "raviartthomas0prism/raviartthomas0prismlocalbasis.hh" +#include "raviartthomas0prism/raviartthomas0prismlocalcoefficients.hh" +#include "raviartthomas0prism/raviartthomas0prismlocalinterpolation.hh" + +namespace Dune +{ + /** + * \brief First order Raviart-Thomas shape functions on prisms. + * + * \ingroup RaviartThomas + * + * \tparam D Type to represent the field in the domain. + * \tparam R Type to represent the field in the range. + */ + template + class RT0PrismLocalFiniteElement + { + + public: + typedef LocalFiniteElementTraits< + RT0PrismLocalBasis, + RT0PrismLocalCoefficients, + RT0PrismLocalInterpolation > > Traits; + + + //! \brief Standard constructor + RT0PrismLocalFiniteElement () + {} + + /** + * \brief Make set number s, where 0 <= s < 32 + * + * \param s Face orientation indicator + */ + RT0PrismLocalFiniteElement (int s) : + basis(s), + interpolation(s) + {} + + const typename Traits::LocalBasisType& localBasis () const + { + return basis; + } + + const typename Traits::LocalCoefficientsType& localCoefficients () const + { + return coefficients; + } + + const typename Traits::LocalInterpolationType& localInterpolation () const + { + return interpolation; + } + + /** \brief Number of shape functions in this finite element */ + unsigned int size () const + { + return basis.size(); + } + + static constexpr GeometryType type () + { + return GeometryTypes::prism; + } + + private: + RT0PrismLocalBasis basis; + RT0PrismLocalCoefficients coefficients; + RT0PrismLocalInterpolation > interpolation; + }; +} +#endif // DUNE_LOCALFUNCTIONS_RAVIARTTHOMAS0_PRISM_HH diff --git a/dune/localfunctions/raviartthomas/raviartthomas0prism/CMakeLists.txt b/dune/localfunctions/raviartthomas/raviartthomas0prism/CMakeLists.txt new file mode 100644 index 00000000..0be568f1 --- /dev/null +++ b/dune/localfunctions/raviartthomas/raviartthomas0prism/CMakeLists.txt @@ -0,0 +1,8 @@ +# SPDX-FileCopyrightText: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root +# SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception + +install(FILES + raviartthomas0prismlocalbasis.hh + raviartthomas0prismlocalcoefficients.hh + raviartthomas0prismlocalinterpolation.hh + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/dune/localfunctions/raviartthomas/raviartthomas0prism) diff --git a/dune/localfunctions/raviartthomas/raviartthomas0prism/raviartthomas0prismlocalbasis.hh b/dune/localfunctions/raviartthomas/raviartthomas0prism/raviartthomas0prismlocalbasis.hh new file mode 100644 index 00000000..65fb7560 --- /dev/null +++ b/dune/localfunctions/raviartthomas/raviartthomas0prism/raviartthomas0prismlocalbasis.hh @@ -0,0 +1,129 @@ +// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- +// vi: set et ts=4 sw=2 sts=2: +// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root +// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception +#ifndef DUNE_LOCALFUNCTIONS_RAVIARTTHOMAS0_PRISM_LOCALBASIS_HH +#define DUNE_LOCALFUNCTIONS_RAVIARTTHOMAS0_PRISM_LOCALBASIS_HH + +#include +#include + +#include + +#include "../../common/localbasis.hh" + +namespace Dune +{ + /** + * \ingroup LocalBasisImplementation + * \brief First order Raviart-Thomas shape functions on the reference prism. + * + * \tparam D Type to represent the field in the domain. + * \tparam R Type to represent the field in the range. + * + * \nosubgrouping + */ + template + class RT0PrismLocalBasis + { + + public: + typedef LocalBasisTraits,R,3,Dune::FieldVector, + Dune::FieldMatrix > Traits; + + /** + * \brief Make set number s, where 0 <= s < 32 + * + * \param s Edge orientation indicator + */ + RT0PrismLocalBasis (std::bitset<5> s = 0) + { + for (size_t i=0; i& out) const + { + out.resize(5); + + out[0] = { in[0], -1.0 + in[1], 0.0}; + + out[1] = { -1.0 + in[0], in[1], 0.0}; + + out[2] = { in[0], in[1], 0.0}; + + out[3] = { 0.0, 0.0, -2.0 + 2.0*in[2]}; + + out[4] = { 0.0, 0.0, 2.0*in[2]}; + + for (std::size_t i=0; i& out) const + { + out.resize(5); + + for(int i=0; i& order, + const typename Traits::DomainType& in, // position + std::vector& out) const // return value + { + auto totalOrder = std::accumulate(order.begin(), order.end(), 0); + if (totalOrder == 0) { + evaluateFunction(in, out); + } else { + DUNE_THROW(NotImplemented, "Desired derivative order is not implemented"); + } + } + + //! \brief Polynomial order of the shape functions + unsigned int order () const + { + return 1; + } + + private: + std::array sign; + }; +} +#endif // DUNE_LOCALFUNCTIONS_RAVIARTTHOMAS0_PRISM_LOCALBASIS_HH diff --git a/dune/localfunctions/raviartthomas/raviartthomas0prism/raviartthomas0prismlocalcoefficients.hh b/dune/localfunctions/raviartthomas/raviartthomas0prism/raviartthomas0prismlocalcoefficients.hh new file mode 100644 index 00000000..3f051e45 --- /dev/null +++ b/dune/localfunctions/raviartthomas/raviartthomas0prism/raviartthomas0prismlocalcoefficients.hh @@ -0,0 +1,50 @@ +// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- +// vi: set et ts=4 sw=2 sts=2: +// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root +// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception +#ifndef DUNE_LOCALFUNCTIONS_RAVIARTTHOMAS0_PRISM_LOCALCOEFFICIENTS_HH +#define DUNE_LOCALFUNCTIONS_RAVIARTTHOMAS0_PRISM_LOCALCOEFFICIENTS_HH + +#include +#include + +#include "../../common/localkey.hh" + +namespace Dune +{ + + /** + * \ingroup LocalLayoutImplementation + * \brief Layout map for Raviart-Thomas-1 elements on prisms. + * + * \nosubgrouping + * \implements Dune::LocalCoefficientsVirtualImp + */ + class RT0PrismLocalCoefficients + { + + public: + //! \brief Standard constructor + RT0PrismLocalCoefficients () : li(size()) + { + for(int i=0; i< size(); i++) + li[i] = LocalKey(i,1,0); + } + + //! \brief number of coefficients + std::size_t size () const + { + return 5; + } + + //! \brief get i'th index + const LocalKey& localKey (std::size_t i) const + { + return li[i]; + } + + private: + std::vector li; + }; +} +#endif // DUNE_LOCALFUNCTIONS_RAVIARTTHOMAS0_PRISM_LOCALCOEFFICIENTS_HH diff --git a/dune/localfunctions/raviartthomas/raviartthomas0prism/raviartthomas0prismlocalinterpolation.hh b/dune/localfunctions/raviartthomas/raviartthomas0prism/raviartthomas0prismlocalinterpolation.hh new file mode 100644 index 00000000..205c8bc2 --- /dev/null +++ b/dune/localfunctions/raviartthomas/raviartthomas0prism/raviartthomas0prismlocalinterpolation.hh @@ -0,0 +1,91 @@ +// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- +// vi: set et ts=4 sw=2 sts=2: +// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root +// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception +#ifndef DUNE_LOCALFUNCTIONS_RAVIARTTHOMAS0_PRISM_LOCALINTERPOLATION_HH +#define DUNE_LOCALFUNCTIONS_RAVIARTTHOMAS0_PRISM_LOCALINTERPOLATION_HH + +#include + +#include + +namespace Dune +{ + /** + * \ingroup LocalInterpolationImplementation + * \brief First order Raviart-Thomas shape functions on the reference prism. + * + * \tparam LB corresponding LocalBasis giving traits + * + * \nosubgrouping + */ + template + class RT0PrismLocalInterpolation + { + + public: + + /** + * \brief Make set number s, where 0 <= s < 32 + * + * \param s Face orientation indicator + */ + RT0PrismLocalInterpolation (std::bitset<5> s = 0) + { + typedef typename LB::Traits::RangeFieldType Scalar; + + for (size_t i=0; i<5; i++) + sign[i] = (s[i]) ? -1.0 : 1.0; + + Scalar r = 1/std::sqrt(2); + + n[0] = { 0.0, -1.0, 0.0}; + n[1] = {-1.0, 0.0, 0.0}; + n[2] = { r, r, 0.0}; + n[3] = { 0.0, 0.0, -1.0}; + n[4] = { 0.0, 0.0, 1.0}; + + c[0] = 1.0; + c[1] = 1.0; + c[2] = std::sqrt(2); + c[3] = 1/2.0; + c[4] = 1/2.0; + + m[0] = { 0.5, 0.0, 0.5}; + m[1] = { 0.0, 0.5, 0.5}; + m[2] = { 0.5, 0.5, 0.5}; + m[3] = { 1/3.0, 1/3.0, 0.0}; + m[4] = { 1/3.0, 1/3.0, 1.0}; + } + + /** + * \brief Interpolate a given function with shape functions + * + * \tparam F Function type for function which should be interpolated + * \tparam C Coefficient type + * \param ff function which should be interpolated + * \param out return value, vector of coefficients + */ + template + void interpolate (const F& ff, std::vector& out) const + { + auto&& f = Impl::makeFunctionWithCallOperator(ff); + + out.resize(5); + for(int i=0; i<5; i++) + out[i] = f(m[i]).dot(n[i]) * c[i] * sign[i]; + } + + private: + // Facet orientations + std::array sign; + // Facet area + std::array c; + + // Facet normals + std::array n; + // Facet midpoints + std::array m; + }; +} +#endif // DUNE_LOCALFUNCTIONS_RAVIARTTHOMAS0_PRISM_LOCALINTERPOLATION_HH diff --git a/dune/localfunctions/raviartthomas/raviartthomas0pyramid.hh b/dune/localfunctions/raviartthomas/raviartthomas0pyramid.hh new file mode 100644 index 00000000..1fa0804c --- /dev/null +++ b/dune/localfunctions/raviartthomas/raviartthomas0pyramid.hh @@ -0,0 +1,81 @@ +// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- +// vi: set et ts=4 sw=2 sts=2: +// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root +// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception +#ifndef DUNE_LOCALFUNCTIONS_RAVIARTTHOMAS0_PYRAMID_HH +#define DUNE_LOCALFUNCTIONS_RAVIARTTHOMAS0_PYRAMID_HH + +#include + +#include "../common/localfiniteelementtraits.hh" +#include "raviartthomas0pyramid/raviartthomas0pyramidlocalbasis.hh" +#include "raviartthomas0pyramid/raviartthomas0pyramidlocalcoefficients.hh" +#include "raviartthomas0pyramid/raviartthomas0pyramidlocalinterpolation.hh" + +namespace Dune +{ + /** + * \brief First order Raviart-Thomas shape functions on pyramids. + * + * \ingroup RaviartThomas + * + * \tparam D Type to represent the field in the domain. + * \tparam R Type to represent the field in the range. + */ + template + class RT0PyramidLocalFiniteElement + { + + public: + typedef LocalFiniteElementTraits< + RT0PyramidLocalBasis, + RT0PyramidLocalCoefficients, + RT0PyramidLocalInterpolation > > Traits; + + //! \brief Standard constructor + RT0PyramidLocalFiniteElement () + {} + + /** + * \brief Make set number s, where 0 <= s < 32 + * + * \param s Face orientation indicator + */ + RT0PyramidLocalFiniteElement (int s) : + basis(s), + interpolation(s) + {} + + const typename Traits::LocalBasisType& localBasis () const + { + return basis; + } + + const typename Traits::LocalCoefficientsType& localCoefficients () const + { + return coefficients; + } + + const typename Traits::LocalInterpolationType& localInterpolation () const + { + return interpolation; + } + + /** \brief Number of shape functions in this finite element */ + unsigned int size () const + { + return basis.size(); + } + + static constexpr GeometryType type () + { + return GeometryTypes::pyramid; + } + + private: + RT0PyramidLocalBasis basis; + RT0PyramidLocalCoefficients coefficients; + RT0PyramidLocalInterpolation > interpolation; + }; +} +#endif // DUNE_LOCALFUNCTIONS_RAVIARTTHOMAS0_PYRAMID_HH diff --git a/dune/localfunctions/raviartthomas/raviartthomas0pyramid/CMakeLists.txt b/dune/localfunctions/raviartthomas/raviartthomas0pyramid/CMakeLists.txt new file mode 100644 index 00000000..b68fe52e --- /dev/null +++ b/dune/localfunctions/raviartthomas/raviartthomas0pyramid/CMakeLists.txt @@ -0,0 +1,8 @@ +# SPDX-FileCopyrightText: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root +# SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception + +install(FILES + raviartthomas0pyramidlocalbasis.hh + raviartthomas0pyramidlocalcoefficients.hh + raviartthomas0pyramidlocalinterpolation.hh + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/dune/localfunctions/raviartthomas/raviartthomas0pyramid) diff --git a/dune/localfunctions/raviartthomas/raviartthomas0pyramid/raviartthomas0pyramidlocalbasis.hh b/dune/localfunctions/raviartthomas/raviartthomas0pyramid/raviartthomas0pyramidlocalbasis.hh new file mode 100644 index 00000000..d4084343 --- /dev/null +++ b/dune/localfunctions/raviartthomas/raviartthomas0pyramid/raviartthomas0pyramidlocalbasis.hh @@ -0,0 +1,131 @@ +// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- +// vi: set et ts=4 sw=2 sts=2: +// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root +// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception +#ifndef DUNE_LOCALFUNCTIONS_RAVIARTTHOMAS0_PYRAMID_LOCALBASIS_HH +#define DUNE_LOCALFUNCTIONS_RAVIARTTHOMAS0_PYRAMID_LOCALBASIS_HH + +#include +#include + +#include + +#include "../../common/localbasis.hh" + +namespace Dune +{ + /** + * \ingroup LocalBasisImplementation + * \brief First order Raviart-Thomas shape functions on the reference pyramid. + * + * \tparam D Type to represent the field in the domain. + * \tparam R Type to represent the field in the range. + * + * \nosubgrouping + */ + template + class RT0PyramidLocalBasis + { + + public: + typedef LocalBasisTraits,R,3,Dune::FieldVector, + Dune::FieldMatrix > Traits; + + /** + * \brief Make set number s, where 0 <= s < 32 + * + * \param s Edge orientation indicator + */ + RT0PyramidLocalBasis (std::bitset<5> s = 0) + { + for (size_t i=0; i& out) const + { + out.resize(5); + for (std::size_t i=0; i& out) const + { + out.resize(5); + + for(int i=0; i& order, + const typename Traits::DomainType& in, // position + std::vector& out) const // return value + { + auto totalOrder = std::accumulate(order.begin(), order.end(), 0); + if (totalOrder == 0) { + evaluateFunction(in, out); + } else { + DUNE_THROW(NotImplemented, "Desired derivative order is not implemented"); + } + } + + //! \brief Polynomial order of the shape functions + unsigned int order () const + { + return 1; + } + + private: + std::array sign; + }; +} +#endif // DUNE_LOCALFUNCTIONS_RAVIARTTHOMAS0_PYRAMID_LOCALBASIS_HH diff --git a/dune/localfunctions/raviartthomas/raviartthomas0pyramid/raviartthomas0pyramidlocalcoefficients.hh b/dune/localfunctions/raviartthomas/raviartthomas0pyramid/raviartthomas0pyramidlocalcoefficients.hh new file mode 100644 index 00000000..d62781a1 --- /dev/null +++ b/dune/localfunctions/raviartthomas/raviartthomas0pyramid/raviartthomas0pyramidlocalcoefficients.hh @@ -0,0 +1,50 @@ +// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- +// vi: set et ts=4 sw=2 sts=2: +// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root +// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception +#ifndef DUNE_LOCALFUNCTIONS_RAVIARTTHOMAS0_PYRAMID_LOCALCOEFFICIENTS_HH +#define DUNE_LOCALFUNCTIONS_RAVIARTTHOMAS0_PYRAMID_LOCALCOEFFICIENTS_HH + +#include +#include + +#include "../../common/localkey.hh" + +namespace Dune +{ + + /** + * \ingroup LocalLayoutImplementation + * \brief Layout map for Raviart-Thomas-1 elements on pyramids. + * + * \nosubgrouping + * \implements Dune::LocalCoefficientsVirtualImp + */ + class RT0PyramidLocalCoefficients + { + + public: + //! \brief Standard constructor + RT0PyramidLocalCoefficients () : li(size()) + { + for(int i=0; i< size(); i++) + li[i] = LocalKey(i,1,0); + } + + //! \brief number of coefficients + std::size_t size () const + { + return 5; + } + + //! \brief get i'th index + const LocalKey& localKey (std::size_t i) const + { + return li[i]; + } + + private: + std::vector li; + }; +} +#endif // DUNE_LOCALFUNCTIONS_RAVIARTTHOMAS0_PYRAMID_LOCALCOEFFICIENTS_HH diff --git a/dune/localfunctions/raviartthomas/raviartthomas0pyramid/raviartthomas0pyramidlocalinterpolation.hh b/dune/localfunctions/raviartthomas/raviartthomas0pyramid/raviartthomas0pyramidlocalinterpolation.hh new file mode 100644 index 00000000..c3815f17 --- /dev/null +++ b/dune/localfunctions/raviartthomas/raviartthomas0pyramid/raviartthomas0pyramidlocalinterpolation.hh @@ -0,0 +1,91 @@ +// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- +// vi: set et ts=4 sw=2 sts=2: +// SPDX-FileCopyrightInfo: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root +// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception +#ifndef DUNE_LOCALFUNCTIONS_RAVIARTTHOMAS0_PYRAMID_LOCALINTERPOLATION_HH +#define DUNE_LOCALFUNCTIONS_RAVIARTTHOMAS0_PYRAMID_LOCALINTERPOLATION_HH + +#include + +#include + +namespace Dune +{ + /** + * \ingroup LocalInterpolationImplementation + * \brief First order Raviart-Thomas shape functions on the reference hexahedron. + * + * \tparam LB corresponding LocalBasis giving traits + * + * \nosubgrouping + */ + template + class RT0PyramidLocalInterpolation + { + + public: + + /** + * \brief Make set number s, where 0 <= s < 32 + * + * \param s Face orientation indicator + */ + RT0PyramidLocalInterpolation (std::bitset<5> s = 0) + { + typedef typename LB::Traits::RangeFieldType Scalar; + + for (size_t i=0; i<5; i++) + sign[i] = (s[i]) ? -1.0 : 1.0; + + Scalar r = 1/std::sqrt(2); + + n[0] = { 0.0, 0.0, -1.0}; + n[1] = {-1.0, 0.0, 0.0}; + n[2] = { r, 0.0, r}; + n[3] = { 0.0, -1.0, 0.0}; + n[4] = { 0.0, r, r}; + + c[0] = 1.0; + c[1] = 1/2.0; + c[2] = 1/2.0 * std::sqrt(2); + c[3] = 1/2.0; + c[4] = 1/2.0 * std::sqrt(2); + + m[0] = { 0.5, 0.5, 0.0}; + m[1] = { 0.0, 1/3.0, 1/3.0}; + m[2] = { 2/3.0, 1/3.0, 1/3.0}; + m[3] = { 1/3.0, 0.0, 1/3.0}; + m[4] = { 1/3.0, 2/3.0, 1/3.0}; + } + + /** + * \brief Interpolate a given function with shape functions + * + * \tparam F Function type for function which should be interpolated + * \tparam C Coefficient type + * \param ff function which should be interpolated + * \param out return value, vector of coefficients + */ + template + void interpolate (const F& ff, std::vector& out) const + { + auto&& f = Impl::makeFunctionWithCallOperator(ff); + + out.resize(5); + for(int i=0; i<5; i++) + out[i] = f(m[i]).dot(n[i]) * c[i] * sign[i]; + } + + private: + // Facet orientations + std::array sign; + // Facet area + std::array c; + + // Facet normals + std::array n; + // Facet midpoints + std::array m; + }; +} +#endif // DUNE_LOCALFUNCTIONS_RAVIARTTHOMAS0_PYRAMID_LOCALINTERPOLATION_HH diff --git a/dune/localfunctions/test/raviartthomaselementtest.cc b/dune/localfunctions/test/raviartthomaselementtest.cc index 73df6cff..b4f02389 100644 --- a/dune/localfunctions/test/raviartthomaselementtest.cc +++ b/dune/localfunctions/test/raviartthomaselementtest.cc @@ -13,6 +13,7 @@ #include #include #include +#include #include @@ -141,6 +142,23 @@ int main(int argc, char** argv) TEST_FE(rt1cube3dlfemDedicated); } + Dune::RT0PyramidLocalFiniteElement rt0pyramidlfemDedicated; + TEST_FE(rt0pyramidlfemDedicated); + for (unsigned int s = 0; s < 32; s++) + { + Dune::RT0PyramidLocalFiniteElement rt0pyramidlfemDedicated(s); + TEST_FE(rt0pyramidlfemDedicated); + } + + Dune::RT0PrismLocalFiniteElement rt0prismlfemDedicated; + TEST_FE(rt0prismlfemDedicated); + for (unsigned int s = 0; s < 32; s++) + { + Dune::RT0PrismLocalFiniteElement rt0prismlfemDedicated(s); + TEST_FE(rt0prismlfemDedicated); + } + + // Test the RaviartThomasLocalFiniteElementCache Dune::RaviartThomasLocalFiniteElementCache lagrangeLFECache; TEST_FE(lagrangeLFECache.get(Dune::GeometryTypes::simplex(2)));