本文整理汇总了C++中simtk::Vector::dump方法的典型用法代码示例。如果您正苦于以下问题:C++ Vector::dump方法的具体用法?C++ Vector::dump怎么用?C++ Vector::dump使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类simtk::Vector
的用法示例。
在下文中一共展示了Vector::dump方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: compareSimulationStates
void compareSimulationStates(SimTK::Vector q_sb, SimTK::Vector u_sb,
SimTK::Vector q_osim, SimTK::Vector u_osim,
string errorMessagePrefix = "")
{
using namespace SimTK;
Vector q_err = q_sb;
Vector u_err = u_sb;
int nq = q_osim.size();
if(q_sb.size() > nq){ // we have an unused quaternion slot in Simbody
q_sb.dump("Simbody q's:");
q_osim.dump("OpenSim q's:");
//This is a hack knowing the free and ball joint tests have the
// quaternion q's first and that the q's are packed as qqqq or aaa*
// for a ball and qqqqxyz or aaaxyz* for a free joint
int quat_ind = ((nq > 6) ? 6 : 3);
int j = 0;
for(int i=0; i< q_sb.size(); i++){
if(i != quat_ind){
q_err[j] = q_sb[i] - q_osim[j];
j++;
}
}
}
else{
if(nq > q_sb.size()){ // OpenSim using constrains
q_err[0] = q_sb[0] - q_osim[0];
q_err[1] = q_sb[1] - q_osim[1];
u_err[0] = u_sb[0] - u_osim[0];
u_err[1] = u_sb[1] - u_osim[1];
}
else{
q_err = q_sb - q_osim;
u_err = u_sb - u_osim;
}
}
//cout<<"\nSimbody - OpenSim:"<<endl;
//q_err.dump("Diff q's:");
//u_err.dump("Diff u's:");
stringstream errorMessage1, errorMessage2;
errorMessage1 << "testConstraints compareSimulationStates failed q_err.norm = " << q_err.norm();
errorMessage2 << "testConstraints compareSimulationStates failed u_err.norm = " << u_err.norm();
ASSERT(q_err.norm() <= 10*integ_accuracy, __FILE__, __LINE__, errorMessagePrefix + errorMessage1.str());
ASSERT(u_err.norm() <= 20*integ_accuracy, __FILE__, __LINE__, errorMessagePrefix + errorMessage2.str());
}