Flow123d  release_3.0.0-1182-ga9abfa7
Public Types | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
FieldFormula< spacedim, Value > Class Template Reference

#include <field_formula.hh>

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

Public Types

typedef FieldAlgorithmBase< spacedim, Value >::Point Point
 
typedef FieldAlgorithmBase< spacedim, ValueFactoryBaseType
 
- Public Types inherited from FieldAlgorithmBase< spacedim, Value >
typedef Space< spacedim >::Point Point
 

Public Member Functions

 FieldFormula (unsigned int n_comp=0)
 
virtual void init_from_input (const Input::Record &rec, const struct FieldAlgoBaseInitData &init_data)
 
bool set_time (const TimeStep &time) override
 
void set_mesh (const Mesh *mesh, bool boundary_domain) override
 
virtual Value::return_type const & value (const Point &p, const ElementAccessor< spacedim > &elm)
 
virtual void value_list (const std::vector< Point > &point_list, const ElementAccessor< spacedim > &elm, std::vector< typename Value::return_type > &value_list)
 
virtual ~FieldFormula ()
 
- Public Member Functions inherited from FieldAlgorithmBase< spacedim, Value >
 FieldAlgorithmBase (unsigned int n_comp=0)
 
void set_component_idx (unsigned int idx)
 
unsigned int n_comp () const
 
FieldResult field_result () const
 
virtual double next_change_time ()
 
virtual void set_native_dh (std::shared_ptr< DOFHandlerMultiDim > dh)
 
bool is_constant_in_space () const
 
virtual ~FieldAlgorithmBase ()
 

Static Public Member Functions

static const Input::Type::Recordget_input_type ()
 Implementation. More...
 
- Static Public Member Functions inherited from FieldAlgorithmBase< spacedim, Value >
static std::string template_name ()
 
static Input::Type::Abstractget_input_type ()
 
static const Input::Type::Instanceget_input_type_instance (Input::Type::Selection value_selection=Input::Type::Selection())
 
static const Input::Type::Recordget_field_algo_common_keys ()
 
static std::shared_ptr< FieldAlgorithmBase< spacedim, Value > > function_factory (const Input::AbstractRecord &rec, const struct FieldAlgoBaseInitData &init_data)
 

Private Types

typedef StringTensorInput< Value::NRows_, Value::NCols_ > STI
 

Private Member Functions

arma::vec eval_depth_var (const Point &p)
 

Private Attributes

StringTensor formula_matrix_
 
std::vector< std::vector< FunctionParser > > parser_matrix_
 
Input::Record in_rec_
 Accessor to Input::Record. More...
 
std::shared_ptr< SurfaceDepthsurface_depth_
 Surface depth object calculate distance from surface. More...
 
bool has_depth_var_
 Flag indicates if depth variable 'd' is used in formula. More...
 
bool first_time_set_
 Flag indicates first call of set_time method, when FunctionParsers in parser_matrix_ must be initialized. More...
 

Static Private Attributes

static const int registrar
 Registrar of class to factory. More...
 

Additional Inherited Members

- Static Public Attributes inherited from FieldAlgorithmBase< spacedim, Value >
static const unsigned int spacedim_ =spacedim
 
static constexpr bool is_enum_valued = boost::is_same<typename Value::element_type, FieldEnum>::value
 
- Protected Member Functions inherited from FieldAlgorithmBase< spacedim, Value >
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 inherited from FieldAlgorithmBase< spacedim, Value >
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...
 

Detailed Description

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

Class representing fields given by runtime parsed formulas.

Using library: http://warp.povusers.org/FunctionParser/

TODO: correct support for discrete functions (use integer parser), actually we just convert double to int

Definition at line 54 of file field_formula.hh.

Member Typedef Documentation

template<int spacedim, class Value >
typedef FieldAlgorithmBase<spacedim, Value> FieldFormula< spacedim, Value >::FactoryBaseType

Definition at line 58 of file field_formula.hh.

template<int spacedim, class Value >
typedef FieldAlgorithmBase<spacedim, Value>::Point FieldFormula< spacedim, Value >::Point

Definition at line 57 of file field_formula.hh.

