LCOV - code coverage report
Current view: top level - include/geom - cell_tet14.h (source / functions) Hit Total Coverage
Test: libMesh/libmesh: #4554 (5a536d) with base 54e0d5 Lines: 7 8 87.5 %
Date: 2026-09-16 12:37:14 Functions: 6 8 75.0 %
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_TET14_H
      21             : #define LIBMESH_CELL_TET14_H
      22             : 
      23             : // Local includes
      24             : #include "libmesh/cell_tet.h"
      25             : #include "libmesh/fe_reference_element_traits.h"
      26             : 
      27             : namespace libMesh
      28             : {
      29             : 
      30             : /**
      31             :  * The \p Tet14 is an element in 3D composed of 14 nodes.  Its edges
      32             :  * and vertices are numbered as in Tet10, like this:
      33             :  *
      34             :  * \verbatim
      35             :  *               3
      36             :  *   TET14:      o
      37             :  *              /|\
      38             :  *             / | \
      39             :  *         7  /  |  \9
      40             :  *           o   |   o              zeta
      41             :  *          /    |8   \              ^
      42             :  *         /     o     \             |
      43             :  *        /    6 |      \            |
      44             :  *     0 o.....o.|.......o 2         o---> eta
      45             :  *        \      |      /             \
      46             :  *         \     |     /               \
      47             :  *          \    |    /                 xi (out of page)
      48             :  *         4 o   |   o 5
      49             :  *            \  |  /
      50             :  *             \ | /
      51             :  *              \|/
      52             :  *               o
      53             :  *               1
      54             :  * \endverbatim
      55             :  *
      56             :  * And it also includes four face nodes:
      57             :  * Node 10, centroid on side 0, arithmetic mean of 0/1/2 or 4/5/6
      58             :  * Node 11, centroid on side 1, arithmetic mean of 0/1/3 or 4/7/8
      59             :  * Node 12, centroid on side 2, arithmetic mean of 1/2/3 or 5/8/9
      60             :  * Node 13, centroid on side 3, arithmetic mean of 0/2/3 or 6/7/9
      61             :  *
      62             :  * (xi, eta, zeta): { 0 <= xi   <= 1
      63             :  *                  { 0 <= eta  <= 1
      64             :  *                  { 0 <= zeta <= 1
      65             :  *                  { xi + eta + zeta <= 1
      66             :  *
      67             :  * \author Roy H. Stogner
      68             :  * \date 2021
      69             :  * \brief A 3D tetrahedral element with 14 nodes.
      70             :  */
      71             : class Tet14 final : public Tet
      72             : {
      73             : public:
      74             : 
      75             :   /**
      76             :    * Constructor.  By default this element has no parent.
      77             :    */
      78             :   explicit
      79      191115 :   Tet14 (Elem * p=nullptr) :
      80      191115 :     Tet(num_nodes, p, _nodelinks_data)
      81      191115 :   {}
      82             : 
      83             :   Tet14 (Tet14 &&) = delete;
      84             :   Tet14 (const Tet14 &) = delete;
      85             :   Tet14 & operator= (const Tet14 &) = delete;
      86             :   Tet14 & operator= (Tet14 &&) = delete;
      87      320962 :   virtual ~Tet14() = default;
      88             : 
      89             :   /**
      90             :    * \returns \p TET14.
      91             :    */
      92  3651604123 :   virtual ElemType type () const override { return TET14; }
      93             : 
      94             :   /**
      95             :    * \returns 14.
      96             :    */
      97  1598864235 :   virtual unsigned int n_nodes() const override { return num_nodes; }
      98             : 
      99             :   /**
     100             :    * \returns 8.
     101             :    */
     102           0 :   virtual unsigned int n_sub_elem() const override { return 8; }
     103             : 
     104             :   /**
     105             :    * \returns \p true if the specified (local) node number is a vertex.
     106             :    */
     107             :   virtual bool is_vertex(const unsigned int i) const override;
     108             : 
     109             :   /**
     110             :    * \returns \p true if the specified (local) node number is an edge.
     111             :    */
     112             :   virtual bool is_edge(const unsigned int i) const override;
     113             : 
     114             :   /**
     115             :    * \returns \p true if the specified (local) node number is a face.
     116             :    */
     117             :   virtual bool is_face(const unsigned int i) const override;
     118             : 
     119             :   /**
     120             :    * \returns \p true if the specified (local) node number is on the
     121             :    * specified side.
     122             :    */
     123             :   virtual bool is_node_on_side(const unsigned int n,
     124             :                                const unsigned int s) const override;
     125             : 
     126             :   virtual std::vector<unsigned int> nodes_on_side(const unsigned int s) const override;
     127             : 
     128             :   virtual std::vector<unsigned int> nodes_on_edge(const unsigned int e) const override;
     129             : 
     130             :   /**
     131             :    * \returns \p true if the specified (local) node number is on the
     132             :    * specified edge.
     133             :    */
     134             :   virtual bool is_node_on_edge(const unsigned int n,
     135             :                                const unsigned int e) const override;
     136             : 
     137             :   /**
     138             :    * \returns \p true if the specified child is on the
     139             :    * specified side.
     140             :    */
     141             :   virtual bool is_child_on_side(const unsigned int c,
     142             :                                 const unsigned int s) 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 THIRD.
     152             :    */
     153             :   virtual Order default_order() const override;
     154             : 
     155             :   /**
     156             :    * \returns \p Tet14::side_nodes_map[side][side_node] after doing some range checking.
     157             :    */
     158             :   virtual unsigned int local_side_node(unsigned int side,
     159             :                                        unsigned int side_node) const override;
     160             : 
     161             :   /**
     162             :    * \returns \p Tet14::edge_nodes_map[edge][edge_node] after doing some range checking.
     163             :    */
     164             :   virtual unsigned int local_edge_node(unsigned int edge,
     165             :                                        unsigned int edge_node) const override;
     166             : 
     167             :   /**
     168             :    * Builds a \p TRI7 built coincident with face i.
     169             :    * The \p std::unique_ptr<Elem> handles the memory aspect.
     170             :    */
     171             :   virtual std::unique_ptr<Elem> build_side_ptr (const unsigned int i) override;
     172             : 
     173             :   /**
     174             :    * Rebuilds a TRI7 built coincident with face i.
     175             :    */
     176             :   virtual void build_side_ptr (std::unique_ptr<Elem> & elem,
     177             :                                const unsigned int i) override;
     178             : 
     179             :   // Avoid hiding deprecated version with different signature
     180             :   using Elem::build_side_ptr;
     181             : 
     182             :   /**
     183             :    * Builds a \p EDGE3 built coincident with edge i.
     184             :    * The \p std::unique_ptr<Elem> handles the memory aspect.
     185             :    */
     186             :   virtual std::unique_ptr<Elem> build_edge_ptr (const unsigned int i) override;
     187             : 
     188             :   /**
     189             :    * Rebuilds a \p EDGE3 coincident with edge i.
     190             :    */
     191             :   virtual void build_edge_ptr (std::unique_ptr<Elem> & edge, const unsigned int i) override;
     192             : 
     193             :   virtual void connectivity(const unsigned int sc,
     194             :                             const IOPackage iop,
     195             :                             std::vector<dof_id_type> & conn) const override;
     196             : 
     197             :   /**
     198             :    * \returns 2 for edge nodes and 3 for face nodes
     199             :    */
     200             :   virtual unsigned int n_second_order_adjacent_vertices (const unsigned int) const override;
     201             : 
     202             :   /**
     203             :    * \returns The element-local number of the \f$ v^{th} \f$ vertex
     204             :    * that defines the \f$ n^{th} \f$ second-order node.
     205             :    *
     206             :    * \note \p n is counted as depicted above, \f$ 4 \le n < 14 \f$.
     207             :    */
     208             :   virtual unsigned short int second_order_adjacent_vertex (const unsigned int n,
     209             :                                                            const unsigned int v) const override;
     210             : 
     211             :   /**
     212             :    * \returns The child number \p c and element-local index \p v of the
     213             :    * \f$ n^{th} \f$ second-order node on the parent element.  See
     214             :    * elem.h for further details.
     215             :    */
     216             :   virtual std::pair<unsigned short int, unsigned short int>
     217             :   second_order_child_vertex (const unsigned int n) const override;
     218             : 
     219             :   /**
     220             :    * Geometric constants for Tet14.
     221             :    */
     222             :   static const int num_nodes = 14;
     223             :   static const int nodes_per_side = 7;
     224             :   static const int nodes_per_edge = 3;
     225             : 
     226             :   /**
     227             :    * This maps the \f$ j^{th} \f$ node of the \f$ i^{th} \f$ side to
     228             :    * element node numbers.
     229             :    */
     230             :   static const ReferenceElementTable<num_sides, nodes_per_side> side_nodes_map;
     231             : 
     232             :   /**
     233             :    * This maps the \f$ j^{th} \f$ node of the \f$ i^{th} \f$ edge to
     234             :    * element node numbers.
     235             :    */
     236             :   static const ReferenceElementTable<num_edges, nodes_per_edge> edge_nodes_map;
     237             : 
     238             :   virtual void permute(unsigned int perm_num) override final;
     239             : 
     240             :   virtual void flip(BoundaryInfo *) override final;
     241             : 
     242             :   ElemType side_type (const unsigned int s) const override final;
     243             : 
     244             : #ifdef LIBMESH_ENABLE_AMR
     245             :   virtual
     246             :   const std::vector<std::pair<unsigned char, unsigned char>> &
     247             :   parent_bracketing_nodes(unsigned int c,
     248             :                           unsigned int n) const override;
     249             : #endif
     250             : 
     251             : protected:
     252             : 
     253             :   /**
     254             :    * Data for links to nodes.
     255             :    */
     256             :   Node * _nodelinks_data[num_nodes];
     257             : 
     258             : 
     259             : 
     260             : #ifdef LIBMESH_ENABLE_AMR
     261             : 
     262             :   /**
     263             :    * Matrix used to create the elements children.
     264             :    */
     265             :   virtual Real embedding_matrix (const unsigned int i,
     266             :                                  const unsigned int j,
     267             :                                  const unsigned int k) const override;
     268             : 
     269             :   /**
     270             :    * Matrix that computes new nodal locations/solution values
     271             :    * from current nodes/solution.
     272             :    */
     273             :   static const Real _embedding_matrix[num_children][num_nodes][num_nodes];
     274             : 
     275             :   /**
     276             :    * Pairs of nodes that bracket child nodes when doing mesh
     277             :    * refinement, for each of the three possible diagonal selection
     278             :    * options.
     279             :    */
     280             :   static const std::vector<std::pair<unsigned char, unsigned char>>
     281             :     _parent_bracketing_nodes[3][num_children][num_nodes];
     282             : 
     283     2878848 :   LIBMESH_ENABLE_TOPOLOGY_CACHES;
     284             : 
     285             : #endif // LIBMESH_ENABLE_AMR
     286             : 
     287             : private:
     288             : 
     289             :   /**
     290             :    * Matrix that tells which vertices define the location
     291             :    * of mid-side or mid-face nodes, indexed by node_num-4
     292             :    */
     293             :   static const unsigned short int _second_order_adjacent_vertices[10][3];
     294             : 
     295             :   /**
     296             :    * Vector that names a child sharing each second order node.
     297             :    */
     298             :   static const unsigned short int _second_order_vertex_child_number[14];
     299             : 
     300             :   /**
     301             :    * Vector that names the child vertex index for each second order node.
     302             :    */
     303             :   static const unsigned short int _second_order_vertex_child_index[14];
     304             : };
     305             : 
     306             : } // namespace libMesh
     307             : 
     308             : 
     309             : #endif // LIBMESH_CELL_TET14_H

Generated by: LCOV version 1.14