openPMD/openPMD-api

Provide copying mechanism for frontend handles

开放

#171 创建于 2018年5月14日

 (1 条评论) (1 个反应) (0 位负责人)C++ (57 个派生)auto 404
frontend: C++17frontend: Python3good first issuehelp wantedinternal

仓库指标

星标
 (160 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

As a continuation of #156, a mechanism to allow detatched copies of frontend objects (i.e. Attributables) 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() to have familiar syntax and semantics.)

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();

贡献者指南