Skip to main content

optiSLang 3D Postprocessing Script API 2025 R1

DataObjectContainer Class Reference

Last update: 16.07.2025

A general container for vector data. More...

Public Types

typedef std::vector< DataObjectKeydata_object_key_vector_type
 A vector of DataObjectKey.
 
typedef std::vector< string > string_vector_type
 A vector of strings.
 
typedef std::vector< Design > TDesignContainer
 A vector of all designs.
 
typedef std::map< string, size_t > TDesignMap
 A map mapping design ID to a an index of the vector of designs.
 

Public Member Functions

DataObjectPtr __getitem__ (int idx) const
 returns the i-th element of the current filter More...
 
string __str__ ()
 provides the print() method for this class in SWIG bindings More...
 
DataObjectContainer active ()
 Filter for active data objects. More...
 
DataObjectContainer depInputs ()
 Filter for data objects marked as DOE dependent parameters. More...
 
string_vector_type designIdents ()
 generates a vector of strings containing all design idents being part in this filter The ordering of the vector corresponds to the ordering of the ouput of generateVector() More...
 
string_vector_type designs ()
 Generates a vector of strings containing all design idents being part in this filter. More...
 
 fillValueTypeManager (::core::ValueTypeManager manager)
 Fill ValueTypeManager with all ValueTypes contained in this DataObjectContainer. More...
 
DataObjectContainer filterDesign (string design_id, bool match_regex=false)
 Returns the subset of data objects where the design ID is equal to the given ID. More...
 
DataObjectContainer filterDesign (string_vector_type ids)
 Returns the subset of data objects where the design ID is equal to one of the given ID list. Design IDs not found in the current DataObjectContainer are skipped. More...
 
DataObjectContainer filterID (string design_id, string quantity_id)
 Returns a set containing a single or no data object, defined by design and quantity ID. More...
 
DataObjectContainer filterID (DataObjectKey key)
 Returns container containing a single DataObject. More...
 
DataObjectContainer filterID (data_object_key_vector_type key_vector)
 Returns a container containing all objects in key_vector. Throws an ERROR if key_vector contains duplicate DataObjectKeys. More...
 
DataObjectContainer filterQuantity (string quantity_id, bool match_regex=false)
 Returns the subset of data objects where the quantity ident is equal to the given ID. More...
 
DataObjectContainer filterQuantity (string_vector_type ids)
 Returns the subset of data objects where the quantity ID is equal to one of the given ID list. Quantity IDs not found in the current DataObjectContainer are skipped. More...
 
DataObjectContainer filterSerializable ()
 Get a subset of all data objects which can be serialized These are all objects which do not contain any NaN or infinity numbers. More...
 
DataObjectContainer filterType (dataobject_types type)
 Returns a container containing objects of a single type. More...
 
DataObjectContainer filterWithoutDesign (string design_id)
 Returns the subset of data objects where the design ID is NOT equal to the given ID. More...
 
DataObjectContainer filterWithoutID (string design_id, string quantity_id)
 Returns the subset of data objects NOT containing the data object defined by ID and quantity ID. More...
 
DataObjectContainer filterWithoutQuantity (string quantity_id)
 Returns the subset of data objects where the quantity ID is NOT equal to the given ID. More...
 
DataObjectContainer fromFile ()
 Filter for data objects which were imported from a file. More...
 
DataObjectContainer inactive ()
 Filter for inactive data objects. More...
 
DataObjectContainer inputs ()
 Filter for data objects marked as DOE input parameters. More...
 
DataObjectContainer nonSamples ()
 Filter for non-sample data objects. More...
 
DataObjectContainer notFromFile ()
 Filter for data objects which were NOT imported from a file. More...
 
DataObjectContainer operator* (DataObjectContainer other)
 performs the set intersection More...
 
DataObjectContainer operator+ (DataObjectContainer other)
 performs the set union More...
 
DataObjectContainer operator/ (DataObjectContainer other)
 performs the set difference More...
 
bool operator== (DataObjectContainer other)
 
DataObjectPtr operator[] (int idx)
 returns the i-th element of the current filter More...
 
string_vector_type quantities ()
 Generates a vector of strings containing all quantity idents being part in this filter. More...
 
string_vector_type quantityIdents ()
 generates a vector of strings containing all quantity idents being part in this filter The ordering of the vector corresponds to the ordering of the ouput of generateVector() More...
 
DataObjectContainer responses ()
 Filter for data objects marked as DOE responses. More...
 
DataObjectContainer samples ()
 Filter for sample data objects. More...
 
 setActive (bool active)
 changes the activity flag of all contained objects More...
 
