dune-grid 2.9.0
vertexorderfactory.hh
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
4// vi: set et ts=4 sw=2 sts=2:
5
6#ifndef DUNE_GRID_UTILITY_VERTEXORDERFACTORY_HH
7#define DUNE_GRID_UTILITY_VERTEXORDERFACTORY_HH
8
9#include <algorithm>
10#include <cstddef>
11#include <functional>
12#include <vector>
13
14#include <dune/geometry/referenceelements.hh>
15#include <dune/geometry/generalvertexorder.hh>
16
17namespace Dune {
18
20
31 template<class IdSet, class Index = std::size_t>
33 const IdSet& idset;
34
35 public:
37 template<std::size_t dim>
38 struct VertexOrder {
40 typedef GeneralVertexOrder<dim, Index> type;
41 };
42
44
53 VertexOrderByIdFactory(const IdSet &idset_) : idset(idset_) { }
54
56
62 template<typename Element>
64 make(const Element &e) const {
65
66 std::size_t size = referenceElement(e.geometry()).size(Element::mydimension);
67
68 std::vector<typename IdSet::IdType> ids(size);
69 for(std::size_t i = 0; i < size; ++i)
70 ids[i] = idset.subId(e, i, Element::mydimension);
71 return GeneralVertexOrder<Element::mydimension, Index>
72 (e.type(), ids.begin(), ids.end());
73 }
74 };
75
76} // namespace Dune
77
78#endif // DUNE_GRID_UTILITY_VERTEXORDERFACTORY_HH
Include standard header files.
Definition: agrid.hh:60
auto referenceElement(const Geometry< mydim, cdim, GridImp, GeometryImp > &geo) -> decltype(referenceElement(geo, geo.impl()))
Definition: common/geometry.hh:558
ALBERTA EL Element
Definition: misc.hh:54
Id Set Interface.
Definition: indexidset.hh:452
IdType subId(const typename Codim< 0 >::Entity &e, int i, unsigned int codim) const
Get id of subentity i of co-dimension codim of a co-dimension 0 entity.
Definition: indexidset.hh:486
Factory for GeneralVertexOrder objects using an IdSet.
Definition: vertexorderfactory.hh:32
VertexOrderByIdFactory(const IdSet &idset_)
construct a factory object
Definition: vertexorderfactory.hh:53
VertexOrder< Element::mydimension >::type make(const Element &e) const
construct a vertex ordering object
Definition: vertexorderfactory.hh:64
type of vertex order object may depend on the dimension of the element
Definition: vertexorderfactory.hh:38
GeneralVertexOrder< dim, Index > type
type of vertex order object
Definition: vertexorderfactory.hh:40