Commit 5d3b0cd06f29a8e2c8644385d1cdc84ea0a9cac2

Authored by Hacene SI HADJ MOHAND
1 parent 45fb3489

shue98 ok

src/ExternLib/Shue/AMDAPlugin.cc 0 โ†’ 100644
... ... @@ -0,0 +1,25 @@
  1 +/*
  2 + * To change this license header, choose License Headers in Project Properties.
  3 + * To change this template file, choose Tools | Templates
  4 + * and open the template in the editor.
  5 + */
  6 +#include <iostream>
  7 +#include "ServicesServer.hh"
  8 +#include "PluginManager.hh"
  9 +#include "ProcessShue.hh"
  10 +
  11 +using namespace AMDA::Parameters;
  12 +
  13 +/**
  14 + Retrieve the Plugin version we're going to expect
  15 +*/
  16 +extern "C" const char* getPluginVersion()
  17 +{
  18 + return "(Version)";
  19 +}
  20 +
  21 +extern "C" void registerPlugin(AMDA::Plugins::PluginManager & pm){
  22 + ProcessFactory factShue = boost::factory<ProcessShue*>();
  23 + ServicesServer::getInstance()->addProcessFactory("shue", factShue);
  24 + ServicesServer::getInstance()->linkProcessWithPlugin("shue", pm.getCurrentPluginPath());
  25 +}
