|
11 | 11 |
|
12 | 12 | #include <utils/math.h> |
13 | 13 | #include "interpolator.h" |
| 14 | +#include "taper_section.h" |
14 | 15 |
|
15 | | - |
16 | | -// ----------------------------- |
17 | | -// TaperSection |
18 | | -// ----------------------------- |
19 | | -class TaperSection { |
20 | | -public: |
21 | | - TaperSection() = default; |
22 | | - |
23 | | - TaperSection( |
24 | | - std::vector<double> z_array, |
25 | | - std::vector<double> radius_array, |
26 | | - double heating_length_initial = std::numeric_limits<double>::quiet_NaN(), |
27 | | - double heating_length_final = std::numeric_limits<double>::quiet_NaN()) |
28 | | - : z_array_(std::move(z_array)), |
29 | | - radius_array_(std::move(radius_array)), |
30 | | - heating_length_initial_(heating_length_initial), |
31 | | - heating_length_final_(heating_length_final) |
32 | | - { |
33 | | - if (z_array_.size() != radius_array_.size()) { |
34 | | - throw std::invalid_argument("TaperSection: z_array and radius_array size mismatch."); |
35 | | - } |
36 | | - if (z_array_.empty()) throw std::invalid_argument("TaperSection: arrays must not be empty."); |
37 | | - if (!std::is_sorted(z_array_.begin(), z_array_.end())) { |
38 | | - throw std::invalid_argument("TaperSection: z_array must be sorted ascending."); |
39 | | - } |
40 | | - } |
41 | | - |
42 | | - double z_initial() const { return z_array_.front(); } |
43 | | - double z_final() const { return z_array_.back(); } |
44 | | - double radius_initial() const { return radius_array_.front(); } |
45 | | - double radius_final() const { return radius_array_.back(); } |
46 | | - bool is_constant() const { return radius_array_.front() == radius_array_.back(); } |
47 | | - |
48 | | - double heating_length_initial() const { return heating_length_initial_; } |
49 | | - double heating_length_final() const { return heating_length_final_; } |
50 | | - |
51 | | - const std::vector<double>& z_array() const { return z_array_; } |
52 | | - const std::vector<double>& radius_array() const { return radius_array_; } |
53 | | - |
54 | | - // Similar to scipy interp1d(bounds_error=False, fill_value=0) |
55 | | - LinearInterpolator interpolation(bool bounds_error = false, double fill_value = 0.0) const { |
56 | | - return LinearInterpolator(z_array_, radius_array_, bounds_error, fill_value); |
57 | | - } |
58 | | - |
59 | | -private: |
60 | | - std::vector<double> z_array_; |
61 | | - std::vector<double> radius_array_; |
62 | | - double heating_length_initial_ = std::numeric_limits<double>::quiet_NaN(); |
63 | | - double heating_length_final_ = std::numeric_limits<double>::quiet_NaN(); |
64 | | -}; |
65 | | - |
66 | | -// ----------------------------- |
67 | | -// AlphaProfile |
68 | | -// ----------------------------- |
69 | 16 | class AlphaProfile { |
70 | 17 | public: |
71 | 18 | AlphaProfile( |
|
0 commit comments