Create DataObjectContainer

Methods handling data object life time

 DataObjectContainer ()
 default constructor (creates an empty container)
 
 DataObjectContainer (DataObjectContainer other)
 copy constructor More...
 
 DataObjectContainer (TDesignContainer designs, TDesignMap design_map, std::map< dataobject_types, number > dimension)
 Create container from its components.
 
DataObjectContainer operator= (DataObjectContainer other)
 destructor More...
 
Element Access

Methods to query and especially modify (insert, erase) data container state

bool exists (string design, string quantity)
 Check whether a DataObject of given design ID and quantity ID exists. More...
 
bool exists (DataObjectKey key)
 Check whether a DataObject with the given DataObjectKey exists. More...
 
bool designExists (string design)
 Check whether any DataObject with the given design ID exists. Computational complexity is of order O( log N_designs ). More...
 
bool quantityExists (string quantity)
 Check whether any DataObject with the given quantity ID exists. Worst case computational complexity is of order O( N_designs * log N_quantities) More...
 
DataObjectPtr find (string design, string quantity)
 Gets the data object with given data key. More...
 
DataObjectPtr find (DataObjectKey key)
 Gets the data object with given data key. More...
 
bool checkInsert (DataObjectKey key, bool overwrite_existing=false)
 checks if an item can be inserted More...
 
void insert (DataObjectKey key, DataObjectPtr item)
 inserts a new data object. Assigns ValueTypeDouble (named after key.quantity()) to the inserted data object. More...
 
void insert (DataObjectKey key, DataObjectPtr item, std::shared_ptr<::core::ValueType > value_type)
 inserts a new data object. More...
 
 insert (DataObjectContainer other, bool update_description=false, Structure *database=0, bool overwrite_existing=false)
 inserts a set of data objects contained in another container More...
 
 erase (DataObjectKey key)
 erases a data object from the container More...
 
 erase (DataObjectContainer container)
 Erases the DataObjects contained in the DataObjectContainer passed as the argument, from this container. DataObjects not contained in this container, are skipped. More...
 
 eraseQuantity (string ident)
 erases all objects (and sets "needs update" flag of its dependencies) with given quantity ident More...
 
 eraseDesign (string ident)
 erases all objects (and sets "needs update" flag of its dependencies) with given design ident More...
 
 renameDesign (string from_name, string to_name)
 renames all design idents More...
 
 renameQuantity (string from_name, string to_name)
 renames all quantity idents More...
 
Capacity
number size ()
 Get the number of data objects contained in this DataObjectContainer. More...
 
bool empty ()
 True, if the DataObjectContainer contains no data objects. More...
 
 clear ()
 clears all data objects in the container
 

Friends

class DataObject
 

Operations

Miscellaneous methods

number dimension (dataobject_types type)
 
static string_vector_type sortDesignIdents (string_vector_type string)
 Sorts the given list of design IDs. More...
 
static string sampleFormatString ()
 
static bool isSampleDesignIdent (string s)
 
static int getSampleNumber (string s)
 
static string getSampleIdent (int number)
 
static bool isReservedResultQuantityIdent (string s)
 

Detailed Description

A general container for vector data.

This is a container for all data objects of the same type which may be used within SoS. A vector data object is described through a 'design' identifier and a 'quantity' identifier:

quantity
A 'quantity' may be the x-direction of the stress tensor, the plastic strain or any other scalar physical quantity.
design
A 'design' is a single instantiation of the same quantity, i.e. if one has several measurements of the same quantity, each measurement represents a single design.

Throughout the workflow of SoS one may add data sets which may be interpreted in terms of new designs or quantities. For example, the mean value or the standard deviation of a quantity is computed from a set of designs of the same quantity, and can be interpreted as a new design. Furthermore, one may define additional quantities, for example compute the von Mises equivalent stress from the 6-dimensional stress tensor (i.e. from 6 different quantities).

DataObjectContainer is a Sender. It communicates to it's Listeners (Qt Datatables, Structure) when its DataObjects are changed (insert, erase, rename, change activity)

Constructor & Destructor Documentation

◆ DataObjectContainer()

copy constructor

Parameters
otherthe container to be copied

Member Function Documentation

◆ __getitem__()

DataObjectPtr __getitem__ ( int  idx) const

returns the i-th element of the current filter

Parameters
idxthe index (0..size-1)
Returns
a data object pointer
Exceptions
exceptionif the index is not valid

◆ __str__()

string __str__ ( )

provides the print() method for this class in SWIG bindings

Returns
a message to be printed when print(this) is called

