diff --git a/src/ExternLib/Tsyganenko96/ProcessShue98.cc b/src/ExternLib/Tsyganenko96/ProcessShue98.cc new file mode 100644 index 0000000..6a82ec8 --- /dev/null +++ b/src/ExternLib/Tsyganenko96/ProcessShue98.cc @@ -0,0 +1,141 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ + +/* + * File: ProcessShue98.cc + * Author: hacene + * + * Created on December 14, 2020, 3:21 PM + */ +#include +#include + +#include + +#include "DicError.hh" +#include "AMDA_exception.hh" + +#include "Operation.hh" +#include "ParameterManager.hh" +#include "ProcessShue98.hh" +#include "ParameterCreatorFromExpression.hh" +//#include "Shue98.hh" + +using namespace std; +using namespace boost; +using namespace log4cxx; + +namespace AMDA { + namespace Parameters { + +ProcessShue98::ProcessShue98(Parameter ¶meter, bool inGSE, const std::string& processType) : SingleParamProcess_CRTP(parameter), + _inGSE(inGSE),_type(processType) { + } + +ProcessShue98::ProcessShue98(const ProcessShue98& pProcess,Parameter ¶meter) :SingleParamProcess_CRTP(pProcess, parameter), _inGSE(pProcess._inGSE), + _type(pProcess._type) { + } + +ProcessShue98::~ProcessShue98() { + if (_inputImfParam != nullptr) { + _inputImfParam->closeConnection(this); + } + if (_inputPswParam != nullptr) { + _inputPswParam->closeConnection(this); + } +} + + void ProcessShue98::establishConnection() { + if (_attributList.size() != 2) { + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_PROCESS_ERR) << AMDA::ex_msg(std::string("ProcessShue98::parse require 2 attributes'"))); + } + + //Imf parameter + _inputImfParam = _parameter.getParameterManager().getParameter(_attributList[0]); + if (_inputImfParam == nullptr) { + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_PROCESS_ERR) << AMDA::ex_msg(std::string("ProcessShue98::parse cannot retrieve imf param"))); + } + _inputImfParam->openConnection(this); + + //Psw parameter + _inputPswParam = _parameter.getParameterManager().getParameter(_attributList[1]); + if (_inputPswParam == nullptr) { + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_PROCESS_ERR) << AMDA::ex_msg(std::string("ProcessShue98::parse cannot retrieve psw param"))); + } + _inputPswParam->openConnection(this); + + + SingleParamProcess::establishConnection(); + } + +TimeStamp ProcessShue98::init() { + +TimeStamp time = _parameterInput->init( this, _timeIntervalList); + + _inputImfParam->init( this, _timeIntervalList); + ParamData* lImfParamInput = _inputImfParam->getParamData(this).get(); + + _inputPswParam->init( this, _timeIntervalList); + ParamData* lPswParamInput = _inputPswParam->getParamData(this).get(); + + _paramInput = _parameterInput->getParamData(this).get(); + + Shue98Creator lCreator(*this, *_paramInput, *lImfParamInput, *lPswParamInput, _inGSE, _type); + _operation = lCreator.getOperation(); + _paramData = ParamDataSPtr(_operation->getParamOutput()); + _paramData->setMinSampling(_paramInput->getMinSampling()); + return time; + + return time; + } + +unsigned int ProcessShue98::write() { + getImfData(); + getPswData(); + return SingleParamProcess::write(); +} + +/* +void ProcessShue98::getImfData() { + try { + ParamDataIndexInfo lParamDataIndexInfo; + lParamDataIndexInfo = _inputImfParam->getAsync(this).get(); + while ((!lParamDataIndexInfo._noMoreTimeInt && !lParamDataIndexInfo._timeIntToProcessChanged) || (lParamDataIndexInfo._nbDataToProcess > 0)) { + reinterpret_cast(_operation)->pushImfData(lParamDataIndexInfo); + if (lParamDataIndexInfo._timeIntToProcessChanged || lParamDataIndexInfo._noMoreTimeInt) + break; + lParamDataIndexInfo = _inputImfParam->getAsync(this).get(); + } + }catch (...) { + throw; + } +} + + +void ProcessShue98::getPswData() { + try { + ParamDataIndexInfo lParamDataIndexInfo; + lParamDataIndexInfo = _inputPswParam->getAsync(this).get(); + while ((!lParamDataIndexInfo._noMoreTimeInt && !lParamDataIndexInfo._timeIntToProcessChanged) || (lParamDataIndexInfo._nbDataToProcess > 0)) { + reinterpret_cast(_operation)->pushPswData(lParamDataIndexInfo); + if (lParamDataIndexInfo._timeIntToProcessChanged || lParamDataIndexInfo._noMoreTimeInt) + break; + lParamDataIndexInfo = _inputPswParam->getAsync(this).get(); + } + }catch (...) { + throw; + } + +} + * */ + +ProcessShue98PosGSM::ProcessShue98PosGSM(Parameter ¶meter) : ProcessShue98(parameter,false,"pos") { +} + +ProcessShue98PosGSE::ProcessShue98PosGSE(Parameter ¶meter) : ProcessShue98(parameter,true,"pos") { +} + } +} \ No newline at end of file diff --git a/src/ExternLib/Tsyganenko96/ProcessShue98.hh b/src/ExternLib/Tsyganenko96/ProcessShue98.hh new file mode 100644 index 0000000..40618f8 --- /dev/null +++ b/src/ExternLib/Tsyganenko96/ProcessShue98.hh @@ -0,0 +1,92 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ + +/* + * File: ProcessShue98.hh + * Author: hacene + * + * Created on December 14, 2020, 9:15 PM + */ + +#ifndef PROCESSSHUE98_HH +#define PROCESSSHUE98_HH + + +#include "SingleParamProcess.hh" +#include "ParamInfo.hh" +#include "Shue98Creator.hh" + +namespace AMDA { + namespace Parameters { + + class ProcessShue98 : public SingleParamProcess_CRTP { + public: + ProcessShue98(Parameter & parameter, bool inGSE, const std::string& processType); + ProcessShue98(const ProcessShue98& pProcess, Parameter & parameter); + virtual ~ProcessShue98(); + + /** + * @overload Process::establishConnection() + */ + virtual void establishConnection(); + + /** + * @overload Process::init() + */ + virtual TimeStamp init(); + + /** + * Write data in dataParam. + */ + virtual unsigned int write(); + + protected: + void getImfData(); + + void getPswData(); + + bool _inGSE; + + std::string _type; + private: + /** + * @brief params intput + */ + ParameterSPtr _inputImfParam; + + ParameterSPtr _inputPswParam; + + }; + + /** + * @class Shue98PosGSM + * @brief Process to Shue 98 position if GSM + */ + class ProcessShue98PosGSM : public ProcessShue98 { + public: + /** + * @brief Constructor. + */ + ProcessShue98PosGSM(Parameter ¶meter); + }; + + /** + * @class Shue98PosGSE + * @brief Process to Shue 98 position if GSE + */ + class ProcessShue98PosGSE : public ProcessShue98 { + public: + /** + * @brief Constructor. + */ + ProcessShue98PosGSE(Parameter ¶meter); + }; + + } +} + +#endif /* PROCESSSHUE98_HH */ + diff --git a/src/ExternLib/Tsyganenko96/Shue98.hh b/src/ExternLib/Tsyganenko96/Shue98.hh deleted file mode 100644 index 136a21a..0000000 --- a/src/ExternLib/Tsyganenko96/Shue98.hh +++ /dev/null @@ -1,168 +0,0 @@ -/* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. - */ - -/* - * File: Shue98.hh - * Author: hacene - * - * Created on December 14, 2020, 11:42 AM - */ - -#ifndef SHUE98_HH -#define SHUE98_HH -#include "Parameter.hh" -#include "ParamData.hh" -#include "DataTypeMath.hh" -#include "Operation.hh" -#include "GeopackWrapper.hh" -#include "Tsyganenko96.hh" - -#include - -namespace AMDA { - namespace Parameters { - namespace Shue98 { - - template - class Shue98Base : public Tsyganenko96Base { - public: - - /** - * @brief Constructor. - * @details Create the ParamData type of the input ParamData. - */ - Shue98Base(Process& pProcess, ParamDataSpec >& paramInput, ParamData& paramImfInput, ParamData& paramPswInput, bool inGSE) - : Tsyganenko96Base(pProcess, paramImfInput, paramPswInput), - _paramInput(paramInput), - _paramOutput(new TOutputParamData), _inGSE(inGSE) { - _paramDataOutput = _paramOutput; - } - - virtual ~Shue98Base() { - } - - /** - * @overload Operation::write(ParamDataIndexInfo &pParamDataIndexInfo) - */ - - void write(ParamDataIndexInfo &pParamDataIndexInfo) { - for (unsigned int _index = pParamDataIndexInfo._startIndex; - _index < pParamDataIndexInfo._startIndex + pParamDataIndexInfo._nbDataToProcess; - ++_index) { - double crtTime = _paramInput.getTime(_index); - - float b_x_gse, b_y_gse, b_z_gse; - getImfData(crtTime, b_x_gse, b_y_gse, b_z_gse); - - float p_sw; - getPswData(crtTime, p_sw); - if (isNAN(p_sw)) { - p_sw = DEFAULT_PSW; - } - - - std::vector inputElt = _paramInput.get(_index); - - time_t timestamp = crtTime; - struct tm *tmp; - tmp = gmtime(×tamp); - - std::vector ouputElt; - ouputElt.resize(3); - ouputElt << NotANumber(); - - //Init geopack with GSM frame - geopack::GeopackWrapper::initInGSM(1900 + tmp->tm_year, 1 + tmp->tm_yday, tmp->tm_hour, tmp->tm_min, tmp->tm_sec); - - //Compute magnetic field - float X_GSW, Y_GSW, Z_GSW; - float dst; - int pos_id; - bool computed = false; - computed = geopack::GeopackWrapper::shue98(p_sw, b_z_gsm, sat_pos_X_GSM, sat_pos_Y_GSM, sat_pos_Z_GSM, - X_GSW, Y_GSW, Z_GSW, dst, pos_id); - if (computed) { - ouputElt[0] = B_X_RES; - ouputElt[1] = B_Y_RES; - ouputElt[2] = B_Z_RES; - } - - - _paramOutput->pushTime(crtTime); - pushData(ouputElt, dst, pos_id); - } - } - - void pushData(std::vector std::vectorouputElt, ElemType dst, int pos_id) = 0; - - protected: - ParamDataSpec >& _paramInput; - - TOutputParamData* _paramOutput; - - bool _inGSE; - }; - - template - class Shue98Dst : public Shue98Base { - - Shue98Dst(Process& pProcess, ParamDataSpec >& paramInput, ParamData& paramImfInput, ParamData& paramPswInput, bool inGSE) - : Shue98Base>(pProcess, paramInput, paramImfInput, paramPswInput, inGSE) { - - } - - virtual ~Shue98Dst() { - } - - pushData(std::vector/*ouputElt*/, ElemType dst, int /*pos_id*/) { - Shue98Base>::_paramOutput->getDataList().push_back(dst); - } - - }; - - template - class Shue98Pos_Id : public Shue98Base { - - Shue98Pos_Id(Process& pProcess, ParamDataSpec >& paramInput, ParamData& paramImfInput, ParamData& paramPswInput, bool inGSE) - : Shue98Base>(pProcess, paramInput, paramImfInput, paramPswInput, inGSE) { - - } - - virtual ~Shue98Pos_Id() { - } - - pushData(std::vector/*ouputElt*/, ElemType /*dst*/, int pos_id) { - Shue98Base>::_paramOutput->getDataList().push_back(pos_id); - } - - }; - - template - class Shue98Pos : public Shue98Base { - - Shue98Pos(Process& pProcess, ParamDataSpec >& paramInput, ParamData& paramImfInput, ParamData& paramPswInput, bool inGSE) - : Shue98Base>>(pProcess, paramInput, paramImfInput, paramPswInput, inGSE) { - - } - - virtual ~Shue98Pos() { - } - - pushData(std::vector ouputElt, ElemType /*dst*/, int /*pos_id*/) { - Shue98Base>>::_paramOutput->getDataList().push_back(ouputElt); - } - - }; - - } - } - - - - - -#endif /* SHUE98_HH */ - diff --git a/src/ExternLib/Tsyganenko96/Shue98Creator.hh b/src/ExternLib/Tsyganenko96/Shue98Creator.hh index 4c727a2..e5725ce 100644 --- a/src/ExternLib/Tsyganenko96/Shue98Creator.hh +++ b/src/ExternLib/Tsyganenko96/Shue98Creator.hh @@ -18,7 +18,7 @@ #include "ParamData.hh" #include "VisitorOfParamData.hh" -#include "Shue98.hh" +#include "Tsyganenko96.hh" namespace AMDA { namespace Parameters { @@ -32,7 +32,7 @@ namespace AMDA { _paramImfInput(paramImfInput), _paramPswInput(paramPswInput), _inGSE(inGSE), - _type(processType){ + _type(processType) { _paramData.accept(*this); } @@ -40,126 +40,126 @@ namespace AMDA { * @overload VisitorOfParamData::visit(ParamDataScalaireShort *) */ void visit(ParamDataScalaireShort *) { - createOperation(); + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("Tsyganenko96Creator operation not supported")); } /** * @overload VisitorOfParamData::visit(ParamDataScalaireFloat *) */ void visit(ParamDataScalaireFloat *) { - createOperation(); + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("Tsyganenko96Creator operation not supported")); } /** * @overload VisitorOfParamData::visit(ParamDataScalaireDouble *) */ void visit(ParamDataScalaireDouble *) { - createOperation(); + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("Tsyganenko96Creator operation not supported")); } /** * @overload VisitorOfParamData::visit(ParamDataScalaireLongDouble *) */ void visit(ParamDataScalaireLongDouble *) { - createOperation(); + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("Tsyganenko96Creator operation not supported")); } /** * @overload VisitorOfParamData::visit(ParamDataScalaireInt *) */ void visit(ParamDataScalaireInt *) { - createOperation(); + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("Tsyganenko96Creator operation not supported")); } /** * @overload VisitorOfParamData::visit(ParamDataLogicalData *) */ void visit(ParamDataLogicalData *) { - BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("Shue98Creator operation not supported")); + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("Tsyganenko96Creator operation not supported")); } /** * @overload VisitorOfParamData::visit(ParamDataTab1DShort *) */ void visit(ParamDataTab1DShort *) { - BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("Shue98Creator operation not supported")); + createOperation(); } /** * @overload VisitorOfParamData::visit(ParamDataTab1DFloat *) */ void visit(ParamDataTab1DFloat *) { - BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("Shue98Creator operation not supported")); + createOperation(); } /** * @overload VisitorOfParamData::visit(ParamDataTab1DDouble *) */ void visit(ParamDataTab1DDouble *) { - BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("Shue98Creator operation not supported")); + createOperation(); } /** * @overload VisitorOfParamData::visit(ParamDataTab1DLongDouble *) */ void visit(ParamDataTab1DLongDouble *) { - BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("Shue98Creator operation not supported")); + createOperation(); } /** * @overload VisitorOfParamData::visit(ParamDataTab1DInt *) */ void visit(ParamDataTab1DInt *) { - BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("Shue98Creator operation not supported")); + createOperation(); } /** * @overload VisitorOfParamData::visit(ParamDataTab1DLogicalData *) */ void visit(ParamDataTab1DLogicalData *) { - BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("Shue98Creator operation not supported")); + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("Tsyganenko96Creator operation not supported")); } /** * @overload VisitorOfParamData::visit(ParamDataTab2DShort *) */ void visit(ParamDataTab2DShort *) { - BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("Shue98Creator operation not supported")); + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("Tsyganenko96Creator operation not supported")); } /** * @overload VisitorOfParamData::visit(ParamDataTab2DFloat *) */ void visit(ParamDataTab2DFloat *) { - BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("Shue98Creator operation not supported")); + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("Tsyganenko96Creator operation not supported")); } /** * @overload VisitorOfParamData::visit(ParamDataTab2DDouble *) */ void visit(ParamDataTab2DDouble *) { - BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("Shue98Creator operation not supported")); + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("Tsyganenko96Creator operation not supported")); } /** * @overload VisitorOfParamData::visit(ParamDataTab2DLongDouble *) */ void visit(ParamDataTab2DLongDouble *) { - BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("Shue98Creator operation not supported")); + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("Tsyganenko96Creator operation not supported")); } /** * @overload VisitorOfParamData::visit(ParamDataTab2DInt *) */ void visit(ParamDataTab2DInt *) { - BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("Shue98Creator operation not supported")); + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("Tsyganenko96Creator operation not supported")); } /** * @overload VisitorOfParamData::visit(ParamDataTab2DLogicalData *) */ void visit(ParamDataTab2DLogicalData *) { - BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("Shue98Creator operation not supported")); + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("Tsyganenko96Creator operation not supported")); } /** @@ -172,12 +172,8 @@ namespace AMDA { template void createOperation() { - if (_type == "pos_id") - _operation = new Shue98::Shue98Pos_Id( _process, dynamic_cast >&>(_paramData), _paramImfInput, _paramPswInput, _inGSE); - if (_type == "dst") - _operation = new Shue98::Shue98Dst( _process, dynamic_cast >&>(_paramData), _paramImfInput, _paramPswInput, _inGSE); if (_type == "pos") - _operation = new Shue98::Shue98Pos( _process, dynamic_cast >&>(_paramData), _paramImfInput, _paramPswInput, _inGSE); + _operation = new Tsyganenko96::Shue98Pos(_process, dynamic_cast >&> (_paramData), _paramImfInput, _paramPswInput, _inGSE); } Process &_process; ParamData &_paramData; diff --git a/src/ExternLib/Tsyganenko96/Tsyganenko96.hh b/src/ExternLib/Tsyganenko96/Tsyganenko96.hh index d60048a..ddc1ca7 100644 --- a/src/ExternLib/Tsyganenko96/Tsyganenko96.hh +++ b/src/ExternLib/Tsyganenko96/Tsyganenko96.hh @@ -258,7 +258,6 @@ namespace AMDA { ouputElt[2] = B_Z_RES; } } - _paramOutput->pushTime(crtTime); _paramOutput->getDataList().push_back(ouputElt); } @@ -394,6 +393,119 @@ namespace AMDA { } }; + template + class Shue98Base : public Tsyganenko96Base{ + public: + + /** + * @brief Constructor. + * @details Create the ParamData type of the input ParamData. + */ + Shue98Base(Process& pProcess, ParamDataSpec >& paramInput, ParamData& paramImfInput, ParamData& paramPswInput, bool inGSE) + : Tsyganenko96Base(pProcess, paramImfInput, paramPswInput), + _paramInput(paramInput), + _paramOutput(new TOutputParamData), _inGSE(inGSE) { + _paramDataOutput = _paramOutput; + } + + virtual ~Shue98Base() { + } + + /** + * @overload Operation::write(ParamDataIndexInfo &pParamDataIndexInfo) + */ + + void write(ParamDataIndexInfo &pParamDataIndexInfo) { + + + for (unsigned int _index = pParamDataIndexInfo._startIndex; + _index < pParamDataIndexInfo._startIndex + pParamDataIndexInfo._nbDataToProcess; + ++_index) { + double crtTime = _paramInput.getTime(_index); + + float b_x_gse, b_y_gse, b_z_gse; + getImfData(crtTime, b_x_gse, b_y_gse, b_z_gse); + + float p_sw; + getPswData(crtTime, p_sw); + if (isNAN(p_sw)) { + p_sw = DEFAULT_PSW; + } + + + std::vector inputElt = _paramInput.get(_index); + + time_t timestamp = crtTime; + struct tm *tmp; + tmp = gmtime(×tamp); + + std::vector ouputElt; + ouputElt.resize(3); + ouputElt << NotANumber(); + + //Init geopack with GSM frame + geopack::GeopackWrapper::initInGSM(1900 + tmp->tm_year, 1 + tmp->tm_yday, tmp->tm_hour, tmp->tm_min, tmp->tm_sec); + + //Compute shue 98 + // inout intialisation + + int transform_flag = -1; + + float sat_pos_X_GSE = inputElt[0]; + float sat_pos_Y_GSE = inputElt[1]; + float sat_pos_Z_GSE = inputElt[2]; + float sat_pos_X_GSM = 0.; + float sat_pos_Y_GSM = 0.; + float sat_pos_Z_GSM = 0.; + + gswgse_08_(&sat_pos_X_GSM, &sat_pos_Y_GSM, &sat_pos_Z_GSM, + &sat_pos_X_GSE, &sat_pos_Y_GSE, &sat_pos_Z_GSE, &transform_flag); + + //Compute Imf B field in GSM frame + float b_x_gsm, b_y_gsm, b_z_gsm; + if (!isNAN(b_x_gse) && !isNAN(b_y_gse) && !isNAN(b_z_gse)) { + gswgse_08_(&b_x_gsm, &b_y_gsm, &b_z_gsm, + &b_x_gse, &b_y_gse, &b_z_gse, &transform_flag); + } else { + b_x_gsm = DEFAULT_IMF_GSM_X; + b_y_gsm = DEFAULT_IMF_GSM_Y; + b_z_gsm = DEFAULT_IMF_GSM_Z; + } + + float X_GSW, Y_GSW, Z_GSW; + float dst; + int pos_id; + bool computed = false; + computed = geopack::GeopackWrapper::shue98(p_sw, b_z_gsm, sat_pos_X_GSM, sat_pos_Y_GSM, sat_pos_Z_GSM, + X_GSW, Y_GSW, Z_GSW, dst, pos_id); + if (computed) { + ouputElt[0] = X_GSW ; + ouputElt[1] = Y_GSW; + ouputElt[2] = Z_GSW; + } + _paramOutput->pushTime(crtTime); + pushData(ouputElt, dst, pos_id); + } + }; + + virtual void pushData(std::vector ouputElt, ElemType dst) = 0; + + protected : + ParamDataSpec >& _paramInput; + + TOutputParamData* _paramOutput; + + bool _inGSE; + }; + + template + class Shue98Pos:public Shue98Base>>{ + Shue98Pos(Process& pProcess, ParamDataSpec >& paramInput, ParamData& paramImfInput, ParamData& paramPswInput, bool inGSE): + Shue98Base>>(pProcess, paramInput, paramImfInput, paramPswInput, inGSE){ + + } + }; + } /* namespace Tsyganenko96 */ } /* namespace Parameters */ } /* namespace AMDA */ -- libgit2 0.21.2