Dune Core Modules (2.9.0)

typefromvertexcount.hh
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 (C) DUNE Project contributors, see file LICENSE.md in module root
4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
5#ifndef DUNE_GEOMETRY_TYPE_FROM_VERTEX_COUNT_HH
6#define DUNE_GEOMETRY_TYPE_FROM_VERTEX_COUNT_HH
7
9
10namespace Dune {
11
16 inline
17 GeometryType geometryTypeFromVertexCount(unsigned int dim, unsigned int vertices)
18 {
19 switch (dim)
20 {
21 case 0 :
23 case 1 :
25 case 2 :
26 switch (vertices) {
27 case 3 :
29 case 4 :
31 default :
32 DUNE_THROW(NotImplemented, "2d elements with " << vertices << " corners are not supported!");
33 }
34 case 3 :
35 switch (vertices) {
36 case 4 :
38 case 5 :
40 case 6 :
42 case 8 :
44 default :
45 DUNE_THROW(NotImplemented, "3d elements with " << vertices << " corners are not supported!");
46 }
47 default :
48 DUNE_THROW(NotImplemented, "geometryTypeFromVertexCount works only up to dim=3");
49 }
50 }
51
52}
53
54#endif // DUNE_GEOMETRY_TYPE_FROM_VERTEX_COUNT_HH
Unique label for each type of entities that can occur in DUNE grids.
Definition: type.hh:125
Default exception for dummy implementations.
Definition: exceptions.hh:263
#define DUNE_THROW(E, m)
Definition: exceptions.hh:218
constexpr GeometryType line
GeometryType representing a line.
Definition: type.hh:512
constexpr GeometryType prism
GeometryType representing a 3D prism.
Definition: type.hh:542
constexpr GeometryType triangle
GeometryType representing a triangle.
Definition: type.hh:518
constexpr GeometryType quadrilateral
GeometryType representing a quadrilateral (a square).
Definition: type.hh:524
constexpr GeometryType hexahedron
GeometryType representing a hexahedron.
Definition: type.hh:548
constexpr GeometryType pyramid
GeometryType representing a 3D pyramid.
Definition: type.hh:536
constexpr GeometryType tetrahedron
GeometryType representing a tetrahedron.
Definition: type.hh:530
constexpr GeometryType vertex
GeometryType representing a vertex.
Definition: type.hh:506
Dune namespace.
Definition: alignedallocator.hh:13
GeometryType geometryTypeFromVertexCount(unsigned int dim, unsigned int vertices)
Utitlity function to construct the correct geometry type given the dimension and the number of vertic...
Definition: typefromvertexcount.hh:17
A unique label for each type of element that can occur in a grid.
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Jul 15, 22:36, 2024)