LCOV - code coverage report
Current view: top level - include/geom - cell_pyramid13.h (source / functions) Hit Total Coverage
Test: libMesh/libmesh: #4229 (6a9aeb) with base 727f46 Lines: 6 10 60.0 %
Date: 2025-08-19 19:27:09 Functions: 5 9 55.6 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.14