本文整理汇总了C++中SolarSystem::computeState方法的典型用法代码示例。如果您正苦于以下问题:C++ SolarSystem::computeState方法的具体用法?C++ SolarSystem::computeState怎么用?C++ SolarSystem::computeState使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SolarSystem
的用法示例。
在下文中一共展示了SolarSystem::computeState方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
// set the maximum level to be logged
ConfigureLOG::ReportLevels() = ConfigureLOG::ReportTimeTags() = true;
if(debug)
ConfigureLOG::ReportingLevel() = ConfigureLOG::FromString("DEBUG");
else if(verbose)
ConfigureLOG::ReportingLevel() = ConfigureLOG::FromString("VERBOSE");
else
ConfigureLOG::ReportingLevel() = ConfigureLOG::FromString("INFO");
// = any of ERROR,WARNING,INFO,VERBOSE,DEBUG,DEBUGn (n=1,2,3,4,5,6,7)
//cout << "Reporting in main is "
// << ConfigureLOG::ToString(ConfigureLOG::ReportingLevel()) << endl;
// display title in the log file
LOG(INFO) << Title;
// now read the binary file, and read selected records
// use the binary to test using the JPL file testpo.<EPH#>
LOG(VERBOSE) << "Initialize with file " << inputFilename;
SSEphemeris.initializeWithBinaryFile(inputFilename);
LOG(VERBOSE) << "End Initialize";
LOG(INFO) << "Ephemeris number is " << SSEphemeris.JPLNumber();
bool foundEOT=false;
int target,center,coord;
double JD,PV[6],value,diff;
SolarSystem::Planet Target,Center;
ifstream istrm;
istrm.open(testFilename.c_str(),ios::in);
if(!istrm.is_open()) {
LOG(ERROR) << "Could not open test file " << testFilename;
}
else while(1) {
string line,word;
getline(istrm,line);
stripTrailing(line,'\r');
strip(line);
if(line.empty())
;
else if(line == string("EOT"))
foundEOT = true;
else if(!foundEOT)
;
else {
word = stripFirstWord(line); // DEPHEM
word = stripFirstWord(line); // date in YYYY.MM.DD form
JD = for2doub(stripFirstWord(line));
target = asInt(stripFirstWord(line));
center = asInt(stripFirstWord(line));
coord = asInt(stripFirstWord(line)) - 1; // my coords are 0-5, theirs 1-6
word = stripFirstWord(line);
value = for2doub(word);
word = rightJustify(word,25);
Target = SolarSystem::Planet(target);
Center = SolarSystem::Planet(center);
iret = SSEphemeris.computeState(JD, Target, Center, PV, false);
if(iret == -1 || iret == -2) continue; // time is not in file
diff = fabs(PV[coord]-value);
LOG(INFO) << fixed << setprecision(1) << setw(9) << JD
<< " " << setw(2) << target //<< " " << setw(2) << Target
<< " " << setw(2) << center //<< " " << setw(2) << Center
<< " " << setw(1) << coord+1
<< " " << scientific << setprecision(5) << setw(13) << diff
<< " " << word
<< " " << fixed << setprecision(20) << setw(25) << PV[coord]
<< " " << iret
<< (diff > 1.e-13 ? " Failure" : "")
;
}
if(istrm.eof() || !istrm.good()) break;
}
if(iret) LOG(INFO) << PrgmName << " terminating with error code " << iret
<< ", which means " <<
(iret == 0 ? "OK" :
(iret == -1 ? "last time in file was before first time in ephemeris" :
(iret == -2 ? "time is beyond end time of ephemeris" :
(iret == -3 ? "file reading failed" : "ephemeris file is corrupted")))) ;
// compute run time
totaltime = clock()-totaltime;
LOG(INFO) << PrgmName << " timing: " << fixed << setprecision(9)
<< double(totaltime)/double(CLOCKS_PER_SEC) << " seconds.";
if(LOGstrm != cout) cout << PrgmName << " timing: " << fixed << setprecision(9)
<< double(totaltime)/double(CLOCKS_PER_SEC) << " seconds." << endl;
return iret;
}
catch(Exception& e) {
LOG(ERROR) << "GPSTk Exception : " << e.what();
}
catch (...) {
LOG(ERROR) << "Unknown error in " << PrgmName << ". Abort." << endl;
}
return -1;
} // end main()