Flow123d  release_2.1.0-87-gfbc1563
Public Types | Public Member Functions | Static Public Member Functions | Private Types | 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, Value > FactoryBaseType
 
- 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
 
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)
 
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 ~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 Attributes

StringTensor formula_matrix_
 
std::vector< std::vector< FunctionParser > > parser_matrix_
 
std::string value_input_address_
 

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...
 

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 44 of file field_formula.hh.

Member Typedef Documentation

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

Definition at line 48 of file field_formula.hh.

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

Definition at line 47 of file field_formula.hh.

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

Definition at line 77 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 64 of file field_formula.cc.

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

Definition at line 192 of file field_formula.cc.

Member Function Documentation

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

Implementation.

Definition at line 33 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 77 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 87 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 159 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 173 of file field_formula.cc.

Member Data Documentation

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

Definition at line 80 of file field_formula.hh.

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

Definition at line 83 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 90 of file field_formula.hh.

template<int spacedim, class Value >
std::string FieldFormula< spacedim, Value >::value_input_address_
private

Definition at line 87 of file field_formula.hh.


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