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 : // Local includes
19 : #include "libmesh/edge_edge4.h"
20 : #include "libmesh/face_quad16.h"
21 : #include "libmesh/enum_io_package.h"
22 : #include "libmesh/enum_order.h"
23 :
24 : namespace libMesh
25 : {
26 :
27 :
28 :
29 :
30 : // ------------------------------------------------------------
31 : // Quad16 class static member initialization
32 : const int Quad16::num_nodes;
33 : const int Quad16::nodes_per_side;
34 :
35 :
36 : // Note: we can omit initialization of the third entry of each row because
37 : // static variables are automatically zero-initialized.
38 : // After the vertices the node locations start moving from Quad8/9
39 :
40 : static constexpr Real _third = Real(1)/3;
41 : const Real Quad16::_master_points[16][3] =
42 : {
43 : //corners
44 : {-1, -1},
45 : {1, -1},
46 : {1, 1},
47 : {-1, 1},
48 : //internal edges
49 : {- _third, -1},
50 : {_third, -1},
51 : //right
52 : {1, - _third},
53 : {1, _third},
54 : //top
55 : {_third, 1},
56 : {- _third, 1},
57 : // left
58 : {-1, _third},
59 : {-1, -_third},
60 : //internal
61 : {- _third, - _third},
62 : {_third, - _third},
63 : {_third, _third},
64 : {- _third, _third}
65 : };
66 :
67 : const unsigned int Quad16::side_nodes_map[Quad16::num_sides][Quad16::nodes_per_side] =
68 : {
69 : {0, 1, 4, 5}, // Side 0
70 : {1, 2, 6, 7}, // Side 1
71 : {2, 3, 8, 9}, // Side 2
72 : {3, 0, 10, 11} // Side 3
73 : };
74 :
75 : // ------------------------------------------------------------
76 : // Quad16 class member functions
77 :
78 34240 : bool Quad16::is_vertex(const unsigned int n) const
79 : {
80 34240 : if (n < 4)
81 8600 : return true;
82 6560 : return false;
83 : }
84 :
85 9792 : bool Quad16::is_edge(const unsigned int n) const
86 : {
87 2448 : libmesh_assert_not_equal_to (n, invalid_uint);
88 9792 : if (n < 4)
89 0 : return false;
90 9792 : if (n > 11)
91 3264 : return false;
92 1632 : return true;
93 : }
94 :
95 800 : bool Quad16::is_face(const unsigned int n) const
96 : {
97 800 : libmesh_assert_not_equal_to (n, invalid_uint);
98 800 : if (n > 11)
99 800 : return true;
100 0 : return false;
101 : }
102 :
103 4352 : bool Quad16::is_node_on_side(const unsigned int n,
104 : const unsigned int s) const
105 : {
106 1088 : libmesh_assert_less (s, n_sides());
107 1088 : return std::find(std::begin(side_nodes_map[s]),
108 4352 : std::end(side_nodes_map[s]),
109 4352 : n) != std::end(side_nodes_map[s]);
110 : }
111 :
112 19552 : unsigned int Quad16::local_side_node(unsigned int side,
113 : unsigned int side_node) const
114 : {
115 4888 : libmesh_assert_less (side, this->n_sides());
116 4888 : libmesh_assert_less (side_node, Quad16::nodes_per_side);
117 :
118 19552 : return Quad16::side_nodes_map[side][side_node];
119 : }
120 :
121 : std::vector<unsigned>
122 1408 : Quad16::nodes_on_side(const unsigned int s) const
123 : {
124 352 : libmesh_assert_less(s, n_sides());
125 1760 : return {std::begin(side_nodes_map[s]), std::end(side_nodes_map[s])};
126 : }
127 :
128 : std::vector<unsigned>
129 1024 : Quad16::nodes_on_edge(const unsigned int e) const
130 : {
131 1024 : return nodes_on_side(e);
132 : }
133 :
134 3760 : bool Quad16::has_affine_map() const
135 : {
136 1904 : Point v = this->point(3) - this->point(0);
137 3760 : return (v.relative_fuzzy_equals(this->point(2) - this->point(1), affine_tol));
138 : }
139 :
140 :
141 503 : std::unique_ptr<Elem> Quad16::build_side_ptr (const unsigned int i)
142 : {
143 503 : return this->simple_build_side_ptr<Edge4, Quad16>(i);
144 : }
145 :
146 :
147 :
148 192 : void Quad16::build_side_ptr (std::unique_ptr<Elem> & side,
149 : const unsigned int i)
150 : {
151 192 : this->simple_build_side_ptr<Quad16>(side, i, EDGE4);
152 192 : }
153 :
154 :
155 :
156 0 : void Quad16::connectivity(const unsigned int libmesh_dbg_var(sf),
157 : const IOPackage iop,
158 : std::vector<dof_id_type> &) const
159 : {
160 0 : libmesh_assert_less (sf, this->n_sub_elem());
161 0 : libmesh_assert_not_equal_to (iop, INVALID_IO_PACKAGE);
162 0 : libmesh_error_msg("Unsupported IO package for Quad16 " << iop);
163 : }
164 :
165 :
166 290 : void Quad16::permute(unsigned int perm_num)
167 : {
168 76 : libmesh_assert_less (perm_num, 4);
169 :
170 872 : for (unsigned int i = 0; i != perm_num; ++i)
171 : {
172 582 : swap4nodes(0,1,2,3);
173 582 : swap4nodes(4,6,8,10);
174 582 : swap4nodes(5,7,9,11);
175 582 : swap4nodes(12,13,14,15);
176 426 : swap4neighbors(0,1,2,3);
177 : }
178 290 : }
179 :
180 :
181 48 : void Quad16::flip(BoundaryInfo * boundary_info)
182 : {
183 12 : libmesh_assert(boundary_info);
184 :
185 48 : swap2nodes(0,1);
186 48 : swap2nodes(2,3);
187 48 : swap2nodes(4,5);
188 48 : swap2nodes(6,11);
189 48 : swap2nodes(7,10);
190 48 : swap2nodes(8,9);
191 48 : swap2nodes(12,13);
192 48 : swap2nodes(14,15);
193 12 : swap2neighbors(1,3);
194 48 : swap2boundarysides(1,3,boundary_info);
195 48 : swap2boundaryedges(1,3,boundary_info);
196 48 : }
197 :
198 256 : ElemType Quad16::side_type (const unsigned int libmesh_dbg_var(s)) const
199 : {
200 64 : libmesh_assert_less (s, 4);
201 256 : return EDGE4;
202 : }
203 :
204 :
205 : } // namespace libMesh
|