... ...
src/ExternLib/Shue/ProcessShue.cc 0 โ†’ 100644
... ... @@ -0,0 +1,156 @@
  1 +/*
  2 + * To change this license header, choose License Headers in Project Properties.
  3 + * To change this template file, choose Tools | Templates
  4 + * and open the template in the editor.
  5 + */
  6 +
  7 +/*
  8 + * File: ProcessShue.cpp
  9 + * Author: hacene
  10 + *
  11 + * Created on December 31, 2020, 3:42 PM
  12 + */
  13 +
  14 +
  15 +#include <stdlib.h>
  16 +#include <string>
  17 +
  18 +#include <boost/lexical_cast.hpp>
  19 +
  20 +#include "DicError.hh"
  21 +#include "AMDA_exception.hh"
  22 +
  23 +#include "Operation.hh"
  24 +#include "ParameterManager.hh"
  25 +#include "ParamMgr.hh"
  26 +#include "ParameterCreatorFromExpression.hh"
  27 +
  28 +#include "ProcessShue.hh"
  29 +
  30 +
  31 +using namespace std;
  32 +using namespace boost;
  33 +using namespace log4cxx;
  34 +
  35 +namespace AMDA {
  36 +namespace Parameters {
  37 +
  38 +
  39 +ProcessShue::ProcessShue(Parameter &parameter) : SingleParamProcess_CRTP(parameter) {
  40 +}
  41 +
  42 +ProcessShue::ProcessShue(const ProcessShue& pProcess, Parameter &parameter): SingleParamProcess_CRTP(pProcess, parameter) {
  43 +}
  44 +
  45 +ProcessShue::~ProcessShue() {
  46 +
  47 + if (_inputImfParam != nullptr) {
  48 + _inputImfParam->closeConnection(this);
  49 + }
  50 + if (_inputPswParam != nullptr) {
  51 + _inputPswParam->closeConnection(this);
  52 + }
  53 +
  54 +}
  55 +
  56 +void ProcessShue::establishConnection(){
  57 +
  58 +
  59 +if (_attributList.size() < 2) {
  60 + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_PROCESS_ERR) << AMDA::ex_msg(std::string("ProcessShue::parse require 3 attributes'")));
  61 + }
  62 +
  63 + //Imf parameter
  64 + _inputImfParam = _parameter.getParameterManager().getParameter(_attributList[0]);
  65 + if (_inputImfParam == nullptr) {
  66 + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_PROCESS_ERR) << AMDA::ex_msg(std::string("ProcessShue::parse cannot retrieve imf param")));
  67 + }
  68 + _inputImfParam->openConnection(this);
  69 +
  70 + //Psw parameter
  71 + _inputPswParam = _parameter.getParameterManager().getParameter(_attributList[1]);
  72 + if (_inputPswParam == nullptr) {
  73 + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_PROCESS_ERR) << AMDA::ex_msg(std::string("ProcessShue::parse cannot retrieve psw param")));
  74 + }
  75 + _inputPswParam->openConnection(this);
  76 +
  77 +
  78 + SingleParamProcess::establishConnection();
  79 +
  80 + }
  81 +
  82 +TimeStamp ProcessShue::init() {
  83 +
  84 +
  85 + _model98 = true;
  86 + if (_attributList.size() > 2 && _attributList[2] == "shue97")
  87 + _model98 = false;
  88 + _inGSE = true;
  89 +
  90 + if (_attributList.size() > 3 && _attributList[3] == "GSM")
  91 + _inGSE = false;
  92 +
  93 + if (_attributList.size() > 4)
  94 + _type= _attributList[4];
  95 +
  96 +
  97 + TimeStamp time = _parameterInput->init( this, _timeIntervalList);
  98 +
  99 +
  100 +
  101 + _inputImfParam->init( this, _timeIntervalList);
  102 + ParamData* lImfParamInput = _inputImfParam->getParamData(this).get();
  103 +
  104 + _inputPswParam->init( this, _timeIntervalList);
  105 + ParamData* lPswParamInput = _inputPswParam->getParamData(this).get();
  106 +
  107 + _paramInput = _parameterInput->getParamData(this).get();
  108 +
  109 + ShueCreator lCreator(*this, *_paramInput, *lImfParamInput, *lPswParamInput, _inGSE,_model98, _type );
  110 + _operation = lCreator.getOperation();
  111 + _paramData = ParamDataSPtr(_operation->getParamOutput());
  112 + _paramData->setMinSampling(_paramInput->getMinSampling());
  113 +
  114 + return time;
  115 +}
  116 +
  117 +unsigned int ProcessShue::write() {
  118 + getImfData();
  119 + getPswData();
  120 + return SingleParamProcess::write();
  121 +}
  122 +
  123 +void ProcessShue::getImfData() {
  124 + try {
  125 + ParamDataIndexInfo lParamDataIndexInfo;
  126 + lParamDataIndexInfo = _inputImfParam->getAsync(this).get();
  127 + while ((!lParamDataIndexInfo._noMoreTimeInt && !lParamDataIndexInfo._timeIntToProcessChanged) || (lParamDataIndexInfo._nbDataToProcess > 0)) {
  128 + reinterpret_cast<Shue::ShueBase*>(_operation)->pushImfData(lParamDataIndexInfo);
  129 + if (lParamDataIndexInfo._timeIntToProcessChanged || lParamDataIndexInfo._noMoreTimeInt)
  130 + break;
  131 + lParamDataIndexInfo = _inputImfParam->getAsync(this).get();
  132 + }
  133 + }catch (...) {
  134 + throw;
  135 + }
  136 +}
  137 +
  138 +void ProcessShue::getPswData() {
  139 + try {
  140 + ParamDataIndexInfo lParamDataIndexInfo;
  141 + lParamDataIndexInfo = _inputPswParam->getAsync(this).get();
  142 + while ((!lParamDataIndexInfo._noMoreTimeInt && !lParamDataIndexInfo._timeIntToProcessChanged) || (lParamDataIndexInfo._nbDataToProcess > 0)) {
  143 + reinterpret_cast<Shue::ShueBase*>(_operation)->pushPswData(lParamDataIndexInfo);
  144 + if (lParamDataIndexInfo._timeIntToProcessChanged || lParamDataIndexInfo._noMoreTimeInt)
  145 + break;
  146 + lParamDataIndexInfo = _inputPswParam->getAsync(this).get();
  147 + }
  148 + }catch (...) {
  149 + throw;
  150 + }
  151 +
  152 +}
  153 +
  154 +
  155 +}
  156 +}