◆ active()

DataObjectContainer active ( )

Filter for active data objects.

Returns
returns the subset of active data objects

◆ checkInsert()

bool checkInsert ( DataObjectKey  key,
bool  overwrite_existing = false 
)

checks if an item can be inserted

Parameters
keythe key to be tested.
overwrite_existingIf true it returns true. Else it returns true if key does not exist in the data base.
Returns
If the key is invalid, it returns false. returns true if key does not exist in the data base.

◆ depInputs()

DataObjectContainer depInputs ( )

Filter for data objects marked as DOE dependent parameters.

Returns
returns the subset of data objects marked as DOE dependent parameters

◆ designExists()

bool designExists ( string  design)

Check whether any DataObject with the given design ID exists. Computational complexity is of order O( log N_designs ).

Parameters
designThe design ID
Returns
True if a DataObject with the given design ID exists.

◆ designIdents()

string_vector_type designIdents ( )

generates a vector of strings containing all design idents being part in this filter The ordering of the vector corresponds to the ordering of the ouput of generateVector()

Returns
the vector contained of design ident strings

◆ designs()

string_vector_type designs ( )

Generates a vector of strings containing all design idents being part in this filter.

Each design ident appears only once in the list. You can use this, for example, to find out which design names are selected.

Returns
The vector contained of design ident strings

◆ dimension()

number dimension ( dataobject_types  type)
Returns
returns the dimension of the data objects of given type, if any
Parameters
typeDataObject type of which the dimension is returned

◆ empty()

bool empty ( )

True, if the DataObjectContainer contains no data objects.

Returns
returns true, if the DataObjectContainer contains no data objects

◆ erase() [1/2]

erase ( DataObjectKey  key)

erases a data object from the container

Parameters
keythe key of the data object to be removed. Throws an exception if it does not exist.

◆ erase() [2/2]

erase ( DataObjectContainer  container)

Erases the DataObjects contained in the DataObjectContainer passed as the argument, from this container. DataObjects not contained in this container, are skipped.

Parameters
containerThe container of the data object to be removed.

◆ eraseDesign()

eraseDesign ( string  ident)

erases all objects (and sets "needs update" flag of its dependencies) with given design ident

Parameters
identthe ident
databasethe database wherein this container and all slaves and masters are stored

◆ eraseQuantity()

eraseQuantity ( string  ident)

erases all objects (and sets "needs update" flag of its dependencies) with given quantity ident

Parameters
identthe ident
databasethe database wherein this container and all slaves and masters are stored

◆ exists() [1/2]

bool exists ( string  design,
string  quantity 
)

Check whether a DataObject of given design ID and quantity ID exists.

Parameters
designThe design ID
quantityThe quantity ID
Returns
true, if the requested DataObject exists.

◆ exists() [2/2]

bool exists ( DataObjectKey  key)

Check whether a DataObject with the given DataObjectKey exists.

Returns
true, if the given key exists
Parameters
keythe key to search for

◆ fillValueTypeManager()

fillValueTypeManager ( ::core::ValueTypeManager  manager)

Fill ValueTypeManager with all ValueTypes contained in this DataObjectContainer.

Note
Convention: one ValueType per quantity. Ignores DataObjects with empty m_value_type shared_ptr.
Parameters
managerThe ValueTypeManager to be filled.

◆ filterDesign() [1/2]

DataObjectContainer filterDesign ( string  design_id,
bool  match_regex = false 
)

Returns the subset of data objects where the design ID is equal to the given ID.

Parameters
design_idThe design ID to filter for.
match_regexIf this is true then the given ident is a regular expression. The returned container contains all data objects that MATCH this expression.
Returns
The resulting DataObjectContainer

◆ filterDesign() [2/2]

DataObjectContainer filterDesign ( string_vector_type  ids)

Returns the subset of data objects where the design ID is equal to one of the given ID list. Design IDs not found in the current DataObjectContainer are skipped.

Parameters
idsa vector of design IDs
Returns
the resulting filter object

◆ filterID() [1/3]

DataObjectContainer filterID ( string  design_id,
string  quantity_id 
)

Returns a set containing a single or no data object, defined by design and quantity ID.

Parameters
design_idthe design ID string
quantity_idthe quantity ID string
Returns
the resulting container

◆ filterID() [2/3]

Returns container containing a single DataObject.

Parameters
keyThe DataObjectKey to filter for.
Returns
the resulting container

◆ filterID() [3/3]

Returns a container containing all objects in key_vector. Throws an ERROR if key_vector contains duplicate DataObjectKeys.

