NumeRe v1.1.4
NumeRe: Framework für Numerische Rechnungen
|
#include <string>
#include "../ParserLib/muParser.h"
#include "memorymanager.hpp"
#include "table.hpp"
#include "../settings.hpp"
#include "../structures.hpp"
Go to the source code of this file.
Classes | |
class | DataAccessParser |
This class is defined to abstrahize the determination of the correct data object and the calculation of the corresponding indices. More... | |
Enumerations | |
enum | DataOptions { NO_OPTION = 0x0 , REPLACE_NAN = 0x1 , INSERT_STRINGS = 0x2 } |
Functions | |
size_t | findAssignmentOperator (StringView sCmd) |
bool | parser_CheckMultArgFunc (const std::string &, const std::string &) |
This function checks, whether the argument located between sLeft and sRight is part of a multi-argument function. More... | |
std::string | getDataElements (std::string &sLine, mu::Parser &_parser, MemoryManager &_data, const Settings &_option, int options=REPLACE_NAN) |
Searches the passed string for calls to any table or cluster and replaces them with internal vectors or their respective values. More... | |
void | replaceDataEntities (std::string &, const std::string &, MemoryManager &, mu::Parser &, const Settings &, int options=NO_OPTION) |
This function replaces all calls to a single data entity with an internal vector or its value, respectively. More... | |
Memory * | extractRange (const std::string &sCmd, DataAccessParser &_accessParser, int nDesiredCols=-1, bool bSort=false) |
This function extracts a portion of a table and returns it to the calling function. The returned pointer may as well be a nullptr, if the selectd table does not exist. More... | |
bool | isNotEmptyExpression (const std::string &) |
This function checks, whether the passed expression is non-empty (i.e. it contains more than white spaces). More... | |
bool | isClusterCandidate (std::string &sLine, std::string &sCluster, bool doCut=true) |
This function checks, whether the passed command line contains the syntax for a cluster candidate, splits up the command line (if selected using doCut) and declares the new cluster, if it is not known up to now. More... | |
mu::value_type | getDataFromObject (const std::string &sObject, long long int i, long long int j, bool isCluster) |
This function returns the data from the selected object and switches automatically between tables and clusters. More... | |
std::vector< mu::value_type > | getDataFromObject (const std::string &sObject, const VectorIndex &vRows, long long int j, bool isCluster) |
This function returns the data from the selected object and switches automatically between tables and clusters. More... | |
DataAccessParser | getAccessParserForPlotAndFit (StringView sExpression) |
This function will return the access parser instance for the current expression validate, whether the expression is actual resolveable. More... | |
Indices | getIndicesForPlotAndFit (const std::string &sExpression, std::string &sDataTable, int &nColumns, bool &openEnd, bool &isCluster) |
This function will calculate the indices from the passed data expression and return them optimized for the plotting and the fitting algorithm. More... | |
Indices | getIndices (StringView sCmd, mu::Parser &_parser, MemoryManager &_data, const Settings &_option) |
Wrapper for the new getIndices function interface. More... | |
void | getIndices (StringView sCmd, Indices &_idx, mu::Parser &_parser, MemoryManager &_data, const Settings &_option) |
The new interface function to determine the used indices in the current expression part. More... | |
bool | isValidIndexSet (const Indices &_idx) |
std::vector< size_t > | getDataGridDimensions (const Indices &_idx, const std::string &sTableName) |
Returns the accessed data grid dimensions. More... | |
enum DataOptions |
Enumerator | |
---|---|
NO_OPTION | |
REPLACE_NAN | |
INSERT_STRINGS |
Definition at line 57 of file dataaccess.hpp.
Memory * extractRange | ( | const std::string & | sCmd, |
DataAccessParser & | _accessParser, | ||
int | nDesiredCols, | ||
bool | bSort | ||
) |
This function extracts a portion of a table and returns it to the calling function. The returned pointer may as well be a nullptr, if the selectd table does not exist.
sCmd | const std::string& |
_accessParser | DataAccessParser& |
nDesiredCols | int |
bSort | bool |
Definition at line 2161 of file dataaccess.cpp.
References Indices::col, DataAccessParser::evalIndices(), Memory::extractRange(), VectorIndex::front(), Memory::getCols(), DataAccessParser::getDataObject(), DataAccessParser::getIndices(), NumeReKernel::getInstance(), Memory::getLines(), NumeReKernel::getMemoryManager(), MemoryManager::getTable(), VectorIndex::isOpenEnd(), isValidIndexSet(), VectorIndex::last(), VectorIndex::numberOfNodes(), Indices::row, VectorIndex::setRange(), Memory::sortElements(), and SyntaxError::TABLE_DOESNT_EXIST.
Referenced by analyzePulse(), boneDetection(), calculateSplines(), fastFourierTransform(), fastWaveletTransform(), and regularizeDataSet().
size_t findAssignmentOperator | ( | StringView | sCmd | ) |
Definition at line 242 of file dataaccess.cpp.
References StringViewBase::find().
Referenced by getDataElements(), and isClusterCandidate().
DataAccessParser getAccessParserForPlotAndFit | ( | StringView | sExpression | ) |
This function will return the access parser instance for the current expression validate, whether the expression is actual resolveable.
sExpression | StringView |
Definition at line 2205 of file dataaccess.cpp.
References Indices::col, DataAccessParser::getDataObject(), DataAccessParser::getIndices(), SyntaxError::INVALID_INDEX, SyntaxError::invalid_position, isValidIndexSet(), Indices::row, SyntaxError::TABLE_DOESNT_EXIST, VectorIndex::to_string(), and StringViewBase::to_string().
Referenced by Plot::extractDataValues(), and getIndicesForPlotAndFit().
std::string getDataElements | ( | string & | sLine, |
Parser & | _parser, | ||
MemoryManager & | _data, | ||
const Settings & | _option, | ||
int | options | ||
) |
Searches the passed string for calls to any table or cluster and replaces them with internal vectors or their respective values.
sLine | string& |
_parser | Parser& |
_data | Datafile& |
_option | const Settings& |
options | int |
This function actually delegates the hard work to replaceDataEntities(), which is itself public and replaces all calls to a single data entity.
Definition at line 276 of file dataaccess.cpp.
References MemoryManager::containsTablesOrClusters(), MemoryManager::copyTable(), mu::ParserBase::CreateTempVectorVar(), findAssignmentOperator(), mu::ParserBase::GetCachedEquation(), MemoryManager::getCols(), MemoryManager::getLines(), handleCachedDataAccess(), mu::ParserBase::HasCachedAccess(), SyntaxError::invalid_position, isClusterCandidate(), mu::ParserBase::IsCompiling(), MemoryManager::isTable(), resolveTablesAndClusters(), StripSpaces(), SyntaxError::UNMATCHED_PARENTHESIS, and validateParenthesisNumber().
Referenced by NumeRe::StringFuncHandler::applySpecialStringFuncs(), NumeRe::StringFuncHandler::argumentParser(), FlowCtrl::calc(), FlowCtrl::compile(), Plot::constructDataLegendElement(), Plot::createDataLegends(), createEveryDefinition(), ProcedureVarFactory::createLocalClusters(), ProcedureVarFactory::createLocalInlineVars(), ProcedureVarFactory::createLocalStrings(), ProcedureVarFactory::createLocalTables(), ProcedureVarFactory::createLocalVars(), createMatFromLines(), createMatFromLinesFilled(), differentiate(), FlowCtrl::evalHeader(), evalPoints(), FlowCtrl::evalRangeBasedHeader(), evaluateExpression(), evaluateFittingParams(), evaluateNumerical(), evaluateParameterValues(), ProcedureVarFactory::evaluateProcedureArguments(), Plot::evaluateSubplot(), extractFirstParameterStringValue(), findExtrema(), findZeroes(), CommandLineParser::getExprAsFileName(), CommandLineParser::getExprAsMathExpression(), CommandLineParser::getFileParameterValue(), getIndices(), getWindow(), handleCachedDataAccess(), NumeReKernel::MainLoop(), parseArg(), CommandLineParser::parseExprAsNumericalValues(), Procedure::ProcCalc(), readAndParseIntervals(), Interval::refresh(), NumeRe::StringParser::replaceDataOccurence(), replaceEntityOccurence(), Odesolver::solve(), tableMethod_aliasof(), tableMethod_annotate(), tableMethod_anova(), tableMethod_binsof(), tableMethod_categories(), tableMethod_categorize(), tableMethod_convert(), tableMethod_counteq(), tableMethod_cov(), tableMethod_findCols(), tableMethod_index(), tableMethod_pcorr(), tableMethod_rank(), tableMethod_scorr(), tableMethod_typeof(), and tableMethod_zscore().
std::vector< mu::value_type > getDataFromObject | ( | const std::string & | sObject, |
const VectorIndex & | vRows, | ||
long long int | j, | ||
bool | isCluster | ||
) |
This function returns the data from the selected object and switches automatically between tables and clusters.
sObject | const std::string& |
vRows | const VectorIndex& |
j | long longint |
isCluster | bool |
Definition at line 2405 of file dataaccess.cpp.
References VectorIndex::front(), NumeRe::ClusterManager::getCluster(), NumeRe::Cluster::getDouble(), MemoryManager::getElement(), NumeReKernel::getInstance(), NumeReKernel::getMemoryManager(), VectorIndex::INVALID, NumeRe::Cluster::push_back(), and VectorIndex::size().
mu::value_type getDataFromObject | ( | const std::string & | sObject, |
long long int | i, | ||
long long int | j, | ||
bool | isCluster | ||
) |
This function returns the data from the selected object and switches automatically between tables and clusters.
sObject | const std::string& |
i | long longint |
j | long longint |
isCluster | bool |
Definition at line 2378 of file dataaccess.cpp.
References NumeRe::ClusterManager::getCluster(), NumeRe::Cluster::getDouble(), MemoryManager::getElement(), NumeReKernel::getInstance(), and NumeReKernel::getMemoryManager().
Referenced by Plot::extractDataValues(), and getDataForFit().
std::vector< size_t > getDataGridDimensions | ( | const Indices & | _idx, |
const std::string & | sTableName | ||
) |
Returns the accessed data grid dimensions.
_idx | const Indices& |
sTableName | const std::string& |
Definition at line 2519 of file dataaccess.cpp.
References MemoryManager::cnt(), Indices::col, NumeReKernel::getInstance(), NumeReKernel::getMemoryManager(), MemoryManager::isTable(), Indices::row, and VectorIndex::subidx().
Referenced by DataAccessParser::getDataGridDimensions().
void getIndices | ( | StringView | sCmd, |
Indices & | _idx, | ||
Parser & | _parser, | ||
MemoryManager & | _data, | ||
const Settings & | _option | ||
) |
The new interface function to determine the used indices in the current expression part.
sCmd | StringView |
_idx | Indices& |
_parser | Parser& |
_data | MemoryManager& |
_option | const Settings& |
Definition at line 70 of file indices.cpp.
References StringViewBase::begin(), Indices::col, MemoryManager::containsTablesOrClusters(), DetachedLogger::debug(), StringViewBase::end(), NumeRe::StringParser::evalAndFormat(), StringViewBase::find_first_of(), g_logger, getAllArguments(), getDataElements(), NumeReKernel::getInstance(), getMatchingParenthesis(), NumeReKernel::getStringParser(), handleArgumentForIndices(), StringViewBase::length(), VectorIndex::OPEN_END, Indices::row, Indices::sCompiledAccessEquation, StringViewBase::strip(), StringView::subview(), StringViewBase::trim_front(), NumeRe::ClusterManager::updateClusterSizeVariables(), and MemoryManager::updateDimensionVariables().
Indices getIndices | ( | StringView | sCmd, |
Parser & | _parser, | ||
MemoryManager & | _data, | ||
const Settings & | _option | ||
) |
Wrapper for the new getIndices function interface.
sCmd | StringView |
_parser | Parser& |
_data | MemoryManager& |
_option | const Settings& |
Definition at line 49 of file indices.cpp.
References getIndices().
Referenced by FlowCtrl::calc(), FlowCtrl::compile(), evaluateFittingParams(), evaluateTargetOptionInCommand(), NumeRe::StringParser::getDataForString(), getIndices(), handleCachedDataAccess(), NumeReKernel::MainLoop(), Procedure::ProcCalc(), replaceDataEntities(), searchAndDeleteCluster(), searchAndDeleteTable(), Odesolver::solve(), and NumeRe::StringParser::storeStringToStringObject().
Indices getIndicesForPlotAndFit | ( | const string & | sExpression, |
string & | sDataTable, | ||
int & | nColumns, | ||
bool & | openEnd, | ||
bool & | isCluster | ||
) |
This function will calculate the indices from the passed data expression and return them optimized for the plotting and the fitting algorithm.
sExpression | const string& |
sDataTable | string& |
nColumns | int& |
openEnd | bool& |
isCluster | bool& |
Definition at line 2234 of file dataaccess.cpp.
References Indices::col, getAccessParserForPlotAndFit(), DataAccessParser::getDataObject(), DataAccessParser::getIndices(), DataAccessParser::isCluster(), VectorIndex::isOpenEnd(), and VectorIndex::numberOfNodes().
Referenced by getDataForFit().
bool isClusterCandidate | ( | string & | sLine, |
string & | sCluster, | ||
bool | doCut | ||
) |
This function checks, whether the passed command line contains the syntax for a cluster candidate, splits up the command line (if selected using doCut) and declares the new cluster, if it is not known up to now.
sLine | string& |
sCluster | string& |
doCut | bool |
Definition at line 2296 of file dataaccess.cpp.
References findAssignmentOperator(), NumeReKernel::getInstance(), getMatchingParenthesis(), NumeReKernel::getMemoryManager(), NumeRe::ClusterManager::isCluster(), NumeRe::ClusterManager::newCluster(), and StripSpaces().
Referenced by FlowCtrl::calc(), FlowCtrl::compile(), getDataElements(), NumeReKernel::MainLoop(), and Procedure::ProcCalc().
bool isNotEmptyExpression | ( | const string & | sExpr | ) |
This function checks, whether the passed expression is non-empty (i.e. it contains more than white spaces).
sExpr | const string& |
Definition at line 2275 of file dataaccess.cpp.
|
inline |
Definition at line 81 of file dataaccess.hpp.
References Indices::col, VectorIndex::isValid(), and Indices::row.
Referenced by NumeRe::StringFuncHandler::applySpecialStringFuncs(), FlowCtrl::calc(), cmd_resample(), cmd_retouch(), cmd_show(), cmd_smooth(), FlowCtrl::compile(), copyDataToTemporaryTable(), createDatagrid(), differentiate(), evaluateFittingParams(), evaluateIndices(), evaluateTargetOptionInCommand(), evaluateTransposeForDataOperation(), extractRange(), getAccessParserForPlotAndFit(), getSamplesForDatagrid(), handleCachedDataAccess(), NumeReKernel::MainLoop(), performMatrixOperation(), plugin_histogram(), Procedure::ProcCalc(), replaceDataEntities(), searchAndDeleteCluster(), searchAndDeleteTable(), Odesolver::solve(), and sortData().
bool parser_CheckMultArgFunc | ( | const string & | sLeft, |
const string & | sRight | ||
) |
This function checks, whether the argument located between sLeft and sRight is part of a multi-argument function.
sLeft | const string& |
sRight | const string& |
Definition at line 2443 of file dataaccess.cpp.
References getLastToken().
Referenced by convertVectorToExpression(), NumeRe::StringParser::getDataForString(), and NumeRe::StringParser::replaceDataOccurence().
void replaceDataEntities | ( | string & | sLine, |
const string & | sEntity, | ||
MemoryManager & | _data, | ||
Parser & | _parser, | ||
const Settings & | _option, | ||
int | options | ||
) |
This function replaces all calls to a single data entity with an internal vector or its value, respectively.
sLine | string& |
sEntity | const string& |
_data | Datafile& |
_parser | Parser& |
_option | const Settings& |
options | int |
Because this function calls the index parser, it will automatically resolve all nested calls to any data entity included in the current call to the specified data entity.
Definition at line 436 of file dataaccess.cpp.
References mu::ParserBase::CacheCurrentAccess(), Indices::col, NumeRe::StringVarFactory::createTempStringVectorVar(), mu::ParserBase::DisableAccessCaching(), VectorIndex::front(), NumeRe::ClusterManager::getCluster(), MemoryManager::getColElements(), MemoryManager::getCols(), NumeRe::FileAdapter::getDataFileName(), NumeRe::Cluster::getDouble(), MemoryManager::getElement(), MemoryManager::getElementAsString(), MemoryManager::getElementMixed(), MemoryManager::getHeadLineElement(), getIndices(), NumeReKernel::getInstance(), getMafAccessString(), getMatchingParenthesis(), NumeRe::Cluster::getParserString(), NumeReKernel::getStringParser(), MemoryManager::getType(), NumeRe::Cluster::getType(), handleMafDataAccess(), INSERT_STRINGS, SyntaxError::INVALID_INDEX, SyntaxError::invalid_position, mu::CachedDataAccess::IS_CLUSTER, isDelimiter(), NumeRe::Cluster::isDouble(), isInQuotes(), VectorIndex::isOpenEnd(), VectorIndex::isString(), isValidIndexSet(), NumeRe::ClusterItem::ITEMTYPE_DOUBLE, mu::CachedDataAccess::NO_FLAG, SyntaxError::NO_MATRIX, NumeRe::Cluster::push_back(), replaceEntityOccurence(), replaceEntityStringOccurence(), replaceToVectorname(), Indices::row, Indices::sCompiledAccessEquation, VectorIndex::setRange(), mu::ParserBase::SetVectorVar(), NumeRe::Cluster::size(), VectorIndex::size(), TableColumn::STRINGLIKE, VectorIndex::subidx(), VectorIndex::to_string(), and toCmdString().
Referenced by NumeRe::StringParser::replaceDataOccurence(), and resolveTablesAndClusters().