JPLDastcomNumFile Class Reference

#include <orsa_file.h>

Inheritance diagram for JPLDastcomNumFile:

Inheritance graph
[legend]
Collaboration diagram for JPLDastcomNumFile:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 JPLDastcomNumFile ()
virtual ~JPLDastcomNumFile ()
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

AsteroidDatabasedb

Protected Attributes

std::string filename
FILE_TYPE file
FILE_STATUS status

Constructor & Destructor Documentation

JPLDastcomNumFile  ) 
 

Definition at line 2569 of file orsa_file.cc.

02569                                        : AsteroidDatabaseFile() {
02570     db = new AsteroidDatabase();
02571   }

~JPLDastcomNumFile  )  [virtual]
 

Definition at line 2573 of file orsa_file.cc.

02573                                         {
02574     delete db;
02575     db = 0;
02576   }


Member Function Documentation

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().

00114                    {
00115     if (status != CLOSE) {
00116       CLOSE_FILE(file);
00117       status = CLOSE;
00118     }
00119   }

virtual std::string GetFileName  )  const [inline, virtual, inherited]
 

Definition at line 99 of file orsa_file.h.

References File::filename.

Referenced by LocationFile::ObsPos(), and OrsaFile::Read().

00099 { return filename; }

void Open  )  [inherited]
 

Definition at line 59 of file orsa_file.cc.

References orsa::CLOSE, OPEN_FILE, orsa::OPEN_R, OPEN_READ, and ORSA_ERROR.

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 2578 of file orsa_file.cc.

References Orbit::a, orsa::AU, OrbitWithEpoch::Compute(), 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(), orsa::TDT, and orsa::universe.

02578                                {
02579     
02580     Open();
02581     
02582     if (status != OPEN_R) {
02583       ORSA_ERROR("Status error!");
02584       return;
02585     }
02586     
02587     db->clear();
02588     
02589     char line[300];
02590     
02591     double a,e,i,omega_node,omega_pericenter,M;
02592     // int    n;
02593     string number,name,orbit_computer,absolute_magnitude,arc,numobs,epoch;
02594     string mean_anomaly,pericenter,node,inclination,eccentricity,semimajor_axis;
02595     // string ceu;
02596     
02597     string year,month,day;
02598     // int    y,m,d;
02599     
02600     Asteroid ast;
02601     
02602     // Date tmp_date(TDT);
02603     Date tmp_date;
02604     
02605     unsigned int local_index = 0;
02606     bool bool_stop=false;
02607     bool bool_pause=false;
02608     REWIND_FILE(file);
02609     while ((GETS_FILE(line,300,file)) != 0) {
02610       
02611       if (strlen(line) < 100) continue; // not a good line, maybe a comment or a white line...
02612       
02613       if (line[0]=='-') continue; // comment
02614       
02615       local_index++;
02616       read_progress(local_index,bool_pause,bool_stop);
02617       
02618       if (bool_stop) break;
02619       
02620       while (bool_pause) {
02621         sleep(1);
02622         read_progress(local_index,bool_pause,bool_stop);
02623       }
02624       
02625       // uncomment the ones used
02626       number.assign(line,0,5);
02627       name.assign(line,6,17); 
02628       
02629       epoch.assign(line,24,5);
02630       //
02631       semimajor_axis.assign(line,30,10);
02632       eccentricity.assign(line,41,10);
02633       inclination.assign(line,52,9);
02634       pericenter.assign(line,62,9);
02635       node.assign(line,72,9);
02636       mean_anomaly.assign(line,82,11);
02637       //////////////
02638       
02639       ast.n = atoi(number.c_str());
02640       
02641       ast.name = name;
02642       remove_leading_trailing_spaces(ast.name);
02643       
02644       a                = atof(semimajor_axis.c_str());
02645       e                = atof(eccentricity.c_str());
02646       i                = (pi/180)*atof(inclination.c_str());
02647       omega_node       = (pi/180)*atof(node.c_str());
02648       omega_pericenter = (pi/180)*atof(pericenter.c_str());
02649       M                = (pi/180)*atof(mean_anomaly.c_str());
02650       
02651       // checks
02652       if ((ast.n==0) || (a==0.0)) {
02653         // bad line...
02654         continue;
02655       }
02656       
02657       ast.orb.a                = FromUnits(a,AU);
02658       ast.orb.e                = e;
02659       ast.orb.i                = i;
02660       ast.orb.omega_node       = omega_node;
02661       ast.orb.omega_pericenter = omega_pericenter;
02662       ast.orb.M                = M;
02663       
02664       // year.assign(epoch,0,4);
02665       // month.assign(epoch,4,2);
02666       // day.assign(epoch,6,2);
02667       
02668       // y = atoi(year.c_str());
02669       // m = atoi(month.c_str());
02670       // d = atoi(day.c_str());
02671       
02672       tmp_date.SetJulian(2400000.5+atof(epoch.c_str()),TDT);
02673       ast.orb.epoch.SetDate(tmp_date);
02674       // ast.orb.T = sqrt(4*pisq/(GetG()*GetMSun())*pow(FromUnits(ast.orb.a,AU),3));
02675       ast.orb.mu = GetG()*GetMSun();
02676       // ast.orb.ref_body = orb_ref_body;
02677       
02678       /* 
02679          switch (universe->GetReferenceSystem()) {
02680          case ECLIPTIC: break;
02681          case EQUATORIAL:
02682          { 
02683          // cerr << "Rotating astorb orbit..." << endl;
02684          const double obleq_rad = obleq(tmp_date).GetRad();
02685          Vector position,velocity;
02686          ast.orb.RelativePosVel(position,velocity);
02687          position.rotate(0.0,obleq_rad,0.0);
02688          velocity.rotate(0.0,obleq_rad,0.0);
02689          ast.orb.Compute(position,velocity,ast.orb.mu,ast.orb.epoch);
02690          }
02691          break;
02692          }
02693       */
02694       
02695       switch (universe->GetReferenceSystem()) {
02696       case ECLIPTIC: break;
02697       case EQUATORIAL:
02698         { 
02699           Vector position,velocity;
02700           ast.orb.RelativePosVel(position,velocity);
02701           EclipticToEquatorial_J2000(position);
02702           EclipticToEquatorial_J2000(velocity);
02703           ast.orb.Compute(position,velocity,ast.orb.mu,ast.orb.epoch);
02704         }
02705         
02706         break;
02707       }
02708       
02709       db->push_back(ast);
02710     }
02711     
02712     read_finished();
02713   }

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().

00257 { };

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().

00256 { };

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().

00101                                                         {
00102       if (status != CLOSE) Close();
00103       filename = name_in;
00104     }

Here is the call graph for this function:


Member Data Documentation

AsteroidDatabase* db [inherited]
 

Definition at line 254 of file orsa_file.h.

Referenced by AsteroidDatabaseFile::AsteroidDatabaseFile().

FILE_TYPE file [protected, inherited]
 

Definition at line 113 of file orsa_file.h.

Referenced by File::Close(), and File::File().

std::string filename [protected, inherited]
 

Definition at line 112 of file orsa_file.h.

Referenced by File::GetFileName(), and File::SetFileName().

FILE_STATUS status [protected, inherited]
 

Definition at line 114 of file orsa_file.h.

Referenced by File::Close(), File::File(), and File::SetFileName().


The documentation for this class was generated from the following files:
Generated on Tue Jan 11 15:28:29 2005 for liborsa by  doxygen 1.4.0