From adc30892f35309750579a77f07c4669ac4cf91ee Mon Sep 17 00:00:00 2001 From: Elena.Budnik Date: Tue, 14 Feb 2017 13:41:10 +0100 Subject: [PATCH] correct venus bowshocl --- src/ExternLib/PlotCurves/AMDAPlugin.cc | 7 +++++-- src/ExternLib/PlotCurves/Boundaries.cc | 35 +++++++++++++++++++++++++++++++++++ src/ExternLib/PlotCurves/Boundaries.hh | 1 + 3 files changed, 41 insertions(+), 2 deletions(-) diff --git a/src/ExternLib/PlotCurves/AMDAPlugin.cc b/src/ExternLib/PlotCurves/AMDAPlugin.cc index 1222286..86ecdce 100644 --- a/src/ExternLib/PlotCurves/AMDAPlugin.cc +++ b/src/ExternLib/PlotCurves/AMDAPlugin.cc @@ -99,10 +99,13 @@ extern "C" void registerPlugin(AMDA::Plugins::PluginManager & /*pm*/) ServicesServer::getInstance()->addServiceImpl("bowshock_farris",&bowshock_farris); // Elena TBD : id in plotCurves.xml acts as function name - to change Request generation procedure ServicesServer::getInstance()->addServiceImpl("mars_bowshock",&bowshock); - ServicesServer::getInstance()->addServiceImpl("venus_bowshock_min",&bowshock); - ServicesServer::getInstance()->addServiceImpl("venus_bowshock_max",&bowshock); + ServicesServer::getInstance()->addServiceImpl("venus_bowshock",&bowshock); ServicesServer::getInstance()->addServiceImpl("mercury_bowshock",&bowshock); ServicesServer::getInstance()->addServiceImpl("saturn_bowshock_went",&saturn_bowshock_went); + ServicesServer::getInstance()->addServiceImpl("jupiter_bowshock_high",&bowshock1); + ServicesServer::getInstance()->addServiceImpl("jupiter_bowshock_low",&bowshock1); + ServicesServer::getInstance()->addServiceImpl("jupiter_magnetopause_high",&bowshock1); + ServicesServer::getInstance()->addServiceImpl("jupiter_magnetopause_low",&bowshock1); ServicesServer::getInstance()->addServiceImpl("venus_magnetopause",&venus_magnetopause); ServicesServer::getInstance()->addServiceImpl("mars_magnetopause",&mars_magnetopause); ServicesServer::getInstance()->addServiceImpl("mercury_magnetopause",&mercury_magnetopause); diff --git a/src/ExternLib/PlotCurves/Boundaries.cc b/src/ExternLib/PlotCurves/Boundaries.cc index 7aa038f..d960cfe 100644 --- a/src/ExternLib/PlotCurves/Boundaries.cc +++ b/src/ExternLib/PlotCurves/Boundaries.cc @@ -84,6 +84,41 @@ using namespace plot; * @details This procedure return the curve definition of general bowshock * r = L/(1+epsilon*cos(theta)) */ +void bowshock1(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("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("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("bowshock not found param3 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 = 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); + } +} + void bowshock(double precision, CurveFunctionWriter::AttributeList& pAttributeList, CurveFunctionWriter::CurvePointList& curvePointList) { CurveFunctionWriter::AttributeList::iterator lparam1It = pAttributeList.find("param1"); diff --git a/src/ExternLib/PlotCurves/Boundaries.hh b/src/ExternLib/PlotCurves/Boundaries.hh index aa88dd3..a8ac71c 100644 --- a/src/ExternLib/PlotCurves/Boundaries.hh +++ b/src/ExternLib/PlotCurves/Boundaries.hh @@ -13,6 +13,7 @@ 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 bowshock1(double precision, CurveFunctionWriter::AttributeList& pAttributeList, CurveFunctionWriter::CurvePointList& curvePointList); void bowshock(double precision, CurveFunctionWriter::AttributeList& pAttributeList, CurveFunctionWriter::CurvePointList& curvePointList); void bowshock_farris(double precision, CurveFunctionWriter::AttributeList& pAttributeList, CurveFunctionWriter::CurvePointList& curvePointList); void saturn_bowshock_went(double precision, CurveFunctionWriter::AttributeList& pAttributeList, CurveFunctionWriter::CurvePointList& curvePointList); -- libgit2 0.21.2