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

References AsteroidDatabaseFile::db.

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

~JPLDastcomNumFile (  )  [virtual]

Definition at line 2575 of file orsa_file.cc.

References AsteroidDatabaseFile::db.

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


Member Function Documentation

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; }

void Open (  )  [inherited]

void Read (  )  [virtual]

Implements ReadFile.

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

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

Here is the call graph for this function:

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

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

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]

FILE_TYPE file [protected, inherited]

std::string filename [protected, inherited]

FILE_STATUS status [protected, inherited]


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

Generated on Sat Aug 15 19:04:35 2009 for liborsa by  doxygen 1.5.9