Skip to content

Commit 51ef274

Browse files
committed
Merge remote-tracking branch 'opensim-org/master' into FixingSO
2 parents 26b88b9 + 3535586 commit 51ef274

File tree

331 files changed

+168304
-19850
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

331 files changed

+168304
-19850
lines changed

.clang-format

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
# This file can be used by the clang-format tool to
2+
# automatically format C++ source code.
3+
# See https://clang.llvm.org/docs/ClangFormat.html.
4+
# You can either run clang-format directly, or you can use
5+
# Integrated Development Environments (IDEs) that support clang-format,
6+
# such as:
7+
# - Visual Studio (https://devblogs.microsoft.com/cppblog/clangformat-support-in-visual-studio-2017-15-7-preview-1/),
8+
# - CLion (https://www.jetbrains.com/help/clion/clangformat-as-alternative-formatter.html).
9+
# See the documentation for IDEs for more information.
10+
---
11+
Language: Cpp
12+
# BasedOnStyle: LLVM
13+
AccessModifierOffset: -4
14+
AlignAfterOpenBracket: DontAlign
15+
AlignConsecutiveAssignments: false
16+
AlignConsecutiveDeclarations: false
17+
AlignEscapedNewlines: Right
18+
AlignOperands: true
19+
AlignTrailingComments: true
20+
AllowAllParametersOfDeclarationOnNextLine: true
21+
AllowShortBlocksOnASingleLine: true
22+
AllowShortCaseLabelsOnASingleLine: true
23+
AllowShortFunctionsOnASingleLine: All
24+
AllowShortIfStatementsOnASingleLine: true
25+
AllowShortLoopsOnASingleLine: true
26+
AlwaysBreakAfterDefinitionReturnType: None
27+
AlwaysBreakAfterReturnType: None
28+
AlwaysBreakBeforeMultilineStrings: false
29+
# AlwaysBreakTemplateDeclarations: Yes
30+
BinPackArguments: true
31+
BinPackParameters: true
32+
BraceWrapping:
33+
AfterClass: false
34+
AfterControlStatement: false
35+
AfterEnum: false
36+
AfterFunction: false
37+
AfterNamespace: false
38+
AfterObjCDeclaration: false
39+
AfterStruct: false
40+
AfterUnion: false
41+
AfterExternBlock: false
42+
BeforeCatch: false
43+
BeforeElse: false
44+
IndentBraces: false
45+
SplitEmptyFunction: true
46+
SplitEmptyRecord: true
47+
SplitEmptyNamespace: true
48+
BreakBeforeBinaryOperators: None
49+
BreakBeforeBraces: Attach
50+
BreakBeforeInheritanceComma: false
51+
# BreakInheritanceList: BeforeColon
52+
BreakBeforeTernaryOperators: true
53+
BreakConstructorInitializersBeforeComma: false
54+
BreakConstructorInitializers: BeforeColon
55+
BreakAfterJavaFieldAnnotations: false
56+
BreakStringLiterals: true
57+
ColumnLimit: 80
58+
CommentPragmas: '^ IWYU pragma:'
59+
CompactNamespaces: false
60+
ConstructorInitializerAllOnOneLineOrOnePerLine: false
61+
ConstructorInitializerIndentWidth: 8
62+
ContinuationIndentWidth: 8
63+
Cpp11BracedListStyle: true
64+
DerivePointerAlignment: false
65+
DisableFormat: false
66+
ExperimentalAutoDetectBinPacking: false
67+
FixNamespaceComments: true
68+
ForEachMacros:
69+
- foreach
70+
- Q_FOREACH
71+
- BOOST_FOREACH
72+
IncludeBlocks: Regroup
73+
IncludeCategories:
74+
- Regex: '^(<SimTKcommon/)'
75+
Priority: 2
76+
- Regex: '^(<simbody/)'
77+
Priority: 3
78+
- Regex: '^(<OpenSim/)'
79+
Priority: 4
80+
- Regex: '.*'
81+
Priority: 1
82+
IncludeIsMainRegex: '(Test)?$'
83+
IndentCaseLabels: false
84+
IndentPPDirectives: AfterHash
85+
IndentWidth: 4
86+
IndentWrappedFunctionNames: false
87+
JavaScriptQuotes: Leave
88+
JavaScriptWrapImports: true
89+
KeepEmptyLinesAtTheStartOfBlocks: true
90+
MacroBlockBegin: ''
91+
MacroBlockEnd: ''
92+
MaxEmptyLinesToKeep: 1
93+
NamespaceIndentation: None
94+
# ObjCBinPackProtocolList: Auto
95+
ObjCBlockIndentWidth: 2
96+
ObjCSpaceAfterProperty: false
97+
ObjCSpaceBeforeProtocolList: true
98+
PenaltyBreakAssignment: 2
99+
PenaltyBreakBeforeFirstCallParameter: 19
100+
PenaltyBreakComment: 300
101+
PenaltyBreakFirstLessLess: 120
102+
PenaltyBreakString: 1000
103+
# PenaltyBreakTemplateDeclaration: 10
104+
PenaltyExcessCharacter: 1000000
105+
PenaltyReturnTypeOnItsOwnLine: 60
106+
PointerAlignment: Left
107+
ReflowComments: true
108+
SortIncludes: true
109+
SortUsingDeclarations: true
110+
SpaceAfterCStyleCast: false
111+
SpaceAfterTemplateKeyword: true
112+
SpaceBeforeAssignmentOperators: true
113+
# SpaceBeforeCpp11BracedList: false
114+
# SpaceBeforeCtorInitializerColon: true
115+
# SpaceBeforeInheritanceColon: true
116+
SpaceBeforeParens: ControlStatements
117+
# SpaceBeforeRangeBasedForLoopColon: true
118+
SpaceInEmptyParentheses: false
119+
SpacesBeforeTrailingComments: 1
120+
SpacesInAngles: false
121+
SpacesInContainerLiterals: true
122+
SpacesInCStyleCastParentheses: false
123+
SpacesInParentheses: false
124+
SpacesInSquareBrackets: false
125+
Standard: Cpp11
126+
TabWidth: 4
127+
UseTab: Never
128+
...
129+
Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
name: continuous-integration
2+
3+
# TODO: build master branch after PRs are merged.
4+
# syntax https://help.github.com/en/articles/workflow-syntax-for-github-actions
5+
on:
6+
schedule:
7+
- cron: '0 2 * * *'
8+
9+
jobs:
10+
windows:
11+
name: Windows
12+
13+
runs-on: windows-2016
14+
15+
steps:
16+
- uses: actions/checkout@v1
17+
- name: Install Chocolatey packages
18+
run: choco install swig --version 3.0.9 --yes --limit-output
19+
- name: Build
20+
run: |
21+
echo %GITHUB_WORKSPACE%\\build_deps
22+
mkdir %GITHUB_WORKSPACE%\\build_deps
23+
chdir %GITHUB_WORKSPACE%\\build_deps
24+
cmake --version
25+
cmake %GITHUB_WORKSPACE%\\dependencies -G"Visual Studio 15 2017" -A x64 -DCMAKE_INSTALL_PREFIX=%GITHUB_WORKSPACE%\\opensim_dependencies_install
26+
cmake --build . --config Release -- /maxcpucount:4
27+
mkdir %GITHUB_WORKSPACE%\\build
28+
chdir %GITHUB_WORKSPACE%\\build
29+
cmake %GITHUB_WORKSPACE% -G"Visual Studio 15 2017" -A x64 -DCMAKE_INSTALL_PREFIX=%GITHUB_WORKSPACE%\\opensim-core-install -DOPENSIM_DEPENDENCIES_DIR=%GITHUB_WORKSPACE%\\opensim_dependencies_install -DWITH_BTK=on -DBUILD_PYTHON_WRAPPING=on -DBUILD_JAVA_WRAPPING=on
30+
cmake --build . --config Release -- /maxcpucount:4
31+
- name: Test
32+
run: |
33+
chdir %GITHUB_WORKSPACE%\\build
34+
ctest --parallel 4 --output-on-failure --build-config Release
35+
- name: Install
36+
run: |
37+
chdir %GITHUB_WORKSPACE%\\build
38+
cmake --build . --config Release --target install -- /maxcpucount:4 /verbosity:quiet
39+
40+
mac:
41+
name: Mac
42+
43+
runs-on: macOS-10.14
44+
45+
steps:
46+
- uses: actions/checkout@v1
47+
- name: Install Homebrew packages
48+
run: |
49+
brew install doxygen swig@3
50+
- name: Build
51+
run: |
52+
mkdir $GITHUB_WORKSPACE/../build_deps && cd $GITHUB_WORKSPACE/../build_deps
53+
DEP_CMAKE_ARGS=($GITHUB_WORKSPACE/dependencies -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/../opensim_dependencies_install -DCMAKE_BUILD_TYPE=Release)
54+
DEP_CMAKE_ARGS+=(-DCMAKE_OSX_DEPLOYMENT_TARGET=10.10)
55+
cmake "${DEP_CMAKE_ARGS[@]}"
56+
make --jobs 4
57+
mkdir $GITHUB_WORKSPACE/../build && cd $GITHUB_WORKSPACE/../build
58+
OSIM_CMAKE_ARGS=($GITHUB_WORKSPACE -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/../opensim-core-install -DCMAKE_BUILD_TYPE=Release)
59+
OSIM_CMAKE_ARGS+=(-DOPENSIM_DEPENDENCIES_DIR=$GITHUB_WORKSPACE/../opensim_dependencies_install)
60+
OSIM_CMAKE_ARGS+=(-DCMAKE_OSX_DEPLOYMENT_TARGET=10.10)
61+
OSIM_CMAKE_ARGS+=(-DWITH_BTK=on)
62+
OSIM_CMAKE_ARGS+=(-DBUILD_PYTHON_WRAPPING=on -DBUILD_JAVA_WRAPPING=on -DSWIG_EXECUTABLE=/usr/local/opt/swig@3/bin/swig)
63+
OSIM_CMAKE_ARGS+=(-DOPENSIM_INSTALL_UNIX_FHS=OFF)
64+
OSIM_CMAKE_ARGS+=(-DOPENSIM_DOXYGEN_USE_MATHJAX=off)
65+
OSIM_CMAKE_ARGS+=(-DOPENSIM_SIMBODY_DOXYGEN_LOCATION="https://simtk.org/api_docs/simbody/latest/")
66+
OSIM_CMAKE_ARGS+=(-DCMAKE_CXX_FLAGS="-Werror")
67+
printf '%s\n' "${OSIM_CMAKE_ARGS[@]}"
68+
cmake "${OSIM_CMAKE_ARGS[@]}"
69+
make --jobs 4
70+
- name: Test
71+
run: |
72+
cd $GITHUB_WORKSPACE/../build
73+
ctest --parallel 4 --output-on-failure
74+
- name: Install
75+
run: |
76+
cd $GITHUB_WORKSPACE/../build
77+
make doxygen
78+
make install
79+
rm -r $GITHUB_WORKSPACE/../opensim_dependencies_install
80+
cd $GITHUB_WORKSPACE/../opensim-core-install/sdk/Python
81+
# Run the python tests, verbosely.
82+
python3 -m unittest discover --start-directory opensim/tests --verbose
83+
# TODO: deploy
84+
85+
linux:
86+
name: Linux
87+
88+
runs-on: ubuntu-18.04
89+
90+
steps:
91+
- uses: actions/checkout@v1
92+
- name: Install packages
93+
run: sudo apt-get install --yes liblapack-dev freeglut3-dev libxi-dev libxmu-dev doxygen python3 python3-dev python3-numpy python3-setuptools swig
94+
- name: Build
95+
run: |
96+
mkdir $GITHUB_WORKSPACE/../build_deps && cd $GITHUB_WORKSPACE/../build_deps
97+
cmake $GITHUB_WORKSPACE/dependencies -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/../opensim_dependencies_install -DCMAKE_BUILD_TYPE=Release
98+
make --jobs 4
99+
mkdir $GITHUB_WORKSPACE/../build && cd $GITHUB_WORKSPACE/../build
100+
OSIM_CMAKE_ARGS=($GITHUB_WORKSPACE -DCMAKE_INSTALL_PREFIX=$GITHUB_WORKSPACE/../opensim-core-install -DCMAKE_BUILD_TYPE=Release)
101+
OSIM_CMAKE_ARGS+=(-DOPENSIM_DEPENDENCIES_DIR=$GITHUB_WORKSPACE/../opensim_dependencies_install)
102+
OSIM_CMAKE_ARGS+=(-DWITH_BTK=on)
103+
OSIM_CMAKE_ARGS+=(-DBUILD_PYTHON_WRAPPING=on -DBUILD_JAVA_WRAPPING=on)
104+
OSIM_CMAKE_ARGS+=(-DOPENSIM_INSTALL_UNIX_FHS=OFF)
105+
OSIM_CMAKE_ARGS+=(-DOPENSIM_DOXYGEN_USE_MATHJAX=off)
106+
OSIM_CMAKE_ARGS+=(-DOPENSIM_SIMBODY_DOXYGEN_LOCATION="https://simtk.org/api_docs/simbody/latest/")
107+
# OSIM_CMAKE_ARGS+=(-DCMAKE_CXX_FLAGS="-Werror")
108+
printf '%s\n' "${OSIM_CMAKE_ARGS[@]}"
109+
cmake "${OSIM_CMAKE_ARGS[@]}"
110+
make --jobs 4
111+
- name: Test
112+
run: |
113+
cd $GITHUB_WORKSPACE/../build
114+
# TODO: Temporary for python to find Simbody libraries.
115+
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GITHUB_WORKSPACE/../opensim_dependencies_install/simbody/lib
116+
ctest --parallel 4 --output-on-failure
117+
- name: Install
118+
run: |
119+
cd $GITHUB_WORKSPACE/../build
120+
make doxygen
121+
make install
122+
rm -r $GITHUB_WORKSPACE/../opensim_dependencies_install
123+
# cd $GITHUB_WORKSPACE/../opensim-core-install/sdk/Python
124+
# Run the python tests, verbosely.
125+
# python3 -m unittest discover --start-directory opensim/tests --verbose
126+
# TODO: deploy
127+
128+
129+

