Skip to content

Commit

Permalink
Merge pull request #90 from ICB-DCM/fixes_ff
Browse files Browse the repository at this point in the history
Various bugfixes
  • Loading branch information
Fabian Fröhlich authored May 12, 2017
2 parents 0fafe7e + 19c8b4a commit 35f18fe
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 35 deletions.
2 changes: 1 addition & 1 deletion @SBMLode/importSBML.m
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,7 @@ function checkIllegalFunctions(str)
csym = sym(sanitizeString(strrep(str,'time','__time_internal_amici__')));
csym = subs(csym,sym('__time_internal_amici__'),sym('time'));
else
csym = sym();
csym = sym(0);
end
end

Expand Down
55 changes: 23 additions & 32 deletions @amimodel/compileC.m
Original file line number Diff line number Diff line change
Expand Up @@ -405,16 +405,7 @@ function compileC(this)


fprintf('amici | ');
if(this.nxtrue ~= this.nx)
cstr = 'amicio2.cpp';
else
cstr = 'amici.cpp';
end
eval(['mex ' DEBUG COPT ...
' -c -outdir ' fullfile(this.wrap_path,'src') ' ' ...
fullfile(this.wrap_path,'src',cstr) ' ' ...
includesstr]);


if(isunix)
if(~ismac)
CLIBS = 'CLIBS="-lrt"';
Expand All @@ -429,37 +420,37 @@ function compileC(this)
end
end


if(this.nxtrue ~= this.nx)
cstr = 'amiwrapo2.cpp';
o2ext = 'o2';
else
cstr = 'amiwrap.cpp';
o2ext = '';
if(this.nxtrue == this.nx)
eval(['mex ' DEBUG COPT ...
' -c -outdir ' fullfile(this.wrap_path,'src') ' ' ...
fullfile(this.wrap_path,'src','amici.cpp') ' ' ...
includesstr]);
end

prefix = 'ami';


eval(['mex ' DEBUG ' ' COPT ...
' -c -outdir ' fullfile(this.wrap_path,'src') ' ' ...
fullfile(this.wrap_path,'src',cstr) ' ' ...
includesstr]);
if(this.nxtrue == this.nx)
eval(['mex ' DEBUG ' ' COPT ...
' -c -outdir ' fullfile(this.wrap_path,'src') ' ' ...
fullfile(this.wrap_path,'src','amiwrap.cpp') ' ' ...
includesstr]);
end

eval(['mex ' DEBUG ' ' COPT ...
' -c -outdir ' fullfile(this.wrap_path,'src') ' ' ...
fullfile(this.wrap_path,'src','amici_interface_matlab.cpp') ' ' ...
includesstr]);
if(this.nxtrue == this.nx)
eval(['mex ' DEBUG ' ' COPT ...
' -c -outdir ' fullfile(this.wrap_path,'src') ' ' ...
fullfile(this.wrap_path,'src','amici_interface_matlab.cpp') ' ' ...
includesstr]);
end

eval(['mex ' DEBUG ' ' COPT ' ' CLIBS ...
' -output ' fullfile(this.wrap_path,'models',this.modelname,[prefix '_' this.modelname]) ...
' "' fullfile(this.wrap_path,'src',['amiwrap' o2ext o_suffix]) '"' ...
' "' fullfile(this.wrap_path,'src',['amici' o2ext o_suffix]) '"' ...
' "' fullfile(this.wrap_path,'src',['amici_interface_matlab' o2ext o_suffix]) '"' ...
' -output ' fullfile(this.wrap_path,'models',this.modelname,['ami_' this.modelname]) ...
' "' fullfile(this.wrap_path,'src',['amiwrap' o_suffix]) '"' ...
' "' fullfile(this.wrap_path,'src',['amici' o_suffix]) '"' ...
' "' fullfile(this.wrap_path,'src',['amici_interface_matlab' o_suffix]) '"' ...
' "' fullfile(this.wrap_path,'models',this.modelname,['wrapfunctions' o_suffix]) '"' ...
objectsstr ...
includesstr ...
])




Expand Down
2 changes: 2 additions & 0 deletions include/amici.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@

void runAmiciSimulation(UserData *udata, const ExpData *edata, ReturnData *rdata, int *pstatus);

void invalidateReturnData(UserData* udata, ReturnData* rdata);

void *setupAMI(int *status, UserData *udata, TempData *tdata);
void setupAMIB(int *status, void *ami_mem, UserData *udata, TempData *tdata);

Expand Down
19 changes: 19 additions & 0 deletions src/amici.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,28 @@ void runAmiciSimulation(UserData *udata, const ExpData *edata, ReturnData *rdata
applyChainRuleFactorToSimulationResults(udata, rdata, edata);

freturn:
if(*pstatus<0){
invalidateReturnData(udata, rdata);
}
freeTempDataAmiMem(udata, tdata, ami_mem, setupBdone, *pstatus);
}

void invalidateReturnData(UserData* udata, ReturnData* rdata) {
/**
* @brief performs all necessary actions to reset return data upon integration failure
* @param[in] udata pointer to the user data struct @type UserData
* @param[out] rdata pointer to the return data struct @type ReturnData
*/
if(llhdata)
*llhdata = amiGetNaN();

if(sllhdata)
fillArray(sllhdata, nplist, amiGetNaN());

if(s2llhdata)
fillArray(s2llhdata, nplist*(ng-1), amiGetNaN());
}

void *setupAMI(int *status, UserData *udata, TempData *tdata) {
/**
* @brief setupAMIs initialises the ami memory object
Expand Down
1 change: 0 additions & 1 deletion src/amicio2.cpp

This file was deleted.

1 change: 0 additions & 1 deletion src/amiwrapo2.cpp

This file was deleted.

0 comments on commit 35f18fe

Please sign in to comment.