/* * 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: Cain.hh * Author: hacene * * Created on September 6, 2021, 11:41 AM */ #ifndef CAIN_HH #define CAIN_HH #include "Parameter.hh" #include "ParamData.hh" #include "DataTypeMath.hh" #include "Operation.hh" #include "SpiceKernelMgr.hh" #include #include #include "cainWarpper.hh" #define RM 3396.2 //RADIUS_MARS namespace AMDA { namespace Parameters { namespace Cain { using namespace std; template class Cain : public Operation { public: Cain(Process& pProcess, ParamDataSpec >¶mInput) : Operation(pProcess), _paramInput(paramInput), _paramOutput(new TOutputParamData()) { _paramDataOutput = _paramOutput; } virtual ~Cain() { } /** * @overload Operation::write(ParamDataIndexInfo &pParamDataIndexInfo) */ void write(ParamDataIndexInfo &pParamDataIndexInfo) { double dlat, dlong, alt; double B= 0.0; double Bx = 0.0, By = 0.0, Bz = 0.0; double Btt = 0.0, Bpp = 0.0, Brr = 0.0; int ifail = -1; for (unsigned int _index = pParamDataIndexInfo._startIndex; _index < pParamDataIndexInfo._startIndex + pParamDataIndexInfo._nbDataToProcess; ++_index) { std::vector xyz_MSO = _paramInput.getDataList()[_index]; dlat = (double) xyz_MSO[0]; dlong = (double) xyz_MSO[1]; alt = (double) xyz_MSO[2]*RM; double crtTime = _paramInput.getTime(_index); cainWarpper::getCain( dlat, dlong, alt, Btt, Bpp, Brr, Bx, By, Bz, B, ifail); std::vector outputBrtp; outputBrtp.resize(3); outputBrtp[0] = Btt; outputBrtp[1] = Bpp; outputBrtp[2] = Brr; vectoroutputBxyz; outputBxyz.resize(3); outputBxyz[0] = Bx; outputBxyz[1] = By; outputBxyz[2] = Bz; // writing data _paramOutput->pushTime(crtTime); pushResult(outputBrtp, B, outputBxyz); } } virtual void pushResult(std::vector& fieldSph, double& magnitude_, std::vector &fieldCoor) = 0; protected: ParamDataSpec >& _paramInput; TOutputParamData* _paramOutput; }; template class CainMag : public Cain{ public: CainMag(Process& pProcess, ParamDataSpec >& paramInput) : Cain(pProcess, paramInput) { } void pushResult(std::vector& /*fieldSph*/, double& magnitude_, std::vector& /*fieldCoor*/){ Cain ::_paramOutput->getDataList().push_back(magnitude_); } }; template class CainCart : public Cain{ public: CainCart(Process& pProcess, ParamDataSpec >& paramInput) : Cain(pProcess, paramInput) { } void pushResult(std::vector& /*fieldSph*/, double& /*magnitude_*/, std::vector& fieldCoor){ Cain ::_paramOutput->getDataList().push_back(fieldCoor); } }; template class CainSphr : public Cain{ public: CainSphr(Process& pProcess, ParamDataSpec >& paramInput) : Cain(pProcess, paramInput) { } void pushResult(std::vector& fieldSph, double& /*magnitude_*/, std::vector& /*fieldCoor*/){ Cain ::_paramOutput->getDataList().push_back(fieldSph); } }; } } } #endif /* CAIN2003_HH */