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

Generated by: LCOV version 1.14