Flow123d  master-1d42d53
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...
 
- 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)
 
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 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);
Directing class of FieldValueCache.
void init(std::shared_ptr< EvalPoints > eval_points)
Init cache.
Class holds local coordinations of evaluating points (bulk and sides) specified by element dimension.
Definition: eval_points.hh:43
Class template representing a field with values dependent on: point, element, and region.
Definition: field.hh:92
void cache_reallocate(const ElementCacheMap &cache_map, unsigned int region_idx) const override
Implements FieldCommon::cache_allocate.
Definition: field.impl.hh:701
void cache_update(ElementCacheMap &cache_map, unsigned int region_patch_idx) const override
Implements FieldCommon::cache_update.
Definition: field.impl.hh:709
bool set_time(const TimeStep &time, LimitSide limit_side) override
Definition: field.impl.hh:284
void set(FieldBasePtr field, double time, std::vector< std::string > region_set_names={"ALL"})
Definition: field.impl.hh:242
void set_mesh(const Mesh &mesh) override
Definition: field.impl.hh:203

Definition at line 247 of file field_model.hh.

Member Typedef Documentation

◆ FieldsTuple

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

Definition at line 251 of file field_model.hh.

◆ Point

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

Definition at line 255 of file field_model.hh.

Constructor & Destructor Documentation

◆ FieldModel()

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

Definition at line 257 of file field_model.hh.

Member Function Documentation

◆ cache_update()

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 270 of file field_model.hh.

◆ set_dependency()

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 262 of file field_model.hh.

Member Data Documentation

◆ fn

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

Definition at line 250 of file field_model.hh.

◆ input_fields

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

Definition at line 252 of file field_model.hh.


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