From d98b5533cc7da6bed46e1290ec7671b9074b6b8e Mon Sep 17 00:00:00 2001 From: Elena.Budnik Date: Wed, 5 Oct 2016 11:04:25 +0200 Subject: [PATCH] new curves/constants --- src/Common/AMDA_constants.hh | 10 ++++++++-- src/ExternLib/PlotCurves/AMDAPlugin.cc | 49 ++----------------------------------------------- src/ExternLib/PlotCurves/BowShock.cc | 127 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/ExternLib/PlotCurves/BowShock.hh | 18 ++++++++++++++++++ 4 files changed, 155 insertions(+), 49 deletions(-) create mode 100644 src/ExternLib/PlotCurves/BowShock.cc create mode 100644 src/ExternLib/PlotCurves/BowShock.hh diff --git a/src/Common/AMDA_constants.hh b/src/Common/AMDA_constants.hh index 1b17f37..88d0242 100644 --- a/src/Common/AMDA_constants.hh +++ b/src/Common/AMDA_constants.hh @@ -8,8 +8,14 @@ #ifndef AMDA_CONSTANTS_HH_ #define AMDA_CONSTANTS_HH_ -#define RADIUS_VENUS 6052. //km +// all radii in km +#define RADIUS_MERCURY 2440. +#define RADIUS_VENUS 6052. +#define RADIUS_EARTH 6371. +#define RADIUS_MARS 3396. +#define RADIUS_JUPITER 71492. +#define RADIUS_SATURN 60286. + #define MK2Ev 86.2069 #endif /* AMDA_CONSTANTS_HH_ */ - diff --git a/src/ExternLib/PlotCurves/AMDAPlugin.cc b/src/ExternLib/PlotCurves/AMDAPlugin.cc index a26b3d9..bb747da 100644 --- a/src/ExternLib/PlotCurves/AMDAPlugin.cc +++ b/src/ExternLib/PlotCurves/AMDAPlugin.cc @@ -53,6 +53,7 @@ DESCRIPTION #include "ServicesServer.hh" #include "PluginManager.hh" #include "CurveFunctionWriter.hh" +#include "BowShock.hh" #include @@ -63,53 +64,6 @@ using namespace plot; //----------------------------------------------------------------------------- /** - * @details This procedure return the curve definition of venus bowshock. - */ -void venus_bowshock(double precision, CurveFunctionWriter::AttributeList& pAttributeList, CurveFunctionWriter::CurvePointList& curvePointList) -{ - //param1 = 145. - CurveFunctionWriter::AttributeList::iterator lparam1It = pAttributeList.find("param1"); - if ( lparam1It == pAttributeList.end()) - { - BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_INFORMATION_REQUEST_ERR) << AMDA::ex_msg(std::string("venus_bowshock not found param1 attribute"))); - } - - //param2 = 1.35 - CurveFunctionWriter::AttributeList::iterator lparam2It = pAttributeList.find("param2"); - if ( lparam2It == pAttributeList.end()) - { - BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_INFORMATION_REQUEST_ERR) << AMDA::ex_msg(std::string("venus_bowshock not found param2 attribute"))); - } - - //param3 = 1.18 - CurveFunctionWriter::AttributeList::iterator lparam3It = pAttributeList.find("param3"); - if ( lparam3It == pAttributeList.end()) - { - BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_INFORMATION_REQUEST_ERR) << AMDA::ex_msg(std::string("venus_bowshock not found param3 attribute"))); - } - - //param4 = 0.55 - CurveFunctionWriter::AttributeList::iterator lparam4It = pAttributeList.find("param4"); - if ( lparam4It == pAttributeList.end()) - { - BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_INFORMATION_REQUEST_ERR) << AMDA::ex_msg(std::string("venus_bowshock not found param4 attribute"))); - } - - double theta, rr; - for (int i = 0; i < precision; ++i) - { - theta = (lparam1It->second * M_PI / 180.) * (double)(((double)i) / precision); - rr = lparam2It->second / (1.0 + lparam3It->second * cos(theta)); - CurveFunctionWriter::CurvePoint point; - point.x = lparam4It->second + rr * cos(theta); - point.y = rr * sin(theta); - point.z = point.y; - //std::cout << "BRE - " << point.x << " - " << point.y << " - " << point.z << std::endl; - curvePointList.push_back(point); - } -} - -/** * @details This procedure return the curve definition of venus magnetopause. */ void venus_magnetopause(double precision, CurveFunctionWriter::AttributeList& pAttributeList, CurveFunctionWriter::CurvePointList& curvePointList) @@ -207,6 +161,7 @@ extern "C" const char* getPluginVersion() */ extern "C" void registerPlugin(AMDA::Plugins::PluginManager & /*pm*/) { + ServicesServer::getInstance()->addServiceImpl("mars_bowshock",&mars_bowshock); ServicesServer::getInstance()->addServiceImpl("venus_bowshock",&venus_bowshock); ServicesServer::getInstance()->addServiceImpl("venus_magnetopause",&venus_magnetopause); ServicesServer::getInstance()->addServiceImpl("circle",&circle); diff --git a/src/ExternLib/PlotCurves/BowShock.cc b/src/ExternLib/PlotCurves/BowShock.cc new file mode 100644 index 0000000..ecda0a2 --- /dev/null +++ b/src/ExternLib/PlotCurves/BowShock.cc @@ -0,0 +1,127 @@ +/* -*- Base: 10 ; Mode: C++ -*- */ +/*------------------------------------------------------------------------ + ** + FOST project + ** +-------------------------------------------------------------------------- +-------------------------------------------------------------------------- + FILE LOG + $Revision: 1.3 $ $Date: 2012-06-15 13:04:42 $ +-------------------------------------------------------------------------- +CREATION + V.SAC + +SUMMARY + +DESCRIPTION + + The main function performs the following actions : +
    +
  • +
