This tutorial shows how to create a data source by loading a VTFx file and setup a model specification.
This data source contains multiple states, scalar results, vector results and a displacement result. After opening the file, the available metadata can be queried through the data source directory.
In this example you will set up the model specification to show the following:
Create a model and a data source.
In this tutorial you will be reading a data source from a VTFx file so you need an instance of the VTFx file interface data source, cee::ug::DataSourceVTFx.
Give the data source a unique id.
Open the test file (contact.vtfx) included in the tutorial data files. The open() function will return true if the file was opened successfully.
Set the data source in the model.
After opening the file, the metadata will be available through the data source's directory through cee::ug::DataSource::directory().
The data source directory contains the following metadata for the data source:
The cee::ug::ModelSpec object is the model specification. Each cee::ug::UnstructGridModel will own a model specification object.
The model specification describes the following settings for the model:
Use the information retrieved from the data source directory to set up the model specification.
Get metadata for all states and set the last state as current in the model specification.
Get metadata for all available scalar results and set the first scalar to show as fringes in the model specification.
Get metadata for all available vector results and set the first vector in the model specification.
Get metadata for all available displacement results and set the first displacement in the model specification.
Toggle on result visibility for all parts for the selected result types. For easy access to the settings for all available parts in a model, use the cee::ug::PartSettingsIterator.
The model is ready to use and can be added to the view. Exactly where the view exists depends on the platform and solution. These examples uses Qt and the view is set up in a cee::qt::ViewerWidget.
UnstructGrid: Load model from file and set up model specification