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


Detailed Description

Definition at line 281 of file orsa_file.h.


Constructor & Destructor Documentation

Definition at line 2570 of file orsa_file.cc.

References AsteroidDatabaseFile::db.

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

~JPLDastcomNumFile (  )  [virtual]

Definition at line 2574 of file orsa_file.cc.

References AsteroidDatabaseFile::db.

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


Member Function Documentation

void Read (  )  [virtual]

Implements ReadFile.

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

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

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:46 2008 for liborsa by  doxygen 1.5.5