Flow123d  JS_before_hm-1621-g63a12c7
Public Types | Public Member Functions | Private Types | Private Attributes | List of all members
FieldModel< spacedim, Value, Fn, InputFields > Class Template Reference

#include <field_model.hh>

Inheritance diagram for FieldModel< spacedim, Value, Fn, InputFields >:
Inheritance graph
[legend]
Collaboration diagram for FieldModel< spacedim, Value, Fn, InputFields >:
Collaboration graph
[legend]

Public Types

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

Public Member Functions

 FieldModel (Fn func, InputFields...args)
 
std::vector< const FieldCommon * > set_dependency (FMT_UNUSED FieldSet &field_set)
 Implements FieldAlgoBase::set_dependency. More...
 
void cache_update (FieldValueCache< typename Value::element_type > &data_cache, ElementCacheMap &cache_map, unsigned int region_patch_idx) override
 Implements FieldAlgoBase::cache_update. More...
 
Value::return_type const & value (FMT_UNUSED const Point &p, FMT_UNUSED const ElementAccessor< spacedim > &elm) override
 Implementation of virtual method. More...
 
void value_list (FMT_UNUSED const Armor::array &point_list, FMT_UNUSED const ElementAccessor< spacedim > &elm, FMT_UNUSED std::vector< typename Value::return_type > &value_list) override
 Implementation of virtual method. More...
 
- 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 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 Value::return_type const & 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 set_native_dh (std::shared_ptr< DOFHandlerMultiDim >)
 
bool is_constant_in_space () const
 
virtual ~FieldAlgorithmBase ()
 

Private Types

typedef std::tuple< InputFields... > FieldsTuple
 

Private Attributes

Fn fn
 
FieldsTuple input_fields
 

Additional Inherited Members

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

Detailed Description

template<int spacedim, class Value, typename Fn, class... InputFields>
class FieldModel< spacedim, Value, Fn, InputFields >

Class representing field computing form results of other fields.

Example of usage:

// Functor class with defined operator ()
class FnProduct {
public:
Vector operator() (Scalar a, Vector v) {
return a(0) * v;
}
};
...
// Create ElementCacheMap
std::shared_ptr<EvalPoints> eval_points = std::make_shared<EvalPoints>();
eval_poinzs->add_bulk<3>( quad ); // initialize EvalPoints
ElementCacheMap elm_cache_map;
elm_cache_map.init(eval_points);
// Definition of fields
... // fill data to fields f_scal, f_vec
// create instance FieldModel class, use helper method Model::create to simply passsing of parameters
auto f_product = Model<3, FieldValue<3>::VectorFixed>::create(FnProduct(), f_scal, f_vec);
// set field on all regions
result.set_mesh( *mesh );
result.set(f_product, time);
result.cache_reallocate(elm_cache_map);
result.set_time(tg.step(), LimitSide::right);
// cache_update
result.cache_update(elm_cache_map);

Definition at line 248 of file field_model.hh.

Member Typedef Documentation

template<int spacedim, class Value , typename Fn , class... InputFields>
typedef std::tuple<InputFields...> FieldModel< spacedim, Value, Fn, InputFields >::FieldsTuple
private

Definition at line 252 of file field_model.hh.

template<int spacedim, class Value , typename Fn , class... InputFields>
typedef FieldAlgorithmBase<spacedim, Value>::Point FieldModel< spacedim, Value, Fn, InputFields >::Point

Definition at line 256 of file field_model.hh.

Constructor & Destructor Documentation

template<int spacedim, class Value , typename Fn , class... InputFields>
FieldModel< spacedim, Value, Fn, InputFields >::FieldModel ( Fn  func,
InputFields...  args 
)
inline

Definition at line 258 of file field_model.hh.

Member Function Documentation

template<int spacedim, class Value , typename Fn , class... InputFields>
void FieldModel< spacedim, Value, Fn, InputFields >::cache_update ( FieldValueCache< typename Value::element_type > &  data_cache,
ElementCacheMap cache_map,
unsigned int  region_patch_idx 
)
inlineoverridevirtual

Implements FieldAlgoBase::cache_update.

Reimplemented from FieldAlgorithmBase< spacedim, Value >.

Definition at line 271 of file field_model.hh.

template<int spacedim, class Value , typename Fn , class... InputFields>
std::vector<const FieldCommon *> FieldModel< spacedim, Value, Fn, InputFields >::set_dependency ( FMT_UNUSED FieldSet field_set)
inlinevirtual

Implements FieldAlgoBase::set_dependency.

Reimplemented from FieldAlgorithmBase< spacedim, Value >.

Definition at line 263 of file field_model.hh.

template<int spacedim, class Value , typename Fn , class... InputFields>
Value::return_type const& FieldModel< spacedim, Value, Fn, InputFields >::value ( FMT_UNUSED const Point p,
FMT_UNUSED const ElementAccessor< spacedim > &  elm 
)
inlineoverride

Implementation of virtual method.

Definition at line 286 of file field_model.hh.

template<int spacedim, class Value , typename Fn , class... InputFields>
void FieldModel< spacedim, Value, Fn, InputFields >::value_list ( FMT_UNUSED const Armor::array point_list,
FMT_UNUSED const ElementAccessor< spacedim > &  elm,
FMT_UNUSED std::vector< typename Value::return_type > &  value_list 
)
inlineoverride

Implementation of virtual method.

Definition at line 292 of file field_model.hh.

Member Data Documentation

template<int spacedim, class Value , typename Fn , class... InputFields>
Fn FieldModel< spacedim, Value, Fn, InputFields >::fn
private

Definition at line 251 of file field_model.hh.

template<int spacedim, class Value , typename Fn , class... InputFields>
FieldsTuple FieldModel< spacedim, Value, Fn, InputFields >::input_fields
private

Definition at line 253 of file field_model.hh.


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