Commit 0b31214ed8c52c66e6fd60857d17cc6be659ba8e

Authored by Hacene SI HADJ MOHAND
1 parent 7a7cbef3

Maglib

src/ExternLib/Maglib/CMakeLists.txt 0 → 100644
... ... @@ -0,0 +1,38 @@
  1 +
  2 +PROJECT(maglib)
  3 +
  4 +set(LIBRARY_OUTPUT_PATH ${PLUGIN_OUTPUT_PATH})
  5 +
  6 +include_directories(
  7 + ${CMAKE_HOME_DIRECTORY}/src/InternLib/
  8 + ${CMAKE_HOME_DIRECTORY}/src/Common/
  9 + ${CMAKE_HOME_DIRECTORY}/src/Parameters/
  10 + ${CMAKE_HOME_DIRECTORY}/src/Plugins/
  11 + ${CMAKE_HOME_DIRECTORY}/src/helpers/
  12 + ${CMAKE_HOME_DIRECTORY}/src/TimeTableCatalog/
  13 + ${CMAKE_HOME_DIRECTORY}/src/Info/
  14 + ${LOG4CXX_INCLUDE_DIR}
  15 + ${Boost_INCLUDE_DIR}
  16 + ${MAGLIBINCLUDE_DIRS}
  17 +)
  18 +
  19 +#Library configuration
  20 +file(
  21 + GLOB_RECURSE
  22 + source_files
  23 + ./*
  24 +)
  25 +
  26 +ADD_LIBRARY( maglib SHARED ${source_files} )
  27 +
  28 +
  29 +target_link_libraries(
  30 + maglib
  31 + ${LOG4CXX_LIBRARIES}
  32 + Parameters
  33 + InternLib
  34 + TimeTableCatalog
  35 + TimeUtil
  36 + Info
  37 +)
  38 +
... ...
src/ExternLib/Maglib/MaglibWarpper.hh 0 → 100644
... ... @@ -0,0 +1,69 @@
  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: MaglibWarper.hh
  9 + * Author: hacene
  10 + *
  11 + * Created on July 21, 2020, 1:16 PM
  12 + */
  13 +
  14 +#ifndef MAGLIBWARPER_HH
  15 +#define MAGLIBWARPER_HH
  16 +
  17 +#include "maglib.hh"
  18 +
  19 +namespace AMDA {
  20 + namespace Parameters {
  21 + namespace maglib {
  22 +
  23 + class maglibWarpper {
  24 + public:
  25 +
  26 + static void getPosmag(int iyear, int imonth, int iday, int ihour, int imin, int isec, float* rrmag, float* thetr, float* phir,
  27 + int* isatex, int* magout, float* xgsm, float* ygsm, float* zgsm, float* xgse, float* ygse, float* zgse, float* tgl,
  28 + float* flg, float* xlambr, float* tglc, float* hsl, float* clatgmr, float* clongmr, float * iposmg[], int* ifai)
  29 + {
  30 + /**
  31 + *
  32 + * @param iyear enre 2000 et 2015
  33 + * @param imonth
  34 + * @param iday
  35 + * @param ihour
  36 + * @param imin
  37 + * @param isec
  38 + * @param rrmag distance radiale geocentrique (rayons terrestres)
  39 + * @param thetr colatitude geocentrique (radians)
  40 + * @param phir longitude geocentrique (radians)
  41 + * @param isatex : 0 = satellite proche (apogee < 8. r. terre.)
  42 +i * isatex : 1 = satellite excentrique (apogee > 8. r. terre.)
  43 + */
  44 + // declaration
  45 +
  46 + int ifail;
  47 +
  48 + float rig[3][3], rgi[3][3], rgsm[3][3], rsmg[3][3], rggsm[3][3], rgsmg[3][3], rgse[3][3], rseg[3][3];
  49 + float rgdip[3][3], rdipg[3][3], rigsm[3][3], rgsmi[3][3];
  50 + float alfag, alfas, deltas, tilt, tetdip, phidip, xgsm, ygsm, zgsm, xgse, ygse, zgse;
  51 + float tgl, flg, xlambr, tglc, hsl, clatgmr, clongmr, xlamb, clatgm, clongm, thetdo, phido, year;
  52 + int iposmg[15] = 0;
  53 +
  54 +
  55 + valfix_(ifail);
  56 + inigeom_(iyear, imonth, iday, ihour, imin, isec, year, alfag, tetdip, phidip, alfas, deltas, rig, rgi, rgdip, rdipg, rgsm,
  57 + rsmg, tilt, rggsm, rgsmg, rgse, rseg, rigsm, rgsmi, ifail);
  58 +
  59 + posmag_(magout, isatex, year, rrmag, thetr, phir, alfag, alfas, deltas, tilt, rgsm, rggsm, rgsmg, rgdip, rgse, tetdip,
  60 + phidip, xgsm, ygsm, zgsm, xgse, ygse, zgse, tgl, flg, xlambr, tglc, hsl, clatgmr, clongmr, iposmg, ifail);
  61 +
  62 + }
  63 + };
  64 +
  65 + }
  66 + }
  67 +}
  68 +#endif /* MAGLIBWARPER_HH */
  69 +
... ...
src/ExternLib/Maglib/Posmag.hh 0 → 100644
... ... @@ -0,0 +1,98 @@
  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: Posmag.hh
  9 + * Author: hacene
  10 + *
  11 + * Created on July 21, 2020, 3:42 PM
  12 + */
  13 +
  14 +#ifndef POSMAG_HH
  15 +#define POSMAG_HH
  16 +#include "MaglibWarpper.hh"
  17 +
  18 +#include "Parameter.hh"
  19 +#include "ParamData.hh"
  20 +#include "DataTypeMath.hh"
  21 +#include "Operation.hh"
  22 +#include "SpiceKernelMgr.hh"
  23 +#include <vector>
  24 +
  25 +namespace AMDA {
  26 + namespace Parameters {
  27 +
  28 + template<typename DataType, class TOutputParamData>
  29 + class Posmag : public Operation {
  30 + public:
  31 +
  32 + /**
  33 + * @brief Constructor.
  34 + * @details Create the ParamData type of the input ParamData.
  35 + */
  36 + Posmag(Process& pProcess, ParamDataSpec<vector<DataType> >&paramInput, int isatex, int magout) :
  37 + Operation(pProcess),
  38 + _paramInput(paramInput),
  39 + _paramOutput(new TOutputParamData()),
  40 + _isatex(isatex),
  41 + _magout(magout) {
  42 + _paramDataOutput = _paramOutput;
  43 + };
  44 +
  45 + /**
  46 + * @brief Constructor.
  47 + * @details Create the ParamData type of the input ParamData.
  48 + */
  49 + Posmag(Process& pProcess, ParamDataSpec<vector<DataType> >&paramInput) :
  50 + Operation(pProcess),
  51 + _paramInput(paramInput),
  52 + _paramOutput(new TOutputParamData()),
  53 + _isatex(0),
  54 + _magout(2) {
  55 + _paramDataOutput = _paramOutput;
  56 + }
  57 +
  58 + virtual ~Posmag() {
  59 + }
  60 +
  61 + /**
  62 + * @overload Operation::write(ParamDataIndexInfo &pParamDataIndexInfo)
  63 + */
  64 + void write(ParamDataIndexInfo &pParamDataIndexInfo) {
  65 + for (unsigned int _index = pParamDataIndexInfo._startIndex;
  66 + _index < pParamDataIndexInfo._startIndex + pParamDataIndexInfo._nbDataToProcess;
  67 + ++_index) {
  68 +
  69 + vector<DataType> in = _paramInput.getDataList()[_index];
  70 + double crtTime = _paramInput.getTime(_index);
  71 + ime_t timestamp = crtTime;
  72 + struct tm *tmp;
  73 + tmp = gmtime(&timestamp);
  74 + float rrmag = in[0];
  75 + float thetr = in[1];
  76 + float phir = in[2];
  77 +
  78 + vector<DataType> outputBrtp;
  79 + outputBrtp.resize(3);
  80 +
  81 +
  82 +
  83 + maglib::maglibWarpper::getPosmag(1900 + tmp->tm_year, 1 + tmp->tm_yday, tmp->tm_hour,
  84 + tmp->tm_min, tmp->tm_sec, rrmag, thetr, phir, _isatex, _magout);
  85 + }
  86 +
  87 + }
  88 +
  89 + protected:
  90 + int _isatex;
  91 + int _magout;
  92 + };
  93 + }
  94 +}
  95 +
  96 +
  97 +#endif /* POSMAG_HH */
  98 +
... ...