#include <orsa_file.h>
Inheritance diagram for OrsaFile:
Public Member Functions | |
OrsaFile () | |
void | Read () |
void | Write () |
void | Open (const FILE_STATUS st=OPEN_R) |
void | Close () |
virtual std::string | GetFileName () const |
virtual void | SetFileName (std::string name_in) |
virtual void | SetFileName (char *name_in) |
Static Public Member Functions | |
static bool | GoodFile (const std::string &) |
Protected Member Functions | |
void | Write (Universe **) |
void | Read (Universe **) |
void | Write (Evolution **) |
void | Read (Evolution **) |
void | Write (Frame *, bool=false) |
void | Read (Frame *, bool=false) |
void | Write (Body *) |
void | Read (Body *) |
void | Write (BodyWithEpoch *) |
void | Read (BodyWithEpoch *) |
void | Write (const Integrator *) |
void | Read (Integrator **) |
void | Write (const Interaction *) |
void | Read (Interaction **) |
void | Write (std::string *) |
void | Read (std::string *) |
void | Write (orsa::Vector *) |
void | Read (orsa::Vector *) |
void | Write (bool *) |
void | Read (bool *) |
void | Write (unsigned int *) |
void | Read (unsigned int *) |
void | Write (int *) |
void | Read (int *) |
void | Write (double *) |
void | Read (double *) |
void | Write (IntegratorType *) |
void | Read (IntegratorType *) |
void | Write (InteractionType *) |
void | Read (InteractionType *) |
void | Write (time_unit *) |
void | Read (time_unit *) |
void | Write (length_unit *) |
void | Read (length_unit *) |
void | Write (mass_unit *) |
void | Read (mass_unit *) |
void | Write (Date *) |
void | Read (Date *) |
void | Write (UniverseTypeAwareTime *) |
void | Read (UniverseTypeAwareTime *) |
void | Write (UniverseTypeAwareTimeStep *) |
void | Read (UniverseTypeAwareTimeStep *) |
void | Write (ReferenceSystem *) |
void | Read (ReferenceSystem *) |
void | Write (UniverseType *) |
void | Read (UniverseType *) |
void | Write (TimeScale *) |
void | Read (TimeScale *) |
void | Write (OrsaFileDataType *) |
void | Read (OrsaFileDataType *) |
void | Write (JPL_planets *) |
void | Read (JPL_planets *) |
void | Write (TimeStep *) |
void | Read (TimeStep *) |
Protected Attributes | |
std::string | filename |
FILE_TYPE | file |
FILE_STATUS | status |
Definition at line 404 of file orsa_file.h.
OrsaFile | ( | ) |
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().
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; }
static bool GoodFile | ( | const std::string & | ) | [static] |
void Open | ( | const FILE_STATUS | st = OPEN_R |
) | [inherited] |
Definition at line 83 of file orsa_file.cc.
References File::Close(), orsa::CLOSE, File::file, File::filename, OPEN_FILE, orsa::OPEN_R, OPEN_READ, orsa::OPEN_W, OPEN_WRITE, ORSA_ERROR, and File::status.
Referenced by OrsaFile::Read(), OrsaConfigFile::Read(), OrsaFile::Write(), and OrsaConfigFile::Write().
00083 { 00084 00085 // already in the right status 00086 if (status == st) return; 00087 00088 // anomalous... 00089 if (st == CLOSE) { 00090 Close(); 00091 return; 00092 } 00093 00094 Close(); 00095 00096 if ((st == OPEN_R) && ((file = OPEN_FILE(filename.c_str(),OPEN_READ)) != 0)) { 00097 status = OPEN_R; 00098 return; 00099 } 00100 00101 if ((st == OPEN_W) && ((file = OPEN_FILE(filename.c_str(),OPEN_WRITE)) != 0)) { 00102 status = OPEN_W; 00103 return; 00104 } 00105 00106 if (file == 0) { 00107 ORSA_ERROR("Can't open file %s",filename.c_str()); 00108 } 00109 00110 status = CLOSE; 00111 }
Here is the call graph for this function:
void Read | ( | TimeStep * | ) | [protected] |
Definition at line 2247 of file orsa_file.cc.
References OrsaFile::Read().
02247 { 02248 unsigned int days; 02249 Read(&days); 02250 unsigned int day_fraction; 02251 Read(&day_fraction); 02252 int sign; 02253 Read(&sign); 02254 *ts = TimeStep(days,day_fraction,sign); 02255 }
Here is the call graph for this function:
void Read | ( | JPL_planets * | ) | [protected] |
Definition at line 2229 of file orsa_file.cc.
References orsa::convert(), and OrsaFile::Read().
02229 { 02230 // read_swap(jp,sizeof(JPL_planets)); 02231 unsigned int i; 02232 Read(&i); 02233 convert(*jp,i); 02234 }
Here is the call graph for this function:
void Read | ( | OrsaFileDataType * | ) | [protected] |
Definition at line 2209 of file orsa_file.cc.
References orsa::convert(), and orsa::OFDT_END_OF_FILE.
02209 { 02210 // const int val = read_swap(ofdt,sizeof(OrsaFileDataType)); 02211 // if (val==0) *ofdt = OFDT_END_OF_FILE; 02212 unsigned int i; 02213 const int val = read_swap(&i,sizeof(unsigned int)); 02214 // convert(*ofdt,i); 02215 // if (val==0) *ofdt = OFDT_END_OF_FILE; 02216 if (val==0) { 02217 *ofdt = OFDT_END_OF_FILE; 02218 } else { 02219 convert(*ofdt,i); 02220 } 02221 }
Here is the call graph for this function:
void Read | ( | TimeScale * | ) | [protected] |
Definition at line 2189 of file orsa_file.cc.
References orsa::convert(), and OrsaFile::Read().
02189 { 02190 // read_swap(ts,sizeof(TimeScale)); 02191 unsigned int i; 02192 Read(&i); 02193 convert(*ts,i); 02194 }
Here is the call graph for this function:
void Read | ( | UniverseType * | ) | [protected] |
Definition at line 2176 of file orsa_file.cc.
References orsa::convert(), and OrsaFile::Read().
02176 { 02177 // read_swap(ut,sizeof(UniverseType)); 02178 unsigned int i; 02179 Read(&i); 02180 convert(*ut,i); 02181 }
Here is the call graph for this function:
void Read | ( | ReferenceSystem * | ) | [protected] |
Definition at line 2163 of file orsa_file.cc.
References orsa::convert(), and OrsaFile::Read().
02163 { 02164 // read_swap(rs,sizeof(ReferenceSystem)); 02165 unsigned int i; 02166 Read(&i); 02167 convert(*rs,i); 02168 }
Here is the call graph for this function:
void Read | ( | UniverseTypeAwareTimeStep * | ) | [protected] |
Definition at line 1893 of file orsa_file.cc.
References Universe::GetUniverseType(), OrsaFile::Read(), orsa::Real, UniverseTypeAwareTimeStep::SetDouble(), UniverseTypeAwareTimeStep::SetTimeStep(), orsa::Simulated, and orsa::universe.
01893 { 01894 switch (universe->GetUniverseType()) { 01895 case Real: { 01896 TimeStep _ts; Read(&_ts); ts_in->SetTimeStep(_ts); 01897 break; 01898 } 01899 case Simulated: { 01900 double tt; Read(&tt); ts_in->SetDouble(tt); 01901 break; 01902 } 01903 } 01904 }
Here is the call graph for this function:
void Read | ( | UniverseTypeAwareTime * | ) | [protected] |
Definition at line 1867 of file orsa_file.cc.
References Universe::GetUniverseType(), OrsaFile::Read(), orsa::Real, UniverseTypeAwareTime::SetDate(), UniverseTypeAwareTime::SetTime(), orsa::Simulated, and orsa::universe.
01867 { 01868 switch (universe->GetUniverseType()) { 01869 case Real: { 01870 Date d; Read(&d); t->SetDate(d); 01871 break; 01872 } 01873 case Simulated: { 01874 double tt; Read(&tt); t->SetTime(tt); 01875 break; 01876 } 01877 } 01878 }
Here is the call graph for this function:
void Read | ( | Date * | ) | [protected] |
Definition at line 1850 of file orsa_file.cc.
References OrsaFile::Read(), and Date::SetJulian().
01850 { 01851 double j; Read(&j); d->SetJulian(j); 01852 }
Here is the call graph for this function:
void Read | ( | mass_unit * | ) | [protected] |
Definition at line 2150 of file orsa_file.cc.
References orsa::convert(), and OrsaFile::Read().
02150 { 02151 // read_swap(mu,sizeof(mass_unit)); 02152 unsigned int i; 02153 Read(&i); 02154 convert(*mu,i); 02155 }
Here is the call graph for this function:
void Read | ( | length_unit * | ) | [protected] |
Definition at line 2137 of file orsa_file.cc.
References orsa::convert(), and OrsaFile::Read().
02137 { 02138 // read_swap(lu,sizeof(length_unit)); 02139 unsigned int i; 02140 Read(&i); 02141 convert(*lu,i); 02142 }
Here is the call graph for this function:
void Read | ( | time_unit * | ) | [protected] |
Definition at line 2124 of file orsa_file.cc.
References orsa::convert(), and OrsaFile::Read().
02124 { 02125 // read_swap(tu,sizeof(time_unit)); 02126 unsigned int i; 02127 Read(&i); 02128 convert(*tu,i); 02129 }
Here is the call graph for this function:
void Read | ( | InteractionType * | ) | [protected] |
Definition at line 2111 of file orsa_file.cc.
References orsa::convert(), and OrsaFile::Read().
02111 { 02112 // read_swap(it,sizeof(InteractionType)); 02113 unsigned int i; 02114 Read(&i); 02115 convert(*it,i); 02116 }
Here is the call graph for this function:
void Read | ( | IntegratorType * | ) | [protected] |
Definition at line 2098 of file orsa_file.cc.
References orsa::convert(), and OrsaFile::Read().
02098 { 02099 // read_swap(it,sizeof(IntegratorType)); 02100 unsigned int i; 02101 Read(&i); 02102 convert(*it,i); 02103 }
Here is the call graph for this function:
void Read | ( | double * | ) | [protected] |
void Read | ( | int * | ) | [protected] |
void Read | ( | unsigned int * | ) | [protected] |
void Read | ( | bool * | ) | [protected] |
void Read | ( | orsa::Vector * | ) | [protected] |
void Read | ( | std::string * | ) | [protected] |
Definition at line 2018 of file orsa_file.cc.
References File::file, OrsaFile::Read(), and READ_FILE.
02018 { 02019 unsigned int n; 02020 Read(&n); 02021 if (n > 0) { 02022 char * name = (char*)malloc(n*sizeof(char)); 02023 READ_FILE(name,sizeof(char),n,file); 02024 *s = name; 02025 /* 02026 ORSA_ERROR("Read(std::string *s) n = %i s = %s s->size() = %i strlen(s->c_str()) = %i name = %s", 02027 n,s->c_str(),s->size(),strlen(s->c_str()),name); 02028 */ 02029 free(name); 02030 } 02031 }
Here is the call graph for this function:
void Read | ( | Interaction ** | ) | [protected] |
Definition at line 1971 of file orsa_file.cc.
References Newton::IncludeFastRelativisticEffects(), Newton::IncludeMultipoleMoments(), Newton::IncludeRelativisticEffects(), orsa::make_new_interaction(), orsa::NEWTON, and OrsaFile::Read().
01971 { 01972 InteractionType type; Read(&type); 01973 make_new_interaction(i, type); 01974 bool b; Read(&b); (*i)->SkipJPLPlanets(b); 01975 if (type == NEWTON) { 01976 Newton * newton = dynamic_cast <Newton *> (*i); 01977 if (newton) { 01978 Read(&b); newton->IncludeMultipoleMoments(b); 01979 Read(&b); newton->IncludeRelativisticEffects(b); 01980 Read(&b); newton->IncludeFastRelativisticEffects(b); 01981 } else { 01982 b = false; 01983 Read(&b); 01984 Read(&b); 01985 Read(&b); 01986 } 01987 } 01988 }
Here is the call graph for this function:
void Read | ( | Integrator ** | ) | [protected] |
Definition at line 1926 of file orsa_file.cc.
References orsa::make_new_integrator(), and OrsaFile::Read().
01926 { 01927 01928 IntegratorType type; Read(&type); 01929 make_new_integrator(i, type); 01930 01931 UniverseTypeAwareTimeStep ts; 01932 Read(&ts); 01933 (*i)->timestep = ts; 01934 01935 double a; Read(&a); 01936 unsigned int m; Read(&m); 01937 01938 (*i)->accuracy = a; 01939 (*i)->m = m; 01940 }
Here is the call graph for this function:
void Read | ( | BodyWithEpoch * | ) | [protected] |
Definition at line 1841 of file orsa_file.cc.
References OrsaFile::Read().
01841 { 01842 Read((Body*)b); 01843 UniverseTypeAwareTime b_epoch; Read(&b_epoch); b->SetEpoch(b_epoch); 01844 }
Here is the call graph for this function:
void Read | ( | Body * | ) | [protected] |
Definition at line 1823 of file orsa_file.cc.
References OrsaFile::Read(), Body::SetPosition(), and Body::SetVelocity().
01823 { 01824 string b_name; Read(&b_name); 01825 double b_mass; Read(&b_mass); 01826 double b_radius; Read(&b_radius); 01827 JPL_planets b_planet; Read(&b_planet); 01828 01829 *b = Body(b_name,b_mass,b_radius,b_planet); 01830 01831 Vector v; 01832 Read(&v); b->SetPosition(v); 01833 Read(&v); b->SetVelocity(v); 01834 }
Here is the call graph for this function:
void Read | ( | Frame * | , | |
bool | = false | |||
) | [protected] |
Definition at line 1791 of file orsa_file.cc.
References OrsaFile::Read(), UniverseTypeAwareTime::SetTime(), and Frame::size().
01791 { 01792 01793 UniverseTypeAwareTime f_time; 01794 Read(&f_time); 01795 f->SetTime(f_time); 01796 unsigned int n = f->size(); 01797 Read(&n); 01798 f->resize(n); 01799 unsigned int j; 01800 Vector v; 01801 if (read_only_r_v) { 01802 for(j=0;j<n;j++) { 01803 Read(&v); (*f)[j].SetPosition(v); 01804 Read(&v); (*f)[j].SetVelocity(v); 01805 } 01806 } else { 01807 for(j=0;j<n;j++) { 01808 Read(&((*f)[j])); 01809 } 01810 } 01811 }
Here is the call graph for this function:
void Read | ( | Evolution ** | ) | [protected] |
Definition at line 1693 of file orsa_file.cc.
References Universe::GetUniverseType(), orsa::OFDT_FRAME, OrsaFile::Read(), orsa::Real, and orsa::universe.
01693 { 01694 01695 string name; 01696 Read(&name); 01697 01698 // double sample_period; 01699 UniverseTypeAwareTimeStep sample_period; 01700 Read(&sample_period); 01701 01702 Integrator * integrator = 0; 01703 Read(&integrator); 01704 01705 Interaction * interaction = 0; 01706 Read(&interaction); 01707 01708 make_new_evolution(e); 01709 01710 (*e)->clear(); 01711 01712 (*e)->name = name; 01713 (*e)->SetSamplePeriod(sample_period); 01714 (*e)->SetIntegrator(integrator); 01715 (*e)->SetInteraction(interaction); 01716 01717 delete integrator; 01718 integrator = 0; 01719 01720 delete interaction; 01721 interaction = 0; 01722 01723 unsigned int n; 01724 Read(&n); 01725 (*e)->start_bodies.resize(n); 01726 for(unsigned int j=0;j<n;j++) { 01727 Read(&((*e)->start_bodies[j])); 01728 } 01729 // 01730 if (universe->GetUniverseType() == Real) { 01731 Read(&n); 01732 (*e)->start_JPL_bodies.clear(); 01733 01734 JPL_planets tmp_jp; 01735 for(unsigned int j=0;j<n;j++) { 01736 Read(&tmp_jp); 01737 (*e)->start_JPL_bodies.push_back(tmp_jp); 01738 } 01739 } 01740 01741 // we REALLY need a Frame to keep all the constant values.... 01742 Frame f; 01743 01744 Read(&last_ofdt_read); 01745 /* 01746 { // debug 01747 ORSA_ERROR("Read(Evolution *e) ofdt = %i",last_ofdt_read); 01748 } 01749 */ 01750 if (last_ofdt_read == OFDT_FRAME) { 01751 // the first is different from the others 01752 Read(&f); 01753 (*e)->push_back(f); 01754 } 01755 01756 Read(&last_ofdt_read); 01757 /* 01758 { // debug 01759 ORSA_ERROR("Read(Evolution *e) ofdt = %i",last_ofdt_read); 01760 } 01761 */ 01762 while (last_ofdt_read == OFDT_FRAME) { 01763 Read(&f,true); 01764 (*e)->push_back(f); 01765 Read(&last_ofdt_read); 01766 } 01767 }
Here is the call graph for this function:
void Read | ( | Universe ** | ) | [protected] |
Definition at line 1608 of file orsa_file.cc.
References orsa::OFDT_EVOLUTION, OrsaFile::Read(), and orsa::swap().
01608 { 01609 01610 swap_bytes = false; 01611 Read(&byte_order); 01612 if (byte_order != BYTEORDER) { 01613 swap_bytes = true; 01614 swap(&byte_order,sizeof(byte_order)); 01615 } 01616 01617 Read(&orsa_version); 01618 01619 time_unit tu; 01620 length_unit lu; 01621 mass_unit mu; 01622 // 01623 Read(&tu); 01624 Read(&lu); 01625 Read(&mu); 01626 01627 UniverseType ut; 01628 Read(&ut); 01629 01630 ReferenceSystem rs;; 01631 Read(&rs); 01632 01633 TimeScale ts; 01634 Read(&ts); 01635 01636 make_new_universe(u,lu,mu,tu,ut,rs,ts); 01637 01638 Read(&((*u)->name)); 01639 Read(&((*u)->description)); 01640 01641 Read(&last_ofdt_read); // the others are read by the Read(evol..) 01642 /* 01643 { // debug 01644 ORSA_ERROR("Read(Universe *u) ofdt = %i",last_ofdt_read); 01645 } 01646 */ 01647 while (last_ofdt_read == OFDT_EVOLUTION) { 01648 Evolution * e = 0; 01649 Read(&e); 01650 (*u)->push_back(e); 01651 } 01652 }
Here is the call graph for this function:
void Read | ( | ) | [virtual] |
Implements ReadWriteFile.
Definition at line 1551 of file orsa_file.cc.
References File::Close(), File::GetFileName(), orsa::LengthLabel(), orsa::MassLabel(), ReadWriteFile::Open(), orsa::OPEN_R, ORSA_DEBUG, ORSA_ERROR, Universe::size(), File::status, orsa::TimeLabel(), and orsa::universe.
Referenced by OrsaFile::Read().
01551 { 01552 01553 Open(OPEN_R); 01554 01555 if (status != OPEN_R) { 01556 ORSA_ERROR("Status error!"); 01557 return; 01558 } 01559 01560 Read(&universe); 01561 01562 Close(); 01563 01564 ORSA_DEBUG("ORSA file %s [ORSA version: %s, byte order: %i, evolutions: %i, units: [%s,%s,%s]]", 01565 GetFileName().c_str(), orsa_version.c_str(), byte_order,universe->size(), 01566 LengthLabel().c_str(), MassLabel().c_str(),TimeLabel().c_str()); 01567 }
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().
Here is the call graph for this function:
void Write | ( | TimeStep * | ) | [protected] |
Definition at line 2236 of file orsa_file.cc.
References TimeStep::day_fraction(), TimeStep::days(), TimeStep::sign(), and OrsaFile::Write().
02236 { 02237 unsigned int days = ts->days(); 02238 Write(&days); 02239 // 02240 unsigned int day_fraction = ts->day_fraction(); 02241 Write(&day_fraction); 02242 // 02243 int sign = ts->sign(); 02244 Write(&sign); 02245 }
Here is the call graph for this function:
void Write | ( | JPL_planets * | ) | [protected] |
Definition at line 2223 of file orsa_file.cc.
References OrsaFile::Write().
02223 { 02224 // WRITE_FILE(jp,sizeof(JPL_planets),1,file); 02225 unsigned int i = *jp; 02226 Write(&i); 02227 }
Here is the call graph for this function:
void Write | ( | OrsaFileDataType * | ) | [protected] |
Definition at line 2196 of file orsa_file.cc.
References OrsaFile::Write().
02196 { 02197 // WRITE_FILE(ofdt,sizeof(OrsaFileDataType),1,file); 02198 unsigned int i = *ofdt; 02199 Write(&i); 02200 }
Here is the call graph for this function:
void Write | ( | TimeScale * | ) | [protected] |
Definition at line 2183 of file orsa_file.cc.
References OrsaFile::Write().
02183 { 02184 // WRITE_FILE(ts,sizeof(TimeScale),1,file); 02185 unsigned int i = *ts; 02186 Write(&i); 02187 }
Here is the call graph for this function:
void Write | ( | UniverseType * | ) | [protected] |
Definition at line 2170 of file orsa_file.cc.
References OrsaFile::Write().
02170 { 02171 // WRITE_FILE(ut,sizeof(UniverseType),1,file); 02172 unsigned int i = *ut; 02173 Write(&i); 02174 }
Here is the call graph for this function:
void Write | ( | ReferenceSystem * | ) | [protected] |
Definition at line 2157 of file orsa_file.cc.
References OrsaFile::Write().
02157 { 02158 // WRITE_FILE(rs,sizeof(ReferenceSystem),1,file); 02159 unsigned int i = *rs; 02160 Write(&i); 02161 }
Here is the call graph for this function:
void Write | ( | UniverseTypeAwareTimeStep * | ) | [protected] |
Definition at line 1880 of file orsa_file.cc.
References UniverseTypeAwareTimeStep::GetDouble(), UniverseTypeAwareTimeStep::GetTimeStep(), Universe::GetUniverseType(), orsa::Real, orsa::Simulated, orsa::universe, and OrsaFile::Write().
01880 { 01881 switch (universe->GetUniverseType()) { 01882 case Real: { 01883 TimeStep _ts = ts_in->GetTimeStep(); Write(&_ts); 01884 break; 01885 } 01886 case Simulated: { 01887 double tt = ts_in->GetDouble(); Write(&tt); 01888 break; 01889 } 01890 } 01891 }
Here is the call graph for this function:
void Write | ( | UniverseTypeAwareTime * | ) | [protected] |
Definition at line 1854 of file orsa_file.cc.
References UniverseTypeAwareTime::GetDate(), UniverseTypeAwareTime::GetTime(), Universe::GetUniverseType(), orsa::Real, orsa::Simulated, orsa::universe, and OrsaFile::Write().
01854 { 01855 switch (universe->GetUniverseType()) { 01856 case Real: { 01857 Date d = t->GetDate(); Write(&d); 01858 break; 01859 } 01860 case Simulated: { 01861 double tt = t->GetTime(); Write(&tt); 01862 break; 01863 } 01864 } 01865 }
Here is the call graph for this function:
void Write | ( | Date * | ) | [protected] |
Definition at line 1846 of file orsa_file.cc.
References Date::GetJulian(), and OrsaFile::Write().
01846 { 01847 double j = d->GetJulian(); Write(&j); 01848 }
Here is the call graph for this function:
void Write | ( | mass_unit * | ) | [protected] |
Definition at line 2144 of file orsa_file.cc.
References OrsaFile::Write().
02144 { 02145 // WRITE_FILE(mu,sizeof(mass_unit),1,file); 02146 unsigned int i = *mu; 02147 Write(&i); 02148 }
Here is the call graph for this function:
void Write | ( | length_unit * | ) | [protected] |
Definition at line 2131 of file orsa_file.cc.
References OrsaFile::Write().
02131 { 02132 // WRITE_FILE(lu,sizeof(length_unit),1,file); 02133 unsigned int i = *lu; 02134 Write(&i); 02135 }
Here is the call graph for this function:
void Write | ( | time_unit * | ) | [protected] |
Definition at line 2118 of file orsa_file.cc.
References OrsaFile::Write().
02118 { 02119 // WRITE_FILE(tu,sizeof(time_unit),1,file); 02120 unsigned int i = *tu; 02121 Write(&i); 02122 }
Here is the call graph for this function:
void Write | ( | InteractionType * | ) | [protected] |
Definition at line 2105 of file orsa_file.cc.
References OrsaFile::Write().
02105 { 02106 // WRITE_FILE(it,sizeof(InteractionType),1,file); 02107 unsigned int i = *it; 02108 Write(&i); 02109 }
Here is the call graph for this function:
void Write | ( | IntegratorType * | ) | [protected] |
Definition at line 2092 of file orsa_file.cc.
References OrsaFile::Write().
02092 { 02093 // WRITE_FILE(it,sizeof(IntegratorType),1,file); 02094 unsigned int i = *it; 02095 Write(&i); 02096 }
Here is the call graph for this function:
void Write | ( | double * | ) | [protected] |
Definition at line 2069 of file orsa_file.cc.
References File::file, and WRITE_FILE.
02069 { 02070 WRITE_FILE(d,sizeof(double),1,file); 02071 }
void Write | ( | int * | ) | [protected] |
Definition at line 2061 of file orsa_file.cc.
References File::file, and WRITE_FILE.
02061 { 02062 WRITE_FILE(i,sizeof(int),1,file); 02063 }
void Write | ( | unsigned int * | ) | [protected] |
Definition at line 2053 of file orsa_file.cc.
References File::file, and WRITE_FILE.
02053 { 02054 WRITE_FILE(i,sizeof(unsigned int),1,file); 02055 }
void Write | ( | bool * | ) | [protected] |
Definition at line 2045 of file orsa_file.cc.
References File::file, and WRITE_FILE.
02045 { 02046 WRITE_FILE(b,sizeof(bool),1,file); 02047 }
void Write | ( | orsa::Vector * | ) | [protected] |
void Write | ( | std::string * | ) | [protected] |
Definition at line 1990 of file orsa_file.cc.
References File::file, ORSA_ERROR, OrsaFile::Write(), and WRITE_FILE.
01990 { 01991 const unsigned int size = s->size(); 01992 unsigned int n = 1 + size; 01993 Write(&n); 01994 char * name = (char*)malloc(n*sizeof(char)); 01995 // 01996 // strcpy(name,s->c_str()); 01997 { 01998 unsigned int i; 01999 for (i=0;i<size;++i) { 02000 name[i] = (*s)[i]; 02001 } 02002 name[size] = '\0'; 02003 } 02004 // 02005 WRITE_FILE(name,sizeof(char),n,file); 02006 /* 02007 ORSA_ERROR("Write(std::string *s) n = %i s = %s s->size() = %i strlen(s->c_str()) = %i", 02008 n,s->c_str(),s->size(),strlen(s->c_str())); 02009 */ 02010 free(name); 02011 { // check 02012 if (strlen(s->c_str()) > n) { 02013 ORSA_ERROR("string length problem..."); 02014 } 02015 } 02016 }
Here is the call graph for this function:
void Write | ( | const Interaction * | ) | [protected] |
Definition at line 1953 of file orsa_file.cc.
References Interaction::GetType(), Newton::IsIncludingFastRelativisticEffects(), Newton::IsIncludingMultipoleMoments(), Newton::IsIncludingRelativisticEffects(), Interaction::IsSkippingJPLPlanets(), orsa::NEWTON, and OrsaFile::Write().
01953 { 01954 InteractionType type = i->GetType(); Write(&type); 01955 bool b = i->IsSkippingJPLPlanets(); Write(&b); 01956 if (type == NEWTON) { 01957 const Newton * newton = dynamic_cast <const Newton *> (i); 01958 if (newton) { 01959 b = newton->IsIncludingMultipoleMoments(); Write(&b); 01960 b = newton->IsIncludingRelativisticEffects(); Write(&b); 01961 b = newton->IsIncludingFastRelativisticEffects(); Write(&b); 01962 } else { 01963 b = false; 01964 Write(&b); 01965 Write(&b); 01966 Write(&b); 01967 } 01968 } 01969 }
Here is the call graph for this function:
void Write | ( | const Integrator * | ) | [protected] |
Definition at line 1907 of file orsa_file.cc.
References Integrator::accuracy, Integrator::GetType(), Integrator::m, Integrator::timestep, and OrsaFile::Write().
01907 { 01908 01909 // IntegratorType it = (*i)->GetType(); 01910 IntegratorType it = i->GetType(); 01911 Write(&it); 01912 01913 // UniverseTypeAwareTimeStep ts = (*i)->timestep; 01914 UniverseTypeAwareTimeStep ts = i->timestep; 01915 Write(&ts); 01916 01917 // double a = (*i)->accuracy; 01918 double a = i->accuracy; 01919 Write(&a); 01920 01921 // unsigned int m = (*i)->m; 01922 unsigned int m = i->m; 01923 Write(&m); 01924 }
Here is the call graph for this function:
void Write | ( | BodyWithEpoch * | ) | [protected] |
Definition at line 1836 of file orsa_file.cc.
References OrsaFile::Write().
01836 { 01837 Write((Body*)b); 01838 UniverseTypeAwareTime b_epoch = b->Epoch(); Write(&b_epoch); 01839 }
Here is the call graph for this function:
void Write | ( | Body * | ) | [protected] |
Definition at line 1813 of file orsa_file.cc.
References Body::JPLPlanet(), Body::mass(), Body::name(), Body::position(), Body::radius(), Body::velocity(), and OrsaFile::Write().
01813 { 01814 string b_name = b->name(); Write(&b_name); 01815 double b_mass = b->mass(); Write(&b_mass); 01816 double b_radius = b->radius(); Write(&b_radius); 01817 JPL_planets b_planet = b->JPLPlanet(); Write(&b_planet); 01818 Vector v; 01819 v = b->position(); Write(&v); 01820 v = b->velocity(); Write(&v); 01821 }
Here is the call graph for this function:
void Write | ( | Frame * | , | |
bool | = false | |||
) | [protected] |
Definition at line 1769 of file orsa_file.cc.
References orsa::OFDT_FRAME, Frame::size(), and OrsaFile::Write().
01769 { 01770 01771 OrsaFileDataType t = OFDT_FRAME; Write(&t); 01772 01773 UniverseTypeAwareTime f_time = *f; 01774 Write(&f_time); 01775 unsigned int n = f->size(); 01776 Write(&n); 01777 // unsigned int j; 01778 Vector v; 01779 if (write_only_r_v) { 01780 for(unsigned int j=0;j<n;j++) { 01781 v = (*f)[j].position(); Write(&v); 01782 v = (*f)[j].velocity(); Write(&v); 01783 } 01784 } else { 01785 for(unsigned int j=0;j<n;j++) { 01786 Write(&((*f)[j])); 01787 } 01788 } 01789 }
Here is the call graph for this function:
void Write | ( | Evolution ** | ) | [protected] |
Definition at line 1654 of file orsa_file.cc.
References Universe::GetUniverseType(), orsa::OFDT_EVOLUTION, orsa::Real, orsa::universe, and OrsaFile::Write().
01654 { 01655 01656 OrsaFileDataType t = OFDT_EVOLUTION; Write(&t); 01657 01658 Write(&((*e)->name)); 01659 UniverseTypeAwareTimeStep sp = (*e)->GetSamplePeriod(); Write(&sp); 01660 // const Integrator * itg = (*e)->GetIntegrator(); Write(&itg); 01661 Write((*e)->GetIntegrator()); 01662 // Write(&((*e)->interaction)); 01663 Write((*e)->GetInteraction()); 01664 01665 unsigned int n = (*e)->start_bodies.size(); 01666 Write(&n); 01667 for(unsigned int j=0;j<n;j++) { 01668 Write(&((*e)->start_bodies[j])); 01669 } 01670 // 01671 if (universe->GetUniverseType() == Real) { 01672 n = (*e)->start_JPL_bodies.size(); 01673 Write(&n); 01674 for(unsigned int j=0;j<n;++j) { 01675 Write(&((*e)->start_JPL_bodies[j])); 01676 } 01677 } 01678 01679 // the first only 01680 if ((*e)->size() > 0) Write(&((*(*e))[0])); 01681 01682 // from the second on, write only position and velocity 01683 for(unsigned int j=1;j<(*e)->size();++j) { 01684 Write(&((*(*e))[j]),true); 01685 } 01686 }
Here is the call graph for this function:
void Write | ( | Universe ** | ) | [protected] |
Definition at line 1569 of file orsa_file.cc.
References Units::GetLengthBaseUnit(), Units::GetMassBaseUnit(), Units::GetTimeBaseUnit(), ORSA_VERSION, orsa::units, and OrsaFile::Write().
01569 { 01570 01571 // endian issues 01572 byte_order = BYTEORDER; // from config.h 01573 Write(&byte_order); 01574 01575 // various info... 01576 orsa_version = ORSA_VERSION; 01577 Write(&orsa_version); 01578 01579 time_unit tu = units->GetTimeBaseUnit(); 01580 length_unit lu = units->GetLengthBaseUnit(); 01581 mass_unit mu = units->GetMassBaseUnit(); 01582 // 01583 Write(&tu); Write(&lu); Write(&mu); 01584 01585 UniverseType ut = (*u)->GetUniverseType(); 01586 Write(&ut); 01587 01588 ReferenceSystem rs = (*u)->GetReferenceSystem(); 01589 Write(&rs); 01590 01591 TimeScale ts = (*u)->GetTimeScale(); 01592 Write(&ts); 01593 01594 Write(&((*u)->name)); 01595 Write(&((*u)->description)); 01596 01597 unsigned int j; 01598 for(j=0;j<(*u)->size();j++) { 01599 if ((*(*u))[j]!=0) Write(&(*(*u))[j]); 01600 } 01601 }
Here is the call graph for this function:
void Write | ( | ) | [virtual] |
Implements ReadWriteFile.
Definition at line 1530 of file orsa_file.cc.
References File::Close(), File::file, FLUSH_FILE, ReadWriteFile::Open(), orsa::OPEN_W, ORSA_ERROR, File::status, and orsa::universe.
Referenced by OrsaFile::Write().
01530 { 01531 01532 Open(OPEN_W); 01533 01534 if (status != OPEN_W) { 01535 ORSA_ERROR("Status error!"); 01536 return; 01537 } 01538 01539 if (!universe) { 01540 ORSA_ERROR("cannot write a non-allocated universe!"); 01541 return; 01542 } 01543 01544 Write(&universe); 01545 01546 FLUSH_FILE(file); 01547 01548 Close(); 01549 }
Here is the call graph for this function:
FILE_TYPE file [protected, inherited] |
Definition at line 113 of file orsa_file.h.
Referenced by SWIFTFile::AsteroidsInFile(), File::Close(), File::File(), ReadWriteFile::Open(), WriteFile::Open(), ReadFile::Open(), Mercury5IntegrationFile::Read(), OrsaFile::Read(), OrsaConfigFile::Read(), SWIFTFile::Read(), LocationFile::Read(), RWOFile::Read(), MPCObsFile::Read(), MPCCometFile::Read(), MPCOrbFile::Read(), AstorbFile::Read(), OrsaFile::Write(), and OrsaConfigFile::Write().
std::string filename [protected, inherited] |
Definition at line 112 of file orsa_file.h.
Referenced by File::GetFileName(), ReadWriteFile::Open(), WriteFile::Open(), ReadFile::Open(), and File::SetFileName().
FILE_STATUS status [protected, inherited] |
Definition at line 114 of file orsa_file.h.
Referenced by File::Close(), File::File(), Mercury5IntegrationFile::Mercury5IntegrationFile(), ReadWriteFile::Open(), WriteFile::Open(), ReadFile::Open(), Mercury5IntegrationFile::Read(), TLEFile::Read(), NEODYSCAT::Read(), JPLDastcomCometFile::Read(), JPLDastcomUnnumFile::Read(), JPLDastcomNumFile::Read(), AstDySMatrixFile::Read(), RadauModIntegrationFile::Read(), OrsaFile::Read(), OrsaConfigFile::Read(), SWIFTFile::Read(), LocationFile::Read(), MPCObsFile::Read(), MPCCometFile::Read(), MPCOrbFile::Read(), AstorbFile::Read(), File::SetFileName(), OrsaFile::Write(), and OrsaConfigFile::Write().