Commit f2db3c160de97807b1ef5138c14a212829b60fbb

Authored by Benjamin Renard
1 parent 65c661e8

Support variable table definition

Add Stereo A SWEA PAD & Maven PLASTIC C0 parameters
config/DataBaseParameters/mav_sta_c0.xml 0 โ†’ 100644
@@ -0,0 +1,24 @@ @@ -0,0 +1,24 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<param xml:id="mav_sta_c0">
  3 + <info>
  4 + <name>Eflux</name>
  5 + <short_name>Eflux</short_name>
  6 + <components></components>
  7 + <units>eV/st/sec</units>
  8 + <coordinates_system></coordinates_system>
  9 + <tensor_order>0</tensor_order>
  10 + <si_conversion></si_conversion>
  11 + <table>
  12 + <centerAutoTable variable="true" name="Energy" units="eV" centerName="mav_sta_c0_energy" log="false"/>
  13 + </table>
  14 + <fill_value>-1e+31</fill_value>
  15 + <ucd></ucd>
  16 + <dataset_id></dataset_id>
  17 + </info>
  18 + <get>
  19 + <amdaParam name="mav_sta_c0_tab2d"/>
  20 + <amdaParam name="mav_sta_c0_energy"/>
  21 + </get>
  22 + <process description="Mass 0">$mav_sta_c0_tab2d[0].toVector()</process>
  23 + <output/>
  24 +</param>
config/DataBaseParameters/mav_sta_c0_energy.xml 0 โ†’ 100644
@@ -0,0 +1,15 @@ @@ -0,0 +1,15 @@
  1 +<?xml version="1.0"?>
  2 +<param xml:id="mav_sta_c0_energy">
  3 + <get>
  4 + <vi name='mavpds:sta:c0'>
  5 + <baseParam name="swp_ind" useNearestValue="true">
  6 + <clb name="energy"/>
  7 + <clb name="nswp"/>
  8 + <clb name="nmass"/>
  9 + <clb name="nenergy"/>
  10 + </baseParam>
  11 + </vi>
  12 + </get>
  13 + <process description="MAVEN STATIC C0 Energy">#getMavenStaticEnergy($mavpds_sta_c0_swp_ind)</process>
  14 + <output/>
  15 +</param>
0 \ No newline at end of file 16 \ No newline at end of file
config/DataBaseParameters/mav_sta_c0_tab2d.xml 0 โ†’ 100644
@@ -0,0 +1,23 @@ @@ -0,0 +1,23 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<param xml:id="mav_sta_c0_tab2d">
  3 + <info>
  4 + <name>Eflux</name>
  5 + <short_name>Eflux</short_name>
  6 + <components></components>
  7 + <units>eV/st/sec</units>
  8 + <coordinates_system></coordinates_system>
  9 + <tensor_order>0</tensor_order>
  10 + <si_conversion></si_conversion>
  11 + <fill_value>-1e+31</fill_value>
  12 + <ucd></ucd>
  13 + <dataset_id></dataset_id>
  14 + </info>
  15 + <get>
  16 + <vi name="mavpds:sta:c0">
  17 + <baseParam name="eflux">
  18 + </baseParam>
  19 + </vi>
  20 + </get>
  21 + <process/>
  22 + <output/>
  23 +</param>
config/DataBaseParameters/sta_swea_pad_energy.xml 0 โ†’ 100644
@@ -0,0 +1,13 @@ @@ -0,0 +1,13 @@
  1 +<?xml version="1.0"?>
  2 +<param xml:id="sta_swea_pad_energy">
  3 + <get>
  4 + <vi name='sta:swea:pad'>
  5 + <baseParam name="EnergyTab" useNearestValue="true">
  6 + <clb name="ETab0"/>
  7 + <clb name="ETab1"/>
  8 + </baseParam>
  9 + </vi>
  10 + </get>
  11 + <process description="StereoA SWEA-PAD Energy">#getClbInfo($sta_swea_pad_EnergyTab;0:ETab0;1:ETab1)</process>
  12 + <output/>
  13 +</param>
0 \ No newline at end of file 14 \ No newline at end of file
config/DataBaseParameters/sta_swea_pad_pasum.xml 0 โ†’ 100644
@@ -0,0 +1,24 @@ @@ -0,0 +1,24 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<param xml:id="sta_swea_pad_pasum">
  3 + <info>
  4 + <name>Stereo-A SWEA PAD Total under all angles</name>
  5 + <short_name>SWEA PAD Total under all angles</short_name>
  6 + <components></components>
  7 + <units>s3/km6</units>
  8 + <coordinates_system></coordinates_system>
  9 + <tensor_order>0</tensor_order>
  10 + <si_conversion></si_conversion>
  11 + <table>
  12 + <centerAutoTable variable="true" name="Energy" units="eV" centerName="sta_swea_pad_energy" log="true"/>
  13 + </table>
  14 + <fill_value>-1e+31</fill_value>
  15 + <ucd></ucd>
  16 + <dataset_id></dataset_id>
  17 + </info>
  18 + <get>
  19 + <amdaParam name="sta_swea_pad_tab2d"/>
  20 + <amdaParam name="sta_swea_pad_energy"/>
  21 + </get>
  22 + <process description="total(sta_swea_pad_tab2d,1)">total($sta_swea_pad_tab2d,1)</process>
  23 + <output/>
  24 +</param>
config/DataBaseParameters/sta_swea_pad_tab2d.xml
@@ -8,10 +8,6 @@ @@ -8,10 +8,6 @@
8 <coordinates_system></coordinates_system> 8 <coordinates_system></coordinates_system>
9 <tensor_order>0</tensor_order> 9 <tensor_order>0</tensor_order>
10 <si_conversion></si_conversion> 10 <si_conversion></si_conversion>
11 - <table>  
12 - <centerTable dim="0" name="PA" centerName="PitchAngles" size="15" units="deg."/>  
13 - <centerAutoTable dim="1" name="Energy" units="eV" centerName="ETab0" log="false"/>  
14 - </table>  
15 <fill_value>-1e+31</fill_value> 11 <fill_value>-1e+31</fill_value>
16 <ucd></ucd> 12 <ucd></ucd>
17 <dataset_id></dataset_id> 13 <dataset_id></dataset_id>
@@ -19,9 +15,6 @@ @@ -19,9 +15,6 @@
19 <get> 15 <get>
20 <vi name="sta:swea:pad"> 16 <vi name="sta:swea:pad">
21 <baseParam name="PAD250"> 17 <baseParam name="PAD250">
22 - <clb name="PitchAngles"/>  
23 - <clb name="ETab0"/>  
24 - <clb name="ETab1"/>  
25 </baseParam> 18 </baseParam>
26 </vi> 19 </vi>
27 </get> 20 </get>
config/DataBaseParameters/xsd/info/paramInfo.xsd
@@ -17,6 +17,7 @@ @@ -17,6 +17,7 @@
17 <xs:attribute name="dim" type="xs:int" /> 17 <xs:attribute name="dim" type="xs:int" />
18 <xs:attribute name="name" type="xs:string" /> 18 <xs:attribute name="name" type="xs:string" />
19 <xs:attribute name="units" type="xs:string" /> 19 <xs:attribute name="units" type="xs:string" />
  20 + <xs:attribute name="variable" type="xs:boolean" />
20 </xs:attributeGroup> 21 </xs:attributeGroup>
21 22
22 <xs:element name="boundsTable" substitutionGroup="TableDef"> 23 <xs:element name="boundsTable" substitutionGroup="TableDef">
src/ExternLib/GetMavenStaticEnergy/AMDAPlugin.cc 0 โ†’ 100644
@@ -0,0 +1,81 @@ @@ -0,0 +1,81 @@
  1 +/* -*- Base: 10 ; Mode: C++ -*- */
  2 +/*------------------------------------------------------------------------
  3 + **
  4 + FOST project
  5 + **
  6 +--------------------------------------------------------------------------
  7 +--------------------------------------------------------------------------
  8 + FILE LOG
  9 + $Revision: 1.3 $ $Date: 2012-06-15 13:04:42 $
  10 +--------------------------------------------------------------------------
  11 +CREATION
  12 + V.SAC
  13 +
  14 +SUMMARY
  15 +
  16 +DESCRIPTION
  17 +
  18 + The main function performs the following actions :
  19 + <ul>
  20 + <li>
  21 + </ul>
  22 +
  23 +------------------------------------------------------------------------*/
  24 +
  25 +//=============================================================================
  26 +//
  27 +// History of code
  28 +//
  29 +// creation
  30 +//
  31 +// modification
  32 +//=============================================================================
  33 +
  34 +/**
  35 +
  36 +*/
  37 +//=============================================================================
  38 +// Include section
  39 +//=============================================================================
  40 +
  41 +// Standard libraries include files
  42 +//-----------------------------------------------------------------------------
  43 +#include <iostream>
  44 +
  45 +// Include oriented definitions
  46 +//-----------------------------------------------------------------------------
  47 +
  48 +// Module Kernel include files
  49 +//-----------------------------------------------------------------------------
  50 +
  51 +#include "GetMavenStaticEnergyProcess.hh"
  52 +#include "ServicesServer.hh"
  53 +#include "PluginManager.hh"
  54 +
  55 +using namespace AMDA::Parameters;
  56 +
  57 +// Other modules include files
  58 +//-----------------------------------------------------------------------------
  59 +
  60 +//=============================================================================
  61 +// Methods of Class AMDAPlugin
  62 +//=============================================================================
  63 +
  64 +
  65 +
  66 +/**
  67 + Retrieve the Plugin version we're going to expect
  68 +*/
  69 +extern "C" const char* getPluginVersion()
  70 +{
  71 + return "(Version)";
  72 +}
  73 +
  74 +/**
  75 + Tells us to register our functionality to an engine kernel
  76 +*/
  77 +extern "C" void registerPlugin(AMDA::Plugins::PluginManager & /*pm*/)
  78 +{
  79 + ProcessFactory factProcessGetMavenStaticEnergy = boost::factory<AMDA::MavenStatic::GetMavenStaticEnergyProcess*>();
  80 + ServicesServer::getInstance()->addProcessFactory("getMavenStaticEnergy", factProcessGetMavenStaticEnergy);
  81 +}
