blob: 30b50616b708e02f867c488540000e73f34c9a5e (
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
/*@@
@file GHExtension.c
@date Friday 18th September
@author Gabrielle Allen
@desc
IO GH extension stuff.
@enddesc
@@*/
/* #define DEBUG_IO */
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "cctk.h"
#include "cctk_Parameters.h"
#include "CactusBase/IOUtil/src/ioGH.h"
#include "iobasicGH.h"
void *IOBasic_SetupGH (tFleshConfig *config, int convergence_level, cGH *GH)
{
int i;
iobasicGH *newGH;
newGH = (iobasicGH *) malloc (sizeof (iobasicGH));
newGH->infovals = (CCTK_REAL **) malloc (CCTK_NumVars () * sizeof (CCTK_REAL *));
for (i=0;i<CCTK_NumVars ();i++)
newGH->infovals[i] = (CCTK_REAL *) malloc (2 * sizeof (CCTK_REAL));
newGH->do_outScalar = (char *) malloc (CCTK_NumVars () * sizeof (char));
newGH->outScalar_last = (int *) malloc (CCTK_NumVars () * sizeof (int));
newGH->do_outInfo = (char *) malloc (CCTK_NumVars () * sizeof (char));
newGH->outInfo_last = (int *) malloc (CCTK_NumVars () * sizeof (int));
return newGH;
}
int IOBasic_InitGH (cGH *GH)
{
DECLARE_CCTK_PARAMETERS
int i;
iobasicGH *myGH;
cParamData *paramdata;
/* get the handles for IOBasic extensions */
myGH = (iobasicGH *) GH->extensions [CCTK_GHExtensionHandle ("IOBasic")];
myGH->filenameListScalar = NULL;
/* How often to output */
myGH->outInfo_every = out_every > 0 ? out_every : -1;
if (outInfo_every > 0)
myGH->outInfo_every = outInfo_every;
myGH->outScalar_every = out_every > 0 ? out_every : -1;
if (outScalar_every > 0)
myGH->outScalar_every = outScalar_every;
ParseVarsForOutput (outInfo_vars, myGH->do_outInfo);
ParseVarsForOutput (outScalar_vars, myGH->do_outScalar);
/* Check whether "outdirScalar" was set.
If so take this dir otherwise default to "IO::outdir" */
paramdata = CCTK_ParameterData ("outdirScalar", CCTK_THORNSTRING);
if (paramdata && paramdata->n_set > 0)
myGH->outdirScalar = strdup (outdirScalar);
else
myGH->outdirScalar = strdup (outdir);
/* create the output dir */
if (CCTK_MyProc (GH) == 0)
CCTK_mkdir (myGH->outdirScalar);
for (i=0; i<CCTK_NumVars(); i++)
myGH->outScalar_last[i] = -1;
for (i=0; i<CCTK_NumVars(); i++)
myGH->outInfo_last [i] = -1;
for (i=0; i<CCTK_NumVars(); i++)
{
myGH->infovals[i][0] = 0.0;
myGH->infovals[i][1] = 0.0;
}
myGH->filenameListScalar = NULL;
return 0;
USE_CCTK_PARAMETERS
}
int IOBasic_rfrTraverseGH(cGH *GH, int rfrpoint)
{
return 0;
}
|