LCOV - code coverage report
Current view: top level - src/fe - fe_rational_shape_1D.C (source / functions) Hit Total Coverage
Test: libMesh/libmesh: #4229 (6a9aeb) with base 727f46 Lines: 28 47 59.6 %
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/libmesh_config.h"
      22             : #ifdef LIBMESH_ENABLE_HIGHER_ORDER_SHAPES
      23             : 
      24             : #include "libmesh/libmesh_common.h"
      25             : #include "libmesh/elem.h"
      26             : #include "libmesh/fe.h"
      27             : #include "libmesh/fe_interface.h"
      28             : 
      29             : 
      30             : namespace {
      31             : using namespace libMesh;
      32             : 
      33             : static const FEFamily _underlying_fe_family = BERNSTEIN;
      34             : 
      35             : } // anonymous namespace
      36             : 
      37             : 
      38             : 
      39             : namespace libMesh
      40             : {
      41             : 
      42             : 
      43             : template <>
      44      453438 : Real FE<1,RATIONAL_BERNSTEIN>::shape(const Elem * elem,
      45             :                                      const Order order,
      46             :                                      const unsigned int i,
      47             :                                      const Point & p,
      48             :                                      const bool add_p_level)
      49             : {
      50       41226 :   libmesh_assert(elem);
      51             : 
      52             :   // FEType object for the non-rational basis underlying this one
      53       41226 :   FEType fe_type(order, _underlying_fe_family);
      54             : 
      55      494664 :   return rational_fe_shape(*elem, fe_type, i, p, add_p_level);
      56             : }
      57             : 
      58             : 
      59             : 
      60             : template <>
      61           0 : Real FE<1,RATIONAL_BERNSTEIN>::shape(const ElemType,
      62             :                                      const Order,
      63             :                                      const unsigned int,
      64             :                                      const Point &)
      65             : {
      66           0 :   libmesh_error_msg("Rational bases require the real element \nto query nodal weighting.");
      67             :   return 0.;
      68             : }
      69             : 
      70             : 
      71             : template <>
      72      453438 : Real FE<1,RATIONAL_BERNSTEIN>::shape(const FEType fet,
      73             :                                      const Elem * elem,
      74             :                                      const unsigned int i,
      75             :                                      const Point & p,
      76             :                                      const bool add_p_level)
      77             : {
      78       41226 :   libmesh_assert(elem);
      79      453438 :   return FE<1,RATIONAL_BERNSTEIN>::shape(elem, fet.order, i, p, add_p_level);
      80             : }
      81             : 
      82             : 
      83             : template <>
      84      452970 : Real FE<1,RATIONAL_BERNSTEIN>::shape_deriv(const Elem * elem,
      85             :                                            const Order order,
      86             :                                            const unsigned int i,
      87             :                                            const unsigned int j,
      88             :                                            const Point & p,
      89             :                                            const bool add_p_level)
      90             : {
      91       41187 :   libmesh_assert(elem);
      92             : 
      93       41187 :   FEType underlying_fe_type(order, _underlying_fe_family);
      94             : 
      95      452970 :   return rational_fe_shape_deriv(*elem, underlying_fe_type, i, j, p,
      96      494157 :                                  add_p_level);
      97             : }
      98             : 
      99             : 
     100             : template <>
     101           0 : Real FE<1,RATIONAL_BERNSTEIN>::shape_deriv(const ElemType,
     102             :                                            const Order,
     103             :                                            const unsigned int,
     104             :                                            const unsigned int,
     105             :                                            const Point &)
     106             : {
     107           0 :   libmesh_error_msg("Rational bases require the real element \nto query nodal weighting.");
     108             :   return 0.;
     109             : }
     110             : 
     111             : 
     112             : template <>
     113      452970 : Real FE<1,RATIONAL_BERNSTEIN>::shape_deriv(const FEType fet,
     114             :                                            const Elem * elem,
     115             :                                            const unsigned int i,
     116             :                                            const unsigned int j,
     117             :                                            const Point & p,
     118             :                                            const bool add_p_level)
     119             : {
     120       41187 :   libmesh_assert(elem);
     121      452970 :   return FE<1,RATIONAL_BERNSTEIN>::shape_deriv(elem, fet.order, i, j, p, add_p_level);
     122             : }
     123             : 
     124             : 
     125             : 
     126             : 
     127             : #ifdef LIBMESH_ENABLE_SECOND_DERIVATIVES
     128             : 
     129             : 
     130             : template <>
     131        3468 : Real FE<1,RATIONAL_BERNSTEIN>::shape_second_deriv(const Elem * elem,
     132             :                                                   const Order order,
     133             :                                                   const unsigned int i,
     134             :                                                   const unsigned int j,
     135             :                                                   const Point & p,
     136             :                                                   const bool add_p_level)
     137             : {
     138         289 :   libmesh_assert(elem);
     139             : 
     140             :   // FEType object to be passed to various FEInterface functions below.
     141         289 :   FEType underlying_fe_type(order, _underlying_fe_family);
     142             : 
     143        3468 :   return rational_fe_shape_second_deriv(*elem, underlying_fe_type, i,
     144        3757 :                                         j, p, add_p_level);
     145             : }
     146             : 
     147             : 
     148             : template <>
     149           0 : Real FE<1,RATIONAL_BERNSTEIN>::shape_second_deriv(const ElemType,
     150             :                                                   const Order,
     151             :                                                   const unsigned int,
     152             :                                                   const unsigned int,
     153             :                                                   const Point &)
     154             : {
     155           0 :   libmesh_error_msg("Rational bases require the real element \nto query nodal weighting.");
     156             :   return 0.;
     157             : }
     158             : 
     159             : 
     160             : 
     161             : 
     162             : template <>
     163           0 : Real FE<1,RATIONAL_BERNSTEIN>::shape_second_deriv(const FEType fet,
     164             :                                                   const Elem * elem,
     165             :                                                   const unsigned int i,
     166             :                                                   const unsigned int j,
     167             :                                                   const Point & p,
     168             :                                                   const bool add_p_level)
     169             : {
     170           0 :   libmesh_assert(elem);
     171           0 :   return FE<1,RATIONAL_BERNSTEIN>::shape_second_deriv(elem, fet.order, i, j, p, add_p_level);
     172             : }
     173             : 
     174             : 
     175             : #endif
     176             : 
     177             : 
     178             : template<>
     179           0 : void FE<1,RATIONAL_BERNSTEIN>::shapes
     180             :   (const Elem * elem,
     181             :    const Order o,
     182             :    const unsigned int i,
     183             :    const std::vector<Point> & p,
     184             :    std::vector<OutputShape> & vi,
     185             :    const bool add_p_level)
     186             : {
     187           0 :   libmesh_assert_equal_to(p.size(), vi.size());
     188           0 :   for (auto j : index_range(vi))
     189           0 :     vi[j] = FE<1,RATIONAL_BERNSTEIN>::shape (elem, o, i, p[j], add_p_level);
     190           0 : }
     191             : 
     192             : template<>
     193        1404 : void FE<1,RATIONAL_BERNSTEIN>::all_shapes
     194             :   (const Elem * elem,
     195             :    const Order o,
     196             :    const std::vector<Point> & p,
     197             :    std::vector<std::vector<OutputShape>> & v,
     198             :    const bool add_p_level)
     199             : {
     200         117 :   FEType underlying_fe_type(o, _underlying_fe_family);
     201             : 
     202        1404 :   rational_all_shapes(*elem, underlying_fe_type, p, v, add_p_level);
     203        1404 : }
     204             : 
     205             : 
     206             : template<>
     207           0 : void FE<1,RATIONAL_BERNSTEIN>::shape_derivs
     208             :   (const Elem * elem,
     209             :    const Order o,
     210             :    const unsigned int i,
     211             :    const unsigned int j,
     212             :    const std::vector<Point> & p,
     213             :    std::vector<OutputShape> & v,
     214             :    const bool add_p_level)
     215             : {
     216           0 :   libmesh_assert_equal_to(p.size(), v.size());
     217           0 :   for (auto vi : index_range(v))
     218           0 :     v[vi] = FE<1,RATIONAL_BERNSTEIN>::shape_deriv (elem, o, i, j, p[vi], add_p_level);
     219           0 : }
     220             : 
     221             : 
     222             : template <>
     223             : void
     224        1272 : FE<1,RATIONAL_BERNSTEIN>::all_shape_derivs (const Elem * elem,
     225             :                                             const Order o,
     226             :                                             const std::vector<Point> & p,
     227             :                                             std::vector<std::vector<Real>> * comps[3],
     228             :                                             const bool add_p_level)
     229             : {
     230         106 :   FEType underlying_fe_type(o, _underlying_fe_family);
     231             : 
     232        1272 :   rational_all_shape_derivs (*elem, underlying_fe_type, p,
     233             :                              comps, add_p_level);
     234        1272 : }
     235             : 
     236             : 
     237             : } // namespace libMesh
     238             : 
     239             : 
     240             : #endif //LIBMESH_ENABLE_HIGHER_ORDER_SHAPES

Generated by: LCOV version 1.14