# cee::ug::DataSourceInterface

class `DataSourceInterface` : public DataSource

  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, and DataSourceDirectory

  Subclassed by DataSourceCae, DataSourceMerged, DataSourceReader, DataSourceVTF, DataSourceVTFx

  Public Functions

  `DataSourceInterface`(int dataSourceId)

    Constructs an empty data source with the given id.

  virtual bool `open`(const Str &filename, Error *error = NULL) = 0

    Opens a file using the derived interface.

  virtual void `close`() = 0

    Closes the currently open file in the derived interface.

  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

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

    Returns true if the state was successfully loaded.

    See also

    DataStateSpec

  virtual void `discardState`(int stateId)

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

  virtual bool `loadCustomResultBaseDependencies`(int stateId, const DataStateSpec &stateSpec)

    Loads custom result bare dependencies. Returns true if success.

  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.

    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 resultIdString.

    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 `createResultCalculator`(const Str &calculatorId, const Str &resultIdString, const Str &initString, const Str &coordSystemString, Str *errorMessage)

    Creates a new result with the given resultIdString by using the result calculator calculatorId configured with the given initString and coordinate system specification.

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

    This method extends the original createResultCalculator() by supporting explicit coordinate system specification. The coordSystemString should be in the format “type=<type>;origin=<x,y,z>;orientation=<m00,m01,m02,m10,m11,m12,m20,m21,m22>” Orientation entries are provided row-major; columns define the coordinate axes. Valid <type> values: cartesian, cylindrical, spherical.

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

    Example: cylindrical: “type=cylindrical;origin=10.0,5.0,0.0;orientation=1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0” Orientation is a 3x3 matrix specified in row-major order.

  bool `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 EnvisionDesktop 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 `recreateResultCalculator`(const Str &calculatorId, const Str &resultIdString, const Str &initString, const Str &coordSystemString, Str *errorMessage)

    Recreates a result calculator with a modified initString and coordinate system specification.

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

    This method extends the original recreateResultCalculator() by supporting explicit coordinate system specification. The coordSystemString should be in the format “type=<type>;origin=<x,y,z>;orientation=<m00,m01,m02,m10,m11,m12,m20,m21,m22>” Orientation entries are provided row-major; columns define the coordinate axes. Valid <type> values: cartesian, cylindrical, spherical. Examples: cylindrical: “type=cylindrical;origin=10.0,5.0,0.0;orientation=1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0” Orientation is a 3x3 matrix specified in row-major order.

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

  bool `deleteResultCalculator`(const Str &calculatorId, const Str &resultIdString)

    Deletes the result calculator with the given calculatorId and resultIdString.

  bool `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.

  void `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.

  Str `primaryFilename`() const

    Returns the primary filename for this data source.

  Str `description`() const

    Returns the description for this data source.

  virtual bool `scalarRange`(int stateId, int resultId, double *min, double *max)

    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.

  virtual bool `vectorRange`(int stateId, int resultId, double *min, double *max)

    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.

  virtual bool `displacementRange`(int stateId, int resultId, double *min, double *max)

    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.

  Public Static Functions

  static bool `supportsResultCalculatorPlugins`()

    Gets if result calculator plugins are supported or not.

  static bool `loadResultCalculatorPlugin`(const Str &baseFileName)

    Loads the specified result calculator plugin.

  Protected Functions

  void `updateDirectoryFromDatabase`()

    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

Conversation saved
HOOPSY BETA

### Hello! I'm HOOPSY

Your multilingual generative AI assistant for documentation. Ask me anything about HOOPS Envision for Desktop in your own language, or choose a sample question below to start a conversation:

What is HOOPS Envision for Desktop?
What are the latest release notes for HOOPS Envision for Desktop?
How do I start evaluating HOOPS Envision for Desktop?
How do I write my first sample application?
How can I get assistance?

HOOPSY may store conversations according to OpenAI's policy. Responses may not always be accurate.

HOOPSY is thinking...