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 <string.h>
/* Write the source code of the case to spinscase.cpp */
void WriteCaseFileSource(void)
{
FILE* fid;
fid=fopen("spinscase.cpp","w");
fprintf(fid,"/* %s */\n%s",casefilename,casefilesource);
fclose(fid);
char* filename;
if ( strcmp(casefilename, "cases/derivatives/derivatives.cpp") ) {
filename = "derivatives.cpp";
} else {
filename = "spinscase.cpp";
}
FILE* fid;
fid = fopen(filename,"w");
fprintf(fid,"/* %s */\n%s",casefilename,casefilesource);
fclose(fid);
}
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