Debian Codegraph @

dune/localfunctions/test/test-finiteelementcache.cc

raw
1 // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 // vi: set et ts=4 sw=2 sts=2:
3 // SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file LICENSE.md in module root
4 // SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
5
6 #include <utility>
7
8 #include <dune/common/hybridutilities.hh>
9
10 #include <dune/geometry/type.hh>
11
12 #include <dune/localfunctions/lagrange/pqkfactory.hh>
13 #include <dune/localfunctions/dualmortarbasis/dualpq1factory.hh>
14 #include <dune/localfunctions/raviartthomas/raviartthomaslfecache.hh>
15 #include <dune/localfunctions/lagrange/lagrangelfecache.hh>
16
17 template<class FiniteElementCache>
18 static void test(Dune::GeometryType type)
19 {
20 FiniteElementCache cache;
21 FiniteElementCache copy = cache;
22 FiniteElementCache move = std::move(copy);
23 copy = move;
24 move = std::move(copy);
25
26
27 using FiniteElement = typename FiniteElementCache::FiniteElementType;
28 [[maybe_unused]] const FiniteElement& finiteElement = cache.get(type);
29 }
30
31 int main() {
32 static constexpr std::size_t max_k = 3;
33 Dune::Hybrid::forEach(std::make_index_sequence<max_k+1>{},[&](auto k)
34 {
35 constexpr int dim = 2;
36 using FiniteElementCache = typename
37 Dune::LagrangeLocalFiniteElementCache<double, double, dim, k>;
38 test<FiniteElementCache>(Dune::GeometryTypes::simplex(dim));
39 test<FiniteElementCache>(Dune::GeometryTypes::cube(dim));
40 });
41 {
42 constexpr int dim = 2;
43 using FiniteElementCache = typename
44 Dune::DualPQ1LocalFiniteElementCache<double, double, dim>;
45 test<FiniteElementCache>(Dune::GeometryTypes::simplex(dim));
46 test<FiniteElementCache>(Dune::GeometryTypes::cube(dim));
47 }
48
49 {
50 constexpr int dim = 2;
51 constexpr int order = 0;
52 using FiniteElementCache = typename
53 Dune::RaviartThomasLocalFiniteElementCache<double, double, dim, order>;
54 test<FiniteElementCache>(Dune::GeometryTypes::simplex(dim));
55 test<FiniteElementCache>(Dune::GeometryTypes::cube(dim));
56 }
57
58 {
59 constexpr int dim = 2;
60 constexpr int order = 1;
61 using FiniteElementCache = typename
62 Dune::RaviartThomasLocalFiniteElementCache<double, double, dim, order>;
63 test<FiniteElementCache>(Dune::GeometryTypes::simplex(dim));
64 test<FiniteElementCache>(Dune::GeometryTypes::cube(dim));
65 }
66
67 {
68 constexpr int dim = 3;
69 constexpr int order = 0;
70 using FiniteElementCache = typename
71 Dune::RaviartThomasLocalFiniteElementCache<double, double, dim, order>;
72 test<FiniteElementCache>(Dune::GeometryTypes::simplex(dim));
73 test<FiniteElementCache>(Dune::GeometryTypes::cube(dim));
74 }
75
76 return 0;
77 }