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

Generated by: LCOV version 1.14