18 #ifndef OPM_IO_ECLOUTPUT_HPP 19 #define OPM_IO_ECLOUTPUT_HPP 21 #include <opm/io/eclipse/EclIOdata.hpp> 22 #include <opm/io/eclipse/PaddedOutputString.hpp> 29 #include <type_traits> 34 class SummarySpecification;
44 const std::ios_base::openmode mode = std::ios::out);
47 void write(
const std::string& name,
48 const std::vector<T>& data)
50 static_assert(std::is_same_v<T, int> ||
51 std::is_same_v<T, float> ||
52 std::is_same_v<T, double> ||
53 std::is_same_v<T, bool> ||
54 std::is_same_v<T, char>,
55 "EclOutput::write<T>: T must be int, float, double, bool, or char");
57 eclArrType arrType = MESS;
60 if constexpr (std::is_same_v<T, int>) {
63 else if constexpr (std::is_same_v<T, float>) {
66 else if constexpr (std::is_same_v<T, double>) {
70 else if constexpr (std::is_same_v<T, bool>) {
73 else if constexpr (std::is_same_v<T, char>) {
75 throw std::invalid_argument {
76 "EclOutput::write<char>: non-empty data is not supported; " 77 "use message() for MESS-type records" 83 writeFormattedHeader(name, data.size(), arrType, element_size);
84 if (arrType != MESS) {
85 writeFormattedArray(data);
89 writeBinaryHeader(name, data.size(), arrType, element_size);
90 if (arrType != MESS) {
91 writeBinaryArray(data);
99 void write(
const std::string& name,
const std::vector<std::string>& data,
int element_size);
101 void message(
const std::string& msg);
104 void set_ix() { ix_standard =
true; }
110 void writeStringVector(
const std::string& name,
111 const std::vector<std::string>& strings,
112 const eclArrType charType,
113 const int charPerStr);
115 void writeBinaryHeader(
const std::string& arrName, std::int64_t size, eclArrType arrType,
int element_size);
117 template <
typename T>
118 void writeBinaryArray(
const std::vector<T>& data);
120 void writeBinaryCharArray(
const std::vector<std::string>& data,
int element_size);
123 void writeFormattedHeader(
const std::string& arrName,
int size, eclArrType arrType,
int element_size);
125 template <
typename T>
126 void writeFormattedArray(
const std::vector<T>& data);
128 void writeFormattedCharArray(
const std::vector<std::string>& data,
int element_size);
131 void writeArrayType(
const eclArrType arrType);
132 std::string make_real_string_ecl(
float value)
const;
133 std::string make_real_string_ix(
float value)
const;
134 std::string make_doub_string_ecl(
double value)
const;
135 std::string make_doub_string_ix(
double value)
const;
137 bool isFormatted, ix_standard;
138 std::ofstream ofileH;
142 void EclOutput::write<std::string>(
const std::string& name,
143 const std::vector<std::string>& data);
146 void EclOutput::write<PaddedOutputString<8>>
147 (
const std::string& name,
148 const std::vector<PaddedOutputString<8>>& data);
152 #endif // OPM_IO_ECLOUTPUT_HPP Definition: OutputStream.hpp:379
File manager for restart output streams.
Definition: OutputStream.hpp:151
Definition: EclOutput.hpp:39
Definition: EclipseGrid.hpp:43
Definition: EclOutput.hpp:32
Null-terminated, left adjusted, space padded array of N characters.
Definition: PaddedOutputString.hpp:39