My Project
DeckOutput.hpp
1 /*
2  Copyright 2017 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
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  OPM is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with OPM. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef DECK_OUTPUT_HPP
21 #define DECK_OUTPUT_HPP
22 
23 #include <iosfwd>
24 #include <string>
25 #include <cstddef>
26 
27 namespace Opm {
28 
29  class DeckOutput {
30  public:
31  struct format {
32  std::string item_sep = " "; // Separator between items on a row.
33  size_t columns = 7; // The maximum number of columns on a record.
34  std::string record_indent = " "; // The indentation when starting a new line.
35  std::string keyword_sep = ""; // The separation between keywords;
36  };
37 
38  explicit DeckOutput(std::ostream& s, int precision = 10);
39  ~DeckOutput();
40  void stash_default( );
41 
42  void start_record( );
43  void end_record( );
44 
45  void start_keyword(const std::string& kw, bool split_line);
46  void end_keyword(bool add_slash);
47 
48  void endl();
49  void write_string(const std::string& s);
50  template <typename T> void write(const T& value);
51  format fmt;
52  private:
53  std::ostream& os;
54  size_t default_count;
55  size_t row_count;
56  bool record_on;
57  int org_precision;
58  bool split_line;
59 
60  template <typename T> void write_value(const T& value);
61  void split_record();
62  void write_sep( );
63  void set_precision(int precision);
64  };
65 }
66 
67 #endif
68 
Definition: DeckOutput.hpp:29
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition: Exceptions.hpp:29
Definition: DeckOutput.hpp:31