LCOV - code coverage report
Current view: top level - src/fe - fe_scalar.C (source / functions) Hit Total Coverage
Test: libMesh/libmesh: #4229 (6a9aeb) with base 727f46 Lines: 11 48 22.9 %
Date: 2025-08-19 19:27:09 Functions: 10 56 17.9 %
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/dof_map.h"
      22             : #include "libmesh/elem.h"
      23             : #include "libmesh/fe.h"
      24             : #include "libmesh/fe_macro.h"
      25             : 
      26             : namespace libMesh
      27             : {
      28             : 
      29             : // ------------------------------------------------------------
      30             : // SCALAR-specific implementations
      31             : 
      32             : // Anonymous namespace for local helper functions
      33             : namespace {
      34             : 
      35      218260 : void scalar_nodal_soln(const Elem * elem,
      36             :                        const Order order,
      37             :                        const std::vector<Number> & elem_soln,
      38             :                        std::vector<Number> &       nodal_soln,
      39             :                        const bool /*add_p_level*/)
      40             : {
      41      218260 :   const unsigned int n_nodes = elem->n_nodes();
      42      218260 :   nodal_soln.resize(n_nodes);
      43             : 
      44             :   // If the SCALAR order is CONSTANT, just set the nodal values
      45             :   // to zero, otherwise, set to the value of the first SCALAR dof
      46     3162184 :   for (unsigned int i=0; i<n_nodes; i++)
      47     2943924 :     nodal_soln[i] = (order == CONSTANT) ? 0. : elem_soln[0];
      48      218260 : } // scalar_nodal_soln()
      49             : 
      50             : } // anonymous namespace
      51             : 
      52             : 
      53             : // Instantiate (side_) nodal_soln() function for every dimension
      54      218260 : LIBMESH_FE_NODAL_SOLN(SCALAR, scalar_nodal_soln)
      55           0 : LIBMESH_FE_SIDE_NODAL_SOLN(SCALAR)
      56             : 
      57             : 
      58             : // Full specialization of n_dofs() function for every dimension
      59             : // The Order indicates the number of SCALAR dofs
      60           0 : template <> unsigned int FE<0,SCALAR>::n_dofs(const ElemType, const Order o) { return o; }
      61           0 : template <> unsigned int FE<1,SCALAR>::n_dofs(const ElemType, const Order o) { return o; }
      62           0 : template <> unsigned int FE<2,SCALAR>::n_dofs(const ElemType, const Order o) { return o; }
      63           0 : template <> unsigned int FE<3,SCALAR>::n_dofs(const ElemType, const Order o) { return o; }
      64             : 
      65           0 : template <> unsigned int FE<0,SCALAR>::n_dofs(const Elem *, const Order o) { return o; }
      66           0 : template <> unsigned int FE<1,SCALAR>::n_dofs(const Elem *, const Order o) { return o; }
      67        1600 : template <> unsigned int FE<2,SCALAR>::n_dofs(const Elem *, const Order o) { return o; }
      68         284 : template <> unsigned int FE<3,SCALAR>::n_dofs(const Elem *, const Order o) { return o; }
      69             : 
      70             : // Full specialization of n_dofs_at_node() function for every dimension.
      71             : // SCALARs have no dofs at nodes
      72           0 : template <> unsigned int FE<0,SCALAR>::n_dofs_at_node(const ElemType, const Order, const unsigned int) { return 0; }
      73           0 : template <> unsigned int FE<1,SCALAR>::n_dofs_at_node(const ElemType, const Order, const unsigned int) { return 0; }
      74           0 : template <> unsigned int FE<2,SCALAR>::n_dofs_at_node(const ElemType, const Order, const unsigned int) { return 0; }
      75           0 : template <> unsigned int FE<3,SCALAR>::n_dofs_at_node(const ElemType, const Order, const unsigned int) { return 0; }
      76             : 
      77           0 : template <> unsigned int FE<0,SCALAR>::n_dofs_at_node(const Elem &, const Order, const unsigned int) { return 0; }
      78           0 : template <> unsigned int FE<1,SCALAR>::n_dofs_at_node(const Elem &, const Order, const unsigned int) { return 0; }
      79           0 : template <> unsigned int FE<2,SCALAR>::n_dofs_at_node(const Elem &, const Order, const unsigned int) { return 0; }
      80           0 : template <> unsigned int FE<3,SCALAR>::n_dofs_at_node(const Elem &, const Order, const unsigned int) { return 0; }
      81             : 
      82             : // Full specialization of n_dofs_per_elem() function for every dimension.
      83             : // SCALARs have no dofs per element
      84           0 : template <> unsigned int FE<0,SCALAR>::n_dofs_per_elem(const ElemType, const Order) { return 0; }
      85           0 : template <> unsigned int FE<1,SCALAR>::n_dofs_per_elem(const ElemType, const Order) { return 0; }
      86           0 : template <> unsigned int FE<2,SCALAR>::n_dofs_per_elem(const ElemType, const Order) { return 0; }
      87           0 : template <> unsigned int FE<3,SCALAR>::n_dofs_per_elem(const ElemType, const Order) { return 0; }
      88             : 
      89           0 : template <> unsigned int FE<0,SCALAR>::n_dofs_per_elem(const Elem &, const Order) { return 0; }
      90           0 : template <> unsigned int FE<1,SCALAR>::n_dofs_per_elem(const Elem &, const Order) { return 0; }
      91           0 : template <> unsigned int FE<2,SCALAR>::n_dofs_per_elem(const Elem &, const Order) { return 0; }
      92           0 : template <> unsigned int FE<3,SCALAR>::n_dofs_per_elem(const Elem &, const Order) { return 0; }
      93             : 
      94             : // Scalar FEMs are discontinuous
      95           0 : template <> FEContinuity FE<0,SCALAR>::get_continuity() const { return DISCONTINUOUS; }
      96           0 : template <> FEContinuity FE<1,SCALAR>::get_continuity() const { return DISCONTINUOUS; }
      97           0 : template <> FEContinuity FE<2,SCALAR>::get_continuity() const { return DISCONTINUOUS; }
      98           0 : template <> FEContinuity FE<3,SCALAR>::get_continuity() const { return DISCONTINUOUS; }
      99             : 
     100             : // Scalar FEMs are not hierarchic
     101           0 : template <> bool FE<0,SCALAR>::is_hierarchic() const { return false; }
     102           0 : template <> bool FE<1,SCALAR>::is_hierarchic() const { return false; }
     103           0 : template <> bool FE<2,SCALAR>::is_hierarchic() const { return false; }
     104           0 : template <> bool FE<3,SCALAR>::is_hierarchic() const { return false; }
     105             : 
     106             : 
     107             : #ifdef LIBMESH_ENABLE_AMR
     108             : // compute_constraints() just returns for SCALAR FEMs
     109             : template <>
     110           0 : void FE<2,SCALAR>::compute_constraints (DofConstraints &,
     111             :                                         DofMap &,
     112             :                                         const unsigned int,
     113             :                                         const Elem *)
     114           0 : { }
     115             : 
     116             : template <>
     117           0 : void FE<3,SCALAR>::compute_constraints (DofConstraints &,
     118             :                                         DofMap &,
     119             :                                         const unsigned int,
     120             :                                         const Elem *)
     121           0 : { }
     122             : #endif // #ifdef LIBMESH_ENABLE_AMR
     123             : 
     124             : // Scalar FEM shapes do not need reinit
     125           0 : template <> bool FE<0,SCALAR>::shapes_need_reinit() const { return false; }
     126           0 : template <> bool FE<1,SCALAR>::shapes_need_reinit() const { return false; }
     127      129196 : template <> bool FE<2,SCALAR>::shapes_need_reinit() const { return false; }
     128      410548 : template <> bool FE<3,SCALAR>::shapes_need_reinit() const { return false; }
     129             : 
     130             : } // namespace libMesh

Generated by: LCOV version 1.14