Parameters
key_vectorA vector of unique DataObjectKeys.
Returns
the resulting container

◆ filterQuantity() [1/2]

DataObjectContainer filterQuantity ( string  quantity_id,
bool  match_regex = false 
)

Returns the subset of data objects where the quantity ident is equal to the given ID.

Parameters
quantity_idThe quantity ID to filter for.
match_regexIf this is true then the given ident is a regular expression. The filter will contain all objects that MATCH this expression.
Returns
the resulting filter object

◆ filterQuantity() [2/2]

DataObjectContainer filterQuantity ( string_vector_type  ids)

Returns the subset of data objects where the quantity ID is equal to one of the given ID list. Quantity IDs not found in the current DataObjectContainer are skipped.

Parameters
idsa vector of quantity IDs
Returns
the resulting filter object

◆ filterSerializable()

DataObjectContainer filterSerializable ( )

Get a subset of all data objects which can be serialized These are all objects which do not contain any NaN or infinity numbers.

Returns
The resulting DataObjectContainer

◆ filterType()

DataObjectContainer filterType ( dataobject_types  type)

Returns a container containing objects of a single type.

Parameters
typethe data object type (node/element/scalar) to filter for.
Returns
the resulting container

◆ filterWithoutDesign()

DataObjectContainer filterWithoutDesign ( string  design_id)

Returns the subset of data objects where the design ID is NOT equal to the given ID.

Parameters
design_idthe design ID to be filtered for.
Returns
the resulting filter object

◆ filterWithoutID()

DataObjectContainer filterWithoutID ( string  design_id,
string  quantity_id 
)

Returns the subset of data objects NOT containing the data object defined by ID and quantity ID.

Parameters
design_idthe design ID string to be filtered for
quantity_idthe quantity ID string to be filtered for
Returns
the resulting filter object

◆ filterWithoutQuantity()

DataObjectContainer filterWithoutQuantity ( string  quantity_id)

Returns the subset of data objects where the quantity ID is NOT equal to the given ID.

Parameters
design_idthe quantity ID to be filtered for
Returns
the resulting filter object

◆ find() [1/2]

DataObjectPtr find ( string  design,
string  quantity 
)

Gets the data object with given data key.

Parameters
designThe design ID
quantityThe quantity ID
Returns
a pointer to the requested object
Exceptions
exceptionif the object does not exist

◆ find() [2/2]

Gets the data object with given data key.

Parameters
keyThe DataObjectKey of the data object to be found
Returns
a pointer to the requested object
Exceptions
exceptionif the object does not exist

◆ fromFile()

DataObjectContainer fromFile ( )

Filter for data objects which were imported from a file.

Returns
returns the subset of data objects which were imported from a file

◆ getSampleIdent()

static string getSampleIdent ( int  number)
static
Returns
the design string ident of the given sample number
Parameters
numberthe number to be converted

◆ getSampleNumber()

static int getSampleNumber ( string  s)
static
Returns
the sample number which is given as a design ident string
Parameters
sthe string to be converted

◆ inactive()

DataObjectContainer inactive ( )

Filter for inactive data objects.

Returns
returns the subset of inactive data objects

◆ inputs()

DataObjectContainer inputs ( )

Filter for data objects marked as DOE input parameters.

Returns
returns the subset of data objects marked as DOE input parameters

◆ insert() [1/3]

void insert ( DataObjectKey  key,
DataObjectPtr  item 
)

inserts a new data object. Assigns ValueTypeDouble (named after key.quantity()) to the inserted data object.

Parameters
itema shared pointer to the data object to be inserted.
Returns
An iterator to the newly added data object
Exceptions
std::exceptionIf the key already exists in the database

◆ insert() [2/3]

void insert ( DataObjectKey  key,
DataObjectPtr  item,
std::shared_ptr<::core::ValueType >  value_type 
)

inserts a new data object.

Parameters
itema shared pointer to the data object to be inserted.
value_typeThe ValueType shared resource of the data object to be inserted.
Returns
An iterator to the newly added data object
Exceptions
std::exceptionIf the key already exists in the database

◆ insert() [3/3]

insert ( DataObjectContainer  other,
bool  update_description = false,
Structure database = 0,
bool  overwrite_existing = false 
)

inserts a set of data objects contained in another container

Parameters
update_descriptionif true, then this method calls
See also
generateDescription for each inserted object!
Parameters
databaseif update_description is true, then update_description must point to the database all data refers to
otherthe container which has all objects to be inserted
overwrite_existingif this is true, then any possibly existing object will be deleted before existing the new one (else an error appears if any object with same ident already exists). If true, the
See also
database must be a valid pointer.

