本文整理汇总了C++中SolarSystem::GetBody方法的典型用法代码示例。如果您正苦于以下问题:C++ SolarSystem::GetBody方法的具体用法?C++ SolarSystem::GetBody怎么用?C++ SolarSystem::GetBody使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SolarSystem
的用法示例。
在下文中一共展示了SolarSystem::GetBody方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
{
LeapSecsFileReader* ls = new LeapSecsFileReader(LeapFileName);
ls->Initialize();
EopFile *eop = new EopFile(eopFileName);
eop->Initialize();
ItrfCoefficientsFile* itrf = new ItrfCoefficientsFile(nutFileName, planFileName);
itrf->Initialize();
//bf->SetEopFile(eop);
//bf->SetCoefficientsFile(itrf);
TimeConverterUtil::SetLeapSecsFileReader(ls);
TimeConverterUtil::SetEopFile(eop);
}
catch (BaseException &bbee)
{
cout << "ERROR !!!!! " << bbee.GetMessage() << endl;
}
SolarSystem* ss;
Star* sol;
Planet* earth;
Planet* mars;
Planet* jupiter;
Moon* luna;
std::string j2000BN = "";
SpacePoint* j2000B = NULL;
try
{
cout << "\n==> Create the solar system <==" << endl;
ss = new SolarSystem("TheSS");
cout << "solar system name = " << ss->GetName() << endl;
cout << " ------ number of objects instantiated = " << GmatBase::GetInstanceCount() << endl;
earth = (Planet*) ss->GetBody(SolarSystem::EARTH_NAME);
cout << "earth name = " << earth->GetName() << endl;
cout << "earth's type name is " << earth->GetTypeName() << endl;
sol = (Star*) ss->GetBody(SolarSystem::SUN_NAME);
cout << "sol name = " << sol->GetName() << endl;
cout << "sol's type name is " << sol->GetTypeName() << endl;
cout << " ------ number of objects instantiated = " << GmatBase::GetInstanceCount() << endl;
luna = (Moon*) ss->GetBody(SolarSystem::MOON_NAME);
cout << "luna name = " << luna->GetName() << endl;
cout << "luna's type name is " << luna->GetTypeName() << endl;
mars = (Planet*) ss->GetBody(SolarSystem::MARS_NAME);
cout << "mars name = " << mars->GetName() << endl;
cout << "mars's type name is " << mars->GetTypeName() << endl;
jupiter = (Planet*) ss->GetBody(SolarSystem::JUPITER_NAME);
cout << "jupiter name = " << jupiter->GetName() << endl;
cout << "jupiter's type name is " << jupiter->GetTypeName() << endl;
SlpFile* anSLP;
DeFile* aDE;
try
{
std::string SLPFileName = "/GMAT/dev/datafiles/mac/DBS_mn2000.dat";
std::string DEFileName = "/GMAT/dev/datafiles/DEascii/macp1941.405";
anSLP = new SlpFile(SLPFileName);
aDE = new DeFile(Gmat::DE405,DEFileName);
cout << "the SLP file is : " << anSLP->GetName() << endl;
cout << "the DE file is : " << aDE->GetName() << endl;
}
catch (BaseException &be1)
示例2: RunTest
//------------------------------------------------------------------------------
//int RunTest(TestOutput &out)
//------------------------------------------------------------------------------
int RunTest(TestOutput &out)
{
Real realVal;
Real expResult;
// for SolarSystem, internal CoordinateSystem
SolarSystem *ssPtr = new SolarSystem("MySolarSystem");
// set J2000Body for Earth
CelestialBody *earthPtr = ssPtr->GetBody("Earth");
std::string j2000BodyName = "Earth";
CelestialBody *j2000Body = earthPtr;
earthPtr->SetJ2000BodyName(j2000BodyName);
earthPtr->SetJ2000Body(j2000Body);
// for CoordinateSystem - EarthMJ2000Eq
CoordinateSystem *csPtr = new CoordinateSystem("CoordinateSystem", "EarthMJ2000Eq");
AxisSystem *mj2000EqAxis = new MJ2000EqAxes("MJ2000Eq");
csPtr->SetRefObject(mj2000EqAxis, Gmat::AXIS_SYSTEM, mj2000EqAxis->GetName());
csPtr->SetSolarSystem(ssPtr);
csPtr->SetStringParameter("Origin", "Earth");
csPtr->SetStringParameter("J2000Body", "Earth");
csPtr->SetRefObject(earthPtr, Gmat::SPACE_POINT, "Earth");
csPtr->Initialize();
// for CoordinateSystem - EarthMJ2000Ec
CoordinateSystem *eccsPtr = new CoordinateSystem("CoordinateSystem", "EarthMJ2000Ec");
AxisSystem *ecAxis = new MJ2000EcAxes("MJ2000Ec");
eccsPtr->SetRefObject(ecAxis, Gmat::AXIS_SYSTEM, ecAxis->GetName());
eccsPtr->SetSolarSystem(ssPtr);
eccsPtr->SetStringParameter("Origin", "Earth");
eccsPtr->SetStringParameter("J2000Body", "Earth");
eccsPtr->SetRefObject(earthPtr, Gmat::SPACE_POINT, "Earth");
eccsPtr->Initialize();
// set SLP file to SolarSystem
std::string slpFileName = "C:\\projects\\gmat\\files\\planetary_ephem\\slp\\mn2000.pc";
SlpFile *theSlpFile = new SlpFile(slpFileName);
ssPtr->SetSource(Gmat::SLP);
ssPtr->SetSourceFile(theSlpFile);
// for Spacecraft
Spacecraft *scPtr = new Spacecraft("MySpacecraft");
scPtr->SetRefObject(csPtr, Gmat::COORDINATE_SYSTEM);
//---------------------------------------------------------------------------
out.Put("======================================== test BplaneParameters\n");
//---------------------------------------------------------------------------
out.Put("=================================== Test with default spacecraft orbit");
out.Put("========== state = ", scPtr->GetCartesianState().ToString());
out.Put("============================== test BdotT()");
BdotT *btParam = new BdotT();
btParam->SetSolarSystem(ssPtr);
btParam->SetInternalCoordSystem(csPtr);
btParam->SetRefObjectName(Gmat::COORDINATE_SYSTEM, "EarthMJ2000Eq");
btParam->SetRefObject(csPtr, Gmat::COORDINATE_SYSTEM, "EarthMJ2000Eq");
btParam->SetRefObjectName(Gmat::SPACECRAFT, "MySpacecraft");
btParam->SetRefObject(scPtr, Gmat::SPACECRAFT, "MySpacecraft");
btParam->Initialize();
out.Put("num RefObjects = ", btParam->GetNumRefObjects());
out.Put("----- test btParam->EvaluateReal()");
out.Put("----- Should get an exception due to non-hyperbolic orbit");
realVal = btParam->EvaluateReal();
out.Put("============================== test BdotR()");
BdotR *brParam = new BdotR();
brParam->SetSolarSystem(ssPtr);
brParam->SetInternalCoordSystem(csPtr);
brParam->SetRefObjectName(Gmat::COORDINATE_SYSTEM, "EarthMJ2000Eq");
brParam->SetRefObject(csPtr, Gmat::COORDINATE_SYSTEM, "EarthMJ2000Eq");
brParam->SetRefObjectName(Gmat::SPACECRAFT, "MySpacecraft");
brParam->SetRefObject(scPtr, Gmat::SPACECRAFT, "MySpacecraft");
brParam->Initialize();
out.Put("num RefObjects = ", brParam->GetNumRefObjects());
out.Put("----- test brParam->EvaluateReal()");
out.Put("----- Should get an exception due to non-hyperbolic orbit");
realVal = brParam->EvaluateReal();
out.Put("");
out.Put("=================================== Test in EarthMJ2000Ec");
BdotT *btecParam = new BdotT();
btecParam->SetSolarSystem(ssPtr);
btecParam->SetInternalCoordSystem(csPtr);
btecParam->SetRefObjectName(Gmat::COORDINATE_SYSTEM, "EarthMJ2000Ec");
btecParam->SetRefObject(eccsPtr, Gmat::COORDINATE_SYSTEM, "EarthMJ2000Ec");
btecParam->SetRefObjectName(Gmat::SPACECRAFT, "MySpacecraft");
btecParam->SetRefObject(scPtr, Gmat::SPACECRAFT, "MySpacecraft");
out.Put("----- test btParam->EvaluateReal()");
out.Put("----- Should get an exception due to non-hyperbolic orbit");
realVal = btecParam->EvaluateReal();
//.........这里部分代码省略.........
示例3: main
//------------------------------------------------------------------------------
// int main(int argc, char *argv[])
//------------------------------------------------------------------------------
int main(int argc, char *argv[])
{
std::string eopFileName = "/GMAT/dev/datafiles/EOPFiles/eopc04.62-now";
std::string nutFileName = "/GMAT/dev/datafiles/ITRF/NUTATION.DAT";
std::string planFileName = "/GMAT/dev/datafiles/ITRF/NUT85.DAT";
std::string SLPFileName = "/GMAT/dev/datafiles/mac/DBS_mn2000.dat";
std::string DEFileName = "/GMAT/dev/datafiles/DEascii/macp1941.405";
std::string LeapFileName = "/GMAT/dev/datafiles/tai-utcFiles/tai-utc.dat";
//std::string eopFileName = "/Users/wendyshoan/WORKONLY/dev/build3/bin/files/eop/eopc04.62-now";
//std::string nutFileName = "/Users/wendyshoan/WORKONLY/dev/build3/bin/files/itrf/NUTATION.DAT";
//std::string planFileName = "/Users/wendyshoan/WORKONLY/dev/build3/bin/files/itrf//NUT85.DAT";
//std::string SLPFileName = "/Users/wendyshoan/WORKONLY/dev/build3/bin/files/planetary_ephem/slp/DBS_mn2000.dat";
//std::string DEFileName = "/Users/wendyshoan/WORKONLY/dev/build3/bin/files/planetary_ephem/de/macp1941.405";
//std::string LeapFileName = "/Users/wendyshoan/WORKONLY/dev/build3/bin/files/time/tai-utc.dat";
cout << "=-=-=-=-=-=-= TEST CalculatedPoint/Barycenter ....." << endl;
cout << " ------ number of objects instantiated = " << GmatBase::GetInstanceCount() << endl;
cout.setf(ios::fixed);
cout.precision(30);
cout << "\n==> First, test the CalculatedPointFactory <==" << endl;
CalculatedPointFactory *cpf = new CalculatedPointFactory();
cout << "CalculatedPointFactory created .........." << endl;
cout << " ------ number of objects instantiated = " << GmatBase::GetInstanceCount() << endl;
LeapSecsFileReader* ls;
EopFile *eop;
ItrfCoefficientsFile* itrf;
try
{
ls = new LeapSecsFileReader(LeapFileName);
ls->Initialize();
eop = new EopFile(eopFileName);
eop->Initialize();
itrf = new ItrfCoefficientsFile(nutFileName, planFileName);
itrf->Initialize();
TimeConverterUtil::SetLeapSecsFileReader(ls);
TimeConverterUtil::SetEopFile(eop);
}
catch (BaseException &bbee)
{
cout << "ERROR !!!!! " << bbee.GetMessage() << endl;
}
SolarSystem* ss;
Star* sol;
Planet* earth;
Planet* mars;
Planet* jupiter;
Moon* luna;
std::string j2000BN = "";
SpacePoint* j2000B = NULL;
try
{
cout << "\n==> Create the solar system <==" << endl;
ss = new SolarSystem("TheSS");
cout << "solar system name = " << ss->GetName() << endl;
cout << " ------ number of objects instantiated = " << GmatBase::GetInstanceCount() << endl;
earth = (Planet*) ss->GetBody(SolarSystem::EARTH_NAME);
cout << "earth name = " << earth->GetName() << endl;
cout << "earth's type name is " << earth->GetTypeName() << endl;
sol = (Star*) ss->GetBody(SolarSystem::SUN_NAME);
cout << "sol name = " << sol->GetName() << endl;
cout << "sol's type name is " << sol->GetTypeName() << endl;
cout << " ------ number of objects instantiated = " << GmatBase::GetInstanceCount() << endl;
luna = (Moon*) ss->GetBody(SolarSystem::MOON_NAME);
cout << "luna name = " << luna->GetName() << endl;
cout << "luna's type name is " << luna->GetTypeName() << endl;
mars = (Planet*) ss->GetBody(SolarSystem::MARS_NAME);
cout << "mars name = " << mars->GetName() << endl;
cout << "mars's type name is " << mars->GetTypeName() << endl;
jupiter = (Planet*) ss->GetBody(SolarSystem::JUPITER_NAME);
cout << "jupiter name = " << jupiter->GetName() << endl;
cout << "jupiter's type name is " << jupiter->GetTypeName() << endl;
SlpFile* anSLP;
DeFile* aDE;
try
{
anSLP = new SlpFile(SLPFileName);
aDE = new DeFile(Gmat::DE405,DEFileName);
cout << "the SLP file is : " << anSLP->GetName() << endl;
cout << "the DE file is : " << aDE->GetName() << endl;
}
catch (BaseException &be1)
{
cout << "ERROR with ephem file -> " << be1.GetMessage() << endl;
}
//.........这里部分代码省略.........