.travis.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ language: cpp
55

66
# Use container-based infrastructure to allow caching (for ccache).
77
sudo: false
8+
dist: trusty
89

910
# For thread_local support on macOS, we require xcode8 or greater.
1011
# Before 2018, xcode7 was the default. Now that xcode8.3 is the default,
@@ -32,7 +33,7 @@ matrix:
3233
- if: type != cron
3334
os: osx
3435
compiler: clang
35-
env: BTYPE=Release WRAP=on DOXY=on NPROC=2 DEPLOY=yes OSX_TARGET=10.10
36+
env: BTYPE=Release WRAP=on DOXY=off NPROC=2 DEPLOY=yes OSX_TARGET=10.10
3637

3738
branches:
3839
except:
@@ -82,6 +83,9 @@ addons:
8283
- valgrind
8384
# To build doxygen documentation.
8485
# TOO OLD; see below. - doxygen
86+
# python3 as linux and osx are still on python2
87+
- python3
88+
- python3-pip
8589
# To avoid being prompted when ssh'ing into sourceforge.
8690
ssh_known_hosts:
8791
# For uploading doxygen.
@@ -217,11 +221,13 @@ install:
217221

218222
# Dependencies.
219223
- OSIM_CMAKE_ARGS+=(-DSIMBODY_HOME=~/simbody -DOPENSIM_DEPENDENCIES_DIR=$OPENSIM_DEPENDENCIES_INSTALL_DIR -DWITH_BTK:BOOL=ON)
220-
224+
# Build applications
225+
- OSIM_CMAKE_ARGS+=(-DOPENSIM_BUILD_INDIVIDUAL_APPS=ON)
226+
221227
# Bindings.
222228
- OSIM_CMAKE_ARGS+=(-DBUILD_PYTHON_WRAPPING=$WRAP -DBUILD_JAVA_WRAPPING=$WRAP -DSWIG_EXECUTABLE=$HOME/swig/bin/swig)
223229
# On Mac, use system python instead of Homebrew python.
224-
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then OSIM_CMAKE_ARGS+=(-DPYTHON_EXECUTABLE=/usr/bin/python); fi
230+
#- if [ "$TRAVIS_OS_NAME" = "osx" ]; then OSIM_CMAKE_ARGS+=(-DPYTHON_EXECUTABLE=/usr/bin/python3); fi
225231

