Skip to main content

optiSLang 3D Postprocessing Script API 2025 R1

ReferenceDesign Class Reference

Last update: 16.07.2025

defines information on imported data and files given a reference design More...

Public Types

typedef std::vector< ImportItemInfoImportItemInfoVector
 a set of data items
 
typedef boost::shared_ptr< MeshMapperBaseMeshMapperBasePtr
 a shared pointer type for MeshMapperBase
 

Public Member Functions

 check (Structure database)
 checks if the settings are valid and produces an error. More...
 
string generateScriptOfSettingsDefinition ()
 Generates a Lua script that is used to build up this object. More...
 
void import (Structure database, int sample_number, string design_path="", bool do_not_check_settings=false)
 imports a design from disk More...
 
 ReferenceDesign (string the_base_path)
 Initializes the object with the base path given and sets further defaults. More...
 
 setBasePath (string path)
 sets a new base path. This includes changing the relative path definition of the already parsed files. More...
 
Modify file list

Methods to modify the file list

 addFile_2dGrid (Structure database, string filename)
 Adds information from a CSV file with Grid information. More...
 
 addFile_3dGrid (Structure database, string filename)
 Adds information from a CSV file with Grid information. More...
 
 addFile_Abaqus (Structure database, string filename)
 Adds information from a file in Abaqus format. More...
 
 addFile_ANSYS_APDL (Structure database, string filename)
 Adds information from an ANSYS Mechanical APDL file either in APDL-style format, or in cdb blocked as well as unblocked format. More...
 
 addFile_ANSYS_RST (Structure database, string filename)
 Adds information from an ANSYS binary structural or coupled-field analysis file. More...
 
 addFile_Image (Structure database, string filename)
 Adds information from a file in a pixel image format. More...
 
 addFile_LSDyna_Dynain (Structure database, string filename)
 adds information from a file in LS-DYNA Dynain format. More...
 
 addFile_LSPrePost (Structure database, string filename)
 adds information from a file in LS-PrePost (LS-DYNA) format. More...
 
 addFile_NastranInput (Structure database, string filename)
 Adds information from a file in NASTRAN format. More...
 
 addFile_PamstampDataAsc (Structure database, string filename)
 Adds information from a file in NASTRAN format. More...
 
 addFile_PERMAS (Structure database, string filename)
 Adds information from a file in PERMAS format. More...
 
 addFile_STL (Structure database, string filename)
 Adds information from a file in STL format. More...
 
 addFile_ElementDataCSV (Structure database, string filename)
 Adds element data information from a file in CSV format. More...
 
 addFile_NodeDataCSV (Structure database, string filename)
 Adds node data information from a file in CSV format. More...
 
 addFile_SignalMeshCSV (Structure database, string filename)
 Adds node data information from a signal file in CSV format. More...
 
 addFile_SignalDataCSV (Structure database, string filename)
 Adds node data information from a signal file in CSV format. More...
 
 addFile_FLUENT_CSV (Structure database, string filename)
 adds information from a file in FLUENT result CSV format. More...
 
 addFile_VTK (Structure database, string filename)
 Adds information from a file in VTK format. More...
 
 removeFileFromList (string filename)
 removes all import data from item list which is associated with the sepcified file More...
 
std::vector< string > getFiles ()
 assembles the complete list of files being known to this class More...
 
std::vector< string > getFilesToImport ()
 Assembles a list of files which are to be imported (only the files for which one selected "import" are exported here) More...
 
Modify file item properties

Methods to modify file item properties

 addItem (Structure database, ImportItemInfo new_item)
 adds a single item to trhe list of import data More...
 
 setImportItem (number item, bool do_import)
 Sets if the item is to be imported There is no error checking! More...
 
 setImportIdent (number item, string ident, Structure database)
 Sets the new ident used for import The ident is automatically modified to be unique and allowed. Further, the list of items is resorted! More...
 
 sortItems ()
 sorts the vector of item information
 
std::vector< number > getItemsForFile (string filename)
 assembles a list of items which are to be imported from a specific file More...
 
number getItemIndex (string filename, ImportItemInfo::Type data_type, string input_ident, number column=0)
 gets the index of the respective item if existing More...
 
 clear ()
 deletes all import items
 
Modify mesh mapper

Methods to control mesh mapper settings

 setMeshMapper (MeshMapperBase mapper)
 sets the (in)compatible mesh mapper object More...
 
MeshMapperBase meshMapper ()
 
MeshMapperBase meshMapperRef ()
 

Public Attributes

string base_path
 Specifies the base path. Must be changed only via setBasePath()! More...
 
