LCOV - code coverage report
Current view: top level - include/geom - cell_prism18.h (source / functions) Hit Total Coverage
Test: libMesh/libmesh: #4554 (5a536d) with base 54e0d5 Lines: 9 10 90.0 %
Date: 2026-09-16 12:37:14 Functions: 8 9 88.9 %
Legend: Lines: hit not hit

          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_PRISM18_H
      21             : #define LIBMESH_CELL_PRISM18_H
      22             : 
      23             : // Local includes
      24             : #include "libmesh/cell_prism.h"
      25             : #include "libmesh/fe_reference_element_traits.h"
      26             : 
      27             : namespace libMesh
      28             : {
      29             : 
      30             : /**
      31             :  * The \p Prism18 is an element in 3D composed of 18 nodes.
      32             :  * It is numbered like this:
      33             :  *
      34             :  * \verbatim
      35             :  *   PRISM18:
      36             :  *               5
      37             :  *               o
      38             :  *              /:\
      39             :  *             / : \
      40             :  *            /  :  \
      41             :  *           /   :   \
      42             :  *       14 o    :    o 13
      43             :  *         /     :     \
      44             :  *        /      :      \
      45             :  *       /       o 11    \
      46             :  *    3 /        :        \4
      47             :  *     o---------o---------o
      48             :  *     |         :12       |
      49             :  *     |         :         |
      50             :  *     |    o    :    o    |            zeta
      51             :  *     |   17    o   16    |             ^   eta (into page)
      52             :  *     |        .2.        |             | /
      53             :  *     |       .   .       |             |/
      54             :  *   9 o      .  o  .      o 10          o---> xi
      55             :  *     |     .  15   .     |
      56             :  *     |  8 o         o 7  |
      57             :  *     |   .           .   |
      58             :  *     |  .             .  |
      59             :  *     | .               . |
      60             :  *     |.                 .|
      61             :  *     o---------o---------o
      62             :  *     0         6         1
      63             :  * \endverbatim
      64             :  *
      65             :  * (xi, eta, zeta): { 0  <= xi   <= 1
      66             :  *                  { 0  <= eta  <= 1
      67             :  *                  { -1 <= zeta <= 1
      68             :  *                  { xi + eta   <= 1
      69             :  * are the reference element coordinates associated with the given
      70             :  * numbering.
      71             :  *
      72             :  * \author Benjamin S. Kirk
      73             :  * \date 2003
      74             :  * \brief A 3D prismatic element with 18 nodes.
      75             :  */
      76             : class Prism18 final : public Prism
      77             : {
      78             : public:
      79             : 
      80             :   /**
      81             :    * Constructor.  By default this element has no parent.
      82             :    */
      83             :   explicit
      84       33985 :   Prism18 (Elem * p=nullptr) :
      85       33985 :     Prism(num_nodes, p, _nodelinks_data)
      86       33985 :   {}
      87             : 
      88             :   Prism18 (Prism18 &&) = delete;
      89             :   Prism18 (const Prism18 &) = delete;
      90             :   Prism18 & operator= (const Prism18 &) = delete;
      91             :   Prism18 & operator= (Prism18 &&) = delete;
      92       57988 :   virtual ~Prism18() = default;
      93             : 
      94             :   /**
      95             :    * \returns \p PRISM18.
      96             :    */
      97   199188803 :   virtual ElemType type () const override { return PRISM18; }
      98             : 
      99             :   /**
     100             :    * \returns 18.
     101             :    */
     102   129421286 :   virtual unsigned int n_nodes() const override { return num_nodes; }
     103             : 
     104             :   /**
     105             :    * \returns 8.
     106             :    */
     107           0 :   virtual unsigned int n_sub_elem() const override { return 8; }
     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             :    * Don't hide Elem::key() defined in the base class.
     155             :    */
     156             :   using Elem::key;
     157             : 
     158             :   /**
     159             :    * \returns An id associated with the \p s side of this element.
     160             :    * The id is not necessarily unique, but should be close.
     161             :    *
     162             :    * We reimplement this method here for the \p Prism18 since we can
     163             :    * use the center node of each quad face to provide a perfect (unique)
     164             :    * key.
     165             :    */
     166             :   virtual dof_id_type key (const unsigned int s) const override;
     167             : 
     168             :   /**
     169             :    * \returns \p Prism18::side_nodes_map[side][side_node] after doing some range checking.
     170             :    */
     171             :   virtual unsigned int local_side_node(unsigned int side,
     172             :                                        unsigned int side_node) const override;
     173             : 
     174             :   /**
     175             :    * \returns \p Prism18::edge_nodes_map[edge][edge_node] after doing some range checking.
     176             :    */
     177             :   virtual unsigned int local_edge_node(unsigned int edge,
     178             :                                        unsigned int edge_node) const override;
     179             : 
     180             :   /**
     181             :    * Builds a \p QUAD9 or \p TRI6 built coincident with face i.
     182             :    * The \p std::unique_ptr<Elem> handles the memory aspect.
     183             :    */
     184             :   virtual std::unique_ptr<Elem> build_side_ptr (const unsigned int i) override;
     185             : 
     186             :   /**
     187             :    * Rebuilds a \p QUAD9 or \p TRI6 built coincident with face i.
     188             :    */
     189             :   virtual void build_side_ptr (std::unique_ptr<Elem> & elem,
     190             :                                const unsigned int i) override;
     191             : 
     192             :   // Avoid hiding deprecated version with different signature
     193             :   using Elem::build_side_ptr;
     194             : 
     195             :   /**
     196             :    * Builds a \p EDGE3 or \p INFEDGE2 built coincident with edge i.
     197             :    * The \p std::unique_ptr<Elem> handles the memory aspect.
     198             :    */
     199             :   virtual std::unique_ptr<Elem> build_edge_ptr (const unsigned int i) override;
     200             : 
     201             :   /**
     202             :    * Rebuilds a \p EDGE3 built coincident with edges 0 to 2, or \p
     203             :    * INFEDGE2 built coincident with edges 3 to 5.
     204             :    */
     205             :   virtual void build_edge_ptr (std::unique_ptr<Elem> & edge, const unsigned int i) override;
     206             : 
     207             :   virtual void connectivity(const unsigned int sc,
     208             :                             const IOPackage iop,
     209             :                             std::vector<dof_id_type> & conn) const override;
     210             : 
     211             :   /**
     212             :    * \returns 2 for all edge nodes and 4 for face nodes.
     213             :    */
     214             :   virtual unsigned int n_second_order_adjacent_vertices (const unsigned int) const override;
     215             : 
     216             :   /**
     217             :    * \returns The element-local number of the \f$ v^{th} \f$ vertex
     218             :    * that defines the \f$ n^{th} \f$ second-order node.
     219             :    *
     220             :    * \note \p n is counted as depicted above, \f$ 6 \le n < 18 \f$.
     221             :    */
     222             :   virtual unsigned short int second_order_adjacent_vertex (const unsigned int n,
     223             :                                                            const unsigned int v) const override;
     224             : 
     225             :   /**
     226             :    * \returns The child number \p c and element-local index \p v of the
     227             :    * \f$ n^{th} \f$ second-order node on the parent element.  See
     228             :    * elem.h for further details.
     229             :    */
     230             :   virtual std::pair<unsigned short int, unsigned short int>
     231             :   second_order_child_vertex (const unsigned int n) const override;
     232             : 
     233             :   /**
     234             :    * Geometric constants for Prism18.
     235             :    */
     236             :   static const int num_nodes = 18;
     237             :   static const int nodes_per_side = 9;
     238             :   static const int nodes_per_edge = 3;
     239             : 
     240             :   /**
     241             :    * This maps the \f$ j^{th} \f$ node of the \f$ i^{th} \f$ side to
     242             :    * element node numbers.
     243             :    */
     244             :   static const ReferenceElementTable<num_sides, nodes_per_side> side_nodes_map;
     245             : 
     246             :   /**
     247             :    * This maps the \f$ j^{th} \f$ node of the \f$ i^{th} \f$ edge to
     248             :    * element node numbers.
     249             :    */
     250             :   static const ReferenceElementTable<num_edges, nodes_per_edge> edge_nodes_map;
     251             : 
     252             :   /**
     253             :    * A specialization for computing the volume of a Prism18.
     254             :    */
     255             :   virtual Real volume () const override;
     256             : 
     257             :   virtual void permute(unsigned int perm_num) override final;
     258             : 
     259             :   virtual void flip(BoundaryInfo *) override final;
     260             : 
     261             :   unsigned int center_node_on_side(const unsigned short side) const override final;
     262             : 
     263             :   ElemType side_type (const unsigned int s) const override final;
     264             : 
     265             : protected:
     266             : 
     267             :   /**
     268             :    * Data for links to nodes.
     269             :    */
     270             :   Node * _nodelinks_data[num_nodes];
     271             : 
     272             : 
     273             : 
     274             : #ifdef LIBMESH_ENABLE_AMR
     275             : 
     276             :   /**
     277             :    * Matrix used to create the elements children.
     278             :    */
     279     1009833 :   virtual Real embedding_matrix (const unsigned int i,
     280             :                                  const unsigned int j,
     281             :                                  const unsigned int k) const override
     282     1009833 :   { return _embedding_matrix[i][j][k]; }
     283             : 
     284             :   /**
     285             :    * Matrix that computes new nodal locations/solution values
     286             :    * from current nodes/solution.
     287             :    */
     288             :   static const Real _embedding_matrix[num_children][num_nodes][num_nodes];
     289             : 
     290     7342438 :   LIBMESH_ENABLE_TOPOLOGY_CACHES;
     291             : 
     292             : #endif // LIBMESH_ENABLE_AMR
     293             : 
     294             :   /**
     295             :    * Matrix that tells which vertices define the location
     296             :    * of mid-side (or second-order) nodes.  This matrix
     297             :    * handles only the second-order nodes that are unique
     298             :    * to \p Prism18.  All other second-order nodes are identical
     299             :    * with \p Prism15, and are therefore handled through a
     300             :    * matrix contained in \p cell_prism.C
     301             :    */
     302             :   static const unsigned short int _remaining_second_order_adjacent_vertices[3][4];
     303             : };
     304             : 
     305             : } // namespace libMesh
     306             : 
     307             : #endif // LIBMESH_CELL_PRISM18_H

Generated by: LCOV version 1.14