8 #ifndef SRC_IO_OUTPUT_DATA_HH_ 9 #define SRC_IO_OUTPUT_DATA_HH_ 13 #include <type_traits> 23 template <
class Value>
46 void print_ascii(ostream &out_stream,
unsigned int idx)
override;
60 void print_binary_all(ostream &out_stream,
bool print_data_size =
true)
override;
62 void print_all_yaml(ostream &out_stream,
unsigned int precision)
override;
72 void add(
unsigned int idx,
const Value&
value);
77 void zero(
unsigned int idx);
82 void normalize(
unsigned int idx,
unsigned int divisor);
95 void operate(
unsigned int idx,
const Value &val,
const Func& func) {
98 for(
unsigned int i_row = 0; i_row < this->
n_rows; i_row++) {
99 for(
unsigned int i_col = 0; i_col < this->
n_cols; i_col++) {
100 if (i_row < val.n_rows() && i_col < val.n_cols())
101 func(*ptr, val(i_row, i_col));
120 typename Value::return_type
aux;
Common abstract parent of all Field<...> classes.
Common parent class for templated OutputData.
void operate(unsigned int idx, const Value &val, const Func &func)
void print_all_yaml(ostream &out_stream, unsigned int precision) override
void print_binary_all(ostream &out_stream, bool print_data_size=true) override
Print all data stored in output data to appended binary format.
void print_ascii(ostream &out_stream, unsigned int idx) override
This class is used for storing data that are copied from field.
void zero(unsigned int idx)
OutputData(const FieldCommon &field, unsigned int size)
Constructor of templated OutputData.
static constexpr bool value
Value::element_type ElemType
void get_min_max_range(double &min, double &max) override
void add(unsigned int idx, const Value &value)
void normalize(unsigned int idx, unsigned int divisor)
virtual ~OutputData() override
Destructor of OutputData.
void print_ascii_all(ostream &out_stream) override
Print all data stored in output data ro ascii format.
void store_value(unsigned int idx, const Value &value)
#define ASSERT_LT_DBG(a, b)
Definition of comparative assert macro (Less Than) only for debug mode.