bool check_on_duplicate_idents_in_database
 defines if quantities to be imported must not exist in the global database In this case, all methods will propose idents which make the new imported data unique.
 
ImportItemInfoVector items
 stores all parsed data item information
 

Detailed Description

defines information on imported data and files given a reference design

This class contains settings for an example design directory (the base_path). These settings include file formats, data items to be imported etc.

Note, the currently stored data must be kept "functional" at all times. If you add a new file using the appropriate function, this will take care for you. If you change the data items from outside (GUI etc.) you must use the function check() in order to approve the changes. If the changes are erroneous, the next addFIle-method call may lead to undefined behaviour.

Constructor & Destructor Documentation

◆ ReferenceDesign()

ReferenceDesign ( string  the_base_path)

Initializes the object with the base path given and sets further defaults.

Parameters
the_base_pathDefines the base path. Refer to base_path for further remarks,

Member Function Documentation

◆ addFile_2dGrid()

addFile_2dGrid ( Structure  database,
string  filename 
)

Adds information from a CSV file with Grid information.

Multiple data items per file are supported. If the file consists geometric information, it is checked on validity (with a warning and being added inactive). If the data items are already existing, their names will be changed. The vector is reordered.

Parameters
databaseThe current database where the items are to be imported
filenameThe file to be parsed. Relative to the base path, or if not existing, relative to the working directory. Otherwise it will be tried to interpret the filename as absolute path

◆ addFile_3dGrid()

addFile_3dGrid ( Structure  database,
string  filename 
)

Adds information from a CSV file with Grid information.

Multiple data items per file are supported. If the file consists geometric information, it is checked on validity (with a warning and being added inactive). If the data items are already existing, their names will be changed. The vector is reordered.

Parameters
databaseThe current database where the items are to be imported
filenameThe file to be parsed. Relative to the base path, or if not existing, relative to the working directory. Otherwise it will be tried to interpret the filename as absolute path

◆ addFile_Abaqus()

addFile_Abaqus ( Structure  database,
string  filename 
)

Adds information from a file in Abaqus format.

Multiple data items per file are supported. If the file consists geometric information, it is checked on validity (with a warning and being added inactive). If the data items are already existing, their names will be changed. The vector is reordered.

Parameters
databaseThe current database where the items are to be imported
filenameThe file to be parsed. Relative to the base path, or if not existing, relative to the working directory. Otherwise it will be tried to interpret the filename as absolute path

◆ addFile_ANSYS_APDL()

addFile_ANSYS_APDL ( Structure  database,
string  filename 
)

Adds information from an ANSYS Mechanical APDL file either in APDL-style format, or in cdb blocked as well as unblocked format.

Parameters
databaseThe current database where the items are to be imported
filenameThe file to be parsed. Interpred either relative to the base path or to the working directory, or interpreted as absolute path. If none of these options match an exsisting file, an exception will be thrown

◆ addFile_ANSYS_RST()

addFile_ANSYS_RST ( Structure  database,
string  filename 
)

Adds information from an ANSYS binary structural or coupled-field analysis file.

Parameters
databaseThe current database where the items are to be imported
filenameThe file to be parsed. Interpred either relative to the base path or to the working directory, or interpreted as absolute path. If none of these options match an exsisting file, an exception will be thrown

◆ addFile_ElementDataCSV()

addFile_ElementDataCSV ( Structure  database,
string  filename 
)

Adds element data information from a file in CSV format.

Only element data items are supported. If the data items are already existing, their names will be changed. The vector is reordered.

Parameters
databasethe current database where the items are to be imported
filenamethe file to be parsed. Is relative the base_path or (if this is not existing, take it as absolute path or relative to working dir)

◆ addFile_FLUENT_CSV()

addFile_FLUENT_CSV ( Structure  database,
string  filename 
)

adds information from a file in FLUENT result CSV format.

Parameters
databaseThe current database where the items are to be imported
filenameThe file to be parsed. Relative to the base path, or if not existing, relative to the working directory or it will be tried to interpret the filename as absolute path

◆ addFile_Image()

addFile_Image ( Structure  database,
string  filename 
)

Adds information from a file in a pixel image format.

Multiple data items per file are supported. It is checked on validity using the pixel dimensions (with a warning and being added inactive). If the data items are already existing, their names will be changed. The vector is reordered.

Parameters
databaseThe current database where the items are to be imported
filenameThe file to be parsed. Interpred either relative to the base path or to the working directory, or interpreted as absolute path. If none of these options match an exsisting file, an exception will be thrown

◆ addFile_LSDyna_Dynain()

addFile_LSDyna_Dynain ( Structure  database,
string  filename 
)

adds information from a file in LS-DYNA Dynain format.

