GCC Code Coverage Report


Directory: ../../../builds/dumux-repositories/
File: /builds/dumux-repositories/dumux/dumux/discretization/nonconformingfecache.hh
Date: 2024-05-04 19:09:25
Exec Total Coverage
Lines: 8 9 88.9%
Functions: 3 4 75.0%
Branches: 9 38 23.7%

Line Branch Exec Source
1 // -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 // vi: set et ts=4 sw=4 sts=4:
3 //
4 // SPDX-FileCopyrightInfo: Copyright © DuMux Project contributors, see AUTHORS.md in root folder
5 // SPDX-License-Identifier: GPL-3.0-or-later
6 //
7 /*!
8 * \file
9 * \ingroup Discretization
10 * \brief A finite element cache for the non-conforming FE spaces RT and CR
11 */
12 #ifndef DUMUX_DISCRETIZATION_NONCONFORMING_FECACHE_HH
13 #define DUMUX_DISCRETIZATION_NONCONFORMING_FECACHE_HH
14
15 #include <memory>
16
17 #include <dune/common/exceptions.hh>
18 #include <dune/geometry/type.hh>
19
20 #include <dune/localfunctions/crouzeixraviart.hh>
21 #include <dune/localfunctions/rannacherturek.hh>
22 #include <dune/localfunctions/common/virtualinterface.hh>
23 #include <dune/localfunctions/common/virtualwrappers.hh>
24
25 namespace Dumux {
26
27 template< class CoordScalar, class Scalar, unsigned int dim>
28 class NonconformingFECache
29 {
30 static_assert(dim == 2 || dim == 3, "Non-conforming FE spaces only implemented for 2D and 3D grids");
31
32 // These are so-called non-conforming finite element spaces
33 // the local basis is only continuous at given points on the faces
34 using RT = Dune::RannacherTurekLocalFiniteElement<CoordScalar, Scalar, dim>;
35 using CR = Dune::CrouzeixRaviartLocalFiniteElement<CoordScalar, Scalar, dim>;
36
37 public:
38 using FiniteElementType = Dune::LocalFiniteElementVirtualInterface<typename RT::Traits::LocalBasisType::Traits>;
39
40 42 NonconformingFECache()
41 : rtBasis_(std::make_unique<Dune::LocalFiniteElementVirtualImp<RT>>(RT{}))
42
7/18
✓ Branch 2 taken 40 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 40 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 40 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 40 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 40 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 40 times.
✗ Branch 16 not taken.
✓ Branch 17 taken 40 times.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
84 , crBasis_(std::make_unique<Dune::LocalFiniteElementVirtualImp<CR>>(CR{}))
43 42 {}
44
45 //! Get local finite element for given GeometryType
46 38433318 const FiniteElementType& get(const Dune::GeometryType& gt) const
47 {
48
1/2
✓ Branch 0 taken 36968116 times.
✗ Branch 1 not taken.
38433318 if (gt.isSimplex())
49 17233724 return *crBasis_;
50
1/2
✓ Branch 0 taken 28725818 times.
✗ Branch 1 not taken.
29816456 else if (gt.isCube())
51 59632912 return *rtBasis_;
52 else
53 DUNE_THROW(Dune::NotImplemented,
54 "Non-conforming local finite element for geometry type " << gt
55 );
56 }
57
58 private:
59 std::unique_ptr<FiniteElementType> rtBasis_;
60 std::unique_ptr<FiniteElementType> crBasis_;
61 };
62
63 } // end namespace Dumux
64
65 #endif
66