Line data Source code
1 : // The libMesh Finite Element Library. 2 : // Copyright (C) 2002-2025 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_INF_PRISM12_H 21 : #define LIBMESH_CELL_INF_PRISM12_H 22 : 23 : #include "libmesh/libmesh_config.h" 24 : 25 : #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS 26 : 27 : // Local includes 28 : #include "libmesh/cell_inf_prism.h" 29 : 30 : namespace libMesh 31 : { 32 : 33 : /** 34 : * The \p InfPrism12 is an infinite element in 3D composed of 12 nodes. 35 : * It is numbered like this: 36 : * \verbatim 37 : * INFPRISM12: 38 : * 5 39 : * o 40 : * : 41 : * : 42 : * : 43 : * 11 o : o 10 44 : * : 2: : 45 : * : o : closer to infinity 46 : * : . . : 47 : * 3o : . o9. : o4 48 : * | :. | .: | 49 : * | o | o | 50 : * | . 8 | 7 . | 51 : * | . | . | 52 : * |. | .| base face 53 : * o-------o-------o 54 : * 0 6 1 55 : * \endverbatim 56 : * 57 : * \author Daniel Dreyer 58 : * \date 2002 59 : * \brief A 3D infinite prismatic element with 12 nodes. 60 : */ 61 : class InfPrism12 final : public InfPrism 62 : { 63 : public: 64 : 65 : /** 66 : * Constructor. By default this element has no parent. 67 : */ 68 : explicit 69 608 : InfPrism12 (Elem * p=nullptr) : 70 608 : InfPrism(num_nodes, p, _nodelinks_data) 71 608 : {} 72 : 73 : InfPrism12 (InfPrism12 &&) = delete; 74 : InfPrism12 (const InfPrism12 &) = delete; 75 : InfPrism12 & operator= (const InfPrism12 &) = delete; 76 : InfPrism12 & operator= (InfPrism12 &&) = delete; 77 1624 : virtual ~InfPrism12() = default; 78 : 79 : /** 80 : * \returns 12. The \p InfPrism12 has 12 nodes. 81 : */ 82 998822 : virtual unsigned int n_nodes() const override { return num_nodes; } 83 : 84 : /** 85 : * \returns \p INFPRISM12. 86 : */ 87 276356 : virtual ElemType type () const override { return INFPRISM12; } 88 : 89 : /** 90 : * \returns 4. 91 : */ 92 0 : virtual unsigned int n_sub_elem() const override { return 4; } 93 : 94 : /** 95 : * \returns \p true if the specified (local) node number is on the 96 : * specified side. 97 : */ 98 : virtual bool is_node_on_side(const unsigned int n, 99 : const unsigned int s) const override; 100 : 101 : virtual std::vector<unsigned int> nodes_on_side(const unsigned int s) const override; 102 : 103 : virtual std::vector<unsigned int> nodes_on_edge(const unsigned int e) const override; 104 : 105 : /** 106 : * \returns \p true if the specified (local) node number is on the 107 : * specified edge. 108 : */ 109 : virtual bool is_node_on_edge(const unsigned int n, 110 : const unsigned int e) const override; 111 : 112 : /** 113 : * \returns SECOND. 114 : */ 115 : virtual Order default_order() const override; 116 : 117 : /** 118 : * \returns \p InfPrism12::side_nodes_map[side][side_node] after doing some range checking. 119 : */ 120 : virtual unsigned int local_side_node(unsigned int side, 121 : unsigned int side_node) const override; 122 : 123 : /** 124 : * \returns \p InfPrism12::edge_nodes_map[edge][edge_node] after doing some range checking. 125 : */ 126 : virtual unsigned int local_edge_node(unsigned int edge, 127 : unsigned int edge_node) const override; 128 : 129 : /** 130 : * \returns A \p TRI6 built coincident with face 0, or an \p 131 : * INFQUAD6 built coincident with faces 1 to 3. 132 : * 133 : * \note that the \p std::unique_ptr<Elem> takes care of freeing memory. 134 : */ 135 : virtual std::unique_ptr<Elem> build_side_ptr (const unsigned int i) override; 136 : 137 : /** 138 : * Rebuilds a \p TRI6 built coincident with face 0, or an \p 139 : * INFQUAD6 built coincident with faces 1 to 3. 140 : */ 141 : virtual void build_side_ptr (std::unique_ptr<Elem> & elem, 142 : const unsigned int i) override; 143 : 144 : // Avoid hiding deprecated version with different signature 145 : using Elem::build_side_ptr; 146 : 147 : /** 148 : * \returns An \p EDGE3 built coincident with edges 0 to 2, or an \p INFEDGE2 149 : * built coincident with edges 3 to 5. 150 : * 151 : * \note The \p std::unique_ptr<Elem> takes care of freeing memory. 152 : */ 153 : virtual std::unique_ptr<Elem> build_edge_ptr (const unsigned int i) override; 154 : 155 : /** 156 : * Rebuilds a \p EDGE3 built coincident with edges 0 to 2, or \p 157 : * INFEDGE2 built coincident with edges 3 to 5. 158 : */ 159 : virtual void build_edge_ptr (std::unique_ptr<Elem> & edge, const unsigned int i) override; 160 : 161 : virtual void connectivity(const unsigned int sc, 162 : const IOPackage iop, 163 : std::vector<dof_id_type> & conn) const override; 164 : 165 : /** 166 : * \returns 2 for all \p n. 167 : */ 168 0 : virtual unsigned int n_second_order_adjacent_vertices (const unsigned int) const override 169 0 : { return 2; } 170 : 171 : /** 172 : * \returns The element-local number of the \f$ v^{th} \f$ vertex 173 : * that defines the \f$ n^{th} \f$ second-order node. 174 : * 175 : * \note \p n is counted as depicted above, \f$ 6 \le n < 12 \f$. 176 : */ 177 : virtual unsigned short int second_order_adjacent_vertex (const unsigned int n, 178 : const unsigned int v) const override; 179 : 180 : /** 181 : * \returns The child number \p c and element-local index \p v of the 182 : * \f$ n^{th} \f$ second-order node on the parent element. See 183 : * elem.h for further details. 184 : */ 185 : virtual std::pair<unsigned short int, unsigned short int> 186 : second_order_child_vertex (const unsigned int n) const override; 187 : 188 : /** 189 : * Geometric constants for InfPrism12. 190 : */ 191 : static const int num_nodes = 12; 192 : static const int nodes_per_side = 6; 193 : static const int nodes_per_edge = 3; 194 : 195 : /** 196 : * This maps the \f$ j^{th} \f$ node of the \f$ i^{th} \f$ side to 197 : * element node numbers. 198 : */ 199 : static const unsigned int side_nodes_map[num_sides][nodes_per_side]; 200 : 201 : /** 202 : * This maps the \f$ j^{th} \f$ node of the \f$ i^{th} \f$ edge to 203 : * element node numbers. 204 : */ 205 : static const unsigned int edge_nodes_map[num_edges][nodes_per_edge]; 206 : 207 : virtual void permute(unsigned int perm_num) override final; 208 : 209 : virtual void flip(BoundaryInfo *) override final; 210 : 211 : ElemType side_type (const unsigned int s) const override final; 212 : 213 : protected: 214 : 215 : /** 216 : * Data for links to nodes. 217 : */ 218 : Node * _nodelinks_data[num_nodes]; 219 : 220 : 221 : #ifdef LIBMESH_ENABLE_AMR 222 : 223 : /** 224 : * Matrix used to create the elements children. 225 : */ 226 8500 : virtual Real embedding_matrix (const unsigned int i, 227 : const unsigned int j, 228 : const unsigned int k) const override 229 8500 : { return _embedding_matrix[i][j][k]; } 230 : 231 : /** 232 : * Matrix that computes new nodal locations/solution values 233 : * from current nodes/solution. 234 : */ 235 : static const Real _embedding_matrix[num_children][num_nodes][num_nodes]; 236 : 237 9620 : LIBMESH_ENABLE_TOPOLOGY_CACHES; 238 : 239 : #endif // LIBMESH_ENABLE_AMR 240 : 241 : 242 : private: 243 : 244 : /** 245 : * Matrix that tells which vertices define the location 246 : * of mid-side (or second-order) nodes 247 : */ 248 : static const unsigned short int _second_order_adjacent_vertices[num_edges][2]; 249 : 250 : /** 251 : * Vector that names a child sharing each second order node. 252 : */ 253 : static const unsigned short int _second_order_vertex_child_number[num_nodes]; 254 : 255 : /** 256 : * Vector that names the child vertex index for each second order node. 257 : */ 258 : static const unsigned short int _second_order_vertex_child_index[num_nodes]; 259 : }; 260 : 261 : } // namespace libMesh 262 : 263 : #endif // ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS 264 : 265 : #endif // LIBMESH_CELL_INF_PRISM12_H