ansys / pyacp

Python Client for Ansys Composite PrepPost
https://acp.docs.pyansys.com
MIT License
4 stars 1 forks source link

Implement recursive copying helper #563

Open greschd opened 3 weeks ago

greschd commented 3 weeks ago

Implement a recursive_copy helper function, which:

To implement this, helper functions for getting the child objects and linked objects are added (as non-public API) to _tree_objects/_traversal.py.

For the edge property lists, an additional .clone() method on the GenericEdgePropertyType classes was needed. This is currently implemented separately on each. [2]

Adds a dependency on networkx, for computing the order in which objects should be stored s.t. all their dependencies (parent, linked objects) are already stored. We may reuse the dependency graph produced for this task in other contexts.

[1] more than one new parent may be needed, for example when copying a Modeling Ply (parent: Modeling Group) which links to a Fabric (parent: Model). [2] in general, the GenericEdgePropertyType classes have a lot of code duplication; this can be dealt with in a later PR (not urgent).

codecov[bot] commented 3 weeks ago

Codecov Report

Attention: Patch coverage is 95.03106% with 8 lines in your changes missing coverage. Please review.

Project coverage is 93.11%. Comparing base (b4bba30) to head (ccec699).

Files Patch % Lines
src/ansys/acp/core/_tree_objects/_traversal.py 95.23% 2 Missing :warning:
.../_tree_objects/_grpc_helpers/edge_property_list.py 75.00% 1 Missing :warning:
...ore/_tree_objects/_grpc_helpers/property_helper.py 75.00% 1 Missing :warning:
...ys/acp/core/_tree_objects/linked_selection_rule.py 88.88% 1 Missing :warning:
src/ansys/acp/core/_tree_objects/modeling_ply.py 83.33% 1 Missing :warning:
src/ansys/acp/core/_tree_objects/sublaminate.py 83.33% 1 Missing :warning:
...c/ansys/acp/core/_tree_objects/virtual_geometry.py 85.71% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #563 +/- ## ========================================== + Coverage 92.91% 93.11% +0.20% ========================================== Files 82 84 +2 Lines 4292 4433 +141 ========================================== + Hits 3988 4128 +140 - Misses 304 305 +1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.