src/ExternLib/GetMavenStaticEnergy/CMakeLists.txt 0 โ†’ 100644
@@ -0,0 +1,33 @@ @@ -0,0 +1,33 @@
  1 +
  2 +PROJECT(GetMavenStaticEnergy)
  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 + ${LOG4CXX_INCLUDE_DIR}
  14 + ${Boost_INCLUDE_DIR}
  15 +)
  16 +
  17 +#Library configuration
  18 +file(
  19 + GLOB_RECURSE
  20 + source_files
  21 + ./*
  22 +)
  23 +
  24 +ADD_LIBRARY( GetMavenStaticEnergy SHARED ${source_files} )
  25 +
  26 +
  27 +target_link_libraries(
  28 + GetMavenStaticEnergy
  29 + ${LOG4CXX_LIBRARIES}
  30 + Parameters
  31 + InternLib
  32 + TimeTableCatalog
  33 +)
0 \ No newline at end of file 34 \ No newline at end of file
src/ExternLib/GetMavenStaticEnergy/GetMavenStaticEnergy.hh 0 โ†’ 100644
@@ -0,0 +1,133 @@ @@ -0,0 +1,133 @@
  1 +/*
  2 + * GetMavenStaticEnergy.hh
  3 + *
  4 + * Created on: Sep 23, 2015
  5 + * Author: AKKA
  6 + */
  7 +
  8 +#ifndef GetMavenStaticEnergy_HH_
  9 +#define GetMavenStaticEnergy_HH_
  10 +
  11 +#include "vector"
  12 +
  13 +#include <boost/algorithm/string.hpp>
  14 +
  15 +#include "AMDA_exception.hh"
  16 +#include "DicError.hh"
  17 +
  18 +#include "Parameter.hh"
  19 +#include "ParamData.hh"
  20 +#include "Operation.hh"
  21 +
  22 +using namespace std;
  23 +using namespace boost;
  24 +using namespace AMDA::Parameters;
  25 +
  26 +namespace AMDA {
  27 +namespace MavenStatic {
  28 +
  29 +namespace Base {
  30 +/**
  31 + * @class Base::GetMavenStaticEnergy
  32 + * @brief Compute Maven STATIC energy
  33 + */
  34 + class GetMavenStaticEnergy : public Operation {
  35 + public:
  36 +
  37 + /**
  38 + * @brief Default Constructor.
  39 + */
  40 + GetMavenStaticEnergy(Process& pProcess) : Operation(pProcess) {}
  41 +
  42 + /**
  43 + * @brief Destructor.
  44 + */
  45 + virtual ~GetMavenStaticEnergy() {}
  46 +
  47 + /**
  48 + * @brief initialize the operation .
  49 + * @detail initialize the operation with information stored in pInput.getInfoList() and pAttribute.
  50 + */
  51 + virtual void init(Parameter& input, Process::AttributeList& pAttribute) = 0;
  52 +
  53 + protected:
  54 + };
  55 + }
  56 +
  57 +
  58 +/**
  59 + * @class GetMavenStaticEnergy
  60 + * @brief Compute Maven STATIC energy.
  61 + */
  62 +template<class TParamData>
  63 +class GetMavenStaticEnergy : public Base::GetMavenStaticEnergy {
  64 +public:
  65 + /**
  66 + * @brief Constructor.
  67 + * @details Create the ParamData type of the input ParamData.
  68 + */
  69 + GetMavenStaticEnergy(Process& pProcess, TParamData& paramInput)
  70 + : Base::GetMavenStaticEnergy(pProcess), _paramInput(paramInput), _paramOutput(new ParamDataTab1DDouble()) {
  71 + _paramDataOutput=_paramOutput;
  72 + }
  73 +
  74 + /**
  75 + *
  76 + * @overload Base::GetMavenStaticEnergy::init()
  77 + */
  78 + void init(Parameter& pInput, Process::AttributeList& /* pAttribute */) {
  79 + Parameter::InfoList& lInfoList = pInput.getInfoList();
  80 +
  81 + int nbMass = (*lInfoList["nmass"].get())[0];
  82 + int nbSweep = (*lInfoList["nswp"].get())[0];
  83 + int nbEnergy = (*lInfoList["nenergy"].get())[0];
  84 +
  85 + for (int i = 0; i < nbSweep; ++i)
  86 + {
  87 + for (int j = 0; j < nbMass; ++j)
  88 + {
  89 + for (int k = 0; k < nbEnergy; ++k)
  90 + {
  91 + std::string infoKey = "energy_";
  92 + infoKey += std::to_string(j * nbEnergy + k);
  93 + _energyList[i].push_back((*lInfoList[infoKey].get())[i]);
  94 + }
  95 + }
  96 + }
  97 + }
  98 +
  99 + /**
  100 + * @overload Operation::write(ParamDataIndexInfo &pParamDataIndexInfo)
  101 + */
  102 + void write(ParamDataIndexInfo &pParamDataIndexInfo) {
  103 + unsigned int index = pParamDataIndexInfo._startIndex;
  104 + for (; index< pParamDataIndexInfo._startIndex + pParamDataIndexInfo._nbDataToProcess; index++) {
  105 + _paramOutput->pushTime(_paramInput.getTime(index));
  106 + _paramOutput->getDataList().push_back((_energyList[(int)floor(_paramInput.getDataList()[index])]));
  107 + }
  108 + }
  109 +
  110 +private:
  111 + /**
  112 + * @brief It is the channel of calibration.
  113 + */
  114 + TParamData &_paramInput;
  115 +
  116 + /**
  117 + * @brief It is the channel of the data shifted.
  118 + */
  119 + ParamDataTab1DDouble *_paramOutput;
  120 +
  121 +
  122 + /**
  123 + * @brief map of calibrationInfo.
  124 + * @detail for expression #getClbInfo($ETableN;0:ImaEner_0;1:ImaEner_1)
  125 + * the key of map is 0 respectively 1
  126 + * the value of map is the value of attributes ImaEner[0] respectively and ImaEner[0]
  127 + */
  128 + std::map<unsigned int , std::vector<double>> _energyList;
  129 +};
  130 +
  131 +} /* namespace MavenStatic */
  132 +} /* namespace AMDA */
  133 +#endif /* GetMavenStaticEnergy_HH_ */
src/ExternLib/GetMavenStaticEnergy/GetMavenStaticEnergyCreator.hh 0 โ†’ 100644
@@ -0,0 +1,163 @@ @@ -0,0 +1,163 @@
  1 +/*
  2 + * GetMavenStaticEnergyCreator.hh
  3 + *
  4 + * Created on: Sep 23, 2015
  5 + * Author: AKKA
  6 + */
  7 +
  8 +#ifndef GetMavenStaticEnergyCreator_HH_
  9 +#define GetMavenStaticEnergyCreator_HH_
  10 +
  11 +#include "DicError.hh"
  12 +#include "AMDA_exception.hh"
  13 +
  14 +#include "ParamData.hh"
  15 +#include "VisitorOfParamData.hh"
  16 +#include "GetMavenStaticEnergy.hh"
  17 +
  18 +namespace AMDA {
  19 +namespace MavenStatic {
  20 +
  21 +/**
  22 + * @class GetMavenStaticEnergyCreator
  23 + * @brief Creator of the Operation GetMavenStaticEnergy parameterized with ParamData input type.
  24 + * @details Implement the interface VisitorOfParamData.
  25 + */
  26 +class GetMavenStaticEnergyCreator : public VisitorOfParamData {
  27 +public:
  28 + /**
  29 + * @brief Constructor.
  30 + */
  31 + GetMavenStaticEnergyCreator(Process& pProcess, ParamData& paramInput)
  32 + : _process(pProcess), _paramData(paramInput), _operation(NULL) {
  33 +
  34 + _paramData.accept(*this);
  35 + }
  36 +
  37 + /**
  38 + * @overload VisitorOfParamData::visit(ParamDataScalaireShort *)
  39 + */
  40 + void visit(ParamDataScalaireShort *) {_operation = new GetMavenStaticEnergy<ParamDataScalaireShort>( _process, dynamic_cast<ParamDataScalaireShort &>(_paramData));}
  41 +
  42 + /**
  43 + * @overload VisitorOfParamData::visit(ParamDataScalaireFloat *)
  44 + */
  45 + void visit(ParamDataScalaireFloat *) { BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("GetClbInfoCreator operation not supported")); }
  46 +
  47 + /**
  48 + * @overload VisitorOfParamData::visit(ParamDataScalaireDouble *)
  49 + */
  50 + void visit(ParamDataScalaireDouble *) { BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("GetClbInfoCreator operation not supported")); }
  51 +
  52 + /**
  53 + * @overload VisitorOfParamData::visit(ParamDataScalaireLongDouble *)
  54 + */
  55 + void visit(ParamDataScalaireLongDouble *) { BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("GetClbInfoCreator operation not supported")); }
  56 +
  57 + /**
  58 + * @overload VisitorOfParamData::visit(ParamDataScalaireInt *)
  59 + */
  60 + void visit(ParamDataScalaireInt *) { BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("GetClbInfoCreator operation not supported")); }
  61 +
  62 + /**
  63 + * @overload VisitorOfParamData::visit(ParamDataLogicalData *)
  64 + */
  65 + void visit(ParamDataLogicalData *) { BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("GetClbInfoCreator operation not supported")); }
  66 +
  67 + /**
  68 + * @overload VisitorOfParamData::visit(ParamDataTab1DShort *)
  69 + */
  70 + void visit(ParamDataTab1DShort *) { BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("GetClbInfoCreator operation not supported")); }
  71 +
  72 + /**
  73 + * @overload VisitorOfParamData::visit(ParamDataTab1DFloat *)
  74 + */
  75 + void visit(ParamDataTab1DFloat *) { BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("GetClbInfoCreator operation not supported")); }
  76 +
  77 + /**
  78 + * @overload VisitorOfParamData::visit(ParamDataTab1DDouble *)
  79 + */
  80 + void visit(ParamDataTab1DDouble *) { BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("GetClbInfoCreator operation not supported")); }
  81 +
  82 + /**
  83 + * @overload VisitorOfParamData::visit(ParamDataTab1DLongDouble *)
  84 + */
  85 + void visit(ParamDataTab1DLongDouble *) { BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("GetClbInfoCreator operation not supported")); }
  86 +
  87 + /**
  88 + * @overload VisitorOfParamData::visit(ParamDataTab1DInt *)
  89 + */
  90 + void visit(ParamDataTab1DInt *) { BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("GetClbInfoCreator operation not supported")); }
  91 +
  92 + /**
  93 + * @overload VisitorOfParamData::visit(ParamDataTab1DLogicalData *)
  94 + */
  95 + void visit(ParamDataTab1DLogicalData *) { BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("GetClbInfoCreator operation not supported")); }
  96 +
  97 + /**
  98 + * @overload VisitorOfParamData::visit(ParamDataTab2DShort *)
  99 + */
  100 + void visit(ParamDataTab2DShort *) {
  101 + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("ParamDataTab2DShort data not supported"));
  102 + }
  103 +
  104 + /**
  105 + * @overload VisitorOfParamData::visit(ParamDataTab2DFloat *)
  106 + */
  107 + void visit(ParamDataTab2DFloat *) {
  108 + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("ParamDataTab2DFloat data not supported"));
  109 + }
  110 +
  111 + /**
  112 + * @overload VisitorOfParamData::visit(ParamDataTab2DDouble *)
  113 + */
  114 + void visit(ParamDataTab2DDouble *) {
  115 + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("ParamDataTab2DDouble data not supported"));
  116 + }
  117 +
  118 + /**
  119 + * @overload VisitorOfParamData::visit(ParamDataTab2DLongDouble *)
  120 + */
  121 + void visit(ParamDataTab2DLongDouble *) {
  122 + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("ParamDataTab2DLongDouble data not supported"));
  123 + }
  124 +
  125 + /**
  126 + * @overload VisitorOfParamData::visit(ParamDataTab2DInt *)
  127 + */
  128 + void visit(ParamDataTab2DInt *) {
  129 + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("ParamDataTab2DInt data not supported"));
  130 + }
  131 +
  132 + /**
  133 + * @overload VisitorOfParamData::visit(ParamDataTab2DLogicalData *)
  134 + */
  135 + void visit(ParamDataTab2DLogicalData *) {
  136 + BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_ERROR_UNKNOWN) << AMDA::ex_msg("ParamDataTab2DLogicalData data not supported"));
  137 + }
  138 +
  139 + /**
  140 + * @brief get the GetClbInfo parameterized operation.
  141 + */
  142 + Operation * getOperation() const { return _operation; }
  143 +
  144 +private:
  145 + /**
  146 + * @brief a reference on the process of Calibration
  147 + */
  148 + Process &_process;
  149 +
  150 + /**
  151 + * @brief the input paramData
  152 + */
  153 + ParamData &_paramData;
  154 +
  155 + /**
  156 + * @brief the operation which is created
  157 + */
  158 + Operation *_operation;
  159 +};
  160 +
  161 +} /* namespace MavenStatic */
  162 +} /* namespace AMDA */
  163 +#endif /* GetMavenStaticEnergyCreator_HH_ */
