The model specification. More...
Public Types | |
enum | ModelColorSource { PART, SET, ELEMENT_TYPE } |
Model color source. This will determine how to color each face of the model if no fringes results are used. More... | |
Public Member Functions | |
std::vector< int > | stateIds () const |
Returns an array of all current states. More... | |
void | setStateIds (const std::vector< int > &stateIds) |
Sets the id(s) of the current state(s). More... | |
void | setStateId (int stateId) |
Sets the id of the current state (single state). More... | |
int | fringesResultId () const |
Returns the current fringes result. More... | |
void | setFringesResultId (int fringesId) |
Specifies the scalar result to show as fringes. More... | |
int | effectiveFringesResultId (size_t globalGeometryIndex, int partId) const |
Returns the effective fringes result for the given part. More... | |
std::vector< int > | allFringesResultIds () const |
Returns an array of all fringes results set up in this model spec. More... | |
int | overridePartFringesResultId (size_t globalGeometryIndex, int partId) const |
Returns the override fringes results for this part. More... | |
void | setOverridePartFringesResultId (size_t globalGeometryIndex, int partId, int fringesId) |
Sets a fringes to override for a given part. More... | |
void | removeAllOverridePartFringesResultIds () |
Removes all override part fringes results. More... | |
int | contourLinesResultId () const |
Returns the current contour lines result. More... | |
void | setContourLinesResultId (int contourLinesId) |
Specifies the scalar result to show as contour lines. More... | |
std::vector< int > | vectorResultIds () const |
Returns an array of current vector results. More... | |
void | setVectorResultIds (const std::vector< int > &vectorIds) |
Specifies the vector result(s) to show. More... | |
void | setVectorResultId (int vectorId) |
Specifies the vector result to show. More... | |
int | displacementResultId () const |
Returns the current displacement result. More... | |
void | setDisplacementResultId (int displacementId) |
Specifies the displacement result to show. More... | |
bool | transformationResult () const |
Returns true if the transformation result is set to be shown. More... | |
void | setTransformationResult (bool useTransformationResult) |
Specifies if the transformation result should be shown. More... | |
std::vector< int > | visibleSetIds () const |
Returns an array with the ids of all the visible element sets. More... | |
void | setVisibleSetIds (const std::vector< int > &setIds) |
Sets which element sets that will be used to determine if an element is visible or not. More... | |
void | setVisibleSetId (int setId) |
Sets which element set that will be used to determine if an element is visible or not. More... | |
bool | showComplementOfVisibleSets () const |
Returns true if the complement of the visible sets will be shown. More... | |
void | setShowComplementOfVisibleSets (bool showComplement) |
Specifies that the complement of the current visible sets will be shown. More... | |
bool | visibilityResult () const |
Returns true if the visibility result is set to be shown. More... | |
void | setVisibilityResult (bool useVisibilityResult) |
Specifies if the visibility result should be shown. More... | |
ModelColorSource | modelColorSource () const |
Returns the current model color source. Default: PART (part colors) More... | |
void | setModelColorSource (ModelColorSource colorSource) |
Sets the model color source. More... | |
ModeShapeAnimation & | modeShapeAnimation () |
Returns the settings for mode shape animation. More... | |
const ModeShapeAnimation & | modeShapeAnimation () const |
Returns the settings for mode shape animation. More... | |
void | clear () |
Clears the model specification back to the default state. More... | |
void | setDefaultResults () |
Sets up the default results to load. More... | |
void | removeInvalidSpecifications () |
Removes specifications that are not valid. More... | |
The model specification.
The model specification describes the visual content of the model. Each model owns a model specification object which can be accessed through UnstructGridModel::modelSpec().
The model specification may, for instance, contain the following settings for the model:
See the topic: Model
See the tutorials: UnstructGrid: A simple model with results and UnstructGrid: Load model from file and set up model specification
All settings in the model specification have a set and a get function, for instance: setFringesResultId() and fringesResultId(). In addition to all set and get functions, there is also the clear() function for resetting the model specification.
Use the metadata found in the data source directory to see available states and results.
There must always be at least one state current in the models specification. To set up an animation, all states included in the animation must be added to the model specification.
To visualize a result that has been set in the model specification, the results visibility must be toggled on in the part settings for all affected parts. Each part has its own part settings where fringes, vector and/or displacement result visibility is toggled. The transformation result does not have a visibility toggle in part settings and will always be applied to all parts as long as use transformation result is chosen in the model specification. Use PartSettings for individual parts or use the PartSettingsIterator easily iterating over all parts.
Example on setting model specification based on metadata. The test model is read from a VTF file and contains multiple states, scalar results, vector results and a displacement result.
Create the model and VTFx file interface data source.
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.
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.
See the complete source code at: UnstructGrid: Load model from file and set up model specification
std::vector< int > cee::ug::ModelSpec::allFringesResultIds | ( | ) | const |
Returns an array of all fringes results set up in this model spec.
Contains both normal fringes result set by setFringesResultId() and override fringes results set using setOverridePartFringesResultId().
void cee::ug::ModelSpec::clear | ( | ) |
Clears the model specification back to the default state.
int cee::ug::ModelSpec::contourLinesResultId | ( | ) | const |
Returns the current contour lines result.
Returns -1 if no result are set as contour lines.
int cee::ug::ModelSpec::displacementResultId | ( | ) | const |
Returns the current displacement result.
Returns -1 if no displacements are set.
int cee::ug::ModelSpec::effectiveFringesResultId | ( | size_t | globalGeometryIndex, |
int | partId | ||
) | const |
Returns the effective fringes result for the given part.
If part fringes is overridden using setOverridePartFringesResultId(), this result will be returned. Otherwise, the result set using setFringesResultId() will be returned. If no fringes are set, -1 is returned.
int cee::ug::ModelSpec::fringesResultId | ( | ) | const |
Returns the current fringes result.
Returns -1 if no result are set as fringes.
ModelSpec::ModelColorSource cee::ug::ModelSpec::modelColorSource | ( | ) | const |
Returns the current model color source. Default: PART (part colors)
ModeShapeAnimation & cee::ug::ModelSpec::modeShapeAnimation | ( | ) |
Returns the settings for mode shape animation.
const ModeShapeAnimation & cee::ug::ModelSpec::modeShapeAnimation | ( | ) | const |
Returns the settings for mode shape animation.
int cee::ug::ModelSpec::overridePartFringesResultId | ( | size_t | globalGeometryIndex, |
int | partId | ||
) | const |
Returns the override fringes results for this part.
Returns -1 if a override fringes result is not set.
void cee::ug::ModelSpec::removeAllOverridePartFringesResultIds | ( | ) |
Removes all override part fringes results.
void cee::ug::ModelSpec::removeInvalidSpecifications | ( | ) |
Removes specifications that are not valid.
void cee::ug::ModelSpec::setContourLinesResultId | ( | int | contourLinesId | ) |
Specifies the scalar result to show as contour lines.
Specify -1 to not show any contour lines.
void cee::ug::ModelSpec::setDefaultResults | ( | ) |
Sets up the default results to load.
This will enable transformation results if present, and also load the displacement result if this is set to be loaded default by the current data source.
void cee::ug::ModelSpec::setDisplacementResultId | ( | int | displacementId | ) |
Specifies the displacement result to show.
Specify -1 to not show any displacements.
void cee::ug::ModelSpec::setFringesResultId | ( | int | fringesId | ) |
Specifies the scalar result to show as fringes.
Specify -1 to not show any fringes.
void cee::ug::ModelSpec::setModelColorSource | ( | ModelColorSource | colorSource | ) |
Sets the model color source.
This will determine how to color each face of the model if no fringesResults are used. Default is PART (use part colors).
void cee::ug::ModelSpec::setOverridePartFringesResultId | ( | size_t | globalGeometryIndex, |
int | partId, | ||
int | fringesId | ||
) |
Sets a fringes to override for a given part.
This will be used on this part instead of the general fringes result set by setFringesResultId().
void cee::ug::ModelSpec::setShowComplementOfVisibleSets | ( | bool | showComplement | ) |
Specifies that the complement of the current visible sets will be shown.
If this option is enabled, only the elements that are NOT present in any of the visible sets will be shown.
void cee::ug::ModelSpec::setStateId | ( | int | stateId | ) |
Sets the id of the current state (single state).
State id must be zero or greater.
If more than one state should be current, use setStateIds() instead.
void cee::ug::ModelSpec::setStateIds | ( | const std::vector< int > & | stateIds | ) |
Sets the id(s) of the current state(s).
State ids must be zero or greater.
If only one state should be current, setStateId() can be used instead.
void cee::ug::ModelSpec::setTransformationResult | ( | bool | useTransformationResult | ) |
Specifies if the transformation result should be shown.
void cee::ug::ModelSpec::setVectorResultId | ( | int | vectorId | ) |
Specifies the vector result to show.
If multiple vector results should be shown, use setVectorResultIds() instead.
Specify -1 to not show any vectors.
void cee::ug::ModelSpec::setVectorResultIds | ( | const std::vector< int > & | vectorIds | ) |
Specifies the vector result(s) to show.
If only vector results should be shown, setVectorResultId() can be used instead.
void cee::ug::ModelSpec::setVisibilityResult | ( | bool | useVisibilityResult | ) |
Specifies if the visibility result should be shown.
void cee::ug::ModelSpec::setVisibleSetId | ( | int | setId | ) |
Sets which element set that will be used to determine if an element is visible or not.
If setId >= 0, then only the elements that are in the visible set will be visible (assuming the showComplementOfVisibleSets() is false).
If -1, all elements will be visible.
void cee::ug::ModelSpec::setVisibleSetIds | ( | const std::vector< int > & | setIds | ) |
Sets which element sets that will be used to determine if an element is visible or not.
If the array is non-empty, only the elements that are in one (or more) of the visible sets will be visible (assuming the showComplementOfVisibleSets() is false).
If the array is empty, all elements will be visible (default).
bool cee::ug::ModelSpec::showComplementOfVisibleSets | ( | ) | const |
Returns true if the complement of the visible sets will be shown.
std::vector< int > cee::ug::ModelSpec::stateIds | ( | ) | const |
Returns an array of all current states.
bool cee::ug::ModelSpec::transformationResult | ( | ) | const |
Returns true if the transformation result is set to be shown.
std::vector< int > cee::ug::ModelSpec::vectorResultIds | ( | ) | const |
Returns an array of current vector results.
Returns an empty array if no vector results are current.
bool cee::ug::ModelSpec::visibilityResult | ( | ) | const |
Returns true if the visibility result is set to be shown.
std::vector< int > cee::ug::ModelSpec::visibleSetIds | ( | ) | const |
Returns an array with the ids of all the visible element sets.
Returns an empty array if element filtering is not in use (default).