power-grid-model icon indicating copy to clipboard operation
power-grid-model copied to clipboard

Remove the Dataset logic from PGM core, use DatasetHandler for MainModel

Open TonyXiang8787 opened this issue 1 year ago • 2 comments

Background

Currently we use Dataset as the input view for MainModel, such as:

https://github.com/PowerGridModel/power-grid-model/blob/95212803cd9af486066deeea4d334b558ccf6e1a/power_grid_model_c/power_grid_model/include/power_grid_model/main_model.hpp#L101-L102

The C-API receives DatasetHandler, we have a function to export to a Dataset. See blow:

https://github.com/PowerGridModel/power-grid-model/blob/95212803cd9af486066deeea4d334b558ccf6e1a/power_grid_model_c/power_grid_model/include/power_grid_model/auxiliary/dataset_handler.hpp#L69-L71

This conversion is redundant. We already have DatasetHandler which handles datasets.

Adjustments

  1. Create export function in DatasetHandler to export a std::span for a single component.
  2. Remove export_dataset function in DatasetHandler.
  3. Change the constructor, get output, and update function of MainModel to receive range of a certain component type.
  4. Create a new class OwningDataset to contain owned buffers. This can be used for the validation test and later for the serialization-to-serialization API for the C-API. (msgpack input -> msgpack output).

TonyXiang8787 avatar Nov 21 '23 10:11 TonyXiang8787

@TonyXiang8787 how much of this is still relevant / unblocked with the new constexpr metadata from #475 ?

mgovers avatar Feb 14 '24 08:02 mgovers

@mgovers still quite relevant

TonyXiang8787 avatar Feb 19 '24 09:02 TonyXiang8787