Flow123d
jenkins-Flow123d-windows32-release-multijob-51
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
* field_formula.hh
3
*
4
* Created on: Jan 2, 2013
5
* Author: jb
6
*/
7
8
#ifndef FIELD_FORMULA_HH_
9
#define FIELD_FORMULA_HH_
10
11
12
#include "
system/system.hh
"
13
#include "
fields/field_algo_base.hh
"
14
#include "
mesh/point.hh
"
15
16
#include <string>
17
using namespace
std;
18
19
class
FunctionParser;
20
21
/**
22
* Class representing fields given by runtime parsed formulas.
23
*
24
* Using library:
25
* http://warp.povusers.org/FunctionParser/
26
*
27
* TODO:
28
* correct support for discrete functions (use integer parser), actually we just convert double to int
29
*
30
*/
31
template
<
int
spacedim,
class
Value>
32
class
FieldFormula
:
public
FieldAlgorithmBase
<spacedim, Value>
33
{
34
public
:
35
typedef
typename
FieldAlgorithmBase<spacedim, Value>::Point
Point
;
36
37
FieldFormula
(
unsigned
int
n_comp=0);
38
39
40
static
Input::Type::Record
input_type
;
41
42
static
Input::Type::Record
get_input_type(
Input::Type::AbstractRecord
&a_type,
const
typename
Value::ElementInputType *eit);
43
44
virtual
void
init_from_input(
const
Input::Record
&rec);
45
46
/**
47
* For time dependent formulas returns always true. For time independent formulas returns true only for the first time.
48
*/
49
virtual
bool
set_time(
double
time);
50
51
/**
52
* Returns one value in one given point. ResultType can be used to avoid some costly calculation if the result is trivial.
53
*/
54
virtual
typename
Value::return_type
const
&value(
const
Point
&p,
const
ElementAccessor<spacedim>
&elm);
55
56
/**
57
* Returns std::vector of scalar values in several points at once.
58
*/
59
virtual
void
value_list (
const
std::vector< Point >
&point_list,
const
ElementAccessor<spacedim>
&elm,
60
std::vector<typename Value::return_type>
&value_list);
61
62
63
virtual
~
FieldFormula
();
64
65
private
:
66
// FieldValue_ wrapper for matrix of strings
67
typedef
FieldValue_<Value::NRows_, Value::NCols_, std::string>
StringValue
;
68
69
// StringValue::return_type == StringTensor, which behaves like arma::mat<string>
70
typename
StringValue::return_type
formula_matrix_
;
71
72
// FieldValue_ wrapper for unified reading of the input
73
StringValue
formula_matrix_helper_
;
74
75
// Matrix of parsers corresponding to the formula matrix returned by formula_matrix_helper_
76
std::vector< std::vector<FunctionParser>
>
parser_matrix_
;
77
78
// Full address of the FiledFormula 'value' key.
79
// Necessary in the case of an error during parsing.
80
std::string
value_input_address_
;
81
82
};
83
84
85
86
#endif
/* FIELD_FORMULA_HH_ */
FieldFormula::value_input_address_
std::string value_input_address_
Definition:
field_formula.hh:80
FieldFormula
Definition:
field_formula.hh:32
field_algo_base.hh
ElementAccessor
Definition:
accessors.hh:36
system.hh
???
FieldValue_::return_type
internal::ReturnType< NRows, NCols, ET >::return_type return_type
Definition:
field_values.hh:191
FieldFormula::Point
FieldAlgorithmBase< spacedim, Value >::Point Point
Definition:
field_formula.hh:35
std::vector
Definition:
doxy_dummy_defs.hh:7
FieldFormula::formula_matrix_
StringValue::return_type formula_matrix_
Definition:
field_formula.hh:70
FieldFormula::StringValue
FieldValue_< Value::NRows_, Value::NCols_, std::string > StringValue
Definition:
field_formula.hh:67
FieldFormula::input_type
static Input::Type::Record input_type
Implementation.
Definition:
field_formula.hh:40
Input::Record
Accessor to the data with type Type::Record.
Definition:
accessors.hh:308
Input::Type::AbstractRecord
Class for declaration of polymorphic Record.
Definition:
type_record.hh:463
FieldAlgorithmBase::Point
Space< spacedim >::Point Point
Definition:
field_algo_base.hh:56
FieldFormula::formula_matrix_helper_
StringValue formula_matrix_helper_
Definition:
field_formula.hh:73
point.hh
FieldFormula::parser_matrix_
std::vector< std::vector< FunctionParser > > parser_matrix_
Definition:
field_formula.hh:76
Input::Type::Record
Record type proxy class.
Definition:
type_record.hh:161
FieldAlgorithmBase
Definition:
field_algo_base.hh:53
FieldValue_< Value::NRows_, Value::NCols_, std::string >
Generated on Mon Oct 20 2014 14:40:44 for Flow123d by
1.8.7