本文整理汇总了C++中SolarSystem::SetSource方法的典型用法代码示例。如果您正苦于以下问题:C++ SolarSystem::SetSource方法的具体用法?C++ SolarSystem::SetSource怎么用?C++ SolarSystem::SetSource使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SolarSystem
的用法示例。
在下文中一共展示了SolarSystem::SetSource方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
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)
{
cout << "ERROR with ephem file -> " << be1.GetMessage() << endl;
}
ss->SetSource(Gmat::SLP);
ss->SetSourceFile(anSLP);
//ss->SetSource(Gmat::DE_405);
//ss->SetSourceFile(aDE);
// set the j2000Body
j2000BN = "Earth";
j2000B = earth;
sol->SetJ2000BodyName(j2000BN);
sol->SetJ2000Body(j2000B);
earth->SetJ2000BodyName(j2000BN);
earth->SetJ2000Body(j2000B);
luna->SetJ2000BodyName(j2000BN);
luna->SetJ2000Body(j2000B);
mars->SetJ2000BodyName(j2000BN);
mars->SetJ2000Body(j2000B);
jupiter->SetJ2000BodyName(j2000BN);
jupiter->SetJ2000Body(j2000B);
}
catch (GmatBaseException &ex)
{
cout << "Some kind of error ..........." << endl;
}
bool isOK = false;
cout << "\n==> Now creating CoordinateSystems <==" << endl;
CoordinateSystem* mj2000 = new CoordinateSystem("", "CoordSystemMJ2000");
cout << " ------ number of objects instantiated = " << GmatBase::GetInstanceCount() << endl;
mj2000->SetSolarSystem(ss);
mj2000->SetStringParameter("OriginName","Earth");
示例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
//.........这里部分代码省略.........
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;
}
//ss->SetSource(Gmat::SLP);
//ss->SetSourceFile(anSLP);
ss->SetSource(Gmat::DE_405);
ss->SetSourceFile(aDE);
// set the j2000Body
j2000BN = "Earth";
j2000B = earth;
sol->SetJ2000BodyName(j2000BN);
sol->SetJ2000Body(j2000B);
earth->SetJ2000BodyName(j2000BN);
earth->SetJ2000Body(j2000B);
luna->SetJ2000BodyName(j2000BN);
luna->SetJ2000Body(j2000B);
mars->SetJ2000BodyName(j2000BN);
mars->SetJ2000Body(j2000B);
jupiter->SetJ2000BodyName(j2000BN);
jupiter->SetJ2000Body(j2000B);
}
catch (GmatBaseException &ex)
{
cout << "Some kind of error ..........." << endl;
}
bool OK = false;
cout << "Now creating Barycenter1" << endl;
Barycenter *bary1 = (Barycenter*) cpf->CreateCalculatedPoint("Barycenter", "Bary1");
cout << "Now setting bddies for Bary1 .........." << endl;
bary1->SetStringParameter("BodyNames","Earth",0);
bary1->SetStringParameter("BodyNames","Sun",1);
bary1->SetStringParameter("BodyNames","Luna",2);
OK = bary1->SetRefObject(earth, Gmat::SPACE_POINT, "Earth");