Skip to content

Commit

Permalink
Add some debug print outs
Browse files Browse the repository at this point in the history
  • Loading branch information
nickbianco committed Oct 2, 2024
1 parent 5f3a5e7 commit bc3545f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
5 changes: 0 additions & 5 deletions OpenSim/Actuators/Test/testDeGrooteFregly2016Muscle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -634,18 +634,13 @@ TEST_CASE("DeGrooteFregly2016Muscle basics") {
SimTK::Real fiberStiffnessAlongTendon =
diffFiberStiffnessAlongTendon.calcDerivative(
muscle.get_optimal_fiber_length());
CAPTURE(muscle.getFiberStiffnessAlongTendon(state));
CAPTURE(fiberStiffnessAlongTendon);
CHECK_THAT(muscle.getFiberStiffnessAlongTendon(state),
Catch::Matchers::WithinRel(fiberStiffnessAlongTendon, 1e-6));

SimTK::Real tendonStiffness = SimTK::Infinity;
CHECK(muscle.getTendonStiffness(state) == SimTK::Infinity);
SimTK::Real muscleStiffness = muscle.calcMuscleStiffness(
tendonStiffness, fiberStiffnessAlongTendon);
CAPTURE(muscleStiffness);
CAPTURE(tendonStiffness);
CAPTURE(muscle.getTendonStiffness(state));
CHECK_THAT(muscle.getMuscleStiffness(state),
Catch::Matchers::WithinRel(muscleStiffness, 1e-6));
CHECK_THAT(muscle.getFiberActivePower(state),
Expand Down
4 changes: 4 additions & 0 deletions OpenSim/Analyses/OutputReporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,23 +130,27 @@ int OutputReporter::printResults(const std::string& baseName,
return 0;
}

log_info("OutputReporter checking extension is .sto: {}", extension);
OPENSIM_THROW_IF_FRMOBJ(IO::Lowercase(extension) != ".sto",
Exception, "Only writing results to '.sto' format is supported.");

std::string prefix = dir.empty() ? "" : dir + "/";

log_info("OutputReporter.printResults: Writing double results to {}.", prefix);
auto& tableD = _tableReporterDouble->getTable();
if (tableD.getNumColumns()) {
STOFileAdapter_<double>::write(tableD,
prefix + baseName + "_Outputs" + extension);
}

log_info("OutputReporter.printResults: Writing Vec3 results to {}.", prefix);
auto& tableV3 = _tableReporterVec3->getTable();
if (tableV3.getNumColumns()) {
STOFileAdapter_<SimTK::Vec3>::write(tableV3,
prefix + baseName + "_OutputsVec3" + extension);
}

log_info("OutputReporter.printResults: Writing SpatialVec results to {}.", prefix);
auto& tableSV = _tableReporterSpatialVec->getTable();
if (tableSV.getNumColumns()) {
STOFileAdapter_<SimTK::SpatialVec>::write(tableSV,
Expand Down
8 changes: 4 additions & 4 deletions OpenSim/Simulation/Model/AnalysisSet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,11 +254,11 @@ void AnalysisSet::
printResults(const string &aBaseName,const string &aDir,double aDT,
const string &aExtension)
{
int i;
int size = getSize();
for(i=0;i<size;i++) {
for(int i = 0; i < getSize(); i++) {
Analysis& analysis = get(i);
if(analysis.getOn() && analysis.getPrintResultFiles()) analysis.printResults(aBaseName,aDir,aDT,aExtension);
if(analysis.getOn() && analysis.getPrintResultFiles()) {
analysis.printResults(aBaseName, aDir, aDT, aExtension);
}
}
}
//=============================================================================
Expand Down

0 comments on commit bc3545f

Please sign in to comment.