Xyst test code coverage report
Current view: top level - IO - PDFWriter.hpp Coverage Total Hit
Commit: 1fb74642dd9d7732b67f32dec2f2762e238d3fa7 Lines: 100.0 % 1 1
Test Date: 2025-08-13 22:18:46 Functions: - 0 0
Legend: Lines:     hit not hit

            Line data    Source code
       1              : // *****************************************************************************
       2              : /*!
       3              :   \file      src/IO/PDFWriter.hpp
       4              :   \copyright 2012-2015 J. Bakosi,
       5              :              2016-2018 Los Alamos National Security, LLC.,
       6              :              2019-2021 Triad National Security, LLC.,
       7              :              2022-2025 J. Bakosi
       8              :              All rights reserved. See the LICENSE file for details.
       9              :   \brief     PDF writer class declaration
      10              :   \details   This file declares a PDF writer class that facilitates outputing
      11              :     probability density functions (PDFs) into files in various formats using
      12              :     various configurations.
      13              : */
      14              : // *****************************************************************************
      15              : #pragma once
      16              : 
      17              : #include <string>
      18              : #include <iostream>
      19              : 
      20              : #include "Writer.hpp"
      21              : #include "UniPDF.hpp"
      22              : #include "StatCtr.hpp"
      23              : 
      24              : namespace tk {
      25              : 
      26              : //! PDFWriter : Writer
      27          255 : class PDFWriter : public tk::Writer {
      28              : 
      29              :   public:
      30              :     //! Constructor
      31              :     explicit PDFWriter(
      32              :       const std::string& filename,
      33              :       const std::string& format = "default",
      34              :       std::streamsize precision = std::cout.precision() );
      35              : 
      36              :     //! Write univariate PDF to text file
      37              :     void writeTxt( const UniPDF& pdf, const tk::ctr::PDFInfo& info ) const;
      38              : 
      39              :   private:
      40              :     //! Assert the number of sample space dimensions given
      41              :     template< std::size_t size, class Container >
      42              :     void assertSampleSpaceDimensions( [[maybe_unused]] const Container& c )
      43              :     const {
      44              :       Assert( c.size() == size,
      45              :               "Number of sample space variables must equal " +
      46              :               std::to_string( size ) + " in PDF writer." );
      47              :     }
      48              : 
      49              :     //! Assert the number of sample space extents given
      50              :     template< std::size_t size, class Container >
      51              :     void assertSampleSpaceExtents( const Container& c ) const {
      52              :       if (!c.empty())
      53              :         Assert( c.size() == size*2,
      54              :                 "PDF user-specified sample space extents must be defined by " +
      55              :                 std::to_string( size*2 ) +" real numbers: minx, maxx, ..." );
      56              :     }
      57              : 
      58              :     //! Query extents and other metadata of univariate PDF sample space
      59              :     void extents( const UniPDF& pdf,
      60              :                   const std::vector< tk::real >& uext,
      61              :                   std::size_t& nbi,
      62              :                   tk::real& min,
      63              :                   tk::real& max,
      64              :                   tk::real& binsize,
      65              :                   std::array< long, 2*UniPDF::dim >& ext,
      66              :                   std::vector< tk::real >& outpdf ) const;
      67              : };
      68              : 
      69              : } // tk::
        

Generated by: LCOV version 2.0-1