Multiple data items per file are supported. If the file consists geometric information, it is checked on validity (with a warning and being added inactive). If the data items are already existing, their names will be changed. The vector is reordered.

Parameters
databaseThe current database where the items are to be imported
filenameThe file to be parsed. Relative to the base path, or if not existing, relative to the working directory or it will be tried to interpret the filename as absolute path

◆ addFile_LSPrePost()

addFile_LSPrePost ( Structure  database,
string  filename 
)

adds information from a file in LS-PrePost (LS-DYNA) format.

Multiple data items per file are supported. If the file consists geometric information, it is checked on validity (with a warning and being added inactive). If the data items are already existing, their names will be changed. The vector is reordered.

Parameters
databaseThe current database where the items are to be imported
filenameThe file to be parsed. Relative to the base path, or if not existing, relative to the working directory or it will be tried to interpret the filename as absolute path

◆ addFile_NastranInput()

addFile_NastranInput ( Structure  database,
string  filename 
)

Adds information from a file in NASTRAN format.

The file will be read and interpreted as input file (*.dat, *bdf) with a clearly and reliable defined data structure described in MSC Nastran Quick Reference Guide Multiple data items per file are supported. If the file consists geometric information, it is checked on validity (with a warning and being added inactive).

Parameters
databaseThe current database where the items are to be imported
filenameThe file to be parsed. Is relative to the base_path or if this is not existing, try to take it as absolute path or relative to the working dir.

◆ addFile_NodeDataCSV()

addFile_NodeDataCSV ( Structure  database,
string  filename 
)

Adds node data information from a file in CSV format.

Only node data items are supported. If the data items are already existing, their names will be changed. The vector is reordered.

Parameters
databasethe current database where the items are to be imported
filenamethe file to be parsed. Is relative the base_path or (if this is not existing, take it as absolute path or relative to working dir)

◆ addFile_PamstampDataAsc()

addFile_PamstampDataAsc ( Structure  database,
string  filename 
)

Adds information from a file in NASTRAN format.

The file will be read and interpreted as data file. At this time we don't know any standard or at least a common format for Nastran output data. In fact, we don't know where the data format comes from... Multiple data items per file are supported. If the file consists geometric information, it is checked on validity (with a warning and being added inactive). If the data items are already existing, their names will be changed. The vector is reordered.

Parameters
databaseThe current database where the items are to be imported
filenameThe file to be parsed. Is relative to the base_path or if this is not existing, try to take it as absolute path or relative to the working dir.

◆ addFile_PERMAS()

addFile_PERMAS ( Structure  database,
string  filename 
)

Adds information from a file in PERMAS format.

Multiple data items per file are supported. If the file consists geometric information, it is checked on validity (with a warning and being added inactive). If the data items are already existing, their names will be changed. The vector is reordered.

Parameters
databaseThe current database where the items are to be imported
filenameThe file to be parsed. Relative to the base path, or if not existing, relative to the working directory or it will be tried to interpret the filename as absolute path

◆ addFile_SignalDataCSV()

addFile_SignalDataCSV ( Structure  database,
string  filename 
)

Adds node data information from a signal file in CSV format.

Only node data items are supported. If the data items are already existing, their names will be changed. The vector is reordered.

Only the data and not the mesh will be imported.

Parameters
databaseThe database where the items are to be imported
filenameThe file to be parsed. As first guess, the path is interpreted relative to the base_path. If this fails, the path is read as absolute path or - as last option - relative to the working dir.

◆ addFile_SignalMeshCSV()

addFile_SignalMeshCSV ( Structure  database,
string  filename 
)

Adds node data information from a signal file in CSV format.

Only node data items are supported. If the data items are already existing, their names will be changed. The vector is reordered.

Both data and mesh will be imported.

Parameters
databaseThe database where the items are to be imported
filenameThe file to be parsed. As first guess, the path is interpreted relative to the base_path. If this fails, the path is read as absolute path or - as last option - relative to the working dir.

◆ addFile_STL()

addFile_STL ( Structure  database,
string  filename 
)

Adds information from a file in STL format.

Only geometric information can be imported. STL import makes only sense in combination with incompatible mesh mappers.

Parameters
databasethe current database where the items are to be imported
filenameThe file to be parsed. Relative to the base path, or if not existing, relative to the working directory or it will be tried to interpret the filename as absolute path

◆ addFile_VTK()

addFile_VTK ( Structure  database,
string  filename 
)

Adds information from a file in VTK format.

Multiple data items per file are supported. If the file consists geometric information, it is checked on validity (with a warning and being added inactive). If the data items are already existing, their names will be changed. The vector is reordered.

