NEODyS and AstDyS .cat file. More...
#include <orsa_file.h>
Public Member Functions | |
NEODYSCAT () | |
~NEODYSCAT () | |
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 |
NEODyS and AstDyS .cat file.
Definition at line 272 of file orsa_file.h.
NEODYSCAT | ( | ) |
Definition at line 3047 of file orsa_file.cc.
References AsteroidDatabaseFile::db.
03047 : AsteroidDatabaseFile() { 03048 // status = CLOSE; 03049 db = new AsteroidDatabase(); 03050 }
~NEODYSCAT | ( | ) |
Definition at line 3052 of file orsa_file.cc.
References AsteroidDatabaseFile::db.
void Close | ( | ) | [inherited] |
Definition at line 116 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 61 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().
void Read | ( | ) | [virtual] |
Implements ReadFile.
Definition at line 3057 of file orsa_file.cc.
References Orbit::a, orsa::AU, OrbitWithEpoch::Compute(), AsteroidDatabaseFile::db, Orbit::e, orsa::ECLIPTIC, orsa::EclipticToEquatorial_J2000(), OrbitWithEpoch::epoch, orsa::EQUATORIAL, orsa::FromUnits(), orsa::GetG(), orsa::GetMSun(), Universe::GetReferenceSystem(), GETS_FILE, Orbit::i, Orbit::M, orsa::M, Orbit::mu, Asteroid::n, Asteroid::name, Orbit::omega_node, Orbit::omega_pericenter, ReadFile::Open(), orsa::OPEN_R, Asteroid::orb, ORSA_ERROR, orsa::pi, AsteroidDatabaseFile::read_finished(), AsteroidDatabaseFile::read_progress(), OrbitWithEpoch::RelativePosVel(), orsa::remove_leading_trailing_spaces(), REWIND_FILE, UniverseTypeAwareTime::SetDate(), Date::SetJulian(), File::status, orsa::TDT, and orsa::universe.
03057 { 03058 03059 // if (status == CLOSE) Open(); 03060 03061 Open(); 03062 03063 if (status != OPEN_R) { 03064 ORSA_ERROR("Status error!"); 03065 return; 03066 } 03067 03068 db->clear(); 03069 03070 char line[300]; 03071 03072 double a,e,i,omega_node,omega_pericenter,M; 03073 // int n; 03074 string number,name,orbit_computer,absolute_magnitude,arc,numobs,epoch; 03075 string mean_anomaly,pericenter,node,inclination,eccentricity,semimajor_axis; 03076 // string ceu; 03077 03078 string year,month,day; 03079 // int y,m,d; 03080 03081 Asteroid ast; 03082 03083 // Date tmp_date(TDT); 03084 Date tmp_date; 03085 03086 unsigned int local_index = 0; 03087 bool bool_stop=false; 03088 bool bool_pause=false; 03089 REWIND_FILE(file); 03090 while ((GETS_FILE(line,300,file)) != 0) { 03091 03092 if (strlen(line) < 100) continue; // not a good line, maybe a comment or a white line... 03093 03094 if (line[0]=='!') continue; // comment 03095 03096 local_index++; 03097 read_progress(local_index,bool_pause,bool_stop); 03098 03099 if (bool_stop) break; 03100 03101 while (bool_pause) { 03102 sleep(1); 03103 read_progress(local_index,bool_pause,bool_stop); 03104 } 03105 03106 // uncomment the ones used 03107 // number.assign(line,0,5); 03108 name.assign(line,0,12); 03109 // 03110 { 03111 // remove -->'<-- 03112 string::size_type pos; 03113 while ((pos=name.find("'",0)) != string::npos) { 03114 // cerr << "name: " << name << " pos: " << pos << endl; 03115 name.erase(pos,1); 03116 } 03117 // cerr << "final name: " << name << endl; 03118 } 03119 03120 // orbit_computer.assign(line,25,15); 03121 // absolute_magnitude.assign(line,41,5); 03122 // 03123 // arc.assign(line,94,5); 03124 // numobs.assign(line,99,5); 03125 // 03126 epoch.assign(line,13,15); 03127 // 03128 semimajor_axis.assign(line,29,25); 03129 eccentricity.assign(line,54,25); 03130 inclination.assign(line,79,25); 03131 node.assign(line,104,25); 03132 pericenter.assign(line,129,25); 03133 mean_anomaly.assign(line,154,25); 03134 ////////////// 03135 03136 // ast.n = atoi(number.c_str()); 03137 // ast.n = 0; 03138 { 03139 char c; 03140 unsigned int ck; 03141 bool is_only_digit=true; 03142 for (ck=0;ck<name.size();++ck) { 03143 c = name[ck]; 03144 if (isalpha(c)) { 03145 is_only_digit=false; 03146 break; 03147 } 03148 } 03149 03150 if (is_only_digit) { 03151 ast.n = atoi(name.c_str()); 03152 } else { 03153 ast.n = 0; 03154 } 03155 } 03156 03157 ast.name = name; 03158 remove_leading_trailing_spaces(ast.name); 03159 03160 // ast.ceu = atof(ceu.c_str()); 03161 03162 // ast.mag = atof(absolute_magnitude.c_str()); 03163 03164 a = atof(semimajor_axis.c_str()); 03165 e = atof(eccentricity.c_str()); 03166 i = (pi/180)*atof(inclination.c_str()); 03167 omega_node = (pi/180)*atof(node.c_str()); 03168 omega_pericenter = (pi/180)*atof(pericenter.c_str()); 03169 M = (pi/180)*atof(mean_anomaly.c_str()); 03170 03171 ast.orb.a = FromUnits(a,AU); 03172 ast.orb.e = e; 03173 ast.orb.i = i; 03174 ast.orb.omega_node = omega_node; 03175 ast.orb.omega_pericenter = omega_pericenter; 03176 ast.orb.M = M; 03177 03178 // year.assign(epoch,0,4); 03179 // month.assign(epoch,4,2); 03180 // day.assign(epoch,6,2); 03181 03182 // y = atoi(year.c_str()); 03183 // m = atoi(month.c_str()); 03184 // d = atoi(day.c_str()); 03185 03186 tmp_date.SetJulian(2400000.5+atof(epoch.c_str()),TDT); 03187 ast.orb.epoch.SetDate(tmp_date); 03188 // ast.orb.T = sqrt(4*pisq/(GetG()*GetMSun())*pow(FromUnits(ast.orb.a,AU),3)); 03189 ast.orb.mu = GetG()*GetMSun(); 03190 // ast.orb.ref_body = orb_ref_body; 03191 03192 /* 03193 switch (universe->GetReferenceSystem()) { 03194 case ECLIPTIC: break; 03195 case EQUATORIAL: 03196 { 03197 // cerr << "Rotating astorb orbit..." << endl; 03198 const double obleq_rad = obleq(tmp_date).GetRad(); 03199 Vector position,velocity; 03200 ast.orb.RelativePosVel(position,velocity); 03201 position.rotate(0.0,obleq_rad,0.0); 03202 velocity.rotate(0.0,obleq_rad,0.0); 03203 ast.orb.Compute(position,velocity,ast.orb.mu,ast.orb.epoch); 03204 } 03205 03206 break; 03207 } 03208 */ 03209 03210 switch (universe->GetReferenceSystem()) { 03211 case ECLIPTIC: break; 03212 case EQUATORIAL: 03213 { 03214 Vector position,velocity; 03215 ast.orb.RelativePosVel(position,velocity); 03216 EclipticToEquatorial_J2000(position); 03217 EclipticToEquatorial_J2000(velocity); 03218 ast.orb.Compute(position,velocity,ast.orb.mu,ast.orb.epoch); 03219 } 03220 break; 03221 } 03222 03223 db->push_back(ast); 03224 } 03225 03226 read_finished(); 03227 }
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 }
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().
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().