openPMD-api
openPMD-api copied to clipboard
add C array arguments in the storeChunk() function API
** My problem **
My reading procedure is implemented via Fortran C interface. The interface exposes on static C arrays
and i need to copy the C arrays to std::vector to use the storeChunk() function.
I would like to avoid the additionnal copying of the data arrays ( these are huge array holding particle data!)
** Possible solution **
add C static array as argument of the storeChunk()
This WIP PR adds these calls.
Until then, you can use storeChunk(shareRaw(ptr), offset, extent) to hijack the shared_ptr overloads.
what is the shareRaw() function exactly doing ?
It creates a shared pointer from a raw pointer with a no-op destructor, i.e. a non-owning shared pointer.
template <typename T>
std::shared_ptr<T> shareRaw(T *x)
{
return std::shared_ptr<T>(x, [](T *) {});
}
ah ok thx !