aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--interface.ccl9
-rw-r--r--src/Table.c78
2 files changed, 87 insertions, 0 deletions
diff --git a/interface.ccl b/interface.ccl
index f794dd9..767bc76 100644
--- a/interface.ccl
+++ b/interface.ccl
@@ -111,6 +111,15 @@ PROVIDES FUNCTION SymmetryTableHandleForGN \
WITH SymBase_SymmetryTableHandleForGN \
LANGUAGE C
+CCTK_INT FUNCTION \
+ GetSymmetryBoundaries \
+ (CCTK_POINTER_TO_CONST IN cctkGH, \
+ CCTK_INT IN size, \
+ CCTK_INT OUT ARRAY symbnd)
+PROVIDES FUNCTION GetSymmetryBoundaries \
+ WITH SymBase_GetSymmetryBoundaries \
+ LANGUAGE C
+
# Interpolation
diff --git a/src/Table.c b/src/Table.c
index 78990e1..2bfc372 100644
--- a/src/Table.c
+++ b/src/Table.c
@@ -149,6 +149,7 @@ SymBase_SymmetryTableHandleForGI (CCTK_POINTER_TO_CONST const cctkGH_,
Error codes of SymBase_SymmetryTableHandleForGI
@endreturndesc
@@*/
+
CCTK_INT
SymBase_SymmetryTableHandleForGN (CCTK_POINTER_TO_CONST const cctkGH_,
CCTK_STRING const group_name)
@@ -163,3 +164,80 @@ SymBase_SymmetryTableHandleForGN (CCTK_POINTER_TO_CONST const cctkGH_,
return SymBase_SymmetryTableHandleForGI (cctkGH_, group_index);
}
+
+
+
+/*@@
+ @routine SymBase_GetSymmetryBoundaries
+ @author Erik Schnetter
+ @date 2006-05-16
+ @desc
+ Determine which boundaries are symmetry boundaries
+ @enddesc
+ @var cctkGH
+ @vtype CCTK_POINTER_TO_CONST
+ @vdesc Grid hierarchy
+ @vio in
+ @endvar
+ @var size
+ @vtype CCTK_INT
+ @vdesc Array size
+ @vio in
+ @endvar
+ @var symbnd
+ @vtype CCTK_INT [size]
+ @vdesc 0 for outer boundary, 1 for symmetry boundary
+ @vio out
+ @endvar
+ @returntype CCTK_INT
+ @returndesc
+ 0 Success
+ -10 Wrong array size; must be 2*cctk_dim
+ -11 Symmetry table handle does not exist
+ -12 Wrong number of symmetry table entries (internal error)
+ @endreturndesc
+@@*/
+
+CCTK_INT
+SymBase_GetSymmetryBoundaries (CCTK_POINTER_TO_CONST const cctkGH_,
+ CCTK_INT const size,
+ CCTK_INT * restrict const symbnd)
+{
+ cGH const *const cctkGH = cctkGH_;
+ struct SymBase const *symdata;
+ CCTK_INT symtable;
+ CCTK_INT symmetry_handle [6];
+ CCTK_INT iret;
+ int d;
+
+ /* Check the arguments */
+ if (size != 2 * cctkGH->cctk_dim)
+ {
+ return -10;
+ }
+
+ /* Get the symmetry table */
+ symtable = SymmetryTableHandleForGrid (cctkGH);
+ if (symtable < 0)
+ {
+ return -11;
+ }
+
+ /* Get the symmetry handles for each face */
+ iret = Util_TableGetIntArray
+ (symtable, 2 * cctkGH->cctk_dim, symmetry_handle, "symmetry_handle");
+ if (iret != 2 * cctkGH->cctk_dim)
+ {
+ return -12;
+ }
+
+ /* A face has a symmetry boundary if there is a valid (non-negative)
+ handle registered for that face */
+ for (d = 0; d < 2 * cctkGH->cctk_dim; ++ d)
+ {
+ symbnd[d] = symmetry_handle[d] >= 0;
+ }
+
+ /* Success */
+ return 0;
+}