LCOV - code coverage report
Current view: top level - src/fe - inf_fe_jacobi_30_00_eval.C (source / functions) Hit Total Coverage
Test: libMesh/libmesh: #4229 (6a9aeb) with base 727f46 Lines: 9 13 69.2 %
Date: 2025-08-19 19:27:09 Functions: 4 8 50.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             : // Local Includes
      20             : #include "libmesh/libmesh_config.h"
      21             : 
      22             : #ifdef LIBMESH_ENABLE_INFINITE_ELEMENTS
      23             : 
      24             : #include "libmesh/inf_fe.h"
      25             : #include "libmesh/jacobi_polynomials.h"
      26             : 
      27             : namespace libMesh
      28             : {
      29             : 
      30             : // Anonymous namespace for local helper functions
      31             : namespace {
      32             : 
      33         410 : Real jacobi_30_00_eval(unsigned n, Real x)
      34             : {
      35         410 :   if (n == 0)
      36          44 :     return 1.;
      37             : 
      38         300 :   Real val = JacobiPolynomials::value(n, /*alpha=*/3, /*beta=*/0, x);
      39             : 
      40             :   // For n>0, there is an even/odd shift of -1/+1 applied. I'm not
      41             :   // sure why this is done for the infinite elements, as it is not
      42             :   // part of the "standard" Jacobi polynomial definition, I'm just
      43             :   // copying what was done in the original implementation...
      44         405 :   return val + (n % 2 == 0 ? -1 : +1);
      45             : }
      46             : 
      47         164 : Real jacobi_30_00_eval_deriv(unsigned n, Real x)
      48             : {
      49         410 :   return JacobiPolynomials::deriv(n, /*alpha=*/3, /*beta=*/0, x);
      50             : }
      51             : } // anonymous namespace
      52             : 
      53             : 
      54             : 
      55             : // Specialize the eval() function for 1, 2, and 3 dimensions and the CARTESIAN mapping type
      56             : // to call the local helper function from the anonymous namespace.
      57           0 : template <> Real InfFE<1,JACOBI_30_00,CARTESIAN>::eval(Real x, Order, unsigned n) { return jacobi_30_00_eval(n, x); }
      58           0 : template <> Real InfFE<2,JACOBI_30_00,CARTESIAN>::eval(Real x, Order, unsigned n) { return jacobi_30_00_eval(n, x); }
      59         410 : template <> Real InfFE<3,JACOBI_30_00,CARTESIAN>::eval(Real x, Order, unsigned n) { return jacobi_30_00_eval(n, x); }
      60             : 
      61             : // Specialize the eval_deriv() function for 1, 2, and 3 dimensions and the CARTESIAN mapping type
      62             : // to call the local helper function from the anonymous namespace.
      63           0 : template <> Real InfFE<1,JACOBI_30_00,CARTESIAN>::eval_deriv(Real x, Order, unsigned n) { return jacobi_30_00_eval_deriv(n, x); }
      64           0 : template <> Real InfFE<2,JACOBI_30_00,CARTESIAN>::eval_deriv(Real x, Order, unsigned n) { return jacobi_30_00_eval_deriv(n, x); }
      65         574 : template <> Real InfFE<3,JACOBI_30_00,CARTESIAN>::eval_deriv(Real x, Order, unsigned n) { return jacobi_30_00_eval_deriv(n, x); }
      66             : 
      67             : } // namespace libMesh
      68             : 
      69             : #endif // LIBMESH_ENABLE_INFINITE_ELEMENTS

Generated by: LCOV version 1.14