NumeRe v1.1.4
NumeRe: Framework für Numerische Rechnungen
|
#include <string>
#include <vector>
#include "../settings.hpp"
#include "../datamanagement/memorymanager.hpp"
#include "../ParserLib/muParser.h"
#include "define.hpp"
#include "../datamanagement/dataaccess.hpp"
Go to the source code of this file.
Functions | |
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, if needed. More... | |
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 first occurence or string::npos, if nothing was found. More... | |
void | convertVectorToExpression (std::string &, const Settings &) |
This function replaces vector expressions with their corresponding multi- expression equation. More... | |
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 elements compared to the others used in the current expression) by applying a simple heuristic to the expression. It will either insert "1", "0" or an empty string in string expressions. More... | |
mu::value_type * | getPointerToVariable (const std::string &sVarName, mu::Parser &_parser) |
This function returns the pointer to the passed variable. More... | |
std::string | promptForUserInput (const std::string &__sCommand) |
This function is invoked, if a prompt operator ("??") was found in a string. More... | |
int | integralFactorial (int nNumber) |
This function returns the factorial of the passed integral value. More... | |
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, if they are defined as open ended. More... | |
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. More... | |
unsigned int | getPositionOfFirstDelimiter (const std::string &) |
This function returns the position of the first delimiter in the passed string, but it jumps over parentheses and braces. More... | |
std::string addMissingVectorComponent | ( | const string & | sVectorComponent, |
const string & | sLeft, | ||
const string & | sRight, | ||
bool | bAddStrings | ||
) |
This function determines the value of missing vector components (i.e. a vector contains not enough elements compared to the others used in the current expression) by applying a simple heuristic to the expression. It will either insert "1", "0" or an empty string in string expressions.
sVectorComponent | const string& |
sLeft | const string& |
sRight | const string& |
bAddStrings | bool |
Definition at line 300 of file parser_functions.cpp.
Referenced by convertVectorToExpression(), and evalMatOp().
void convertVectorToExpression | ( | string & | sLine, |
const Settings & | _option | ||
) |
This function replaces vector expressions with their corresponding multi- expression equation.
sLine | string& |
_option | const Settings& |
It is used quite extensively, however, it might not be necessary everywhere, because the parser can cope with the vector syntax now.
Definition at line 82 of file parser_functions.cpp.
References addMissingVectorComponent(), containsStrings(), convertVectorToExpression(), getMatchingParenthesis(), getNextArgument(), SyntaxError::INCOMPLETE_VECTOR_SYNTAX, SyntaxError::invalid_position, isMultiValue(), isToStringArg(), and parser_CheckMultArgFunc().
Referenced by NumeRe::StringFuncHandler::argumentParser(), convertVectorToExpression(), Plot::create2dDrawing(), Plot::create3dDrawing(), evalPoints(), evaluateFittingParams(), Plot::fillData(), CommandLineParser::getExprAsMathExpression(), NumeRe::StringParser::numToString(), and NumeRe::StringParser::storeStringResults().
bool evaluateIndices | ( | const string & | sCache, |
Indices & | _idx, | ||
MemoryManager & | _data | ||
) |
This function will evaluate the passed indices, so that they match the dimensions of the passed cache, if they are defined as open ended.
sCache | const string& |
_idx | Indices& |
_data | Datafile& |
Definition at line 625 of file parser_functions.cpp.
References Indices::col, MemoryManager::getCols(), MemoryManager::getLines(), VectorIndex::isOpenEnd(), isValidIndexSet(), Indices::row, and VectorIndex::setRange().
Referenced by evalMatOp(), and evaluateFittingParams().
std::string evaluateTargetOptionInCommand | ( | string & | sCmd, |
const string & | sDefaultTarget, | ||
Indices & | _idx, | ||
Parser & | _parser, | ||
MemoryManager & | _data, | ||
const Settings & | _option | ||
) |
This function evaluates the "target=TABLE()" expression and creates the target table, if needed.
sCmd | string& |
sDefaultTarget | const string& |
_idx | Indices& |
_parser | Parser& |
_data | Datafile& |
_option | const Settings& |
If this option is not found, the function will create a default target cache.
Definition at line 566 of file parser_functions.cpp.
References MemoryManager::addTable(), VectorIndex::back(), Indices::col, findParameter(), VectorIndex::front(), getArgAtPos(), MemoryManager::getCols(), getIndices(), SyntaxError::INVALID_INDEX, SyntaxError::invalid_position, MemoryManager::isTable(), isValidIndexSet(), VectorIndex::OPEN_END, Indices::row, and VectorIndex::to_string().
Referenced by CommandLineParser::getTargetTable(), plugin_histogram(), plugin_random(), and plugin_statistics().
size_t findVariableInExpression | ( | const std::string & | sExpr, |
const std::string & | sVarName, | ||
size_t | nPosStart | ||
) |
This function searches for the selected variable in the passed string and returns the position of the first occurence or string::npos, if nothing was found.
sExpr | const std::string& |
sVarName | const std::string& |
nPosStart | size_t |
Definition at line 42 of file parser_functions.cpp.
mu::value_type * getPointerToVariable | ( | const string & | sVarName, |
Parser & | _parser | ||
) |
This function returns the pointer to the passed variable.
sVarName | const string& |
_parser | Parser& |
Definition at line 511 of file parser_functions.cpp.
References mu::ParserBase::GetVar().
Referenced by differentiate(), evalPoints(), findExtrema(), findZeroes(), FlowCtrl::prepareLocalVarsAndReplace(), NumeRe::StringParser::storeStringResults(), and taylor().
unsigned int getPositionOfFirstDelimiter | ( | const string & | sLine | ) |
This function returns the position of the first delimiter in the passed string, but it jumps over parentheses and braces.
sLine | const string& |
Definition at line 396 of file parser_functions.cpp.
References getMatchingParenthesis().
Referenced by NumeRe::StringParser::numToString().
int integralFactorial | ( | int | nNumber | ) |
This function returns the factorial of the passed integral value.
nNumber | int |
Definition at line 535 of file parser_functions.cpp.
Referenced by taylor().
std::string promptForUserInput | ( | const string & | __sCommand | ) |
This function is invoked, if a prompt operator ("??") was found in a string.
__sCommand | const string& |
It will ask the user to provide the needed value during the execution.
Definition at line 429 of file parser_functions.cpp.
References NumeReKernel::getline(), NumeReKernel::printPreFmt(), and StripSpaces().
Referenced by FlowCtrl::calc(), cmd_print(), FlowCtrl::compile(), Plot::createSubPlotSet(), CommandLineParser::getExprAsDataObject(), CommandLineParser::getExprAsMathExpression(), NumeReKernel::MainLoop(), CommandLineParser::parseExprAsString(), and Procedure::ProcCalc().
std::vector< double > readAndParseIntervals | ( | string & | sExpr, |
Parser & | _parser, | ||
MemoryManager & | _data, | ||
FunctionDefinitionManager & | _functions, | ||
const Settings & | _option, | ||
bool | bEraseInterval | ||
) |
This function will read the interval syntax in commands and return their values in a single vector.
sExpr | string& |
_parser | Parser& |
_data | Datafile& |
_functions | Define& |
_option | const Settings& |
bEraseInterval | bool |
Definition at line 706 of file parser_functions.cpp.
References FunctionDefinitionManager::call(), MemoryManager::containsTablesOrClusters(), mu::ParserBase::Eval(), findParameter(), SyntaxError::FUNCTION_ERROR, getAllArguments(), getAllIndices(), getDataElements(), getMatchingParenthesis(), SyntaxError::invalid_position, isInQuotes(), isNotEmptyExpression(), readAndParseLegacyIntervals(), and mu::ParserBase::SetExpr().
Referenced by evaluateFittingParams(), evaluateParameterValues(), and Odesolver::solve().