LCOV - code coverage report
Current view: top level - src/systems - qoi_set.C (source / functions) Hit Total Coverage
Test: libMesh/libmesh: #4229 (6a9aeb) with base 727f46 Lines: 14 15 93.3 %
Date: 2025-08-19 19:27:09 Functions: 2 3 66.7 %
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/qoi_set.h"
      22             : #include "libmesh/system.h"
      23             : 
      24             : // C++ Includes
      25             : #include <vector>
      26             : 
      27             : 
      28             : namespace libMesh
      29             : {
      30             : 
      31           0 : QoISet::QoISet(const System & sys) : _indices(sys.n_qois(), true) {}
      32             : 
      33             : 
      34             : 
      35        4340 : std::size_t QoISet::size (const System & sys) const
      36             : {
      37         124 :   std::size_t qoi_count = 0;
      38        8680 :   for (auto i : make_range(sys.n_qois()))
      39        4340 :     if (this->has_index(i))
      40        4340 :       qoi_count++;
      41        4340 :   return qoi_count;
      42             : }
      43             : 
      44             : 
      45             : 
      46        2674 : void QoISet::add_indices(const std::vector<unsigned int> & indices)
      47             : {
      48        2674 :   unsigned int max_size = 0;
      49        7458 :   for (const auto & i : indices)
      50        9340 :     max_size = std::max(max_size, i + 1);
      51             : 
      52        2674 :   _indices.resize(max_size);
      53             : 
      54        7458 :   for (const auto & i : indices)
      55        4784 :     _indices[i] = true;
      56        2674 : }
      57             : 
      58             : 
      59             : 
      60             : inline
      61             : void QoISet::remove_indices(const std::vector<unsigned int> & indices)
      62             : {
      63             :   for (const auto & i : indices)
      64             :     _indices[i] = false;
      65             : }
      66             : 
      67             : } // namespace libMesh

Generated by: LCOV version 1.14