93 template <
class Value>
120 "Do not support output of vectors with fixed size >3. Field: %s\n",
128 THROW(OutputTime::ExcOutputVariableVector() << OutputTime::EI_FieldName(this->
field_name));
146 delete[] this->
data_;
156 void print(ostream &out_stream,
unsigned int idx)
override
161 out_stream << *ptr <<
" ";
173 for(
unsigned int idx = 0; idx < this->
n_values; idx++) {
176 out_stream << *ptr <<
" ";
190 void add(
unsigned int idx,
const Value& value) {
204 void normalize(
unsigned int idx,
unsigned int divisor) {
213 template <
class Func>
214 void operate(
unsigned int idx,
const Value &val,
const Func& func) {
217 for(
unsigned int i_row = 0; i_row < this->
n_rows; i_row++) {
218 for(
unsigned int i_col = 0; i_col < this->
n_cols; i_col++) {
219 if (i_row < val.n_rows() && i_col < val.n_cols())
220 func(*ptr, val(i_row, i_col));
239 typename Value::return_type
aux;
262 template<
int spacedim,
class Value>
270 if (! flags) flags = 1 << type;
271 for (
unsigned long index=0; index < multi_field.
size(); index++)
273 if (flags & (1 << ids))
279 template<
int spacedim,
class Value>
287 if (! flags) flags = 1 << type;
289 if (flags & (1 << ids))
295 template<
int spacedim,
class Value>
300 if( this->
rank != 0) {
308 ASSERT(!this->
_mesh || this->
_mesh==field_mesh,
"Overwriting non-null mesh pointer.\n");
309 this->
_mesh=field_mesh;
319 auto it=std::find_if(od_vec.begin(), od_vec.end(),
321 if ( it == od_vec.end() ) {
322 od_vec.push_back( std::make_shared<
OutputData<Value> >(field, size[space_type]) );
334 for(
unsigned int idx=0; idx < output_data.
n_values; idx++)
335 output_data.
zero(idx);
340 Node * node = ele->node[i_node];
341 unsigned int ele_index = ele.index();
344 const Value &node_value =
345 Value( const_cast<typename Value::return_type &>(
348 output_data.
add(node_index, node_value);
355 for(
unsigned int idx=0; idx < output_data.
n_values; idx++)
360 unsigned int corner_index=0;
363 Node * node = ele->node[i_node];
364 unsigned int ele_index = ele.index();
366 const Value &node_value =
367 Value( const_cast<typename Value::return_type &>(
378 unsigned int ele_index = ele.index();
379 const Value &ele_value =
380 Value( const_cast<typename Value::return_type &>(
381 field.
value(ele->centre(),
Common abstract parent of all Field<...> classes.
Common parent class for templated OutputData.
#define FOR_ELEMENT_NODES(i, j)
void operate(unsigned int idx, const Value &val, const Func &func)
std::string output_field_name
void print(ostream &out_stream, unsigned int idx) override
unsigned int size() const
Number of subfields that compose the multi-field.
#define FOR_ELEMENTS(_mesh_, __i)
Class template representing a field with values dependent on: point, element, and region...
void register_data(const DiscreteSpace type, MultiField< spacedim, Value > &multi_field)
Generic method for registering output data stored in MultiField.
~OutputData()
Destructor of OutputData.
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.
FieldCommon & units(const UnitSI &units)
Set basic units of the field.
std::map< std::string, DiscreteSpaceFlags > output_names
Value::element_type ElemType
unsigned int DiscreteSpaceFlags
unsigned int n_elements() const
void add(unsigned int idx, const Value &value)
#define ASSERT_LESS(a, b)
void normalize(unsigned int idx, unsigned int divisor)
static const unsigned int N_DISCRETE_SPACES
unsigned int index(const T *pointer) const
virtual Value::return_type const & value(const Point &p, const ElementAccessor< spacedim > &elm) const
void compute_field_data(DiscreteSpace type, Field< spacedim, Value > &field)
const Mesh * mesh() const
OutputDataFieldVec output_data_vec_[N_DISCRETE_SPACES]
FieldCommon & name(const string &name)
unsigned int n_nodes() const
std::shared_ptr< OutputDataBase > OutputDataPtr
Class for representation of a vector of fields of the same physical quantity.
#define THROW(whole_exception_expr)
Wrapper for throw. Saves the throwing point.
NodeVector node_vector
Vector of nodes of the mesh.
void store_value(unsigned int idx, const Value &value)
void print_all(ostream &out_stream) override
Print all data stored in output data.