OOFEM
2.4
OOFEM.org - Object Oriented Finite Element Solver
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
parser.h
Go to the documentation of this file.
1
/*
2
*
3
* ##### ##### ###### ###### ### ###
4
* ## ## ## ## ## ## ## ### ##
5
* ## ## ## ## #### #### ## # ##
6
* ## ## ## ## ## ## ## ##
7
* ## ## ## ## ## ## ## ##
8
* ##### ##### ## ###### ## ##
9
*
10
*
11
* OOFEM : Object Oriented Finite Element Code
12
*
13
* Copyright (C) 1993 - 2013 Borek Patzak
14
*
15
*
16
*
17
* Czech Technical University, Faculty of Civil Engineering,
18
* Department of Structural Mechanics, 166 29 Prague, Czech Republic
19
*
20
* This library is free software; you can redistribute it and/or
21
* modify it under the terms of the GNU Lesser General Public
22
* License as published by the Free Software Foundation; either
23
* version 2.1 of the License, or (at your option) any later version.
24
*
25
* This program is distributed in the hope that it will be useful,
26
* but WITHOUT ANY WARRANTY; without even the implied warranty of
27
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
28
* Lesser General Public License for more details.
29
*
30
* You should have received a copy of the GNU Lesser General Public
31
* License along with this library; if not, write to the Free Software
32
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
33
*/
34
35
#ifndef parser_h
36
#define parser_h
37
38
#include "oofemcfg.h"
39
40
namespace
oofem
{
41
#define Parser_CMD_LENGTH 1024
42
#define Parser_TBLSZ 23
43
54
class
OOFEM_EXPORT
Parser
55
{
56
public
:
57
Parser
() {
58
curr_tok = PRINT;
59
no_of_errors = 0;
60
for
(
int
i = 0; i <
Parser_TBLSZ
; i++ ) {
61
table [ i ] = 0;
62
}
63
}
64
~Parser
() {
65
reset();
66
}
67
68
double
eval(
const
char
*
string
,
int
&err);
69
void
reset();
70
71
private
:
72
enum
Token_value
{
73
NAME,
NUMBER
, END,
74
SQRT_FUNC, SIN_FUNC, COS_FUNC,
TAN_FUNC
, ATAN_FUNC, ASIN_FUNC, ACOS_FUNC, EXP_FUNC, HEAVISIDE_FUNC,
75
PLUS=
'+'
, MINUS=
'-'
, MUL=
'*'
, DIV=
'/'
, POW=
'^'
, BOOL_EQ, BOOL_LE, BOOL_LT, BOOL_GE, BOOL_GT,
76
PRINT=
';'
, ASSIGN=
'='
, LP=
'('
, RP=
')'
77
};
78
79
int
no_of_errors
;
80
Token_value
curr_tok
;
81
struct
name
{
82
char
*
string
;
83
name
*
next
;
84
double
value
;
85
};
86
name
*table [
Parser_TBLSZ
];
87
double
number_value
;
88
char
string_value [
Parser_CMD_LENGTH
];
89
const
char
*
parsedLine
;
90
91
name
*look(
const
char
*p,
int
ins = 0);
92
inline
name
*
insert
(
const
char
*s) {
return
look(s, 1); }
93
void
error(
const
char
*s);
94
double
expr(
bool
get
);
95
double
term(
bool
get
);
96
double
prim(
bool
get
);
97
double
agr(
bool
get
);
98
Token_value
get_token();
99
};
100
}
// end namespace oofem
101
#endif // parser_h
oofem::Parser::curr_tok
Token_value curr_tok
Definition:
parser.h:80
oofem::Parser::parsedLine
const char * parsedLine
Definition:
parser.h:89
oofem::Parser::no_of_errors
int no_of_errors
Definition:
parser.h:79
oofem::Parser::name::value
double value
Definition:
parser.h:84
Parser_CMD_LENGTH
#define Parser_CMD_LENGTH
Definition:
parser.h:41
oofem::Parser::number_value
double number_value
Definition:
parser.h:87
oofem::Parser::TAN_FUNC
Definition:
parser.h:74
oofem::Parser::Parser
Parser()
Definition:
parser.h:57
oofem::Parser::NUMBER
Definition:
parser.h:73
oofem::Parser::name::next
name * next
Definition:
parser.h:83
Parser_TBLSZ
#define Parser_TBLSZ
Definition:
parser.h:42
oofem::Parser::name
Definition:
parser.h:81
oofem
the oofem namespace is to define a context or scope in which all oofem names are defined.
oofem::Parser::name::string
char * string
Definition:
parser.h:82
oofem::Parser::insert
name * insert(const char *s)
Definition:
parser.h:92
oofem::Parser::Token_value
Token_value
Definition:
parser.h:72
oofem::Parser::~Parser
~Parser()
Definition:
parser.h:64
oofem::Parser
Class for evaluating mathematical expressions in strings.
Definition:
parser.h:54
This page is part of the
OOFEM
documentation. Copyright (c) 2011
Borek Patzak
Project e-mail:
info@oofem.org
Generated at Tue Jan 2 2018 20:07:30 for OOFEM by
doxygen
1.8.11 written by
Dimitri van Heesch
, © 1997-2011