+ +------------------------------------------------------------------------*/ + +//============================================================================= +// +// History of code +// +// creation +// +// modification +//============================================================================= + +/** + +*/ +//============================================================================= +// Include section +//============================================================================= + +// Standard libraries include files +//----------------------------------------------------------------------------- +#include + +// Include oriented definitions +//----------------------------------------------------------------------------- + +// Module Kernel include files +//----------------------------------------------------------------------------- + +#include "DicError.hh" +#include "AMDA_exception.hh" +#include "ServicesServer.hh" +#include "PluginManager.hh" +#include "CurveFunctionWriter.hh" +#include "BowShock.hh" + +#include + +using namespace AMDA::Parameters; +using namespace plot; + +// Other modules include files +//----------------------------------------------------------------------------- + +void venus_bowshock(double precision, CurveFunctionWriter::AttributeList& pAttributeList, CurveFunctionWriter::CurvePointList& curvePointList) +{ + // param1 = 145.0 degrees + // param2 = 1.35 Rv + // param3 = 1.18 + // param4 = 0.55 Rv + bowshock(precision, pAttributeList, curvePointList); +} + +void mars_bowshock(double precision, CurveFunctionWriter::AttributeList& pAttributeList, CurveFunctionWriter::CurvePointList& curvePointList) +{ + // param1 = 135.0 degrees + // param2 = 2.04 Rm + // param3 = 1.02 + // param4 = 0.55 Rm + bowshock(precision, pAttributeList, curvePointList); +} +/** + * @details This procedure return the curve definition of general bowshock + * r = L/(1+epsilon*cos(theta)) + */ +void bowshock(double precision, CurveFunctionWriter::AttributeList& pAttributeList, CurveFunctionWriter::CurvePointList& curvePointList) +{ + CurveFunctionWriter::AttributeList::iterator lparam1It = pAttributeList.find("param1"); + if ( lparam1It == pAttributeList.end()) + { + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_INFORMATION_REQUEST_ERR) << AMDA::ex_msg(std::string("venus_bowshock not found param1 attribute"))); + } + + CurveFunctionWriter::AttributeList::iterator lparam2It = pAttributeList.find("param2"); + if ( lparam2It == pAttributeList.end()) + { + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_INFORMATION_REQUEST_ERR) << AMDA::ex_msg(std::string("venus_bowshock not found param2 attribute"))); + } + + CurveFunctionWriter::AttributeList::iterator lparam3It = pAttributeList.find("param3"); + if ( lparam3It == pAttributeList.end()) + { + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_INFORMATION_REQUEST_ERR) << AMDA::ex_msg(std::string("venus_bowshock not found param3 attribute"))); + } + + CurveFunctionWriter::AttributeList::iterator lparam4It = pAttributeList.find("param4"); + if ( lparam4It == pAttributeList.end()) + { + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_INFORMATION_REQUEST_ERR) << AMDA::ex_msg(std::string("venus_bowshock not found param4 attribute"))); + } + + double theta, rr; + for (int i = 0; i < precision; ++i) + { + theta = (lparam1It->second * M_PI / 180.) * (double)(((double)i) / precision); + rr = lparam2It->second / (1.0 + lparam3It->second * cos(theta)); + CurveFunctionWriter::CurvePoint point; + point.x = lparam4It->second + rr * cos(theta); + point.y = rr * sin(theta); + point.z = point.y; + //std::cout << "BRE - " << point.x << " - " << point.y << " - " << point.z << std::endl; + curvePointList.push_back(point); + } +} + + diff --git a/src/ExternLib/PlotCurves/BowShock.hh b/src/ExternLib/PlotCurves/BowShock.hh new file mode 100644 index 0000000..09a1ba7 --- /dev/null +++ b/src/ExternLib/PlotCurves/BowShock.hh @@ -0,0 +1,18 @@ +/** + * AMDAPlugin.hh + * + * Created on: + * Author: + */ + +#ifndef BOWSHOCK_HH_ +#define BOWSHOCK_HH_ + +using namespace plot; + +void venus_bowshock(double precision, CurveFunctionWriter::AttributeList& pAttributeList, CurveFunctionWriter::CurvePointList& curvePointList); +void mars_bowshock(double precision, CurveFunctionWriter::AttributeList& pAttributeList, CurveFunctionWriter::CurvePointList& curvePointList); + +void bowshock(double precision, CurveFunctionWriter::AttributeList& pAttributeList, CurveFunctionWriter::CurvePointList& curvePointList); + +#endif /* BOWSHOCK_HH_*/ -- libgit2 0.21.2