Parameters
databaseThe current database where the items are to be imported
filenameThe file to be parsed. Relative to the base path, or if not existing, relative to the working directory. Otherwise it will be tried to interpret the filename as absolute path

◆ addItem()

addItem ( Structure  database,
ImportItemInfo  new_item 
)

adds a single item to trhe list of import data

Parameters
databasethe database we refer to
new_itemthe new item
Note
This method is used for directly modifying the data. It is not intended to be used by the user/GUI, but by generateScriptOfSettingsDefinition().

◆ check()

check ( Structure  database)

checks if the settings are valid and produces an error.

Parameters
databasethe data base

◆ generateScriptOfSettingsDefinition()

string generateScriptOfSettingsDefinition ( )

Generates a Lua script that is used to build up this object.

Returns
The script code. Ends with a newline.
Note
This script works only for the global reference design (due to restrictions in itself and other classes)

◆ getFiles()

std::vector< string > getFiles ( )

assembles the complete list of files being known to this class

This is a compact view onto the contained data, since multiple items may be imported from a single file.

Returns
a list of filenames. The file names are relative to the base path.

◆ getFilesToImport()

std::vector< string > getFilesToImport ( )

Assembles a list of files which are to be imported (only the files for which one selected "import" are exported here)

This is a compact view onto the contained data, since multiple items may be imported from a single file and some files may be inactive.

Returns
a list of filenames. The file names are relative to the base path.

◆ getItemIndex()

number getItemIndex ( string  filename,
ImportItemInfo::Type  data_type,
string  input_ident,
number  column = 0 
)

gets the index of the respective item if existing

Parameters
filenamethe filename relative to the base directory
data_typethe data type, e.g. "coordinate along x direction"
input_identthe input ident, e.g. "thickness"
columnthe column index for tensor fields (else 0)
Returns
index to the item in the vector items. Throws an exception if not existing

◆ getItemsForFile()

std::vector< number > getItemsForFile ( string  filename)

assembles a list of items which are to be imported from a specific file

Parameters
filenamethe file name for which all items to be imported are searched.
Returns
a list of integer indices in ascending order. Each index refers to an Item in the vector items. If no data is to be imported from the requested file, an empty list is returned.

◆ import()

void import ( Structure  database,
int  sample_number,
string  design_path = "",
bool  do_not_check_settings = false 
)

imports a design from disk

Parameters
databasethe data base where all data is to be added
sample_numberthe design number which is used to define the design ident string for all new data in the database
design_pathif this is empty, one takes the base_path. Else one takes this string instead of this->base_path
do_not_check_settingsIf this is true, then the contents of design_info will not be checked on validity before starting the import. This is helpful when importing multiple designs at once. If this settings object is configured to check on duplicates in the global database, then a duplicate would be found after import of the first design always leading to an error! In this case, set this parameter to true.
Returns
Returns an projection error report for each imported quantity. If no projection error occured during import, an empty quantity report will be returned. See DesignProjectionErrorReport for further details If an error appears during import, an exception is thrown. Nevertheless, the method tries to import as much data as possible before quit.

◆ meshMapper()

MeshMapperBase meshMapper ( )
Returns
a reference to the (in)compatible mesh mapper object

◆ meshMapperRef()

MeshMapperBase meshMapperRef ( )
Returns
a modifyable reference to the (in)compatible mesh mapper object

◆ removeFileFromList()

removeFileFromList ( string  filename)

removes all import data from item list which is associated with the sepcified file

Parameters
filenamethe file name of the file which is to be removed from import item list (exact match!).
Exceptions
std::exceptionif the file does not exist in the list.

◆ setBasePath()

setBasePath ( string  path)

sets a new base path. This includes changing the relative path definition of the already parsed files.

Parameters
paththe base path

◆ setImportIdent()

setImportIdent ( number  item,
string  ident,
Structure  database 
)

Sets the new ident used for import The ident is automatically modified to be unique and allowed. Further, the list of items is resorted!

Parameters
itemthe index in items vector
identthe new value of "imported_ident"
databasethe database (used for checking the ident on being allowed).

◆ setImportItem()

setImportItem ( number  item,
bool  do_import 
)

Sets if the item is to be imported There is no error checking!

Parameters
itemthe index in items vector
do_importthe new value of "do_import".

◆ setMeshMapper()

setMeshMapper ( MeshMapperBase  mapper)

sets the (in)compatible mesh mapper object

Parameters
mapperthe new mapping handler

Member Data Documentation

◆ base_path

string base_path

Specifies the base path. Must be changed only via setBasePath()!

base_path should always point to an existing absolute filesystem directory otherwise an exception may occour during program execution.

Connect with Ansys