next up previous contents
Next: Symmetry Interpolation Up: SymBase Previous: Registering Symmetries for Faces   Contents

Querying Symmetries of Faces

Physical boundary conditions need to know to which faces they should apply the boundary condition. They need to query SymBase for the set of faces that have a symmetry boundary condition, and they must not apply their physical boundary condition there. The API is

CCTK_INT FUNCTION
    SymmetryTableHandleForGrid (CCTK_POINTER_TO_CONST IN cctkGH)

CCTK_INT FUNCTION
    SymmetryTableHandleForGI
        (CCTK_POINTER_TO_CONST IN cctkGH,
         CCTK_INT IN group_index)

CCTK_INT FUNCTION
    SymmetryTableHandleForGN
        (CCTK_POINTER_TO_CONST IN cctkGH,
         CCTK_STRING IN group_name)

The first of these functions returns the symmetry table handle for the grid hierarchy; the second and third return the that for the grid array group (by index or name, respectively).

The table entry with key symmetry_handle contains the symmetry handle for the symmetry boundary condition, or a negative number if the face has no symmetry boundary condition associated with it.

The code to find out which boundaries should have a physical boundary condition applied might look as follows:

#include "cctk.h"
#include "util_Table.h"

CCTK_INT symtable;
CCTK_INT symbnd[6];
int face;
int ierr;

symtable = SymmetryTableHandleForGrid (cctkGH);
if (symtable<0)
  CCTK_VWarn(0, __LINE__, __FILE__, "Thorn_Name", "symtable is out of bounds");

ierr = Util_TableGetIntArray (symtable, 6, symbnd, "symmetry_handle");
if (ierr!=6)
  CCTK_VWarn(0, __LINE__, __FILE__, "Thorn_Name", "Util_TableGetIntArray returned error");

for (face=0; face<6; ++face) {
  if (cctk_bbox[face] && symbnd[face]<0) {
    /* Apply physical boundary condition here */
  }
}


#include "util_Table.h"

CCTK_INT symtable
CCTK_INT symbnd(6)
integer face
integer ierr

symtable = SymmetryTableHandleForGrid (cctkGH)
if (symtable<0) call CCTK_WARN (0, "internal error")

call Util_TableGetIntArray (ierr, int(symtable), 6, symbnd, "symmetry_handle")
if (ierr/=6) call CCTK_WARN (0, "internal error")

do face=1,6
  if (cctk_bbox(face)/=0 .and. symbnd(face)<0) then
    ! Apply physical boundary condition here
  end if
end do