LCOV - code coverage report
Current view: top level - src/utils - GeochemistrySortedIndices.C (source / functions) Hit Total Coverage
Test: idaholab/moose geochemistry: 602416 Lines: 6 6 100.0 %
Date: 2025-07-18 11:37:48 Functions: 1 1 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //* This file is part of the MOOSE framework
       2             : //* https://mooseframework.inl.gov
       3             : //*
       4             : //* All rights reserved, see COPYRIGHT for full restrictions
       5             : //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
       6             : //*
       7             : //* Licensed under LGPL 2.1, please see LICENSE for details
       8             : //* https://www.gnu.org/licenses/lgpl-2.1.html
       9             : 
      10             : #include "GeochemistrySortedIndices.h"
      11             : 
      12             : namespace GeochemistrySortedIndices
      13             : {
      14             : std::vector<unsigned>
      15       12874 : sortedIndices(const std::vector<Real> & to_sort, bool ascending)
      16             : {
      17       12874 :   std::vector<unsigned> order(to_sort.size());
      18             :   unsigned ind = 0;
      19             :   std::iota(order.begin(), order.end(), ind++);
      20       12874 :   if (ascending)
      21       79780 :     std::sort(order.begin(), order.end(), [&](int i, int j) { return to_sort[i] < to_sort[j]; });
      22             :   else
      23      447855 :     std::sort(order.begin(), order.end(), [&](int i, int j) { return to_sort[i] > to_sort[j]; });
      24       12874 :   return order;
      25             : }
      26             : } // namespace GeochemistrySortedIndices

Generated by: LCOV version 1.14