Variable::Span<T>
Created by: germasch
Can you provide some context on how apps are expected to use Span<T>
from #1289? I gather there have been some requests for this, but I'd be interested to learn how others use this.
It looks like a useful feature to me, which I might want to use in my projects.
The way it looks to me from the test is:
var = io.DefineVariable<double>(....)
writer = io.Open(...)
auto span = writer.Put<T>(var)
// fill span with data
// How do I say that I'm done filling the data and it's ready to be written? Isn't that what Put is for?
The other part I'm wondering about is, why std::span (well, that's C++20, but you know what I mean)? On the app side, that works for simple 1-d arrays, I guess. But at lot of apps do more complicated things.
In my case, as an example, I calculate moments from my particle data as diagnostics. So I create a 2-d or 3-d array, calculate my output data in it, then write it, then destroy it. I think the point of this is to avoid me allocating data, then handing it to ADIOS2, which will at some point copy it into its internal buffer, then I free my data. It'd be nicer if I could create my 2-d/3-d data structure directly using adios2's buffer, avoiding the need to have two temporary buffers and a copy. But std::span doesn't really help me very much, or what's the idea?