Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
shamrock::PatchDataLazyGetter Class Reference

Lazily fetches a single named field of a patch as a numpy array, on demand. More...

#include <shampylib/include/shampylib/PatchDataToPy.hpp>

Collaboration diagram for shamrock::PatchDataLazyGetter:

Public Member Functions

 PatchDataLazyGetter (shamrock::patch::PatchDataLayer &pdat)
py::object get_item (const std::string &key) const

Public Attributes

shamrock::patch::PatchDataLayer & pdat

Detailed Description

Lazily fetches a single named field of a patch as a numpy array, on demand.

Unlike pdat_to_dic (which eagerly copies every field of a patch to a python dict), this only pays the device->host copy cost for the fields actually queried via operator[]/__getitem__, so a getter that only touches a handful of fields does not force a copy of every field in the patch.

Definition at line 279 of file PatchDataToPy.hpp.

Constructor & Destructor Documentation

◆ PatchDataLazyGetter()

shamrock::PatchDataLazyGetter::PatchDataLazyGetter ( shamrock::patch::PatchDataLayer & pdat)
inlineexplicit

Definition at line 283 of file PatchDataToPy.hpp.

Member Function Documentation

◆ get_item()

& shamrock::PatchDataLazyGetter::get_item ( const std::string & key) const
inline

Definition at line 285 of file PatchDataToPy.hpp.

Member Data Documentation

◆ pdat

shamrock::patch::PatchDataLayer& shamrock::PatchDataLazyGetter::pdat

Definition at line 281 of file PatchDataToPy.hpp.


The documentation for this class was generated from the following files: