cee::ug::DataSourceInterface Class Referenceabstract

A parent class for interface data sources. More...

Public Member Functions

 DataSourceInterface (int dataSourceId)
 Constructs an empty data source with the given id. More...
 
virtual bool open (const Str &filename, Error *error=NULL)=0
 Opens a file using the derived interface. More...
 
virtual void close ()=0
 Closes the currently open file in the derived interface. More...
 
virtual bool loadState (int stateId, const DataStateSpec &stateSpec, Error *error)
 Loads the state at the given stateId. Only loads the state if not already present in the DataSource. More...
 
virtual void discardState (int stateId)
 Deletes the state with the given id from the data source. More...
 
virtual bool loadCustomResultBaseDependencies (int stateId, const DataStateSpec &stateSpec)
 Loads custom result bare dependencies. Returns true if success. More...
 
bool createResultCalculator (const Str &calculatorId, const Str &resultIdString, const Str &initString, Str *errorMessage)
 Creates a new result with the given 'resultIdString' by using the result calculator 'calculatorId' configured with the given 'initString'. More...
 
bool recreateResultCalculator (const Str &calculatorId, const Str &resultIdString, const Str &initString, Str *errorMessage)
 Recreates a result calculator with a modified initString. More...
 
bool deleteResultCalculator (const Str &calculatorId, const Str &resultIdString)
 Deletes the result calculator with the given calculatorId and resultIdString. More...
 
bool setResultCalculatorParams (const Str &calculatorId, const Str &resultIdString, const ResultCalculatorParams &calcParams)
 Sets the parameters for the given result calculator instance. More...
 
void getResultCalculatorParams (const Str &calculatorId, const Str &resultIdString, ResultCalculatorParams *calcParams) const
 Gets the current parameters exposed by the given result calculator instance. More...
 
Str primaryFilename () const
 Returns the primary filename for this data source. More...
 
Str description () const
 Returns the description for this data source. More...
 
virtual bool scalarRange (int stateId, int resultId, double *min, double *max)
 Gets the range of the given scalar result for the given state. More...
 
virtual bool vectorRange (int stateId, int resultId, double *min, double *max)
 Gets the range of the given vector result for the given state. More...
 
virtual bool displacementRange (int stateId, int resultId, double *min, double *max)
 Gets the range of the given displacement result for the given state. More...
 
- Public Member Functions inherited from cee::ug::DataSource
int id () const
 Returns the id of the data source. More...
 
size_t stateCount () const
 Returns number of states for the data source. More...
 
size_t stateIndex (int stateId) const
 Returns the index of the state with id stateId. More...
 
size_t geometryCountPerState () const
 Returns the number of geometries (per state) in the Datasource. More...
 
const DataStatestate (size_t stateIndex) const
 Returns the state at the given state index. More...
 
DataStatestate (size_t stateIndex)
 Returns the state at the given state index. More...
 
const DataStatecurrentState (const UnstructGridModel *model) const
 Returns the current state (the state in the current frame) in the given model. More...
 
DataStatecurrentState (const UnstructGridModel *model)
 Returns the current state (the state in the current frame) in the given model. More...
 
const DataSourceDirectorydirectory () const
 Returns the data directory of the data source. More...
 
DataSourceDirectorydirectory ()
 Returns the data directory of the data source. More...
 
const DataElementSetelementSet (size_t setIndex) const
 Returns a const ptr to the element set at the given index. More...
 
DataElementSetelementSet (size_t setIndex)
 Returns the element set at the given index. More...
 
size_t elementSetCount () const
 Returns the number of DataElementSets in this data source. More...
 
size_t elementSetIndex (int setId) const
 Returns the index of the element set with the given id. More...
 
void addElementSet (DataElementSet *elementSet)
 Adds an element set to this data source. More...
 
void removeElementSet (const DataElementSet *elementSet)
 Removes an element set from this data source. More...
 
void removeAllElementSets ()
 Removes all element sets from the data source. More...
 
bool isDataSourceValid (Str *failReason) const
 Validates that the data source contents matches the metadata. More...
 
int defaultDispacementResultId () const
 Returns the current state (the state in the current frame) in the given model. More...
 
bool computeCustomResults (int stateId, const DataStateSpec &stateSpec)
 Computes custom results. More...
 
- Public Member Functions inherited from cee::RefCountedObject
void addRef () const
 Increments the reference count for this object. More...
 
void release () const
 Decrements the reference count for this object. More...
 
int refCount () const
 Returns the reference count for this object. More...
 
void setRefCountZero () const
 Sets the ref count to zero, but DOES NOT delete the object. More...
 

Static Public Member Functions

static bool supportsResultCalculatorPlugins ()
 Gets if result calculator plugins are supported or not. More...
 
static bool loadResultCalculatorPlugin (const Str &baseFileName)
 Loads the specified result calculator plugin. More...
 

Protected Member Functions

void updateDirectoryFromDatabase ()
 Updates the directory with synthetic metadata from all states, parts and results in the geometries. More...
 
Inheritance diagram for cee::ug::DataSourceInterface:
cee::ug::DataSource cee::RefCountedObject cee::imp::cae::DataSourceCae cee::ug::DataSourceMerged cee::ug::DataSourceReader cee::ug::DataSourceVTF cee::ug::DataSourceVTFx

Detailed Description

A parent class for interface data sources.

See the main class DataSource for general explanation on a data source.

DataSourceInterface is the parent class for all interface data sources and cannot be instantiated. DataSource contains general functions that applies to all interface data source types. To create a data source, use one of the subclassed versions, for instance DataSourceVTF.

See DataSourceVTF and DataSourceVTFx on how to create a data source from a model file.

