openPMD / openPMD/openPMD-api

Provide copying mechanism for frontend handles

Open
#171 1 comment 1 reaction 0 assignees View on GitHub
frontend: C++17 frontend: Python3 good first issue help wanted internal
Dominant language
C++
Stars
161
Forks
59
Avg merge
2d 22h
Merged PRs (30d)
7

Description

As a continuation of #156, a mechanism to allow detatched copies of frontend objects (i.e. ```Attributable```s) should be provided. While it is possible to create two objects with the same parameters explicitly, it is cumbersome e.g. when assigning multiple iterations in a series with the same openPMD data and differing record data.

(Shamelessly stealing numpy's lingo with [```.copy()```](https://docs.scipy.org/doc/numpy-1.14.0/reference/generated/numpy.copy.html) to have familiar syntax and semantics.)

```cpp
Series s = Series("./out.h5", AccessType::CREATE);

Iteration i1 = s.iterations[1];

/* merely creates a view into i1
* every modification to i1 is reflected in i2 (and vice versa) */
s.iterations[2] = i1;

/* have an independent copy of the iteration that is not merely a view
* any modification to i1 will not be reflected in i2 (and vice versa) */
s.iterations[3] = i1.copy();
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.