DNDSR 0.1.0.dev1+gcd065ad
Distributed Numeric Data Structure for CFV
Loading...
Searching...
No Matches
Line2.hpp
Go to the documentation of this file.
1#pragma once
2// Auto-generated by tools/gen_shape_functions -- DO NOT EDIT
3// Element: Line2
4// Regenerate: /usr/bin/python3 -m tools.gen_shape_functions.generate
5
6#include "DNDS/Defines.hpp"
7#include "Geom/Geometric.hpp"
8#include "Geom/ElemEnum.hpp"
10
11namespace DNDS::Geom::Elem
12{
13
14 // Forward declaration (primary template is in ElementTraitsBase.hpp)
15 template <ElemType> struct ShapeFuncImpl;
16
17 // <GEN_SHAPE_FUNCS_BEGIN>
18 template <>
20 {
21 template <class TPoint, class TArray>
22 DNDS_DEVICE_CALLABLE static inline void Diff0(const TPoint &p, TArray &&v)
23 {
24 t_real xi = p[0];
25 const t_real _t0 = ((0.5))*xi;
26 v(0, 0) = (0.5) - _t0;
27 v(0, 1) = _t0 + (0.5);
28 }
29
30 template <class TPoint, class TArray>
31 DNDS_DEVICE_CALLABLE static inline void Diff1(const TPoint &p, TArray &&v)
32 {
33 t_real xi = p[0];
34 v(0, 0) = (-0.5);
35 v(0, 1) = (0.5);
36 }
37
38 template <class TPoint, class TArray>
39 DNDS_DEVICE_CALLABLE static inline void Diff2(const TPoint &p, TArray &&v)
40 {
41 t_real xi = p[0];
42 // all zero
43 }
44
45 template <class TPoint, class TArray>
46 DNDS_DEVICE_CALLABLE static inline void Diff3(const TPoint &p, TArray &&v)
47 {
48 t_real xi = p[0];
49 // all zero
50 }
51 };
52 // <GEN_SHAPE_FUNCS_END>
53
54
55
56 /**
57 * @brief Element traits for 2-node linear line element (Line2)
58 *
59 * Line2 is a 1D linear element with nodes at the endpoints.
60 * Used as edge/face elements for 2D/3D meshes.
61 */
62 template <>
64 {
65 // ============================================================
66 // Core Element Identification
67 // ============================================================
68
69 /// @brief Element type enum value for static dispatch
70 static constexpr ElemType elemType = Line2;
71
72 /// @brief Spatial dimension (1 = line element)
73 static constexpr int dim = 1;
74
75 /// @brief Polynomial order of shape functions (1 = linear)
76 static constexpr int order = 1;
77
78 /// @brief Number of vertices (2 endpoints)
79 static constexpr int numVertices = 2;
80
81 /// @brief Total number of nodes (same as vertices for linear element)
82 static constexpr int numNodes = 2;
83
84 /// @brief Number of faces (0 for 1D element - endpoints are nodes, not faces)
85 static constexpr int numFaces = 0;
86
87 /// @brief Parametric space type (line space: xi in [-1, 1])
88 static constexpr ParamSpace paramSpace = LineSpace;
89
90 /// @brief Volume of parametric space (length = 2.0)
91 static constexpr t_real paramSpaceVol = 2.0;
92
93 // ============================================================
94 // Geometry Definition
95 // ============================================================
96
97 /**
98 * @brief Standard coordinates of nodes in parametric space
99 *
100 * Format: {x, y, z} for each node. Even though this is 1D,
101 * we store 3D coordinates for consistency with higher-D elements.
102 * Node 0: xi = -1 -> (-1, 0, 0)
103 * Node 1: xi = +1 -> ( 1, 0, 0)
104 */
105 static constexpr std::array<t_real, 3 * 2> standardCoords = {
106 -1, 0, 0, // Node 0: left endpoint
107 1, 0, 0}; // Node 1: right endpoint
108
109 // ============================================================
110 // Face/Edge Type Queries
111 // ============================================================
112
113 /**
114 * @brief Get the element type of a face
115 * @param iFace Face index (unused for Line2 as it has no faces)
116 * @return UnknownElem (1D elements don't have faces in the traditional sense)
117 */
118 static constexpr ElemType GetFaceType(t_index /*iFace*/) { return UnknownElem; }
119
120 // ============================================================
121 // Order Elevation (P-Refinement)
122 // ============================================================
123
124 /**
125 * @brief Element type after order elevation (O1 -> O2)
126 * Line2 elevates to Line3 (3-node quadratic line)
127 */
128 static constexpr ElemType elevatedType = Line3;
129
130 /// @brief Number of additional nodes created during elevation
131 static constexpr int numElevNodes = 1;
132
133 /**
134 * @brief Elevation spans define which parent nodes each new node connects
135 *
136 * For Line2 -> Line3:
137 * - 1 new node at the midpoint
138 * - Span {0, 1} means this new node connects nodes 0 and 1
139 */
140 static constexpr std::array<tElevSpan, 1> elevSpans = {{
141 {0, 1}}}; // Midpoint connects nodes 0 and 1
142
143 /// @brief Element type of each elevation span (all Line2 edges)
144 static constexpr std::array<ElemType, 1> elevNodeSpanTypes = {Line2};
145
146 // ============================================================
147 // VTK/Visualization Support
148 // ============================================================
149
150 /// @brief VTK cell type identifier (3 = VTK_LINE)
151 static constexpr int vtkCellType = 3;
152
153 /**
154 * @brief VTK node ordering map
155 *
156 * For Line2, VTK uses the same ordering as DNDS:
157 * VTK node 0 = DNDS node 0
158 * VTK node 1 = DNDS node 1
159 */
160 static constexpr std::array<int, 2> vtkNodeOrder = {0, 1};
161 };
162
163} // namespace DNDS::Geom::Elem
Core type aliases, constants, and metaprogramming utilities for the DNDS framework.
#define DNDS_DEVICE_CALLABLE
Definition Defines.hpp:76
int32_t t_index
Definition Geometric.hpp:6
double t_real
Definition Geometric.hpp:8
static constexpr ElemType GetFaceType(t_index)
Get the element type of a face.
Definition Line2.hpp:118
static DNDS_DEVICE_CALLABLE void Diff3(const TPoint &p, TArray &&v)
Definition Line2.hpp:46
static DNDS_DEVICE_CALLABLE void Diff0(const TPoint &p, TArray &&v)
Definition Line2.hpp:22
static DNDS_DEVICE_CALLABLE void Diff1(const TPoint &p, TArray &&v)
Definition Line2.hpp:31
static DNDS_DEVICE_CALLABLE void Diff2(const TPoint &p, TArray &&v)
Definition Line2.hpp:39
Eigen::Matrix< real, 5, 1 > v
double order
Definition test_ODE.cpp:257