Kratos
Kratos copied to clipboard
Inconsistent ModelPart.GetProperties
trafficstars
Description
I've observed the following discrepancy in the ModelPart interface:
- From the c++ interface, ModelPart.GetProperties(id) returns the property with the corresponding id from the mesh 0 (default value)
- From the python interface, ModelPart.GetProperties(id) returns all the properties from the mesh with the corresponding id.
I opened a discussion about this in the past, and I don't remember why we keep it (I think because it would break to much code)
Recap
| item | container | |
|---|---|---|
| Value | Node | Nodes |
| Element | Elements | |
| Condition | Conditions | |
| Properties | Properties | |
| Methods | CreateNew(item) Has(item) Get(item) Add(item) Remove(item) |
(container) Set(container) |
Propertiesmeans the item and also the container.- The Python interface adds
Get(container). In general, this is not a problem, but it conflicts in the case of the properties. Consequently, there are multiple definitions ofGetPropertiesin Python, returning the container or the item. - Furthermore, the properties Id may be confused with the mesh Id (legacy).
My proposal
- Remove the mesh Id from the python interface (#9774). This is a behavior change.
- GetProperties(mesh_id) -> Container
+ GetProperties(prop_id) -> Item
- Remove the
GetProperties()(container), which can be confused withGetProperties(id)(item). This is an API breaker.
NOTE: I'm not sure about the proposal 2 and I would like to hear opinions.
Pros:
- Avoid confusion between properties item and properties container
- Easy to replace
Cons:
- There is a
GetNodesetc, but notGetProperties(container) - ~1k of deprecation warnings
In @KratosMultiphysics/implementation-committee we prefer only to remove the mesh id (option 1)