The DataReader is an easy and efficient way to get data into the UnstructGridModel, leveraging the data management support of UnstructGridModel through the DataSourceReader. More...
Public Member Functions | |
virtual bool | isSupportedFileFormat (const Str &filename)=0 |
Returns true if the given file is supported by the reader. More... | |
virtual bool | open (const Str &filename, Error *error)=0 |
Opens the given file and prepare to answer the initializeDirectory() method and then readGeometry() etc. More... | |
virtual void | close ()=0 |
Supposed to close any of your open file(s) and prepare to open a new file. More... | |
virtual size_t | geometryCount () const =0 |
Returns the number of geometries provided by this data reader. The normal case will be one geometry. More... | |
virtual bool | initializeDirectory (DataSourceDirectory *directory, Error *error)=0 |
Updates the directory with all the data provided by this reader. More... | |
virtual bool | hasNewGeometryForEachState (size_t globalGeometryIndex) const |
Supposed to return true if each state has a separate/different geometry. The default implementation returns false. More... | |
virtual bool | readGeometry (int stateId, size_t geometryIndex, DataGeometry *geometry, Error *error)=0 |
Reads the geometry from the analysis and fill in the passed geometry. More... | |
virtual bool | readScalarResult (int stateId, size_t geometryIndex, int resultId, DataResultScalar *scalarResult, Error *error) |
Reads the specified scalar result from the analysis and populate the passed scalarResult. More... | |
virtual bool | readVectorResult (int stateId, size_t geometryIndex, int resultId, DataResultVector *vectorResult, Error *error) |
Reads the specified vector result from the analysis and populate the passed vectorResult. More... | |
virtual bool | readDisplacementResult (int stateId, size_t geometryIndex, int resultId, DataResultDisplacement *displacementResult, Error *error) |
Reads the specified displacement result from the analysis and populate the passed vectorResult. More... | |
virtual bool | readSymmetricTensorResult (int stateId, size_t geometryIndex, int resultId, DataResultSymmetricTensor *symmetricTensorResult, Error *error) |
Reads the specified symmetric tensor result from the analysis and populate the passed symmetricTensorResult. More... | |
virtual bool | readTransformationResult (int stateId, size_t geometryIndex, DataResultTransformation *transformationResult, Error *error) |
Reads the specified transformation result from the analysis and populate the passed transformationResult. More... | |
![]() | |
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... | |
The DataReader is an easy and efficient way to get data into the UnstructGridModel, leveraging the data management support of UnstructGridModel through the DataSourceReader.
The DataReader is responsible for providing data to the DataSourceReader data source. After implementing the DataReader for your file format, you can just plug this custom reader into a DataSourceReader, set this as the data source for you UnstructGridModel. Then you can open an analysis, and use the DataSourceDirectory information to populate your UI. Then specify what to visualize in the ModelSpec as well as on cutting planes, isosurfaces, isovolumes and particle traces. UnstructGridModel will use the derived DataReader to load the geometry and results whenever needed. You only have to specify what to show, and the UnstructGridModel will do the data management.
To create a reader, you have to implement the following methods:
|
pure virtual |
Supposed to close any of your open file(s) and prepare to open a new file.
|
pure virtual |
Returns the number of geometries provided by this data reader. The normal case will be one geometry.
|
virtual |
Supposed to return true if each state has a separate/different geometry. The default implementation returns false.
Use this method to specify that one (or more) of your geometries change for each state. This is usually the case if the model is remeshed between each time step.
If only the nodes change but not the topology of the geometry, you should use displacements results as this is much more efficient than re-specifying the whole geometry.
|
pure virtual |
Updates the directory with all the data provided by this reader.
You must add info about all states, parts, scalars, vectors, displacements and transformation results. The reader will only be asked about data that is in the directory.
Example:
|
pure virtual |
Returns true if the given file is supported by the reader.
Opens the given file and prepare to answer the initializeDirectory() method and then readGeometry() etc.
Returns true if the file was successfully opened the reader is ready to provide data. Please note that you should usually not read all the data in this method, only check that the file is present and maybe do some initial reading.
|
virtual |
Reads the specified displacement result from the analysis and populate the passed vectorResult.
Use this method to provide the specified displacement result for the given geometry and at the given state. The number of results values must match the number of nodes in the corresponding geometry.
|
pure virtual |
Reads the geometry from the analysis and fill in the passed geometry.
Use this method to provide the geometry (with all parts) for the given geometry index. If you have overridden the hasNewGeometryForEachState() method and returned true, you will get a call to this method for each new state that is loaded. If not, you will only once get a call to this method.
Advanced example: Two states, two geometries, one remeshed and one constant.
|
virtual |
Reads the specified scalar result from the analysis and populate the passed scalarResult.
Use this method to provide the specified scalar result for the given geometry and at the given state. The result mapping provided must match the one specified for this result in initializeDirectory() and the number of result values must match the corresponding geometry.
Advanced example matching the example in readGeometry() (Two states, two geometries, one remeshed and one constant):
|
virtual |
Reads the specified symmetric tensor result from the analysis and populate the passed symmetricTensorResult.
Use this method to provide the specified symmetric tensor result for the given geometry and at the given state. The result mapping provided must match the one specified for this result in initializeDirectory() and the number of result values must match the corresponding geometry.
|
virtual |
Reads the specified transformation result from the analysis and populate the passed transformationResult.
Use this method to provide per part transformation matrices for the given geometry and state. The number of parts must match the corresponding geometry.
This method will be called if DataSourceDirectory::setTransformationResult(true) is done in initializeDirectory().
|
virtual |
Reads the specified vector result from the analysis and populate the passed vectorResult.
Use this method to provide the specified vector result for the given geometry and at the given state. The result mapping provided must match the one specified for this result in initializeDirectory() and the number of result values must match the corresponding geometry.