◆ isReservedResultQuantityIdent()

static bool isReservedResultQuantityIdent ( string  s)
static
Returns
true if the given quantity ident is reserved for results (hence it cannot be imported from file)
Parameters
sthe string to test

◆ isSampleDesignIdent()

static bool isSampleDesignIdent ( string  s)
static
Returns
true if the given design ident string can be interpreted as a sample number
Parameters
sthe string to be checked

◆ nonSamples()

DataObjectContainer nonSamples ( )

Filter for non-sample data objects.

Returns
returns the subset of data objects NOT having sample string IDs

◆ notFromFile()

DataObjectContainer notFromFile ( )

Filter for data objects which were NOT imported from a file.

Returns
returns the subset of data objects which were NOT imported from a file

◆ operator*()

performs the set intersection

Parameters
otherthe other filter
Returns
returns the intersection of this and other

◆ operator+()

performs the set union

Parameters
otherthe other filter
Returns
returns the union of this and other

◆ operator/()

performs the set difference

Parameters
otherthe other filter
Returns
returns the difference of this minus other

◆ operator=()

destructor

the assignment operator It copies all data and callbacks, but no mutexes (thread locks)

Parameters
otherthe source
Returns
a reference to this object

◆ operator==()

bool operator== ( DataObjectContainer  other)
Returns
true if both objects contain objects with identical content
Parameters
otherthe container to be compared This equal content means, that the pointer do not necessarily point to the same address, but the objects behind these addresses have the same contents. Both containers may contain copies of the same data sets. Then they are considered to be equal.

◆ operator[]()

DataObjectPtr operator[] ( int  idx)

returns the i-th element of the current filter

Parameters
idxthe index (0..size-1)
Returns
a data object pointer
Exceptions
exceptionif the index is not valid

◆ quantities()

string_vector_type quantities ( )

Generates a vector of strings containing all quantity idents being part in this filter.

Each quantity ident appears only once in the list. You can use this, for example, to find out which quantity names are selected.

Returns
The vector contained of quantity ident strings

◆ quantityExists()

bool quantityExists ( string  quantity)

Check whether any DataObject with the given quantity ID exists. Worst case computational complexity is of order O( N_designs * log N_quantities)

Parameters
quantityThe design ID
Returns
True if a DataObject with the given quantity ID exists.

◆ quantityIdents()

string_vector_type quantityIdents ( )

generates a vector of strings containing all quantity idents being part in this filter The ordering of the vector corresponds to the ordering of the ouput of generateVector()

Returns
the vector contained of quantity ident strings

◆ renameDesign()

renameDesign ( string  from_name,
string  to_name 
)

renames all design idents

Note
Creates copies of the DataObjects to be renamed and removes the original DataObjects from this DataObjectContainer. This favors data consistency over performance.
Parameters
from_namethe original design ident
to_namethe new design ident. If it cannot be renamed (for example, if the names already exist in the data base) an exception is thrown. The data base may remain unchanged. After the renaming, the ordering of the data base will be adjusted to the new naming.

◆ renameQuantity()

renameQuantity ( string  from_name,
string  to_name 
)

renames all quantity idents

Note
Creates copies of the DataObjects to be renamed and removes the original DataObjects from this DataObjectContainer. This favors data consistency over performance.
Parameters
from_namethe original design ident
to_namethe new quantity ident. If it cannot be renamed (for example, if the names already exist in the data base) an exception is thrown. The data base may remain unchanged. After the renaming, the ordering of the data base will be adjusted to the new naming.

◆ responses()

DataObjectContainer responses ( )

Filter for data objects marked as DOE responses.

Returns
returns the subset of data objects marked as DOE responses

◆ sampleFormatString()

static string sampleFormatString ( )
static
Returns
A copy of the
See also
sample_ident_format_string

◆ samples()

DataObjectContainer samples ( )

Filter for sample data objects.

Returns
returns the subset of data objects having sample string IDs

◆ setActive()

setActive ( bool  active)

changes the activity flag of all contained objects

Parameters
activeis true if the objects are to be set active, false if inactive.

◆ size()

number size ( )

Get the number of data objects contained in this DataObjectContainer.

Returns
the number of objects contained in this DataObjectContainer

◆ sortDesignIdents()

static string_vector_type sortDesignIdents ( string_vector_type  string)
static

Sorts the given list of design IDs.

Parameters
stringa vector of unique design ID strings
Returns
An ordered vector of IDs. Numbers are sorted according to
See also
compareDesignIdents

Connect with Ansys