Data
An analysis with COMPAS FEA2 is defined by a “model” (compas_fea2.model.Model
)
and a “problem” (compas_fea2.problem.Problem
), with each many different sub-components.
All these components, and the model and problem themselves, are COMPAS data objects,
and derive from a base FEA2 data class (compas_fea2.base.FEAData
).
compas.data.Data
|_ compas_fea2.base.FEAData
|_ compas_fea2.model.Model
|_ compas_fea2.model.Node
|_ compas_fea2.model.Element
|_ ...
|_ compas_fea2.model.Part
|_ ...
|_ compas_fea2.model.Material
|_ ...
|_ compas_fea2.model.Section
|_ ...
|_ compas_fea2.model.Constraint
|_ ...
|_ compas_fea2.model.Group
|_ ...
|_ compas_fea2.model.BoundaryCondition
|_ ...
|_ compas_fea2.model.InitialCondition
|_ ...
compas.data.Data
|_ compas_fea2.base.FEAData
|_ compas_fea2.problem.Problem
|_ compas_fea2.problem.Step
|_ ...
|_ compas_fea2.problem.Load
|_ ...
|_ compas_fea2.problem.Displacement
|_ ...
This means that all these components have the same base data infrastructure as all other COMPAS objects. They have a guid, a name, and general attributes.
>>> from compas_fea2.model import Node
>>> node = Node(name='node')
>>> node.name
'node'
>>> node.guid
...
>>> node.attributes
{}
The can be converted to data and serialised to a JSON string or file.
>>> node.to_data()
{'name': 'node', 'guid': ..., 'attributes': {}}
>>> node.to_jsonstring()
'{"name": "node", "guid": ..., "attributes": {}}'
The only difference from other COMPAS objects is their default name.
>>> node = Node()
>>> node.name
...