Flow123d  jenkins-Flow123d-windows-release-multijob-285
Classes | Public Types | Public Member Functions | Private Attributes | List of all members
MultiField< spacedim, Value > Class Template Reference

Class for representation of a vector of fields of the same physical quantity. More...

#include <multi_field.hh>

Inheritance diagram for MultiField< spacedim, Value >:
Inheritance graph
[legend]
Collaboration diagram for MultiField< spacedim, Value >:
Collaboration graph
[legend]

Classes

class  MultiFieldFactory
 

Public Types

typedef Field< spacedim, Value > SubFieldType
 
typedef Field< spacedim, typename FieldValue< spacedim >::Vector > TransposedField
 

Public Member Functions

 MultiField ()
 
IT::AbstractRecordget_input_type () override
 
IT::Recordget_multifield_input_type () override
 
bool set_time (const TimeStep &time) override
 
void set_mesh (const Mesh &mesh) override
 
void copy_from (const FieldCommon &other) override
 
void output (OutputTime *stream) override
 
bool is_constant (Region reg) override
 
virtual ~MultiField ()
 
unsigned int size () const
 Number of subfields that compose the multi-field. More...
 
SubFieldTypeoperator[] (unsigned int idx)
 
void set_up_components ()
 
- Public Member Functions inherited from FieldCommon
 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")
 
FieldCommonname (const string &name)
 
FieldCommondescription (const string &description)
 
FieldCommoninput_default (const string &input_default)
 
FieldCommonunits (const UnitSI &units)
 Set basic units of the field. More...
 
FieldCommoninput_selection (const Input::Type::Selection *element_selection)
 
FieldCommonoutput_type (OutputTime::DiscreteSpace rt)
 
FieldCommonflags (FieldFlag::Flags::Mask mask)
 
FieldCommonflags_add (FieldFlag::Flags::Mask mask)
 
void set_components (const std::vector< string > &names)
 
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 UnitSIunits () const
 
OutputTime::DiscreteSpace output_type () const
 
bool is_bc () const
 
unsigned int n_comp () const
 
const Meshmesh () const
 
LimitSide limit_side () const
 
FieldFlag::Flagsflags ()
 
double time () const
 
void mark_input_times (TimeMark::Type mark_type)
 
bool changed () const
 
void set_component_index (unsigned int idx)
 
bool is_multifield () const
 
virtual ~FieldCommon ()
 

Private Attributes

std::vector< SubFieldTypesub_fields_
 
SubFieldType sub_field_type_
 Helper class members, used only for input record. More...
 
TransposedField transposed_field_
 

Additional Inherited Members

- Static Public Member Functions inherited from FieldCommon
static IT::Record field_descriptor_record (const string &record_name)
 
- Protected Types inherited from FieldCommon
enum  TimeStatus { TimeStatus::changed, TimeStatus::constant, TimeStatus::unknown }
 
- Protected Member Functions inherited from FieldCommon
 FieldCommon ()
 
 FieldCommon (const FieldCommon &other)
 
void set_history_changed ()
 
- Protected Attributes inherited from FieldCommon
std::string name_
 
std::shared_ptr< SharedDatashared_
 
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 inherited from FieldCommon
static const unsigned int history_length_limit_ =3
 

Detailed Description

template<int spacedim, class Value>
class MultiField< spacedim, Value >

Class for representation of a vector of fields of the same physical quantity.

When solving a system of same equations with the number of components given at runtime (as in the case of transport equation for runtime given number of substances) we need means how to work with the whole vector of fields at once. This is the aim of this class. It provides the interface given by the parent class FieldCommonBase, but principally it is just a vector of Field<Value,dim> objects. The sub-fields or components of a MultiField are independent objects, how ever the setters propagates the values from the MultiFields to the individual fields. The only exception is the set_name method which in conjunction with MultiField::set_subfield_names can set unique name to each component.

Template parameters are used for every subfield.

TODO:

Definition of MultiField must be in separate file. In other case source file field.cc is too big and compiler can throw compile error.

Definition at line 45 of file multi_field.hh.

Member Typedef Documentation

template<int spacedim, class Value>
typedef Field<spacedim, Value> MultiField< spacedim, Value >::SubFieldType

