aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--interface.ccl5
-rw-r--r--schedule.ccl14
-rw-r--r--src/Output.c87
-rw-r--r--src/Startup.c45
-rw-r--r--src/make.code.defn3
5 files changed, 150 insertions, 4 deletions
diff --git a/interface.ccl b/interface.ccl
index 2af7f08..56a65d0 100644
--- a/interface.ccl
+++ b/interface.ccl
@@ -69,6 +69,11 @@ dhole3_zmax
private:
+int triggergroup type=SCALAR
+{
+triggervar
+} "For triggering output"
+
real ahfgradient type=GF
{
ahfgradx,
diff --git a/schedule.ccl b/schedule.ccl
index e873d93..9ace195 100644
--- a/schedule.ccl
+++ b/schedule.ccl
@@ -10,6 +10,11 @@ schedule AHFinder_SetSym at CCTK_BASEGRID
LANG: Fortran
} "Set symmetries for AHFinder grid functions"
+schedule AHFinder_Startup at CCTK_STARTUP
+{
+ LANG: C
+} "Register AHFinder as an IO Method"
+
if (ahf_active)
{
@@ -27,18 +32,20 @@ if (ahf_active)
STORAGE: ahfindergrid,ahfinderexp,ahfgradient,ahfinder_gauss,find3grid
STORAGE: ahfmask
- schedule ahfinder at CCTK_POSTSTEP
+ schedule ahfinder at CCTK_ANALYSIS
{
LANG: Fortran
+ TRIGGERS: triggergroup
} "Call apparent horizon finder with persisting grid functions"
}
else if (CCTK_Equals (ahf_mask,"off"))
{
- schedule ahfinder at CCTK_POSTSTEP
+ schedule ahfinder at CCTK_ANALYSIS
{
LANG: Fortran
STORAGE: ahfindergrid,ahfinderexp,ahfgradient,ahfinder_gauss,find3grid
STORAGE: ahfmask
+ TRIGGERS:triggergroup
} "Call apparent horizon finder"
}
else
@@ -46,10 +53,11 @@ if (ahf_active)
STORAGE: ahfmask
STORAGE: hole1_bounds,hole2_bounds,hole3_bounds
- schedule ahfinder at CCTK_POSTSTEP
+ schedule ahfinder at CCTK_ANALYSIS
{
LANG: Fortran
STORAGE: ahfindergrid,ahfinderexp,ahfgradient,ahfinder_gauss,find3grid
+ TRIGGERS: triggergroup
} "Call apparent horizon finder with persisting mask"
}
}
diff --git a/src/Output.c b/src/Output.c
new file mode 100644
index 0000000..d598afe
--- /dev/null
+++ b/src/Output.c
@@ -0,0 +1,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;
+}
+
+
+
+
+
diff --git a/src/Startup.c b/src/Startup.c
new file mode 100644
index 0000000..6331e11
--- /dev/null
+++ b/src/Startup.c
@@ -0,0 +1,45 @@
+ /*@@
+ @file Startup.c
+ @date Sat 10th November 2001
+ @author Gabrielle Allen
+ @desc
+ Startup routines for AHFinder.
+ @enddesc
+ @version $Id$
+ @@*/
+
+#include "cctk.h"
+
+static const char *rcsid = "$Header$";
+
+CCTK_FILEVERSION(CactusEinstein_AHFinder_Startup_c)
+
+int AHFinder_TimeForOutput (const cGH *GH, int vindex);
+
+/********************************************************************
+ ******************** External Routines ************************
+ ********************************************************************/
+void AHFinder_Startup (void);
+
+ /*@@
+ @routine AHfinder_Startup
+ @date Sat 10th November 2001
+ @author Gabrielle Allen
+ @desc
+ The startup registration routine for AHFinder.
+ Registers AHFinder as an IO Method and provide the
+ only necessary method TimeForOutput
+ @enddesc
+ @calls CCTK_RegisterGHExtensionSetupGH
+@@*/
+void AHFinder_Startup (void)
+{
+ int handle;
+
+ handle = CCTK_RegisterIOMethod ("AHFinder");
+ CCTK_RegisterIOMethodTimeToOutput (handle, AHFinder_TimeForOutput);
+}
+
+
+
+
diff --git a/src/make.code.defn b/src/make.code.defn
index 76d20eb..5c7e669 100644
--- a/src/make.code.defn
+++ b/src/make.code.defn
@@ -6,4 +6,5 @@ SRCS += AHFinder_dat.F AHFinder.F \
AHFinder_min.F AHFinder_pow.F AHFinder_leg.F \
AHFinder_flow.F AHFinder_mask.F AHFinder_output.F \
AHFinder_find3.F AHFinder_calcsigma.F \
- AHFinder_initguess.F AHFinder_gau.F SetSym.F
+ AHFinder_initguess.F AHFinder_gau.F SetSym.F \
+ Startup.c Output.c