#include <orsa_file.h>
Inheritance diagram for JPLDastcomUnnumFile:
Public Member Functions | |
JPLDastcomUnnumFile () | |
virtual | ~JPLDastcomUnnumFile () |
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 288 of file orsa_file.h.
Definition at line 2717 of file orsa_file.cc.
References AsteroidDatabaseFile::db.
02717 : AsteroidDatabaseFile() { 02718 db = new AsteroidDatabase(); 02719 }
~JPLDastcomUnnumFile | ( | ) | [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 2726 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, and orsa::universe.
02726 { 02727 02728 Open(); 02729 02730 if (status != OPEN_R) { 02731 ORSA_ERROR("Status error!"); 02732 return; 02733 } 02734 02735 db->clear(); 02736 02737 char line[300]; 02738 02739 double a,e,i,omega_node,omega_pericenter,M; 02740 // int n; 02741 string number,name,orbit_computer,absolute_magnitude,arc,numobs,epoch; 02742 string mean_anomaly,pericenter,node,inclination,eccentricity,semimajor_axis; 02743 // string ceu; 02744 02745 string year,month,day; 02746 // int y,m,d; 02747 02748 Asteroid ast; 02749 02750 // Date tmp_date(TDT); 02751 Date tmp_date; 02752 02753 unsigned int local_index = 0; 02754 bool bool_stop=false; 02755 bool bool_pause=false; 02756 REWIND_FILE(file); 02757 while ((GETS_FILE(line,300,file)) != 0) { 02758 02759 if (strlen(line) < 100) continue; // not a good line, maybe a comment or a white line... 02760 02761 if (line[0]=='-') continue; // comment 02762 02763 local_index++; 02764 read_progress(local_index,bool_pause,bool_stop); 02765 02766 if (bool_stop) break; 02767 02768 while (bool_pause) { 02769 sleep(1); 02770 read_progress(local_index,bool_pause,bool_stop); 02771 } 02772 02773 // uncomment the ones used 02774 // number.assign(line,0,5); 02775 name.assign(line,0,11); 02776 02777 epoch.assign(line,12,5); 02778 // 02779 semimajor_axis.assign(line,18,11); 02780 eccentricity.assign(line,30,10); 02781 inclination.assign(line,41,9); 02782 pericenter.assign(line,51,9); 02783 node.assign(line,61,9); 02784 mean_anomaly.assign(line,71,11); 02785 ////////////// 02786 02787 ast.n = atoi(number.c_str()); 02788 02789 ast.name = name; 02790 remove_leading_trailing_spaces(ast.name); 02791 02792 a = atof(semimajor_axis.c_str()); 02793 e = atof(eccentricity.c_str()); 02794 i = (pi/180)*atof(inclination.c_str()); 02795 omega_node = (pi/180)*atof(node.c_str()); 02796 omega_pericenter = (pi/180)*atof(pericenter.c_str()); 02797 M = (pi/180)*atof(mean_anomaly.c_str()); 02798 02799 // checks 02800 if ((a==0.0)) { 02801 // bad line... 02802 continue; 02803 } 02804 02805 ast.orb.a = FromUnits(a,AU); 02806 ast.orb.e = e; 02807 ast.orb.i = i; 02808 ast.orb.omega_node = omega_node; 02809 ast.orb.omega_pericenter = omega_pericenter; 02810 ast.orb.M = M; 02811 02812 // year.assign(epoch,0,4); 02813 // month.assign(epoch,4,2); 02814 // day.assign(epoch,6,2); 02815 02816 // y = atoi(year.c_str()); 02817 // m = atoi(month.c_str()); 02818 // d = atoi(day.c_str()); 02819 02820 tmp_date.SetJulian(2400000.5+atof(epoch.c_str()),TDT); 02821 ast.orb.epoch.SetDate(tmp_date); 02822 // ast.orb.T = sqrt(4*pisq/(GetG()*GetMSun())*pow(FromUnits(ast.orb.a,AU),3)); 02823 ast.orb.mu = GetG()*GetMSun(); 02824 // ast.orb.ref_body = orb_ref_body; 02825 02826 /* 02827 switch (universe->GetReferenceSystem()) { 02828 case ECLIPTIC: break; 02829 case EQUATORIAL: 02830 { 02831 // cerr << "Rotating astorb orbit..." << endl; 02832 const double obleq_rad = obleq(tmp_date).GetRad(); 02833 Vector position,velocity; 02834 ast.orb.RelativePosVel(position,velocity); 02835 position.rotate(0.0,obleq_rad,0.0); 02836 velocity.rotate(0.0,obleq_rad,0.0); 02837 ast.orb.Compute(position,velocity,ast.orb.mu,ast.orb.epoch); 02838 } 02839 break; 02840 } 02841 */ 02842 02843 switch (universe->GetReferenceSystem()) { 02844 case ECLIPTIC: break; 02845 case EQUATORIAL: 02846 { 02847 Vector position,velocity; 02848 ast.orb.RelativePosVel(position,velocity); 02849 EclipticToEquatorial_J2000(position); 02850 EclipticToEquatorial_J2000(velocity); 02851 ast.orb.Compute(position,velocity,ast.orb.mu,ast.orb.epoch); 02852 } 02853 break; 02854 } 02855 02856 db->push_back(ast); 02857 } 02858 02859 read_finished(); 02860 }
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().