NumeRe v1.1.4
NumeRe: Framework für Numerische Rechnungen
parser_functions.hpp
Go to the documentation of this file.
1/*****************************************************************************
2 NumeRe: Framework fuer Numerische Rechnungen
3 Copyright (C) 2014 Erik Haenel et al.
4
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17******************************************************************************/
18
19#ifndef PARSER_FUNCTIONS_HPP
20#define PARSER_FUNCTIONS_HPP
21
22#include <string>
23#include <vector>
24
25#include "../settings.hpp"
26#include "../datamanagement/memorymanager.hpp"
27#include "../ParserLib/muParser.h"
28#include "define.hpp"
29#include "../datamanagement/dataaccess.hpp"
30
31// Tools & Stuff
32std::string evaluateTargetOptionInCommand(std::string& sCmd, const std::string& sDefaultTarget, Indices& _idx, mu::Parser& _parser, MemoryManager& _data, const Settings& _option);
33size_t findVariableInExpression(const std::string& sExpr, const std::string& sVarName, size_t nPosStart = 0);
34void convertVectorToExpression(std::string&, const Settings&);
35std::string addMissingVectorComponent(const std::string&, const std::string&, const std::string&, bool);
36mu::value_type* getPointerToVariable(const std::string& sVarName, mu::Parser& _parser);
37std::string promptForUserInput(const std::string& __sCommand);
38int integralFactorial(int nNumber);
39bool evaluateIndices(const std::string& sCache, Indices& _idx, MemoryManager& _data);
40std::vector<double> readAndParseIntervals(std::string& sExpr, mu::Parser& _parser, MemoryManager& _data, FunctionDefinitionManager& _functions, const Settings& _option, bool bEraseInterval = false);
41unsigned int getPositionOfFirstDelimiter(const std::string&);
42
43#endif
44
45
This class implements the function definition managing instance.
Definition: define.hpp:74
This class represents the central memory managing instance. It will handle all tables and clusters,...
This class manages the setting values of the internal (kernel) settings of this application.
Definition: settings.hpp:663
Mathematical expressions parser.
Definition: muParser.h:51
MUP_BASETYPE value_type
The numeric datatype used by the parser.
Definition: muParserDef.h:251
bool evaluateIndices(const std::string &sCache, Indices &_idx, MemoryManager &_data)
This function will evaluate the passed indices, so that they match the dimensions of the passed cache...
unsigned int getPositionOfFirstDelimiter(const std::string &)
This function returns the position of the first delimiter in the passed string, but it jumps over par...
std::string evaluateTargetOptionInCommand(std::string &sCmd, const std::string &sDefaultTarget, Indices &_idx, mu::Parser &_parser, MemoryManager &_data, const Settings &_option)
This function evaluates the "target=TABLE()" expression and creates the target table,...
int integralFactorial(int nNumber)
This function returns the factorial of the passed integral value.
std::string addMissingVectorComponent(const std::string &, const std::string &, const std::string &, bool)
This function determines the value of missing vector components (i.e. a vector contains not enough el...
void convertVectorToExpression(std::string &, const Settings &)
This function replaces vector expressions with their corresponding multi- expression equation.
std::vector< double > readAndParseIntervals(std::string &sExpr, mu::Parser &_parser, MemoryManager &_data, FunctionDefinitionManager &_functions, const Settings &_option, bool bEraseInterval=false)
This function will read the interval syntax in commands and return their values in a single vector.
size_t findVariableInExpression(const std::string &sExpr, const std::string &sVarName, size_t nPosStart=0)
This function searches for the selected variable in the passed string and returns the position of the...
std::string promptForUserInput(const std::string &__sCommand)
This function is invoked, if a prompt operator ("??") was found in a string.
mu::value_type * getPointerToVariable(const std::string &sVarName, mu::Parser &_parser)
This function returns the pointer to the passed variable.
This structure is central for managing the indices of a table or cluster read or write data access....