blob: 342ac3fd62707ceb62323b1b66dc80e26308ad36 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "cctk.h"
#include "cctk_Arguments.h"
#include "cctk_Parameters.h"
#include "cctk_Termination.h"
#include "cctk_Timers.h"
#include "ManualTermination.h"
int ManualTerminationFile (CCTK_ARGUMENTS)
{
int retval = 0, terminate;
FILE *terminationfile;
DECLARE_CCTK_PARAMETERS;
/* only one processor needs to query the elapsed runtime */
if (CCTK_MyProc (cctkGH) != 0)
{
return (0);
}
if ( ((cctkGH->cctk_iteration-1) % check_file_every*1.0e0) != 0)
{
return(0);
}
terminationfile = fopen(MT_get_terminate_filename(NULL),"r");
if(terminationfile!=NULL)
{
terminate=0;
fscanf(terminationfile,"%d",&terminate);
fclose(terminationfile);
if (terminate==1)
{
CCTK_VInfo (CCTK_THORNSTRING, "OH MY GOD! Found termination signal "
"in termination file! TERMINATION NOW!!!!");
CCTK_TerminateNext (cctkGH);
}
}
return (retval);
}
|