NOAA-OWP / ngen

Next Generation Water Modeling Engine and Framework Prototype
Other
82 stars 57 forks source link

Refactor DataProvider::get_values interface and implementations to avoid excess allocation and copying #809

Open PhilMiller opened 2 months ago

PhilMiller commented 2 months ago

https://github.com/NOAA-OWP/ngen/blob/dd664668975e84a21d58c79300248210a0a256bf/include/forcing/DataProvider.hpp#L87

The member function signature in the DataProvider interface demands the allocation of a temporary vector and the likely copying of data from that temporary vector by the consumer.

The signature ought to be

virtual void get_values(boost::span<data_type> output, selection_type const&  selector, ReSampleMethod = SUM);

We could phase the refactoring by