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,52 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Contributors to the Power Grid Model project <powergridmodel@lfenergy.org>
|
|
2
|
+
//
|
|
3
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
4
|
+
|
|
5
|
+
#pragma once
|
|
6
|
+
#ifndef POWER_GRID_MODEL_CPP_OPTIONS_HPP
|
|
7
|
+
#define POWER_GRID_MODEL_CPP_OPTIONS_HPP
|
|
8
|
+
|
|
9
|
+
#include "basics.hpp"
|
|
10
|
+
#include "handle.hpp"
|
|
11
|
+
|
|
12
|
+
#include "power_grid_model_c/options.h"
|
|
13
|
+
|
|
14
|
+
namespace power_grid_model_cpp {
|
|
15
|
+
class Options {
|
|
16
|
+
public:
|
|
17
|
+
Options() : options_{handle_.call_with(PGM_create_options)} {}
|
|
18
|
+
|
|
19
|
+
RawOptions* get() { return options_.get(); }
|
|
20
|
+
RawOptions const* get() const { return options_.get(); }
|
|
21
|
+
|
|
22
|
+
void set_calculation_type(Idx type) { handle_.call_with(PGM_set_calculation_type, get(), type); }
|
|
23
|
+
|
|
24
|
+
void set_calculation_method(Idx method) { handle_.call_with(PGM_set_calculation_method, get(), method); }
|
|
25
|
+
|
|
26
|
+
void set_symmetric(Idx sym) { handle_.call_with(PGM_set_symmetric, get(), sym); }
|
|
27
|
+
|
|
28
|
+
void set_err_tol(double err_tol) { handle_.call_with(PGM_set_err_tol, get(), err_tol); }
|
|
29
|
+
|
|
30
|
+
void set_max_iter(Idx max_iter) { handle_.call_with(PGM_set_max_iter, get(), max_iter); }
|
|
31
|
+
|
|
32
|
+
void set_threading(Idx threading) { handle_.call_with(PGM_set_threading, get(), threading); }
|
|
33
|
+
|
|
34
|
+
void set_short_circuit_voltage_scaling(Idx short_circuit_voltage_scaling) {
|
|
35
|
+
handle_.call_with(PGM_set_short_circuit_voltage_scaling, get(), short_circuit_voltage_scaling);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
void set_tap_changing_strategy(Idx tap_changing_strategy) {
|
|
39
|
+
handle_.call_with(PGM_set_tap_changing_strategy, get(), tap_changing_strategy);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
void set_experimental_features(Idx experimental_features) {
|
|
43
|
+
handle_.call_with(PGM_set_experimental_features, get(), experimental_features);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
private:
|
|
47
|
+
Handle handle_{};
|
|
48
|
+
detail::UniquePtr<RawOptions, &PGM_destroy_options> options_;
|
|
49
|
+
};
|
|
50
|
+
} // namespace power_grid_model_cpp
|
|
51
|
+
|
|
52
|
+
#endif // POWER_GRID_MODEL_CPP_OPTIONS_HPP
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Contributors to the Power Grid Model project <powergridmodel@lfenergy.org>
|
|
2
|
+
//
|
|
3
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
4
|
+
|
|
5
|
+
#pragma once
|
|
6
|
+
#ifndef POWER_GRID_MODEL_CPP_SERIALIZATION_HPP
|
|
7
|
+
#define POWER_GRID_MODEL_CPP_SERIALIZATION_HPP
|
|
8
|
+
|
|
9
|
+
#include "basics.hpp"
|
|
10
|
+
#include "dataset.hpp"
|
|
11
|
+
#include "handle.hpp"
|
|
12
|
+
#include "meta_data.hpp"
|
|
13
|
+
|
|
14
|
+
#include "power_grid_model_c/serialization.h"
|
|
15
|
+
|
|
16
|
+
#include <cstring>
|
|
17
|
+
|
|
18
|
+
namespace power_grid_model_cpp {
|
|
19
|
+
class Deserializer {
|
|
20
|
+
public:
|
|
21
|
+
Deserializer(std::vector<std::byte> const& data, Idx serialization_format)
|
|
22
|
+
: deserializer_{handle_.call_with(PGM_create_deserializer_from_binary_buffer,
|
|
23
|
+
reinterpret_cast<const char*>(data.data()), static_cast<Idx>(data.size()),
|
|
24
|
+
serialization_format)},
|
|
25
|
+
dataset_{handle_.call_with(PGM_deserializer_get_dataset, get())} {}
|
|
26
|
+
Deserializer(std::vector<char> const& data, Idx serialization_format)
|
|
27
|
+
: deserializer_{handle_.call_with(PGM_create_deserializer_from_binary_buffer, data.data(),
|
|
28
|
+
static_cast<Idx>(data.size()), serialization_format)},
|
|
29
|
+
dataset_{handle_.call_with(PGM_deserializer_get_dataset, get())} {}
|
|
30
|
+
Deserializer(std::string const& data_string, Idx serialization_format)
|
|
31
|
+
: deserializer_{handle_.call_with(PGM_create_deserializer_from_null_terminated_string, data_string.c_str(),
|
|
32
|
+
serialization_format)},
|
|
33
|
+
dataset_{handle_.call_with(PGM_deserializer_get_dataset, get())} {}
|
|
34
|
+
|
|
35
|
+
RawDeserializer* get() { return deserializer_.get(); }
|
|
36
|
+
RawDeserializer const* get() const { return deserializer_.get(); }
|
|
37
|
+
|
|
38
|
+
DatasetWritable& get_dataset() { return dataset_; }
|
|
39
|
+
|
|
40
|
+
void parse_to_buffer() { handle_.call_with(PGM_deserializer_parse_to_buffer, get()); }
|
|
41
|
+
|
|
42
|
+
private:
|
|
43
|
+
Handle handle_{};
|
|
44
|
+
detail::UniquePtr<RawDeserializer, &PGM_destroy_deserializer> deserializer_;
|
|
45
|
+
DatasetWritable dataset_;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
class Serializer {
|
|
49
|
+
public:
|
|
50
|
+
Serializer(DatasetConst const& dataset, Idx serialization_format)
|
|
51
|
+
: serializer_{handle_.call_with(PGM_create_serializer, dataset.get(), serialization_format)} {}
|
|
52
|
+
|
|
53
|
+
RawSerializer* get() { return serializer_.get(); }
|
|
54
|
+
RawSerializer const* get() const { return serializer_.get(); }
|
|
55
|
+
|
|
56
|
+
std::string_view get_to_binary_buffer(Idx use_compact_list) {
|
|
57
|
+
char const* temp_data{};
|
|
58
|
+
Idx buffer_size{};
|
|
59
|
+
handle_.call_with(PGM_serializer_get_to_binary_buffer, get(), use_compact_list, &temp_data, &buffer_size);
|
|
60
|
+
if (temp_data == nullptr) {
|
|
61
|
+
return std::string_view{};
|
|
62
|
+
} // empty data
|
|
63
|
+
return std::string_view{temp_data, static_cast<size_t>(buffer_size)};
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
void get_to_binary_buffer(Idx use_compact_list, std::vector<std::byte>& data) {
|
|
67
|
+
auto temp_data = get_to_binary_buffer(use_compact_list);
|
|
68
|
+
if (!temp_data.empty()) {
|
|
69
|
+
data.resize(temp_data.size());
|
|
70
|
+
std::memcpy(data.data(), temp_data.data(), temp_data.size());
|
|
71
|
+
} else {
|
|
72
|
+
data.resize(0); // empty data
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
void get_to_binary_buffer(Idx use_compact_list, std::vector<char>& data) {
|
|
77
|
+
auto temp_data = get_to_binary_buffer(use_compact_list);
|
|
78
|
+
if (!temp_data.empty()) {
|
|
79
|
+
data.assign(temp_data.begin(), temp_data.end());
|
|
80
|
+
} else {
|
|
81
|
+
data.resize(0); // empty data
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
std::string get_to_zero_terminated_string(Idx use_compact_list, Idx indent) {
|
|
86
|
+
return std::string{
|
|
87
|
+
handle_.call_with(PGM_serializer_get_to_zero_terminated_string, get(), use_compact_list, indent)};
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
private:
|
|
91
|
+
power_grid_model_cpp::Handle handle_{};
|
|
92
|
+
detail::UniquePtr<RawSerializer, &PGM_destroy_serializer> serializer_;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
inline OwningDataset create_owning_dataset(DatasetWritable& writable_dataset) {
|
|
96
|
+
auto const& info = writable_dataset.get_info();
|
|
97
|
+
bool const is_batch = info.is_batch();
|
|
98
|
+
Idx const batch_size = info.batch_size();
|
|
99
|
+
auto const& dataset_name = info.name();
|
|
100
|
+
DatasetMutable dataset_mutable{dataset_name, is_batch, batch_size};
|
|
101
|
+
OwningMemory storage{};
|
|
102
|
+
|
|
103
|
+
for (Idx component_idx{}; component_idx < info.n_components(); ++component_idx) {
|
|
104
|
+
auto const& component_name = info.component_name(component_idx);
|
|
105
|
+
auto const& component_meta = MetaData::get_component_by_name(dataset_name, component_name);
|
|
106
|
+
Idx const component_size = info.component_total_elements(component_idx);
|
|
107
|
+
Idx const elements_per_scenario = info.component_elements_per_scenario(component_idx);
|
|
108
|
+
|
|
109
|
+
auto& current_indptr = storage.indptrs.emplace_back(elements_per_scenario < 0 ? batch_size + 1 : 0);
|
|
110
|
+
if (!current_indptr.empty()) {
|
|
111
|
+
current_indptr.at(0) = 0;
|
|
112
|
+
current_indptr.at(batch_size) = component_size;
|
|
113
|
+
}
|
|
114
|
+
Idx* const indptr = current_indptr.empty() ? nullptr : current_indptr.data();
|
|
115
|
+
auto& current_buffer = storage.buffers.emplace_back(component_meta, component_size);
|
|
116
|
+
writable_dataset.set_buffer(component_name, indptr, current_buffer);
|
|
117
|
+
dataset_mutable.add_buffer(component_name, elements_per_scenario, component_size, indptr, current_buffer);
|
|
118
|
+
}
|
|
119
|
+
return OwningDataset{// NOLINT(modernize-use-designated-initializers)
|
|
120
|
+
std::move(dataset_mutable), std::move(storage)};
|
|
121
|
+
}
|
|
122
|
+
} // namespace power_grid_model_cpp
|
|
123
|
+
|
|
124
|
+
#endif // POWER_GRID_MODEL_CPP_SERIALIZATION_HPP
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Contributors to the Power Grid Model project <powergridmodel@lfenergy.org>
|
|
2
|
+
//
|
|
3
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
4
|
+
|
|
5
|
+
#pragma once
|
|
6
|
+
|
|
7
|
+
#ifndef POWER_GRID_MODEL_CPP_UTILS_HPP
|
|
8
|
+
#define POWER_GRID_MODEL_CPP_UTILS_HPP
|
|
9
|
+
|
|
10
|
+
#include "basics.hpp"
|
|
11
|
+
#include "handle.hpp"
|
|
12
|
+
#include "meta_data.hpp"
|
|
13
|
+
|
|
14
|
+
#include <array>
|
|
15
|
+
#include <complex>
|
|
16
|
+
#include <limits>
|
|
17
|
+
|
|
18
|
+
namespace power_grid_model_cpp {
|
|
19
|
+
inline bool is_nan(IntS const x) { return x == std::numeric_limits<IntS>::min(); }
|
|
20
|
+
inline bool is_nan(ID const x) { return x == std::numeric_limits<ID>::min(); }
|
|
21
|
+
inline bool is_nan(double const x) { return std::isnan(x); }
|
|
22
|
+
inline bool is_nan(std::complex<double> const& x) { return is_nan(x.real()) || is_nan(x.imag()); }
|
|
23
|
+
inline bool is_nan(std::array<double, 3> const& array) {
|
|
24
|
+
return is_nan(array[0]) || is_nan(array[1]) || is_nan(array[2]);
|
|
25
|
+
}
|
|
26
|
+
inline bool is_nan(std::array<std::complex<double>, 3> const& array) {
|
|
27
|
+
return is_nan(array[0]) || is_nan(array[1]) || is_nan(array[2]);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
constexpr double nan = std::numeric_limits<double>::quiet_NaN();
|
|
31
|
+
constexpr int8_t na_IntS = std::numeric_limits<int8_t>::min();
|
|
32
|
+
constexpr ID na_IntID = std::numeric_limits<ID>::min();
|
|
33
|
+
|
|
34
|
+
template <typename T> constexpr T nan_value() {
|
|
35
|
+
if constexpr (std::is_same_v<T, double>) {
|
|
36
|
+
return nan;
|
|
37
|
+
} else if constexpr (std::is_same_v<T, ID>) {
|
|
38
|
+
return na_IntID;
|
|
39
|
+
} else if constexpr (std::is_same_v<T, int8_t>) {
|
|
40
|
+
return na_IntS;
|
|
41
|
+
} else if constexpr (std::is_same_v<T, std::array<double, 3>>) {
|
|
42
|
+
return std::array<double, 3>{nan, nan, nan};
|
|
43
|
+
} else {
|
|
44
|
+
static_assert(false, "Unsupported type for nan_value");
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
class UnsupportedPGM_CType : public PowerGridError {
|
|
49
|
+
public:
|
|
50
|
+
UnsupportedPGM_CType()
|
|
51
|
+
: PowerGridError{[&]() {
|
|
52
|
+
using namespace std::string_literals;
|
|
53
|
+
return "Unsupported PGM_Ctype"s;
|
|
54
|
+
}()} {}
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
template <class Functor, class... Args>
|
|
58
|
+
decltype(auto) pgm_type_func_selector(enum PGM_CType type, Functor&& f, Args&&... args) {
|
|
59
|
+
switch (type) {
|
|
60
|
+
case PGM_int32:
|
|
61
|
+
return std::forward<Functor>(f).template operator()<ID>(std::forward<Args>(args)...);
|
|
62
|
+
case PGM_int8:
|
|
63
|
+
return std::forward<Functor>(f).template operator()<IntS>(std::forward<Args>(args)...);
|
|
64
|
+
case PGM_double:
|
|
65
|
+
return std::forward<Functor>(f).template operator()<double>(std::forward<Args>(args)...);
|
|
66
|
+
case PGM_double3:
|
|
67
|
+
return std::forward<Functor>(f).template operator()<std::array<double, 3>>(std::forward<Args>(args)...);
|
|
68
|
+
default:
|
|
69
|
+
throw UnsupportedPGM_CType();
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
template <class Functor, class... Args>
|
|
74
|
+
decltype(auto) pgm_type_func_selector(MetaAttribute const* attribute, Functor&& f, Args&&... args) {
|
|
75
|
+
return pgm_type_func_selector(MetaData::attribute_ctype(attribute), std::forward<Functor>(f),
|
|
76
|
+
std::forward<Args>(args)...);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
} // namespace power_grid_model_cpp
|
|
80
|
+
|
|
81
|
+
#endif // POWER_GRID_MODEL_CPP_UTILS_HPP
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Contributors to the Power Grid Model project <powergridmodel@lfenergy.org>
|
|
2
|
+
//
|
|
3
|
+
// SPDX-License-Identifier: MPL-2.0
|
|
4
|
+
|
|
5
|
+
#pragma once
|
|
6
|
+
#ifndef POWER_GRID_MODEL_CPP_HPP
|
|
7
|
+
#define POWER_GRID_MODEL_CPP_HPP
|
|
8
|
+
|
|
9
|
+
#include "power_grid_model_cpp/basics.hpp"
|
|
10
|
+
#include "power_grid_model_cpp/buffer.hpp"
|
|
11
|
+
#include "power_grid_model_cpp/dataset.hpp"
|
|
12
|
+
#include "power_grid_model_cpp/handle.hpp"
|
|
13
|
+
#include "power_grid_model_cpp/meta_data.hpp"
|
|
14
|
+
#include "power_grid_model_cpp/model.hpp"
|
|
15
|
+
#include "power_grid_model_cpp/options.hpp"
|
|
16
|
+
#include "power_grid_model_cpp/serialization.hpp"
|
|
17
|
+
#include "power_grid_model_cpp/utils.hpp"
|
|
18
|
+
|
|
19
|
+
#endif // POWER_GRID_MODEL_CPP_HPP
|
power_grid_model/_core/power_grid_model_c/lib/cmake/power_grid_model/power_grid_modelConfig.cmake
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: Contributors to the Power Grid Model project <powergridmodel@lfenergy.org>
|
|
2
|
+
#
|
|
3
|
+
# SPDX-License-Identifier: MPL-2.0
|
|
4
|
+
|
|
5
|
+
# CMake package of power_grid_model
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
####### Expanded from @PACKAGE_INIT@ by configure_package_config_file() #######
|
|
9
|
+
####### Any changes to this file will be overwritten by the next CMake run ####
|
|
10
|
+
####### The input file was power_grid_modelConfig.cmake.in ########
|
|
11
|
+
|
|
12
|
+
get_filename_component(PACKAGE_PREFIX_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../" ABSOLUTE)
|
|
13
|
+
|
|
14
|
+
macro(set_and_check _var _file)
|
|
15
|
+
set(${_var} "${_file}")
|
|
16
|
+
if(NOT EXISTS "${_file}")
|
|
17
|
+
message(FATAL_ERROR "File or directory ${_file} referenced by variable ${_var} does not exist !")
|
|
18
|
+
endif()
|
|
19
|
+
endmacro()
|
|
20
|
+
|
|
21
|
+
macro(check_required_components _NAME)
|
|
22
|
+
foreach(comp ${${_NAME}_FIND_COMPONENTS})
|
|
23
|
+
if(NOT ${_NAME}_${comp}_FOUND)
|
|
24
|
+
if(${_NAME}_FIND_REQUIRED_${comp})
|
|
25
|
+
set(${_NAME}_FOUND FALSE)
|
|
26
|
+
endif()
|
|
27
|
+
endif()
|
|
28
|
+
endforeach()
|
|
29
|
+
endmacro()
|
|
30
|
+
|
|
31
|
+
####################################################################################
|
|
32
|
+
|
|
33
|
+
if(NOT TARGET power_grid_model::power_grid_model_c)
|
|
34
|
+
include("${CMAKE_CURRENT_LIST_DIR}/power_grid_modelTargets.cmake")
|
|
35
|
+
endif()
|
|
36
|
+
|
|
37
|
+
check_required_components(power_grid_model)
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# This is a basic version file for the Config-mode of find_package().
|
|
2
|
+
# It is used by write_basic_package_version_file() as input file for configure_file()
|
|
3
|
+
# to create a version-file which can be installed along a config.cmake file.
|
|
4
|
+
#
|
|
5
|
+
# The created file sets PACKAGE_VERSION_EXACT if the current version string and
|
|
6
|
+
# the requested version string are exactly the same and it sets
|
|
7
|
+
# PACKAGE_VERSION_COMPATIBLE if the current version is >= requested version,
|
|
8
|
+
# but only if the requested major version is the same as the current one.
|
|
9
|
+
# The variable CVF_VERSION must be set before calling configure_file().
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
set(PACKAGE_VERSION "1.12.119")
|
|
13
|
+
|
|
14
|
+
if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
|
|
15
|
+
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
|
16
|
+
else()
|
|
17
|
+
|
|
18
|
+
if("1.12.119" MATCHES "^([0-9]+)\\.")
|
|
19
|
+
set(CVF_VERSION_MAJOR "${CMAKE_MATCH_1}")
|
|
20
|
+
if(NOT CVF_VERSION_MAJOR VERSION_EQUAL 0)
|
|
21
|
+
string(REGEX REPLACE "^0+" "" CVF_VERSION_MAJOR "${CVF_VERSION_MAJOR}")
|
|
22
|
+
endif()
|
|
23
|
+
else()
|
|
24
|
+
set(CVF_VERSION_MAJOR "1.12.119")
|
|
25
|
+
endif()
|
|
26
|
+
|
|
27
|
+
if(PACKAGE_FIND_VERSION_RANGE)
|
|
28
|
+
# both endpoints of the range must have the expected major version
|
|
29
|
+
math (EXPR CVF_VERSION_MAJOR_NEXT "${CVF_VERSION_MAJOR} + 1")
|
|
30
|
+
if (NOT PACKAGE_FIND_VERSION_MIN_MAJOR STREQUAL CVF_VERSION_MAJOR
|
|
31
|
+
OR ((PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE" AND NOT PACKAGE_FIND_VERSION_MAX_MAJOR STREQUAL CVF_VERSION_MAJOR)
|
|
32
|
+
OR (PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE" AND NOT PACKAGE_FIND_VERSION_MAX VERSION_LESS_EQUAL CVF_VERSION_MAJOR_NEXT)))
|
|
33
|
+
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
|
34
|
+
elseif(PACKAGE_FIND_VERSION_MIN_MAJOR STREQUAL CVF_VERSION_MAJOR
|
|
35
|
+
AND ((PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE" AND PACKAGE_VERSION VERSION_LESS_EQUAL PACKAGE_FIND_VERSION_MAX)
|
|
36
|
+
OR (PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE" AND PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION_MAX)))
|
|
37
|
+
set(PACKAGE_VERSION_COMPATIBLE TRUE)
|
|
38
|
+
else()
|
|
39
|
+
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
|
40
|
+
endif()
|
|
41
|
+
else()
|
|
42
|
+
if(PACKAGE_FIND_VERSION_MAJOR STREQUAL CVF_VERSION_MAJOR)
|
|
43
|
+
set(PACKAGE_VERSION_COMPATIBLE TRUE)
|
|
44
|
+
else()
|
|
45
|
+
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
|
46
|
+
endif()
|
|
47
|
+
|
|
48
|
+
if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
|
|
49
|
+
set(PACKAGE_VERSION_EXACT TRUE)
|
|
50
|
+
endif()
|
|
51
|
+
endif()
|
|
52
|
+
endif()
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it:
|
|
56
|
+
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "8" STREQUAL "")
|
|
57
|
+
return()
|
|
58
|
+
endif()
|
|
59
|
+
|
|
60
|
+
# check that the installed version has the same 32/64bit-ness as the one which is currently searching:
|
|
61
|
+
if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "8")
|
|
62
|
+
math(EXPR installedBits "8 * 8")
|
|
63
|
+
set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)")
|
|
64
|
+
set(PACKAGE_VERSION_UNSUITABLE TRUE)
|
|
65
|
+
endif()
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#----------------------------------------------------------------
|
|
2
|
+
# Generated CMake target import file for configuration "Release".
|
|
3
|
+
#----------------------------------------------------------------
|
|
4
|
+
|
|
5
|
+
# Commands may need to know the format version.
|
|
6
|
+
set(CMAKE_IMPORT_FILE_VERSION 1)
|
|
7
|
+
|
|
8
|
+
# Import target "power_grid_model::power_grid_model_c" for configuration "Release"
|
|
9
|
+
set_property(TARGET power_grid_model::power_grid_model_c APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
|
|
10
|
+
set_target_properties(power_grid_model::power_grid_model_c PROPERTIES
|
|
11
|
+
IMPORTED_IMPLIB_RELEASE "${_IMPORT_PREFIX}/lib/power_grid_model_c.lib"
|
|
12
|
+
IMPORTED_LOCATION_RELEASE "${_IMPORT_PREFIX}/bin/power_grid_model_c.dll"
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
list(APPEND _cmake_import_check_targets power_grid_model::power_grid_model_c )
|
|
16
|
+
list(APPEND _cmake_import_check_files_for_power_grid_model::power_grid_model_c "${_IMPORT_PREFIX}/lib/power_grid_model_c.lib" "${_IMPORT_PREFIX}/bin/power_grid_model_c.dll" )
|
|
17
|
+
|
|
18
|
+
# Commands beyond this point should not need to know the version.
|
|
19
|
+
set(CMAKE_IMPORT_FILE_VERSION)
|
power_grid_model/_core/power_grid_model_c/lib/cmake/power_grid_model/power_grid_modelTargets.cmake
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
# Generated by CMake
|
|
2
|
+
|
|
3
|
+
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.8)
|
|
4
|
+
message(FATAL_ERROR "CMake >= 3.0.0 required")
|
|
5
|
+
endif()
|
|
6
|
+
if(CMAKE_VERSION VERSION_LESS "3.0.0")
|
|
7
|
+
message(FATAL_ERROR "CMake >= 3.0.0 required")
|
|
8
|
+
endif()
|
|
9
|
+
cmake_policy(PUSH)
|
|
10
|
+
cmake_policy(VERSION 3.0.0...3.29)
|
|
11
|
+
#----------------------------------------------------------------
|
|
12
|
+
# Generated CMake target import file.
|
|
13
|
+
#----------------------------------------------------------------
|
|
14
|
+
|
|
15
|
+
# Commands may need to know the format version.
|
|
16
|
+
set(CMAKE_IMPORT_FILE_VERSION 1)
|
|
17
|
+
|
|
18
|
+
# Protect against multiple inclusion, which would fail when already imported targets are added once more.
|
|
19
|
+
set(_cmake_targets_defined "")
|
|
20
|
+
set(_cmake_targets_not_defined "")
|
|
21
|
+
set(_cmake_expected_targets "")
|
|
22
|
+
foreach(_cmake_expected_target IN ITEMS power_grid_model::power_grid_model_c power_grid_model::power_grid_model_cpp)
|
|
23
|
+
list(APPEND _cmake_expected_targets "${_cmake_expected_target}")
|
|
24
|
+
if(TARGET "${_cmake_expected_target}")
|
|
25
|
+
list(APPEND _cmake_targets_defined "${_cmake_expected_target}")
|
|
26
|
+
else()
|
|
27
|
+
list(APPEND _cmake_targets_not_defined "${_cmake_expected_target}")
|
|
28
|
+
endif()
|
|
29
|
+
endforeach()
|
|
30
|
+
unset(_cmake_expected_target)
|
|
31
|
+
if(_cmake_targets_defined STREQUAL _cmake_expected_targets)
|
|
32
|
+
unset(_cmake_targets_defined)
|
|
33
|
+
unset(_cmake_targets_not_defined)
|
|
34
|
+
unset(_cmake_expected_targets)
|
|
35
|
+
unset(CMAKE_IMPORT_FILE_VERSION)
|
|
36
|
+
cmake_policy(POP)
|
|
37
|
+
return()
|
|
38
|
+
endif()
|
|
39
|
+
if(NOT _cmake_targets_defined STREQUAL "")
|
|
40
|
+
string(REPLACE ";" ", " _cmake_targets_defined_text "${_cmake_targets_defined}")
|
|
41
|
+
string(REPLACE ";" ", " _cmake_targets_not_defined_text "${_cmake_targets_not_defined}")
|
|
42
|
+
message(FATAL_ERROR "Some (but not all) targets in this export set were already defined.\nTargets Defined: ${_cmake_targets_defined_text}\nTargets not yet defined: ${_cmake_targets_not_defined_text}\n")
|
|
43
|
+
endif()
|
|
44
|
+
unset(_cmake_targets_defined)
|
|
45
|
+
unset(_cmake_targets_not_defined)
|
|
46
|
+
unset(_cmake_expected_targets)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
# Compute the installation prefix relative to this file.
|
|
50
|
+
get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
|
51
|
+
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
|
|
52
|
+
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
|
|
53
|
+
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
|
|
54
|
+
if(_IMPORT_PREFIX STREQUAL "/")
|
|
55
|
+
set(_IMPORT_PREFIX "")
|
|
56
|
+
endif()
|
|
57
|
+
|
|
58
|
+
# Create imported target power_grid_model::power_grid_model_c
|
|
59
|
+
add_library(power_grid_model::power_grid_model_c SHARED IMPORTED)
|
|
60
|
+
|
|
61
|
+
set_target_properties(power_grid_model::power_grid_model_c PROPERTIES
|
|
62
|
+
INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
if(NOT CMAKE_VERSION VERSION_LESS "3.23.0")
|
|
66
|
+
target_sources(power_grid_model::power_grid_model_c
|
|
67
|
+
INTERFACE
|
|
68
|
+
FILE_SET "pgm_c_public_headers"
|
|
69
|
+
TYPE "HEADERS"
|
|
70
|
+
BASE_DIRS "${_IMPORT_PREFIX}/include"
|
|
71
|
+
FILES "${_IMPORT_PREFIX}/include/power_grid_model_c.h" "${_IMPORT_PREFIX}/include/power_grid_model_c/basics.h" "${_IMPORT_PREFIX}/include/power_grid_model_c/buffer.h" "${_IMPORT_PREFIX}/include/power_grid_model_c/dataset.h" "${_IMPORT_PREFIX}/include/power_grid_model_c/dataset_definitions.h" "${_IMPORT_PREFIX}/include/power_grid_model_c/handle.h" "${_IMPORT_PREFIX}/include/power_grid_model_c/meta_data.h" "${_IMPORT_PREFIX}/include/power_grid_model_c/model.h" "${_IMPORT_PREFIX}/include/power_grid_model_c/options.h" "${_IMPORT_PREFIX}/include/power_grid_model_c/serialization.h"
|
|
72
|
+
)
|
|
73
|
+
else()
|
|
74
|
+
set_property(TARGET power_grid_model::power_grid_model_c
|
|
75
|
+
APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES
|
|
76
|
+
"${_IMPORT_PREFIX}/include"
|
|
77
|
+
)
|
|
78
|
+
endif()
|
|
79
|
+
|
|
80
|
+
# Create imported target power_grid_model::power_grid_model_cpp
|
|
81
|
+
add_library(power_grid_model::power_grid_model_cpp INTERFACE IMPORTED)
|
|
82
|
+
|
|
83
|
+
set_target_properties(power_grid_model::power_grid_model_cpp PROPERTIES
|
|
84
|
+
INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
|
|
85
|
+
INTERFACE_LINK_LIBRARIES "power_grid_model::power_grid_model_c"
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
if(NOT CMAKE_VERSION VERSION_LESS "3.23.0")
|
|
89
|
+
target_sources(power_grid_model::power_grid_model_cpp
|
|
90
|
+
INTERFACE
|
|
91
|
+
FILE_SET "pgm_cpp_public_headers"
|
|
92
|
+
TYPE "HEADERS"
|
|
93
|
+
BASE_DIRS "${_IMPORT_PREFIX}/include"
|
|
94
|
+
FILES "${_IMPORT_PREFIX}/include/power_grid_model_cpp.hpp" "${_IMPORT_PREFIX}/include/power_grid_model_cpp/basics.hpp" "${_IMPORT_PREFIX}/include/power_grid_model_cpp/buffer.hpp" "${_IMPORT_PREFIX}/include/power_grid_model_cpp/dataset.hpp" "${_IMPORT_PREFIX}/include/power_grid_model_cpp/handle.hpp" "${_IMPORT_PREFIX}/include/power_grid_model_cpp/meta_data.hpp" "${_IMPORT_PREFIX}/include/power_grid_model_cpp/model.hpp" "${_IMPORT_PREFIX}/include/power_grid_model_cpp/options.hpp" "${_IMPORT_PREFIX}/include/power_grid_model_cpp/serialization.hpp" "${_IMPORT_PREFIX}/include/power_grid_model_cpp/utils.hpp"
|
|
95
|
+
)
|
|
96
|
+
else()
|
|
97
|
+
set_property(TARGET power_grid_model::power_grid_model_cpp
|
|
98
|
+
APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES
|
|
99
|
+
"${_IMPORT_PREFIX}/include"
|
|
100
|
+
)
|
|
101
|
+
endif()
|
|
102
|
+
|
|
103
|
+
# Load information for each installed configuration.
|
|
104
|
+
file(GLOB _cmake_config_files "${CMAKE_CURRENT_LIST_DIR}/power_grid_modelTargets-*.cmake")
|
|
105
|
+
foreach(_cmake_config_file IN LISTS _cmake_config_files)
|
|
106
|
+
include("${_cmake_config_file}")
|
|
107
|
+
endforeach()
|
|
108
|
+
unset(_cmake_config_file)
|
|
109
|
+
unset(_cmake_config_files)
|
|
110
|
+
|
|
111
|
+
# Cleanup temporary variables.
|
|
112
|
+
set(_IMPORT_PREFIX)
|
|
113
|
+
|
|
114
|
+
# Loop over all imported files and verify that they actually exist
|
|
115
|
+
foreach(_cmake_target IN LISTS _cmake_import_check_targets)
|
|
116
|
+
if(CMAKE_VERSION VERSION_LESS "3.28"
|
|
117
|
+
OR NOT DEFINED _cmake_import_check_xcframework_for_${_cmake_target}
|
|
118
|
+
OR NOT IS_DIRECTORY "${_cmake_import_check_xcframework_for_${_cmake_target}}")
|
|
119
|
+
foreach(_cmake_file IN LISTS "_cmake_import_check_files_for_${_cmake_target}")
|
|
120
|
+
if(NOT EXISTS "${_cmake_file}")
|
|
121
|
+
message(FATAL_ERROR "The imported target \"${_cmake_target}\" references the file
|
|
122
|
+
\"${_cmake_file}\"
|
|
123
|
+
but this file does not exist. Possible reasons include:
|
|
124
|
+
* The file was deleted, renamed, or moved to another location.
|
|
125
|
+
* An install or uninstall procedure did not complete successfully.
|
|
126
|
+
* The installation package was faulty and contained
|
|
127
|
+
\"${CMAKE_CURRENT_LIST_FILE}\"
|
|
128
|
+
but not all the files it references.
|
|
129
|
+
")
|
|
130
|
+
endif()
|
|
131
|
+
endforeach()
|
|
132
|
+
endif()
|
|
133
|
+
unset(_cmake_file)
|
|
134
|
+
unset("_cmake_import_check_files_for_${_cmake_target}")
|
|
135
|
+
endforeach()
|
|
136
|
+
unset(_cmake_target)
|
|
137
|
+
unset(_cmake_import_check_targets)
|
|
138
|
+
|
|
139
|
+
# This file does not depend on other imported targets which have
|
|
140
|
+
# been exported from the same project but in a separate export set.
|
|
141
|
+
|
|
142
|
+
# Commands beyond this point should not need to know the version.
|
|
143
|
+
set(CMAKE_IMPORT_FILE_VERSION)
|
|
144
|
+
cmake_policy(POP)
|
|
Binary file
|