template<int spacedim, class Value >
typedef StringTensorInput<Value::NRows_,Value::NCols_> FieldFormula< spacedim, Value >::STI
private

Definition at line 94 of file field_formula.hh.

Constructor & Destructor Documentation

template<int spacedim, class Value >
FieldFormula< spacedim, Value >::FieldFormula ( unsigned int  n_comp = 0)

Definition at line 70 of file field_formula.cc.

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

Definition at line 255 of file field_formula.cc.

Member Function Documentation

template<int spacedim, class Value >
arma::vec FieldFormula< spacedim, Value >::eval_depth_var ( const Point p)
inlineprivate

Evaluate depth variable if it is contained in formula.

Return arma vec of point coordinates extended by depth value (or zero if depth is not contained.

Definition at line 234 of file field_formula.cc.

Here is the caller graph for this function:

template<int spacedim, class Value >
const Input::Type::Record & FieldFormula< spacedim, Value >::get_input_type ( )
static

Implementation.

Definition at line 34 of file field_formula.cc.

template<int spacedim, class Value >
void FieldFormula< spacedim, Value >::init_from_input ( const Input::Record rec,
const struct FieldAlgoBaseInitData init_data 
)
virtual

Function can provide way to initialize itself from the input data.

TODO: make protected, should be called through function factory

Reimplemented from FieldAlgorithmBase< spacedim, Value >.

Definition at line 85 of file field_formula.cc.

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

Create SurfaceDepth object if surface region is set.

See also description of the FieldBase<...>::set_mesh.

Reimplemented from FieldAlgorithmBase< spacedim, Value >.

Definition at line 186 of file field_formula.cc.

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

For time dependent formulas returns always true. For time independent formulas returns true only for the first time.

Reimplemented from FieldAlgorithmBase< spacedim, Value >.

Definition at line 95 of file field_formula.cc.

template<int spacedim, class Value >
Value::return_type const & FieldFormula< spacedim, Value >::value ( const Point p,
const ElementAccessor< spacedim > &  elm 
)
virtual

Returns one value in one given point. ResultType can be used to avoid some costly calculation if the result is trivial.

Implements FieldAlgorithmBase< spacedim, Value >.

Definition at line 199 of file field_formula.cc.

template<int spacedim, class Value >
void FieldFormula< spacedim, Value >::value_list ( const std::vector< Point > &  point_list,
const ElementAccessor< spacedim > &  elm,
std::vector< typename Value::return_type > &  value_list 
)
virtual

Returns std::vector of scalar values in several points at once.

Implements FieldAlgorithmBase< spacedim, Value >.

Definition at line 215 of file field_formula.cc.

Member Data Documentation

template<int spacedim, class Value >
bool FieldFormula< spacedim, Value >::first_time_set_
private

Flag indicates first call of set_time method, when FunctionParsers in parser_matrix_ must be initialized.

Definition at line 119 of file field_formula.hh.

template<int spacedim, class Value >
StringTensor FieldFormula< spacedim, Value >::formula_matrix_
private

Definition at line 104 of file field_formula.hh.

template<int spacedim, class Value >
bool FieldFormula< spacedim, Value >::has_depth_var_
private

Flag indicates if depth variable 'd' is used in formula.

Definition at line 116 of file field_formula.hh.

template<int spacedim, class Value >
Input::Record FieldFormula< spacedim, Value >::in_rec_
private

Accessor to Input::Record.

Definition at line 110 of file field_formula.hh.

template<int spacedim, class Value >
std::vector< std::vector<FunctionParser> > FieldFormula< spacedim, Value >::parser_matrix_
private

Definition at line 107 of file field_formula.hh.

template<int spacedim, class Value >
const int FieldFormula< spacedim, Value >::registrar
staticprivate
Initial value:
=
Input::register_class< FieldFormula<spacedim, Value>, unsigned int >("FieldFormula") +

Registrar of class to factory.

Definition at line 122 of file field_formula.hh.

template<int spacedim, class Value >
std::shared_ptr<SurfaceDepth> FieldFormula< spacedim, Value >::surface_depth_
private

Surface depth object calculate distance from surface.

Definition at line 113 of file field_formula.hh.


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