Flow123d  release_2.2.0-26-ge868538
field_time_function.hh
Go to the documentation of this file.
1 /*!
2  *
3  * Copyright (C) 2015 Technical University of Liberec. All rights reserved.
4  *
5  * This program is free software; you can redistribute it and/or modify it under
6  * the terms of the GNU General Public License version 3 as published by the
7  * Free Software Foundation. (http://www.gnu.org/licenses/gpl-3.0.en.html)
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12  *
13  *
14  * @file field_time_function.hh
15  * @brief
16  */
17 
18 #ifndef FIELD_TIME_FUNCTION_HH_
19 #define FIELD_TIME_FUNCTION_HH_
20 
21 #include "fields/field_constant.hh"
22 
23 /**
24  * Class representing spatially fields defined by time-dependent function.
25  *
26  */
27 template <int spacedim, class Value>
28 class FieldTimeFunction : public FieldConstant<spacedim, Value>
29 {
30 public:
33 
34  /**
35  * Return Record for initialization of FieldTimeFunction that is derived from Abstract given by @p a_type
36  * and the individual elements of the possible Value (vector, tensor) in given times have Input::Type @p eit.
37  */
38  static const Input::Type::Record & get_input_type();
39 
40 
41  /**
42  * Default constructor, optionally we need number of components @p n_comp in the case of Vector valued fields.
43  */
44  FieldTimeFunction(unsigned int n_comp=0);
45 
46  /**
47  * This method initialize actual value of the field given from the given Input::Record @p rec.
48  *
49  * TODO: after removing support for vector valued FieldConstant we can merge this method
50  * with FieldConstant::init_from_input and move initizaliation of FieldConstant value
51  * to set_time method.
52  */
53  void init_from_input(const Input::Record &rec, const struct FieldAlgoBaseInitData& init_data);
54 
55  /**
56  * Set time and init value_.
57  */
58  bool set_time(const TimeStep &time) override;
59 
60 private:
61  /// Registrar of class to factory
62  static const int registrar;
63 
64  /// Accessor to Input::Record
66 
67  /**
68  * Initialization data of field. Necessary for check limits.
69  *
70  * TODO: Temporary solution will be replaced with shared_ptr to field data in FieldAlgoBase
71  */
72  std::string field_name_;
74  std::pair<double, double> limits_;
75 
76 
77 };
78 
79 #endif /* FIELD_TIME_FUNCTION_HH_ */
FieldTimeFunction(unsigned int n_comp=0)
static const int registrar
Registrar of class to factory.
static const Input::Type::Record & get_input_type()
bool set_time(const TimeStep &time) override
FieldAlgorithmBase< spacedim, Value > FactoryBaseType
Helper struct stores data for initizalize descentants of FieldAlgorithmBase.
FieldAlgorithmBase< spacedim, Value >::Point Point
void init_from_input(const Input::Record &rec, const struct FieldAlgoBaseInitData &init_data)
std::pair< double, double > limits_
Accessor to the data with type Type::Record.
Definition: accessors.hh:292
Input::Record in_rec_
Accessor to Input::Record.
Space< spacedim >::Point Point
Record type proxy class.
Definition: type_record.hh:182
Class for representation SI units of Fields.
Definition: unit_si.hh:40
Representation of one time step..
unsigned int n_comp() const