Flow123d
3.9.0-454df51df
|
#include <field_python.hh>
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 | |
TYPEDEF_ERR_INFO (EI_FuncName, std::string) | |
TYPEDEF_ERR_INFO (EI_PModule, std::string) | |
TYPEDEF_ERR_INFO (EI_Size, unsigned int) | |
TYPEDEF_ERR_INFO (EI_ValueSize, unsigned int) | |
DECLARE_EXCEPTION (ExcNoPythonSupport,<< "Flow123d compiled without support for Python, FieldPython can not be used.\n") | |
DECLARE_EXCEPTION (ExcNoPythonInit,<< "Either 'script_string' or 'script_file' has to be specified in PythonField initialization.\n") | |
DECLARE_EXCEPTION (ExcInvalidCompNumber,<< "Field "<< EI_FuncName::qval<< " from the python module: "<< EI_PModule::val<< " returns "<< EI_Size::val<< " components but should return "<< EI_ValueSize::val<< " components.\n") | |
FieldPython (unsigned int n_comp=0) | |
virtual void | init_from_input (const Input::Record &rec, const struct FieldAlgoBaseInitData &init_data) |
void | set_python_field_from_file (const FilePath &file_name, const string &func_name) |
void | set_python_field_from_string (const string &python_source, const string &func_name) |
virtual const Value::return_type & | value (const Point &p, const ElementAccessor< spacedim > &elm) |
virtual void | value_list (const Armor::array &point_list, const ElementAccessor< spacedim > &elm, std::vector< typename Value::return_type > &value_list) |
virtual | ~FieldPython () |
Public Member Functions inherited from FieldAlgorithmBase< spacedim, Value > | |
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 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 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 const Input::Type::Record & | get_input_type () |
Implementation. More... | |
Static Public Member Functions inherited from FieldAlgorithmBase< spacedim, Value > | |
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) |
Private Member Functions | |
void | set_func (const string &func_name) |
void | set_value (const Point &p, const ElementAccessor< spacedim > &elm, Value &value) |
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 = std::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... | |
This class assumes field python field with spacedim
arguments containing coordinates of the given point. The field should return a tuple representing a vector value (possibly of size one for scalar fields)
TODO:
Definition at line 46 of file field_python.hh.
typedef FieldAlgorithmBase<spacedim, Value> FieldPython< spacedim, Value >::FactoryBaseType |
Definition at line 50 of file field_python.hh.
typedef FieldAlgorithmBase<spacedim, Value>::Point FieldPython< spacedim, Value >::Point |
Definition at line 49 of file field_python.hh.
FieldPython< spacedim, Value >::FieldPython | ( | unsigned int | n_comp = 0 | ) |
Definition at line 60 of file field_python.impl.hh.
|
virtual |
Definition at line 210 of file field_python.impl.hh.
FieldPython< spacedim, Value >::DECLARE_EXCEPTION | ( | ExcInvalidCompNumber | , |
<< "Field "<< EI_FuncName::qval<< " from the python module: "<< EI_PModule::val<< " returns "<< EI_Size::val<< " components but should return "<< EI_ValueSize::val<< " components.\n" | |||
) |
FieldPython< spacedim, Value >::DECLARE_EXCEPTION | ( | ExcNoPythonInit | , |
<< "Either 'script_string' or 'script_file' has to be specified in PythonField initialization.\n" | |||
) |
FieldPython< spacedim, Value >::DECLARE_EXCEPTION | ( | ExcNoPythonSupport | , |
<< "Flow123d compiled without support for | Python, | ||
FieldPython< spacedim, Value > can not be used.\n" | |||
) |
|
static |
Implementation.
Definition at line 34 of file field_python.impl.hh.
|
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 91 of file field_python.impl.hh.
|
private |
Common part of set_python_field_from_* methods
Definition at line 121 of file field_python.impl.hh.
void FieldPython< spacedim, Value >::set_python_field_from_file | ( | const FilePath & | file_name, |
const string & | func_name | ||
) |
Set the file and field to be called. TODO: use FilePath
Definition at line 109 of file field_python.impl.hh.
void FieldPython< spacedim, Value >::set_python_field_from_string | ( | const string & | python_source, |
const string & | func_name | ||
) |
Set the source in a string and name of the field to be called.
Definition at line 78 of file field_python.impl.hh.
|
inlineprivate |
Implementation.
Returns one vector value in one given point.
Definition at line 187 of file field_python.impl.hh.
FieldPython< spacedim, Value >::TYPEDEF_ERR_INFO | ( | EI_FuncName | , |
std::string | |||
) |
FieldPython< spacedim, Value >::TYPEDEF_ERR_INFO | ( | EI_PModule | , |
std::string | |||
) |
FieldPython< spacedim, Value >::TYPEDEF_ERR_INFO | ( | EI_Size | , |
unsigned int | |||
) |
FieldPython< spacedim, Value >::TYPEDEF_ERR_INFO | ( | EI_ValueSize | , |
unsigned int | |||
) |
|
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 157 of file field_python.impl.hh.
|
virtual |
Returns std::vector of scalar values in several points at once.
Implements FieldAlgorithmBase< spacedim, Value >.
Definition at line 169 of file field_python.impl.hh.
|
staticprivate |
Registrar of class to factory.
Definition at line 94 of file field_python.hh.