LCOV - code coverage report
Current view: top level - include/geom - face_tri6.h (source / functions) Hit Total Coverage
Test: libMesh/libmesh: #4229 (6a9aeb) with base 727f46 Lines: 12 13 92.3 %
Date: 2025-08-19 19:27:09 Functions: 10 11 90.9 %
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_FACE_TRI6_H
      21             : #define LIBMESH_FACE_TRI6_H
      22             : 
      23             : // Local includes
      24             : #include "libmesh/libmesh_common.h"
      25             : #include "libmesh/face_tri.h"
      26             : 
      27             : namespace libMesh
      28             : {
      29             : 
      30             : /**
      31             :  * The \p Tri6 is an element in 2D composed of 6 nodes.  It is
      32             :  * numbered like this:
      33             :  *
      34             :  * \verbatim
      35             :  *   TRI6:
      36             :  *    2
      37             :  *    o
      38             :  *    |\
      39             :  *    | \
      40             :  *    |  \            eta
      41             :  *    |   \            ^
      42             :  *    |    \           |
      43             :  *  5 o     o 4        |
      44             :  *    |      \         o---> xi
      45             :  *    |       \
      46             :  *    |        \
      47             :  *    o----o----o
      48             :  *    0    3    1
      49             :  * \endverbatim
      50             :  *
      51             :  * (xi, eta): { 0 <= xi  <= 1
      52             :  *            { 0 <= eta <= 1
      53             :  *            { xi + eta <= 1
      54             :  * are the reference element coordinates associated with the given
      55             :  * numbering.
      56             :  *
      57             :  * \author Benjamin S. Kirk
      58             :  * \date 2002
      59             :  * \brief A 2D triangular element with 6 nodes.
      60             :  */
      61             : class Tri6 : public Tri
      62             : {
      63             : public:
      64             : 
      65             :   /**
      66             :    * Constructor.  By default this element has no parent.
      67             :    */
      68             :   explicit
      69     4603877 :   Tri6 (Elem * p=nullptr) :
      70     4603877 :     Tri(num_nodes, p, _nodelinks_data) {}
      71             : 
      72             :   Tri6 (Tri6 &&) = delete;
      73             :   Tri6 (const Tri6 &) = delete;
      74             :   Tri6 & operator= (const Tri6 &) = delete;
      75             :   Tri6 & operator= (Tri6 &&) = delete;
      76     4770008 :   virtual ~Tri6() = default;
      77             : 
      78             :   /**
      79             :    * \returns \p TRI6.
      80             :    */
      81 14249169675 :   virtual ElemType type () const override { return TRI6; }
      82             : 
      83             :   /**
      84             :    * \returns 6.
      85             :    */
      86  1995482255 :   virtual unsigned int n_nodes() const override { return num_nodes; }
      87             : 
      88             :   /**
      89             :    * \returns 4.
      90             :    */
      91           0 :   virtual unsigned int n_sub_elem() const override { return 4; }
      92             : 
      93             :   /**
      94             :    * \returns \p true if the specified (local) node number is a vertex.
      95             :    */
      96             :   virtual bool is_vertex(const unsigned int i) const override;
      97             : 
      98             :   /**
      99             :    * \returns \p true if the specified (local) node number is an edge.
     100             :    */
     101             :   virtual bool is_edge(const unsigned int i) const override;
     102             : 
     103             :   /**
     104             :    * \returns \p true if the specified (local) node number is a face.
     105             :    */
     106             :   virtual bool is_face(const unsigned int i) const override;
     107             : 
     108             :   /**
     109             :    * \returns \p true if the specified (local) node number is on the
     110             :    * specified side.
     111             :    */
     112             :   virtual bool is_node_on_side(const unsigned int n,
     113             :                                const unsigned int s) const override;
     114             : 
     115             :   virtual std::vector<unsigned int> nodes_on_side(const unsigned int s) const override;
     116             : 
     117             :   virtual std::vector<unsigned int> nodes_on_edge(const unsigned int e) const override;
     118             : 
     119             :   /**
     120             :    * \returns \p true if the specified (local) node number is on the
     121             :    * specified edge (== is_node_on_side in 2D).
     122             :    */
     123       33997 :   virtual bool is_node_on_edge(const unsigned int n,
     124             :                                const unsigned int e) const override
     125       33997 :   { return this->is_node_on_side(n,e); }
     126             : 
     127             :   /**
     128             :    * \returns \p true if the element map is definitely affine within
     129             :    * numerical tolerances.
     130             :    */
     131             :   virtual bool has_affine_map () const override;
     132             : 
     133             :   /**
     134             :    * \returns SECOND.
     135             :    */
     136             :   virtual Order default_order() const override;
     137             : 
     138             :   /**
     139             :    * Don't hide Elem::key() defined in the base class.
     140             :    */
     141             :   using Elem::key;
     142             : 
     143             :   /**
     144             :    * \returns An id associated with the \p s side of this element.
     145             :    * The id is not necessarily unique, but should be close.
     146             :    *
     147             :    * We reimplement this method here for the \p Tri6 since we can
     148             :    * use the center node of each edge to provide a perfect (unique)
     149             :    * key.
     150             :    */
     151             :   virtual dof_id_type key (const unsigned int s) const override;
     152             : 
     153             :   /**
     154             :    * \returns \p Tri6::side_nodes_map[side][side_node] after doing some range checking.
     155             :    */
     156             :   virtual unsigned int local_side_node(unsigned int side,
     157             :                                        unsigned int side_node) const override;
     158             : 
     159             :   virtual std::unique_ptr<Elem> build_side_ptr (const unsigned int i) override;
     160             : 
     161             :   /**
     162             :    * Rebuilds an EDGE2 coincident with face i.
     163             :    */
     164             :   virtual void build_side_ptr (std::unique_ptr<Elem> & elem,
     165             :                                const unsigned int i) override;
     166             : 
     167             :   // Avoid hiding deprecated version with different signature
     168             :   using Elem::build_side_ptr;
     169             : 
     170             :   virtual void connectivity(const unsigned int sf,
     171             :                             const IOPackage iop,
     172             :                             std::vector<dof_id_type> & conn) const override;
     173             : 
     174             :   /**
     175             :    * \returns 2 for all \p n.
     176             :    */
     177        5835 :   virtual unsigned int n_second_order_adjacent_vertices (const unsigned int) const override
     178        5835 :   { return 2; }
     179             : 
     180             :   /**
     181             :    * \returns The element-local number of the  \f$ v^{th} \f$ vertex
     182             :    * that defines the \f$ n^{th} \f$ second-order node.
     183             :    *
     184             :    * \note \p n is counted as depicted above, \f$ 3 \le n < 6 \f$.
     185             :    */
     186             :   virtual unsigned short int second_order_adjacent_vertex (const unsigned int n,
     187             :                                                            const unsigned int v) const override;
     188             : 
     189             :   /**
     190             :    * \returns The child number \p c and element-local index \p v of the
     191             :    * \f$ n^{th} \f$ second-order node on the parent element.  See
     192             :    * elem.h for further details.
     193             :    */
     194             :   virtual std::pair<unsigned short int, unsigned short int>
     195             :   second_order_child_vertex (const unsigned int n) const override;
     196             : 
     197             :   /**
     198             :    * Geometric constants for Tri6.
     199             :    */
     200             :   static const int num_nodes = 6;
     201             :   static const int nodes_per_side = 3;
     202             : 
     203             :   /**
     204             :    * This maps the \f$ j^{th} \f$ node of the \f$ i^{th} \f$ side to
     205             :    * element node numbers.
     206             :    */
     207             :   static const unsigned int side_nodes_map[num_sides][nodes_per_side];
     208             : 
     209             :   /**
     210             :    * An optimized method for approximating the area of a
     211             :    * TRI6 using quadrature.
     212             :    */
     213             :   virtual Real volume () const override;
     214             : 
     215             :   /**
     216             :    * \returns A bounding box (not necessarily the minimal bounding box)
     217             :    * containing the geometric element.
     218             :    */
     219             :   virtual BoundingBox loose_bounding_box () const override;
     220             : 
     221             :   virtual void permute(unsigned int perm_num) override final;
     222             : 
     223             :   virtual void flip(BoundaryInfo *) override final;
     224             : 
     225             :   unsigned int center_node_on_side(const unsigned short side) const override final;
     226             : 
     227             :   ElemType side_type (const unsigned int s) const override final;
     228             : 
     229             : protected:
     230             : 
     231             :   /**
     232             :    * Data for links to nodes.
     233             :    */
     234             :   Node * _nodelinks_data[num_nodes];
     235             : 
     236             : 
     237             : 
     238             : #ifdef LIBMESH_ENABLE_AMR
     239             : 
     240             :   /**
     241             :    * Matrix used to create the elements children.
     242             :    */
     243      610452 :   virtual Real embedding_matrix (const unsigned int i,
     244             :                                  const unsigned int j,
     245             :                                  const unsigned int k) const override
     246      610452 :   { return _embedding_matrix[i][j][k]; }
     247             : 
     248             :   /**
     249             :    * Matrix that computes new nodal locations/solution values
     250             :    * from current nodes/solution.
     251             :    */
     252             :   static const Real _embedding_matrix[num_children][num_nodes][num_nodes];
     253             : 
     254     1261448 :   LIBMESH_ENABLE_TOPOLOGY_CACHES;
     255             : 
     256             : #endif // LIBMESH_ENABLE_AMR
     257             : 
     258             : private:
     259             : 
     260             :   /**
     261             :    * Matrix that tells which vertices define the location
     262             :    * of mid-side (or second-order) nodes
     263             :    */
     264             :   static const unsigned short int _second_order_adjacent_vertices[num_sides][2];
     265             : 
     266             :   /**
     267             :    * Vector that names a child sharing each second order node.
     268             :    */
     269             :   static const unsigned short int _second_order_vertex_child_number[num_nodes];
     270             : 
     271             :   /**
     272             :    * Vector that names the child vertex index for each second order node.
     273             :    */
     274             :   static const unsigned short int _second_order_vertex_child_index[num_nodes];
     275             : };
     276             : 
     277             : 
     278             : } // namespace libMesh
     279             : 
     280             : #endif // LIBMESH_FACE_TRI6_H

Generated by: LCOV version 1.14