blob: 3cfaa02f0106f2f4c577665f6ce9a5da0450fc17 (
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
|
/*@@
@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->Scalarnum = (int *) malloc (CCTK_NumVars () * sizeof (int));
newGH->Scalarlast = (int *) malloc (CCTK_NumVars () * sizeof (int));
newGH->infonum = (int *) malloc (CCTK_NumVars () * sizeof (int));
newGH->infolast = (int *) malloc (CCTK_NumVars () * sizeof (int));
return newGH;
}
int IOBasic_InitGH (cGH *GH)
{
DECLARE_CCTK_PARAMETERS
int i;
iobasicGH *myGH;
/* get the handles for IOBasic extensions */
myGH = (iobasicGH *) GH->extensions [CCTK_GHExtensionHandle ("IOBasic")];
myGH->filenameListScalar = NULL;
/* How often to output */
myGH->infoevery = out_every > 0 ? out_every : -1;
if (outInfo_every > 0)
myGH->infoevery = outInfo_every;
myGH->Scalarevery = out_every > 0 ? out_every : -1;
if (outScalar_every > 0)
myGH->Scalarevery = outScalar_every;
InitIONum(myGH->infonum,outInfo_vars);
InitIONum(myGH->Scalarnum,outScalar_vars);
/* Deal with the output directories */
myGH->outpfx_Scalar = outdir;
if (!CCTK_Equals(outdirScalar,"outdir"))
myGH->outpfx_Scalar = outdirScalar;
/* Create the output directories */
if (myGH->Scalarevery > 0) {
if (CCTK_MyProc (GH) == 0) {
CCTK_mkdir(myGH->outpfx_Scalar);
}
}
for (i=0; i<CCTK_NumVars(); i++)
myGH->Scalarlast[i] = -1;
for (i=0; i<CCTK_NumVars(); i++)
myGH->infolast [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;
}
int IOBasic_rfrTraverseGH(cGH *GH, int rfrpoint)
{
return 0;
}
|