Quinoa all test code coverage report
Current view: top level - Mesh - CommMap.cpp (source / functions) Hit Total Coverage
Commit: -128-NOTFOUND Lines: 7 7 100.0 %
Date: 2024-11-22 08:51:48 Functions: 4 4 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 6 8 75.0 %

           Branch data     Line data    Source code
       1                 :            : // *****************************************************************************
       2                 :            : /*!
       3                 :            :   \file      src/Mesh/CommMap.cpp
       4                 :            :   \copyright 2012-2015 J. Bakosi,
       5                 :            :              2016-2018 Los Alamos National Security, LLC.,
       6                 :            :              2019-2021 Triad National Security, LLC.
       7                 :            :              All rights reserved. See the LICENSE file for details.
       8                 :            :   \brief     Functions employing communication maps
       9                 :            :   \details   Functions employing communication maps.
      10                 :            : */
      11                 :            : // *****************************************************************************
      12                 :            : 
      13                 :            : #include <algorithm>
      14                 :            : 
      15                 :            : #include "CommMap.hpp"
      16                 :            : 
      17                 :            : namespace tk {
      18                 :            : 
      19                 :   17881725 : bool slave( const NodeCommMap& map, std::size_t node, int chare )
      20                 :            : // *****************************************************************************
      21                 :            : //  Decide if a node is not counted by a chare
      22                 :            : //! \param[in] map Node commuinication map to search in
      23                 :            : //! \param[in] node Global node id to search for
      24                 :            : //! \param[in] chare Caller chare id (but really can be any chare id)
      25                 :            : //! \return True if the node is a slave (counted by another chare with a lower
      26                 :            : //!   chare id)
      27                 :            : //! \details If a node is found in the node communication map and is associated
      28                 :            : //! to a lower chare id than the chare id given, it is counted by another chare
      29                 :            : //! (and not the caller one), hence a "slave" (for the purpose of this count).
      30                 :            : // *****************************************************************************
      31                 :            : {
      32                 :            :   return
      33                 :   17881725 :     std::any_of( map.cbegin(), map.cend(),
      34                 :   20078859 :       [&](const auto& s) {
      35 [ +  - ][ +  + ]:   37960584 :         return s.second.find(node) != s.second.cend() && s.first > chare; } );
                 [ +  + ]
      36                 :            : }
      37                 :            : 
      38                 :    1340242 : tk::real count( const NodeCommMap& map, std::size_t node )
      39                 :            : // *****************************************************************************
      40                 :            : //  Count the number of contributions to a node
      41                 :            : //! \param[in] map Node commuinication map to search in
      42                 :            : //! \param[in] node Global node id to search for
      43                 :            : //! \return Count of contributions to node
      44                 :            : // *****************************************************************************
      45                 :            : {
      46                 :    1340242 :   return 1.0 + static_cast< tk::real >( std::count_if( map.cbegin(), map.cend(),
      47         [ +  - ]:    5091507 :     [&](const auto& s) { return s.second.find(node) != s.second.cend(); } ) );
      48                 :            : }
      49                 :            : 
      50                 :            : } // tk::

Generated by: LCOV version 1.14