src/ExternLib/GetMavenStaticEnergy/GetMavenStaticEnergyProcess.cc 0 โ†’ 100644
@@ -0,0 +1,51 @@ @@ -0,0 +1,51 @@
  1 +/*
  2 + * GetMavenStaticEnergyProcess.cc
  3 + *
  4 + * Created on: Sep 23, 2015
  5 + * Author: AKKA
  6 + */
  7 +#include <stdlib.h>
  8 +#include <string>
  9 +
  10 +#include "AMDA_exception.hh"
  11 +#include "DicError.hh"
  12 +
  13 +#include "Operation.hh"
  14 +#include "ParameterManager.hh"
  15 +#include "GetMavenStaticEnergyProcess.hh"
  16 +#include "GetMavenStaticEnergyCreator.hh"
  17 +#include "ParameterCreatorFromExpression.hh"
  18 +
  19 +using namespace std;
  20 +using namespace boost;
  21 +using namespace log4cxx;
  22 +
  23 +namespace AMDA {
  24 +namespace MavenStatic {
  25 +
  26 +GetMavenStaticEnergyProcess::GetMavenStaticEnergyProcess(Parameter &parameter)
  27 + : SingleParamProcess_CRTP(parameter) {
  28 + }
  29 +
  30 +GetMavenStaticEnergyProcess::GetMavenStaticEnergyProcess(const GetMavenStaticEnergyProcess& pProcess, Parameter &parameter)
  31 + : SingleParamProcess_CRTP(pProcess,parameter) {
  32 + }
  33 +
  34 +GetMavenStaticEnergyProcess::~GetMavenStaticEnergyProcess() {
  35 + }
  36 +
  37 +TimeStamp GetMavenStaticEnergyProcess::init() {
  38 + TimeStamp timeStamp = _parameterInput->init( this, _timeIntervalList);
  39 + Parameter::InfoList lInfoList = _parameterInput->getInfoList();
  40 + _parameter.getInfoList().insert(lInfoList.begin(), lInfoList.end());
  41 + _paramInput = _parameterInput->getParamData(this).get();
  42 + GetMavenStaticEnergyCreator lGetMavenStaticEnergyCreator(*this,*_paramInput);
  43 + _operation = lGetMavenStaticEnergyCreator.getOperation();
  44 + dynamic_cast<Base::GetMavenStaticEnergy*>(_operation)->init(*_parameterInput,_attributList);
  45 + _paramData = ParamDataSPtr(_operation->getParamOutput());
  46 + _paramData->setMinSampling(_paramInput->getMinSampling());
  47 + return timeStamp;
  48 +}
  49 +
  50 +} /* namespace MavenStatic */
  51 +} /* namespace AMDA */
src/ExternLib/GetMavenStaticEnergy/GetMavenStaticEnergyProcess.hh 0 โ†’ 100644
@@ -0,0 +1,44 @@ @@ -0,0 +1,44 @@
  1 +/*
  2 + * GetMavenStaticEnergyProcess.hh
  3 + *
  4 + * Created on: Sep 23, 2015
  5 + * Author: AKKA
  6 + */
  7 +
  8 +#ifndef GetMavenStaticEnergyProcess_HH_
  9 +#define GetMavenStaticEnergyProcess_HH_
  10 +
  11 +#include "SingleParamProcess.hh"
  12 +
  13 +namespace AMDA {
  14 +namespace MavenStatic {
  15 +
  16 + /**
  17 + * @class GetMavenStaticEnergyProcess
  18 + * @brief Return the energy table got Maven STATIC.
  19 + */
  20 + class GetMavenStaticEnergyProcess : public AMDA::Parameters::SingleParamProcess_CRTP<GetMavenStaticEnergyProcess> {
  21 + public:
  22 + /**
  23 + * @brief Constructor.
  24 + */
  25 + GetMavenStaticEnergyProcess(AMDA::Parameters::Parameter &parameter);
  26 + /**
  27 + * @brief Copy Constructor.
  28 + */
  29 + GetMavenStaticEnergyProcess(const GetMavenStaticEnergyProcess& pProcess, AMDA::Parameters::Parameter &pParameter) ;
  30 + /**
  31 + * @brief Destructor.
  32 + */
  33 + ~GetMavenStaticEnergyProcess();
  34 +
  35 + // Overload Process methods
  36 + /**
  37 + * @overload Process::init()
  38 + */
  39 + AMDA::Parameters::TimeStamp init();
  40 + };
  41 +
  42 +} /* namespace MavenStatic */
  43 +} /* namespace AMDA */
  44 +#endif /* GetMavenStaticEnergyProcess_HH_ */
src/Info/ParamTable.cc
@@ -7,6 +7,7 @@ @@ -7,6 +7,7 @@
7 #include "ParamTable.hh" 7 #include "ParamTable.hh"
8 8
9 #include "Parameter.hh" 9 #include "Parameter.hh"
  10 +#include "ParamData.hh"
10 11
11 using namespace log4cxx; 12 using namespace log4cxx;
12 13
@@ -16,7 +17,7 @@ namespace Info { @@ -16,7 +17,7 @@ namespace Info {
16 LoggerPtr ParamTable::_logger(Logger::getLogger("AMDA-Kernel.ParamTable")); 17 LoggerPtr ParamTable::_logger(Logger::getLogger("AMDA-Kernel.ParamTable"));
17 18
18 ParamTable::ParamTable(const char *paramId) : _paramId(paramId), 19 ParamTable::ParamTable(const char *paramId) : _paramId(paramId),
19 - _tableName(""), _tableUnits("") 20 + _tableName(""), _tableUnits(""), _variable("false")
20 { 21 {
21 } 22 }
22 23
@@ -56,57 +57,121 @@ std::string ParamTable::getUnits(void) @@ -56,57 +57,121 @@ std::string ParamTable::getUnits(void)
56 return _tableUnits; 57 return _tableUnits;
57 } 58 }
58 59
59 -ParamBoundsTable::ParamBoundsTable(const char *paramId, const char *boundsName) :  
60 - ParamTable(paramId), _boundsName(boundsName) 60 +/*
  61 + * @brief Set isVariable attribute
  62 + */
  63 +void ParamTable::setIsVariable(bool isVariable)
61 { 64 {
  65 + _variable = isVariable;
62 } 66 }
63 67
64 /* 68 /*
65 - * @brief Get size of the table 69 + * @brief Get if it's a variable table
66 */ 70 */
67 -int ParamBoundsTable::getSize(ParameterManager *parameterManager) 71 +bool ParamTable::isVariable(void)
68 { 72 {
  73 + return _variable;
  74 +}
  75 +
  76 +void ParamTable::addTableParam(std::string key, std::string name)
  77 +{
  78 + _tableParams[key] = name;
  79 +}
  80 +
  81 +std::string ParamTable::getTableParamByKey(std::string key)
  82 +{
  83 + return _tableParams[key];
  84 +}
  85 +
  86 +std::map<std::string, std::string>& ParamTable::getTableParams()
  87 +{
  88 + return _tableParams;
  89 +}
  90 +
  91 +std::vector<double> ParamTable::getConstantTableParamValuesByKey(ParameterManager *parameterManager, std::string key)
  92 +{
  93 + std::vector<double> paramValues;
69 ParameterSPtr tmpParam = parameterManager->getParameter(_paramId); 94 ParameterSPtr tmpParam = parameterManager->getParameter(_paramId);
  95 + if (tmpParam == nullptr)
  96 + return paramValues;
70 AMDA::Parameters::Parameter::InfoList lInfoList = tmpParam->getInfoList(); 97 AMDA::Parameters::Parameter::InfoList lInfoList = tmpParam->getInfoList();
71 - AMDA::Parameters::Parameter::InfoValuesSPtr pTableInfo = lInfoList[_boundsName];  
72 - return pTableInfo->size() - 1; 98 + if (_tableParams.find(key) == _tableParams.end())
  99 + return paramValues;
  100 + std::string tableParamName = _tableParams[key];
  101 + if (lInfoList.find(tableParamName) == lInfoList.end())
  102 + return paramValues;
  103 + paramValues = *lInfoList[tableParamName].get();
  104 + return paramValues;
  105 +}
  106 +
  107 +std::vector<double> ParamTable::getVariableTableParamValuesByKey(std::map<std::string, std::vector<double>>* paramsTableData, std::string key)
  108 +{
  109 + std::vector<double> paramValues;
  110 + if (paramsTableData == NULL)
  111 + return paramValues;
  112 + if (paramsTableData->find(key) == paramsTableData->end())
  113 + return paramValues;
  114 + return (*paramsTableData)[key];
  115 +}
  116 +
  117 +std::vector<double> ParamTable::getTableParamValuesByKey(ParameterManager *parameterManager, std::map<std::string, std::vector<double>>* paramsTableData, std::string key)
  118 +{
  119 + if (_variable)
  120 + return getVariableTableParamValuesByKey(paramsTableData, key);
  121 + else
  122 + return getConstantTableParamValuesByKey(parameterManager, key);
  123 +}
  124 +
  125 +std::string ParamBoundsTable::_boundsParamKey = "TABLEPARAM_BOUNDS";
  126 +
  127 +ParamBoundsTable::ParamBoundsTable(const char *paramId) :
  128 + ParamTable(paramId)
  129 +{
73 } 130 }
74 131
75 /* 132 /*
76 - * @brief Get a bounds for a specified index 133 + * @brief Get size of the table
77 */ 134 */
78 -t_TableBound ParamBoundsTable::getBound(ParameterManager *parameterManager, unsigned int index) 135 +int ParamBoundsTable::getSize(ParameterManager *parameterManager)
79 { 136 {
80 - ParameterSPtr tmpParam = parameterManager->getParameter(_paramId); 137 + if (!_variable)
  138 + {
  139 + std::vector<double> boundsValues = getConstantTableParamValuesByKey(parameterManager, ParamBoundsTable::_boundsParamKey);
  140 + return boundsValues.size() - 1;
  141 + }
  142 + else
  143 + {
  144 + return 0;
  145 + }
  146 +}
81 147
  148 +/*
  149 + * @brief Get a bounds for a specified index
  150 + */
  151 +t_TableBound ParamBoundsTable::getBound(ParameterManager *parameterManager, unsigned int index, std::map<std::string, std::vector<double>>* paramsTableData)
  152 +{
82 t_TableBound bound; 153 t_TableBound bound;
83 bound.index = index; 154 bound.index = index;
84 - if (tmpParam == nullptr)  
85 - {  
86 - LOG4CXX_ERROR(_logger, "Associated parameter not reachable!");  
87 - bound.min = index;  
88 - bound.max = index+1;  
89 - return bound;  
90 - }  
91 155
92 - //get table info from parameter info list  
93 - AMDA::Parameters::Parameter::InfoList lInfoList = tmpParam->getInfoList();  
94 - AMDA::Parameters::Parameter::InfoValuesSPtr pTableInfo = lInfoList[_boundsName];  
95 - if (index >= pTableInfo->size() - 1) 156 + std::vector<double> boundsValues = getTableParamValuesByKey(parameterManager, paramsTableData, ParamBoundsTable::_boundsParamKey);
  157 +
  158 + if (index >= boundsValues.size() - 1)
96 { 159 {
97 LOG4CXX_ERROR(_logger, "Index " << index << " outside of table definition => Cannot get real bound" ); 160 LOG4CXX_ERROR(_logger, "Index " << index << " outside of table definition => Cannot get real bound" );
98 bound.min = index; 161 bound.min = index;
99 bound.max = index+1; 162 bound.max = index+1;
100 return bound; 163 return bound;
101 } 164 }
102 - bound.min = std::min((*pTableInfo)[index], (*pTableInfo)[index+1]);  
103 - bound.max = std::max((*pTableInfo)[index], (*pTableInfo)[index+1]); 165 + bound.min = std::min(boundsValues[index], boundsValues[index+1]);
  166 + bound.max = std::max(boundsValues[index], boundsValues[index+1]);
104 167
105 return bound; 168 return bound;
106 } 169 }
107 170
108 -ParamCenterTable::ParamCenterTable(const char *paramId, const char *centerName, double size) :  
109 - ParamTable(paramId), _centerName(centerName), _size(size) 171 +std::string ParamCenterTable::_centersParamKey = "TABLEPARAM_CENTERS";
  172 +
  173 +ParamCenterTable::ParamCenterTable(const char *paramId, double size) :
  174 + ParamTable(paramId), _size(size)
