// PropDirected.cpp #include "PropDirected.h" #include #include "PropStat.h" #include "objstream/ObjData.hpp" using std::string; using trf::TrackDerivative; using trf::Surface; using trf::VTrack; using trf::ETrack; using trf::PropStat; using trf::Propagator; using trf::PropDirected; //********************************************************************** // Use OBS data to define the direction. // The string dir is used if present. // Otherwise no action is taken. // Returns true if the string is found and is valid. // Allowed values are nearest, forward, backward, nearest_move, // forward_move and backward_move. bool PropDirected::set_direction(const ObjData& data) { if ( ! data.has("dir") ) return false; string sdir = data.get_string("dir"); Propagator::PropDir dir; if ( sdir == "forward" ) { dir = Propagator::FORWARD; } else if ( sdir == "backward" ) { dir = Propagator::BACKWARD; } else if ( sdir == "nearest" ) { dir = Propagator::NEAREST; } else if ( sdir == "forward_move" ) { dir = Propagator::FORWARD_MOVE; } else if ( sdir == "backward_move" ) { dir = Propagator::BACKWARD_MOVE; } else if ( sdir == "nearest_move" ) { dir = Propagator::NEAREST_MOVE; } else { return false; } set_direction(dir); return true; } //********************************************************************** // constructor PropDirected::PropDirected() { set_direction(NEAREST); } //********************************************************************** // constructor from direction PropDirected::PropDirected(PropDir dir) { set_direction(dir); } //********************************************************************** // destructor PropDirected::~PropDirected() { } //********************************************************************** // Set the direction. void PropDirected::set_direction(PropDir dir) { _dir = dir; } //********************************************************************** // Fetch the direction. Propagator::PropDir PropDirected::get_direction() const { return _dir; } //********************************************************************** // Propagate a track without error in the specified direction. PropStat PropDirected::vec_prop(VTrack& trv, const Surface& srf, TrackDerivative* pder) const { return vec_dir_prop(trv, srf, _dir, pder); } //********************************************************************** // Propagate a track with error in the specified direction. PropStat PropDirected::err_prop(ETrack& trv, const Surface& srf, TrackDerivative* pder) const { return err_dir_prop(trv, srf, _dir, pder); } //**********************************************************************