#include <orsa_orbit.h>
Public Member Functions | |
OptimizedOrbitPositions (const OrbitWithEpoch &orbit) | |
Sky | PropagatedSky_J2000 (const UniverseTypeAwareTime &, const std::string &obscode, const bool integrate=true, const bool light_time_corrections=true) |
void | PropagatedPosVel (const UniverseTypeAwareTime &, Vector &, Vector &, bool integrate=true) |
OrbitWithEpoch | PropagatedOrbit (const UniverseTypeAwareTime &, bool integrate=true) |
Definition at line 170 of file orsa_orbit.h.
OptimizedOrbitPositions | ( | const OrbitWithEpoch & | orbit | ) |
Definition at line 869 of file orsa_orbit.cc.
References orsa::EARTH_AND_MOON, orsa::JUPITER, orsa::MARS, orsa::MERCURY, orsa::NEPTUNE, orsa::SATURN, orsa::SUN, orsa::URANUS, and orsa::VENUS.
00869 : _orbit(orbit) { 00870 00871 l.push_back(SUN); 00872 l.push_back(MERCURY); 00873 l.push_back(VENUS); 00874 l.push_back(EARTH_AND_MOON); 00875 l.push_back(MARS); 00876 l.push_back(JUPITER); 00877 l.push_back(SATURN); 00878 l.push_back(URANUS); 00879 l.push_back(NEPTUNE); 00880 00881 frames.clear(); 00882 }
OrbitWithEpoch PropagatedOrbit | ( | const UniverseTypeAwareTime & | final_time, | |
bool | integrate = true | |||
) |
Definition at line 884 of file orsa_orbit.cc.
References Integrator::accuracy, OrbitWithEpoch::Compute(), orsa::DAY, OrbitWithEpoch::epoch, orsa::FromUnits(), orsa::GetG(), orsa::GetMSun(), Evolution::Integrate(), Orbit::M, orsa::NEWTON, Orbit::Period(), Body::position(), Evolution::push_back(), OrbitWithEpoch::RelativePosVel(), Evolution::SetIntegrator(), Evolution::SetInteraction(), Evolution::SetMaxUnsavedSubSteps(), Body::SetPosition(), Evolution::SetSamplePeriod(), orsa::SetupSolarSystem(), Body::SetVelocity(), Frame::size(), Evolution::size(), orsa::SUN, UniverseTypeAwareTime::Time(), Integrator::timestep, orsa::twopi, and Body::velocity().
Referenced by OptimizedOrbitPositions::PropagatedPosVel().
00884 { 00885 00886 std::sort(frames.begin(),frames.end()); 00887 00888 /* 00889 for (unsigned int k=0;k<frames.size();++k) { 00890 ORSA_ERROR("OptimizedOrbitPositions::PropagatedOrbit(...) ==> frame[%i] time: %f dt: %f",k,frames[k].GetTime(),(frames[k]-final_time).absolute().GetDouble()); 00891 } 00892 */ 00893 00894 if (!integrate) { 00895 OrbitWithEpoch oe(_orbit); 00896 oe.M += twopi*(final_time.Time() - _orbit.epoch.Time())/(_orbit.Period()); 00897 oe.M = fmod(10*twopi+fmod(oe.M,twopi),twopi); 00898 oe.epoch = final_time; 00899 return (oe); 00900 } 00901 00902 Frame start_frame; 00903 00904 if (frames.size() > 0) { 00905 00906 if (final_time <= frames[0]) { 00907 start_frame = frames[0]; 00908 // ORSA_ERROR("OptimizedOrbitPositions::PropagatedOrbit(...) ==> starting from a saved frame..."); 00909 } else if (final_time >= frames[frames.size()-1]) { 00910 start_frame = frames[frames.size()-1]; 00911 // ORSA_ERROR("OptimizedOrbitPositions::PropagatedOrbit(...) ==> starting from a saved frame..."); 00912 } else { 00913 unsigned int k=1; 00914 while (k < frames.size()) { 00915 00916 if ( (final_time >= frames[k-1]) && (final_time <= frames[k]) ) { 00917 if ((final_time-frames[k-1]).absolute() < (frames[k]-final_time).absolute()) { 00918 start_frame = frames[k-1]; 00919 // ORSA_ERROR("OptimizedOrbitPositions::PropagatedOrbit(...) ==> starting from a saved frame..."); 00920 break; 00921 } else { 00922 start_frame = frames[k]; 00923 // ORSA_ERROR("OptimizedOrbitPositions::PropagatedOrbit(...) ==> starting from a saved frame..."); 00924 break; 00925 } 00926 } 00927 00928 ++k; 00929 } 00930 } 00931 00932 } else { 00933 00934 // ORSA_ERROR("OptimizedOrbitPositions::PropagatedOrbit(...) ==> first call..."); 00935 00936 SetupSolarSystem(start_frame,l,_orbit.epoch); 00937 // start_frame.SetDate(_orbit.epoch); 00938 00939 const JPLBody Sun(SUN,_orbit.epoch); 00940 00941 Body b("object"); 00942 Vector r, v; 00943 _orbit.RelativePosVel(r,v); 00944 r += Sun.position(); 00945 v += Sun.velocity(); 00946 // cerr << "b.position: " << b.position.x << " " << b.position.y << " " << b.position.z << endl; 00947 b.SetPosition(r); 00948 b.SetVelocity(v); 00949 00950 start_frame.push_back(b); 00951 00952 frames.push_back(start_frame); 00953 } 00954 00955 Radau15 itg; 00956 itg.accuracy = 1.0e-12; 00957 itg.timestep = FromUnits(1.0,DAY); 00958 00959 Evolution evol; 00960 evol.SetInteraction(NEWTON); 00961 evol.SetIntegrator(&itg); 00962 evol.push_back(start_frame); 00963 evol.SetMaxUnsavedSubSteps(100000); 00964 // obs_utat.SetDate(final_time.GetDate()); 00965 // evol.sample_period = orbit_epoch_frame.Time() - obs_utat.Time(); // important, otherwise the final frame is not saved 00966 // evol.sample_period = (orbit_epoch_frame.Time() - obs_utat.Time())*(1.0-1.0e-8); // important, otherwise the final frame is not saved 00967 // evol.sample_period = (start_frame.Time() - obs_utat.Time())*(1.0-1.0e-8); // important, otherwise the final frame is not saved 00968 // evol.sample_period = (start_frame.Time() - obs_utat.Time()); 00969 // evol.sample_period = start_frame - final_time; 00970 evol.SetSamplePeriod(final_time - start_frame); 00971 evol.Integrate(final_time,true); 00972 00973 Frame last_frame = evol[evol.size()-1]; 00974 00975 // don't add the frame if the size of evol is 1, 00976 // because this means that the integration was not needed, 00977 // and the 'frames' already contains it. 00978 if (evol.size() > 1) frames.push_back(last_frame); 00979 00980 const Vector relative_position = last_frame[last_frame.size()-1].position() - last_frame[0].position(); 00981 const Vector relative_velocity = last_frame[last_frame.size()-1].velocity() - last_frame[0].velocity(); 00982 00983 OrbitWithEpoch oe; 00984 oe.Compute(relative_position,relative_velocity,GetG()*GetMSun(),final_time); 00985 00986 return (oe); 00987 }
void PropagatedPosVel | ( | const UniverseTypeAwareTime & | final_time, | |
Vector & | position, | |||
Vector & | velocity, | |||
bool | integrate = true | |||
) |
Definition at line 1176 of file orsa_orbit.cc.
References OptimizedOrbitPositions::PropagatedOrbit(), and OrbitWithEpoch::RelativePosVel().
01176 { 01177 OrbitWithEpoch oe = PropagatedOrbit(final_time,integrate); 01178 oe.RelativePosVel(position,velocity,final_time); 01179 }
Sky PropagatedSky_J2000 | ( | const UniverseTypeAwareTime & | , | |
const std::string & | obscode, | |||
const bool | integrate = true , |
|||
const bool | light_time_corrections = true | |||
) |