aboutsummaryrefslogtreecommitdiff
path: root/src/Table.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/Table.c')
-rw-r--r--src/Table.c165
1 files changed, 165 insertions, 0 deletions
diff --git a/src/Table.c b/src/Table.c
new file mode 100644
index 0000000..3d88f07
--- /dev/null
+++ b/src/Table.c
@@ -0,0 +1,165 @@
+/*@@
+ @file $RCSfile$
+ @author $Author$
+ @date $Date$
+ @desc
+ Get the symmetry table handle for a grid or grid array
+ @version $Header$
+ @enddesc
+@@*/
+
+#include "cctk.h"
+
+#include "SymBase.h"
+
+
+
+/* the rcs ID and its dummy function to use it */
+static const char *const rcsid = "$Header$";
+CCTK_FILEVERSION (CactusBase_SymBase_Table_c);
+
+
+
+/*@@
+ @routine SymBase_SymmetryTableHandleForGrid
+ @author Erik Schnetter
+ @date 2004-03-06
+ @desc
+ Return the symmetry table handle for the grid hierarchy
+ @enddesc
+ @var cctkGH
+ @vtype CCTK_POINTER_TO_CONST
+ @vdesc Grid hierarchy
+ @vio in
+ @endvar
+ @returntype CCTK_INT
+ @returndesc
+ >=0 symmetry table handle
+ @endreturndesc
+@@*/
+
+CCTK_INT
+SymBase_SymmetryTableHandleForGrid (CCTK_POINTER_TO_CONST const cctkGH_)
+{
+ cGH const *const cctkGH = cctkGH_;
+ struct SymBase const *symdata;
+
+ if (!cctkGH)
+ {
+ CCTK_WARN (0, "internal error");
+ }
+
+ symdata = CCTK_GHExtension (cctkGH, "SymBase");
+ if (!symdata)
+ {
+ CCTK_WARN (0, "internal error");
+ }
+
+ return symdata->sym_table;
+}
+
+
+
+/*@@
+ @routine SymBase_SymmetryTableHandleForGI
+ @author Erik Schnetter
+ @date 2004-03-06
+ @desc
+ Return the symmetry table handle for a grid array
+ @enddesc
+ @var cctkGH
+ @vtype CCTK_POINTER_TO_CONST
+ @vdesc Grid hierarchy
+ @vio in
+ @endvar
+ @var group_index
+ @vtype CCTK_INT
+ @vdesc Group
+ @vio in
+ @endvar
+ @returntype CCTK_INT
+ @returndesc
+ >=0 symmetry table handle
+ -6 if group_index has an illegal value
+ -7 if the group type has an illegal value
+ -8 if there was an internal error
+ @endreturndesc
+@@*/
+
+CCTK_INT
+SymBase_SymmetryTableHandleForGI (CCTK_POINTER_TO_CONST const cctkGH_,
+ CCTK_INT const group_index)
+{
+ cGH const *const cctkGH = cctkGH_;
+ struct SymBase const *symdata;
+
+ if (!cctkGH)
+ {
+ CCTK_WARN (0, "internal error");
+ }
+
+ symdata = CCTK_GHExtension (cctkGH, "SymBase");
+ if (!symdata)
+ {
+ CCTK_WARN (0, "internal error");
+ }
+
+ if (group_index < 0 || group_index >= CCTK_NumGroups ())
+ {
+ return -6; /* illegal argument */
+ }
+
+ switch (CCTK_GroupTypeI (group_index))
+ {
+ case CCTK_GF:
+ return -7; /* illegal group type */
+ case CCTK_SCALAR:
+ case CCTK_ARRAY:
+ return symdata->array_sym_tables[group_index];
+ default:
+ CCTK_WARN (0, "internal error");
+ }
+
+ return -8; /* internal error */
+}
+
+
+
+/*@@
+ @routine SymBase_SymmetryTableHandleForGN
+ @author Erik Schnetter
+ @date 2004-03-06
+ @desc
+ Return the symmetry table handle for a grid array
+ @enddesc
+ @var cctkGH
+ @vtype CCTK_POINTER_TO_CONST
+ @vdesc Grid hierarchy
+ @vio in
+ @endvar
+ @var group_name
+ @vtype CCTK_STRING
+ @vdesc Group
+ @vio in
+ @endvar
+ @returntype CCTK_INT
+ @returndesc
+ >=0 symmetry table handle
+ Error codes of CCTK_GroupIndex
+ Error codes of SymBase_SymmetryTableHandleForGI
+ @endreturndesc
+@@*/
+CCTK_INT
+SymBase_SymmetryTableHandleForGN (CCTK_POINTER_TO_CONST const cctkGH_,
+ CCTK_STRING const group_name)
+{
+ int group_index;
+
+ group_index = CCTK_GroupIndex (group_name);
+ if (group_index < 0)
+ {
+ return group_index; /* illegal argument */
+ }
+
+ return SymBase_SymmetryTableHandleForGI (cctkGH_, group_index);
+}