Definition at line 48 of file multi_field.hh.

template<int spacedim, class Value>
typedef Field<spacedim, typename FieldValue<spacedim>::Vector > MultiField< spacedim, Value >::TransposedField

Definition at line 49 of file multi_field.hh.

Constructor & Destructor Documentation

template<int spacedim, class Value >
MultiField< spacedim, Value >::MultiField ( )

Default constructor.

Definition at line 22 of file multi_field.impl.hh.

template<int spacedim, class Value>
virtual MultiField< spacedim, Value >::~MultiField ( )
inlinevirtual

Virtual destructor.

Definition at line 113 of file multi_field.hh.

Member Function Documentation

template<int spacedim, class Value >
void MultiField< spacedim, Value >::copy_from ( const FieldCommon other)
overridevirtual

Polymorphic copy. Check correct type, allows copy of MultiField or Field.

Implements FieldCommon.

Definition at line 86 of file multi_field.impl.hh.

template<int spacedim, class Value >
it::AbstractRecord & MultiField< spacedim, Value >::get_input_type ( )
overridevirtual

Returns input type of particular field instance, this is usually static member input_type of the corresponding FieldBase class ( with same template parameters), however, for fields returning "Enum" we have to create whole unique Input::Type hierarchy for every instance since every such field use different Selection for initialization, even if all returns just unsigned int.

Implements FieldCommon.

Definition at line 31 of file multi_field.impl.hh.

Here is the caller graph for this function:

template<int spacedim, class Value >
it::Record & MultiField< spacedim, Value >::get_multifield_input_type ( )
overridevirtual

Returns input type for MultiField instance. TODO: temporary solution, see multifield_

Implements FieldCommon.

Definition at line 40 of file multi_field.impl.hh.

template<int spacedim, class Value >
bool MultiField< spacedim, Value >::is_constant ( Region  reg)
overridevirtual

Implementation of FieldCommonBase::is_constant().

Implements FieldCommon.

Definition at line 112 of file multi_field.impl.hh.

template<int spacedim, class Value>
SubFieldType& MultiField< spacedim, Value >::operator[] ( unsigned int  idx)
inline

Returns reference to the sub-field (component) of given index idx.

Definition at line 122 of file multi_field.hh.

template<int spacedim, class Value >
void MultiField< spacedim, Value >::output ( OutputTime stream)
overridevirtual

Implementation of FieldCommonBase::output().

Implements FieldCommon.

Definition at line 100 of file multi_field.impl.hh.

template<int spacedim, class Value >
void MultiField< spacedim, Value >::set_mesh ( const Mesh mesh)
overridevirtual

We have to override the set_mesh method in order to call set_mesh method for subfields.

Reimplemented from FieldCommon.

Definition at line 75 of file multi_field.impl.hh.

Here is the caller graph for this function:

template<int spacedim, class Value >
bool MultiField< spacedim, Value >::set_time ( const TimeStep time)
overridevirtual

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.

In first call initialize MultiField to the number of components given by the size of names and use this vector to name individual components. Should be called after the setters derived from FieldCommonBase.

Implements FieldCommon.

Definition at line 55 of file multi_field.impl.hh.

template<int spacedim, class Value >
void MultiField< spacedim, Value >::set_up_components ( )

Initialize components of MultiField.

Must be call after setting components, mesh and limit side.

Definition at line 121 of file multi_field.impl.hh.

Here is the caller graph for this function:

template<int spacedim, class Value>
unsigned int MultiField< spacedim, Value >::size ( ) const
inline

Number of subfields that compose the multi-field.

Definition at line 116 of file multi_field.hh.

Here is the caller graph for this function:

Member Data Documentation

template<int spacedim, class Value>
SubFieldType MultiField< spacedim, Value >::sub_field_type_
private

Helper class members, used only for input record.

Definition at line 139 of file multi_field.hh.

template<int spacedim, class Value>
std::vector< SubFieldType > MultiField< spacedim, Value >::sub_fields_
private

Definition at line 136 of file multi_field.hh.

template<int spacedim, class Value>
TransposedField MultiField< spacedim, Value >::transposed_field_
private

Definition at line 140 of file multi_field.hh.


The documentation for this class was generated from the following files: