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_PYRAMID13_H 21 : #define LIBMESH_CELL_PYRAMID13_H 22 : 23 : // Local includes 24 : #include "libmesh/cell_pyramid.h" 25 : #include "libmesh/cell_pyramid5.h" 26 : #include "libmesh/fe_reference_element_traits.h" 27 : 28 : namespace libMesh 29 : { 30 : 31 : /** 32 : * The \p Pyramid13 is an element in 3D composed of 13 nodes, designed 33 : * to interface with a QUAD8 element on the base and a TRI6 element on 34 : * each of the triangular faces. Cubit will generate hybrid meshes 35 : * with linear pyramids, but as of version 14 will not export 36 : * quadratic pyramids. Paraview should support 13-node pyramids... 37 : * 38 : * The node numbering for the pyramid13 is given below: 39 : * 40 : * \verbatim 41 : * PYRAMID13: 42 : * o 4 43 : * //|\ 44 : * // | \ 45 : * // | \ 46 : * // | \ 47 : * 12 o/ | o 11 48 : * // | \ 49 : * /o 9 o 10 \ 50 : * // | \ zeta 51 : * // | \ ^ eta (into page) 52 : * 3 o/.......o.|........o 2 | / 53 : * ./ 7 | / |/ 54 : * ./ | / o---> xi 55 : * ./ | / 56 : * ./ | / 57 : * 8 o/ | o 6 58 : * ./ | / 59 : * ./ | / 60 : * ./ |/ 61 : * o--------o---------o 62 : * 0 5 1 63 : * \endverbatim 64 : * 65 : * (xi, eta, zeta): { zeta-1 <= xi <= 1-zeta 66 : * { zeta-1 <= eta <= 1-zeta 67 : * { 0 <= zeta <= 1 68 : * are the reference element coordinates associated with the given 69 : * numbering. 70 : * 71 : * \author John W. Peterson 72 : * \date 2014 73 : * \brief A 3D pyramid element with 13 nodes. 74 : */ 75 : class Pyramid13 final : public Pyramid 76 : { 77 : public: 78 : 79 : /** 80 : * Constructor. By default this element has no parent. 81 : */ 82 : explicit 83 214072 : Pyramid13 (Elem * p=nullptr) : 84 214072 : Pyramid(num_nodes, p, _nodelinks_data) 85 214072 : {} 86 : 87 : Pyramid13 (Pyramid13 &&) = delete; 88 : Pyramid13 (const Pyramid13 &) = delete; 89 : Pyramid13 & operator= (const Pyramid13 &) = delete; 90 : Pyramid13 & operator= (Pyramid13 &&) = delete; 91 220507 : virtual ~Pyramid13() = default; 92 : 93 : /** 94 : * \returns 13. 95 : */ 96 11035650 : virtual unsigned int n_nodes() const override { return num_nodes; } 97 : 98 : /** 99 : * \returns \p PYRAMID13. 100 : */ 101 180031862 : virtual ElemType type () const override { return PYRAMID13; } 102 : 103 : /** 104 : * FIXME: we don't yet have a refinement pattern for pyramids... 105 : * \returns 1. 106 : */ 107 0 : virtual unsigned int n_sub_elem() const override { return 1; } 108 : 109 : /** 110 : * \returns \p true if the specified (local) node number is a vertex. 111 : */ 112 : virtual bool is_vertex(const unsigned int i) const override; 113 : 114 : /** 115 : * \returns \p true if the specified (local) node number is an edge. 116 : */ 117 : virtual bool is_edge(const unsigned int i) const override; 118 : 119 : /** 120 : * \returns \p true if the specified (local) node number is a face. 121 : */ 122 : virtual bool is_face(const unsigned int i) const override; 123 : 124 : /** 125 : * \returns \p true if the specified (local) node number is on the 126 : * specified side. 127 : */ 128 : virtual bool is_node_on_side(const unsigned int n, 129 : const unsigned int s) const override; 130 : 131 : virtual std::vector<unsigned int> nodes_on_side(const unsigned int s) const override; 132 : 133 : virtual std::vector<unsigned int> nodes_on_edge(const unsigned int e) const override; 134 : 135 : /** 136 : * \returns \p true if the specified (local) node number is on the 137 : * specified edge. 138 : */ 139 : virtual bool is_node_on_edge(const unsigned int n, 140 : const unsigned int e) const override; 141 : 142 : /** 143 : * \returns \p true if the element map is definitely affine within 144 : * numerical tolerances. 145 : */ 146 : virtual bool has_affine_map () const override; 147 : 148 : /** 149 : * \returns SECOND. 150 : */ 151 : virtual Order default_order() const override; 152 : 153 : /** 154 : * \returns \p Pyramid13::side_nodes_map[side][side_node] after doing some range checking. 155 : */ 156 : virtual unsigned int local_side_node(unsigned int side, 157 : unsigned int side_node) const override; 158 : 159 : /** 160 : * \returns \p Pyramid13::edge_nodes_map[edge][edge_node] after doing some range checking. 161 : */ 162 : virtual unsigned int local_edge_node(unsigned int edge, 163 : unsigned int edge_node) const override; 164 : 165 : /** 166 : * Builds a \p QUAD8 or \p TRI6 coincident with face i. 167 : * The \p std::unique_ptr<Elem> handles the memory aspect. 168 : */ 169 : virtual std::unique_ptr<Elem> build_side_ptr (const unsigned int i) override; 170 : 171 : /** 172 : * Rebuilds a \p QUAD8 or \p TRI6 built coincident with face i. 173 : */ 174 : virtual void build_side_ptr (std::unique_ptr<Elem> & elem, 175 : const unsigned int i) override; 176 : 177 : // Avoid hiding deprecated version with different signature 178 : using Elem::build_side_ptr; 179 : 180 : /** 181 : * Builds a \p EDGE3 coincident with edge i. 182 : * The \p std::unique_ptr<Elem> handles the memory aspect. 183 : */ 184 : virtual std::unique_ptr<Elem> build_edge_ptr (const unsigned int i) override; 185 : 186 : /** 187 : * Rebuilds a \p EDGE3 coincident with edge i. 188 : */ 189 : virtual void build_edge_ptr (std::unique_ptr<Elem> & edge, const unsigned int i) override; 190 : 191 : virtual void connectivity(const unsigned int sc, 192 : const IOPackage iop, 193 : std::vector<dof_id_type> & conn) const override; 194 : 195 : /** 196 : * \returns 2 for all edge nodes. 197 : */ 198 : virtual unsigned int n_second_order_adjacent_vertices (const unsigned int n) const override; 199 : 200 : /** 201 : * \returns The element-local number of the \f$ v^{th} \f$ vertex 202 : * that defines the \f$ n^{th} \f$ second-order node. 203 : */ 204 : virtual unsigned short int second_order_adjacent_vertex (const unsigned int n, 205 : const unsigned int v) const override; 206 : 207 : /** 208 : * Geometric constants for Pyramid13. 209 : */ 210 : static const int num_nodes = 13; 211 : static const int nodes_per_side = 8; 212 : static const int nodes_per_edge = 3; 213 : 214 : /** 215 : * These map the \f$ j^{th} \f$ node of the \f$ i^{th} \f$ edge or 216 : * side to element node numbers. They are derived from the 217 : * first-order Pyramid5 tables; see fe_reference_element_traits.h. 218 : */ 219 : static constexpr NodeMapTable<num_edges, nodes_per_edge> 220 : _edge_nodes = derived_edge_nodes<Pyramid5, num_edges>(); 221 : static constexpr const unsigned int (&edge_nodes_map)[num_edges][nodes_per_edge] = _edge_nodes.values; 222 : 223 : static constexpr NodeMapTable<num_sides, nodes_per_side> 224 : _side_nodes = derived_side_nodes<Pyramid5, num_sides, nodes_per_side> 225 : (_edge_nodes.values, no_face_node); 226 : static constexpr const unsigned int (&side_nodes_map)[num_sides][nodes_per_side] = _side_nodes.values; 227 : 228 : /** 229 : * Specialization for computing the volume of a Pyramid13. 230 : */ 231 : virtual Real volume () const override; 232 : 233 : virtual void permute(unsigned int perm_num) override final; 234 : 235 : virtual void flip(BoundaryInfo *) override final; 236 : 237 : ElemType side_type (const unsigned int s) const override final; 238 : 239 : protected: 240 : 241 : /** 242 : * Data for links to nodes. 243 : */ 244 : Node * _nodelinks_data[num_nodes]; 245 : 246 : 247 : 248 : #ifdef LIBMESH_ENABLE_AMR 249 : 250 : /** 251 : * Matrix used to create the elements children. 252 : */ 253 0 : virtual Real embedding_matrix (const unsigned int, 254 : const unsigned int, 255 : const unsigned int) const override 256 0 : { libmesh_not_implemented(); return 0.; } 257 : 258 0 : LIBMESH_ENABLE_TOPOLOGY_CACHES; 259 : 260 : #endif // LIBMESH_ENABLE_AMR 261 : 262 : }; 263 : 264 : } // namespace libMesh 265 : 266 : 267 : #endif // LIBMESH_CELL_PYRAMID13_H