Quinoa all test code coverage report
Current view: top level - Mesh - CommMap.cpp (source / functions) Hit Total Coverage
Commit: Quinoa_v0.3-957-gb4f0efae0 Lines: 7 7 100.0 %
Date: 2021-11-09 15:14:18 Functions: 3 3 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 4 4 100.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                 :   11168284 : 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                 :   11168284 :     std::any_of( map.cbegin(), map.cend(),
      34                 :   16854293 :       [&](const auto& s) {
      35 [ +  + ][ +  + ]:   33708586 :         return s.second.find(node) != s.second.cend() && s.first > chare; } );
      36                 :            : }
      37                 :            : 
      38                 :    1269482 : 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                 :    1269482 :   return 1.0 + static_cast< tk::real >( std::count_if( map.cbegin(), map.cend(),
      47                 :    1269482 :     [&](const auto& s) { return s.second.find(node) != s.second.cend(); } ) );
      48                 :            : }
      49                 :            : 
      50                 :            : } // tk::

Generated by: LCOV version 1.14