226232
# Doxygen.
227233
- OSIM_CMAKE_ARGS+=(-DOPENSIM_DOXYGEN_USE_MATHJAX=off -DOPENSIM_SIMBODY_DOXYGEN_LOCATION="https://simtk.org/api_docs/simbody/latest/")
@@ -264,7 +270,7 @@ script:
264270
# Go to the python wrapping package directory.
265271
- if [ "$WRAP" = "on" ]; then cd $OPENSIM_HOME/sdk/Python; fi
266272
# Run the python tests, verbosely.
267-
- if [ "$WRAP" = "on" ]; then /usr/bin/python -m unittest discover --start-directory opensim/tests --verbose; fi
273+
- if [ "$WRAP" = "on" ]; then python3 -m unittest discover --start-directory opensim/tests --verbose; fi
268274

269275
## Set up ssh for sourceforge.
270276
- if [[ "$DEPLOY" = "yes" || ("$DOXY" = "on" && "$TRAVIS_OS_NAME" = "linux" && "$TRAVIS_PULL_REQUEST" != "false") ]]; then PREP_SOURCEFORGE_SSH=0; else PREP_SOURCEFORGE_SSH=1; fi

Applications/Analyze/test/subject02_Setup_IAA_02_232.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
<compute_potentials_only> false </compute_potentials_only>
7676
<!--Report individual contributions to constraint reactions in addition to
7777
accelerations.-->
78-
<report_constraint_reactions> false </report_constraint_reactions>
78+
<report_constraint_reactions> true </report_constraint_reactions>
7979
</InducedAccelerations>
8080
</objects>
8181
<groups/>

