Skip to main content

optiSLang 3D Postprocessing Script API 2025 R1

MetaStructure Class Reference

Last update: 16.07.2025

Defines a meta structure which contains all data that is used to create a finite element mesh. More...

Public Member Functions

 add (Part part)
 Adds the given part to the structure. More...
 
 add (Section section)
 adds the given section More...
 
 add (Material material)
 adds the given material law definition More...
 
 add (ElementSet elementset)
 adds the given element set More...
 
 add (NodeSet nodeset)
 adds the given node set More...
 
 add (Data meta)
 adds all node/element data from the given meta structure to this one. More...
 
 add (MetaStructure meta)
 adds all contents of the given MetaStructure More...
 
 addAndMerge (Mesh meta)
 Adds the mesh information from the given meta structure to this one such that both will be merged. More...
 
 addElementData (string ident, ElementData data)
 adds the given element data More...
 
 addPointData (string ident, PointData data)
 adds the given node data More...
 
 addScalarData (string ident, ScalarData data)
 adds the given scalar data More...
 
Data data ()
 
bool emptyData ()
 
bool emptyMesh ()
 
std::list< string > isCompatible (MetaStructure other)
 Returns an empty list if both meshes are compatble. More...
 
bool isFEM ()
 returns true if the mesh is of type MESH_FEM3D
 
bool isGrid1D ()
 returns true if the grid is of type MESH_RAY
 
bool isGrid2D ()
 returns true if the grid is of type MESH_PIXEL
 
bool isGrid3D ()
 returns true if the grid is of type MESH_VOXEL
 
bool isMap2D ()
 returns true if the grid is of type MESH_PIXEL and the parameter idents are set
 
bool isMap3D ()
 returns true if the grid is of type MESH_VOXEL and the parameter idents are set
 
bool isSubsetOf (MetaStructure other)
 
Mesh mesh ()
 
Mesh meshRef ()
 
 MetaStructure ()
 creates an empty meta structure
 
 MetaStructure (MetaStructure other, bool copy_mesh=true, bool copy_data=true)
 copy constructor More...
 
MetaStructure operator= (MetaStructure other)
 overrides the assignment operator This object will contain the same data as other (copying data). The operator checks if other and this object are actually the same object - if so, it does nothing More...
 
bool operator== (MetaStructure other)
 returns true if both objects have the same contents primarily used to test the serialization More...
 
 setGridIdents (string x="", string y="", string z="")
 sets the idents of a map abscissa This function must be called AFTER setTYpeVoxel or setTypePixel More...
 
 setMeshTypeFEM ()
 sets the mesh type to MESH_FEM3D
 
 setMeshTypePixel (number nx, number ny)
 sets the mesh type to MESH_PIXEL More...
 
 setMeshTypeRay (number nx)
 sets the mesh type to MESH_RAY More...
 
 setMeshTypeVoxel (number nx, number ny, number nz)
 sets the mesh type to MESH_VOXEL More...
 

Detailed Description

Defines a meta structure which contains all data that is used to create a finite element mesh.

The following ideas lead to the concept:

  • abstract general format (does not change with each new SoS version)
  • only definition data without logic checks; If the mesh is "valid" will be tested outside of this meta structure
  • compact memory footprint: Try to use as little space as possible since the structure may be in memory during the whole application lifetime

When using serialization, one should only store meta structures which contain meshes, but no data objects. Reason: Since data objects are inetrnally stored by n-tuples of numbers, the time to load/save is very long. Use block formats to improve serialization speed.

Constructor & Destructor Documentation

◆ MetaStructure()

MetaStructure ( MetaStructure  other,
bool  copy_mesh = true,
bool  copy_data = true 
)

copy constructor

Parameters
otherthe meta structure to be copied from
copy_meshif this is false, no mesh information are copied
copy_dataif this is false, no data objects are copied

Member Function Documentation

◆ add() [1/7]

add ( Part  part)

Adds the given part to the structure.

It changes the index of the part according to the current number of contained parts. The index starts at 0. If the part already exists in the data base (i.e. it has the same string ident), then the method tries to add the part contents to the existing part.

Parameters
partthe full initialized part to be added
Exceptions
Anexception is thrown if the part to be added overlaps the already contained parts (has same node/element indices).

