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

Generated by: LCOV version 1.14