0 157 \ No newline at end of file
... ...
src/ExternLib/Shue/ProcessShue.hh 0 โ†’ 100644
... ... @@ -0,0 +1,72 @@
  1 +/*
  2 + * To change this license header, choose License Headers in Project Properties.
  3 + * To change this template file, choose Tools | Templates
  4 + * and open the template in the editor.
  5 + */
  6 +
  7 +/*
  8 + * File: ProcessShue.hh
  9 + * Author: hacene
  10 + *
  11 + * Created on December 31, 2020, 3:42 PM
  12 + */
  13 +
  14 +#ifndef PROCESSSHUE_HH
  15 +#define PROCESSSHUE_HH
  16 +
  17 +#include "SingleParamProcess.hh"
  18 +#include "ParamInfo.hh"
  19 +#include "ShueCreator.hh"
  20 +namespace AMDA {
  21 + namespace Parameters {
  22 +
  23 + class ProcessShue : public SingleParamProcess_CRTP<ProcessShue> {
  24 + public:
  25 + ProcessShue(Parameter &parameter);
  26 + ProcessShue(const ProcessShue& pProcess, Parameter &parameter);
  27 + virtual ~ProcessShue();
  28 +
  29 + /**
  30 + * @overload Process::establishConnection()
  31 + */
  32 + void establishConnection();
  33 +
  34 + /**
  35 + * @overload Process::init()
  36 + */
  37 + virtual TimeStamp init();
  38 +/*
  39 +
  40 + * Write data in dataParam.
  41 + */
  42 + unsigned int write();
  43 +
  44 +
  45 + protected:
  46 + void getImfData();
  47 +
  48 + void getPswData();
  49 +
  50 + bool _inGSE;
  51 +
  52 + bool _model98;
  53 +
  54 + std::string _type;
  55 +
  56 + private:
  57 + /*
  58 + * @brief params intput
  59 + */
  60 +
  61 + ParameterSPtr _inputImfParam;
  62 +
  63 + ParameterSPtr _inputPswParam;
  64 +
  65 +
  66 + };
  67 +
  68 +
  69 + }
  70 +}
  71 +
  72 +#endif /* PROCESSSHUE_HH */
0 73 \ No newline at end of file
... ...
src/ExternLib/Shue/Shue.hh
... ... @@ -18,28 +18,32 @@
18 18 #include "ParamData.hh"
19 19 #include "DataTypeMath.hh"
20 20 #include "Operation.hh"
  21 +#include "shue_compute.hh"
