FEDEM Solver  R8.0
Source code of the dynamics solver
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Types | Private Attributes | List of all members
FFrExtractor Class Reference

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...
 
FFrResultContainergetResultContainer (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...
 
VariableSetgetVariables ()
 Returns a pointer to the variables container of this extractor. More...
 
ItemGroupSetgetItemGroups ()
 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...
 
FFrEntryBasegetTopLevelVar (const std::string &key) const
 Returns a specified top level variable or item group. More...
 
FFrObjectGroupgetObjectGroup (int id) const
 Returns a specified object group. More...
 
FFrSuperObjectGroupgetSuperGroup (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...
 
FFrEntryBasesearch (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...
 
FFrEntryBasefindVar (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...
 

Detailed Description

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.

Member Typedef Documentation

◆ ContainerMap

typedef std::map<std::string,FFrResultContainer*> FFrExtractor::ContainerMap
private

File name to result container mapping.

Constructor & Destructor Documentation

◆ FFrExtractor()

FFrExtractor::FFrExtractor ( const char *  xname = NULL)

Default constructor.

Parameters
[in]xnameOptional extractor name

◆ ~FFrExtractor()

FFrExtractor::~FFrExtractor ( )
virtual

The destructor frees the dynamically allocated members.

Member Function Documentation

◆ addFile()

bool FFrExtractor::addFile ( const std::string &  fileName,
bool  mustExist = false 
)

Adds a single file to the RDB.

◆ addFiles() [1/2]

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.

◆ addFiles() [2/2]

bool FFrExtractor::addFiles ( const std::vector< std::string > &  fileNames,
bool  showProgress = false,
bool  mustExist = false 
)
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.

◆ clearPreReadTimeStep()

void FFrExtractor::clearPreReadTimeStep ( )

Clears the pre-read time step cache.

◆ closeFiles()

void FFrExtractor::closeFiles ( )

Closes all result container files.

◆ disableTimeStepPreRead()

void FFrExtractor::disableTimeStepPreRead ( )

Disables file-based pre-read of time steps.

◆ doResultFilesUpdate()

void FFrExtractor::doResultFilesUpdate ( )
virtual

Checks if there is new data on disk.

◆ doSingleResultFileUpdate()

int FFrExtractor::doSingleResultFileUpdate ( FFrResultContainer container)
protectedvirtual

Checks if there is new data on disk for the given container.

◆ empty()

bool FFrExtractor::empty ( ) const
inline

Returns whether the extractor contains any results or not.

◆ enableTimeStepPreRead()

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.

◆ findVar()

FFrEntryBase * FFrExtractor::findVar ( const std::string &  oType,
int  baseId,
const std::string &  vName 
)

Finds a variable reference of an object group.

Parameters
[in]oTypeObject group type name
[in]baseIdBase id of the object to find the variable within
[in]vNameName of the variable to find

◆ getAllResultContainerFiles()

std::set< std::string > FFrExtractor::getAllResultContainerFiles ( ) const

Returns all result container files currently in this extractor.

◆ getCurrentRDBPhysTime()

double FFrExtractor::getCurrentRDBPhysTime ( ) const
inline

Returns RDB position information.

◆ getDictionary()

std::set<std::string>* FFrExtractor::getDictionary ( )
inline

Returns the text dictionary of this extractor.

◆ getFirstTimeStep()

double FFrExtractor::getFirstTimeStep ( ) const

Returns the physical time of the first time step in RDB.

◆ getItemGroups()

ItemGroupSet* FFrExtractor::getItemGroups ( )
inline

Returns a pointer to the item group container of this extractor.

◆ getLastTimeStep()

double FFrExtractor::getLastTimeStep ( ) const

Returns the physical time of the last time step in RDB.

◆ getLastWrittenTime()

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.

◆ getName()

const std::string& FFrExtractor::getName ( ) const
inline

Returns the name of this extractor.

◆ getObjectGroup()

FFrObjectGroup * FFrExtractor::getObjectGroup ( int  id) const

Returns a specified object group.

◆ getResultContainer()

FFrResultContainer * FFrExtractor::getResultContainer ( const std::string &  fileName) const

Returns the result container associated with fileName.

◆ getSingleTimeStepData() [1/2]

int FFrExtractor::getSingleTimeStepData ( const FFrEntryBase entryRef,
const double *  values,
int  nval 
)

Special single time step interface.

◆ getSingleTimeStepData() [2/2]

int FFrExtractor::getSingleTimeStepData ( const FFrEntryBase entryRef,
const int *  values,
int  nval 
)

Special single time step interface.

◆ getSuperGroup()

FFrSuperObjectGroup * FFrExtractor::getSuperGroup ( const std::string &  key) const

Returns a specified super object group.

◆ getTopLevelVar()

FFrEntryBase * FFrExtractor::getTopLevelVar ( const std::string &  key) const

Returns a specified top level variable or item group.

◆ getValidKeys()

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.

◆ getVariables()

VariableSet* FFrExtractor::getVariables ( )
inline

Returns a pointer to the variables container of this extractor.

◆ incrementRDB()

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.

◆ positionRDB()

bool FFrExtractor::positionRDB ( double  wantedTime,
double &  foundTime,
bool  getNextHigher = false 
)

Positions the result containers in the RDB.

Parameters
[in]wantedTimeThe wanted physical time
[out]foundTimeThe actual found physical time
[in]getNextHigherIf true, use the closest higher time step
Returns
true if one or more of the containers are positioned

◆ printContainerInfo()

void FFrExtractor::printContainerInfo ( ) const

Prints out some information for the result containers to std::cout.

◆ printHierarchy()

void FFrExtractor::printHierarchy ( ) const

Prints out the RDB hierarchy of this extractor to std::cout.

◆ releaseMemoryBlocks()

void FFrExtractor::releaseMemoryBlocks ( bool  readOps = false)
static

Releases the dynamically allocated memory blocks in global scope.

◆ removeFiles()

bool FFrExtractor::removeFiles ( const std::set< std::string > &  fileNames)
virtual

Removes the specified files from the RDB.

◆ resetRDBPositioning()

bool FFrExtractor::resetRDBPositioning ( )

Resets the RDB to point to the first of all time steps recorded.

◆ search() [1/2]

FFrEntryBase * FFrExtractor::search ( const FFaResultDescription descr)

Finds the first entry that matches a search criterion.

◆ search() [2/2]

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.

◆ updateExtractorHeader()

bool FFrExtractor::updateExtractorHeader ( FFrResultContainer container)
protected

Updates the top-level containers with items from container.

Member Data Documentation

◆ myContainers

ContainerMap FFrExtractor::myContainers
private

All result containers in this extractor.

◆ myCurrentPhysTime

double FFrExtractor::myCurrentPhysTime
private

Physical time of last time step read.

◆ myDict

std::set<std::string> FFrExtractor::myDict
private

Text dictionary used to minimize multiple string storage.

◆ myItemGroups

ItemGroupSet FFrExtractor::myItemGroups
private

All item groups in this extractor.

◆ myName

std::string FFrExtractor::myName
private

Name of this extractor.

◆ myTopLevelOGs

std::map<int,FFrObjectGroup*> FFrExtractor::myTopLevelOGs
protected

Top level object group mapping.

◆ myTopLevelSOGs

std::map<std::string,FFrSuperObjectGroup*> FFrExtractor::myTopLevelSOGs
protected

Top level super object group mapping.

◆ myTopLevelVars

std::map<std::string,FFrEntryBase*> FFrExtractor::myTopLevelVars
protected

Top level variable mapping.

◆ myVariables

VariableSet FFrExtractor::myVariables
private

All variables in this extractor.


The documentation for this class was generated from the following files: