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