Line data Source code
1 : // The libMesh Finite Element Library.
2 : // Copyright (C) 2002-2026 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
3 :
4 : // This library is free software; you can redistribute it and/or
5 : // modify it under the terms of the GNU Lesser General Public
6 : // License as published by the Free Software Foundation; either
7 : // version 2.1 of the License, or (at your option) any later version.
8 :
9 : // This library is distributed in the hope that it will be useful,
10 : // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 : // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 : // Lesser General Public License for more details.
13 :
14 : // You should have received a copy of the GNU Lesser General Public
15 : // License along with this library; if not, write to the Free Software
16 : // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 :
18 :
19 :
20 : #ifndef LIBMESH_CELL_TET14_H
21 : #define LIBMESH_CELL_TET14_H
22 :
23 : // Local includes
24 : #include "libmesh/cell_tet.h"
25 : #include "libmesh/cell_tet4.h"
26 : #include "libmesh/fe_reference_element_traits.h"
27 :
28 : namespace libMesh
29 : {
30 :
31 : /**
32 : * The \p Tet14 is an element in 3D composed of 14 nodes. Its edges
33 : * and vertices are numbered as in Tet10, like this:
34 : *
35 : * \verbatim
36 : * 3
37 : * TET14: o
38 : * /|\
39 : * / | \
40 : * 7 / | \9
41 : * o | o zeta
42 : * / |8 \ ^
43 : * / o \ |
44 : * / 6 | \ |
45 : * 0 o.....o.|.......o 2 o---> eta
46 : * \ | / \
47 : * \ | / \
48 : * \ | / xi (out of page)
49 : * 4 o | o 5
50 : * \ | /
51 : * \ | /
52 : * \|/
53 : * o
54 : * 1
55 : * \endverbatim
56 : *
57 : * And it also includes four face nodes:
58 : * Node 10, centroid on side 0, arithmetic mean of 0/1/2 or 4/5/6
59 : * Node 11, centroid on side 1, arithmetic mean of 0/1/3 or 4/7/8
60 : * Node 12, centroid on side 2, arithmetic mean of 1/2/3 or 5/8/9
61 : * Node 13, centroid on side 3, arithmetic mean of 0/2/3 or 6/7/9
62 : *
63 : * (xi, eta, zeta): { 0 <= xi <= 1
64 : * { 0 <= eta <= 1
65 : * { 0 <= zeta <= 1
66 : * { xi + eta + zeta <= 1
67 : *
68 : * \author Roy H. Stogner
69 : * \date 2021
70 : * \brief A 3D tetrahedral element with 14 nodes.
71 : */
72 : class Tet14 final : public Tet
73 : {
74 : public:
75 :
76 : /**
77 : * Constructor. By default this element has no parent.
78 : */
79 : explicit
80 3701487 : Tet14 (Elem * p=nullptr) :
81 3701487 : Tet(num_nodes, p, _nodelinks_data)
82 3701487 : {}
83 :
84 : Tet14 (Tet14 &&) = delete;
85 : Tet14 (const Tet14 &) = delete;
86 : Tet14 & operator= (const Tet14 &) = delete;
87 : Tet14 & operator= (Tet14 &&) = delete;
88 3841340 : virtual ~Tet14() = default;
89 :
90 : /**
91 : * \returns \p TET14.
92 : */
93 13785067958 : virtual ElemType type () const override { return TET14; }
94 :
95 : /**
96 : * \returns 14.
97 : */
98 1934837328 : virtual unsigned int n_nodes() const override { return num_nodes; }
99 :
100 : /**
101 : * \returns 8.
102 : */
103 0 : virtual unsigned int n_sub_elem() const override { return 8; }
104 :
105 : /**
106 : * \returns \p true if the specified (local) node number is a vertex.
107 : */
108 : virtual bool is_vertex(const unsigned int i) const override;
109 :
110 : /**
111 : * \returns \p true if the specified (local) node number is an edge.
112 : */
113 : virtual bool is_edge(const unsigned int i) const override;
114 :
115 : /**
116 : * \returns \p true if the specified (local) node number is a face.
117 : */
118 : virtual bool is_face(const unsigned int i) const override;
119 :
120 : /**
121 : * \returns \p true if the specified (local) node number is on the
122 : * specified side.
123 : */
124 : virtual bool is_node_on_side(const unsigned int n,
125 : const unsigned int s) const override;
126 :
127 : virtual std::vector<unsigned int> nodes_on_side(const unsigned int s) const override;
128 :
129 : virtual std::vector<unsigned int> nodes_on_edge(const unsigned int e) const override;
130 :
131 : /**
132 : * \returns \p true if the specified (local) node number is on the
133 : * specified edge.
134 : */
135 : virtual bool is_node_on_edge(const unsigned int n,
136 : const unsigned int e) const override;
137 :
138 : /**
139 : * \returns \p true if the specified child is on the
140 : * specified side.
141 : */
142 : virtual bool is_child_on_side(const unsigned int c,
143 : const unsigned int s) const override;
144 :
145 : /**
146 : * \returns \p true if the element map is definitely affine within
147 : * numerical tolerances.
148 : */
149 : virtual bool has_affine_map () const override;
150 :
151 : /**
152 : * \returns THIRD.
153 : */
154 : virtual Order default_order() const override;
155 :
156 : /**
157 : * \returns \p Tet14::side_nodes_map[side][side_node] after doing some range checking.
158 : */
159 : virtual unsigned int local_side_node(unsigned int side,
160 : unsigned int side_node) const override;
161 :
162 : /**
163 : * \returns \p Tet14::edge_nodes_map[edge][edge_node] after doing some range checking.
164 : */
165 : virtual unsigned int local_edge_node(unsigned int edge,
166 : unsigned int edge_node) const override;
167 :
168 : /**
169 : * Builds a \p TRI7 built coincident with face i.
170 : * The \p std::unique_ptr<Elem> handles the memory aspect.
171 : */
172 : virtual std::unique_ptr<Elem> build_side_ptr (const unsigned int i) override;
173 :
174 : /**
175 : * Rebuilds a TRI7 built coincident with face i.
176 : */
177 : virtual void build_side_ptr (std::unique_ptr<Elem> & elem,
178 : const unsigned int i) override;
179 :
180 : // Avoid hiding deprecated version with different signature
181 : using Elem::build_side_ptr;
182 :
183 : /**
184 : * Builds a \p EDGE3 built coincident with edge i.
185 : * The \p std::unique_ptr<Elem> handles the memory aspect.
186 : */
187 : virtual std::unique_ptr<Elem> build_edge_ptr (const unsigned int i) override;
188 :
189 : /**
190 : * Rebuilds a \p EDGE3 coincident with edge i.
191 : */
192 : virtual void build_edge_ptr (std::unique_ptr<Elem> & edge, const unsigned int i) override;
193 :
194 : virtual void connectivity(const unsigned int sc,
195 : const IOPackage iop,
196 : std::vector<dof_id_type> & conn) const override;
197 :
198 : /**
199 : * \returns 2 for edge nodes and 3 for face nodes
200 : */
201 : virtual unsigned int n_second_order_adjacent_vertices (const unsigned int) const override;
202 :
203 : /**
204 : * \returns The element-local number of the \f$ v^{th} \f$ vertex
205 : * that defines the \f$ n^{th} \f$ second-order node.
206 : *
207 : * \note \p n is counted as depicted above, \f$ 4 \le n < 14 \f$.
208 : */
209 : virtual unsigned short int second_order_adjacent_vertex (const unsigned int n,
210 : const unsigned int v) const override;
211 :
212 : /**
213 : * \returns The child number \p c and element-local index \p v of the
214 : * \f$ n^{th} \f$ second-order node on the parent element. See
215 : * elem.h for further details.
216 : */
217 : virtual std::pair<unsigned short int, unsigned short int>
218 : second_order_child_vertex (const unsigned int n) const override;
219 :
220 : /**
221 : * Geometric constants for Tet14.
222 : */
223 : static const int num_nodes = 14;
224 : static const int nodes_per_side = 7;
225 : static const int nodes_per_edge = 3;
226 :
227 : /**
228 : * These map the \f$ j^{th} \f$ node of the \f$ i^{th} \f$ edge or
229 : * side to element node numbers. They are derived from the
230 : * first-order Tet4 tables; see fe_reference_element_traits.h.
231 : */
232 : static constexpr NodeMapTable<num_edges, nodes_per_edge>
233 : _edge_nodes = derived_edge_nodes<Tet4, num_edges>();
234 : static constexpr const unsigned int (&edge_nodes_map)[num_edges][nodes_per_edge] = _edge_nodes.values;
235 :
236 : static constexpr NodeMapTable<num_sides, nodes_per_side>
237 : _side_nodes = derived_side_nodes<Tet4, num_sides, nodes_per_side>
238 : (_edge_nodes.values, [](unsigned int s) { return 10 + s; });
239 : static constexpr const unsigned int (&side_nodes_map)[num_sides][nodes_per_side] = _side_nodes.values;
240 :
241 : virtual void permute(unsigned int perm_num) override final;
242 :
243 : virtual void flip(BoundaryInfo *) override final;
244 :
245 : ElemType side_type (const unsigned int s) const override final;
246 :
247 : #ifdef LIBMESH_ENABLE_AMR
248 : virtual
249 : const std::vector<std::pair<unsigned char, unsigned char>> &
250 : parent_bracketing_nodes(unsigned int c,
251 : unsigned int n) const override;
252 : #endif
253 :
254 : protected:
255 :
256 : /**
257 : * Data for links to nodes.
258 : */
259 : Node * _nodelinks_data[num_nodes];
260 :
261 :
262 :
263 : #ifdef LIBMESH_ENABLE_AMR
264 :
265 : /**
266 : * Matrix used to create the elements children.
267 : */
268 : virtual Real embedding_matrix (const unsigned int i,
269 : const unsigned int j,
270 : const unsigned int k) const override;
271 :
272 : /**
273 : * Matrix that computes new nodal locations/solution values
274 : * from current nodes/solution.
275 : */
276 : static const Real _embedding_matrix[num_children][num_nodes][num_nodes];
277 :
278 : /**
279 : * Pairs of nodes that bracket child nodes when doing mesh
280 : * refinement, for each of the three possible diagonal selection
281 : * options.
282 : */
283 : static const std::vector<std::pair<unsigned char, unsigned char>>
284 : _parent_bracketing_nodes[3][num_children][num_nodes];
285 :
286 13918870 : LIBMESH_ENABLE_TOPOLOGY_CACHES;
287 :
288 : #endif // LIBMESH_ENABLE_AMR
289 :
290 : private:
291 :
292 : /**
293 : * Matrix that tells which vertices define the location
294 : * of mid-side or mid-face nodes, indexed by node_num-4
295 : */
296 : static const unsigned short int _second_order_adjacent_vertices[10][3];
297 :
298 : /**
299 : * Vector that names a child sharing each second order node.
300 : */
301 : static const unsigned short int _second_order_vertex_child_number[14];
302 :
303 : /**
304 : * Vector that names the child vertex index for each second order node.
305 : */
306 : static const unsigned short int _second_order_vertex_child_index[14];
307 : };
308 :
309 : } // namespace libMesh
310 :
311 :
312 : #endif // LIBMESH_CELL_TET14_H
|