Flow123d
jenkins-Flow123d-linux-release-multijob-282
|
Common abstract parent of all Field<...> classes. More...
#include <field_common.hh>
Classes | |
struct | SharedData |
Public Member Functions | |
TYPEDEF_ERR_INFO (EI_Time, double) | |
TYPEDEF_ERR_INFO (EI_Field, std::string) | |
DECLARE_INPUT_EXCEPTION (ExcNonascendingTime,<< "Non-ascending time: "<< EI_Time::val<< " for field "<< EI_Field::qval<< ".\n") | |
DECLARE_INPUT_EXCEPTION (ExcMissingDomain,<< "Missing domain specification (region, r_id, or r_set) in the field descriptor:") | |
DECLARE_EXCEPTION (ExcFieldMeshDifference,<< "Two copies of the field "<< EI_Field::qval<< "call set_mesh with different arguments.\n") | |
FieldCommon & | name (const string &name) |
FieldCommon & | description (const string &description) |
FieldCommon & | input_default (const string &input_default) |
FieldCommon & | units (const UnitSI &units) |
Set basic units of the field. More... | |
FieldCommon & | input_selection (const Input::Type::Selection *element_selection) |
FieldCommon & | output_type (OutputTime::DiscreteSpace rt) |
FieldCommon & | flags (FieldFlag::Flags::Mask mask) |
FieldCommon & | flags_add (FieldFlag::Flags::Mask mask) |
void | set_components (const std::vector< string > &names) |
virtual void | set_mesh (const Mesh &mesh) |
void | set_input_list (const Input::Array &list) |
void | set_limit_side (LimitSide side) |
const std::string & | input_name () const |
const std::string & | name () const |
const std::string | description () const |
const std::string & | input_default () const |
const UnitSI & | units () const |
OutputTime::DiscreteSpace | output_type () const |
bool | is_bc () const |
unsigned int | n_comp () const |
const Mesh * | mesh () const |
LimitSide | limit_side () const |
FieldFlag::Flags & | flags () |
double | time () const |
virtual IT::AbstractRecord & | get_input_type ()=0 |
virtual IT::Record & | get_multifield_input_type ()=0 |
void | mark_input_times (TimeMark::Type mark_type) |
virtual bool | set_time (const TimeStep &time)=0 |
virtual void | copy_from (const FieldCommon &other)=0 |
virtual void | output (OutputTime *stream)=0 |
virtual bool | is_constant (Region reg)=0 |
bool | changed () const |
void | set_component_index (unsigned int idx) |
bool | is_multifield () const |
virtual | ~FieldCommon () |
Static Public Member Functions | |
static IT::Record | field_descriptor_record (const string &record_name) |
Protected Types | |
enum | TimeStatus { TimeStatus::changed, TimeStatus::constant, TimeStatus::unknown } |
Protected Member Functions | |
FieldCommon () | |
FieldCommon (const FieldCommon &other) | |
void | set_history_changed () |
Protected Attributes | |
std::string | name_ |
std::shared_ptr< SharedData > | shared_ |
LimitSide | limit_side_ |
TimeStatus | set_time_result_ |
Status of history . More... | |
double | last_time_ = -numeric_limits<double>::infinity() |
OutputTime::DiscreteSpace | type_of_output_data_ = OutputTime::ELEM_DATA |
unsigned int | component_index_ |
bool | multifield_ |
FieldFlag::Flags | flags_ = FieldFlag::declare_input & FieldFlag::equation_input & FieldFlag::allow_output |
Field flags. Default setting is "an equation input field, that can read from user input, and can be written to output". More... | |
Static Protected Attributes | |
static const unsigned int | history_length_limit_ =3 |
Friends | |
std::ostream & | operator<< (std::ostream &stream, const FieldCommon &field) |
Common abstract parent of all Field<...> classes.
We need common ancestor in order to keep a list of all fields in one EqData object and allow collective operations like set_time
or init_from_input
.
Definition at line 47 of file field_common.hh.
|
strongprotected |
Result of last set time method
Enumerator | |
---|---|
changed | |
constant | |
unknown |
Definition at line 448 of file field_common.hh.
|
virtual |
Virtual destructor.
Definition at line 119 of file field_common.cc.
|
protected |
Private default constructor. Should be used only through Field<...>
Definition at line 8 of file field_common.cc.
|
protected |
Private copy constructor. Should be used only through Field<...>
Definition at line 23 of file field_common.cc.
|
inline |
Returns true if set_time_result_ is not TimeStatus::constant
. Returns the same value as last set_time method.
Definition at line 296 of file field_common.hh.
|
pure virtual |
Check that other
is instance of the same Field<..> class and perform assignment. Polymorphic copy.
Implemented in Field< spacedim, Value >, Field< spacedim, FieldValue< 3 >::EnumVector >, Field< 3, FieldValue< 3 >::Vector >, Field< spacedim, FieldValue< 3 >::Vector >, Field< 3, FieldValue< 3 >::Scalar >, Field< 3, FieldValue< 3 >::VectorFixed >, Field< spacedim, FieldValue< 3 >::Scalar >, Field< spacedim, FieldValue< 3 >::Enum >, Field< 3, FieldValue< 3 >::Integer >, Field< 3, FieldValue< 3 >::TensorFixed >, Field< spacedim, typename FieldValue< spacedim >::Vector >, Field< 3, FieldValue< 3 >::EnumVector >, MultiField< spacedim, Value >, and MultiField< 3, FieldValue< 3 >::Scalar >.
FieldCommon::DECLARE_EXCEPTION | ( | ExcFieldMeshDifference | , |
<< "Two copies of the field "<< EI_Field::qval<< "call set_mesh with different arguments.\n" | |||
) |
FieldCommon::DECLARE_INPUT_EXCEPTION | ( | ExcNonascendingTime | , |
<< "Non-ascending time: "<< EI_Time::val<< " for field "<< EI_Field::qval<< ".\n" | |||
) |
FieldCommon::DECLARE_INPUT_EXCEPTION | ( | ExcMissingDomain | , |
<< "Missing domain specification (region, r_id, or r_set) in the field descriptor:" | |||
) |
|
inline |
Set description of the field, used for description of corresponding key in documentation.
Definition at line 80 of file field_common.hh.
|
inline |
|
static |
Common part of the field descriptor. To get finished record one has to add keys for individual fields. This is done automatically using FieldSet::get_input_type().
Definition at line 34 of file field_common.cc.
|
inline |
Set given mask to the field flags, ignoring default setting. Default setting is declare_input & equation_input & allow_output.
Definition at line 134 of file field_common.hh.
|
inline |
|
inline |
Add given mask to the field flags.
Definition at line 140 of file field_common.hh.
|
pure virtual |
Returns input type for particular field instance, this is reference to a static member input_type of the corresponding FieldBase
class (i.e. with the same template parameters). This is used in FieldSet::make_field_descriptor_type.
Implemented in Field< spacedim, Value >, Field< spacedim, FieldValue< 3 >::EnumVector >, Field< 3, FieldValue< 3 >::Vector >, Field< spacedim, FieldValue< 3 >::Vector >, Field< 3, FieldValue< 3 >::Scalar >, Field< 3, FieldValue< 3 >::VectorFixed >, Field< spacedim, FieldValue< 3 >::Scalar >, Field< spacedim, FieldValue< 3 >::Enum >, Field< 3, FieldValue< 3 >::Integer >, Field< 3, FieldValue< 3 >::TensorFixed >, Field< spacedim, typename FieldValue< spacedim >::Vector >, Field< 3, FieldValue< 3 >::EnumVector >, MultiField< spacedim, Value >, and MultiField< 3, FieldValue< 3 >::Scalar >.
|
pure virtual |
Returns input type for MultiField instance. TODO: temporary solution, see multifield_
Implemented in Field< spacedim, Value >, Field< spacedim, FieldValue< 3 >::EnumVector >, Field< 3, FieldValue< 3 >::Vector >, Field< spacedim, FieldValue< 3 >::Vector >, Field< 3, FieldValue< 3 >::Scalar >, Field< 3, FieldValue< 3 >::VectorFixed >, Field< spacedim, FieldValue< 3 >::Scalar >, Field< spacedim, FieldValue< 3 >::Enum >, Field< 3, FieldValue< 3 >::Integer >, Field< 3, FieldValue< 3 >::TensorFixed >, Field< spacedim, typename FieldValue< spacedim >::Vector >, Field< 3, FieldValue< 3 >::EnumVector >, MultiField< spacedim, Value >, and MultiField< 3, FieldValue< 3 >::Scalar >.
|
inline |
Set default value for the field's key from which the default constant valued field will be constructed.
During the first call of the set_time
method, we check that the field is defined on all regions. On regions where it is not set yet, we use given dflt
string to get particular instance of FieldBase<> (see check_initialized_region_fields_
). The default string is interpreted in the same way as if it appears in the input file as the value of the field. In particular it can be whole record with TYPE
of the field etc. Most common choice is however mere constant.
Definition at line 92 of file field_common.hh.
|
inline |
|
inline |
Getters.
Definition at line 183 of file field_common.hh.
|
inline |
For the fields returning "Enum", we have to pass the Input::Type::Selection object to the field implementations.
We must save raw pointer since selection may not be yet initialized (during static initialization phase).
Definition at line 114 of file field_common.hh.
|
inline |
|
pure virtual |
If the field on given region reg
exists and is of type FieldConstant<...> the method method returns true otherwise it returns false. Then one call ElementAccessor<spacedim>(mesh(), reg ) to construct an ElementAccessor elm
pointing to "virtual" element on which Field::value returns constant value.
Current implementation use virtual functions and can be prohibitively slow if called for every element. If this becomes necessary it is possible to incorporate such test into set_time method and in this method just return precomputed result.
Implemented in Field< spacedim, Value >, Field< spacedim, FieldValue< 3 >::EnumVector >, Field< 3, FieldValue< 3 >::Vector >, Field< spacedim, FieldValue< 3 >::Vector >, Field< 3, FieldValue< 3 >::Scalar >, Field< 3, FieldValue< 3 >::VectorFixed >, Field< spacedim, FieldValue< 3 >::Scalar >, Field< spacedim, FieldValue< 3 >::Enum >, Field< 3, FieldValue< 3 >::Integer >, Field< 3, FieldValue< 3 >::TensorFixed >, Field< spacedim, typename FieldValue< spacedim >::Vector >, Field< 3, FieldValue< 3 >::EnumVector >, MultiField< spacedim, Value >, and MultiField< 3, FieldValue< 3 >::Scalar >.
|
inline |
Return multifield_
flag. TODO: temporary solution
Definition at line 314 of file field_common.hh.
|
inline |
Definition at line 210 of file field_common.hh.
void FieldCommon::mark_input_times | ( | TimeMark::Type | mark_type | ) |
Pass through the input array input_list_
, collect all times where the field could change and put appropriate time marks into global TimeMarks object. Introduced time marks have both given mark_type
and type_input()
type.
Further development:
Definition at line 103 of file field_common.cc.
|
inline |
|
inline |
|
inline |
Set name of the field. In fact there are two attributes set by this method.
The first is name used to identify the field as part of a FieldSet or MultiField objects. This name is permanent and can be set only by this method. Can be accessed by name()
method. This name is also used at output.
The second is input_name_
that determines appropriate key name in the input field descriptor. This name is also set by this method, but is stored in the internal shared space which is overwritten during call of copy_from method or assignment operator. Can be accessed by input_name()
mathod.
Definition at line 73 of file field_common.hh.
|
inline |
|
pure virtual |
Output the field. The parameter output_fields
is checked for value named by the field name. If the key exists, then the output of the field is performed. If the key do not appear in the input, no output is done.
Implemented in Field< spacedim, Value >, Field< spacedim, FieldValue< 3 >::EnumVector >, Field< 3, FieldValue< 3 >::Vector >, Field< spacedim, FieldValue< 3 >::Vector >, Field< 3, FieldValue< 3 >::Scalar >, Field< 3, FieldValue< 3 >::VectorFixed >, Field< spacedim, FieldValue< 3 >::Scalar >, Field< spacedim, FieldValue< 3 >::Enum >, Field< 3, FieldValue< 3 >::Integer >, Field< 3, FieldValue< 3 >::TensorFixed >, Field< spacedim, typename FieldValue< spacedim >::Vector >, Field< 3, FieldValue< 3 >::EnumVector >, MultiField< spacedim, Value >, and MultiField< 3, FieldValue< 3 >::Scalar >.
|
inline |
Output discrete space used in the output() method. Can be different for different field copies. one can choose between: data constant on elements, linear data given in nodes, and discontinuous linear data.
If not set explicitly by this method, the default value is OutputTime::ELEM_DATA
Definition at line 127 of file field_common.hh.
|
inline |
|
inline |
Sets component_index_
Definition at line 305 of file field_common.hh.
|
inline |
Set vector of component names. Set number of components for run-time sized vectors. This is used latter when we construct objects derived from FieldBase<...>.
n_comp_ is constant zero for fixed values, this zero is set by Field<...> constructors
Definition at line 150 of file field_common.hh.
|
inlineprotected |
Invalidate last time in order to force set_time method update region_fields_.
Definition at line 342 of file field_common.hh.
void FieldCommon::set_input_list | ( | const Input::Array & | list | ) |
Set the data list from which field will read its input. It is list of "field descriptors". When reading from the input list we consider only field descriptors containing key of named by the field name. These field descriptors has to have times forming ascending sequence.
The list is used by set_time method to set field on individual regions to actual FieldBase descendants.
Definition at line 53 of file field_common.cc.
|
inline |
Set side of limit when calling set_time
with jump time, i.e. time where the field change implementation on some region. Wee assume that implementations prescribe only smooth fields. This method invalidate result of changed()
so it should be called just before set_time
. Can be different for different field copies.
Definition at line 177 of file field_common.hh.
|
inlinevirtual |
Set internal mesh pointer.
Reimplemented in Field< spacedim, Value >, Field< spacedim, FieldValue< 3 >::EnumVector >, Field< 3, FieldValue< 3 >::Vector >, Field< spacedim, FieldValue< 3 >::Vector >, Field< 3, FieldValue< 3 >::Scalar >, Field< 3, FieldValue< 3 >::VectorFixed >, Field< spacedim, FieldValue< 3 >::Scalar >, Field< spacedim, FieldValue< 3 >::Enum >, Field< 3, FieldValue< 3 >::Integer >, Field< 3, FieldValue< 3 >::TensorFixed >, Field< spacedim, typename FieldValue< spacedim >::Vector >, Field< 3, FieldValue< 3 >::EnumVector >, MultiField< spacedim, Value >, and MultiField< 3, FieldValue< 3 >::Scalar >.
Definition at line 159 of file field_common.hh.
|
pure virtual |
Abstract method to update field to the new time level. Implemented by in class template Field<...>.
Return true if the value of the field was changed on some region. The returned value is also stored in changed_during_set_time
data member.
Default values helps when creating steady field. Note that default TimeGovernor constructor set time to 0.0.
Different field copies can be set to different times.
Implemented in Field< spacedim, Value >, Field< spacedim, FieldValue< 3 >::EnumVector >, Field< 3, FieldValue< 3 >::Vector >, Field< spacedim, FieldValue< 3 >::Vector >, Field< 3, FieldValue< 3 >::Scalar >, Field< 3, FieldValue< 3 >::VectorFixed >, Field< spacedim, FieldValue< 3 >::Scalar >, Field< spacedim, FieldValue< 3 >::Enum >, Field< 3, FieldValue< 3 >::Integer >, Field< 3, FieldValue< 3 >::TensorFixed >, Field< spacedim, typename FieldValue< spacedim >::Vector >, Field< 3, FieldValue< 3 >::EnumVector >, MultiField< spacedim, Value >, and MultiField< 3, FieldValue< 3 >::Scalar >.
|
inline |
Returns time set by last call of set_time method. Can be different for different field copies.
Definition at line 220 of file field_common.hh.
FieldCommon::TYPEDEF_ERR_INFO | ( | EI_Time | , |
double | |||
) |
FieldCommon::TYPEDEF_ERR_INFO | ( | EI_Field | , |
std::string | |||
) |
|
inline |
Set basic units of the field.
Currently, we use it only during output and we represents units just by a string.
TODO: Particular class for representing and conversion of various units would be more appropriate. This can allow specification of the units on the inptu, automatic conversion and the same on the output. Possibly this allow using Boost::Units library, however, it seems to introduce lot of boilerplate code. But can increase correctness of the calculations.
Definition at line 105 of file field_common.hh.
|
inline |
Definition at line 195 of file field_common.hh.
|
friend |
Stream output operator
Definition at line 489 of file field_common.hh.
|
protected |
Specify if the field is part of a MultiField and which component it is
Definition at line 470 of file field_common.hh.
|
protected |
Field flags. Default setting is "an equation input field, that can read from user input, and can be written to output".
Definition at line 484 of file field_common.hh.
|
staticprotected |
Maximum number of FieldBase objects we store per one region.
Definition at line 481 of file field_common.hh.
|
protected |
Last set time. Can be different for different field copies.
Definition at line 460 of file field_common.hh.
|
protected |
Which value is returned for times where field is discontinuous.
Definition at line 443 of file field_common.hh.
|
protected |
Flag determining if object is Multifield or Field. TODO: temporary solution, goal is to make these two classes to behave similarly
Definition at line 476 of file field_common.hh.
|
protected |
Name that identifies the field in the field_set. By default this is same as shared_->input_name_.
Definition at line 433 of file field_common.hh.
|
protected |
Status of history
.
Definition at line 455 of file field_common.hh.
|
protected |
Data shared among copies of the same input field.
Definition at line 438 of file field_common.hh.
|
protected |
Output data type used in the output() method. Can be different for different field copies.
Definition at line 465 of file field_common.hh.