21 22  
22 23 #include <iterator>
23 24 namespace AMDA {
24 25 namespace Parameters {
25   - namespace Shue{
26   -
  26 + namespace Shue {
  27 +
27 28 #define AVERAGE_TIME 1200 // (seconds)
28 29 #define MAX_GAP_SIZE 3600 // (seconds)
29 30 #define DEFAULT_IMF_GSM_X 0.
30 31 #define DEFAULT_IMF_GSM_Y 2.
31 32 #define DEFAULT_IMF_GSM_Z -3.
32 33 #define DEFAULT_PSW 3.
33   -
34   - class ShueBase : public Operation{
  34 +
  35 + class ShueBase : public Operation {
35 36 public:
  37 +
36 38 ShueBase(Process& pProcess, ParamData& paramImfInput, ParamData& paramPswInput)
37 39 : Operation(pProcess),
38 40 _paramImfInput(dynamic_cast<ParamDataSpec<std::vector<float> >&> (paramImfInput)),
39   - _paramPswInput(dynamic_cast<ParamDataSpec<float>&> (paramPswInput)){
  41 + _paramPswInput(dynamic_cast<ParamDataSpec<float>&> (paramPswInput)) {
40 42 }
41   - virtual ~ShueBase(){
  43 +
  44 + virtual ~ShueBase() {
42 45 }
  46 +
43 47 void pushImfData(ParamDataIndexInfo &pParamDataIndexInfo) {
44 48 for (unsigned int _index = pParamDataIndexInfo._startIndex;
45 49 _index < pParamDataIndexInfo._startIndex + pParamDataIndexInfo._nbDataToProcess;
... ... @@ -63,6 +67,7 @@ namespace AMDA {
63 67 _psw.push_back(std::pair<double, float>(time, inputElt));
64 68 }
65 69 }
  70 +
66 71 float getValue(std::vector<std::pair<double, float> >& input, double time) {
67 72 double min_t = time - AVERAGE_TIME / 2.;
68 73 double max_t = time + AVERAGE_TIME / 2.;
... ... @@ -109,9 +114,9 @@ namespace AMDA {
109 114 void getPswData(double time, float& p_sw) {
110 115 p_sw = getValue(_psw, time);
111 116 }
112   -
113   - private:
114   -
  117 +
  118 + private:
  119 +
115 120 ParamDataSpec<std::vector<float> >& _paramImfInput;
116 121  
117 122 ParamDataSpec<float>& _paramPswInput;
... ... @@ -126,32 +131,173 @@ namespace AMDA {
126 131 std::vector<std::pair<double, float> > _psw;
127 132  
128 133 };
129   -
130   - template <typename ElemType, typename TOutputParamData>
131   - class Shue98 : public ShueBase {
  134 +
  135 + template <typename ElemType, class TOutputParamData>
  136 + class Shue : public ShueBase {
132 137 public:
133   - Shue98(Process& pProcess, ParamDataSpec<std::vector<ElemType> >& paramInput, ParamData& paramImfInput, ParamData& paramPswInput, bool inGSE):
  138 +
  139 + Shue(Process& pProcess, ParamDataSpec<std::vector<ElemType> >& paramInput, ParamData& paramImfInput, ParamData& paramPswInput, bool inGSE, bool model98) :
134 140 ShueBase(pProcess, paramImfInput, paramPswInput),
135   - _paramInput(paramInput),
136   - _paramOutput(new ParamDataSpec<TOutputParamData>), _inGSE(inGSE) {
  141 + _paramInput(paramInput),
  142 + _paramOutput(new TOutputParamData), _inGSE(inGSE), _model98(model98) {
137 143 _paramDataOutput = _paramOutput;
138 144 }
139   -
140   - void write(ParamDataIndexInfo &pParamDataIndexInfo) {
141   -
142   - }
143   -
144   - private:
  145 +
  146 + void write(ParamDataIndexInfo &pParamDataIndexInfo) {
  147 +
  148 +
  149 + for (unsigned int _index = pParamDataIndexInfo._startIndex;
  150 + _index < pParamDataIndexInfo._startIndex + pParamDataIndexInfo._nbDataToProcess;
  151 + ++_index) {
  152 + double crtTime = _paramInput.getTime(_index);
  153 +
  154 + float b_x_gse, b_y_gse, b_z_gse;
  155 + getImfData(crtTime, b_x_gse, b_y_gse, b_z_gse);
  156 +
  157 + float p_sw;
  158 + getPswData(crtTime, p_sw);
  159 + if (isNAN(p_sw)) {
  160 + p_sw = DEFAULT_PSW;
  161 + }
  162 +
  163 +
  164 + std::vector<ElemType> inputElt = _paramInput.get(_index);
  165 +
  166 + time_t timestamp = crtTime;
  167 + struct tm *tmp;
  168 + tmp = gmtime(&timestamp);
  169 +
  170 + std::vector<ElemType> ouputElt;
  171 + ouputElt.resize(3);
  172 + ouputElt << NotANumber();
  173 +
  174 + //Init geopack with GSM frame
  175 + ShueCompute::initInGSM(1900 + tmp->tm_year, 1 + tmp->tm_yday, tmp->tm_hour, tmp->tm_min, tmp->tm_sec);
  176 +
  177 + //Compute shue 98
  178 + // inout intialisation
  179 +
  180 + int transform_flag = -1;
  181 +
  182 + float sat_pos_X_GSE = inputElt[0];
  183 + float sat_pos_Y_GSE = inputElt[1];
  184 + float sat_pos_Z_GSE = inputElt[2];
  185 + float sat_pos_X_GSM = 0.;
  186 + float sat_pos_Y_GSM = 0.;
  187 + float sat_pos_Z_GSM = 0.;
  188 +
  189 + gswgse_08_(&sat_pos_X_GSM, &sat_pos_Y_GSM, &sat_pos_Z_GSM,
  190 + &sat_pos_X_GSE, &sat_pos_Y_GSE, &sat_pos_Z_GSE, &transform_flag);
  191 +
  192 + //Compute Imf B field in GSM frame
  193 + float b_x_gsm, b_y_gsm, b_z_gsm;
  194 + if (!isNAN(b_x_gse) && !isNAN(b_y_gse) && !isNAN(b_z_gse)) {
  195 + gswgse_08_(&b_x_gsm, &b_y_gsm, &b_z_gsm,
  196 + &b_x_gse, &b_y_gse, &b_z_gse, &transform_flag);
  197 + } else {
  198 + b_x_gsm = DEFAULT_IMF_GSM_X;
  199 + b_y_gsm = DEFAULT_IMF_GSM_Y;
  200 + b_z_gsm = DEFAULT_IMF_GSM_Z;
  201 + }
  202 +
  203 + float X_GSW, Y_GSW, Z_GSW;
  204 + int flag_transToGSE = 1;
  205 + float X_GSE = 0;
  206 + float Y_GSE = 0;
  207 + float Z_GSE = 0;
  208 +
  209 + float dst;
  210 + int pos_id;
  211 + bool computed = false;
  212 + if(_model98){
  213 + computed = ShueCompute::shue98(p_sw, b_z_gsm, sat_pos_X_GSM, sat_pos_Y_GSM, sat_pos_Z_GSM,
  214 + X_GSW, Y_GSW, Z_GSW, dst, pos_id);
  215 + if (computed) {
  216 + if(_inGSE){
  217 + // transform results from GSM to GSE
  218 + gswgse_08_(&X_GSW, &Y_GSW, &Z_GSW,
  219 + &X_GSE, &Y_GSE, &Z_GSE, &flag_transToGSE);
  220 + ouputElt[0] = X_GSE;
  221 + ouputElt[1] = Y_GSE;
  222 + ouputElt[2] = Z_GSE;
  223 + }else{
  224 + ouputElt[0] = X_GSW;
  225 + ouputElt[1] = Y_GSW;
  226 + ouputElt[2] = Z_GSW;
  227 + }
  228 + }
  229 + }else{
  230 + // TBD
  231 + }
  232 + _paramOutput->pushTime(crtTime);
  233 + pushData(ouputElt, dst, pos_id);
  234 + }
  235 + };
  236 +
  237 + virtual void pushData(std::vector<ElemType> ouputElt, ElemType dst, int pos_id) = 0;
  238 + protected:
145 239 ParamDataSpec<std::vector<ElemType> >& _paramInput;
146 240  
147   - ParamDataSpec<TOutputParamData>* _paramOutput;
  241 + TOutputParamData* _paramOutput;
148 242  
149 243 bool _inGSE;
150   -
  244 +
  245 + bool _model98;
  246 +
  247 + };
  248 +
  249 + template <typename ElemType>
  250 + class ShuePos : public Shue<ElemType, ParamDataSpec<std::vector<ElemType>>>
  251 + {
  252 + public:
  253 +
  254 + ShuePos(Process& pProcess, ParamDataSpec<std::vector<ElemType> >& paramInput, ParamData& paramImfInput, ParamData& paramPswInput, bool inGSE, bool model98):
  255 + Shue<ElemType, ParamDataSpec<std::vector < ElemType>>>(pProcess, paramInput,paramImfInput,paramPswInput, inGSE, model98){
  256 + }
  257 + virtual ~ShuePos(){
  258 +
  259 + }
  260 +
  261 + void pushData(std::vector<ElemType> ouputElt, ElemType /*dst*/, int /*pos_id*/) {
  262 + Shue<ElemType, ParamDataSpec<std::vector < ElemType>>>::_paramOutput->getDataList().push_back(ouputElt);
  263 + }
151 264 };
152   -
153 265  
154 266  
  267 + template <typename ElemType>
  268 + class ShueDst : public Shue<ElemType, ParamDataSpec<ElemType>>
  269 + {
  270 + public:
  271 +
  272 + ShueDst(Process& pProcess, ParamDataSpec<std::vector<ElemType> >& paramInput, ParamData& paramImfInput, ParamData& paramPswInput, bool inGSE, bool model98):
  273 + Shue<ElemType, ParamDataSpec<ElemType>>(pProcess, paramInput,paramImfInput,paramPswInput, inGSE, model98){
  274 + }
  275 + virtual ~ShueDst(){
  276 +
  277 + }
  278 +
  279 + void pushData(std::vector<ElemType> /*ouputElt*/, ElemType dst, int /*pos_id*/) {
  280 + Shue<ElemType, ParamDataSpec< ElemType>>::_paramOutput->getDataList().push_back(dst);
  281 + }
  282 + };
  283 +
  284 + template <typename ElemType>
  285 + class ShuePos_flag : public Shue<ElemType, ParamDataSpec<int>>
  286 + {
  287 + public:
  288 +
  289 + ShuePos_flag(Process& pProcess, ParamDataSpec<std::vector<ElemType> >& paramInput, ParamData& paramImfInput, ParamData& paramPswInput, bool inGSE, bool model98):
  290 + Shue<ElemType, ParamDataSpec<int>>(pProcess, paramInput,paramImfInput,paramPswInput, inGSE, model98){
  291 + }
  292 + virtual ~ShuePos_flag(){
  293 +
  294 + }
  295 +
  296 + void pushData(std::vector<ElemType> /*ouputElt*/, ElemType /*dst*/, int pos_id) {
  297 + Shue<ElemType, ParamDataSpec<int>>::_paramOutput->getDataList().push_back(pos_id);
  298 + }
  299 + };
  300 +
155 301 } // end Shue
156 302 } // end Parameters
157 303 } // end AMDA
... ...
src/ExternLib/Shue/ShueCreator.hh 0 โ†’ 100644
... ... @@ -0,0 +1,196 @@
  1 +/*
  2 + * To change this license header, choose License Headers in Project Properties.
  3 + * To change this template file, choose Tools | Templates
  4 + * and open the template in the editor.
  5 + */
  6 +
  7 +/*
  8 + * File: ShueCreator.hh
  9 + * Author: hacene
  10 + *
  11 + * Created on December 31, 2020, 3:06 PM
  12 + */
  13 +
  14 +#ifndef SHUECREATOR_HH
  15 +#define SHUECREATOR_HH
  16 +#include "ParamData.hh"
  17 +#include "VisitorOfParamData.hh"
  18 +#include "Shue.hh"
  19 +
  20 +namespace AMDA {
  21 + namespace Parameters {
  22 +
  23 + class ShueCreator : public VisitorOfParamData {
  24 + public:
  25 +
  26 + ShueCreator(Process& pProcess, ParamData& paramInput, ParamData& paramImfInput, ParamData& paramPswInput, bool inGSE, bool model98, const std::string& processType) :
  27 + _process(pProcess),
  28 + _paramData(paramInput),
  29 + _paramImfInput(paramImfInput),
  30 + _paramPswInput(paramPswInput),
  31 + _inGSE(inGSE),
  32 + _model98(model98),
  33 + _type(processType) {
  34 + _paramData.accept(*this);
  35 + }
  36 +
  37 + /**
  38 + * @overload VisitorOfParamData::visit(ParamDataScalaireShort *)
  39 + */
  40 + void visit(ParamDataScalaireShort *) {
  41 + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("Tsyganenko96Creator operation not supported"));
  42 + }
  43 +
  44 + /**
  45 + * @overload VisitorOfParamData::visit(ParamDataScalaireFloat *)
  46 + */
  47 + void visit(ParamDataScalaireFloat *) {
  48 + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("Tsyganenko96Creator operation not supported"));
  49 + }
  50 +
  51 + /**
  52 + * @overload VisitorOfParamData::visit(ParamDataScalaireDouble *)
  53 + */
  54 + void visit(ParamDataScalaireDouble *) {
  55 + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("Tsyganenko96Creator operation not supported"));
  56 + }
  57 +
  58 + /**
  59 + * @overload VisitorOfParamData::visit(ParamDataScalaireLongDouble *)
  60 + */
  61 + void visit(ParamDataScalaireLongDouble *) {
  62 + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("Tsyganenko96Creator operation not supported"));
  63 + }
  64 +
  65 + /**
  66 + * @overload VisitorOfParamData::visit(ParamDataScalaireInt *)
  67 + */
  68 + void visit(ParamDataScalaireInt *) {
  69 + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("Tsyganenko96Creator operation not supported"));
  70 + }
  71 +
  72 + /**
  73 + * @overload VisitorOfParamData::visit(ParamDataLogicalData *)
  74 + */
  75 + void visit(ParamDataLogicalData *) {
  76 + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("Tsyganenko96Creator operation not supported"));
  77 + }
  78 +
  79 + /**
  80 + * @overload VisitorOfParamData::visit(ParamDataTab1DShort *)
  81 + */
  82 + void visit(ParamDataTab1DShort *) {
  83 + createOperation<short>();
  84 + }
  85 +
  86 + /**
  87 + * @overload VisitorOfParamData::visit(ParamDataTab1DFloat *)
  88 + */
  89 + void visit(ParamDataTab1DFloat *) {
  90 + createOperation<float>();
  91 + }
  92 +
  93 + /**
  94 + * @overload VisitorOfParamData::visit(ParamDataTab1DDouble *)
  95 + */
  96 + void visit(ParamDataTab1DDouble *) {
  97 + createOperation<double>();
  98 + }
  99 +
  100 + /**
  101 + * @overload VisitorOfParamData::visit(ParamDataTab1DLongDouble *)
  102 + */
  103 + void visit(ParamDataTab1DLongDouble *) {
  104 + createOperation<long double>();
  105 + }
  106 +
  107 + /**
  108 + * @overload VisitorOfParamData::visit(ParamDataTab1DInt *)
  109 + */
  110 + void visit(ParamDataTab1DInt *) {
  111 + createOperation<int>();
  112 + }
  113 +
  114 + /**
  115 + * @overload VisitorOfParamData::visit(ParamDataTab1DLogicalData *)
  116 + */
  117 + void visit(ParamDataTab1DLogicalData *) {
  118 + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("Tsyganenko96Creator operation not supported"));
  119 + }
  120 +
  121 + /**
  122 + * @overload VisitorOfParamData::visit(ParamDataTab2DShort *)
  123 + */
  124 + void visit(ParamDataTab2DShort *) {
  125 + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("Tsyganenko96Creator operation not supported"));
  126 + }
  127 +
  128 + /**
  129 + * @overload VisitorOfParamData::visit(ParamDataTab2DFloat *)
  130 + */
  131 + void visit(ParamDataTab2DFloat *) {
  132 + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("Tsyganenko96Creator operation not supported"));
  133 + }
  134 +
  135 + /**
  136 + * @overload VisitorOfParamData::visit(ParamDataTab2DDouble *)
  137 + */
  138 + void visit(ParamDataTab2DDouble *) {
  139 + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("Tsyganenko96Creator operation not supported"));
  140 + }
  141 +
  142 + /**
  143 + * @overload VisitorOfParamData::visit(ParamDataTab2DLongDouble *)
  144 + */
  145 + void visit(ParamDataTab2DLongDouble *) {
  146 + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("Tsyganenko96Creator operation not supported"));
  147 + }
  148 +
  149 + /**
  150 + * @overload VisitorOfParamData::visit(ParamDataTab2DInt *)
  151 + */
  152 + void visit(ParamDataTab2DInt *) {
  153 + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("Tsyganenko96Creator operation not supported"));
  154 + }
  155 +
  156 + /**
  157 + * @overload VisitorOfParamData::visit(ParamDataTab2DLogicalData *)
  158 + */
  159 + void visit(ParamDataTab2DLogicalData *) {
  160 + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("Tsyganenko96Creator operation not supported"));
  161 + }
  162 +
  163 + /**
  164 + * @brief get the Tsyganenko96 parameterized operation.
  165 + */
  166 + Operation * getOperation() const {
  167 + return _operation;
  168 + }
  169 + private:
  170 +
  171 + template <typename Type>
  172 + void createOperation() {
  173 + if (_type == "pos"){
  174 + _operation = new Shue::ShuePos<Type>(_process, dynamic_cast<ParamDataSpec<std::vector<Type> >&> (_paramData), _paramImfInput, _paramPswInput, _inGSE, _model98);
  175 + }else if(_type == "pos_flag" ){
  176 + _operation = new Shue::ShuePos_flag<Type>(_process, dynamic_cast<ParamDataSpec<std::vector<Type> >&> (_paramData), _paramImfInput, _paramPswInput, _inGSE, _model98);
  177 + }else if(_type == "dst" ){
  178 + _operation = new Shue::ShueDst<Type>(_process, dynamic_cast<ParamDataSpec<std::vector<Type> >&> (_paramData), _paramImfInput, _paramPswInput, _inGSE, _model98);
  179 + }
  180 + }
  181 + Process &_process;
  182 + ParamData &_paramData;
  183 + ParamData &_paramImfInput;
  184 + ParamData &_paramPswInput;
  185 + bool _inGSE;
  186 + bool _model98;
  187 + std::string _type;
  188 + Operation* _operation;
  189 + };
  190 +
  191 + }
  192 +}
  193 +
  194 +
  195 +#endif /* SHUECREATOR_HH */
  196 +
