Flow123d
3.9.1-0844c3d
|
#include <field_algo_base.hh>
Public Types | |
typedef Space< spacedim >::Point | Point |
Public Member Functions | |
TYPEDEF_ERR_INFO (EI_Field, std::string) | |
DECLARE_EXCEPTION (ExcInputInitUnsupported,<< "The field "<< EI_Field::qval<< " do not support initialization from input.\n") | |
FieldAlgorithmBase (unsigned int n_comp=0) | |
virtual void | init_from_input (const Input::Record &rec, const struct FieldAlgoBaseInitData &init_data) |
virtual bool | set_time (const TimeStep &time) |
virtual void | set_mesh (const Mesh *mesh, bool boundary_domain) |
void | set_component_idx (unsigned int idx) |
unsigned int | n_comp () const |
FieldResult | field_result () const |
virtual double | next_change_time () |
virtual const Value::return_type & | value (const Point &p, const ElementAccessor< spacedim > &elm)=0 |
virtual void | value_list (const Armor::array &point_list, const ElementAccessor< spacedim > &elm, std::vector< typename Value::return_type > &value_list)=0 |
virtual void | cache_reinit (const ElementCacheMap &cache_map) |
Allows reinit data members or structures in descendants during reinit of FieldValueCache of 'parental' Field<> More... | |
virtual void | cache_update (FieldValueCache< typename Value::element_type > &data_cache, ElementCacheMap &cache_map, unsigned int region_patch_idx) |
virtual void | set_native_dh (std::shared_ptr< DOFHandlerMultiDim >) |
bool | is_constant_in_space () const |
virtual std::vector< const FieldCommon * > | set_dependency (FMT_UNUSED FieldSet &field_set) |
virtual | ~FieldAlgorithmBase () |
Static Public Member Functions | |
static std::string | template_name () |
static Input::Type::Abstract & | get_input_type () |
static const Input::Type::Instance & | get_input_type_instance (Input::Type::Selection value_selection=Input::Type::Selection()) |
static const Input::Type::Record & | get_field_algo_common_keys () |
static std::shared_ptr< FieldAlgorithmBase< spacedim, Value > > | function_factory (const Input::AbstractRecord &rec, const struct FieldAlgoBaseInitData &init_data) |
Static Public Attributes | |
static const unsigned int | spacedim_ =spacedim |
static constexpr bool | is_enum_valued = std::is_same<typename Value::element_type, FieldEnum>::value |
Protected Member Functions | |
void | init_unit_conversion_coefficient (const Input::Record &rec, const struct FieldAlgoBaseInitData &init_data) |
Init value of unit_conversion_coefficient_ from input. More... | |
Protected Attributes | |
TimeStep | time_ |
Actual time level; initial value is -infinity. More... | |
Value | value_ |
Last value, prevents passing large values (vectors) by value. More... | |
Value::return_type | r_value_ |
FieldResult | field_result_ |
Indicator of particular values (zero, one) constant over space. More... | |
unsigned int | component_idx_ |
Specify if the field is part of a MultiField and which component it is. More... | |
double | unit_conversion_coefficient_ |
Coeficient of conversion of user-defined unit. More... | |
bool | is_constant_in_space_ |
Flag detects that field is only dependent on time. More... | |
Base class for space-time function classes.
Definition at line 112 of file field_algo_base.hh.
typedef Space<spacedim>::Point FieldAlgorithmBase< spacedim, Value >::Point |
Definition at line 115 of file field_algo_base.hh.
FieldAlgorithmBase< spacedim, Value >::FieldAlgorithmBase | ( | unsigned int | n_comp = 0 | ) |
Kind of default constructor , with possible setting of the initial time. Fields that returns variable size vectors accepts number of components n_comp
.
Definition at line 47 of file field_algo_base.impl.hh.
|
inlinevirtual |
Virtual destructor.
Definition at line 271 of file field_algo_base.hh.
|
virtual |
Allows reinit data members or structures in descendants during reinit of FieldValueCache of 'parental' Field<>
Reimplemented in FieldFormula< spacedim, Value >.
Definition at line 149 of file field_algo_base.impl.hh.
|
virtual |
Reimplemented in FieldModel< spacedim, Value, Fn, InputFields >, FieldFormula< spacedim, Value >, and FieldConstant< spacedim, Value >.
Definition at line 139 of file field_algo_base.impl.hh.
FieldAlgorithmBase< spacedim, Value >::DECLARE_EXCEPTION | ( | ExcInputInitUnsupported | , |
<< "The field "<< EI_Field::qval<< " do not support initialization from input.\n" | |||
) |
|
inline |
Special field values spatially constant. Could allow optimization of tensor multiplication and tensor or vector addition. field_result_ should be set in constructor and in set_time method of particular Field implementation.
Definition at line 201 of file field_algo_base.hh.
|
static |
This static method gets accessor to abstract record with function input, dispatch to correct constructor and initialize appropriate function object from the input. Returns shared pointer to FunctionBase<>.
Definition at line 101 of file field_algo_base.impl.hh.
|
static |
Returns auxiliary record with keys common to all field algorithms.
Definition at line 91 of file field_algo_base.impl.hh.
|
static |
Returns whole tree of input types for FieldBase with all descendants based on element input type (namely for FieldConstant) given by element_input_type pointer.
Definition at line 66 of file field_algo_base.impl.hh.
|
static |
Returns parameterized whole tree of input types for FieldBase with all descendants based on element input type (namely for FieldConstant) given by element_input_type pointer.
Definition at line 78 of file field_algo_base.impl.hh.
|
virtual |
Function can provide way to initialize itself from the input data.
TODO: make protected, should be called through function factory
Reimplemented in FieldConstant< spacedim, Value >, FieldTimeFunction< spacedim, Value >, FieldFormula< spacedim, Value >, and FieldPython< spacedim, Value >.
Definition at line 112 of file field_algo_base.impl.hh.
|
protected |
Init value of unit_conversion_coefficient_
from input.
Definition at line 170 of file field_algo_base.impl.hh.
|
inline |
Return true if field is only dependent on time.
Definition at line 257 of file field_algo_base.hh.
unsigned int FieldAlgorithmBase< spacedim, Value >::n_comp |
Returns number of rows, i.e. number of components for variable size vectors. For values of fixed size returns zero.
Definition at line 133 of file field_algo_base.impl.hh.
|
inlinevirtual |
Method for getting some information about next time where the function change its character. Used to add appropriate TimeMarks. TODO: think what kind of information we may need, is the next time value enough?
Definition at line 209 of file field_algo_base.hh.
|
inline |
Sets component_idx_
Definition at line 189 of file field_algo_base.hh.
|
inlinevirtual |
Set reference of FieldSet to FieldFormula instance.
Reimplemented in FieldModel< spacedim, Value, Fn, InputFields >.
Definition at line 264 of file field_algo_base.hh.
|
virtual |
Is used only by some Field implementations, but can be used to check validity of incoming ElementAccessor in value methods.
Optional parameter boundary_domain
can be used to specify, that the field will be evaluated only on the boundary part of the mesh. TODO: make separate mesh for the boundary, then we can drop this parameter.
Reimplemented in FieldAddPotential< spacedim, Value >, and FieldFormula< spacedim, Value >.
Definition at line 127 of file field_algo_base.impl.hh.
|
inlinevirtual |
Postponed setter of Dof handler for FieldFE. For other types of fields has no effect.
Definition at line 251 of file field_algo_base.hh.
|
virtual |
Set new time value. Some Fields may and some may not implement time dependent values and possibly various types of interpolation. There can not be unified approach to interpolation (at least not on this abstraction level) since some fields (FieldFormula, FieldPython) provides naturally time dependent functions other fields like (FieldConstant, ...), however, can be equipped by various time interpolation schemes. In future, we obviously need time interpolation of higher order so that we can use ODE integrators of higher order.
The method returns true if the value of the field has changed in the new time step.
Reimplemented in FieldAddPotential< spacedim, Value >, FieldFormula< spacedim, Value >, and FieldTimeFunction< spacedim, Value >.
Definition at line 119 of file field_algo_base.impl.hh.
|
static |
Returns template parameters as string in order to distinguish name of Abstracts for initialization of different instances of the FieldBase template.
Definition at line 59 of file field_algo_base.impl.hh.
FieldAlgorithmBase< spacedim, Value >::TYPEDEF_ERR_INFO | ( | EI_Field | , |
std::string | |||
) |
|
pure virtual |
Returns one value in one given point on
an element given by ElementAccessor elm
. It returns reference to he actual value in order to avoid temporaries for vector and tensor values.
This method just call the later one value(Point, ElementAccessor, Value)
and drops the FieldResult.
Usual implementation of this method fills member
r_value_ through unified envelope value_
as general tensor and then returns member r_value_
. However, some particular Fields may have result stored elsewhere, in such a case the reference to the result can be returned directly without using the member value_
. Keeping such wide space for optimization has drawback in slow generic implementation of the value_list
method that fills whole vector of values for vector of points. Its generic implementation has to copy all values instead of directly store them into the vector of result values.
So the best practice when implementing value
and @value_list methods in particular FieldBase descendant is implement some thing like value(point, elm, Value::return_type &value) and using s having in part
Implemented in FieldModel< spacedim, Value, Fn, InputFields >, FieldConstant< spacedim, Value >, FieldAddPotential< spacedim, Value >, FieldFormula< spacedim, Value >, and FieldPython< spacedim, Value >.
|
pure virtual |
Returns std::vector of scalar values in several points at once. The base class implements trivial implementation using the value(,,)
method. This is not optimal as it involves lot of virtual calls, but this overhead can be negligible for more complex fields as Python of Formula.
FieldAlgorithmBase provides a slow implementation using the value() method. Derived Field can implement its value_list method as call of FieldAlgoritmBase<...>::value_list().
Implemented in FieldModel< spacedim, Value, Fn, InputFields >, FieldConstant< spacedim, Value >, FieldAddPotential< spacedim, Value >, FieldFormula< spacedim, Value >, and FieldPython< spacedim, Value >.
Definition at line 154 of file field_algo_base.impl.hh.
|
protected |
Specify if the field is part of a MultiField and which component it is.
Definition at line 285 of file field_algo_base.hh.
|
protected |
Indicator of particular values (zero, one) constant over space.
Definition at line 283 of file field_algo_base.hh.
|
protected |
Flag detects that field is only dependent on time.
Definition at line 289 of file field_algo_base.hh.
|
staticconstexpr |
Definition at line 117 of file field_algo_base.hh.
|
protected |
Definition at line 281 of file field_algo_base.hh.
|
static |
Definition at line 116 of file field_algo_base.hh.
|
protected |
Actual time level; initial value is -infinity.
Definition at line 278 of file field_algo_base.hh.
|
protected |
Coeficient of conversion of user-defined unit.
Definition at line 287 of file field_algo_base.hh.
|
protected |
Last value, prevents passing large values (vectors) by value.
Definition at line 280 of file field_algo_base.hh.