Flow123d  JS_before_hm-1621-g63a12c7
field_common.hh
Go to the documentation of this file.
1 /*!
2  *
3  * Copyright (C) 2015 Technical University of Liberec. All rights reserved.
4  *
5  * This program is free software; you can redistribute it and/or modify it under
6  * the terms of the GNU General Public License version 3 as published by the
7  * Free Software Foundation. (http://www.gnu.org/licenses/gpl-3.0.en.html)
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12  *
13  *
14  * @file field_common.hh
15  * @brief
16  */
17 
18 #ifndef FIELD_COMMON_HH_
19 #define FIELD_COMMON_HH_
20 
21 #include <algorithm> // for sort, unique
22 #include <limits> // for numeric_limits
23 #include <memory> // for shared_ptr
24 #include <ostream> // for operator<<
25 #include <string> // for string, basic_...
26 #include <utility> // for make_pair, pair
27 #include <vector> // for vector, allocator
28 #include "fields/field_algo_base.hh" // for FieldResult
29 #include "fields/field_flag.hh" // for FieldFlag, Fie...
30 #include "fields/field_values.hh" // for FieldEnum
31 #include "tools/unit_si.hh" // for UnitSI
32 #include "input/accessors.hh" // for Record, Array ...
33 #include "input/input_exception.hh" // for ExcInputMessage
34 #include "input/type_base.hh" // for Array, Type
35 #include "input/type_generic.hh" // for Instance
36 #include "input/type_record.hh" // for Record
37 #include "input/type_selection.hh" // for Selection
38 #include "io/output_time.hh" // for OutputTime
39 #include "mesh/region.hh" // for Region (ptr only)
40 #include "system/asserts.hh" // for Assert, ASSERT
41 #include "system/exc_common.hh" // for EI_Message
42 #include "system/exceptions.hh" // for operator<<
43 #include "system/flag_array.hh" // for FlagArray<>::Mask
44 #include "tools/time_governor.hh" // for TimeGovernor (...
45 
46 class Mesh;
47 class Observe;
48 class EvalPoints;
49 class ElementCacheMap;
50 class FieldSet;
51 
52 
53 using namespace std;
54 
55 namespace IT=Input::Type;
56 
57 /**
58  * Left and right time limit, used in the @p set_time() method.
59  * Assigned values allow to index an array.
60  */
61 enum class LimitSide {
62  left=0,
63  right=1
64 };
65 
66 
67 
68 /**
69  * @brief Common abstract parent of all Field<...> classes.
70  *
71  * We need common ancestor in order to keep a list of all fields in one EqData object and allow
72  * collective operations like @p set_time or @p init_from_input.
73  */
74 class FieldCommon {
75 
76 public:
77  TYPEDEF_ERR_INFO(EI_Time, double);
78  TYPEDEF_ERR_INFO(EI_Field, std::string);
79  TYPEDEF_ERR_INFO( EI_FieldInputName, std::string);
80  TYPEDEF_ERR_INFO( EI_FieldName, std::string);
81  TYPEDEF_ERR_INFO( EI_RegId, unsigned int);
82  TYPEDEF_ERR_INFO( EI_RegLabel, std::string);
83  DECLARE_INPUT_EXCEPTION(ExcNonascendingTime,
84  << "Non-ascending time: " << EI_Time::val << " for field " << EI_Field::qval << ".\n");
85  DECLARE_INPUT_EXCEPTION(ExcMissingDomain,
86  << "Missing domain specification (region or r_id) in the field descriptor:");
87  DECLARE_EXCEPTION(ExcFieldMeshDifference,
88  << "Two copies of the field " << EI_Field::qval << "call set_mesh with different arguments.\n");
89  DECLARE_INPUT_EXCEPTION(ExcMissingFieldValue,
90  << "Missing value of the input field " << EI_FieldInputName::qval << " (" << EI_FieldName::qval
91  << ") on region ID: " << EI_RegId::val << " label: " << EI_RegLabel::qval << ".\n");
92 
93 
94 
95  /// Store data of one initialization message.
96  struct MessageData {
97  /// Constructor
98  MessageData(std::string default_value, std::string field_name, std::string region_list)
99  : default_value_(default_value), field_name_(field_name), region_list_(region_list) {};
100 
101  std::string default_value_; ///< Default value of the field.
102  std::string field_name_; ///< Parameter name_ of the field.
103  std::string region_list_; ///< List of regions separated by comma.
104  };
105 
106  /**
107  * Set name of the field. In fact there are two attributes set by this method.
108  *
109  * The first is name used to identify the field as part of a FieldSet or MultiField objects.
110  * This name is permanent and can be set only by this method. Can be accessed by @p name() method.
111  * This name is also used at output.
112  *
113  * The second is @p input_name_ that determines appropriate key name in the input field descriptor.
114  * This name is also set by this method, but is stored in the internal shared space which
115  * is overwritten during call of copy_from method or assignment operator. Can be accessed by @p input_name() mathod.
116  *
117  */
118  FieldCommon &name(const string & name)
119  { name_=shared_->input_name_ = name;
120  return *this;
121  }
122  /**
123  * Set description of the field, used for description of corresponding key in documentation.
124  */
125  FieldCommon & description(const string & description)
126  { shared_->input_description_ = description; return *this;}
127  /**
128  * Set default value for the field's key from which the default constant valued field will be constructed.
129  *
130  * During the first call of the @p set_time method, we check that the field is defined on all regions.
131  * On regions where it is not set yet, we use given @p dflt string to get particular instance of
132  * FieldBase<> (see @p check_initialized_region_fields_).
133  * The default string is interpreted in the same way as if it appears in the input file
134  * as the value of the field. In particular it can be whole record with @p TYPE of the field etc.
135  * Most common choice is however mere constant.
136  */
137  FieldCommon & input_default(const string &input_default)
138  { shared_->input_default_ = input_default; return *this;}
139  /**
140  * @brief Set basic units of the field.
141  *
142  * Currently, we use it only during output and we represents units just by a string.
143  *
144  * TODO:
145  * Particular class for representing and conversion of various units would be more appropriate.
146  * This can allow specification of the units on the inptu, automatic conversion and the same on the output.
147  * Possibly this allow using Boost::Units library, however, it seems to introduce lot of boilerplate code.
148  * But can increase correctness of the calculations.
149  */
150  FieldCommon & units(const UnitSI & units)
151  { shared_->units_ = units; return *this;}
152 
153  /**
154  * Set limits of value of the field.
155  */
156  FieldCommon & set_limits(double min, double max = std::numeric_limits<double>::max())
157  {
158  ASSERT(min < max)(min)(max).error("Invalid field limits!");
159  shared_->limits_ = std::make_pair(min, max);
160  return *this;
161  }
162 
163  /**
164  * For the fields returning "Enum", we have to pass the Input::Type::Selection object to
165  * the field implementations.
166  *
167  * We must save raw pointer since selection may not be yet initialized (during static initialization phase).
168  */
170  {
171  shared_->input_element_selection_=element_selection;
172  return *this;
173  }
174 
175  /**
176  * Output discrete space used in the output() method. Can be different for different field copies.
177  * one can choose between:
178  * data constant on elements, linear data given in nodes, and discontinuous linear data.
179  *
180  * If not set explicitly by this method, the default value is OutputTime::ELEM_DATA
181  */
183  { if (rt!=OutputTime::UNDEFINED) type_of_output_data_ = rt; return *this; }
184 
185  /**
186  * Set given mask to the field flags, ignoring default setting.
187  * Default setting is declare_input & equation_input & allow_output.
188  */
189  FieldCommon & flags(FieldFlag::Flags::Mask mask)
190  { flags_ = FieldFlag::Flags(mask); return *this; }
191 
192  /**
193  * Add given mask to the field flags.
194  */
195  FieldCommon & flags_add(FieldFlag::Flags::Mask mask)
196  { flags().add(mask); return *this; }
197 
198  /**
199  * Set vector of component names.
200  * Set number of components for run-time sized vectors. This is used latter when we construct
201  * objects derived from FieldBase<...>.
202  *
203  * n_comp_ is constant zero for fixed values, this zero is set by Field<...> constructors
204  */
205  void set_components(const std::vector<string> &names) {
206  // Test of unique values in names vector for MultiField
207  if (multifield_) {
208  std::vector<string> cpy = names;
209  std::sort( cpy.begin(), cpy.end() );
210  cpy.erase( std::unique( cpy.begin(), cpy.end() ), cpy.end() );
211  if (names.size() != cpy.size()) {
212  THROW( Input::ExcInputMessage() << EI_Message("The field " + this->input_name()
213  + " has set non-unique names of components.") );
214  }
215  shared_->n_comp_ = names.size();
216  } else {
217  shared_->n_comp_ = (shared_->n_comp_ ? names.size() : 0);
218  }
219 
220  shared_->comp_names_ = names;
221  }
222 
223 
224  /**
225  * Set internal mesh pointer.
226  */
227  virtual void set_mesh(const Mesh &mesh) = 0;
228  /**
229  * Set the data list from which field will read its input. It is list of "field descriptors".
230  * When reading from the input list we consider only field descriptors containing key of
231  * named by the field name. These field descriptors has to have times forming ascending sequence.
232  *
233  * The list is used by set_time method to set field on individual regions to actual FieldBase descendants.
234  */
235  virtual void set_input_list(const Input::Array &list, const TimeGovernor &tg) =0;
236 
237  /**
238  * Getters.
239  */
240  const std::string &input_name() const
241  { return shared_->input_name_;}
242 
243  const std::string &name() const
244  { return name_;}
245 
246  const std::string description() const
247  {return shared_->input_description_;}
248 
249  const std::string &input_default() const
250  { return shared_->input_default_;}
251 
252  const UnitSI &units() const
253  {
254  ASSERT(shared_->units_.is_def())(name()).error("Getting undefined unit.\n");
255  return shared_->units_;
256  }
257 
258  std::pair<double, double> limits() const
259  {
260  return shared_->limits_;
261  }
262 
264  { return type_of_output_data_; }
265 
266  bool is_bc() const
267  { return shared_->bc_;}
268 
269  unsigned int n_comp() const
270  { return shared_->comp_names_.size();}
271 
272  const Mesh * mesh() const
273  { return shared_->mesh_;}
274 
276  { return flags_; }
277 
279  { return flags_; }
280 
281  /**
282  * Returns time set by last call of set_time method.
283  * Can be different for different field copies.
284  */
285  double time() const
286  { return last_time_; }
287 
288  /**
289  * Returns true if the field change algorithm for the current time set through the @p set_time method.
290  * This happen for all times in the field descriptors on the input of this particular field.
291  */
292  bool is_jump_time() {
293  return is_jump_time_;
294  }
295 
296  /**
297  * Returns number of field descriptors containing the field.
298  */
299  unsigned int input_list_size() const {
300  return shared_->input_list_.size();
301  }
302 
303  /**
304  * If the field on given region @p reg exists and is of type FieldConstant<...> the method method returns true
305  * otherwise it returns false.
306  * Then one can call ElementAccessor<spacedim>(mesh(), reg ) to construct an ElementAccessor @p elm
307  * pointing to "virtual" element on which Field::value returns constant value.
308  * Unlike the Field<>::field_result method, this one provides no value, so it have common header (arguments, return type) and
309  * could be part of FieldCommon and FieldSet which is useful in some applications.
310  *
311  * TODO:Current implementation use virtual functions and can be prohibitively slow if called for every element. If this
312  * becomes necessary it is possible to incorporate such test into set_time method and in this method just return precomputed result.
313  */
314  virtual bool is_constant(Region reg) =0;
315 
316 
317  /**
318  * @brief Indicates special field states.
319  *
320  * Extension of the previous method. Return possible values from the enum @p FieldResult, see description there.
321  * The initial state is @p field_none, if the field is correctly set on all regions of the @p region_set given as parameter
322  * we return state @p field_other or even more particular result.
323  *
324  * Special field values spatially constant. Could allow optimization of tensor multiplication and
325  * tensor or vector addition. field_result_ should be set in constructor and in set_time method of particular Field implementation.
326  * We return value @p result_none, if the field is not initialized on the region of the given element accessor @p elm.
327  * Other possible results are: result_zeros, result_eye, result_ones, result_constant, result_other
328  * see @p FieldResult for explanation.
329  *
330  * Multifield return most particular value that holds for all its subfields.
331  *
332  *
333  */
334  virtual FieldResult field_result( RegionSet region_set) const =0;
335 
336  /**
337  * Return specification of the field value type in form of the string:
338  * [ <element type>, NRows, NCols]
339  *
340  * Result is valid JSON (and/or flow style YAML).
341  * For multifields not implemented.
342  */
343  virtual std::string get_value_attribute() const =0;
344 
345  /**
346  * Returns true if set_time_result_ is not @p TimeStatus::constant.
347  * Returns the same value as last set_time method.
348  */
349  bool changed() const
350  {
351  ASSERT( set_time_result_ != TimeStatus::unknown ).error("Invalid time status.");
352  return ( (set_time_result_ == TimeStatus::changed) );
353  }
354 
355  /**
356  * Common part of the field descriptor. To get finished record
357  * one has to add keys for individual fields. This is done automatically
358  * using FieldSet::get_input_type().
359  */
360  static IT::Record field_descriptor_record(const string& record_name);
361 
362  /**
363  * Create description of field descriptor record.
364  */
365  static const std::string field_descriptor_record_description(const string& record_name);
366 
367  /**
368  * Returns input type for particular field instance, this is reference to a static member input_type of the corresponding @p FieldBase
369  * class (i.e. with the same template parameters). This is used in FieldSet::make_field_descriptor_type.
370  */
371  virtual IT::Instance get_input_type() =0;
372 
373  /**
374  * Returns input type for MultiField instance.
375  * TODO: temporary solution, see @p multifield_
376  */
377  virtual IT::Array get_multifield_input_type() =0;
378 
379  /**
380  * Pass through the input array @p input_list_, collect all times where the field could change and
381  * put appropriate time marks into global TimeMarks object.
382  * Introduced time marks have both given @p mark_type and @p type_input() type.
383  *
384  * Further development:
385  * - we have to distinguish "jump" times and "smooth" times
386  */
387  void mark_input_times(const TimeGovernor &tg);
388 
389  /**
390  * Abstract method to update field to the new time level.
391  * Implemented by in class template Field<...>.
392  *
393  * Return true if the value of the field was changed on some region.
394  * The returned value is also stored in @p changed_during_set_time data member.
395  *
396  * Default values helps when creating steady field. Note that default TimeGovernor constructor
397  * set time to 0.0.
398  *
399  * Different field copies can be set to different times.
400  *
401  * TODO: update following:
402  * Set side of limit when calling @p set_time
403  * with jump time, i.e. time where the field change implementation on some region.
404  * Wee assume that implementations prescribe only smooth fields.
405  * This method invalidate result of
406  * @p changed() so it should be called just before @p set_time.
407  * Can be different for different field copies.
408  */
409  virtual bool set_time(const TimeStep &time, LimitSide limit_side) =0;
410 
411  /**
412  * Check that @p other is instance of the same Field<..> class and
413  * perform assignment. Polymorphic copy.
414  *
415  * The copy is performed only if *this have set flag 'input_copy'.
416  * If *this have set also the flag 'decare_input' the copy is performed only if the
417  * input_list is empty.
418  */
419  virtual void copy_from(const FieldCommon & other) =0;
420 
421  /**
422  * Output the field.
423  * The parameter @p output_fields is checked for value named by the field name. If the key exists,
424  * then the output of the field is performed. If the key do not appear in the input, no output is done.
425  */
426  virtual void field_output(std::shared_ptr<OutputTime> stream) =0;
427 
428  /**
429  * Perform the observe output of the field.
430  * The Observe object passed by the parameter is called with the particular Field<> as the parameter
431  * to evaluate the field in observation points and store the values in the OutputData arrays.
432  */
433  virtual void observe_output(std::shared_ptr<Observe> observe) =0;
434 
435  /**
436  * Set reference of FieldSet to all instances of FieldFormula.
437  */
438  virtual std::vector<const FieldCommon *> set_dependency(FieldSet &field_set, unsigned int i_reg) const =0;
439 
440  /**
441  * Sets @p component_index_
442  */
443  void set_component_index(unsigned int idx)
444  {
445  this->component_index_ = idx;
446  }
447 
448  /**
449  * Return @p multifield_ flag.
450  * TODO: temporary solution
451  */
452  inline bool is_multifield() const
453  {
454  return this->multifield_;
455  }
456 
457  /**
458  * Reallocate field value cache of Field on given region.
459  */
460  virtual void cache_reallocate(const ElementCacheMap &cache_map, unsigned int region_idx) const = 0;
461 
462  /**
463  * Read data to cache for appropriate elements given by ElementCacheMap object.
464  */
465  virtual void cache_update(ElementCacheMap &cache_map, unsigned int region_patch_idx) const = 0;
466 
467 
468  /**
469  * Returns pointer to this (Field) or the sub-field component (MultiField).
470  */
471  virtual FieldCommon *get_component(FMT_UNUSED unsigned int idx) {
472  return this;
473  }
474 
475 
476  /**
477  * Returns FieldValueCache if element_type of field is double or nullptr for other element_types.
478  */
479  virtual FieldValueCache<double> * value_cache() =0;
480 
481 
482  /**
483  * Same as previous but return const pointer
484  */
485  virtual const FieldValueCache<double> * value_cache() const =0;
486 
487 
488  /**
489  * Print stored messages to table.
490  *
491  * Return true if messages_data_ vector is nonempty and clear its.
492  */
493  static bool print_message_table(ostream& stream, std::string equation_name);
494 
495  /**
496  * Virtual destructor.
497  */
498  virtual ~FieldCommon();
499 
500  /**
501  * Hold shape of Field.
502  *
503  * Value is set in constructor of descendant class.
504  */
506 
507 
508 protected:
509  /**
510  * Private default constructor. Should be used only through
511  * Field<...>
512  */
513  FieldCommon();
514 
515  /**
516  * Private copy constructor. Should be used only through
517  * Field<...>
518  */
519  FieldCommon(const FieldCommon & other);
520 
521  /**
522  * Invalidate last time in order to force set_time method
523  * update region_fields_.
524  */
526  {
527  last_time_ = -numeric_limits<double>::infinity();
528  }
529 
530  void set_shape(uint n_rows, uint n_cols) {
531  if (n_cols==1) this->shape_ = { n_rows };
532  else this->shape_ = { n_rows, n_cols };
533  }
534 
535  /**
536  * Setters for essential field properties.
537  */
538  /**
539  * Data shared among copies of the same field.
540  *
541  * This allow field copies in different equations with different time setting, but
542  * sharing common input field descriptor array and common history.
543  */
544  struct SharedData {
545  /**
546  * Empty constructor.
547  */
549  : list_idx_(0), limits_(std::make_pair(-std::numeric_limits<double>::max(), std::numeric_limits<double>::max())) {};
550 
551  /**
552  * True for boundary fields.
553  */
554  bool bc_;
555  /**
556  * Number of components for fields that return variable size vectors. Zero in other cases.
557  */
558  unsigned int n_comp_;
559  /**
560  * Names of field components.
561  */
563  /**
564  * Name of the particular field. Used to name the key in the Field list Record.
565  */
566  std::string input_name_;
567  /**
568  * Description of corresponding key in the Field list Record.
569  */
570  std::string input_description_;
571  /**
572  * Units of the field values. Currently just a string description.
573  */
575  /**
576  * For Enum valued fields this is the input type selection that should be used
577  * to read possible values of the field (e.g. for FieldConstant the key 'value' has this selection input type).
578  *
579  * Is empty selection for for non-enum values fields.
580  */
582  /**
583  * Possible default value of the field.
584  */
586  /**
587  * Pointer to the mesh on which the field lives.
588  */
589  const Mesh *mesh_;
590 
591  /**
592  * Vector of input field descriptors from which the field is set.
593  */
595 
596  /**
597  * Index to current position of input field descriptor.
598  */
599  unsigned int list_idx_;
600 
601  /**
602  * True after check_initialized_region_fields_ is called. That happen at first call of the set_time method.
603  */
605 
606  /**
607  * For which values of an enum valued field we do not
608  * check the field. User is responsible, that the value will not be called
609  * on such regions.
610  */
612 
613  /**
614  * Allow set minimal and maximal limit value of Field.
615  */
616  std::pair<double, double> limits_;
617 
618 
619  };
620 
621  /**
622  * Name that identifies the field in the field_set. By default this is same as
623  * shared_->input_name_.
624  */
625  std::string name_;
626 
627  /**
628  * Data shared among copies of the same input field.
629  */
630  std::shared_ptr<SharedData> shared_;
631 
632  /**
633  * Result of last set time method
634  */
635  enum class TimeStatus {
636  changed, //< Field changed during last set time call.
637  constant, //< Field doesn't change.
638  unknown //< Before first call of set_time.
639  };
640 
641  // TODO: Merge time information: set_time_result_, last_time_, last_limit_side_, is_jump_time into
642  // a single structure with single getter.
643  /**
644  * Status of @p history.
645  */
647 
648  /**
649  * Last set time. Can be different for different field copies.
650  * Store also time limit, since the field may be discontinuous.
651  */
652  double last_time_ = -numeric_limits<double>::infinity();
653  LimitSide last_limit_side_ = LimitSide::left;
654 
655  /**
656  * Set to true by the @p set_time method the field algorithm change on any region.
657  * Accessible through the @p is_jump_time method.
658  */
660 
661  /**
662  * Output data type used in the output() method. Can be different for different field copies.
663  */
665 
666  /**
667  * Specify if the field is part of a MultiField and which component it is
668  */
669  unsigned int component_index_;
670 
671  /**
672  * Flag determining if object is Multifield or Field.
673  * TODO: temporary solution, goal is to make these two classes to behave similarly
674  */
676 
677  /**
678  * Maximum number of FieldBase objects we store per one region.
679  */
680  static const unsigned int history_length_limit_=3;
681 
682  /// Field flags. Default setting is "an equation input field, that can read from user input, and can be written to output"
684 
685  /// Vector of data of initialization messages.
687 
688  /**
689  * Stream output operator
690  */
691  friend std::ostream &operator<<(std::ostream &stream, const FieldCommon &field) {
692 
693  vector<string> limit_side_str = {"left", "right"};
694 
695  stream
696  << "field name:" << field.name()
697  << " n. comp.:" << field.n_comp()
698  << " last time:" << field.last_time_
699  << " last limit side:" << limit_side_str[(unsigned int) field.last_limit_side_];
700  return stream;
701  }
702 
703 public:
704 
705  /// Manually mark flag that the field has been changed.
707  { set_time_result_ = TimeStatus::changed; }
708 };
709 
710 
711 
712 
713 
714 
715 
716 #endif /* FIELD_COMMON_HH_ */
std::string input_description_
Common abstract parent of all Field<...> classes.
Definition: field_common.hh:74
Container for various descendants of FieldCommonBase.
Definition: field_set.hh:159
std::pair< double, double > limits_
bool is_jump_time_
Accessor to input data conforming to declared Array.
Definition: accessors.hh:566
unsigned int uint
FieldCommon & input_selection(Input::Type::Selection element_selection)
static constexpr Mask allow_output
The field can output. Is part of generated output selection. (default on)
Definition: field_flag.hh:37
FieldFlag::Flags get_flags() const
FieldCommon & flags_add(FieldFlag::Flags::Mask mask)
OutputTime::DiscreteSpace get_output_type() const
std::string name_
#define DECLARE_EXCEPTION(ExcName, Format)
Macro for simple definition of exceptions.
Definition: exceptions.hh:158
unsigned int component_index_
std::pair< double, double > limits() const
Store data of one initialization message.
Definition: field_common.hh:96
Definitions of ASSERTS.
vector< Input::Record > input_list_
Directing class of FieldValueCache.
Definition: mesh.h:77
Helper class that stores data of generic types.
Definition: type_generic.hh:89
double last_time_
const std::string & input_default() const
#define ASSERT(expr)
Allow use shorter versions of macro names if these names is not used with external library...
Definition: asserts.hh:347
Basic time management functionality for unsteady (and steady) solvers (class Equation).
FieldCommon & units(const UnitSI &units)
Set basic units of the field.
const std::string description() const
Basic time management class.
Class for declaration of inputs sequences.
Definition: type_base.hh:339
std::vector< uint > shape_
std::string default_value_
Default value of the field.
Definition: field_common.hh:99
std::shared_ptr< SharedData > shared_
double time() const
friend std::ostream & operator<<(std::ostream &stream, const FieldCommon &field)
#define FMT_UNUSED
Definition: posix.h:75
std::string field_name_
Parameter name_ of the field.
const std::string & name() const
FieldFlag::Flags & flags()
FieldCommon & input_default(const string &input_default)
const UnitSI & units() const
void set_time_result_changed()
Manually mark flag that the field has been changed.
MessageData(std::string default_value, std::string field_name, std::string region_list)
Constructor.
Definition: field_common.hh:98
virtual FieldCommon * get_component(FMT_UNUSED unsigned int idx)
unsigned int input_list_size() const
bool is_multifield() const
LimitSide last_limit_side_
void set_shape(uint n_rows, uint n_cols)
#define TYPEDEF_ERR_INFO(EI_Type, Type)
Macro to simplify declaration of error_info types.
Definition: exceptions.hh:194
std::vector< FieldEnum > no_check_values_
FieldResult
bool is_jump_time()
#define DECLARE_INPUT_EXCEPTION(ExcName, Format)
Macro for simple definition of input exceptions.
FieldCommon & description(const string &description)
Class holds local coordinations of evaluating points (bulk and sides) specified by element dimension...
Definition: eval_points.hh:43
static std::vector< MessageData > messages_data_
Vector of data of initialization messages.
void set_component_index(unsigned int idx)
IT::Selection input_element_selection_
const Mesh * mesh() const
FieldCommon & name(const string &name)
unsigned int n_comp() const
bool changed() const
void set_components(const std::vector< string > &names)
Record type proxy class.
Definition: type_record.hh:182
void set_history_changed()
FieldCommon & set_limits(double min, double max=std::numeric_limits< double >::max())
FlagArray< FieldFlag > Flags
Definition: field_flag.hh:26
FieldCommon & flags(FieldFlag::Flags::Mask mask)
const std::string & input_name() const
static constexpr Mask equation_input
The field is data parameter of the owning equation. (default on)
Definition: field_flag.hh:33
Class for representation SI units of Fields.
Definition: unit_si.hh:40
bool is_bc() const
#define THROW(whole_exception_expr)
Wrapper for throw. Saves the throwing point.
Definition: exceptions.hh:53
Representation of one time step..
TimeStatus set_time_result_
std::string region_list_
List of regions separated by comma.
Template for classes storing finite set of named values.
LimitSide
Definition: field_common.hh:61
FieldCommon & output_type(OutputTime::DiscreteSpace rt)
static constexpr Mask declare_input
The field can be set from input. The key in input field descriptor is declared. (default on) ...
Definition: field_flag.hh:35
std::vector< std::string > comp_names_