#include <orsa_file.h>
Inheritance diagram for JPLDastcomCometFile:
Public Member Functions | |
JPLDastcomCometFile () | |
virtual | ~JPLDastcomCometFile () |
void | Read () |
virtual void | read_progress (int, bool &, bool &) |
virtual void | read_finished () |
void | Open () |
void | Close () |
virtual std::string | GetFileName () const |
virtual void | SetFileName (std::string name_in) |
virtual void | SetFileName (char *name_in) |
Public Attributes | |
AsteroidDatabase * | db |
Protected Attributes | |
std::string | filename |
FILE_TYPE | file |
FILE_STATUS | status |
Definition at line 295 of file orsa_file.h.
Definition at line 2864 of file orsa_file.cc.
References AsteroidDatabaseFile::db.
02864 : AsteroidDatabaseFile() { 02865 db = new AsteroidDatabase(); 02866 }
~JPLDastcomCometFile | ( | ) | [virtual] |
void Close | ( | ) | [inherited] |
Definition at line 114 of file orsa_file.cc.
References orsa::CLOSE, CLOSE_FILE, File::file, and File::status.
Referenced by SWIFTFile::AsteroidsInFile(), ReadWriteFile::Open(), OrsaFile::Read(), OrsaConfigFile::Read(), SWIFTFile::Read(), Config::read_from_file(), File::SetFileName(), OrsaFile::Write(), OrsaConfigFile::Write(), Config::write_to_file(), and File::~File().
virtual std::string GetFileName | ( | ) | const [inline, virtual, inherited] |
Definition at line 99 of file orsa_file.h.
References File::filename.
Referenced by OrsaFile::Read().
00099 { return filename; }
void Open | ( | ) | [inherited] |
Definition at line 59 of file orsa_file.cc.
References orsa::CLOSE, File::file, File::filename, OPEN_FILE, orsa::OPEN_R, OPEN_READ, ORSA_ERROR, and File::status.
Referenced by SWIFTFile::AsteroidsInFile(), Mercury5IntegrationFile::Read(), TLEFile::Read(), NEODYSCAT::Read(), JPLDastcomCometFile::Read(), JPLDastcomUnnumFile::Read(), JPLDastcomNumFile::Read(), AstDySMatrixFile::Read(), RadauModIntegrationFile::Read(), SWIFTFile::Read(), LocationFile::Read(), RWOFile::Read(), MPCObsFile::Read(), MPCCometFile::Read(), MPCOrbFile::Read(), and AstorbFile::Read().
00059 { 00060 if (status != CLOSE) return; 00061 00062 file = OPEN_FILE(filename.c_str(),OPEN_READ); 00063 00064 if (file == 0) { 00065 ORSA_ERROR("Can't open file %s",filename.c_str()); 00066 } else { 00067 status = OPEN_R; 00068 } 00069 }
void Read | ( | ) | [virtual] |
Implements ReadFile.
Definition at line 2873 of file orsa_file.cc.
References orsa::AU, AsteroidDatabaseFile::db, orsa::ECLIPTIC, orsa::EclipticToEquatorial_J2000(), orsa::EQUATORIAL, orsa::FromUnits(), orsa::GetG(), orsa::GetMSun(), Universe::GetReferenceSystem(), GETS_FILE, orsa::M, ReadFile::Open(), orsa::OPEN_R, ORSA_ERROR, orsa::pi, AsteroidDatabaseFile::read_finished(), AsteroidDatabaseFile::read_progress(), orsa::remove_leading_trailing_spaces(), REWIND_FILE, Date::SetJulian(), File::status, orsa::TDT, UniverseTypeAwareTime::Time(), orsa::twopi, and orsa::universe.
02873 { 02874 02875 Open(); 02876 02877 if (status != OPEN_R) { 02878 ORSA_ERROR("Status error!"); 02879 return; 02880 } 02881 02882 db->clear(); 02883 02884 char line[300]; 02885 02886 double a,e,i,omega_node,omega_pericenter,M; 02887 string number,type,name,orbit_computer,absolute_magnitude,arc,numobs,epoch; 02888 string mean_anomaly,pericenter,node,inclination,eccentricity,semimajor_axis; 02889 // string ceu; 02890 string pericenter_distance,pericenter_epoch; 02891 02892 string year,month,day; 02893 int y=0,m=0; 02894 double frac_day; 02895 02896 Asteroid ast; 02897 02898 double q; 02899 02900 REWIND_FILE(file); 02901 02902 // Date tmp_date(TDT); 02903 Date tmp_date; 02904 02905 unsigned int local_index = 0; 02906 bool bool_stop=false; 02907 bool bool_pause=false; 02908 02909 while ( (GETS_FILE(line,300,file)) != 0 ) { 02910 02911 // if (strlen(line) < 90) continue; // not a good line, maybe a comment or a white line... 02912 02913 if (line[0]=='-') continue; // comment 02914 02915 ++local_index; 02916 read_progress(local_index,bool_pause,bool_stop); 02917 02918 if (bool_stop) break; 02919 02920 while (bool_pause) { 02921 // cerr << "AstorbFile::Read() sleeping..." << endl; 02922 sleep(1); 02923 read_progress(local_index,bool_pause,bool_stop); 02924 } 02925 02926 // uncomment the ones used 02927 // number.assign(line,0,4); 02928 // type.assign(line,4,1); 02929 // name.assign(line,5,7); 02930 name.assign(line,0,37); 02931 epoch.assign(line,38,5); 02932 // cerr << "comet name: " << name << endl; 02933 pericenter_distance.assign(line,44,10); 02934 eccentricity.assign(line,55,10); 02935 inclination.assign(line,66,9); 02936 pericenter.assign(line,76,9); 02937 node.assign(line,86,9); 02938 // 02939 pericenter_epoch.assign(line,96,14); 02940 02941 // conversions 02942 02943 ast.name = name; 02944 remove_leading_trailing_spaces(ast.name); 02945 02946 // ast.n = 0; // arbitrary, for the moment 02947 ast.n = 0; 02948 02949 // ast.mag = atof(absolute_magnitude.c_str()); 02950 02951 // a = atof(semimajor_axis.c_str()); 02952 e = atof(eccentricity.c_str()); 02953 02954 // to be tested... 02955 q = atof(pericenter_distance.c_str()); 02956 if (e == 1.0) { 02957 a = q; 02958 } else { 02959 a = q/fabs(1.0-e); 02960 } 02961 02962 // checks 02963 if ((q==0.0)) { 02964 // bad line... 02965 continue; 02966 } 02967 02968 i = (pi/180)*atof(inclination.c_str()); 02969 omega_node = (pi/180)*atof(node.c_str()); 02970 omega_pericenter = (pi/180)*atof(pericenter.c_str()); 02971 // M = (pi/180)*atof(mean_anomaly.c_str()); 02972 02973 tmp_date.SetJulian(2400000.5+atof(epoch.c_str()),TDT); 02974 ast.orb.epoch.SetDate(tmp_date); 02975 02976 year.assign(pericenter_epoch,0,4); 02977 month.assign(pericenter_epoch,4,2); 02978 day.assign(pericenter_epoch,6,8); 02979 02980 y = atoi(year.c_str()); 02981 m = atoi(month.c_str()); 02982 frac_day = atof(day.c_str()); 02983 02984 Date peri_date; 02985 peri_date.SetGregor(y,m,frac_day,TDT); 02986 UniverseTypeAwareTime pericenter_passage(peri_date); 02987 02988 ast.orb.mu = GetG()*GetMSun(); 02989 02990 ast.orb.a = FromUnits(a,AU); 02991 ast.orb.e = e; 02992 ast.orb.i = i; 02993 ast.orb.omega_node = omega_node; 02994 ast.orb.omega_pericenter = omega_pericenter; 02995 // 02996 M = ((ast.orb.epoch.Time() - pericenter_passage.Time())/ast.orb.Period())*twopi; 02997 M = fmod(10*twopi+fmod(M,twopi),twopi); 02998 // 02999 ast.orb.M = M; 03000 03001 // cerr << "comet: " << ast.name << " q: " << q << " e: " << e << " i: " << i*(180/pi) << endl; 03002 03003 /* 03004 switch (universe->GetReferenceSystem()) { 03005 case ECLIPTIC: break; 03006 case EQUATORIAL: 03007 { 03008 // cerr << "Rotating astorb orbit..." << endl; 03009 const double obleq_rad = obleq(tmp_date).GetRad(); 03010 Vector position,velocity; 03011 ast.orb.RelativePosVel(position,velocity); 03012 position.rotate(0.0,obleq_rad,0.0); 03013 velocity.rotate(0.0,obleq_rad,0.0); 03014 ast.orb.Compute(position,velocity,ast.orb.mu,ast.orb.epoch); 03015 } 03016 break; 03017 } 03018 */ 03019 03020 switch (universe->GetReferenceSystem()) { 03021 case ECLIPTIC: break; 03022 case EQUATORIAL: 03023 { 03024 Vector position,velocity; 03025 ast.orb.RelativePosVel(position,velocity); 03026 EclipticToEquatorial_J2000(position); 03027 EclipticToEquatorial_J2000(velocity); 03028 ast.orb.Compute(position,velocity,ast.orb.mu,ast.orb.epoch); 03029 } 03030 break; 03031 } 03032 03033 db->push_back(ast); 03034 03035 } 03036 03037 read_finished(); 03038 }
Here is the call graph for this function:
virtual void read_finished | ( | ) | [inline, virtual, inherited] |
Definition at line 257 of file orsa_file.h.
Referenced by NEODYSCAT::Read(), JPLDastcomCometFile::Read(), JPLDastcomUnnumFile::Read(), JPLDastcomNumFile::Read(), AstDySMatrixFile::Read(), MPCCometFile::Read(), MPCOrbFile::Read(), and AstorbFile::Read().
virtual void read_progress | ( | int | , | |
bool & | , | |||
bool & | ||||
) | [inline, virtual, inherited] |
Definition at line 256 of file orsa_file.h.
Referenced by NEODYSCAT::Read(), JPLDastcomCometFile::Read(), JPLDastcomUnnumFile::Read(), JPLDastcomNumFile::Read(), AstDySMatrixFile::Read(), MPCCometFile::Read(), MPCOrbFile::Read(), and AstorbFile::Read().
virtual void SetFileName | ( | char * | name_in | ) | [inline, virtual, inherited] |
Definition at line 106 of file orsa_file.h.
References File::SetFileName().
00106 { 00107 std::string n = name_in; 00108 SetFileName (n); 00109 }
Here is the call graph for this function:
virtual void SetFileName | ( | std::string | name_in | ) | [inline, virtual, inherited] |
Definition at line 101 of file orsa_file.h.
References File::Close(), orsa::CLOSE, File::filename, and File::status.
Referenced by OrsaConfigFile::OrsaConfigFile(), and File::SetFileName().
Here is the call graph for this function:
AsteroidDatabase* db [inherited] |
Definition at line 254 of file orsa_file.h.
Referenced by AstDySMatrixFile::AstDySMatrixFile(), AsteroidDatabaseFile::AsteroidDatabaseFile(), AstorbFile::AstorbFile(), JPLDastcomCometFile::JPLDastcomCometFile(), JPLDastcomNumFile::JPLDastcomNumFile(), JPLDastcomUnnumFile::JPLDastcomUnnumFile(), MPCCometFile::MPCCometFile(), MPCOrbFile::MPCOrbFile(), NEODYSCAT::NEODYSCAT(), NEODYSCAT::Read(), JPLDastcomCometFile::Read(), JPLDastcomUnnumFile::Read(), JPLDastcomNumFile::Read(), AstDySMatrixFile::Read(), MPCCometFile::Read(), MPCOrbFile::Read(), AstorbFile::Read(), AstDySMatrixFile::~AstDySMatrixFile(), AstorbFile::~AstorbFile(), JPLDastcomCometFile::~JPLDastcomCometFile(), JPLDastcomNumFile::~JPLDastcomNumFile(), JPLDastcomUnnumFile::~JPLDastcomUnnumFile(), MPCCometFile::~MPCCometFile(), MPCOrbFile::~MPCOrbFile(), and NEODYSCAT::~NEODYSCAT().
FILE_TYPE file [protected, inherited] |
Definition at line 113 of file orsa_file.h.
Referenced by SWIFTFile::AsteroidsInFile(), File::Close(), File::File(), ReadWriteFile::Open(), WriteFile::Open(), ReadFile::Open(), Mercury5IntegrationFile::Read(), OrsaFile::Read(), OrsaConfigFile::Read(), SWIFTFile::Read(), LocationFile::Read(), RWOFile::Read(), MPCObsFile::Read(), MPCCometFile::Read(), MPCOrbFile::Read(), AstorbFile::Read(), OrsaFile::Write(), and OrsaConfigFile::Write().
std::string filename [protected, inherited] |
Definition at line 112 of file orsa_file.h.
Referenced by File::GetFileName(), ReadWriteFile::Open(), WriteFile::Open(), ReadFile::Open(), and File::SetFileName().
FILE_STATUS status [protected, inherited] |
Definition at line 114 of file orsa_file.h.
Referenced by File::Close(), File::File(), Mercury5IntegrationFile::Mercury5IntegrationFile(), ReadWriteFile::Open(), WriteFile::Open(), ReadFile::Open(), Mercury5IntegrationFile::Read(), TLEFile::Read(), NEODYSCAT::Read(), JPLDastcomCometFile::Read(), JPLDastcomUnnumFile::Read(), JPLDastcomNumFile::Read(), AstDySMatrixFile::Read(), RadauModIntegrationFile::Read(), OrsaFile::Read(), OrsaConfigFile::Read(), SWIFTFile::Read(), LocationFile::Read(), MPCObsFile::Read(), MPCCometFile::Read(), MPCOrbFile::Read(), AstorbFile::Read(), File::SetFileName(), OrsaFile::Write(), and OrsaConfigFile::Write().