|
Flow123d
|
#include <field_base.hh>


Public Types | |
| typedef Space< spacedim >::Point | Point |
| typedef Value | ValueType |
Public Member Functions | |
| FieldBase (unsigned int n_comp=0) | |
| virtual void | init_from_input (const Input::Record &rec) |
| virtual bool | set_time (double time) |
| virtual void | set_mesh (const Mesh *mesh, bool boundary_domain) |
| unsigned int | n_comp () const |
| FieldResult | field_result () const |
| virtual double | next_change_time () |
| virtual Value::return_type const & | value (const Point &p, const ElementAccessor< spacedim > &elm)=0 |
| virtual void | value_list (const std::vector< Point > &point_list, const ElementAccessor< spacedim > &elm, std::vector< typename Value::return_type > &value_list)=0 |
| virtual | ~FieldBase () |
Static Public Member Functions | |
| static std::string | template_name () |
| static Input::Type::AbstractRecord | get_input_type (const typename Value::ElementInputType *element_input_type=nullptr) |
| static std::shared_ptr < FieldBase< spacedim, Value > > | function_factory (const Input::AbstractRecord &rec, unsigned int n_comp=0) |
Static Public Attributes | |
| static const unsigned int | spacedim_ =spacedim |
| static Input::Type::AbstractRecord | input_type |
Protected Attributes | |
| double | 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... | |
Base class for space-time function classes.
Definition at line 53 of file field_base.hh.
| typedef Space<spacedim>::Point FieldBase< spacedim, Value >::Point |
Definition at line 56 of file field_base.hh.
Definition at line 57 of file field_base.hh.
| FieldBase< spacedim, Value >::FieldBase | ( | 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 35 of file field_base_impl.hh.
|
inlinevirtual |
Virtual destructor.
Definition at line 175 of file field_base.hh.
|
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 128 of file field_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 78 of file field_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. USE ONLY IF YOU CAN NOT USE static member FieldBase<...>::input_type.
Definition at line 59 of file field_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 FieldInterpolatedP0< spacedim, Value >, FieldElementwise< spacedim, Value >, FieldConstant< spacedim, Value >, FieldPython< spacedim, Value >, and FieldFormula< spacedim, Value >.
Definition at line 105 of file field_base_impl.hh.
| unsigned int FieldBase< spacedim, Value >::n_comp | ( | ) | const |
Returns number of rows, i.e. number of components for variable size vectors. For values of fixed size returns zero.
Definition at line 127 of file field_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 136 of file field_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 FieldElementwise< spacedim, Value >.
Definition at line 121 of file field_base_impl.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 FieldElementwise< spacedim, Value >, FieldInterpolatedP0< spacedim, Value >, FieldAddPotential< spacedim, Value >, and FieldFormula< spacedim, Value >.
Definition at line 113 of file field_base_impl.hh.
|
static |
Returns template parameters as string in order to distinguish name of AbstractRecords for initialization of different instances of the FieldBase template.
Definition at line 45 of file field_base_impl.hh.
|
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 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 FieldElementwise< spacedim, Value >, FieldInterpolatedP0< spacedim, Value >, FieldPython< spacedim, Value >, FieldConstant< spacedim, Value >, FieldFE< spacedim, Value >, FieldFormula< spacedim, Value >, and FieldAddPotential< spacedim, Value >.
|
pure virtual |
Pure virtual method. At least this has to be implemented by descendants. Returns one value in one given point. ResultType can be used to avoid some costly calculation if the result is trivial. 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.
Implemented in FieldElementwise< spacedim, Value >, FieldInterpolatedP0< spacedim, Value >, FieldPython< spacedim, Value >, FieldConstant< spacedim, Value >, FieldFE< spacedim, Value >, FieldFormula< spacedim, Value >, and FieldAddPotential< spacedim, Value >.
|
protected |
Indicator of particular values (zero, one) constant over space.
Definition at line 185 of file field_base.hh.
|
static |
Declaration of input type data member.
Definition at line 76 of file field_base.hh.
|
protected |
Definition at line 183 of file field_base.hh.
|
static |
Definition at line 58 of file field_base.hh.
|
protected |
Actual time level; initial value is -infinity.
Definition at line 180 of file field_base.hh.
|
protected |
Last value, prevents passing large values (vectors) by value.
Definition at line 182 of file field_base.hh.
1.8.4