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

Generated by: LCOV version 1.14