Quinoa all test code coverage report
Current view: top level - Inciter - Transfer.hpp (source / functions) Hit Total Coverage
Commit: -128-NOTFOUND Lines: 8 8 100.0 %
Date: 2024-11-08 10:37:44 Functions: 1 1 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 3 6 50.0 %

           Branch data     Line data    Source code
       1                 :            : // *****************************************************************************
       2                 :            : /*!
       3                 :            :   \file      src/Inciter/Transfer.hpp
       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     Types for solution transfer between solvers holding different
       9                 :            :              meshes
      10                 :            :   \details   Types for solution transfer between solvers holding different
      11                 :            :              meshes.
      12                 :            : */
      13                 :            : // *****************************************************************************
      14                 :            : #ifndef Transfer_h
      15                 :            : #define Transfer_h
      16                 :            : 
      17                 :            : #include "NoWarning/charm++.hpp"
      18                 :            : 
      19                 :            : namespace inciter {
      20                 :            : 
      21                 :            : //! \brief Description of solution transfer between two solvers holding
      22                 :            : //!   different meshes
      23 [ +  - ][ +  - ]:         45 : struct Transfer {
      24                 :            :   std::size_t src;              //!< Source mesh id
      25                 :            :   std::size_t dst;              //!< Destination mesh id
      26                 :            :   std::vector< CkCallback > cb; //!< List of callbacks to continue with
      27                 :            :   //std::vector< std::size_t > cbs;     // only for debugging
      28                 :            : 
      29                 :            :   //! Constructor: empty for Charm++
      30                 :            :   explicit Transfer() = default;
      31                 :            : 
      32                 :            :   //! Constructor: initialize src and dest mesh ids
      33                 :          2 :   explicit Transfer( std::size_t s, std::size_t d ) : src(s), dst(d) {}
      34                 :            : 
      35                 :            :   /** @name Pack/Unpack: Serialize Transfer object for Charm++ */
      36                 :            :   ///@{
      37                 :            :   //! Pack/Unpack serialize member function
      38                 :            :   //! \param[in,out] p Charm++'s PUP::er serializer object reference
      39                 :         39 :   void pup( PUP::er& p ) {
      40                 :         39 :     p | src;
      41                 :         39 :     p | dst;
      42                 :         39 :     p | cb;
      43                 :         39 :   }
      44                 :            :   //! Pack/Unpack serialize operator|
      45                 :            :   //! \param[in,out] p Charm++'s PUP::er serializer object reference
      46                 :            :   //! \param[in,out] t Transfer object reference
      47         [ +  - ]:         39 :   friend void operator|( PUP::er& p, Transfer& t ) { t.pup(p); }
      48                 :            :   ///@}
      49                 :            : 
      50                 :            :   //! \brief Operator << for writing a Transfer object to output streams
      51                 :            :   //! \param[in,out] os Output stream to write to
      52                 :            :   //! \param[in] t Transfer object to write
      53                 :            :   //! \return Updated output stream
      54                 :            :   friend std::ostream& operator<<( std::ostream& os, const Transfer& t ) {
      55                 :            :     os << t.src << '>' << t.dst;
      56                 :            :     return os;
      57                 :            :   }
      58                 :            : 
      59                 :            :   //! \brief Equal operator for, e.g., finding unique elements, used by, e.g.,
      60                 :            :   //!    std::unique().
      61                 :            :   //! \details Test on src and dst only.
      62                 :            :   //! \param[in] transfer Transfer object to compare
      63                 :            :   //! \return Boolean indicating if term equals 'this'
      64                 :            :   bool operator== ( const Transfer& transfer) const {
      65                 :            :     if (src == transfer.src && dst == transfer.dst)
      66                 :            :       return true;
      67                 :            :     else
      68                 :            :       return false;
      69                 :            :   }
      70                 :            : 
      71                 :            :   //! Less-than operator for ordering, used by, e.g., std::sort().
      72                 :            :   //! \details Test on src and dst only.
      73                 :            :   //! \param[in] transfer Transfer object to compare
      74                 :            :   //! \return Boolean indicating if term is less than 'this'
      75                 :            :   bool operator< ( const Transfer& transfer ) const {
      76                 :            :     if (src < transfer.src)
      77                 :            :       return true;
      78                 :            :     else if (src == transfer.src && dst < transfer.dst)
      79                 :            :       return true;
      80                 :            :     else
      81                 :            :       return false;
      82                 :            :   }
      83                 :            : };
      84                 :            : 
      85                 :            : } // inciter::
      86                 :            : 
      87                 :            : #endif // Transfer_h

Generated by: LCOV version 1.14