From e74f20d9b36e91a0eae351480b8ec40a6abd31ad Mon Sep 17 00:00:00 2001 From: Hacene SI HADJ MOHAND Date: Fri, 15 Oct 2021 16:29:25 +0200 Subject: [PATCH] compil ok --- src/ExternLib/Cain/Pv_ionos.hh | 151 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------------------------------------------- src/ExternLib/Cain/Pv_ionosProcess.cc | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ src/ExternLib/Cain/Pv_ionosProcess.hh | 4 ++-- src/ExternLib/Cain/data.hh | 31 ++++++++++++++----------------- 4 files changed, 146 insertions(+), 93 deletions(-) create mode 100644 src/ExternLib/Cain/Pv_ionosProcess.cc diff --git a/src/ExternLib/Cain/Pv_ionos.hh b/src/ExternLib/Cain/Pv_ionos.hh index 7e0ab23..41f95d4 100644 --- a/src/ExternLib/Cain/Pv_ionos.hh +++ b/src/ExternLib/Cain/Pv_ionos.hh @@ -24,8 +24,8 @@ namespace AMDA { namespace Parameters { - namespace Pv_ionos{ - + namespace Pv_ionos { + template /** * Pv_ionosTe computes electron temperature of Venus @@ -33,103 +33,106 @@ namespace AMDA { * @param pProcess * @param paramInput */ - class Pv_ionosTe: public Operation { - public: - Pv_ionosTe(Process& pProcess, ParamDataSpec >¶mInput) : Operation(pProcess), + class Pv_ionosTe : public Operation { + public: + + Pv_ionosTe(Process& pProcess, ParamDataSpec >¶mInput) : Operation(pProcess), _paramInput(paramInput), _paramOutput(new TOutputParamData()) { } - virtual ~Pv_ionosTe(){ - - } - - void write(ParamDataIndexInfo &pParamDataIndexInfo) { - double alt, sza; - double te; - std::vector bp; - bp.resize(4); - for (unsigned int _index = pParamDataIndexInfo._startIndex; + + virtual ~Pv_ionosTe() { + + } + + void write(ParamDataIndexInfo &pParamDataIndexInfo) { + double alt, sza; + double te; + std::vector pb; + pb.resize(4); + for (unsigned int _index = pParamDataIndexInfo._startIndex; _index < pParamDataIndexInfo._startIndex + pParamDataIndexInfo._nbDataToProcess; ++_index) { std::vector input = _paramInput.getDataList()[_index]; - alt = (double) input[0]; - sza = (double) input[1]; - double crtTime = _paramInput.getTime(_index); - double s=std::sin(sza); - double s=std::cos(sza); - double s2=std::sin(2*sza); - double c2=std::cos(2*sza); - double s3=std::sin(3*sza); - double c1=std::cos(3*sza); - for (int j=1;j<5;j++){ - int k = 7*j; - pb(j-1) = fdsmodt(k-6)+fdsmodt(k-5)*s+fdsmodt(k-4)*c+fdsmodt(k-3)*s2+fdsmodt(k-2)*c2+ - fdsmodt(k-1)*s3 + fdsmodt(k)*c3; - } - te=pb(1)+pb(2)/((alt+pb(3))**2)+pb(4)*alt; - _paramOutput->pushTime(crtTime); - _paramOutput->getDataList().push_back(te); - } + alt = (double) input[0]; + sza = (double) input[1]; + double crtTime = _paramInput.getTime(_index); + double s = std::sin(sza); + double c = std::cos(sza); + double s2 = std::sin(2 * sza); + double c2 = std::cos(2 * sza); + double s3 = std::sin(3 * sza); + double c3 = std::cos(3 * sza); + for (int j = 1; j < 5; j++) { + int k = 7 * j; + pb[j - 1] = fdsmodt[k - 6] + fdsmodt[k - 5] * s + fdsmodt[k - 4] * c + fdsmodt[k - 3] * s2 + fdsmodt[k - 2] * c2 + + fdsmodt[k - 1] * s3 + fdsmodt[k] * c3; + } + te = pb[1] + pb[2] / ((alt + pb[3])*(alt + pb[3])) + pb[4] * alt; + _paramOutput->pushTime(crtTime); + _paramOutput->getDataList().push_back(te); } - - protected: + } + + protected: ParamDataSpec >& _paramInput; TOutputParamData* _paramOutput; }; - - template + + template /** * Pv_ionosDe computes electron density of Venus atmosphere * see Pv_ionos_ReadMe * @param pProcess * @param paramInput */ - class Pv_ionosTe: public Operation { - public: - Pv_ionosDe(Process& pProcess, ParamDataSpec >¶mInput) : Operation(pProcess), + class Pv_ionosDe : public Operation { + public: + + Pv_ionosDe(Process& pProcess, ParamDataSpec >¶mInput) : Operation(pProcess), _paramInput(paramInput), _paramOutput(new TOutputParamData()) { } - virtual ~Pv_ionosDe(){ - - } - - void write(ParamDataIndexInfo &pParamDataIndexInfo) { - double alt, sza; - double te; - std::vector bp; - bp.resize(4); - for (unsigned int _index = pParamDataIndexInfo._startIndex; + + virtual ~Pv_ionosDe() { + + } + + void write(ParamDataIndexInfo &pParamDataIndexInfo) { + double alt, sza; + double de, szap; + std::vector bp; + bp.resize(4); + for (unsigned int _index = pParamDataIndexInfo._startIndex; _index < pParamDataIndexInfo._startIndex + pParamDataIndexInfo._nbDataToProcess; ++_index) { std::vector input = _paramInput.getDataList()[_index]; - alt = (double) input[0]; - sza = (double) input[1]; - double crtTime = _paramInput.getTime(_index); - double s2=std::sin(sza)*std::sin(sza); - double s=std::cos(sza); - double s2=std::sin(2*sza); - double c2=std::cos(2*sza); - double s3=std::sin(3*sza); - double c1=std::cos(3*sza); - for (int j=1;j<5;j++){ - int k = 7*j; - pb(j-1) = fdsmodt(k-6)+fdsmodt(k-5)*s+fdsmodt(k-4)*c+fdsmodt(k-3)*s2+fdsmodt(k-2)*c2+ - fdsmodt(k-1)*s3 + fdsmodt(k)*c3; - } - te=pb(1)+pb(2)/((alt+pb(3))**2)+pb(4)*alt; - _paramOutput->pushTime(crtTime); - _paramOutput->getDataList().push_back(te); + alt = (double) input[0]; + sza = (double) input[1]; + double crtTime = _paramInput.getTime(_index); + double s2 = std::sin(sza) * std::sin(sza); + szap = sza * (1. - fdsmodde[23] * s2 * std::exp(-fdsmodde[24] * s2 - fdsmodde[25]*(alt - fdsmodde[26])*(alt - fdsmodde[26]))); + double sinz = sin(fdsmodde[18] + szap); + double s = fdsmodde[1] + fdsmodde[2] / (alt - fdsmodde[3]) + + sinz * fdsmodde[13] + + fdsmodde[19] * std::exp(-fdsmodde[20]*((alt - fdsmodde[21])*(alt - fdsmodde[21])) - fdsmodde[22] * szap * szap); + double o = fdsmodde[4] + fdsmodde[5] / (alt - fdsmodde[6]) + sinz * fdsmodde[14]; + double c = fdsmodde[7] + fdsmodde[8] / (alt - fdsmodde[9]) + sinz * fdsmodde[15]; + double m = fdsmodde[10] + fdsmodde[11] / (alt - fdsmodde[12]) + sinz * fdsmodde[16]; + double ss = s * cos(fdsmodde[10] + szap); + double calc = (1.77245 * ss * erfc(-ss) + std::exp(-ss * ss) + o); + if (calc <= 0) + calc = 0.00001; + de = c + m * log(calc); + _paramOutput->pushTime(crtTime); + _paramOutput->getDataList().push_back(de); } - } - - protected: + } + + protected: ParamDataSpec >& _paramInput; TOutputParamData* _paramOutput; }; } } - } - -#endif - +} #endif /* PV_IONOS_HH */ diff --git a/src/ExternLib/Cain/Pv_ionosProcess.cc b/src/ExternLib/Cain/Pv_ionosProcess.cc new file mode 100644 index 0000000..82e44c0 --- /dev/null +++ b/src/ExternLib/Cain/Pv_ionosProcess.cc @@ -0,0 +1,53 @@ +/* + * 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: Pv_ionosProcess.c++ + * Author: hacene + * + * Created on October 14, 2021, 4:25 PM + */ + +#include "Operation.hh" +#include "ParameterManager.hh" +#include "ParameterCreatorFromExpression.hh" +#include +#include "DicError.hh" +#include "AMDA_exception.hh" +#include "CainCreator.hh" + +#include "Pv_ionosProcess.hh" +namespace AMDA { + namespace Parameters { + + Pv_ionosProcess::Pv_ionosProcess(Parameter& parameter) : SingleParamProcess_CRTP(parameter) { + } + + + Pv_ionosProcess::Pv_ionosProcess(const Pv_ionosProcess& pProcess, Parameter ¶meter) : SingleParamProcess_CRTP(pProcess, parameter) { + } + + Pv_ionosProcess::~Pv_ionosProcess() { + } + TimeStamp Pv_ionosProcess::init() { + if (_attributList.size() < 1) { + 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"))); + } + std::string ouputType = _attributList[0]; + TimeStamp timeStamp = _parameterInput->init(this, _timeIntervalList); + Parameter::InfoList lInfoList = _parameterInput->getInfoList(); + _parameter.getInfoList().insert(lInfoList.begin(), lInfoList.end()); + _paramInput = _parameterInput->getParamData(this).get(); + CainCreator ICreator(*this, *_paramInput, ouputType); + _operation = ICreator.getOperation(); + _paramData = ParamDataSPtr(_operation->getParamOutput()); + _paramData->setMinSampling(_paramInput->getMinSampling()); + return timeStamp; + + } + + } +} \ No newline at end of file diff --git a/src/ExternLib/Cain/Pv_ionosProcess.hh b/src/ExternLib/Cain/Pv_ionosProcess.hh index b64f727..377a70f 100644 --- a/src/ExternLib/Cain/Pv_ionosProcess.hh +++ b/src/ExternLib/Cain/Pv_ionosProcess.hh @@ -18,10 +18,10 @@ namespace AMDA { namespace Parameters { - class Pv_ionosProcess : public AMDA::Parameters::SingleParamProcess_CRTP { + class Pv_ionosProcess : public AMDA::Parameters::SingleParamProcess_CRTP { public: Pv_ionosProcess(Parameter& parameter); - Pv_ionosProcess(const cainProcess& pProcess, Parameter& parameter); + Pv_ionosProcess(const Pv_ionosProcess& pProcess, Parameter& parameter); virtual ~Pv_ionosProcess(); /** diff --git a/src/ExternLib/Cain/data.hh b/src/ExternLib/Cain/data.hh index 55e9474..d66db39 100644 --- a/src/ExternLib/Cain/data.hh +++ b/src/ExternLib/Cain/data.hh @@ -15,31 +15,28 @@ #define DATA_HH namespace AMDA { namespace Parameters { - namespace Pv_ionosTemp { - static std::vector fdsmodt( - 3.567296, 1.3836078E-02, 1.5086544E-02, 6.0729804E-03, 4.0306677E-03, - -1.3217842E-02, 7.8089219E-03, -2775.023, -123.7310, 8.828382, + namespace Pv_ionos { + const std::vector< double> fdsmodt{ + 3.567296, 1.3836078e-02, 1.5086544e-02, 6.0729804e-03, 4.0306677e-03, + -1.3217842e-02, 7.8089219e-03, -2775.023, -123.7310, 8.828382, -96.94563, 15.84634, 138.9812, -139.7511, -84.03277, 0.2649297, -1.444215, 0.6347786, -2.192531, -0.5396207, - 0.6054179, 1.0569388E-04, -8.0908003E-06 1.3877957E-05, -1.2327257E-05, - -1.1256760E-05, 1.3830228E-05, -1.4350858E-05 - ); - - static std::vector fdsmodt( - 5.334022, 252.5587, 120.4444 9.1163822E-02, - 6.195264, - 37.38898 3.331818, 245.5529, 0.7587564, 0.1453792, - - 0.9461438 127.1485, - 0.3391595, 2.4936652E-02, 0.1879423, - - 5.3126566E-02, 2.9439656E-02, 1.654282, 415.7859, 2.6281483E-02 + 0.6054179, 1.0569388e-04, -8.0908003e-06, 1.3877957e-05, -1.2327257e-05, + -1.1256760e-05, 1.3830228e-05, -1.4350858e-05 + }; + + const std::vector fdsmodde{ + 5.334022, 252.5587, 120.4444, 9.1163822E-02, - 6.195264, + 37.38898, 3.331818, 245.5529, 0.7587564, 0.1453792, + -0.9461438, 127.1485, -0.3391595, 2.4936652E-02, 0.1879423, + - 5.3126566E-02, 2.9439656E-02, 1.654282, 415.7859, 2.6281483E-02, 145.3951, 2.045347, 0.4421963, 3.036170, 9.1009791E-04, 141.5824 - ); + }; } } } - -#endif - #endif /* DATA_HH */ -- libgit2 0.21.2