power-grid-model 1.10.17__py3-none-win_amd64.whl → 1.12.119__py3-none-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of power-grid-model might be problematic. Click here for more details.
- power_grid_model/__init__.py +54 -29
- power_grid_model/_core/__init__.py +3 -3
- power_grid_model/_core/buffer_handling.py +507 -478
- power_grid_model/_core/data_handling.py +195 -141
- power_grid_model/_core/data_types.py +142 -0
- power_grid_model/_core/dataset_definitions.py +109 -109
- power_grid_model/_core/enum.py +226 -0
- power_grid_model/_core/error_handling.py +215 -198
- power_grid_model/_core/errors.py +134 -0
- power_grid_model/_core/index_integer.py +17 -17
- power_grid_model/_core/options.py +71 -69
- power_grid_model/_core/power_grid_core.py +577 -562
- power_grid_model/_core/power_grid_dataset.py +545 -490
- power_grid_model/_core/power_grid_meta.py +262 -244
- power_grid_model/_core/power_grid_model.py +1025 -687
- power_grid_model/_core/power_grid_model_c/__init__.py +3 -0
- power_grid_model/_core/power_grid_model_c/bin/power_grid_model_c.dll +0 -0
- power_grid_model/_core/power_grid_model_c/get_pgm_dll_path.py +63 -0
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_c/basics.h +251 -0
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_c/buffer.h +108 -0
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_c/dataset.h +332 -0
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_c/dataset_definitions.h +1060 -0
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_c/handle.h +111 -0
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_c/meta_data.h +189 -0
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_c/model.h +130 -0
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_c/options.h +142 -0
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_c/serialization.h +118 -0
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_c.h +36 -0
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_cpp/basics.hpp +65 -0
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_cpp/buffer.hpp +61 -0
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_cpp/dataset.hpp +224 -0
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_cpp/handle.hpp +108 -0
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_cpp/meta_data.hpp +84 -0
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_cpp/model.hpp +63 -0
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_cpp/options.hpp +52 -0
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_cpp/serialization.hpp +124 -0
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_cpp/utils.hpp +81 -0
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_cpp.hpp +19 -0
- power_grid_model/_core/power_grid_model_c/lib/cmake/power_grid_model/power_grid_modelConfig.cmake +37 -0
- power_grid_model/_core/power_grid_model_c/lib/cmake/power_grid_model/power_grid_modelConfigVersion.cmake +65 -0
- power_grid_model/_core/power_grid_model_c/lib/cmake/power_grid_model/power_grid_modelTargets-release.cmake +19 -0
- power_grid_model/_core/power_grid_model_c/lib/cmake/power_grid_model/power_grid_modelTargets.cmake +144 -0
- power_grid_model/_core/power_grid_model_c/lib/power_grid_model_c.lib +0 -0
- power_grid_model/_core/power_grid_model_c/share/LICENSE +292 -0
- power_grid_model/_core/power_grid_model_c/share/README.md +15 -0
- power_grid_model/_core/serialization.py +319 -317
- power_grid_model/_core/typing.py +20 -0
- power_grid_model/{_utils.py → _core/utils.py} +798 -783
- power_grid_model/data_types.py +321 -319
- power_grid_model/enum.py +27 -214
- power_grid_model/errors.py +37 -119
- power_grid_model/typing.py +43 -48
- power_grid_model/utils.py +529 -400
- power_grid_model/validation/__init__.py +25 -10
- power_grid_model/validation/{rules.py → _rules.py} +1167 -962
- power_grid_model/validation/{validation.py → _validation.py} +1172 -1015
- power_grid_model/validation/assertions.py +93 -92
- power_grid_model/validation/errors.py +602 -524
- power_grid_model/validation/utils.py +313 -318
- {power_grid_model-1.10.17.dist-info → power_grid_model-1.12.119.dist-info}/METADATA +162 -165
- power_grid_model-1.12.119.dist-info/RECORD +65 -0
- {power_grid_model-1.10.17.dist-info → power_grid_model-1.12.119.dist-info}/WHEEL +1 -1
- power_grid_model-1.12.119.dist-info/entry_points.txt +3 -0
- power_grid_model/_core/_power_grid_core.dll +0 -0
- power_grid_model-1.10.17.dist-info/RECORD +0 -32
- power_grid_model-1.10.17.dist-info/top_level.txt +0 -1
- {power_grid_model-1.10.17.dist-info → power_grid_model-1.12.119.dist-info/licenses}/LICENSE +0 -0
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Contributors to the Power Grid Model project <powergridmodel@lfenergy.org>
|
|
2
|
+
//
|
|
3
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @brief header file which includes dataset handling functions
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
#pragma once
|
|
11
|
+
#ifndef POWER_GRID_MODEL_C_DATASET_H
|
|
12
|
+
#define POWER_GRID_MODEL_C_DATASET_H
|
|
13
|
+
|
|
14
|
+
#include "basics.h"
|
|
15
|
+
|
|
16
|
+
#ifdef __cplusplus
|
|
17
|
+
extern "C" {
|
|
18
|
+
#endif
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @brief Get the name of the dataset.
|
|
22
|
+
* @param handle
|
|
23
|
+
* @param info A pointer to the info object.
|
|
24
|
+
* @return A pointer to null null-terminated string of the dataset name.
|
|
25
|
+
* The pointer is permanently valid.
|
|
26
|
+
*/
|
|
27
|
+
PGM_API char const* PGM_dataset_info_name(PGM_Handle* handle, PGM_DatasetInfo const* info);
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @brief Get the flag whether the dataset is a batch dataset.
|
|
31
|
+
* @param handle
|
|
32
|
+
* @param info A pointer to the info object.
|
|
33
|
+
* @return 1 if the dataset is a batch, 0 if it is not.
|
|
34
|
+
*/
|
|
35
|
+
PGM_API PGM_Idx PGM_dataset_info_is_batch(PGM_Handle* handle, PGM_DatasetInfo const* info);
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @brief Get the batch size of the dataset.
|
|
39
|
+
* @param handle
|
|
40
|
+
* @param info A pointer to the info object.
|
|
41
|
+
* @return Size of the batch. For a single-dataset, the batch size is always 1.
|
|
42
|
+
*/
|
|
43
|
+
PGM_API PGM_Idx PGM_dataset_info_batch_size(PGM_Handle* handle, PGM_DatasetInfo const* info);
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* @brief Get the number of components in the dataset.
|
|
47
|
+
* @param handle
|
|
48
|
+
* @param info A pointer to the info object.
|
|
49
|
+
* @return The number of components.
|
|
50
|
+
*/
|
|
51
|
+
PGM_API PGM_Idx PGM_dataset_info_n_components(PGM_Handle* handle, PGM_DatasetInfo const* info);
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* @brief Get the name of i-th component.
|
|
55
|
+
* @param handle
|
|
56
|
+
* @param info A pointer to the info object.
|
|
57
|
+
* @param component_idx The index number of the component.
|
|
58
|
+
* @return A pointer to the null-terminated string of the component name.
|
|
59
|
+
* The pointer is permanently valid.
|
|
60
|
+
*/
|
|
61
|
+
PGM_API char const* PGM_dataset_info_component_name(PGM_Handle* handle, PGM_DatasetInfo const* info,
|
|
62
|
+
PGM_Idx component_idx);
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* @brief Get the elements per scenario for the i-th component.
|
|
66
|
+
* @param handle
|
|
67
|
+
* @param info A pointer to the info object.
|
|
68
|
+
* @param component_idx The index number of the component.
|
|
69
|
+
* @return Number of elements per scenario for that component,
|
|
70
|
+
* or -1 if the scenario is not uniform (different number per scenario).
|
|
71
|
+
*/
|
|
72
|
+
PGM_API PGM_Idx PGM_dataset_info_elements_per_scenario(PGM_Handle* handle, PGM_DatasetInfo const* info,
|
|
73
|
+
PGM_Idx component_idx);
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* @brief Get the total number of elements for the i-th component.
|
|
77
|
+
* @param handle
|
|
78
|
+
* @param info A pointer to the info object.
|
|
79
|
+
* @param component_idx The index number of the component.
|
|
80
|
+
* @return The total number of elements of that component.
|
|
81
|
+
* If the number of elements per scenario is uniform,
|
|
82
|
+
* this value must equal to PGM_dataset_info_batch_size() * PGM_dataset_info_elements_per_scenario().
|
|
83
|
+
*/
|
|
84
|
+
PGM_API PGM_Idx PGM_dataset_info_total_elements(PGM_Handle* handle, PGM_DatasetInfo const* info, PGM_Idx component_idx);
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* @brief Return whether a component has attribute indications.
|
|
88
|
+
*
|
|
89
|
+
* Attribute indications are used to indicate the presence of meaningful attributes
|
|
90
|
+
* for a certain component in the dataset.
|
|
91
|
+
* If it returns 1 for that component, you can create columnar data with only the indicated attributes.
|
|
92
|
+
* In this case, you are guaranteed that all information from the original serialized data will be retained
|
|
93
|
+
* for this component, i.e., you do not lose any meaningful information during the deserialization process.
|
|
94
|
+
* Otherwise, no such guarantees are made.
|
|
95
|
+
*
|
|
96
|
+
* @param handle
|
|
97
|
+
* @param info A pointer to the info object.
|
|
98
|
+
* @param component_idx The index number of the component.
|
|
99
|
+
* @return 1 if the component has attribute indications, 0 if it does not.
|
|
100
|
+
*/
|
|
101
|
+
PGM_API PGM_Idx PGM_dataset_info_has_attribute_indications(PGM_Handle* handle, PGM_DatasetInfo const* info,
|
|
102
|
+
PGM_Idx component_idx);
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* @brief Return the number of attribute indications for a component.
|
|
106
|
+
*
|
|
107
|
+
* @param handle
|
|
108
|
+
* @param info A pointer to the info object.
|
|
109
|
+
* @param component_idx The index number of the component.
|
|
110
|
+
* @return The number of attribute indications for the component.
|
|
111
|
+
* It returns 0 if PGM_dataset_info_has_attribute_indications() returns zero.
|
|
112
|
+
*/
|
|
113
|
+
PGM_API PGM_Idx PGM_dataset_info_n_attribute_indications(PGM_Handle* handle, PGM_DatasetInfo const* info,
|
|
114
|
+
PGM_Idx component_idx);
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* @brief Return the name of the i-th attribute indication for a component.
|
|
118
|
+
*
|
|
119
|
+
* @param handle
|
|
120
|
+
* @param info A pointer to the info object.
|
|
121
|
+
* @param component_idx The index number of the component.
|
|
122
|
+
* @param attribute_idx The index number of attribute indication.
|
|
123
|
+
* @return A pointer to the null-terminated string of the attribute indication.
|
|
124
|
+
* The pointer has the same lifetime as the input info pointer.
|
|
125
|
+
* It is UB if PGM_dataset_info_has_attribute_indications() returns zero, or if attribute_idx is out of bounds.
|
|
126
|
+
*/
|
|
127
|
+
PGM_API char const* PGM_dataset_info_attribute_name(PGM_Handle* handle, PGM_DatasetInfo const* info,
|
|
128
|
+
PGM_Idx component_idx, PGM_Idx attribute_idx);
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* @brief Create an instance of PGM_ConstDataset.
|
|
132
|
+
* @param handle
|
|
133
|
+
* @param dataset The name of the dataset.
|
|
134
|
+
* @param is_batch 1 if the dataset is a batch, 0 if the dataset is single.
|
|
135
|
+
* @param batch_size The size of the batch. For single datasets, this must be 1.
|
|
136
|
+
* @return A pointer to the created PGM_ConstDataset, or NULL if errors occur. Check the handle for error.
|
|
137
|
+
* The instance must be freed by PGM_destroy_dataset_const().
|
|
138
|
+
*/
|
|
139
|
+
PGM_API PGM_ConstDataset* PGM_create_dataset_const(PGM_Handle* handle, char const* dataset, PGM_Idx is_batch,
|
|
140
|
+
PGM_Idx batch_size);
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* @brief Create an instance of PGM_ConstDataset from a PGM_WritableDataset
|
|
144
|
+
* They share the same buffer memory.
|
|
145
|
+
* @param handle
|
|
146
|
+
* @param writable_dataset pointer to an instance of PGM_WritableDataset
|
|
147
|
+
* @return A pointer to the created PGM_ConstDataset, or NULL if errors occur. Check the handle for error.
|
|
148
|
+
* The instance must be freed by PGM_destroy_dataset_const().
|
|
149
|
+
*/
|
|
150
|
+
PGM_API PGM_ConstDataset* PGM_create_dataset_const_from_writable(PGM_Handle* handle,
|
|
151
|
+
PGM_WritableDataset const* writable_dataset);
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* @brief Create an instance of PGM_ConstDataset from a PGM_MutableDataset
|
|
155
|
+
* They share the same buffer memory.
|
|
156
|
+
* @param handle
|
|
157
|
+
* @param mutable_dataset pointer to an instance of PGM_MutableDataset
|
|
158
|
+
* @return A pointer to the created PGM_ConstDataset, or NULL if errors occur. Check the handle for error.
|
|
159
|
+
* The instance must be freed by PGM_destroy_dataset_const().
|
|
160
|
+
*/
|
|
161
|
+
PGM_API PGM_ConstDataset* PGM_create_dataset_const_from_mutable(PGM_Handle* handle,
|
|
162
|
+
PGM_MutableDataset const* mutable_dataset);
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* @brief Destroy an instance of PGM_ConstDataset.
|
|
166
|
+
* @param dataset The pointer to the PGM_ConstDataset created by PGM_create_dataset_const(),
|
|
167
|
+
* PGM_create_dataset_const_from_writable(), or PGM_create_dataset_const_from_mutable().
|
|
168
|
+
* @return
|
|
169
|
+
*/
|
|
170
|
+
PGM_API void PGM_destroy_dataset_const(PGM_ConstDataset* dataset);
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* @brief Add a component buffer to an instance of PGM_ConstDataset.
|
|
174
|
+
* @param handle
|
|
175
|
+
* @param dataset The pointer to the PGM_ConstDataset.
|
|
176
|
+
* @param component The name of the component.
|
|
177
|
+
* @param elements_per_scenario The number of the elements per scenario.
|
|
178
|
+
* If the component is uniform, elements_per_scenario must be >= 0
|
|
179
|
+
* If the component is not uniform, elements_per_scenario must be -1
|
|
180
|
+
* @param total_elements The total number of elements for all scenarios.
|
|
181
|
+
* If elements_per_scenario >= 0, we must have elements_per_scenario * batch_size = total_elements.
|
|
182
|
+
* @param indptr A pointer to an array of indptr of a non-uniform component.
|
|
183
|
+
* If the component is uniform, indptr must be NULL.
|
|
184
|
+
* If the component is not uniform, indptr must point to an array of size (batch_size + 1).
|
|
185
|
+
* The values in the array must be not decreasing.
|
|
186
|
+
* And we must have indptr[0] = 0, indptr[batch_size] = total_elements.
|
|
187
|
+
* @param data A void pointer to the row based buffer data or NULL for columnar data.
|
|
188
|
+
* @return
|
|
189
|
+
*/
|
|
190
|
+
PGM_API void PGM_dataset_const_add_buffer(PGM_Handle* handle, PGM_ConstDataset* dataset, char const* component,
|
|
191
|
+
PGM_Idx elements_per_scenario, PGM_Idx total_elements, PGM_Idx const* indptr,
|
|
192
|
+
void const* data);
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* @brief Add a attribute buffer to an instance of PGM_ConstDataset/component.
|
|
196
|
+
* @param handle
|
|
197
|
+
* @param dataset The pointer to the PGM_ConstDataset.
|
|
198
|
+
* @param component The name of the component.
|
|
199
|
+
* @param attribute The name of the attribute.
|
|
200
|
+
* @param data A void pointer to the buffer data.
|
|
201
|
+
* @return
|
|
202
|
+
*/
|
|
203
|
+
PGM_API void PGM_dataset_const_add_attribute_buffer(PGM_Handle* handle, PGM_ConstDataset* dataset,
|
|
204
|
+
char const* component, char const* attribute, void const* data);
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* @brief Get the dataset info of the instance PGM_ConstDataset.
|
|
208
|
+
* @param handle
|
|
209
|
+
* @param dataset A pointer to the PGM_ConstDataset.
|
|
210
|
+
* @return A pointer to the instance of PGM_DatasetInfo.
|
|
211
|
+
* The pointer has the same lifetime as the input dataset pointer.
|
|
212
|
+
*/
|
|
213
|
+
PGM_API PGM_DatasetInfo const* PGM_dataset_const_get_info(PGM_Handle* handle, PGM_ConstDataset const* dataset);
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* @brief Set the next const dataset as cartesian product dimension.
|
|
217
|
+
*
|
|
218
|
+
* This function allows users to run a batch calculation with multiple dimensions of scenarios.
|
|
219
|
+
* The way users can archive this is to combine multiple batch datasets
|
|
220
|
+
* to create a multi-dimension batch calculation using a linked list pattern. The calculation core will
|
|
221
|
+
* interpret the combined dataset as a cartesian product on a linked list of all the scenarios.
|
|
222
|
+
* Each batch dataset in the linked list represents one dimension of the cartesian product.
|
|
223
|
+
*
|
|
224
|
+
* @param handle
|
|
225
|
+
* @param dataset
|
|
226
|
+
* @param next_dataset The next dataset in the linked list.
|
|
227
|
+
*/
|
|
228
|
+
PGM_API void PGM_dataset_const_set_next_cartesian_product_dimension(PGM_Handle* handle, PGM_ConstDataset* dataset,
|
|
229
|
+
PGM_ConstDataset const* next_dataset);
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* @brief Get the dataset info of the instance PGM_WritableDataset.
|
|
233
|
+
* @param handle
|
|
234
|
+
* @param dataset A pointer to the PGM_WritableDataset.
|
|
235
|
+
* @return A pointer to the instance of PGM_DatasetInfo.
|
|
236
|
+
* The pointer has the same lifetime as the input dataset pointer.
|
|
237
|
+
*/
|
|
238
|
+
PGM_API PGM_DatasetInfo const* PGM_dataset_writable_get_info(PGM_Handle* handle, PGM_WritableDataset const* dataset);
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* @brief Set buffer into the instance PGM_WritableDataset.
|
|
242
|
+
* @param handle
|
|
243
|
+
* @param dataset A pointer to the PGM_WritableDataset.
|
|
244
|
+
* @param component The name of the component.
|
|
245
|
+
* @param indptr A pointer to an array of indptr of a non-uniform component.
|
|
246
|
+
* If the component is uniform, indptr must be NULL.
|
|
247
|
+
* If the component is not uniform, indptr must point to an array of size (batch_size + 1).
|
|
248
|
+
* @param data A void pointer to the row based buffer data or NULL for columnar data.
|
|
249
|
+
* @return
|
|
250
|
+
*/
|
|
251
|
+
PGM_API void PGM_dataset_writable_set_buffer(PGM_Handle* handle, PGM_WritableDataset* dataset, char const* component,
|
|
252
|
+
PGM_Idx* indptr, void* data);
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* @brief Set buffer into the instance PGM_WritableDataset.
|
|
256
|
+
* @param handle
|
|
257
|
+
* @param dataset A pointer to the PGM_WritableDataset.
|
|
258
|
+
* @param component The name of the component.
|
|
259
|
+
* @param attribute The name of the attribute.
|
|
260
|
+
* @param data A void pointer to the buffer data.
|
|
261
|
+
* @return
|
|
262
|
+
*/
|
|
263
|
+
PGM_API void PGM_dataset_writable_set_attribute_buffer(PGM_Handle* handle, PGM_WritableDataset* dataset,
|
|
264
|
+
char const* component, char const* attribute, void* data);
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* @brief Create an instance of PGM_MutableDataset.
|
|
268
|
+
* @param handle
|
|
269
|
+
* @param dataset The name of the dataset.
|
|
270
|
+
* @param is_batch 1 if the dataset is a batch, 0 if the dataset is single.
|
|
271
|
+
* @param batch_size The size of the batch. For single datasets, this must be 1.
|
|
272
|
+
* @return A pointer to the created PGM_MutableDataset, or NULL if errors occur. Check the handle for error.
|
|
273
|
+
* The instance must be freed by PGM_destroy_dataset_mutable().
|
|
274
|
+
*/
|
|
275
|
+
PGM_API PGM_MutableDataset* PGM_create_dataset_mutable(PGM_Handle* handle, char const* dataset, PGM_Idx is_batch,
|
|
276
|
+
PGM_Idx batch_size);
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* @brief Destroy an instance of PGM_MutableDataset.
|
|
280
|
+
* @param dataset The pointer to the PGM_MutableDataset created by PGM_create_dataset_mutable().
|
|
281
|
+
* @return
|
|
282
|
+
*/
|
|
283
|
+
PGM_API void PGM_destroy_dataset_mutable(PGM_MutableDataset* dataset);
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* @brief Add a component buffer to an instance of PGM_MutableDataset.
|
|
287
|
+
* @param handle
|
|
288
|
+
* @param dataset The pointer to the PGM_MutableDataset.
|
|
289
|
+
* @param component The name of the component.
|
|
290
|
+
* @param elements_per_scenario The number of the elements per scenario.
|
|
291
|
+
* If the component is uniform, elements_per_scenario must be >= 0
|
|
292
|
+
* If the component is not uniform, elements_per_scenario must be -1
|
|
293
|
+
* @param total_elements The total number of elements for all scenarios.
|
|
294
|
+
* If elements_per_scenario >= 0, we must have elements_per_scenario * batch_size = total_elements.
|
|
295
|
+
* @param indptr A pointer to an array of indptr of a non-uniform component.
|
|
296
|
+
* If the component is uniform, indptr must be NULL.
|
|
297
|
+
* If the component is not uniform, indptr must point to an array of size (batch_size + 1).
|
|
298
|
+
* The values in the array must be not decreasing.
|
|
299
|
+
* And we must have indptr[0] = 0, indptr[batch_size] = total_elements.
|
|
300
|
+
* @param data A void pointer to the row based buffer data or NULL for columnar data.
|
|
301
|
+
* @return
|
|
302
|
+
*/
|
|
303
|
+
PGM_API void PGM_dataset_mutable_add_buffer(PGM_Handle* handle, PGM_MutableDataset* dataset, char const* component,
|
|
304
|
+
PGM_Idx elements_per_scenario, PGM_Idx total_elements,
|
|
305
|
+
PGM_Idx const* indptr, void* data);
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* @brief Add a attribute buffer to an instance of PGM_MutableDataset/component.
|
|
309
|
+
* @param handle
|
|
310
|
+
* @param dataset The pointer to the PGM_MutableDataset.
|
|
311
|
+
* @param component The name of the component.
|
|
312
|
+
* @param attribute The name of the attribute.
|
|
313
|
+
* @param data A void pointer to the buffer data.
|
|
314
|
+
* @return
|
|
315
|
+
*/
|
|
316
|
+
PGM_API void PGM_dataset_mutable_add_attribute_buffer(PGM_Handle* handle, PGM_MutableDataset* dataset,
|
|
317
|
+
char const* component, char const* attribute, void* data);
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* @brief Get the dataset info of the instance PGM_MutableDataset.
|
|
321
|
+
* @param handle
|
|
322
|
+
* @param dataset A pointer to the PGM_MutableDataset.
|
|
323
|
+
* @return A pointer to the instance of PGM_DatasetInfo.
|
|
324
|
+
* The pointer has the same lifetime as the input dataset pointer.
|
|
325
|
+
*/
|
|
326
|
+
PGM_API PGM_DatasetInfo const* PGM_dataset_mutable_get_info(PGM_Handle* handle, PGM_MutableDataset const* dataset);
|
|
327
|
+
|
|
328
|
+
#ifdef __cplusplus
|
|
329
|
+
}
|
|
330
|
+
#endif
|
|
331
|
+
|
|
332
|
+
#endif
|