Structure Class Reference
Last update: 16.07.2025The central data structure for SoS. More...
Public Types | |
| typedef std::pair< string, string > | StringPair |
| a string pair | |
| typedef std::list< StructureListener *> | StructureListenerList |
| A list of StructureListener pointers. | |
Public Member Functions | |
| bool | operator== (Structure other) |
Create database | |
Methods handling database life time | |
| Structure () | |
| default constructor | |
Meta-Information | |
destructor Methods to access some meta information | |
| std::size_t | savestateChanged () |
| std::size_t | savestateChangedRef () |
| string | savestateLastFileNameSDB () |
| string | savestateLastFileNameSDBRef () |
Access Properties | |
Methods to access and even modify properties | |
| string | name () |
| setName (string s) | |
Reference mesh | |
Methods to access and modify the reference mesh | |
| setReferenceNodeSet (string part_ident, string set_ident) | |
| setReferenceElementSet (string part_ident, string set_ident) | |
| setFixedNodeSet (string part_ident, string set_ident) | |
| addNodeSet (NodeSet component) | |
| addElementSet (ElementSet component) | |
| eraseNodeSet (string part_ident, string set_ident) | |
| eraseElementSet (string part_ident, string set_ident) | |
| MeshAssembly | referenceMesh () |
| MetaStructure | metaReferenceMesh () |
| Structure::StringPair | elementSet () |
| Structure::StringPair | nodeSet () |
| Structure::StringPair | fixedNodeSet () |
| IndexMapper | indexMapper () |
| IndexMapper | totalIndexMapper () |
| IndexMapper | totalBoundaryIndexMapper () |
| IndexMapper | freeIndexMapper () |
| toolbox::projection::DistanceField | distanceField () |
| bool | hasDistanceField () |
| clearDistanceField () | |
| setDistanceField (toolbox::projection::DistanceField distancefield) | |
Data Access | |
Methods to query and modify (insert, erase) data objects | |
| DataObjectContainer | data () |
| nodeData () | |
| This method has been removed, it always produces an ERROR message. Use data().filterType(sos.NODE_DATA) to get a DataObjectContainer containing all node data objects. (data():filterType(sos.NODE_DATA) in Lua) More... | |
| elementData () | |
| This method has been removed, it always produces an ERROR message. Use data().filterType(sos.ELEMENT_DATA) to get a DataObjectContainer containing all node data objects. (data():filterType(sos.ELEMENT_DATA) in Lua) More... | |
| scalarData () | |
| This method has been removed, it always produces an ERROR message. Use data().filterType(sos.SCALAR_DATA) to get a DataObjectContainer containing all node data objects. (data():filterType(sos.SCALAR_DATA) in Lua) More... | |
| insertData (DataObjectContainer data) | |
| RandomFieldContainer | randomFieldData () |
| RandomFieldContainer | randomFieldDataRef () |
| FMOPContainer | FMOPData () |
| FMOPContainer | FMOPDataRef () |
| ::MOPContainer | MOPData () |
| ::MOPContainer | MOPDataRef () |
| ::handler::ScalarMOPContainer | ScalarMOPData () |
| ::handler::ScalarMOPContainer | ScalarMOPDataRef () |
| macro::MacroManager | macroManager () |
| macro::MacroManager | macroManagerRef () |
| ::core::ValueTypeManager | valueTypeManager () |
| ::core::ValueTypeManager | valueTypeManagerRef () |
| bool | isAcademicStructure () |
| clear () | |
| Clears all data contained in this database. This includes the reference mesh, all (Field-)MOPs, random fields and all DataObjects contained in the DataObjectContainer. | |
| clearData () | |
| Clears all data, except for the reference mesh and named selections, contained in this database. This includes the reference mesh, all (Field-)MOPs, random fields and all DataObjects contained in the DataObjectContainer. | |
Operations | |
Miscellaneous methods | |
| deactivateErodedDesigns (number max_allowed=0) | |
| std::size_t | deactivateIncompleteDesigns () |
| setCoordinates (Matrix coordinates) | |
| Matrix | coordinates () |
| copyReferenceMesh (Structure dest) | |
| Copies the reference mesh (and active node and element sets) to the target. More... | |
| string | saveAsString () |
| Serialize the database and save it in a string instead on disk. More... | |
| loadFromString (string state) | |
| Load a serialization of the database from a string. More... | |
| loadFromString (string state, std::shared_ptr<::data_handler::CustomModelDeserializer > deserializer) | |
Detailed Description
The central data structure for SoS.
This class stores all data required to process and post-process Statistics on Structures.
Structure is a Listener. It implements callback functions listening to changes at DataObjectContainer instances.
- See also
- insertData
- eraseData ...
Data displayed in the user interface is stored in an unique instance of Structure. Access this unique instance:
database = sos.database()
Data stored:
- Reference mesh (referenceMesh())
- Field and scalar data (nodeData(), elementData(), scalarData())
- Field-MOPs (FMOPData())
- Random fields (RandomFieldData())
- Macros (chunkManager())
The object returned by scalarData() is a DataObjectContainer. DataObjectContainer provides read access to all DataObjects contained in the filter. DataObjectContainer provides database write access, allowing the insertion of a DataObject.
Each DataObject contained in a DataObjectContainer is uniquely identified by a DataObjectKey. A DataObjectKey consists of a quantity identifier and a design identifier.
- Note
- The same syntax applies to all data types: node, element and scalar data.
- [Scalar/Node/Element]DataObject read access script examples.
Access specific DataObject.
key = sos.DataObjectKey("1", "yield_stress")
dataObject1 = sos.database().scalarData().find(key)
dataObject2 = sos.database().scalarData().find("2","yield_stress")
value = dataObject1.getData()[0]
- Note
- Individual DataObjects, as returned by the find() method, are a lightweight class (C++ pointer). No (field) data is copied when assigning DataObjects.
Using filters. Every filter method returns another filter, for an easy combination of filters.
filterAllSamples = sos.database().scalarData().samples() dataObjects = filterAllSamples.generateVector() dataObject1 = dataObjects[0]filterYieldStress = filterAllSamples.filterQuantity("yield_*", true) #true: match regular expression designs = filterYieldStress.designs() #a vector of design identifiers
filterResponses = sos.database().nodeData().filterQuantity("thickness").responses() filterCoPs = filterResponses.filterDesign("CoP", true) #true: match regular expression
- [Scalar/Node/Element]DataObject write access script examples. Not exhaustive, also see DataObjectContainer.
dataObject = sos.createScalarDataObject(6.626e-34) key = sos.DataObjectKey("1", "quantum") sos.database().scalarData().insert(key, dataObject)sos.database().scalarData().erase(key)
sos.database().scalarData().eraseQuantity("quantum")
sos.database().scalarData().eraseDesign("1")
- Access Field-MOP (also see FMOPContainer, FMOPGroup)
fmop = sos.database().FMOPData().findFMOP("thickness",sos.ELEMENT_DATA) inputSensitivites = fmop.inputCoP() #vector of input sensitivities (CoPs)
inputs = fmop.inputIdentsVector()
- Access Random Field (also see RandomFieldContainer, RandomFieldGroup)
rf = sos.database().RandomFieldContainer().findGroup("thickness", sos.ELEMENT_DATA) totalExplainedVariation = rf.getVariationTotal() amplitudeIdentifier1 = rf.amplitudeIdent(0)
- Access/Create/Load Macros (also see MacroManager)
\note Currently only Lua macros are supported.
print(sos.database().macroManager().size()) #empty by default, stores user created macros functionEvaluateFieldMOP = sos.defaultMacroManager().get("elementApproxFieldMOP") print(functionEvaluateFieldMOP.getMacro())
myFunction = sos.MacroFunction() myFunction.setIdent("helloWorld") myFunction.setShortName("print 'Hello world!'") myFunction.setMacro("print('Hello world!')") sos.database().MacroManager().add(myFunction)
sos.loadMacros() sos_macros.helloWorld() #prints 'Hello world!'
Member Function Documentation
◆ addElementSet()
| addElementSet | ( | ElementSet | component | ) |
◆ addNodeSet()
| addNodeSet | ( | NodeSet | component | ) |
◆ clearDistanceField()
| clearDistanceField | ( | ) |
◆ coordinates()
| Matrix coordinates | ( | ) |
◆ copyReferenceMesh()
| copyReferenceMesh | ( | Structure | dest | ) |
Copies the reference mesh (and active node and element sets) to the target.
- Parameters
-
dest the destination database.
◆ data()
| DataObjectContainer data | ( | ) |
◆ deactivateErodedDesigns()
| deactivateErodedDesigns | ( | number | max_allowed = 0 | ) |
◆ deactivateIncompleteDesigns()
| std::size_t deactivateIncompleteDesigns | ( | ) |
◆ distanceField()
| toolbox::projection::DistanceField distanceField | ( | ) |
◆ elementData()
| elementData | ( | ) |
This method has been removed, it always produces an ERROR message. Use data().filterType(sos.ELEMENT_DATA) to get a DataObjectContainer containing all node data objects. (data():filterType(sos.ELEMENT_DATA) in Lua)
◆ elementSet()
| Structure::StringPair elementSet | ( | ) |
◆ eraseElementSet()
| eraseElementSet | ( | string | part_ident, |
| string | set_ident | ||
| ) |
◆ eraseNodeSet()
| eraseNodeSet | ( | string | part_ident, |
| string | set_ident | ||
| ) |
◆ fixedNodeSet()
| Structure::StringPair fixedNodeSet | ( | ) |
◆ FMOPData()
| FMOPContainer FMOPData | ( | ) |
◆ FMOPDataRef()
| FMOPContainer FMOPDataRef | ( | ) |
◆ freeIndexMapper()
| IndexMapper freeIndexMapper | ( | ) |
◆ hasDistanceField()
| bool hasDistanceField | ( | ) |
◆ indexMapper()
| IndexMapper indexMapper | ( | ) |
◆ insertData()
| insertData | ( | DataObjectContainer | data | ) |
◆ isAcademicStructure()
| bool isAcademicStructure | ( | ) |
◆ loadFromString()
| loadFromString | ( | string | state | ) |
Load a serialization of the database from a string.
- Parameters
-
state The string to serialize from
◆ macroManager()
| macro::MacroManager macroManager | ( | ) |
◆ macroManagerRef()
| macro::MacroManager macroManagerRef | ( | ) |
◆ metaReferenceMesh()
| MetaStructure metaReferenceMesh | ( | ) |
◆ MOPData()
| ::MOPContainer MOPData | ( | ) |
◆ MOPDataRef()
| ::MOPContainer MOPDataRef | ( | ) |
◆ name()
| string name | ( | ) |
◆ nodeData()
| nodeData | ( | ) |
This method has been removed, it always produces an ERROR message. Use data().filterType(sos.NODE_DATA) to get a DataObjectContainer containing all node data objects. (data():filterType(sos.NODE_DATA) in Lua)
◆ nodeSet()
| Structure::StringPair nodeSet | ( | ) |
◆ operator==()
| bool operator== | ( | Structure | other | ) |
Primarily used to test the serialization
- Parameters
-
other the object to be compared
- Returns
- true if both objects have the same contents
◆ randomFieldData()
| RandomFieldContainer randomFieldData | ( | ) |
◆ randomFieldDataRef()
| RandomFieldContainer randomFieldDataRef | ( | ) |
◆ referenceMesh()
| MeshAssembly referenceMesh | ( | ) |
◆ saveAsString()
| string saveAsString | ( | ) |
Serialize the database and save it in a string instead on disk.
- Returns
- The string
◆ savestateChanged()
| std::size_t savestateChanged | ( | ) |
- Returns
- A const-reference to Pimpl::m_savestate_changed
◆ savestateChangedRef()
| std::size_t savestateChangedRef | ( | ) |
- Returns
- A reference to Pimpl::m_savestate_changed
◆ savestateLastFileNameSDB()
| string savestateLastFileNameSDB | ( | ) |
- Returns
- a reference to m_savestate_last_file_name_sdb
◆ savestateLastFileNameSDBRef()
| string savestateLastFileNameSDBRef | ( | ) |
- Returns
- a non- reference to m_savestate_last_file_name_sdb
◆ scalarData()
| scalarData | ( | ) |
This method has been removed, it always produces an ERROR message. Use data().filterType(sos.SCALAR_DATA) to get a DataObjectContainer containing all node data objects. (data():filterType(sos.SCALAR_DATA) in Lua)
◆ ScalarMOPDataRef()
| ::handler::ScalarMOPContainer ScalarMOPDataRef | ( | ) |
◆ setCoordinates()
| setCoordinates | ( | Matrix | coordinates | ) |
◆ setDistanceField()
| setDistanceField | ( | toolbox::projection::DistanceField | distancefield | ) |
◆ setFixedNodeSet()
| setFixedNodeSet | ( | string | part_ident, |
| string | set_ident | ||
| ) |
◆ setName()
| setName | ( | string | s | ) |
◆ setReferenceElementSet()
| setReferenceElementSet | ( | string | part_ident, |
| string | set_ident | ||
| ) |
◆ setReferenceNodeSet()
| setReferenceNodeSet | ( | string | part_ident, |
| string | set_ident | ||
| ) |
◆ totalBoundaryIndexMapper()
| IndexMapper totalBoundaryIndexMapper | ( | ) |
◆ totalIndexMapper()
| IndexMapper totalIndexMapper | ( | ) |
◆ valueTypeManager()
| ::core::ValueTypeManager valueTypeManager | ( | ) |
◆ valueTypeManagerRef()
| ::core::ValueTypeManager valueTypeManagerRef | ( | ) |