... ...
src/ExternLib/Shue/shue_calc.cc deleted
... ... @@ -1,6 +0,0 @@
1   -/*
2   - * To change this license header, choose License Headers in Project Properties.
3   - * To change this template file, choose Tools | Templates
4   - * and open the template in the editor.
5   - */
6   -
src/ExternLib/Shue/shue_compute.hh 0 โ†’ 100644
... ... @@ -0,0 +1,54 @@
  1 +/*
  2 + * To change this license header, choose License Headers in Project Properties.
  3 + * To change this template file, choose Tools | Templates
  4 + * and open the template in the editor.
  5 + */
  6 +
  7 +/*
  8 + * File: shue_compute.hh
  9 + * Author: hacene
  10 + *
  11 + * Created on December 31, 2020, 2:50 PM
  12 + */
  13 +
  14 +#ifndef SHUE_COMPUTE_HH
  15 +#define SHUE_COMPUTE_HH
  16 +
  17 +#include "geopack.hh"
  18 +
  19 +namespace AMDA {
  20 + namespace Parameters {
  21 + namespace Shue {
  22 +#define LMAX_VAL 2000
  23 +
  24 + class ShueCompute {
  25 + public:
  26 +
  27 + static void initInGSM(int iyr, int iday, int ihour, int min, int isec) {
  28 + // We use GSM coordinate frames
  29 + float v_default_x = -400.0;
  30 + float v_default_y = 0.0;
  31 + float v_default_z = 0.0;
  32 +
  33 + recalc_08_(&iyr, &iday, &ihour, &min, &isec, &v_default_x, &v_default_y, &v_default_z);
  34 + }
  35 +
  36 + static bool shue98(float Pdyn_i, float bzIMF_i, float sat_pos_X_GSM, float sat_pos_Y_GSM, float sat_pos_Z_GSM,
  37 + float &x_mgnp, float &y_mgnp, float &z_mgnp, float &DIST_MGNP, int &ID_MGNP) {
  38 + // We use dynamic pressure Pdyn
  39 + float vel_mgnp = -1.0;
  40 +
  41 + shuetal_mgnp_08_(&Pdyn_i, &vel_mgnp, &bzIMF_i, &sat_pos_X_GSM, &sat_pos_Y_GSM, &sat_pos_Z_GSM,
  42 + &x_mgnp, &y_mgnp, &z_mgnp, &DIST_MGNP, &ID_MGNP);
  43 +
  44 + return ID_MGNP != 0;
  45 + }
  46 + };
  47 + }
  48 +
  49 + }
  50 +}
  51 +
  52 +
  53 +#endif /* SHUE_COMPUTE_HH */
  54 +
... ...