Applications/Analyze/test/testAnalyzeTool.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -133,15 +133,11 @@ void testTugOfWar(const string& dataFileName, const double& defaultAct) {
133133
analyze.run();
134134

135135
// Load the AnalyzTool results for the muscle's force through time
136-
TimeSeriesTable_<double> results =
137-
STOFileAdapter_<double>::
138-
read("Analyze_Tug_of_War/Tug_of_War_Millard_Iso_ForceReporter_forces.sto");
136+
TimeSeriesTable_<double> results("Analyze_Tug_of_War/Tug_of_War_Millard_Iso_ForceReporter_forces.sto");
139137
assert(results.getNumColumns() == 1);
140138
SimTK::Vector forces = results.getDependentColumnAtIndex(0);
141139

142-
TimeSeriesTable_<double> outputs_table =
143-
STOFileAdapter_<double>::
144-
read("Analyze_Tug_of_War/Tug_of_War_Millard_Iso_Outputs.sto");
140+
TimeSeriesTable_<double> outputs_table("Analyze_Tug_of_War/Tug_of_War_Millard_Iso_Outputs.sto");
145141
SimTK::Vector tf_output = outputs_table.getDependentColumnAtIndex(1);
146142

147143
// Load input data as StatesTrajectory used to perform the Analysis

Applications/Analyze/test/testStaticOptimization.cpp

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ using namespace std;
3838
*/
3939
void testArm26(const string& muscleModelClassName, double atol, double ftol);
4040

41+
void testArm26DisabledMuscles();
42+
4143
void testLapackErrorDLASD4();
4244

4345
void testModelWithPassiveForces();
@@ -95,6 +97,14 @@ int main()
9597
failures.push_back("testRelativePathInExternalLoads");
9698
}
9799

