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

Generated by: LCOV version 1.14