Flow123d  3.9.0-97067769b
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 <string.h> // for memcpy
22 #include <new> // for operator new[]
23 #include <ostream> // for operator<<
24 #include <string> // for operator<<, string
25 #include <utility> // for pair
26 #include <armadillo>
27 #include "fields/field_algo_base.hh" // for FieldAlgorithmBase
28 #include "fields/field_constant.hh" // for FieldConstant
29 #include "fields/field_values.hh" // for FieldValue<>::TensorFixed
30 #include "input/accessors.hh" // for ExcAccessorForNullStorage
31 #include "input/accessors_impl.hh" // for Record::val
32 #include "input/storage.hh" // for ExcStorageTypeMismatch
33 #include "input/type_record.hh" // for Record::ExcRecordKeyNotFound
34 #include "tools/time_governor.hh" // for TimeStep
35 class UnitSI;
36 
37 /**
38  * Class representing spatially fields defined by time-dependent function.
39  *
40  */
41 template <int spacedim, class Value>
42 class FieldTimeFunction : public FieldConstant<spacedim, Value>
43 {
44 public:
47 
48  /**
49  * Return Record for initialization of FieldTimeFunction that is derived from Abstract given by @p a_type
50  * and the individual elements of the possible Value (vector, tensor) in given times have Input::Type @p eit.
51  */
52  static const Input::Type::Record & get_input_type();
53 
54 
55  /**
56  * Default constructor, optionally we need number of components @p n_comp in the case of Vector valued fields.
57  */
58  FieldTimeFunction(unsigned int n_comp=0);
59 
60  /**
61  * This method initialize actual value of the field given from the given Input::Record @p rec.
62  *
63  * TODO: after removing support for vector valued FieldConstant we can merge this method
64  * with FieldConstant::init_from_input and move initizaliation of FieldConstant value
65  * to set_time method.
66  */
67  void init_from_input(const Input::Record &rec, const struct FieldAlgoBaseInitData& init_data) override;
68 
69  /**
70  * Set time and init value_.
71  */
72  bool set_time(const TimeStep &time) override;
73 
74 private:
75  /// Registrar of class to factory
76  static const int registrar;
77 
78  /// Accessor to Input::Record
80 
81  /**
82  * Initialization data of field. Necessary for check limits.
83  *
84  * TODO: Temporary solution will be replaced with shared_ptr to field data in FieldAlgoBase
85  */
86  std::string field_name_;
88  std::pair<double, double> limits_;
89 
90 
91 };
92 
93 #endif /* FIELD_TIME_FUNCTION_HH_ */
FieldTimeFunction::FieldTimeFunction
FieldTimeFunction(unsigned int n_comp=0)
Definition: field_time_function.cc:50
FieldTimeFunction::get_input_type
static const Input::Type::Record & get_input_type()
Definition: field_time_function.cc:28
FieldAlgorithmBase::n_comp
unsigned int n_comp() const
Definition: field_algo_base.impl.hh:133
field_constant.hh
time_governor.hh
Basic time management class.
field_algo_base.hh
FieldTimeFunction::set_time
bool set_time(const TimeStep &time) override
Definition: field_time_function.cc:67
string.h
FieldTimeFunction::init_from_input
void init_from_input(const Input::Record &rec, const struct FieldAlgoBaseInitData &init_data) override
Definition: field_time_function.cc:56
FieldConstant
Definition: field_constant.hh:43
FieldTimeFunction::FactoryBaseType
FieldAlgorithmBase< spacedim, Value > FactoryBaseType
Definition: field_time_function.hh:46
FieldAlgorithmBase::Point
Space< spacedim >::Point Point
Definition: field_algo_base.hh:115
storage.hh
type_record.hh
FieldTimeFunction::in_rec_
Input::Record in_rec_
Accessor to Input::Record.
Definition: field_time_function.hh:79
Input::Record
Accessor to the data with type Type::Record.
Definition: accessors.hh:291
FieldTimeFunction::Point
FieldAlgorithmBase< spacedim, Value >::Point Point
Definition: field_time_function.hh:45
FieldTimeFunction::limits_
std::pair< double, double > limits_
Definition: field_time_function.hh:88
FieldAlgoBaseInitData
Helper struct stores data for initizalize descentants of FieldAlgorithmBase.
Definition: field_algo_base.hh:81
accessors.hh
TimeStep
Representation of one time step..
Definition: time_governor.hh:123
field_values.hh
UnitSI
Class for representation SI units of Fields.
Definition: unit_si.hh:40
Input::Type::Record
Record type proxy class.
Definition: type_record.hh:182
FieldTimeFunction::unit_si_
UnitSI & unit_si_
Definition: field_time_function.hh:87
FieldAlgorithmBase
Definition: field_algo_base.hh:112
accessors_impl.hh
FieldTimeFunction::field_name_
std::string field_name_
Definition: field_time_function.hh:86
FieldTimeFunction::registrar
static const int registrar
Registrar of class to factory.
Definition: field_time_function.hh:76
FieldTimeFunction
Definition: field_time_function.hh:42