Commit 7270c794 authored by Alexander Lapshin's avatar Alexander Lapshin

integrator options

parent b34ad36c
......@@ -8,7 +8,7 @@ PropInfoBase::PropInfoBase(
AtmModel atmModel,
const bool sun,
const bool moon,
const bool prec_itrf,
const IntegratorCfg& icfg,
const int type)
:
m_atmModel(std::move(atmModel)),
......@@ -17,7 +17,7 @@ PropInfoBase::PropInfoBase(
m_sun(sun),
m_moon(moon),
m_type(type),
m_prec_itrf(prec_itrf)
m_integrator_cfg(icfg)
{
}
......@@ -44,9 +44,7 @@ bool PropInfoBase::Load(myXML::Contain* parent)
LoadXML(con, "EarthModel", m_earthModel);
LoadXML(con, "AtmModel", m_atmModel, false);
LoadXML(con, "Id", m_id, false, &idloaded);
m_prec_itrf = false;
LoadXML(con, "prec_itrf", m_prec_itrf, false);
m_integrator_cfg.Load(parent);
return true;
}
......@@ -70,8 +68,7 @@ void PropInfoBase::load(const jsonval& parent)
loadjson(parent, "earth", m_earthModel);
loadjson(parent, "atm", m_atmModel, false);
m_prec_itrf = false;
loadjson(parent, "prec_itrf", m_prec_itrf, false);
m_integrator_cfg.load(parent);
}
std::string PropInfoBase::GetAsXML() const
......@@ -87,7 +84,10 @@ std::string PropInfoBase::GetAsXML() const
PutValue(outs, "Sun", m_sun);
PutValue(outs, "Moon", m_moon);
PutValue(outs, "LightModel", m_lightModel);
PutValue(outs, "prec_itrf", m_prec_itrf);
PutValue(outs, "integratorEps", get_integrator_cfg().getEps());
PutValue(outs, "integratorStepInit", get_integrator_cfg().getStepInit());
PutValue(outs, "integratorStepMin", get_integrator_cfg().getStepMin());
PutValue(outs, "prec_itrf", get_integrator_cfg().getPrecItfr());
outs << "<EarthModel>";
PutValue(outs, "Model", m_earthModel.GetModel());
......
......@@ -6,6 +6,7 @@
#include "AtmModel.h"
#include "EarthModel.h"
#include "json_functions.h"
#include "integratorcfg.h"
enum proptypes
{
......@@ -27,7 +28,7 @@ public:
AtmModel atmModel,
const bool sun,
const bool moon,
const bool prec_itrf,
const IntegratorCfg& icfg,
const int type);
bool Load(myXML::Contain* parent);
......@@ -35,12 +36,13 @@ public:
bool IsSun() const { return m_sun; }
bool IsMoon() const { return m_moon; }
int GetType() const { return m_type; }
bool is_prec_itrf() const { return m_prec_itrf; }
//bool is_prec_itrf() const { return m_prec_itrf; }
const AtmModel& GetAtmModel() const { return m_atmModel; }
const EarthModel& GetEarthModel() const { return m_earthModel; }
std::string GetLightModel() const { return m_lightModel; }
std::string GetAsXML() const;
void ToXml(std::ostream& outs) const;
const IntegratorCfg& get_integrator_cfg() const { return m_integrator_cfg; }
private:
static std::string TypeConvert(int value) ;
......@@ -53,7 +55,7 @@ private:
bool m_moon;
int m_type;
int m_id;
bool m_prec_itrf {false};
IntegratorCfg m_integrator_cfg;
};
typedef std::map<int, PropInfoBase> PropInfoBases;
......
......@@ -41,15 +41,22 @@ bool Propagator::Init(const PropInfoBase& propInfo, const SInitOrbit& initOrbit,
m_variates = variates;
if (propInfo.GetType() == ST_PROP) {
const IntegratorCfg& icfg = initOrbit.GetIntegratorCfg();
if (!m_variates) {
InitStPredictor(m_stPredictor, initOrbit, propInfo);
m_stPredictor.GetPredictor()->SetAccuracy(icfg.getEps(), icfg.getStepInit(), icfg.getStepMin(), icfg.getPrecItfr());
m_stPredictor.GetPredictor()->SetAccuracy(
propInfo.get_integrator_cfg().getEps(),
propInfo.get_integrator_cfg().getStepInit(),
propInfo.get_integrator_cfg().getStepMin(),
propInfo.get_integrator_cfg().getPrecItfr());
m_predictor = &m_stPredictor;
}
else {
InitStvPredictor(m_stvPredictor, initOrbit, propInfo);
m_stvPredictor.GetPredictor()->SetAccuracy(icfg.getEps(), icfg.getStepInit(), icfg.getStepMin(), icfg.getPrecItfr());
m_stvPredictor.GetPredictor()->SetAccuracy(
propInfo.get_integrator_cfg().getEps(),
propInfo.get_integrator_cfg().getStepInit(),
propInfo.get_integrator_cfg().getStepMin(),
propInfo.get_integrator_cfg().getPrecItfr());
m_predictor = &m_stvPredictor;
}
}
......@@ -262,7 +269,6 @@ bool Propagator::Propagate(const TimeJD& jd, SInitOrbit& res) const
0,
m_initOrbit.GetId()
);
res.SetIntegratorCfg(m_initOrbit.GetIntegratorCfg());
return true;
}
else {
......@@ -283,7 +289,6 @@ bool Propagator::Propagate(const TimeJD& jd, SInitOrbit& res) const
0,
m_initOrbit.GetId()
);
res.SetIntegratorCfg(m_initOrbit.GetIntegratorCfg());
return true;
}
else {
......@@ -304,7 +309,6 @@ bool Propagator::Propagate(const TimeJD& jd, SInitOrbit& res) const
0,
m_initOrbit.GetId()
);
res.SetIntegratorCfg(m_initOrbit.GetIntegratorCfg());
return true;
}
else {
......
......@@ -78,9 +78,6 @@ public:
void SetMotionModel(const MotionModel& motionModel);
void SetDate(const TimeJD& date);
void SetId(TOrbitId id) { m_id = id; }
void SetIntegratorCfg(const IntegratorCfg& icfg) { m_integratorCfg = icfg; }
const IntegratorCfg& GetIntegratorCfg() const { return m_integratorCfg; }
protected:
static int ParseSrcType(const TOrbitId& id);
void CreateFromKepler(const KepData& kd, const std::string& frame);
......@@ -102,7 +99,6 @@ protected:
TOrbitId m_id;
TOrbitId m_baseid;
PropInfoBase m_propInfo;
IntegratorCfg m_integratorCfg;
int rev_;
};
......
#include "integratorcfg.h"
#include "XMLFunctions.h"
void IntegratorCfg::load(const jsonval& parent)
{
m_eps = -1;
loadjson(parent, "eps", m_eps, false);
m_stepinit = -1;
loadjson(parent, "init_step", m_stepinit, false);
m_stepmin = -1;
loadjson(parent, "min_step", m_stepmin, false);
m_precItrf = false;
loadjson(parent, "prec_itrf", m_precItrf, false);
}
bool IntegratorCfg::Load(myXML::Contain* parent)
{
std::map<std::string, myXML::Contain*> con;
GetChildren(parent, con);
LoadXML(con, "integratorEps", m_eps, false);
LoadXML(con, "integratorStepInit", m_stepinit, false);
LoadXML(con, "integratorStepMin", m_stepmin, false);
LoadXML(con, "prec_itrf", m_precItrf, false);
return true;
}
#pragma once
#include "json_functions.h"
#define IEPS 1E-9
#define ISTEPINIT 10E-3
#define ISTEPMIN .1E-3
#include <myXML_Document.hpp>
class IntegratorCfg
{
public:
IntegratorCfg() :
m_eps(IEPS), m_stepinit(ISTEPINIT), m_stepmin(ISTEPMIN), m_precItrf(false)
IntegratorCfg()
{
}
......@@ -20,13 +16,14 @@ public:
}
void load(const jsonval& parent);
double getEps() const { return m_eps > 0 ? m_eps : IEPS; }
double getStepInit() const { return m_stepinit > 0 ? m_stepinit : ISTEPINIT; }
double getStepMin() const { return m_stepmin > 0 ? m_stepmin : ISTEPMIN; }
bool Load(myXML::Contain* parent);
double getEps() const { return m_eps; }
double getStepInit() const { return m_stepinit; }
double getStepMin() const { return m_stepmin; }
bool getPrecItfr() const { return m_precItrf; }
private:
double m_eps;
double m_stepinit;
double m_stepmin;
bool m_precItrf;
double m_eps{1E-9};
double m_stepinit{10E-3};
double m_stepmin{.1E-3};
bool m_precItrf{false};
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment