aboutsummaryrefslogtreecommitdiff
path: root/src/Output.c
blob: 7562ff8d6f4187f162a54da7e80ad71c3f7fa9bb (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
 /*@@
   @file      Output.c
   @date      November 10 2001
   @author    Gabrielle Allen
   @desc
              Functions to deal with making AHFinder an IO method
   @enddesc
   @version   $Id$
 @@*/

#include "cctk.h"
#include "cctk_Parameters.h"

static const char *rcsid = "$Header$";

CCTK_FILEVERSION(CactusEinstein_AHFinder_Output_c)

static int ahf_ncall=0;

int AHFinder_TimeForOutput (const cGH *GH, int vindex);

 /*@@
   @routine    AHFinder_TimeForOutput
   @date       June 31 1999
   @author     Gabrielle Allen
   @desc
               Decides if it is time to output a variable using info output
   @enddesc
   @calls      CheckSteerableParameters

   @var        GH
   @vdesc      Pointer to CCTK GH
   @vtype      const cGH *
   @vio        in
   @endvar
   @var        vindex
   @vdesc      index of variable to check for output
   @vtype      int
   @vio        in
   @endvar

   @returntype int
   @returndesc
               true/false (1 or 0) if analysis should be called
   @endreturndesc
@@*/
int AHFinder_TimeForOutput (const cGH *GH, int vindex)
{
  DECLARE_CCTK_PARAMETERS

  int retval=1;
  int ahfafter;

  if (vindex==CCTK_VarIndex("ahfinder::triggervar"))
  {

    if (ahf_findaftertime <= 0) 
    {
      ahfafter = ahf_findafter;
      if (GH->cctk_iteration < ahfafter) {retval=0;}
    }
    else
    {
      if (GH->cctk_time < ahf_findaftertime) {retval=0;}
      if (ahf_ncall == 0) {ahfafter = GH->cctk_iteration;}
    }
  
    if ( ((GH->cctk_iteration-ahfafter) % ahf_findevery) ) 
    {
      retval = 0;
    }

    if (retval==1) {ahf_ncall = 0;}

  }
  else
  {
    retval = 0;
  }
      
  return retval;
}