Skip to content

Instantly share code, notes, and snippets.

View adamkewley's full-sized avatar

Adam Kewley adamkewley

View GitHub Profile
==3541== Memcheck, a memory error detector
==3541== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==3541== Using Valgrind-3.14.0 and LibVEX; rerun with -h for copyright info
==3541== Command: ./opensim-cmd
==3541==
[info] Updating Model file from 30000 to latest format...
[info] Loaded model f0914m from file model_generic.osim
[warning] Couldn't find file 'sacrum.vtp'.
[warning] Couldn't find file 'pelvis.vtp'.
[warning] Couldn't find file 'l_pelvis.vtp'.
@adamkewley
adamkewley / ak_opensim-build.bat
Created September 29, 2020 08:57
Automatically end-to-end build OpenSim4 from source /w CMake + Visual Studio
Rem Automatically end-to-end build opensim on Windows
set build_type=RelWithDebInfo
set generator=Visual Studio 16 2019
set project_dir=%CD%
set deps_build_dir=%project_dir%\deps-build
set deps_install_dir=%project_dir%\%build_type%-deps-install
set build_dir=%project_dir%\build
set install_dir=%project_dir%\%build_type%-install
set configuration_types=Debug;Release;MinSizeRel;RelWithDebInfo
==13528== Memcheck, a memory error detector
==13528== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==13528== Using Valgrind-3.14.0 and LibVEX; rerun with -h for copyright info
==13528== Command: ./opensim-cmd
==13528== Parent PID: 8611
==13528==
==13528==
==13528== HEAP SUMMARY:
==13528== in use at exit: 430,209 bytes in 2,856 blocks
==13528== total heap usage: 8,398,926 allocs, 8,396,070 frees, 684,100,483 bytes allocated
#!/usr/bin/env bash
# (before) checkout this project
# git clone https://github.com/opensim-org/opensim-core.git
# cd opensim-core/
# (before) install package-managed dependencies
# apt-get install git cmake cmake-curses-gui \
# freeglut3-dev libxi-dev libxmu-dev \
# liblapack-dev swig python-dev default-jdk
/* -------------------------------------------------------------------------- *
* test_suite.cpp *
* -------------------------------------------------------------------------- *
* Test_suite that checks analytical solutions of muscle lengths over *
* wrapping surfaces with the numerical solutions of OpenSim. Especially *
* important for unconventional wrapping (over a rotated cylinder for example *
* *
* Author(s): Joris Verhagen *
* *
* Licensed under the Apache License, Version 2.0 (the "License"); you may *
@adamkewley
adamkewley / coordinate_ma_measure.cpp
Created November 30, 2020 15:52
Measure which coordinate affect muscle moment arms in an OpenSim model
#include <OpenSim/Simulation/Model/Model.h>
#include <OpenSim/Simulation/SimulationUtilities.h>
#include <iostream>
#include <cstring>
#include <cmath>
using OpenSim::Coordinate;
using OpenSim::Component;
#include <OpenSim/Common/Mtx.h>
#include <OpenSim/Simulation/Wrap/WrapMath.h>
#define PICOBENCH_IMPLEMENT_WITH_MAIN
#include "picobench.hpp"
#include <random>
static std::minstd_rand rng{std::random_device{}()};
static std::uniform_real_distribution<double> dist;
@adamkewley
adamkewley / splinefit.cpp
Created December 14, 2020 16:03
This is the prettiest code for spline fitting ever ever
#include <OpenSim/Simulation/Model/Model.h>
#include <OpenSim/Simulation/SimulationUtilities.h>
#include <iostream>
#include <cstring>
#include <cmath>
using OpenSim::Coordinate;
using OpenSim::Component;
#!/usr/bin/env bash
# (before) checkout this project
# git clone https://github.com/opensim-org/opensim-core.git
# cd opensim-core/
# (before) install package-managed dependencies
#apt-get install git cmake cmake-curses-gui \
# freeglut3-dev libxi-dev libxmu-dev \
# liblapack-dev swig python-dev default-jdk
#include "show_model_screen.hpp"
#include "osmv_config.hpp"
#include "application.hpp"
#include "screen.hpp"
#include "meshes.hpp"
#include "opensim_wrapper.hpp"
#include "loading_screen.hpp"
#include "globals.hpp"