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_HEX20_H 21 : #define LIBMESH_CELL_HEX20_H 22 : 23 : // Local includes 24 : #include "libmesh/cell_hex.h" 25 : #include "libmesh/fe_reference_element_traits.h" 26 : 27 : namespace libMesh 28 : { 29 : 30 : /** 31 : * The \p Hex20 is an element in 3D composed of 20 nodes. It is 32 : * numbered like this: 33 : * 34 : * \verbatim 35 : * HEX20: 7 18 6 36 : * o--------------o--------------o 37 : * /: /| 38 : * / : / | 39 : * / : / | 40 : * 19/ : 17/ | 41 : * o : o | 42 : * / : / | 43 : * / 15o / 14o 44 : * / : / | zeta 45 : * 4/ : 16 5/ | ^ eta (into page) 46 : * o--------------o--------------o | | / 47 : * | : | | |/ 48 : * | : | | o---> xi 49 : * | : 10 | | 50 : * | 3o..............o....|.........o 51 : * | . | / 2 52 : * | . 13| / 53 : * 12 o . o / 54 : * | . | / 55 : * | 11o | o 56 : * | . | / 9 57 : * | . | / 58 : * | . | / 59 : * |. |/ 60 : * o--------------o--------------o 61 : * 0 8 1 62 : * \endverbatim 63 : * 64 : * (xi, eta, zeta) in [-1,1]^3 are the reference element coordinates 65 : * associated with the given numbering. 66 : * 67 : * \author Benjamin S. Kirk 68 : * \date 2002 69 : * \brief A 3D hexahedral element with 20 nodes. 70 : */ 71 : class Hex20 final : public Hex 72 : { 73 : public: 74 : 75 : /** 76 : * Constructor. By default this element has no parent. 77 : */ 78 : explicit 79 6660 : Hex20 (Elem * p=nullptr) : 80 6660 : Hex(num_nodes, p, _nodelinks_data) 81 6660 : {} 82 : 83 : Hex20 (Hex20 &&) = delete; 84 : Hex20 (const Hex20 &) = delete; 85 : Hex20 & operator= (const Hex20 &) = delete; 86 : Hex20 & operator= (Hex20 &&) = delete; 87 11409 : virtual ~Hex20() = default; 88 : 89 : /** 90 : * \returns \p HEX20. 91 : */ 92 240784467 : virtual ElemType type () const override { return HEX20; } 93 : 94 : /** 95 : * \returns 20. 96 : */ 97 122225772 : virtual unsigned int n_nodes() const override { return num_nodes; } 98 : 99 : /** 100 : * \returns 1. 101 : */ 102 0 : virtual unsigned int n_sub_elem() const override { return 1; } 103 : 104 : /** 105 : * \returns \p true if the specified (local) node number is a vertex. 106 : */ 107 : virtual bool is_vertex(const unsigned int i) const override; 108 : 109 : /** 110 : * \returns \p true if the specified (local) node number is an edge. 111 : */ 112 : virtual bool is_edge(const unsigned int i) const override; 113 : 114 : /** 115 : * \returns \p true if the specified (local) node number is a face. 116 : */ 117 : virtual bool is_face(const unsigned int i) const override; 118 : 119 : /** 120 : * \returns \p true if the specified (local) node number is on the 121 : * specified side. 122 : */ 123 : virtual bool is_node_on_side(const unsigned int n, 124 : const unsigned int s) const override; 125 : 126 : virtual std::vector<unsigned int> nodes_on_side(const unsigned int s) const override; 127 : 128 : virtual std::vector<unsigned int> nodes_on_edge(const unsigned int e) const override; 129 : 130 : /** 131 : * \returns \p true if the specified (local) node number is on the 132 : * specified edge. 133 : */ 134 : virtual bool is_node_on_edge(const unsigned int n, 135 : const unsigned int e) const override; 136 : 137 : /** 138 : * \returns \p true if the element map is definitely affine within 139 : * numerical tolerances. 140 : */ 141 : virtual bool has_affine_map () const override; 142 : 143 : /** 144 : * \returns SECOND. 145 : */ 146 : virtual Order default_order() const override; 147 : 148 : /** 149 : * \returns \p Hex20::side_nodes_map[side][side_node] after doing some range checking. 150 : */ 151 : virtual unsigned int local_side_node(unsigned int side, 152 : unsigned int side_node) const override; 153 : 154 : /** 155 : * \returns \p Hex20::edge_nodes_map[edge][edge_node] after doing some range checking. 156 : */ 157 : virtual unsigned int local_edge_node(unsigned int edge, 158 : unsigned int edge_node) const override; 159 : 160 : /** 161 : * Builds a \p QUAD8 built coincident with face i. 162 : * The \p std::unique_ptr<Elem> handles the memory aspect. 163 : */ 164 : virtual std::unique_ptr<Elem> build_side_ptr (const unsigned int i) override; 165 : 166 : /** 167 : * Rebuilds a \p QUAD8 built coincident with face i. 168 : */ 169 : virtual void build_side_ptr (std::unique_ptr<Elem> & elem, 170 : const unsigned int i) override; 171 : 172 : // Avoid hiding deprecated version with different signature 173 : using Elem::build_side_ptr; 174 : 175 : /** 176 : * Builds a \p EDGE3 built coincident with edge i. 177 : * The \p std::unique_ptr<Elem> handles the memory aspect. 178 : */ 179 : virtual std::unique_ptr<Elem> build_edge_ptr (const unsigned int i) override; 180 : 181 : /** 182 : * Rebuilds a \p EDGE3 built coincident with edge i. 183 : */ 184 : virtual void build_edge_ptr (std::unique_ptr<Elem> & edge, const unsigned int i) override; 185 : 186 : virtual void connectivity(const unsigned int sc, 187 : const IOPackage iop, 188 : std::vector<dof_id_type> & conn) const override; 189 : 190 : /** 191 : * \returns 2 for all \p n. 192 : */ 193 0 : virtual unsigned int n_second_order_adjacent_vertices (const unsigned int) const override 194 0 : { return 2; } 195 : 196 : /** 197 : * \returns The element-local number of the \f$ v^{th} \f$ vertex 198 : * that defines the \f$ n^{th} \f$ second-order node. 199 : * 200 : * \note \p n uses the numbering shown above, \f$ 8 \le n < 20 \f$. 201 : */ 202 : virtual unsigned short int second_order_adjacent_vertex (const unsigned int n, 203 : const unsigned int v) const override; 204 : 205 : /** 206 : * \returns The child number \p c and element-local index \p v of the 207 : * \f$ n^{th} \f$ second-order node on the parent element. See 208 : * elem.h for further details. 209 : */ 210 : virtual std::pair<unsigned short int, unsigned short int> 211 : second_order_child_vertex (const unsigned int n) const override; 212 : 213 : /** 214 : * Geometric constants for Hex20. 215 : */ 216 : static const int num_nodes = 20; 217 : static const int nodes_per_side = 8; 218 : static const int nodes_per_edge = 3; 219 : 220 : /** 221 : * This maps the \f$ j^{th} \f$ node of the \f$ i^{th} \f$ side to 222 : * element node numbers. 223 : */ 224 : static const ReferenceElementTable<num_sides, nodes_per_side> side_nodes_map; 225 : 226 : /** 227 : * This maps the \f$ j^{th} \f$ node of the \f$ i^{th} \f$ edge to 228 : * element node numbers. 229 : */ 230 : static const ReferenceElementTable<num_edges, nodes_per_edge> edge_nodes_map; 231 : 232 : /** 233 : * A specialization for computing the volume of a Hex20. 234 : */ 235 : virtual Real volume () const override; 236 : 237 : virtual void permute(unsigned int perm_num) override final; 238 : 239 : virtual void flip(BoundaryInfo *) override final; 240 : 241 : ElemType side_type (const unsigned int s) const override final; 242 : 243 : protected: 244 : 245 : /** 246 : * Data for links to nodes. 247 : */ 248 : Node * _nodelinks_data[num_nodes]; 249 : 250 : 251 : 252 : #ifdef LIBMESH_ENABLE_AMR 253 : 254 : /** 255 : * Matrix used to create the elements children. 256 : */ 257 424144 : virtual Real embedding_matrix (const unsigned int i, 258 : const unsigned int j, 259 : const unsigned int k) const override 260 424144 : { return _embedding_matrix[i][j][k]; } 261 : 262 : /** 263 : * Matrix that computes new nodal locations/solution values 264 : * from current nodes/solution. 265 : */ 266 : static const Real _embedding_matrix[num_children][num_nodes][num_nodes]; 267 : 268 252896 : LIBMESH_ENABLE_TOPOLOGY_CACHES; 269 : 270 : #endif // LIBMESH_ENABLE_AMR 271 : 272 : }; 273 : 274 : } // namespace libMesh 275 : 276 : #endif // LIBMESH_CELL_HEX20_H