本文整理汇总了C++中Planet::GetMass方法的典型用法代码示例。如果您正苦于以下问题:C++ Planet::GetMass方法的具体用法?C++ Planet::GetMass怎么用?C++ Planet::GetMass使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Planet
的用法示例。
在下文中一共展示了Planet::GetMass方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
if (!OK) cout << "ERROR setting barycenter with body Sun" << endl;
OK = bary1->SetRefObject(luna, Gmat::SPACE_POINT, "Luna");
if (!OK) cout << "ERROR setting barycenter with body Luna" << endl;
Integer num = 0;
StringArray names;
cout << "Check out bary1 data ---------------------" << endl;
num = bary1->GetIntegerParameter("NumberOfBodies");
cout << "bary1 number of bodies = " << num << endl;
cout << "bary1 body names are: " << endl;
names = bary1->GetStringArrayParameter(bary1->GetParameterID("BodyNames"));
for (unsigned int i = 0; i < names.size(); i++)
cout << " .... " << names.at(i) << endl;
cout << "bary1 bodies (their names) are: " << endl;
for (Integer i = 0; i < num; i++)
{
cout << " .... " << (bary1->GetRefObject(Gmat::SPACE_POINT, names.at(i), i))->GetName() << endl;
}
cout << "Now try to clone bary1 " << endl;
Barycenter* bary2 = (Barycenter*) bary1->Clone();
cout << "Check out bary2 data ---------------------" << endl;
num = bary2->GetIntegerParameter("NumberOfBodies");
cout << "bary2 number of bodies = " << num << endl;
cout << "bary2 body names are: " << endl;
names = bary2->GetStringArrayParameter(bary1->GetParameterID("BodyNames"));
for (unsigned int i = 0; i < names.size(); i++)
cout << " .... " << names.at(i) << endl;
cout << "bary2 bodies (their names) are: " << endl;
for (Integer i = 0; i < num; i++)
{
cout << " .... " << (bary2->GetRefObject(Gmat::SPACE_POINT, names.at(i), i))->GetName() << endl;
}
cout << "NOW try to clear the body list .........." << endl;
bary2->TakeAction("ClearBodies");
num = bary2->GetIntegerParameter("NumberOfBodies");
cout << "bary2 number of bodies = " << num << endl;
cout << "bary2 body names are: " << endl;
names = bary2->GetStringArrayParameter(bary1->GetParameterID("BodyNames"));
for (unsigned int i = 0; i < names.size(); i++)
cout << " .... " << names.at(i) << endl;
cout << "bary2 bodies (their names) are: " << endl;
for (Integer i = 0; i < num; i++)
{
cout << " .... " << (bary2->GetRefObject(Gmat::SPACE_POINT, names.at(i), i))->GetName() << endl;
}
A1Mjd atTime1;
// Real ut1_utc = -0.5036517; // 2005/01/01
Real atTime = atTime1.UtcMjdToA1Mjd(ModifiedJulianDate(1991,4,6,7,51,28.39));
A1Mjd testTime(atTime);
cout << "The test time is " << testTime.Get() << endl;
cout << "*** NOW try to do bary1 calculations ........." << endl;
cout.setf(ios::scientific);
cout << "Earth's mass = " << earth->GetMass() << endl;
//cout.setf(ios::fixed);
//cout.precision(30);
cout << "Earth's position and velocity at test time are : " << earth->GetMJ2000State(atTime) << endl;
//cout.setf(ios::scientific);
cout << "Sun's mass = " << sol->GetMass() << endl;
//cout.setf(ios::fixed);
//cout.precision(30);
cout << "Sun's position and velocity at test time are : " << sol->GetMJ2000State(atTime) << endl;
//cout.setf(ios::scientific);
cout << "Luna's mass = " << luna->GetMass() << endl;
//cout.setf(ios::fixed);
//cout.precision(30);
cout << "Luna's position and velocity at test time are : " << luna->GetMJ2000State(atTime) << endl;
cout << "bary1's position and velocity at test time = " << bary1->GetMJ2000State(atTime) << endl;
cout << "Now delete SolarSystem ............." << endl;
delete ss;
cout << " ------ number of objects instantiated = " << GmatBase::GetInstanceCount() << endl;
cout << "Now delete Barycenter 1 ............." << endl;
delete bary1;
cout << "........ bary1 deleted ............." << endl;
cout << "Now delete Barycenter 2 ............." << endl;
delete bary2;
cout << "........ bary2 deleted ............." << endl;
cout << "Now delete everything else ............." << endl;
delete cpf;
cout << "........ cpf deleted ............." << endl;
delete ls;
cout << "........ ls deleted ............." << endl;
delete eop;
cout << "........ eop deleted ............." << endl;
delete itrf;
cout << "........ itrf deleted ............." << endl;
cout << " ------ number of objects instantiated = " << GmatBase::GetInstanceCount() << endl;
cout << "=-=-=-=-=-=-= END TEST CalculatedPoint/Barycenter ....." << endl;
}