Commit 90c67e3c authored by David Deepwell's avatar David Deepwell
Browse files

Make derivatives.x not overwrite spinscase.cpp

The spinscase.cpp file is the case file showing what was run in
a given simulation. If derivatives are calculated afterwards
(using derivatives.x) then this file gets over-written and case
specific parameters/instructions will be lost. Rather than be
over-written, a different file (derivatives.cpp) will be created
when derivatives.x is run.
parent d365395b
#include <stdio.h> #include <stdio.h>
#include <string.h>
/* Write the source code of the case to spinscase.cpp */ /* Write the source code of the case to spinscase.cpp */
void WriteCaseFileSource(void) void WriteCaseFileSource(void)
{ {
FILE* fid; char* filename;
fid=fopen("spinscase.cpp","w"); if ( strcmp(casefilename, "cases/derivatives/derivatives.cpp") ) {
fprintf(fid,"/* %s */\n%s",casefilename,casefilesource); filename = "derivatives.cpp";
fclose(fid); } else {
filename = "spinscase.cpp";
FILE* fid;
fid = fopen(filename,"w");
fprintf(fid,"/* %s */\n%s",casefilename,casefilesource);
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment