Flow123d  jenkins-Flow123d-linux-release-multijob-282
field_constant.hh
Go to the documentation of this file.
1 /*
2  * field_constant.hh
3  *
4  * Created on: Dec 15, 2012
5  * Author: jb
6  */
7 
8 
9 #ifndef FIELD_CONSTANT_HH_
10 #define FIELD_CONSTANT_HH_
11 
12 #include "system/system.hh"
14 #include "mesh/point.hh"
15 
16 
17 /**
18  * Class representing spatially constant fields.
19  *
20  */
21 template <int spacedim, class Value>
22 class FieldConstant : public FieldAlgorithmBase<spacedim, Value>
23 {
24 public:
26 
27  /**
28  * Default constructor, optionally we need number of components @p n_comp in the case of Vector valued fields.
29  */
30  FieldConstant(unsigned int n_comp=0);
31 
32 
34 
35  /**
36  * Return Record for initialization of FieldConstant that is derived from AbstractRecord given by @p a_type
37  * and the individual elements of the possible Value (vector, tensor) have Input::Type @p eit.
38  */
39  static Input::Type::Record get_input_type(Input::Type::AbstractRecord &a_type, const typename Value::ElementInputType *eit);
40 
41  /**
42  * Smart setter from the given value to return.
43  */
44  FieldConstant<spacedim, Value> &set_value(const typename Value::return_type &val);
45 
46  /**
47  * This method initialize actual value of the field given from the given Input::Record @p rec.
48  */
49  virtual void init_from_input(const Input::Record &rec);
50 
51 
52 
53  /**
54  * Returns one value in one given point. ResultType can be used to avoid some costly calculation if the result is trivial.
55  */
56  virtual typename Value::return_type const &value(const Point &p, const ElementAccessor<spacedim> &elm);
57 
58  /**
59  * Returns std::vector of scalar values in several points at once.
60  */
61  virtual void value_list (const std::vector< Point > &point_list, const ElementAccessor<spacedim> &elm,
63 
64 
65  virtual ~FieldConstant();
66 
67 private:
68 
69 };
70 
71 
72 #endif /* FIELD_CONSTANT_HH_ */
FieldConstant< spacedim, Value > & set_value(const typename Value::return_type &val)
virtual void init_from_input(const Input::Record &rec)
static Input::Type::Record get_input_type(Input::Type::AbstractRecord &a_type, const typename Value::ElementInputType *eit)
virtual void value_list(const std::vector< Point > &point_list, const ElementAccessor< spacedim > &elm, std::vector< typename Value::return_type > &value_list)
virtual Value::return_type const & value(const Point &p, const ElementAccessor< spacedim > &elm)
static Input::Type::Record input_type
Implementation.
Accessor to the data with type Type::Record.
Definition: accessors.hh:327
FieldAlgorithmBase< spacedim, Value >::Point Point
FieldConstant(unsigned int n_comp=0)
Class for declaration of polymorphic Record.
Definition: type_record.hh:487
Space< spacedim >::Point Point
Record type proxy class.
Definition: type_record.hh:169
unsigned int n_comp() const