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