Line data Source code
1 : // *****************************************************************************
2 : /*!
3 : \file src/IO/DiagWriter.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 Text diagnostics writer definition
10 : \details This file feines the ASCII diagnostics writer class that
11 : facilitates outputing diagnostics to text files.
12 : */
13 : // *****************************************************************************
14 : #pragma once
15 :
16 : #include <string>
17 : #include <vector>
18 : #include <fstream>
19 :
20 : #include "Types.hpp"
21 : #include "Writer.hpp"
22 :
23 : namespace tk {
24 :
25 : //! \brief DiagWriter : tk::Writer
26 : //! \details ASCII diagnostics writer class that facilitates outputing
27 : //! diagnostics to text files.
28 5254 : class DiagWriter : public tk::Writer {
29 :
30 : public:
31 : //! Constructor
32 : explicit DiagWriter( const std::string& filename,
33 : const std::string& format = "default",
34 : std::streamsize precision = std::cout.precision(),
35 : std::ios_base::openmode mode = std::ios_base::out );
36 :
37 : //! Write out diagnostics file header
38 : void header( const std::vector< std::string >& name ) const;
39 :
40 : //! Write diagnostics file
41 : std::size_t write( uint64_t it,
42 : tk::real t,
43 : tk::real dt,
44 : const std::vector< tk::real >& diagnostics );
45 :
46 : private:
47 : int m_precision; //!< Floating-point precision in digits
48 : int m_width; //!< Floating-point number width
49 : };
50 :
51 : } // tk::
|