DataSourceInterface contains functionality for loading and discarding states manually. Loading states is useful to get access to, for instance, result data without having to add the state and results through the model.

See also
DataSource
DataSourceVTF
DataSourceVTFx
DataSourceDirectory

Constructor & Destructor Documentation

cee::ug::DataSourceInterface::DataSourceInterface ( int  dataSourceId)

Constructs an empty data source with the given id.

Member Function Documentation

cee::ug::DataSourceInterface::close ( )
pure virtual

Closes the currently open file in the derived interface.

Implemented in cee::ug::DataSourceVTFx, cee::imp::cae::DataSourceCae, cee::ug::DataSourceVTF, cee::ug::DataSourceMerged, and cee::ug::DataSourceReader.

bool cee::ug::DataSourceInterface::createResultCalculator ( const Str calculatorId,
const Str resultIdString,
const Str initString,
Str errorMessage 
)

Creates a new result with the given 'resultIdString' by using the result calculator 'calculatorId' configured with the given 'initString'.

A new result calculator instance will be created and initialized with the given initString. If it can based on this produce a result, a new result will be added with the given result idString.

This is useful for having calculators that e.g. support a mathematical expression. The initString is passed unmodified to the calculator initialize() method.

See the CRC ExpressionPlugin for an example on how to use this feature.

Note: To change the initString (e.g. expression), use the recreateResultCalculator() method.

bool cee::ug::DataSourceInterface::deleteResultCalculator ( const Str calculatorId,
const Str resultIdString 
)

Deletes the result calculator with the given calculatorId and resultIdString.

Str cee::ug::DataSourceInterface::description ( ) const

Returns the description for this data source.

void cee::ug::DataSourceInterface::discardState ( int  stateId)
virtual

Deletes the state with the given id from the data source.

bool cee::ug::DataSourceInterface::displacementRange ( int  stateId,
int  resultId,
double *  min,
double *  max 
)
virtual

Gets the range of the given displacement result for the given state.

The result does not need to be loaded. The it returns the global min max of the state, not taking any current filtering into account.

This will fetch the result from the reader if not already loaded, and is more efficient than loading the result into the data model if you only need the min/max. If the result is already present in the data model it will be used without loading the data.

void cee::ug::DataSourceInterface::getResultCalculatorParams ( const Str calculatorId,
const Str resultIdString,
ResultCalculatorParams calcParams 
) const

Gets the current parameters exposed by the given result calculator instance.

You can find which calculator instance is producing a result (if any) by checking the resultCalculatorId and idString parameters in the ResultInfo from the DataSourceDirectory.

bool cee::ug::DataSourceInterface::loadCustomResultBaseDependencies ( int  stateId,
const DataStateSpec stateSpec 
)
virtual

Loads custom result bare dependencies. Returns true if success.

Implements cee::ug::DataSource.

bool cee::ug::DataSourceInterface::loadResultCalculatorPlugin ( const Str baseFileName)
static

Loads the specified result calculator plugin.

bool cee::ug::DataSourceInterface::loadState ( int  stateId,
const DataStateSpec stateSpec,
Error error 
)
virtual

Loads the state at the given stateId. Only loads the state if not already present in the DataSource.

The stateSpec describes which results to load for the given state.

Returns true if the state was successfully loaded.

See also
DataStateSpec

Reimplemented in cee::ug::DataSourceReader.

cee::ug::DataSourceInterface::open ( const Str filename,
Error error = NULL 
)
pure virtual
Str cee::ug::DataSourceInterface::primaryFilename ( ) const

Returns the primary filename for this data source.

bool cee::ug::DataSourceInterface::recreateResultCalculator ( const Str calculatorId,
const Str resultIdString,
const Str initString,
Str errorMessage 
)

Recreates a result calculator with a modified initString.

This function will create a new result calculator instance like the createResultCalculator(), but it will keep the same resultId and from the CDC point of view modify the result. The resultId is keep constant and any parts of the model currently showing the result will be updated.

There needs to already be a result calculator with the given calculatorId and resultIdString

bool cee::ug::DataSourceInterface::scalarRange ( int  stateId,
int  resultId,
double *  min,
double *  max 
)
virtual

Gets the range of the given scalar result for the given state.

The result does not need to be loaded. The it returns the global min max of the state, not taking any current filtering into account.

This will fetch the result from the reader if not already loaded, and is more efficient than loading the result into the data model if you only need the min/max. If the result is already present in the data model it will be used without loading the data.

Reimplemented in cee::ug::DataSourceReader.

bool cee::ug::DataSourceInterface::setResultCalculatorParams ( const Str calculatorId,
const Str resultIdString,
const ResultCalculatorParams calcParams 
)

Sets the parameters for the given result calculator instance.

If the result is in use, the model will be updated.

You can find which calculator instance is producing a result (if any) by checking the resultCalculatorId and idString parameters in the ResultInfo from the DataSourceDirectory.

bool cee::ug::DataSourceInterface::supportsResultCalculatorPlugins ( )
static

Gets if result calculator plugins are supported or not.

void cee::ug::DataSourceInterface::updateDirectoryFromDatabase ( )
protected

Updates the directory with synthetic metadata from all states, parts and results in the geometries.

Note
Provided for convenience. Writing the directory info manually is the correct and most most efficient way.
See also
DataSourceDirectory
bool cee::ug::DataSourceInterface::vectorRange ( int  stateId,
int  resultId,
double *  min,
double *  max 
)
virtual

Gets the range of the given vector result for the given state.

The result does not need to be loaded. The it returns the global min max of the state, not taking any current filtering into account.

This will fetch the result from the reader if not already loaded, and is more efficient than loading the result into the data model if you only need the min/max. If the result is already present in the data model it will be used without loading the data.

Reimplemented in cee::ug::DataSourceReader.