100+
try {
101+
testArm26DisabledMuscles();
102+
}
103+
catch (const std::exception& e) {
104+
cout << e.what() << endl;
105+
failures.push_back("testArm26DisabledMuscles");
106+
}
107+
98108
if (!failures.empty()) {
99109
cout << "Done, with failure(s): " << failures << endl;
100110
return 1;
@@ -238,3 +248,21 @@ void testRelativePathInExternalLoads() {
238248
analyze.setResultsDir("Results_UsingRelativePaths");
239249
analyze.run();
240250
}
251+
252+
void testArm26DisabledMuscles() {
253+
AnalyzeTool analyze("arm26_Setup_StaticOptimization.xml");
254+
analyze.setResultsDir("Results_arm26_StaticOptimization_Disabled");
255+
Model& model=analyze.getModel();
256+
model.updComponent<Actuator>("/forceset/TRIlat").set_appliesForce(false);
257+
model.updComponent<Actuator>("/forceset/TRImed").set_appliesForce(false);
258+
analyze.run();
259+
Storage activations(analyze.getResultsDir() + "/arm26_StaticOptimization_activation.sto");
260+
ASSERT_EQUAL(activations.getColumnLabels().size(), 5);
261+
ASSERT_EQUAL(activations.getColumnLabels().findIndex("TRIlat"), -1);
262+
ASSERT_EQUAL(activations.getColumnLabels().findIndex("TRImed"), -1);
263+
Storage forces(analyze.getResultsDir() + "/arm26_StaticOptimization_force.sto");
264+
ASSERT_EQUAL(forces.getColumnLabels().size(), 5);
265+
ASSERT_EQUAL(forces.getColumnLabels().findIndex("TRIlat"), -1);
266+
ASSERT_EQUAL(forces.getColumnLabels().findIndex("TRImed"), -1);
267+
268+
}

Applications/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ add_subdirectory(IK)
88
add_subdirectory(ID)
99
add_subdirectory(CMC)
1010
add_subdirectory(RRA)
11+
add_subdirectory(opensense)
1112
add_subdirectory(versionUpdate)
1213

1314
add_subdirectory(opensim-cmd)

0 commit comments

Comments
 (0)