1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// *****************************************************************************
/*!
  \file      src/IO/DiagWriter.hpp
  \copyright 2012-2015 J. Bakosi,
             2016-2018 Los Alamos National Security, LLC.,
             2019-2021 Triad National Security, LLC.,
             2022-2025 J. Bakosi
             All rights reserved. See the LICENSE file for details.
  \brief     Text diagnostics writer definition
  \details   This file feines the ASCII diagnostics writer class that
     facilitates outputing diagnostics to text files.
*/
// *****************************************************************************
#pragma once

#include <string><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <vector><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <fstream><--- Include file:  not found. Please note: Cppcheck does not need standard library headers to get proper results.

#include "Types.hpp"
#include "Writer.hpp"

namespace tk {

//! \brief DiagWriter : tk::Writer
//! \details ASCII diagnostics writer class that facilitates outputing
//!   diagnostics to text files.
class DiagWriter : public tk::Writer {

  public:
    //! Constructor
    explicit DiagWriter( const std::string& filename,
                         const std::string& format = "default",
                         std::streamsize precision = std::cout.precision(),
                         std::ios_base::openmode mode = std::ios_base::out );

    //! Write out diagnostics file header
    void header( const std::vector< std::string >& name ) const;

    //! Write diagnostics file
    std::size_t write( uint64_t it,
                       tk::real t,
                       tk::real dt,
                       const std::vector< tk::real >& diagnostics );

  private:
    int m_precision;     //!< Floating-point precision in digits
    int m_width;         //!< Floating-point number width
};

} // tk::