Commit e74f20d9b36e91a0eae351480b8ec40a6abd31ad

Authored by Hacene SI HADJ MOHAND
1 parent ab1d0117
Exists in 9719

compil ok

src/ExternLib/Cain/Pv_ionos.hh
... ... @@ -24,8 +24,8 @@
24 24  
25 25 namespace AMDA {
26 26 namespace Parameters {
27   - namespace Pv_ionos{
28   -
  27 + namespace Pv_ionos {
  28 +
29 29 template<typename DataType, class TOutputParamData>
30 30 /**
31 31 * Pv_ionosTe computes electron temperature of Venus
... ... @@ -33,103 +33,106 @@ namespace AMDA {
33 33 * @param pProcess
34 34 * @param paramInput
35 35 */
36   - class Pv_ionosTe: public Operation {
37   - public:
38   - Pv_ionosTe(Process& pProcess, ParamDataSpec<vector<DataType> >&paramInput) : Operation(pProcess),
  36 + class Pv_ionosTe : public Operation {
  37 + public:
  38 +
  39 + Pv_ionosTe(Process& pProcess, ParamDataSpec<std::vector<DataType> >&paramInput) : Operation(pProcess),
39 40 _paramInput(paramInput), _paramOutput(new TOutputParamData()) {
40 41 }
41   - virtual ~Pv_ionosTe(){
42   -
43   - }
44   -
45   - void write(ParamDataIndexInfo &pParamDataIndexInfo) {
46   - double alt, sza;
47   - double te;
48   - std::vector<double> bp;
49   - bp.resize(4);
50   - for (unsigned int _index = pParamDataIndexInfo._startIndex;
  42 +
  43 + virtual ~Pv_ionosTe() {
  44 +
  45 + }
  46 +
  47 + void write(ParamDataIndexInfo &pParamDataIndexInfo) {
  48 + double alt, sza;
  49 + double te;
  50 + std::vector<double> pb;
  51 + pb.resize(4);
  52 + for (unsigned int _index = pParamDataIndexInfo._startIndex;
51 53 _index < pParamDataIndexInfo._startIndex + pParamDataIndexInfo._nbDataToProcess;
52 54 ++_index) {
53 55 std::vector<DataType> input = _paramInput.getDataList()[_index];
54   - alt = (double) input[0];
55   - sza = (double) input[1];
56   - double crtTime = _paramInput.getTime(_index);
57   - double s=std::sin(sza);
58   - double s=std::cos(sza);
59   - double s2=std::sin(2*sza);
60   - double c2=std::cos(2*sza);
61   - double s3=std::sin(3*sza);
62   - double c1=std::cos(3*sza);
63   - for (int j=1;j<5;j++){
64   - int k = 7*j;
65   - pb(j-1) = fdsmodt(k-6)+fdsmodt(k-5)*s+fdsmodt(k-4)*c+fdsmodt(k-3)*s2+fdsmodt(k-2)*c2+
66   - fdsmodt(k-1)*s3 + fdsmodt(k)*c3;
67   - }
68   - te=pb(1)+pb(2)/((alt+pb(3))**2)+pb(4)*alt;
69   - _paramOutput->pushTime(crtTime);
70   - _paramOutput->getDataList().push_back(te);
71   - }
  56 + alt = (double) input[0];
  57 + sza = (double) input[1];
  58 + double crtTime = _paramInput.getTime(_index);
  59 + double s = std::sin(sza);
  60 + double c = std::cos(sza);
  61 + double s2 = std::sin(2 * sza);
  62 + double c2 = std::cos(2 * sza);
  63 + double s3 = std::sin(3 * sza);
  64 + double c3 = std::cos(3 * sza);
  65 + for (int j = 1; j < 5; j++) {
  66 + int k = 7 * j;
  67 + pb[j - 1] = fdsmodt[k - 6] + fdsmodt[k - 5] * s + fdsmodt[k - 4] * c + fdsmodt[k - 3] * s2 + fdsmodt[k - 2] * c2 +
  68 + fdsmodt[k - 1] * s3 + fdsmodt[k] * c3;
  69 + }
  70 + te = pb[1] + pb[2] / ((alt + pb[3])*(alt + pb[3])) + pb[4] * alt;
  71 + _paramOutput->pushTime(crtTime);
  72 + _paramOutput->getDataList().push_back(te);
72 73 }
73   -
74   - protected:
  74 + }
  75 +
  76 + protected:
75 77 ParamDataSpec<std::vector<DataType> >& _paramInput;
76 78 TOutputParamData* _paramOutput;
77 79 };
78   -
79   - template<typename DataType, class TOutputParamData>
  80 +
  81 + template<typename DataType, class TOutputParamData>
80 82 /**
81 83 * Pv_ionosDe computes electron density of Venus atmosphere
82 84 * see Pv_ionos_ReadMe
83 85 * @param pProcess
84 86 * @param paramInput
85 87 */
86   - class Pv_ionosTe: public Operation {
87   - public:
88   - Pv_ionosDe(Process& pProcess, ParamDataSpec<vector<DataType> >&paramInput) : Operation(pProcess),
  88 + class Pv_ionosDe : public Operation {
  89 + public:
  90 +
  91 + Pv_ionosDe(Process& pProcess, ParamDataSpec<std::vector<DataType> >&paramInput) : Operation(pProcess),
89 92 _paramInput(paramInput), _paramOutput(new TOutputParamData()) {
90 93 }
91   - virtual ~Pv_ionosDe(){
92   -
93   - }
94   -
95   - void write(ParamDataIndexInfo &pParamDataIndexInfo) {
96   - double alt, sza;
97   - double te;
98   - std::vector<double> bp;
99   - bp.resize(4);
100   - for (unsigned int _index = pParamDataIndexInfo._startIndex;
  94 +
  95 + virtual ~Pv_ionosDe() {
  96 +
  97 + }
  98 +
  99 + void write(ParamDataIndexInfo &pParamDataIndexInfo) {
  100 + double alt, sza;
  101 + double de, szap;
  102 + std::vector<double> bp;
  103 + bp.resize(4);
  104 + for (unsigned int _index = pParamDataIndexInfo._startIndex;
101 105 _index < pParamDataIndexInfo._startIndex + pParamDataIndexInfo._nbDataToProcess;
102 106 ++_index) {
103 107 std::vector<DataType> input = _paramInput.getDataList()[_index];
104   - alt = (double) input[0];
105   - sza = (double) input[1];
106   - double crtTime = _paramInput.getTime(_index);
107   - double s2=std::sin(sza)*std::sin(sza);
108   - double s=std::cos(sza);
109   - double s2=std::sin(2*sza);
110   - double c2=std::cos(2*sza);
111   - double s3=std::sin(3*sza);
112   - double c1=std::cos(3*sza);
113   - for (int j=1;j<5;j++){
114   - int k = 7*j;
115   - pb(j-1) = fdsmodt(k-6)+fdsmodt(k-5)*s+fdsmodt(k-4)*c+fdsmodt(k-3)*s2+fdsmodt(k-2)*c2+
116   - fdsmodt(k-1)*s3 + fdsmodt(k)*c3;
117   - }
118   - te=pb(1)+pb(2)/((alt+pb(3))**2)+pb(4)*alt;
119   - _paramOutput->pushTime(crtTime);
120   - _paramOutput->getDataList().push_back(te);
  108 + alt = (double) input[0];
  109 + sza = (double) input[1];
  110 + double crtTime = _paramInput.getTime(_index);
  111 + double s2 = std::sin(sza) * std::sin(sza);
  112 + szap = sza * (1. - fdsmodde[23] * s2 * std::exp(-fdsmodde[24] * s2 - fdsmodde[25]*(alt - fdsmodde[26])*(alt - fdsmodde[26])));
  113 + double sinz = sin(fdsmodde[18] + szap);
  114 + double s = fdsmodde[1] + fdsmodde[2] / (alt - fdsmodde[3])
  115 + + sinz * fdsmodde[13]
  116 + + fdsmodde[19] * std::exp(-fdsmodde[20]*((alt - fdsmodde[21])*(alt - fdsmodde[21])) - fdsmodde[22] * szap * szap);
  117 + double o = fdsmodde[4] + fdsmodde[5] / (alt - fdsmodde[6]) + sinz * fdsmodde[14];
  118 + double c = fdsmodde[7] + fdsmodde[8] / (alt - fdsmodde[9]) + sinz * fdsmodde[15];
  119 + double m = fdsmodde[10] + fdsmodde[11] / (alt - fdsmodde[12]) + sinz * fdsmodde[16];
  120 + double ss = s * cos(fdsmodde[10] + szap);
  121 + double calc = (1.77245 * ss * erfc(-ss) + std::exp(-ss * ss) + o);
  122 + if (calc <= 0)
  123 + calc = 0.00001;
  124 + de = c + m * log(calc);
  125 + _paramOutput->pushTime(crtTime);
  126 + _paramOutput->getDataList().push_back(de);
121 127 }
122   - }
123   -
124   - protected:
  128 + }
  129 +
  130 + protected:
125 131 ParamDataSpec<std::vector<DataType> >& _paramInput;
126 132 TOutputParamData* _paramOutput;
127 133 };
128 134 }
129 135 }
130   - }
131   -
132   -#endif
133   -
  136 +}
134 137 #endif /* PV_IONOS_HH */
135 138  
... ...
src/ExternLib/Cain/Pv_ionosProcess.cc 0 โ†’ 100644
... ... @@ -0,0 +1,53 @@
  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: Pv_ionosProcess.c++
  9 + * Author: hacene
  10 + *
  11 + * Created on October 14, 2021, 4:25 PM
  12 + */
  13 +
  14 +#include "Operation.hh"
  15 +#include "ParameterManager.hh"
  16 +#include "ParameterCreatorFromExpression.hh"
  17 +#include <boost/lexical_cast.hpp>
  18 +#include "DicError.hh"
  19 +#include "AMDA_exception.hh"
  20 +#include "CainCreator.hh"
  21 +
  22 +#include "Pv_ionosProcess.hh"
  23 +namespace AMDA {
  24 + namespace Parameters {
  25 +
  26 + Pv_ionosProcess::Pv_ionosProcess(Parameter& parameter) : SingleParamProcess_CRTP(parameter) {
  27 + }
  28 +
  29 +
  30 + Pv_ionosProcess::Pv_ionosProcess(const Pv_ionosProcess& pProcess, Parameter &parameter) : SingleParamProcess_CRTP(pProcess, parameter) {
  31 + }
  32 +
  33 + Pv_ionosProcess::~Pv_ionosProcess() {
  34 + }
  35 + TimeStamp Pv_ionosProcess::init() {
  36 + if (_attributList.size() < 1) {
  37 + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_PROCESS_ERR) << AMDA::ex_msg(std::string("Pv_ionosProcess::init required at least 1 attribute")));
  38 + }
  39 + std::string ouputType = _attributList[0];
  40 + TimeStamp timeStamp = _parameterInput->init(this, _timeIntervalList);
  41 + Parameter::InfoList lInfoList = _parameterInput->getInfoList();
  42 + _parameter.getInfoList().insert(lInfoList.begin(), lInfoList.end());
  43 + _paramInput = _parameterInput->getParamData(this).get();
  44 + CainCreator ICreator(*this, *_paramInput, ouputType);
  45 + _operation = ICreator.getOperation();
  46 + _paramData = ParamDataSPtr(_operation->getParamOutput());
  47 + _paramData->setMinSampling(_paramInput->getMinSampling());
  48 + return timeStamp;
  49 +
  50 + }
  51 +
  52 + }
  53 +}
0 54 \ No newline at end of file
... ...
src/ExternLib/Cain/Pv_ionosProcess.hh
... ... @@ -18,10 +18,10 @@
18 18 namespace AMDA {
19 19 namespace Parameters {
20 20  
21   - class Pv_ionosProcess : public AMDA::Parameters::SingleParamProcess_CRTP<cainProcess> {
  21 + class Pv_ionosProcess : public AMDA::Parameters::SingleParamProcess_CRTP<Pv_ionosProcess> {
22 22 public:
23 23 Pv_ionosProcess(Parameter& parameter);
24   - Pv_ionosProcess(const cainProcess& pProcess, Parameter& parameter);
  24 + Pv_ionosProcess(const Pv_ionosProcess& pProcess, Parameter& parameter);
25 25 virtual ~Pv_ionosProcess();
26 26  
27 27 /**
... ...
src/ExternLib/Cain/data.hh
... ... @@ -15,31 +15,28 @@
15 15 #define DATA_HH
16 16 namespace AMDA {
17 17 namespace Parameters {
18   - namespace Pv_ionosTemp {
19   - static std::vector<double> fdsmodt(
20   - 3.567296, 1.3836078E-02, 1.5086544E-02, 6.0729804E-03, 4.0306677E-03,
21   - -1.3217842E-02, 7.8089219E-03, -2775.023, -123.7310, 8.828382,
  18 + namespace Pv_ionos {
  19 + const std::vector< double> fdsmodt{
  20 + 3.567296, 1.3836078e-02, 1.5086544e-02, 6.0729804e-03, 4.0306677e-03,
  21 + -1.3217842e-02, 7.8089219e-03, -2775.023, -123.7310, 8.828382,
22 22 -96.94563, 15.84634, 138.9812, -139.7511, -84.03277,
23 23 0.2649297, -1.444215, 0.6347786, -2.192531, -0.5396207,
24   - 0.6054179, 1.0569388E-04, -8.0908003E-06 1.3877957E-05, -1.2327257E-05,
25   - -1.1256760E-05, 1.3830228E-05, -1.4350858E-05
26   - );
27   -
28   - static std::vector<double> fdsmodt(
29   - 5.334022, 252.5587, 120.4444 9.1163822E-02, - 6.195264,
30   - 37.38898 3.331818, 245.5529, 0.7587564, 0.1453792,
31   - - 0.9461438 127.1485, - 0.3391595, 2.4936652E-02, 0.1879423,
32   - - 5.3126566E-02, 2.9439656E-02, 1.654282, 415.7859, 2.6281483E-02
  24 + 0.6054179, 1.0569388e-04, -8.0908003e-06, 1.3877957e-05, -1.2327257e-05,
  25 + -1.1256760e-05, 1.3830228e-05, -1.4350858e-05
  26 + };
  27 +
  28 + const std::vector<double> fdsmodde{
  29 + 5.334022, 252.5587, 120.4444, 9.1163822E-02, - 6.195264,
  30 + 37.38898, 3.331818, 245.5529, 0.7587564, 0.1453792,
  31 + -0.9461438, 127.1485, -0.3391595, 2.4936652E-02, 0.1879423,
  32 + - 5.3126566E-02, 2.9439656E-02, 1.654282, 415.7859, 2.6281483E-02,
33 33 145.3951, 2.045347, 0.4421963, 3.036170, 9.1009791E-04,
34 34 141.5824
35   - );
  35 + };
36 36  
37 37 }
38 38 }
39 39 }
40 40  
41   -
42   -#endif
43   -
44 41 #endif /* DATA_HH */
45 42  
... ...