aboutsummaryrefslogtreecommitdiff
path: root/src/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/util.c b/src/util.c
index a4bc5eb..ac1a3ee 100644
--- a/src/util.c
+++ b/src/util.c
@@ -78,3 +78,50 @@ case CCTK_VARIABLE_FPOINTER: return 0;
default: return -1;
}
}
+
+/******************************************************************************/
+
+/*@@
+ @routine AEILocalInterp_get_int_param
+ @date 12 Jan 2007
+ @author Jonathan Thornburg <jthorn@aei.mpg.de>
+ @desc This function gets the (scalar) value of a CCTK_INT or Boolean
+ Cactus parameter.
+ @enddesc
+
+ @var thorn_or_implementation_name
+ @vdesc The name of the thorn (for private parameters) or implementation
+ (for restricted parameters), eg "AEILocalInterp".
+ @vtype const char*
+ @endvar
+
+ @var parameter_name
+ @vdesc The name of the parameter, e.g. "log_interp_coords"
+ @vtype const char*
+ @endvar
+
+ @returntype int
+ @returndesc This function returns the value of the parameter.
+ If an error occurs, this function calls
+ CCTK_VWarn(CCTK_WARN_ABORT, ...)
+ (and does not return to the caller).
+ @endreturndesc
+ @@*/
+int AEILocalInterp_get_int_param(const char* const thorn_or_implementation_name,
+ const char* const parameter_name)
+{
+CCTK_INT data_type;
+const CCTK_INT* const value_ptr
+ = (const CCTK_INT*) CCTK_ParameterGet(parameter_name,
+ thorn_or_implementation_name,
+ NULL);
+
+if (value_ptr == NULL)
+ then CCTK_VWarn(CCTK_WARN_ABORT, __LINE__, __FILE__, CCTK_THORNSTRING,
+"***** AEILocalInterp_decode_N_parts():\n"
+" can't get value of parameter %s::%s!\n"
+ ,
+ thorn_or_implementation_name, parameter_name); /*NOTREACHED*/
+
+return *value_ptr;
+}