Walker test code coverage report
Current view: top level - Walker - Collector.hpp (source / functions) Hit Total Coverage
Commit: test_coverage.info Lines: 8 8 100.0 %
Date: 2022-09-21 13:52:12 Functions: 2 2 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 22 54 40.7 %

           Branch data     Line data    Source code
       1                 :            : // *****************************************************************************
       2                 :            : /*!
       3                 :            :   \file      src/Walker/Collector.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     Charm++ module interface file for collecting contributions from
       9                 :            :              Integrators
      10                 :            :   \details   Charm++ module interface file for collecting contributions from
      11                 :            :              Integrators.
      12                 :            : */
      13                 :            : // *****************************************************************************
      14                 :            : #ifndef Collector_h
      15                 :            : #define Collector_h
      16                 :            : 
      17                 :            : #include <cstddef>
      18                 :            : 
      19                 :            : #include "Types.hpp"
      20                 :            : #include "PDFReducer.hpp"
      21                 :            : #include "Distributor.hpp"
      22                 :            : #include "Walker/InputDeck/InputDeck.hpp"
      23                 :            : 
      24                 :            : namespace walker {
      25                 :            : 
      26                 :            : extern ctr::InputDeck g_inputdeck;
      27                 :            : extern CkReduction::reducerType PDFMerger;
      28                 :            : 
      29                 :            : #if defined(__clang__)
      30                 :            :   #pragma clang diagnostic push
      31                 :            :   #pragma clang diagnostic ignored "-Wundefined-func-template"
      32                 :            : #endif
      33                 :            : 
      34                 :            : //! Collector Charm++ chare group class
      35                 :            : //! \details Instantiations of Collector comprise a processor aware Charm++
      36                 :            : //!   chare group. When instantiated, a new object is created on each PE and not
      37                 :            : //!   more (as opposed to individual chares or chare array object elements). The
      38                 :            : //!   group's elements are used to collect information from all Integrator chare
      39                 :            : //!   objects that happen to be on a given PE. See also the Charm++ interface
      40                 :            : //!   file collector.ci.
      41                 :            : //! \see http://charm.cs.illinois.edu/manuals/html/charm++/manual.html
      42                 :            : class Collector : public CBase_Collector {
      43                 :            : 
      44                 :            :   public:
      45                 :            :     //! Constructor
      46                 :        281 :     explicit Collector( CProxy_Distributor hostproxy ) :
      47                 :            :       m_hostproxy( hostproxy ),
      48                 :            :       m_nchare( 0 ),
      49                 :            :       m_nord( 0 ),
      50                 :            :       m_ncen( 0 ),
      51 [ +  - ][ +  - ]:        562 :       m_ordinary( g_inputdeck.momentNames( tk::ctr::ordinary ).size(), 0.0 ),
         [ -  - ][ -  - ]
      52 [ +  - ][ +  - ]:        562 :       m_central( g_inputdeck.momentNames( tk::ctr::central ).size(), 0.0 ),
         [ -  - ][ -  - ]
      53                 :            :       m_ordupdf(
      54                 :            :         tk::ctr::numPDF< 1 >( g_inputdeck.get< tag::discr, tag::binsize >(),
      55                 :            :                               g_inputdeck.get< tag::pdf >(),
      56                 :            :                               tk::ctr::Moment::ORDINARY ) ),
      57                 :            :       m_ordbpdf(
      58                 :            :         tk::ctr::numPDF< 2 >( g_inputdeck.get< tag::discr, tag::binsize >(),
      59                 :            :                               g_inputdeck.get< tag::pdf >(),
      60                 :            :                               tk::ctr::Moment::ORDINARY ) ),
      61                 :            :       m_ordtpdf(
      62                 :            :         tk::ctr::numPDF< 3 >( g_inputdeck.get< tag::discr, tag::binsize >(),
      63                 :            :                               g_inputdeck.get< tag::pdf >(),
      64                 :            :                               tk::ctr::Moment::ORDINARY ) ),
      65                 :            :       m_cenupdf(
      66                 :            :         tk::ctr::numPDF< 1 >( g_inputdeck.get< tag::discr, tag::binsize >(),
      67                 :            :                               g_inputdeck.get< tag::pdf >(),
      68                 :            :                               tk::ctr::Moment::CENTRAL ) ),
      69                 :            :       m_cenbpdf(
      70                 :            :         tk::ctr::numPDF< 2 >( g_inputdeck.get< tag::discr, tag::binsize >(),
      71                 :            :                               g_inputdeck.get< tag::pdf >(),
      72                 :            :                               tk::ctr::Moment::CENTRAL ) ),
      73                 :            :       m_centpdf(
      74                 :            :         tk::ctr::numPDF< 3 >( g_inputdeck.get< tag::discr, tag::binsize >(),
      75                 :            :                               g_inputdeck.get< tag::pdf >(),
      76 [ +  - ][ +  - ]:        843 :                               tk::ctr::Moment::CENTRAL ) )
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
                 [ +  - ]
      77                 :        281 :     {}
      78                 :            : 
      79                 :            :     //! \brief Configure Charm++ reduction types for collecting PDFs
      80                 :            :     //! \details Since this is a [initnode] routine, see collector.ci, the
      81                 :            :     //!   Charm++ runtime system executes the routine exactly once on every
      82                 :            :     //!   logical node early on in the Charm++ init sequence. Must be static as
      83                 :            :     //!   it is called without an object. See also: Section "Initializations at
      84                 :            :     //!   Program Startup" at in the Charm++ manual
      85                 :            :     //!   http://charm.cs.illinois.edu/manuals/html/charm++/manual.html.
      86                 :        281 :     static void registerPDFMerger()
      87                 :        281 :     { PDFMerger = CkReduction::addReducer( tk::mergePDF ); }
      88                 :            : 
      89                 :            :     //! Chares register on my PE
      90                 :            :     //! \note This function does not have to be declared as a Charm++ entry
      91                 :            :     //!   method since it is always called by chares on the same PE.
      92 [ +  - ][ -  - ]:        956 :     void checkin() { ++m_nchare; }
      93                 :            : 
      94                 :            :     //! Chares contribute ordinary moments and ordinary PDFs
      95                 :            :     void chareOrd( const std::vector< tk::real >& ord,
      96                 :            :                    const std::vector< tk::UniPDF >& updf,
      97                 :            :                    const std::vector< tk::BiPDF >& bpdf,
      98                 :            :                    const std::vector< tk::TriPDF >& tpdf );
      99                 :            : 
     100                 :            :     //! Chares contribute central moments and central PDFs
     101                 :            :     void chareCen( const std::vector< tk::real >& cen,
     102                 :            :                    const std::vector< tk::UniPDF >& updf,
     103                 :            :                    const std::vector< tk::BiPDF >& bpdf,
     104                 :            :                    const std::vector< tk::TriPDF >& tpdf );
     105                 :            : 
     106                 :            :   private:
     107                 :            :     CProxy_Distributor m_hostproxy;             //!< Host proxy    
     108                 :            :     std::size_t m_nchare;  //!< Number of chares contributing to my PE
     109                 :            :     std::size_t m_nord;    //!< Number of chares contributed ordinary moments
     110                 :            :     std::size_t m_ncen;    //!< Number of chares contributed central moments
     111                 :            :     std::vector< tk::real > m_ordinary;         //!< Ordinary moments
     112                 :            :     std::vector< tk::real > m_central;          //!< Central moments
     113                 :            :     std::vector< tk::UniPDF > m_ordupdf;        //!< Ordinary univariate PDFs
     114                 :            :     std::vector< tk::BiPDF > m_ordbpdf;         //!< Ordinary bivariate PDFs
     115                 :            :     std::vector< tk::TriPDF > m_ordtpdf;        //!< Ordinary trivariate PDFs
     116                 :            :     std::vector< tk::UniPDF > m_cenupdf;        //!< Central univariate PDFs
     117                 :            :     std::vector< tk::BiPDF > m_cenbpdf;         //!< Central bivariate PDFs
     118                 :            :     std::vector< tk::TriPDF > m_centpdf;        //!< Central trivariate PDFs
     119                 :            :     std::vector< tk::real > m_extra;            //!< Extra statistics data
     120                 :            : };
     121                 :            : 
     122                 :            : #if defined(__clang__)
     123                 :            :   #pragma clang diagnostic pop
     124                 :            : #endif
     125                 :            : 
     126                 :            : } // walker::
     127                 :            : 
     128                 :            : #endif // Collector_h

Generated by: LCOV version 1.14