Mercury5IntegrationFile Class Reference

Mercury 5 integration input files. More...

#include <orsa_file.h>

Inheritance diagram for Mercury5IntegrationFile:

Inheritance graph
[legend]
Collaboration diagram for Mercury5IntegrationFile:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Mercury5IntegrationFile (OrbitStream &)
 Mercury5IntegrationFile (OrbitStream &, M5COLS)
void Read ()
void Open ()
void Close ()
virtual std::string GetFileName () const
virtual void SetFileName (std::string name_in)
virtual void SetFileName (char *name_in)

Public Attributes

M5COLS cols

Protected Attributes

std::string filename
FILE_TYPE file
FILE_STATUS status

Detailed Description

Mercury 5 integration input files.

Definition at line 149 of file orsa_file.h.


Constructor & Destructor Documentation

Mercury5IntegrationFile OrbitStream  ) 
 

Definition at line 35 of file orsa_file_mercury.cc.

References orsa::C10, orsa::CLOSE, and Mercury5IntegrationFile::cols.

00035                                                                     {
00036     os = &osin;
00037     cols = C10;
00038     status = CLOSE;
00039   }

Mercury5IntegrationFile OrbitStream ,
M5COLS 
 

Definition at line 41 of file orsa_file_mercury.cc.

References orsa::CLOSE, and Mercury5IntegrationFile::cols.

00041                                                                                  {
00042     os   = &osin;
00043     cols = c_in; 
00044     status = CLOSE;
00045   }


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 47 of file orsa_file_mercury.cc.

References Orbit::a, orsa::AU, orsa::C10, orsa::C7, orsa::CLOSE, Mercury5IntegrationFile::cols, orsa::DAY, Orbit::e, OrbitWithEpoch::epoch, orsa::FromUnits(), GETS_FILE, Orbit::i, OrbitStream::label, orsa::label(), Orbit::M, orsa::M, Orbit::omega_node, Orbit::omega_pericenter, ReadFile::Open(), orsa::OPEN_R, orsa::pi, REWIND_FILE, UniverseTypeAwareTime::SetTime(), and OrbitStream::timestep.

00047                                      {
00048     
00049     // if (file == 0) Open();
00050     if (status == CLOSE) Open();
00051     
00052     if (status != OPEN_R){ 
00053       cerr << "problems encountered when opening file.\n" << endl;
00054     }
00055     
00056     os->resize(0);
00057     os->timestep = 0.0;
00058     OrbitWithEpoch fo;
00059     REWIND_FILE(file); 
00060     
00061     // read the first 4 lines containing the header
00062     int l;
00063     char line[1024],label[1024];
00064     for (l=0;l<4;l++) {
00065       GETS_FILE(line,1024,file);
00066       if (l==1) { // second line
00067         sscanf(line,"%s",label);
00068         os->label = label;
00069         // cerr << "LABEL: [" << os->label << "]" << endl;
00070       }
00071     }
00072     
00073     double a,e,i,omega_per,omega_nod,M;
00074     double time,time_old=0,timestep;
00075     // start reading
00076     
00077     if (cols == C7) {
00078       while (GETS_FILE(line,1024,file) != 0) {
00079         
00080         /* while ( (fscanf(file,"%lf %lf %lf %lf %lf %lf %lf",
00081            &time,&a,&e,&i,&omega_per,&omega_nod,&M)) != EOF ) {
00082         */
00083         
00084         sscanf(line,"%lf %lf %lf %lf %lf %lf %lf",
00085                &time,&a,&e,&i,&omega_per,&omega_nod,&M);
00086         
00087         timestep  = time - time_old;
00088         time_old  = time;
00089         if (os->size() == 2) { 
00090           os->timestep = FromUnits(timestep,DAY); // read in days, save in the current time units
00091           cerr << "timestep set to: " << os->timestep << endl;
00092         }
00093         
00094         fo.epoch.SetTime(FromUnits(time,DAY)); // read in days, save in the current time units
00095         
00096         fo.a                = FromUnits(a,AU);
00097         fo.e                = e;
00098         fo.i                = (pi/180.0)*i;
00099         fo.omega_node       = (pi/180.0)*omega_nod;
00100         fo.omega_pericenter = (pi/180.0)*omega_per;
00101         fo.M                = (pi/180.0)*M;
00102         
00103         os->push_back(fo);
00104       }
00105     }
00106     
00107     if (cols == C10) {
00108       double dummy;
00109       while (GETS_FILE(line,1024,file) != 0) {
00110         /* while ( (fscanf(file,"%lf %lf %lf %lf %lf %lf %lf %lf %lf %lf",
00111            &time,&a,&e,&i,&omega_per,&omega_nod,&M,&dummy,&dummy,&dummy))!= EOF ) {
00112         */
00113 
00114         sscanf(line,"%lf %lf %lf %lf %lf %lf %lf %lf %lf %lf",
00115                &time,&a,&e,&i,&omega_per,&omega_nod,&M,&dummy,&dummy,&dummy);
00116         
00117         timestep  = time - time_old;
00118         time_old  = time;
00119         if (os->size() == 2) { 
00120           os->timestep = FromUnits(timestep,DAY); // read in days, save in the current time units
00121           cerr << "timestep set to: " << os->timestep << endl;
00122         }
00123         
00124         fo.epoch.SetTime(FromUnits(time,DAY)); // read in days, save in the current time units
00125         
00126         fo.a                = FromUnits(a,AU);
00127         fo.e                = e;
00128         fo.i                = (pi/180.0)*i;
00129         fo.omega_node       = (pi/180.0)*omega_nod;
00130         fo.omega_pericenter = (pi/180.0)*omega_per;
00131         fo.M                = (pi/180.0)*M;
00132         
00133         os->push_back(fo);
00134       }
00135     }  
00136   }

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:

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

M5COLS cols
 

Definition at line 158 of file orsa_file.h.

Referenced by Mercury5IntegrationFile::Mercury5IntegrationFile(), and Mercury5IntegrationFile::Read().

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:16 2005 for liborsa by  doxygen 1.4.0