110 { 175 {
111 } 176 }
112 177
@@ -115,36 +180,28 @@ ParamCenterTable::ParamCenterTable(const char *paramId, const char *centerName, @@ -115,36 +180,28 @@ ParamCenterTable::ParamCenterTable(const char *paramId, const char *centerName,
115 */ 180 */
116 int ParamCenterTable::getSize(ParameterManager *parameterManager) 181 int ParamCenterTable::getSize(ParameterManager *parameterManager)
117 { 182 {
118 - ParameterSPtr tmpParam = parameterManager->getParameter(_paramId);  
119 - AMDA::Parameters::Parameter::InfoList lInfoList = tmpParam->getInfoList();  
120 - AMDA::Parameters::Parameter::InfoValuesSPtr pTableInfo = lInfoList[_centerName];  
121 - return pTableInfo->size(); 183 + if (!_variable)
  184 + {
  185 + std::vector<double> centersValues = getConstantTableParamValuesByKey(parameterManager, ParamCenterTable::_centersParamKey);
  186 + return centersValues.size();
  187 + }
  188 + else
  189 + {
  190 + return 0;
  191 + }
122 } 192 }
123 193
124 /* 194 /*
125 * @brief Get a bound for a specified index 195 * @brief Get a bound for a specified index
126 */ 196 */
127 -t_TableBound ParamCenterTable::getBound(ParameterManager *parameterManager, unsigned int index) 197 +t_TableBound ParamCenterTable::getBound(ParameterManager *parameterManager, unsigned int index, std::map<std::string, std::vector<double>>* paramsTableData)
128 { 198 {
129 - ParameterSPtr tmpParam = parameterManager->getParameter(_paramId);  
130 -  
131 t_TableBound bound; 199 t_TableBound bound;
132 bound.index = index; 200 bound.index = index;
133 201
134 - if (tmpParam == nullptr)  
135 - {  
136 - LOG4CXX_ERROR(_logger, "Associated parameter not reachable!");  
137 - bound.min = index;  
138 - bound.max = index+1;  
139 - return bound;  
140 - } 202 + std::vector<double> centersValues = getTableParamValuesByKey(parameterManager, paramsTableData, ParamCenterTable::_centersParamKey);
141 203
142 - //get table info from parameter info list  
143 -  
144 - AMDA::Parameters::Parameter::InfoList lInfoList = tmpParam->getInfoList();  
145 - AMDA::Parameters::Parameter::InfoValuesSPtr pTableInfo = lInfoList[_centerName];  
146 -  
147 - if (index >= pTableInfo->size()) 204 + if (index >= centersValues.size())
148 { 205 {
149 LOG4CXX_ERROR(_logger, "Index " << index << " outside of table definition => Cannot get real bound" ); 206 LOG4CXX_ERROR(_logger, "Index " << index << " outside of table definition => Cannot get real bound" );
150 bound.min = index; 207 bound.min = index;
@@ -152,14 +209,17 @@ t_TableBound ParamCenterTable::getBound(ParameterManager *parameterManager, unsi @@ -152,14 +209,17 @@ t_TableBound ParamCenterTable::getBound(ParameterManager *parameterManager, unsi
152 return bound; 209 return bound;
153 } 210 }
154 211
155 - bound.min = (*pTableInfo)[index] - _size/2.;  
156 - bound.max = (*pTableInfo)[index] + _size/2.;; 212 + bound.min = centersValues[index] - _size/2.;
  213 + bound.max = centersValues[index] + _size/2.;;
157 214
158 return bound; 215 return bound;
159 } 216 }
160 217
161 -ParamCenterWidthTable::ParamCenterWidthTable(const char *paramId, const char *centerName, const char *widthName) :  
162 - ParamTable(paramId), _centerName(centerName), _widthName(widthName) 218 +std::string ParamCenterWidthTable::_centersParamKey = "TABLEPARAM_CENTERS";
  219 +std::string ParamCenterWidthTable::_widthsParamKey = "TABLEPARAM_WIDTHS";
  220 +
  221 +ParamCenterWidthTable::ParamCenterWidthTable(const char *paramId) :
  222 + ParamTable(paramId)
163 { 223 {
164 } 224 }
165 225
@@ -168,37 +228,29 @@ ParamCenterWidthTable::ParamCenterWidthTable(const char *paramId, const char *ce @@ -168,37 +228,29 @@ ParamCenterWidthTable::ParamCenterWidthTable(const char *paramId, const char *ce
168 */ 228 */
169 int ParamCenterWidthTable::getSize(ParameterManager *parameterManager) 229 int ParamCenterWidthTable::getSize(ParameterManager *parameterManager)
170 { 230 {
171 - ParameterSPtr tmpParam = parameterManager->getParameter(_paramId);  
172 - AMDA::Parameters::Parameter::InfoList lInfoList = tmpParam->getInfoList();  
173 - AMDA::Parameters::Parameter::InfoValuesSPtr pTableInfo = lInfoList[_centerName];  
174 - return pTableInfo->size(); 231 + if (!_variable)
  232 + {
  233 + std::vector<double> centersValues = getConstantTableParamValuesByKey(parameterManager, ParamCenterWidthTable::_centersParamKey);
  234 + return centersValues.size();
  235 + }
  236 + else
  237 + {
  238 + return 0;
  239 + }
175 } 240 }
176 241
177 /* 242 /*
178 * @brief Get a bound for a specified index 243 * @brief Get a bound for a specified index
179 */ 244 */
180 -t_TableBound ParamCenterWidthTable::getBound(ParameterManager *parameterManager, unsigned int index) 245 +t_TableBound ParamCenterWidthTable::getBound(ParameterManager *parameterManager, unsigned int index, std::map<std::string, std::vector<double>>* paramsTableData)
181 { 246 {
182 - ParameterSPtr tmpParam = parameterManager->getParameter(_paramId);  
183 -  
184 t_TableBound bound; 247 t_TableBound bound;
185 bound.index = index; 248 bound.index = index;
186 249
187 - if (tmpParam == nullptr)  
188 - {  
189 - LOG4CXX_ERROR(_logger, "Associated parameter not reachable!");  
190 - bound.min = index;  
191 - bound.max = index+1;  
192 - return bound;  
193 - }  
194 -  
195 - //get table info from parameter info list  
196 -  
197 - AMDA::Parameters::Parameter::InfoList lInfoList = tmpParam->getInfoList();  
198 - AMDA::Parameters::Parameter::InfoValuesSPtr pTableInfo = lInfoList[_centerName];  
199 - AMDA::Parameters::Parameter::InfoValuesSPtr pWidthInfo = lInfoList[_widthName]; 250 + std::vector<double> centersValues = getTableParamValuesByKey(parameterManager, paramsTableData, ParamCenterWidthTable::_centersParamKey);
  251 + std::vector<double> widthsValues = getTableParamValuesByKey(parameterManager, paramsTableData, ParamCenterWidthTable::_centersParamKey);
200 252
201 - if ((index >= pTableInfo->size()) || (index >= pWidthInfo->size())) 253 + if ((index >= centersValues.size()) || (index >= widthsValues.size()))
202 { 254 {
203 LOG4CXX_ERROR(_logger, "Index " << index << " outside of table definition => Cannot get real bound" ); 255 LOG4CXX_ERROR(_logger, "Index " << index << " outside of table definition => Cannot get real bound" );
204 bound.min = index; 256 bound.min = index;
@@ -206,14 +258,16 @@ t_TableBound ParamCenterWidthTable::getBound(ParameterManager *parameterManager, @@ -206,14 +258,16 @@ t_TableBound ParamCenterWidthTable::getBound(ParameterManager *parameterManager,
206 return bound; 258 return bound;
207 } 259 }
208 260
209 - bound.min = (*pTableInfo)[index] - (*pWidthInfo)[index]/2.;  
210 - bound.max = (*pTableInfo)[index] + (*pWidthInfo)[index]/2.;; 261 + bound.min = centersValues[index] - widthsValues[index]/2.;
  262 + bound.max = centersValues[index] + widthsValues[index]/2.;;
211 263
212 return bound; 264 return bound;
213 } 265 }
214 266
215 -ParamCenterAutoTable::ParamCenterAutoTable(const char *paramId, const char *centerName, bool log) :  
216 - ParamTable(paramId), _centerName(centerName), _log(log) 267 +std::string ParamCenterAutoTable::_centersParamKey = "TABLEPARAM_CENTERS";
  268 +
  269 +ParamCenterAutoTable::ParamCenterAutoTable(const char *paramId, bool log) :
  270 + ParamTable(paramId), _log(log)
217 { 271 {
218 } 272 }
219 273
@@ -222,36 +276,28 @@ ParamCenterAutoTable::ParamCenterAutoTable(const char *paramId, const char *cent @@ -222,36 +276,28 @@ ParamCenterAutoTable::ParamCenterAutoTable(const char *paramId, const char *cent
222 */ 276 */
223 int ParamCenterAutoTable::getSize(ParameterManager *parameterManager) 277 int ParamCenterAutoTable::getSize(ParameterManager *parameterManager)
224 { 278 {
225 - ParameterSPtr tmpParam = parameterManager->getParameter(_paramId);  
226 - AMDA::Parameters::Parameter::InfoList lInfoList = tmpParam->getInfoList();  
227 - AMDA::Parameters::Parameter::InfoValuesSPtr pTableInfo = lInfoList[_centerName];  
228 - return pTableInfo->size(); 279 + if (!_variable)
  280 + {
  281 + std::vector<double> centersValues = getConstantTableParamValuesByKey(parameterManager, ParamCenterAutoTable::_centersParamKey);
  282 + return centersValues.size();
  283 + }
  284 + else
  285 + {
  286 + return 0;
  287 + }
229 } 288 }
230 289
231 /* 290 /*
232 * @brief Get a bound for a specified index 291 * @brief Get a bound for a specified index
233 */ 292 */
234 -t_TableBound ParamCenterAutoTable::getBound(ParameterManager *parameterManager, unsigned int index) 293 +t_TableBound ParamCenterAutoTable::getBound(ParameterManager *parameterManager, unsigned int index, std::map<std::string, std::vector<double>>* paramsTableData)
235 { 294 {
236 - ParameterSPtr tmpParam = parameterManager->getParameter(_paramId);  
237 -  
238 t_TableBound bound; 295 t_TableBound bound;
239 bound.index = index; 296 bound.index = index;
240 297
241 - if (tmpParam == nullptr)  
242 - {  
243 - LOG4CXX_ERROR(_logger, "Associated parameter not reachable!");  
244 - bound.min = index;  
245 - bound.max = index+1;  
246 - return bound;  
247 - }  
248 -  
249 - //get table info from parameter info list  
250 -  
251 - AMDA::Parameters::Parameter::InfoList lInfoList = tmpParam->getInfoList();  
252 - AMDA::Parameters::Parameter::InfoValuesSPtr pTableInfo = lInfoList[_centerName]; 298 + std::vector<double> centersValues = getTableParamValuesByKey(parameterManager, paramsTableData, ParamCenterAutoTable::_centersParamKey);
253 299
254 - if (index >= pTableInfo->size()) 300 + if (index >= centersValues.size())
255 { 301 {
256 LOG4CXX_ERROR(_logger, "Index " << index << " outside of table definition => Cannot get real bound" ); 302 LOG4CXX_ERROR(_logger, "Index " << index << " outside of table definition => Cannot get real bound" );
257 bound.min = index; 303 bound.min = index;
@@ -261,7 +307,7 @@ t_TableBound ParamCenterAutoTable::getBound(ParameterManager *parameterManager, @@ -261,7 +307,7 @@ t_TableBound ParamCenterAutoTable::getBound(ParameterManager *parameterManager,
261 307
262 //Compute bounds 308 //Compute bounds
263 309
264 - if (pTableInfo->size() <= 1) 310 + if (centersValues.size() <= 1)
265 { 311 {
266 LOG4CXX_ERROR(_logger, "Table dimension too small to compute bound" ); 312 LOG4CXX_ERROR(_logger, "Table dimension too small to compute bound" );
267 bound.min = index; 313 bound.min = index;
@@ -275,17 +321,17 @@ t_TableBound ParamCenterAutoTable::getBound(ParameterManager *parameterManager, @@ -275,17 +321,17 @@ t_TableBound ParamCenterAutoTable::getBound(ParameterManager *parameterManager,
275 if (index == 0) 321 if (index == 0)
276 { 322 {
277 if (_log) 323 if (_log)
278 - plus = exp((log10((*pTableInfo)[1]) - log10((*pTableInfo)[0]))/2.); 324 + plus = (log10(centersValues[1]) - log10(centersValues[0]))/2.;
279 else 325 else
280 - plus = ((*pTableInfo)[1] - (*pTableInfo)[0])/2.; 326 + plus = (centersValues[1] - centersValues[0])/2.;
281 minus = plus; 327 minus = plus;
282 } 328 }
283 - else if (index == pTableInfo->size() - 1) 329 + else if (index == centersValues.size() - 1)
284 { 330 {
285 if (_log) 331 if (_log)
286 - minus = exp((log10((*pTableInfo)[pTableInfo->size() - 1]) - log10((*pTableInfo)[pTableInfo->size() - 2]))/2.); 332 + minus = (log10(centersValues[centersValues.size() - 1]) - log10(centersValues[centersValues.size() - 2]))/2.;
287 else 333 else
288 - minus = ((*pTableInfo)[pTableInfo->size() - 1] - (*pTableInfo)[pTableInfo->size() - 2])/2.; 334 + minus = (centersValues[centersValues.size() - 1] - centersValues[centersValues.size() - 2])/2.;
289 plus = minus; 335 plus = minus;
290 336
291 } 337 }
@@ -293,18 +339,26 @@ t_TableBound ParamCenterAutoTable::getBound(ParameterManager *parameterManager, @@ -293,18 +339,26 @@ t_TableBound ParamCenterAutoTable::getBound(ParameterManager *parameterManager,
293 { 339 {
294 if (_log) 340 if (_log)
295 { 341 {
296 - minus = exp((log10((*pTableInfo)[index]) - log10((*pTableInfo)[index-1]))/2.);  
297 - plus = exp((log10((*pTableInfo)[index+1]) - log10((*pTableInfo)[index]))/2.); 342 + minus = (log10(centersValues[index]) - log10(centersValues[index-1]))/2.;
  343 + plus = (log10(centersValues[index+1]) - log10(centersValues[index]))/2.;
298 } 344 }
299 else 345 else
300 { 346 {
301 - minus = ((*pTableInfo)[index] - (*pTableInfo)[index-1])/2.;  
302 - plus = ((*pTableInfo)[index+1] - (*pTableInfo)[index])/2.; 347 + minus = (centersValues[index] - centersValues[index-1])/2.;
  348 + plus = (centersValues[index+1] - centersValues[index])/2.;
303 } 349 }
304 } 350 }
305 351
306 - bound.min = (*pTableInfo)[index] - minus;  
307 - bound.max = (*pTableInfo)[index] + plus; 352 + if (_log)
  353 + {
  354 + bound.min = exp(log10(centersValues[index]) - minus);
  355 + bound.max = exp(log10(centersValues[index]) + plus);
  356 + }
  357 + else
  358 + {
  359 + bound.min = centersValues[index] - minus;
  360 + bound.max = centersValues[index] + plus;
  361 + }
308 362
309 if (bound.min > bound.max) 363 if (bound.min > bound.max)
310 { 364 {
@@ -316,8 +370,10 @@ t_TableBound ParamCenterAutoTable::getBound(ParameterManager *parameterManager, @@ -316,8 +370,10 @@ t_TableBound ParamCenterAutoTable::getBound(ParameterManager *parameterManager,
316 return bound; 370 return bound;
317 } 371 }
318 372
319 -ParamMinMaxTable::ParamMinMaxTable(const char *paramId, const char *minName, const char *maxName) :  
320 - ParamTable(paramId), _minName(minName), _maxName(maxName) 373 +std::string ParamMinMaxTable::_minParamKey = "TABLEPARAM_MIN";
  374 +std::string ParamMinMaxTable::_maxParamKey = "TABLEPARAM_MAX";
  375 +
  376 +ParamMinMaxTable::ParamMinMaxTable(const char *paramId) : ParamTable(paramId)
321 { 377 {
322 } 378 }
323 379
@@ -326,37 +382,29 @@ ParamMinMaxTable::ParamMinMaxTable(const char *paramId, const char *minName, con @@ -326,37 +382,29 @@ ParamMinMaxTable::ParamMinMaxTable(const char *paramId, const char *minName, con
326 */ 382 */
327 int ParamMinMaxTable::getSize(ParameterManager *parameterManager) 383 int ParamMinMaxTable::getSize(ParameterManager *parameterManager)
328 { 384 {
329 - ParameterSPtr tmpParam = parameterManager->getParameter(_paramId);  
330 - AMDA::Parameters::Parameter::InfoList lInfoList = tmpParam->getInfoList();  
331 - AMDA::Parameters::Parameter::InfoValuesSPtr pTableMinInfo = lInfoList[_minName];  
332 - return pTableMinInfo->size(); 385 + if (!_variable)
  386 + {
  387 + std::vector<double> minValues = getConstantTableParamValuesByKey(parameterManager, ParamMinMaxTable::_minParamKey);
  388 + return minValues.size();
  389 + }
  390 + else
  391 + {
  392 + return 0;
  393 + }
333 } 394 }
334 395
335 /* 396 /*
336 * @brief Get bound for a specified index 397 * @brief Get bound for a specified index
337 */ 398 */
338 -t_TableBound ParamMinMaxTable::getBound(ParameterManager *parameterManager, unsigned int index) 399 +t_TableBound ParamMinMaxTable::getBound(ParameterManager *parameterManager, unsigned int index, std::map<std::string, std::vector<double>>* paramsTableData)
339 { 400 {
340 - ParameterSPtr tmpParam = parameterManager->getParameter(_paramId);  
341 -  
342 t_TableBound bound; 401 t_TableBound bound;
343 bound.index = index; 402 bound.index = index;
344 403
345 - if (tmpParam == nullptr)  
346 - {  
347 - LOG4CXX_ERROR(_logger, "Associated parameter not reachable!");  
348 - bound.min = index;  
349 - bound.max = index+1;  
350 - return bound;  
351 - }  
352 -  
353 - //get table info from parameter info list  
354 -  
355 - AMDA::Parameters::Parameter::InfoList lInfoList = tmpParam->getInfoList();  
356 - AMDA::Parameters::Parameter::InfoValuesSPtr pTableMinInfo = lInfoList[_minName];  
357 - AMDA::Parameters::Parameter::InfoValuesSPtr pTableMaxInfo = lInfoList[_maxName]; 404 + std::vector<double> minValues = getTableParamValuesByKey(parameterManager, paramsTableData, ParamMinMaxTable::_minParamKey);
  405 + std::vector<double> maxValues = getTableParamValuesByKey(parameterManager, paramsTableData, ParamMinMaxTable::_maxParamKey);
358 406
359 - if ((index >= pTableMinInfo->size()) || (index >= pTableMaxInfo->size())) 407 + if ((index >= minValues.size()) || (index >= maxValues.size()))
360 { 408 {
361 LOG4CXX_ERROR(_logger, "Index " << index << " outside of table definition => Cannot get real bound" ); 409 LOG4CXX_ERROR(_logger, "Index " << index << " outside of table definition => Cannot get real bound" );
362 bound.min = index; 410 bound.min = index;
@@ -364,8 +412,8 @@ t_TableBound ParamMinMaxTable::getBound(ParameterManager *parameterManager, unsi @@ -364,8 +412,8 @@ t_TableBound ParamMinMaxTable::getBound(ParameterManager *parameterManager, unsi
364 return bound; 412 return bound;
365 } 413 }
366 414
367 - bound.min = std::min((*pTableMinInfo)[index], (*pTableMaxInfo)[index]);  
368 - bound.max = std::max((*pTableMinInfo)[index], (*pTableMaxInfo)[index]); 415 + bound.min = std::min(minValues[index], maxValues[index]);
  416 + bound.max = std::max(minValues[index], maxValues[index]);
369 417
370 return bound; 418 return bound;
371 } 419 }
src/Info/ParamTable.hh
@@ -40,7 +40,7 @@ namespace Info { @@ -40,7 +40,7 @@ namespace Info {
40 40
41 virtual int getSize(ParameterManager *parameterManager) = 0; 41 virtual int getSize(ParameterManager *parameterManager) = 0;
42 42
43 - virtual t_TableBound getBound(ParameterManager *parameterManager, unsigned int index) = 0; 43 + virtual t_TableBound getBound(ParameterManager *parameterManager, unsigned int index, std::map<std::string, std::vector<double>>* paramsTableData = NULL) = 0;
44 44
45 void setParameterLink(ParameterSPtr parameter); 45 void setParameterLink(ParameterSPtr parameter);
46 46
@@ -52,6 +52,16 @@ namespace Info { @@ -52,6 +52,16 @@ namespace Info {
52 52
53 std::string getUnits(void); 53 std::string getUnits(void);
54 54
  55 + void setIsVariable(bool isVariable);
  56 +
  57 + bool isVariable(void);
  58 +
  59 + void addTableParam(std::string key, std::string name);
  60 +
  61 + std::string getTableParamByKey(std::string key);
  62 +
  63 + std::map<std::string, std::string>& getTableParams();
  64 +
55 protected: 65 protected:
56 /** logger of paramTable */ 66 /** logger of paramTable */
57 static log4cxx::LoggerPtr _logger; 67 static log4cxx::LoggerPtr _logger;
@@ -61,6 +71,16 @@ namespace Info { @@ -61,6 +71,16 @@ namespace Info {
61 std::string _tableName; 71 std::string _tableName;
62 72
63 std::string _tableUnits; 73 std::string _tableUnits;
  74 +
  75 + bool _variable;
  76 +
  77 + std::map<std::string, std::string> _tableParams;
  78 +
  79 + std::vector<double> getTableParamValuesByKey(ParameterManager *parameterManager, std::map<std::string, std::vector<double>>* paramsTableData, std::string key);
  80 +
  81 + std::vector<double> getConstantTableParamValuesByKey(ParameterManager *parameterManager, std::string key);
  82 +
  83 + std::vector<double> getVariableTableParamValuesByKey(std::map<std::string, std::vector<double>>* paramsTableData, std::string key);
64 }; 84 };
65 85
66 /** 86 /**
@@ -70,14 +90,13 @@ namespace Info { @@ -70,14 +90,13 @@ namespace Info {
70 */ 90 */
71 class ParamBoundsTable : public ParamTable { 91 class ParamBoundsTable : public ParamTable {
72 public: 92 public:
73 - ParamBoundsTable(const char *paramId, const char *boundsName); 93 + ParamBoundsTable(const char *paramId);
74 94
75 virtual int getSize(ParameterManager *parameterManager); 95 virtual int getSize(ParameterManager *parameterManager);
76 96
77 - virtual t_TableBound getBound(ParameterManager *parameterManager, unsigned int index); 97 + virtual t_TableBound getBound(ParameterManager *parameterManager, unsigned int index, std::map<std::string, std::vector<double>>* paramsTableData = NULL);
78 98
79 - private:  
80 - std::string _boundsName; 99 + static std::string _boundsParamKey;
81 }; 100 };
82 101
83 /** 102 /**
@@ -87,14 +106,15 @@ namespace Info { @@ -87,14 +106,15 @@ namespace Info {
87 */ 106 */
88 class ParamCenterTable : public ParamTable { 107 class ParamCenterTable : public ParamTable {
89 public: 108 public:
90 - ParamCenterTable(const char *paramId, const char *centerName, double size); 109 + ParamCenterTable(const char *paramId, double size);
91 110
92 virtual int getSize(ParameterManager *parameterManager); 111 virtual int getSize(ParameterManager *parameterManager);
93 112
94 - virtual t_TableBound getBound(ParameterManager *parameterManager, unsigned int index); 113 + virtual t_TableBound getBound(ParameterManager *parameterManager, unsigned int index, std::map<std::string, std::vector<double>>* paramsTableData = NULL);
  114 +
  115 + static std::string _centersParamKey;
95 116
96 private: 117 private:
97 - std::string _centerName;  
98 double _size; 118 double _size;
99 }; 119 };
100 120
@@ -105,15 +125,14 @@ namespace Info { @@ -105,15 +125,14 @@ namespace Info {
105 */ 125 */
106 class ParamCenterWidthTable : public ParamTable { 126 class ParamCenterWidthTable : public ParamTable {
107 public: 127 public:
108 - ParamCenterWidthTable(const char *paramId, const char *centerName, const char *widthName); 128 + ParamCenterWidthTable(const char *paramId);
109 129
110 virtual int getSize(ParameterManager *parameterManager); 130 virtual int getSize(ParameterManager *parameterManager);
111 131
112 - virtual t_TableBound getBound(ParameterManager *parameterManager, unsigned int index); 132 + virtual t_TableBound getBound(ParameterManager *parameterManager, unsigned int index, std::map<std::string, std::vector<double>>* paramsTableData = NULL);
113 133
114 - private:  
115 - std::string _centerName;  
116 - std::string _widthName; 134 + static std::string _centersParamKey;
  135 + static std::string _widthsParamKey;
117 }; 136 };
118 137
119 /** 138 /**
@@ -123,14 +142,15 @@ namespace Info { @@ -123,14 +142,15 @@ namespace Info {
123 */ 142 */
124 class ParamCenterAutoTable : public ParamTable { 143 class ParamCenterAutoTable : public ParamTable {
125 public: 144 public:
126 - ParamCenterAutoTable(const char *paramId, const char *centerName, bool log); 145 + ParamCenterAutoTable(const char *paramId, bool log);
127 146
128 virtual int getSize(ParameterManager *parameterManager); 147 virtual int getSize(ParameterManager *parameterManager);
129 148
130 - virtual t_TableBound getBound(ParameterManager *parameterManager, unsigned int index); 149 + virtual t_TableBound getBound(ParameterManager *parameterManager, unsigned int index, std::map<std::string, std::vector<double>>* paramsTableData = NULL);
  150 +
  151 + static std::string _centersParamKey;
131 152
132 private: 153 private:
133 - std::string _centerName;  
134 bool _log; 154 bool _log;
135 }; 155 };
136 156
@@ -141,16 +161,14 @@ namespace Info { @@ -141,16 +161,14 @@ namespace Info {
141 */ 161 */
142 class ParamMinMaxTable : public ParamTable { 162 class ParamMinMaxTable : public ParamTable {
143 public: 163 public:
144 - ParamMinMaxTable(const char *paramId, const char *minName, const char *maxName); 164 + ParamMinMaxTable(const char *paramId);
145 165
146 virtual int getSize(ParameterManager *parameterManager); 166 virtual int getSize(ParameterManager *parameterManager);
147 167
148 - virtual t_TableBound getBound(ParameterManager *parameterManager, unsigned int index);  
149 -  
150 - private:  
151 - std::string _minName; 168 + virtual t_TableBound getBound(ParameterManager *parameterManager, unsigned int index, std::map<std::string, std::vector<double>>* paramsTableData = NULL);
152 169
153 - std::string _maxName; 170 + static std::string _minParamKey;
  171 + static std::string _maxParamKey;
154 }; 172 };
155 } /* namespace Info */ 173 } /* namespace Info */
156 } /* namespace AMDA */ 174 } /* namespace AMDA */
src/Info/ParamTableNode.cc
@@ -63,6 +63,15 @@ public: @@ -63,6 +63,15 @@ public:
63 xmlFree(value); 63 xmlFree(value);
64 } 64 }
65 65
  66 + //Get variable
  67 + value = xmlGetProp(pNode, (const xmlChar *) "variable");
  68 + bool variable = false;
  69 + if (value != NULL)
  70 + {
  71 + variable = (strcmp((char*)value,"true") == 0);
  72 + xmlFree(value);
  73 + }
  74 +
66 xmlChar* lboundsName = NULL; 75 xmlChar* lboundsName = NULL;
67 try { 76 try {
68 if (!(lboundsName = xmlGetProp(pNode, (const xmlChar *) "boundsName"))) { 77 if (!(lboundsName = xmlGetProp(pNode, (const xmlChar *) "boundsName"))) {
@@ -73,10 +82,12 @@ public: @@ -73,10 +82,12 @@ public:
73 LOG4CXX_DEBUG(gLogger, "BoundsTable::proceed - Bounds name : " << lboundsName); 82 LOG4CXX_DEBUG(gLogger, "BoundsTable::proceed - Bounds name : " << lboundsName);
74 83
75 boost::shared_ptr<ParamTable> table(new ParamBoundsTable( 84 boost::shared_ptr<ParamTable> table(new ParamBoundsTable(
76 - paramId.c_str(), (const char*)lboundsName)); 85 + paramId.c_str()));
77 86
  87 + table->addTableParam(ParamBoundsTable::_boundsParamKey, (const char*)lboundsName);
78 table->setName(name); 88 table->setName(name);
79 table->setUnits(units); 89 table->setUnits(units);
  90 + table->setIsVariable(variable);
80 91
81 pParamInfo->addTable(dim, table); 92 pParamInfo->addTable(dim, table);
82 } catch (...) { 93 } catch (...) {
@@ -130,6 +141,15 @@ public: @@ -130,6 +141,15 @@ public:
130 xmlFree(value); 141 xmlFree(value);
131 } 142 }
132 143
  144 + //Get variable
  145 + value = xmlGetProp(pNode, (const xmlChar *) "variable");
  146 + bool variable = false;
  147 + if (value != NULL)
  148 + {
  149 + variable = (strcmp((char*)value,"true") == 0);
  150 + xmlFree(value);
  151 + }
  152 +
133 xmlChar* lminTableName = NULL; 153 xmlChar* lminTableName = NULL;
134 xmlChar* lmaxTableName = NULL; 154 xmlChar* lmaxTableName = NULL;
135 155
@@ -147,10 +167,13 @@ public: @@ -147,10 +167,13 @@ public:
147 LOG4CXX_DEBUG(gLogger, "MinMaxTable::proceed - Min Table name : " << lminTableName << " - Max Table name : " << lmaxTableName); 167 LOG4CXX_DEBUG(gLogger, "MinMaxTable::proceed - Min Table name : " << lminTableName << " - Max Table name : " << lmaxTableName);
148 168
149 boost::shared_ptr<ParamTable> table(new ParamMinMaxTable( 169 boost::shared_ptr<ParamTable> table(new ParamMinMaxTable(
150 - paramId.c_str(), (const char*)lminTableName, (const char*)lmaxTableName)); 170 + paramId.c_str()));
151 171
  172 + table->addTableParam(ParamMinMaxTable::_minParamKey, (const char*)lminTableName);
  173 + table->addTableParam(ParamMinMaxTable::_maxParamKey, (const char*)lmaxTableName);
152 table->setName(name); 174 table->setName(name);
153 table->setUnits(units); 175 table->setUnits(units);
  176 + table->setIsVariable(variable);
154 177
155 pParamInfo->addTable(dim,table); 178 pParamInfo->addTable(dim,table);
156 179
@@ -207,6 +230,15 @@ public: @@ -207,6 +230,15 @@ public:
207 xmlFree(value); 230 xmlFree(value);
208 } 231 }
209 232
  233 + //Get variable
  234 + value = xmlGetProp(pNode, (const xmlChar *) "variable");
  235 + bool variable = false;
  236 + if (value != NULL)
  237 + {
  238 + variable = (strcmp((char*)value,"true") == 0);
  239 + xmlFree(value);
  240 + }
  241 +
210 xmlChar* lcenterName = NULL; 242 xmlChar* lcenterName = NULL;
211 xmlChar* lsize = NULL; 243 xmlChar* lsize = NULL;
212 try { 244 try {
@@ -223,10 +255,12 @@ public: @@ -223,10 +255,12 @@ public:
223 } 255 }
224 256
225 boost::shared_ptr<ParamTable> table(new ParamCenterTable( 257 boost::shared_ptr<ParamTable> table(new ParamCenterTable(
226 - paramId.c_str(), (const char*)lcenterName, atof((const char*)lsize))); 258 + paramId.c_str(), atof((const char*)lsize)));
227 259
  260 + table->addTableParam(ParamCenterTable::_centersParamKey, (const char*)lcenterName);
228 table->setName(name); 261 table->setName(name);
229 table->setUnits(units); 262 table->setUnits(units);
  263 + table->setIsVariable(variable);
230 264
231 pParamInfo->addTable(dim, table); 265 pParamInfo->addTable(dim, table);
232 } catch (...) { 266 } catch (...) {
@@ -286,6 +320,15 @@ public: @@ -286,6 +320,15 @@ public:
286 xmlFree(value); 320 xmlFree(value);
287 } 321 }
288 322
  323 + //Get variable
  324 + value = xmlGetProp(pNode, (const xmlChar *) "variable");
  325 + bool variable = false;
  326 + if (value != NULL)
  327 + {
  328 + variable = (strcmp((char*)value,"true") == 0);
  329 + xmlFree(value);
  330 + }
  331 +
289 xmlChar* lcenterName = NULL; 332 xmlChar* lcenterName = NULL;
290 xmlChar* lwidthName = NULL; 333 xmlChar* lwidthName = NULL;
291 try { 334 try {
@@ -304,10 +347,13 @@ public: @@ -304,10 +347,13 @@ public:
304 LOG4CXX_DEBUG(gLogger, "CenterWidthTable::proceed - Width name : " << lwidthName); 347 LOG4CXX_DEBUG(gLogger, "CenterWidthTable::proceed - Width name : " << lwidthName);
305 348
306 boost::shared_ptr<ParamTable> table(new ParamCenterWidthTable( 349 boost::shared_ptr<ParamTable> table(new ParamCenterWidthTable(
307 - paramId.c_str(), (const char*)lcenterName, (const char*)lwidthName)); 350 + paramId.c_str()));
308 351
  352 + table->addTableParam(ParamCenterWidthTable::_centersParamKey, (const char*)lcenterName);
  353 + table->addTableParam(ParamCenterWidthTable::_widthsParamKey, (const char*)lwidthName);
309 table->setName(name); 354 table->setName(name);
310 table->setUnits(units); 355 table->setUnits(units);
  356 + table->setIsVariable(variable);
311 357
312 pParamInfo->addTable(dim, table); 358 pParamInfo->addTable(dim, table);
313 } catch (...) { 359 } catch (...) {
@@ -367,6 +413,15 @@ public: @@ -367,6 +413,15 @@ public:
367 xmlFree(value); 413 xmlFree(value);
368 } 414 }
369 415
  416 + //Get variable
  417 + value = xmlGetProp(pNode, (const xmlChar *) "variable");
  418 + bool variable = false;
  419 + if (value != NULL)
  420 + {
  421 + variable = (strcmp((char*)value,"true") == 0);
  422 + xmlFree(value);
  423 + }
  424 +
370 xmlChar* lcenterName = NULL; 425 xmlChar* lcenterName = NULL;
371 xmlChar* llog = NULL; 426 xmlChar* llog = NULL;
372 try { 427 try {
@@ -384,10 +439,12 @@ public: @@ -384,10 +439,12 @@ public:
384 } 439 }
385 440
386 boost::shared_ptr<ParamTable> table(new ParamCenterAutoTable( 441 boost::shared_ptr<ParamTable> table(new ParamCenterAutoTable(
387 - paramId.c_str(), (const char*)lcenterName, isLog)); 442 + paramId.c_str(), isLog));
388 443
  444 + table->addTableParam(ParamCenterAutoTable::_centersParamKey, (const char*)lcenterName);
389 table->setName(name); 445 table->setName(name);
390 table->setUnits(units); 446 table->setUnits(units);
  447 + table->setIsVariable(variable);
391 448
392 pParamInfo->addTable(dim, table); 449 pParamInfo->addTable(dim, table);
393 } catch (...) { 450 } catch (...) {
src/ParamGetImpl/DDServerInterface/VirtualInstrument.cc
@@ -136,6 +136,10 @@ namespace DDServerInterface { @@ -136,6 +136,10 @@ namespace DDServerInterface {
136 recurseInfoValues<double>(infoList, pIinfoName, 136 recurseInfoValues<double>(infoList, pIinfoName,
137 data->DimNumber, data->Dimensions, 137 data->DimNumber, data->Dimensions,
138 *data->Variables); 138 *data->Variables);
  139 + } else if (data->type == DD_SHORT) {
  140 + recurseInfoValues<short>(infoList, pIinfoName,
  141 + data->DimNumber, data->Dimensions,
  142 + *data->Variables);
139 } 143 }
140 } else { 144 } else {
141 145
src/ParamOutputImpl/Plot/PanelPlotOutput.cc
@@ -1563,6 +1563,9 @@ void PanelPlotOutput::drawMatrix(MatrixGrid&amp; matrixGrid, double minDataVal, doub @@ -1563,6 +1563,9 @@ void PanelPlotOutput::drawMatrix(MatrixGrid&amp; matrixGrid, double minDataVal, doub
1563 y[2] = part.y[1]; 1563 y[2] = part.y[1];
1564 y[3] = y[2]; 1564 y[3] = y[2];
1565 1565
  1566 + if (isNAN(part.value))
  1567 + continue;
  1568 +
1566 if (!dataValueIsColorIndex) 1569 if (!dataValueIsColorIndex)
1567 { 1570 {
1568 if (!getColoredValue(part.value, minDataVal, maxDataVal, col)) 1571 if (!getColoredValue(part.value, minDataVal, maxDataVal, col))
@@ -1570,8 +1573,6 @@ void PanelPlotOutput::drawMatrix(MatrixGrid&amp; matrixGrid, double minDataVal, doub @@ -1570,8 +1573,6 @@ void PanelPlotOutput::drawMatrix(MatrixGrid&amp; matrixGrid, double minDataVal, doub
1570 } 1573 }
1571 else 1574 else
1572 { 1575 {
1573 - if (isNAN(part.value))  
1574 - continue;  
1575 Color dataValueColor(colorMapIndex, (int)part.value); 1576 Color dataValueColor(colorMapIndex, (int)part.value);
1576 restoreColor(_pls, dataValueColor, _panel->_page->_mode); 1577 restoreColor(_pls, dataValueColor, _panel->_page->_mode);
1577 _pls->fill(4, x, y); 1578 _pls->fill(4, x, y);
@@ -2901,9 +2902,12 @@ void PanelPlotOutput::createParameters(std::list&lt;std::string&gt;&amp; usedParametersId_ @@ -2901,9 +2902,12 @@ void PanelPlotOutput::createParameters(std::list&lt;std::string&gt;&amp; usedParametersId_
2901 std::shared_ptr<SpectroProperties> pSpecProp = it->getSpectroProperties(); 2902 std::shared_ptr<SpectroProperties> pSpecProp = it->getSpectroProperties();
2902 if (pSpecProp != nullptr) 2903 if (pSpecProp != nullptr)
2903 { 2904 {
  2905 + AMDA::Info::ParamInfoSPtr paramInfo = AMDA::Info::ParamMgr::getInstance()->getParamInfoFromId(originalParam->getInfoId());
  2906 + boost::shared_ptr<AMDA::Info::ParamTable> tableSPtr;
  2907 + if (paramInfo != nullptr)
  2908 + tableSPtr = paramInfo->getTable(pSpecProp->getRelatedDim());
2904 //get corrected sampling value in relation with max resolution 2909 //get corrected sampling value in relation with max resolution
2905 double correctedSamplingValue = getCorrectedSamplingValue(pSpecProp->getMaxResolution(), samplingValue); 2910 double correctedSamplingValue = getCorrectedSamplingValue(pSpecProp->getMaxResolution(), samplingValue);
2906 -  
2907 AMDA::Parameters::ParameterSPtr usedParam; 2911 AMDA::Parameters::ParameterSPtr usedParam;
2908 2912
2909 if (abs(samplingValue - correctedSamplingValue) > 1.) 2913 if (abs(samplingValue - correctedSamplingValue) > 1.)
@@ -2911,17 +2915,49 @@ void PanelPlotOutput::createParameters(std::list&lt;std::string&gt;&amp; usedParametersId_ @@ -2911,17 +2915,49 @@ void PanelPlotOutput::createParameters(std::list&lt;std::string&gt;&amp; usedParametersId_
2911 //more than one second between samplingValue and correctedSamplingValue 2915 //more than one second between samplingValue and correctedSamplingValue
2912 //=> use resampling parameter 2916 //=> use resampling parameter
2913 usedParam = createSampledParameter(originalParam, correctedSamplingValue); 2917 usedParam = createSampledParameter(originalParam, correctedSamplingValue);
  2918 + if ((tableSPtr != nullptr) && tableSPtr->isVariable())
  2919 + {
  2920 + for (std::map<std::string, std::string>::iterator it = tableSPtr->getTableParams().begin(); it != tableSPtr->getTableParams().end(); ++it)
  2921 + {
  2922 + std::string tableParamKey = it->first;
  2923 + std::string tableParamName = it->second;
  2924 +
  2925 + AMDA::Parameters::ParameterSPtr originalTableParam = _parameterManager.getParameter(tableParamName);
  2926 + AMDA::Parameters::ParameterSPtr usedTableParam = createSampledParameter(originalTableParam, correctedSamplingValue);
  2927 + pSpecProp->addTableParam(tableParamKey, usedTableParam->getId());
  2928 + }
  2929 + }
2914 } 2930 }
2915 else 2931 else
2916 { 2932 {
2917 //use original parameter 2933 //use original parameter
2918 usedParam = originalParam; 2934 usedParam = originalParam;
  2935 + if ((tableSPtr != nullptr) && tableSPtr->isVariable())
  2936 + {
  2937 + for (std::map<std::string, std::string>::iterator it = tableSPtr->getTableParams().begin(); it != tableSPtr->getTableParams().end(); ++it)
  2938 + {
  2939 + std::string tableParamKey = it->first;
  2940 + std::string tableParamName = it->second;
  2941 +
  2942 + AMDA::Parameters::ParameterSPtr originalTableParam = _parameterManager.getParameter(tableParamName);
  2943 + pSpecProp->addTableParam(tableParamKey, originalTableParam->getId());
  2944 + }
  2945 + }
2919 } 2946 }
2920 2947
2921 //Add used parameter to parameters list 2948 //Add used parameter to parameters list
2922 if (std::find (usedParametersId_.begin(),usedParametersId_.end(),usedParam->getId()) == usedParametersId_.end()) 2949 if (std::find (usedParametersId_.begin(),usedParametersId_.end(),usedParam->getId()) == usedParametersId_.end())
2923 usedParametersId_.push_back(usedParam->getId()); 2950 usedParametersId_.push_back(usedParam->getId());
2924 pSpecProp->setParamId(usedParam->getId()); 2951 pSpecProp->setParamId(usedParam->getId());
  2952 + //Add table parameters to parameters list
  2953 + for (std::map<std::string, std::string>::iterator it = pSpecProp->getTableParams().begin(); it != pSpecProp->getTableParams().end(); ++it)
  2954 + {
  2955 + std::string tableParamKey = it->first;
  2956 + std::string tableParamId = it->second;
  2957 +
  2958 + if (std::find (usedParametersId_.begin(),usedParametersId_.end(),tableParamId) == usedParametersId_.end())
  2959 + usedParametersId_.push_back(tableParamId);
  2960 + }
2925 } 2961 }
2926 } 2962 }
2927 } 2963 }
src/ParamOutputImpl/Plot/ParameterData.cc
@@ -188,20 +188,26 @@ void ComponentParameterData::preAllocate(int nbData) @@ -188,20 +188,26 @@ void ComponentParameterData::preAllocate(int nbData)
188 void ComponentParameterData::addValue(double value) { 188 void ComponentParameterData::addValue(double value) {
189 _values.push_back(value); 189 _values.push_back(value);
190 190
191 - if (isnan(_min) && !isnan(value)) {  
192 - _min = value;  
193 - } else if (!isnan(_min) && !isnan(value)) {  
194 - _min = std::min(_min, value);  
195 - } 191 + if (!isnan(value))
  192 + {
  193 + if (isnan(_min))
  194 + _min = value;
  195 + else
  196 + _min = std::min(_min, value);
196 197
197 - if (isnan(_max) && !isnan(value)) {  
198 - _max = value;  
199 - } else if (!isnan(value) && !isnan(_max)) {  
200 - _max = std::max(_max, value);  
201 - } 198 + if (isnan(_max))
  199 + _max = value;
  200 + else
  201 + _max = std::max(_max, value);
202 202
203 - if (isnan(_minStrictPos) && !isnan(value) && (value > 0))  
204 - _minStrictPos = std::min(_min, value); 203 + if (value > 0)
  204 + {
  205 + if (isnan(_minStrictPos))
  206 + _minStrictPos = value;
  207 + else
  208 + _minStrictPos = std::min(_min, value);
  209 + }
  210 + }
205 } 211 }
206 212
207 } /* namespace plot */ 213 } /* namespace plot */
src/ParamOutputImpl/Plot/SpectroProperties.hh
@@ -56,6 +56,7 @@ public: @@ -56,6 +56,7 @@ public:
56 SpectroProperties& operator=(const SpectroProperties& ref_) { 56 SpectroProperties& operator=(const SpectroProperties& ref_) {
57 DrawingProperties::operator=(ref_); 57 DrawingProperties::operator=(ref_);
58 _paramId = ref_._paramId; 58 _paramId = ref_._paramId;
  59 + _tableParamsId = ref_._tableParamsId;
59 _hasYAxis = ref_._hasYAxis; 60 _hasYAxis = ref_._hasYAxis;
60 _hasXAxis = ref_._hasXAxis; 61 _hasXAxis = ref_._hasXAxis;
61 _hasZAxis = ref_._hasZAxis; 62 _hasZAxis = ref_._hasZAxis;
@@ -76,6 +77,18 @@ public: @@ -76,6 +77,18 @@ public:
76 _paramId = paramId_; 77 _paramId = paramId_;
77 } 78 }
78 79
  80 + std::string getTableParamIdByName(std::string paramName){
  81 + return _tableParamsId[paramName];
  82 + }
  83 +
  84 + std::map<std::string, std::string>& getTableParams() {
  85 + return _tableParamsId;
  86 + }
  87 +
  88 + void addTableParam(std::string paramName, std::string paramId) {
  89 + _tableParamsId[paramName] = paramId;
  90 + }
  91 +
79 bool hasXAxis() const { 92 bool hasXAxis() const {
80 return _hasXAxis; 93 return _hasXAxis;
81 } 94 }
@@ -135,6 +148,11 @@ private: @@ -135,6 +148,11 @@ private:
135 std::string _paramId; 148 std::string _paramId;
136 149
137 /** 150 /**
  151 + * @brief Calculated tableParamsId (from resolution).
  152 + */
  153 + std::map<std::string, std::string> _tableParamsId;
  154 +
  155 + /**
138 * @brief Flag that indicates the serie has X Axis 156 * @brief Flag that indicates the serie has X Axis
139 */ 157 */
140 bool _hasXAxis; 158 bool _hasXAxis;
src/ParamOutputImpl/Plot/Time/TimePlot.cc
@@ -278,11 +278,39 @@ void TimePlot::configureSpectroAxis() { @@ -278,11 +278,39 @@ void TimePlot::configureSpectroAxis() {
278 else 278 else
279 { 279 {
280 AMDA::Info::t_TableBound crtBound; 280 AMDA::Info::t_TableBound crtBound;
281 - for (int i = 0; i < parameterDimension; ++i) 281 + if (!tableSPtr->isVariable())
282 { 282 {
283 - crtBound = tableSPtr->getBound(&_parameterManager, i);  
284 - lYAxisRange.setMin(std::min(crtBound.min,lYAxisRange.getMin()));  
285 - lYAxisRange.setMax(std::max(crtBound.max,lYAxisRange.getMax())); 283 + for (int i = 0; i < parameterDimension; ++i)
  284 + {
  285 + crtBound = tableSPtr->getBound(&_parameterManager, i);
  286 + lYAxisRange.setMin(std::min(crtBound.min,lYAxisRange.getMin()));
  287 + lYAxisRange.setMax(std::max(crtBound.max,lYAxisRange.getMax()));
  288 + }
  289 + }
  290 + else
  291 + {
  292 + //Variable table => we need to loop under all records to find axis min & max values
  293 + for (int i = 0; i < (*_pParameterValues)[spectroPropertiesPtr->getParamId()].getSize(); ++i)
  294 + {
  295 + std::map<std::string, std::vector<double>> paramsTableData;
  296 + for (std::map<std::string, std::string>::iterator it = spectroPropertiesPtr->getTableParams().begin(); it != spectroPropertiesPtr->getTableParams().end(); ++it)
  297 + {
  298 + ParameterData& data = (*_pParameterValues)[it->second];
  299 + std::vector<double> paramTableValues;
  300 + for (int j = 0; j < data.getDim1Size(); ++j)
  301 + {
  302 + double* values = data.getValues(AMDA::Common::ParameterIndexComponent(j,-1), i);
  303 + paramTableValues.push_back((*values));
  304 + }
  305 + paramsTableData[it->first] = paramTableValues;
  306 + }
  307 + for (int j = 0; j < parameterDimension; ++j)
  308 + {
  309 + crtBound = tableSPtr->getBound(&_parameterManager, j, &paramsTableData);
  310 + lYAxisRange.setMin(std::min(crtBound.min,lYAxisRange.getMin()));
  311 + lYAxisRange.setMax(std::max(crtBound.max,lYAxisRange.getMax()));
  312 + }
  313 + }
286 } 314 }
287 315
288 // Set Y axis legend if not already done 316 // Set Y axis legend if not already done
@@ -305,7 +333,7 @@ void TimePlot::configureSpectroAxis() { @@ -305,7 +333,7 @@ void TimePlot::configureSpectroAxis() {
305 otherTableSPtr = paramInfo->getTable(0); 333 otherTableSPtr = paramInfo->getTable(0);
306 otherDimIndex = spectroPropertiesPtr->getIndexes().front().getDim1Index(); 334 otherDimIndex = spectroPropertiesPtr->getIndexes().front().getDim1Index();
307 } 335 }
308 - if (otherTableSPtr != nullptr) 336 + if ((otherTableSPtr != nullptr) && !otherTableSPtr->isVariable())
309 { 337 {
310 AMDA::Info::t_TableBound crtBound = otherTableSPtr->getBound(&_parameterManager, otherDimIndex); 338 AMDA::Info::t_TableBound crtBound = otherTableSPtr->getBound(&_parameterManager, otherDimIndex);
311 if (otherTableSPtr->getName().empty()) 339 if (otherTableSPtr->getName().empty())
@@ -364,8 +392,10 @@ void TimePlot::configureSpectroAxis() { @@ -364,8 +392,10 @@ void TimePlot::configureSpectroAxis() {
364 else 392 else
365 minVal = (*_pParameterValues)[spectroPropertiesPtr->getParamId()].getMin(index); 393 minVal = (*_pParameterValues)[spectroPropertiesPtr->getParamId()].getMin(index);
366 maxVal = (*_pParameterValues)[spectroPropertiesPtr->getParamId()].getMax(index); 394 maxVal = (*_pParameterValues)[spectroPropertiesPtr->getParamId()].getMax(index);
367 - lParamRange.setMin(std::min(minVal,lParamRange.getMin()));  
368 - lParamRange.setMax(std::max(maxVal,lParamRange.getMax())); 395 + if (!isnan(maxVal))
  396 + lParamRange.setMin(std::min(minVal,lParamRange.getMin()));
  397 + if (!isnan(maxVal))
  398 + lParamRange.setMax(std::max(maxVal,lParamRange.getMax()));
369 } 399 }
370 } 400 }
371 else 401 else
@@ -893,49 +923,101 @@ void TimePlot::drawSpectro(double startDate, double stopDate, std::string pParam @@ -893,49 +923,101 @@ void TimePlot::drawSpectro(double startDate, double stopDate, std::string pParam
893 } 923 }
894 924
895 MatrixGrid matrixGrid; 925 MatrixGrid matrixGrid;
896 - for (auto index : pSpectro.getIndexes()) 926 +
  927 + if ((tableSPtr == nullptr) || !tableSPtr->isVariable())
897 { 928 {
898 - GridPart part;  
899 - if (tableSPtr == nullptr)  
900 - {  
901 - if (pSpectro.getRelatedDim() == 0)  
902 - part.y[0] = index.getDim1Index();  
903 - else  
904 - part.y[0] = index.getDim2Index();  
905 - part.y[1] = part.y[0]+1;  
906 - }  
907 - else 929 + for (auto index : pSpectro.getIndexes())
908 { 930 {
909 - AMDA::Info::t_TableBound crtBound;  
910 - if (pSpectro.getRelatedDim() == 0)  
911 - crtBound = tableSPtr->getBound(&_parameterManager, index.getDim1Index()); 931 + GridPart part;
  932 + if (tableSPtr == nullptr)
  933 + {
  934 + if (pSpectro.getRelatedDim() == 0)
  935 + part.y[0] = index.getDim1Index();
  936 + else
  937 + part.y[0] = index.getDim2Index();
  938 + part.y[1] = part.y[0]+1;
  939 + }
912 else 940 else
913 - crtBound = tableSPtr->getBound(&_parameterManager, index.getDim2Index());  
914 - part.y[0] = crtBound.min;  
915 - part.y[1] = crtBound.max;  
916 - if (lYAxis->_scale == Axis::Scale::LOGARITHMIC)  
917 { 941 {
918 - part.y[0] = ((part.y[0] > 0) ? log10(part.y[0]) : 10e-3);  
919 - part.y[1] = ((part.y[1] > 0) ? log10(part.y[1]) : 10e-3); 942 + AMDA::Info::t_TableBound crtBound;
  943 + if (pSpectro.getRelatedDim() == 0)
  944 + crtBound = tableSPtr->getBound(&_parameterManager, index.getDim1Index());
  945 + else
  946 + crtBound = tableSPtr->getBound(&_parameterManager, index.getDim2Index());
  947 + part.y[0] = crtBound.min;
  948 + part.y[1] = crtBound.max;
  949 + if (lYAxis->_scale == Axis::Scale::LOGARITHMIC)
  950 + {
  951 + part.y[0] = ((part.y[0] > 0) ? log10(part.y[0]) : 10e-3);
  952 + part.y[1] = ((part.y[1] > 0) ? log10(part.y[1]) : 10e-3);
  953 + }
920 } 954 }
921 - }  
922 955
923 - //get original data for interval [startDate, stopDate]  
924 - int startIndex;  
925 - int nbValues;  
926 - double *valuesInterval = data.getIntervalValues(startDate, stopDate, index, 956 + //get original data for interval [startDate, stopDate]
  957 + int startIndex;
  958 + int nbValues;
  959 + double *valuesInterval = data.getIntervalValues(startDate, stopDate, index,
927 startIndex, nbValues); 960 startIndex, nbValues);
928 961
929 - if (valuesInterval == NULL)  
930 - continue; 962 + if (valuesInterval == NULL)
  963 + continue;
931 964
932 - for (int i = startIndex; i < startIndex + nbValues - 1; ++i) 965 + for (int i = startIndex; i < startIndex + nbValues - 1; ++i)
  966 + {
  967 + part.x[0] = data.getTimes()[i];
  968 + part.x[1] = data.getTimes()[i+1];
  969 +
  970 + part.value = valuesInterval[i];
  971 + matrixGrid.push_back(part);
  972 + }
  973 + }
  974 + }
  975 + else
  976 + {
  977 + //Variable table
  978 + AMDA::Info::t_TableBound crtBound;
  979 + for (auto index : pSpectro.getIndexes())
933 { 980 {
934 - part.x[0] = data.getTimes()[i];  
935 - part.x[1] = data.getTimes()[i+1]; 981 + int startIndex;
  982 + int nbValues;
  983 + double *valuesInterval = data.getIntervalValues(startDate, stopDate, index,
  984 + startIndex, nbValues);
  985 + for (int i = startIndex; i < startIndex + nbValues - 1; ++i)
  986 + {
  987 + GridPart part;
  988 + part.x[0] = data.getTimes()[i];
  989 + part.x[1] = data.getTimes()[i+1];
936 990
937 - part.value = valuesInterval[i];  
938 - matrixGrid.push_back(part); 991 + part.value = valuesInterval[i];
  992 +
  993 + std::map<std::string, std::vector<double>> paramsTableData;
  994 + for (std::map<std::string, std::string>::iterator it = pSpectro.getTableParams().begin(); it != pSpectro.getTableParams().end(); ++it)
  995 + {
  996 + ParameterData& tableData = (*_pParameterValues)[it->second];
  997 + std::vector<double> paramTableValues;
  998 + for (int j = 0; j < data.getDim1Size(); ++j)
  999 + {
  1000 + double* values = tableData.getValues(AMDA::Common::ParameterIndexComponent(j,-1), i);
  1001 + paramTableValues.push_back((*values));
  1002 + }
  1003 + paramsTableData[it->first] = paramTableValues;
  1004 + }
  1005 +
  1006 + if (pSpectro.getRelatedDim() == 0)
  1007 + crtBound = tableSPtr->getBound(&_parameterManager, index.getDim1Index(), &paramsTableData);
  1008 + else
  1009 + crtBound = tableSPtr->getBound(&_parameterManager, index.getDim2Index(), &paramsTableData);
  1010 +
  1011 + part.y[0] = crtBound.min;
  1012 + part.y[1] = crtBound.max;
  1013 + if (lYAxis->_scale == Axis::Scale::LOGARITHMIC)
  1014 + {
  1015 + part.y[0] = ((part.y[0] > 0) ? log10(part.y[0]) : 10e-3);
  1016 + part.y[1] = ((part.y[1] > 0) ? log10(part.y[1]) : 10e-3);
  1017 + }
  1018 +
  1019 + matrixGrid.push_back(part);
  1020 + }
939 } 1021 }
940 } 1022 }
941 1023
src/Parameters/VisitorOfParamData.hh
@@ -61,6 +61,18 @@ public: @@ -61,6 +61,18 @@ public:
61 return _data[col]; 61 return _data[col];
62 } 62 }
63 63
  64 + std::vector<Type> toVector()
  65 + {
  66 + std::vector<Type> res(_data, _data + _size);
  67 + return res;
  68 + }
  69 +
  70 + const std::vector<Type> toVector() const
  71 + {
  72 + std::vector<Type> res(_data, _data + _size);
  73 + return res;
  74 + }
  75 +
64 private: 76 private:
65 int _size; 77 int _size;
66 78