opm-common
ExtSmryOutput.hpp
1 /*
2  Copyright 2019 Statoil ASA.
3 
4  This file is part of the Open Porous Media project (OPM).
5 
6  OPM is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by
7  the Free Software Foundation, either version 3 of the License, or
8  (at your option) any later version.
9 
10  OPM is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with OPM. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #ifndef OPM_IO_ExtSmryOutput_HPP
20 #define OPM_IO_ExtSmryOutput_HPP
21 
22 #include <array>
23 #include <chrono>
24 #include <string>
25 #include <vector>
26 
27 namespace Opm {
28 
29 class EclipseState;
30 class GridDims;
31 
32 namespace EclIO {
33 
35 {
36 public:
37  ExtSmryOutput(const std::vector<std::string>& valueKeys,
38  const std::vector<std::string>& valueUnits,
39  const EclipseState& es,
40  const time_t start_time);
41 
42  void write(const std::vector<float>& ts_data,
43  int report_step,
44  bool is_final_summary);
45 
46 private:
47  static constexpr int m_min_write_interval = 15; // at least 15 seconds between each write
48  std::chrono::time_point<std::chrono::system_clock> m_last_write;
49 
50  std::string m_outputFileName;
51  int m_nTimeSteps;
52  int m_nVect;
53  bool m_fmt;
54 
55  std::vector<int> m_start_date_vect;
56  std::string m_restart_rootn;
57  int m_restart_step;
58  std::vector<std::string> m_smry_keys;
59  std::vector<std::string> m_smryUnits;
60  std::vector<int> m_rstep;
61  std::vector<int> m_tstep;
62  std::vector<std::vector<float>> m_smrydata;
63 
64  std::array<int, 3> ijk_from_global_index(const GridDims& dims,
65  int globInd) const;
66  std::vector<std::string> make_modified_keys(const std::vector<std::string>& valueKeys,
67  const GridDims& dims);
68  bool rename_tmpfile(const std::string& tmp_fname);
69 };
70 
71 
72 }} // namespace Opm::EclIO
73 
74 #endif // OPM_IO_ExtSmryOutput_HPP
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:30
Definition: EclipseState.hpp:66
Definition: ExtSmryOutput.hpp:34
Definition: GridDims.hpp:30