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

References AsteroidDatabaseFile::db.

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

~JPLDastcomUnnumFile (  )  [virtual]

Definition at line 2723 of file orsa_file.cc.

References AsteroidDatabaseFile::db.

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


Member Function Documentation

void Read (  )  [virtual]

Implements ReadFile.

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

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

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 Sat May 10 00:04:10 2008 for liborsa by  doxygen 1.5.5