Dune Core Modules (2.9.0)

deprecated_topology.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_DEPRECATED_TOPOLOGY_HH
6#define DUNE_DEPRECATED_TOPOLOGY_HH
7
8 namespace Impl
9 {
10
11 // Basic Topology Types
12 // --------------------
13
14 // PointDeprecationHelper can be used to prevent a deprecation warning for Point
15 struct PointDeprecationHelper
16 {
17 static const unsigned int dimension = 0;
18 static const unsigned int numCorners = 1;
19
20 static const unsigned int id = 0;
21
22 static std::string name () { return "p"; }
23 };
24
25 using Point [[deprecated("Use GeometryTypes::vertex instead.")]] = PointDeprecationHelper;
26
27
28 template< class BaseTopology >
29 struct [[deprecated("Use GeometryTypes::prismaticExtension(GeometryType gt) instead.")]] Prism
30 {
31 static const unsigned int dimension = BaseTopology::dimension + 1;
32 static const unsigned int numCorners = 2 * BaseTopology::numCorners;
33
34 static const unsigned int id = BaseTopology::id | ((unsigned int)prismConstruction << (dimension-1));
35
36 static std::string name () { return BaseTopology::name() + "l"; }
37 };
38
39
40 template< class BaseTopology >
41 struct [[deprecated("Use GeometryTypes::conicalExtension(GeometryType gt) instead.")]] Pyramid
42 {
43 static const unsigned int dimension = BaseTopology::dimension + 1;
44 static const unsigned int numCorners = BaseTopology::numCorners + 1;
45
46 static const unsigned int id = BaseTopology::id | ((unsigned int)pyramidConstruction << (dimension-1));
47
48 static std::string name () { return BaseTopology::name() + "o"; }
49 };
50
51
52
53 // Properties of Topologies
54 // ------------------------
55
56 template< class Topology >
57 struct [[deprecated("Use GeometryType::isSimplex() instead.")]] IsSimplex
58 : public std::integral_constant< bool, (Topology::id >> 1) == 0 >
59 {};
60
61 template< class Topology >
62 struct [[deprecated("Use GeometryType::isCube() instead.")]] IsCube
63 : public std::integral_constant< bool, (Topology::id | 1) == (1 << Topology::dimension) - 1 >
64 {};
65
78 [[deprecated("Use GeometryType::isPrismatic() or GeometryType::isConical() instead.")]]
79 inline static bool isTopology ( TopologyConstruction construction, unsigned int topologyId, int dim, int codim = 0 ) noexcept
80 {
81 assert( (dim > 0) && (topologyId < numTopologies( dim )) );
82 assert( (0 <= codim) && (codim <= dim) );
83 return (codim >= (dim-1)) || (((topologyId >> (dim-codim-1)) & 1) == (unsigned int)construction);
84 }
85
86
87 // SimplexTopology
88 // ---------------
89
90 template< unsigned int dim >
91 struct [[deprecated("Use GeometryTypes::simplex(dim) instead.")]] SimplexTopology
92 {
93 typedef Pyramid< typename SimplexTopology< dim-1 >::type > type;
94 };
95
96 template<>
97 struct [[deprecated("Use GeometryTypes::simplex(dim) instead.")]] SimplexTopology< 0 >
98 {
99 typedef Point type;
100 };
101
102
103
104 // CubeTopology
105 // ------------
106
107 template< unsigned int dim >
108 struct [[deprecated("Use GeometryTypes::cube(dim) instead.")]] CubeTopology
109 {
110 typedef Prism< typename CubeTopology< dim-1 >::type > type;
111 };
112
113 template<>
114 struct [[deprecated("Use GeometryTypes::simplex(dim) instead.")]] CubeTopology< 0 >
115 {
116 typedef Point type;
117 };
118
119
120
121 // PyramidTopology
122 // ---------------
123
124 template< unsigned int dim >
125 struct [[deprecated]] PyramidTopology
126 {
127 typedef Pyramid< typename CubeTopology< dim-1 >::type > type;
128 };
129
130
131
132 // PrismTopology
133 // -------------
134
135 template< unsigned int dim >
136 struct [[deprecated]] PrismTopology
137 {
138 typedef Prism< typename SimplexTopology< dim-1 >::type > type;
139 };
140
141
142
143
144 // IfTopology
145 // ----------
146
147 template< template< class > class Operation, int dim, class Topology = PointDeprecationHelper >
148 struct [[deprecated("Use IfGeometryType instead.")]] IfTopology
149 {
150 template< class... Args >
151 static auto apply ( unsigned int topologyId, Args &&... args )
152 {
153 if( topologyId & 1 )
154 return IfTopology< Operation, dim-1, Prism< Topology > >::apply( topologyId >> 1, std::forward< Args >( args )... );
155 else
156 return IfTopology< Operation, dim-1, Pyramid< Topology > >::apply( topologyId >> 1, std::forward< Args >( args )... );
157 }
158 };
159
160 template< template< class > class Operation, class Topology >
161 struct [[deprecated("Use IfGeometryType instead.")]] IfTopology< Operation, 0, Topology >
162 {
163 template< class... Args >
164 static auto apply ([[maybe_unused]] unsigned int topologyId, Args &&... args)
165 {
166 return Operation< Topology >::apply( std::forward< Args >( args )... );
167 }
168 };
169
170 } // namespace Impl
171#endif
GeometryType
Type representing VTK's entity geometry types.
Definition: common.hh:132
constexpr GeometryType prismaticExtension(const GeometryType &gt)
Return GeometryType of a prismatic construction with gt as base
Definition: type.hh:493
constexpr GeometryType conicalExtension(const GeometryType &gt)
Return GeometryType of a conical construction with gt as base
Definition: type.hh:487
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Jul 15, 22:36, 2024)