Flow123d  jenkins-Flow123d-windows32-release-multijob-51
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 <field.hh>

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

Public Types

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

Public Member Functions

 MultiField ()
 
IT::AbstractRecordget_input_type () override
 
void set_limit_side (LimitSide side) override
 
bool set_time (const TimeGovernor &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...
 
void init (const vector< string > &names)
 
void set_complemented_vector_field (TransposedField &complemented)
 
SubFieldTypeoperator[] (unsigned int idx)
 
- 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_n_components (unsigned int n_comp)
 
void set_input_list (const Input::Array &list)
 
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
 
virtual ~FieldCommon ()
 

Private Attributes

std::vector< SubFieldTypesub_fields_
 
std::vector< std::string > sub_names_
 

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
 
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 at line 309 of file field.hh.

Member Typedef Documentation

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

Definition at line 312 of file field.hh.

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

Definition at line 313 of file field.hh.

Constructor & Destructor Documentation

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

Default constructor.

Definition at line 466 of file field.impl.hh.

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

Virtual destructor.

Definition at line 362 of file 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 528 of file 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 492 of file field.impl.hh.

template<int spacedim, class Value >
void MultiField< spacedim, Value >::init ( const vector< string > &  names)

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.

Definition at line 473 of file field.impl.hh.

Here is the caller graph for this function:

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

Implementation of FieldCommonBase::is_constant().

Implements FieldCommon.

Definition at line 554 of file 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 383 of file field.hh.

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

Implementation of FieldCommonBase::output().

Implements FieldCommon.

Definition at line 542 of file field.impl.hh.

template<int spacedim, class Value>
void MultiField< spacedim, Value >::set_complemented_vector_field ( TransposedField complemented)

Allows set Field<dim, Vector> that can be used for alternative initialization in "transposed" form.

template<int spacedim, class Value >
void MultiField< spacedim, Value >::set_limit_side ( LimitSide  side)
overridevirtual

Set side of limit when calling set_time with jump time. This method invalidate result of changed() so it should be called just before set_time. Can be different for different field copies.

Implements FieldCommon.

Definition at line 498 of file 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 520 of file field.impl.hh.

Here is the caller graph for this function:

template<int spacedim, class Value >
bool MultiField< spacedim, Value >::set_time ( const TimeGovernor 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.

Implements FieldCommon.

Definition at line 506 of file field.impl.hh.

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

Number of subfields that compose the multi-field.

Definition at line 365 of file field.hh.

Here is the caller graph for this function:

Member Data Documentation

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

Definition at line 387 of file field.hh.

template<int spacedim, class Value>
std::vector< std::string > MultiField< spacedim, Value >::sub_names_
private

Definition at line 388 of file field.hh.


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