NNPDF / pineappl

PineAPPL is not an extension of APPLgrid
https://nnpdf.github.io/pineappl/
GNU General Public License v3.0
13 stars 3 forks source link

Change the way subgrids are imported and exported #58

Closed cschwan closed 3 years ago

alecandido commented 3 years ago

I'm not sure this is the correct place to tell you, but I was thinking about the fill/write_q2_slice issue and I've a suggestion: I said I would have expected a read method as a partner of the write one, but actually you should be able to implement a read statement on top of the fill one already at the abstract level, just allocating - filling - returning the buffer.

Is this meaningful for you, or it's trivial and should be done by the user itself to encourage the use of fill?

cschwan commented 3 years ago

That's surely the right place, because those are the exact methods I'll to change. First of all, I'll get rid write_q2_slice, which is obsolete because we now have ReadOnlySparseSubgrid - that's going to do the job. This will require bigger changes in the C API though.

I didn't implement the Read trait because that's not exactly what fill_q2_slice does. What we need is to export Q^2 slices one by one, skipping empty slices.

cschwan commented 3 years ago

Commits be733ac5281414ff7b592699c22b5a53791f2af9, ce5bc1bac83944d88504319b667d5b48107374b2 and f6b932304e7fedd129765b8dcebe98d37adc419b change the way grids are imported, also through the C API. Thanks to those changes we can now import a grid using custom x1/x2/Q2-grid points, by simply specifying them.

cschwan commented 3 years ago

Commit b8f46c1f9c3a110238555505d96ccd42824e2f99 removes the q2_slice methods; instead Subgrid::iter() can be used.