Dune-Fufem 2.11-git
Loading...
Searching...
No Matches
dgindexset.hh
Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2// vi: set et ts=4 sw=2 sts=2:
3
4// SPDX-FileCopyrightText: Copyright © DUNE-FUFEM Project contributors, see file AUTHORS.md
5// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception OR LGPL-3.0-or-later
6
7#ifndef DUNE_FUFEM_DG_INDEX_SET_HH
8#define DUNE_FUFEM_DG_INDEX_SET_HH
9
10#warning This header is deprecated and will be removed after 2.11.
11
17#include <vector>
18
21
26template <class GridView>
27class
28[[deprecated("This class is deprecated and will be removed after 2.11.")]]
30
31public:
32
33 DGIndexSet(const GridView& gridView) : mapper_(gridView,Dune::mcmgLayout(Dune::Codim<1>()))
34 {
35 setup(gridView);
36 }
37
38 void setup(const GridView& gridView) {
39
40 mapper_.update(gridView);
41
42 const int dim = GridView::dimension;
43
44 // Compute the number of vertices for each face
45 faceOffsets_.resize(gridView.size(1) + 1);
46
47 for (const auto& e: elements(gridView)) {
48
49 auto refElement = Dune::ReferenceElements<typename GridView::ctype, dim>::general(e.type());
50
51 // Alternative without NeighborIterator
52 // Get the number of vertices for each face
53 for (int i=0; i<refElement.size(1); i++)
54 faceOffsets_[mapper_.subIndex(e, i, 1) + 1] = refElement.size(i,1,dim);
55
56 }
57
58 // Accumulate
59 faceOffsets_[0] = 0;
60 for (size_t i=1; i<faceOffsets_.size(); i++)
61 faceOffsets_[i] += faceOffsets_[i-1];
62 }
63
64 int size() const {
65 return faceOffsets_[faceOffsets_.size()-1];
66 }
67
68 int operator()(const typename GridView::template Codim<0>::Entity& element, int subFace) const {
69 return faceOffsets_[mapper_.subIndex(element, subFace, 1)];
70 }
71
73
75};
76
77#endif
size_type dim() const
An index set for first-order DG functions on the grid boundary.
Definition dgindexset.hh:29
std::vector< int > faceOffsets_
Definition dgindexset.hh:72
void setup(const GridView &gridView)
Definition dgindexset.hh:38
int operator()(const typename GridView::template Codim< 0 >::Entity &element, int subFace) const
Definition dgindexset.hh:68
DGIndexSet(const GridView &gridView)
Definition dgindexset.hh:33
Dune::MultipleCodimMultipleGeomTypeMapper< GridView > mapper_
Definition dgindexset.hh:74
int size() const
Definition dgindexset.hh:64