LCOV - code coverage report
Current view: top level - src/geom - edge_edge2.C (source / functions) Hit Total Coverage
Test: libMesh/libmesh: #4229 (6a9aeb) with base 727f46 Lines: 21 46 45.7 %
Date: 2025-08-19 19:27:09 Functions: 7 13 53.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             : // Local includes
      21             : #include "libmesh/edge_edge2.h"
      22             : #include "libmesh/enum_io_package.h"
      23             : #include "libmesh/enum_order.h"
      24             : 
      25             : namespace libMesh
      26             : {
      27             : 
      28             : 
      29             : // ------------------------------------------------------------
      30             : // Edge2 class static member initializations
      31             : const int Edge2::num_nodes;
      32             : 
      33             : #ifdef LIBMESH_ENABLE_AMR
      34             : 
      35             : const Real Edge2::_embedding_matrix[Edge2::num_children][Edge2::num_nodes][Edge2::num_nodes] =
      36             :   {
      37             :     // embedding matrix for child 0
      38             :     {
      39             :       // 0    1
      40             :       {1.0, 0.0}, // 0
      41             :       {0.5, 0.5}  // 1
      42             :     },
      43             : 
      44             :     // embedding matrix for child 1
      45             :     {
      46             :       // 0    1
      47             :       {0.5, 0.5}, // 0
      48             :       {0.0, 1.0}  // 1
      49             :     }
      50             :   };
      51             : 
      52             : #endif
      53             : 
      54   149664524 : bool Edge2::is_vertex(const unsigned int libmesh_dbg_var(n)) const
      55             : {
      56    10210416 :   libmesh_assert_not_equal_to (n, invalid_uint);
      57   149664524 :   return true;
      58             : }
      59             : 
      60           0 : bool Edge2::is_edge(const unsigned int) const
      61             : {
      62           0 :   return false;
      63             : }
      64             : 
      65           0 : bool Edge2::is_face(const unsigned int) const
      66             : {
      67           0 :   return false;
      68             : }
      69             : 
      70        1036 : bool Edge2::is_node_on_side(const unsigned int n,
      71             :                             const unsigned int s) const
      72             : {
      73          76 :   libmesh_assert_less (s, Edge2::num_nodes);
      74        1036 :   return (s == n);
      75             : }
      76             : 
      77           0 : bool Edge2::is_node_on_edge(const unsigned int,
      78             :                             const unsigned int libmesh_dbg_var(e)) const
      79             : {
      80           0 :   libmesh_assert_equal_to (e, 0);
      81           0 :   return true;
      82             : }
      83             : 
      84             : 
      85             : 
      86    84371348 : Order Edge2::default_order() const
      87             : {
      88    84371348 :   return FIRST;
      89             : }
      90             : 
      91             : 
      92             : 
      93           0 : bool Edge2::has_invertible_map(Real tol) const
      94             : {
      95           0 :   return this->volume() > tol;
      96             : }
      97             : 
      98             : 
      99             : 
     100           0 : void Edge2::connectivity(const unsigned int libmesh_dbg_var(sc),
     101             :                          const IOPackage iop,
     102             :                          std::vector<dof_id_type> & conn) const
     103             : {
     104           0 :   libmesh_assert_equal_to (sc, 0);
     105           0 :   libmesh_assert_less (sc, this->n_sub_elem());
     106           0 :   libmesh_assert_not_equal_to (iop, INVALID_IO_PACKAGE);
     107             : 
     108             :   // Create storage
     109           0 :   conn.resize(2);
     110             : 
     111           0 :   switch (iop)
     112             :     {
     113           0 :     case TECPLOT:
     114             :       {
     115           0 :         conn[0] = this->node_id(0)+1;
     116           0 :         conn[1] = this->node_id(1)+1;
     117           0 :         return;
     118             :       }
     119             : 
     120           0 :     case VTK:
     121             :       {
     122           0 :         conn[0] = this->node_id(0);
     123           0 :         conn[1] = this->node_id(1);
     124           0 :         return;
     125             :       }
     126             : 
     127           0 :     default:
     128           0 :       libmesh_error_msg("Unsupported IO package " << iop);
     129             :     }
     130             : }
     131             : 
     132             : 
     133          24 : Point Edge2::true_centroid () const
     134             : {
     135          26 :   return Real(0.5) * (this->point(0) + this->point(1));
     136             : }
     137             : 
     138      108503 : Real Edge2::volume () const
     139             : {
     140             :   // OK, so this is probably overkill, since it is equivalent to
     141             :   // Elem::hmax() for the Edge2, but here it is nonetheless...
     142      117710 :   return (this->point(1) - this->point(0)).norm();
     143             : }
     144             : 
     145             : 
     146             : 
     147      122716 : dof_id_type Edge2::key () const
     148             : {
     149       12572 :   return this->compute_key(this->node_id(0),
     150      122716 :                            this->node_id(1));
     151             : }
     152             : 
     153             : 
     154          72 : void Edge2::flip(BoundaryInfo * boundary_info)
     155             : {
     156           6 :   libmesh_assert(boundary_info);
     157             : 
     158          72 :   swap2nodes(0,1);
     159           6 :   swap2neighbors(0,1);
     160          72 :   swap2boundarysides(0,1,boundary_info);
     161          72 : }
     162             : 
     163             : 
     164             : } // namespace libMesh

Generated by: LCOV version 1.14