当前位置: 首页>>代码示例>>C++>>正文


C++ Planet::GetMass方法代码示例

本文整理汇总了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;

}
开发者ID:rockstorm101,项目名称:GMAT,代码行数:101,代码来源:TestBary.cpp


注:本文中的Planet::GetMass方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。