aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschnetter <schnetter@906471b6-c639-44d1-9ea0-3e3d6879f074>2006-06-22 20:01:47 +0000
committerschnetter <schnetter@906471b6-c639-44d1-9ea0-3e3d6879f074>2006-06-22 20:01:47 +0000
commita539b85e390beaeb3c5555491083fe86ac2b127f (patch)
treec4a34240765d68cc6ce3a72fef7ea31de24ef63f
parentd97ad7720ff7425bd03d5558d6a30c5e2d96672b (diff)
Introduce a new aliased function "GetSymmetryBoundaries" to SymBase,
which looks at the symmetry table and returns an array describing which outer boundaries are symmetry boundaries. This function is easier to use that examining the table manually. git-svn-id: http://svn.cactuscode.org/arrangements/CactusBase/SymBase/trunk@35 906471b6-c639-44d1-9ea0-3e3d6879f074
-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;
+}