Flow123d
last_with_con_2.0.0-4-g42e6930
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
flow123d
src
fields
field_formula.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_formula.hh
15
* @brief
16
*/
17
18
#ifndef FIELD_FORMULA_HH_
19
#define FIELD_FORMULA_HH_
20
21
22
#include "
system/system.hh
"
23
#include "
fields/field_algo_base.hh
"
24
#include "
mesh/point.hh
"
25
#include "
input/factory.hh
"
26
#include "
fields/field_values.hh
"
27
28
#include <string>
29
using namespace
std
;
30
31
class
FunctionParser;
32
33
/**
34
* Class representing fields given by runtime parsed formulas.
35
*
36
* Using library:
37
* http://warp.povusers.org/FunctionParser/
38
*
39
* TODO:
40
* correct support for discrete functions (use integer parser), actually we just convert double to int
41
*
42
*/
43
template
<
int
spacedim,
class
Value>
44
class
FieldFormula
:
public
FieldAlgorithmBase
<spacedim, Value>
45
{
46
public
:
47
typedef
typename
FieldAlgorithmBase<spacedim, Value>::Point
Point
;
48
typedef
FieldAlgorithmBase<spacedim, Value>
FactoryBaseType
;
49
50
FieldFormula
(
unsigned
int
n_comp=0);
51
52
53
static
const
Input::Type::Record
& get_input_type();
54
55
virtual
void
init_from_input(
const
Input::Record
&rec);
56
57
/**
58
* For time dependent formulas returns always true. For time independent formulas returns true only for the first time.
59
*/
60
bool
set_time(
const
TimeStep
&time)
override
;
61
62
/**
63
* Returns one value in one given point. ResultType can be used to avoid some costly calculation if the result is trivial.
64
*/
65
virtual
typename
Value::return_type
const
&value(
const
Point &p,
const
ElementAccessor<spacedim>
&elm);
66
67
/**
68
* Returns std::vector of scalar values in several points at once.
69
*/
70
virtual
void
value_list (
const
std::vector< Point >
&point_list,
const
ElementAccessor<spacedim>
&elm,
71
std::vector<typename Value::return_type>
&value_list);
72
73
74
virtual
~
FieldFormula
();
75
76
private
:
77
typedef
StringTensorInput<Value::NRows_,Value::NCols_>
STI
;
78
79
// StringValue::return_type == StringTensor, which behaves like arma::mat<string>
80
StringTensor
formula_matrix_
;
81
82
// Matrix of parsers corresponding to the formula matrix returned by formula_matrix_helper_
83
std::vector< std::vector<FunctionParser>
>
parser_matrix_
;
84
85
// Full address of the FiledFormula 'value' key.
86
// Necessary in the case of an error during parsing.
87
std::string
value_input_address_
;
88
89
/// Registrar of class to factory
90
static
const
int
registrar
;
91
92
93
};
94
95
96
97
#endif
/* FIELD_FORMULA_HH_ */
FieldFormula::value_input_address_
std::string value_input_address_
Definition:
field_formula.hh:87
FieldFormula
Definition:
field_formula.hh:44
field_values.hh
field_algo_base.hh
ElementAccessor
Definition:
output_element.hh:25
system.hh
std
Definition:
doxy_dummy_defs.hh:5
FieldFormula::STI
StringTensorInput< Value::NRows_, Value::NCols_ > STI
Definition:
field_formula.hh:77
FieldFormula::Point
FieldAlgorithmBase< spacedim, Value >::Point Point
Definition:
field_formula.hh:47
std::vector
Definition:
doxy_dummy_defs.hh:7
FieldFormula::formula_matrix_
StringTensor formula_matrix_
Definition:
field_formula.hh:80
StringTensorInput
Definition:
field_values.hh:515
Input::Record
Accessor to the data with type Type::Record.
Definition:
accessors.hh:277
FieldAlgorithmBase::Point
Space< spacedim >::Point Point
Definition:
field_algo_base.hh:69
FieldFormula::registrar
static const int registrar
Registrar of class to factory.
Definition:
field_formula.hh:90
FieldFormula::FactoryBaseType
FieldAlgorithmBase< spacedim, Value > FactoryBaseType
Definition:
field_formula.hh:48
point.hh
FieldFormula::parser_matrix_
std::vector< std::vector< FunctionParser > > parser_matrix_
Definition:
field_formula.hh:83
Input::Type::Record
Record type proxy class.
Definition:
type_record.hh:171
TimeStep
Representation of one time step..
Definition:
time_governor.hh:54
FieldAlgorithmBase
Definition:
field_algo_base.hh:66
StringTensor
Definition:
field_values.hh:493
factory.hh
Generated by
1.8.11