FEDEM Solver
R8.0
Source code of the dynamics solver
|
Front-end for the result extraction module. More...
#include <FFrExtractor.H>
Public Member Functions | |
FFrExtractor (const char *xname=NULL) | |
Default constructor. More... | |
virtual | ~FFrExtractor () |
The destructor frees the dynamically allocated members. More... | |
const std::string & | getName () const |
Returns the name of this extractor. More... | |
bool | addFiles (const std::set< std::string > &fileNames, bool showProgress=false) |
Adds a set of files to the RDB. More... | |
virtual bool | addFiles (const std::vector< std::string > &fileNames, bool showProgress=false, bool mustExist=false) |
Adds a list of files to the RDB. More... | |
bool | addFile (const std::string &fileName, bool mustExist=false) |
Adds a single file to the RDB. More... | |
void | closeFiles () |
Closes all result container files. More... | |
std::set< std::string > | getAllResultContainerFiles () const |
Returns all result container files currently in this extractor. More... | |
FFrResultContainer * | getResultContainer (const std::string &fileName) const |
Returns the result container associated with fileName. More... | |
virtual bool | removeFiles (const std::set< std::string > &fileNames) |
Removes the specified files from the RDB. More... | |
virtual void | doResultFilesUpdate () |
Checks if there is new data on disk. More... | |
VariableSet * | getVariables () |
Returns a pointer to the variables container of this extractor. More... | |
ItemGroupSet * | getItemGroups () |
Returns a pointer to the item group container of this extractor. More... | |
bool | empty () const |
Returns whether the extractor contains any results or not. More... | |
FFrEntryBase * | getTopLevelVar (const std::string &key) const |
Returns a specified top level variable or item group. More... | |
FFrObjectGroup * | getObjectGroup (int id) const |
Returns a specified object group. More... | |
FFrSuperObjectGroup * | getSuperGroup (const std::string &key) const |
Returns a specified super object group. More... | |
void | printContainerInfo () const |
Prints out some information for the result containers to std::cout. More... | |
void | printHierarchy () const |
Prints out the RDB hierarchy of this extractor to std::cout. More... | |
FFrEntryBase * | search (const FFaResultDescription &descr) |
Finds the first entry that matches a search criterion. More... | |
void | search (std::vector< FFrEntryBase * > &entries, const FFaResultDescription &descr) |
Wild-card version finding all entries matching a search criterion. More... | |
FFrEntryBase * | findVar (const std::string &oType, int baseId, const std::string &vName) |
Finds a variable reference of an object group. More... | |
bool | resetRDBPositioning () |
Resets the RDB to point to the first of all time steps recorded. More... | |
bool | positionRDB (double wantedTime, double &foundTime, bool getNextHigher=false) |
Positions the result containers in the RDB. More... | |
bool | incrementRDB () |
Increments the RDB to the closest time step defined. More... | |
void | getValidKeys (std::set< double > &resKeys, const std::set< std::string > &files) const |
Get a set of keys for which valid data exist in the provided files. More... | |
void | enableTimeStepPreRead (const std::set< std::string > &files) |
Enables file-based pre-read of time steps. More... | |
void | disableTimeStepPreRead () |
Disables file-based pre-read of time steps. More... | |
void | clearPreReadTimeStep () |
Clears the pre-read time step cache. More... | |
double | getLastTimeStep () const |
Returns the physical time of the last time step in RDB. More... | |
double | getFirstTimeStep () const |
Returns the physical time of the first time step in RDB. More... | |
double | getLastWrittenTime () const |
Returns the physical time of the last changed time step in RDB. More... | |
double | getCurrentRDBPhysTime () const |
Returns RDB position information. More... | |
int | getSingleTimeStepData (const FFrEntryBase *entryRef, const double *values, int nval) |
Special single time step interface. More... | |
int | getSingleTimeStepData (const FFrEntryBase *entryRef, const int *values, int nval) |
Special single time step interface. More... | |
std::set< std::string > * | getDictionary () |
Returns the text dictionary of this extractor. More... | |
Static Public Member Functions | |
static void | releaseMemoryBlocks (bool readOps=false) |
Releases the dynamically allocated memory blocks in global scope. More... | |
Protected Member Functions | |
virtual int | doSingleResultFileUpdate (FFrResultContainer *container) |
Checks if there is new data on disk for the given container. More... | |
bool | updateExtractorHeader (FFrResultContainer *container) |
Updates the top-level containers with items from container. More... | |
Protected Attributes | |
std::map< std::string, FFrSuperObjectGroup * > | myTopLevelSOGs |
Top level super object group mapping. More... | |
std::map< int, FFrObjectGroup * > | myTopLevelOGs |
Top level object group mapping. More... | |
std::map< std::string, FFrEntryBase * > | myTopLevelVars |
Top level variable mapping. More... | |
Private Types | |
typedef std::map< std::string, FFrResultContainer * > | ContainerMap |
File name to result container mapping. More... | |
Private Attributes | |
std::string | myName |
Name of this extractor. More... | |
double | myCurrentPhysTime |
Physical time of last time step read. More... | |
std::set< std::string > | myDict |
Text dictionary used to minimize multiple string storage. More... | |
ContainerMap | myContainers |
All result containers in this extractor. More... | |
VariableSet | myVariables |
All variables in this extractor. More... | |
ItemGroupSet | myItemGroups |
All item groups in this extractor. More... | |
Front-end for the result extraction module.
This class defines the front-end for accessing result data bases in a Fedem model. All data access is performed through the methods of this class. There is typically only one instance of this class for a given Fedem model, but it may contain an arbitrary number of result file containers, represented by the FFrResultContainer class. Note that a given result quantity may exist in more than one result container. When requested for, the value in the most recent result container is then returned.
|
private |
File name to result container mapping.
FFrExtractor::FFrExtractor | ( | const char * | xname = NULL | ) |
Default constructor.
[in] | xname | Optional extractor name |
|
virtual |
The destructor frees the dynamically allocated members.
bool FFrExtractor::addFile | ( | const std::string & | fileName, |
bool | mustExist = false |
||
) |
Adds a single file to the RDB.
bool FFrExtractor::addFiles | ( | const std::set< std::string > & | fileNames, |
bool | showProgress = false |
||
) |
Adds a set of files to the RDB.
Overloaded method that does the same as the below, but takes a set of files instead of a vector.
|
virtual |
Adds a list of files to the RDB.
Adds several files to the result database. Returns false if one or more of the files caused an error.
void FFrExtractor::clearPreReadTimeStep | ( | ) |
Clears the pre-read time step cache.
void FFrExtractor::closeFiles | ( | ) |
Closes all result container files.
void FFrExtractor::disableTimeStepPreRead | ( | ) |
Disables file-based pre-read of time steps.
|
virtual |
Checks if there is new data on disk.
|
protectedvirtual |
Checks if there is new data on disk for the given container.
|
inline |
Returns whether the extractor contains any results or not.
void FFrExtractor::enableTimeStepPreRead | ( | const std::set< std::string > & | files | ) |
Enables file-based pre-read of time steps.
Enables single read of the current time step in the selected files.
FFrEntryBase * FFrExtractor::findVar | ( | const std::string & | oType, |
int | baseId, | ||
const std::string & | vName | ||
) |
Finds a variable reference of an object group.
[in] | oType | Object group type name |
[in] | baseId | Base id of the object to find the variable within |
[in] | vName | Name of the variable to find |
std::set< std::string > FFrExtractor::getAllResultContainerFiles | ( | ) | const |
Returns all result container files currently in this extractor.
|
inline |
Returns RDB position information.
|
inline |
Returns the text dictionary of this extractor.
double FFrExtractor::getFirstTimeStep | ( | ) | const |
Returns the physical time of the first time step in RDB.
|
inline |
Returns a pointer to the item group container of this extractor.
double FFrExtractor::getLastTimeStep | ( | ) | const |
Returns the physical time of the last time step in RDB.
double FFrExtractor::getLastWrittenTime | ( | ) | const |
Returns the physical time of the last changed time step in RDB.
The largest end time among the result containers with new or existing data is returned. If no data exist, -HUGE_VAL is returned.
|
inline |
Returns the name of this extractor.
FFrObjectGroup * FFrExtractor::getObjectGroup | ( | int | id | ) | const |
Returns a specified object group.
FFrResultContainer * FFrExtractor::getResultContainer | ( | const std::string & | fileName | ) | const |
Returns the result container associated with fileName.
int FFrExtractor::getSingleTimeStepData | ( | const FFrEntryBase * | entryRef, |
const double * | values, | ||
int | nval | ||
) |
Special single time step interface.
int FFrExtractor::getSingleTimeStepData | ( | const FFrEntryBase * | entryRef, |
const int * | values, | ||
int | nval | ||
) |
Special single time step interface.
FFrSuperObjectGroup * FFrExtractor::getSuperGroup | ( | const std::string & | key | ) | const |
Returns a specified super object group.
FFrEntryBase * FFrExtractor::getTopLevelVar | ( | const std::string & | key | ) | const |
Returns a specified top level variable or item group.
void FFrExtractor::getValidKeys | ( | std::set< double > & | validValues, |
const std::set< std::string > & | files | ||
) | const |
Get a set of keys for which valid data exist in the provided files.
Get the times with valid data from the extractor, looking only on the extractor files matching the file names provided.
|
inline |
Returns a pointer to the variables container of this extractor.
bool FFrExtractor::incrementRDB | ( | ) |
Increments the RDB to the closest time step defined.
Used when mapping against key.
The default key (and currently hard-coded) is physical time. If we are at the end of all time series, return false.
bool FFrExtractor::positionRDB | ( | double | wantedTime, |
double & | foundTime, | ||
bool | getNextHigher = false |
||
) |
Positions the result containers in the RDB.
[in] | wantedTime | The wanted physical time |
[out] | foundTime | The actual found physical time |
[in] | getNextHigher | If true, use the closest higher time step |
void FFrExtractor::printContainerInfo | ( | ) | const |
Prints out some information for the result containers to std::cout.
void FFrExtractor::printHierarchy | ( | ) | const |
Prints out the RDB hierarchy of this extractor to std::cout.
|
static |
Releases the dynamically allocated memory blocks in global scope.
|
virtual |
Removes the specified files from the RDB.
bool FFrExtractor::resetRDBPositioning | ( | ) |
Resets the RDB to point to the first of all time steps recorded.
FFrEntryBase * FFrExtractor::search | ( | const FFaResultDescription & | descr | ) |
Finds the first entry that matches a search criterion.
void FFrExtractor::search | ( | std::vector< FFrEntryBase * > & | entries, |
const FFaResultDescription & | descr | ||
) |
Wild-card version finding all entries matching a search criterion.
New search method used to set up the result menu in animation properties based on the actual results present in the RDB. This version returns a vector of all entries that match the given description, in which a single '*' (wild-card) means all entries on that level.
|
protected |
Updates the top-level containers with items from container.
|
private |
All result containers in this extractor.
|
private |
Physical time of last time step read.
|
private |
Text dictionary used to minimize multiple string storage.
|
private |
All item groups in this extractor.
|
private |
Name of this extractor.
|
protected |
Top level object group mapping.
|
protected |
Top level super object group mapping.
|
protected |
Top level variable mapping.
|
private |
All variables in this extractor.