diff options
author | jthorn <jthorn@0f49ee68-0e4f-0410-9b9c-b2c123ded7ef> | 2003-07-06 11:16:19 +0000 |
---|---|---|
committer | jthorn <jthorn@0f49ee68-0e4f-0410-9b9c-b2c123ded7ef> | 2003-07-06 11:16:19 +0000 |
commit | a07489dec7a4e1153624e158a2c5f2837b9247de (patch) | |
tree | 83be503e3cdaf39c578202c0fcdcf71337845e42 /src/util.c | |
parent | 892b8a2d121db4c1e436177cb19baa06eb8d0e4a (diff) |
This commit was generated by cvs2svn to compensate for changes in r2,
which included commits to RCS files with non-trunk default branches.
git-svn-id: http://svn.aei.mpg.de/numrel/AEIThorns/AEILocalInterp/trunk@3 0f49ee68-0e4f-0410-9b9c-b2c123ded7ef
Diffstat (limited to 'src/util.c')
-rw-r--r-- | src/util.c | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/src/util.c b/src/util.c new file mode 100644 index 0000000..a4bc5eb --- /dev/null +++ b/src/util.c @@ -0,0 +1,80 @@ + /*@@ + @file util.c + @date 23 Oct 2001 + @author Jonathan Thornburg <jthorn@aei.mpg.de> + @desc + Utility routines for generalized interpolation. + + This file contains various utility routines for the interpolator. + @enddesc + @version $Id$ + @@*/ + +#include <math.h> +#include <limits.h> +#include <stdlib.h> +#include <stdio.h> +#include <string.h> + +#ifndef AEILOCALINTERP_STANDALONE_TEST + #include "cctk.h" +#endif + +#include "InterpLocalUniform.h" + +/* the rcs ID and its dummy function to use it */ +static const char *rcsid = "$Header$"; +#ifndef AEILOCALINTERP_STANDALONE_TEST + CCTK_FILEVERSION(AEIThorns_AEILocalInterp_src_util_c) +#endif + +/******************************************************************************/ + +/*@@ + @routine AEILocalInterp_decode_N_parts + @date 22 Jan 2002 + @author Jonathan Thornburg <jthorn@aei.mpg.de> + @desc This function decodes a CCTK_VARIABLE_* variable type code + (cctk_Constants.h) to determine whether the type is real + or complex. + @enddesc + + @var type_code + @vdesc The type code to be decoded + @vtype int + @endvar + + @returntype int + @returndesc This function returns + 1 if the data type represents a real number of some sort + (includes integers) + 2 if the data type represents a complex number + 0 if the data type doesn't represent a number, + eg strings and pointers + -1 if the data type is invalid + @endreturndesc + @@*/ +int AEILocalInterp_decode_N_parts(int type_code) +{ +switch (type_code) + { +case CCTK_VARIABLE_VOID: return 0; +case CCTK_VARIABLE_BYTE: return 1; +case CCTK_VARIABLE_INT: return 1; +case CCTK_VARIABLE_INT2: return 1; +case CCTK_VARIABLE_INT4: return 1; +case CCTK_VARIABLE_INT8: return 1; +case CCTK_VARIABLE_REAL: return 1; +case CCTK_VARIABLE_REAL4: return 1; +case CCTK_VARIABLE_REAL8: return 1; +case CCTK_VARIABLE_REAL16: return 1; +case CCTK_VARIABLE_COMPLEX: return 2; +case CCTK_VARIABLE_COMPLEX8: return 2; +case CCTK_VARIABLE_COMPLEX16: return 2; +case CCTK_VARIABLE_COMPLEX32: return 2; +case CCTK_VARIABLE_STRING: return 0; +case CCTK_VARIABLE_POINTER: return 0; +case CCTK_VARIABLE_FPOINTER: return 0; +default: return -1; + } +} |