◆ add() [2/7]

add ( Section  section)

adds the given section

Parameters
sectionthe section to be added

◆ add() [3/7]

add ( Material  material)

adds the given material law definition

Parameters
materialthe material to be added

◆ add() [4/7]

add ( ElementSet  elementset)

adds the given element set

Parameters
elementsetthe element set to be added

◆ add() [5/7]

add ( NodeSet  nodeset)

adds the given node set

Parameters
nodesetthe node set to be added

◆ add() [6/7]

add ( Data  meta)

adds all node/element data from the given meta structure to this one.

Parameters
metathe data structure containing the source data No error checking on compatibility with the mesh!

◆ add() [7/7]

add ( MetaStructure  meta)

adds all contents of the given MetaStructure

Parameters
metathe data structure containing the source data

◆ addAndMerge()

addAndMerge ( Mesh  meta)

Adds the mesh information from the given meta structure to this one such that both will be merged.

Parameters
metathe data structure containing the source data
Exceptions
anexception is thrown if any duplicate nodes/elements exist. No error checking on compatibility, etc.

◆ addElementData()

addElementData ( string  ident,
ElementData  data 
)

adds the given element data

Parameters
identthe ident of the node data
datathe data container to be added

◆ addPointData()

addPointData ( string  ident,
PointData  data 
)

adds the given node data

Parameters
identthe ident of the node data
datathe data container to be added

◆ addScalarData()

addScalarData ( string  ident,
ScalarData  data 
)

adds the given scalar data

Parameters
identthe ident of the scalar data
datathe data container to be added

◆ data()

Data data ( )
Returns
m_data

◆ emptyData()

bool emptyData ( )
Returns
true if there are no data items in this object

◆ emptyMesh()

bool emptyMesh ( )
Returns
true if there is no structural data in this object

◆ isCompatible()

std::list< string > isCompatible ( MetaStructure  other)

Returns an empty list if both meshes are compatble.

Compatibility means that mesh data of the one mesh can be applied directly to the other mesh.

Parameters
otherThe other mesh
Returns
A string list listing differences. This list is empty if:
  • both meshes are empty.
  • both meshes are identical
  • both meshes differ only in the point coordinates or set definitions Its size is otherwise not zero.

◆ isSubsetOf()

bool isSubsetOf ( MetaStructure  other)
Returns
Returns true if this mesh is a subset of the other

That means, that some nodes or elements might have been deleted. Still the method will return true. Only parts, nodes, elements and sections are tested on subset. The other mesh components are tested on equality!

Parameters
otherthe other mesh

◆ mesh()

Mesh mesh ( )
Returns
m_mesh

◆ meshRef()

Mesh meshRef ( )
Returns
m_mesh

◆ operator=()

MetaStructure operator= ( MetaStructure  other)

overrides the assignment operator This object will contain the same data as other (copying data). The operator checks if other and this object are actually the same object - if so, it does nothing

Parameters
otherthe source object
Returns
a reference to *this

◆ operator==()

bool operator== ( MetaStructure  other)

returns true if both objects have the same contents primarily used to test the serialization

Parameters
otherthe object to be compared
Returns
true if both are equal

◆ setGridIdents()

setGridIdents ( string  x = "",
string  y = "",
string  z = "" 
)

sets the idents of a map abscissa This function must be called AFTER setTYpeVoxel or setTypePixel

Parameters
xthe x parameter ident
ythe y parameter ident
zthe z parameter ident

◆ setMeshTypePixel()

setMeshTypePixel ( number  nx,
number  ny 
)

sets the mesh type to MESH_PIXEL

Parameters
nxthe number of grid points along the x axis
nythe number of grid points along the y axis

◆ setMeshTypeRay()

setMeshTypeRay ( number  nx)

sets the mesh type to MESH_RAY

Parameters
nxthe number of grid points along the x axis

◆ setMeshTypeVoxel()

setMeshTypeVoxel ( number  nx,
number  ny,
number  nz 
)

sets the mesh type to MESH_VOXEL

Parameters
nxthe number of grid points along the x axis
nythe number of grid points along the y axis
nzthe number of grid points along the z axis

Connect with Ansys