8 #ifndef SRC_IO_OUTPUT_DATA_HH_ 9 #define SRC_IO_OUTPUT_DATA_HH_ 22 template <
class Value>
45 void print(ostream &out_stream,
unsigned int idx)
override;
54 void print_all(ostream &out_stream)
override;
56 void print_all_yaml(ostream &out_stream,
unsigned int precision)
override;
61 void store_value(
unsigned int idx,
const Value& value);
66 void add(
unsigned int idx,
const Value& value);
71 void zero(
unsigned int idx);
76 void normalize(
unsigned int idx,
unsigned int divisor);
84 void operate(
unsigned int idx,
const Value &val,
const Func& func) {
87 for(
unsigned int i_row = 0; i_row < this->
n_rows; i_row++) {
88 for(
unsigned int i_col = 0; i_col < this->
n_cols; i_col++) {
89 if (i_row < val.n_rows() && i_col < val.n_cols())
90 func(*ptr, val(i_row, i_col));
109 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(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.
Value::element_type ElemType
void add(unsigned int idx, const Value &value)
void normalize(unsigned int idx, unsigned int divisor)
virtual ~OutputData() override
Destructor of OutputData.
void store_value(unsigned int idx, const Value &value)
void print_all(ostream &out_stream) override
Print all data stored in output data.
#define ASSERT_LT_DBG(a, b)
Definition of comparative assert macro (Less Than) only for debug mode.