@@ -75,7 +75,7 @@ MuscleForceDirection::MuscleForceDirection(
7575// CLONE CONSTRUCTOR
7676Object* MuscleForceDirection::copy () const {
7777 MuscleForceDirection* object = new MuscleForceDirection (*this );
78- return ( object) ;
78+ return object;
7979}
8080
8181// ============ OPERATORS ============
@@ -93,7 +93,7 @@ MuscleForceDirection& MuscleForceDirection::operator=(
9393 _bodyNames = aMuscleForceDirection._bodyNames ;
9494 _effectInsertion = aMuscleForceDirection._effectInsertion ;
9595
96- return ( *this ) ;
96+ return *this ;
9797}
9898
9999// setNull()
@@ -130,7 +130,7 @@ void MuscleForceDirection::setupProperties() {
130130 " directions are desired at the effective muscle attachments." );
131131 _propertySet.append (&_boolEffectiveInsertionsProp);
132132
133- _boolPrintAttachPointProp.setName (" print_attachments " );
133+ _boolPrintAttachPointProp.setName (" print_muscle_attachments " );
134134 _boolPrintAttachPointProp.setComment (
135135 " Flag (true or false)specifying whether a storage file with the "
136136 " position of the muscle attachments will be printed." );
@@ -197,7 +197,7 @@ void MuscleForceDirection::constructDescriptionAttachments() {
197197// constructColumnLabels() for the output results
198198void MuscleForceDirection::constructColumnLabels () {
199199 if (_model == NULL ) return ;
200- const Set<Muscle> muscleSet = _model->getMuscles ();
200+ const auto & muscleSet = _model->getMuscles ();
201201
202202 // Get the indexes of the muscles attached to the specified bodies.
203203 _muscleIndices = getMusclesIndexForBody (_model, _bodyNames);
@@ -210,7 +210,7 @@ void MuscleForceDirection::constructColumnLabels() {
210210 if (!_expressInLocalFrame) {
211211 // get ground body name
212212 auto groundbody = _model->getGround ();
213- std::string GroundName = groundbody.getName ();
213+ auto GroundName = groundbody.getName ();
214214
215215 // creates labels for muscles in global reference frame
216216 for (int i = 0 ; i < _muscleIndices.getSize (); i++) {
@@ -229,7 +229,7 @@ void MuscleForceDirection::constructColumnLabels() {
229229 for (int i = 0 ; i < _muscleIndices.getSize (); i++) {
230230 j = _muscleIndices[i];
231231
232- const PathPointSet & pathpointSet =
232+ const auto & pathpointSet =
233233 muscleSet[j].getGeometryPath ().getPathPointSet ();
234234 int SetLast = pathpointSet.getSize () - 1 ;
235235
@@ -300,14 +300,14 @@ void MuscleForceDirection::setModel(Model& aModel) {
300300// RECORD: THE CORE OF THE ANALYSIS
301301int MuscleForceDirection::record (const SimTK::State& s) {
302302 // Muscles
303- const BodySet & bodySet = _model->getBodySet ();
304- const Set<Muscle> & muscleSet = _model->getMuscles ();
303+ const auto & bodySet = _model->getBodySet ();
304+ const auto & muscleSet = _model->getMuscles ();
305305
306306 // the analysis to be performed is defined within the for loop.
307307 for (int i = 0 ; i < _muscleIndices.getSize (); i++) {
308308 // Extract the path of selected muscle
309- Muscle & muscle = muscleSet.get (_muscleIndices[i]);
310- const GeometryPath & path = muscle.getGeometryPath ();
309+ const auto & muscle = muscleSet.get (_muscleIndices[i]);
310+ const auto & path = muscle.getGeometryPath ();
311311
312312 /* ----------NOTE-------------------------------------------
313313 GetCurrentPath doesn't work as well as PointForceDirection.
@@ -420,7 +420,7 @@ int MuscleForceDirection::record(const SimTK::State& s) {
420420 for (int k = 0 ; k < PFDs.getSize (); k++) { delete PFDs[k]; }
421421 }
422422
423- return ( 0 ) ;
423+ return 0 ;
424424}
425425
426426// BEGIN
@@ -437,7 +437,7 @@ int MuscleForceDirection::begin(SimTK::State& s) {
437437 int status = 0 ;
438438 if (_storeDir.getSize () <= 0 ) { status = record (s); }
439439
440- return ( status) ;
440+ return status;
441441}
442442// STEP
443443
@@ -446,7 +446,7 @@ int MuscleForceDirection::step(const SimTK::State& s, int stepNumber) {
446446
447447 record (s);
448448
449- return ( 0 ) ;
449+ return 0 ;
450450}
451451
452452// END
@@ -455,7 +455,7 @@ int MuscleForceDirection::end(SimTK::State& s) {
455455
456456 record (s);
457457
458- return ( 0 ) ;
458+ return 0 ;
459459}
460460
461461// Print results.
@@ -485,7 +485,7 @@ int MuscleForceDirection::printResults(const string& aBaseName,
485485 aDT, aExtension);
486486 }
487487
488- return ( 0 ) ;
488+ return 0 ;
489489}
490490
491491// UTILITIES Utilities implemented by Luca Modenese (check on 15th March 2012).
@@ -495,8 +495,8 @@ int MuscleForceDirection::printResults(const string& aBaseName,
495495bool MuscleForceDirection::isMuscleAttachedToBody (const Muscle& aMuscle,
496496 const string& aBodyName) {
497497 bool Attached = false ;
498- OpenSim::GeometryPath aGeometryPath = aMuscle.getGeometryPath ();
499- OpenSim::PathPointSet aPointSet = aGeometryPath.getPathPointSet ();
498+ const auto & aGeometryPath = aMuscle.getGeometryPath ();
499+ const auto & aPointSet = aGeometryPath.getPathPointSet ();
500500 int FinalPointIndex = aPointSet.getSize () - 1 ;
501501
502502 /* ---------NOTE--------------------------------------------
@@ -517,7 +517,7 @@ bool MuscleForceDirection::isMuscleAttachedToBody(const Muscle& aMuscle,
517517Array<int > MuscleForceDirection::getMusclesIndexForBody (
518518 Model* model, const Array<std::string>& bodyNames) {
519519 // Entire muscleset
520- const Set<Muscle> muscles = model->getMuscles ();
520+ const auto & muscles = model->getMuscles ();
521521 Array<int > musclesIndexForBody;
522522
523523 // CASE 1: the 'all' flag is considered: all muscles will be analyzed.
@@ -532,10 +532,10 @@ Array<int> MuscleForceDirection::getMusclesIndexForBody(
532532 else {
533533 int k = 0 , n = 0 ;
534534
535- OpenSim:: Array<int > MusclesIndexForBody_temp;
536- // OpenSim:: Set<OpenSim:: Muscle> muscles = _model->getMuscles();
535+ Array<int > MusclesIndexForBody_temp;
536+ // Set<Muscle> muscles = _model->getMuscles();
537537 for (int n_body = 0 ; n_body < bodyNames.getSize (); ++n_body) {
538- std::string aBodyName = bodyNames.get (n_body);
538+ auto aBodyName = bodyNames.get (n_body);
539539
540540 /* ----------------NOTE----------------------------------------------
541541 Here an array of indexes MusclesIndexForBody_temp is created
@@ -599,7 +599,7 @@ void MuscleForceDirection::getEffectiveAttachments(
599599 --------------------------------------------*/
600600
601601 const auto & InitialBody = aPFDs[0 ]->frame ();
602- std::string InitialBodyName = InitialBody.getName ();
602+ auto InitialBodyName = InitialBody.getName ();
603603 // int effecInsertProx;
604604 for (int n = 0 ; n < N_points; n++) {
605605 const auto & FollowBody = aPFDs[n]->frame ();
@@ -615,7 +615,7 @@ void MuscleForceDirection::getEffectiveAttachments(
615615 is found. The previous point is the effective insertion.
616616 --------------------------------------------*/
617617 const auto & FinalBody = aPFDs[N_points - 1 ]->frame ();
618- std::string FinalBodyName = FinalBody.getName ();
618+ auto FinalBodyName = FinalBody.getName ();
619619 for (int n = N_points - 1 ; n >= 0 ; n--) {
620620 const auto & PreviousBody = aPFDs[n]->frame ();
621621 if (FinalBodyName != PreviousBody.getName ()) {
@@ -626,8 +626,8 @@ void MuscleForceDirection::getEffectiveAttachments(
626626}
627627
628628// NormalizeVec3 is an inline function to calculate the norm of a vector Vec3.
629- inline void MuscleForceDirection::NormalizeVec3 (SimTK::Vec3& v1,
630- SimTK::Vec3& rNormv1) {
629+ void MuscleForceDirection::NormalizeVec3 (SimTK::Vec3& v1,
630+ SimTK::Vec3& rNormv1) {
631631 double Magnitude =
632632 sqrt (pow (v1[0 ], 2.0 ) + pow (v1[1 ], 2.0 ) + pow (v1[2 ], 2.0 ));
633633 rNormv1 = v1 / Magnitude;
0 commit comments