power-grid-model 1.12.57__py3-none-win_amd64.whl → 1.12.59__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 -54
- power_grid_model/_core/__init__.py +3 -3
- power_grid_model/_core/buffer_handling.py +493 -493
- power_grid_model/_core/data_handling.py +141 -141
- power_grid_model/_core/data_types.py +132 -132
- power_grid_model/_core/dataset_definitions.py +109 -109
- power_grid_model/_core/enum.py +226 -226
- power_grid_model/_core/error_handling.py +206 -206
- power_grid_model/_core/errors.py +130 -130
- power_grid_model/_core/index_integer.py +17 -17
- power_grid_model/_core/options.py +71 -71
- power_grid_model/_core/power_grid_core.py +563 -563
- power_grid_model/_core/power_grid_dataset.py +535 -535
- power_grid_model/_core/power_grid_meta.py +243 -243
- power_grid_model/_core/power_grid_model.py +686 -686
- power_grid_model/_core/power_grid_model_c/__init__.py +3 -3
- 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 -63
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_c/basics.h +255 -255
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_c/buffer.h +108 -108
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_c/dataset.h +316 -316
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_c/dataset_definitions.h +1052 -1052
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_c/handle.h +99 -99
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_c/meta_data.h +189 -189
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_c/model.h +125 -125
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_c/options.h +142 -142
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_c/serialization.h +118 -118
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_c.h +36 -36
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_cpp/basics.hpp +65 -65
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_cpp/buffer.hpp +61 -61
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_cpp/dataset.hpp +220 -220
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_cpp/handle.hpp +108 -108
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_cpp/meta_data.hpp +84 -84
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_cpp/model.hpp +63 -63
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_cpp/options.hpp +52 -52
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_cpp/serialization.hpp +124 -124
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_cpp/utils.hpp +81 -81
- power_grid_model/_core/power_grid_model_c/include/power_grid_model_cpp.hpp +19 -19
- power_grid_model/_core/power_grid_model_c/lib/cmake/power_grid_model/power_grid_modelConfigVersion.cmake +3 -3
- power_grid_model/_core/serialization.py +317 -317
- power_grid_model/_core/typing.py +20 -20
- power_grid_model/_core/utils.py +798 -798
- power_grid_model/data_types.py +321 -321
- power_grid_model/enum.py +27 -27
- power_grid_model/errors.py +37 -37
- power_grid_model/typing.py +43 -43
- power_grid_model/utils.py +473 -473
- power_grid_model/validation/__init__.py +25 -25
- power_grid_model/validation/_rules.py +1171 -1171
- power_grid_model/validation/_validation.py +1172 -1172
- power_grid_model/validation/assertions.py +93 -93
- power_grid_model/validation/errors.py +602 -602
- power_grid_model/validation/utils.py +313 -313
- {power_grid_model-1.12.57.dist-info → power_grid_model-1.12.59.dist-info}/METADATA +1 -1
- power_grid_model-1.12.59.dist-info/RECORD +65 -0
- power_grid_model-1.12.57.dist-info/RECORD +0 -65
- {power_grid_model-1.12.57.dist-info → power_grid_model-1.12.59.dist-info}/WHEEL +0 -0
- {power_grid_model-1.12.57.dist-info → power_grid_model-1.12.59.dist-info}/entry_points.txt +0 -0
- {power_grid_model-1.12.57.dist-info → power_grid_model-1.12.59.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,99 +1,99 @@
|
|
|
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 handle functions
|
|
7
|
-
*
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
#pragma once
|
|
11
|
-
#ifndef POWER_GRID_MODEL_C_HANDLE_H
|
|
12
|
-
#define POWER_GRID_MODEL_C_HANDLE_H
|
|
13
|
-
|
|
14
|
-
#include "basics.h"
|
|
15
|
-
|
|
16
|
-
#ifdef __cplusplus
|
|
17
|
-
extern "C" {
|
|
18
|
-
#endif
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* @brief Create a new handle.
|
|
22
|
-
*
|
|
23
|
-
* A handle object is needed to store error information.
|
|
24
|
-
* If you run it in multi-threading at user side, each thread should have unique handle.
|
|
25
|
-
* The handle should be destroyed by PGM_destroy_handle().
|
|
26
|
-
*
|
|
27
|
-
* @return A pointer to the created handle.
|
|
28
|
-
*/
|
|
29
|
-
PGM_API PGM_Handle* PGM_create_handle(void);
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* @brief Destroy the handle.
|
|
33
|
-
*
|
|
34
|
-
* @param handle The pointer to the handle created by PGM_create_handle().
|
|
35
|
-
*/
|
|
36
|
-
PGM_API void PGM_destroy_handle(PGM_Handle* handle);
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* @brief Get error code of last operation.
|
|
40
|
-
*
|
|
41
|
-
* @param handle The pointer to the handle you just used for an operation.
|
|
42
|
-
* @return The error code, see #PGM_ErrorCode .
|
|
43
|
-
*/
|
|
44
|
-
PGM_API PGM_Idx PGM_error_code(PGM_Handle const* handle);
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* @brief Get error message of last operation.
|
|
48
|
-
*
|
|
49
|
-
* If the error code is PGM_batch_error.
|
|
50
|
-
* Use PGM_n_failed_scenarios(), PGM_failed_scenarios(), and PGM_batch_errors() to retrieve the detail.
|
|
51
|
-
*
|
|
52
|
-
* @param handle The pointer to the handle you just used for an operation.
|
|
53
|
-
* @return A char const* poiner to a zero terminated string.
|
|
54
|
-
* The pointer is not valid if you execute another operation.
|
|
55
|
-
* You need to copy the string in your own data.
|
|
56
|
-
*/
|
|
57
|
-
PGM_API char const* PGM_error_message(PGM_Handle const* handle);
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* @brief Get the number of failed scenarios. Only applicable when you just executed a batch calculation.
|
|
61
|
-
*
|
|
62
|
-
* @param handle The pointer to the handle you just used for a batch calculation.
|
|
63
|
-
* @return The number of failed scenarios.
|
|
64
|
-
*/
|
|
65
|
-
PGM_API PGM_Idx PGM_n_failed_scenarios(PGM_Handle const* handle);
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* @brief Get the list of failed scenarios, Only applicable when you just execute a batch calculation.
|
|
69
|
-
*
|
|
70
|
-
* @param handle The pointer to the handle you just used for a batch calculation.
|
|
71
|
-
* @return A pointer to a PGM_Idx array with length returned by PGM_n_failed_scenarios().
|
|
72
|
-
* The pointer is not valid if you execute another operation.
|
|
73
|
-
* You need to copy the array in your own data.
|
|
74
|
-
*/
|
|
75
|
-
PGM_API PGM_Idx const* PGM_failed_scenarios(PGM_Handle const* handle);
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* @brief Get the list of batch errors. Only applicable when you just execute a batch calculation.
|
|
79
|
-
*
|
|
80
|
-
* @param handle The pointer to the handle you just used for a batch calculation.
|
|
81
|
-
* @return A pointer to a char const* array with length returned by PGM_n_failed_scenarios().
|
|
82
|
-
* Each entry is a zero terminated string.
|
|
83
|
-
* The pointer is not valid if you execute another operation.
|
|
84
|
-
* You need to copy the array (and the string) in your own data.
|
|
85
|
-
*/
|
|
86
|
-
PGM_API char const** PGM_batch_errors(PGM_Handle const* handle);
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* @brief Clear and reset the handle.
|
|
90
|
-
*
|
|
91
|
-
* @param handle The pointer to the handle.
|
|
92
|
-
*/
|
|
93
|
-
PGM_API void PGM_clear_error(PGM_Handle* handle);
|
|
94
|
-
|
|
95
|
-
#ifdef __cplusplus
|
|
96
|
-
}
|
|
97
|
-
#endif
|
|
98
|
-
|
|
99
|
-
#endif
|
|
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 handle functions
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
#pragma once
|
|
11
|
+
#ifndef POWER_GRID_MODEL_C_HANDLE_H
|
|
12
|
+
#define POWER_GRID_MODEL_C_HANDLE_H
|
|
13
|
+
|
|
14
|
+
#include "basics.h"
|
|
15
|
+
|
|
16
|
+
#ifdef __cplusplus
|
|
17
|
+
extern "C" {
|
|
18
|
+
#endif
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @brief Create a new handle.
|
|
22
|
+
*
|
|
23
|
+
* A handle object is needed to store error information.
|
|
24
|
+
* If you run it in multi-threading at user side, each thread should have unique handle.
|
|
25
|
+
* The handle should be destroyed by PGM_destroy_handle().
|
|
26
|
+
*
|
|
27
|
+
* @return A pointer to the created handle.
|
|
28
|
+
*/
|
|
29
|
+
PGM_API PGM_Handle* PGM_create_handle(void);
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* @brief Destroy the handle.
|
|
33
|
+
*
|
|
34
|
+
* @param handle The pointer to the handle created by PGM_create_handle().
|
|
35
|
+
*/
|
|
36
|
+
PGM_API void PGM_destroy_handle(PGM_Handle* handle);
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* @brief Get error code of last operation.
|
|
40
|
+
*
|
|
41
|
+
* @param handle The pointer to the handle you just used for an operation.
|
|
42
|
+
* @return The error code, see #PGM_ErrorCode .
|
|
43
|
+
*/
|
|
44
|
+
PGM_API PGM_Idx PGM_error_code(PGM_Handle const* handle);
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* @brief Get error message of last operation.
|
|
48
|
+
*
|
|
49
|
+
* If the error code is PGM_batch_error.
|
|
50
|
+
* Use PGM_n_failed_scenarios(), PGM_failed_scenarios(), and PGM_batch_errors() to retrieve the detail.
|
|
51
|
+
*
|
|
52
|
+
* @param handle The pointer to the handle you just used for an operation.
|
|
53
|
+
* @return A char const* poiner to a zero terminated string.
|
|
54
|
+
* The pointer is not valid if you execute another operation.
|
|
55
|
+
* You need to copy the string in your own data.
|
|
56
|
+
*/
|
|
57
|
+
PGM_API char const* PGM_error_message(PGM_Handle const* handle);
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* @brief Get the number of failed scenarios. Only applicable when you just executed a batch calculation.
|
|
61
|
+
*
|
|
62
|
+
* @param handle The pointer to the handle you just used for a batch calculation.
|
|
63
|
+
* @return The number of failed scenarios.
|
|
64
|
+
*/
|
|
65
|
+
PGM_API PGM_Idx PGM_n_failed_scenarios(PGM_Handle const* handle);
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* @brief Get the list of failed scenarios, Only applicable when you just execute a batch calculation.
|
|
69
|
+
*
|
|
70
|
+
* @param handle The pointer to the handle you just used for a batch calculation.
|
|
71
|
+
* @return A pointer to a PGM_Idx array with length returned by PGM_n_failed_scenarios().
|
|
72
|
+
* The pointer is not valid if you execute another operation.
|
|
73
|
+
* You need to copy the array in your own data.
|
|
74
|
+
*/
|
|
75
|
+
PGM_API PGM_Idx const* PGM_failed_scenarios(PGM_Handle const* handle);
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* @brief Get the list of batch errors. Only applicable when you just execute a batch calculation.
|
|
79
|
+
*
|
|
80
|
+
* @param handle The pointer to the handle you just used for a batch calculation.
|
|
81
|
+
* @return A pointer to a char const* array with length returned by PGM_n_failed_scenarios().
|
|
82
|
+
* Each entry is a zero terminated string.
|
|
83
|
+
* The pointer is not valid if you execute another operation.
|
|
84
|
+
* You need to copy the array (and the string) in your own data.
|
|
85
|
+
*/
|
|
86
|
+
PGM_API char const** PGM_batch_errors(PGM_Handle const* handle);
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* @brief Clear and reset the handle.
|
|
90
|
+
*
|
|
91
|
+
* @param handle The pointer to the handle.
|
|
92
|
+
*/
|
|
93
|
+
PGM_API void PGM_clear_error(PGM_Handle* handle);
|
|
94
|
+
|
|
95
|
+
#ifdef __cplusplus
|
|
96
|
+
}
|
|
97
|
+
#endif
|
|
98
|
+
|
|
99
|
+
#endif
|
|
@@ -1,189 +1,189 @@
|
|
|
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 meta data functions
|
|
7
|
-
*
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
#pragma once
|
|
11
|
-
#ifndef POWER_GRID_MODEL_C_META_DATA_H
|
|
12
|
-
#define POWER_GRID_MODEL_C_META_DATA_H
|
|
13
|
-
|
|
14
|
-
#include "basics.h"
|
|
15
|
-
|
|
16
|
-
#ifdef __cplusplus
|
|
17
|
-
extern "C" {
|
|
18
|
-
#endif
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* @brief Get number of datasets.
|
|
22
|
-
*
|
|
23
|
-
* @param handle
|
|
24
|
-
* @return The number of datasets.
|
|
25
|
-
*/
|
|
26
|
-
PGM_API PGM_Idx PGM_meta_n_datasets(PGM_Handle* handle);
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* @brief Get pointer of idx-th dataset.
|
|
30
|
-
*
|
|
31
|
-
* @param handle
|
|
32
|
-
* @param idx The sequence number, should be between [0, PGM_meta_n_datasets()).
|
|
33
|
-
* @return The pointer to the idx-th dataset. The pointer is permanantly valid.
|
|
34
|
-
* Or a NULL if your input is out of bound.
|
|
35
|
-
*/
|
|
36
|
-
PGM_API PGM_MetaDataset const* PGM_meta_get_dataset_by_idx(PGM_Handle* handle, PGM_Idx idx);
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* @brief Get pointer of dataset by name.
|
|
40
|
-
*
|
|
41
|
-
* @param handle
|
|
42
|
-
* @param dataset The name of the dataset.
|
|
43
|
-
* @return The pointer to the dataset with that name. The pointer is permanantly valid.
|
|
44
|
-
* Or a NULL if your input is out of bound.
|
|
45
|
-
*/
|
|
46
|
-
PGM_API PGM_MetaDataset const* PGM_meta_get_dataset_by_name(PGM_Handle* handle, char const* dataset);
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* @brief Get name of the dataset.
|
|
50
|
-
*
|
|
51
|
-
* @param handle
|
|
52
|
-
* @param dataset The pointer to a dataset object.
|
|
53
|
-
* @return The name of the dataset in a char const*. The pointer is permanantly valid.
|
|
54
|
-
*/
|
|
55
|
-
PGM_API char const* PGM_meta_dataset_name(PGM_Handle* handle, PGM_MetaDataset const* dataset);
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* @brief Get the number of components for a dataset.
|
|
59
|
-
*
|
|
60
|
-
* @param handle
|
|
61
|
-
* @param dataset The pointer to the dataset.
|
|
62
|
-
* @return Number of components.
|
|
63
|
-
*/
|
|
64
|
-
PGM_API PGM_Idx PGM_meta_n_components(PGM_Handle* handle, PGM_MetaDataset const* dataset);
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* @brief Get pointer of idx-th component of a dataset.
|
|
68
|
-
*
|
|
69
|
-
* @param handle
|
|
70
|
-
* @param dataset The pointer to the dataset.
|
|
71
|
-
* @param idx The sequence number, should be between [0, PGM_meta_n_components()).
|
|
72
|
-
* @return The pointer to the idx-th component. The pointer is permanantly valid.
|
|
73
|
-
* Or a NULL if your input is out of bound.
|
|
74
|
-
*/
|
|
75
|
-
PGM_API PGM_MetaComponent const* PGM_meta_get_component_by_idx(PGM_Handle* handle, PGM_MetaDataset const* dataset,
|
|
76
|
-
PGM_Idx idx);
|
|
77
|
-
/**
|
|
78
|
-
* @brief Get pointer of a component by name.
|
|
79
|
-
*
|
|
80
|
-
* @param handle
|
|
81
|
-
* @param dataset The name of the dataset.
|
|
82
|
-
* @param component The name of the component.
|
|
83
|
-
* @return The pointer to the component with that name. The pointer is permanantly valid.
|
|
84
|
-
* Or a NULL if your input is out of bound.
|
|
85
|
-
*/
|
|
86
|
-
PGM_API PGM_MetaComponent const* PGM_meta_get_component_by_name(PGM_Handle* handle, char const* dataset,
|
|
87
|
-
char const* component);
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* @brief Get name of component.
|
|
91
|
-
*
|
|
92
|
-
* @param handle
|
|
93
|
-
* @param component The pointer to the component.
|
|
94
|
-
* @return The name of the component in a char const*. The pointer is permanantly valid.
|
|
95
|
-
*/
|
|
96
|
-
PGM_API char const* PGM_meta_component_name(PGM_Handle* handle, PGM_MetaComponent const* component);
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* @brief Get size of the component.
|
|
100
|
-
*
|
|
101
|
-
* @param handle
|
|
102
|
-
* @param component The pointer to the component.
|
|
103
|
-
* @return Size of the component.
|
|
104
|
-
*/
|
|
105
|
-
PGM_API size_t PGM_meta_component_size(PGM_Handle* handle, PGM_MetaComponent const* component);
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* @brief Get alignment of the component.
|
|
109
|
-
*
|
|
110
|
-
* @param handle
|
|
111
|
-
* @param component The pointer to the component.
|
|
112
|
-
* @return Alignment of the component.
|
|
113
|
-
*/
|
|
114
|
-
PGM_API size_t PGM_meta_component_alignment(PGM_Handle* handle, PGM_MetaComponent const* component);
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* @brief Get number of attributes of the component.
|
|
118
|
-
*
|
|
119
|
-
* @param handle
|
|
120
|
-
* @param component The pointer to the component.
|
|
121
|
-
* @return Number of attributes.
|
|
122
|
-
*/
|
|
123
|
-
PGM_API PGM_Idx PGM_meta_n_attributes(PGM_Handle* handle, PGM_MetaComponent const* component);
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* @brief Get pointer of idx-th attribute of a component.
|
|
127
|
-
*
|
|
128
|
-
* @param handle
|
|
129
|
-
* @param component The pointer to the component.
|
|
130
|
-
* @param idx The sequence number, should be between [0, PGM_meta_n_attributes())
|
|
131
|
-
* @return The pointer to the idx-th attribute. The pointer is permanantly valid.
|
|
132
|
-
* Or a NULL if your input is out of bound.
|
|
133
|
-
*/
|
|
134
|
-
PGM_API PGM_MetaAttribute const* PGM_meta_get_attribute_by_idx(PGM_Handle* handle, PGM_MetaComponent const* component,
|
|
135
|
-
PGM_Idx idx);
|
|
136
|
-
/**
|
|
137
|
-
* @brief Get pointer of a attribute by name.
|
|
138
|
-
*
|
|
139
|
-
* @param handle
|
|
140
|
-
* @param dataset The name of the dataset.
|
|
141
|
-
* @param component The name of the component.
|
|
142
|
-
* @param attribute The name of the attribute.
|
|
143
|
-
* @return The pointer to the component with that name. The pointer is permanantly valid.
|
|
144
|
-
* Or a NULL if your input is out of bound.
|
|
145
|
-
*/
|
|
146
|
-
PGM_API PGM_MetaAttribute const* PGM_meta_get_attribute_by_name(PGM_Handle* handle, char const* dataset,
|
|
147
|
-
char const* component, char const* attribute);
|
|
148
|
-
|
|
149
|
-
/**
|
|
150
|
-
* @brief Get attribute name.
|
|
151
|
-
*
|
|
152
|
-
* @param handle
|
|
153
|
-
* @param attribute The pointer to attribute.
|
|
154
|
-
* @return The name of the attribute in char const*. The pointer is permanantly valid.
|
|
155
|
-
*/
|
|
156
|
-
PGM_API char const* PGM_meta_attribute_name(PGM_Handle* handle, PGM_MetaAttribute const* attribute);
|
|
157
|
-
|
|
158
|
-
/**
|
|
159
|
-
* @brief Get the type of an attribute.
|
|
160
|
-
*
|
|
161
|
-
* @param handle
|
|
162
|
-
* @param attribute The pointer to attribute.
|
|
163
|
-
* @return The type of the attribute as in enum PGM_CType.
|
|
164
|
-
*
|
|
165
|
-
*/
|
|
166
|
-
PGM_API PGM_Idx PGM_meta_attribute_ctype(PGM_Handle* handle, PGM_MetaAttribute const* attribute);
|
|
167
|
-
|
|
168
|
-
/**
|
|
169
|
-
* @brief Get the offset of an attribute in a component.
|
|
170
|
-
*
|
|
171
|
-
* @param handle
|
|
172
|
-
* @param attribute The pointer to attribute.
|
|
173
|
-
* @return The offset of this attribute.
|
|
174
|
-
*/
|
|
175
|
-
PGM_API size_t PGM_meta_attribute_offset(PGM_Handle* handle, PGM_MetaAttribute const* attribute);
|
|
176
|
-
|
|
177
|
-
/**
|
|
178
|
-
* @brief Get whether the system is little endian.
|
|
179
|
-
*
|
|
180
|
-
* @param handle
|
|
181
|
-
* @return 1 if the system is litten endian; 0 if the system is big endian.
|
|
182
|
-
*/
|
|
183
|
-
PGM_API int PGM_is_little_endian(PGM_Handle* handle);
|
|
184
|
-
|
|
185
|
-
#ifdef __cplusplus
|
|
186
|
-
}
|
|
187
|
-
#endif
|
|
188
|
-
|
|
189
|
-
#endif
|
|
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 meta data functions
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
#pragma once
|
|
11
|
+
#ifndef POWER_GRID_MODEL_C_META_DATA_H
|
|
12
|
+
#define POWER_GRID_MODEL_C_META_DATA_H
|
|
13
|
+
|
|
14
|
+
#include "basics.h"
|
|
15
|
+
|
|
16
|
+
#ifdef __cplusplus
|
|
17
|
+
extern "C" {
|
|
18
|
+
#endif
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @brief Get number of datasets.
|
|
22
|
+
*
|
|
23
|
+
* @param handle
|
|
24
|
+
* @return The number of datasets.
|
|
25
|
+
*/
|
|
26
|
+
PGM_API PGM_Idx PGM_meta_n_datasets(PGM_Handle* handle);
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* @brief Get pointer of idx-th dataset.
|
|
30
|
+
*
|
|
31
|
+
* @param handle
|
|
32
|
+
* @param idx The sequence number, should be between [0, PGM_meta_n_datasets()).
|
|
33
|
+
* @return The pointer to the idx-th dataset. The pointer is permanantly valid.
|
|
34
|
+
* Or a NULL if your input is out of bound.
|
|
35
|
+
*/
|
|
36
|
+
PGM_API PGM_MetaDataset const* PGM_meta_get_dataset_by_idx(PGM_Handle* handle, PGM_Idx idx);
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* @brief Get pointer of dataset by name.
|
|
40
|
+
*
|
|
41
|
+
* @param handle
|
|
42
|
+
* @param dataset The name of the dataset.
|
|
43
|
+
* @return The pointer to the dataset with that name. The pointer is permanantly valid.
|
|
44
|
+
* Or a NULL if your input is out of bound.
|
|
45
|
+
*/
|
|
46
|
+
PGM_API PGM_MetaDataset const* PGM_meta_get_dataset_by_name(PGM_Handle* handle, char const* dataset);
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* @brief Get name of the dataset.
|
|
50
|
+
*
|
|
51
|
+
* @param handle
|
|
52
|
+
* @param dataset The pointer to a dataset object.
|
|
53
|
+
* @return The name of the dataset in a char const*. The pointer is permanantly valid.
|
|
54
|
+
*/
|
|
55
|
+
PGM_API char const* PGM_meta_dataset_name(PGM_Handle* handle, PGM_MetaDataset const* dataset);
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* @brief Get the number of components for a dataset.
|
|
59
|
+
*
|
|
60
|
+
* @param handle
|
|
61
|
+
* @param dataset The pointer to the dataset.
|
|
62
|
+
* @return Number of components.
|
|
63
|
+
*/
|
|
64
|
+
PGM_API PGM_Idx PGM_meta_n_components(PGM_Handle* handle, PGM_MetaDataset const* dataset);
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* @brief Get pointer of idx-th component of a dataset.
|
|
68
|
+
*
|
|
69
|
+
* @param handle
|
|
70
|
+
* @param dataset The pointer to the dataset.
|
|
71
|
+
* @param idx The sequence number, should be between [0, PGM_meta_n_components()).
|
|
72
|
+
* @return The pointer to the idx-th component. The pointer is permanantly valid.
|
|
73
|
+
* Or a NULL if your input is out of bound.
|
|
74
|
+
*/
|
|
75
|
+
PGM_API PGM_MetaComponent const* PGM_meta_get_component_by_idx(PGM_Handle* handle, PGM_MetaDataset const* dataset,
|
|
76
|
+
PGM_Idx idx);
|
|
77
|
+
/**
|
|
78
|
+
* @brief Get pointer of a component by name.
|
|
79
|
+
*
|
|
80
|
+
* @param handle
|
|
81
|
+
* @param dataset The name of the dataset.
|
|
82
|
+
* @param component The name of the component.
|
|
83
|
+
* @return The pointer to the component with that name. The pointer is permanantly valid.
|
|
84
|
+
* Or a NULL if your input is out of bound.
|
|
85
|
+
*/
|
|
86
|
+
PGM_API PGM_MetaComponent const* PGM_meta_get_component_by_name(PGM_Handle* handle, char const* dataset,
|
|
87
|
+
char const* component);
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* @brief Get name of component.
|
|
91
|
+
*
|
|
92
|
+
* @param handle
|
|
93
|
+
* @param component The pointer to the component.
|
|
94
|
+
* @return The name of the component in a char const*. The pointer is permanantly valid.
|
|
95
|
+
*/
|
|
96
|
+
PGM_API char const* PGM_meta_component_name(PGM_Handle* handle, PGM_MetaComponent const* component);
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* @brief Get size of the component.
|
|
100
|
+
*
|
|
101
|
+
* @param handle
|
|
102
|
+
* @param component The pointer to the component.
|
|
103
|
+
* @return Size of the component.
|
|
104
|
+
*/
|
|
105
|
+
PGM_API size_t PGM_meta_component_size(PGM_Handle* handle, PGM_MetaComponent const* component);
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* @brief Get alignment of the component.
|
|
109
|
+
*
|
|
110
|
+
* @param handle
|
|
111
|
+
* @param component The pointer to the component.
|
|
112
|
+
* @return Alignment of the component.
|
|
113
|
+
*/
|
|
114
|
+
PGM_API size_t PGM_meta_component_alignment(PGM_Handle* handle, PGM_MetaComponent const* component);
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* @brief Get number of attributes of the component.
|
|
118
|
+
*
|
|
119
|
+
* @param handle
|
|
120
|
+
* @param component The pointer to the component.
|
|
121
|
+
* @return Number of attributes.
|
|
122
|
+
*/
|
|
123
|
+
PGM_API PGM_Idx PGM_meta_n_attributes(PGM_Handle* handle, PGM_MetaComponent const* component);
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* @brief Get pointer of idx-th attribute of a component.
|
|
127
|
+
*
|
|
128
|
+
* @param handle
|
|
129
|
+
* @param component The pointer to the component.
|
|
130
|
+
* @param idx The sequence number, should be between [0, PGM_meta_n_attributes())
|
|
131
|
+
* @return The pointer to the idx-th attribute. The pointer is permanantly valid.
|
|
132
|
+
* Or a NULL if your input is out of bound.
|
|
133
|
+
*/
|
|
134
|
+
PGM_API PGM_MetaAttribute const* PGM_meta_get_attribute_by_idx(PGM_Handle* handle, PGM_MetaComponent const* component,
|
|
135
|
+
PGM_Idx idx);
|
|
136
|
+
/**
|
|
137
|
+
* @brief Get pointer of a attribute by name.
|
|
138
|
+
*
|
|
139
|
+
* @param handle
|
|
140
|
+
* @param dataset The name of the dataset.
|
|
141
|
+
* @param component The name of the component.
|
|
142
|
+
* @param attribute The name of the attribute.
|
|
143
|
+
* @return The pointer to the component with that name. The pointer is permanantly valid.
|
|
144
|
+
* Or a NULL if your input is out of bound.
|
|
145
|
+
*/
|
|
146
|
+
PGM_API PGM_MetaAttribute const* PGM_meta_get_attribute_by_name(PGM_Handle* handle, char const* dataset,
|
|
147
|
+
char const* component, char const* attribute);
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* @brief Get attribute name.
|
|
151
|
+
*
|
|
152
|
+
* @param handle
|
|
153
|
+
* @param attribute The pointer to attribute.
|
|
154
|
+
* @return The name of the attribute in char const*. The pointer is permanantly valid.
|
|
155
|
+
*/
|
|
156
|
+
PGM_API char const* PGM_meta_attribute_name(PGM_Handle* handle, PGM_MetaAttribute const* attribute);
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* @brief Get the type of an attribute.
|
|
160
|
+
*
|
|
161
|
+
* @param handle
|
|
162
|
+
* @param attribute The pointer to attribute.
|
|
163
|
+
* @return The type of the attribute as in enum PGM_CType.
|
|
164
|
+
*
|
|
165
|
+
*/
|
|
166
|
+
PGM_API PGM_Idx PGM_meta_attribute_ctype(PGM_Handle* handle, PGM_MetaAttribute const* attribute);
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* @brief Get the offset of an attribute in a component.
|
|
170
|
+
*
|
|
171
|
+
* @param handle
|
|
172
|
+
* @param attribute The pointer to attribute.
|
|
173
|
+
* @return The offset of this attribute.
|
|
174
|
+
*/
|
|
175
|
+
PGM_API size_t PGM_meta_attribute_offset(PGM_Handle* handle, PGM_MetaAttribute const* attribute);
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* @brief Get whether the system is little endian.
|
|
179
|
+
*
|
|
180
|
+
* @param handle
|
|
181
|
+
* @return 1 if the system is litten endian; 0 if the system is big endian.
|
|
182
|
+
*/
|
|
183
|
+
PGM_API int PGM_is_little_endian(PGM_Handle* handle);
|
|
184
|
+
|
|
185
|
+
#ifdef __cplusplus
|
|
186
|
+
}
|
|
187
|
+
#endif
|
|
188
|
+
|
|
189
|
+
#endif
|