Commit 377d2481baca6bfff5fdbaa5b234dfc8d63a2ff5
1 parent
a27ed16c
Exists in
master
and in
82 other branches
tilt ok
Showing
6 changed files
with
249 additions
and
201 deletions
Show diff stats
src/ExternLib/Tsyganenko96/AMDAPlugin.cc
@@ -40,4 +40,5 @@ extern "C" void registerPlugin(AMDA::Plugins::PluginManager & pm) { | @@ -40,4 +40,5 @@ extern "C" void registerPlugin(AMDA::Plugins::PluginManager & pm) { | ||
40 | ProcessFactory factProcessTiltAngle= boost::factory<ProcessTiltAngle*>(); | 40 | ProcessFactory factProcessTiltAngle= boost::factory<ProcessTiltAngle*>(); |
41 | ServicesServer::getInstance()->addProcessFactory("tilt_angle", factProcessTiltAngle); | 41 | ServicesServer::getInstance()->addProcessFactory("tilt_angle", factProcessTiltAngle); |
42 | ServicesServer::getInstance()->linkProcessWithPlugin("tilt_angle", pm.getCurrentPluginPath()); | 42 | ServicesServer::getInstance()->linkProcessWithPlugin("tilt_angle", pm.getCurrentPluginPath()); |
43 | + | ||
43 | } | 44 | } |
src/ExternLib/Tsyganenko96/GeopackWrapper.hh
@@ -144,11 +144,11 @@ namespace AMDA { | @@ -144,11 +144,11 @@ namespace AMDA { | ||
144 | lat *= (180. / M_PI); | 144 | lat *= (180. / M_PI); |
145 | } | 145 | } |
146 | 146 | ||
147 | - static void computeTiltAngle(int iyr, int iday, int ihour, int min, int isec, float * tiltAngle) { | 147 | + static void computeTiltAngle(int iyr, int iday, int ihour, int min, int isec, float & tiltAngle) { |
148 | float v_default_x = -400.0; | 148 | float v_default_x = -400.0; |
149 | float v_default_y = 0.0; | 149 | float v_default_y = 0.0; |
150 | float v_default_z = 0.0; | 150 | float v_default_z = 0.0; |
151 | - recalc_08_modified_(&iyr, &iday, &ihour, &min, &isec, &v_default_x, &v_default_y, &v_default_z, tiltAngle); | 151 | + recalc_08_modified_(&iyr, &iday, &ihour, &min, &isec, &v_default_x, &v_default_y, &v_default_z, & tiltAngle); |
152 | } | 152 | } |
153 | 153 | ||
154 | }; | 154 | }; |
src/ExternLib/Tsyganenko96/ProcessTiltAngle.cc
@@ -10,32 +10,47 @@ | @@ -10,32 +10,47 @@ | ||
10 | * | 10 | * |
11 | * Created on June 19, 2020, 10:32 AM | 11 | * Created on June 19, 2020, 10:32 AM |
12 | */ | 12 | */ |
13 | +#include <stdlib.h> | ||
14 | +#include <string> | ||
13 | 15 | ||
16 | +#include "Operation.hh" | ||
17 | +#include "ParameterManager.hh" | ||
18 | + | ||
19 | +#include "ParameterCreatorFromExpression.hh" | ||
14 | #include "ProcessTiltAngle.hh" | 20 | #include "ProcessTiltAngle.hh" |
21 | +#include "TiltAngleCreator.hh" | ||
15 | 22 | ||
16 | -ProcessTiltAngle::ProcessTiltAngle(Parameter ¶meter) : SingleParamProcess_CRTP(parameter) { | ||
17 | -} | 23 | +namespace AMDA { |
24 | + namespace Parameters { | ||
18 | 25 | ||
19 | -ProcessTiltAngle::ProcessTiltAngle(const ProcessTiltAngle& pProcess, Parameter ¶meter) : SingleParamProcess_CRTP(pProcess, parameter) { | ||
20 | -} | 26 | + ProcessTiltAngle::ProcessTiltAngle(Parameter ¶meter) : SingleParamProcess_CRTP(parameter) { |
27 | + } | ||
21 | 28 | ||
22 | -TimeStamp ProcessTiltAngle::init() { | ||
23 | - | ||
24 | - TimeStamp time = _parameterInput->init(this, _timeIntervalList); | ||
25 | - | ||
26 | - _paramInput = _parameterInput->getParamData(this).get(); | ||
27 | - | ||
28 | - TiltAngleCreator lCreator(*this, *paramInput, "tilt"); | ||
29 | - | ||
30 | - _operation = lCreator.getOperation(); | ||
31 | - | ||
32 | - _paramData = ParamDataSPtr(_operation->getParamOutput()); | ||
33 | - | ||
34 | - _paramData->setMinSampling(_paramInput->getMinSampling()); | ||
35 | - | ||
36 | - return time; | ||
37 | -} | 29 | + ProcessTiltAngle::ProcessTiltAngle(const ProcessTiltAngle& pProcess, Parameter ¶meter) : SingleParamProcess_CRTP(pProcess, parameter) { |
30 | + } | ||
38 | 31 | ||
39 | -ProcessTiltAngle::~ProcessTiltAngle() { | ||
40 | -} | 32 | + ProcessTiltAngle::~ProcessTiltAngle() { |
33 | + } | ||
34 | + | ||
35 | + TimeStamp ProcessTiltAngle::init() { | ||
36 | + | ||
37 | + TimeStamp time = _parameterInput->init(this, _timeIntervalList); | ||
41 | 38 | ||
39 | + Parameter::InfoList lInfoList = _parameterInput->getInfoList(); | ||
40 | + _parameter.getInfoList().insert(lInfoList.begin(), lInfoList.end()); | ||
41 | + | ||
42 | + _paramInput = _parameterInput->getParamData(this).get(); | ||
43 | + | ||
44 | + TiltAngleCreator lCreator(*this, *_paramInput, "tilt"); | ||
45 | + | ||
46 | + _operation = lCreator.getOperation(); | ||
47 | + | ||
48 | + _paramData = ParamDataSPtr(_operation->getParamOutput()); | ||
49 | + | ||
50 | + _paramData->setMinSampling(_paramInput->getMinSampling()); | ||
51 | + | ||
52 | + return time; | ||
53 | + } | ||
54 | + | ||
55 | + } | ||
56 | +} |
src/ExternLib/Tsyganenko96/ProcessTiltAngle.hh
@@ -17,14 +17,24 @@ | @@ -17,14 +17,24 @@ | ||
17 | #include "ParamInfo.hh" | 17 | #include "ParamInfo.hh" |
18 | #include "TiltAngleCreator.hh" | 18 | #include "TiltAngleCreator.hh" |
19 | 19 | ||
20 | -class ProcessTiltAngle { | ||
21 | -public: | ||
22 | - ProcessTiltAngle(); | ||
23 | - ProcessTiltAngle(const ProcessTiltAngle& orig); | ||
24 | - virtual ~ProcessTiltAngle(); | ||
25 | -private: | ||
26 | - | ||
27 | -}; | 20 | +namespace AMDA { |
21 | + namespace Parameters { | ||
22 | + | ||
23 | + class ProcessTiltAngle : public SingleParamProcess_CRTP<ProcessTiltAngle> { | ||
24 | + public: | ||
25 | + ProcessTiltAngle(Parameter & parameter); | ||
26 | + ProcessTiltAngle(const ProcessTiltAngle& pProcess, Parameter &pParameter); | ||
27 | + virtual ~ProcessTiltAngle(); | ||
28 | + | ||
29 | + /** | ||
30 | + * @overload Process::init() | ||
31 | + */ | ||
32 | + virtual TimeStamp init(); | ||
33 | + private: | ||
34 | + | ||
35 | + }; | ||
36 | + } | ||
37 | +} | ||
28 | 38 | ||
29 | #endif /* PROCESSTILTANGLE_HH */ | 39 | #endif /* PROCESSTILTANGLE_HH */ |
30 | 40 |
src/ExternLib/Tsyganenko96/TiltAngleCreator.hh
@@ -20,161 +20,165 @@ | @@ -20,161 +20,165 @@ | ||
20 | #include "VisitorOfParamData.hh" | 20 | #include "VisitorOfParamData.hh" |
21 | #include "Tsyganenko96.hh" | 21 | #include "Tsyganenko96.hh" |
22 | 22 | ||
23 | -class TiltAngleCreator : public VisitorOfParamData { | ||
24 | -public: | ||
25 | - | ||
26 | - ProcessTiltAngleCreator(Process& pProcess, ParamData& paramInput, std::string processType) : _process(pProcess), _paramData(paramInput), _type(processType) { | ||
27 | - _paramData.accept(*this); | ||
28 | - } | ||
29 | - virtual ~ProcessTiltAngleCreator(); | ||
30 | - | ||
31 | - /** | ||
32 | - * @overload VisitorOfParamData::visit(ParamDataScalaireShort *) | ||
33 | - */ | ||
34 | - void visit(ParamDataScalaireShort *) { | ||
35 | - BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("Tsyganenko96Creator operation not supported")); | ||
36 | - } | ||
37 | - | ||
38 | - /** | ||
39 | - * @overload VisitorOfParamData::visit(ParamDataScalaireFloat *) | ||
40 | - */ | ||
41 | - void visit(ParamDataScalaireFloat *) { | ||
42 | - BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("Tsyganenko96Creator operation not supported")); | ||
43 | - } | ||
44 | - | ||
45 | - /** | ||
46 | - * @overload VisitorOfParamData::visit(ParamDataScalaireDouble *) | ||
47 | - */ | ||
48 | - void visit(ParamDataScalaireDouble *) { | ||
49 | - BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("Tsyganenko96Creator operation not supported")); | ||
50 | - } | ||
51 | - | ||
52 | - /** | ||
53 | - * @overload VisitorOfParamData::visit(ParamDataScalaireLongDouble *) | ||
54 | - */ | ||
55 | - void visit(ParamDataScalaireLongDouble *) { | ||
56 | - BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("Tsyganenko96Creator operation not supported")); | ||
57 | - } | ||
58 | - | ||
59 | - /** | ||
60 | - * @overload VisitorOfParamData::visit(ParamDataScalaireInt *) | ||
61 | - */ | ||
62 | - void visit(ParamDataScalaireInt *) { | ||
63 | - BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("Tsyganenko96Creator operation not supported")); | ||
64 | - } | ||
65 | - | ||
66 | - /** | ||
67 | - * @overload VisitorOfParamData::visit(ParamDataLogicalData *) | ||
68 | - */ | ||
69 | - void visit(ParamDataLogicalData *) { | ||
70 | - BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("Tsyganenko96Creator operation not supported")); | ||
71 | - } | ||
72 | - | ||
73 | - /** | ||
74 | - * @overload VisitorOfParamData::visit(ParamDataTab1DShort *) | ||
75 | - */ | ||
76 | - void visit(ParamDataTab1DShort *) { | ||
77 | - createOperation<short>(); | ||
78 | - } | ||
79 | - | ||
80 | - /** | ||
81 | - * @overload VisitorOfParamData::visit(ParamDataTab1DFloat *) | ||
82 | - */ | ||
83 | - void visit(ParamDataTab1DFloat *) { | ||
84 | - createOperation<float>(); | ||
85 | - } | ||
86 | - | ||
87 | - /** | ||
88 | - * @overload VisitorOfParamData::visit(ParamDataTab1DDouble *) | ||
89 | - */ | ||
90 | - void visit(ParamDataTab1DDouble *) { | ||
91 | - createOperation<double>(); | ||
92 | - } | ||
93 | - | ||
94 | - /** | ||
95 | - * @overload VisitorOfParamData::visit(ParamDataTab1DLongDouble *) | ||
96 | - */ | ||
97 | - void visit(ParamDataTab1DLongDouble *) { | ||
98 | - createOperation<long double>(); | ||
99 | - } | ||
100 | - | ||
101 | - /** | ||
102 | - * @overload VisitorOfParamData::visit(ParamDataTab1DInt *) | ||
103 | - */ | ||
104 | - void visit(ParamDataTab1DInt *) { | ||
105 | - createOperation<int>(); | ||
106 | - } | ||
107 | - | ||
108 | - /** | ||
109 | - * @overload VisitorOfParamData::visit(ParamDataTab1DLogicalData *) | ||
110 | - */ | ||
111 | - void visit(ParamDataTab1DLogicalData *) { | ||
112 | - BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("Tsyganenko96Creator operation not supported")); | ||
113 | - } | ||
114 | - | ||
115 | - /** | ||
116 | - * @overload VisitorOfParamData::visit(ParamDataTab2DShort *) | ||
117 | - */ | ||
118 | - void visit(ParamDataTab2DShort *) { | ||
119 | - BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("Tsyganenko96Creator operation not supported")); | ||
120 | - } | ||
121 | - | ||
122 | - /** | ||
123 | - * @overload VisitorOfParamData::visit(ParamDataTab2DFloat *) | ||
124 | - */ | ||
125 | - void visit(ParamDataTab2DFloat *) { | ||
126 | - BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("Tsyganenko96Creator operation not supported")); | ||
127 | - } | ||
128 | - | ||
129 | - /** | ||
130 | - * @overload VisitorOfParamData::visit(ParamDataTab2DDouble *) | ||
131 | - */ | ||
132 | - void visit(ParamDataTab2DDouble *) { | ||
133 | - BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("Tsyganenko96Creator operation not supported")); | ||
134 | - } | ||
135 | - | ||
136 | - /** | ||
137 | - * @overload VisitorOfParamData::visit(ParamDataTab2DLongDouble *) | ||
138 | - */ | ||
139 | - void visit(ParamDataTab2DLongDouble *) { | ||
140 | - BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("Tsyganenko96Creator operation not supported")); | ||
141 | - } | ||
142 | - | ||
143 | - /** | ||
144 | - * @overload VisitorOfParamData::visit(ParamDataTab2DInt *) | ||
145 | - */ | ||
146 | - void visit(ParamDataTab2DInt *) { | ||
147 | - BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("Tsyganenko96Creator operation not supported")); | ||
148 | - } | ||
149 | - | ||
150 | - /** | ||
151 | - * @overload VisitorOfParamData::visit(ParamDataTab2DLogicalData *) | ||
152 | - */ | ||
153 | - void visit(ParamDataTab2DLogicalData *) { | ||
154 | - BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("Tsyganenko96Creator operation not supported")); | ||
155 | - } | ||
156 | - | ||
157 | - /** | ||
158 | - * @brief get the Tsyganenko96 parameterized operation. | ||
159 | - */ | ||
160 | - Operation * getOperation() const { | ||
161 | - return _operation; | ||
162 | - } | ||
163 | - | ||
164 | - | ||
165 | -private: | ||
166 | - | ||
167 | - template <typename Type> | ||
168 | - void createOperation() { | ||
169 | - if (_type == "tilte") | ||
170 | - _operation = new DipoleTiltAngle::DipoleTiltAngle<Type>(_process, dynamic_cast<ParamDataSpec<std::vector<Type> > &> (_paramData), _paramImfInput); | ||
171 | - } | ||
172 | - Process &_process; | ||
173 | - ParamData &_paramData; | ||
174 | - ParamData &_paramImfInput; | ||
175 | - std::string _type; | ||
176 | - Operation* _operation; | ||
177 | -}; | 23 | +namespace AMDA { |
24 | + namespace Parameters { | ||
25 | + | ||
26 | + class TiltAngleCreator : public VisitorOfParamData { | ||
27 | + public: | ||
28 | + | ||
29 | + TiltAngleCreator(Process& pProcess, ParamData& paramInput, const std::string& processType) : _process(pProcess), _paramData(paramInput), _type(processType) { | ||
30 | + _paramData.accept(*this); | ||
31 | + } | ||
32 | + | ||
33 | + /** | ||
34 | + * @overload VisitorOfParamData::visit(ParamDataScalaireShort *) | ||
35 | + */ | ||
36 | + void visit(ParamDataScalaireShort *) { | ||
37 | + createOperation<short>(); | ||
38 | + } | ||
39 | + | ||
40 | + /** | ||
41 | + * @overload VisitorOfParamData::visit(ParamDataScalaireFloat *) | ||
42 | + */ | ||
43 | + void visit(ParamDataScalaireFloat *) { | ||
44 | + createOperation<float>(); | ||
45 | + } | ||
46 | + | ||
47 | + /** | ||
48 | + * @overload VisitorOfParamData::visit(ParamDataScalaireDouble *) | ||
49 | + */ | ||
50 | + void visit(ParamDataScalaireDouble *) { | ||
51 | + createOperation<double>(); | ||
52 | + } | ||
53 | + | ||
54 | + /** | ||
55 | + * @overload VisitorOfParamData::visit(ParamDataScalaireLongDouble *) | ||
56 | + */ | ||
57 | + void visit(ParamDataScalaireLongDouble *) { | ||
58 | + createOperation<long double>(); | ||
59 | + } | ||
60 | + | ||
61 | + /** | ||
62 | + * @overload VisitorOfParamData::visit(ParamDataScalaireInt *) | ||
63 | + */ | ||
64 | + void visit(ParamDataScalaireInt *) { | ||
65 | + createOperation<int>(); | ||
66 | + } | ||
67 | + | ||
68 | + /** | ||
69 | + * @overload VisitorOfParamData::visit(ParamDataLogicalData *) | ||
70 | + */ | ||
71 | + void visit(ParamDataLogicalData *) { | ||
72 | + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("Tsyganenko96Creator operation not supported")); | ||
73 | + } | ||
74 | + | ||
75 | + /** | ||
76 | + * @overload VisitorOfParamData::visit(ParamDataTab1DShort *) | ||
77 | + */ | ||
78 | + void visit(ParamDataTab1DShort *) { | ||
79 | + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("Tsyganenko96Creator operation not supported")); | ||
80 | + } | ||
81 | + | ||
82 | + /** | ||
83 | + * @overload VisitorOfParamData::visit(ParamDataTab1DFloat *) | ||
84 | + */ | ||
85 | + void visit(ParamDataTab1DFloat *) { | ||
86 | + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("Tsyganenko96Creator operation not supported")); | ||
87 | + } | ||
88 | + | ||
89 | + /** | ||
90 | + * @overload VisitorOfParamData::visit(ParamDataTab1DDouble *) | ||
91 | + */ | ||
92 | + void visit(ParamDataTab1DDouble *) { | ||
93 | + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("Tsyganenko96Creator operation not supported")); | ||
94 | + } | ||
95 | + | ||
96 | + /** | ||
97 | + * @overload VisitorOfParamData::visit(ParamDataTab1DLongDouble *) | ||
98 | + */ | ||
99 | + void visit(ParamDataTab1DLongDouble *) { | ||
100 | + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("Tsyganenko96Creator operation not supported")); | ||
101 | + } | ||
102 | + | ||
103 | + /** | ||
104 | + * @overload VisitorOfParamData::visit(ParamDataTab1DInt *) | ||
105 | + */ | ||
106 | + void visit(ParamDataTab1DInt *) { | ||
107 | + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("Tsyganenko96Creator operation not supported")); | ||
108 | + } | ||
109 | + | ||
110 | + /** | ||
111 | + * @overload VisitorOfParamData::visit(ParamDataTab1DLogicalData *) | ||
112 | + */ | ||
113 | + void visit(ParamDataTab1DLogicalData *) { | ||
114 | + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("Tsyganenko96Creator operation not supported")); | ||
115 | + } | ||
116 | + | ||
117 | + /** | ||
118 | + * @overload VisitorOfParamData::visit(ParamDataTab2DShort *) | ||
119 | + */ | ||
120 | + void visit(ParamDataTab2DShort *) { | ||
121 | + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("Tsyganenko96Creator operation not supported")); | ||
122 | + } | ||
123 | + | ||
124 | + /** | ||
125 | + * @overload VisitorOfParamData::visit(ParamDataTab2DFloat *) | ||
126 | + */ | ||
127 | + void visit(ParamDataTab2DFloat *) { | ||
128 | + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("Tsyganenko96Creator operation not supported")); | ||
129 | + } | ||
130 | + | ||
131 | + /** | ||
132 | + * @overload VisitorOfParamData::visit(ParamDataTab2DDouble *) | ||
133 | + */ | ||
134 | + void visit(ParamDataTab2DDouble *) { | ||
135 | + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("Tsyganenko96Creator operation not supported")); | ||
136 | + } | ||
137 | + | ||
138 | + /** | ||
139 | + * @overload VisitorOfParamData::visit(ParamDataTab2DLongDouble *) | ||
140 | + */ | ||
141 | + void visit(ParamDataTab2DLongDouble *) { | ||
142 | + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("Tsyganenko96Creator operation not supported")); | ||
143 | + } | ||
144 | + | ||
145 | + /** | ||
146 | + * @overload VisitorOfParamData::visit(ParamDataTab2DInt *) | ||
147 | + */ | ||
148 | + void visit(ParamDataTab2DInt *) { | ||
149 | + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("Tsyganenko96Creator operation not supported")); | ||
150 | + } | ||
151 | + | ||
152 | + /** | ||
153 | + * @overload VisitorOfParamData::visit(ParamDataTab2DLogicalData *) | ||
154 | + */ | ||
155 | + void visit(ParamDataTab2DLogicalData *) { | ||
156 | + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("Tsyganenko96Creator operation not supported")); | ||
157 | + } | ||
158 | + | ||
159 | + /** | ||
160 | + * @brief get the Tsyganenko96 parameterized operation. | ||
161 | + */ | ||
162 | + Operation * getOperation() const { | ||
163 | + return _operation; | ||
164 | + } | ||
165 | + | ||
166 | + | ||
167 | + private: | ||
168 | + | ||
169 | + template <typename Type> | ||
170 | + void createOperation() { | ||
171 | + if (_type == "tilt") | ||
172 | + _operation = new Tsyganenko96::DipoleTiltAngle<Type>(_process, dynamic_cast<ParamDataSpec<Type> &> (_paramData)); | ||
173 | + } | ||
174 | + Process &_process; | ||
175 | + ParamData &_paramData; | ||
176 | + std::string _type; | ||
177 | + Operation* _operation; | ||
178 | + }; | ||
179 | + | ||
180 | + } | ||
181 | +} | ||
178 | 182 | ||
179 | #endif /* TILTANGLECREATOR_HH */ | 183 | #endif /* TILTANGLECREATOR_HH */ |
180 | 184 |
src/ExternLib/Tsyganenko96/Tsyganenko96.hh
@@ -33,10 +33,6 @@ namespace AMDA { | @@ -33,10 +33,6 @@ namespace AMDA { | ||
33 | #define DEFAULT_IMF_GSM_Z -3. | 33 | #define DEFAULT_IMF_GSM_Z -3. |
34 | #define DEFAULT_DST -10. | 34 | #define DEFAULT_DST -10. |
35 | #define DEFAULT_PSW 3. | 35 | #define DEFAULT_PSW 3. |
36 | - | ||
37 | - class DipoleBase : public Operation{ | ||
38 | - A completer | ||
39 | - }; | ||
40 | 36 | ||
41 | class Tsyganenko96Base : public Operation { | 37 | class Tsyganenko96Base : public Operation { |
42 | public: | 38 | public: |
@@ -269,35 +265,57 @@ namespace AMDA { | @@ -269,35 +265,57 @@ namespace AMDA { | ||
269 | bool _inGSE; | 265 | bool _inGSE; |
270 | }; | 266 | }; |
271 | 267 | ||
268 | + template<typename DataType> | ||
269 | + class DipoleBase : public Operation { | ||
270 | + public: | ||
271 | + | ||
272 | + DipoleBase(Process& pProcess, ParamDataSpec<DataType>& paramInput) : Operation(pProcess), | ||
273 | + _paramInput(paramInput), | ||
274 | + _paramOutput(new ParamDataSpec<DataType>) { | ||
275 | + _paramDataOutput = _paramOutput; | ||
276 | + } | ||
277 | + | ||
278 | + virtual ~DipoleBase() { | ||
279 | + } | ||
280 | + | ||
281 | + protected: | ||
282 | + /** | ||
283 | + * @brief Input paramter data. | ||
284 | + */ | ||
285 | + ParamDataSpec<DataType>& _paramInput; | ||
286 | + | ||
287 | + ParamDataSpec<DataType>* _paramOutput; | ||
288 | + | ||
289 | + }; | ||
290 | + | ||
272 | template <typename ElemType> | 291 | template <typename ElemType> |
273 | - class DipoleTiltAngle : public DipoleBase { | 292 | + class DipoleTiltAngle : public DipoleBase<ElemType> { |
274 | public: | 293 | public: |
275 | 294 | ||
276 | /** | 295 | /** |
277 | * @brief Constructor. | 296 | * @brief Constructor. |
278 | * @details Create the ParamData type of the input ParamData. | 297 | * @details Create the ParamData type of the input ParamData. |
279 | */ | 298 | */ |
280 | - DipoleTiltAngle(Process& pProcess, ParamDataSpec<std::vector<ElemType> >& paramInput) | ||
281 | - : Tsyganenko96Base(pProcess, paramImfInput, paramPswInput, paramDstInput), | ||
282 | - _paramInput(paramInput), | ||
283 | - _paramOutput(new ParamDataSpec<ElemType>) { | ||
284 | - _paramDataOutput = _paramOutput; | 299 | + DipoleTiltAngle(Process& pProcess, ParamDataSpec<ElemType >& paramInput) |
300 | + : DipoleBase<ElemType>(pProcess, paramInput) { | ||
301 | + } | ||
285 | 302 | ||
303 | + virtual ~DipoleTiltAngle() { | ||
286 | } | 304 | } |
287 | 305 | ||
288 | void write(ParamDataIndexInfo &pParamDataIndexInfo) { | 306 | void write(ParamDataIndexInfo &pParamDataIndexInfo) { |
289 | for (unsigned int _index = pParamDataIndexInfo._startIndex; | 307 | for (unsigned int _index = pParamDataIndexInfo._startIndex; |
290 | _index < pParamDataIndexInfo._startIndex + pParamDataIndexInfo._nbDataToProcess; | 308 | _index < pParamDataIndexInfo._startIndex + pParamDataIndexInfo._nbDataToProcess; |
291 | ++_index) { | 309 | ++_index) { |
292 | - double crtTime = _paramInput.getTime(_index); | 310 | + double crtTime = DipoleBase<ElemType>::_paramInput.getTime(_index); |
293 | time_t timestamp = crtTime; | 311 | time_t timestamp = crtTime; |
294 | struct tm *tmp; | 312 | struct tm *tmp; |
295 | tmp = gmtime(×tamp); | 313 | tmp = gmtime(×tamp); |
296 | float tiltAngle_res; | 314 | float tiltAngle_res; |
297 | - geopack::GeopackWrapper::recalc_08_modified_(1900 + tmp->tm_year, 1 + tmp->tm_yday, tmp->tm_hour, tmp->tm_min, tmp->tm_sec, tiltAngle_res); | 315 | + geopack::GeopackWrapper::computeTiltAngle(1900 + tmp->tm_year, 1 + tmp->tm_yday, tmp->tm_hour, tmp->tm_min, tmp->tm_sec, tiltAngle_res); |
298 | 316 | ||
299 | - _paramOutput->pushTime(crtTime); | ||
300 | - paramOutput->getDataList(tiltAngle_res); | 317 | + DipoleBase<ElemType>::_paramOutput->pushTime(crtTime); |
318 | + DipoleBase<ElemType>::_paramOutput->getDataList().push_back(tiltAngle_res*180.0/(atan(1)*4)); | ||
301 | } | 319 | } |
302 | }; | 320 | }; |
303 | }; | 321 | }; |