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

Generated by: LCOV version 1.14