LCOV - code coverage report
Current view: top level - src/numerics - sum_shell_matrix.C (source / functions) Hit Total Coverage
Test: libMesh/libmesh: #4229 (6a9aeb) with base 727f46 Lines: 8 26 30.8 %
Date: 2025-08-19 19:27:09 Functions: 2 10 20.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             : 
      20             : // Local includes
      21             : #include "libmesh/sum_shell_matrix.h"
      22             : #include "libmesh/numeric_vector.h"
      23             : #include "libmesh/int_range.h"
      24             : 
      25             : namespace libMesh
      26             : {
      27             : 
      28             : template <typename T>
      29           0 : numeric_index_type SumShellMatrix<T>::m () const
      30             : {
      31           0 :   libmesh_assert(!matrices.empty());
      32           0 :   const numeric_index_type n_rows = matrices[0]->m();
      33             : #ifndef NDEBUG
      34           0 :   for (auto i : index_range(matrices))
      35           0 :     libmesh_assert_equal_to (matrices[i]->m(), n_rows);
      36             : #endif
      37           0 :   return n_rows;
      38             : }
      39             : 
      40             : 
      41             : 
      42             : template <typename T>
      43           0 : numeric_index_type SumShellMatrix<T>::n () const
      44             : {
      45           0 :   libmesh_assert(!matrices.empty());
      46           0 :   const numeric_index_type n_cols = matrices[0]->n();
      47             : #ifndef NDEBUG
      48           0 :   for (auto i : index_range(matrices))
      49           0 :     libmesh_assert_equal_to (matrices[i]->n(), n_cols);
      50             : #endif
      51           0 :   return n_cols;
      52             : }
      53             : 
      54             : 
      55             : 
      56             : template <typename T>
      57         988 : void SumShellMatrix<T>::vector_mult (NumericVector<T> & dest,
      58             :                                      const NumericVector<T> & arg) const
      59             : {
      60         988 :   dest.zero();
      61         988 :   this->vector_mult_add(dest,arg);
      62         988 : }
      63             : 
      64             : 
      65             : 
      66             : template <typename T>
      67         988 : void SumShellMatrix<T>::vector_mult_add (NumericVector<T> & dest,
      68             :                                          const NumericVector<T> & arg) const
      69             : {
      70        2964 :   for (auto i : index_range(matrices))
      71        2140 :     matrices[i]->vector_mult_add(dest, arg);
      72         988 : }
      73             : 
      74             : 
      75             : 
      76             : template <typename T>
      77           0 : void SumShellMatrix<T>::get_diagonal (NumericVector<T> & dest) const
      78             : {
      79           0 :   std::unique_ptr<NumericVector<T>> a = dest.zero_clone();
      80           0 :   for (auto i : index_range(matrices))
      81             :     {
      82           0 :       matrices[i]->get_diagonal(*a);
      83           0 :       dest += *a;
      84             :     }
      85           0 : }
      86             : 
      87             : 
      88             : 
      89             : //------------------------------------------------------------------
      90             : // Explicit instantiations
      91             : template class LIBMESH_EXPORT SumShellMatrix<Number>;
      92             : 
      93             : } // namespace libMesh

Generated by: LCOV version 1.14