JPLDastcomUnnumFile Class Reference

#include <orsa_file.h>

Inheritance diagram for JPLDastcomUnnumFile:

Inheritance graph
[legend]
Collaboration diagram for JPLDastcomUnnumFile:

Collaboration graph
[legend]

List of all members.

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

AsteroidDatabasedb

Protected Attributes

std::string filename
FILE_TYPE file
FILE_STATUS status


Detailed Description

Definition at line 288 of file orsa_file.h.


Constructor & Destructor Documentation

Definition at line 2718 of file orsa_file.cc.

References AsteroidDatabaseFile::db.

02718                                            : AsteroidDatabaseFile() {
02719     db = new AsteroidDatabase();
02720   }

~JPLDastcomUnnumFile (  )  [virtual]

Definition at line 2722 of file orsa_file.cc.

References AsteroidDatabaseFile::db.

02722                                             {
02723     delete db;
02724     db = 0;
02725   }


Member Function Documentation

void Read (  )  [virtual]

Implements ReadFile.

Definition at line 2727 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.

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

Here is the call graph for this function:

virtual void read_progress ( int  ,
bool &  ,
bool &   
) [inline, virtual, inherited]

virtual void read_finished (  )  [inline, virtual, inherited]

void Open (  )  [inherited]

void Close (  )  [inherited]

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

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

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:


Member Data Documentation

AsteroidDatabase* db [inherited]

std::string filename [protected, inherited]

FILE_TYPE file [protected, inherited]

FILE_STATUS status [protected, inherited]


The documentation for this class was generated from the following files:

Generated on Thu Feb 14 21:41:47 2008 for liborsa by  doxygen 1.5.5