本文整理汇总了C++中Array_::getElt方法的典型用法代码示例。如果您正苦于以下问题:C++ Array_::getElt方法的具体用法?C++ Array_::getElt怎么用?C++ Array_::getElt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Array_
的用法示例。
在下文中一共展示了Array_::getElt方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: flexionFDSimulationWithHitMap
//.........这里部分代码省略.........
// Check for a Run->Quit menu pick every <x> second.
system.addEventHandler(new UserInputHandler(*silo, 0.001));
system.realizeTopology();
//Show ContactSurfaceIndex for each contact surface
// for (int i=0; i < matter.getNumBodies(); ++i) {
//MobilizedBodyIndex mbx(i);
// const MobilizedBody& mobod = matter.getMobilizedBody(mbx);
// const int nsurfs = mobod.getBody().getNumContactSurfaces();
//printf("mobod %d has %d contact surfaces\n", (int)mbx, nsurfs);
////cout << "mobod with mass: " << (float)mobod.getBodyMass(si) << " has " << nsurfs << " contact surfaces" << endl;
// //for (int i=0; i<nsurfs; ++i) {
// //printf("%2d: index %d\n", i,
// //(int)tracker.getContactSurfaceIndex(mbx,i));
// //}
// }
//cout << "tracker num of surfaces: " << tracker.getNumSurfaces() << endl;
//State state = system.getDefaultState();
//viz.report(state);
State& state = model.initializeState();
viz.updSimbodyVisualizer().report(state);
// Add reporters
ForceReporter* forceReporter = new ForceReporter(&model);
model.addAnalysis(forceReporter);
CustomAnalysis* customReporter = new CustomAnalysis(&model, "r");
model.addAnalysis(customReporter);
// Create the integrator and manager for the simulation.
SimTK::RungeKuttaMersonIntegrator integrator(model.getMultibodySystem());
//SimTK::CPodesIntegrator integrator(model.getMultibodySystem());
//integrator.setAccuracy(.01);
//integrator.setAccuracy(1e-3);
//integrator.setFixedStepSize(0.001);
Manager manager(model, integrator);
// Define the initial and final simulation times
double initialTime = 0.0;
double finalTime = 0.2;
// Integrate from initial time to final time
manager.setInitialTime(initialTime);
manager.setFinalTime(finalTime);
std::cout<<"\n\nIntegrating from "<<initialTime<<" to " <<finalTime<<std::endl;
result = std::time(nullptr);
std::cout << "\nBefore integrate(si) " << std::asctime(std::localtime(&result)) << endl;
manager.integrate(state);
result = std::time(nullptr);
std::cout << "\nAfter integrate(si) " << std::asctime(std::localtime(&result)) << endl;
// Save the simulation results
Storage statesDegrees(manager.getStateStorage());
statesDegrees.print("../outputs/states_flex.sto");
model.updSimbodyEngine().convertRadiansToDegrees(statesDegrees);
statesDegrees.setWriteSIMMHeader(true);
statesDegrees.print("../outputs/states_degrees_flex.mot");
// force reporter results
forceReporter->getForceStorage().print("../outputs/force_reporter_flex.mot");
//customReporter->print( "../outputs/custom_reporter_flex.mot");
//cout << "You can choose 'Replay'" << endl;
int menuId, item;
unsigned int frameRate = 5;
do {
cout << "Please choose 'Replay' or 'Quit'" << endl;
viz.updInputSilo().waitForMenuPick(menuId, item);
if (item != ReplayItem && item != QuitItem)
cout << "\aDude... follow instructions!\n";
if (item == ReplayItem)
{
cout << "Type desired frame rate (integer) for playback and press Enter (default = 1) : ";
//frameRate = cin.get();
cin >> frameRate;
if (cin.fail())
{
cout << "Not an int. Setting default frame rate." << endl;
cin.clear();
cin.ignore(std::numeric_limits<int>::max(),'\n');
frameRate = 1;
}
//cout << "saveEm size: " << saveEm.size() << endl;
for (unsigned int i=0; i<saveEm.size(); i++)
{
viz.updSimbodyVisualizer().drawFrameNow(saveEm.getElt(i));
if (frameRate == 0)
frameRate = 1;
usleep(1000000/frameRate);
}
}
} while (menuId != RunMenuId || item != QuitItem);
}