diff --git a/.gitignore b/.gitignore index 9a58815aee..7ba3fb048b 100644 --- a/.gitignore +++ b/.gitignore @@ -149,11 +149,13 @@ tests/sbml-test-suite/ tests/sedml-test-suite/ -mtoc/config/latexextras.sty-e +matlab/mtoc/config/latexextras.sty-e -mtoc/config/latexextras.sty +matlab/mtoc/config/latexextras.sty -mtoc/config/Doxyfile-e +matlab/mtoc/config/Doxyfile-e + +.directory .project @@ -167,3 +169,19 @@ __pycache__ tests/cpputest/writeResults.h5 tests/cpputest/writeResults.h5.bak + +tests/sbml-semantic-test-cases/* + +python/.idea/misc.xml + +python/.idea/modules.xml + +python/.idea/python.iml + +python/.idea/workspace.xml + +*.pyc + +python/testSpeedy.py + +python/test.txt diff --git a/.travis.yml b/.travis.yml index fa7e01d62c..74c580e22f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,6 +24,7 @@ matrix: - doxygen - doxygen-latex - cppcheck + - swig3.0 - libboost-serialization-dev env: ENABLE_GCOV_COVERAGE=TRUE before_install: @@ -35,21 +36,30 @@ matrix: before_install: - brew update # without this homebrew can stumble over wrong ruby version - (brew install gcc || brew link --overwrite gcc) # fix linker warning regarding /usr/local/include/c++ - - brew install hdf5 cppcheck + - brew install hdf5 cppcheck swig + - brew upgrade python install: + # Python distutils only looks for `swig` and does not find `swig3.0` + - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then mkdir -p ~/bin/ && ln -s /usr/bin/swig3.0 ~/bin/swig && export PATH=~/bin/:$PATH; fi + - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then pyenv versions; fi + - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then pyenv shell 2.7 3.6; fi + - pip3 install --user --upgrade pip setuptools wheel pkgconfig - ./scripts/buildSuiteSparse.sh - ./scripts/buildSundials.sh - ./scripts/buildCpputest.sh - ./scripts/buildAmici.sh - - ./scripts/buildTests.sh script: - ./scripts/run-cpputest.sh - ./scripts/run-cppcheck.sh + - ./scripts/run-python_unittest.sh - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ./scripts/run-valgrind.sh; fi - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ./scripts/run-doxygen.sh; fi +after_failure: + - ls -alR + notifications: webhooks: urls: diff --git a/@amimodel/compileC.m b/@amimodel/compileC.m deleted file mode 100644 index d9230fa14d..0000000000 --- a/@amimodel/compileC.m +++ /dev/null @@ -1,8 +0,0 @@ -function compileC(this) - % compileC compiles the mex simulation file - % - % Return values: - % void - - amimodel.compileAndLinkModel(this.modelname, this.wrap_path, this.recompile, this.coptim, this.debug, this.funs, this.cfun, this.adjoint); -end diff --git a/@amimodel/generateM.m b/@amimodel/generateM.m deleted file mode 100644 index 89e20ca5c5..0000000000 --- a/@amimodel/generateM.m +++ /dev/null @@ -1,440 +0,0 @@ -function generateM(this, amimodelo2) -% generateM generates the matlab wrapper for the compiled C files. -% -% Parameters: -% amimodelo2: this struct must contain all necessary symbolic -% definitions for second order sensivities @type amimodel -% -% Return values: -% void - -nx = this.nx; -ny = this.ny; -np = this.np; -nk = this.nk; -nz = this.nz; -if(~isempty(amimodelo2)) - nztrue = amimodelo2.nztrue; - nxtrue = amimodelo2.nxtrue; - nytrue = amimodelo2.nytrue; - o2flag = amimodelo2.o2flag; -else - nztrue = nz; - nxtrue = nx; - nytrue = ny; - o2flag = this.o2flag; -end - -[commit_hash,branch,url] = getCommitHash( this.wrap_path ); -if(isempty(commit_hash)) - commit_hash = '#'; -end - -if(o2flag) - nxtrue = amimodelo2.nxtrue; - nytrue = amimodelo2.nytrue; -end - -%% Generation of the simulation file - -fid = fopen(fullfile(this.wrap_path,'models',this.modelname,['simulate_',this.modelname,'.m']),'w'); -fprintf(fid,['%% simulate_' this.modelname '.m is the matlab interface to the cvodes mex\n'... - '%% which simulates the ordinary differential equation and respective\n'... - '%% sensitivities according to user specifications.\n'... - '%% this routine was generated using AMICI commit ' commit_hash ' in branch ' branch ' in repo ' url '.\n'... - '%%\n'... - '%% USAGE:\n'... - '%% ======\n'... - '%% [...] = simulate_' this.modelname '(tout,theta)\n'... - '%% [...] = simulate_' this.modelname '(tout,theta,kappa,data,options)\n'... - '%% [status,tout,x,y,sx,sy] = simulate_' this.modelname '(...)\n'... - '%%\n'... - '%% INPUTS:\n'... - '%% =======\n'... - '%% tout ... 1 dimensional vector of timepoints at which a solution to the ODE is desired\n'... - '%% theta ... 1 dimensional parameter vector of parameters for which sensitivities are desired.\n'... - '%% this corresponds to the specification in model.sym.p\n'... - '%% kappa ... 1 dimensional parameter vector of parameters for which sensitivities are not desired.\n'... - '%% this corresponds to the specification in model.sym.k\n'... - '%% data ... struct containing the following fields:\n'... - '%% Y ... 2 dimensional matrix containing data.\n'... - '%% columns must correspond to observables and rows to time-points\n'... - '%% Sigma_Y ... 2 dimensional matrix containing standard deviation of data.\n'... - '%% columns must correspond to observables and rows to time-points\n'... - '%% T ... (optional) 2 dimensional matrix containing events.\n'... - '%% columns must correspond to event-types and rows to possible event-times\n'... - '%% Sigma_T ... (optional) 2 dimensional matrix containing standard deviation of events.\n'... - '%% columns must correspond to event-types and rows to possible event-times\n'... - '%% options ... additional options to pass to the cvodes solver. Refer to the cvodes guide for more documentation.\n'... - '%% .atol ... absolute tolerance for the solver. default is specified in the user-provided syms function.\n'... - '%% .rtol ... relative tolerance for the solver. default is specified in the user-provided syms function.\n'... - '%% .maxsteps ... maximal number of integration steps. default is specified in the user-provided syms function.\n'... - '%% .tstart ... start of integration. for all timepoints before this, values will be set to initial value.\n'... - '%% .sens_ind ... 1 dimensional vector of indexes for which sensitivities must be computed.\n'... - '%% default value is 1:length(theta).\n'... - '%% .x0 ... user-provided state initialisation. This should be a vector of dimension [#states, 1].\n'... - '%% default is state initialisation based on the model definition.\n'... - '%% .sx0 ... user-provided sensitivity initialisation. this should be a matrix of dimension [#states x #parameters].\n'... - '%% default is sensitivity initialisation based on the derivative of the state initialisation.\n'... - '%% .lmm ... linear multistep method for forward problem.\n'... - '%% 1: Adams-Bashford\n'... - '%% 2: BDF (DEFAULT)\n'... - '%% .iter ... iteration method for linear multistep.\n'... - '%% 1: Functional\n'... - '%% 2: Newton (DEFAULT)\n'... - '%% .linsol ... linear solver module.\n'... - '%% direct solvers:\n'... - '%% 1: Dense (DEFAULT)\n'... - '%% 2: Band (not implemented)\n'... - '%% 3: LAPACK Dense (not implemented)\n'... - '%% 4: LAPACK Band (not implemented)\n'... - '%% 5: Diag (not implemented)\n'... - '%% implicit krylov solvers:\n'... - '%% 6: SPGMR\n'... - '%% 7: SPBCG\n'... - '%% 8: SPTFQMR\n'... - '%% sparse solvers:\n'... - '%% 9: KLU\n'... - '%% .stldet ... flag for stability limit detection. this should be turned on for stiff problems.\n'... - '%% 0: OFF\n'... - '%% 1: ON (DEFAULT)\n'... - '%% .qPositiveX ... vector of 0 or 1 of same dimension as state vector. 1 enforces positivity of states.\n'... - '%% .sensi_meth ... method for sensitivity analysis.\n'... - '%% ''forward'': forward sensitivity analysis (DEFAULT)\n'... - '%% ''adjoint'': adjoint sensitivity analysis \n'... - '%% .adjoint ... flag for adjoint sensitivity analysis.\n'... - '%% true: on \n'... - '%% false: off (DEFAULT)\n'... - '%% .ism ... only available for sensi_meth == 1. Method for computation of forward sensitivities.\n'... - '%% 1: Simultaneous (DEFAULT)\n'... - '%% 2: Staggered\n'... - '%% 3: Staggered1\n'... - '%% .Nd ... only available for sensi_meth == 2. Number of Interpolation nodes for forward solution. \n'... - '%% Default is 1000. \n'... - '%% .interpType ... only available for sensi_meth == 2. Interpolation method for forward solution.\n'... - '%% 1: Hermite (DEFAULT for problems without discontinuities)\n'... - '%% 2: Polynomial (DEFAULT for problems with discontinuities)\n'... - '%% .ordering ... online state reordering.\n'... - '%% 0: AMD reordering (default)\n'... - '%% 1: COLAMD reordering\n'... - '%% 2: natural reordering\n'... - '%%\n'... - '%% Outputs:\n'... - '%% ========\n'... - '%% sol.status ... flag for status of integration. generally status<0 for failed integration\n'... - '%% sol.t ... vector at which the solution was computed\n'... - '%% sol.llh ... likelihood value\n'... - '%% sol.chi2 ... chi2 value\n'... - '%% sol.sllh ... gradient of likelihood\n'... - '%% sol.s2llh ... hessian or hessian-vector-product of likelihood\n'... - '%% sol.x ... time-resolved state vector\n'... - '%% sol.y ... time-resolved output vector\n'... - '%% sol.sx ... time-resolved state sensitivity vector\n'... - '%% sol.sy ... time-resolved output sensitivity vector\n'... - '%% sol.z ... event output\n'... - '%% sol.sz ... sensitivity of event output\n'... - ]); -fprintf(fid,['function varargout = simulate_' this.modelname '(varargin)\n\n']); -fprintf(fid,'%% DO NOT CHANGE ANYTHING IN THIS FILE UNLESS YOU ARE VERY SURE ABOUT WHAT YOU ARE DOING\n'); -fprintf(fid,'%% MANUAL CHANGES TO THIS FILE CAN RESULT IN WRONG SOLUTIONS AND CRASHING OF MATLAB\n'); -fprintf(fid,'if(nargin<2)\n'); -fprintf(fid,' error(''Not enough input arguments.'');\n'); -fprintf(fid,'else\n'); -fprintf(fid,' tout=varargin{1};\n'); -fprintf(fid,' theta=varargin{2};\n'); -fprintf(fid,'end\n'); - -fprintf(fid,'if(nargin>=3)\n'); -fprintf(fid,' kappa=varargin{3};\n'); -fprintf(fid,'else\n'); -fprintf(fid,' kappa=[];\n'); -fprintf(fid,'end\n'); -fprintf(fid,'\n'); -if(nk==0) - fprintf(fid,'if(nargin==2)\n'); - fprintf(fid,' kappa = [];\n'); - fprintf(fid,'end\n'); -end - -fprintf(fid,['if(length(theta)<' num2str(np) ')\n']); -fprintf(fid,' error(''provided parameter vector is too short'');\n'); -fprintf(fid,'end\n'); -fprintf(fid,'\n'); - -fprintf(fid,'\n'); -fprintf(fid,'xscale = [];\n'); -fprintf(fid,'if(nargin>=5)\n'); -fprintf(fid,' if(isa(varargin{5},''amioption''))\n'); -fprintf(fid,' options_ami = varargin{5};\n'); -fprintf(fid,' else\n'); -fprintf(fid,' options_ami = amioption(varargin{5});\n'); -fprintf(fid,' end\n'); -fprintf(fid,'else\n'); -fprintf(fid,' options_ami = amioption();\n'); -fprintf(fid,'end\n'); -fprintf(fid,'if(isempty(options_ami.sens_ind))\n'); -fprintf(fid,[' options_ami.sens_ind = 1:' num2str(np) ';\n']); -fprintf(fid,['end\n']); -if(o2flag == 0) -fprintf(fid,'if(options_ami.sensi>1)\n'); -fprintf(fid,' error(''Second order sensitivities were requested but not computed'');\n'); -fprintf(fid,'end\n'); -end -fprintf(fid,'\n'); - -fprintf(fid,'if(isempty(options_ami.pscale))\n'); -fprintf(fid,[' options_ami.pscale = ''' this.param ''' ;\n']); -fprintf(fid,'end\n'); -fprintf(fid,'switch (options_ami.pscale)\n'); -fprintf(fid,' case 1\n'); -fprintf(fid,' chainRuleFactor = exp(theta(options_ami.sens_ind));\n'); -fprintf(fid,' case 2\n'); -fprintf(fid,' chainRuleFactor = 10.^theta(options_ami.sens_ind)*log(10);\n'); -fprintf(fid,' otherwise\n'); -fprintf(fid,' chainRuleFactor = ones(size(options_ami.sens_ind));\n'); -fprintf(fid,'end\n\n'); - -if(o2flag == 2) - fprintf(fid,'if(nargin>=6)\n'); - fprintf(fid,' v = varargin{6};\n'); - fprintf(fid,' v = v(:).*chainRuleFactor;\n'); - fprintf(fid,'else\n'); - fprintf(fid,' if(options_ami.sensi==2)\n'); - fprintf(fid,' error(''6th argument (multiplication vector is missing'');\n'); - fprintf(fid,' end\n'); - fprintf(fid,'end\n'); -end - -if(o2flag) - fprintf(fid,'if(nargout>1)\n'); - fprintf(fid,' if(nargout>6)\n'); - fprintf(fid,' options_ami.sensi = 2;\n'); - fprintf(fid,' options_ami.sensi_meth = ''forward'';\n'); - fprintf(fid,' elseif(nargout>4)\n'); - fprintf(fid,' options_ami.sensi = 1;\n'); - fprintf(fid,' options_ami.sensi_meth = ''forward'';\n'); - fprintf(fid,' else\n'); - fprintf(fid,' options_ami.sensi = 0;\n'); - fprintf(fid,' end\n'); - fprintf(fid,'end\n'); -else - fprintf(fid,'if(nargout>1)\n'); - fprintf(fid,' if(nargout>4)\n'); - fprintf(fid,' options_ami.sensi = 1;\n'); - fprintf(fid,' options_ami.sensi_meth = ''forward'';\n'); - fprintf(fid,' else\n'); - fprintf(fid,' options_ami.sensi = 0;\n'); - fprintf(fid,' end\n'); - fprintf(fid,'end\n'); -end -if(~this.forward) - fprintf(fid,'if(options_ami.sensi>0)\n'); - fprintf(fid,' if(options_ami.sensi_meth == 1)\n'); - fprintf(fid,' error(''forward sensitivities are disabled as necessary routines were not compiled'');\n'); - fprintf(fid,' end\n'); - fprintf(fid,'end\n'); -end -if(~this.adjoint) - fprintf(fid,'if(options_ami.sensi>0)\n'); - fprintf(fid,' if(options_ami.sensi_meth == 2)\n'); - fprintf(fid,' error(''adjoint sensitivities are disabled as necessary routines were not compiled'');\n'); - fprintf(fid,' end\n'); - fprintf(fid,'end\n'); -end -fprintf(fid,['nplist = length(options_ami.sens_ind); %% MUST NOT CHANGE THIS VALUE\n']); -fprintf(fid,['if(nplist == 0)\n']); -fprintf(fid,[' options_ami.sensi = 0;\n']); -fprintf(fid,['end\n']); -if(o2flag) - fprintf(fid,['if(options_ami.sensi > 1)\n']); - fprintf(fid,[' nxfull = ' num2str(amimodelo2.nx) ';\n']); - fprintf(fid,['else\n']); - fprintf(fid,[' nxfull = ' num2str(nxtrue) ';\n']); - fprintf(fid,['end\n']); -else - fprintf(fid,['nxfull = ' num2str(nx) ';\n']); -end -fprintf(fid,['if(isempty(options_ami.qpositivex))\n']); -fprintf(fid,[' options_ami.qpositivex = zeros(nxfull,1);\n']); -fprintf(fid,['else\n']); -fprintf(fid,[' if(numel(options_ami.qpositivex)>=nxfull)\n']); -fprintf(fid,[' options_ami.qpositivex = options_ami.qpositivex(:);\n']); -fprintf(fid,[' else\n']); -fprintf(fid,[' error([''Number of elements in options_ami.qpositivex does not match number of states '' num2str(nxfull) ]);\n']); -fprintf(fid,[' end\n']); -fprintf(fid,['end\n']); -fprintf(fid,'plist = options_ami.sens_ind-1;\n'); -fprintf(fid,['if(nargin>=4)\n']); -fprintf(fid,[' if(isempty(varargin{4}));\n']); -fprintf(fid,[' data=[];\n']); -fprintf(fid,[' else\n']); -fprintf(fid,[' if(isa(varargin{4},''amidata''));\n']); -fprintf(fid,[' data=varargin{4};\n']); -fprintf(fid,[' else\n']); -fprintf(fid,[' data=amidata(varargin{4});\n']); -fprintf(fid,[' end\n']); -fprintf(fid,[' if(data.ne>0);\n']); -fprintf(fid,[' options_ami.nmaxevent = data.ne;\n']); -fprintf(fid,[' else\n']); -fprintf(fid,[' data.ne = options_ami.nmaxevent;\n']); -fprintf(fid,[' end\n']); -fprintf(fid,[' if(isempty(kappa))\n']); -fprintf(fid,[' kappa = data.condition;\n']); -fprintf(fid,[' end\n']); -fprintf(fid,[' if(isempty(tout))\n']); -fprintf(fid,[' tout = data.t;\n']); -fprintf(fid,[' end\n']); -fprintf(fid,[' end\n']); -fprintf(fid,['else\n']); -fprintf(fid,[' data=[];\n']); -fprintf(fid,['end\n']); -fprintf(fid,['if(~all(tout==sort(tout)))\n']); -fprintf(fid,[' error(''Provided time vector is not monotonically increasing!'');\n']); -fprintf(fid,['end\n']); -fprintf(fid,['if(not(length(tout)==length(unique(tout))))\n']); -fprintf(fid,[' error(''Provided time vector has non-unique entries!!'');\n']); -fprintf(fid,['end\n']); -fprintf(fid,['if(max(options_ami.sens_ind)>' num2str(np) ')\n']); -fprintf(fid,[' error(''Sensitivity index exceeds parameter dimension!'')\n']); -fprintf(fid,['end\n']); -fprintf(fid,['if(length(kappa)<' num2str(nk) ')\n']); -fprintf(fid,' error(''provided condition vector is too short'');\n'); -fprintf(fid,'end\n'); - -if(o2flag == 2) - fprintf(fid,'if(nargin>=6)\n'); - fprintf(fid,' kappa = [kappa(:);v(:)];\n'); - fprintf(fid,'end\n'); -end - -fprintf(fid,'init = struct();\n'); -fprintf(fid,'if(~isempty(options_ami.x0))\n'); -fprintf(fid,' if(size(options_ami.x0,2)~=1)\n'); -fprintf(fid,' error(''x0 field must be a row vector!'');\n'); -fprintf(fid,' end\n'); -fprintf(fid,' if(size(options_ami.x0,1)~=nxfull)\n'); -fprintf(fid,' error(''Number of columns in x0 field does not agree with number of states!'');\n'); -fprintf(fid,' end\n'); -fprintf(fid,' init.x0 = options_ami.x0;\n'); -fprintf(fid,'end\n'); -fprintf(fid,'if(~isempty(options_ami.sx0))\n'); -fprintf(fid,' if(size(options_ami.sx0,2)~=nplist)\n'); -fprintf(fid,' error(''Number of rows in sx0 field does not agree with number of model parameters!'');\n'); -fprintf(fid,' end\n'); -fprintf(fid,' if(size(options_ami.sx0,1)~=nxfull)\n'); -fprintf(fid,' error(''Number of columns in sx0 field does not agree with number of states!'');\n'); -fprintf(fid,' end\n'); -fprintf(fid,' init.sx0 = bsxfun(@times,options_ami.sx0,1./permute(chainRuleFactor(:),[2,1]));\n'); -fprintf(fid,'end\n'); - -if(o2flag) - fprintf(fid,'if(options_ami.sensi<2)\n'); - fprintf(fid,[' sol = ami_' this.modelname '(tout,theta(1:' num2str(np) '),kappa(1:' num2str(nk) '),options_ami,plist,xscale,init,data);\n']); - fprintf(fid,'else\n'); - switch(o2flag) - case 1 - fprintf(fid,[' sol = ami_' this.modelname '_o2(tout,theta(1:' num2str(np) '),kappa(1:' num2str(nk) '),options_ami,plist,xscale,init,data);\n']); - case 2 - fprintf(fid,[' sol = ami_' this.modelname '_o2vec(tout,theta(1:' num2str(np) '),kappa(1:' num2str(amimodelo2.nk) '),options_ami,plist,xscale,init,data);\n']); - end - fprintf(fid,'end\n'); -else - fprintf(fid,['sol = ami_' this.modelname '(tout,theta(1:' num2str(np) '),kappa(1:' num2str(nk) '),options_ami,plist,xscale,init,data);\n']); -end - -if(o2flag) - fprintf(fid,'if(options_ami.sensi == 2)\n'); - fprintf(fid, ' if(~(options_ami.sensi_meth==2))\n'); - - fprintf(fid,[' sz = zeros(size(sol.z,1),' num2str(nztrue) ',length(theta(options_ami.sens_ind)));\n']); - fprintf(fid,[' ssigmaz = zeros(size(sol.z,1),' num2str(nztrue) ',length(theta(options_ami.sens_ind)));\n']); - fprintf(fid,[' srz = zeros(size(sol.z,1),' num2str(nztrue) ',length(theta(options_ami.sens_ind)));\n']); - fprintf(fid,[' for iz = 1:' num2str(nztrue) '\n']); - fprintf(fid,[' sz(:,iz,:) = sol.sz(:,2*iz-1,:);\n']); - fprintf(fid,[' ssigmaz(:,iz,:) = sol.ssigmaz(:,2*iz-1,:);\n']); - fprintf(fid,[' srz(:,iz,:) = sol.srz(:,2*iz-1,:);\n']); - fprintf(fid,[' end\n']); - switch(o2flag) - case 1 - fprintf(fid,[' sol.s2x = reshape(sol.sx(:,' num2str(nxtrue+1) ':end,:),length(tout),' num2str(nxtrue) ',' num2str(np) ',length(options_ami.sens_ind));\n']); - fprintf(fid,[' sol.s2y = reshape(sol.sy(:,' num2str(nytrue+1) ':end,:),length(tout),' num2str(nytrue) ',' num2str(np) ',length(options_ami.sens_ind));\n']); - fprintf(fid,[' sol.s2sigmay = reshape(sol.ssigmay(:,' num2str(nytrue+1) ':end,:),length(tout),' num2str(nytrue) ',' num2str(np) ',length(options_ami.sens_ind));\n']); - case 2 - fprintf(fid,[' sol.s2x = sol.sx(:,' num2str(nxtrue+1) ':end,:);\n']); - fprintf(fid,[' sol.s2y = sol.sy(:,' num2str(nytrue+1) ':end,:);\n']); - fprintf(fid,[' sol.s2sigmay = sol.ssigmay(:,' num2str(nytrue+1) ':end,:);\n']); - end - switch(o2flag) - case 1 - fprintf(fid,[' s2z = zeros(size(sol.z,1),' num2str(nztrue) ',' num2str(np) ',length(options_ami.sens_ind));\n']); - fprintf(fid,[' s2sigmaz = zeros(size(sol.z,1),' num2str(nztrue) ',' num2str(np) ',length(options_ami.sens_ind));\n']); - fprintf(fid,[' s2rz = zeros(size(sol.z,1),' num2str(nztrue) ',' num2str(np) ',length(options_ami.sens_ind));\n']); - case 2 - fprintf(fid,[' s2z = zeros(size(sol.z,1),' num2str(nztrue) ',length(theta(options_ami.sens_ind)));\n']); - fprintf(fid,[' s2sigmaz = zeros(size(sol.z,1),' num2str(nztrue) ',length(theta(options_ami.sens_ind)));\n']); - fprintf(fid,[' s2rz = zeros(size(sol.z,1),' num2str(nztrue) ',length(theta(options_ami.sens_ind)));\n']); - end - fprintf(fid,[' for iz = 1:' num2str(nztrue) '\n']); - switch(o2flag) - case 1 - fprintf(fid,[' sol.s2z(:,iz,:,:) = reshape(sol.sz(:,((iz-1)*(' num2str(np) '+1)+2):((iz-1)*(' num2str(np) '+1)+' num2str(np) '+1),:),options_ami.nmaxevent,1,' num2str(np) ',length(options_ami.sens_ind));\n']); - fprintf(fid,[' sol.s2sigmaz(:,iz,:,:) = reshape(sol.ssigmaz(:,((iz-1)*(' num2str(np) '+1)+2):((iz-1)*(' num2str(np) '+1)+' num2str(np) '+1),:),options_ami.nmaxevent,1,' num2str(np) ',length(options_ami.sens_ind));\n']); - fprintf(fid,[' sol.s2rz(:,iz,:,:) = reshape(sol.srz(:,((iz-1)*(' num2str(np) '+1)+2):((iz-1)*(' num2str(np) '+1)+' num2str(np) '+1),:),options_ami.nmaxevent,1,' num2str(np) ',length(options_ami.sens_ind));\n']); - case 2 - fprintf(fid,[' sol.s2z(:,iz,:) = reshape(sol.sz(:,2*(iz-1)+2,:),options_ami.nmaxevent,1,length(theta(options_ami.sens_ind)));\n']); - fprintf(fid,[' sol.s2sigmaz(:,iz,:) = reshape(sol.ssigmaz(:,2*(iz-1)+2,:),options_ami.nmaxevent,1,length(theta(options_ami.sens_ind)));\n']); - fprintf(fid,[' sol.s2rz(:,iz,:) = reshape(sol.srz(:,2*(iz-1)+2,:),options_ami.nmaxevent,1,length(theta(options_ami.sens_ind)));\n']); - end - fprintf(fid,' end\n'); - fprintf(fid,[' sol.sx = sol.sx(:,1:' num2str(nxtrue) ',:);\n']); - fprintf(fid,[' sol.sy = sol.sy(:,1:' num2str(nytrue) ',:);\n']); - fprintf(fid,[' sol.ssigmay = sol.ssigmay(:,1:' num2str(nytrue) ',:);\n']); - fprintf(fid,[' if(iz>0)\n']); - fprintf(fid,[' sol.sz = sz;\n']); - fprintf(fid,[' sol.ssigmaz = ssigmaz;\n']); - fprintf(fid,[' sol.srz = srz;\n']); - fprintf(fid,' end\n'); - fprintf(fid,' end\n'); - fprintf(fid,[' sol.x = sol.x(:,1:' num2str(nxtrue) ');\n']); - fprintf(fid,[' sol.y = sol.y(:,1:' num2str(nytrue) ');\n']); - fprintf(fid,[' sol.sigmay = sol.sigmay(:,1:' num2str(nytrue) ');\n']); - fprintf(fid,[' sol.z = sol.z(:,1:' num2str(nztrue) ');\n']); - fprintf(fid,[' sol.rz = sol.rz(:,1:' num2str(nztrue) ');\n']); - fprintf(fid,[' sol.sigmaz = sol.sigmaz(:,1:' num2str(nztrue) ');\n']); - fprintf(fid,'end\n'); -end - -fprintf(fid,'if(nargout>1)\n'); -fprintf(fid,' varargout{1} = sol.status;\n'); -fprintf(fid,' varargout{2} = sol.t;\n'); -fprintf(fid,' varargout{3} = sol.x;\n'); -fprintf(fid,' varargout{4} = sol.y;\n'); -fprintf(fid,' if(nargout>4)\n'); -fprintf(fid,' varargout{5} = sol.sx;\n'); -fprintf(fid,' varargout{6} = sol.sy;\n'); -if(o2flag) - fprintf(fid,' if(nargout>6)\n'); - fprintf(fid,' varargout{7} = sol.s2x;\n'); - fprintf(fid,' varargout{8} = sol.s2y;\n'); - fprintf(fid,' end\n'); -end -fprintf(fid,' end\n'); -fprintf(fid,'else\n'); -fprintf(fid,' varargout{1} = sol;\n'); -fprintf(fid,'end\n'); -fprintf(fid,'end\n'); - -fclose(fid); - -%% Generation of the file which computes the Jacobian - -for fun = this.mfuns - if(isfield(this.fun,fun{1})) - fprintf([fun{1} ' | ']); - this.fun.(fun{1}).writeMcode(this); - end -end - - -end - diff --git a/CMakeLists.txt b/CMakeLists.txt index d9d930400c..75d6d32972 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,16 +1,15 @@ # # Build AMICI library # - +cmake_minimum_required(VERSION 3.3) project(amici) -cmake_minimum_required(VERSION 2.8) - -set(AMICI_DIR ${CMAKE_CURRENT_SOURCE_DIR}) - +set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) +set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) +# Compiler flags include(CheckCXXCompilerFlag) set(MY_CXX_FLAGS -Wall) foreach(FLAG ${MY_CXX_FLAGS}) @@ -21,13 +20,25 @@ foreach(FLAG ${MY_CXX_FLAGS}) endif() endforeach(FLAG) -add_definitions(-DAMICI_WITHOUT_MATLAB) - -set(SUITESPARSE_DIR "${AMICI_DIR}/SuiteSparse/") -set(SUNDIALS_LIB_DIR "${AMICI_DIR}/sundials/build/lib") -set(CMAKE_MODULE_PATH ${AMICI_DIR}/CMakeModules) - +# find dependencies find_package(HDF5 COMPONENTS C HL CXX REQUIRED) +set(HDF5_LIBRARIES ${HDF5_HL_LIBRARIES} ${HDF5_C_LIBRARIES} ${HDF5_CXX_LIBRARIES}) +set(SUITESPARSE_DIR "${CMAKE_SOURCE_DIR}/ThirdParty/SuiteSparse/") +set(SUITESPARSE_INCLUDE_DIRS "${SUITESPARSE_DIR}/include" "${CMAKE_SOURCE_DIR}/ThirdParty/sundials/src") +set(SUITESPARSE_LIBRARIES + ${SUITESPARSE_DIR}/KLU/Lib/libklu${CMAKE_STATIC_LIBRARY_SUFFIX} + ${SUITESPARSE_DIR}/COLAMD/Lib/libcolamd${CMAKE_STATIC_LIBRARY_SUFFIX} + ${SUITESPARSE_DIR}/BTF/Lib/libbtf${CMAKE_STATIC_LIBRARY_SUFFIX} + ${SUITESPARSE_DIR}/AMD/Lib/libamd${CMAKE_STATIC_LIBRARY_SUFFIX} + ${SUITESPARSE_DIR}/SuiteSparse_config/libsuitesparseconfig${CMAKE_STATIC_LIBRARY_SUFFIX} + ) + +set(SUNDIALS_LIB_DIR "${CMAKE_SOURCE_DIR}/ThirdParty/sundials/build/lib") +set(SUNDIALS_LIBRARIES ${SUNDIALS_LIB_DIR}/libsundials_nvecserial${CMAKE_STATIC_LIBRARY_SUFFIX} + ${SUNDIALS_LIB_DIR}/libsundials_cvodes${CMAKE_STATIC_LIBRARY_SUFFIX} + ${SUNDIALS_LIB_DIR}/libsundials_idas${CMAKE_STATIC_LIBRARY_SUFFIX} + ) +set(SUNDIALS_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/ThirdParty/sundials/include") # AMICI requires BLAS, currently Intel MKL, CBLAS or MATLAB BLAS can be used. # The latter is not supported via CMake yet. @@ -42,84 +53,109 @@ else() set(BLAS_LIBRARIES -lcblas CACHE STRING "") endif() -include_directories("${AMICI_DIR}/include/") -include_directories("${HDF5_INCLUDE_DIRS}") -include_directories("${AMICI_DIR}/sundials/include") -include_directories("${AMICI_DIR}/sundials/src") -include_directories("${SUITESPARSE_DIR}/include") - -if(NOT "${BLAS_INCLUDE_DIRS}" STREQUAL "") - include_directories(${BLAS_INCLUDE_DIRS}) -endif() +# Add target to create version file +add_custom_target( + version + ${CMAKE_COMMAND} -D SRC=${CMAKE_SOURCE_DIR}/include/amici/version.in.h + -D DST=${CMAKE_BINARY_DIR}/include/amici/version.h + -P ${CMAKE_SOURCE_DIR}/cmake/configureVersion.cmake + ) # Library source files set(AMICI_SRC_LIST - ${AMICI_DIR}/src/symbolic_functions.cpp - ${AMICI_DIR}/src/cblas.cpp - ${AMICI_DIR}/src/amici.cpp - ${AMICI_DIR}/src/misc.cpp - ${AMICI_DIR}/src/rdata.cpp - ${AMICI_DIR}/src/edata.cpp - ${AMICI_DIR}/src/hdf5.cpp - ${AMICI_DIR}/src/spline.cpp - ${AMICI_DIR}/src/solver.cpp - ${AMICI_DIR}/src/solver_cvodes.cpp - ${AMICI_DIR}/src/solver_idas.cpp - ${AMICI_DIR}/src/model.cpp - ${AMICI_DIR}/src/model_ode.cpp - ${AMICI_DIR}/src/model_dae.cpp - ${AMICI_DIR}/src/newton_solver.cpp - ${AMICI_DIR}/src/forwardproblem.cpp - ${AMICI_DIR}/src/steadystateproblem.cpp - ${AMICI_DIR}/src/backwardproblem.cpp -) + ${CMAKE_SOURCE_DIR}/src/symbolic_functions.cpp + ${CMAKE_SOURCE_DIR}/src/cblas.cpp + ${CMAKE_SOURCE_DIR}/src/amici.cpp + ${CMAKE_SOURCE_DIR}/src/misc.cpp + ${CMAKE_SOURCE_DIR}/src/rdata.cpp + ${CMAKE_SOURCE_DIR}/src/edata.cpp + ${CMAKE_SOURCE_DIR}/src/hdf5.cpp + ${CMAKE_SOURCE_DIR}/src/spline.cpp + ${CMAKE_SOURCE_DIR}/src/solver.cpp + ${CMAKE_SOURCE_DIR}/src/solver_cvodes.cpp + ${CMAKE_SOURCE_DIR}/src/solver_idas.cpp + ${CMAKE_SOURCE_DIR}/src/model.cpp + ${CMAKE_SOURCE_DIR}/src/model_ode.cpp + ${CMAKE_SOURCE_DIR}/src/model_dae.cpp + ${CMAKE_SOURCE_DIR}/src/newton_solver.cpp + ${CMAKE_SOURCE_DIR}/src/forwardproblem.cpp + ${CMAKE_SOURCE_DIR}/src/steadystateproblem.cpp + ${CMAKE_SOURCE_DIR}/src/backwardproblem.cpp + ) add_library(${PROJECT_NAME} ${AMICI_SRC_LIST}) +add_dependencies(${PROJECT_NAME} version) +file(GLOB PUBLIC_HEADERS include/amici/*.h) +set_target_properties(${PROJECT_NAME} PROPERTIES PUBLIC_HEADER "${PUBLIC_HEADERS}") +target_include_directories(${PROJECT_NAME} + PUBLIC $ + $ + PUBLIC $ + PUBLIC swig + PUBLIC ${SUNDIALS_INCLUDE_DIRS} + PUBLIC ${SUITESPARSE_INCLUDE_DIRS} + PUBLIC ${HDF5_INCLUDE_DIRS} + ) + +if(NOT "${BLAS_INCLUDE_DIRS}" STREQUAL "") + target_include_directories(${PROJECT_NAME} PUBLIC ${BLAS_INCLUDE_DIRS}) +endif() target_link_libraries(${PROJECT_NAME} - ${SUNDIALS_LIB_DIR}/libsundials_nvecserial${CMAKE_STATIC_LIBRARY_SUFFIX} - ${SUNDIALS_LIB_DIR}/libsundials_cvodes${CMAKE_STATIC_LIBRARY_SUFFIX} - ${SUNDIALS_LIB_DIR}/libsundials_idas${CMAKE_STATIC_LIBRARY_SUFFIX} - ${SUITESPARSE_DIR}/KLU/Lib/libklu${CMAKE_STATIC_LIBRARY_SUFFIX} - ${SUITESPARSE_DIR}/COLAMD/Lib/libcolamd${CMAKE_STATIC_LIBRARY_SUFFIX} - ${SUITESPARSE_DIR}/BTF/Lib/libbtf${CMAKE_STATIC_LIBRARY_SUFFIX} - ${SUITESPARSE_DIR}/AMD/Lib/libamd${CMAKE_STATIC_LIBRARY_SUFFIX} - ${SUITESPARSE_DIR}/SuiteSparse_config/libsuitesparseconfig${CMAKE_STATIC_LIBRARY_SUFFIX} - ${HDF5_HL_LIBRARIES} - ${HDF5_C_LIBRARIES} - ${HDF5_CXX_LIBRARIES} - ${BLAS_LIBRARIES} - -ldl -lz -lm -) + PUBLIC ${SUNDIALS_LIBRARIES} + PUBLIC ${SUITESPARSE_LIBRARIES} + PUBLIC ${HDF5_LIBRARIES} + PUBLIC ${BLAS_LIBRARIES} + ) # Create targets to make the sources show up in IDEs for convenience add_custom_target(matlabInterface SOURCES src/interface_matlab.cpp src/returndata_matlab.cpp) -add_custom_target(fileTemplates SOURCES src/CMakeLists.template.txt src/main.template.cpp) +add_custom_target(fileTemplates SOURCES src/CMakeLists.template.txt src/main.template.cpp src/wrapfunctions.ODE_template.h src/wrapfunctions.template.cpp swig/CMakeLists_model.txt) if($ENV{ENABLE_GCOV_COVERAGE}) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 --coverage") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 --coverage") endif() -include(CMakeModules/clang-tools.cmake) +include(clang-tools) + +set(AUTHORS "Fabian Froehlich, Jan Hasenauer, Daniel Weindl and Paul Stapor") +set(AUTHOR_EMAIL "fabian.froehlich@helmholtz-muenchen.de") # -include(GenerateExportHeader) -generate_export_header(amici) +include(GNUInstallDirs) install(TARGETS ${PROJECT_NAME} EXPORT AmiciTargets - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib - RUNTIME DESTINATION bin - INCLUDES DESTINATION include -) -export(EXPORT AmiciTargets - FILE "${CMAKE_CURRENT_BINARY_DIR}/AmiciTargets.cmake" - NAMESPACE Upstream:: -) -get_property(AmiciConfigIncludes DIRECTORY PROPERTY INCLUDE_DIRECTORIES) -configure_file(CMakeModules/AmiciConfig.cmake - "${CMAKE_CURRENT_BINARY_DIR}/AmiciConfig.cmake" - @ONLY + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/amici ) +export(EXPORT AmiciTargets FILE AmiciTargets.cmake + NAMESPACE Upstream:: + ) +configure_file(cmake/AmiciConfig.cmake + "${CMAKE_CURRENT_BINARY_DIR}/AmiciConfig.cmake" + @ONLY + ) +include(CMakePackageConfigHelpers) +include(version) +write_basic_package_version_file(AmiciConfigVersion.cmake COMPATIBILITY ExactVersion) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/AmiciConfig.cmake + ${CMAKE_CURRENT_BINARY_DIR}/AmiciTargets.cmake + ${CMAKE_CURRENT_BINARY_DIR}/AmiciConfigVersion.cmake + DESTINATION share/Amici/cmake ) # Register package export(PACKAGE Amici) # + + +# build interfaces for other languages +add_subdirectory(swig) +add_subdirectory(python) + +option(BUILD_TESTS "Build integration tests?" ON) +if(BUILD_TESTS) + enable_testing() + + add_subdirectory(tests/cpputest) +endif() diff --git a/CMakeModules/AmiciConfig.cmake b/CMakeModules/AmiciConfig.cmake deleted file mode 100644 index 355e8b3a33..0000000000 --- a/CMakeModules/AmiciConfig.cmake +++ /dev/null @@ -1,2 +0,0 @@ -include("${CMAKE_CURRENT_LIST_DIR}/AmiciTargets.cmake") -set_property(TARGET Upstream::amici PROPERTY INCLUDE_DIRECTORIES @AmiciConfigIncludes@) diff --git a/README.md b/README.md index 0f4bcd394e..52f9cd3509 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ About AMICI ========== -AMICI provides a MATLAB interface for the SUNDIALS solvers CVODES (for ordinary differential equations) and IDAS (for algebraic differential equations). AMICI allows the user to specify differential equation models in terms of symbolic variables in MATLAB and automatically compiles such models as .mex simulation files. In contrast to the SUNDIALSTB interface, all necessary functions are transformed into native C code, which allows for a significantly faster compilation. Beyond forward integration, the compiled simulation file also allows for forward sensitivity analysis, steady state sensitivity analysis and adjoint sensitivity analysis for likelihood based output functions. +AMICI provides a multilanguage interface for the SUNDIALS solvers CVODES (for ordinary differential equations) and IDAS (for algebraic differential equations). AMICI allows the user to read differential equation models specified as SBML and automatically compiles such models as .mex simulation fiels, c++ executables and python modules. In contrast to the SUNDIALSTB interface, all necessary functions are transformed into native C++ code, which allows for a significantly faster simulation. Beyond forward integration, the compiled simulation file also allows for forward sensitivity analysis, steady state sensitivity analysis and adjoint sensitivity analysis for likelihood based output functions. The interface was designed to provide routines for efficient gradient computation in parameter estimation of biochemical reaction models but is also applicable to a wider range of differential equation constrained optimization problems. @@ -9,7 +9,6 @@ Current build status ==================== Linux/Mac: [![TravisCI](https://travis-ci.org/ICB-DCM/AMICI.svg?branch=master)](https://travis-ci.org/ICB-DCM/AMICI) -Windows: [![AppVeyor](https://ci.appveyor.com/api/projects/status/ob315laj1i6i3om3?svg=true)](https://ci.appveyor.com/project/FFroehlich/amici) Coverage: [![Coverage Status](https://coveralls.io/repos/github/ICB-DCM/AMICI/badge.svg?branch=master)](https://coveralls.io/github/ICB-DCM/AMICI?branch=master) FAQ diff --git a/SuiteSparse/AMD/Demo/Makefile b/ThirdParty/SuiteSparse/AMD/Demo/Makefile similarity index 100% rename from SuiteSparse/AMD/Demo/Makefile rename to ThirdParty/SuiteSparse/AMD/Demo/Makefile diff --git a/SuiteSparse/AMD/Demo/amd_demo.c b/ThirdParty/SuiteSparse/AMD/Demo/amd_demo.c similarity index 100% rename from SuiteSparse/AMD/Demo/amd_demo.c rename to ThirdParty/SuiteSparse/AMD/Demo/amd_demo.c diff --git a/SuiteSparse/AMD/Demo/amd_demo.out b/ThirdParty/SuiteSparse/AMD/Demo/amd_demo.out similarity index 100% rename from SuiteSparse/AMD/Demo/amd_demo.out rename to ThirdParty/SuiteSparse/AMD/Demo/amd_demo.out diff --git a/SuiteSparse/AMD/Demo/amd_demo2.c b/ThirdParty/SuiteSparse/AMD/Demo/amd_demo2.c similarity index 100% rename from SuiteSparse/AMD/Demo/amd_demo2.c rename to ThirdParty/SuiteSparse/AMD/Demo/amd_demo2.c diff --git a/SuiteSparse/AMD/Demo/amd_demo2.out b/ThirdParty/SuiteSparse/AMD/Demo/amd_demo2.out similarity index 100% rename from SuiteSparse/AMD/Demo/amd_demo2.out rename to ThirdParty/SuiteSparse/AMD/Demo/amd_demo2.out diff --git a/SuiteSparse/AMD/Demo/amd_f77cross.f b/ThirdParty/SuiteSparse/AMD/Demo/amd_f77cross.f similarity index 100% rename from SuiteSparse/AMD/Demo/amd_f77cross.f rename to ThirdParty/SuiteSparse/AMD/Demo/amd_f77cross.f diff --git a/SuiteSparse/AMD/Demo/amd_f77cross.out b/ThirdParty/SuiteSparse/AMD/Demo/amd_f77cross.out similarity index 100% rename from SuiteSparse/AMD/Demo/amd_f77cross.out rename to ThirdParty/SuiteSparse/AMD/Demo/amd_f77cross.out diff --git a/SuiteSparse/AMD/Demo/amd_f77demo.f b/ThirdParty/SuiteSparse/AMD/Demo/amd_f77demo.f similarity index 100% rename from SuiteSparse/AMD/Demo/amd_f77demo.f rename to ThirdParty/SuiteSparse/AMD/Demo/amd_f77demo.f diff --git a/SuiteSparse/AMD/Demo/amd_f77demo.out b/ThirdParty/SuiteSparse/AMD/Demo/amd_f77demo.out similarity index 100% rename from SuiteSparse/AMD/Demo/amd_f77demo.out rename to ThirdParty/SuiteSparse/AMD/Demo/amd_f77demo.out diff --git a/SuiteSparse/AMD/Demo/amd_f77simple.f b/ThirdParty/SuiteSparse/AMD/Demo/amd_f77simple.f similarity index 100% rename from SuiteSparse/AMD/Demo/amd_f77simple.f rename to ThirdParty/SuiteSparse/AMD/Demo/amd_f77simple.f diff --git a/SuiteSparse/AMD/Demo/amd_f77simple.out b/ThirdParty/SuiteSparse/AMD/Demo/amd_f77simple.out similarity index 100% rename from SuiteSparse/AMD/Demo/amd_f77simple.out rename to ThirdParty/SuiteSparse/AMD/Demo/amd_f77simple.out diff --git a/SuiteSparse/AMD/Demo/amd_f77wrapper.c b/ThirdParty/SuiteSparse/AMD/Demo/amd_f77wrapper.c similarity index 100% rename from SuiteSparse/AMD/Demo/amd_f77wrapper.c rename to ThirdParty/SuiteSparse/AMD/Demo/amd_f77wrapper.c diff --git a/SuiteSparse/AMD/Demo/amd_l_demo.c b/ThirdParty/SuiteSparse/AMD/Demo/amd_l_demo.c similarity index 100% rename from SuiteSparse/AMD/Demo/amd_l_demo.c rename to ThirdParty/SuiteSparse/AMD/Demo/amd_l_demo.c diff --git a/SuiteSparse/AMD/Demo/amd_l_demo.out b/ThirdParty/SuiteSparse/AMD/Demo/amd_l_demo.out similarity index 100% rename from SuiteSparse/AMD/Demo/amd_l_demo.out rename to ThirdParty/SuiteSparse/AMD/Demo/amd_l_demo.out diff --git a/SuiteSparse/AMD/Demo/amd_simple.c b/ThirdParty/SuiteSparse/AMD/Demo/amd_simple.c similarity index 100% rename from SuiteSparse/AMD/Demo/amd_simple.c rename to ThirdParty/SuiteSparse/AMD/Demo/amd_simple.c diff --git a/SuiteSparse/AMD/Demo/amd_simple.out b/ThirdParty/SuiteSparse/AMD/Demo/amd_simple.out similarity index 100% rename from SuiteSparse/AMD/Demo/amd_simple.out rename to ThirdParty/SuiteSparse/AMD/Demo/amd_simple.out diff --git a/SuiteSparse/AMD/Doc/AMD_UserGuide.bib b/ThirdParty/SuiteSparse/AMD/Doc/AMD_UserGuide.bib similarity index 100% rename from SuiteSparse/AMD/Doc/AMD_UserGuide.bib rename to ThirdParty/SuiteSparse/AMD/Doc/AMD_UserGuide.bib diff --git a/SuiteSparse/AMD/Doc/AMD_UserGuide.pdf b/ThirdParty/SuiteSparse/AMD/Doc/AMD_UserGuide.pdf similarity index 100% rename from SuiteSparse/AMD/Doc/AMD_UserGuide.pdf rename to ThirdParty/SuiteSparse/AMD/Doc/AMD_UserGuide.pdf diff --git a/SuiteSparse/AMD/Doc/AMD_UserGuide.tex b/ThirdParty/SuiteSparse/AMD/Doc/AMD_UserGuide.tex similarity index 100% rename from SuiteSparse/AMD/Doc/AMD_UserGuide.tex rename to ThirdParty/SuiteSparse/AMD/Doc/AMD_UserGuide.tex diff --git a/SuiteSparse/AMD/Doc/ChangeLog b/ThirdParty/SuiteSparse/AMD/Doc/ChangeLog similarity index 100% rename from SuiteSparse/AMD/Doc/ChangeLog rename to ThirdParty/SuiteSparse/AMD/Doc/ChangeLog diff --git a/SuiteSparse/AMD/Doc/License.txt b/ThirdParty/SuiteSparse/AMD/Doc/License.txt similarity index 100% rename from SuiteSparse/AMD/Doc/License.txt rename to ThirdParty/SuiteSparse/AMD/Doc/License.txt diff --git a/SuiteSparse/AMD/Doc/Makefile b/ThirdParty/SuiteSparse/AMD/Doc/Makefile similarity index 100% rename from SuiteSparse/AMD/Doc/Makefile rename to ThirdParty/SuiteSparse/AMD/Doc/Makefile diff --git a/SuiteSparse/AMD/Doc/lesser.txt b/ThirdParty/SuiteSparse/AMD/Doc/lesser.txt similarity index 100% rename from SuiteSparse/AMD/Doc/lesser.txt rename to ThirdParty/SuiteSparse/AMD/Doc/lesser.txt diff --git a/SuiteSparse/AMD/Include/amd.h b/ThirdParty/SuiteSparse/AMD/Include/amd.h similarity index 100% rename from SuiteSparse/AMD/Include/amd.h rename to ThirdParty/SuiteSparse/AMD/Include/amd.h diff --git a/SuiteSparse/AMD/Include/amd_internal.h b/ThirdParty/SuiteSparse/AMD/Include/amd_internal.h similarity index 100% rename from SuiteSparse/AMD/Include/amd_internal.h rename to ThirdParty/SuiteSparse/AMD/Include/amd_internal.h diff --git a/SuiteSparse/AMD/Lib/Makefile b/ThirdParty/SuiteSparse/AMD/Lib/Makefile similarity index 100% rename from SuiteSparse/AMD/Lib/Makefile rename to ThirdParty/SuiteSparse/AMD/Lib/Makefile diff --git a/SuiteSparse/AMD/MATLAB/Contents.m b/ThirdParty/SuiteSparse/AMD/MATLAB/Contents.m similarity index 100% rename from SuiteSparse/AMD/MATLAB/Contents.m rename to ThirdParty/SuiteSparse/AMD/MATLAB/Contents.m diff --git a/SuiteSparse/AMD/MATLAB/amd2.m b/ThirdParty/SuiteSparse/AMD/MATLAB/amd2.m similarity index 100% rename from SuiteSparse/AMD/MATLAB/amd2.m rename to ThirdParty/SuiteSparse/AMD/MATLAB/amd2.m diff --git a/SuiteSparse/AMD/MATLAB/amd_demo.m b/ThirdParty/SuiteSparse/AMD/MATLAB/amd_demo.m similarity index 100% rename from SuiteSparse/AMD/MATLAB/amd_demo.m rename to ThirdParty/SuiteSparse/AMD/MATLAB/amd_demo.m diff --git a/SuiteSparse/AMD/MATLAB/amd_demo.m.out b/ThirdParty/SuiteSparse/AMD/MATLAB/amd_demo.m.out similarity index 100% rename from SuiteSparse/AMD/MATLAB/amd_demo.m.out rename to ThirdParty/SuiteSparse/AMD/MATLAB/amd_demo.m.out diff --git a/SuiteSparse/AMD/MATLAB/amd_install.m b/ThirdParty/SuiteSparse/AMD/MATLAB/amd_install.m similarity index 100% rename from SuiteSparse/AMD/MATLAB/amd_install.m rename to ThirdParty/SuiteSparse/AMD/MATLAB/amd_install.m diff --git a/SuiteSparse/AMD/MATLAB/amd_make.m b/ThirdParty/SuiteSparse/AMD/MATLAB/amd_make.m similarity index 100% rename from SuiteSparse/AMD/MATLAB/amd_make.m rename to ThirdParty/SuiteSparse/AMD/MATLAB/amd_make.m diff --git a/SuiteSparse/AMD/MATLAB/amd_mex.c b/ThirdParty/SuiteSparse/AMD/MATLAB/amd_mex.c similarity index 100% rename from SuiteSparse/AMD/MATLAB/amd_mex.c rename to ThirdParty/SuiteSparse/AMD/MATLAB/amd_mex.c diff --git a/SuiteSparse/AMD/MATLAB/can_24 b/ThirdParty/SuiteSparse/AMD/MATLAB/can_24 similarity index 100% rename from SuiteSparse/AMD/MATLAB/can_24 rename to ThirdParty/SuiteSparse/AMD/MATLAB/can_24 diff --git a/SuiteSparse/AMD/Makefile b/ThirdParty/SuiteSparse/AMD/Makefile similarity index 100% rename from SuiteSparse/AMD/Makefile rename to ThirdParty/SuiteSparse/AMD/Makefile diff --git a/SuiteSparse/AMD/README.txt b/ThirdParty/SuiteSparse/AMD/README.txt similarity index 100% rename from SuiteSparse/AMD/README.txt rename to ThirdParty/SuiteSparse/AMD/README.txt diff --git a/SuiteSparse/AMD/Source/amd.f b/ThirdParty/SuiteSparse/AMD/Source/amd.f similarity index 100% rename from SuiteSparse/AMD/Source/amd.f rename to ThirdParty/SuiteSparse/AMD/Source/amd.f diff --git a/SuiteSparse/AMD/Source/amd_1.c b/ThirdParty/SuiteSparse/AMD/Source/amd_1.c similarity index 100% rename from SuiteSparse/AMD/Source/amd_1.c rename to ThirdParty/SuiteSparse/AMD/Source/amd_1.c diff --git a/SuiteSparse/AMD/Source/amd_2.c b/ThirdParty/SuiteSparse/AMD/Source/amd_2.c similarity index 100% rename from SuiteSparse/AMD/Source/amd_2.c rename to ThirdParty/SuiteSparse/AMD/Source/amd_2.c diff --git a/SuiteSparse/AMD/Source/amd_aat.c b/ThirdParty/SuiteSparse/AMD/Source/amd_aat.c similarity index 100% rename from SuiteSparse/AMD/Source/amd_aat.c rename to ThirdParty/SuiteSparse/AMD/Source/amd_aat.c diff --git a/SuiteSparse/AMD/Source/amd_control.c b/ThirdParty/SuiteSparse/AMD/Source/amd_control.c similarity index 100% rename from SuiteSparse/AMD/Source/amd_control.c rename to ThirdParty/SuiteSparse/AMD/Source/amd_control.c diff --git a/SuiteSparse/AMD/Source/amd_defaults.c b/ThirdParty/SuiteSparse/AMD/Source/amd_defaults.c similarity index 100% rename from SuiteSparse/AMD/Source/amd_defaults.c rename to ThirdParty/SuiteSparse/AMD/Source/amd_defaults.c diff --git a/SuiteSparse/AMD/Source/amd_dump.c b/ThirdParty/SuiteSparse/AMD/Source/amd_dump.c similarity index 100% rename from SuiteSparse/AMD/Source/amd_dump.c rename to ThirdParty/SuiteSparse/AMD/Source/amd_dump.c diff --git a/SuiteSparse/AMD/Source/amd_global.c b/ThirdParty/SuiteSparse/AMD/Source/amd_global.c similarity index 100% rename from SuiteSparse/AMD/Source/amd_global.c rename to ThirdParty/SuiteSparse/AMD/Source/amd_global.c diff --git a/SuiteSparse/AMD/Source/amd_info.c b/ThirdParty/SuiteSparse/AMD/Source/amd_info.c similarity index 100% rename from SuiteSparse/AMD/Source/amd_info.c rename to ThirdParty/SuiteSparse/AMD/Source/amd_info.c diff --git a/SuiteSparse/AMD/Source/amd_order.c b/ThirdParty/SuiteSparse/AMD/Source/amd_order.c similarity index 100% rename from SuiteSparse/AMD/Source/amd_order.c rename to ThirdParty/SuiteSparse/AMD/Source/amd_order.c diff --git a/SuiteSparse/AMD/Source/amd_post_tree.c b/ThirdParty/SuiteSparse/AMD/Source/amd_post_tree.c similarity index 100% rename from SuiteSparse/AMD/Source/amd_post_tree.c rename to ThirdParty/SuiteSparse/AMD/Source/amd_post_tree.c diff --git a/SuiteSparse/AMD/Source/amd_postorder.c b/ThirdParty/SuiteSparse/AMD/Source/amd_postorder.c similarity index 100% rename from SuiteSparse/AMD/Source/amd_postorder.c rename to ThirdParty/SuiteSparse/AMD/Source/amd_postorder.c diff --git a/SuiteSparse/AMD/Source/amd_preprocess.c b/ThirdParty/SuiteSparse/AMD/Source/amd_preprocess.c similarity index 100% rename from SuiteSparse/AMD/Source/amd_preprocess.c rename to ThirdParty/SuiteSparse/AMD/Source/amd_preprocess.c diff --git a/SuiteSparse/AMD/Source/amd_valid.c b/ThirdParty/SuiteSparse/AMD/Source/amd_valid.c similarity index 100% rename from SuiteSparse/AMD/Source/amd_valid.c rename to ThirdParty/SuiteSparse/AMD/Source/amd_valid.c diff --git a/SuiteSparse/AMD/Source/amdbar.f b/ThirdParty/SuiteSparse/AMD/Source/amdbar.f similarity index 100% rename from SuiteSparse/AMD/Source/amdbar.f rename to ThirdParty/SuiteSparse/AMD/Source/amdbar.f diff --git a/SuiteSparse/BTF/Doc/ChangeLog b/ThirdParty/SuiteSparse/BTF/Doc/ChangeLog similarity index 100% rename from SuiteSparse/BTF/Doc/ChangeLog rename to ThirdParty/SuiteSparse/BTF/Doc/ChangeLog diff --git a/SuiteSparse/BTF/Doc/License.txt b/ThirdParty/SuiteSparse/BTF/Doc/License.txt similarity index 100% rename from SuiteSparse/BTF/Doc/License.txt rename to ThirdParty/SuiteSparse/BTF/Doc/License.txt diff --git a/SuiteSparse/BTF/Doc/lesser.txt b/ThirdParty/SuiteSparse/BTF/Doc/lesser.txt similarity index 100% rename from SuiteSparse/BTF/Doc/lesser.txt rename to ThirdParty/SuiteSparse/BTF/Doc/lesser.txt diff --git a/SuiteSparse/BTF/Include/btf.h b/ThirdParty/SuiteSparse/BTF/Include/btf.h similarity index 100% rename from SuiteSparse/BTF/Include/btf.h rename to ThirdParty/SuiteSparse/BTF/Include/btf.h diff --git a/SuiteSparse/BTF/Include/btf_internal.h b/ThirdParty/SuiteSparse/BTF/Include/btf_internal.h similarity index 100% rename from SuiteSparse/BTF/Include/btf_internal.h rename to ThirdParty/SuiteSparse/BTF/Include/btf_internal.h diff --git a/SuiteSparse/BTF/Lib/Makefile b/ThirdParty/SuiteSparse/BTF/Lib/Makefile similarity index 100% rename from SuiteSparse/BTF/Lib/Makefile rename to ThirdParty/SuiteSparse/BTF/Lib/Makefile diff --git a/SuiteSparse/BTF/MATLAB/Contents.m b/ThirdParty/SuiteSparse/BTF/MATLAB/Contents.m similarity index 100% rename from SuiteSparse/BTF/MATLAB/Contents.m rename to ThirdParty/SuiteSparse/BTF/MATLAB/Contents.m diff --git a/SuiteSparse/BTF/MATLAB/Test/btf_test.m b/ThirdParty/SuiteSparse/BTF/MATLAB/Test/btf_test.m similarity index 100% rename from SuiteSparse/BTF/MATLAB/Test/btf_test.m rename to ThirdParty/SuiteSparse/BTF/MATLAB/Test/btf_test.m diff --git a/SuiteSparse/BTF/MATLAB/Test/checkbtf.m b/ThirdParty/SuiteSparse/BTF/MATLAB/Test/checkbtf.m similarity index 100% rename from SuiteSparse/BTF/MATLAB/Test/checkbtf.m rename to ThirdParty/SuiteSparse/BTF/MATLAB/Test/checkbtf.m diff --git a/SuiteSparse/BTF/MATLAB/Test/test1.m b/ThirdParty/SuiteSparse/BTF/MATLAB/Test/test1.m similarity index 100% rename from SuiteSparse/BTF/MATLAB/Test/test1.m rename to ThirdParty/SuiteSparse/BTF/MATLAB/Test/test1.m diff --git a/SuiteSparse/BTF/MATLAB/Test/test2.m b/ThirdParty/SuiteSparse/BTF/MATLAB/Test/test2.m similarity index 100% rename from SuiteSparse/BTF/MATLAB/Test/test2.m rename to ThirdParty/SuiteSparse/BTF/MATLAB/Test/test2.m diff --git a/SuiteSparse/BTF/MATLAB/Test/test3.m b/ThirdParty/SuiteSparse/BTF/MATLAB/Test/test3.m similarity index 100% rename from SuiteSparse/BTF/MATLAB/Test/test3.m rename to ThirdParty/SuiteSparse/BTF/MATLAB/Test/test3.m diff --git a/SuiteSparse/BTF/MATLAB/Test/test4.m b/ThirdParty/SuiteSparse/BTF/MATLAB/Test/test4.m similarity index 100% rename from SuiteSparse/BTF/MATLAB/Test/test4.m rename to ThirdParty/SuiteSparse/BTF/MATLAB/Test/test4.m diff --git a/SuiteSparse/BTF/MATLAB/Test/test5.m b/ThirdParty/SuiteSparse/BTF/MATLAB/Test/test5.m similarity index 100% rename from SuiteSparse/BTF/MATLAB/Test/test5.m rename to ThirdParty/SuiteSparse/BTF/MATLAB/Test/test5.m diff --git a/SuiteSparse/BTF/MATLAB/Test/test6.m b/ThirdParty/SuiteSparse/BTF/MATLAB/Test/test6.m similarity index 100% rename from SuiteSparse/BTF/MATLAB/Test/test6.m rename to ThirdParty/SuiteSparse/BTF/MATLAB/Test/test6.m diff --git a/SuiteSparse/BTF/MATLAB/btf.c b/ThirdParty/SuiteSparse/BTF/MATLAB/btf.c similarity index 100% rename from SuiteSparse/BTF/MATLAB/btf.c rename to ThirdParty/SuiteSparse/BTF/MATLAB/btf.c diff --git a/SuiteSparse/BTF/MATLAB/btf.m b/ThirdParty/SuiteSparse/BTF/MATLAB/btf.m similarity index 100% rename from SuiteSparse/BTF/MATLAB/btf.m rename to ThirdParty/SuiteSparse/BTF/MATLAB/btf.m diff --git a/SuiteSparse/BTF/MATLAB/btf_demo.m b/ThirdParty/SuiteSparse/BTF/MATLAB/btf_demo.m similarity index 100% rename from SuiteSparse/BTF/MATLAB/btf_demo.m rename to ThirdParty/SuiteSparse/BTF/MATLAB/btf_demo.m diff --git a/SuiteSparse/BTF/MATLAB/btf_install.m b/ThirdParty/SuiteSparse/BTF/MATLAB/btf_install.m similarity index 100% rename from SuiteSparse/BTF/MATLAB/btf_install.m rename to ThirdParty/SuiteSparse/BTF/MATLAB/btf_install.m diff --git a/SuiteSparse/BTF/MATLAB/btf_make.m b/ThirdParty/SuiteSparse/BTF/MATLAB/btf_make.m similarity index 100% rename from SuiteSparse/BTF/MATLAB/btf_make.m rename to ThirdParty/SuiteSparse/BTF/MATLAB/btf_make.m diff --git a/SuiteSparse/BTF/MATLAB/drawbtf.m b/ThirdParty/SuiteSparse/BTF/MATLAB/drawbtf.m similarity index 100% rename from SuiteSparse/BTF/MATLAB/drawbtf.m rename to ThirdParty/SuiteSparse/BTF/MATLAB/drawbtf.m diff --git a/SuiteSparse/BTF/MATLAB/maxtrans.c b/ThirdParty/SuiteSparse/BTF/MATLAB/maxtrans.c similarity index 100% rename from SuiteSparse/BTF/MATLAB/maxtrans.c rename to ThirdParty/SuiteSparse/BTF/MATLAB/maxtrans.c diff --git a/SuiteSparse/BTF/MATLAB/maxtrans.m b/ThirdParty/SuiteSparse/BTF/MATLAB/maxtrans.m similarity index 100% rename from SuiteSparse/BTF/MATLAB/maxtrans.m rename to ThirdParty/SuiteSparse/BTF/MATLAB/maxtrans.m diff --git a/SuiteSparse/BTF/MATLAB/strongcomp.c b/ThirdParty/SuiteSparse/BTF/MATLAB/strongcomp.c similarity index 100% rename from SuiteSparse/BTF/MATLAB/strongcomp.c rename to ThirdParty/SuiteSparse/BTF/MATLAB/strongcomp.c diff --git a/SuiteSparse/BTF/MATLAB/strongcomp.m b/ThirdParty/SuiteSparse/BTF/MATLAB/strongcomp.m similarity index 100% rename from SuiteSparse/BTF/MATLAB/strongcomp.m rename to ThirdParty/SuiteSparse/BTF/MATLAB/strongcomp.m diff --git a/SuiteSparse/BTF/Makefile b/ThirdParty/SuiteSparse/BTF/Makefile similarity index 100% rename from SuiteSparse/BTF/Makefile rename to ThirdParty/SuiteSparse/BTF/Makefile diff --git a/SuiteSparse/BTF/README.txt b/ThirdParty/SuiteSparse/BTF/README.txt similarity index 100% rename from SuiteSparse/BTF/README.txt rename to ThirdParty/SuiteSparse/BTF/README.txt diff --git a/SuiteSparse/BTF/Source/btf_maxtrans.c b/ThirdParty/SuiteSparse/BTF/Source/btf_maxtrans.c similarity index 100% rename from SuiteSparse/BTF/Source/btf_maxtrans.c rename to ThirdParty/SuiteSparse/BTF/Source/btf_maxtrans.c diff --git a/SuiteSparse/BTF/Source/btf_order.c b/ThirdParty/SuiteSparse/BTF/Source/btf_order.c similarity index 100% rename from SuiteSparse/BTF/Source/btf_order.c rename to ThirdParty/SuiteSparse/BTF/Source/btf_order.c diff --git a/SuiteSparse/BTF/Source/btf_strongcomp.c b/ThirdParty/SuiteSparse/BTF/Source/btf_strongcomp.c similarity index 100% rename from SuiteSparse/BTF/Source/btf_strongcomp.c rename to ThirdParty/SuiteSparse/BTF/Source/btf_strongcomp.c diff --git a/SuiteSparse/CAMD/Demo/Makefile b/ThirdParty/SuiteSparse/CAMD/Demo/Makefile similarity index 100% rename from SuiteSparse/CAMD/Demo/Makefile rename to ThirdParty/SuiteSparse/CAMD/Demo/Makefile diff --git a/SuiteSparse/CAMD/Demo/camd_demo.c b/ThirdParty/SuiteSparse/CAMD/Demo/camd_demo.c similarity index 100% rename from SuiteSparse/CAMD/Demo/camd_demo.c rename to ThirdParty/SuiteSparse/CAMD/Demo/camd_demo.c diff --git a/SuiteSparse/CAMD/Demo/camd_demo.out b/ThirdParty/SuiteSparse/CAMD/Demo/camd_demo.out similarity index 100% rename from SuiteSparse/CAMD/Demo/camd_demo.out rename to ThirdParty/SuiteSparse/CAMD/Demo/camd_demo.out diff --git a/SuiteSparse/CAMD/Demo/camd_demo2.c b/ThirdParty/SuiteSparse/CAMD/Demo/camd_demo2.c similarity index 100% rename from SuiteSparse/CAMD/Demo/camd_demo2.c rename to ThirdParty/SuiteSparse/CAMD/Demo/camd_demo2.c diff --git a/SuiteSparse/CAMD/Demo/camd_demo2.out b/ThirdParty/SuiteSparse/CAMD/Demo/camd_demo2.out similarity index 100% rename from SuiteSparse/CAMD/Demo/camd_demo2.out rename to ThirdParty/SuiteSparse/CAMD/Demo/camd_demo2.out diff --git a/SuiteSparse/CAMD/Demo/camd_l_demo.c b/ThirdParty/SuiteSparse/CAMD/Demo/camd_l_demo.c similarity index 100% rename from SuiteSparse/CAMD/Demo/camd_l_demo.c rename to ThirdParty/SuiteSparse/CAMD/Demo/camd_l_demo.c diff --git a/SuiteSparse/CAMD/Demo/camd_l_demo.out b/ThirdParty/SuiteSparse/CAMD/Demo/camd_l_demo.out similarity index 100% rename from SuiteSparse/CAMD/Demo/camd_l_demo.out rename to ThirdParty/SuiteSparse/CAMD/Demo/camd_l_demo.out diff --git a/SuiteSparse/CAMD/Demo/camd_simple.c b/ThirdParty/SuiteSparse/CAMD/Demo/camd_simple.c similarity index 100% rename from SuiteSparse/CAMD/Demo/camd_simple.c rename to ThirdParty/SuiteSparse/CAMD/Demo/camd_simple.c diff --git a/SuiteSparse/CAMD/Demo/camd_simple.out b/ThirdParty/SuiteSparse/CAMD/Demo/camd_simple.out similarity index 100% rename from SuiteSparse/CAMD/Demo/camd_simple.out rename to ThirdParty/SuiteSparse/CAMD/Demo/camd_simple.out diff --git a/SuiteSparse/CAMD/Doc/CAMD_UserGuide.bib b/ThirdParty/SuiteSparse/CAMD/Doc/CAMD_UserGuide.bib similarity index 100% rename from SuiteSparse/CAMD/Doc/CAMD_UserGuide.bib rename to ThirdParty/SuiteSparse/CAMD/Doc/CAMD_UserGuide.bib diff --git a/SuiteSparse/CAMD/Doc/CAMD_UserGuide.pdf b/ThirdParty/SuiteSparse/CAMD/Doc/CAMD_UserGuide.pdf similarity index 100% rename from SuiteSparse/CAMD/Doc/CAMD_UserGuide.pdf rename to ThirdParty/SuiteSparse/CAMD/Doc/CAMD_UserGuide.pdf diff --git a/SuiteSparse/CAMD/Doc/CAMD_UserGuide.tex b/ThirdParty/SuiteSparse/CAMD/Doc/CAMD_UserGuide.tex similarity index 100% rename from SuiteSparse/CAMD/Doc/CAMD_UserGuide.tex rename to ThirdParty/SuiteSparse/CAMD/Doc/CAMD_UserGuide.tex diff --git a/SuiteSparse/CAMD/Doc/ChangeLog b/ThirdParty/SuiteSparse/CAMD/Doc/ChangeLog similarity index 100% rename from SuiteSparse/CAMD/Doc/ChangeLog rename to ThirdParty/SuiteSparse/CAMD/Doc/ChangeLog diff --git a/SuiteSparse/CAMD/Doc/License.txt b/ThirdParty/SuiteSparse/CAMD/Doc/License.txt similarity index 100% rename from SuiteSparse/CAMD/Doc/License.txt rename to ThirdParty/SuiteSparse/CAMD/Doc/License.txt diff --git a/SuiteSparse/CAMD/Doc/Makefile b/ThirdParty/SuiteSparse/CAMD/Doc/Makefile similarity index 100% rename from SuiteSparse/CAMD/Doc/Makefile rename to ThirdParty/SuiteSparse/CAMD/Doc/Makefile diff --git a/SuiteSparse/CAMD/Doc/camd.sed b/ThirdParty/SuiteSparse/CAMD/Doc/camd.sed similarity index 100% rename from SuiteSparse/CAMD/Doc/camd.sed rename to ThirdParty/SuiteSparse/CAMD/Doc/camd.sed diff --git a/SuiteSparse/CAMD/Doc/cdiff b/ThirdParty/SuiteSparse/CAMD/Doc/cdiff similarity index 100% rename from SuiteSparse/CAMD/Doc/cdiff rename to ThirdParty/SuiteSparse/CAMD/Doc/cdiff diff --git a/SuiteSparse/CAMD/Doc/docdiff b/ThirdParty/SuiteSparse/CAMD/Doc/docdiff similarity index 100% rename from SuiteSparse/CAMD/Doc/docdiff rename to ThirdParty/SuiteSparse/CAMD/Doc/docdiff diff --git a/SuiteSparse/CAMD/Doc/lesser.txt b/ThirdParty/SuiteSparse/CAMD/Doc/lesser.txt similarity index 100% rename from SuiteSparse/CAMD/Doc/lesser.txt rename to ThirdParty/SuiteSparse/CAMD/Doc/lesser.txt diff --git a/SuiteSparse/CAMD/Include/camd.h b/ThirdParty/SuiteSparse/CAMD/Include/camd.h similarity index 100% rename from SuiteSparse/CAMD/Include/camd.h rename to ThirdParty/SuiteSparse/CAMD/Include/camd.h diff --git a/SuiteSparse/CAMD/Include/camd_internal.h b/ThirdParty/SuiteSparse/CAMD/Include/camd_internal.h similarity index 100% rename from SuiteSparse/CAMD/Include/camd_internal.h rename to ThirdParty/SuiteSparse/CAMD/Include/camd_internal.h diff --git a/SuiteSparse/CAMD/Lib/Makefile b/ThirdParty/SuiteSparse/CAMD/Lib/Makefile similarity index 100% rename from SuiteSparse/CAMD/Lib/Makefile rename to ThirdParty/SuiteSparse/CAMD/Lib/Makefile diff --git a/SuiteSparse/CAMD/MATLAB/Contents.m b/ThirdParty/SuiteSparse/CAMD/MATLAB/Contents.m similarity index 100% rename from SuiteSparse/CAMD/MATLAB/Contents.m rename to ThirdParty/SuiteSparse/CAMD/MATLAB/Contents.m diff --git a/SuiteSparse/CAMD/MATLAB/camd.m b/ThirdParty/SuiteSparse/CAMD/MATLAB/camd.m similarity index 100% rename from SuiteSparse/CAMD/MATLAB/camd.m rename to ThirdParty/SuiteSparse/CAMD/MATLAB/camd.m diff --git a/SuiteSparse/CAMD/MATLAB/camd_demo.m b/ThirdParty/SuiteSparse/CAMD/MATLAB/camd_demo.m similarity index 100% rename from SuiteSparse/CAMD/MATLAB/camd_demo.m rename to ThirdParty/SuiteSparse/CAMD/MATLAB/camd_demo.m diff --git a/SuiteSparse/CAMD/MATLAB/camd_demo.m.out b/ThirdParty/SuiteSparse/CAMD/MATLAB/camd_demo.m.out similarity index 100% rename from SuiteSparse/CAMD/MATLAB/camd_demo.m.out rename to ThirdParty/SuiteSparse/CAMD/MATLAB/camd_demo.m.out diff --git a/SuiteSparse/CAMD/MATLAB/camd_make.m b/ThirdParty/SuiteSparse/CAMD/MATLAB/camd_make.m similarity index 100% rename from SuiteSparse/CAMD/MATLAB/camd_make.m rename to ThirdParty/SuiteSparse/CAMD/MATLAB/camd_make.m diff --git a/SuiteSparse/CAMD/MATLAB/camd_mex.c b/ThirdParty/SuiteSparse/CAMD/MATLAB/camd_mex.c similarity index 100% rename from SuiteSparse/CAMD/MATLAB/camd_mex.c rename to ThirdParty/SuiteSparse/CAMD/MATLAB/camd_mex.c diff --git a/SuiteSparse/CAMD/MATLAB/can_24 b/ThirdParty/SuiteSparse/CAMD/MATLAB/can_24 similarity index 100% rename from SuiteSparse/CAMD/MATLAB/can_24 rename to ThirdParty/SuiteSparse/CAMD/MATLAB/can_24 diff --git a/SuiteSparse/CAMD/Makefile b/ThirdParty/SuiteSparse/CAMD/Makefile similarity index 100% rename from SuiteSparse/CAMD/Makefile rename to ThirdParty/SuiteSparse/CAMD/Makefile diff --git a/SuiteSparse/CAMD/README.txt b/ThirdParty/SuiteSparse/CAMD/README.txt similarity index 100% rename from SuiteSparse/CAMD/README.txt rename to ThirdParty/SuiteSparse/CAMD/README.txt diff --git a/SuiteSparse/CAMD/Source/camd_1.c b/ThirdParty/SuiteSparse/CAMD/Source/camd_1.c similarity index 100% rename from SuiteSparse/CAMD/Source/camd_1.c rename to ThirdParty/SuiteSparse/CAMD/Source/camd_1.c diff --git a/SuiteSparse/CAMD/Source/camd_2.c b/ThirdParty/SuiteSparse/CAMD/Source/camd_2.c similarity index 100% rename from SuiteSparse/CAMD/Source/camd_2.c rename to ThirdParty/SuiteSparse/CAMD/Source/camd_2.c diff --git a/SuiteSparse/CAMD/Source/camd_aat.c b/ThirdParty/SuiteSparse/CAMD/Source/camd_aat.c similarity index 100% rename from SuiteSparse/CAMD/Source/camd_aat.c rename to ThirdParty/SuiteSparse/CAMD/Source/camd_aat.c diff --git a/SuiteSparse/CAMD/Source/camd_control.c b/ThirdParty/SuiteSparse/CAMD/Source/camd_control.c similarity index 100% rename from SuiteSparse/CAMD/Source/camd_control.c rename to ThirdParty/SuiteSparse/CAMD/Source/camd_control.c diff --git a/SuiteSparse/CAMD/Source/camd_defaults.c b/ThirdParty/SuiteSparse/CAMD/Source/camd_defaults.c similarity index 100% rename from SuiteSparse/CAMD/Source/camd_defaults.c rename to ThirdParty/SuiteSparse/CAMD/Source/camd_defaults.c diff --git a/SuiteSparse/CAMD/Source/camd_dump.c b/ThirdParty/SuiteSparse/CAMD/Source/camd_dump.c similarity index 100% rename from SuiteSparse/CAMD/Source/camd_dump.c rename to ThirdParty/SuiteSparse/CAMD/Source/camd_dump.c diff --git a/SuiteSparse/CAMD/Source/camd_global.c b/ThirdParty/SuiteSparse/CAMD/Source/camd_global.c similarity index 100% rename from SuiteSparse/CAMD/Source/camd_global.c rename to ThirdParty/SuiteSparse/CAMD/Source/camd_global.c diff --git a/SuiteSparse/CAMD/Source/camd_info.c b/ThirdParty/SuiteSparse/CAMD/Source/camd_info.c similarity index 100% rename from SuiteSparse/CAMD/Source/camd_info.c rename to ThirdParty/SuiteSparse/CAMD/Source/camd_info.c diff --git a/SuiteSparse/CAMD/Source/camd_order.c b/ThirdParty/SuiteSparse/CAMD/Source/camd_order.c similarity index 100% rename from SuiteSparse/CAMD/Source/camd_order.c rename to ThirdParty/SuiteSparse/CAMD/Source/camd_order.c diff --git a/SuiteSparse/CAMD/Source/camd_postorder.c b/ThirdParty/SuiteSparse/CAMD/Source/camd_postorder.c similarity index 100% rename from SuiteSparse/CAMD/Source/camd_postorder.c rename to ThirdParty/SuiteSparse/CAMD/Source/camd_postorder.c diff --git a/SuiteSparse/CAMD/Source/camd_preprocess.c b/ThirdParty/SuiteSparse/CAMD/Source/camd_preprocess.c similarity index 100% rename from SuiteSparse/CAMD/Source/camd_preprocess.c rename to ThirdParty/SuiteSparse/CAMD/Source/camd_preprocess.c diff --git a/SuiteSparse/CAMD/Source/camd_valid.c b/ThirdParty/SuiteSparse/CAMD/Source/camd_valid.c similarity index 100% rename from SuiteSparse/CAMD/Source/camd_valid.c rename to ThirdParty/SuiteSparse/CAMD/Source/camd_valid.c diff --git a/SuiteSparse/COLAMD/Demo/Makefile b/ThirdParty/SuiteSparse/COLAMD/Demo/Makefile similarity index 100% rename from SuiteSparse/COLAMD/Demo/Makefile rename to ThirdParty/SuiteSparse/COLAMD/Demo/Makefile diff --git a/SuiteSparse/COLAMD/Demo/colamd_example.c b/ThirdParty/SuiteSparse/COLAMD/Demo/colamd_example.c similarity index 100% rename from SuiteSparse/COLAMD/Demo/colamd_example.c rename to ThirdParty/SuiteSparse/COLAMD/Demo/colamd_example.c diff --git a/SuiteSparse/COLAMD/Demo/colamd_example.out b/ThirdParty/SuiteSparse/COLAMD/Demo/colamd_example.out similarity index 100% rename from SuiteSparse/COLAMD/Demo/colamd_example.out rename to ThirdParty/SuiteSparse/COLAMD/Demo/colamd_example.out diff --git a/SuiteSparse/COLAMD/Demo/colamd_l_example.c b/ThirdParty/SuiteSparse/COLAMD/Demo/colamd_l_example.c similarity index 100% rename from SuiteSparse/COLAMD/Demo/colamd_l_example.c rename to ThirdParty/SuiteSparse/COLAMD/Demo/colamd_l_example.c diff --git a/SuiteSparse/COLAMD/Demo/colamd_l_example.out b/ThirdParty/SuiteSparse/COLAMD/Demo/colamd_l_example.out similarity index 100% rename from SuiteSparse/COLAMD/Demo/colamd_l_example.out rename to ThirdParty/SuiteSparse/COLAMD/Demo/colamd_l_example.out diff --git a/SuiteSparse/COLAMD/Doc/ChangeLog b/ThirdParty/SuiteSparse/COLAMD/Doc/ChangeLog similarity index 100% rename from SuiteSparse/COLAMD/Doc/ChangeLog rename to ThirdParty/SuiteSparse/COLAMD/Doc/ChangeLog diff --git a/SuiteSparse/COLAMD/Doc/License.txt b/ThirdParty/SuiteSparse/COLAMD/Doc/License.txt similarity index 100% rename from SuiteSparse/COLAMD/Doc/License.txt rename to ThirdParty/SuiteSparse/COLAMD/Doc/License.txt diff --git a/SuiteSparse/COLAMD/Doc/lesser.txt b/ThirdParty/SuiteSparse/COLAMD/Doc/lesser.txt similarity index 100% rename from SuiteSparse/COLAMD/Doc/lesser.txt rename to ThirdParty/SuiteSparse/COLAMD/Doc/lesser.txt diff --git a/SuiteSparse/COLAMD/Include/colamd.h b/ThirdParty/SuiteSparse/COLAMD/Include/colamd.h similarity index 100% rename from SuiteSparse/COLAMD/Include/colamd.h rename to ThirdParty/SuiteSparse/COLAMD/Include/colamd.h diff --git a/SuiteSparse/COLAMD/Lib/Makefile b/ThirdParty/SuiteSparse/COLAMD/Lib/Makefile similarity index 100% rename from SuiteSparse/COLAMD/Lib/Makefile rename to ThirdParty/SuiteSparse/COLAMD/Lib/Makefile diff --git a/SuiteSparse/COLAMD/MATLAB/Contents.m b/ThirdParty/SuiteSparse/COLAMD/MATLAB/Contents.m similarity index 100% rename from SuiteSparse/COLAMD/MATLAB/Contents.m rename to ThirdParty/SuiteSparse/COLAMD/MATLAB/Contents.m diff --git a/SuiteSparse/COLAMD/MATLAB/colamd2.m b/ThirdParty/SuiteSparse/COLAMD/MATLAB/colamd2.m similarity index 100% rename from SuiteSparse/COLAMD/MATLAB/colamd2.m rename to ThirdParty/SuiteSparse/COLAMD/MATLAB/colamd2.m diff --git a/SuiteSparse/COLAMD/MATLAB/colamd_demo.m b/ThirdParty/SuiteSparse/COLAMD/MATLAB/colamd_demo.m similarity index 100% rename from SuiteSparse/COLAMD/MATLAB/colamd_demo.m rename to ThirdParty/SuiteSparse/COLAMD/MATLAB/colamd_demo.m diff --git a/SuiteSparse/COLAMD/MATLAB/colamd_install.m b/ThirdParty/SuiteSparse/COLAMD/MATLAB/colamd_install.m similarity index 100% rename from SuiteSparse/COLAMD/MATLAB/colamd_install.m rename to ThirdParty/SuiteSparse/COLAMD/MATLAB/colamd_install.m diff --git a/SuiteSparse/COLAMD/MATLAB/colamd_make.m b/ThirdParty/SuiteSparse/COLAMD/MATLAB/colamd_make.m similarity index 100% rename from SuiteSparse/COLAMD/MATLAB/colamd_make.m rename to ThirdParty/SuiteSparse/COLAMD/MATLAB/colamd_make.m diff --git a/SuiteSparse/COLAMD/MATLAB/colamd_test.m b/ThirdParty/SuiteSparse/COLAMD/MATLAB/colamd_test.m similarity index 100% rename from SuiteSparse/COLAMD/MATLAB/colamd_test.m rename to ThirdParty/SuiteSparse/COLAMD/MATLAB/colamd_test.m diff --git a/SuiteSparse/COLAMD/MATLAB/colamdmex.c b/ThirdParty/SuiteSparse/COLAMD/MATLAB/colamdmex.c similarity index 100% rename from SuiteSparse/COLAMD/MATLAB/colamdmex.c rename to ThirdParty/SuiteSparse/COLAMD/MATLAB/colamdmex.c diff --git a/SuiteSparse/COLAMD/MATLAB/colamdtestmex.c b/ThirdParty/SuiteSparse/COLAMD/MATLAB/colamdtestmex.c similarity index 100% rename from SuiteSparse/COLAMD/MATLAB/colamdtestmex.c rename to ThirdParty/SuiteSparse/COLAMD/MATLAB/colamdtestmex.c diff --git a/SuiteSparse/COLAMD/MATLAB/luflops.m b/ThirdParty/SuiteSparse/COLAMD/MATLAB/luflops.m similarity index 100% rename from SuiteSparse/COLAMD/MATLAB/luflops.m rename to ThirdParty/SuiteSparse/COLAMD/MATLAB/luflops.m diff --git a/SuiteSparse/COLAMD/MATLAB/symamd2.m b/ThirdParty/SuiteSparse/COLAMD/MATLAB/symamd2.m similarity index 100% rename from SuiteSparse/COLAMD/MATLAB/symamd2.m rename to ThirdParty/SuiteSparse/COLAMD/MATLAB/symamd2.m diff --git a/SuiteSparse/COLAMD/MATLAB/symamdmex.c b/ThirdParty/SuiteSparse/COLAMD/MATLAB/symamdmex.c similarity index 100% rename from SuiteSparse/COLAMD/MATLAB/symamdmex.c rename to ThirdParty/SuiteSparse/COLAMD/MATLAB/symamdmex.c diff --git a/SuiteSparse/COLAMD/MATLAB/symamdtestmex.c b/ThirdParty/SuiteSparse/COLAMD/MATLAB/symamdtestmex.c similarity index 100% rename from SuiteSparse/COLAMD/MATLAB/symamdtestmex.c rename to ThirdParty/SuiteSparse/COLAMD/MATLAB/symamdtestmex.c diff --git a/SuiteSparse/COLAMD/Makefile b/ThirdParty/SuiteSparse/COLAMD/Makefile similarity index 100% rename from SuiteSparse/COLAMD/Makefile rename to ThirdParty/SuiteSparse/COLAMD/Makefile diff --git a/SuiteSparse/COLAMD/README.txt b/ThirdParty/SuiteSparse/COLAMD/README.txt similarity index 100% rename from SuiteSparse/COLAMD/README.txt rename to ThirdParty/SuiteSparse/COLAMD/README.txt diff --git a/SuiteSparse/COLAMD/Source/colamd.c b/ThirdParty/SuiteSparse/COLAMD/Source/colamd.c similarity index 100% rename from SuiteSparse/COLAMD/Source/colamd.c rename to ThirdParty/SuiteSparse/COLAMD/Source/colamd.c diff --git a/SuiteSparse/CSparse_to_CXSparse b/ThirdParty/SuiteSparse/CSparse_to_CXSparse similarity index 100% rename from SuiteSparse/CSparse_to_CXSparse rename to ThirdParty/SuiteSparse/CSparse_to_CXSparse diff --git a/SuiteSparse/ChangeLog b/ThirdParty/SuiteSparse/ChangeLog similarity index 100% rename from SuiteSparse/ChangeLog rename to ThirdParty/SuiteSparse/ChangeLog diff --git a/SuiteSparse/Contents.m b/ThirdParty/SuiteSparse/Contents.m similarity index 100% rename from SuiteSparse/Contents.m rename to ThirdParty/SuiteSparse/Contents.m diff --git a/SuiteSparse/KLU/Demo/Makefile b/ThirdParty/SuiteSparse/KLU/Demo/Makefile similarity index 100% rename from SuiteSparse/KLU/Demo/Makefile rename to ThirdParty/SuiteSparse/KLU/Demo/Makefile diff --git a/SuiteSparse/KLU/Demo/klu_simple.c b/ThirdParty/SuiteSparse/KLU/Demo/klu_simple.c similarity index 100% rename from SuiteSparse/KLU/Demo/klu_simple.c rename to ThirdParty/SuiteSparse/KLU/Demo/klu_simple.c diff --git a/SuiteSparse/KLU/Demo/klu_simple.out b/ThirdParty/SuiteSparse/KLU/Demo/klu_simple.out similarity index 100% rename from SuiteSparse/KLU/Demo/klu_simple.out rename to ThirdParty/SuiteSparse/KLU/Demo/klu_simple.out diff --git a/SuiteSparse/KLU/Demo/kludemo.c b/ThirdParty/SuiteSparse/KLU/Demo/kludemo.c similarity index 100% rename from SuiteSparse/KLU/Demo/kludemo.c rename to ThirdParty/SuiteSparse/KLU/Demo/kludemo.c diff --git a/SuiteSparse/KLU/Demo/kludemo.out b/ThirdParty/SuiteSparse/KLU/Demo/kludemo.out similarity index 100% rename from SuiteSparse/KLU/Demo/kludemo.out rename to ThirdParty/SuiteSparse/KLU/Demo/kludemo.out diff --git a/SuiteSparse/KLU/Demo/kluldemo.c b/ThirdParty/SuiteSparse/KLU/Demo/kluldemo.c similarity index 100% rename from SuiteSparse/KLU/Demo/kluldemo.c rename to ThirdParty/SuiteSparse/KLU/Demo/kluldemo.c diff --git a/SuiteSparse/KLU/Doc/ChangeLog b/ThirdParty/SuiteSparse/KLU/Doc/ChangeLog similarity index 100% rename from SuiteSparse/KLU/Doc/ChangeLog rename to ThirdParty/SuiteSparse/KLU/Doc/ChangeLog diff --git a/SuiteSparse/KLU/Doc/KLU_UserGuide.bib b/ThirdParty/SuiteSparse/KLU/Doc/KLU_UserGuide.bib similarity index 100% rename from SuiteSparse/KLU/Doc/KLU_UserGuide.bib rename to ThirdParty/SuiteSparse/KLU/Doc/KLU_UserGuide.bib diff --git a/SuiteSparse/KLU/Doc/KLU_UserGuide.pdf b/ThirdParty/SuiteSparse/KLU/Doc/KLU_UserGuide.pdf similarity index 100% rename from SuiteSparse/KLU/Doc/KLU_UserGuide.pdf rename to ThirdParty/SuiteSparse/KLU/Doc/KLU_UserGuide.pdf diff --git a/SuiteSparse/KLU/Doc/KLU_UserGuide.tex b/ThirdParty/SuiteSparse/KLU/Doc/KLU_UserGuide.tex similarity index 100% rename from SuiteSparse/KLU/Doc/KLU_UserGuide.tex rename to ThirdParty/SuiteSparse/KLU/Doc/KLU_UserGuide.tex diff --git a/SuiteSparse/KLU/Doc/License.txt b/ThirdParty/SuiteSparse/KLU/Doc/License.txt similarity index 100% rename from SuiteSparse/KLU/Doc/License.txt rename to ThirdParty/SuiteSparse/KLU/Doc/License.txt diff --git a/SuiteSparse/KLU/Doc/Makefile b/ThirdParty/SuiteSparse/KLU/Doc/Makefile similarity index 100% rename from SuiteSparse/KLU/Doc/Makefile rename to ThirdParty/SuiteSparse/KLU/Doc/Makefile diff --git a/SuiteSparse/KLU/Doc/lesser.txt b/ThirdParty/SuiteSparse/KLU/Doc/lesser.txt similarity index 100% rename from SuiteSparse/KLU/Doc/lesser.txt rename to ThirdParty/SuiteSparse/KLU/Doc/lesser.txt diff --git a/SuiteSparse/KLU/Doc/palamadai_e.pdf b/ThirdParty/SuiteSparse/KLU/Doc/palamadai_e.pdf similarity index 100% rename from SuiteSparse/KLU/Doc/palamadai_e.pdf rename to ThirdParty/SuiteSparse/KLU/Doc/palamadai_e.pdf diff --git a/SuiteSparse/KLU/Include/klu.h b/ThirdParty/SuiteSparse/KLU/Include/klu.h similarity index 100% rename from SuiteSparse/KLU/Include/klu.h rename to ThirdParty/SuiteSparse/KLU/Include/klu.h diff --git a/SuiteSparse/KLU/Include/klu_internal.h b/ThirdParty/SuiteSparse/KLU/Include/klu_internal.h similarity index 100% rename from SuiteSparse/KLU/Include/klu_internal.h rename to ThirdParty/SuiteSparse/KLU/Include/klu_internal.h diff --git a/SuiteSparse/KLU/Include/klu_version.h b/ThirdParty/SuiteSparse/KLU/Include/klu_version.h similarity index 100% rename from SuiteSparse/KLU/Include/klu_version.h rename to ThirdParty/SuiteSparse/KLU/Include/klu_version.h diff --git a/SuiteSparse/KLU/Lib/Makefile b/ThirdParty/SuiteSparse/KLU/Lib/Makefile similarity index 100% rename from SuiteSparse/KLU/Lib/Makefile rename to ThirdParty/SuiteSparse/KLU/Lib/Makefile diff --git a/SuiteSparse/KLU/MATLAB/Contents.m b/ThirdParty/SuiteSparse/KLU/MATLAB/Contents.m similarity index 100% rename from SuiteSparse/KLU/MATLAB/Contents.m rename to ThirdParty/SuiteSparse/KLU/MATLAB/Contents.m diff --git a/SuiteSparse/KLU/MATLAB/Test/klu_test.m b/ThirdParty/SuiteSparse/KLU/MATLAB/Test/klu_test.m similarity index 100% rename from SuiteSparse/KLU/MATLAB/Test/klu_test.m rename to ThirdParty/SuiteSparse/KLU/MATLAB/Test/klu_test.m diff --git a/SuiteSparse/KLU/MATLAB/Test/test1.m b/ThirdParty/SuiteSparse/KLU/MATLAB/Test/test1.m similarity index 100% rename from SuiteSparse/KLU/MATLAB/Test/test1.m rename to ThirdParty/SuiteSparse/KLU/MATLAB/Test/test1.m diff --git a/SuiteSparse/KLU/MATLAB/Test/test2.m b/ThirdParty/SuiteSparse/KLU/MATLAB/Test/test2.m similarity index 100% rename from SuiteSparse/KLU/MATLAB/Test/test2.m rename to ThirdParty/SuiteSparse/KLU/MATLAB/Test/test2.m diff --git a/SuiteSparse/KLU/MATLAB/Test/test3.m b/ThirdParty/SuiteSparse/KLU/MATLAB/Test/test3.m similarity index 100% rename from SuiteSparse/KLU/MATLAB/Test/test3.m rename to ThirdParty/SuiteSparse/KLU/MATLAB/Test/test3.m diff --git a/SuiteSparse/KLU/MATLAB/Test/test4.m b/ThirdParty/SuiteSparse/KLU/MATLAB/Test/test4.m similarity index 100% rename from SuiteSparse/KLU/MATLAB/Test/test4.m rename to ThirdParty/SuiteSparse/KLU/MATLAB/Test/test4.m diff --git a/SuiteSparse/KLU/MATLAB/Test/test5.m b/ThirdParty/SuiteSparse/KLU/MATLAB/Test/test5.m similarity index 100% rename from SuiteSparse/KLU/MATLAB/Test/test5.m rename to ThirdParty/SuiteSparse/KLU/MATLAB/Test/test5.m diff --git a/SuiteSparse/KLU/MATLAB/klu.m b/ThirdParty/SuiteSparse/KLU/MATLAB/klu.m similarity index 100% rename from SuiteSparse/KLU/MATLAB/klu.m rename to ThirdParty/SuiteSparse/KLU/MATLAB/klu.m diff --git a/SuiteSparse/KLU/MATLAB/klu_demo.m b/ThirdParty/SuiteSparse/KLU/MATLAB/klu_demo.m similarity index 100% rename from SuiteSparse/KLU/MATLAB/klu_demo.m rename to ThirdParty/SuiteSparse/KLU/MATLAB/klu_demo.m diff --git a/SuiteSparse/KLU/MATLAB/klu_demo.m.out b/ThirdParty/SuiteSparse/KLU/MATLAB/klu_demo.m.out similarity index 100% rename from SuiteSparse/KLU/MATLAB/klu_demo.m.out rename to ThirdParty/SuiteSparse/KLU/MATLAB/klu_demo.m.out diff --git a/SuiteSparse/KLU/MATLAB/klu_install.m b/ThirdParty/SuiteSparse/KLU/MATLAB/klu_install.m similarity index 100% rename from SuiteSparse/KLU/MATLAB/klu_install.m rename to ThirdParty/SuiteSparse/KLU/MATLAB/klu_install.m diff --git a/SuiteSparse/KLU/MATLAB/klu_make.m b/ThirdParty/SuiteSparse/KLU/MATLAB/klu_make.m similarity index 100% rename from SuiteSparse/KLU/MATLAB/klu_make.m rename to ThirdParty/SuiteSparse/KLU/MATLAB/klu_make.m diff --git a/SuiteSparse/KLU/MATLAB/klu_mex.c b/ThirdParty/SuiteSparse/KLU/MATLAB/klu_mex.c similarity index 100% rename from SuiteSparse/KLU/MATLAB/klu_mex.c rename to ThirdParty/SuiteSparse/KLU/MATLAB/klu_mex.c diff --git a/SuiteSparse/KLU/Makefile b/ThirdParty/SuiteSparse/KLU/Makefile similarity index 100% rename from SuiteSparse/KLU/Makefile rename to ThirdParty/SuiteSparse/KLU/Makefile diff --git a/SuiteSparse/KLU/Matrix/1c.mtx b/ThirdParty/SuiteSparse/KLU/Matrix/1c.mtx similarity index 100% rename from SuiteSparse/KLU/Matrix/1c.mtx rename to ThirdParty/SuiteSparse/KLU/Matrix/1c.mtx diff --git a/SuiteSparse/KLU/Matrix/GD99_cc.mtx b/ThirdParty/SuiteSparse/KLU/Matrix/GD99_cc.mtx similarity index 100% rename from SuiteSparse/KLU/Matrix/GD99_cc.mtx rename to ThirdParty/SuiteSparse/KLU/Matrix/GD99_cc.mtx diff --git a/SuiteSparse/KLU/Matrix/arrow.mtx b/ThirdParty/SuiteSparse/KLU/Matrix/arrow.mtx similarity index 100% rename from SuiteSparse/KLU/Matrix/arrow.mtx rename to ThirdParty/SuiteSparse/KLU/Matrix/arrow.mtx diff --git a/SuiteSparse/KLU/Matrix/arrowc.mtx b/ThirdParty/SuiteSparse/KLU/Matrix/arrowc.mtx similarity index 100% rename from SuiteSparse/KLU/Matrix/arrowc.mtx rename to ThirdParty/SuiteSparse/KLU/Matrix/arrowc.mtx diff --git a/SuiteSparse/KLU/Matrix/ctina.mtx b/ThirdParty/SuiteSparse/KLU/Matrix/ctina.mtx similarity index 100% rename from SuiteSparse/KLU/Matrix/ctina.mtx rename to ThirdParty/SuiteSparse/KLU/Matrix/ctina.mtx diff --git a/SuiteSparse/KLU/Matrix/impcol_a.mtx b/ThirdParty/SuiteSparse/KLU/Matrix/impcol_a.mtx similarity index 100% rename from SuiteSparse/KLU/Matrix/impcol_a.mtx rename to ThirdParty/SuiteSparse/KLU/Matrix/impcol_a.mtx diff --git a/SuiteSparse/KLU/Matrix/one.mtx b/ThirdParty/SuiteSparse/KLU/Matrix/one.mtx similarity index 100% rename from SuiteSparse/KLU/Matrix/one.mtx rename to ThirdParty/SuiteSparse/KLU/Matrix/one.mtx diff --git a/SuiteSparse/KLU/Matrix/onec.mtx b/ThirdParty/SuiteSparse/KLU/Matrix/onec.mtx similarity index 100% rename from SuiteSparse/KLU/Matrix/onec.mtx rename to ThirdParty/SuiteSparse/KLU/Matrix/onec.mtx diff --git a/SuiteSparse/KLU/Matrix/two.mtx b/ThirdParty/SuiteSparse/KLU/Matrix/two.mtx similarity index 100% rename from SuiteSparse/KLU/Matrix/two.mtx rename to ThirdParty/SuiteSparse/KLU/Matrix/two.mtx diff --git a/SuiteSparse/KLU/Matrix/w156.mtx b/ThirdParty/SuiteSparse/KLU/Matrix/w156.mtx similarity index 100% rename from SuiteSparse/KLU/Matrix/w156.mtx rename to ThirdParty/SuiteSparse/KLU/Matrix/w156.mtx diff --git a/SuiteSparse/KLU/README.txt b/ThirdParty/SuiteSparse/KLU/README.txt similarity index 100% rename from SuiteSparse/KLU/README.txt rename to ThirdParty/SuiteSparse/KLU/README.txt diff --git a/SuiteSparse/KLU/Source/klu.c b/ThirdParty/SuiteSparse/KLU/Source/klu.c similarity index 100% rename from SuiteSparse/KLU/Source/klu.c rename to ThirdParty/SuiteSparse/KLU/Source/klu.c diff --git a/SuiteSparse/KLU/Source/klu_analyze.c b/ThirdParty/SuiteSparse/KLU/Source/klu_analyze.c similarity index 100% rename from SuiteSparse/KLU/Source/klu_analyze.c rename to ThirdParty/SuiteSparse/KLU/Source/klu_analyze.c diff --git a/SuiteSparse/KLU/Source/klu_analyze_given.c b/ThirdParty/SuiteSparse/KLU/Source/klu_analyze_given.c similarity index 100% rename from SuiteSparse/KLU/Source/klu_analyze_given.c rename to ThirdParty/SuiteSparse/KLU/Source/klu_analyze_given.c diff --git a/SuiteSparse/KLU/Source/klu_defaults.c b/ThirdParty/SuiteSparse/KLU/Source/klu_defaults.c similarity index 100% rename from SuiteSparse/KLU/Source/klu_defaults.c rename to ThirdParty/SuiteSparse/KLU/Source/klu_defaults.c diff --git a/SuiteSparse/KLU/Source/klu_diagnostics.c b/ThirdParty/SuiteSparse/KLU/Source/klu_diagnostics.c similarity index 100% rename from SuiteSparse/KLU/Source/klu_diagnostics.c rename to ThirdParty/SuiteSparse/KLU/Source/klu_diagnostics.c diff --git a/SuiteSparse/KLU/Source/klu_dump.c b/ThirdParty/SuiteSparse/KLU/Source/klu_dump.c similarity index 100% rename from SuiteSparse/KLU/Source/klu_dump.c rename to ThirdParty/SuiteSparse/KLU/Source/klu_dump.c diff --git a/SuiteSparse/KLU/Source/klu_extract.c b/ThirdParty/SuiteSparse/KLU/Source/klu_extract.c similarity index 100% rename from SuiteSparse/KLU/Source/klu_extract.c rename to ThirdParty/SuiteSparse/KLU/Source/klu_extract.c diff --git a/SuiteSparse/KLU/Source/klu_factor.c b/ThirdParty/SuiteSparse/KLU/Source/klu_factor.c similarity index 100% rename from SuiteSparse/KLU/Source/klu_factor.c rename to ThirdParty/SuiteSparse/KLU/Source/klu_factor.c diff --git a/SuiteSparse/KLU/Source/klu_free_numeric.c b/ThirdParty/SuiteSparse/KLU/Source/klu_free_numeric.c similarity index 100% rename from SuiteSparse/KLU/Source/klu_free_numeric.c rename to ThirdParty/SuiteSparse/KLU/Source/klu_free_numeric.c diff --git a/SuiteSparse/KLU/Source/klu_free_symbolic.c b/ThirdParty/SuiteSparse/KLU/Source/klu_free_symbolic.c similarity index 100% rename from SuiteSparse/KLU/Source/klu_free_symbolic.c rename to ThirdParty/SuiteSparse/KLU/Source/klu_free_symbolic.c diff --git a/SuiteSparse/KLU/Source/klu_kernel.c b/ThirdParty/SuiteSparse/KLU/Source/klu_kernel.c similarity index 100% rename from SuiteSparse/KLU/Source/klu_kernel.c rename to ThirdParty/SuiteSparse/KLU/Source/klu_kernel.c diff --git a/SuiteSparse/KLU/Source/klu_memory.c b/ThirdParty/SuiteSparse/KLU/Source/klu_memory.c similarity index 100% rename from SuiteSparse/KLU/Source/klu_memory.c rename to ThirdParty/SuiteSparse/KLU/Source/klu_memory.c diff --git a/SuiteSparse/KLU/Source/klu_refactor.c b/ThirdParty/SuiteSparse/KLU/Source/klu_refactor.c similarity index 100% rename from SuiteSparse/KLU/Source/klu_refactor.c rename to ThirdParty/SuiteSparse/KLU/Source/klu_refactor.c diff --git a/SuiteSparse/KLU/Source/klu_scale.c b/ThirdParty/SuiteSparse/KLU/Source/klu_scale.c similarity index 100% rename from SuiteSparse/KLU/Source/klu_scale.c rename to ThirdParty/SuiteSparse/KLU/Source/klu_scale.c diff --git a/SuiteSparse/KLU/Source/klu_solve.c b/ThirdParty/SuiteSparse/KLU/Source/klu_solve.c similarity index 100% rename from SuiteSparse/KLU/Source/klu_solve.c rename to ThirdParty/SuiteSparse/KLU/Source/klu_solve.c diff --git a/SuiteSparse/KLU/Source/klu_sort.c b/ThirdParty/SuiteSparse/KLU/Source/klu_sort.c similarity index 100% rename from SuiteSparse/KLU/Source/klu_sort.c rename to ThirdParty/SuiteSparse/KLU/Source/klu_sort.c diff --git a/SuiteSparse/KLU/Source/klu_tsolve.c b/ThirdParty/SuiteSparse/KLU/Source/klu_tsolve.c similarity index 100% rename from SuiteSparse/KLU/Source/klu_tsolve.c rename to ThirdParty/SuiteSparse/KLU/Source/klu_tsolve.c diff --git a/SuiteSparse/KLU/Tcov/Makefile b/ThirdParty/SuiteSparse/KLU/Tcov/Makefile similarity index 100% rename from SuiteSparse/KLU/Tcov/Makefile rename to ThirdParty/SuiteSparse/KLU/Tcov/Makefile diff --git a/SuiteSparse/KLU/Tcov/README.txt b/ThirdParty/SuiteSparse/KLU/Tcov/README.txt similarity index 100% rename from SuiteSparse/KLU/Tcov/README.txt rename to ThirdParty/SuiteSparse/KLU/Tcov/README.txt diff --git a/SuiteSparse/KLU/Tcov/coverage b/ThirdParty/SuiteSparse/KLU/Tcov/coverage similarity index 100% rename from SuiteSparse/KLU/Tcov/coverage rename to ThirdParty/SuiteSparse/KLU/Tcov/coverage diff --git a/SuiteSparse/KLU/Tcov/klultests b/ThirdParty/SuiteSparse/KLU/Tcov/klultests similarity index 100% rename from SuiteSparse/KLU/Tcov/klultests rename to ThirdParty/SuiteSparse/KLU/Tcov/klultests diff --git a/SuiteSparse/KLU/Tcov/klutest.c b/ThirdParty/SuiteSparse/KLU/Tcov/klutest.c similarity index 100% rename from SuiteSparse/KLU/Tcov/klutest.c rename to ThirdParty/SuiteSparse/KLU/Tcov/klutest.c diff --git a/SuiteSparse/KLU/Tcov/klutests b/ThirdParty/SuiteSparse/KLU/Tcov/klutests similarity index 100% rename from SuiteSparse/KLU/Tcov/klutests rename to ThirdParty/SuiteSparse/KLU/Tcov/klutests diff --git a/SuiteSparse/KLU/Tcov/vklultests b/ThirdParty/SuiteSparse/KLU/Tcov/vklultests similarity index 100% rename from SuiteSparse/KLU/Tcov/vklultests rename to ThirdParty/SuiteSparse/KLU/Tcov/vklultests diff --git a/SuiteSparse/KLU/Tcov/vklutests b/ThirdParty/SuiteSparse/KLU/Tcov/vklutests similarity index 100% rename from SuiteSparse/KLU/Tcov/vklutests rename to ThirdParty/SuiteSparse/KLU/Tcov/vklutests diff --git a/SuiteSparse/KLU/User/Makefile b/ThirdParty/SuiteSparse/KLU/User/Makefile similarity index 100% rename from SuiteSparse/KLU/User/Makefile rename to ThirdParty/SuiteSparse/KLU/User/Makefile diff --git a/SuiteSparse/KLU/User/README.txt b/ThirdParty/SuiteSparse/KLU/User/README.txt similarity index 100% rename from SuiteSparse/KLU/User/README.txt rename to ThirdParty/SuiteSparse/KLU/User/README.txt diff --git a/SuiteSparse/KLU/User/klu_cholmod.c b/ThirdParty/SuiteSparse/KLU/User/klu_cholmod.c similarity index 100% rename from SuiteSparse/KLU/User/klu_cholmod.c rename to ThirdParty/SuiteSparse/KLU/User/klu_cholmod.c diff --git a/SuiteSparse/KLU/User/klu_cholmod.h b/ThirdParty/SuiteSparse/KLU/User/klu_cholmod.h similarity index 100% rename from SuiteSparse/KLU/User/klu_cholmod.h rename to ThirdParty/SuiteSparse/KLU/User/klu_cholmod.h diff --git a/SuiteSparse/KLU/User/klu_l_cholmod.c b/ThirdParty/SuiteSparse/KLU/User/klu_l_cholmod.c similarity index 100% rename from SuiteSparse/KLU/User/klu_l_cholmod.c rename to ThirdParty/SuiteSparse/KLU/User/klu_l_cholmod.c diff --git a/SuiteSparse/LICENSE.txt b/ThirdParty/SuiteSparse/LICENSE.txt similarity index 100% rename from SuiteSparse/LICENSE.txt rename to ThirdParty/SuiteSparse/LICENSE.txt diff --git a/SuiteSparse/Makefile b/ThirdParty/SuiteSparse/Makefile similarity index 100% rename from SuiteSparse/Makefile rename to ThirdParty/SuiteSparse/Makefile diff --git a/SuiteSparse/README.txt b/ThirdParty/SuiteSparse/README.txt similarity index 100% rename from SuiteSparse/README.txt rename to ThirdParty/SuiteSparse/README.txt diff --git a/SuiteSparse/SuiteSparse_config/Makefile b/ThirdParty/SuiteSparse/SuiteSparse_config/Makefile similarity index 100% rename from SuiteSparse/SuiteSparse_config/Makefile rename to ThirdParty/SuiteSparse/SuiteSparse_config/Makefile diff --git a/SuiteSparse/SuiteSparse_config/README.txt b/ThirdParty/SuiteSparse/SuiteSparse_config/README.txt similarity index 100% rename from SuiteSparse/SuiteSparse_config/README.txt rename to ThirdParty/SuiteSparse/SuiteSparse_config/README.txt diff --git a/SuiteSparse/SuiteSparse_config/SuiteSparse_config.c b/ThirdParty/SuiteSparse/SuiteSparse_config/SuiteSparse_config.c similarity index 100% rename from SuiteSparse/SuiteSparse_config/SuiteSparse_config.c rename to ThirdParty/SuiteSparse/SuiteSparse_config/SuiteSparse_config.c diff --git a/SuiteSparse/SuiteSparse_config/SuiteSparse_config.h b/ThirdParty/SuiteSparse/SuiteSparse_config/SuiteSparse_config.h similarity index 100% rename from SuiteSparse/SuiteSparse_config/SuiteSparse_config.h rename to ThirdParty/SuiteSparse/SuiteSparse_config/SuiteSparse_config.h diff --git a/SuiteSparse/SuiteSparse_config/SuiteSparse_config.mk b/ThirdParty/SuiteSparse/SuiteSparse_config/SuiteSparse_config.mk similarity index 100% rename from SuiteSparse/SuiteSparse_config/SuiteSparse_config.mk rename to ThirdParty/SuiteSparse/SuiteSparse_config/SuiteSparse_config.mk diff --git a/SuiteSparse/SuiteSparse_config/xerbla/Makefile b/ThirdParty/SuiteSparse/SuiteSparse_config/xerbla/Makefile similarity index 100% rename from SuiteSparse/SuiteSparse_config/xerbla/Makefile rename to ThirdParty/SuiteSparse/SuiteSparse_config/xerbla/Makefile diff --git a/SuiteSparse/SuiteSparse_config/xerbla/xerbla.c b/ThirdParty/SuiteSparse/SuiteSparse_config/xerbla/xerbla.c similarity index 100% rename from SuiteSparse/SuiteSparse_config/xerbla/xerbla.c rename to ThirdParty/SuiteSparse/SuiteSparse_config/xerbla/xerbla.c diff --git a/SuiteSparse/SuiteSparse_config/xerbla/xerbla.f b/ThirdParty/SuiteSparse/SuiteSparse_config/xerbla/xerbla.f similarity index 100% rename from SuiteSparse/SuiteSparse_config/xerbla/xerbla.f rename to ThirdParty/SuiteSparse/SuiteSparse_config/xerbla/xerbla.f diff --git a/SuiteSparse/SuiteSparse_config/xerbla/xerbla.h b/ThirdParty/SuiteSparse/SuiteSparse_config/xerbla/xerbla.h similarity index 100% rename from SuiteSparse/SuiteSparse_config/xerbla/xerbla.h rename to ThirdParty/SuiteSparse/SuiteSparse_config/xerbla/xerbla.h diff --git a/SuiteSparse/SuiteSparse_demo.m b/ThirdParty/SuiteSparse/SuiteSparse_demo.m similarity index 100% rename from SuiteSparse/SuiteSparse_demo.m rename to ThirdParty/SuiteSparse/SuiteSparse_demo.m diff --git a/SuiteSparse/SuiteSparse_install.m b/ThirdParty/SuiteSparse/SuiteSparse_install.m similarity index 100% rename from SuiteSparse/SuiteSparse_install.m rename to ThirdParty/SuiteSparse/SuiteSparse_install.m diff --git a/SuiteSparse/SuiteSparse_test.m b/ThirdParty/SuiteSparse/SuiteSparse_test.m similarity index 100% rename from SuiteSparse/SuiteSparse_test.m rename to ThirdParty/SuiteSparse/SuiteSparse_test.m diff --git a/sundials/CMakeLists.txt b/ThirdParty/sundials/CMakeLists.txt similarity index 100% rename from sundials/CMakeLists.txt rename to ThirdParty/sundials/CMakeLists.txt diff --git a/sundials/INSTALL_GUIDE.pdf b/ThirdParty/sundials/INSTALL_GUIDE.pdf similarity index 100% rename from sundials/INSTALL_GUIDE.pdf rename to ThirdParty/sundials/INSTALL_GUIDE.pdf diff --git a/sundials/LICENSE b/ThirdParty/sundials/LICENSE similarity index 100% rename from sundials/LICENSE rename to ThirdParty/sundials/LICENSE diff --git a/sundials/README b/ThirdParty/sundials/README similarity index 100% rename from sundials/README rename to ThirdParty/sundials/README diff --git a/sundials/config/FindHypre.cmake b/ThirdParty/sundials/config/FindHypre.cmake similarity index 100% rename from sundials/config/FindHypre.cmake rename to ThirdParty/sundials/config/FindHypre.cmake diff --git a/sundials/config/FindKLU.cmake b/ThirdParty/sundials/config/FindKLU.cmake similarity index 100% rename from sundials/config/FindKLU.cmake rename to ThirdParty/sundials/config/FindKLU.cmake diff --git a/sundials/config/FindMPI.cmake b/ThirdParty/sundials/config/FindMPI.cmake similarity index 100% rename from sundials/config/FindMPI.cmake rename to ThirdParty/sundials/config/FindMPI.cmake diff --git a/sundials/config/FindPETSc.cmake b/ThirdParty/sundials/config/FindPETSc.cmake similarity index 100% rename from sundials/config/FindPETSc.cmake rename to ThirdParty/sundials/config/FindPETSc.cmake diff --git a/sundials/config/FindSUPERLUMT.cmake b/ThirdParty/sundials/config/FindSUPERLUMT.cmake similarity index 100% rename from sundials/config/FindSUPERLUMT.cmake rename to ThirdParty/sundials/config/FindSUPERLUMT.cmake diff --git a/sundials/config/SundialsAddTest.cmake b/ThirdParty/sundials/config/SundialsAddTest.cmake similarity index 100% rename from sundials/config/SundialsAddTest.cmake rename to ThirdParty/sundials/config/SundialsAddTest.cmake diff --git a/sundials/config/SundialsCXX.cmake b/ThirdParty/sundials/config/SundialsCXX.cmake similarity index 100% rename from sundials/config/SundialsCXX.cmake rename to ThirdParty/sundials/config/SundialsCXX.cmake diff --git a/sundials/config/SundialsFortran.cmake b/ThirdParty/sundials/config/SundialsFortran.cmake similarity index 100% rename from sundials/config/SundialsFortran.cmake rename to ThirdParty/sundials/config/SundialsFortran.cmake diff --git a/sundials/config/SundialsFortran90.cmake b/ThirdParty/sundials/config/SundialsFortran90.cmake similarity index 100% rename from sundials/config/SundialsFortran90.cmake rename to ThirdParty/sundials/config/SundialsFortran90.cmake diff --git a/sundials/config/SundialsHypre.cmake b/ThirdParty/sundials/config/SundialsHypre.cmake similarity index 100% rename from sundials/config/SundialsHypre.cmake rename to ThirdParty/sundials/config/SundialsHypre.cmake diff --git a/sundials/config/SundialsKLU.cmake b/ThirdParty/sundials/config/SundialsKLU.cmake similarity index 100% rename from sundials/config/SundialsKLU.cmake rename to ThirdParty/sundials/config/SundialsKLU.cmake diff --git a/sundials/config/SundialsLapack.cmake b/ThirdParty/sundials/config/SundialsLapack.cmake similarity index 100% rename from sundials/config/SundialsLapack.cmake rename to ThirdParty/sundials/config/SundialsLapack.cmake diff --git a/sundials/config/SundialsMPIC.cmake b/ThirdParty/sundials/config/SundialsMPIC.cmake similarity index 100% rename from sundials/config/SundialsMPIC.cmake rename to ThirdParty/sundials/config/SundialsMPIC.cmake diff --git a/sundials/config/SundialsMPICXX.cmake b/ThirdParty/sundials/config/SundialsMPICXX.cmake similarity index 100% rename from sundials/config/SundialsMPICXX.cmake rename to ThirdParty/sundials/config/SundialsMPICXX.cmake diff --git a/sundials/config/SundialsMPIF.cmake b/ThirdParty/sundials/config/SundialsMPIF.cmake similarity index 100% rename from sundials/config/SundialsMPIF.cmake rename to ThirdParty/sundials/config/SundialsMPIF.cmake diff --git a/sundials/config/SundialsMPIF90.cmake b/ThirdParty/sundials/config/SundialsMPIF90.cmake similarity index 100% rename from sundials/config/SundialsMPIF90.cmake rename to ThirdParty/sundials/config/SundialsMPIF90.cmake diff --git a/sundials/config/SundialsPETSc.cmake b/ThirdParty/sundials/config/SundialsPETSc.cmake similarity index 100% rename from sundials/config/SundialsPETSc.cmake rename to ThirdParty/sundials/config/SundialsPETSc.cmake diff --git a/sundials/config/SundialsSuperLUMT.cmake b/ThirdParty/sundials/config/SundialsSuperLUMT.cmake similarity index 100% rename from sundials/config/SundialsSuperLUMT.cmake rename to ThirdParty/sundials/config/SundialsSuperLUMT.cmake diff --git a/sundials/include/arkode/arkode.h b/ThirdParty/sundials/include/arkode/arkode.h similarity index 100% rename from sundials/include/arkode/arkode.h rename to ThirdParty/sundials/include/arkode/arkode.h diff --git a/sundials/include/arkode/arkode_band.h b/ThirdParty/sundials/include/arkode/arkode_band.h similarity index 100% rename from sundials/include/arkode/arkode_band.h rename to ThirdParty/sundials/include/arkode/arkode_band.h diff --git a/sundials/include/arkode/arkode_bandpre.h b/ThirdParty/sundials/include/arkode/arkode_bandpre.h similarity index 100% rename from sundials/include/arkode/arkode_bandpre.h rename to ThirdParty/sundials/include/arkode/arkode_bandpre.h diff --git a/sundials/include/arkode/arkode_bbdpre.h b/ThirdParty/sundials/include/arkode/arkode_bbdpre.h similarity index 100% rename from sundials/include/arkode/arkode_bbdpre.h rename to ThirdParty/sundials/include/arkode/arkode_bbdpre.h diff --git a/sundials/include/arkode/arkode_dense.h b/ThirdParty/sundials/include/arkode/arkode_dense.h similarity index 100% rename from sundials/include/arkode/arkode_dense.h rename to ThirdParty/sundials/include/arkode/arkode_dense.h diff --git a/sundials/include/arkode/arkode_direct.h b/ThirdParty/sundials/include/arkode/arkode_direct.h similarity index 100% rename from sundials/include/arkode/arkode_direct.h rename to ThirdParty/sundials/include/arkode/arkode_direct.h diff --git a/sundials/include/arkode/arkode_klu.h b/ThirdParty/sundials/include/arkode/arkode_klu.h similarity index 100% rename from sundials/include/arkode/arkode_klu.h rename to ThirdParty/sundials/include/arkode/arkode_klu.h diff --git a/sundials/include/arkode/arkode_lapack.h b/ThirdParty/sundials/include/arkode/arkode_lapack.h similarity index 100% rename from sundials/include/arkode/arkode_lapack.h rename to ThirdParty/sundials/include/arkode/arkode_lapack.h diff --git a/sundials/include/arkode/arkode_pcg.h b/ThirdParty/sundials/include/arkode/arkode_pcg.h similarity index 100% rename from sundials/include/arkode/arkode_pcg.h rename to ThirdParty/sundials/include/arkode/arkode_pcg.h diff --git a/sundials/include/arkode/arkode_sparse.h b/ThirdParty/sundials/include/arkode/arkode_sparse.h similarity index 100% rename from sundials/include/arkode/arkode_sparse.h rename to ThirdParty/sundials/include/arkode/arkode_sparse.h diff --git a/sundials/include/arkode/arkode_spbcgs.h b/ThirdParty/sundials/include/arkode/arkode_spbcgs.h similarity index 100% rename from sundials/include/arkode/arkode_spbcgs.h rename to ThirdParty/sundials/include/arkode/arkode_spbcgs.h diff --git a/sundials/include/arkode/arkode_spfgmr.h b/ThirdParty/sundials/include/arkode/arkode_spfgmr.h similarity index 100% rename from sundials/include/arkode/arkode_spfgmr.h rename to ThirdParty/sundials/include/arkode/arkode_spfgmr.h diff --git a/sundials/include/arkode/arkode_spgmr.h b/ThirdParty/sundials/include/arkode/arkode_spgmr.h similarity index 100% rename from sundials/include/arkode/arkode_spgmr.h rename to ThirdParty/sundials/include/arkode/arkode_spgmr.h diff --git a/sundials/include/arkode/arkode_spils.h b/ThirdParty/sundials/include/arkode/arkode_spils.h similarity index 100% rename from sundials/include/arkode/arkode_spils.h rename to ThirdParty/sundials/include/arkode/arkode_spils.h diff --git a/sundials/include/arkode/arkode_sptfqmr.h b/ThirdParty/sundials/include/arkode/arkode_sptfqmr.h similarity index 100% rename from sundials/include/arkode/arkode_sptfqmr.h rename to ThirdParty/sundials/include/arkode/arkode_sptfqmr.h diff --git a/sundials/include/arkode/arkode_superlumt.h b/ThirdParty/sundials/include/arkode/arkode_superlumt.h similarity index 100% rename from sundials/include/arkode/arkode_superlumt.h rename to ThirdParty/sundials/include/arkode/arkode_superlumt.h diff --git a/sundials/include/cvode/cvode.h b/ThirdParty/sundials/include/cvode/cvode.h similarity index 100% rename from sundials/include/cvode/cvode.h rename to ThirdParty/sundials/include/cvode/cvode.h diff --git a/sundials/include/cvode/cvode_band.h b/ThirdParty/sundials/include/cvode/cvode_band.h similarity index 100% rename from sundials/include/cvode/cvode_band.h rename to ThirdParty/sundials/include/cvode/cvode_band.h diff --git a/sundials/include/cvode/cvode_bandpre.h b/ThirdParty/sundials/include/cvode/cvode_bandpre.h similarity index 100% rename from sundials/include/cvode/cvode_bandpre.h rename to ThirdParty/sundials/include/cvode/cvode_bandpre.h diff --git a/sundials/include/cvode/cvode_bbdpre.h b/ThirdParty/sundials/include/cvode/cvode_bbdpre.h similarity index 100% rename from sundials/include/cvode/cvode_bbdpre.h rename to ThirdParty/sundials/include/cvode/cvode_bbdpre.h diff --git a/sundials/include/cvode/cvode_dense.h b/ThirdParty/sundials/include/cvode/cvode_dense.h similarity index 100% rename from sundials/include/cvode/cvode_dense.h rename to ThirdParty/sundials/include/cvode/cvode_dense.h diff --git a/sundials/include/cvode/cvode_diag.h b/ThirdParty/sundials/include/cvode/cvode_diag.h similarity index 100% rename from sundials/include/cvode/cvode_diag.h rename to ThirdParty/sundials/include/cvode/cvode_diag.h diff --git a/sundials/include/cvode/cvode_direct.h b/ThirdParty/sundials/include/cvode/cvode_direct.h similarity index 100% rename from sundials/include/cvode/cvode_direct.h rename to ThirdParty/sundials/include/cvode/cvode_direct.h diff --git a/sundials/include/cvode/cvode_klu.h b/ThirdParty/sundials/include/cvode/cvode_klu.h similarity index 100% rename from sundials/include/cvode/cvode_klu.h rename to ThirdParty/sundials/include/cvode/cvode_klu.h diff --git a/sundials/include/cvode/cvode_lapack.h b/ThirdParty/sundials/include/cvode/cvode_lapack.h similarity index 100% rename from sundials/include/cvode/cvode_lapack.h rename to ThirdParty/sundials/include/cvode/cvode_lapack.h diff --git a/sundials/include/cvode/cvode_sparse.h b/ThirdParty/sundials/include/cvode/cvode_sparse.h similarity index 100% rename from sundials/include/cvode/cvode_sparse.h rename to ThirdParty/sundials/include/cvode/cvode_sparse.h diff --git a/sundials/include/cvode/cvode_spbcgs.h b/ThirdParty/sundials/include/cvode/cvode_spbcgs.h similarity index 100% rename from sundials/include/cvode/cvode_spbcgs.h rename to ThirdParty/sundials/include/cvode/cvode_spbcgs.h diff --git a/sundials/include/cvode/cvode_spgmr.h b/ThirdParty/sundials/include/cvode/cvode_spgmr.h similarity index 100% rename from sundials/include/cvode/cvode_spgmr.h rename to ThirdParty/sundials/include/cvode/cvode_spgmr.h diff --git a/sundials/include/cvode/cvode_spils.h b/ThirdParty/sundials/include/cvode/cvode_spils.h similarity index 100% rename from sundials/include/cvode/cvode_spils.h rename to ThirdParty/sundials/include/cvode/cvode_spils.h diff --git a/sundials/include/cvode/cvode_sptfqmr.h b/ThirdParty/sundials/include/cvode/cvode_sptfqmr.h similarity index 100% rename from sundials/include/cvode/cvode_sptfqmr.h rename to ThirdParty/sundials/include/cvode/cvode_sptfqmr.h diff --git a/sundials/include/cvode/cvode_superlumt.h b/ThirdParty/sundials/include/cvode/cvode_superlumt.h similarity index 100% rename from sundials/include/cvode/cvode_superlumt.h rename to ThirdParty/sundials/include/cvode/cvode_superlumt.h diff --git a/sundials/include/cvodes/cvodes.h b/ThirdParty/sundials/include/cvodes/cvodes.h similarity index 100% rename from sundials/include/cvodes/cvodes.h rename to ThirdParty/sundials/include/cvodes/cvodes.h diff --git a/sundials/include/cvodes/cvodes_band.h b/ThirdParty/sundials/include/cvodes/cvodes_band.h similarity index 100% rename from sundials/include/cvodes/cvodes_band.h rename to ThirdParty/sundials/include/cvodes/cvodes_band.h diff --git a/sundials/include/cvodes/cvodes_bandpre.h b/ThirdParty/sundials/include/cvodes/cvodes_bandpre.h similarity index 100% rename from sundials/include/cvodes/cvodes_bandpre.h rename to ThirdParty/sundials/include/cvodes/cvodes_bandpre.h diff --git a/sundials/include/cvodes/cvodes_bbdpre.h b/ThirdParty/sundials/include/cvodes/cvodes_bbdpre.h similarity index 100% rename from sundials/include/cvodes/cvodes_bbdpre.h rename to ThirdParty/sundials/include/cvodes/cvodes_bbdpre.h diff --git a/sundials/include/cvodes/cvodes_dense.h b/ThirdParty/sundials/include/cvodes/cvodes_dense.h similarity index 100% rename from sundials/include/cvodes/cvodes_dense.h rename to ThirdParty/sundials/include/cvodes/cvodes_dense.h diff --git a/sundials/include/cvodes/cvodes_diag.h b/ThirdParty/sundials/include/cvodes/cvodes_diag.h similarity index 100% rename from sundials/include/cvodes/cvodes_diag.h rename to ThirdParty/sundials/include/cvodes/cvodes_diag.h diff --git a/sundials/include/cvodes/cvodes_direct.h b/ThirdParty/sundials/include/cvodes/cvodes_direct.h similarity index 100% rename from sundials/include/cvodes/cvodes_direct.h rename to ThirdParty/sundials/include/cvodes/cvodes_direct.h diff --git a/sundials/include/cvodes/cvodes_klu.h b/ThirdParty/sundials/include/cvodes/cvodes_klu.h similarity index 100% rename from sundials/include/cvodes/cvodes_klu.h rename to ThirdParty/sundials/include/cvodes/cvodes_klu.h diff --git a/sundials/include/cvodes/cvodes_lapack.h b/ThirdParty/sundials/include/cvodes/cvodes_lapack.h similarity index 100% rename from sundials/include/cvodes/cvodes_lapack.h rename to ThirdParty/sundials/include/cvodes/cvodes_lapack.h diff --git a/sundials/include/cvodes/cvodes_sparse.h b/ThirdParty/sundials/include/cvodes/cvodes_sparse.h similarity index 100% rename from sundials/include/cvodes/cvodes_sparse.h rename to ThirdParty/sundials/include/cvodes/cvodes_sparse.h diff --git a/sundials/include/cvodes/cvodes_spbcgs.h b/ThirdParty/sundials/include/cvodes/cvodes_spbcgs.h similarity index 100% rename from sundials/include/cvodes/cvodes_spbcgs.h rename to ThirdParty/sundials/include/cvodes/cvodes_spbcgs.h diff --git a/sundials/include/cvodes/cvodes_spgmr.h b/ThirdParty/sundials/include/cvodes/cvodes_spgmr.h similarity index 100% rename from sundials/include/cvodes/cvodes_spgmr.h rename to ThirdParty/sundials/include/cvodes/cvodes_spgmr.h diff --git a/sundials/include/cvodes/cvodes_spils.h b/ThirdParty/sundials/include/cvodes/cvodes_spils.h similarity index 100% rename from sundials/include/cvodes/cvodes_spils.h rename to ThirdParty/sundials/include/cvodes/cvodes_spils.h diff --git a/sundials/include/cvodes/cvodes_sptfqmr.h b/ThirdParty/sundials/include/cvodes/cvodes_sptfqmr.h similarity index 100% rename from sundials/include/cvodes/cvodes_sptfqmr.h rename to ThirdParty/sundials/include/cvodes/cvodes_sptfqmr.h diff --git a/sundials/include/cvodes/cvodes_superlumt.h b/ThirdParty/sundials/include/cvodes/cvodes_superlumt.h similarity index 100% rename from sundials/include/cvodes/cvodes_superlumt.h rename to ThirdParty/sundials/include/cvodes/cvodes_superlumt.h diff --git a/sundials/include/ida/ida.h b/ThirdParty/sundials/include/ida/ida.h similarity index 100% rename from sundials/include/ida/ida.h rename to ThirdParty/sundials/include/ida/ida.h diff --git a/sundials/include/ida/ida_band.h b/ThirdParty/sundials/include/ida/ida_band.h similarity index 100% rename from sundials/include/ida/ida_band.h rename to ThirdParty/sundials/include/ida/ida_band.h diff --git a/sundials/include/ida/ida_bbdpre.h b/ThirdParty/sundials/include/ida/ida_bbdpre.h similarity index 100% rename from sundials/include/ida/ida_bbdpre.h rename to ThirdParty/sundials/include/ida/ida_bbdpre.h diff --git a/sundials/include/ida/ida_dense.h b/ThirdParty/sundials/include/ida/ida_dense.h similarity index 100% rename from sundials/include/ida/ida_dense.h rename to ThirdParty/sundials/include/ida/ida_dense.h diff --git a/sundials/include/ida/ida_direct.h b/ThirdParty/sundials/include/ida/ida_direct.h similarity index 100% rename from sundials/include/ida/ida_direct.h rename to ThirdParty/sundials/include/ida/ida_direct.h diff --git a/sundials/include/ida/ida_klu.h b/ThirdParty/sundials/include/ida/ida_klu.h similarity index 100% rename from sundials/include/ida/ida_klu.h rename to ThirdParty/sundials/include/ida/ida_klu.h diff --git a/sundials/include/ida/ida_lapack.h b/ThirdParty/sundials/include/ida/ida_lapack.h similarity index 100% rename from sundials/include/ida/ida_lapack.h rename to ThirdParty/sundials/include/ida/ida_lapack.h diff --git a/sundials/include/ida/ida_sparse.h b/ThirdParty/sundials/include/ida/ida_sparse.h similarity index 100% rename from sundials/include/ida/ida_sparse.h rename to ThirdParty/sundials/include/ida/ida_sparse.h diff --git a/sundials/include/ida/ida_spbcgs.h b/ThirdParty/sundials/include/ida/ida_spbcgs.h similarity index 100% rename from sundials/include/ida/ida_spbcgs.h rename to ThirdParty/sundials/include/ida/ida_spbcgs.h diff --git a/sundials/include/ida/ida_spgmr.h b/ThirdParty/sundials/include/ida/ida_spgmr.h similarity index 100% rename from sundials/include/ida/ida_spgmr.h rename to ThirdParty/sundials/include/ida/ida_spgmr.h diff --git a/sundials/include/ida/ida_spils.h b/ThirdParty/sundials/include/ida/ida_spils.h similarity index 100% rename from sundials/include/ida/ida_spils.h rename to ThirdParty/sundials/include/ida/ida_spils.h diff --git a/sundials/include/ida/ida_sptfqmr.h b/ThirdParty/sundials/include/ida/ida_sptfqmr.h similarity index 100% rename from sundials/include/ida/ida_sptfqmr.h rename to ThirdParty/sundials/include/ida/ida_sptfqmr.h diff --git a/sundials/include/ida/ida_superlumt.h b/ThirdParty/sundials/include/ida/ida_superlumt.h similarity index 100% rename from sundials/include/ida/ida_superlumt.h rename to ThirdParty/sundials/include/ida/ida_superlumt.h diff --git a/sundials/include/idas/idas.h b/ThirdParty/sundials/include/idas/idas.h similarity index 100% rename from sundials/include/idas/idas.h rename to ThirdParty/sundials/include/idas/idas.h diff --git a/sundials/include/idas/idas_band.h b/ThirdParty/sundials/include/idas/idas_band.h similarity index 100% rename from sundials/include/idas/idas_band.h rename to ThirdParty/sundials/include/idas/idas_band.h diff --git a/sundials/include/idas/idas_bbdpre.h b/ThirdParty/sundials/include/idas/idas_bbdpre.h similarity index 100% rename from sundials/include/idas/idas_bbdpre.h rename to ThirdParty/sundials/include/idas/idas_bbdpre.h diff --git a/sundials/include/idas/idas_dense.h b/ThirdParty/sundials/include/idas/idas_dense.h similarity index 100% rename from sundials/include/idas/idas_dense.h rename to ThirdParty/sundials/include/idas/idas_dense.h diff --git a/sundials/include/idas/idas_direct.h b/ThirdParty/sundials/include/idas/idas_direct.h similarity index 100% rename from sundials/include/idas/idas_direct.h rename to ThirdParty/sundials/include/idas/idas_direct.h diff --git a/sundials/include/idas/idas_klu.h b/ThirdParty/sundials/include/idas/idas_klu.h similarity index 100% rename from sundials/include/idas/idas_klu.h rename to ThirdParty/sundials/include/idas/idas_klu.h diff --git a/sundials/include/idas/idas_lapack.h b/ThirdParty/sundials/include/idas/idas_lapack.h similarity index 100% rename from sundials/include/idas/idas_lapack.h rename to ThirdParty/sundials/include/idas/idas_lapack.h diff --git a/sundials/include/idas/idas_sparse.h b/ThirdParty/sundials/include/idas/idas_sparse.h similarity index 100% rename from sundials/include/idas/idas_sparse.h rename to ThirdParty/sundials/include/idas/idas_sparse.h diff --git a/sundials/include/idas/idas_spbcgs.h b/ThirdParty/sundials/include/idas/idas_spbcgs.h similarity index 100% rename from sundials/include/idas/idas_spbcgs.h rename to ThirdParty/sundials/include/idas/idas_spbcgs.h diff --git a/sundials/include/idas/idas_spgmr.h b/ThirdParty/sundials/include/idas/idas_spgmr.h similarity index 100% rename from sundials/include/idas/idas_spgmr.h rename to ThirdParty/sundials/include/idas/idas_spgmr.h diff --git a/sundials/include/idas/idas_spils.h b/ThirdParty/sundials/include/idas/idas_spils.h similarity index 100% rename from sundials/include/idas/idas_spils.h rename to ThirdParty/sundials/include/idas/idas_spils.h diff --git a/sundials/include/idas/idas_sptfqmr.h b/ThirdParty/sundials/include/idas/idas_sptfqmr.h similarity index 100% rename from sundials/include/idas/idas_sptfqmr.h rename to ThirdParty/sundials/include/idas/idas_sptfqmr.h diff --git a/sundials/include/idas/idas_superlumt.h b/ThirdParty/sundials/include/idas/idas_superlumt.h similarity index 100% rename from sundials/include/idas/idas_superlumt.h rename to ThirdParty/sundials/include/idas/idas_superlumt.h diff --git a/sundials/include/kinsol/kinsol.h b/ThirdParty/sundials/include/kinsol/kinsol.h similarity index 100% rename from sundials/include/kinsol/kinsol.h rename to ThirdParty/sundials/include/kinsol/kinsol.h diff --git a/sundials/include/kinsol/kinsol_band.h b/ThirdParty/sundials/include/kinsol/kinsol_band.h similarity index 100% rename from sundials/include/kinsol/kinsol_band.h rename to ThirdParty/sundials/include/kinsol/kinsol_band.h diff --git a/sundials/include/kinsol/kinsol_bbdpre.h b/ThirdParty/sundials/include/kinsol/kinsol_bbdpre.h similarity index 100% rename from sundials/include/kinsol/kinsol_bbdpre.h rename to ThirdParty/sundials/include/kinsol/kinsol_bbdpre.h diff --git a/sundials/include/kinsol/kinsol_dense.h b/ThirdParty/sundials/include/kinsol/kinsol_dense.h similarity index 100% rename from sundials/include/kinsol/kinsol_dense.h rename to ThirdParty/sundials/include/kinsol/kinsol_dense.h diff --git a/sundials/include/kinsol/kinsol_direct.h b/ThirdParty/sundials/include/kinsol/kinsol_direct.h similarity index 100% rename from sundials/include/kinsol/kinsol_direct.h rename to ThirdParty/sundials/include/kinsol/kinsol_direct.h diff --git a/sundials/include/kinsol/kinsol_klu.h b/ThirdParty/sundials/include/kinsol/kinsol_klu.h similarity index 100% rename from sundials/include/kinsol/kinsol_klu.h rename to ThirdParty/sundials/include/kinsol/kinsol_klu.h diff --git a/sundials/include/kinsol/kinsol_lapack.h b/ThirdParty/sundials/include/kinsol/kinsol_lapack.h similarity index 100% rename from sundials/include/kinsol/kinsol_lapack.h rename to ThirdParty/sundials/include/kinsol/kinsol_lapack.h diff --git a/sundials/include/kinsol/kinsol_sparse.h b/ThirdParty/sundials/include/kinsol/kinsol_sparse.h similarity index 100% rename from sundials/include/kinsol/kinsol_sparse.h rename to ThirdParty/sundials/include/kinsol/kinsol_sparse.h diff --git a/sundials/include/kinsol/kinsol_spbcgs.h b/ThirdParty/sundials/include/kinsol/kinsol_spbcgs.h similarity index 100% rename from sundials/include/kinsol/kinsol_spbcgs.h rename to ThirdParty/sundials/include/kinsol/kinsol_spbcgs.h diff --git a/sundials/include/kinsol/kinsol_spfgmr.h b/ThirdParty/sundials/include/kinsol/kinsol_spfgmr.h similarity index 100% rename from sundials/include/kinsol/kinsol_spfgmr.h rename to ThirdParty/sundials/include/kinsol/kinsol_spfgmr.h diff --git a/sundials/include/kinsol/kinsol_spgmr.h b/ThirdParty/sundials/include/kinsol/kinsol_spgmr.h similarity index 100% rename from sundials/include/kinsol/kinsol_spgmr.h rename to ThirdParty/sundials/include/kinsol/kinsol_spgmr.h diff --git a/sundials/include/kinsol/kinsol_spils.h b/ThirdParty/sundials/include/kinsol/kinsol_spils.h similarity index 100% rename from sundials/include/kinsol/kinsol_spils.h rename to ThirdParty/sundials/include/kinsol/kinsol_spils.h diff --git a/sundials/include/kinsol/kinsol_sptfqmr.h b/ThirdParty/sundials/include/kinsol/kinsol_sptfqmr.h similarity index 100% rename from sundials/include/kinsol/kinsol_sptfqmr.h rename to ThirdParty/sundials/include/kinsol/kinsol_sptfqmr.h diff --git a/sundials/include/kinsol/kinsol_superlumt.h b/ThirdParty/sundials/include/kinsol/kinsol_superlumt.h similarity index 100% rename from sundials/include/kinsol/kinsol_superlumt.h rename to ThirdParty/sundials/include/kinsol/kinsol_superlumt.h diff --git a/sundials/include/nvector/nvector_openmp.h b/ThirdParty/sundials/include/nvector/nvector_openmp.h similarity index 100% rename from sundials/include/nvector/nvector_openmp.h rename to ThirdParty/sundials/include/nvector/nvector_openmp.h diff --git a/sundials/include/nvector/nvector_parallel.h b/ThirdParty/sundials/include/nvector/nvector_parallel.h similarity index 100% rename from sundials/include/nvector/nvector_parallel.h rename to ThirdParty/sundials/include/nvector/nvector_parallel.h diff --git a/sundials/include/nvector/nvector_parhyp.h b/ThirdParty/sundials/include/nvector/nvector_parhyp.h similarity index 100% rename from sundials/include/nvector/nvector_parhyp.h rename to ThirdParty/sundials/include/nvector/nvector_parhyp.h diff --git a/sundials/include/nvector/nvector_petsc.h b/ThirdParty/sundials/include/nvector/nvector_petsc.h similarity index 100% rename from sundials/include/nvector/nvector_petsc.h rename to ThirdParty/sundials/include/nvector/nvector_petsc.h diff --git a/sundials/include/nvector/nvector_pthreads.h b/ThirdParty/sundials/include/nvector/nvector_pthreads.h similarity index 100% rename from sundials/include/nvector/nvector_pthreads.h rename to ThirdParty/sundials/include/nvector/nvector_pthreads.h diff --git a/sundials/include/nvector/nvector_serial.h b/ThirdParty/sundials/include/nvector/nvector_serial.h similarity index 100% rename from sundials/include/nvector/nvector_serial.h rename to ThirdParty/sundials/include/nvector/nvector_serial.h diff --git a/sundials/include/sundials/sundials_band.h b/ThirdParty/sundials/include/sundials/sundials_band.h similarity index 100% rename from sundials/include/sundials/sundials_band.h rename to ThirdParty/sundials/include/sundials/sundials_band.h diff --git a/sundials/include/sundials/sundials_config.h b/ThirdParty/sundials/include/sundials/sundials_config.h similarity index 100% rename from sundials/include/sundials/sundials_config.h rename to ThirdParty/sundials/include/sundials/sundials_config.h diff --git a/sundials/include/sundials/sundials_config.in b/ThirdParty/sundials/include/sundials/sundials_config.in similarity index 100% rename from sundials/include/sundials/sundials_config.in rename to ThirdParty/sundials/include/sundials/sundials_config.in diff --git a/sundials/include/sundials/sundials_dense.h b/ThirdParty/sundials/include/sundials/sundials_dense.h similarity index 100% rename from sundials/include/sundials/sundials_dense.h rename to ThirdParty/sundials/include/sundials/sundials_dense.h diff --git a/sundials/include/sundials/sundials_direct.h b/ThirdParty/sundials/include/sundials/sundials_direct.h similarity index 100% rename from sundials/include/sundials/sundials_direct.h rename to ThirdParty/sundials/include/sundials/sundials_direct.h diff --git a/sundials/include/sundials/sundials_fnvector.h b/ThirdParty/sundials/include/sundials/sundials_fnvector.h similarity index 100% rename from sundials/include/sundials/sundials_fnvector.h rename to ThirdParty/sundials/include/sundials/sundials_fnvector.h diff --git a/sundials/include/sundials/sundials_iterative.h b/ThirdParty/sundials/include/sundials/sundials_iterative.h similarity index 100% rename from sundials/include/sundials/sundials_iterative.h rename to ThirdParty/sundials/include/sundials/sundials_iterative.h diff --git a/sundials/include/sundials/sundials_klu_impl.h b/ThirdParty/sundials/include/sundials/sundials_klu_impl.h similarity index 100% rename from sundials/include/sundials/sundials_klu_impl.h rename to ThirdParty/sundials/include/sundials/sundials_klu_impl.h diff --git a/sundials/include/sundials/sundials_lapack.h b/ThirdParty/sundials/include/sundials/sundials_lapack.h similarity index 100% rename from sundials/include/sundials/sundials_lapack.h rename to ThirdParty/sundials/include/sundials/sundials_lapack.h diff --git a/sundials/include/sundials/sundials_math.h b/ThirdParty/sundials/include/sundials/sundials_math.h similarity index 100% rename from sundials/include/sundials/sundials_math.h rename to ThirdParty/sundials/include/sundials/sundials_math.h diff --git a/sundials/include/sundials/sundials_nvector.h b/ThirdParty/sundials/include/sundials/sundials_nvector.h similarity index 100% rename from sundials/include/sundials/sundials_nvector.h rename to ThirdParty/sundials/include/sundials/sundials_nvector.h diff --git a/sundials/include/sundials/sundials_pcg.h b/ThirdParty/sundials/include/sundials/sundials_pcg.h similarity index 100% rename from sundials/include/sundials/sundials_pcg.h rename to ThirdParty/sundials/include/sundials/sundials_pcg.h diff --git a/sundials/include/sundials/sundials_sparse.h b/ThirdParty/sundials/include/sundials/sundials_sparse.h similarity index 100% rename from sundials/include/sundials/sundials_sparse.h rename to ThirdParty/sundials/include/sundials/sundials_sparse.h diff --git a/sundials/include/sundials/sundials_spbcgs.h b/ThirdParty/sundials/include/sundials/sundials_spbcgs.h similarity index 100% rename from sundials/include/sundials/sundials_spbcgs.h rename to ThirdParty/sundials/include/sundials/sundials_spbcgs.h diff --git a/sundials/include/sundials/sundials_spfgmr.h b/ThirdParty/sundials/include/sundials/sundials_spfgmr.h similarity index 100% rename from sundials/include/sundials/sundials_spfgmr.h rename to ThirdParty/sundials/include/sundials/sundials_spfgmr.h diff --git a/sundials/include/sundials/sundials_spgmr.h b/ThirdParty/sundials/include/sundials/sundials_spgmr.h similarity index 100% rename from sundials/include/sundials/sundials_spgmr.h rename to ThirdParty/sundials/include/sundials/sundials_spgmr.h diff --git a/sundials/include/sundials/sundials_sptfqmr.h b/ThirdParty/sundials/include/sundials/sundials_sptfqmr.h similarity index 100% rename from sundials/include/sundials/sundials_sptfqmr.h rename to ThirdParty/sundials/include/sundials/sundials_sptfqmr.h diff --git a/sundials/include/sundials/sundials_superlumt_impl.h b/ThirdParty/sundials/include/sundials/sundials_superlumt_impl.h similarity index 100% rename from sundials/include/sundials/sundials_superlumt_impl.h rename to ThirdParty/sundials/include/sundials/sundials_superlumt_impl.h diff --git a/sundials/include/sundials/sundials_types.h b/ThirdParty/sundials/include/sundials/sundials_types.h similarity index 100% rename from sundials/include/sundials/sundials_types.h rename to ThirdParty/sundials/include/sundials/sundials_types.h diff --git a/sundials/src/arkode/CMakeLists.txt b/ThirdParty/sundials/src/arkode/CMakeLists.txt similarity index 100% rename from sundials/src/arkode/CMakeLists.txt rename to ThirdParty/sundials/src/arkode/CMakeLists.txt diff --git a/sundials/src/arkode/LICENSE b/ThirdParty/sundials/src/arkode/LICENSE similarity index 100% rename from sundials/src/arkode/LICENSE rename to ThirdParty/sundials/src/arkode/LICENSE diff --git a/sundials/src/arkode/README b/ThirdParty/sundials/src/arkode/README similarity index 100% rename from sundials/src/arkode/README rename to ThirdParty/sundials/src/arkode/README diff --git a/sundials/src/arkode/arkode.c b/ThirdParty/sundials/src/arkode/arkode.c similarity index 100% rename from sundials/src/arkode/arkode.c rename to ThirdParty/sundials/src/arkode/arkode.c diff --git a/sundials/src/arkode/arkode_band.c b/ThirdParty/sundials/src/arkode/arkode_band.c similarity index 100% rename from sundials/src/arkode/arkode_band.c rename to ThirdParty/sundials/src/arkode/arkode_band.c diff --git a/sundials/src/arkode/arkode_bandpre.c b/ThirdParty/sundials/src/arkode/arkode_bandpre.c similarity index 100% rename from sundials/src/arkode/arkode_bandpre.c rename to ThirdParty/sundials/src/arkode/arkode_bandpre.c diff --git a/sundials/src/arkode/arkode_bandpre_impl.h b/ThirdParty/sundials/src/arkode/arkode_bandpre_impl.h similarity index 100% rename from sundials/src/arkode/arkode_bandpre_impl.h rename to ThirdParty/sundials/src/arkode/arkode_bandpre_impl.h diff --git a/sundials/src/arkode/arkode_bbdpre.c b/ThirdParty/sundials/src/arkode/arkode_bbdpre.c similarity index 100% rename from sundials/src/arkode/arkode_bbdpre.c rename to ThirdParty/sundials/src/arkode/arkode_bbdpre.c diff --git a/sundials/src/arkode/arkode_bbdpre_impl.h b/ThirdParty/sundials/src/arkode/arkode_bbdpre_impl.h similarity index 100% rename from sundials/src/arkode/arkode_bbdpre_impl.h rename to ThirdParty/sundials/src/arkode/arkode_bbdpre_impl.h diff --git a/sundials/src/arkode/arkode_butcher.c b/ThirdParty/sundials/src/arkode/arkode_butcher.c similarity index 100% rename from sundials/src/arkode/arkode_butcher.c rename to ThirdParty/sundials/src/arkode/arkode_butcher.c diff --git a/sundials/src/arkode/arkode_dense.c b/ThirdParty/sundials/src/arkode/arkode_dense.c similarity index 100% rename from sundials/src/arkode/arkode_dense.c rename to ThirdParty/sundials/src/arkode/arkode_dense.c diff --git a/sundials/src/arkode/arkode_direct.c b/ThirdParty/sundials/src/arkode/arkode_direct.c similarity index 100% rename from sundials/src/arkode/arkode_direct.c rename to ThirdParty/sundials/src/arkode/arkode_direct.c diff --git a/sundials/src/arkode/arkode_direct_impl.h b/ThirdParty/sundials/src/arkode/arkode_direct_impl.h similarity index 100% rename from sundials/src/arkode/arkode_direct_impl.h rename to ThirdParty/sundials/src/arkode/arkode_direct_impl.h diff --git a/sundials/src/arkode/arkode_impl.h b/ThirdParty/sundials/src/arkode/arkode_impl.h similarity index 100% rename from sundials/src/arkode/arkode_impl.h rename to ThirdParty/sundials/src/arkode/arkode_impl.h diff --git a/sundials/src/arkode/arkode_io.c b/ThirdParty/sundials/src/arkode/arkode_io.c similarity index 100% rename from sundials/src/arkode/arkode_io.c rename to ThirdParty/sundials/src/arkode/arkode_io.c diff --git a/sundials/src/arkode/arkode_klu.c b/ThirdParty/sundials/src/arkode/arkode_klu.c similarity index 100% rename from sundials/src/arkode/arkode_klu.c rename to ThirdParty/sundials/src/arkode/arkode_klu.c diff --git a/sundials/src/arkode/arkode_lapack.c b/ThirdParty/sundials/src/arkode/arkode_lapack.c similarity index 100% rename from sundials/src/arkode/arkode_lapack.c rename to ThirdParty/sundials/src/arkode/arkode_lapack.c diff --git a/sundials/src/arkode/arkode_pcg.c b/ThirdParty/sundials/src/arkode/arkode_pcg.c similarity index 100% rename from sundials/src/arkode/arkode_pcg.c rename to ThirdParty/sundials/src/arkode/arkode_pcg.c diff --git a/sundials/src/arkode/arkode_sparse.c b/ThirdParty/sundials/src/arkode/arkode_sparse.c similarity index 100% rename from sundials/src/arkode/arkode_sparse.c rename to ThirdParty/sundials/src/arkode/arkode_sparse.c diff --git a/sundials/src/arkode/arkode_sparse_impl.h b/ThirdParty/sundials/src/arkode/arkode_sparse_impl.h similarity index 100% rename from sundials/src/arkode/arkode_sparse_impl.h rename to ThirdParty/sundials/src/arkode/arkode_sparse_impl.h diff --git a/sundials/src/arkode/arkode_spbcgs.c b/ThirdParty/sundials/src/arkode/arkode_spbcgs.c similarity index 100% rename from sundials/src/arkode/arkode_spbcgs.c rename to ThirdParty/sundials/src/arkode/arkode_spbcgs.c diff --git a/sundials/src/arkode/arkode_spfgmr.c b/ThirdParty/sundials/src/arkode/arkode_spfgmr.c similarity index 100% rename from sundials/src/arkode/arkode_spfgmr.c rename to ThirdParty/sundials/src/arkode/arkode_spfgmr.c diff --git a/sundials/src/arkode/arkode_spgmr.c b/ThirdParty/sundials/src/arkode/arkode_spgmr.c similarity index 100% rename from sundials/src/arkode/arkode_spgmr.c rename to ThirdParty/sundials/src/arkode/arkode_spgmr.c diff --git a/sundials/src/arkode/arkode_spils.c b/ThirdParty/sundials/src/arkode/arkode_spils.c similarity index 100% rename from sundials/src/arkode/arkode_spils.c rename to ThirdParty/sundials/src/arkode/arkode_spils.c diff --git a/sundials/src/arkode/arkode_spils_impl.h b/ThirdParty/sundials/src/arkode/arkode_spils_impl.h similarity index 100% rename from sundials/src/arkode/arkode_spils_impl.h rename to ThirdParty/sundials/src/arkode/arkode_spils_impl.h diff --git a/sundials/src/arkode/arkode_sptfqmr.c b/ThirdParty/sundials/src/arkode/arkode_sptfqmr.c similarity index 100% rename from sundials/src/arkode/arkode_sptfqmr.c rename to ThirdParty/sundials/src/arkode/arkode_sptfqmr.c diff --git a/sundials/src/arkode/arkode_superlumt.c b/ThirdParty/sundials/src/arkode/arkode_superlumt.c similarity index 100% rename from sundials/src/arkode/arkode_superlumt.c rename to ThirdParty/sundials/src/arkode/arkode_superlumt.c diff --git a/sundials/src/arkode/fcmix/CMakeLists.txt b/ThirdParty/sundials/src/arkode/fcmix/CMakeLists.txt similarity index 100% rename from sundials/src/arkode/fcmix/CMakeLists.txt rename to ThirdParty/sundials/src/arkode/fcmix/CMakeLists.txt diff --git a/sundials/src/arkode/fcmix/farkadapt.c b/ThirdParty/sundials/src/arkode/fcmix/farkadapt.c similarity index 100% rename from sundials/src/arkode/fcmix/farkadapt.c rename to ThirdParty/sundials/src/arkode/fcmix/farkadapt.c diff --git a/sundials/src/arkode/fcmix/farkband.c b/ThirdParty/sundials/src/arkode/fcmix/farkband.c similarity index 100% rename from sundials/src/arkode/fcmix/farkband.c rename to ThirdParty/sundials/src/arkode/fcmix/farkband.c diff --git a/sundials/src/arkode/fcmix/farkbandmass.c b/ThirdParty/sundials/src/arkode/fcmix/farkbandmass.c similarity index 100% rename from sundials/src/arkode/fcmix/farkbandmass.c rename to ThirdParty/sundials/src/arkode/fcmix/farkbandmass.c diff --git a/sundials/src/arkode/fcmix/farkbbd.c b/ThirdParty/sundials/src/arkode/fcmix/farkbbd.c similarity index 100% rename from sundials/src/arkode/fcmix/farkbbd.c rename to ThirdParty/sundials/src/arkode/fcmix/farkbbd.c diff --git a/sundials/src/arkode/fcmix/farkbbd.h b/ThirdParty/sundials/src/arkode/fcmix/farkbbd.h similarity index 100% rename from sundials/src/arkode/fcmix/farkbbd.h rename to ThirdParty/sundials/src/arkode/fcmix/farkbbd.h diff --git a/sundials/src/arkode/fcmix/farkbp.c b/ThirdParty/sundials/src/arkode/fcmix/farkbp.c similarity index 100% rename from sundials/src/arkode/fcmix/farkbp.c rename to ThirdParty/sundials/src/arkode/fcmix/farkbp.c diff --git a/sundials/src/arkode/fcmix/farkbp.h b/ThirdParty/sundials/src/arkode/fcmix/farkbp.h similarity index 100% rename from sundials/src/arkode/fcmix/farkbp.h rename to ThirdParty/sundials/src/arkode/fcmix/farkbp.h diff --git a/sundials/src/arkode/fcmix/farkdense.c b/ThirdParty/sundials/src/arkode/fcmix/farkdense.c similarity index 100% rename from sundials/src/arkode/fcmix/farkdense.c rename to ThirdParty/sundials/src/arkode/fcmix/farkdense.c diff --git a/sundials/src/arkode/fcmix/farkdensemass.c b/ThirdParty/sundials/src/arkode/fcmix/farkdensemass.c similarity index 100% rename from sundials/src/arkode/fcmix/farkdensemass.c rename to ThirdParty/sundials/src/arkode/fcmix/farkdensemass.c diff --git a/sundials/src/arkode/fcmix/farkewt.c b/ThirdParty/sundials/src/arkode/fcmix/farkewt.c similarity index 100% rename from sundials/src/arkode/fcmix/farkewt.c rename to ThirdParty/sundials/src/arkode/fcmix/farkewt.c diff --git a/sundials/src/arkode/fcmix/farkexpstab.c b/ThirdParty/sundials/src/arkode/fcmix/farkexpstab.c similarity index 100% rename from sundials/src/arkode/fcmix/farkexpstab.c rename to ThirdParty/sundials/src/arkode/fcmix/farkexpstab.c diff --git a/sundials/src/arkode/fcmix/farkjtimes.c b/ThirdParty/sundials/src/arkode/fcmix/farkjtimes.c similarity index 100% rename from sundials/src/arkode/fcmix/farkjtimes.c rename to ThirdParty/sundials/src/arkode/fcmix/farkjtimes.c diff --git a/sundials/src/arkode/fcmix/farkklu.c b/ThirdParty/sundials/src/arkode/fcmix/farkklu.c similarity index 100% rename from sundials/src/arkode/fcmix/farkklu.c rename to ThirdParty/sundials/src/arkode/fcmix/farkklu.c diff --git a/sundials/src/arkode/fcmix/farklapack.c b/ThirdParty/sundials/src/arkode/fcmix/farklapack.c similarity index 100% rename from sundials/src/arkode/fcmix/farklapack.c rename to ThirdParty/sundials/src/arkode/fcmix/farklapack.c diff --git a/sundials/src/arkode/fcmix/farklapband.c b/ThirdParty/sundials/src/arkode/fcmix/farklapband.c similarity index 100% rename from sundials/src/arkode/fcmix/farklapband.c rename to ThirdParty/sundials/src/arkode/fcmix/farklapband.c diff --git a/sundials/src/arkode/fcmix/farklapbandmass.c b/ThirdParty/sundials/src/arkode/fcmix/farklapbandmass.c similarity index 100% rename from sundials/src/arkode/fcmix/farklapbandmass.c rename to ThirdParty/sundials/src/arkode/fcmix/farklapbandmass.c diff --git a/sundials/src/arkode/fcmix/farklapdense.c b/ThirdParty/sundials/src/arkode/fcmix/farklapdense.c similarity index 100% rename from sundials/src/arkode/fcmix/farklapdense.c rename to ThirdParty/sundials/src/arkode/fcmix/farklapdense.c diff --git a/sundials/src/arkode/fcmix/farklapdensemass.c b/ThirdParty/sundials/src/arkode/fcmix/farklapdensemass.c similarity index 100% rename from sundials/src/arkode/fcmix/farklapdensemass.c rename to ThirdParty/sundials/src/arkode/fcmix/farklapdensemass.c diff --git a/sundials/src/arkode/fcmix/farkmasspreco.c b/ThirdParty/sundials/src/arkode/fcmix/farkmasspreco.c similarity index 100% rename from sundials/src/arkode/fcmix/farkmasspreco.c rename to ThirdParty/sundials/src/arkode/fcmix/farkmasspreco.c diff --git a/sundials/src/arkode/fcmix/farkmtimes.c b/ThirdParty/sundials/src/arkode/fcmix/farkmtimes.c similarity index 100% rename from sundials/src/arkode/fcmix/farkmtimes.c rename to ThirdParty/sundials/src/arkode/fcmix/farkmtimes.c diff --git a/sundials/src/arkode/fcmix/farkode.c b/ThirdParty/sundials/src/arkode/fcmix/farkode.c similarity index 100% rename from sundials/src/arkode/fcmix/farkode.c rename to ThirdParty/sundials/src/arkode/fcmix/farkode.c diff --git a/sundials/src/arkode/fcmix/farkode.h b/ThirdParty/sundials/src/arkode/fcmix/farkode.h similarity index 100% rename from sundials/src/arkode/fcmix/farkode.h rename to ThirdParty/sundials/src/arkode/fcmix/farkode.h diff --git a/sundials/src/arkode/fcmix/farkpreco.c b/ThirdParty/sundials/src/arkode/fcmix/farkpreco.c similarity index 100% rename from sundials/src/arkode/fcmix/farkpreco.c rename to ThirdParty/sundials/src/arkode/fcmix/farkpreco.c diff --git a/sundials/src/arkode/fcmix/farkroot.c b/ThirdParty/sundials/src/arkode/fcmix/farkroot.c similarity index 100% rename from sundials/src/arkode/fcmix/farkroot.c rename to ThirdParty/sundials/src/arkode/fcmix/farkroot.c diff --git a/sundials/src/arkode/fcmix/farkroot.h b/ThirdParty/sundials/src/arkode/fcmix/farkroot.h similarity index 100% rename from sundials/src/arkode/fcmix/farkroot.h rename to ThirdParty/sundials/src/arkode/fcmix/farkroot.h diff --git a/sundials/src/arkode/fcmix/farksparse.c b/ThirdParty/sundials/src/arkode/fcmix/farksparse.c similarity index 100% rename from sundials/src/arkode/fcmix/farksparse.c rename to ThirdParty/sundials/src/arkode/fcmix/farksparse.c diff --git a/sundials/src/arkode/fcmix/farksparsemass.c b/ThirdParty/sundials/src/arkode/fcmix/farksparsemass.c similarity index 100% rename from sundials/src/arkode/fcmix/farksparsemass.c rename to ThirdParty/sundials/src/arkode/fcmix/farksparsemass.c diff --git a/sundials/src/arkode/fcmix/farksuperlumt.c b/ThirdParty/sundials/src/arkode/fcmix/farksuperlumt.c similarity index 100% rename from sundials/src/arkode/fcmix/farksuperlumt.c rename to ThirdParty/sundials/src/arkode/fcmix/farksuperlumt.c diff --git a/sundials/src/cvode/CMakeLists.txt b/ThirdParty/sundials/src/cvode/CMakeLists.txt similarity index 100% rename from sundials/src/cvode/CMakeLists.txt rename to ThirdParty/sundials/src/cvode/CMakeLists.txt diff --git a/sundials/src/cvode/LICENSE b/ThirdParty/sundials/src/cvode/LICENSE similarity index 100% rename from sundials/src/cvode/LICENSE rename to ThirdParty/sundials/src/cvode/LICENSE diff --git a/sundials/src/cvode/README b/ThirdParty/sundials/src/cvode/README similarity index 100% rename from sundials/src/cvode/README rename to ThirdParty/sundials/src/cvode/README diff --git a/sundials/src/cvode/cvode.c b/ThirdParty/sundials/src/cvode/cvode.c similarity index 100% rename from sundials/src/cvode/cvode.c rename to ThirdParty/sundials/src/cvode/cvode.c diff --git a/sundials/src/cvode/cvode_band.c b/ThirdParty/sundials/src/cvode/cvode_band.c similarity index 100% rename from sundials/src/cvode/cvode_band.c rename to ThirdParty/sundials/src/cvode/cvode_band.c diff --git a/sundials/src/cvode/cvode_bandpre.c b/ThirdParty/sundials/src/cvode/cvode_bandpre.c similarity index 100% rename from sundials/src/cvode/cvode_bandpre.c rename to ThirdParty/sundials/src/cvode/cvode_bandpre.c diff --git a/sundials/src/cvode/cvode_bandpre_impl.h b/ThirdParty/sundials/src/cvode/cvode_bandpre_impl.h similarity index 100% rename from sundials/src/cvode/cvode_bandpre_impl.h rename to ThirdParty/sundials/src/cvode/cvode_bandpre_impl.h diff --git a/sundials/src/cvode/cvode_bbdpre.c b/ThirdParty/sundials/src/cvode/cvode_bbdpre.c similarity index 100% rename from sundials/src/cvode/cvode_bbdpre.c rename to ThirdParty/sundials/src/cvode/cvode_bbdpre.c diff --git a/sundials/src/cvode/cvode_bbdpre_impl.h b/ThirdParty/sundials/src/cvode/cvode_bbdpre_impl.h similarity index 100% rename from sundials/src/cvode/cvode_bbdpre_impl.h rename to ThirdParty/sundials/src/cvode/cvode_bbdpre_impl.h diff --git a/sundials/src/cvode/cvode_dense.c b/ThirdParty/sundials/src/cvode/cvode_dense.c similarity index 100% rename from sundials/src/cvode/cvode_dense.c rename to ThirdParty/sundials/src/cvode/cvode_dense.c diff --git a/sundials/src/cvode/cvode_diag.c b/ThirdParty/sundials/src/cvode/cvode_diag.c similarity index 100% rename from sundials/src/cvode/cvode_diag.c rename to ThirdParty/sundials/src/cvode/cvode_diag.c diff --git a/sundials/src/cvode/cvode_diag_impl.h b/ThirdParty/sundials/src/cvode/cvode_diag_impl.h similarity index 100% rename from sundials/src/cvode/cvode_diag_impl.h rename to ThirdParty/sundials/src/cvode/cvode_diag_impl.h diff --git a/sundials/src/cvode/cvode_direct.c b/ThirdParty/sundials/src/cvode/cvode_direct.c similarity index 100% rename from sundials/src/cvode/cvode_direct.c rename to ThirdParty/sundials/src/cvode/cvode_direct.c diff --git a/sundials/src/cvode/cvode_direct_impl.h b/ThirdParty/sundials/src/cvode/cvode_direct_impl.h similarity index 100% rename from sundials/src/cvode/cvode_direct_impl.h rename to ThirdParty/sundials/src/cvode/cvode_direct_impl.h diff --git a/sundials/src/cvode/cvode_impl.h b/ThirdParty/sundials/src/cvode/cvode_impl.h similarity index 100% rename from sundials/src/cvode/cvode_impl.h rename to ThirdParty/sundials/src/cvode/cvode_impl.h diff --git a/sundials/src/cvode/cvode_io.c b/ThirdParty/sundials/src/cvode/cvode_io.c similarity index 100% rename from sundials/src/cvode/cvode_io.c rename to ThirdParty/sundials/src/cvode/cvode_io.c diff --git a/sundials/src/cvode/cvode_klu.c b/ThirdParty/sundials/src/cvode/cvode_klu.c similarity index 100% rename from sundials/src/cvode/cvode_klu.c rename to ThirdParty/sundials/src/cvode/cvode_klu.c diff --git a/sundials/src/cvode/cvode_lapack.c b/ThirdParty/sundials/src/cvode/cvode_lapack.c similarity index 100% rename from sundials/src/cvode/cvode_lapack.c rename to ThirdParty/sundials/src/cvode/cvode_lapack.c diff --git a/sundials/src/cvode/cvode_sparse.c b/ThirdParty/sundials/src/cvode/cvode_sparse.c similarity index 100% rename from sundials/src/cvode/cvode_sparse.c rename to ThirdParty/sundials/src/cvode/cvode_sparse.c diff --git a/sundials/src/cvode/cvode_sparse_impl.h b/ThirdParty/sundials/src/cvode/cvode_sparse_impl.h similarity index 100% rename from sundials/src/cvode/cvode_sparse_impl.h rename to ThirdParty/sundials/src/cvode/cvode_sparse_impl.h diff --git a/sundials/src/cvode/cvode_spbcgs.c b/ThirdParty/sundials/src/cvode/cvode_spbcgs.c similarity index 100% rename from sundials/src/cvode/cvode_spbcgs.c rename to ThirdParty/sundials/src/cvode/cvode_spbcgs.c diff --git a/sundials/src/cvode/cvode_spgmr.c b/ThirdParty/sundials/src/cvode/cvode_spgmr.c similarity index 100% rename from sundials/src/cvode/cvode_spgmr.c rename to ThirdParty/sundials/src/cvode/cvode_spgmr.c diff --git a/sundials/src/cvode/cvode_spils.c b/ThirdParty/sundials/src/cvode/cvode_spils.c similarity index 100% rename from sundials/src/cvode/cvode_spils.c rename to ThirdParty/sundials/src/cvode/cvode_spils.c diff --git a/sundials/src/cvode/cvode_spils_impl.h b/ThirdParty/sundials/src/cvode/cvode_spils_impl.h similarity index 100% rename from sundials/src/cvode/cvode_spils_impl.h rename to ThirdParty/sundials/src/cvode/cvode_spils_impl.h diff --git a/sundials/src/cvode/cvode_sptfqmr.c b/ThirdParty/sundials/src/cvode/cvode_sptfqmr.c similarity index 100% rename from sundials/src/cvode/cvode_sptfqmr.c rename to ThirdParty/sundials/src/cvode/cvode_sptfqmr.c diff --git a/sundials/src/cvode/cvode_superlumt.c b/ThirdParty/sundials/src/cvode/cvode_superlumt.c similarity index 100% rename from sundials/src/cvode/cvode_superlumt.c rename to ThirdParty/sundials/src/cvode/cvode_superlumt.c diff --git a/sundials/src/cvode/fcmix/CMakeLists.txt b/ThirdParty/sundials/src/cvode/fcmix/CMakeLists.txt similarity index 100% rename from sundials/src/cvode/fcmix/CMakeLists.txt rename to ThirdParty/sundials/src/cvode/fcmix/CMakeLists.txt diff --git a/sundials/src/cvode/fcmix/fcvband.c b/ThirdParty/sundials/src/cvode/fcmix/fcvband.c similarity index 100% rename from sundials/src/cvode/fcmix/fcvband.c rename to ThirdParty/sundials/src/cvode/fcmix/fcvband.c diff --git a/sundials/src/cvode/fcmix/fcvbbd.c b/ThirdParty/sundials/src/cvode/fcmix/fcvbbd.c similarity index 100% rename from sundials/src/cvode/fcmix/fcvbbd.c rename to ThirdParty/sundials/src/cvode/fcmix/fcvbbd.c diff --git a/sundials/src/cvode/fcmix/fcvbbd.h b/ThirdParty/sundials/src/cvode/fcmix/fcvbbd.h similarity index 100% rename from sundials/src/cvode/fcmix/fcvbbd.h rename to ThirdParty/sundials/src/cvode/fcmix/fcvbbd.h diff --git a/sundials/src/cvode/fcmix/fcvbp.c b/ThirdParty/sundials/src/cvode/fcmix/fcvbp.c similarity index 100% rename from sundials/src/cvode/fcmix/fcvbp.c rename to ThirdParty/sundials/src/cvode/fcmix/fcvbp.c diff --git a/sundials/src/cvode/fcmix/fcvbp.h b/ThirdParty/sundials/src/cvode/fcmix/fcvbp.h similarity index 100% rename from sundials/src/cvode/fcmix/fcvbp.h rename to ThirdParty/sundials/src/cvode/fcmix/fcvbp.h diff --git a/sundials/src/cvode/fcmix/fcvdense.c b/ThirdParty/sundials/src/cvode/fcmix/fcvdense.c similarity index 100% rename from sundials/src/cvode/fcmix/fcvdense.c rename to ThirdParty/sundials/src/cvode/fcmix/fcvdense.c diff --git a/sundials/src/cvode/fcmix/fcvewt.c b/ThirdParty/sundials/src/cvode/fcmix/fcvewt.c similarity index 100% rename from sundials/src/cvode/fcmix/fcvewt.c rename to ThirdParty/sundials/src/cvode/fcmix/fcvewt.c diff --git a/sundials/src/cvode/fcmix/fcvjtimes.c b/ThirdParty/sundials/src/cvode/fcmix/fcvjtimes.c similarity index 100% rename from sundials/src/cvode/fcmix/fcvjtimes.c rename to ThirdParty/sundials/src/cvode/fcmix/fcvjtimes.c diff --git a/sundials/src/cvode/fcmix/fcvklu.c b/ThirdParty/sundials/src/cvode/fcmix/fcvklu.c similarity index 100% rename from sundials/src/cvode/fcmix/fcvklu.c rename to ThirdParty/sundials/src/cvode/fcmix/fcvklu.c diff --git a/sundials/src/cvode/fcmix/fcvlapack.c b/ThirdParty/sundials/src/cvode/fcmix/fcvlapack.c similarity index 100% rename from sundials/src/cvode/fcmix/fcvlapack.c rename to ThirdParty/sundials/src/cvode/fcmix/fcvlapack.c diff --git a/sundials/src/cvode/fcmix/fcvlapband.c b/ThirdParty/sundials/src/cvode/fcmix/fcvlapband.c similarity index 100% rename from sundials/src/cvode/fcmix/fcvlapband.c rename to ThirdParty/sundials/src/cvode/fcmix/fcvlapband.c diff --git a/sundials/src/cvode/fcmix/fcvlapdense.c b/ThirdParty/sundials/src/cvode/fcmix/fcvlapdense.c similarity index 100% rename from sundials/src/cvode/fcmix/fcvlapdense.c rename to ThirdParty/sundials/src/cvode/fcmix/fcvlapdense.c diff --git a/sundials/src/cvode/fcmix/fcvode.c b/ThirdParty/sundials/src/cvode/fcmix/fcvode.c similarity index 100% rename from sundials/src/cvode/fcmix/fcvode.c rename to ThirdParty/sundials/src/cvode/fcmix/fcvode.c diff --git a/sundials/src/cvode/fcmix/fcvode.h b/ThirdParty/sundials/src/cvode/fcmix/fcvode.h similarity index 100% rename from sundials/src/cvode/fcmix/fcvode.h rename to ThirdParty/sundials/src/cvode/fcmix/fcvode.h diff --git a/sundials/src/cvode/fcmix/fcvpreco.c b/ThirdParty/sundials/src/cvode/fcmix/fcvpreco.c similarity index 100% rename from sundials/src/cvode/fcmix/fcvpreco.c rename to ThirdParty/sundials/src/cvode/fcmix/fcvpreco.c diff --git a/sundials/src/cvode/fcmix/fcvroot.c b/ThirdParty/sundials/src/cvode/fcmix/fcvroot.c similarity index 100% rename from sundials/src/cvode/fcmix/fcvroot.c rename to ThirdParty/sundials/src/cvode/fcmix/fcvroot.c diff --git a/sundials/src/cvode/fcmix/fcvroot.h b/ThirdParty/sundials/src/cvode/fcmix/fcvroot.h similarity index 100% rename from sundials/src/cvode/fcmix/fcvroot.h rename to ThirdParty/sundials/src/cvode/fcmix/fcvroot.h diff --git a/sundials/src/cvode/fcmix/fcvsparse.c b/ThirdParty/sundials/src/cvode/fcmix/fcvsparse.c similarity index 100% rename from sundials/src/cvode/fcmix/fcvsparse.c rename to ThirdParty/sundials/src/cvode/fcmix/fcvsparse.c diff --git a/sundials/src/cvode/fcmix/fcvsuperlumt.c b/ThirdParty/sundials/src/cvode/fcmix/fcvsuperlumt.c similarity index 100% rename from sundials/src/cvode/fcmix/fcvsuperlumt.c rename to ThirdParty/sundials/src/cvode/fcmix/fcvsuperlumt.c diff --git a/sundials/src/cvodes/CMakeLists.txt b/ThirdParty/sundials/src/cvodes/CMakeLists.txt similarity index 100% rename from sundials/src/cvodes/CMakeLists.txt rename to ThirdParty/sundials/src/cvodes/CMakeLists.txt diff --git a/sundials/src/cvodes/LICENSE b/ThirdParty/sundials/src/cvodes/LICENSE similarity index 100% rename from sundials/src/cvodes/LICENSE rename to ThirdParty/sundials/src/cvodes/LICENSE diff --git a/sundials/src/cvodes/README b/ThirdParty/sundials/src/cvodes/README similarity index 100% rename from sundials/src/cvodes/README rename to ThirdParty/sundials/src/cvodes/README diff --git a/sundials/src/cvodes/cvodea.c b/ThirdParty/sundials/src/cvodes/cvodea.c similarity index 100% rename from sundials/src/cvodes/cvodea.c rename to ThirdParty/sundials/src/cvodes/cvodea.c diff --git a/sundials/src/cvodes/cvodea_io.c b/ThirdParty/sundials/src/cvodes/cvodea_io.c similarity index 100% rename from sundials/src/cvodes/cvodea_io.c rename to ThirdParty/sundials/src/cvodes/cvodea_io.c diff --git a/sundials/src/cvodes/cvodes.c b/ThirdParty/sundials/src/cvodes/cvodes.c similarity index 100% rename from sundials/src/cvodes/cvodes.c rename to ThirdParty/sundials/src/cvodes/cvodes.c diff --git a/sundials/src/cvodes/cvodes_band.c b/ThirdParty/sundials/src/cvodes/cvodes_band.c similarity index 100% rename from sundials/src/cvodes/cvodes_band.c rename to ThirdParty/sundials/src/cvodes/cvodes_band.c diff --git a/sundials/src/cvodes/cvodes_bandpre.c b/ThirdParty/sundials/src/cvodes/cvodes_bandpre.c similarity index 100% rename from sundials/src/cvodes/cvodes_bandpre.c rename to ThirdParty/sundials/src/cvodes/cvodes_bandpre.c diff --git a/sundials/src/cvodes/cvodes_bandpre_impl.h b/ThirdParty/sundials/src/cvodes/cvodes_bandpre_impl.h similarity index 100% rename from sundials/src/cvodes/cvodes_bandpre_impl.h rename to ThirdParty/sundials/src/cvodes/cvodes_bandpre_impl.h diff --git a/sundials/src/cvodes/cvodes_bbdpre.c b/ThirdParty/sundials/src/cvodes/cvodes_bbdpre.c similarity index 100% rename from sundials/src/cvodes/cvodes_bbdpre.c rename to ThirdParty/sundials/src/cvodes/cvodes_bbdpre.c diff --git a/sundials/src/cvodes/cvodes_bbdpre_impl.h b/ThirdParty/sundials/src/cvodes/cvodes_bbdpre_impl.h similarity index 100% rename from sundials/src/cvodes/cvodes_bbdpre_impl.h rename to ThirdParty/sundials/src/cvodes/cvodes_bbdpre_impl.h diff --git a/sundials/src/cvodes/cvodes_dense.c b/ThirdParty/sundials/src/cvodes/cvodes_dense.c similarity index 100% rename from sundials/src/cvodes/cvodes_dense.c rename to ThirdParty/sundials/src/cvodes/cvodes_dense.c diff --git a/sundials/src/cvodes/cvodes_diag.c b/ThirdParty/sundials/src/cvodes/cvodes_diag.c similarity index 100% rename from sundials/src/cvodes/cvodes_diag.c rename to ThirdParty/sundials/src/cvodes/cvodes_diag.c diff --git a/sundials/src/cvodes/cvodes_diag_impl.h b/ThirdParty/sundials/src/cvodes/cvodes_diag_impl.h similarity index 100% rename from sundials/src/cvodes/cvodes_diag_impl.h rename to ThirdParty/sundials/src/cvodes/cvodes_diag_impl.h diff --git a/sundials/src/cvodes/cvodes_direct.c b/ThirdParty/sundials/src/cvodes/cvodes_direct.c similarity index 100% rename from sundials/src/cvodes/cvodes_direct.c rename to ThirdParty/sundials/src/cvodes/cvodes_direct.c diff --git a/sundials/src/cvodes/cvodes_direct_impl.h b/ThirdParty/sundials/src/cvodes/cvodes_direct_impl.h similarity index 100% rename from sundials/src/cvodes/cvodes_direct_impl.h rename to ThirdParty/sundials/src/cvodes/cvodes_direct_impl.h diff --git a/sundials/src/cvodes/cvodes_impl.h b/ThirdParty/sundials/src/cvodes/cvodes_impl.h similarity index 100% rename from sundials/src/cvodes/cvodes_impl.h rename to ThirdParty/sundials/src/cvodes/cvodes_impl.h diff --git a/sundials/src/cvodes/cvodes_io.c b/ThirdParty/sundials/src/cvodes/cvodes_io.c similarity index 100% rename from sundials/src/cvodes/cvodes_io.c rename to ThirdParty/sundials/src/cvodes/cvodes_io.c diff --git a/sundials/src/cvodes/cvodes_klu.c b/ThirdParty/sundials/src/cvodes/cvodes_klu.c similarity index 100% rename from sundials/src/cvodes/cvodes_klu.c rename to ThirdParty/sundials/src/cvodes/cvodes_klu.c diff --git a/sundials/src/cvodes/cvodes_lapack.c b/ThirdParty/sundials/src/cvodes/cvodes_lapack.c similarity index 100% rename from sundials/src/cvodes/cvodes_lapack.c rename to ThirdParty/sundials/src/cvodes/cvodes_lapack.c diff --git a/sundials/src/cvodes/cvodes_sparse.c b/ThirdParty/sundials/src/cvodes/cvodes_sparse.c similarity index 100% rename from sundials/src/cvodes/cvodes_sparse.c rename to ThirdParty/sundials/src/cvodes/cvodes_sparse.c diff --git a/sundials/src/cvodes/cvodes_sparse_impl.h b/ThirdParty/sundials/src/cvodes/cvodes_sparse_impl.h similarity index 100% rename from sundials/src/cvodes/cvodes_sparse_impl.h rename to ThirdParty/sundials/src/cvodes/cvodes_sparse_impl.h diff --git a/sundials/src/cvodes/cvodes_spbcgs.c b/ThirdParty/sundials/src/cvodes/cvodes_spbcgs.c similarity index 100% rename from sundials/src/cvodes/cvodes_spbcgs.c rename to ThirdParty/sundials/src/cvodes/cvodes_spbcgs.c diff --git a/sundials/src/cvodes/cvodes_spgmr.c b/ThirdParty/sundials/src/cvodes/cvodes_spgmr.c similarity index 100% rename from sundials/src/cvodes/cvodes_spgmr.c rename to ThirdParty/sundials/src/cvodes/cvodes_spgmr.c diff --git a/sundials/src/cvodes/cvodes_spils.c b/ThirdParty/sundials/src/cvodes/cvodes_spils.c similarity index 100% rename from sundials/src/cvodes/cvodes_spils.c rename to ThirdParty/sundials/src/cvodes/cvodes_spils.c diff --git a/sundials/src/cvodes/cvodes_spils_impl.h b/ThirdParty/sundials/src/cvodes/cvodes_spils_impl.h similarity index 100% rename from sundials/src/cvodes/cvodes_spils_impl.h rename to ThirdParty/sundials/src/cvodes/cvodes_spils_impl.h diff --git a/sundials/src/cvodes/cvodes_sptfqmr.c b/ThirdParty/sundials/src/cvodes/cvodes_sptfqmr.c similarity index 100% rename from sundials/src/cvodes/cvodes_sptfqmr.c rename to ThirdParty/sundials/src/cvodes/cvodes_sptfqmr.c diff --git a/sundials/src/cvodes/cvodes_superlumt.c b/ThirdParty/sundials/src/cvodes/cvodes_superlumt.c similarity index 100% rename from sundials/src/cvodes/cvodes_superlumt.c rename to ThirdParty/sundials/src/cvodes/cvodes_superlumt.c diff --git a/sundials/src/ida/CMakeLists.txt b/ThirdParty/sundials/src/ida/CMakeLists.txt similarity index 100% rename from sundials/src/ida/CMakeLists.txt rename to ThirdParty/sundials/src/ida/CMakeLists.txt diff --git a/sundials/src/ida/LICENSE b/ThirdParty/sundials/src/ida/LICENSE similarity index 100% rename from sundials/src/ida/LICENSE rename to ThirdParty/sundials/src/ida/LICENSE diff --git a/sundials/src/ida/README b/ThirdParty/sundials/src/ida/README similarity index 100% rename from sundials/src/ida/README rename to ThirdParty/sundials/src/ida/README diff --git a/sundials/src/ida/fcmix/CMakeLists.txt b/ThirdParty/sundials/src/ida/fcmix/CMakeLists.txt similarity index 100% rename from sundials/src/ida/fcmix/CMakeLists.txt rename to ThirdParty/sundials/src/ida/fcmix/CMakeLists.txt diff --git a/sundials/src/ida/fcmix/fida.c b/ThirdParty/sundials/src/ida/fcmix/fida.c similarity index 100% rename from sundials/src/ida/fcmix/fida.c rename to ThirdParty/sundials/src/ida/fcmix/fida.c diff --git a/sundials/src/ida/fcmix/fida.h b/ThirdParty/sundials/src/ida/fcmix/fida.h similarity index 100% rename from sundials/src/ida/fcmix/fida.h rename to ThirdParty/sundials/src/ida/fcmix/fida.h diff --git a/sundials/src/ida/fcmix/fidaband.c b/ThirdParty/sundials/src/ida/fcmix/fidaband.c similarity index 100% rename from sundials/src/ida/fcmix/fidaband.c rename to ThirdParty/sundials/src/ida/fcmix/fidaband.c diff --git a/sundials/src/ida/fcmix/fidabbd.c b/ThirdParty/sundials/src/ida/fcmix/fidabbd.c similarity index 100% rename from sundials/src/ida/fcmix/fidabbd.c rename to ThirdParty/sundials/src/ida/fcmix/fidabbd.c diff --git a/sundials/src/ida/fcmix/fidabbd.h b/ThirdParty/sundials/src/ida/fcmix/fidabbd.h similarity index 100% rename from sundials/src/ida/fcmix/fidabbd.h rename to ThirdParty/sundials/src/ida/fcmix/fidabbd.h diff --git a/sundials/src/ida/fcmix/fidadense.c b/ThirdParty/sundials/src/ida/fcmix/fidadense.c similarity index 100% rename from sundials/src/ida/fcmix/fidadense.c rename to ThirdParty/sundials/src/ida/fcmix/fidadense.c diff --git a/sundials/src/ida/fcmix/fidaewt.c b/ThirdParty/sundials/src/ida/fcmix/fidaewt.c similarity index 100% rename from sundials/src/ida/fcmix/fidaewt.c rename to ThirdParty/sundials/src/ida/fcmix/fidaewt.c diff --git a/sundials/src/ida/fcmix/fidajtimes.c b/ThirdParty/sundials/src/ida/fcmix/fidajtimes.c similarity index 100% rename from sundials/src/ida/fcmix/fidajtimes.c rename to ThirdParty/sundials/src/ida/fcmix/fidajtimes.c diff --git a/sundials/src/ida/fcmix/fidaklu.c b/ThirdParty/sundials/src/ida/fcmix/fidaklu.c similarity index 100% rename from sundials/src/ida/fcmix/fidaklu.c rename to ThirdParty/sundials/src/ida/fcmix/fidaklu.c diff --git a/sundials/src/ida/fcmix/fidalapack.c b/ThirdParty/sundials/src/ida/fcmix/fidalapack.c similarity index 100% rename from sundials/src/ida/fcmix/fidalapack.c rename to ThirdParty/sundials/src/ida/fcmix/fidalapack.c diff --git a/sundials/src/ida/fcmix/fidalapband.c b/ThirdParty/sundials/src/ida/fcmix/fidalapband.c similarity index 100% rename from sundials/src/ida/fcmix/fidalapband.c rename to ThirdParty/sundials/src/ida/fcmix/fidalapband.c diff --git a/sundials/src/ida/fcmix/fidalapdense.c b/ThirdParty/sundials/src/ida/fcmix/fidalapdense.c similarity index 100% rename from sundials/src/ida/fcmix/fidalapdense.c rename to ThirdParty/sundials/src/ida/fcmix/fidalapdense.c diff --git a/sundials/src/ida/fcmix/fidapreco.c b/ThirdParty/sundials/src/ida/fcmix/fidapreco.c similarity index 100% rename from sundials/src/ida/fcmix/fidapreco.c rename to ThirdParty/sundials/src/ida/fcmix/fidapreco.c diff --git a/sundials/src/ida/fcmix/fidaroot.c b/ThirdParty/sundials/src/ida/fcmix/fidaroot.c similarity index 100% rename from sundials/src/ida/fcmix/fidaroot.c rename to ThirdParty/sundials/src/ida/fcmix/fidaroot.c diff --git a/sundials/src/ida/fcmix/fidaroot.h b/ThirdParty/sundials/src/ida/fcmix/fidaroot.h similarity index 100% rename from sundials/src/ida/fcmix/fidaroot.h rename to ThirdParty/sundials/src/ida/fcmix/fidaroot.h diff --git a/sundials/src/ida/fcmix/fidasparse.c b/ThirdParty/sundials/src/ida/fcmix/fidasparse.c similarity index 100% rename from sundials/src/ida/fcmix/fidasparse.c rename to ThirdParty/sundials/src/ida/fcmix/fidasparse.c diff --git a/sundials/src/ida/fcmix/fidasuperlumt.c b/ThirdParty/sundials/src/ida/fcmix/fidasuperlumt.c similarity index 100% rename from sundials/src/ida/fcmix/fidasuperlumt.c rename to ThirdParty/sundials/src/ida/fcmix/fidasuperlumt.c diff --git a/sundials/src/ida/ida.c b/ThirdParty/sundials/src/ida/ida.c similarity index 100% rename from sundials/src/ida/ida.c rename to ThirdParty/sundials/src/ida/ida.c diff --git a/sundials/src/ida/ida_band.c b/ThirdParty/sundials/src/ida/ida_band.c similarity index 100% rename from sundials/src/ida/ida_band.c rename to ThirdParty/sundials/src/ida/ida_band.c diff --git a/sundials/src/ida/ida_bbdpre.c b/ThirdParty/sundials/src/ida/ida_bbdpre.c similarity index 100% rename from sundials/src/ida/ida_bbdpre.c rename to ThirdParty/sundials/src/ida/ida_bbdpre.c diff --git a/sundials/src/ida/ida_bbdpre_impl.h b/ThirdParty/sundials/src/ida/ida_bbdpre_impl.h similarity index 100% rename from sundials/src/ida/ida_bbdpre_impl.h rename to ThirdParty/sundials/src/ida/ida_bbdpre_impl.h diff --git a/sundials/src/ida/ida_dense.c b/ThirdParty/sundials/src/ida/ida_dense.c similarity index 100% rename from sundials/src/ida/ida_dense.c rename to ThirdParty/sundials/src/ida/ida_dense.c diff --git a/sundials/src/ida/ida_direct.c b/ThirdParty/sundials/src/ida/ida_direct.c similarity index 100% rename from sundials/src/ida/ida_direct.c rename to ThirdParty/sundials/src/ida/ida_direct.c diff --git a/sundials/src/ida/ida_direct_impl.h b/ThirdParty/sundials/src/ida/ida_direct_impl.h similarity index 100% rename from sundials/src/ida/ida_direct_impl.h rename to ThirdParty/sundials/src/ida/ida_direct_impl.h diff --git a/sundials/src/ida/ida_ic.c b/ThirdParty/sundials/src/ida/ida_ic.c similarity index 100% rename from sundials/src/ida/ida_ic.c rename to ThirdParty/sundials/src/ida/ida_ic.c diff --git a/sundials/src/ida/ida_impl.h b/ThirdParty/sundials/src/ida/ida_impl.h similarity index 100% rename from sundials/src/ida/ida_impl.h rename to ThirdParty/sundials/src/ida/ida_impl.h diff --git a/sundials/src/ida/ida_io.c b/ThirdParty/sundials/src/ida/ida_io.c similarity index 100% rename from sundials/src/ida/ida_io.c rename to ThirdParty/sundials/src/ida/ida_io.c diff --git a/sundials/src/ida/ida_klu.c b/ThirdParty/sundials/src/ida/ida_klu.c similarity index 100% rename from sundials/src/ida/ida_klu.c rename to ThirdParty/sundials/src/ida/ida_klu.c diff --git a/sundials/src/ida/ida_lapack.c b/ThirdParty/sundials/src/ida/ida_lapack.c similarity index 100% rename from sundials/src/ida/ida_lapack.c rename to ThirdParty/sundials/src/ida/ida_lapack.c diff --git a/sundials/src/ida/ida_sparse.c b/ThirdParty/sundials/src/ida/ida_sparse.c similarity index 100% rename from sundials/src/ida/ida_sparse.c rename to ThirdParty/sundials/src/ida/ida_sparse.c diff --git a/sundials/src/ida/ida_sparse_impl.h b/ThirdParty/sundials/src/ida/ida_sparse_impl.h similarity index 100% rename from sundials/src/ida/ida_sparse_impl.h rename to ThirdParty/sundials/src/ida/ida_sparse_impl.h diff --git a/sundials/src/ida/ida_spbcgs.c b/ThirdParty/sundials/src/ida/ida_spbcgs.c similarity index 100% rename from sundials/src/ida/ida_spbcgs.c rename to ThirdParty/sundials/src/ida/ida_spbcgs.c diff --git a/sundials/src/ida/ida_spgmr.c b/ThirdParty/sundials/src/ida/ida_spgmr.c similarity index 100% rename from sundials/src/ida/ida_spgmr.c rename to ThirdParty/sundials/src/ida/ida_spgmr.c diff --git a/sundials/src/ida/ida_spils.c b/ThirdParty/sundials/src/ida/ida_spils.c similarity index 100% rename from sundials/src/ida/ida_spils.c rename to ThirdParty/sundials/src/ida/ida_spils.c diff --git a/sundials/src/ida/ida_spils_impl.h b/ThirdParty/sundials/src/ida/ida_spils_impl.h similarity index 100% rename from sundials/src/ida/ida_spils_impl.h rename to ThirdParty/sundials/src/ida/ida_spils_impl.h diff --git a/sundials/src/ida/ida_sptfqmr.c b/ThirdParty/sundials/src/ida/ida_sptfqmr.c similarity index 100% rename from sundials/src/ida/ida_sptfqmr.c rename to ThirdParty/sundials/src/ida/ida_sptfqmr.c diff --git a/sundials/src/ida/ida_superlumt.c b/ThirdParty/sundials/src/ida/ida_superlumt.c similarity index 100% rename from sundials/src/ida/ida_superlumt.c rename to ThirdParty/sundials/src/ida/ida_superlumt.c diff --git a/sundials/src/idas/CMakeLists.txt b/ThirdParty/sundials/src/idas/CMakeLists.txt similarity index 100% rename from sundials/src/idas/CMakeLists.txt rename to ThirdParty/sundials/src/idas/CMakeLists.txt diff --git a/sundials/src/idas/LICENSE b/ThirdParty/sundials/src/idas/LICENSE similarity index 100% rename from sundials/src/idas/LICENSE rename to ThirdParty/sundials/src/idas/LICENSE diff --git a/sundials/src/idas/README b/ThirdParty/sundials/src/idas/README similarity index 100% rename from sundials/src/idas/README rename to ThirdParty/sundials/src/idas/README diff --git a/sundials/src/idas/idaa.c b/ThirdParty/sundials/src/idas/idaa.c similarity index 100% rename from sundials/src/idas/idaa.c rename to ThirdParty/sundials/src/idas/idaa.c diff --git a/sundials/src/idas/idaa_io.c b/ThirdParty/sundials/src/idas/idaa_io.c similarity index 100% rename from sundials/src/idas/idaa_io.c rename to ThirdParty/sundials/src/idas/idaa_io.c diff --git a/sundials/src/idas/idas.c b/ThirdParty/sundials/src/idas/idas.c similarity index 100% rename from sundials/src/idas/idas.c rename to ThirdParty/sundials/src/idas/idas.c diff --git a/sundials/src/idas/idas_band.c b/ThirdParty/sundials/src/idas/idas_band.c similarity index 100% rename from sundials/src/idas/idas_band.c rename to ThirdParty/sundials/src/idas/idas_band.c diff --git a/sundials/src/idas/idas_bbdpre.c b/ThirdParty/sundials/src/idas/idas_bbdpre.c similarity index 100% rename from sundials/src/idas/idas_bbdpre.c rename to ThirdParty/sundials/src/idas/idas_bbdpre.c diff --git a/sundials/src/idas/idas_bbdpre_impl.h b/ThirdParty/sundials/src/idas/idas_bbdpre_impl.h similarity index 100% rename from sundials/src/idas/idas_bbdpre_impl.h rename to ThirdParty/sundials/src/idas/idas_bbdpre_impl.h diff --git a/sundials/src/idas/idas_dense.c b/ThirdParty/sundials/src/idas/idas_dense.c similarity index 100% rename from sundials/src/idas/idas_dense.c rename to ThirdParty/sundials/src/idas/idas_dense.c diff --git a/sundials/src/idas/idas_direct.c b/ThirdParty/sundials/src/idas/idas_direct.c similarity index 100% rename from sundials/src/idas/idas_direct.c rename to ThirdParty/sundials/src/idas/idas_direct.c diff --git a/sundials/src/idas/idas_direct_impl.h b/ThirdParty/sundials/src/idas/idas_direct_impl.h similarity index 100% rename from sundials/src/idas/idas_direct_impl.h rename to ThirdParty/sundials/src/idas/idas_direct_impl.h diff --git a/sundials/src/idas/idas_ic.c b/ThirdParty/sundials/src/idas/idas_ic.c similarity index 100% rename from sundials/src/idas/idas_ic.c rename to ThirdParty/sundials/src/idas/idas_ic.c diff --git a/sundials/src/idas/idas_impl.h b/ThirdParty/sundials/src/idas/idas_impl.h similarity index 100% rename from sundials/src/idas/idas_impl.h rename to ThirdParty/sundials/src/idas/idas_impl.h diff --git a/sundials/src/idas/idas_io.c b/ThirdParty/sundials/src/idas/idas_io.c similarity index 100% rename from sundials/src/idas/idas_io.c rename to ThirdParty/sundials/src/idas/idas_io.c diff --git a/sundials/src/idas/idas_klu.c b/ThirdParty/sundials/src/idas/idas_klu.c similarity index 100% rename from sundials/src/idas/idas_klu.c rename to ThirdParty/sundials/src/idas/idas_klu.c diff --git a/sundials/src/idas/idas_lapack.c b/ThirdParty/sundials/src/idas/idas_lapack.c similarity index 100% rename from sundials/src/idas/idas_lapack.c rename to ThirdParty/sundials/src/idas/idas_lapack.c diff --git a/sundials/src/idas/idas_sparse.c b/ThirdParty/sundials/src/idas/idas_sparse.c similarity index 100% rename from sundials/src/idas/idas_sparse.c rename to ThirdParty/sundials/src/idas/idas_sparse.c diff --git a/sundials/src/idas/idas_sparse_impl.h b/ThirdParty/sundials/src/idas/idas_sparse_impl.h similarity index 100% rename from sundials/src/idas/idas_sparse_impl.h rename to ThirdParty/sundials/src/idas/idas_sparse_impl.h diff --git a/sundials/src/idas/idas_spbcgs.c b/ThirdParty/sundials/src/idas/idas_spbcgs.c similarity index 100% rename from sundials/src/idas/idas_spbcgs.c rename to ThirdParty/sundials/src/idas/idas_spbcgs.c diff --git a/sundials/src/idas/idas_spgmr.c b/ThirdParty/sundials/src/idas/idas_spgmr.c similarity index 100% rename from sundials/src/idas/idas_spgmr.c rename to ThirdParty/sundials/src/idas/idas_spgmr.c diff --git a/sundials/src/idas/idas_spils.c b/ThirdParty/sundials/src/idas/idas_spils.c similarity index 100% rename from sundials/src/idas/idas_spils.c rename to ThirdParty/sundials/src/idas/idas_spils.c diff --git a/sundials/src/idas/idas_spils_impl.h b/ThirdParty/sundials/src/idas/idas_spils_impl.h similarity index 100% rename from sundials/src/idas/idas_spils_impl.h rename to ThirdParty/sundials/src/idas/idas_spils_impl.h diff --git a/sundials/src/idas/idas_sptfqmr.c b/ThirdParty/sundials/src/idas/idas_sptfqmr.c similarity index 100% rename from sundials/src/idas/idas_sptfqmr.c rename to ThirdParty/sundials/src/idas/idas_sptfqmr.c diff --git a/sundials/src/idas/idas_superlumt.c b/ThirdParty/sundials/src/idas/idas_superlumt.c similarity index 100% rename from sundials/src/idas/idas_superlumt.c rename to ThirdParty/sundials/src/idas/idas_superlumt.c diff --git a/sundials/src/kinsol/CMakeLists.txt b/ThirdParty/sundials/src/kinsol/CMakeLists.txt similarity index 100% rename from sundials/src/kinsol/CMakeLists.txt rename to ThirdParty/sundials/src/kinsol/CMakeLists.txt diff --git a/sundials/src/kinsol/LICENSE b/ThirdParty/sundials/src/kinsol/LICENSE similarity index 100% rename from sundials/src/kinsol/LICENSE rename to ThirdParty/sundials/src/kinsol/LICENSE diff --git a/sundials/src/kinsol/README b/ThirdParty/sundials/src/kinsol/README similarity index 100% rename from sundials/src/kinsol/README rename to ThirdParty/sundials/src/kinsol/README diff --git a/sundials/src/kinsol/fcmix/CMakeLists.txt b/ThirdParty/sundials/src/kinsol/fcmix/CMakeLists.txt similarity index 100% rename from sundials/src/kinsol/fcmix/CMakeLists.txt rename to ThirdParty/sundials/src/kinsol/fcmix/CMakeLists.txt diff --git a/sundials/src/kinsol/fcmix/fkinband.c b/ThirdParty/sundials/src/kinsol/fcmix/fkinband.c similarity index 100% rename from sundials/src/kinsol/fcmix/fkinband.c rename to ThirdParty/sundials/src/kinsol/fcmix/fkinband.c diff --git a/sundials/src/kinsol/fcmix/fkinbbd.c b/ThirdParty/sundials/src/kinsol/fcmix/fkinbbd.c similarity index 100% rename from sundials/src/kinsol/fcmix/fkinbbd.c rename to ThirdParty/sundials/src/kinsol/fcmix/fkinbbd.c diff --git a/sundials/src/kinsol/fcmix/fkinbbd.h b/ThirdParty/sundials/src/kinsol/fcmix/fkinbbd.h similarity index 100% rename from sundials/src/kinsol/fcmix/fkinbbd.h rename to ThirdParty/sundials/src/kinsol/fcmix/fkinbbd.h diff --git a/sundials/src/kinsol/fcmix/fkindense.c b/ThirdParty/sundials/src/kinsol/fcmix/fkindense.c similarity index 100% rename from sundials/src/kinsol/fcmix/fkindense.c rename to ThirdParty/sundials/src/kinsol/fcmix/fkindense.c diff --git a/sundials/src/kinsol/fcmix/fkinjtimes.c b/ThirdParty/sundials/src/kinsol/fcmix/fkinjtimes.c similarity index 100% rename from sundials/src/kinsol/fcmix/fkinjtimes.c rename to ThirdParty/sundials/src/kinsol/fcmix/fkinjtimes.c diff --git a/sundials/src/kinsol/fcmix/fkinklu.c b/ThirdParty/sundials/src/kinsol/fcmix/fkinklu.c similarity index 100% rename from sundials/src/kinsol/fcmix/fkinklu.c rename to ThirdParty/sundials/src/kinsol/fcmix/fkinklu.c diff --git a/sundials/src/kinsol/fcmix/fkinlapack.c b/ThirdParty/sundials/src/kinsol/fcmix/fkinlapack.c similarity index 100% rename from sundials/src/kinsol/fcmix/fkinlapack.c rename to ThirdParty/sundials/src/kinsol/fcmix/fkinlapack.c diff --git a/sundials/src/kinsol/fcmix/fkinlapband.c b/ThirdParty/sundials/src/kinsol/fcmix/fkinlapband.c similarity index 100% rename from sundials/src/kinsol/fcmix/fkinlapband.c rename to ThirdParty/sundials/src/kinsol/fcmix/fkinlapband.c diff --git a/sundials/src/kinsol/fcmix/fkinlapdense.c b/ThirdParty/sundials/src/kinsol/fcmix/fkinlapdense.c similarity index 100% rename from sundials/src/kinsol/fcmix/fkinlapdense.c rename to ThirdParty/sundials/src/kinsol/fcmix/fkinlapdense.c diff --git a/sundials/src/kinsol/fcmix/fkinpreco.c b/ThirdParty/sundials/src/kinsol/fcmix/fkinpreco.c similarity index 100% rename from sundials/src/kinsol/fcmix/fkinpreco.c rename to ThirdParty/sundials/src/kinsol/fcmix/fkinpreco.c diff --git a/sundials/src/kinsol/fcmix/fkinsol.c b/ThirdParty/sundials/src/kinsol/fcmix/fkinsol.c similarity index 100% rename from sundials/src/kinsol/fcmix/fkinsol.c rename to ThirdParty/sundials/src/kinsol/fcmix/fkinsol.c diff --git a/sundials/src/kinsol/fcmix/fkinsol.h b/ThirdParty/sundials/src/kinsol/fcmix/fkinsol.h similarity index 100% rename from sundials/src/kinsol/fcmix/fkinsol.h rename to ThirdParty/sundials/src/kinsol/fcmix/fkinsol.h diff --git a/sundials/src/kinsol/fcmix/fkinsparse.c b/ThirdParty/sundials/src/kinsol/fcmix/fkinsparse.c similarity index 100% rename from sundials/src/kinsol/fcmix/fkinsparse.c rename to ThirdParty/sundials/src/kinsol/fcmix/fkinsparse.c diff --git a/sundials/src/kinsol/fcmix/fkinsuperlumt.c b/ThirdParty/sundials/src/kinsol/fcmix/fkinsuperlumt.c similarity index 100% rename from sundials/src/kinsol/fcmix/fkinsuperlumt.c rename to ThirdParty/sundials/src/kinsol/fcmix/fkinsuperlumt.c diff --git a/sundials/src/kinsol/kinsol.c b/ThirdParty/sundials/src/kinsol/kinsol.c similarity index 100% rename from sundials/src/kinsol/kinsol.c rename to ThirdParty/sundials/src/kinsol/kinsol.c diff --git a/sundials/src/kinsol/kinsol_band.c b/ThirdParty/sundials/src/kinsol/kinsol_band.c similarity index 100% rename from sundials/src/kinsol/kinsol_band.c rename to ThirdParty/sundials/src/kinsol/kinsol_band.c diff --git a/sundials/src/kinsol/kinsol_bbdpre.c b/ThirdParty/sundials/src/kinsol/kinsol_bbdpre.c similarity index 100% rename from sundials/src/kinsol/kinsol_bbdpre.c rename to ThirdParty/sundials/src/kinsol/kinsol_bbdpre.c diff --git a/sundials/src/kinsol/kinsol_bbdpre_impl.h b/ThirdParty/sundials/src/kinsol/kinsol_bbdpre_impl.h similarity index 100% rename from sundials/src/kinsol/kinsol_bbdpre_impl.h rename to ThirdParty/sundials/src/kinsol/kinsol_bbdpre_impl.h diff --git a/sundials/src/kinsol/kinsol_dense.c b/ThirdParty/sundials/src/kinsol/kinsol_dense.c similarity index 100% rename from sundials/src/kinsol/kinsol_dense.c rename to ThirdParty/sundials/src/kinsol/kinsol_dense.c diff --git a/sundials/src/kinsol/kinsol_direct.c b/ThirdParty/sundials/src/kinsol/kinsol_direct.c similarity index 100% rename from sundials/src/kinsol/kinsol_direct.c rename to ThirdParty/sundials/src/kinsol/kinsol_direct.c diff --git a/sundials/src/kinsol/kinsol_direct_impl.h b/ThirdParty/sundials/src/kinsol/kinsol_direct_impl.h similarity index 100% rename from sundials/src/kinsol/kinsol_direct_impl.h rename to ThirdParty/sundials/src/kinsol/kinsol_direct_impl.h diff --git a/sundials/src/kinsol/kinsol_impl.h b/ThirdParty/sundials/src/kinsol/kinsol_impl.h similarity index 100% rename from sundials/src/kinsol/kinsol_impl.h rename to ThirdParty/sundials/src/kinsol/kinsol_impl.h diff --git a/sundials/src/kinsol/kinsol_io.c b/ThirdParty/sundials/src/kinsol/kinsol_io.c similarity index 100% rename from sundials/src/kinsol/kinsol_io.c rename to ThirdParty/sundials/src/kinsol/kinsol_io.c diff --git a/sundials/src/kinsol/kinsol_klu.c b/ThirdParty/sundials/src/kinsol/kinsol_klu.c similarity index 100% rename from sundials/src/kinsol/kinsol_klu.c rename to ThirdParty/sundials/src/kinsol/kinsol_klu.c diff --git a/sundials/src/kinsol/kinsol_lapack.c b/ThirdParty/sundials/src/kinsol/kinsol_lapack.c similarity index 100% rename from sundials/src/kinsol/kinsol_lapack.c rename to ThirdParty/sundials/src/kinsol/kinsol_lapack.c diff --git a/sundials/src/kinsol/kinsol_sparse.c b/ThirdParty/sundials/src/kinsol/kinsol_sparse.c similarity index 100% rename from sundials/src/kinsol/kinsol_sparse.c rename to ThirdParty/sundials/src/kinsol/kinsol_sparse.c diff --git a/sundials/src/kinsol/kinsol_sparse_impl.h b/ThirdParty/sundials/src/kinsol/kinsol_sparse_impl.h similarity index 100% rename from sundials/src/kinsol/kinsol_sparse_impl.h rename to ThirdParty/sundials/src/kinsol/kinsol_sparse_impl.h diff --git a/sundials/src/kinsol/kinsol_spbcgs.c b/ThirdParty/sundials/src/kinsol/kinsol_spbcgs.c similarity index 100% rename from sundials/src/kinsol/kinsol_spbcgs.c rename to ThirdParty/sundials/src/kinsol/kinsol_spbcgs.c diff --git a/sundials/src/kinsol/kinsol_spfgmr.c b/ThirdParty/sundials/src/kinsol/kinsol_spfgmr.c similarity index 100% rename from sundials/src/kinsol/kinsol_spfgmr.c rename to ThirdParty/sundials/src/kinsol/kinsol_spfgmr.c diff --git a/sundials/src/kinsol/kinsol_spgmr.c b/ThirdParty/sundials/src/kinsol/kinsol_spgmr.c similarity index 100% rename from sundials/src/kinsol/kinsol_spgmr.c rename to ThirdParty/sundials/src/kinsol/kinsol_spgmr.c diff --git a/sundials/src/kinsol/kinsol_spils.c b/ThirdParty/sundials/src/kinsol/kinsol_spils.c similarity index 100% rename from sundials/src/kinsol/kinsol_spils.c rename to ThirdParty/sundials/src/kinsol/kinsol_spils.c diff --git a/sundials/src/kinsol/kinsol_spils_impl.h b/ThirdParty/sundials/src/kinsol/kinsol_spils_impl.h similarity index 100% rename from sundials/src/kinsol/kinsol_spils_impl.h rename to ThirdParty/sundials/src/kinsol/kinsol_spils_impl.h diff --git a/sundials/src/kinsol/kinsol_sptfqmr.c b/ThirdParty/sundials/src/kinsol/kinsol_sptfqmr.c similarity index 100% rename from sundials/src/kinsol/kinsol_sptfqmr.c rename to ThirdParty/sundials/src/kinsol/kinsol_sptfqmr.c diff --git a/sundials/src/kinsol/kinsol_superlumt.c b/ThirdParty/sundials/src/kinsol/kinsol_superlumt.c similarity index 100% rename from sundials/src/kinsol/kinsol_superlumt.c rename to ThirdParty/sundials/src/kinsol/kinsol_superlumt.c diff --git a/sundials/src/nvec_openmp/CMakeLists.txt b/ThirdParty/sundials/src/nvec_openmp/CMakeLists.txt similarity index 100% rename from sundials/src/nvec_openmp/CMakeLists.txt rename to ThirdParty/sundials/src/nvec_openmp/CMakeLists.txt diff --git a/sundials/src/nvec_openmp/README b/ThirdParty/sundials/src/nvec_openmp/README similarity index 100% rename from sundials/src/nvec_openmp/README rename to ThirdParty/sundials/src/nvec_openmp/README diff --git a/sundials/src/nvec_openmp/fnvector_openmp.c b/ThirdParty/sundials/src/nvec_openmp/fnvector_openmp.c similarity index 100% rename from sundials/src/nvec_openmp/fnvector_openmp.c rename to ThirdParty/sundials/src/nvec_openmp/fnvector_openmp.c diff --git a/sundials/src/nvec_openmp/fnvector_openmp.h b/ThirdParty/sundials/src/nvec_openmp/fnvector_openmp.h similarity index 100% rename from sundials/src/nvec_openmp/fnvector_openmp.h rename to ThirdParty/sundials/src/nvec_openmp/fnvector_openmp.h diff --git a/sundials/src/nvec_openmp/nvector_openmp.c b/ThirdParty/sundials/src/nvec_openmp/nvector_openmp.c similarity index 100% rename from sundials/src/nvec_openmp/nvector_openmp.c rename to ThirdParty/sundials/src/nvec_openmp/nvector_openmp.c diff --git a/sundials/src/nvec_par/CMakeLists.txt b/ThirdParty/sundials/src/nvec_par/CMakeLists.txt similarity index 100% rename from sundials/src/nvec_par/CMakeLists.txt rename to ThirdParty/sundials/src/nvec_par/CMakeLists.txt diff --git a/sundials/src/nvec_par/README b/ThirdParty/sundials/src/nvec_par/README similarity index 100% rename from sundials/src/nvec_par/README rename to ThirdParty/sundials/src/nvec_par/README diff --git a/sundials/src/nvec_par/fnvector_parallel.c b/ThirdParty/sundials/src/nvec_par/fnvector_parallel.c similarity index 100% rename from sundials/src/nvec_par/fnvector_parallel.c rename to ThirdParty/sundials/src/nvec_par/fnvector_parallel.c diff --git a/sundials/src/nvec_par/fnvector_parallel.h b/ThirdParty/sundials/src/nvec_par/fnvector_parallel.h similarity index 100% rename from sundials/src/nvec_par/fnvector_parallel.h rename to ThirdParty/sundials/src/nvec_par/fnvector_parallel.h diff --git a/sundials/src/nvec_par/nvector_parallel.c b/ThirdParty/sundials/src/nvec_par/nvector_parallel.c similarity index 100% rename from sundials/src/nvec_par/nvector_parallel.c rename to ThirdParty/sundials/src/nvec_par/nvector_parallel.c diff --git a/sundials/src/nvec_parhyp/CMakeLists.txt b/ThirdParty/sundials/src/nvec_parhyp/CMakeLists.txt similarity index 100% rename from sundials/src/nvec_parhyp/CMakeLists.txt rename to ThirdParty/sundials/src/nvec_parhyp/CMakeLists.txt diff --git a/sundials/src/nvec_parhyp/README b/ThirdParty/sundials/src/nvec_parhyp/README similarity index 100% rename from sundials/src/nvec_parhyp/README rename to ThirdParty/sundials/src/nvec_parhyp/README diff --git a/sundials/src/nvec_parhyp/nvector_parhyp.c b/ThirdParty/sundials/src/nvec_parhyp/nvector_parhyp.c similarity index 100% rename from sundials/src/nvec_parhyp/nvector_parhyp.c rename to ThirdParty/sundials/src/nvec_parhyp/nvector_parhyp.c diff --git a/sundials/src/nvec_petsc/CMakeLists.txt b/ThirdParty/sundials/src/nvec_petsc/CMakeLists.txt similarity index 100% rename from sundials/src/nvec_petsc/CMakeLists.txt rename to ThirdParty/sundials/src/nvec_petsc/CMakeLists.txt diff --git a/sundials/src/nvec_petsc/README b/ThirdParty/sundials/src/nvec_petsc/README similarity index 100% rename from sundials/src/nvec_petsc/README rename to ThirdParty/sundials/src/nvec_petsc/README diff --git a/sundials/src/nvec_petsc/nvector_petsc.c b/ThirdParty/sundials/src/nvec_petsc/nvector_petsc.c similarity index 100% rename from sundials/src/nvec_petsc/nvector_petsc.c rename to ThirdParty/sundials/src/nvec_petsc/nvector_petsc.c diff --git a/sundials/src/nvec_pthreads/CMakeLists.txt b/ThirdParty/sundials/src/nvec_pthreads/CMakeLists.txt similarity index 100% rename from sundials/src/nvec_pthreads/CMakeLists.txt rename to ThirdParty/sundials/src/nvec_pthreads/CMakeLists.txt diff --git a/sundials/src/nvec_pthreads/README b/ThirdParty/sundials/src/nvec_pthreads/README similarity index 100% rename from sundials/src/nvec_pthreads/README rename to ThirdParty/sundials/src/nvec_pthreads/README diff --git a/sundials/src/nvec_pthreads/fnvector_pthreads.c b/ThirdParty/sundials/src/nvec_pthreads/fnvector_pthreads.c similarity index 100% rename from sundials/src/nvec_pthreads/fnvector_pthreads.c rename to ThirdParty/sundials/src/nvec_pthreads/fnvector_pthreads.c diff --git a/sundials/src/nvec_pthreads/fnvector_pthreads.h b/ThirdParty/sundials/src/nvec_pthreads/fnvector_pthreads.h similarity index 100% rename from sundials/src/nvec_pthreads/fnvector_pthreads.h rename to ThirdParty/sundials/src/nvec_pthreads/fnvector_pthreads.h diff --git a/sundials/src/nvec_pthreads/nvector_pthreads.c b/ThirdParty/sundials/src/nvec_pthreads/nvector_pthreads.c similarity index 100% rename from sundials/src/nvec_pthreads/nvector_pthreads.c rename to ThirdParty/sundials/src/nvec_pthreads/nvector_pthreads.c diff --git a/sundials/src/nvec_ser/CMakeLists.txt b/ThirdParty/sundials/src/nvec_ser/CMakeLists.txt similarity index 100% rename from sundials/src/nvec_ser/CMakeLists.txt rename to ThirdParty/sundials/src/nvec_ser/CMakeLists.txt diff --git a/sundials/src/nvec_ser/README b/ThirdParty/sundials/src/nvec_ser/README similarity index 100% rename from sundials/src/nvec_ser/README rename to ThirdParty/sundials/src/nvec_ser/README diff --git a/sundials/src/nvec_ser/fnvector_serial.c b/ThirdParty/sundials/src/nvec_ser/fnvector_serial.c similarity index 100% rename from sundials/src/nvec_ser/fnvector_serial.c rename to ThirdParty/sundials/src/nvec_ser/fnvector_serial.c diff --git a/sundials/src/nvec_ser/fnvector_serial.h b/ThirdParty/sundials/src/nvec_ser/fnvector_serial.h similarity index 100% rename from sundials/src/nvec_ser/fnvector_serial.h rename to ThirdParty/sundials/src/nvec_ser/fnvector_serial.h diff --git a/sundials/src/nvec_ser/nvector_serial.c b/ThirdParty/sundials/src/nvec_ser/nvector_serial.c similarity index 100% rename from sundials/src/nvec_ser/nvector_serial.c rename to ThirdParty/sundials/src/nvec_ser/nvector_serial.c diff --git a/sundials/src/sundials/CMakeLists.txt b/ThirdParty/sundials/src/sundials/CMakeLists.txt similarity index 100% rename from sundials/src/sundials/CMakeLists.txt rename to ThirdParty/sundials/src/sundials/CMakeLists.txt diff --git a/sundials/src/sundials/LICENSE b/ThirdParty/sundials/src/sundials/LICENSE similarity index 100% rename from sundials/src/sundials/LICENSE rename to ThirdParty/sundials/src/sundials/LICENSE diff --git a/sundials/src/sundials/README b/ThirdParty/sundials/src/sundials/README similarity index 100% rename from sundials/src/sundials/README rename to ThirdParty/sundials/src/sundials/README diff --git a/sundials/src/sundials/sundials_band.c b/ThirdParty/sundials/src/sundials/sundials_band.c similarity index 100% rename from sundials/src/sundials/sundials_band.c rename to ThirdParty/sundials/src/sundials/sundials_band.c diff --git a/sundials/src/sundials/sundials_dense.c b/ThirdParty/sundials/src/sundials/sundials_dense.c similarity index 100% rename from sundials/src/sundials/sundials_dense.c rename to ThirdParty/sundials/src/sundials/sundials_dense.c diff --git a/sundials/src/sundials/sundials_direct.c b/ThirdParty/sundials/src/sundials/sundials_direct.c similarity index 100% rename from sundials/src/sundials/sundials_direct.c rename to ThirdParty/sundials/src/sundials/sundials_direct.c diff --git a/sundials/src/sundials/sundials_iterative.c b/ThirdParty/sundials/src/sundials/sundials_iterative.c similarity index 100% rename from sundials/src/sundials/sundials_iterative.c rename to ThirdParty/sundials/src/sundials/sundials_iterative.c diff --git a/sundials/src/sundials/sundials_math.c b/ThirdParty/sundials/src/sundials/sundials_math.c similarity index 100% rename from sundials/src/sundials/sundials_math.c rename to ThirdParty/sundials/src/sundials/sundials_math.c diff --git a/sundials/src/sundials/sundials_nvector.c b/ThirdParty/sundials/src/sundials/sundials_nvector.c similarity index 100% rename from sundials/src/sundials/sundials_nvector.c rename to ThirdParty/sundials/src/sundials/sundials_nvector.c diff --git a/sundials/src/sundials/sundials_pcg.c b/ThirdParty/sundials/src/sundials/sundials_pcg.c similarity index 100% rename from sundials/src/sundials/sundials_pcg.c rename to ThirdParty/sundials/src/sundials/sundials_pcg.c diff --git a/sundials/src/sundials/sundials_sparse.c b/ThirdParty/sundials/src/sundials/sundials_sparse.c similarity index 100% rename from sundials/src/sundials/sundials_sparse.c rename to ThirdParty/sundials/src/sundials/sundials_sparse.c diff --git a/sundials/src/sundials/sundials_spbcgs.c b/ThirdParty/sundials/src/sundials/sundials_spbcgs.c similarity index 100% rename from sundials/src/sundials/sundials_spbcgs.c rename to ThirdParty/sundials/src/sundials/sundials_spbcgs.c diff --git a/sundials/src/sundials/sundials_spfgmr.c b/ThirdParty/sundials/src/sundials/sundials_spfgmr.c similarity index 100% rename from sundials/src/sundials/sundials_spfgmr.c rename to ThirdParty/sundials/src/sundials/sundials_spfgmr.c diff --git a/sundials/src/sundials/sundials_spgmr.c b/ThirdParty/sundials/src/sundials/sundials_spgmr.c similarity index 100% rename from sundials/src/sundials/sundials_spgmr.c rename to ThirdParty/sundials/src/sundials/sundials_spgmr.c diff --git a/sundials/src/sundials/sundials_sptfqmr.c b/ThirdParty/sundials/src/sundials/sundials_sptfqmr.c similarity index 100% rename from sundials/src/sundials/sundials_sptfqmr.c rename to ThirdParty/sundials/src/sundials/sundials_sptfqmr.c diff --git a/cmake/AmiciConfig.cmake b/cmake/AmiciConfig.cmake new file mode 100644 index 0000000000..2fd685ead9 --- /dev/null +++ b/cmake/AmiciConfig.cmake @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_LIST_DIR}/AmiciTargets.cmake") diff --git a/CMakeModules/clang-tools.cmake b/cmake/clang-tools.cmake similarity index 100% rename from CMakeModules/clang-tools.cmake rename to cmake/clang-tools.cmake diff --git a/cmake/configureVersion.cmake b/cmake/configureVersion.cmake new file mode 100644 index 0000000000..ef8e0df555 --- /dev/null +++ b/cmake/configureVersion.cmake @@ -0,0 +1,5 @@ +include(${CMAKE_CURRENT_LIST_DIR}/version.cmake) +set(AMICI_VERSION ${PROJECT_VERSION}) +get_filename_component(directory ${DST} DIRECTORY) +file(MAKE_DIRECTORY ${directory}) +configure_file(${SRC} ${DST} @ONLY) diff --git a/cmake/version.cmake b/cmake/version.cmake new file mode 100644 index 0000000000..0da979f9e7 --- /dev/null +++ b/cmake/version.cmake @@ -0,0 +1,8 @@ +find_package(Git) +if(Git_FOUND) + execute_process(COMMAND sh -c "${GIT_EXECUTABLE} describe --abbrev=4 --dirty=-dirty --always --tags | tr -d '\n'" + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + OUTPUT_VARIABLE PROJECT_VERSION + ) +endif() + diff --git a/include/amici/model.h b/include/amici/model.h index 000e64e0bf..a49d03baf1 100644 --- a/include/amici/model.h +++ b/include/amici/model.h @@ -113,6 +113,7 @@ namespace amici { M(nx*nx, 0.0), stau(plist.size(), 0.0), h(ne,0.0), + unscaledParameters(p), originalParameters(p), fixedParameters(k), plist_(plist), diff --git a/include/amici/model_ode.h b/include/amici/model_ode.h index a3a514a688..105cfd7bc4 100644 --- a/include/amici/model_ode.h +++ b/include/amici/model_ode.h @@ -285,7 +285,7 @@ namespace amici { virtual void fdxdotdp(realtype *dxdotdp, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h, const int ip, const realtype *w, const realtype *dwdp) { throw AmiException("Requested functionality is not supported as %s is not implemented for this model!",__func__); // not implemented - }; + } /** model specific implementation of fsxdot * @param sxdot sensitivity rhs @@ -305,7 +305,7 @@ namespace amici { const int ip, const realtype *sx, const realtype *w, const realtype *dwdx, const realtype *J, const realtype *dxdotdp) { throw AmiException("Requested functionality is not supported as %s is not implemented for this model!",__func__); - }; + } }; } // namespace amici diff --git a/include/amici/version.in.h b/include/amici/version.in.h new file mode 100644 index 0000000000..c31230ddf6 --- /dev/null +++ b/include/amici/version.in.h @@ -0,0 +1,6 @@ +#ifndef AMICI_VERSION_H +#define AMICI_VERSION_H + +#define AMICI_VERSION "@AMICI_VERSION@" + +#endif diff --git a/@amidata/amidata.m b/matlab/@amidata/amidata.m similarity index 100% rename from @amidata/amidata.m rename to matlab/@amidata/amidata.m diff --git a/@amievent/amievent.m b/matlab/@amievent/amievent.m similarity index 100% rename from @amievent/amievent.m rename to matlab/@amievent/amievent.m diff --git a/@amievent/setHflag.m b/matlab/@amievent/setHflag.m similarity index 100% rename from @amievent/setHflag.m rename to matlab/@amievent/setHflag.m diff --git a/@amifun/amifun.m b/matlab/@amifun/amifun.m similarity index 100% rename from @amifun/amifun.m rename to matlab/@amifun/amifun.m diff --git a/@amifun/gccode.m b/matlab/@amifun/gccode.m similarity index 100% rename from @amifun/gccode.m rename to matlab/@amifun/gccode.m diff --git a/@amifun/getArgs.m b/matlab/@amifun/getArgs.m similarity index 100% rename from @amifun/getArgs.m rename to matlab/@amifun/getArgs.m diff --git a/@amifun/getCVar.m b/matlab/@amifun/getCVar.m similarity index 100% rename from @amifun/getCVar.m rename to matlab/@amifun/getCVar.m diff --git a/@amifun/getDeps.m b/matlab/@amifun/getDeps.m similarity index 100% rename from @amifun/getDeps.m rename to matlab/@amifun/getDeps.m diff --git a/@amifun/getNVecs.m b/matlab/@amifun/getNVecs.m similarity index 100% rename from @amifun/getNVecs.m rename to matlab/@amifun/getNVecs.m diff --git a/@amifun/getSensiFlag.m b/matlab/@amifun/getSensiFlag.m similarity index 100% rename from @amifun/getSensiFlag.m rename to matlab/@amifun/getSensiFlag.m diff --git a/@amifun/getSyms.m b/matlab/@amifun/getSyms.m similarity index 100% rename from @amifun/getSyms.m rename to matlab/@amifun/getSyms.m diff --git a/@amifun/writeCcode.m b/matlab/@amifun/writeCcode.m similarity index 100% rename from @amifun/writeCcode.m rename to matlab/@amifun/writeCcode.m diff --git a/@amifun/writeCcode_sensi.m b/matlab/@amifun/writeCcode_sensi.m similarity index 100% rename from @amifun/writeCcode_sensi.m rename to matlab/@amifun/writeCcode_sensi.m diff --git a/@amifun/writeMcode.m b/matlab/@amifun/writeMcode.m similarity index 100% rename from @amifun/writeMcode.m rename to matlab/@amifun/writeMcode.m diff --git a/@amimodel/amimodel.m b/matlab/@amimodel/amimodel.m similarity index 97% rename from @amimodel/amimodel.m rename to matlab/@amimodel/amimodel.m index 35de9b2293..1b77aac6bf 100644 --- a/@amimodel/amimodel.m +++ b/matlab/@amimodel/amimodel.m @@ -177,7 +177,7 @@ AM.modelname = modelname; % set path and create folder - AM.wrap_path=fileparts(fileparts(mfilename('fullpath'))); + AM.wrap_path=fileparts(fileparts(fileparts(mfilename('fullpath')))); if(~exist(fullfile(AM.wrap_path,'models'),'dir')) mkdir(fullfile(AM.wrap_path,'models')); mkdir(fullfile(AM.wrap_path,'models',AM.modelname)); @@ -262,7 +262,9 @@ function updateWrapPath(this,wrap_path) end methods(Static) - compileAndLinkModel(modelname, wrap_path, recompile, coptim, debug, funs, cfun, adjoint) + compileAndLinkModel(modelname, modelSourceFolder, coptim, debug, funs, cfun) + + generateMatlabWrapper(nx, ny, np, nk, nz, o2flag, amimodelo2, wrapperFilename, modelname, pscale, forward, adjoint) end end diff --git a/@amimodel/augmento2.m b/matlab/@amimodel/augmento2.m similarity index 100% rename from @amimodel/augmento2.m rename to matlab/@amimodel/augmento2.m diff --git a/@amimodel/augmento2vec.m b/matlab/@amimodel/augmento2vec.m similarity index 100% rename from @amimodel/augmento2vec.m rename to matlab/@amimodel/augmento2vec.m diff --git a/@amimodel/checkDeps.m b/matlab/@amimodel/checkDeps.m similarity index 100% rename from @amimodel/checkDeps.m rename to matlab/@amimodel/checkDeps.m diff --git a/@amimodel/compileAndLinkModel.m b/matlab/@amimodel/compileAndLinkModel.m similarity index 91% rename from @amimodel/compileAndLinkModel.m rename to matlab/@amimodel/compileAndLinkModel.m index 60fb6902e8..c00dea969d 100644 --- a/@amimodel/compileAndLinkModel.m +++ b/matlab/@amimodel/compileAndLinkModel.m @@ -1,4 +1,4 @@ -function compileAndLinkModel(modelname, wrap_path, recompile, coptim, debug, funs, cfun, adjoint) +function compileAndLinkModel(modelname, modelSourceFolder, coptim, debug, funs, cfun) % compileAndLinkModel compiles the mex simulation file. % It does not check if the model files have changed since generating % C++ code or whether all files are still present. @@ -7,15 +7,12 @@ function compileAndLinkModel(modelname, wrap_path, recompile, coptim, debug, fun % % Parameters: % modelname: name of the model as specified for amiwrap() - % wrap_path: AMICI path - % recompile: flag indicating whether all source files should be - % recompiled + % modelSourceFolder: path to model source directory % coptim: optimization flags % debug: enable debugging % funs: array with names of the model functions, will be guessed % from source files if left empty % cfun: struct indicating which files should be recompiled - % adjoint: flag indicating whether adjoint sensitivies are enabled % % Return values: % void @@ -23,7 +20,7 @@ function compileAndLinkModel(modelname, wrap_path, recompile, coptim, debug, fun % if no list provided, try to determine relevant files from model % folder if(isempty(funs)) - ls = dir(fullfile(wrap_path, 'models', modelname, [modelname '_*.cpp'])); + ls = dir(fullfile(modelSourceFolder, [modelname '_*.cpp'])); ls = {ls.name}; % extract funs from filename (strip of modelname_ and .cpp funs = cellfun(@(x) x((length(modelname)+2):(length(x)-4)), ls, 'UniformOutput', false); @@ -33,10 +30,7 @@ function compileAndLinkModel(modelname, wrap_path, recompile, coptim, debug, fun if(ispc) objectFileSuffix = '.obj'; end - - amiciSourcePath = fullfile(wrap_path,'src'); - modelSourceFolder = fullfile(wrap_path,'models',modelname); - + % compile flags COPT = ['COPTIMFLAGS=''' coptim ' -DNDEBUG'' CXXFLAGS=''$CXXFLAGS -std=c++0x''']; if(debug) @@ -47,8 +41,9 @@ function compileAndLinkModel(modelname, wrap_path, recompile, coptim, debug, fun end compilerVersion = getCompilerVersionString(); - baseObjectFolder = fullfile(wrap_path,'models',mexext,version('-release'),compilerVersion); - baseModelObjectFolder = fullfile(wrap_path,'models',modelname,version('-release'),compilerVersion); + amiciRootPath = fileparts(fileparts(fileparts(mfilename('fullpath')))); + baseObjectFolder = fullfile(amiciRootPath,'models',mexext,version('-release'),compilerVersion); + baseModelObjectFolder = fullfile(modelSourceFolder,version('-release'),compilerVersion); if(debug) objectFolder = fullfile(baseObjectFolder, 'debug'); modelObjectFolder = fullfile(baseModelObjectFolder, 'debug'); @@ -65,11 +60,12 @@ function compileAndLinkModel(modelname, wrap_path, recompile, coptim, debug, fun end %% Third party libraries - [objectsstr, includesstr] = compileAMICIDependencies(wrap_path, objectFolder, objectFileSuffix, COPT, DEBUG); + dependencyPath = fullfile(amiciRootPath, 'ThirdParty'); + [objectsstr, includesstr] = compileAMICIDependencies(dependencyPath, objectFolder, objectFileSuffix, COPT, DEBUG); includesstr = strcat(includesstr,' -I"', modelSourceFolder, '"'); %% Recompile AMICI base files if necessary - [objectStrAmici] = compileAmiciBase(wrap_path, objectFolder, objectFileSuffix, includesstr, DEBUG, COPT); + [objectStrAmici] = compileAmiciBase(amiciRootPath, objectFolder, objectFileSuffix, includesstr, DEBUG, COPT); objectsstr = [objectsstr, objectStrAmici]; %% Model-specific files @@ -178,7 +174,7 @@ function compileAndLinkModel(modelname, wrap_path, recompile, coptim, debug, fun ' -output ' mexFilename ' ' objectsstr]) end -function [objectStrAmici] = compileAmiciBase(wrap_path, objectFolder, objectFileSuffix, includesstr, DEBUG, COPT) +function [objectStrAmici] = compileAmiciBase(amiciRootPath, objectFolder, objectFileSuffix, includesstr, DEBUG, COPT) % generate hash for file and append debug string if we have an md5 % file, check this hash against the contained hash cppsrc = {'amici', 'symbolic_functions','spline', ... @@ -189,8 +185,8 @@ function compileAndLinkModel(modelname, wrap_path, recompile, coptim, debug, fun 'forwardproblem', 'steadystateproblem', 'backwardproblem', 'newton_solver'}; % to be safe, recompile everything if headers have changed. otherwise % would need to check the full include hierarchy - amiciIncludePath = fullfile(wrap_path,'include','amici'); - amiciSourcePath = fullfile(wrap_path,'src'); + amiciIncludePath = fullfile(amiciRootPath,'include','amici'); + amiciSourcePath = fullfile(amiciRootPath,'src'); recompile = headersHaveChanged(amiciIncludePath,objectFolder); objectArray = cellfun(@(x) [' "', fullfile(objectFolder, x), objectFileSuffix, '"'], cppsrc, 'UniformOutput', false); objectStrAmici = strjoin(objectArray, ' '); diff --git a/matlab/@amimodel/compileC.m b/matlab/@amimodel/compileC.m new file mode 100644 index 0000000000..4056b77a3b --- /dev/null +++ b/matlab/@amimodel/compileC.m @@ -0,0 +1,8 @@ +function compileC(this) + % compileC compiles the mex simulation file + % + % Return values: + % void + + amimodel.compileAndLinkModel(this.modelname, fullfile(this.wrap_path,'models',this.modelname), this.coptim, this.debug, this.funs, this.cfun); +end diff --git a/@amimodel/generateC.m b/matlab/@amimodel/generateC.m similarity index 89% rename from @amimodel/generateC.m rename to matlab/@amimodel/generateC.m index 6f01edac74..2324d61270 100644 --- a/@amimodel/generateC.m +++ b/matlab/@amimodel/generateC.m @@ -161,8 +161,8 @@ function generateC(this) otherwise fprintf(fid,' amici::AMICI_O2MODE_NONE,\n'); end -fprintf(fid,[' std::vector(' num2str(this.np) '),\n']); -fprintf(fid,[' std::vector(' num2str(this.nk) '),\n']); +fprintf(fid,[' std::vector(' num2str(this.np) ',1.0),\n']); +fprintf(fid,[' std::vector(' num2str(this.nk) ',1.0),\n']); fprintf(fid,' std::vector(),\n'); initstr = num2str(transpose(double(this.id)), '%d, '); fprintf(fid,[' std::vector{' initstr(1:end-1) '},\n']); @@ -195,6 +195,9 @@ function generateC(this) fprintf('CMakeLists | '); generateCMakeFile(this); +fprintf('swig | '); +generateSwigInterfaceFiles(this) + fprintf('main | '); generateMainC(this); @@ -238,12 +241,35 @@ function generateCMakeFile(this) t.add('TPL_MODELNAME', this.modelname); t.add('TPL_SOURCES', sourceStr); CMakeFileName = fullfile(this.wrap_path,'models',this.modelname,'CMakeLists.txt'); - CMakeTemplateFileName = fullfile(fileparts(fileparts(mfilename('fullpath'))), 'src/CMakeLists.template.txt'); + CMakeTemplateFileName = fullfile(fileparts(fileparts(fileparts(mfilename('fullpath')))), 'src' , 'CMakeLists.template.txt'); t.replace(CMakeTemplateFileName, CMakeFileName); end +function generateSwigInterfaceFiles(this) + + modelSwigDir = fullfile(this.wrap_path,'models',this.modelname,'swig'); + amiciSwigDir = fullfile(fileparts(fileparts(fileparts(mfilename('fullpath')))),'swig'); + mkdir(modelSwigDir) + + %interface file + t = template(); + t.add('TPL_MODELNAME', this.modelname); + SwigInterfaceFile = fullfile(modelSwigDir,[this.modelname '.i']); + SwigInterfaceTemplateFileName = fullfile(amiciSwigDir, 'modelname.template.i'); + t.replace(SwigInterfaceTemplateFileName, SwigInterfaceFile); + + %CMakeLists.txt + if(~exist(fullfile(this.wrap_path,'models',this.modelname,'swig'),'dir')) + mkdir(fullfile(this.wrap_path,'models',this.modelname),'swig'); + end + copyfile(fullfile(amiciSwigDir,'CMakeLists_model.txt'),fullfile(modelSwigDir,'CMakeLists.txt')); + +end + + + function generateMainC(this) - mainFileSource = fullfile(fileparts(fileparts(mfilename('fullpath'))), 'src/main.template.cpp'); + mainFileSource = fullfile(fileparts(fileparts(fileparts(mfilename('fullpath')))), 'src/main.template.cpp'); mainFileDestination = fullfile(this.wrap_path,'models',this.modelname,'main.cpp'); copyfile(mainFileSource, mainFileDestination); end diff --git a/matlab/@amimodel/generateM.m b/matlab/@amimodel/generateM.m new file mode 100644 index 0000000000..be85528e80 --- /dev/null +++ b/matlab/@amimodel/generateM.m @@ -0,0 +1,26 @@ +function generateM(this, amimodelo2) +% generateM generates the matlab wrapper for the compiled C files. +% +% Parameters: +% amimodelo2: this struct must contain all necessary symbolic +% definitions for second order sensivities @type amimodel +% +% Return values: +% void +wrapperFilename = fullfile(this.wrap_path,'models',this.modelname,['simulate_',this.modelname,'.m']); +this.generateMatlabWrapper(this.nx, this.ny, this.np, this.nk, this.nz, ... + this.o2flag, amimodelo2, wrapperFilename, this.modelname, this.param, ... + this.forward, this.adjoint) + +%% Generation of the file which computes the Jacobian + +for fun = this.mfuns + if(isfield(this.fun,fun{1})) + fprintf([fun{1} ' | ']); + this.fun.(fun{1}).writeMcode(this); + end +end + + +end + diff --git a/matlab/@amimodel/generateMatlabWrapper.m b/matlab/@amimodel/generateMatlabWrapper.m new file mode 100644 index 0000000000..02f5684fa2 --- /dev/null +++ b/matlab/@amimodel/generateMatlabWrapper.m @@ -0,0 +1,443 @@ +function generateMatlabWrapper(nx, ny, np, nk, nz, o2flag, amimodelo2, wrapperFilename, modelname, ... + pscale, forward, adjoint) + % generateMatlabWrapper generates the matlab wrapper for the compiled C files. + % + % Parameters: + % nx: number of states + % ny: number of observables + % np: number of parameters + % nk: number of fixed parameters + % nz: number of events + % o2flag: o2flag + % amimodelo2: this struct must contain all necessary symbolic + % definitions for second order sensivities @type amimodel + % wrapperFilename: output filename + % modelname: name of the model + % pscale: default parameter scaling + % forward: has forward sensitivity equations + % adjoint: has adjoint sensitivity equations + % + % Return values: + % void + amiciRootDir = fileparts(fileparts(fileparts(mfilename('fullpath')))); + + if(~isempty(amimodelo2)) + nztrue = amimodelo2.nztrue; + nxtrue = amimodelo2.nxtrue; + nytrue = amimodelo2.nytrue; + o2flag = amimodelo2.o2flag; + else + nztrue = nz; + nxtrue = nx; + nytrue = ny; + o2flag = o2flag; + end + + [commit_hash,branch,url] = getCommitHash(amiciRootDir); + if(isempty(commit_hash)) + commit_hash = '#'; + end + + if(o2flag) + nxtrue = amimodelo2.nxtrue; + nytrue = amimodelo2.nytrue; + end + + + %% Generation of the simulation file + + fid = fopen(wrapperFilename,'w'); + fprintf(fid,['%% simulate_' modelname '.m is the matlab interface to the cvodes mex\n'... + '%% which simulates the ordinary differential equation and respective\n'... + '%% sensitivities according to user specifications.\n'... + '%% this routine was generated using AMICI commit ' commit_hash ' in branch ' branch ' in repo ' url '.\n'... + '%%\n'... + '%% USAGE:\n'... + '%% ======\n'... + '%% [...] = simulate_' modelname '(tout,theta)\n'... + '%% [...] = simulate_' modelname '(tout,theta,kappa,data,options)\n'... + '%% [status,tout,x,y,sx,sy] = simulate_' modelname '(...)\n'... + '%%\n'... + '%% INPUTS:\n'... + '%% =======\n'... + '%% tout ... 1 dimensional vector of timepoints at which a solution to the ODE is desired\n'... + '%% theta ... 1 dimensional parameter vector of parameters for which sensitivities are desired.\n'... + '%% this corresponds to the specification in model.sym.p\n'... + '%% kappa ... 1 dimensional parameter vector of parameters for which sensitivities are not desired.\n'... + '%% this corresponds to the specification in model.sym.k\n'... + '%% data ... struct containing the following fields:\n'... + '%% Y ... 2 dimensional matrix containing data.\n'... + '%% columns must correspond to observables and rows to time-points\n'... + '%% Sigma_Y ... 2 dimensional matrix containing standard deviation of data.\n'... + '%% columns must correspond to observables and rows to time-points\n'... + '%% T ... (optional) 2 dimensional matrix containing events.\n'... + '%% columns must correspond to event-types and rows to possible event-times\n'... + '%% Sigma_T ... (optional) 2 dimensional matrix containing standard deviation of events.\n'... + '%% columns must correspond to event-types and rows to possible event-times\n'... + '%% options ... additional options to pass to the cvodes solver. Refer to the cvodes guide for more documentation.\n'... + '%% .atol ... absolute tolerance for the solver. default is specified in the user-provided syms function.\n'... + '%% .rtol ... relative tolerance for the solver. default is specified in the user-provided syms function.\n'... + '%% .maxsteps ... maximal number of integration steps. default is specified in the user-provided syms function.\n'... + '%% .tstart ... start of integration. for all timepoints before this, values will be set to initial value.\n'... + '%% .sens_ind ... 1 dimensional vector of indexes for which sensitivities must be computed.\n'... + '%% default value is 1:length(theta).\n'... + '%% .x0 ... user-provided state initialisation. This should be a vector of dimension [#states, 1].\n'... + '%% default is state initialisation based on the model definition.\n'... + '%% .sx0 ... user-provided sensitivity initialisation. this should be a matrix of dimension [#states x #parameters].\n'... + '%% default is sensitivity initialisation based on the derivative of the state initialisation.\n'... + '%% .lmm ... linear multistep method for forward problem.\n'... + '%% 1: Adams-Bashford\n'... + '%% 2: BDF (DEFAULT)\n'... + '%% .iter ... iteration method for linear multistep.\n'... + '%% 1: Functional\n'... + '%% 2: Newton (DEFAULT)\n'... + '%% .linsol ... linear solver module.\n'... + '%% direct solvers:\n'... + '%% 1: Dense (DEFAULT)\n'... + '%% 2: Band (not implemented)\n'... + '%% 3: LAPACK Dense (not implemented)\n'... + '%% 4: LAPACK Band (not implemented)\n'... + '%% 5: Diag (not implemented)\n'... + '%% implicit krylov solvers:\n'... + '%% 6: SPGMR\n'... + '%% 7: SPBCG\n'... + '%% 8: SPTFQMR\n'... + '%% sparse solvers:\n'... + '%% 9: KLU\n'... + '%% .stldet ... flag for stability limit detection. this should be turned on for stiff problems.\n'... + '%% 0: OFF\n'... + '%% 1: ON (DEFAULT)\n'... + '%% .qPositiveX ... vector of 0 or 1 of same dimension as state vector. 1 enforces positivity of states.\n'... + '%% .sensi_meth ... method for sensitivity analysis.\n'... + '%% ''forward'': forward sensitivity analysis (DEFAULT)\n'... + '%% ''adjoint'': adjoint sensitivity analysis \n'... + '%% .adjoint ... flag for adjoint sensitivity analysis.\n'... + '%% true: on \n'... + '%% false: off (DEFAULT)\n'... + '%% .ism ... only available for sensi_meth == 1. Method for computation of forward sensitivities.\n'... + '%% 1: Simultaneous (DEFAULT)\n'... + '%% 2: Staggered\n'... + '%% 3: Staggered1\n'... + '%% .Nd ... only available for sensi_meth == 2. Number of Interpolation nodes for forward solution. \n'... + '%% Default is 1000. \n'... + '%% .interpType ... only available for sensi_meth == 2. Interpolation method for forward solution.\n'... + '%% 1: Hermite (DEFAULT for problems without discontinuities)\n'... + '%% 2: Polynomial (DEFAULT for problems with discontinuities)\n'... + '%% .ordering ... online state reordering.\n'... + '%% 0: AMD reordering (default)\n'... + '%% 1: COLAMD reordering\n'... + '%% 2: natural reordering\n'... + '%%\n'... + '%% Outputs:\n'... + '%% ========\n'... + '%% sol.status ... flag for status of integration. generally status<0 for failed integration\n'... + '%% sol.t ... vector at which the solution was computed\n'... + '%% sol.llh ... likelihood value\n'... + '%% sol.chi2 ... chi2 value\n'... + '%% sol.sllh ... gradient of likelihood\n'... + '%% sol.s2llh ... hessian or hessian-vector-product of likelihood\n'... + '%% sol.x ... time-resolved state vector\n'... + '%% sol.y ... time-resolved output vector\n'... + '%% sol.sx ... time-resolved state sensitivity vector\n'... + '%% sol.sy ... time-resolved output sensitivity vector\n'... + '%% sol.z ... event output\n'... + '%% sol.sz ... sensitivity of event output\n'... + ]); + + + fprintf(fid,['function varargout = simulate_' modelname '(varargin)\n\n']); + fprintf(fid,'%% DO NOT CHANGE ANYTHING IN THIS FILE UNLESS YOU ARE VERY SURE ABOUT WHAT YOU ARE DOING\n'); + fprintf(fid,'%% MANUAL CHANGES TO THIS FILE CAN RESULT IN WRONG SOLUTIONS AND CRASHING OF MATLAB\n'); + fprintf(fid,'if(nargin<2)\n'); + fprintf(fid,' error(''Not enough input arguments.'');\n'); + fprintf(fid,'else\n'); + fprintf(fid,' tout=varargin{1};\n'); + fprintf(fid,' theta=varargin{2};\n'); + fprintf(fid,'end\n'); + + fprintf(fid,'if(nargin>=3)\n'); + fprintf(fid,' kappa=varargin{3};\n'); + fprintf(fid,'else\n'); + fprintf(fid,' kappa=[];\n'); + fprintf(fid,'end\n'); + fprintf(fid,'\n'); + if(nk==0) + fprintf(fid,'if(nargin==2)\n'); + fprintf(fid,' kappa = [];\n'); + fprintf(fid,'end\n'); + end + + fprintf(fid,['if(length(theta)<' num2str(np) ')\n']); + fprintf(fid,' error(''provided parameter vector is too short'');\n'); + fprintf(fid,'end\n'); + fprintf(fid,'\n'); + + fprintf(fid,'\n'); + fprintf(fid,'xscale = [];\n'); + fprintf(fid,'if(nargin>=5)\n'); + fprintf(fid,' if(isa(varargin{5},''amioption''))\n'); + fprintf(fid,' options_ami = varargin{5};\n'); + fprintf(fid,' else\n'); + fprintf(fid,' options_ami = amioption(varargin{5});\n'); + fprintf(fid,' end\n'); + fprintf(fid,'else\n'); + fprintf(fid,' options_ami = amioption();\n'); + fprintf(fid,'end\n'); + fprintf(fid,'if(isempty(options_ami.sens_ind))\n'); + fprintf(fid,[' options_ami.sens_ind = 1:' num2str(np) ';\n']); + fprintf(fid,['end\n']); + if(o2flag == 0) + fprintf(fid,'if(options_ami.sensi>1)\n'); + fprintf(fid,' error(''Second order sensitivities were requested but not computed'');\n'); + fprintf(fid,'end\n'); + end + fprintf(fid,'\n'); + + + fprintf(fid,'if(isempty(options_ami.pscale))\n'); + fprintf(fid,[' options_ami.pscale = ''' pscale ''' ;\n']); + fprintf(fid,'end\n'); + fprintf(fid,'switch (options_ami.pscale)\n'); + fprintf(fid,' case 1\n'); + fprintf(fid,' chainRuleFactor = exp(theta(options_ami.sens_ind));\n'); + fprintf(fid,' case 2\n'); + fprintf(fid,' chainRuleFactor = 10.^theta(options_ami.sens_ind)*log(10);\n'); + fprintf(fid,' otherwise\n'); + fprintf(fid,' chainRuleFactor = ones(size(options_ami.sens_ind));\n'); + fprintf(fid,'end\n\n'); + + if(o2flag == 2) + fprintf(fid,'if(nargin>=6)\n'); + fprintf(fid,' v = varargin{6};\n'); + fprintf(fid,' v = v(:).*chainRuleFactor;\n'); + fprintf(fid,'else\n'); + fprintf(fid,' if(options_ami.sensi==2)\n'); + fprintf(fid,' error(''6th argument (multiplication vector is missing'');\n'); + fprintf(fid,' end\n'); + fprintf(fid,'end\n'); + end + + if(o2flag) + fprintf(fid,'if(nargout>1)\n'); + fprintf(fid,' if(nargout>6)\n'); + fprintf(fid,' options_ami.sensi = 2;\n'); + fprintf(fid,' options_ami.sensi_meth = ''forward'';\n'); + fprintf(fid,' elseif(nargout>4)\n'); + fprintf(fid,' options_ami.sensi = 1;\n'); + fprintf(fid,' options_ami.sensi_meth = ''forward'';\n'); + fprintf(fid,' else\n'); + fprintf(fid,' options_ami.sensi = 0;\n'); + fprintf(fid,' end\n'); + fprintf(fid,'end\n'); + else + fprintf(fid,'if(nargout>1)\n'); + fprintf(fid,' if(nargout>4)\n'); + fprintf(fid,' options_ami.sensi = 1;\n'); + fprintf(fid,' options_ami.sensi_meth = ''forward'';\n'); + fprintf(fid,' else\n'); + fprintf(fid,' options_ami.sensi = 0;\n'); + fprintf(fid,' end\n'); + fprintf(fid,'end\n'); + end + if(~forward) + fprintf(fid,'if(options_ami.sensi>0)\n'); + fprintf(fid,' if(options_ami.sensi_meth == 1)\n'); + fprintf(fid,' error(''forward sensitivities are disabled as necessary routines were not compiled'');\n'); + fprintf(fid,' end\n'); + fprintf(fid,'end\n'); + end + if(~adjoint) + fprintf(fid,'if(options_ami.sensi>0)\n'); + fprintf(fid,' if(options_ami.sensi_meth == 2)\n'); + fprintf(fid,' error(''adjoint sensitivities are disabled as necessary routines were not compiled'');\n'); + fprintf(fid,' end\n'); + fprintf(fid,'end\n'); + end + fprintf(fid,['nplist = length(options_ami.sens_ind); %% MUST NOT CHANGE THIS VALUE\n']); + fprintf(fid,['if(nplist == 0)\n']); + fprintf(fid,[' options_ami.sensi = 0;\n']); + fprintf(fid,['end\n']); + if(o2flag) + fprintf(fid,['if(options_ami.sensi > 1)\n']); + fprintf(fid,[' nxfull = ' num2str(amimodelo2.nx) ';\n']); + fprintf(fid,['else\n']); + fprintf(fid,[' nxfull = ' num2str(nxtrue) ';\n']); + fprintf(fid,['end\n']); + else + fprintf(fid,['nxfull = ' num2str(nx) ';\n']); + end + fprintf(fid,['if(isempty(options_ami.qpositivex))\n']); + fprintf(fid,[' options_ami.qpositivex = zeros(nxfull,1);\n']); + fprintf(fid,['else\n']); + fprintf(fid,[' if(numel(options_ami.qpositivex)>=nxfull)\n']); + fprintf(fid,[' options_ami.qpositivex = options_ami.qpositivex(:);\n']); + fprintf(fid,[' else\n']); + fprintf(fid,[' error([''Number of elements in options_ami.qpositivex does not match number of states '' num2str(nxfull) ]);\n']); + fprintf(fid,[' end\n']); + fprintf(fid,['end\n']); + fprintf(fid,'plist = options_ami.sens_ind-1;\n'); + fprintf(fid,['if(nargin>=4)\n']); + fprintf(fid,[' if(isempty(varargin{4}));\n']); + fprintf(fid,[' data=[];\n']); + fprintf(fid,[' else\n']); + fprintf(fid,[' if(isa(varargin{4},''amidata''));\n']); + fprintf(fid,[' data=varargin{4};\n']); + fprintf(fid,[' else\n']); + fprintf(fid,[' data=amidata(varargin{4});\n']); + fprintf(fid,[' end\n']); + fprintf(fid,[' if(data.ne>0);\n']); + fprintf(fid,[' options_ami.nmaxevent = data.ne;\n']); + fprintf(fid,[' else\n']); + fprintf(fid,[' data.ne = options_ami.nmaxevent;\n']); + fprintf(fid,[' end\n']); + fprintf(fid,[' if(isempty(kappa))\n']); + fprintf(fid,[' kappa = data.condition;\n']); + fprintf(fid,[' end\n']); + fprintf(fid,[' if(isempty(tout))\n']); + fprintf(fid,[' tout = data.t;\n']); + fprintf(fid,[' end\n']); + fprintf(fid,[' end\n']); + fprintf(fid,['else\n']); + fprintf(fid,[' data=[];\n']); + fprintf(fid,['end\n']); + fprintf(fid,['if(~all(tout==sort(tout)))\n']); + fprintf(fid,[' error(''Provided time vector is not monotonically increasing!'');\n']); + fprintf(fid,['end\n']); + fprintf(fid,['if(not(length(tout)==length(unique(tout))))\n']); + fprintf(fid,[' error(''Provided time vector has non-unique entries!!'');\n']); + fprintf(fid,['end\n']); + fprintf(fid,['if(max(options_ami.sens_ind)>' num2str(np) ')\n']); + fprintf(fid,[' error(''Sensitivity index exceeds parameter dimension!'')\n']); + fprintf(fid,['end\n']); + fprintf(fid,['if(length(kappa)<' num2str(nk) ')\n']); + fprintf(fid,' error(''provided condition vector is too short'');\n'); + fprintf(fid,'end\n'); + + if(o2flag == 2) + fprintf(fid,'if(nargin>=6)\n'); + fprintf(fid,' kappa = [kappa(:);v(:)];\n'); + fprintf(fid,'end\n'); + end + + fprintf(fid,'init = struct();\n'); + fprintf(fid,'if(~isempty(options_ami.x0))\n'); + fprintf(fid,' if(size(options_ami.x0,2)~=1)\n'); + fprintf(fid,' error(''x0 field must be a row vector!'');\n'); + fprintf(fid,' end\n'); + fprintf(fid,' if(size(options_ami.x0,1)~=nxfull)\n'); + fprintf(fid,' error(''Number of columns in x0 field does not agree with number of states!'');\n'); + fprintf(fid,' end\n'); + fprintf(fid,' init.x0 = options_ami.x0;\n'); + fprintf(fid,'end\n'); + fprintf(fid,'if(~isempty(options_ami.sx0))\n'); + fprintf(fid,' if(size(options_ami.sx0,2)~=nplist)\n'); + fprintf(fid,' error(''Number of rows in sx0 field does not agree with number of model parameters!'');\n'); + fprintf(fid,' end\n'); + fprintf(fid,' if(size(options_ami.sx0,1)~=nxfull)\n'); + fprintf(fid,' error(''Number of columns in sx0 field does not agree with number of states!'');\n'); + fprintf(fid,' end\n'); + fprintf(fid,' init.sx0 = bsxfun(@times,options_ami.sx0,1./permute(chainRuleFactor(:),[2,1]));\n'); + fprintf(fid,'end\n'); + + + if(o2flag) + fprintf(fid,'if(options_ami.sensi<2)\n'); + fprintf(fid,[' sol = ami_' modelname '(tout,theta(1:' num2str(np) '),kappa(1:' num2str(nk) '),options_ami,plist,xscale,init,data);\n']); + fprintf(fid,'else\n'); + switch(o2flag) + case 1 + fprintf(fid,[' sol = ami_' modelname '_o2(tout,theta(1:' num2str(np) '),kappa(1:' num2str(nk) '),options_ami,plist,xscale,init,data);\n']); + case 2 + fprintf(fid,[' sol = ami_' modelname '_o2vec(tout,theta(1:' num2str(np) '),kappa(1:' num2str(amimodelo2.nk) '),options_ami,plist,xscale,init,data);\n']); + end + fprintf(fid,'end\n'); + else + fprintf(fid,['sol = ami_' modelname '(tout,theta(1:' num2str(np) '),kappa(1:' num2str(nk) '),options_ami,plist,xscale,init,data);\n']); + end + + if(o2flag) + fprintf(fid,'if(options_ami.sensi == 2)\n'); + fprintf(fid, ' if(~(options_ami.sensi_meth==2))\n'); + + fprintf(fid,[' sz = zeros(size(sol.z,1),' num2str(nztrue) ',length(theta(options_ami.sens_ind)));\n']); + fprintf(fid,[' ssigmaz = zeros(size(sol.z,1),' num2str(nztrue) ',length(theta(options_ami.sens_ind)));\n']); + fprintf(fid,[' srz = zeros(size(sol.z,1),' num2str(nztrue) ',length(theta(options_ami.sens_ind)));\n']); + fprintf(fid,[' for iz = 1:' num2str(nztrue) '\n']); + fprintf(fid,[' sz(:,iz,:) = sol.sz(:,2*iz-1,:);\n']); + fprintf(fid,[' ssigmaz(:,iz,:) = sol.ssigmaz(:,2*iz-1,:);\n']); + fprintf(fid,[' srz(:,iz,:) = sol.srz(:,2*iz-1,:);\n']); + fprintf(fid,[' end\n']); + switch(o2flag) + case 1 + fprintf(fid,[' sol.s2x = reshape(sol.sx(:,' num2str(nxtrue+1) ':end,:),length(tout),' num2str(nxtrue) ',' num2str(np) ',length(options_ami.sens_ind));\n']); + fprintf(fid,[' sol.s2y = reshape(sol.sy(:,' num2str(nytrue+1) ':end,:),length(tout),' num2str(nytrue) ',' num2str(np) ',length(options_ami.sens_ind));\n']); + fprintf(fid,[' sol.s2sigmay = reshape(sol.ssigmay(:,' num2str(nytrue+1) ':end,:),length(tout),' num2str(nytrue) ',' num2str(np) ',length(options_ami.sens_ind));\n']); + case 2 + fprintf(fid,[' sol.s2x = sol.sx(:,' num2str(nxtrue+1) ':end,:);\n']); + fprintf(fid,[' sol.s2y = sol.sy(:,' num2str(nytrue+1) ':end,:);\n']); + fprintf(fid,[' sol.s2sigmay = sol.ssigmay(:,' num2str(nytrue+1) ':end,:);\n']); + end + switch(o2flag) + case 1 + fprintf(fid,[' s2z = zeros(size(sol.z,1),' num2str(nztrue) ',' num2str(np) ',length(options_ami.sens_ind));\n']); + fprintf(fid,[' s2sigmaz = zeros(size(sol.z,1),' num2str(nztrue) ',' num2str(np) ',length(options_ami.sens_ind));\n']); + fprintf(fid,[' s2rz = zeros(size(sol.z,1),' num2str(nztrue) ',' num2str(np) ',length(options_ami.sens_ind));\n']); + case 2 + fprintf(fid,[' s2z = zeros(size(sol.z,1),' num2str(nztrue) ',length(theta(options_ami.sens_ind)));\n']); + fprintf(fid,[' s2sigmaz = zeros(size(sol.z,1),' num2str(nztrue) ',length(theta(options_ami.sens_ind)));\n']); + fprintf(fid,[' s2rz = zeros(size(sol.z,1),' num2str(nztrue) ',length(theta(options_ami.sens_ind)));\n']); + end + fprintf(fid,[' for iz = 1:' num2str(nztrue) '\n']); + switch(o2flag) + case 1 + fprintf(fid,[' sol.s2z(:,iz,:,:) = reshape(sol.sz(:,((iz-1)*(' num2str(np) '+1)+2):((iz-1)*(' num2str(np) '+1)+' num2str(np) '+1),:),options_ami.nmaxevent,1,' num2str(np) ',length(options_ami.sens_ind));\n']); + fprintf(fid,[' sol.s2sigmaz(:,iz,:,:) = reshape(sol.ssigmaz(:,((iz-1)*(' num2str(np) '+1)+2):((iz-1)*(' num2str(np) '+1)+' num2str(np) '+1),:),options_ami.nmaxevent,1,' num2str(np) ',length(options_ami.sens_ind));\n']); + fprintf(fid,[' sol.s2rz(:,iz,:,:) = reshape(sol.srz(:,((iz-1)*(' num2str(np) '+1)+2):((iz-1)*(' num2str(np) '+1)+' num2str(np) '+1),:),options_ami.nmaxevent,1,' num2str(np) ',length(options_ami.sens_ind));\n']); + case 2 + fprintf(fid,[' sol.s2z(:,iz,:) = reshape(sol.sz(:,2*(iz-1)+2,:),options_ami.nmaxevent,1,length(theta(options_ami.sens_ind)));\n']); + fprintf(fid,[' sol.s2sigmaz(:,iz,:) = reshape(sol.ssigmaz(:,2*(iz-1)+2,:),options_ami.nmaxevent,1,length(theta(options_ami.sens_ind)));\n']); + fprintf(fid,[' sol.s2rz(:,iz,:) = reshape(sol.srz(:,2*(iz-1)+2,:),options_ami.nmaxevent,1,length(theta(options_ami.sens_ind)));\n']); + end + fprintf(fid,' end\n'); + fprintf(fid,[' sol.sx = sol.sx(:,1:' num2str(nxtrue) ',:);\n']); + fprintf(fid,[' sol.sy = sol.sy(:,1:' num2str(nytrue) ',:);\n']); + fprintf(fid,[' sol.ssigmay = sol.ssigmay(:,1:' num2str(nytrue) ',:);\n']); + fprintf(fid,[' if(iz>0)\n']); + fprintf(fid,[' sol.sz = sz;\n']); + fprintf(fid,[' sol.ssigmaz = ssigmaz;\n']); + fprintf(fid,[' sol.srz = srz;\n']); + fprintf(fid,' end\n'); + fprintf(fid,' end\n'); + fprintf(fid,[' sol.x = sol.x(:,1:' num2str(nxtrue) ');\n']); + fprintf(fid,[' sol.y = sol.y(:,1:' num2str(nytrue) ');\n']); + fprintf(fid,[' sol.sigmay = sol.sigmay(:,1:' num2str(nytrue) ');\n']); + fprintf(fid,[' sol.z = sol.z(:,1:' num2str(nztrue) ');\n']); + fprintf(fid,[' sol.rz = sol.rz(:,1:' num2str(nztrue) ');\n']); + fprintf(fid,[' sol.sigmaz = sol.sigmaz(:,1:' num2str(nztrue) ');\n']); + fprintf(fid,'end\n'); + end + + fprintf(fid,'if(nargout>1)\n'); + fprintf(fid,' varargout{1} = sol.status;\n'); + fprintf(fid,' varargout{2} = sol.t;\n'); + fprintf(fid,' varargout{3} = sol.x;\n'); + fprintf(fid,' varargout{4} = sol.y;\n'); + fprintf(fid,' if(nargout>4)\n'); + fprintf(fid,' varargout{5} = sol.sx;\n'); + fprintf(fid,' varargout{6} = sol.sy;\n'); + if(o2flag) + fprintf(fid,' if(nargout>6)\n'); + fprintf(fid,' varargout{7} = sol.s2x;\n'); + fprintf(fid,' varargout{8} = sol.s2y;\n'); + fprintf(fid,' end\n'); + end + fprintf(fid,' end\n'); + fprintf(fid,'else\n'); + fprintf(fid,' varargout{1} = sol;\n'); + fprintf(fid,'end\n'); + fprintf(fid,'end\n'); + + fclose(fid); + +end + diff --git a/@amimodel/getFun.m b/matlab/@amimodel/getFun.m similarity index 95% rename from @amimodel/getFun.m rename to matlab/@amimodel/getFun.m index 429fae5b12..4d126c585c 100644 --- a/@amimodel/getFun.m +++ b/matlab/@amimodel/getFun.m @@ -9,7 +9,7 @@ function getFun(this,HTable,funstr) % Return values: % void - [wrap_path,~,~]=fileparts(which('amiwrap.m')); + [wrap_path,~,~]=fileparts(fileparts(which('amiwrap.m'))); fun = amifun(funstr,this); diff --git a/@amimodel/loadOldHashes.m b/matlab/@amimodel/loadOldHashes.m similarity index 96% rename from @amimodel/loadOldHashes.m rename to matlab/@amimodel/loadOldHashes.m index b70ebbfa73..088aa826ef 100644 --- a/@amimodel/loadOldHashes.m +++ b/matlab/@amimodel/loadOldHashes.m @@ -5,7 +5,7 @@ % HTable: struct with hashes of symbolic definition from the previous % compilation @type struct - [wrap_path,~,~]=fileparts(which('amiwrap.m')); + [wrap_path,~,~]=fileparts(fileparts(which('amiwrap.m'))); try load(fullfile(wrap_path,'models',this.modelname,['hashes.mat'])) try diff --git a/@amimodel/makeEvents.m b/matlab/@amimodel/makeEvents.m similarity index 100% rename from @amimodel/makeEvents.m rename to matlab/@amimodel/makeEvents.m diff --git a/@amimodel/makeSyms.m b/matlab/@amimodel/makeSyms.m similarity index 100% rename from @amimodel/makeSyms.m rename to matlab/@amimodel/makeSyms.m diff --git a/@amimodel/parseModel.m b/matlab/@amimodel/parseModel.m similarity index 98% rename from @amimodel/parseModel.m rename to matlab/@amimodel/parseModel.m index b328874149..fd93cdcfdd 100644 --- a/@amimodel/parseModel.m +++ b/matlab/@amimodel/parseModel.m @@ -79,11 +79,11 @@ function parseModel(this) 'getSensiFlag','getSyms','writeCcode',... 'writeCcode_sensi'}; for ifile = 1:length(codegen_amifun) - this.HTable(1).(codegen_amifun{ifile}) = CalcMD5(fullfile(this.wrap_path,'@amifun',[codegen_amifun{ifile} '.m']),'File'); + this.HTable(1).(codegen_amifun{ifile}) = CalcMD5(fullfile(this.wrap_path,'matlab','@amifun',[codegen_amifun{ifile} '.m']),'File'); end codegen_amimodel = {'generateC','makeSyms','makeEvents'}; for ifile = 1:length(codegen_amimodel) - this.HTable(1).(codegen_amimodel{ifile}) = CalcMD5(fullfile(this.wrap_path,'@amimodel',[codegen_amimodel{ifile} '.m']),'File'); + this.HTable(1).(codegen_amimodel{ifile}) = CalcMD5(fullfile(this.wrap_path,'matlab','@amimodel',[codegen_amimodel{ifile} '.m']),'File'); end if(not(this.recompile)) this.recompile = not(strcmp(this.HTable(1).x,HTable.x)); diff --git a/@amioption/amioption.m b/matlab/@amioption/amioption.m similarity index 100% rename from @amioption/amioption.m rename to matlab/@amioption/amioption.m diff --git a/@amised/amised.m b/matlab/@amised/amised.m similarity index 100% rename from @amised/amised.m rename to matlab/@amised/amised.m diff --git a/@optsym/optsym.m b/matlab/@optsym/optsym.m similarity index 100% rename from @optsym/optsym.m rename to matlab/@optsym/optsym.m diff --git a/AMICI2D2D.m b/matlab/AMICI2D2D.m similarity index 100% rename from AMICI2D2D.m rename to matlab/AMICI2D2D.m diff --git a/SBML2AMICI.m b/matlab/SBML2AMICI.m similarity index 82% rename from SBML2AMICI.m rename to matlab/SBML2AMICI.m index a827cc81ec..ad73de42fe 100644 --- a/SBML2AMICI.m +++ b/matlab/SBML2AMICI.m @@ -11,11 +11,11 @@ function SBML2AMICI( filename, modelname ) if(nargin<2) modelname = filename; end - wrap_path=fileparts(mfilename('fullpath')); - if(~exist(fullfile(wrap_path,'SBMLimporter'),'dir')) + amiciMatlabPath=fileparts(mfilename('fullpath')); + if(~exist(fullfile(amiciMatlabPath,'SBMLimporter'),'dir')) error('SBMLimporter is not available, try running `git submodule update --init`') end - addpath(fullfile(wrap_path,'SBMLimporter')); + addpath(fullfile(amiciMatlabPath,'SBMLimporter')); ODE = SBMLode(filename); ODE.writeAMICI(modelname); pnom = ODE.pnom; diff --git a/SBMLimporter/.gitrepo b/matlab/SBMLimporter/.gitrepo similarity index 100% rename from SBMLimporter/.gitrepo rename to matlab/SBMLimporter/.gitrepo diff --git a/SBMLimporter/@SBMLode/SBMLode.m b/matlab/SBMLimporter/@SBMLode/SBMLode.m similarity index 100% rename from SBMLimporter/@SBMLode/SBMLode.m rename to matlab/SBMLimporter/@SBMLode/SBMLode.m diff --git a/SBMLimporter/@SBMLode/checkODE.m b/matlab/SBMLimporter/@SBMLode/checkODE.m similarity index 100% rename from SBMLimporter/@SBMLode/checkODE.m rename to matlab/SBMLimporter/@SBMLode/checkODE.m diff --git a/SBMLimporter/@SBMLode/importSBML.m b/matlab/SBMLimporter/@SBMLode/importSBML.m similarity index 100% rename from SBMLimporter/@SBMLode/importSBML.m rename to matlab/SBMLimporter/@SBMLode/importSBML.m diff --git a/SBMLimporter/@SBMLode/writeAMICI.m b/matlab/SBMLimporter/@SBMLode/writeAMICI.m similarity index 100% rename from SBMLimporter/@SBMLode/writeAMICI.m rename to matlab/SBMLimporter/@SBMLode/writeAMICI.m diff --git a/SBMLimporter/LICENSE b/matlab/SBMLimporter/LICENSE similarity index 100% rename from SBMLimporter/LICENSE rename to matlab/SBMLimporter/LICENSE diff --git a/SBMLimporter/README.md b/matlab/SBMLimporter/README.md similarity index 100% rename from SBMLimporter/README.md rename to matlab/SBMLimporter/README.md diff --git a/SBMLimporter/computeBracketLevel.m b/matlab/SBMLimporter/computeBracketLevel.m similarity index 100% rename from SBMLimporter/computeBracketLevel.m rename to matlab/SBMLimporter/computeBracketLevel.m diff --git a/STRUCT2AMICI.m b/matlab/STRUCT2AMICI.m similarity index 100% rename from STRUCT2AMICI.m rename to matlab/STRUCT2AMICI.m diff --git a/amiwrap.m b/matlab/amiwrap.m similarity index 73% rename from amiwrap.m rename to matlab/amiwrap.m index 360be26c48..bd66b38824 100644 --- a/amiwrap.m +++ b/matlab/amiwrap.m @@ -65,23 +65,25 @@ function amiwrap( varargin ) %% % computations - wrap_path=fileparts(mfilename('fullpath')); - addpath(genpath(fullfile(wrap_path,'auxiliary'))); - addpath(fullfile(wrap_path,'symbolic')); + matlabRootPath=fileparts(mfilename('fullpath')); + amiciRootPath=fileparts(matlabRootPath); + + addpath(genpath(fullfile(matlabRootPath,'auxiliary'))); + addpath(fullfile(matlabRootPath,'symbolic')); % compile CalcMD5 if necessary try CalcMD5('TEST','char','hex'); catch try - addpath(fullfile(wrap_path,'auxiliary','CalcMD5')) + addpath(fullfile(matlabRootPath,'auxiliary','CalcMD5')) CalcMD5('TEST','char','hex'); catch disp('CalcMD5 has not been compiled yet. Compiling now!') tmpdir = pwd; - cd(fullfile(wrap_path,'auxiliary','CalcMD5')) - mex(fullfile(wrap_path,'auxiliary','CalcMD5','CalcMD5.c')) - addpath(fullfile(wrap_path,'auxiliary','CalcMD5')) + cd(fullfile(matlabRootPath,'auxiliary','CalcMD5')) + mex(fullfile(matlabRootPath,'auxiliary','CalcMD5','CalcMD5.c')) + addpath(fullfile(matlabRootPath,'auxiliary','CalcMD5')) cd(tmpdir); end end @@ -97,18 +99,18 @@ function amiwrap( varargin ) model_hash = []; end - commit_hash = getCommitHash(wrap_path); + commit_hash = getCommitHash(amiciRootPath); - if(~exist(fullfile(wrap_path,'models',modelname),'dir')) - mkdir(fullfile(wrap_path,'models',modelname)); + if(~exist(fullfile(amiciRootPath,'models',modelname),'dir')) + mkdir(fullfile(amiciRootPath,'models',modelname)); end - addpath(fullfile(wrap_path,'models',modelname)); + addpath(fullfile(amiciRootPath,'models',modelname)); if(exist([commit_hash '_' model_hash '.mat'],'file')==2); load([commit_hash '_' model_hash '.mat']); % update modelname according to this function call model.updateModelName(modelname); % update wrap_path to this function call - model.updateWrapPath(wrap_path); + model.updateWrapPath(amiciRootPath); end if(~exist('model','var')) @@ -117,7 +119,7 @@ function amiwrap( varargin ) if(~isempty(model_hash) && ~isempty(commit_hash)) - save(fullfile(wrap_path,'models',modelname,[commit_hash '_' model_hash]),'model') + save(fullfile(amiciRootPath,'models',modelname,[commit_hash '_' model_hash]),'model') end end @@ -131,19 +133,19 @@ function amiwrap( varargin ) end if(~isempty(o2string)) - o2_hash = CalcMD5(fullfile(wrap_path,'@amimodel',['augment' o2string '.m']),'File'); + o2_hash = CalcMD5(fullfile(matlabRootPath,'@amimodel',['augment' o2string '.m']),'File'); try - if(~exist(fullfile(wrap_path,'models',[modelname '_' o2string]),'dir')) - mkdir(fullfile(wrap_path,'models',[modelname '_' o2string])); + if(~exist(fullfile(amiciRootPath,'models',[modelname '_' o2string]),'dir')) + mkdir(fullfile(amiciRootPath,'models',[modelname '_' o2string])); end - addpath(fullfile(wrap_path,'models',[modelname '_' o2string])); + addpath(fullfile(amiciRootPath,'models',[modelname '_' o2string])); end if(exist([commit_hash '_' model_hash '_' o2_hash '.mat'],'file')==2); load([commit_hash '_' model_hash '_' o2_hash '.mat']); % update modelname according to this function call modelo2.updateModelName([modelname '_' o2string]); % update wrap_path to this function call - modelo2.updateWrapPath(wrap_path); + modelo2.updateWrapPath(amiciRootPath); end if(~exist('modelo2','var')) disp('Augmenting to second order ...') @@ -151,7 +153,7 @@ function amiwrap( varargin ) if(~isempty(model_hash) && ~isempty(commit_hash)) - save(fullfile(wrap_path,'models',[modelname '_' o2string],[commit_hash '_' model_hash '_' o2_hash]),'modelo2') + save(fullfile(amiciRootPath,'models',[modelname '_' o2string],[commit_hash '_' model_hash '_' o2_hash]),'modelo2') end end end @@ -188,22 +190,22 @@ function amiwrap( varargin ) clear(['simulate_' modelname ]); clear(['ami_' modelname ]); clear(['ami_' modelname o2string]); - movefile(fullfile(wrap_path,'models',modelname,['simulate_' modelname '.m']),fullfile(tdir,['simulate_' modelname '.m'])); - movefile(fullfile(wrap_path,'models',modelname,['ami_' modelname '.' mexext]),fullfile(tdir,['ami_' modelname '.' mexext])); + movefile(fullfile(amiciRootPath,'models',modelname,['simulate_' modelname '.m']),fullfile(tdir,['simulate_' modelname '.m'])); + movefile(fullfile(amiciRootPath,'models',modelname,['ami_' modelname '.' mexext]),fullfile(tdir,['ami_' modelname '.' mexext])); % make files available in the path tmp = which(fullfile(tdir,['simulate_' modelname '.m'])); tmp = which(fullfile(tdir,['ami_' modelname '.' mexext])); for fun = model.mfuns - copyfile(fullfile(wrap_path,'models',modelname,[fun{1} '_' modelname '.m']),fullfile(tdir,[fun{1} '_' modelname '.m'])); + copyfile(fullfile(amiciRootPath,'models',modelname,[fun{1} '_' modelname '.m']),fullfile(tdir,[fun{1} '_' modelname '.m'])); tmp = which(fullfile(tdir,[fun{1} '_' modelname '.m'])); end % clear .m and .mex files from memory if(~isempty(o2string)) - movefile(fullfile(wrap_path,'models',[modelname '_' o2string],[ 'ami_' modelname '_' o2string '.' mexext]),fullfile(tdir,['ami_' modelname '_' o2string '.' mexext])); + movefile(fullfile(amiciRootPath,'models',[modelname '_' o2string],[ 'ami_' modelname '_' o2string '.' mexext]),fullfile(tdir,['ami_' modelname '_' o2string '.' mexext])); tmp = which(fullfile(tdir,['ami_' modelname '_' o2string '.' mexext])); end else - addpath(fullfile(wrap_path,'models',modelname)); + addpath(fullfile(amiciRootPath,'models',modelname)); end warning(warningreset); end diff --git a/auxiliary/CalcMD5/CalcMD5.c b/matlab/auxiliary/CalcMD5/CalcMD5.c similarity index 100% rename from auxiliary/CalcMD5/CalcMD5.c rename to matlab/auxiliary/CalcMD5/CalcMD5.c diff --git a/auxiliary/CalcMD5/CalcMD5.m b/matlab/auxiliary/CalcMD5/CalcMD5.m similarity index 100% rename from auxiliary/CalcMD5/CalcMD5.m rename to matlab/auxiliary/CalcMD5/CalcMD5.m diff --git a/auxiliary/CalcMD5/TestCalcMD5.m b/matlab/auxiliary/CalcMD5/TestCalcMD5.m similarity index 100% rename from auxiliary/CalcMD5/TestCalcMD5.m rename to matlab/auxiliary/CalcMD5/TestCalcMD5.m diff --git a/auxiliary/CalcMD5/license.txt b/matlab/auxiliary/CalcMD5/license.txt similarity index 100% rename from auxiliary/CalcMD5/license.txt rename to matlab/auxiliary/CalcMD5/license.txt diff --git a/auxiliary/am_setdefault.m b/matlab/auxiliary/am_setdefault.m similarity index 100% rename from auxiliary/am_setdefault.m rename to matlab/auxiliary/am_setdefault.m diff --git a/auxiliary/ami_mfun.m b/matlab/auxiliary/ami_mfun.m similarity index 100% rename from auxiliary/ami_mfun.m rename to matlab/auxiliary/ami_mfun.m diff --git a/auxiliary/compileAMICIDependencies.m b/matlab/auxiliary/compileAMICIDependencies.m similarity index 93% rename from auxiliary/compileAMICIDependencies.m rename to matlab/auxiliary/compileAMICIDependencies.m index 22e3b5ab7f..f6aa85e427 100644 --- a/auxiliary/compileAMICIDependencies.m +++ b/matlab/auxiliary/compileAMICIDependencies.m @@ -1,13 +1,13 @@ -function [objectsstr, includesstr] = compileAMICIDependencies(wrap_path, objectFolder, o_suffix, COPT, DEBUG) +function [objectsstr, includesstr] = compileAMICIDependencies(dependencyPath, objectFolder, o_suffix, COPT, DEBUG) %COMPILEAMICIDEPENDENCIES Compiles Sundials and SuiteSparse libraries required by AMICI - sundials_path = fullfile(wrap_path,'sundials'); + sundials_path = fullfile(dependencyPath,'sundials'); sundials_ver = '2.7.0'; - ssparse_path = fullfile(wrap_path,'SuiteSparse'); + ssparse_path = fullfile(dependencyPath,'SuiteSparse'); ssparse_ver = '4.5.3'; - lapack_path = fullfile(wrap_path,'lapack-3.5.0'); % currently not used, lapack implementation still needs to be done + lapack_path = fullfile(dependencyPath,'lapack-3.5.0'); % currently not used, lapack implementation still needs to be done lapack_ver = '3.5.0'; @@ -26,7 +26,7 @@ objectsstr = strcat(objectsstr,' "',fullfile(objectFolder,objects_ssparse{j}),'"'); end - includesstr = getIncludeString(wrap_path, sundials_path, ssparse_path); + includesstr = getIncludeString(fullfile(fileparts(dependencyPath)), sundials_path, ssparse_path); % collect files that need to be recompiled sources_sundials = getSourcesSundials(); @@ -58,12 +58,12 @@ fclose(fid); end -function includesstr = getIncludeString(wrap_path, sundials_path, ssparse_path) +function includesstr = getIncludeString(amici_root_path, sundials_path, ssparse_path) includesstr = ''; includesstr = strcat(includesstr,' -I"', fullfile(sundials_path, 'include'), '"'); - includesstr = strcat(includesstr,' -I"', fullfile(wrap_path), '"'); - includesstr = strcat(includesstr,' -I"', fullfile(wrap_path, 'src'), '"'); - includesstr = strcat(includesstr,' -I"', fullfile(wrap_path, 'include'), '"'); + includesstr = strcat(includesstr,' -I"', fullfile(amici_root_path), '"'); + includesstr = strcat(includesstr,' -I"', fullfile(amici_root_path, 'src'), '"'); + includesstr = strcat(includesstr,' -I"', fullfile(amici_root_path, 'include'), '"'); includesstr = strcat(includesstr,' -I"', fullfile(ssparse_path, 'KLU','Include'), '"'); includesstr = strcat(includesstr,' -I"', fullfile(ssparse_path, 'AMD','Include'), '"'); includesstr = strcat(includesstr,' -I"', fullfile(ssparse_path, 'COLAMD','Include'), '"'); diff --git a/auxiliary/getCommitHash.m b/matlab/auxiliary/getCommitHash.m similarity index 100% rename from auxiliary/getCommitHash.m rename to matlab/auxiliary/getCommitHash.m diff --git a/auxiliary/struct2xml/license.txt b/matlab/auxiliary/struct2xml/license.txt similarity index 100% rename from auxiliary/struct2xml/license.txt rename to matlab/auxiliary/struct2xml/license.txt diff --git a/auxiliary/struct2xml/struct2xml.m b/matlab/auxiliary/struct2xml/struct2xml.m similarity index 100% rename from auxiliary/struct2xml/struct2xml.m rename to matlab/auxiliary/struct2xml/struct2xml.m diff --git a/auxiliary/structToHDF5Attribute.m b/matlab/auxiliary/structToHDF5Attribute.m similarity index 100% rename from auxiliary/structToHDF5Attribute.m rename to matlab/auxiliary/structToHDF5Attribute.m diff --git a/auxiliary/template.m b/matlab/auxiliary/template.m similarity index 100% rename from auxiliary/template.m rename to matlab/auxiliary/template.m diff --git a/auxiliary/xml2struct/license.txt b/matlab/auxiliary/xml2struct/license.txt similarity index 100% rename from auxiliary/xml2struct/license.txt rename to matlab/auxiliary/xml2struct/license.txt diff --git a/auxiliary/xml2struct/xml2struct.m b/matlab/auxiliary/xml2struct/xml2struct.m similarity index 100% rename from auxiliary/xml2struct/xml2struct.m rename to matlab/auxiliary/xml2struct/xml2struct.m diff --git a/examples/amiExamples.m b/matlab/examples/amiExamples.m similarity index 100% rename from examples/amiExamples.m rename to matlab/examples/amiExamples.m diff --git a/examples/example_adjoint/example_adjoint.m b/matlab/examples/example_adjoint/example_adjoint.m similarity index 100% rename from examples/example_adjoint/example_adjoint.m rename to matlab/examples/example_adjoint/example_adjoint.m diff --git a/examples/example_adjoint/html/example_adjoint.html b/matlab/examples/example_adjoint/html/example_adjoint.html similarity index 100% rename from examples/example_adjoint/html/example_adjoint.html rename to matlab/examples/example_adjoint/html/example_adjoint.html diff --git a/examples/example_adjoint/html/example_adjoint.png b/matlab/examples/example_adjoint/html/example_adjoint.png similarity index 100% rename from examples/example_adjoint/html/example_adjoint.png rename to matlab/examples/example_adjoint/html/example_adjoint.png diff --git a/examples/example_adjoint/html/example_adjoint.tex b/matlab/examples/example_adjoint/html/example_adjoint.tex similarity index 100% rename from examples/example_adjoint/html/example_adjoint.tex rename to matlab/examples/example_adjoint/html/example_adjoint.tex diff --git a/examples/example_adjoint/html/example_adjoint_01.png b/matlab/examples/example_adjoint/html/example_adjoint_01.png similarity index 100% rename from examples/example_adjoint/html/example_adjoint_01.png rename to matlab/examples/example_adjoint/html/example_adjoint_01.png diff --git a/examples/example_adjoint/html/example_adjoint_02.png b/matlab/examples/example_adjoint/html/example_adjoint_02.png similarity index 100% rename from examples/example_adjoint/html/example_adjoint_02.png rename to matlab/examples/example_adjoint/html/example_adjoint_02.png diff --git a/examples/example_adjoint/html/model_adjoint_syms.html b/matlab/examples/example_adjoint/html/model_adjoint_syms.html similarity index 100% rename from examples/example_adjoint/html/model_adjoint_syms.html rename to matlab/examples/example_adjoint/html/model_adjoint_syms.html diff --git a/examples/example_adjoint/html/model_adjoint_syms.tex b/matlab/examples/example_adjoint/html/model_adjoint_syms.tex similarity index 100% rename from examples/example_adjoint/html/model_adjoint_syms.tex rename to matlab/examples/example_adjoint/html/model_adjoint_syms.tex diff --git a/examples/example_adjoint/model_adjoint_syms.m b/matlab/examples/example_adjoint/model_adjoint_syms.m similarity index 100% rename from examples/example_adjoint/model_adjoint_syms.m rename to matlab/examples/example_adjoint/model_adjoint_syms.m diff --git a/examples/example_adjoint_hessian/example_adjoint_hessian.m b/matlab/examples/example_adjoint_hessian/example_adjoint_hessian.m similarity index 100% rename from examples/example_adjoint_hessian/example_adjoint_hessian.m rename to matlab/examples/example_adjoint_hessian/example_adjoint_hessian.m diff --git a/examples/example_adjoint_hessian/model_adjoint_hessian_syms.m b/matlab/examples/example_adjoint_hessian/model_adjoint_hessian_syms.m similarity index 100% rename from examples/example_adjoint_hessian/model_adjoint_hessian_syms.m rename to matlab/examples/example_adjoint_hessian/model_adjoint_hessian_syms.m diff --git a/examples/example_dirac/example_dirac.m b/matlab/examples/example_dirac/example_dirac.m similarity index 100% rename from examples/example_dirac/example_dirac.m rename to matlab/examples/example_dirac/example_dirac.m diff --git a/examples/example_dirac/html/example_dirac.html b/matlab/examples/example_dirac/html/example_dirac.html similarity index 100% rename from examples/example_dirac/html/example_dirac.html rename to matlab/examples/example_dirac/html/example_dirac.html diff --git a/examples/example_dirac/html/example_dirac.png b/matlab/examples/example_dirac/html/example_dirac.png similarity index 100% rename from examples/example_dirac/html/example_dirac.png rename to matlab/examples/example_dirac/html/example_dirac.png diff --git a/examples/example_dirac/html/example_dirac.tex b/matlab/examples/example_dirac/html/example_dirac.tex similarity index 100% rename from examples/example_dirac/html/example_dirac.tex rename to matlab/examples/example_dirac/html/example_dirac.tex diff --git a/examples/example_dirac/html/example_dirac_01.png b/matlab/examples/example_dirac/html/example_dirac_01.png similarity index 100% rename from examples/example_dirac/html/example_dirac_01.png rename to matlab/examples/example_dirac/html/example_dirac_01.png diff --git a/examples/example_dirac/html/example_dirac_02.png b/matlab/examples/example_dirac/html/example_dirac_02.png similarity index 100% rename from examples/example_dirac/html/example_dirac_02.png rename to matlab/examples/example_dirac/html/example_dirac_02.png diff --git a/examples/example_dirac/html/example_dirac_03.png b/matlab/examples/example_dirac/html/example_dirac_03.png similarity index 100% rename from examples/example_dirac/html/example_dirac_03.png rename to matlab/examples/example_dirac/html/example_dirac_03.png diff --git a/examples/example_dirac/html/model_dirac_syms.html b/matlab/examples/example_dirac/html/model_dirac_syms.html similarity index 100% rename from examples/example_dirac/html/model_dirac_syms.html rename to matlab/examples/example_dirac/html/model_dirac_syms.html diff --git a/examples/example_dirac/html/model_dirac_syms.tex b/matlab/examples/example_dirac/html/model_dirac_syms.tex similarity index 100% rename from examples/example_dirac/html/model_dirac_syms.tex rename to matlab/examples/example_dirac/html/model_dirac_syms.tex diff --git a/examples/example_dirac/model_dirac_syms.m b/matlab/examples/example_dirac/model_dirac_syms.m similarity index 100% rename from examples/example_dirac/model_dirac_syms.m rename to matlab/examples/example_dirac/model_dirac_syms.m diff --git a/examples/example_dirac_adjoint/example_dirac_adjoint.m b/matlab/examples/example_dirac_adjoint/example_dirac_adjoint.m similarity index 100% rename from examples/example_dirac_adjoint/example_dirac_adjoint.m rename to matlab/examples/example_dirac_adjoint/example_dirac_adjoint.m diff --git a/examples/example_dirac_adjoint/example_model_5_paper.m b/matlab/examples/example_dirac_adjoint/example_model_5_paper.m similarity index 100% rename from examples/example_dirac_adjoint/example_model_5_paper.m rename to matlab/examples/example_dirac_adjoint/example_model_5_paper.m diff --git a/examples/example_dirac_adjoint/html/example_dirac_adjoint.html b/matlab/examples/example_dirac_adjoint/html/example_dirac_adjoint.html similarity index 100% rename from examples/example_dirac_adjoint/html/example_dirac_adjoint.html rename to matlab/examples/example_dirac_adjoint/html/example_dirac_adjoint.html diff --git a/examples/example_dirac_adjoint/html/example_dirac_adjoint.png b/matlab/examples/example_dirac_adjoint/html/example_dirac_adjoint.png similarity index 100% rename from examples/example_dirac_adjoint/html/example_dirac_adjoint.png rename to matlab/examples/example_dirac_adjoint/html/example_dirac_adjoint.png diff --git a/examples/example_dirac_adjoint/html/example_dirac_adjoint.tex b/matlab/examples/example_dirac_adjoint/html/example_dirac_adjoint.tex similarity index 100% rename from examples/example_dirac_adjoint/html/example_dirac_adjoint.tex rename to matlab/examples/example_dirac_adjoint/html/example_dirac_adjoint.tex diff --git a/examples/example_dirac_adjoint/html/example_dirac_adjoint_01.png b/matlab/examples/example_dirac_adjoint/html/example_dirac_adjoint_01.png similarity index 100% rename from examples/example_dirac_adjoint/html/example_dirac_adjoint_01.png rename to matlab/examples/example_dirac_adjoint/html/example_dirac_adjoint_01.png diff --git a/examples/example_dirac_adjoint/html/example_dirac_adjoint_02.png b/matlab/examples/example_dirac_adjoint/html/example_dirac_adjoint_02.png similarity index 100% rename from examples/example_dirac_adjoint/html/example_dirac_adjoint_02.png rename to matlab/examples/example_dirac_adjoint/html/example_dirac_adjoint_02.png diff --git a/examples/example_dirac_adjoint/html/model_dirac_adjoint_syms.html b/matlab/examples/example_dirac_adjoint/html/model_dirac_adjoint_syms.html similarity index 100% rename from examples/example_dirac_adjoint/html/model_dirac_adjoint_syms.html rename to matlab/examples/example_dirac_adjoint/html/model_dirac_adjoint_syms.html diff --git a/examples/example_dirac_adjoint/html/model_dirac_adjoint_syms.tex b/matlab/examples/example_dirac_adjoint/html/model_dirac_adjoint_syms.tex similarity index 100% rename from examples/example_dirac_adjoint/html/model_dirac_adjoint_syms.tex rename to matlab/examples/example_dirac_adjoint/html/model_dirac_adjoint_syms.tex diff --git a/examples/example_dirac_adjoint/model_dirac_adjoint_syms.m b/matlab/examples/example_dirac_adjoint/model_dirac_adjoint_syms.m similarity index 100% rename from examples/example_dirac_adjoint/model_dirac_adjoint_syms.m rename to matlab/examples/example_dirac_adjoint/model_dirac_adjoint_syms.m diff --git a/examples/example_dirac_adjoint_hessVecProd/example_dirac_adjoint_hessVecProd.m b/matlab/examples/example_dirac_adjoint_hessVecProd/example_dirac_adjoint_hessVecProd.m similarity index 100% rename from examples/example_dirac_adjoint_hessVecProd/example_dirac_adjoint_hessVecProd.m rename to matlab/examples/example_dirac_adjoint_hessVecProd/example_dirac_adjoint_hessVecProd.m diff --git a/examples/example_dirac_adjoint_hessVecProd/model_dirac_adjoint_hessVecProd_syms.m b/matlab/examples/example_dirac_adjoint_hessVecProd/model_dirac_adjoint_hessVecProd_syms.m similarity index 100% rename from examples/example_dirac_adjoint_hessVecProd/model_dirac_adjoint_hessVecProd_syms.m rename to matlab/examples/example_dirac_adjoint_hessVecProd/model_dirac_adjoint_hessVecProd_syms.m diff --git a/examples/example_dirac_secondorder/example_dirac_secondorder.m b/matlab/examples/example_dirac_secondorder/example_dirac_secondorder.m similarity index 100% rename from examples/example_dirac_secondorder/example_dirac_secondorder.m rename to matlab/examples/example_dirac_secondorder/example_dirac_secondorder.m diff --git a/examples/example_dirac_secondorder/html/example_dirac_secondorder.html b/matlab/examples/example_dirac_secondorder/html/example_dirac_secondorder.html similarity index 100% rename from examples/example_dirac_secondorder/html/example_dirac_secondorder.html rename to matlab/examples/example_dirac_secondorder/html/example_dirac_secondorder.html diff --git a/examples/example_dirac_secondorder/html/example_dirac_secondorder.png b/matlab/examples/example_dirac_secondorder/html/example_dirac_secondorder.png similarity index 100% rename from examples/example_dirac_secondorder/html/example_dirac_secondorder.png rename to matlab/examples/example_dirac_secondorder/html/example_dirac_secondorder.png diff --git a/examples/example_dirac_secondorder/html/example_dirac_secondorder.tex b/matlab/examples/example_dirac_secondorder/html/example_dirac_secondorder.tex similarity index 100% rename from examples/example_dirac_secondorder/html/example_dirac_secondorder.tex rename to matlab/examples/example_dirac_secondorder/html/example_dirac_secondorder.tex diff --git a/examples/example_dirac_secondorder/html/example_dirac_secondorder_01.png b/matlab/examples/example_dirac_secondorder/html/example_dirac_secondorder_01.png similarity index 100% rename from examples/example_dirac_secondorder/html/example_dirac_secondorder_01.png rename to matlab/examples/example_dirac_secondorder/html/example_dirac_secondorder_01.png diff --git a/examples/example_dirac_secondorder/html/example_dirac_secondorder_02.png b/matlab/examples/example_dirac_secondorder/html/example_dirac_secondorder_02.png similarity index 100% rename from examples/example_dirac_secondorder/html/example_dirac_secondorder_02.png rename to matlab/examples/example_dirac_secondorder/html/example_dirac_secondorder_02.png diff --git a/examples/example_dirac_secondorder/html/model_dirac_secondorder_syms.html b/matlab/examples/example_dirac_secondorder/html/model_dirac_secondorder_syms.html similarity index 100% rename from examples/example_dirac_secondorder/html/model_dirac_secondorder_syms.html rename to matlab/examples/example_dirac_secondorder/html/model_dirac_secondorder_syms.html diff --git a/examples/example_dirac_secondorder/html/model_dirac_secondorder_syms.tex b/matlab/examples/example_dirac_secondorder/html/model_dirac_secondorder_syms.tex similarity index 100% rename from examples/example_dirac_secondorder/html/model_dirac_secondorder_syms.tex rename to matlab/examples/example_dirac_secondorder/html/model_dirac_secondorder_syms.tex diff --git a/examples/example_dirac_secondorder/model_dirac_secondorder_syms.m b/matlab/examples/example_dirac_secondorder/model_dirac_secondorder_syms.m similarity index 100% rename from examples/example_dirac_secondorder/model_dirac_secondorder_syms.m rename to matlab/examples/example_dirac_secondorder/model_dirac_secondorder_syms.m diff --git a/examples/example_dirac_secondorder_vectmult/example_dirac_secondorder_vectmult.m b/matlab/examples/example_dirac_secondorder_vectmult/example_dirac_secondorder_vectmult.m similarity index 100% rename from examples/example_dirac_secondorder_vectmult/example_dirac_secondorder_vectmult.m rename to matlab/examples/example_dirac_secondorder_vectmult/example_dirac_secondorder_vectmult.m diff --git a/examples/example_dirac_secondorder_vectmult/html/example_dirac_secondorder_vectmult.html b/matlab/examples/example_dirac_secondorder_vectmult/html/example_dirac_secondorder_vectmult.html similarity index 100% rename from examples/example_dirac_secondorder_vectmult/html/example_dirac_secondorder_vectmult.html rename to matlab/examples/example_dirac_secondorder_vectmult/html/example_dirac_secondorder_vectmult.html diff --git a/examples/example_dirac_secondorder_vectmult/html/example_dirac_secondorder_vectmult.png b/matlab/examples/example_dirac_secondorder_vectmult/html/example_dirac_secondorder_vectmult.png similarity index 100% rename from examples/example_dirac_secondorder_vectmult/html/example_dirac_secondorder_vectmult.png rename to matlab/examples/example_dirac_secondorder_vectmult/html/example_dirac_secondorder_vectmult.png diff --git a/examples/example_dirac_secondorder_vectmult/html/example_dirac_secondorder_vectmult.tex b/matlab/examples/example_dirac_secondorder_vectmult/html/example_dirac_secondorder_vectmult.tex similarity index 100% rename from examples/example_dirac_secondorder_vectmult/html/example_dirac_secondorder_vectmult.tex rename to matlab/examples/example_dirac_secondorder_vectmult/html/example_dirac_secondorder_vectmult.tex diff --git a/examples/example_dirac_secondorder_vectmult/html/example_dirac_secondorder_vectmult_01.png b/matlab/examples/example_dirac_secondorder_vectmult/html/example_dirac_secondorder_vectmult_01.png similarity index 100% rename from examples/example_dirac_secondorder_vectmult/html/example_dirac_secondorder_vectmult_01.png rename to matlab/examples/example_dirac_secondorder_vectmult/html/example_dirac_secondorder_vectmult_01.png diff --git a/examples/example_dirac_secondorder_vectmult/html/example_dirac_secondorder_vectmult_02.png b/matlab/examples/example_dirac_secondorder_vectmult/html/example_dirac_secondorder_vectmult_02.png similarity index 100% rename from examples/example_dirac_secondorder_vectmult/html/example_dirac_secondorder_vectmult_02.png rename to matlab/examples/example_dirac_secondorder_vectmult/html/example_dirac_secondorder_vectmult_02.png diff --git a/examples/example_dirac_secondorder_vectmult/html/model_dirac_secondorder_vectmult_syms.html b/matlab/examples/example_dirac_secondorder_vectmult/html/model_dirac_secondorder_vectmult_syms.html similarity index 100% rename from examples/example_dirac_secondorder_vectmult/html/model_dirac_secondorder_vectmult_syms.html rename to matlab/examples/example_dirac_secondorder_vectmult/html/model_dirac_secondorder_vectmult_syms.html diff --git a/examples/example_dirac_secondorder_vectmult/html/model_dirac_secondorder_vectmult_syms.tex b/matlab/examples/example_dirac_secondorder_vectmult/html/model_dirac_secondorder_vectmult_syms.tex similarity index 100% rename from examples/example_dirac_secondorder_vectmult/html/model_dirac_secondorder_vectmult_syms.tex rename to matlab/examples/example_dirac_secondorder_vectmult/html/model_dirac_secondorder_vectmult_syms.tex diff --git a/examples/example_dirac_secondorder_vectmult/model_dirac_secondorder_vectmult_syms.m b/matlab/examples/example_dirac_secondorder_vectmult/model_dirac_secondorder_vectmult_syms.m similarity index 100% rename from examples/example_dirac_secondorder_vectmult/model_dirac_secondorder_vectmult_syms.m rename to matlab/examples/example_dirac_secondorder_vectmult/model_dirac_secondorder_vectmult_syms.m diff --git a/examples/example_events/example_events.m b/matlab/examples/example_events/example_events.m similarity index 100% rename from examples/example_events/example_events.m rename to matlab/examples/example_events/example_events.m diff --git a/examples/example_events/html/example_events.html b/matlab/examples/example_events/html/example_events.html similarity index 100% rename from examples/example_events/html/example_events.html rename to matlab/examples/example_events/html/example_events.html diff --git a/examples/example_events/html/example_events.png b/matlab/examples/example_events/html/example_events.png similarity index 100% rename from examples/example_events/html/example_events.png rename to matlab/examples/example_events/html/example_events.png diff --git a/examples/example_events/html/example_events.tex b/matlab/examples/example_events/html/example_events.tex similarity index 100% rename from examples/example_events/html/example_events.tex rename to matlab/examples/example_events/html/example_events.tex diff --git a/examples/example_events/html/example_events_01.png b/matlab/examples/example_events/html/example_events_01.png similarity index 100% rename from examples/example_events/html/example_events_01.png rename to matlab/examples/example_events/html/example_events_01.png diff --git a/examples/example_events/html/example_events_02.png b/matlab/examples/example_events/html/example_events_02.png similarity index 100% rename from examples/example_events/html/example_events_02.png rename to matlab/examples/example_events/html/example_events_02.png diff --git a/examples/example_events/html/example_events_03.png b/matlab/examples/example_events/html/example_events_03.png similarity index 100% rename from examples/example_events/html/example_events_03.png rename to matlab/examples/example_events/html/example_events_03.png diff --git a/examples/example_events/html/example_events_04.png b/matlab/examples/example_events/html/example_events_04.png similarity index 100% rename from examples/example_events/html/example_events_04.png rename to matlab/examples/example_events/html/example_events_04.png diff --git a/examples/example_events/html/model_events_syms.html b/matlab/examples/example_events/html/model_events_syms.html similarity index 100% rename from examples/example_events/html/model_events_syms.html rename to matlab/examples/example_events/html/model_events_syms.html diff --git a/examples/example_events/html/model_events_syms.tex b/matlab/examples/example_events/html/model_events_syms.tex similarity index 100% rename from examples/example_events/html/model_events_syms.tex rename to matlab/examples/example_events/html/model_events_syms.tex diff --git a/examples/example_events/model_events_syms.m b/matlab/examples/example_events/model_events_syms.m similarity index 100% rename from examples/example_events/model_events_syms.m rename to matlab/examples/example_events/model_events_syms.m diff --git a/examples/example_jakstat_adjoint/example_jakstat_adjoint.m b/matlab/examples/example_jakstat_adjoint/example_jakstat_adjoint.m similarity index 100% rename from examples/example_jakstat_adjoint/example_jakstat_adjoint.m rename to matlab/examples/example_jakstat_adjoint/example_jakstat_adjoint.m diff --git a/examples/example_jakstat_adjoint/html/example_jakstat_adjoint.html b/matlab/examples/example_jakstat_adjoint/html/example_jakstat_adjoint.html similarity index 100% rename from examples/example_jakstat_adjoint/html/example_jakstat_adjoint.html rename to matlab/examples/example_jakstat_adjoint/html/example_jakstat_adjoint.html diff --git a/examples/example_jakstat_adjoint/html/example_jakstat_adjoint.png b/matlab/examples/example_jakstat_adjoint/html/example_jakstat_adjoint.png similarity index 100% rename from examples/example_jakstat_adjoint/html/example_jakstat_adjoint.png rename to matlab/examples/example_jakstat_adjoint/html/example_jakstat_adjoint.png diff --git a/examples/example_jakstat_adjoint/html/example_jakstat_adjoint.tex b/matlab/examples/example_jakstat_adjoint/html/example_jakstat_adjoint.tex similarity index 100% rename from examples/example_jakstat_adjoint/html/example_jakstat_adjoint.tex rename to matlab/examples/example_jakstat_adjoint/html/example_jakstat_adjoint.tex diff --git a/examples/example_jakstat_adjoint/html/example_jakstat_adjoint_01.png b/matlab/examples/example_jakstat_adjoint/html/example_jakstat_adjoint_01.png similarity index 100% rename from examples/example_jakstat_adjoint/html/example_jakstat_adjoint_01.png rename to matlab/examples/example_jakstat_adjoint/html/example_jakstat_adjoint_01.png diff --git a/examples/example_jakstat_adjoint/html/example_jakstat_adjoint_02.png b/matlab/examples/example_jakstat_adjoint/html/example_jakstat_adjoint_02.png similarity index 100% rename from examples/example_jakstat_adjoint/html/example_jakstat_adjoint_02.png rename to matlab/examples/example_jakstat_adjoint/html/example_jakstat_adjoint_02.png diff --git a/examples/example_jakstat_adjoint/html/model_jakstat_adjoint_syms.html b/matlab/examples/example_jakstat_adjoint/html/model_jakstat_adjoint_syms.html similarity index 100% rename from examples/example_jakstat_adjoint/html/model_jakstat_adjoint_syms.html rename to matlab/examples/example_jakstat_adjoint/html/model_jakstat_adjoint_syms.html diff --git a/examples/example_jakstat_adjoint/html/model_jakstat_adjoint_syms.tex b/matlab/examples/example_jakstat_adjoint/html/model_jakstat_adjoint_syms.tex similarity index 100% rename from examples/example_jakstat_adjoint/html/model_jakstat_adjoint_syms.tex rename to matlab/examples/example_jakstat_adjoint/html/model_jakstat_adjoint_syms.tex diff --git a/examples/example_jakstat_adjoint/model_jakstat_adjoint_syms.m b/matlab/examples/example_jakstat_adjoint/model_jakstat_adjoint_syms.m similarity index 100% rename from examples/example_jakstat_adjoint/model_jakstat_adjoint_syms.m rename to matlab/examples/example_jakstat_adjoint/model_jakstat_adjoint_syms.m diff --git a/examples/example_jakstat_adjoint/pnas_data_original.xls b/matlab/examples/example_jakstat_adjoint/pnas_data_original.xls similarity index 100% rename from examples/example_jakstat_adjoint/pnas_data_original.xls rename to matlab/examples/example_jakstat_adjoint/pnas_data_original.xls diff --git a/examples/example_jakstat_adjoint_hvp/example_jakstat_adjoint_hvp.m b/matlab/examples/example_jakstat_adjoint_hvp/example_jakstat_adjoint_hvp.m similarity index 100% rename from examples/example_jakstat_adjoint_hvp/example_jakstat_adjoint_hvp.m rename to matlab/examples/example_jakstat_adjoint_hvp/example_jakstat_adjoint_hvp.m diff --git a/examples/example_jakstat_adjoint_hvp/model_jakstat_adjoint_hvp_syms.m b/matlab/examples/example_jakstat_adjoint_hvp/model_jakstat_adjoint_hvp_syms.m similarity index 100% rename from examples/example_jakstat_adjoint_hvp/model_jakstat_adjoint_hvp_syms.m rename to matlab/examples/example_jakstat_adjoint_hvp/model_jakstat_adjoint_hvp_syms.m diff --git a/examples/example_jakstat_adjoint_hvp/pnas_data_original.xls b/matlab/examples/example_jakstat_adjoint_hvp/pnas_data_original.xls similarity index 100% rename from examples/example_jakstat_adjoint_hvp/pnas_data_original.xls rename to matlab/examples/example_jakstat_adjoint_hvp/pnas_data_original.xls diff --git a/examples/example_nested_events/example_nested_events.m b/matlab/examples/example_nested_events/example_nested_events.m similarity index 100% rename from examples/example_nested_events/example_nested_events.m rename to matlab/examples/example_nested_events/example_nested_events.m diff --git a/examples/example_nested_events/model_nested_events_syms.m b/matlab/examples/example_nested_events/model_nested_events_syms.m similarity index 100% rename from examples/example_nested_events/model_nested_events_syms.m rename to matlab/examples/example_nested_events/model_nested_events_syms.m diff --git a/examples/example_neuron/example_neuron.m b/matlab/examples/example_neuron/example_neuron.m similarity index 100% rename from examples/example_neuron/example_neuron.m rename to matlab/examples/example_neuron/example_neuron.m diff --git a/examples/example_neuron/model_neuron_syms.m b/matlab/examples/example_neuron/model_neuron_syms.m similarity index 100% rename from examples/example_neuron/model_neuron_syms.m rename to matlab/examples/example_neuron/model_neuron_syms.m diff --git a/examples/example_robertson/example_robertson.m b/matlab/examples/example_robertson/example_robertson.m similarity index 100% rename from examples/example_robertson/example_robertson.m rename to matlab/examples/example_robertson/example_robertson.m diff --git a/examples/example_robertson/model_robertson_syms.m b/matlab/examples/example_robertson/model_robertson_syms.m similarity index 100% rename from examples/example_robertson/model_robertson_syms.m rename to matlab/examples/example_robertson/model_robertson_syms.m diff --git a/examples/example_steadystate/example_steadystate.m b/matlab/examples/example_steadystate/example_steadystate.m similarity index 100% rename from examples/example_steadystate/example_steadystate.m rename to matlab/examples/example_steadystate/example_steadystate.m diff --git a/examples/example_steadystate/html/example_steadystate.html b/matlab/examples/example_steadystate/html/example_steadystate.html similarity index 100% rename from examples/example_steadystate/html/example_steadystate.html rename to matlab/examples/example_steadystate/html/example_steadystate.html diff --git a/examples/example_steadystate/html/example_steadystate.png b/matlab/examples/example_steadystate/html/example_steadystate.png similarity index 100% rename from examples/example_steadystate/html/example_steadystate.png rename to matlab/examples/example_steadystate/html/example_steadystate.png diff --git a/examples/example_steadystate/html/example_steadystate.tex b/matlab/examples/example_steadystate/html/example_steadystate.tex similarity index 100% rename from examples/example_steadystate/html/example_steadystate.tex rename to matlab/examples/example_steadystate/html/example_steadystate.tex diff --git a/examples/example_steadystate/html/example_steadystate_01.png b/matlab/examples/example_steadystate/html/example_steadystate_01.png similarity index 100% rename from examples/example_steadystate/html/example_steadystate_01.png rename to matlab/examples/example_steadystate/html/example_steadystate_01.png diff --git a/examples/example_steadystate/html/example_steadystate_02.png b/matlab/examples/example_steadystate/html/example_steadystate_02.png similarity index 100% rename from examples/example_steadystate/html/example_steadystate_02.png rename to matlab/examples/example_steadystate/html/example_steadystate_02.png diff --git a/examples/example_steadystate/html/example_steadystate_03.png b/matlab/examples/example_steadystate/html/example_steadystate_03.png similarity index 100% rename from examples/example_steadystate/html/example_steadystate_03.png rename to matlab/examples/example_steadystate/html/example_steadystate_03.png diff --git a/examples/example_steadystate/html/example_steadystate_04.png b/matlab/examples/example_steadystate/html/example_steadystate_04.png similarity index 100% rename from examples/example_steadystate/html/example_steadystate_04.png rename to matlab/examples/example_steadystate/html/example_steadystate_04.png diff --git a/examples/example_steadystate/html/model_steadystate_syms.html b/matlab/examples/example_steadystate/html/model_steadystate_syms.html similarity index 100% rename from examples/example_steadystate/html/model_steadystate_syms.html rename to matlab/examples/example_steadystate/html/model_steadystate_syms.html diff --git a/examples/example_steadystate/html/model_steadystate_syms.tex b/matlab/examples/example_steadystate/html/model_steadystate_syms.tex similarity index 100% rename from examples/example_steadystate/html/model_steadystate_syms.tex rename to matlab/examples/example_steadystate/html/model_steadystate_syms.tex diff --git a/examples/example_steadystate/model_steadystate_syms.m b/matlab/examples/example_steadystate/model_steadystate_syms.m similarity index 100% rename from examples/example_steadystate/model_steadystate_syms.m rename to matlab/examples/example_steadystate/model_steadystate_syms.m diff --git a/installAMICI.m b/matlab/installAMICI.m similarity index 100% rename from installAMICI.m rename to matlab/installAMICI.m diff --git a/mtoc/MatlabDocMaker.m b/matlab/mtoc/MatlabDocMaker.m similarity index 100% rename from mtoc/MatlabDocMaker.m rename to matlab/mtoc/MatlabDocMaker.m diff --git a/mtoc/config/Doxyfile.template b/matlab/mtoc/config/Doxyfile.template similarity index 99% rename from mtoc/config/Doxyfile.template rename to matlab/mtoc/config/Doxyfile.template index 8406520c87..f0956921d2 100644 --- a/mtoc/config/Doxyfile.template +++ b/matlab/mtoc/config/Doxyfile.template @@ -669,17 +669,10 @@ RECURSIVE = YES # excluded from the INPUT source files. This way you can easily exclude a # subdirectory from a directory tree whose root is specified with the INPUT tag. -EXCLUDE = "sundials" \ - "scripts" \ - "SuiteSparse" \ - "ThirdParty" \ - "models" \ - "examples" \ - "mtoc" \ - "auxiliary" \ - "README.md" \ +EXCLUDE = "README.md" \ "src/solver_cvodes.cpp" \ "src/solver_idas.cpp" \ + "src/wrapfunctions.ODE_template.h" \ "include/amici/solver_cvodes.h" \ "include/amici/solver_idas.h" @@ -695,7 +688,15 @@ EXCLUDE_SYMLINKS = YES # against the file with absolute path, so to exclude all test directories # for example use the pattern */test/* -EXCLUDE_PATTERNS = +EXCLUDE_PATTERNS = "_SourceDir_/models/*" \ + "_SourceDir_/tests/*" \ + "_SourceDir_/scripts/*" \ + "_SourceDir_/ThirdParty/*" \ + "_SourceDir_/matlab/examples/*" \ + "_SourceDir_/matlab/mtoc/*" \ + "_SourceDir_/matlab/auxiliary/*" \ + "_SourceDir_/python/test/*" \ + "_SourceDir_/build" # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names # (namespaces, classes, functions, etc.) that should be excluded from the @@ -1649,7 +1650,7 @@ MSCFILE_DIRS = # DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note # that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. -DOT_GRAPH_MAX_NODES = 60 +DOT_GRAPH_MAX_NODES = 100 # The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the # graphs generated by dot. A depth value of 3 means that only nodes reachable diff --git a/mtoc/config/developers.c b/matlab/mtoc/config/developers.c similarity index 100% rename from mtoc/config/developers.c rename to matlab/mtoc/config/developers.c diff --git a/mtoc/config/latexextras.template b/matlab/mtoc/config/latexextras.template similarity index 100% rename from mtoc/config/latexextras.template rename to matlab/mtoc/config/latexextras.template diff --git a/mtoc/config/mtocpp b/matlab/mtoc/config/mtocpp similarity index 100% rename from mtoc/config/mtocpp rename to matlab/mtoc/config/mtocpp diff --git a/mtoc/config/mtocpp.conf b/matlab/mtoc/config/mtocpp.conf similarity index 100% rename from mtoc/config/mtocpp.conf rename to matlab/mtoc/config/mtocpp.conf diff --git a/mtoc/config/mtocpp_post b/matlab/mtoc/config/mtocpp_post similarity index 100% rename from mtoc/config/mtocpp_post rename to matlab/mtoc/config/mtocpp_post diff --git a/mtoc/makeDocumentation.m b/matlab/mtoc/makeDocumentation.m similarity index 100% rename from mtoc/makeDocumentation.m rename to matlab/mtoc/makeDocumentation.m diff --git a/mtoc/makeExampleDoc.m b/matlab/mtoc/makeExampleDoc.m similarity index 100% rename from mtoc/makeExampleDoc.m rename to matlab/mtoc/makeExampleDoc.m diff --git a/symbolic/am_and.m b/matlab/symbolic/am_and.m similarity index 100% rename from symbolic/am_and.m rename to matlab/symbolic/am_and.m diff --git a/symbolic/am_eq.m b/matlab/symbolic/am_eq.m similarity index 100% rename from symbolic/am_eq.m rename to matlab/symbolic/am_eq.m diff --git a/symbolic/am_ge.m b/matlab/symbolic/am_ge.m similarity index 100% rename from symbolic/am_ge.m rename to matlab/symbolic/am_ge.m diff --git a/symbolic/am_gt.m b/matlab/symbolic/am_gt.m similarity index 100% rename from symbolic/am_gt.m rename to matlab/symbolic/am_gt.m diff --git a/symbolic/am_if.m b/matlab/symbolic/am_if.m similarity index 100% rename from symbolic/am_if.m rename to matlab/symbolic/am_if.m diff --git a/symbolic/am_le.m b/matlab/symbolic/am_le.m similarity index 100% rename from symbolic/am_le.m rename to matlab/symbolic/am_le.m diff --git a/symbolic/am_lt.m b/matlab/symbolic/am_lt.m similarity index 100% rename from symbolic/am_lt.m rename to matlab/symbolic/am_lt.m diff --git a/symbolic/am_max.m b/matlab/symbolic/am_max.m similarity index 100% rename from symbolic/am_max.m rename to matlab/symbolic/am_max.m diff --git a/symbolic/am_min.m b/matlab/symbolic/am_min.m similarity index 100% rename from symbolic/am_min.m rename to matlab/symbolic/am_min.m diff --git a/symbolic/am_or.m b/matlab/symbolic/am_or.m similarity index 100% rename from symbolic/am_or.m rename to matlab/symbolic/am_or.m diff --git a/symbolic/am_piecewise.m b/matlab/symbolic/am_piecewise.m similarity index 100% rename from symbolic/am_piecewise.m rename to matlab/symbolic/am_piecewise.m diff --git a/symbolic/am_spline.m b/matlab/symbolic/am_spline.m similarity index 100% rename from symbolic/am_spline.m rename to matlab/symbolic/am_spline.m diff --git a/symbolic/am_spline_pos.m b/matlab/symbolic/am_spline_pos.m similarity index 100% rename from symbolic/am_spline_pos.m rename to matlab/symbolic/am_spline_pos.m diff --git a/symbolic/am_stepfun.m b/matlab/symbolic/am_stepfun.m similarity index 100% rename from symbolic/am_stepfun.m rename to matlab/symbolic/am_stepfun.m diff --git a/symbolic/am_xor.m b/matlab/symbolic/am_xor.m similarity index 100% rename from symbolic/am_xor.m rename to matlab/symbolic/am_xor.m diff --git a/models/model_dirac/CMakeLists.txt b/models/model_dirac/CMakeLists.txt index bd3ffba359..15f31fba9e 100644 --- a/models/model_dirac/CMakeLists.txt +++ b/models/model_dirac/CMakeLists.txt @@ -1,5 +1,7 @@ project(model_dirac) +set(CMAKE_POSITION_INDEPENDENT_CODE ON) + cmake_minimum_required(VERSION 2.8) set(CMAKE_CXX_STANDARD 11) @@ -16,12 +18,8 @@ foreach(FLAG ${MY_CXX_FLAGS}) endforeach(FLAG) find_package(Amici HINTS ${CMAKE_CURRENT_LIST_DIR}/../../build) -get_property(AmiciConfigIncludes TARGET Upstream::amici PROPERTY INCLUDE_DIRECTORIES) - -set(MODEL_DIR "${Amici_DIR}/../models/model_dirac") -include_directories("${CMAKE_CURRENT_SOURCE_DIR}") -include_directories(${AmiciConfigIncludes}) +set(MODEL_DIR ${CMAKE_CURRENT_LIST_DIR}) set(SRC_LIST_LIB ${MODEL_DIR}/model_dirac_J.cpp ${MODEL_DIR}/model_dirac_JB.cpp @@ -48,20 +46,41 @@ ${MODEL_DIR}/model_dirac_y.cpp ${MODEL_DIR}/wrapfunctions.cpp ) - + add_library(${PROJECT_NAME} ${SRC_LIST_LIB}) +add_library(model ALIAS ${PROJECT_NAME}) + +target_include_directories(${PROJECT_NAME} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}") -target_link_libraries( - ${PROJECT_NAME} - Upstream::amici +target_link_libraries(${PROJECT_NAME} + PUBLIC Upstream::amici ) set(SRC_LIST_EXE main.cpp) add_executable(simulate_${PROJECT_NAME} ${SRC_LIST_EXE}) -target_link_libraries(simulate_${PROJECT_NAME} ${PROJECT_NAME} Upstream::amici) +target_link_libraries(simulate_${PROJECT_NAME} ${PROJECT_NAME}) if($ENV{ENABLE_GCOV_COVERAGE}) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 --coverage") endif() + +## SWIG + +add_subdirectory(swig) + +# +include(GNUInstallDirs) +install(TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}Targets + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} +) +export(EXPORT ${PROJECT_NAME}Targets FILE ${PROJECT_NAME}Config.cmake + NAMESPACE Upstream:: + ) +# + diff --git a/models/model_dirac/swig/CMakeLists.txt b/models/model_dirac/swig/CMakeLists.txt new file mode 100644 index 0000000000..3e22a79b95 --- /dev/null +++ b/models/model_dirac/swig/CMakeLists.txt @@ -0,0 +1,26 @@ +find_package(SWIG REQUIRED) +include(${SWIG_USE_FILE}) + +FIND_PACKAGE(PythonLibs REQUIRED) +INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH}) + +SET(CMAKE_SWIG_FLAGS "") +SET_SOURCE_FILES_PROPERTIES(${PROJECT_NAME}.i PROPERTIES CPLUSPLUS ON) + +# swig does not use INTERFACE_INCLUDE_DIRS of linked libraries, so add manually +get_target_property(AMICI_INCLUDE_DIRS Upstream::amici INTERFACE_INCLUDE_DIRECTORIES) +include_directories(${AMICI_INCLUDE_DIRS} ..) + +SWIG_ADD_LIBRARY(${PROJECT_NAME} MODULE LANGUAGE python SOURCES ${PROJECT_NAME}.i) + +SWIG_LINK_LIBRARIES(${PROJECT_NAME} + ${PYTHON_LIBRARIES} + model) + +# configure module setup script +SET(SETUP_PY_IN ${Amici_DIR}/model_setup.template.py) +SET(SETUP_PY_OUT ${CMAKE_CURRENT_BINARY_DIR}/setup.py) + +add_custom_target(install-python + DEPENDS _${PROJECT_NAME} + COMMAND python ${SETUP_PY_OUT} install) diff --git a/models/model_dirac/swig/model_dirac.i b/models/model_dirac/swig/model_dirac.i new file mode 100644 index 0000000000..908c43b490 --- /dev/null +++ b/models/model_dirac/swig/model_dirac.i @@ -0,0 +1,14 @@ +%module model_dirac +%import amici.i +// Add necessary symbols to generated header + +%{ +#include "wrapfunctions.h" +#include "amici/model_ode.h" +#include "amici/model_dae.h" +using namespace amici; +%} + + +// Process symbols in header +%include "wrapfunctions.h" diff --git a/models/model_dirac/wrapfunctions.h b/models/model_dirac/wrapfunctions.h index a342736932..60ffb17fe4 100644 --- a/models/model_dirac/wrapfunctions.h +++ b/models/model_dirac/wrapfunctions.h @@ -1,6 +1,6 @@ #ifndef _amici_wrapfunctions_h #define _amici_wrapfunctions_h -/* Generated by AMICI 7e4e208f6b779f504c7f6213008012ff6006f710 */ +/* Generated by AMICI */ #include #include #include "amici/defines.h" @@ -62,8 +62,8 @@ class Model_model_dirac : public amici::Model_ODE { 0, 1, amici::AMICI_O2MODE_NONE, - std::vector(4), - std::vector(0), + std::vector(4,1.0), + std::vector(0,1.0), std::vector(), std::vector{0, 0}, std::vector{}) diff --git a/models/model_events/CMakeLists.txt b/models/model_events/CMakeLists.txt index 850bd66795..1faf522528 100644 --- a/models/model_events/CMakeLists.txt +++ b/models/model_events/CMakeLists.txt @@ -1,5 +1,7 @@ project(model_events) +set(CMAKE_POSITION_INDEPENDENT_CODE ON) + cmake_minimum_required(VERSION 2.8) set(CMAKE_CXX_STANDARD 11) @@ -16,12 +18,8 @@ foreach(FLAG ${MY_CXX_FLAGS}) endforeach(FLAG) find_package(Amici HINTS ${CMAKE_CURRENT_LIST_DIR}/../../build) -get_property(AmiciConfigIncludes TARGET Upstream::amici PROPERTY INCLUDE_DIRECTORIES) - -set(MODEL_DIR "${Amici_DIR}/../models/model_events") -include_directories("${CMAKE_CURRENT_SOURCE_DIR}") -include_directories(${AmiciConfigIncludes}) +set(MODEL_DIR ${CMAKE_CURRENT_LIST_DIR}) set(SRC_LIST_LIB ${MODEL_DIR}/model_events_J.cpp ${MODEL_DIR}/model_events_JB.cpp @@ -62,20 +60,41 @@ ${MODEL_DIR}/model_events_z.cpp ${MODEL_DIR}/wrapfunctions.cpp ) - + add_library(${PROJECT_NAME} ${SRC_LIST_LIB}) +add_library(model ALIAS ${PROJECT_NAME}) + +target_include_directories(${PROJECT_NAME} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}") -target_link_libraries( - ${PROJECT_NAME} - Upstream::amici +target_link_libraries(${PROJECT_NAME} + PUBLIC Upstream::amici ) set(SRC_LIST_EXE main.cpp) add_executable(simulate_${PROJECT_NAME} ${SRC_LIST_EXE}) -target_link_libraries(simulate_${PROJECT_NAME} ${PROJECT_NAME} Upstream::amici) +target_link_libraries(simulate_${PROJECT_NAME} ${PROJECT_NAME}) if($ENV{ENABLE_GCOV_COVERAGE}) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 --coverage") endif() + +## SWIG + +add_subdirectory(swig) + +# +include(GNUInstallDirs) +install(TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}Targets + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} +) +export(EXPORT ${PROJECT_NAME}Targets FILE ${PROJECT_NAME}Config.cmake + NAMESPACE Upstream:: + ) +# + diff --git a/models/model_events/swig/CMakeLists.txt b/models/model_events/swig/CMakeLists.txt new file mode 100644 index 0000000000..3e22a79b95 --- /dev/null +++ b/models/model_events/swig/CMakeLists.txt @@ -0,0 +1,26 @@ +find_package(SWIG REQUIRED) +include(${SWIG_USE_FILE}) + +FIND_PACKAGE(PythonLibs REQUIRED) +INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH}) + +SET(CMAKE_SWIG_FLAGS "") +SET_SOURCE_FILES_PROPERTIES(${PROJECT_NAME}.i PROPERTIES CPLUSPLUS ON) + +# swig does not use INTERFACE_INCLUDE_DIRS of linked libraries, so add manually +get_target_property(AMICI_INCLUDE_DIRS Upstream::amici INTERFACE_INCLUDE_DIRECTORIES) +include_directories(${AMICI_INCLUDE_DIRS} ..) + +SWIG_ADD_LIBRARY(${PROJECT_NAME} MODULE LANGUAGE python SOURCES ${PROJECT_NAME}.i) + +SWIG_LINK_LIBRARIES(${PROJECT_NAME} + ${PYTHON_LIBRARIES} + model) + +# configure module setup script +SET(SETUP_PY_IN ${Amici_DIR}/model_setup.template.py) +SET(SETUP_PY_OUT ${CMAKE_CURRENT_BINARY_DIR}/setup.py) + +add_custom_target(install-python + DEPENDS _${PROJECT_NAME} + COMMAND python ${SETUP_PY_OUT} install) diff --git a/models/model_events/swig/model_events.i b/models/model_events/swig/model_events.i new file mode 100644 index 0000000000..e62e99d55f --- /dev/null +++ b/models/model_events/swig/model_events.i @@ -0,0 +1,14 @@ +%module model_events +%import amici.i +// Add necessary symbols to generated header + +%{ +#include "wrapfunctions.h" +#include "amici/model_ode.h" +#include "amici/model_dae.h" +using namespace amici; +%} + + +// Process symbols in header +%include "wrapfunctions.h" diff --git a/models/model_events/wrapfunctions.h b/models/model_events/wrapfunctions.h index 81d49efd78..ec77d2a4ee 100644 --- a/models/model_events/wrapfunctions.h +++ b/models/model_events/wrapfunctions.h @@ -1,6 +1,6 @@ #ifndef _amici_wrapfunctions_h #define _amici_wrapfunctions_h -/* Generated by AMICI 7e4e208f6b779f504c7f6213008012ff6006f710 */ +/* Generated by AMICI */ #include #include #include "amici/defines.h" @@ -76,8 +76,8 @@ class Model_model_events : public amici::Model_ODE { 0, 1, amici::AMICI_O2MODE_NONE, - std::vector(4), - std::vector(4), + std::vector(4,1.0), + std::vector(4,1.0), std::vector(), std::vector{0, 0, 0}, std::vector{1, 2}) diff --git a/models/model_jakstat_adjoint/CMakeLists.txt b/models/model_jakstat_adjoint/CMakeLists.txt index 8a510c0fa5..df9e761bc2 100644 --- a/models/model_jakstat_adjoint/CMakeLists.txt +++ b/models/model_jakstat_adjoint/CMakeLists.txt @@ -1,5 +1,7 @@ project(model_jakstat_adjoint) +set(CMAKE_POSITION_INDEPENDENT_CODE ON) + cmake_minimum_required(VERSION 2.8) set(CMAKE_CXX_STANDARD 11) @@ -16,12 +18,8 @@ foreach(FLAG ${MY_CXX_FLAGS}) endforeach(FLAG) find_package(Amici HINTS ${CMAKE_CURRENT_LIST_DIR}/../../build) -get_property(AmiciConfigIncludes TARGET Upstream::amici PROPERTY INCLUDE_DIRECTORIES) - -set(MODEL_DIR "${Amici_DIR}/../models/model_jakstat_adjoint") -include_directories("${CMAKE_CURRENT_SOURCE_DIR}") -include_directories(${AmiciConfigIncludes}) +set(MODEL_DIR ${CMAKE_CURRENT_LIST_DIR}) set(SRC_LIST_LIB ${MODEL_DIR}/model_jakstat_adjoint_J.cpp ${MODEL_DIR}/model_jakstat_adjoint_JB.cpp @@ -51,20 +49,41 @@ ${MODEL_DIR}/model_jakstat_adjoint_y.cpp ${MODEL_DIR}/wrapfunctions.cpp ) - + add_library(${PROJECT_NAME} ${SRC_LIST_LIB}) +add_library(model ALIAS ${PROJECT_NAME}) + +target_include_directories(${PROJECT_NAME} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}") -target_link_libraries( - ${PROJECT_NAME} - Upstream::amici +target_link_libraries(${PROJECT_NAME} + PUBLIC Upstream::amici ) set(SRC_LIST_EXE main.cpp) add_executable(simulate_${PROJECT_NAME} ${SRC_LIST_EXE}) -target_link_libraries(simulate_${PROJECT_NAME} ${PROJECT_NAME} Upstream::amici) +target_link_libraries(simulate_${PROJECT_NAME} ${PROJECT_NAME}) if($ENV{ENABLE_GCOV_COVERAGE}) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 --coverage") endif() + +## SWIG + +add_subdirectory(swig) + +# +include(GNUInstallDirs) +install(TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}Targets + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} +) +export(EXPORT ${PROJECT_NAME}Targets FILE ${PROJECT_NAME}Config.cmake + NAMESPACE Upstream:: + ) +# + diff --git a/models/model_jakstat_adjoint/swig/CMakeLists.txt b/models/model_jakstat_adjoint/swig/CMakeLists.txt new file mode 100644 index 0000000000..3e22a79b95 --- /dev/null +++ b/models/model_jakstat_adjoint/swig/CMakeLists.txt @@ -0,0 +1,26 @@ +find_package(SWIG REQUIRED) +include(${SWIG_USE_FILE}) + +FIND_PACKAGE(PythonLibs REQUIRED) +INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH}) + +SET(CMAKE_SWIG_FLAGS "") +SET_SOURCE_FILES_PROPERTIES(${PROJECT_NAME}.i PROPERTIES CPLUSPLUS ON) + +# swig does not use INTERFACE_INCLUDE_DIRS of linked libraries, so add manually +get_target_property(AMICI_INCLUDE_DIRS Upstream::amici INTERFACE_INCLUDE_DIRECTORIES) +include_directories(${AMICI_INCLUDE_DIRS} ..) + +SWIG_ADD_LIBRARY(${PROJECT_NAME} MODULE LANGUAGE python SOURCES ${PROJECT_NAME}.i) + +SWIG_LINK_LIBRARIES(${PROJECT_NAME} + ${PYTHON_LIBRARIES} + model) + +# configure module setup script +SET(SETUP_PY_IN ${Amici_DIR}/model_setup.template.py) +SET(SETUP_PY_OUT ${CMAKE_CURRENT_BINARY_DIR}/setup.py) + +add_custom_target(install-python + DEPENDS _${PROJECT_NAME} + COMMAND python ${SETUP_PY_OUT} install) diff --git a/models/model_jakstat_adjoint/swig/model_jakstat_adjoint.i b/models/model_jakstat_adjoint/swig/model_jakstat_adjoint.i new file mode 100644 index 0000000000..3f0f1374fe --- /dev/null +++ b/models/model_jakstat_adjoint/swig/model_jakstat_adjoint.i @@ -0,0 +1,14 @@ +%module model_jakstat_adjoint +%import amici.i +// Add necessary symbols to generated header + +%{ +#include "wrapfunctions.h" +#include "amici/model_ode.h" +#include "amici/model_dae.h" +using namespace amici; +%} + + +// Process symbols in header +%include "wrapfunctions.h" diff --git a/models/model_jakstat_adjoint/wrapfunctions.h b/models/model_jakstat_adjoint/wrapfunctions.h index c8fc7b136b..0d6e58699b 100644 --- a/models/model_jakstat_adjoint/wrapfunctions.h +++ b/models/model_jakstat_adjoint/wrapfunctions.h @@ -1,6 +1,6 @@ #ifndef _amici_wrapfunctions_h #define _amici_wrapfunctions_h -/* Generated by AMICI 7e4e208f6b779f504c7f6213008012ff6006f710 */ +/* Generated by AMICI */ #include #include #include "amici/defines.h" @@ -65,8 +65,8 @@ class Model_model_jakstat_adjoint : public amici::Model_ODE { 8, 1, amici::AMICI_O2MODE_NONE, - std::vector(17), - std::vector(2), + std::vector(17,1.0), + std::vector(2,1.0), std::vector(), std::vector{0, 0, 0, 0, 0, 0, 0, 0, 0}, std::vector{}) diff --git a/models/model_jakstat_adjoint_o2/CMakeLists.txt b/models/model_jakstat_adjoint_o2/CMakeLists.txt index 28b3478d12..bf1493dbc4 100644 --- a/models/model_jakstat_adjoint_o2/CMakeLists.txt +++ b/models/model_jakstat_adjoint_o2/CMakeLists.txt @@ -1,5 +1,7 @@ project(model_jakstat_adjoint_o2) +set(CMAKE_POSITION_INDEPENDENT_CODE ON) + cmake_minimum_required(VERSION 2.8) set(CMAKE_CXX_STANDARD 11) @@ -16,12 +18,8 @@ foreach(FLAG ${MY_CXX_FLAGS}) endforeach(FLAG) find_package(Amici HINTS ${CMAKE_CURRENT_LIST_DIR}/../../build) -get_property(AmiciConfigIncludes TARGET Upstream::amici PROPERTY INCLUDE_DIRECTORIES) - -set(MODEL_DIR "${Amici_DIR}/../models/model_jakstat_adjoint_o2") -include_directories("${CMAKE_CURRENT_SOURCE_DIR}") -include_directories(${AmiciConfigIncludes}) +set(MODEL_DIR ${CMAKE_CURRENT_LIST_DIR}) set(SRC_LIST_LIB ${MODEL_DIR}/model_jakstat_adjoint_o2_J.cpp ${MODEL_DIR}/model_jakstat_adjoint_o2_JB.cpp @@ -51,20 +49,41 @@ ${MODEL_DIR}/model_jakstat_adjoint_o2_y.cpp ${MODEL_DIR}/wrapfunctions.cpp ) - + add_library(${PROJECT_NAME} ${SRC_LIST_LIB}) +add_library(model ALIAS ${PROJECT_NAME}) + +target_include_directories(${PROJECT_NAME} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}") -target_link_libraries( - ${PROJECT_NAME} - Upstream::amici +target_link_libraries(${PROJECT_NAME} + PUBLIC Upstream::amici ) set(SRC_LIST_EXE main.cpp) add_executable(simulate_${PROJECT_NAME} ${SRC_LIST_EXE}) -target_link_libraries(simulate_${PROJECT_NAME} ${PROJECT_NAME} Upstream::amici) +target_link_libraries(simulate_${PROJECT_NAME} ${PROJECT_NAME}) if($ENV{ENABLE_GCOV_COVERAGE}) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 --coverage") endif() + +## SWIG + +add_subdirectory(swig) + +# +include(GNUInstallDirs) +install(TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}Targets + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} +) +export(EXPORT ${PROJECT_NAME}Targets FILE ${PROJECT_NAME}Config.cmake + NAMESPACE Upstream:: + ) +# + diff --git a/models/model_jakstat_adjoint_o2/swig/CMakeLists.txt b/models/model_jakstat_adjoint_o2/swig/CMakeLists.txt new file mode 100644 index 0000000000..3e22a79b95 --- /dev/null +++ b/models/model_jakstat_adjoint_o2/swig/CMakeLists.txt @@ -0,0 +1,26 @@ +find_package(SWIG REQUIRED) +include(${SWIG_USE_FILE}) + +FIND_PACKAGE(PythonLibs REQUIRED) +INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH}) + +SET(CMAKE_SWIG_FLAGS "") +SET_SOURCE_FILES_PROPERTIES(${PROJECT_NAME}.i PROPERTIES CPLUSPLUS ON) + +# swig does not use INTERFACE_INCLUDE_DIRS of linked libraries, so add manually +get_target_property(AMICI_INCLUDE_DIRS Upstream::amici INTERFACE_INCLUDE_DIRECTORIES) +include_directories(${AMICI_INCLUDE_DIRS} ..) + +SWIG_ADD_LIBRARY(${PROJECT_NAME} MODULE LANGUAGE python SOURCES ${PROJECT_NAME}.i) + +SWIG_LINK_LIBRARIES(${PROJECT_NAME} + ${PYTHON_LIBRARIES} + model) + +# configure module setup script +SET(SETUP_PY_IN ${Amici_DIR}/model_setup.template.py) +SET(SETUP_PY_OUT ${CMAKE_CURRENT_BINARY_DIR}/setup.py) + +add_custom_target(install-python + DEPENDS _${PROJECT_NAME} + COMMAND python ${SETUP_PY_OUT} install) diff --git a/models/model_jakstat_adjoint_o2/swig/model_jakstat_adjoint_o2.i b/models/model_jakstat_adjoint_o2/swig/model_jakstat_adjoint_o2.i new file mode 100644 index 0000000000..97b5161c84 --- /dev/null +++ b/models/model_jakstat_adjoint_o2/swig/model_jakstat_adjoint_o2.i @@ -0,0 +1,14 @@ +%module model_jakstat_adjoint_o2 +%import amici.i +// Add necessary symbols to generated header + +%{ +#include "wrapfunctions.h" +#include "amici/model_ode.h" +#include "amici/model_dae.h" +using namespace amici; +%} + + +// Process symbols in header +%include "wrapfunctions.h" diff --git a/models/model_jakstat_adjoint_o2/wrapfunctions.h b/models/model_jakstat_adjoint_o2/wrapfunctions.h index 5c9a1469a2..e08acce6f6 100644 --- a/models/model_jakstat_adjoint_o2/wrapfunctions.h +++ b/models/model_jakstat_adjoint_o2/wrapfunctions.h @@ -1,6 +1,6 @@ #ifndef _amici_wrapfunctions_h #define _amici_wrapfunctions_h -/* Generated by AMICI 7e4e208f6b779f504c7f6213008012ff6006f710 */ +/* Generated by AMICI */ #include #include #include "amici/defines.h" @@ -65,8 +65,8 @@ class Model_model_jakstat_adjoint_o2 : public amici::Model_ODE { 8, 154, amici::AMICI_O2MODE_FULL, - std::vector(17), - std::vector(2), + std::vector(17,1.0), + std::vector(2,1.0), std::vector(), std::vector{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, std::vector{}) diff --git a/models/model_nested_events/CMakeLists.txt b/models/model_nested_events/CMakeLists.txt index 3456720084..b93bbbee8a 100644 --- a/models/model_nested_events/CMakeLists.txt +++ b/models/model_nested_events/CMakeLists.txt @@ -1,5 +1,7 @@ project(model_nested_events) +set(CMAKE_POSITION_INDEPENDENT_CODE ON) + cmake_minimum_required(VERSION 2.8) set(CMAKE_CXX_STANDARD 11) @@ -16,12 +18,8 @@ foreach(FLAG ${MY_CXX_FLAGS}) endforeach(FLAG) find_package(Amici HINTS ${CMAKE_CURRENT_LIST_DIR}/../../build) -get_property(AmiciConfigIncludes TARGET Upstream::amici PROPERTY INCLUDE_DIRECTORIES) - -set(MODEL_DIR "${Amici_DIR}/../models/model_nested_events") -include_directories("${CMAKE_CURRENT_SOURCE_DIR}") -include_directories(${AmiciConfigIncludes}) +set(MODEL_DIR ${CMAKE_CURRENT_LIST_DIR}) set(SRC_LIST_LIB ${MODEL_DIR}/model_nested_events_J.cpp ${MODEL_DIR}/model_nested_events_JB.cpp @@ -51,20 +49,41 @@ ${MODEL_DIR}/model_nested_events_y.cpp ${MODEL_DIR}/wrapfunctions.cpp ) - + add_library(${PROJECT_NAME} ${SRC_LIST_LIB}) +add_library(model ALIAS ${PROJECT_NAME}) + +target_include_directories(${PROJECT_NAME} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}") -target_link_libraries( - ${PROJECT_NAME} - Upstream::amici +target_link_libraries(${PROJECT_NAME} + PUBLIC Upstream::amici ) set(SRC_LIST_EXE main.cpp) add_executable(simulate_${PROJECT_NAME} ${SRC_LIST_EXE}) -target_link_libraries(simulate_${PROJECT_NAME} ${PROJECT_NAME} Upstream::amici) +target_link_libraries(simulate_${PROJECT_NAME} ${PROJECT_NAME}) if($ENV{ENABLE_GCOV_COVERAGE}) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 --coverage") endif() + +## SWIG + +add_subdirectory(swig) + +# +include(GNUInstallDirs) +install(TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}Targets + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} +) +export(EXPORT ${PROJECT_NAME}Targets FILE ${PROJECT_NAME}Config.cmake + NAMESPACE Upstream:: + ) +# + diff --git a/models/model_nested_events/swig/CMakeLists.txt b/models/model_nested_events/swig/CMakeLists.txt new file mode 100644 index 0000000000..3e22a79b95 --- /dev/null +++ b/models/model_nested_events/swig/CMakeLists.txt @@ -0,0 +1,26 @@ +find_package(SWIG REQUIRED) +include(${SWIG_USE_FILE}) + +FIND_PACKAGE(PythonLibs REQUIRED) +INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH}) + +SET(CMAKE_SWIG_FLAGS "") +SET_SOURCE_FILES_PROPERTIES(${PROJECT_NAME}.i PROPERTIES CPLUSPLUS ON) + +# swig does not use INTERFACE_INCLUDE_DIRS of linked libraries, so add manually +get_target_property(AMICI_INCLUDE_DIRS Upstream::amici INTERFACE_INCLUDE_DIRECTORIES) +include_directories(${AMICI_INCLUDE_DIRS} ..) + +SWIG_ADD_LIBRARY(${PROJECT_NAME} MODULE LANGUAGE python SOURCES ${PROJECT_NAME}.i) + +SWIG_LINK_LIBRARIES(${PROJECT_NAME} + ${PYTHON_LIBRARIES} + model) + +# configure module setup script +SET(SETUP_PY_IN ${Amici_DIR}/model_setup.template.py) +SET(SETUP_PY_OUT ${CMAKE_CURRENT_BINARY_DIR}/setup.py) + +add_custom_target(install-python + DEPENDS _${PROJECT_NAME} + COMMAND python ${SETUP_PY_OUT} install) diff --git a/models/model_nested_events/swig/model_nested_events.i b/models/model_nested_events/swig/model_nested_events.i new file mode 100644 index 0000000000..3c12b36d5f --- /dev/null +++ b/models/model_nested_events/swig/model_nested_events.i @@ -0,0 +1,14 @@ +%module model_nested_events +%import amici.i +// Add necessary symbols to generated header + +%{ +#include "wrapfunctions.h" +#include "amici/model_ode.h" +#include "amici/model_dae.h" +using namespace amici; +%} + + +// Process symbols in header +%include "wrapfunctions.h" diff --git a/models/model_nested_events/wrapfunctions.h b/models/model_nested_events/wrapfunctions.h index d138067ff3..c1a852ade5 100644 --- a/models/model_nested_events/wrapfunctions.h +++ b/models/model_nested_events/wrapfunctions.h @@ -1,6 +1,6 @@ #ifndef _amici_wrapfunctions_h #define _amici_wrapfunctions_h -/* Generated by AMICI 7e4e208f6b779f504c7f6213008012ff6006f710 */ +/* Generated by AMICI */ #include #include #include "amici/defines.h" @@ -65,8 +65,8 @@ class Model_model_nested_events : public amici::Model_ODE { 0, 0, amici::AMICI_O2MODE_NONE, - std::vector(5), - std::vector(0), + std::vector(5,1.0), + std::vector(0,1.0), std::vector(), std::vector{0}, std::vector{}) diff --git a/models/model_neuron/CMakeLists.txt b/models/model_neuron/CMakeLists.txt index e570026d29..68127be87b 100644 --- a/models/model_neuron/CMakeLists.txt +++ b/models/model_neuron/CMakeLists.txt @@ -1,5 +1,7 @@ project(model_neuron) +set(CMAKE_POSITION_INDEPENDENT_CODE ON) + cmake_minimum_required(VERSION 2.8) set(CMAKE_CXX_STANDARD 11) @@ -16,12 +18,8 @@ foreach(FLAG ${MY_CXX_FLAGS}) endforeach(FLAG) find_package(Amici HINTS ${CMAKE_CURRENT_LIST_DIR}/../../build) -get_property(AmiciConfigIncludes TARGET Upstream::amici PROPERTY INCLUDE_DIRECTORIES) - -set(MODEL_DIR "${Amici_DIR}/../models/model_neuron") -include_directories("${CMAKE_CURRENT_SOURCE_DIR}") -include_directories(${AmiciConfigIncludes}) +set(MODEL_DIR ${CMAKE_CURRENT_LIST_DIR}) set(SRC_LIST_LIB ${MODEL_DIR}/model_neuron_J.cpp ${MODEL_DIR}/model_neuron_JB.cpp @@ -65,20 +63,41 @@ ${MODEL_DIR}/model_neuron_z.cpp ${MODEL_DIR}/wrapfunctions.cpp ) - + add_library(${PROJECT_NAME} ${SRC_LIST_LIB}) +add_library(model ALIAS ${PROJECT_NAME}) + +target_include_directories(${PROJECT_NAME} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}") -target_link_libraries( - ${PROJECT_NAME} - Upstream::amici +target_link_libraries(${PROJECT_NAME} + PUBLIC Upstream::amici ) set(SRC_LIST_EXE main.cpp) add_executable(simulate_${PROJECT_NAME} ${SRC_LIST_EXE}) -target_link_libraries(simulate_${PROJECT_NAME} ${PROJECT_NAME} Upstream::amici) +target_link_libraries(simulate_${PROJECT_NAME} ${PROJECT_NAME}) if($ENV{ENABLE_GCOV_COVERAGE}) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 --coverage") endif() + +## SWIG + +add_subdirectory(swig) + +# +include(GNUInstallDirs) +install(TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}Targets + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} +) +export(EXPORT ${PROJECT_NAME}Targets FILE ${PROJECT_NAME}Config.cmake + NAMESPACE Upstream:: + ) +# + diff --git a/models/model_neuron/swig/CMakeLists.txt b/models/model_neuron/swig/CMakeLists.txt new file mode 100644 index 0000000000..3e22a79b95 --- /dev/null +++ b/models/model_neuron/swig/CMakeLists.txt @@ -0,0 +1,26 @@ +find_package(SWIG REQUIRED) +include(${SWIG_USE_FILE}) + +FIND_PACKAGE(PythonLibs REQUIRED) +INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH}) + +SET(CMAKE_SWIG_FLAGS "") +SET_SOURCE_FILES_PROPERTIES(${PROJECT_NAME}.i PROPERTIES CPLUSPLUS ON) + +# swig does not use INTERFACE_INCLUDE_DIRS of linked libraries, so add manually +get_target_property(AMICI_INCLUDE_DIRS Upstream::amici INTERFACE_INCLUDE_DIRECTORIES) +include_directories(${AMICI_INCLUDE_DIRS} ..) + +SWIG_ADD_LIBRARY(${PROJECT_NAME} MODULE LANGUAGE python SOURCES ${PROJECT_NAME}.i) + +SWIG_LINK_LIBRARIES(${PROJECT_NAME} + ${PYTHON_LIBRARIES} + model) + +# configure module setup script +SET(SETUP_PY_IN ${Amici_DIR}/model_setup.template.py) +SET(SETUP_PY_OUT ${CMAKE_CURRENT_BINARY_DIR}/setup.py) + +add_custom_target(install-python + DEPENDS _${PROJECT_NAME} + COMMAND python ${SETUP_PY_OUT} install) diff --git a/models/model_neuron/swig/model_neuron.i b/models/model_neuron/swig/model_neuron.i new file mode 100644 index 0000000000..4511c79a44 --- /dev/null +++ b/models/model_neuron/swig/model_neuron.i @@ -0,0 +1,14 @@ +%module model_neuron +%import amici.i +// Add necessary symbols to generated header + +%{ +#include "wrapfunctions.h" +#include "amici/model_ode.h" +#include "amici/model_dae.h" +using namespace amici; +%} + + +// Process symbols in header +%include "wrapfunctions.h" diff --git a/models/model_neuron/wrapfunctions.h b/models/model_neuron/wrapfunctions.h index b99ab64dd9..e025099812 100644 --- a/models/model_neuron/wrapfunctions.h +++ b/models/model_neuron/wrapfunctions.h @@ -1,6 +1,6 @@ #ifndef _amici_wrapfunctions_h #define _amici_wrapfunctions_h -/* Generated by AMICI 7e4e208f6b779f504c7f6213008012ff6006f710 */ +/* Generated by AMICI */ #include #include #include "amici/defines.h" @@ -79,8 +79,8 @@ class Model_model_neuron : public amici::Model_ODE { 1, 1, amici::AMICI_O2MODE_NONE, - std::vector(4), - std::vector(2), + std::vector(4,1.0), + std::vector(2,1.0), std::vector(), std::vector{0, 0}, std::vector{1}) diff --git a/models/model_neuron_o2/CMakeLists.txt b/models/model_neuron_o2/CMakeLists.txt index 1bda3094a9..c9581f030e 100644 --- a/models/model_neuron_o2/CMakeLists.txt +++ b/models/model_neuron_o2/CMakeLists.txt @@ -1,5 +1,7 @@ project(model_neuron_o2) +set(CMAKE_POSITION_INDEPENDENT_CODE ON) + cmake_minimum_required(VERSION 2.8) set(CMAKE_CXX_STANDARD 11) @@ -16,12 +18,8 @@ foreach(FLAG ${MY_CXX_FLAGS}) endforeach(FLAG) find_package(Amici HINTS ${CMAKE_CURRENT_LIST_DIR}/../../build) -get_property(AmiciConfigIncludes TARGET Upstream::amici PROPERTY INCLUDE_DIRECTORIES) - -set(MODEL_DIR "${Amici_DIR}/../models/model_neuron_o2") -include_directories("${CMAKE_CURRENT_SOURCE_DIR}") -include_directories(${AmiciConfigIncludes}) +set(MODEL_DIR ${CMAKE_CURRENT_LIST_DIR}) set(SRC_LIST_LIB ${MODEL_DIR}/model_neuron_o2_J.cpp ${MODEL_DIR}/model_neuron_o2_JB.cpp @@ -67,20 +65,41 @@ ${MODEL_DIR}/model_neuron_o2_z.cpp ${MODEL_DIR}/wrapfunctions.cpp ) - + add_library(${PROJECT_NAME} ${SRC_LIST_LIB}) +add_library(model ALIAS ${PROJECT_NAME}) + +target_include_directories(${PROJECT_NAME} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}") -target_link_libraries( - ${PROJECT_NAME} - Upstream::amici +target_link_libraries(${PROJECT_NAME} + PUBLIC Upstream::amici ) set(SRC_LIST_EXE main.cpp) add_executable(simulate_${PROJECT_NAME} ${SRC_LIST_EXE}) -target_link_libraries(simulate_${PROJECT_NAME} ${PROJECT_NAME} Upstream::amici) +target_link_libraries(simulate_${PROJECT_NAME} ${PROJECT_NAME}) if($ENV{ENABLE_GCOV_COVERAGE}) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 --coverage") endif() + +## SWIG + +add_subdirectory(swig) + +# +include(GNUInstallDirs) +install(TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}Targets + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} +) +export(EXPORT ${PROJECT_NAME}Targets FILE ${PROJECT_NAME}Config.cmake + NAMESPACE Upstream:: + ) +# + diff --git a/models/model_neuron_o2/swig/CMakeLists.txt b/models/model_neuron_o2/swig/CMakeLists.txt new file mode 100644 index 0000000000..3e22a79b95 --- /dev/null +++ b/models/model_neuron_o2/swig/CMakeLists.txt @@ -0,0 +1,26 @@ +find_package(SWIG REQUIRED) +include(${SWIG_USE_FILE}) + +FIND_PACKAGE(PythonLibs REQUIRED) +INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH}) + +SET(CMAKE_SWIG_FLAGS "") +SET_SOURCE_FILES_PROPERTIES(${PROJECT_NAME}.i PROPERTIES CPLUSPLUS ON) + +# swig does not use INTERFACE_INCLUDE_DIRS of linked libraries, so add manually +get_target_property(AMICI_INCLUDE_DIRS Upstream::amici INTERFACE_INCLUDE_DIRECTORIES) +include_directories(${AMICI_INCLUDE_DIRS} ..) + +SWIG_ADD_LIBRARY(${PROJECT_NAME} MODULE LANGUAGE python SOURCES ${PROJECT_NAME}.i) + +SWIG_LINK_LIBRARIES(${PROJECT_NAME} + ${PYTHON_LIBRARIES} + model) + +# configure module setup script +SET(SETUP_PY_IN ${Amici_DIR}/model_setup.template.py) +SET(SETUP_PY_OUT ${CMAKE_CURRENT_BINARY_DIR}/setup.py) + +add_custom_target(install-python + DEPENDS _${PROJECT_NAME} + COMMAND python ${SETUP_PY_OUT} install) diff --git a/models/model_neuron_o2/swig/model_neuron_o2.i b/models/model_neuron_o2/swig/model_neuron_o2.i new file mode 100644 index 0000000000..978b2ffb14 --- /dev/null +++ b/models/model_neuron_o2/swig/model_neuron_o2.i @@ -0,0 +1,14 @@ +%module model_neuron_o2 +%import amici.i +// Add necessary symbols to generated header + +%{ +#include "wrapfunctions.h" +#include "amici/model_ode.h" +#include "amici/model_dae.h" +using namespace amici; +%} + + +// Process symbols in header +%include "wrapfunctions.h" diff --git a/models/model_neuron_o2/wrapfunctions.h b/models/model_neuron_o2/wrapfunctions.h index 0cc0761df0..ad0e12b5ab 100644 --- a/models/model_neuron_o2/wrapfunctions.h +++ b/models/model_neuron_o2/wrapfunctions.h @@ -1,6 +1,6 @@ #ifndef _amici_wrapfunctions_h #define _amici_wrapfunctions_h -/* Generated by AMICI 7e4e208f6b779f504c7f6213008012ff6006f710 */ +/* Generated by AMICI */ #include #include #include "amici/defines.h" @@ -81,8 +81,8 @@ class Model_model_neuron_o2 : public amici::Model_ODE { 1, 8, amici::AMICI_O2MODE_FULL, - std::vector(4), - std::vector(2), + std::vector(4,1.0), + std::vector(2,1.0), std::vector(), std::vector{0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, std::vector{1, 1, 1, 1, 1}) diff --git a/models/model_robertson/CMakeLists.txt b/models/model_robertson/CMakeLists.txt index ae0cafac44..c56f4d1149 100644 --- a/models/model_robertson/CMakeLists.txt +++ b/models/model_robertson/CMakeLists.txt @@ -1,5 +1,7 @@ project(model_robertson) +set(CMAKE_POSITION_INDEPENDENT_CODE ON) + cmake_minimum_required(VERSION 2.8) set(CMAKE_CXX_STANDARD 11) @@ -16,12 +18,8 @@ foreach(FLAG ${MY_CXX_FLAGS}) endforeach(FLAG) find_package(Amici HINTS ${CMAKE_CURRENT_LIST_DIR}/../../build) -get_property(AmiciConfigIncludes TARGET Upstream::amici PROPERTY INCLUDE_DIRECTORIES) - -set(MODEL_DIR "${Amici_DIR}/../models/model_robertson") -include_directories("${CMAKE_CURRENT_SOURCE_DIR}") -include_directories(${AmiciConfigIncludes}) +set(MODEL_DIR ${CMAKE_CURRENT_LIST_DIR}) set(SRC_LIST_LIB ${MODEL_DIR}/model_robertson_J.cpp ${MODEL_DIR}/model_robertson_JB.cpp @@ -49,20 +47,41 @@ ${MODEL_DIR}/model_robertson_y.cpp ${MODEL_DIR}/wrapfunctions.cpp ) - + add_library(${PROJECT_NAME} ${SRC_LIST_LIB}) +add_library(model ALIAS ${PROJECT_NAME}) + +target_include_directories(${PROJECT_NAME} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}") -target_link_libraries( - ${PROJECT_NAME} - Upstream::amici +target_link_libraries(${PROJECT_NAME} + PUBLIC Upstream::amici ) set(SRC_LIST_EXE main.cpp) add_executable(simulate_${PROJECT_NAME} ${SRC_LIST_EXE}) -target_link_libraries(simulate_${PROJECT_NAME} ${PROJECT_NAME} Upstream::amici) +target_link_libraries(simulate_${PROJECT_NAME} ${PROJECT_NAME}) if($ENV{ENABLE_GCOV_COVERAGE}) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 --coverage") endif() + +## SWIG + +add_subdirectory(swig) + +# +include(GNUInstallDirs) +install(TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}Targets + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} +) +export(EXPORT ${PROJECT_NAME}Targets FILE ${PROJECT_NAME}Config.cmake + NAMESPACE Upstream:: + ) +# + diff --git a/models/model_robertson/swig/CMakeLists.txt b/models/model_robertson/swig/CMakeLists.txt new file mode 100644 index 0000000000..3e22a79b95 --- /dev/null +++ b/models/model_robertson/swig/CMakeLists.txt @@ -0,0 +1,26 @@ +find_package(SWIG REQUIRED) +include(${SWIG_USE_FILE}) + +FIND_PACKAGE(PythonLibs REQUIRED) +INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH}) + +SET(CMAKE_SWIG_FLAGS "") +SET_SOURCE_FILES_PROPERTIES(${PROJECT_NAME}.i PROPERTIES CPLUSPLUS ON) + +# swig does not use INTERFACE_INCLUDE_DIRS of linked libraries, so add manually +get_target_property(AMICI_INCLUDE_DIRS Upstream::amici INTERFACE_INCLUDE_DIRECTORIES) +include_directories(${AMICI_INCLUDE_DIRS} ..) + +SWIG_ADD_LIBRARY(${PROJECT_NAME} MODULE LANGUAGE python SOURCES ${PROJECT_NAME}.i) + +SWIG_LINK_LIBRARIES(${PROJECT_NAME} + ${PYTHON_LIBRARIES} + model) + +# configure module setup script +SET(SETUP_PY_IN ${Amici_DIR}/model_setup.template.py) +SET(SETUP_PY_OUT ${CMAKE_CURRENT_BINARY_DIR}/setup.py) + +add_custom_target(install-python + DEPENDS _${PROJECT_NAME} + COMMAND python ${SETUP_PY_OUT} install) diff --git a/models/model_robertson/swig/model_robertson.i b/models/model_robertson/swig/model_robertson.i new file mode 100644 index 0000000000..1027282a23 --- /dev/null +++ b/models/model_robertson/swig/model_robertson.i @@ -0,0 +1,14 @@ +%module model_robertson +%import amici.i +// Add necessary symbols to generated header + +%{ +#include "wrapfunctions.h" +#include "amici/model_ode.h" +#include "amici/model_dae.h" +using namespace amici; +%} + + +// Process symbols in header +%include "wrapfunctions.h" diff --git a/models/model_robertson/wrapfunctions.h b/models/model_robertson/wrapfunctions.h index cdf3f590c0..7e0346380e 100644 --- a/models/model_robertson/wrapfunctions.h +++ b/models/model_robertson/wrapfunctions.h @@ -1,6 +1,6 @@ #ifndef _amici_wrapfunctions_h #define _amici_wrapfunctions_h -/* Generated by AMICI 7e4e208f6b779f504c7f6213008012ff6006f710 */ +/* Generated by AMICI */ #include #include #include "amici/defines.h" @@ -63,8 +63,8 @@ class Model_model_robertson : public amici::Model_DAE { 2, 2, amici::AMICI_O2MODE_NONE, - std::vector(3), - std::vector(1), + std::vector(3,1.0), + std::vector(1,1.0), std::vector(), std::vector{1, 1, 0}, std::vector{}) diff --git a/models/model_steadystate/CMakeLists.txt b/models/model_steadystate/CMakeLists.txt index 0240d8dd38..61f403ca60 100644 --- a/models/model_steadystate/CMakeLists.txt +++ b/models/model_steadystate/CMakeLists.txt @@ -1,5 +1,7 @@ project(model_steadystate) +set(CMAKE_POSITION_INDEPENDENT_CODE ON) + cmake_minimum_required(VERSION 2.8) set(CMAKE_CXX_STANDARD 11) @@ -16,12 +18,8 @@ foreach(FLAG ${MY_CXX_FLAGS}) endforeach(FLAG) find_package(Amici HINTS ${CMAKE_CURRENT_LIST_DIR}/../../build) -get_property(AmiciConfigIncludes TARGET Upstream::amici PROPERTY INCLUDE_DIRECTORIES) - -set(MODEL_DIR "${Amici_DIR}/../models/model_steadystate") -include_directories("${CMAKE_CURRENT_SOURCE_DIR}") -include_directories(${AmiciConfigIncludes}) +set(MODEL_DIR ${CMAKE_CURRENT_LIST_DIR}) set(SRC_LIST_LIB ${MODEL_DIR}/model_steadystate_J.cpp ${MODEL_DIR}/model_steadystate_JB.cpp @@ -48,20 +46,41 @@ ${MODEL_DIR}/model_steadystate_y.cpp ${MODEL_DIR}/wrapfunctions.cpp ) - + add_library(${PROJECT_NAME} ${SRC_LIST_LIB}) +add_library(model ALIAS ${PROJECT_NAME}) + +target_include_directories(${PROJECT_NAME} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}") -target_link_libraries( - ${PROJECT_NAME} - Upstream::amici +target_link_libraries(${PROJECT_NAME} + PUBLIC Upstream::amici ) set(SRC_LIST_EXE main.cpp) add_executable(simulate_${PROJECT_NAME} ${SRC_LIST_EXE}) -target_link_libraries(simulate_${PROJECT_NAME} ${PROJECT_NAME} Upstream::amici) +target_link_libraries(simulate_${PROJECT_NAME} ${PROJECT_NAME}) if($ENV{ENABLE_GCOV_COVERAGE}) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 --coverage") endif() + +## SWIG + +add_subdirectory(swig) + +# +include(GNUInstallDirs) +install(TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}Targets + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} +) +export(EXPORT ${PROJECT_NAME}Targets FILE ${PROJECT_NAME}Config.cmake + NAMESPACE Upstream:: + ) +# + diff --git a/models/model_steadystate/swig/CMakeLists.txt b/models/model_steadystate/swig/CMakeLists.txt new file mode 100644 index 0000000000..3e22a79b95 --- /dev/null +++ b/models/model_steadystate/swig/CMakeLists.txt @@ -0,0 +1,26 @@ +find_package(SWIG REQUIRED) +include(${SWIG_USE_FILE}) + +FIND_PACKAGE(PythonLibs REQUIRED) +INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH}) + +SET(CMAKE_SWIG_FLAGS "") +SET_SOURCE_FILES_PROPERTIES(${PROJECT_NAME}.i PROPERTIES CPLUSPLUS ON) + +# swig does not use INTERFACE_INCLUDE_DIRS of linked libraries, so add manually +get_target_property(AMICI_INCLUDE_DIRS Upstream::amici INTERFACE_INCLUDE_DIRECTORIES) +include_directories(${AMICI_INCLUDE_DIRS} ..) + +SWIG_ADD_LIBRARY(${PROJECT_NAME} MODULE LANGUAGE python SOURCES ${PROJECT_NAME}.i) + +SWIG_LINK_LIBRARIES(${PROJECT_NAME} + ${PYTHON_LIBRARIES} + model) + +# configure module setup script +SET(SETUP_PY_IN ${Amici_DIR}/model_setup.template.py) +SET(SETUP_PY_OUT ${CMAKE_CURRENT_BINARY_DIR}/setup.py) + +add_custom_target(install-python + DEPENDS _${PROJECT_NAME} + COMMAND python ${SETUP_PY_OUT} install) diff --git a/models/model_steadystate/swig/model_steadystate.i b/models/model_steadystate/swig/model_steadystate.i new file mode 100644 index 0000000000..f8f6865dac --- /dev/null +++ b/models/model_steadystate/swig/model_steadystate.i @@ -0,0 +1,14 @@ +%module model_steadystate +%import amici.i +// Add necessary symbols to generated header + +%{ +#include "wrapfunctions.h" +#include "amici/model_ode.h" +#include "amici/model_dae.h" +using namespace amici; +%} + + +// Process symbols in header +%include "wrapfunctions.h" diff --git a/models/model_steadystate/wrapfunctions.h b/models/model_steadystate/wrapfunctions.h index 452e900e0c..df4489b03f 100644 --- a/models/model_steadystate/wrapfunctions.h +++ b/models/model_steadystate/wrapfunctions.h @@ -1,6 +1,6 @@ #ifndef _amici_wrapfunctions_h #define _amici_wrapfunctions_h -/* Generated by AMICI 4bc7cd2a972300a9064305c7713378fae209b017 */ +/* Generated by AMICI */ #include #include #include "amici/defines.h" @@ -62,8 +62,8 @@ class Model_model_steadystate : public amici::Model_ODE { 2, 2, amici::AMICI_O2MODE_NONE, - std::vector(5), - std::vector(4), + std::vector(5,1.0), + std::vector(4,1.0), std::vector(), std::vector{0, 0, 0}, std::vector{}) diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt new file mode 100644 index 0000000000..3f218da684 --- /dev/null +++ b/python/CMakeLists.txt @@ -0,0 +1,59 @@ +find_package(PythonInterp 3.6 REQUIRED) + +# Configure setup.py and copy to output directory +set(AMICI_VERSION "@AMICI_VERSION@") # to be replaced later +SET(SETUP_PY_IN ${CMAKE_CURRENT_SOURCE_DIR}/setup.py.in) +SET(SETUP_PY_OUT ${CMAKE_CURRENT_BINARY_DIR}/setup.py) +CONFIGURE_FILE(${SETUP_PY_IN} ${SETUP_PY_OUT}) + +CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/python/amici/setup.template.py ${CMAKE_CURRENT_BINARY_DIR}/setup.template.py) + +# Copy further amici-python-module files to binary_dir +add_custom_target(python-module-files + DEPENDS always_rebuild + COMMENT "Preparing python module directory" + COMMAND ${CMAKE_COMMAND} -D SRC=${CMAKE_CURRENT_BINARY_DIR}/setup.py + -D DST=${CMAKE_CURRENT_BINARY_DIR}/setup.py + -P ${PROJECT_SOURCE_DIR}/cmake/configureVersion.cmake + COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_CURRENT_BINARY_DIR}/amici + COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/amici + COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_SOURCE_DIR}/python/amici ${CMAKE_CURRENT_BINARY_DIR}/amici + COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_SOURCE_DIR}/src ${CMAKE_CURRENT_BINARY_DIR}/amici/src + COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_SOURCE_DIR}/include ${CMAKE_CURRENT_BINARY_DIR}/amici/include + COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_SOURCE_DIR}/swig ${CMAKE_CURRENT_BINARY_DIR}/amici/swig + COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_SOURCE_DIR}/ThirdParty ${CMAKE_CURRENT_BINARY_DIR}/amici/ThirdParty + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/setup.template.py ${CMAKE_CURRENT_BINARY_DIR}/amici/setup.template.py + COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/README.md ${CMAKE_CURRENT_BINARY_DIR}/ + COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/amici/libs/ + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_BINARY_DIR}/libamici.a" ${CMAKE_CURRENT_BINARY_DIR}/amici/libs/ + COMMAND ${CMAKE_COMMAND} -E copy "${PROJECT_SOURCE_DIR}/ThirdParty/sundials/build/lib/libsundials_nvecserial.a" ${CMAKE_CURRENT_BINARY_DIR}/amici/libs/ + COMMAND ${CMAKE_COMMAND} -E copy "${PROJECT_SOURCE_DIR}/ThirdParty/sundials/build/lib/libsundials_cvodes.a" ${CMAKE_CURRENT_BINARY_DIR}/amici/libs/ + COMMAND ${CMAKE_COMMAND} -E copy "${PROJECT_SOURCE_DIR}/ThirdParty/sundials/build/lib/libsundials_idas.a" ${CMAKE_CURRENT_BINARY_DIR}/amici/libs/ + COMMAND ${CMAKE_COMMAND} -E copy "${PROJECT_SOURCE_DIR}/ThirdParty/SuiteSparse/KLU/Lib/libklu.a" ${CMAKE_CURRENT_BINARY_DIR}/amici/libs/ + COMMAND ${CMAKE_COMMAND} -E copy "${PROJECT_SOURCE_DIR}/ThirdParty/SuiteSparse/COLAMD/Lib/libcolamd.a" ${CMAKE_CURRENT_BINARY_DIR}/amici/libs/ + COMMAND ${CMAKE_COMMAND} -E copy "${PROJECT_SOURCE_DIR}/ThirdParty/SuiteSparse/BTF/Lib/libbtf.a" ${CMAKE_CURRENT_BINARY_DIR}/amici/libs/ + COMMAND ${CMAKE_COMMAND} -E copy "${PROJECT_SOURCE_DIR}/ThirdParty/SuiteSparse/AMD/Lib/libamd.a" ${CMAKE_CURRENT_BINARY_DIR}/amici/libs/ + COMMAND ${CMAKE_COMMAND} -E copy "${PROJECT_SOURCE_DIR}/ThirdParty/SuiteSparse/SuiteSparse_config/libsuitesparseconfig.a" ${CMAKE_CURRENT_BINARY_DIR}/amici/libs/ + ) + +add_custom_target(install-python + COMMENT "Installing AMICI base python package" + DEPENDS python-module-files + COMMAND ${PYTHON_EXECUTABLE} ${SETUP_PY_OUT} install --prefix= --user) + + +# Create python wheel +# Note that we have to run build_ext explicitely before bdist_wheel, otherwise the swig-generated +# amici.py will not be added to the module build folder, because it does not yet exist at the +# build_py stage +add_custom_target(python-wheel + COMMENT "Creating wheel for AMICI base python package" + DEPENDS python-module-files + COMMAND ${PYTHON_EXECUTABLE} setup.py build_ext + COMMAND ${PYTHON_EXECUTABLE} setup.py bdist_wheel --dist-dir=${CMAKE_CURRENT_BINARY_DIR} +) + +add_custom_command( + OUTPUT always_rebuild + COMMAND cmake -E echo + ) diff --git a/python/amici/__init__.py b/python/amici/__init__.py new file mode 100644 index 0000000000..85aa459662 --- /dev/null +++ b/python/amici/__init__.py @@ -0,0 +1,129 @@ +"""The AMICI Python module + +The AMICI Python module provides functionality for importing SBML models and turning them into C++ Python extensions. + +Getting started: +``` +# creating a extension module for an SBML model: +import amici +amiSbml = amici.SbmlImporter('mymodel.sbml') +amiSbml.sbml2amici('modelName', 'outputDirectory') + +# using the created module (set python path) +import modelName +help(modelName) +``` + +Attributes: +----------- + amici_path: absolute root path of the amici repository + amiciSwigPath: absolute path of the amici swig directory + amiciSrcPath: absolute path of the amici source directory + amiciModulePath: absolute root path of the amici module +""" + +import os +import numpy as np + + +def setAmiciPaths(): + """Set module-wide paths to components of the AMICI distribution""" + + global amici_path, amiciSwigPath, amiciSrcPath, amiciModulePath + # determine package installation path, or, if used directly from git + # repository, get repository root + if os.path.exists(os.path.join(os.path.dirname(__file__), '..', '..', '.git')): + amici_path = os.path.abspath(os.path.join( + os.path.dirname(__file__), '..', '..')) + else: + amici_path = os.path.dirname(__file__) + + amiciSwigPath = os.path.join(amici_path, 'swig') + amiciSrcPath = os.path.join(amici_path, 'src') + amiciModulePath = os.path.dirname(__file__) + + +# If this file is inside the amici package, import swig interface, +# otherwise we are inside the git repository, then don't +dirname = os.path.dirname(__file__) +if os.path.isfile(os.path.join(dirname, 'amici.py')): + import amici + from .amici import * + +setAmiciPaths() + +from .sbml_import import * + + +def runAmiciSimulation(model, solver, edata=None): + if edata: + edata = edata.get() + rdata = amici.runAmiciSimulation(solver.get(), edata, model.get()) + return rdataToNumPyArrays(rdata) + + +def rdataToNumPyArrays(rdata): + npReturnData = {} + fieldNames = ['t', 'x', 'x0', 'sx', 'sx0', 'y', 'sigmay', 'sy', 'ssigmay', + 'z', 'rz', 'sigmaz', 'sz', 'srz', 'ssigmaz', 'sllh', 's2llh', + 'J', 'xdot', 'status', 'llh', 'chi2', + 'newton_numlinsteps', 'newton_numsteps', + 'numsteps', 'numrhsevals', 'numerrtestfails', 'numnonlinsolvconvfails', + 'order', 'numstepsB', 'numrhsevalsB', 'numerrtestfailsB', 'numnonlinsolvconvfailsB'] + + for field in fieldNames: + npReturnData[field] = getFieldAsNumPyArray(rdata, field) + + return npReturnData + + +def getFieldAsNumPyArray(rdata, field): + + fieldDimensions = {'ts': [rdata.nt], + 'x': [rdata.nt, rdata.nx], + 'x0': [rdata.nx], + 'sx': [rdata.nt, rdata.nplist, rdata.nx], + 'sx0': [rdata.nx, rdata.nplist], + # observables + 'y': [rdata.nt, rdata.ny], + 'sigmay': [rdata.nt, rdata.ny], + 'sy': [rdata.nt, rdata.nplist, rdata.ny], + 'ssigmay': [rdata.nt, rdata.nplist, rdata.ny], + # event observables + 'z': [rdata.nmaxevent, rdata.nz], + 'rz': [rdata.nmaxevent, rdata.nz], + 'sigmaz': [rdata.nmaxevent, rdata.nz], + 'sz': [rdata.nmaxevent, rdata.nplist, rdata.nz], + 'srz': [rdata.nmaxevent, rdata.nplist, rdata.nz], + 'ssigmaz': [rdata.nmaxevent, rdata.nplist, rdata.nz], + # objective function + 'sllh': [rdata.nplist], + 's2llh': [rdata.np, rdata.nplist], + # diagnosis + 'J': [rdata.nx, rdata.nx], + 'xdot': [rdata.nx], + 'newton_numlinsteps': [rdata.newton_maxsteps, 2], + 'newton_numsteps': [1, 2], + 'numsteps': [rdata.nt], + 'numrhsevals': [rdata.nt], + 'numerrtestfails': [rdata.nt], + 'numnonlinsolvconvfails': [rdata.nt], + 'order': [rdata.nt], + 'numstepsB': [rdata.nt], + 'numrhsevalsB': [rdata.nt], + 'numerrtestfailsB': [rdata.nt], + 'numnonlinsolvconvfailsB': [rdata.nt], + } + if field == 't': + field = 'ts' + + attr = getattr(rdata, field) + if field in fieldDimensions.keys(): + if len(fieldDimensions[field]) == 1: + return np.array(attr) + elif len(attr) == 0: + return None + else: + return np.array(attr).reshape(fieldDimensions[field]) + else: + return float(attr) diff --git a/python/amici/__init__.template.py b/python/amici/__init__.template.py new file mode 100644 index 0000000000..40a385209f --- /dev/null +++ b/python/amici/__init__.template.py @@ -0,0 +1,3 @@ +"""AMICI-generated module for model TPL_MODELNAME""" + +from TPL_MODELNAME.TPL_MODELNAME import * diff --git a/python/amici/sbml_import.py b/python/amici/sbml_import.py new file mode 100644 index 0000000000..d60b5b8421 --- /dev/null +++ b/python/amici/sbml_import.py @@ -0,0 +1,981 @@ +#!/usr/bin/env python3 + +import symengine as sp +from symengine.printing import CCodePrinter +from symengine import symbols +import libsbml as sbml +import os +import re +import math +import shutil +import subprocess +import sys +from string import Template + +from . import amici_path, amiciSwigPath, amiciSrcPath, amiciModulePath + +class SBMLException(Exception): + pass + +class SbmlImporter: + """The SbmlImporter class generates AMICI C++ files for a model provided in the Systems Biology Markup Language (SBML). + + Attributes: + ----------- + Codeprinter: codeprinter that allows + functions: dict carrying function specific definitions + symbols: symbolic definitions + SBMLreader: the libSBML sbml reader [!not storing this will result in a segfault!] + sbml_doc: document carrying the sbml defintion [!not storing this will result in a segfault!] + sbml: sbml definition [!not storing this will result in a segfault!] + modelName: name of the model that will be used for compilation + modelPath: path to the generated model specific files + modelSwigPath: path to the generated swig files + n_species: number of species + speciesIndex: dict that maps species names to indices + speciesCompartment: array of compartment for each species + constantSpecies: ids of species that are marked as constant + boundaryConditionSpecies: ids of species that are marked as boundary condition + speciesHasOnlySubstanceUnits: array of flags indicating whether a species has only substance units + speciesInitial: array of initial concentrations + speciesConversionFactor: array of conversion factors for every + parameterValues: array of parameter values + n_parameter: number of parameters + parameterIndex: dict that maps parameter names to indices + compartmentSymbols: array of compartment ids + compartmentVolume: array of compartment volumes + n_reactions: number of reactions + stoichiometricMatrix: stoichiometrix matrix of the model + fluxVector: vector of reaction kinetic laws + observables: array of observable definitions + n_observables: number of observables + """ + + def __init__(self, SBMLFile): + """Create a new Model instance. + + Arguments: + ---------- + SBMLFile: Path to SBML file where the model is specified + modelname: Name of Model to be generated + """ + self.loadSBMLFile(SBMLFile) + + self.Codeprinter = CCodePrinter() + + """Signatures and properties of generated model functions (see include/amici/model.h for details).""" + self.functions = { + 'J': { + 'signature': '(realtype *J, const realtype t, const realtype *x, const double *p,' + ' const double *k, const realtype *h, const realtype *w, const realtype *dwdx)'}, + 'JB': { + 'signature': '(realtype *JB, const realtype t, const realtype *x, const realtype *p,' + ' const realtype *k, const realtype *h, const realtype *xB, const realtype *w,' + ' const realtype *dwdx)'}, + 'JDiag': { + 'signature': '(realtype *JDiag, const realtype t, const realtype *x, const realtype *p,' + ' const realtype *k, const realtype *h, const realtype *w, const realtype *dwdx)'}, + 'JSparse': { + 'signature': '(SlsMat JSparse, const realtype t, const realtype *x, const realtype *p,' + ' const realtype *k, const realtype *h, const realtype *w, const realtype *dwdx)', + 'symbol': 'sparseList'}, + 'JSparseB': { + 'signature': '(SlsMat JSparseB, const realtype t, const realtype *x, const realtype *p,' + ' const realtype *k, const realtype *h, const realtype *xB, const realtype *w,' + ' const realtype *dwdx)', + 'symbol': 'sparseList'}, + 'Jv': { + 'signature': '(realtype *Jv, const realtype t, const realtype *x, const realtype *p,' + ' const realtype *k, const realtype *h, const realtype *v, const realtype *w,' + ' const realtype *dwdx)'}, + 'JvB': { + 'signature': '(realtype *JvB, const realtype t, const realtype *x, const realtype *p,' + ' const realtype *k, const realtype *h, const realtype *xB, const realtype *vB,' + ' const realtype *w, const realtype *dwdx)'}, + 'Jy': { + 'signature': '(double *nllh, const int iy, const realtype *p, const realtype *k, const double *y,' + ' const double *sigmay, const double *my)', + 'variable': 'nllh', + 'multiobs': True}, + 'dJydsigma': { + 'signature': '(double *dJydsigma, const int iy, const realtype *p, const realtype *k, const double *y,' + ' const double *sigmay, const double *my)', + 'multiobs': True}, + 'dJydy': { + 'signature': '(double *dJydy, const int iy, const realtype *p, const realtype *k, const double *y,' + ' const double *sigmay, const double *my)', + 'multiobs': True}, + 'dwdp': { + 'signature': '(realtype *dwdp, const realtype t, const realtype *x, const realtype *p,' + ' const realtype *k, const realtype *h, const realtype *w)', + 'symbol': 'sparseList'}, + 'dwdx': { + 'signature': '(realtype *dwdx, const realtype t, const realtype *x, const realtype *p,' + ' const realtype *k, const realtype *h, const realtype *w)', + 'symbol': 'sparseList'}, + 'dxdotdp': { + 'signature': '(realtype *dxdotdp, const realtype t, const realtype *x, const realtype *p,' + ' const realtype *k, const realtype *h, const int ip, const realtype *w,' + ' const realtype *dwdp)', + 'sensitivity': True}, + 'dydx': { + 'signature': '(double *dydx, const realtype t, const realtype *x, const realtype *p,' + ' const realtype *k, const realtype *h)'}, + 'dydp': { + 'signature': '(double *dydp, const realtype t, const realtype *x, const realtype *p,' + ' const realtype *k, const realtype *h)'}, + 'qBdot': { + 'signature': '(realtype *qBdot, const int ip, const realtype t, const realtype *x, const realtype *p,' + ' const realtype *k, const realtype *h, const realtype *xB, const realtype *w,' + ' const realtype *dwdp)', + 'sensitivity': True}, + 'sigma_y': {'signature': '(double *sigmay, const realtype t, const realtype *p, const realtype *k)', + 'variable': 'sigmay'}, + 'sxdot': { + 'signature': '(realtype *sxdot, const realtype t, const realtype *x, const realtype *p,' + ' const realtype *k, const realtype *h, const int ip, const realtype *sx,' + ' const realtype *w, const realtype *dwdx, const realtype *J, const realtype *dxdotdp)'}, + 'w': { + 'signature': '(realtype *w, const realtype t, const realtype *x, const realtype *p,' + ' const realtype *k, const realtype *h)'}, + 'x0': {'signature': '(realtype *x0, const realtype t, const realtype *p, const realtype *k)'}, + 'sx0': { + 'signature': '(realtype *sx0, const realtype t,const realtype *x0, const realtype *p,' + ' const realtype *k, const int ip)'}, + 'xBdot': { + 'signature': '(realtype *xBdot, const realtype t, const realtype *x, const realtype *p,' + ' const realtype *k, const realtype *h, const realtype *xB, const realtype *w,' + ' const realtype *dwdx)'}, + 'xdot': { + 'signature': '(realtype *xdot, const realtype t, const realtype *x, const realtype *p,' + ' const realtype *k, const realtype *h, const realtype *w)'}, + 'y': { + 'signature': '(double *y, const realtype t, const realtype *x, const realtype *p, const realtype *k,' + ' const realtype *h)'} + } + + """Long and short names for model components""" + self.symbols = { + 'species': {'shortName': 'x'}, + 'sensitivity': {'shortName': 'sx'}, + 'vector': {'shortName': 'v'}, + 'vectorB': {'shortName': 'vB'}, + 'parameter': {'shortName': 'p'}, + 'fixed_parameter': {'shortName': 'k'}, + 'observable': {'shortName': 'y'}, + 'adjoint': {'shortName': 'xB'}, + 'flux': {'shortName': 'w'}, + 'dxdotdp': {'shortName': 'dxdotdp'}, + 'dwdx': {'shortName': 'dwdx'}, + 'dwdp': {'shortName': 'dwdp'}, + 'JSparse': {'shortName': 'J'}, + 'JSparseB': {'shortName': 'JB'}, + 'my': {'shortName': 'my'}, + 'sigma_y': {'shortName': 'sigmay'} + } + + def loadSBMLFile(self, SBMLFile): + """Parse the provided SBML file.""" + self.SBMLreader = sbml.SBMLReader() + self.sbml_doc = self.SBMLreader.readSBML(SBMLFile) + + if (self.sbml_doc.getNumErrors() > 0): + raise SBMLException('Provided SBML file does not exists or is invalid!') + + # apply several model simplifications that make our life substantially easier + if len(self.sbml_doc.getModel().getListOfFunctionDefinitions())>0: + convertConfig = sbml.SBMLFunctionDefinitionConverter().getDefaultProperties() + status = self.sbml_doc.convert(convertConfig) + if status != sbml.LIBSBML_OPERATION_SUCCESS: + raise SBMLException('Could not flatten function definitions!') + + convertConfig = sbml.SBMLInitialAssignmentConverter().getDefaultProperties() + status = self.sbml_doc.convert(convertConfig) + if status != sbml.LIBSBML_OPERATION_SUCCESS: + raise SBMLException('Could not flatten initial assignments!') + + convertConfig = sbml.SBMLLocalParameterConverter().getDefaultProperties() + status = self.sbml_doc.convert(convertConfig) + if status != sbml.LIBSBML_OPERATION_SUCCESS: + raise SBMLException('Could not flatten local parameters!') + + self.sbml = self.sbml_doc.getModel() + + + def sbml2amici(self, modelName, output_dir=None, observables={}, constantParameters=[], sigmas={}): + """Generate AMICI C++ files for the model provided to the constructor. + + Args: + ----- + modelName: name of the model/model directory + output_dir: see sbml_import.setPaths() + """ + + self.setName(modelName) + self.setPaths(output_dir) + self.processSBML(constantParameters) + self.computeModelEquations(observables, sigmas) + self.prepareModelFolder() + self.generateCCode() + self.compileCCode() + + + def setName(self, modelName): + """Sets the model name + + Args: + modelName: name of the model (must only contain valid filename characters) + """ + self.modelName = modelName + + + def setPaths(self, output_dir=None): + """Set output paths for the model and create if necessary + + Args: + ----- + output_dir: relative or absolute path where the generated model code is to be placed. will be created if does not exists. defaults to `pwd`/amici-$modelname. + """ + + if not output_dir: + output_dir = '%s/amici-%s' % (os.getcwd(), self.modelName) + + self.modelPath = os.path.abspath(output_dir) + self.modelSwigPath = os.path.join(self.modelPath, 'swig') + + for dir in [self.modelPath, self.modelSwigPath]: + if not os.path.exists(dir): + os.makedirs(dir) + + + def processSBML(self, constantParameters=[]): + """Read parameters, species, reactions, and so on from SBML model""" + self.checkSupport() + self.processParameters(constantParameters) + self.processSpecies() + self.processReactions() + self.processCompartments() + self.processRules() + self.processVolumeConversion() + self.processTime() + self.cleanReservedSymbols() + self.replaceSpecialConstants() + + + def checkSupport(self): + """Check whether all required SBML features are supported.""" + if len(self.sbml.getListOfSpecies()) == 0: + raise SBMLException('Models without species are currently not supported!') + + if len(self.sbml.all_elements_from_plugins) > 0: + raise SBMLException('SBML extensions are currently not supported!') + + if len(self.sbml.getListOfEvents()) > 0: + raise SBMLException('Events are currently not supported!') + + if any([not(rule.isAssignment()) for rule in self.sbml.getListOfRules()]): + raise SBMLException('Algebraic and rate rules are currently not supported!') + + if any([reaction.getFast() for reaction in self.sbml.getListOfReactions()]): + raise SBMLException('Fast reactions are currently not supported!') + + if any([any([not element.getStoichiometryMath() is None + for element in list(reaction.getListOfReactants()) + list(reaction.getListOfProducts())]) + for reaction in self.sbml.getListOfReactions()]): + raise SBMLException('Non-unity stoichiometry is currently not supported!') + + + def processSpecies(self): + """Get species information from SBML model.""" + species = self.sbml.getListOfSpecies() + self.n_species = len(species) + self.speciesIndex = {species_element.getId(): species_index + for species_index, species_element in enumerate(species)} + self.symbols['species']['sym'] = sp.DenseMatrix([symbols(spec.getId()) for spec in species]) + self.speciesCompartment = sp.DenseMatrix([symbols(spec.getCompartment()) for spec in species]) + self.constantSpecies = [species_element.getId() if species_element.getConstant() else None + for species_element in species] + self.boundaryConditionSpecies = [species_element.getId() if species_element.getBoundaryCondition() else None + for species_element in species] + self.speciesHasOnlySubstanceUnits = [specie.getHasOnlySubstanceUnits() for specie in species] + + concentrations = [spec.getInitialConcentration() for spec in species] + amounts = [spec.getInitialAmount() for spec in species] + + self.speciesInitial = sp.DenseMatrix([sp.sympify(conc) if not math.isnan(conc) else + sp.sympify(amounts[index])/self.speciesCompartment[index] if not + math.isnan(amounts[index]) else + self.symbols['species']['sym'][index] + for index, conc in enumerate(concentrations)]) + + if self.sbml.isSetConversionFactor(): + conversionFactor = self.sbml.getConversionFactor() + else: + conversionFactor = 1.0 + self.speciesConversionFactor = sp.DenseMatrix([sp.sympify(specie.getConversionFactor()) if + specie.isSetConversionFactor() else conversionFactor + for specie in species]) + + + def processParameters(self, constantParameters=[]): + """Get parameter information from SBML model.""" + + fixedParameters = [ parameter for parameter in self.sbml.getListOfParameters() if parameter.getId() in constantParameters ] + parameters = [ parameter for parameter in self.sbml.getListOfParameters() if parameter.getId() not in constantParameters ] + + self.symbols['parameter']['sym'] = sp.DenseMatrix([symbols(par.getId()) for par in parameters]) + self.parameterValues = [par.getValue() for par in parameters] + self.n_parameters = len(self.symbols['parameter']['sym']) + self.parameterIndex = {parameter_element.getId(): parameter_index + for parameter_index, parameter_element in enumerate(parameters)} + + self.symbols['fixed_parameter']['sym'] = sp.DenseMatrix([symbols(par.getId()) for par in fixedParameters]) + self.fixedParameterValues = [par.getValue() for par in fixedParameters] + self.n_fixed_parameters = len(self.symbols['fixed_parameter']['sym']) + self.fixedParameterIndex = {parameter_element.getId(): parameter_index + for parameter_index, parameter_element in enumerate(fixedParameters)} + + + def processCompartments(self): + """Get compartment information, stoichiometric matrix and fluxes from SBML model.""" + compartments = self.sbml.getListOfCompartments() + self.compartmentSymbols = sp.DenseMatrix([symbols(comp.getId()) for comp in compartments]) + self.compartmentVolume = sp.DenseMatrix([sp.sympify(comp.getVolume()) if comp.isSetVolume() + else sp.sympify(1.0) for comp in compartments]) + + self.replaceInAllExpressions(self.compartmentSymbols,self.compartmentVolume) + + + def processReactions(self): + """Get reactions from SBML model.""" + reactions = self.sbml.getListOfReactions() + self.n_reactions = len(reactions) + + # stoichiometric matrix + self.stoichiometricMatrix = sp.zeros(self.n_species, self.n_reactions) + self.fluxVector = sp.zeros(self.n_reactions, 1) + self.symbols['flux']['sym'] = sp.zeros(self.n_reactions, 1) + + for reactionIndex, reaction in enumerate(reactions): + + for elementList, sign in [(reaction.getListOfReactants(), -1.0), + (reaction.getListOfProducts(), 1.0)]: + elements = {} + for index, element in enumerate(elementList): + # we need the index here as we might have multiple elements for the same species + elements[index] = {'species': element.getSpecies()} + if element.isSetId(): + if element.getId() in [rule.getVariable() + for rule in self.sbml.getListOfRules() if rule.getFormula() != '']: + elements[index]['stoichiometry'] = sp.sympify(element.getId()) + else: + # dont put the symbol if it wont get replaced by a rule + elements[index]['stoichiometry'] = sp.sympify(element.getStoichiometry()) + else: + elements[index]['stoichiometry'] = sp.sympify(element.getStoichiometry()) + + for index in elements.keys(): + if not (elements[index]['species'] in self.constantSpecies + or elements[index]['species'] in self.boundaryConditionSpecies): + specieIndex = self.speciesIndex[elements[index]['species']] + self.stoichiometricMatrix[specieIndex, reactionIndex] += sign * \ + elements[index]['stoichiometry'] * self.speciesConversionFactor[specieIndex]/ \ + self.speciesCompartment[specieIndex] + + # usage of formulaToL3String ensures that we get "time" as time symbol + math = sbml.formulaToL3String(reaction.getKineticLaw().getMath()) + try: + symMath = sp.sympify(math) + except: + raise SBMLException('Kinetic law "' + math + '" contains an unsupported expression!') + for r in reactions: + for element in list(r.getListOfReactants()) + list(r.getListOfProducts()): + if element.isSetId() & element.isSetStoichiometry(): + symMath = symMath.subs(sp.sympify(element.getId()),sp.sympify(element.getStoichiometry())) + self.fluxVector[reactionIndex] = symMath + self.symbols['flux']['sym'][reactionIndex] = sp.sympify('w' + str(reactionIndex)) + if any([str(symbol) in [reaction.getId() for reaction in reactions if reaction.isSetId()] + for symbol in self.fluxVector[reactionIndex].free_symbols]): + raise SBMLException('Kinetic laws involving reaction ids are currently not supported!') + + + def processRules(self): + """Process *Rules defined in the SBML model.""" + rules = self.sbml.getListOfRules() + + rulevars = getRuleVars(rules) + fluxvars = self.fluxVector.free_symbols + specvars = self.symbols['species']['sym'].free_symbols + volumevars = self.compartmentVolume.free_symbols + compartmentvars = self.compartmentSymbols.free_symbols + parametervars = self.symbols['parameter']['sym'].free_symbols + stoichvars = self.stoichiometricMatrix.free_symbols + + for rule in rules: + if rule.getFormula() == '': + continue + variable = sp.sympify(rule.getVariable()) + formula = sp.sympify(rule.getFormula()) + + if variable in stoichvars: + self.stoichiometricMatrix = self.stoichiometricMatrix.subs(variable, formula) + + if variable in specvars: + raise SBMLException('Species assignment rules are currently not supported!') + + if variable in compartmentvars: + raise SBMLException('Compartment assignment rules are currently not supported!') + + if variable in parametervars: + try: + self.parameterValues[self.parameterIndex[str(variable)]] = float(formula) + except: + raise SBMLException('Non-float parameter assignment rules are currently not supported!') + + if variable in fluxvars: + self.fluxVector = self.fluxVector.subs(variable, formula) + + if variable in volumevars: + self.compartmentVolume = self.compartmentVolume.subs(variable, formula) + + if variable in rulevars: + for nested_rule in rules: + nested_formula = sp.sympify(nested_rule.getFormula()) + nested_formula.subs(variable, formula) + nested_rule.setFormula(str(nested_formula)) + + def processVolumeConversion(self): + """Convert equations from amount to volume.""" + for index, bool in enumerate(self.speciesHasOnlySubstanceUnits): + if bool: + self.fluxVector = self.fluxVector.subs(self.symbols['species']['sym'][index], + self.symbols['species']['sym'][index] * self.speciesCompartment[index] + .subs(self.compartmentSymbols, + self.compartmentVolume)) + + + def processTime(self): + """Converts time_symbol into cpp variable.""" + sbmlTimeSymbol = sp.sympify('time') + amiciTimeSymbol = sp.sympify('t') + + self.replaceInAllExpressions(sbmlTimeSymbol, amiciTimeSymbol) + + + + def replaceInAllExpressions(self,old,new): + """Replaces 'old' by 'new' in all symbolic expressions. + + Args: + old: symbolic variables to be replaced + new: replacement symbolic variables + + """ + fields = ['observables', 'stoichiometricMatrix', 'fluxVector', 'speciesInitial'] + for field in fields: + if field in dir(self): + self.__setattr__(field, self.__getattribute__(field).subs(old, new)) + + + def cleanReservedSymbols(self): + reservedSymbols = ['k','p','y','w'] + for str in reservedSymbols: + old_symbol = sp.sympify(str) + new_symbol = sp.sympify('amici_' + str) + self.replaceInAllExpressions(old_symbol, new_symbol) + for symbol in self.symbols.keys(): + if 'sym' in self.symbols[symbol].keys(): + self.symbols[symbol]['sym'] = self.symbols[symbol]['sym'].subs(old_symbol,new_symbol) + + def replaceSpecialConstants(self): + constants = [(sp.sympify('avogadro'),sp.sympify('6.02214179*1e23')),] + for constant, value in constants: + # do not replace if any symbol is shadowing default definition + if not any([constant in self.symbols[symbol]['sym'] + for symbol in self.symbols.keys() if 'sym' in self.symbols[symbol].keys()]): + self.replaceInAllExpressions(constant, value) + else: + # yes sbml supports this but we wont, are you really expecting to be saved if you are trying to shoot + # yourself in the foot? + raise SBMLException('Ecountered currently unsupported element id ' + str(constant) + '!') + + + def getSparseSymbols(self,symbolName): + """Create sparse symbolic matrix. + + Args: + symbolName: + + Returns: + sparseMatrix: + symbolList: + sparseList: + symbolColPtrs: + symbolRowVals: + """ + matrix = self.functions[symbolName]['sym'] + symbolIndex = 0 + sparseMatrix = sp.zeros(matrix.rows,matrix.cols) + symbolList = [] + sparseList = [] + symbolColPtrs = [] + symbolRowVals = [] + for col in range(0,matrix.cols): + symbolColPtrs.append(symbolIndex) + for row in range(0, matrix.rows): + if(not(matrix[row, col]==0)): + name = symbolName + str(symbolIndex) + sparseMatrix[row, col] = sp.sympify(name) + symbolList.append(name) + sparseList.append(matrix[row, col]) + symbolRowVals.append(row) + symbolIndex += 1 + symbolColPtrs.append(symbolIndex) + sparseList = sp.DenseMatrix(sparseList) + return sparseMatrix, symbolList, sparseList, symbolColPtrs, symbolRowVals + + def computeModelEquations(self, observables={}, sigmas={}): + """Perform symbolic computations required to populate functions in `self.functions`.""" + + # core + self.functions['xdot']['sym'] = self.stoichiometricMatrix * self.symbols['flux']['sym'] + self.computeModelEquationsLinearSolver() + self.computeModelEquationsObjectiveFunction(observables, sigmas) + + # sensitivity + self.computeModelEquationsSensitivitesCore() + self.computeModelEquationsForwardSensitivites() + self.computeModelEquationsAdjointSensitivites() + + + def computeModelEquationsLinearSolver(self): + """Perform symbolic computations required for the use of various linear solvers.""" + self.functions['w']['sym'] = self.fluxVector + self.functions['dwdx']['sym'] = self.fluxVector.jacobian(self.symbols['species']['sym']) + + self.functions['dwdx']['sparseSym'],\ + self.symbols['dwdx']['sym'],\ + self.functions['dwdx']['sparseList'] = self.getSparseSymbols('dwdx')[0:3] + + self.functions['J']['sym'] = self.functions['xdot']['sym'].jacobian(self.symbols['species']['sym']) \ + + self.stoichiometricMatrix * self.functions['dwdx']['sparseSym'] + self.symbols['vector']['sym'] = getSymbols('v',self.n_species) + self.functions['Jv']['sym'] = self.functions['J']['sym']*self.symbols['vector']['sym'] + + self.functions['JSparse']['sym'],\ + self.symbols['JSparse']['sym'],\ + self.functions['JSparse']['sparseList'],\ + self.functions['JSparse']['colPtrs'],\ + self.functions['JSparse']['rowVals'] = self.getSparseSymbols('J') + + self.functions['x0']['sym'] = self.speciesInitial + self.functions['JDiag']['sym'] = getSymbolicDiagonal(self.functions['J']['sym']) + + + def computeModelEquationsObjectiveFunction(self, observables={}, sigmas={}): + """Perform symbolic computations required for objective function evaluation. + + Args: + observables: dictionary(observableName:formulaString) to be added to the model + sigmas: dictionary(observableName: sigma value or (existing) parameter name) + """ + speciesSyms = self.symbols['species']['sym'] + + # add user-provided observables or make all species observable + if(observables): + self.observables = sp.DenseMatrix(observables.values()) + observableSyms = sp.DenseMatrix(observables.keys()) + self.n_observables = len(observables) + else: + self.observables = speciesSyms + observableSyms = sp.DenseMatrix([sp.sympify('y' + str(index)) for index in range(0,len(speciesSyms))]) + self.n_observables = len(speciesSyms) + self.functions['y']['sym'] = self.observables + sigmaYSyms = sp.DenseMatrix([sp.sympify('sigma' + str(symbol)) for symbol in observableSyms]) + self.functions['sigma_y']['sym'] = sp.ones(sigmaYSyms.cols, sigmaYSyms.rows) + + # set user-provided sigmas + for iy, obsName in enumerate(observables): + if obsName in sigmas: + self.functions['sigma_y']['sym'][iy] = sigmas[obsName] + + self.symbols['my']['sym'] = sp.DenseMatrix([sp.sympify('m' + str(symbol)) for symbol in observableSyms]) + + loglikelihoodString = lambda strSymbol: '0.5*sqrt(2*pi*sigma{symbol}**2) + 0.5*(({symbol}-m{symbol})/sigma{symbol})**2'.format(symbol=strSymbol) + self.functions['Jy']['sym'] = sp.DenseMatrix([sp.sympify(loglikelihoodString(str(symbol))) for symbol in observableSyms]) + self.functions['dJydy']['sym'] = self.functions['Jy']['sym'].jacobian(observableSyms) + self.functions['dJydsigma']['sym'] = self.functions['Jy']['sym'].jacobian(sigmaYSyms) + self.functions['Jy']['sym'] = self.functions['Jy']['sym'].transpose() + self.functions['dJydy']['sym'] = self.functions['dJydy']['sym'].transpose() + self.functions['dJydsigma']['sym'] = self.functions['dJydsigma']['sym'].transpose() + + self.symbols['observable']['sym'] = observableSyms + self.symbols['sigma_y']['sym'] = sigmaYSyms + + + def computeModelEquationsSensitivitesCore(self): + """Perform symbolic computations required for any sensitivity analysis.""" + self.functions['dydp']['sym'] = self.functions['y']['sym']\ + .jacobian(self.symbols['parameter']['sym']) + self.functions['dydx']['sym'] = self.functions['y']['sym']\ + .jacobian(self.symbols['species']['sym']) + + self.functions['dwdp']['sym'] = self.fluxVector.jacobian(self.symbols['parameter']['sym']) + + self.functions['dwdp']['sparseSym'],\ + self.symbols['dwdp']['sym'],\ + self.functions['dwdp']['sparseList'] = self.getSparseSymbols('dwdp')[0:3] + + self.functions['dxdotdp']['sym'] = self.functions['xdot']['sym']\ + .jacobian(self.symbols['parameter']['sym'])\ + + self.stoichiometricMatrix\ + * self.functions['dwdp']['sparseSym'] + self.symbols['dxdotdp']['sym'] = getSymbols('dxdotdp',self.n_species) + self.functions['sx0']['sym'] = self.speciesInitial.jacobian(self.symbols['parameter']['sym']) + + + def computeModelEquationsForwardSensitivites(self): + """Perform symbolic computations required for forward sensitivity analysis.""" + self.symbols['sensitivity']['sym'] = getSymbols('sx',self.n_species) + self.functions['sxdot']['sym'] = self.functions['JSparse']['sym']\ + * self.symbols['sensitivity']['sym'] \ + + self.symbols['dxdotdp']['sym'] + + def computeModelEquationsAdjointSensitivites(self): + """Perform symbolic computations required for adjoint sensitivity analysis.""" + self.functions['JB']['sym'] = self.functions['J']['sym'].transpose() + self.symbols['vectorB']['sym'] = getSymbols('vB', self.n_species) + self.functions['JvB']['sym'] = self.functions['JB']['sym'] \ + * self.symbols['vectorB']['sym'] + self.functions['JSparseB']['sym'], self.symbols['JSparseB']['sym'],\ + self.functions['JSparseB']['sparseList'], self.functions['JSparseB']['colPtrs'],\ + self.functions['JSparseB']['rowVals'] = self.getSparseSymbols('JB') + + self.symbols['adjoint']['sym'] = getSymbols('xB',self.n_species) + self.functions['xBdot']['sym'] = - self.functions['JB']['sym']\ + * self.symbols['adjoint']['sym'] + self.functions['qBdot']['sym'] = - self.symbols['adjoint']['sym'].transpose()\ + * self.functions['dxdotdp']['sym'] + + + def prepareModelFolder(self): + + for file in os.listdir(self.modelPath): + file_path = os.path.join(self.modelPath, file) + if os.path.isfile(file_path): + os.remove(file_path) + + + + def generateCCode(self): + """Create C++ code files for the model based on.""" + for name in self.symbols.keys(): + self.writeIndexFiles(name) + + for function in self.functions.keys(): + self.writeFunctionFile(function) + + self.writeWrapfunctionsCPP() + self.writeWrapfunctionsHeader() + self.writeCMakeFile() + self.writeSwigFiles() + self.writeModuleSetup() + + shutil.copy(os.path.join(amiciSrcPath, 'main.template.cpp'), + os.path.join(self.modelPath, 'main.cpp')) + + + def compileCCode(self): + """Compile the generated model code""" + + moduleDir = self.modelPath + oldCwd = os.getcwd() + os.chdir(moduleDir) # setup.py assumes it is run from within the model dir + from distutils.core import run_setup + run_setup('setup.py', + script_args=["build_ext", + '--build-lib=%s' % moduleDir, + ]) + os.chdir(oldCwd) + + def writeIndexFiles(self,name): + """Write index file for a symbolic array. + + Args: + Symbols: symbolic variables + CVariableName: Name of the C++ array the symbols + fileName: filename without path + """ + lines = [] + [lines.append('#define ' + str(symbol) + ' ' + str(self.symbols[name]['shortName']) + '[' + str(index) + ']') + for index, symbol in enumerate(self.symbols[name]['sym'])] + open(os.path.join(self.modelPath,name + '.h'), 'w').write('\n'.join(lines)) + + + def writeFunctionFile(self,function): + """Write the function `function`. + + Args: + function: name of the function to be written (see self.functions)""" + + # function header + lines = ['#include "amici/symbolic_functions.h"', + '#include "amici/defines.h" //realtype definition', + 'using amici::realtype;', + '#include ', + ''] + + # function signature + signature = self.functions[function]['signature'] + + if(not signature.find('SlsMat') == -1): + lines.append('#include ') + + lines.append('') + + for symbol in self.symbols.keys(): + # added |double for data + # added '[0]*' for initial conditions + if not re.search('const (realtype|double) \*' + self.symbols[symbol]['shortName'] + '[0]*[,)]+', + signature) is None : + lines.append('#include "' + symbol + '.h"') + + lines.append('') + + lines.append('void ' + function + '_' + self.modelName + signature + '{') + + # function body + body = self.getFunctionBody(function) + self.functions[function]['body'] = body + lines += body + lines.append('}') + #if not body is None: + open(os.path.join(self.modelPath, self.modelName + '_' + function + '.cpp'), 'w').write('\n'.join(lines)) + + + def getFunctionBody(self,function): + """Generate C++ code for body of function `function`. + + Args: + function: name of the function to be written (see self.functions) + """ + + if('variable' in self.functions[function].keys()): + variableName = self.functions[function]['variable'] + else: + variableName = function + + if ('symbol' in self.functions[function].keys()): + symbol = self.functions[function][self.functions[function]['symbol']] + else: + symbol = self.functions[function]['sym'] + lines = [] + + + if('sensitivity' in self.functions[function].keys()): + lines.append(' '*4 + 'switch(ip) {') + for ipar in range(0,self.n_parameters): + lines.append(' ' * 8 + 'case ' + str(ipar) + ':') + lines += self.getSymLines(symbol[:, ipar], variableName, 12) + lines.append(' ' * 12 + 'break;') + lines.append('}') + elif('multiobs' in self.functions[function].keys()): + lines.append(' '*4 + 'switch(iy) {') + for iobs in range(0,self.n_observables): + lines.append(' ' * 8 + 'case ' + str(iobs) + ':') + lines += self.getSymLines(symbol[:, iobs], variableName, 12) + lines.append(' ' * 12 + 'break;') + lines.append('}') + else: + if('colPtrs' in self.functions[function].keys()): + rowVals = self.functions[function]['rowVals'] + colPtrs = self.functions[function]['colPtrs'] + lines += self.getSparseSymLines(symbol, rowVals, colPtrs, variableName, 4) + else: + lines += self.getSymLines(symbol, variableName, 4) + + return [line for line in lines if line] + + + def writeWrapfunctionsCPP(self): + """Write model-specific 'wrapper' file (wrapfunctions.cpp).""" + templateData = {'MODELNAME': self.modelName} + applyTemplate(os.path.join(amiciSrcPath, 'wrapfunctions.template.cpp'), + os.path.join(self.modelPath, 'wrapfunctions.cpp'), templateData) + + + def writeWrapfunctionsHeader(self): + """Write model-specific header file (wrapfunctions.h).""" + templateData = {'MODELNAME': str(self.modelName), + 'NX': str(self.n_species), + 'NXTRUE': str(self.n_species), + 'NY': str(self.n_observables), + 'NYTRUE': str(self.n_observables), + 'NZ': '0', + 'NZTRUE': '0', + 'NEVENT': '0', + 'NOBJECTIVE': '1', + 'NW': str(len(self.symbols['flux']['sym'])), + 'NDWDDX': str(len(self.functions['dwdx']['sparseList'])), + 'NDWDP': str(len(self.functions['dwdp']['sparseList'])), + 'NNZ': str(len(self.functions['JSparse']['sparseList'])), + 'UBW': str(self.n_species), + 'LBW': str(self.n_species), + 'NP': str(self.n_parameters), + 'NK': str(self.n_fixed_parameters), + 'O2MODE': 'amici::AMICI_O2MODE_NONE', + 'PARAMETERS': str(self.parameterValues)[1:-1], + 'FIXED_PARAMETERS': str(self.fixedParameterValues)[1:-1]} + applyTemplate(os.path.join(amiciSrcPath, 'wrapfunctions.ODE_template.h'), + os.path.join(self.modelPath, 'wrapfunctions.h'), templateData) + + def writeCMakeFile(self): + """Write CMake CMakeLists.txt file for this model.""" + sources = [self.modelName + '_' + function + '.cpp ' if self.functions[function]['body'] is not None else '' + for function in self.functions.keys() ] + try: + sources.remove('') + except: + pass + templateData = {'MODELNAME': self.modelName, + 'SOURCES': '\n'.join(sources)} + applyTemplate(os.path.join(amiciSrcPath, 'CMakeLists.template.txt'), + os.path.join(self.modelPath, 'CMakeLists.txt'), templateData) + + def writeSwigFiles(self): + """Write SWIG interface files for this model.""" + if not os.path.exists(self.modelSwigPath): + os.makedirs(self.modelSwigPath) + templateData = {'MODELNAME': self.modelName} + applyTemplate(os.path.join(amiciSwigPath, 'modelname.template.i'), + os.path.join(self.modelSwigPath, self.modelName + '.i'), templateData) + shutil.copy(os.path.join(amiciSwigPath, 'CMakeLists_model.txt'), + os.path.join(self.modelSwigPath, 'CMakeLists.txt')) + + def writeModuleSetup(self): + """Create a distutils setup.py file for compile the model module.""" + + templateData = {'MODELNAME': self.modelName, + 'VERSION': '0.1.0'} + applyTemplate(os.path.join(amiciModulePath, 'setup.template.py'), + os.path.join(self.modelPath, 'setup.py'), templateData) + + # write __init__.py for the model module + if not os.path.exists(os.path.join(self.modelPath, self.modelName)): + os.makedirs(os.path.join(self.modelPath, self.modelName)) + + applyTemplate(os.path.join(amiciModulePath, '__init__.template.py'), + os.path.join(self.modelPath, self.modelName, '__init__.py'), templateData) + + def getSymLines(self, symbols, variable, indentLevel): + """Generate C++ code for assigning symbolic terms in symbols to C++ array `variable`. + + Args: + symbols: vectors of symbolic terms + variable: name of the C++ array to assign to + indentLevel: indentation level (number of leading blanks) + + Returns: + C++ code as list of lines""" + + lines = [' ' * indentLevel + variable + '[' + str(index) + '] = ' + self.printWithException(math) + ';' + if not math == 0 else '' for index, math in enumerate(symbols)] + + try: + lines.remove('') + except: + pass + + return lines + + def getSparseSymLines(self, symbolList, RowVals, ColPtrs, variable, indentLevel): + """Generate C++ code for assigning sparse symbolic matrix to a C++ array `variable`. + + Args: + symbolList: vectors of symbolic terms + RowVals: list of row indices of each nonzero entry (see CVODES SlsMat documentation for details) + ColPtrs: list of indices of the first column entries (see CVODES SlsMat documentation for details) + variable: name of the C++ array to assign to + indentLevel: indentation level (number of leading blanks) + + Returns: + C++ code as list of lines""" + lines = [ + ' ' * indentLevel + variable + '->indexvals[' + str(index) + '] = ' + self.printWithException(math) + ';' + for index, math in enumerate(RowVals)] + lines.extend([' ' * indentLevel + variable + '->indexptrs[' + str(index) + '] = ' + self.printWithException(math) + ';' + for index, math in enumerate(ColPtrs)]) + lines.extend([' ' * indentLevel + variable + '->data[' + str(index) + '] = ' + self.printWithException(math) + ';' + for index, math in enumerate(symbolList)]) + + return lines + + def printWithException(self,math): + try: + return self.Codeprinter.doprint(math) + except: + raise SBMLException('Encountered unsupported function in expression "' + str(math) + '"!') + +def applyTemplate(sourceFile,targetFile,templateData): + """Load source file, apply template substitution as provided in templateData and save as targetFile. + + Args: + sourceFile: relative or absolute path to template file + targetFile: relative or absolute path to output file + templateData: dictionary with template keywords to substitute (key is template veriable without TemplateAmici.delimiter) + """ + with open(sourceFile) as filein: + src = TemplateAmici(filein.read()) + result = src.safe_substitute(templateData) + with open(targetFile, 'w') as fileout: + fileout.write(result) + +def getSymbols(prefix,length): + """Get symbolic matrix with symbols prefix0..prefix(length-1). + + Args: + prefix: variable name + length: number of symbolic variables + 1 + """ + return sp.DenseMatrix([sp.sympify(prefix + str(i)) for i in range(0, length)]) + + +def getSymbolicDiagonal(matrix): + """Get symbolic matrix with diagonal of matrix `matrix`. + + Args: + matrix: Matrix from which to return the diagonal + Returns: + Symbolic matrix with the diagonal of `matrix`. + """ + assert matrix.cols == matrix.rows + diagonal = [matrix[index,index] for index in range(matrix.cols)] + + return sp.DenseMatrix(diagonal) + +def getRuleVars(rules): + return sp.DenseMatrix([sp.sympify(rule.getFormula()) for rule in rules if rule.getFormula() != '']).free_symbols + +class TemplateAmici(Template): + """Template format used in AMICI (see string.template for more details).""" + delimiter = 'TPL_' + + +def assignmentRules2observables(sbml, filter = lambda *_: True): + """Turn assignment rules into observables. + + Args: + sbml: an sbml Model instance + filter: callback function taking assignment variable as input and returning True/False to indicate if the respective rule should be turned into an observable""" + observables = {} + for p in sbml.getListOfParameters(): + parameterId = p.getId() + if filter(parameterId): + observables[parameterId] = sbml.getAssignmentRuleByVariable(parameterId).getFormula() + + for parameterId in observables: + sbml.removeRuleByVariable(parameterId) + sbml.removeParameter(parameterId) + + return observables + diff --git a/python/amici/setup.template.py b/python/amici/setup.template.py new file mode 100644 index 0000000000..861ef7c8a7 --- /dev/null +++ b/python/amici/setup.template.py @@ -0,0 +1,90 @@ +from setuptools import find_packages +from distutils.core import setup, Extension +from distutils import sysconfig +import os +from amici import amici_path + +os.chdir(os.path.dirname(os.path.abspath(__file__))) + +def getModelSources(): + """Get list of source files for the amici base library""" + import glob + import re + modelSources = glob.glob('*.cpp') + return modelSources + + +def getAmiciLibs(): + """Get list of libraries for the amici base library""" + return ['amici', + 'hdf5_hl_cpp', 'hdf5_hl', 'hdf5_cpp', 'hdf5', + 'sundials_nvecserial', 'sundials_cvodes', 'sundials_idas', + 'klu', 'colamd', 'btf', 'amd', 'suitesparseconfig' + ] + +# Find HDF5 +import pkgconfig +h5pkgcfg = pkgconfig.parse("hdf5") + +cxx_flags = ['-std=c++0x'] +linker_flags = ['${BLAS_LIBRARIES}'] +if 'ENABLE_GCOV_COVERAGE' in os.environ and os.environ['ENABLE_GCOV_COVERAGE'] == 'TRUE': + cxx_flags.extend(['-g', '-O0', '--coverage']) + linker_flags.append('--coverage') + +# Remove the "-Wstrict-prototypes" compiler option, which isn't valid for +# C++ to fix warnings. +cfg_vars = sysconfig.get_config_vars() +for key, value in cfg_vars.items(): + if type(value) == str: + cfg_vars[key] = value.replace("-Wstrict-prototypes", "") + + +# Build shared object +model_module = Extension('TPL_MODELNAME/_TPL_MODELNAME', + sources=['swig/TPL_MODELNAME.i', *getModelSources()], + include_dirs=[os.getcwd(), + os.path.join(amici_path, 'include'), + os.path.join(amici_path, 'ThirdParty/sundials/include'), + os.path.join(amici_path, 'ThirdParty/SuiteSparse/include'), + *h5pkgcfg['include_dirs'] + ], + libraries = [*getAmiciLibs(), 'cblas'], # TODO generic BLAS + library_dirs=[ + *h5pkgcfg['library_dirs'], + os.path.join(amici_path, 'libs')], + swig_opts=['-c++', '-modern', '-outdir', 'TPL_MODELNAME', + '-I%s' % os.path.join(amici_path, 'swig'), + '-I%s' % os.path.join(amici_path, 'include'),], + extra_compile_args=cxx_flags, + extra_link_args=linker_flags + ) + +# Install +setup( + name='TPL_MODELNAME', + version='TPL_VERSION', + description='AMICI-generated module for model TPL_MODELNAME', + url='https://github.com/ICB-DCM/AMICI', + author='model-author-todo', + author_email='model-author-todo', + #license = 'BSD', + ext_modules=[model_module], + packages=find_packages(), + install_requires=[], + python_requires='>=3', + package_data={ + }, + zip_safe = False, + include_package_data=True, + classifiers=[ + 'Development Status :: 3 - Alpha', + 'Intended Audience :: Science/Research', + #'License :: OSI Approved :: BSD License', + 'Operating System :: POSIX :: Linux', + 'Operating System :: MacOS :: MacOS X', + 'Programming Language :: Python', + 'Programming Language :: C++', + 'Topic :: Scientific/Engineering :: Bio-Informatics', + ], +) diff --git a/python/examples/example_steadystate/model_steadystate_scaled.sbml b/python/examples/example_steadystate/model_steadystate_scaled.sbml new file mode 100644 index 0000000000..6b4df7460c --- /dev/null +++ b/python/examples/example_steadystate/model_steadystate_scaled.sbml @@ -0,0 +1,191 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + x1 + + + + + x2 + + + + + x3 + + + + + + + scaling_x1 + x1 + + + + + + + + offset_x2 + x2 + + + + + + x1 + + + + + + + + + + + + + + + + p1 + + + x1 + 2 + + + + + + + + + + + + + + + + + + p2 + x1 + x2 + + + + + + + + + + + + + + + + p3 + x2 + + + + + + + + + + + + + + + + + p4 + x3 + + + + + + + + + + + + + k4 + x3 + + + + + + + + + + + p5 + + + + + + + diff --git a/python/examples/example_steadystate/steadystate.py b/python/examples/example_steadystate/steadystate.py new file mode 100644 index 0000000000..7bf9b7687d --- /dev/null +++ b/python/examples/example_steadystate/steadystate.py @@ -0,0 +1,72 @@ +#!/usr/bin/env python3 +""" +Example using [model_steadystate_scaled.sbml] model to demonstrate and test SBML import and Amici Python interface. + +To use python-generated model in matlab, run: +``` +modelName = ''; +modelDir = ''; +amimodel.compileAndLinkModel(modelName, modelDir, [], [], [], []); +amimodel.generateMatlabWrapper(3, 6, 8, 1, 0, 0, [], [ modelDir '/simulate_test.m'], modelName, 'lin', 1, 1); +``` +""" + +import amici + +import os +import sys +import numpy as np +import matplotlib.pyplot as plt + + +os.chdir(os.path.dirname(__file__)) + +def createModule(): + """Create Python module from SBML model""" + sbmlImporter = amici.SbmlImporter('model_steadystate_scaled.sbml') + sbml = sbmlImporter.sbml + + observables = amici.assignmentRules2observables(sbml, filter=lambda variableId: + variableId.startswith('observable_') and not variableId.endswith('_sigma')) + + print(observables) + + sbmlImporter.sbml2amici('test', 'test', + observables=observables, + constantParameters=['k4'], + sigmas={'observable_x1withsigma': 'observable_x1withsigma_sigma'}) + +def plotStateTrajectories(rdata): + for ix in range(rdata['x'].shape[1]): + plt.plot(rdata['t'], rdata['x'][:, ix], label='$x_%d$' % ix) + plt.xlabel('$t$ (s)') + plt.ylabel('$x_i(t)$ (mmol/ml)') + plt.legend() + plt.title('State trajectories') + plt.show() + +def plotObservableTrajectories(rdata): + for iy in range(rdata['y'].shape[1]): + plt.plot(rdata['t'], rdata['y'][:, iy], label='$y_%d$' % iy) + plt.xlabel('$t$ (s)') + plt.ylabel('$y_i(t)$ (AU)') + plt.legend() + plt.title('Observables') + + plt.show() + +createModule() + +sys.path.insert(0, 'test') +import test as modelModule + +model = modelModule.getModel() +model.setTimepoints(amici.DoubleVector(np.linspace(0, 60, 60))) +solver = model.getSolver() +rdata = amici.runAmiciSimulation(model, solver) + +print(rdata) + +plotStateTrajectories(rdata) +plotObservableTrajectories(rdata) + diff --git a/python/setup.py.in b/python/setup.py.in new file mode 100644 index 0000000000..163e94af96 --- /dev/null +++ b/python/setup.py.in @@ -0,0 +1,90 @@ +from setuptools import find_packages +from distutils.core import setup, Extension +from distutils import sysconfig +import os +import re + +def getAmiciBaseSources(): + """Get list of source files for the amici base library""" + import glob + import re + amiciBaseSources = glob.glob('amici/src/*.cpp') + amiciBaseSources = [src for src in amiciBaseSources if not re.search(r'(matlab)|(\.template\.)', src)] + return amiciBaseSources + +# Remove the "-Wstrict-prototypes" compiler option, which isn't valid for +# C++ to fix warnings. +cfg_vars = sysconfig.get_config_vars() +for key, value in cfg_vars.items(): + if type(value) == str: + cfg_vars[key] = value.replace("-Wstrict-prototypes", "") + +# Find HDF5 include dir +import pkgconfig +h5pkgcfg = pkgconfig.parse("hdf5") + +cxx_flags = ['-std=c++0x'] +linker_flags = ['${BLAS_LIBRARIES}'] +if 'ENABLE_GCOV_COVERAGE' in os.environ and os.environ['ENABLE_GCOV_COVERAGE'] == 'TRUE': + cxx_flags.extend(['-g', '-O0', '--coverage']) + linker_flags.append('--coverage') + +# Build shared object +amici_module = Extension('amici/_amici', + sources=['amici/swig/amici.i', + ], + include_dirs=['amici/include', + 'amici/ThirdParty/SuiteSparse/include', + 'amici/ThirdParty/sundials/include', + 'amici/ThirdParty/sundials/src', + *h5pkgcfg['include_dirs']], # NOTE: requires that pkgconfig knows about hdf5 + libraries=['amici', + 'hdf5_hl_cpp', 'hdf5_hl', 'hdf5_cpp', 'hdf5', + 'sundials_nvecserial', 'sundials_cvodes', 'sundials_idas', + 'klu', 'colamd', 'btf', 'amd', 'suitesparseconfig' + ], + library_dirs=[ + *h5pkgcfg['library_dirs'], + 'amici/libs/', + ], + swig_opts=['-c++', '-modern', '-v', '-Iamici/include/', '-outdir', 'amici/'], + extra_compile_args=cxx_flags, + extra_link_args=linker_flags + ) + +# Install +setup( + name='${PROJECT_NAME}', + version=re.sub(r'v([^-]+)-([^-]+)-(.*)', r'\1.\2+\3', '${AMICI_VERSION}').replace('-','.'), + description='Advanced multi-language Interface to CVODES and IDAS', + url='https://github.com/ICB-DCM/AMICI', + author='${AUTHORS}', + author_email='${AUTHOR_EMAIL}', + license = 'BSD', + ext_modules=[amici_module,], + packages=find_packages(), + install_requires=['symengine', 'python-libsbml', 'h5py'], + python_requires='>=3', + package_data={ + 'amici': ['include/amici/*', + 'src/*template*', + 'swig/*', + 'libs/*', + 'amici.py', + 'setup.py.template', + 'ThirdParty/sundials/include/*/*', + 'ThirdParty/SuiteSparse/include/*'], + }, + zip_safe = False, + include_package_data=True, + classifiers=[ + 'Development Status :: 3 - Alpha', + 'Intended Audience :: Science/Research', + 'License :: OSI Approved :: BSD License', + 'Operating System :: POSIX :: Linux', + 'Operating System :: MacOS :: MacOS X', + 'Programming Language :: Python', + 'Programming Language :: C++', + 'Topic :: Scientific/Engineering :: Bio-Informatics', + ], +) diff --git a/python/test/testSBML.py b/python/test/testSBML.py new file mode 100755 index 0000000000..fc1c22f88b --- /dev/null +++ b/python/test/testSBML.py @@ -0,0 +1,113 @@ +#!/usr/bin/env python3 +"""Run SBML Test Suite and verify simulation results [https://github.com/sbmlteam/sbml-test-suite/releases]""" +import traceback +import os +import sys +import importlib +import numpy as np +import amici + +# directory with sbml semantic test cases +test_path = os.path.join(os.path.dirname(__file__), 'sbml-semantic-test-cases', 'cases', 'semantic') + +def runTest(testId, logfile): + try: + current_test_path = os.path.join(test_path, testId) + + # results + resultsFile = os.path.join(current_test_path, testId + '-results.csv') + results = np.genfromtxt(resultsFile, delimiter=',') + + # model + sbmlFile = findModelFile(current_test_path, testId) + + wrapper = amici.SbmlImporter(sbmlFile) + wrapper.sbml2amici('SBMLTest' + testId) + + # settings + settings = readSettingsFile(current_test_path, testId) + ts = np.linspace(float(settings['start']), float(settings['start']) + float(settings['duration']), + int(settings['steps']) + 1) + atol = float(settings['absolute']) + rtol = float(settings['relative']) + + sys.path.insert(0, wrapper.modelPath) + mod = importlib.import_module(wrapper.modelName) + + model = mod.getModel() + model.setTimepoints(mod.amici.DoubleVector(ts)) + solver = model.getSolver() + solver.setMaxSteps(int(1e6)) + solver.setRelativeTolerance(rtol / 1000.0) + solver.setAbsoluteTolerance(atol / 1000.0) + rdata = amici.runAmiciSimulation(model, solver) + amountSpecies = settings['amount'].replace(' ', '').replace('\n', '').split(',') + simulated_x = rdata['x'] + test_x = results[1:, [1+ wrapper.speciesIndex[variable] for variable in settings['variables'].replace(' ', '').replace('\n', '').split(',') if variable in wrapper.speciesIndex.keys() ] ] + + for species in amountSpecies: + if not species == '': + volume = wrapper.speciesCompartment[wrapper.speciesIndex[species]].subs(wrapper.compartmentSymbols, + wrapper.compartmentVolume) + simulated_x[:, wrapper.speciesIndex[species]] = simulated_x[:, wrapper.speciesIndex[species]] * volume + pass + + adev = abs(simulated_x - test_x) + adev[np.isnan(adev)] = True + rdev = abs((simulated_x - test_x) / test_x) + rdev[np.isnan(rdev)] = True + if (not np.all(np.logical_or(adev < atol, rdev < rtol))): + if (not np.all(adev < atol)): + raise Exception('Absolute tolerance violated') + + if (not np.all(rdev < rtol)): + raise Exception('Relative tolerance violated') + + except amici.SBMLException as err: + print("Did not run test " + testId + ": {0}".format(err)) + pass + + except Exception as err: + str = "Failed test " + testId + ": {0}".format(err) + traceback.print_exc(10) + logfile.write(str + '\n') + return + +def findModelFile(current_test_path, testId): + """Find model file for the given test (guess filename extension)""" + sbmlFile = os.path.join(current_test_path, testId + '-sbml-l3v2.xml') + + # fallback l3v1 + if not os.path.isfile(sbmlFile): + sbmlFile = os.path.join(current_test_path, testId + '-sbml-l3v1.xml') + + # fallback l2v5 + if not os.path.isfile(sbmlFile): + sbmlFile = os.path.join(current_test_path, testId + '-sbml-l2v5.xml') + + return sbmlFile + +def readSettingsFile(current_test_path, testId): + """Read settings for the given test""" + settingsFile = os.path.join(current_test_path, testId + '-settings.txt') + settings = {} + with open(settingsFile) as f: + for line in f: + if not line == '\n': + (key, val) = line.split(':') + settings[key] = val + return settings + + +def getTestStr(testId): + testStr = str(testId) + testStr = '0'*(5-len(testStr)) + testStr + return testStr + +def main(): + for testId in range(1774,1781): + with open("test.txt", "a") as logfile: + runTest(getTestStr(testId), logfile) + +if __name__ == '__main__': + main() \ No newline at end of file diff --git a/scripts/buildAll.sh b/scripts/buildAll.sh index 6e7961025c..c2e8d6c528 100755 --- a/scripts/buildAll.sh +++ b/scripts/buildAll.sh @@ -11,4 +11,3 @@ ${SCRIPT_PATH}/buildSuiteSparse.sh ${SCRIPT_PATH}/buildSundials.sh ${SCRIPT_PATH}/buildCpputest.sh ${SCRIPT_PATH}/buildAmici.sh -${SCRIPT_PATH}/buildTests.sh diff --git a/scripts/buildAmici.sh b/scripts/buildAmici.sh index a5c5a1d476..2ca4ad2d31 100755 --- a/scripts/buildAmici.sh +++ b/scripts/buildAmici.sh @@ -9,5 +9,8 @@ AMICI_PATH="`( cd \"$AMICI_PATH/..\" && pwd )`" mkdir -p ${AMICI_PATH}/build cd ${AMICI_PATH}/build -cmake -DCMAKE_BUILD_TYPE=Debug .. +CPPUTEST_BUILD_DIR=${AMICI_PATH}/ThirdParty/cpputest-master/build/ +CppUTest_DIR=${CPPUTEST_BUILD_DIR} cmake -DCMAKE_BUILD_TYPE=Debug .. make +make python-wheel +pip3 install --user --prefix= `ls -t ${AMICI_PATH}/build/python/amici-*.whl | head -1` diff --git a/scripts/buildCpputest.sh b/scripts/buildCpputest.sh index 98431dfee4..e84ba05a79 100755 --- a/scripts/buildCpputest.sh +++ b/scripts/buildCpputest.sh @@ -17,5 +17,12 @@ if [ ! -d "cpputest-master" ]; then wget -O cpputest-master.zip https://codeload.github.com/cpputest/cpputest/zip/master fi unzip cpputest-master.zip - cd cpputest-master/ && ./autogen.sh && ./configure && make + #cd cpputest-master/ && ./autogen.sh && ./configure && make fi + +cd cpputest-master +mkdir -p build +cd build +cmake -DTESTS=OFF -DBUILD_TESTING=OFF -DC++11=ON .. +make -j4 + diff --git a/scripts/buildModel.sh b/scripts/buildModel.sh new file mode 100755 index 0000000000..1827d40e9d --- /dev/null +++ b/scripts/buildModel.sh @@ -0,0 +1,14 @@ +#!/bin/bash +# +# Build amici tests +# +set -e + +AMICI_PATH="`dirname \"$BASH_SOURCE\"`" +AMICI_PATH="`( cd \"$AMICI_PATH/..\" && pwd )`" + +mkdir -p ${AMICI_PATH}/models/$1/build +cd ${AMICI_PATH}/models/$1/build +cmake -DCMAKE_CXX_STANDARD=11 -DCMAKE_CXX_STANDARD_REQUIRED=ON -DCMAKE_BUILD_TYPE=Release .. +make + diff --git a/scripts/buildSuiteSparse.sh b/scripts/buildSuiteSparse.sh index 108be6d5a6..c2a08ab6ce 100755 --- a/scripts/buildSuiteSparse.sh +++ b/scripts/buildSuiteSparse.sh @@ -7,7 +7,7 @@ set -e AMICI_PATH="`dirname \"$BASH_SOURCE\"`" AMICI_PATH="`( cd \"$AMICI_PATH/..\" && pwd )`" -SUITESPARSE_ROOT="${AMICI_PATH}/SuiteSparse" +SUITESPARSE_ROOT="${AMICI_PATH}/ThirdParty/SuiteSparse" for subdir in SuiteSparse_config BTF AMD CAMD COLAMD KLU do cd ${SUITESPARSE_ROOT}/${subdir} && make library diff --git a/scripts/buildSundials.sh b/scripts/buildSundials.sh index 8200487a14..7c4116047f 100755 --- a/scripts/buildSundials.sh +++ b/scripts/buildSundials.sh @@ -7,14 +7,15 @@ set -e AMICI_PATH="`dirname \"$BASH_SOURCE\"`" AMICI_PATH="`( cd \"$AMICI_PATH/..\" && pwd )`" -SUITESPARSE_ROOT="${AMICI_PATH}/SuiteSparse" -SUNDIALS_BUILD_PATH="${AMICI_PATH}/sundials/build/" +SUITESPARSE_ROOT="${AMICI_PATH}/ThirdParty/SuiteSparse" +SUNDIALS_BUILD_PATH="${AMICI_PATH}/ThirdParty/sundials/build/" mkdir -p ${SUNDIALS_BUILD_PATH} cd ${SUNDIALS_BUILD_PATH} cmake -DCMAKE_INSTALL_PREFIX="${SUNDIALS_BUILD_PATH}" \ -DCMAKE_BUILD_TYPE=Debug \ +-DCMAKE_POSITION_INDEPENDENT_CODE=ON \ -DBUILD_ARKODE=OFF \ -DBUILD_CVODE=OFF \ -DBUILD_IDA=OFF \ diff --git a/scripts/buildTests.sh b/scripts/buildTests.sh deleted file mode 100755 index 6f81371ff1..0000000000 --- a/scripts/buildTests.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash -# -# Build amici tests -# -set -e - -AMICI_PATH="`dirname \"$BASH_SOURCE\"`" -AMICI_PATH="`( cd \"$AMICI_PATH/..\" && pwd )`" - -# Build test models -TESTMODELS="model_dirac model_steadystate model_jakstat_adjoint model_jakstat_adjoint_o2 model_neuron model_neuron_o2 model_events model_nested_events model_robertson" -for MODEL in $TESTMODELS; do - mkdir -p ${AMICI_PATH}/models/${MODEL}/build - cd ${AMICI_PATH}/models/${MODEL}/build - cmake -DCMAKE_CXX_STANDARD=11 -DCMAKE_CXX_STANDARD_REQUIRED=ON -DCMAKE_BUILD_TYPE=Debug .. - make -done; - - -# Build test suite -CPPUTEST_BUILD_DIR=${AMICI_PATH}/ThirdParty/cpputest-master/ -cd ${AMICI_PATH}/tests/cpputest/ -mkdir -p build -cd build -cmake -DCMAKE_CXX_STANDARD=11 -DCMAKE_CXX_STANDARD_REQUIRED=ON -DCMAKE_BUILD_TYPE=Debug -DCPPUTEST_DIR=${CPPUTEST_BUILD_DIR} .. -make - - - -# Save list of testmodels -ENV_FILE=${AMICI_PATH}/scripts/env.sh -touch ${ENV_FILE} && echo export TESTMODELS="${TESTMODELS}" >> ${ENV_FILE} diff --git a/scripts/buildTestsXcode.sh b/scripts/buildTestsXcode.sh index 0ab0b4f601..b6873aac4d 100755 --- a/scripts/buildTestsXcode.sh +++ b/scripts/buildTestsXcode.sh @@ -19,7 +19,6 @@ cd build_xcode cmake -G"Xcode" -DCMAKE_CXX_STANDARD=11 -DCMAKE_CXX_STANDARD_REQUIRED=ON -DCMAKE_BUILD_TYPE=Debug -DCPPUTEST_DIR=${CPPUTEST_BUILD_DIR} .. cp ./../expectedResults.h5 ./expectedResults.h5 -cp ./../writeResults.h5 ./writeResults.h5 mkdir -p ${AMICI_PATH}/build_xcode cd ${AMICI_PATH}/build_xcode diff --git a/scripts/run-cpputest.sh b/scripts/run-cpputest.sh index b4aa128afa..8c5ced7b36 100755 --- a/scripts/run-cpputest.sh +++ b/scripts/run-cpputest.sh @@ -8,7 +8,7 @@ if [ -f ${AMICI_PATH}/scripts/env.sh ]; then fi # run tests -cd ${AMICI_PATH}/tests/cpputest/build +cd ${AMICI_PATH}/build ctest -V mv ${AMICI_PATH}/tests/cpputest/writeResults.h5 ${AMICI_PATH}/tests/cpputest/writeResults.h5.bak diff --git a/scripts/run-doxygen.sh b/scripts/run-doxygen.sh index 46e1bb4876..4207f04b1d 100755 --- a/scripts/run-doxygen.sh +++ b/scripts/run-doxygen.sh @@ -17,56 +17,58 @@ if [ ! -d "mtocpp-master" ]; then fi unzip mtocpp-master.zip mkdir ./mtocpp-master/build - cd ./mtocpp-master/build && cmake .. && make + cd ./mtocpp-master/build && cmake .. && make mtocpp mtocpp_post if [ $? -ne 0 ] ; then exit 1 fi fi cd ${AMICI_PATH} - +MTOC_CONFIG_PATH=${AMICI_PATH}/matlab/mtoc/config # generate filter -echo "$AMICI_PATH/ThirdParty/mtocpp-master/build/mtocpp \$1 $AMICI_PATH/mtoc/config/mtocpp.conf" > ${AMICI_PATH}/mtoc/config/mtocpp_filter.sh +echo "$AMICI_PATH/ThirdParty/mtocpp-master/build/mtocpp \$1 ${MTOC_CONFIG_PATH}/mtocpp.conf" > ${MTOC_CONFIG_PATH}/mtocpp_filter.sh -chmod +x ${AMICI_PATH}/mtoc/config/mtocpp_filter.sh +chmod +x ${MTOC_CONFIG_PATH}/mtocpp_filter.sh # generate doxyfile -cp ${AMICI_PATH}/mtoc/config/Doxyfile.template ${AMICI_PATH}/mtoc/config/Doxyfile - -sed -i -e "s#_OutputDir_#$AMICI_PATH/doc#g" ${AMICI_PATH}/mtoc/config/Doxyfile -sed -i -e "s#_SourceDir_#$AMICI_PATH#g" ${AMICI_PATH}/mtoc/config/Doxyfile -sed -i -e "s#_ConfDir_#$AMICI_PATH/mtoc/config#g" ${AMICI_PATH}/mtoc/config/Doxyfile -sed -i -e "s#_ProjectName_#AMICI#g" ${AMICI_PATH}/mtoc/config/Doxyfile -sed -i -e "s#_ProjectDescription_#Advanced Matlab Interface for CVODES and IDAS#g" ${AMICI_PATH}/mtoc/config/Doxyfile -sed -i -e "s#_ProjectLogo_##g" ${AMICI_PATH}/mtoc/config/Doxyfile -sed -i -e "s#_ProjectVersion_##g" ${AMICI_PATH}/mtoc/config/Doxyfile -sed -i -e "s#_MTOCFILTER_#$AMICI_PATH/mtoc/config/mtocpp_filter.sh#g" ${AMICI_PATH}/mtoc/config/Doxyfile -sed -i -e "s#_LatexExtras_#$AMICI_PATH/mtoc/config/latexextras#g" ${AMICI_PATH}/mtoc/config/Doxyfile -sed -i -e "s#_GenLatex_#YES#g" ${AMICI_PATH}/mtoc/config/Doxyfile -sed -i -e "s#_HaveDot_#YES#g" ${AMICI_PATH}/mtoc/config/Doxyfile -sed -i -e "s#WARN_LOGFILE =#WARN_LOGFILE =$AMICI_PATH/mtoc/warnings.log#g" ${AMICI_PATH}/mtoc/config/Doxyfile +DOXYFILE=${MTOC_CONFIG_PATH}/Doxyfile +cp ${MTOC_CONFIG_PATH}/Doxyfile.template ${DOXYFILE} +DOXY_WARNING_FILE=${AMICI_PATH}/matlab/mtoc/warnings.log + +sed -i -e "s#_OutputDir_#$AMICI_PATH/doc#g" ${DOXYFILE} +sed -i -e "s#_SourceDir_#$AMICI_PATH#g" ${DOXYFILE} +sed -i -e "s#_ConfDir_#${MTOC_CONFIG_PATH}#g" ${DOXYFILE} +sed -i -e "s#_ProjectName_#AMICI#g" ${DOXYFILE} +sed -i -e "s#_ProjectDescription_#Advanced Multilanguage Interface for CVODES and IDAS#g" ${DOXYFILE} +sed -i -e "s#_ProjectLogo_##g" ${DOXYFILE} +sed -i -e "s#_ProjectVersion_##g" ${DOXYFILE} +sed -i -e "s#_MTOCFILTER_#${MTOC_CONFIG_PATH}/mtocpp_filter.sh#g" ${DOXYFILE} +sed -i -e "s#_LatexExtras_#${MTOC_CONFIG_PATH}/latexextras#g" ${DOXYFILE} +sed -i -e "s#_GenLatex_#YES#g" ${DOXYFILE} +sed -i -e "s#_HaveDot_#YES#g" ${DOXYFILE} +sed -i -e "s#WARN_LOGFILE =#WARN_LOGFILE =${DOXY_WARNING_FILE}#g" ${DOXYFILE} # generate latexextras -cp ${AMICI_PATH}/mtoc/config/latexextras.template ${AMICI_PATH}/mtoc/config/latexextras.sty -sed -i -e "s#_ConfDir_#$AMICI_PATH/mtoc/config#g" ${AMICI_PATH}/mtoc/config/latexextras.sty +cp ${MTOC_CONFIG_PATH}/latexextras.template ${MTOC_CONFIG_PATH}/latexextras.sty +sed -i -e "s#_ConfDir_#${MTOC_CONFIG_PATH}#g" ${MTOC_CONFIG_PATH}/latexextras.sty -doxygen "$AMICI_PATH/mtoc/config/Doxyfile" -doxygen "$AMICI_PATH/mtoc/config/Doxyfile" +doxygen "${DOXYFILE}" +doxygen "${DOXYFILE}" #cleanup #rm ${AMICI_PATH}/mtoc/config/latexextras.sty -rm ${AMICI_PATH}/mtoc/config/Doxyfile -rm ${AMICI_PATH}/mtoc/config/mtocpp_filter.sh +rm ${DOXYFILE} +rm ${MTOC_CONFIG_PATH}/mtocpp_filter.sh # check if warnings log was created -if [ -f ${AMICI_PATH}/mtoc/warnings.log ]; then +if [ -f ${DOXY_WARNING_FILE} ]; then # check if warnings log is empty -if [ -s ${AMICI_PATH}/mtoc/warnings.log ]; then + if [ -s ${DOXY_WARNING_FILE} ]; then echo "DOXYGEN failed:" - cat ${AMICI_PATH}/mtoc/warnings.log - rm ${AMICI_PATH}/mtoc/warnings.log + cat ${DOXY_WARNING_FILE} + rm ${DOXY_WARNING_FILE} exit 1 else exit 0 diff --git a/scripts/run-python_unittest.sh b/scripts/run-python_unittest.sh new file mode 100755 index 0000000000..b888fe89b1 --- /dev/null +++ b/scripts/run-python_unittest.sh @@ -0,0 +1,13 @@ +#!/bin/bash +AMICI_PATH="`dirname \"$0\"`" +AMICI_PATH="`( cd \"$AMICI_PATH/..\" && pwd )`" + +# read environment variables put there by build script +if [ -f ${AMICI_PATH}/scripts/env.sh ]; then + . ${AMICI_PATH}/scripts/env.sh +fi + +# run tests +cd ${AMICI_PATH}/tests/ + +./testModels.py diff --git a/scripts/run-valgrind.sh b/scripts/run-valgrind.sh index 00a3386db5..c609d375dc 100755 --- a/scripts/run-valgrind.sh +++ b/scripts/run-valgrind.sh @@ -14,12 +14,12 @@ fi set -e # run tests -cd ${AMICI_PATH}/tests/cpputest/build +cd ${AMICI_PATH}/build/tests/cpputest/ VALGRIND_OPTS="--leak-check=full --error-exitcode=1 --trace-children=yes --show-leak-kinds=definite" - -for MODEL in `ctest -N | grep "Test[ ]*#" | grep -v unittests | sed -E 's/ *Test[ ]*#[0-9]+: (.*)/\1/'` - do cd ${AMICI_PATH}/tests/cpputest/build/${MODEL}/ && valgrind ${VALGRIND_OPTS} ./model_${MODEL}_test +set -x +for MODEL in `ctest -N | grep "Test[ ]*#" | grep -v unittests | sed -E 's/ *Test[ ]*#[0-9]+: model_(.*)_test/\1/'` + do cd ${AMICI_PATH}/build/tests/cpputest/${MODEL}/ && valgrind ${VALGRIND_OPTS} ./model_${MODEL}_test done cd ${AMICI_PATH}/tests/cpputest/build/unittests/ && valgrind ${VALGRIND_OPTS} ./unittests rm ${AMICI_PATH}/tests/cpputest/writeResults.h5 diff --git a/src/CMakeLists.template.txt b/src/CMakeLists.template.txt index 5bfdef9f63..eb5d38bbc8 100644 --- a/src/CMakeLists.template.txt +++ b/src/CMakeLists.template.txt @@ -1,5 +1,7 @@ project(TPL_MODELNAME) +set(CMAKE_POSITION_INDEPENDENT_CODE ON) + cmake_minimum_required(VERSION 2.8) set(CMAKE_CXX_STANDARD 11) @@ -16,30 +18,47 @@ foreach(FLAG ${MY_CXX_FLAGS}) endforeach(FLAG) find_package(Amici HINTS ${CMAKE_CURRENT_LIST_DIR}/../../build) -get_property(AmiciConfigIncludes TARGET Upstream::amici PROPERTY INCLUDE_DIRECTORIES) - -set(MODEL_DIR "${Amici_DIR}/../models/TPL_MODELNAME") -include_directories("${CMAKE_CURRENT_SOURCE_DIR}") -include_directories(${AmiciConfigIncludes}) +set(MODEL_DIR ${CMAKE_CURRENT_LIST_DIR}) set(SRC_LIST_LIB TPL_SOURCES ${MODEL_DIR}/wrapfunctions.cpp ) - + add_library(${PROJECT_NAME} ${SRC_LIST_LIB}) +add_library(model ALIAS ${PROJECT_NAME}) + +target_include_directories(${PROJECT_NAME} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}") -target_link_libraries( - ${PROJECT_NAME} - Upstream::amici +target_link_libraries(${PROJECT_NAME} + PUBLIC Upstream::amici ) set(SRC_LIST_EXE main.cpp) add_executable(simulate_${PROJECT_NAME} ${SRC_LIST_EXE}) -target_link_libraries(simulate_${PROJECT_NAME} ${PROJECT_NAME} Upstream::amici) +target_link_libraries(simulate_${PROJECT_NAME} ${PROJECT_NAME}) if($ENV{ENABLE_GCOV_COVERAGE}) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 --coverage") endif() + +## SWIG + +add_subdirectory(swig) + +# +include(GNUInstallDirs) +install(TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}Targets + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} +) +export(EXPORT ${PROJECT_NAME}Targets FILE ${PROJECT_NAME}Config.cmake + NAMESPACE Upstream:: + ) +# + diff --git a/src/wrapfunctions.ODE_template.h b/src/wrapfunctions.ODE_template.h new file mode 100644 index 0000000000..eae2660592 --- /dev/null +++ b/src/wrapfunctions.ODE_template.h @@ -0,0 +1,700 @@ +#ifndef _amici_wrapfunctions_h +#define _amici_wrapfunctions_h +#include +#include +#include "amici/defines.h" +#include //SlsMat definition +#include "amici/solver_cvodes.h" +#include "amici/model_ode.h" + +namespace amici { +class Solver; +} + +#define pi M_PI + +/** + * @brief Wrapper function to instantiate the linked Amici model without knowing the name at compile time. + * @return + */ +std::unique_ptr getModel(); +extern void J_TPL_MODELNAME(realtype *J, const realtype t, const realtype *x, const double *p, const double *k, const realtype *h, const realtype *w, const realtype *dwdx); +extern void JB_TPL_MODELNAME(realtype *JB, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h, const realtype *xB, const realtype *w, const realtype *dwdx); +extern void JDiag_TPL_MODELNAME(realtype *JDiag, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h, const realtype *w, const realtype *dwdx); +extern void JSparse_TPL_MODELNAME(SlsMat JSparse, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h, const realtype *w, const realtype *dwdx); +extern void JSparseB_TPL_MODELNAME(SlsMat JSparseB, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h, const realtype *xB, const realtype *w, const realtype *dwdx); +extern void Jv_TPL_MODELNAME(realtype *Jv, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h, const realtype *v, const realtype *w, const realtype *dwdx); +extern void JvB_TPL_MODELNAME(realtype *JvB, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h, const realtype *xB, const realtype *vB, const realtype *w, const realtype *dwdx); +extern void Jy_TPL_MODELNAME(double *nllh, const int iy, const realtype *p, const realtype *k, const double *y, const double *sigmay, const double *my); +extern void dJydsigma_TPL_MODELNAME(double *dJydsigma, const int iy, const realtype *p, const realtype *k, const double *y, const double *sigmay, const double *my); +extern void dJydy_TPL_MODELNAME(double *dJydy, const int iy, const realtype *p, const realtype *k, const double *y, const double *sigmay, const double *my); +extern void dwdp_TPL_MODELNAME(realtype *dwdp, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h, const realtype *w); +extern void dwdx_TPL_MODELNAME(realtype *dwdx, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h, const realtype *w); +extern void dxdotdp_TPL_MODELNAME(realtype *dxdotdp, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h, const int ip, const realtype *w, const realtype *dwdp); +extern void dydx_TPL_MODELNAME(double *dydx, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h); +extern void qBdot_TPL_MODELNAME(realtype *qBdot, const int ip, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h, const realtype *xB, const realtype *w, const realtype *dwdp); +extern void sigma_y_TPL_MODELNAME(double *sigmay, const realtype t, const realtype *p, const realtype *k); +extern void sxdot_TPL_MODELNAME(realtype *sxdot, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h, const int ip, const realtype *sx, const realtype *w, const realtype *dwdx, const realtype *J, const realtype *dxdotdp); +extern void w_TPL_MODELNAME(realtype *w, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h); +extern void x0_TPL_MODELNAME(realtype *x0, const realtype t, const realtype *p, const realtype *k); +extern void xBdot_TPL_MODELNAME(realtype *xBdot, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h, const realtype *xB, const realtype *w, const realtype *dwdx); +extern void xdot_TPL_MODELNAME(realtype *xdot, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h, const realtype *w); +extern void y_TPL_MODELNAME(double *y, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h); + +/** + * @brief AMICI-generated model subclass. + */ +class Model_TPL_MODELNAME : public amici::Model_ODE { +public: + /** + * @brief Default constructor. + */ + Model_TPL_MODELNAME() + : amici::Model_ODE( + TPL_NX, // nx + TPL_NXTRUE, // nxtrue + TPL_NY, // ny + TPL_NYTRUE, // nytrue + TPL_NZ, // nz + TPL_NZTRUE, // nztrue + TPL_NEVENT, // nevent + TPL_NOBJECTIVE, // nobjective + TPL_NW, // nw + TPL_NDWDDX, // ndwddx + TPL_NDWDP, // ndwdp + TPL_NNZ, // nnz + TPL_UBW, // ubw + TPL_LBW, // lbw + TPL_O2MODE, // o2mode + std::vector{TPL_PARAMETERS}, // dynamic parameters + std::vector{TPL_FIXED_PARAMETERS}, // fixedParameters + std::vector{}, // plist + std::vector(TPL_NX,0.0), // idlist + std::vector{} // z2event + ) + {} + + /** + * @brief Clone this model instance. + * @return A deep copy of this instance. + */ + virtual amici::Model* clone() const override { return new Model_TPL_MODELNAME(*this); } + + /** model specific implementation for fJ + * @param J Matrix to which the Jacobian will be written + * @param t timepoint + * @param x Vector with the states + * @param p parameter vector + * @param k constants vector + * @param h heavyside vector + * @param w vector with helper variables + * @param dwdx derivative of w wrt x + **/ + virtual void fJ(realtype *J, const realtype t, const realtype *x, const double *p, const double *k, const realtype *h, const realtype *w, const realtype *dwdx) override { + J_TPL_MODELNAME(J, t, x, p, k, h, w, dwdx); + } + + /** model specific implementation for fJB + * @param JB Matrix to which the Jacobian will be written + * @param t timepoint + * @param x Vector with the states + * @param p parameter vector + * @param k constants vector + * @param h heavyside vector + * @param xB Vector with the adjoint states + * @param w vector with helper variables + * @param dwdx derivative of w wrt x + **/ + virtual void fJB(realtype *JB, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h, const realtype *xB, const realtype *w, const realtype *dwdx) override { + JB_TPL_MODELNAME(JB, t, x, p, k, h, xB, w, dwdx); + } + + /** model specific implementation for fJDiag + * @param JDiag Matrix to which the Jacobian will be written + * @param t timepoint + * @param x Vector with the states + * @param p parameter vector + * @param k constants vector + * @param h heavyside vector + * @param w vector with helper variables + * @param dwdx derivative of w wrt x + **/ + virtual void fJDiag(realtype *JDiag, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h, const realtype *w, const realtype *dwdx) override { + JDiag_TPL_MODELNAME(JDiag, t, x, p, k, h, w, dwdx); + } + + /** model specific implementation for fJSparse + * @param JSparse Matrix to which the Jacobian will be written + * @param t timepoint + * @param x Vector with the states + * @param p parameter vector + * @param k constants vector + * @param h heavyside vector + * @param w vector with helper variables + * @param dwdx derivative of w wrt x + **/ + virtual void fJSparse(SlsMat JSparse, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h, const realtype *w, const realtype *dwdx) override { + JSparse_TPL_MODELNAME(JSparse, t, x, p, k, h, w, dwdx); + } + + /** model specific implementation for fJSparseB + * @param JSparseB Matrix to which the Jacobian will be written + * @param t timepoint + * @param x Vector with the states + * @param p parameter vector + * @param k constants vector + * @param h heavyside vector + * @param xB Vector with the adjoint states + * @param w vector with helper variables + * @param dwdx derivative of w wrt x + **/ + virtual void fJSparseB(SlsMat JSparseB, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h, const realtype *xB, const realtype *w, const realtype *dwdx) override { + JSparseB_TPL_MODELNAME(JSparseB, t, x, p, k, h, xB, w, dwdx); + } + + /** model specific implementation of fJrz + * @param nllh regularization for event measurements z + * @param iz event output index + * @param p parameter vector + * @param k constant vector + * @param z model event output at timepoint + * @param sigmaz event measurement standard deviation at timepoint + **/ + virtual void fJrz(double *nllh, const int iz, const realtype *p, const realtype *k, const double *rz, const double *sigmaz) override { + } + + /** model specific implementation for fJv + * @param Jv Matrix vector product of J with a vector v + * @param t timepoint + * @param x Vector with the states + * @param p parameter vector + * @param k constants vector + * @param h heavyside vector + * @param v Vector with which the Jacobian is multiplied + * @param w vector with helper variables + * @param dwdx derivative of w wrt x + **/ + virtual void fJv(realtype *Jv, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h, const realtype *v, const realtype *w, const realtype *dwdx) override { + Jv_TPL_MODELNAME(Jv, t, x, p, k, h, v, w, dwdx); + } + + /** model specific implementation for fJvB + * @param JvB Matrix vector product of JB with a vector v + * @param t timepoint + * @param x Vector with the states + * @param p parameter vector + * @param k constants vector + * @param h heavyside vector + * @param xB Vector with the adjoint states + * @param vB Vector with which the Jacobian is multiplied + * @param w vector with helper variables + * @param dwdx derivative of w wrt x + **/ + virtual void fJvB(realtype *JvB, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h, const realtype *xB, const realtype *vB, const realtype *w, const realtype *dwdx) override { + JvB_TPL_MODELNAME(JvB, t, x, p, k, h, xB, vB, w, dwdx); + } + + /** model specific implementation of fJy + * @param nllh negative log-likelihood for measurements y + * @param iy output index + * @param p parameter vector + * @param k constant vector + * @param y model output at timepoint + * @param sigmay measurement standard deviation at timepoint + * @param my measurements at timepoint + **/ + virtual void fJy(double *nllh, const int iy, const realtype *p, const realtype *k, const double *y, const double *sigmay, const double *my) override { + Jy_TPL_MODELNAME(nllh, iy, p, k, y, sigmay, my); + } + + /** model specific implementation of fJz + * @param nllh negative log-likelihood for event measurements z + * @param iz event output index + * @param p parameter vector + * @param k constant vector + * @param z model event output at timepoint + * @param sigmaz event measurement standard deviation at timepoint + * @param mz event measurements at timepoint + **/ + virtual void fJz(double *nllh, const int iz, const realtype *p, const realtype *k, const double *z, const double *sigmaz, const double *mz) override { + } + + /** model specific implementation of fdJrzdsigma + * @param dJrzdsigma Sensitivity of event penalization Jrz w.r.t. + * standard deviation sigmaz + * @param iz event output index + * @param p parameter vector + * @param k constant vector + * @param rz model root output at timepoint + * @param sigmaz event measurement standard deviation at timepoint + **/ + virtual void fdJrzdsigma(double *dJrzdsigma, const int iz, const realtype *p, const realtype *k, const double *rz, const double *sigmaz) override { + } + + /** model specific implementation of fdJrzdz + * @param dJrzdz partial derivative of event penalization Jrz + * @param iz event output index + * @param p parameter vector + * @param k constant vector + * @param rz model root output at timepoint + * @param sigmaz event measurement standard deviation at timepoint + **/ + virtual void fdJrzdz(double *dJrzdz, const int iz, const realtype *p, const realtype *k, const double *rz, const double *sigmaz) override { + } + + /** model specific implementation of fdJydsigma + * @param dJydsigma Sensitivity of time-resolved measurement + * negative log-likelihood Jy w.r.t. standard deviation sigmay + * @param iy output index + * @param p parameter vector + * @param k constant vector + * @param y model output at timepoint + * @param sigmay measurement standard deviation at timepoint + * @param my measurement at timepoint + **/ + virtual void fdJydsigma(double *dJydsigma, const int iy, const realtype *p, const realtype *k, const double *y, const double *sigmay, const double *my) override { + dJydsigma_TPL_MODELNAME(dJydsigma, iy, p, k, y, sigmay, my); + } + + /** model specific implementation of fdJydy + * @param dJydy partial derivative of time-resolved measurement negative log-likelihood Jy + * @param iy output index + * @param p parameter vector + * @param k constant vector + * @param y model output at timepoint + * @param sigmay measurement standard deviation at timepoint + * @param my measurement at timepoint + **/ + virtual void fdJydy(double *dJydy, const int iy, const realtype *p, const realtype *k, const double *y, const double *sigmay, const double *my) override { + dJydy_TPL_MODELNAME(dJydy, iy, p, k, y, sigmay, my); + } + + /** model specific implementation of fdJzdsigma + * @param dJzdsigma Sensitivity of event measurement + * negative log-likelihood Jz w.r.t. standard deviation sigmaz + * @param iz event output index + * @param p parameter vector + * @param k constant vector + * @param z model event output at timepoint + * @param sigmaz event measurement standard deviation at timepoint + * @param mz event measurement at timepoint + **/ + virtual void fdJzdsigma(double *dJzdsigma, const int iz, const realtype *p, const realtype *k, const double *z, const double *sigmaz, const double *mz) override { + } + + /** model specific implementation of fdJzdz + * @param dJzdz partial derivative of event measurement negative log-likelihood Jz + * @param iz event output index + * @param p parameter vector + * @param k constant vector + * @param z model event output at timepoint + * @param sigmaz event measurement standard deviation at timepoint + * @param mz event measurement at timepoint + **/ + virtual void fdJzdz(double *dJzdz, const int iz, const realtype *p, const realtype *k, const double *z, const double *sigmaz, const double *mz) override { + } + + /** model specific implementation of fdeltasx + * @param deltaqB sensitivity update + * @param t current time + * @param x current state + * @param p parameter vector + * @param k constant vector + * @param h heavyside vector + * @param ip sensitivity index + * @param ie event index + * @param xdot new model right hand side + * @param xdot_old previous model right hand side + * @param xB adjoint state + **/ + virtual void fdeltaqB(double *deltaqB, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h, const int ip, const int ie, const realtype *xdot, const realtype *xdot_old, const realtype *xB) override { + } + + /** model specific implementation of fdeltasx + * @param deltasx sensitivity update + * @param t current time + * @param x current state + * @param p parameter vector + * @param k constant vector + * @param h heavyside vector + * @param w repeating elements vector + * @param ip sensitivity index + * @param ie event index + * @param xdot new model right hand side + * @param xdot_old previous model right hand side + * @param sx state sensitivity + * @param stau event-time sensitivity + **/ + virtual void fdeltasx(double *deltasx, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h, const realtype *w, const int ip, const int ie, const realtype *xdot, const realtype *xdot_old, const realtype *sx, const realtype *stau) override { + } + + /** model specific implementation of fdeltax + * @param deltax state update + * @param t current time + * @param x current state + * @param p parameter vector + * @param k constant vector + * @param h heavyside vector + * @param ie event index + * @param xdot new model right hand side + * @param xdot_old previous model right hand side + **/ + virtual void fdeltax(double *deltax, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h, const int ie, const realtype *xdot, const realtype *xdot_old) override { + } + + /** model specific implementation of fdeltaxB + * @param deltaxB adjoint state update + * @param t current time + * @param x current state + * @param p parameter vector + * @param k constant vector + * @param h heavyside vector + * @param ie event index + * @param xdot new model right hand side + * @param xdot_old previous model right hand side + * @param xB current adjoint state + **/ + virtual void fdeltaxB(double *deltaxB, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h, const int ie, const realtype *xdot, const realtype *xdot_old, const realtype *xB) override { + } + + /** model specific implementation of fdrzdp + * @param drzdp partial derivative of root output rz w.r.t. model parameters p + * @param ie event index + * @param t current time + * @param x current state + * @param p parameter vector + * @param k constant vector + * @param h heavyside vector + * @param ip parameter index w.r.t. which the derivative is requested + **/ + virtual void fdrzdp(double *drzdp, const int ie, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h, const int ip) override { + } + + /** model specific implementation of fdrzdx + * @param drzdx partial derivative of root output rz w.r.t. model states x + * @param ie event index + * @param t current time + * @param x current state + * @param p parameter vector + * @param k constant vector + * @param h heavyside vector + **/ + virtual void fdrzdx(double *drzdx, const int ie, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h) override { + } + + /** model specific implementation of fsigmay + * @param dsigmaydp partial derivative of standard deviation of measurements + * @param t current time + * @param p parameter vector + * @param k constant vector + * @param ip sensitivity index + **/ + virtual void fdsigma_ydp(double *dsigmaydp, const realtype t, const realtype *p, const realtype *k, const int ip) override { + } + + /** model specific implementation of fsigmaz + * @param dsigmazdp partial derivative of standard deviation of event measurements + * @param t current time + * @param p parameter vector + * @param k constant vector + * @param ip sensitivity index + **/ + virtual void fdsigma_zdp(double *dsigmazdp, const realtype t, const realtype *p, const realtype *k, const int ip) override { + } + + /** model specific implementation of dwdp + * @param dwdp Recurring terms in xdot, parameter derivative + * @param t timepoint + * @param x Vector with the states + * @param p parameter vector + * @param k constants vector + * @param h heavyside vector + * @param w vector with helper variables + */ + virtual void fdwdp(realtype *dwdp, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h, const realtype *w) override { + dwdp_TPL_MODELNAME(dwdp, t, x, p, k, h, w); + } + + /** model specific implementation of dwdx + * @param dwdx Recurring terms in xdot, state derivative + * @param t timepoint + * @param x Vector with the states + * @param p parameter vector + * @param k constants vector + * @param h heavyside vector + * @param w vector with helper variables + */ + virtual void fdwdx(realtype *dwdx, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h, const realtype *w) override { + dwdx_TPL_MODELNAME(dwdx, t, x, p, k, h, w); + } + + /** model specific implementation of fdxdotdp + * @param dxdotdp partial derivative xdot wrt p + * @param t timepoint + * @param x Vector with the states + * @param p parameter vector + * @param k constants vector + * @param h heavyside vector + * @param ip parameter index + * @param w vector with helper variables + * @param dwdp derivative of w wrt p + */ + virtual void fdxdotdp(realtype *dxdotdp, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h, const int ip, const realtype *w, const realtype *dwdp) override { + dxdotdp_TPL_MODELNAME(dxdotdp, t, x, p, k, h, ip, w, dwdp); + } + + /** model specific implementation of fdydp + * @param dydp partial derivative of observables y w.r.t. model parameters p + * @param t current time + * @param x current state + * @param p parameter vector + * @param k constant vector + * @param h heavyside vector + * @param ip parameter index w.r.t. which the derivative is requested + **/ + virtual void fdydp(double *dydp, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h, const int ip) override { + } + + /** model specific implementation of fdydx + * @param dydx partial derivative of observables y w.r.t. model states x + * @param t current time + * @param x current state + * @param p parameter vector + * @param k constant vector + * @param h heavyside vector + **/ + virtual void fdydx(double *dydx, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h) override { + dydx_TPL_MODELNAME(dydx, t, x, p, k, h); + } + + /** model specific implementation of fdzdp + * @param dzdp partial derivative of event-resolved output z w.r.t. model parameters p + * @param ie event index + * @param t current time + * @param x current state + * @param p parameter vector + * @param k constant vector + * @param h heavyside vector + * @param ip parameter index w.r.t. which the derivative is requested + **/ + virtual void fdzdp(double *dzdp, const int ie, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h, const int ip) override { + } + + /** model specific implementation of fdzdx + * @param dzdx partial derivative of event-resolved output z w.r.t. model states x + * @param ie event index + * @param t current time + * @param x current state + * @param p parameter vector + * @param k constant vector + * @param h heavyside vector + **/ + virtual void fdzdx(double *dzdx, const int ie, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h) override { + } + + /** model specific implementation for fqBdot + * @param qBdot adjoint quadrature equation + * @param ip sensitivity index + * @param t timepoint + * @param x Vector with the states + * @param p parameter vector + * @param k constants vector + * @param h heavyside vector + * @param xB Vector with the adjoint states + * @param w vector with helper variables + * @param dwdp derivative of w wrt p + **/ + virtual void fqBdot(realtype *qBdot, const int ip, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h, const realtype *xB, const realtype *w, const realtype *dwdp) override { + qBdot_TPL_MODELNAME(qBdot, ip, t, x, p, k, h, xB, w, dwdp); + } + + /** model specific implementation for froot + * @param root values of the trigger function + * @param t timepoint + * @param x Vector with the states + * @param p parameter vector + * @param k constants vector + * @param h heavyside vector + **/ + virtual void froot(realtype *root, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h) override { + } + + /** model specific implementation of frz + * @param rz value of root function at current timepoint (non-output events not included) + * @param ie event index + * @param t current time + * @param x current state + * @param p parameter vector + * @param k constant vector + * @param h heavyside vector + **/ + virtual void frz(double *rz, const int ie, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h) override { + } + + /** model specific implementation of fsigmay + * @param sigmay standard deviation of measurements + * @param t current time + * @param p parameter vector + * @param k constant vector + **/ + virtual void fsigma_y(double *sigmay, const realtype t, const realtype *p, const realtype *k) override { + sigma_y_TPL_MODELNAME(sigmay, t, p, k); + } + + /** model specific implementation of fsigmaz + * @param sigmaz standard deviation of event measurements + * @param t current time + * @param p parameter vector + * @param k constant vector + **/ + virtual void fsigma_z(double *sigmaz, const realtype t, const realtype *p, const realtype *k) override { + } + + /** model specific implementation of fsrz + * @param srz Sensitivity of rz, total derivative + * @param ie event index + * @param t current time + * @param x current state + * @param p parameter vector + * @param k constant vector + * @param sx current state sensitivity + * @param h heavyside vector + * @param ip sensitivity index + **/ + virtual void fsrz(double *srz, const int ie, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h, const realtype *sx, const int ip) override { + } + + /** model specific implementation of fstau + * @param stau total derivative of event timepoint + * @param t current time + * @param x current state + * @param p parameter vector + * @param k constant vector + * @param h heavyside vector + * @param sx current state sensitivity + * @param ip sensitivity index + * @param ie event index + **/ + virtual void fstau(double *stau, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h, const realtype *sx, const int ip, const int ie) override { + } + + /** model specific implementation of fsx0 + * @param sx0 initial state sensitivities + * @param t initial time + * @param x0 initial state + * @param p parameter vector + * @param k constant vector + * @param ip sensitivity index + **/ + virtual void fsx0(realtype *sx0, const realtype t,const realtype *x0, const realtype *p, const realtype *k, const int ip) override { + } + + /** model specific implementation of fsxdot + * @param sxdot sensitivity rhs + * @param t timepoint + * @param x Vector with the states + * @param p parameter vector + * @param k constants vector + * @param h heavyside vector + * @param ip parameter index + * @param sx Vector with the state sensitivities + * @param w vector with helper variables + * @param dwdx derivative of w wrt x + * @param J jacobian + * @param dxdotdp parameter derivative of residual function + */ + virtual void fsxdot(realtype *sxdot, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h, const int ip, const realtype *sx, const realtype *w, const realtype *dwdx, const realtype *J, const realtype *dxdotdp) override { + sxdot_TPL_MODELNAME(sxdot, t, x, p, k, h, ip, sx, w, dwdx, J, dxdotdp); + } + + /** model specific implementation of fsz + * @param sz Sensitivity of rz, total derivative + * @param ie event index + * @param t current time + * @param x current state + * @param p parameter vector + * @param k constant vector + * @param h heavyside vector + * @param sx current state sensitivity + * @param ip sensitivity index + **/ + virtual void fsz(double *sz, const int ie, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h, const realtype *sx, const int ip) override { + } + + /** model specific implementation of fw + * @param w Recurring terms in xdot + * @param t timepoint + * @param x Vector with the states + * @param p parameter vector + * @param k constants vector + * @param h heavyside vector + */ + virtual void fw(realtype *w, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h) override { + w_TPL_MODELNAME(w, t, x, p, k, h); + } + + /** model specific implementation of fx0 + * @param x0 initial state + * @param t initial time + * @param p parameter vector + * @param k constant vector + **/ + virtual void fx0(realtype *x0, const realtype t, const realtype *p, const realtype *k) override { + x0_TPL_MODELNAME(x0, t, p, k); + } + + /** model specific implementation for fxBdot + * @param xBdot adjoint residual function + * @param t timepoint + * @param x Vector with the states + * @param p parameter vector + * @param k constants vector + * @param h heavyside vector + * @param xB Vector with the adjoint states + * @param w vector with helper variables + * @param dwdx derivative of w wrt x + **/ + virtual void fxBdot(realtype *xBdot, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h, const realtype *xB, const realtype *w, const realtype *dwdx) override { + xBdot_TPL_MODELNAME(xBdot, t, x, p, k, h, xB, w, dwdx); + } + + /** model specific implementation for fxdot + * @param xdot residual function + * @param t timepoint + * @param x Vector with the states + * @param p parameter vector + * @param k constants vector + * @param h heavyside vector + * @param w vector with helper variables + **/ + virtual void fxdot(realtype *xdot, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h, const realtype *w) override { + xdot_TPL_MODELNAME(xdot, t, x, p, k, h, w); + } + + /** model specific implementation of fy + * @param y model output at current timepoint + * @param t current time + * @param x current state + * @param p parameter vector + * @param k constant vector + * @param h heavyside vector + **/ + virtual void fy(double *y, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h) override { + y_TPL_MODELNAME(y, t, x, p, k, h); + } + + /** model specific implementation of fz + * @param z value of event output + * @param ie event index + * @param t current time + * @param x current state + * @param p parameter vector + * @param k constant vector + * @param h heavyside vector + **/ + virtual void fz(double *z, const int ie, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h) override { + } + +}; + +#endif /* _amici_wrapfunctions_h */ diff --git a/src/wrapfunctions.template.cpp b/src/wrapfunctions.template.cpp new file mode 100644 index 0000000000..f64a4a0bd1 --- /dev/null +++ b/src/wrapfunctions.template.cpp @@ -0,0 +1,7 @@ +#include "amici/model.h" +#include "wrapfunctions.h" + +std::unique_ptr getModel() { + return std::unique_ptr(new Model_TPL_MODELNAME()); +} + diff --git a/swig/CMakeLists.txt b/swig/CMakeLists.txt new file mode 100644 index 0000000000..6a672d2789 --- /dev/null +++ b/swig/CMakeLists.txt @@ -0,0 +1,29 @@ +# +# Build additional AMICI interfaces via swig +# + +find_package(SWIG REQUIRED 3) +include(${SWIG_USE_FILE}) + +set(AMICI_INTERFACE_LIST + ${CMAKE_CURRENT_LIST_DIR}/amici.i + ${CMAKE_CURRENT_LIST_DIR}/edata.i + ${CMAKE_CURRENT_LIST_DIR}/rdata.i + ${CMAKE_CURRENT_LIST_DIR}/model.i + ${CMAKE_CURRENT_LIST_DIR}/model_ode.i + ${CMAKE_CURRENT_LIST_DIR}/model_dae.i + ${CMAKE_CURRENT_LIST_DIR}/solver.i + ${CMAKE_CURRENT_LIST_DIR}/solver_cvodes.i + ${CMAKE_CURRENT_LIST_DIR}/solver_idas.i + ${CMAKE_CURRENT_LIST_DIR}/std_unique_ptr.i +) + +# Add target to show files in IDE +add_custom_target(swigInterface SOURCES ${AMICI_INTERFACE_LIST}) + +## Add subdirectories for each language if desired +#option(BUILD_PYTHON "Build Python SWIG module" ON) +#if(BUILD_PYTHON) +# add_subdirectory(python) +#endif() + diff --git a/swig/CMakeLists_model.txt b/swig/CMakeLists_model.txt new file mode 100644 index 0000000000..3e22a79b95 --- /dev/null +++ b/swig/CMakeLists_model.txt @@ -0,0 +1,26 @@ +find_package(SWIG REQUIRED) +include(${SWIG_USE_FILE}) + +FIND_PACKAGE(PythonLibs REQUIRED) +INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH}) + +SET(CMAKE_SWIG_FLAGS "") +SET_SOURCE_FILES_PROPERTIES(${PROJECT_NAME}.i PROPERTIES CPLUSPLUS ON) + +# swig does not use INTERFACE_INCLUDE_DIRS of linked libraries, so add manually +get_target_property(AMICI_INCLUDE_DIRS Upstream::amici INTERFACE_INCLUDE_DIRECTORIES) +include_directories(${AMICI_INCLUDE_DIRS} ..) + +SWIG_ADD_LIBRARY(${PROJECT_NAME} MODULE LANGUAGE python SOURCES ${PROJECT_NAME}.i) + +SWIG_LINK_LIBRARIES(${PROJECT_NAME} + ${PYTHON_LIBRARIES} + model) + +# configure module setup script +SET(SETUP_PY_IN ${Amici_DIR}/model_setup.template.py) +SET(SETUP_PY_OUT ${CMAKE_CURRENT_BINARY_DIR}/setup.py) + +add_custom_target(install-python + DEPENDS _${PROJECT_NAME} + COMMAND python ${SETUP_PY_OUT} install) diff --git a/swig/amici.i b/swig/amici.i new file mode 100644 index 0000000000..7fb94dcc80 --- /dev/null +++ b/swig/amici.i @@ -0,0 +1,38 @@ +%module amici + +typedef double realtype; + +%include +%include + +%include std_unique_ptr.i +wrap_unique_ptr(SolverPtr, amici::Solver) +wrap_unique_ptr(ReturnDataPtr, amici::ReturnData) +wrap_unique_ptr(ModelPtr, amici::Model) + +%include edata.i +%include rdata.i + +%include solver.i +%include solver_idas.i +%include solver_cvodes.i +%include model.i +%include model_ode.i +%include model_dae.i +%include hdf5.i + + +// Add necessary symbols to generated header +%{ +#include "amici/amici.h" +using namespace amici; +%} + +// Process symbols in header +%include "amici/amici.h" + +namespace std +{ + %template(DoubleVector) vector; + %template(IntVector) vector; +} diff --git a/swig/edata.i b/swig/edata.i new file mode 100644 index 0000000000..95cea57c17 --- /dev/null +++ b/swig/edata.i @@ -0,0 +1,10 @@ +%module edata + +// Add necessary symbols to generated header +%{ +#include "amici/edata.h" +using namespace amici; +%} + +// Process symbols in header +%include "amici/edata.h" diff --git a/swig/hdf5.i b/swig/hdf5.i new file mode 100644 index 0000000000..cce52bcef8 --- /dev/null +++ b/swig/hdf5.i @@ -0,0 +1,16 @@ +%module hdf5 + +// Add necessary symbols to generated header +%{ +#include "amici/hdf5.h" +using namespace amici; +%} + +%include std_unique_ptr.i + +wrap_unique_ptr(ExpDataPtr, amici::ExpData) + + +// Process symbols in header + +%include "amici/hdf5.h" diff --git a/swig/model.i b/swig/model.i new file mode 100644 index 0000000000..2d820f9705 --- /dev/null +++ b/swig/model.i @@ -0,0 +1,11 @@ +%module model + +// Add necessary symbols to generated header +%{ +#include "amici/model.h" +using namespace amici; +%} + +// Process symbols in header + +%include "amici/model.h" diff --git a/swig/model_dae.i b/swig/model_dae.i new file mode 100644 index 0000000000..f59e749552 --- /dev/null +++ b/swig/model_dae.i @@ -0,0 +1,11 @@ +%module model_dae + +// Add necessary symbols to generated header +%{ +#include "amici/model_dae.h" +using namespace amici; +%} + +// Process symbols in header + +%include "amici/model_dae.h" diff --git a/swig/model_ode.i b/swig/model_ode.i new file mode 100644 index 0000000000..e7c5a4c681 --- /dev/null +++ b/swig/model_ode.i @@ -0,0 +1,13 @@ +%module model_ode + +// Add necessary symbols to generated header +%{ +#include "amici/model_ode.h" +using namespace amici; +%} + +// Process symbols in header + +%include "amici/model_ode.h" + + diff --git a/swig/modelname.template.i b/swig/modelname.template.i new file mode 100644 index 0000000000..3425d78a17 --- /dev/null +++ b/swig/modelname.template.i @@ -0,0 +1,14 @@ +%module TPL_MODELNAME +%import amici.i +// Add necessary symbols to generated header + +%{ +#include "wrapfunctions.h" +#include "amici/model_ode.h" +#include "amici/model_dae.h" +using namespace amici; +%} + + +// Process symbols in header +%include "wrapfunctions.h" diff --git a/swig/python/CMakeLists.txt b/swig/python/CMakeLists.txt new file mode 100644 index 0000000000..d68537e4a8 --- /dev/null +++ b/swig/python/CMakeLists.txt @@ -0,0 +1,50 @@ +# +# Build AMICI python interface +# + +# Find Python interpreter, libs and headers +find_package(PythonInterp 3.6 REQUIRED)# TODO to setup.py +find_package(PythonLibs REQUIRED) +include_directories(${PYTHON_INCLUDE_PATH}) + +set(CMAKE_SWIG_OUTDIR ${CMAKE_CURRENT_BINARY_DIR}/amici) +#set(CMAKE_SWIG_FLAGS "") + +set_source_files_properties( + ${AMICI_SRC_LIST} ${AMICI_DIR}/swig/amici.i + PROPERTIES CPLUSPLUS ON + ) + +SWIG_ADD_LIBRARY( + amici MODULE + LANGUAGE python + SOURCES ${AMICI_DIR}/swig/amici.i + ) + +SWIG_LINK_LIBRARIES(amici + ${PYTHON_LIBRARIES} + ${AMICI_DIR}/build/libamici${CMAKE_STATIC_LIBRARY_SUFFIX} + ${SUNDIALS_LIB_DIR}/libsundials_nvecserial${CMAKE_STATIC_LIBRARY_SUFFIX} + ${SUNDIALS_LIB_DIR}/libsundials_cvodes${CMAKE_STATIC_LIBRARY_SUFFIX} + ${SUNDIALS_LIB_DIR}/libsundials_idas${CMAKE_STATIC_LIBRARY_SUFFIX} + ${SUITESPARSE_DIR}/KLU/Lib/libklu${CMAKE_STATIC_LIBRARY_SUFFIX} + ${SUITESPARSE_DIR}/COLAMD/Lib/libcolamd${CMAKE_STATIC_LIBRARY_SUFFIX} + ${SUITESPARSE_DIR}/BTF/Lib/libbtf${CMAKE_STATIC_LIBRARY_SUFFIX} + ${SUITESPARSE_DIR}/AMD/Lib/libamd${CMAKE_STATIC_LIBRARY_SUFFIX} + ${SUITESPARSE_DIR}/SuiteSparse_config/libsuitesparseconfig${CMAKE_STATIC_LIBRARY_SUFFIX} + ${HDF5_HL_LIBRARIES} + ${HDF5_C_LIBRARIES} + ${HDF5_CXX_LIBRARIES} + ${BLAS_LIBRARIES} + -ldl -lz -lm) + +# put library into python package +# (SWIG_ADD_LIBRARY directory options don't work in current cmake version) +set_target_properties(_amici + PROPERTIES + LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/amici" + ) + +#SET(PYTHON_INSTALL_FILES +# ${CMAKE_CURRENT_BINARY_DIR}/amici.py +# $) diff --git a/swig/rdata.i b/swig/rdata.i new file mode 100644 index 0000000000..efab480ca1 --- /dev/null +++ b/swig/rdata.i @@ -0,0 +1,10 @@ +%module rdata + +// Add necessary symbols to generated header +%{ +#include "amici/rdata.h" +using namespace amici; +%} + +// Process symbols in header +%include "amici/rdata.h" diff --git a/swig/solver.i b/swig/solver.i new file mode 100644 index 0000000000..758abe237d --- /dev/null +++ b/swig/solver.i @@ -0,0 +1,12 @@ +%module solver + +// Add necessary symbols to generated header +%{ +#include "amici/solver.h" +using namespace amici; +%} + +%rename(equals) operator==; + +// Process symbols in header +%include "amici/solver.h" diff --git a/swig/solver_cvodes.i b/swig/solver_cvodes.i new file mode 100644 index 0000000000..deb480d22b --- /dev/null +++ b/swig/solver_cvodes.i @@ -0,0 +1,10 @@ +%module solver_cvodes + +// Add necessary symbols to generated header +%{ +#include "amici/solver_cvodes.h" +using namespace amici; +%} + +// Process symbols in header +%include "amici/solver_cvodes.h" diff --git a/swig/solver_idas.i b/swig/solver_idas.i new file mode 100644 index 0000000000..c75a96ae31 --- /dev/null +++ b/swig/solver_idas.i @@ -0,0 +1,10 @@ +%module solver_idas + +// Add necessary symbols to generated header +%{ +#include "amici/solver_idas.h" +using namespace amici; +%} + +// Process symbols in header +%include "amici/solver_idas.h" diff --git a/swig/std_unique_ptr.i b/swig/std_unique_ptr.i new file mode 100644 index 0000000000..1063bd75b1 --- /dev/null +++ b/swig/std_unique_ptr.i @@ -0,0 +1,34 @@ +%module std_unique_ptr + +namespace std { + %feature("novaluewrapper") unique_ptr; + template + struct unique_ptr { + typedef Type* pointer; + + explicit unique_ptr( pointer Ptr ); + unique_ptr (unique_ptr&& Right); + template unique_ptr( unique_ptr&& Right ); + unique_ptr( const unique_ptr& Right) = delete; + + + pointer operator-> () const; + pointer release (); + void reset (pointer __p=pointer()); + void swap (unique_ptr &__u); + pointer get () const; + operator bool () const; + + ~unique_ptr(); + }; +} + +%define wrap_unique_ptr(Name, Type) + %template(Name) std::unique_ptr; + %newobject std::unique_ptr::release; + + %typemap(out) std::unique_ptr %{ + $result = SWIG_NewPointerObj(new $1_ltype(std::move($1)), $&1_descriptor, SWIG_POINTER_OWN); + %} + +%enddef diff --git a/tests/SBMLTest.m b/tests/SBMLTest.m index 8555d28f43..73c7fb2323 100644 --- a/tests/SBMLTest.m +++ b/tests/SBMLTest.m @@ -3,7 +3,7 @@ cd(exedir); fid = fopen(['./SBMLTest_log_' date '.txt'],'w+'); -for iTest = 1:1529 +for iTest = 21:1529 cd(exedir); testid = [repmat('0',1,4-floor(log10(iTest))),num2str(iTest)]; if(~exist(fullfile(pwd,'SBMLresults',[testid '-results.csv']))) @@ -23,8 +23,8 @@ function runSBMLTest(iTest,fid) curdir = pwd; testid = [repmat('0',1,4-floor(log10(iTest))),num2str(iTest)]; disp([' =================== ' testid ' =================== ']); -if(exist(fullfile(pwd,'sbml-test-suite','cases','semantic',testid),'dir')) - cd(fullfile(pwd,'sbml-test-suite','cases','semantic',testid)) +if(exist(fullfile(pwd,'sbml-semantic-test-cases','cases','semantic',testid),'dir')) + cd(fullfile(pwd,'sbml-semantic-test-cases','cases','semantic',testid)) try if(exist(fullfile(pwd,[testid '-sbml-l3v1.xml']),'file')) SBML2AMICI([testid '-sbml-l3v1'],['SBMLTEST_' testid]) diff --git a/tests/cpputest/CMakeLists.txt b/tests/cpputest/CMakeLists.txt index 43e279e7ba..0adbd35a37 100644 --- a/tests/cpputest/CMakeLists.txt +++ b/tests/cpputest/CMakeLists.txt @@ -1,43 +1,67 @@ project(amiciIntegrationTests) - cmake_minimum_required(VERSION 2.8) -set(CMAKE_BUILD_TYPE Debug) - -find_package(Amici HINTS ${CMAKE_CURRENT_LIST_DIR}/../../build) -get_property(AmiciConfigIncludes TARGET Upstream::amici PROPERTY INCLUDE_DIRECTORIES) -set(AMICI_DIR ${Amici_DIR}/..) +find_package(CppUTest REQUIRED) -set(CPPUTEST_DIR "${AMICI_DIR}/ThirdParty/cpputest-3.8/" CACHE PATH "cppUTest root directory") -set(CPPUTEST_INCLUDE_DIR "${CPPUTEST_DIR}/include" CACHE PATH "cppUTest include directory") -set(CPPUTEST_LIBRARY "${CPPUTEST_DIR}/lib/libCppUTest.a" "${CPPUTEST_DIR}/lib/libCppUTestExt.a" CACHE PATH "cppUTest libraries") +# models depend on Upstream::amici +add_library(Upstream::amici ALIAS amici) +# CppUTest includes for memory leak detector set(CMAKE_CXX_FLAGS_OLD "${CMAKE_CXX_FLAGS}") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -include sstream -include ${CPPUTEST_INCLUDE_DIR}/CppUTest/MemoryLeakDetectorNewMacros.h") - -include_directories("${CMAKE_CURRENT_SOURCE_DIR}") -include_directories(${AmiciConfigIncludes}) -include_directories(${CPPUTEST_INCLUDE_DIR}) +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -include sstream -include CppUTest/MemoryLeakDetectorNewMacros.h") -if(APPLE) - set(SHARED_OBJECT_EXTENSION .dylib) -else() - set(SHARED_OBJECT_EXTENSION .so) -endif() +# Amici testing library +add_library(amici-testing testfunctions.cpp) +target_compile_definitions(amici-testing + PUBLIC NEW_OPTION_FILE="${CMAKE_CURRENT_SOURCE_DIR}/testOptions.h5" + PUBLIC HDFFILE="${CMAKE_CURRENT_SOURCE_DIR}/expectedResults.h5" + PUBLIC HDFFILEWRITE="${CMAKE_CURRENT_SOURCE_DIR}/writeResults.h5" + ) +target_include_directories(amici-testing + PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} + PUBLIC ${CppUTest_INCLUDE_DIRS} + ) +target_link_libraries(amici-testing + PUBLIC Upstream::amici + PUBLIC ${CppUTest_LIBRARIES} + ) -enable_testing() +# Names of models for which tests are to be run +set(TEST_MODELS + dirac + steadystate + jakstat_adjoint + jakstat_adjoint_o2 + neuron neuron_o2 + events + nested_events + robertson + ) add_subdirectory(unittests) -add_subdirectory(dirac) -add_subdirectory(events) -add_subdirectory(nested_events) -add_subdirectory(steadystate) -add_subdirectory(jakstat_adjoint) -add_subdirectory(neuron) -add_subdirectory(robertson) -add_subdirectory(jakstat_adjoint_o2) -add_subdirectory(neuron_o2) - -if($ENV{ENABLE_GCOV_COVERAGE}) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 --coverage") -endif() + +include(ExternalProject) + +foreach(MODEL IN ITEMS ${TEST_MODELS}) + # Build model + ExternalProject_Add(external_model_${MODEL} + PREFIX "" + SOURCE_DIR "${CMAKE_SOURCE_DIR}/models/model_${MODEL}/" + INSTALL_COMMAND "" + TEST_COMMAND "" + DEPENDS amici + ) + # Rebuild if amici files are updated + ExternalProject_Add_StepDependencies(external_model_${MODEL} build amici) + + add_library(model_${MODEL} STATIC IMPORTED) + set_target_properties(model_${MODEL} + PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES + "${CMAKE_SOURCE_DIR}/models/model_${MODEL}/" + IMPORTED_LOCATION + "${CMAKE_CURRENT_BINARY_DIR}/external_model_${MODEL}-prefix/src/external_model_${MODEL}-build/${CMAKE_STATIC_LIBRARY_PREFIX}model_${MODEL}${CMAKE_STATIC_LIBRARY_SUFFIX}" + ) + # Build tests for this model + add_subdirectory(${MODEL}) +endforeach() diff --git a/tests/cpputest/dirac/CMakeLists.txt b/tests/cpputest/dirac/CMakeLists.txt index 9bcd3ab14a..43779ac4a3 100644 --- a/tests/cpputest/dirac/CMakeLists.txt +++ b/tests/cpputest/dirac/CMakeLists.txt @@ -1,26 +1,18 @@ -project(model_dirac_test) - -set(MODEL_DIR "${AMICI_DIR}/models/model_dirac") +get_filename_component(MODEL_NAME ${CMAKE_CURRENT_LIST_DIR} NAME) +project(model_${MODEL_NAME}_test) set(SRC_LIST main.cpp tests1.cpp - ../testfunctions.cpp ) -include_directories(${CMAKE_CURRENT_SOURCE_DIR}) -include_directories("${MODEL_DIR}") +include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CppUTest_INCLUDE_DIRS}) add_executable(${PROJECT_NAME} ${SRC_LIST}) target_link_libraries(${PROJECT_NAME} - ${AMICI_DIR}/models/model_dirac/build/libmodel_dirac.a - ${CPPUTEST_LIBRARY} - Upstream::amici + amici-testing + model_${MODEL_NAME} ) -if($ENV{ENABLE_GCOV_COVERAGE}) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 --coverage") -endif() - -add_test(NAME dirac COMMAND ./model_dirac_test -c) +add_test(NAME ${PROJECT_NAME} COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME} -c) diff --git a/tests/cpputest/events/CMakeLists.txt b/tests/cpputest/events/CMakeLists.txt index c4e8d8d6bd..048ec70352 100644 --- a/tests/cpputest/events/CMakeLists.txt +++ b/tests/cpputest/events/CMakeLists.txt @@ -1,26 +1,18 @@ -project(model_events_test) - -set(MODEL_DIR "${AMICI_DIR}/models/model_events") +get_filename_component(MODEL_NAME ${CMAKE_CURRENT_LIST_DIR} NAME) +project(model_${MODEL_NAME}_test) set(SRC_LIST main.cpp tests1.cpp - ../testfunctions.cpp ) -include_directories(${CMAKE_CURRENT_SOURCE_DIR}) -include_directories("${MODEL_DIR}") +include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CppUTest_INCLUDE_DIRS}) add_executable(${PROJECT_NAME} ${SRC_LIST}) target_link_libraries(${PROJECT_NAME} - ${AMICI_DIR}/models/model_events/build/libmodel_events.a - ${CPPUTEST_LIBRARY} - Upstream::amici - ) - -if($ENV{ENABLE_GCOV_COVERAGE}) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 --coverage") -endif() + amici-testing + model_${MODEL_NAME} +) -add_test(NAME events COMMAND ./model_events_test -c) +add_test(NAME ${PROJECT_NAME} COMMAND ./${PROJECT_NAME} -c) diff --git a/tests/cpputest/events/tests1.cpp b/tests/cpputest/events/tests1.cpp index c8885ee7f6..f01bc9d105 100644 --- a/tests/cpputest/events/tests1.cpp +++ b/tests/cpputest/events/tests1.cpp @@ -17,6 +17,10 @@ TEST_GROUP(groupEvents) } }; +TEST(groupEvents, testDefault) { + amici::simulateWithDefaultOptions(); +} + TEST(groupEvents, testSimulation) { amici::simulateVerifyWrite("/model_events/nosensi/"); } diff --git a/tests/cpputest/jakstat_adjoint/CMakeLists.txt b/tests/cpputest/jakstat_adjoint/CMakeLists.txt index be27c4e8c4..048ec70352 100644 --- a/tests/cpputest/jakstat_adjoint/CMakeLists.txt +++ b/tests/cpputest/jakstat_adjoint/CMakeLists.txt @@ -1,26 +1,18 @@ -project(model_jakstat_adjoint_test) - -set(MODEL_DIR "${AMICI_DIR}/models/model_jakstat_adjoint") +get_filename_component(MODEL_NAME ${CMAKE_CURRENT_LIST_DIR} NAME) +project(model_${MODEL_NAME}_test) set(SRC_LIST main.cpp tests1.cpp - ../testfunctions.cpp ) -include_directories(${CMAKE_CURRENT_SOURCE_DIR}) -include_directories("${MODEL_DIR}") +include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CppUTest_INCLUDE_DIRS}) add_executable(${PROJECT_NAME} ${SRC_LIST}) target_link_libraries(${PROJECT_NAME} - ${AMICI_DIR}/models/model_jakstat_adjoint/build/libmodel_jakstat_adjoint.a - ${CPPUTEST_LIBRARY} - Upstream::amici - ) - -if($ENV{ENABLE_GCOV_COVERAGE}) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 --coverage") -endif() + amici-testing + model_${MODEL_NAME} +) -add_test(NAME jakstat_adjoint COMMAND ./model_jakstat_adjoint_test -c) +add_test(NAME ${PROJECT_NAME} COMMAND ./${PROJECT_NAME} -c) diff --git a/tests/cpputest/jakstat_adjoint_o2/CMakeLists.txt b/tests/cpputest/jakstat_adjoint_o2/CMakeLists.txt index 0f328b6a94..048ec70352 100644 --- a/tests/cpputest/jakstat_adjoint_o2/CMakeLists.txt +++ b/tests/cpputest/jakstat_adjoint_o2/CMakeLists.txt @@ -1,26 +1,18 @@ -project(model_jakstat_adjoint_o2_test) - -set(MODEL_DIR "${AMICI_DIR}/models/model_jakstat_adjoint_o2") +get_filename_component(MODEL_NAME ${CMAKE_CURRENT_LIST_DIR} NAME) +project(model_${MODEL_NAME}_test) set(SRC_LIST main.cpp tests1.cpp - ../testfunctions.cpp ) -include_directories(${CMAKE_CURRENT_SOURCE_DIR}) -include_directories("${MODEL_DIR}") +include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CppUTest_INCLUDE_DIRS}) add_executable(${PROJECT_NAME} ${SRC_LIST}) target_link_libraries(${PROJECT_NAME} - ${AMICI_DIR}/models/model_jakstat_adjoint_o2/build/libmodel_jakstat_adjoint_o2.a - ${CPPUTEST_LIBRARY} - Upstream::amici - ) - -if($ENV{ENABLE_GCOV_COVERAGE}) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 --coverage") -endif() - -add_test(NAME jakstat_adjoint_o2 COMMAND ./model_jakstat_adjoint_o2_test -c) + amici-testing + model_${MODEL_NAME} +) + +add_test(NAME ${PROJECT_NAME} COMMAND ./${PROJECT_NAME} -c) diff --git a/tests/cpputest/nested_events/CMakeLists.txt b/tests/cpputest/nested_events/CMakeLists.txt index 64427a7912..048ec70352 100644 --- a/tests/cpputest/nested_events/CMakeLists.txt +++ b/tests/cpputest/nested_events/CMakeLists.txt @@ -1,26 +1,18 @@ -project(model_nested_events_test) - -set(MODEL_DIR "${AMICI_DIR}/models/model_nested_events") +get_filename_component(MODEL_NAME ${CMAKE_CURRENT_LIST_DIR} NAME) +project(model_${MODEL_NAME}_test) set(SRC_LIST main.cpp tests1.cpp - ../testfunctions.cpp ) -include_directories(${CMAKE_CURRENT_SOURCE_DIR}) -include_directories("${MODEL_DIR}") +include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CppUTest_INCLUDE_DIRS}) add_executable(${PROJECT_NAME} ${SRC_LIST}) target_link_libraries(${PROJECT_NAME} - ${AMICI_DIR}/models/model_nested_events/build/libmodel_nested_events.a - ${CPPUTEST_LIBRARY} - Upstream::amici - ) - -if($ENV{ENABLE_GCOV_COVERAGE}) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 --coverage") -endif() + amici-testing + model_${MODEL_NAME} +) -add_test(NAME nested_events COMMAND ./model_nested_events_test -c) +add_test(NAME ${PROJECT_NAME} COMMAND ./${PROJECT_NAME} -c) diff --git a/tests/cpputest/neuron/CMakeLists.txt b/tests/cpputest/neuron/CMakeLists.txt index e96ad8610e..048ec70352 100644 --- a/tests/cpputest/neuron/CMakeLists.txt +++ b/tests/cpputest/neuron/CMakeLists.txt @@ -1,26 +1,18 @@ -project(model_neuron_test) - -set(MODEL_DIR "${AMICI_DIR}/models/model_neuron") +get_filename_component(MODEL_NAME ${CMAKE_CURRENT_LIST_DIR} NAME) +project(model_${MODEL_NAME}_test) set(SRC_LIST main.cpp tests1.cpp - ../testfunctions.cpp ) -include_directories(${CMAKE_CURRENT_SOURCE_DIR}) -include_directories("${MODEL_DIR}") +include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CppUTest_INCLUDE_DIRS}) add_executable(${PROJECT_NAME} ${SRC_LIST}) target_link_libraries(${PROJECT_NAME} - ${AMICI_DIR}/models/model_neuron/build/libmodel_neuron.a - ${CPPUTEST_LIBRARY} - Upstream::amici - ) - -if($ENV{ENABLE_GCOV_COVERAGE}) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 --coverage") -endif() + amici-testing + model_${MODEL_NAME} +) -add_test(NAME neuron COMMAND ./model_neuron_test -c) +add_test(NAME ${PROJECT_NAME} COMMAND ./${PROJECT_NAME} -c) diff --git a/tests/cpputest/neuron_o2/CMakeLists.txt b/tests/cpputest/neuron_o2/CMakeLists.txt index a942682f9e..048ec70352 100644 --- a/tests/cpputest/neuron_o2/CMakeLists.txt +++ b/tests/cpputest/neuron_o2/CMakeLists.txt @@ -1,26 +1,18 @@ -project(model_neuron_o2_test) - -set(MODEL_DIR "${AMICI_DIR}/models/model_neuron_o2") +get_filename_component(MODEL_NAME ${CMAKE_CURRENT_LIST_DIR} NAME) +project(model_${MODEL_NAME}_test) set(SRC_LIST main.cpp tests1.cpp - ../testfunctions.cpp ) -include_directories(${CMAKE_CURRENT_SOURCE_DIR}) -include_directories("${MODEL_DIR}") +include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CppUTest_INCLUDE_DIRS}) add_executable(${PROJECT_NAME} ${SRC_LIST}) target_link_libraries(${PROJECT_NAME} - ${AMICI_DIR}/models/model_neuron_o2/build/libmodel_neuron_o2.a - ${CPPUTEST_LIBRARY} - Upstream::amici - ) - -if($ENV{ENABLE_GCOV_COVERAGE}) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 --coverage") -endif() + amici-testing + model_${MODEL_NAME} +) -add_test(NAME neuron_o2 COMMAND ./model_neuron_o2_test -c) +add_test(NAME ${PROJECT_NAME} COMMAND ./${PROJECT_NAME} -c) diff --git a/tests/cpputest/robertson/CMakeLists.txt b/tests/cpputest/robertson/CMakeLists.txt index ff97abd38f..2ed4b0a6d3 100644 --- a/tests/cpputest/robertson/CMakeLists.txt +++ b/tests/cpputest/robertson/CMakeLists.txt @@ -1,26 +1,19 @@ -project(model_robertson_test) - -set(MODEL_DIR "${AMICI_DIR}/models/model_robertson") +get_filename_component(MODEL_NAME ${CMAKE_CURRENT_LIST_DIR} NAME) +project(model_${MODEL_NAME}_test) set(SRC_LIST main.cpp tests1.cpp - ../testfunctions.cpp ) -include_directories(${CMAKE_CURRENT_SOURCE_DIR}) -include_directories("${MODEL_DIR}") +include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CppUTest_INCLUDE_DIRS}) add_executable(${PROJECT_NAME} ${SRC_LIST}) +add_dependencies(${PROJECT_NAME} external_model_${MODEL_NAME}) target_link_libraries(${PROJECT_NAME} - ${AMICI_DIR}/models/model_robertson/build/libmodel_robertson.a - ${CPPUTEST_LIBRARY} - Upstream::amici + amici-testing + model_${MODEL_NAME} ) -if($ENV{ENABLE_GCOV_COVERAGE}) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 --coverage") -endif() - -add_test(NAME robertson COMMAND ./model_robertson_test -c) +add_test(NAME ${PROJECT_NAME} COMMAND ./${PROJECT_NAME} -c) diff --git a/tests/cpputest/steadystate/CMakeLists.txt b/tests/cpputest/steadystate/CMakeLists.txt index b2b31a9434..048ec70352 100644 --- a/tests/cpputest/steadystate/CMakeLists.txt +++ b/tests/cpputest/steadystate/CMakeLists.txt @@ -1,26 +1,18 @@ -project(model_steadystate_test) - -set(MODEL_DIR "${AMICI_DIR}/models/model_steadystate") +get_filename_component(MODEL_NAME ${CMAKE_CURRENT_LIST_DIR} NAME) +project(model_${MODEL_NAME}_test) set(SRC_LIST main.cpp tests1.cpp - ../testfunctions.cpp ) -include_directories(${CMAKE_CURRENT_SOURCE_DIR}) -include_directories("${MODEL_DIR}") +include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CppUTest_INCLUDE_DIRS}) add_executable(${PROJECT_NAME} ${SRC_LIST}) target_link_libraries(${PROJECT_NAME} - ${AMICI_DIR}/models/model_steadystate/build/libmodel_steadystate.a - ${CPPUTEST_LIBRARY} - Upstream::amici - ) - -if($ENV{ENABLE_GCOV_COVERAGE}) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 --coverage") -endif() + amici-testing + model_${MODEL_NAME} +) -add_test(NAME steadystate COMMAND ./model_steadystate_test -c) +add_test(NAME ${PROJECT_NAME} COMMAND ./${PROJECT_NAME} -c) diff --git a/tests/cpputest/steadystate/tests1.cpp b/tests/cpputest/steadystate/tests1.cpp index 3932637318..2bdaf4b348 100644 --- a/tests/cpputest/steadystate/tests1.cpp +++ b/tests/cpputest/steadystate/tests1.cpp @@ -17,6 +17,11 @@ TEST_GROUP(groupSteadystate) } }; +TEST(groupSteadystate, testDefault) { + amici::simulateWithDefaultOptions(); +} + + TEST(groupSteadystate, testModelFromHDF5) { // Test reading some python-written options std::vector pExp {1, 0.5, 0.4, 2, 0.1}; diff --git a/tests/cpputest/testfunctions.cpp b/tests/cpputest/testfunctions.cpp index d3d60b2096..4f14c2b85c 100644 --- a/tests/cpputest/testfunctions.cpp +++ b/tests/cpputest/testfunctions.cpp @@ -22,6 +22,13 @@ void simulateVerifyWrite(std::string path, double atol, double rtol) simulateVerifyWrite(NEW_OPTION_FILE, HDFFILE, HDFFILEWRITE, path, atol, rtol); } +void simulateWithDefaultOptions() { + using namespace amici; + auto model = getModel(); + auto solver = model->getSolver(); + std::unique_ptr edata; + auto rdata = runAmiciSimulation(*solver, edata.get(), *model); +} void simulateVerifyWrite(const std::string hdffileOptions, const std::string hdffileResults, const std::string hdffilewrite, std::string path, double atol, double rtol) { @@ -92,7 +99,7 @@ void checkEqualArray(std::vector const& expected, std::vector co double atol, double rtol, std::string const& name) { CHECK_EQUAL(expected.size(), actual.size()); - for(int i = 0; i < expected.size(); ++i) + for(int i = 0; (unsigned) i < expected.size(); ++i) { bool withinTol = withinTolerance(expected[i], actual[i], atol, rtol, i, name.c_str()); CHECK_TRUE(withinTol); diff --git a/tests/cpputest/testfunctions.h b/tests/cpputest/testfunctions.h index 74a6d3fcc6..c39bbc827f 100644 --- a/tests/cpputest/testfunctions.h +++ b/tests/cpputest/testfunctions.h @@ -11,17 +11,18 @@ #endif #include #include // make std::ostringstream available (needs to come before TestHarness.h) -#include "CppUTest/TestHarness.h" -#include "CppUTestExt/MockSupport.h" +#include +#include namespace amici { class ReturnData; class ExpData; -#define NEW_OPTION_FILE "../../testOptions.h5" -#define HDFFILE "../../expectedResults.h5" -#define HDFFILEWRITE "../../writeResults.h5" +#if !defined(NEW_OPTION_FILE) || !defined(HDFFILE) || !defined(HDFFILEWRITE) +# error "Must define NEW_OPTION_FILE HDFFILE HDFFILEWRITE" +#endif + #define TEST_ATOL 1e-10 #define TEST_RTOL 1e-05 @@ -101,6 +102,7 @@ class Model_Test : public Model { } }; +void simulateWithDefaultOptions(); void simulateVerifyWrite(const std::string path); diff --git a/tests/cpputest/unittests/CMakeLists.txt b/tests/cpputest/unittests/CMakeLists.txt index 6429e85be7..350baaf53a 100644 --- a/tests/cpputest/unittests/CMakeLists.txt +++ b/tests/cpputest/unittests/CMakeLists.txt @@ -7,7 +7,6 @@ find_package(Boost COMPONENTS serialization) set(SRC_LIST main.cpp tests1.cpp - ../testfunctions.cpp ) if(Boost_FOUND) @@ -20,13 +19,9 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}) add_executable(${PROJECT_NAME} ${SRC_LIST}) target_link_libraries(${PROJECT_NAME} - ${CPPUTEST_LIBRARY} + amici-testing Upstream::amici ${Boost_LIBRARIES} ) -if($ENV{ENABLE_GCOV_COVERAGE}) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 --coverage") -endif() - add_test(NAME unittests COMMAND ./unittests -c) diff --git a/tests/cpputest/wrapTestModels.m b/tests/cpputest/wrapTestModels.m index 1f75412b70..6417c626c2 100644 --- a/tests/cpputest/wrapTestModels.m +++ b/tests/cpputest/wrapTestModels.m @@ -6,7 +6,7 @@ function wrapTestModels() % void amiciPath = fileparts(mfilename('fullpath')); - amiciPath = [amiciPath '/../..']; + amiciPath = [amiciPath '/../../matlab']; %% EXAMPLE STEADYSTATE diff --git a/tests/testModels.py b/tests/testModels.py new file mode 100755 index 0000000000..a1f0ed09c1 --- /dev/null +++ b/tests/testModels.py @@ -0,0 +1,138 @@ +#!/usr/bin/env python3 + +import sys +import h5py +import amici +import unittest +import importlib +import os +import re +import numpy as np + +class TestAmiciPregeneratedModel(unittest.TestCase): + ''' + TestCase class for tests that were pregenerated using the the matlab code generation routines and cmake + build routines + + NOTE: requires having run scripts/buildTests.sh before to build the python modules for the test models + ''' + + expectedResultsFile = os.path.join(os.path.dirname(__file__), 'cpputest','expectedResults.h5') + + def runTest(self): + ''' + test runner routine that loads data expectedResults.h5 hdf file and runs individual models/settings + as subTests + ''' + expectedResults = h5py.File(self.expectedResultsFile, 'r') + + for subTest in expectedResults.keys(): + for case in list(expectedResults[subTest].keys()): + if re.search('^sensi2',case) != None: + modelName = subTest + '_o2' + else: + modelName = subTest + + with self.subTest(modelName=modelName, caseName=case): + print('running subTest modelName = ' + modelName + ', caseName = ' + case) + modelSwigFolder = os.path.join(os.path.dirname(__file__), '..', 'build', 'tests', + 'cpputest', 'external_' + modelName + '-prefix', + 'src', 'external_' + modelName + '-build', 'swig') + sys.path.insert(0, modelSwigFolder) + testModelModule = importlib.import_module(modelName) + self.model = testModelModule.getModel() + self.solver = self.model.getSolver() + amici.readModelDataFromHDF5(self.expectedResultsFile, + self.model.get(), + "/" + subTest + "/" + case + "/options") + amici.readSolverSettingsFromHDF5(self.expectedResultsFile, + self.solver.get(), + "/" + subTest + "/" + case + "/options") + + edata = None + if 'data' in expectedResults[subTest][case].keys(): + edata = amici.readSimulationExpData(self.expectedResultsFile, + "/" + subTest + "/" + case + "/data", + self.model.get()) + rdata = amici.runAmiciSimulation(self.model, self.solver, edata) + + + if modelName == 'model_neuron_o2': + verifySimulationResults(rdata, expectedResults[subTest][case]['results'],rtol=1e-3) + else: + verifySimulationResults(rdata, expectedResults[subTest][case]['results']) + + + +def verifySimulationResults(rdata,expectedResults,atol=1e-8,rtol=1e-4): + ''' + compares all fields of the simulation results in rdata against the expectedResults using the provided + tolerances + + Args: + rdata: simulation results as returned by amici.runAmiciSimulation + expectedResults: stored test results + atol: absolute tolerance + rtol: relative tolerance + ''' + + if expectedResults.attrs['status'][0] != 0: + assert rdata['status'] == expectedResults.attrs['status'][0] + return + + for field in expectedResults.keys(): + if field == 'diagnosis': + for subfield in expectedResults[field].keys(): + checkResults(rdata, subfield, expectedResults[field][subfield][()], 0, 2) + else: + if field == 's2llh': + checkResults(rdata, field, expectedResults[field][()], 1e-4, 1e-3) + else: + checkResults(rdata, field, expectedResults[field][()], atol, rtol) + + for attr in expectedResults.attrs.keys(): + checkResults(rdata, attr, expectedResults.attrs[attr], atol, rtol) + + +def checkResults(rdata, field, expected, atol, rtol): + ''' + checks whether rdata[field] agrees with expected according to provided tolerances + + Args: + rdata: simulation results as returned by amici.runAmiciSimulation + field: name of the field to check + expected: expected test results + atol: absolute tolerance + rtol: relative tolerance + ''' + + result = rdata[field] + adev = abs(result-expected) + rdev = abs((result-expected))/(abs(expected)+rtol) + + if np.any(np.isnan(expected)): + if len(expected) > 1 : + assert all(np.isnan(result[np.isnan(expected)])) + else: # subindexing fails for scalars + assert np.isnan(result) + adev = adev[~np.isnan(expected)] + rdev = rdev[~np.isnan(expected)] + + if np.any(np.isinf(expected)): + if len(expected) > 1 : + assert all(np.isinf(result[np.isinf(expected)])) + else: # subindexing fails for scalars + assert np.isinf(result) + adev = adev[~np.isinf(expected)] + rdev = rdev[~np.isinf(expected)] + + if not np.all(np.logical_or(rdev <= rtol,adev <= atol)): + assert np.all(np.logical_or(rdev <= rtol,adev <= atol)) + + + +if __name__ == '__main__': + suite = unittest.TestSuite() + suite.addTest(TestAmiciPregeneratedModel()) + unittest.main() + \ No newline at end of file