From 73ec59015f5e13f7042f8dcfe2647866b756ddc6 Mon Sep 17 00:00:00 2001 From: schnetter Date: Tue, 9 Mar 2004 14:12:09 +0000 Subject: Register with SymBase. git-svn-id: http://svn.cactuscode.org/arrangements/CactusNumerical/Periodic/trunk@12 1bf05452-ddb3-4880-bfa1-00436340132b --- interface.ccl | 13 +++++++++++++ schedule.ccl | 5 +++++ src/periodic.c | 41 ++++++++++++++++++++++++++++++++++------- src/periodic.h | 3 +++ 4 files changed, 55 insertions(+), 7 deletions(-) diff --git a/interface.ccl b/interface.ccl index aa3fd55..222d4f1 100644 --- a/interface.ccl +++ b/interface.ccl @@ -10,6 +10,19 @@ USES INCLUDE HEADER: Slab.h +CCTK_INT FUNCTION SymmetryRegister (CCTK_STRING IN sym_name) +USES FUNCTION SymmetryRegister + +CCTK_INT FUNCTION \ + SymmetryRegisterGrid \ + (CCTK_POINTER IN cctkGH, \ + CCTK_INT IN sym_handle, \ + CCTK_INT IN ARRAY which_faces, \ + CCTK_INT IN ARRAY symmetry_zone_width) +USES FUNCTION SymmetryRegisterGrid + + + CCTK_INT FUNCTION Boundary_SelectedGVs(CCTK_POINTER_TO_CONST IN GH, \ CCTK_INT IN array_size, CCTK_INT ARRAY OUT var_indicies, \ diff --git a/schedule.ccl b/schedule.ccl index 9be1b93..65050d4 100644 --- a/schedule.ccl +++ b/schedule.ccl @@ -1,6 +1,11 @@ # Schedule definitions for thorn Periodic # $Header$ +SCHEDULE Periodic_RegisterBC IN SymmetryRegister +{ + LANG: C +} "Register periodic boundary conditions" + SCHEDULE Periodic_ApplyBC IN BoundaryConditions { LANG: C diff --git a/src/periodic.c b/src/periodic.c index ccb6a8a..33dbee0 100644 --- a/src/periodic.c +++ b/src/periodic.c @@ -43,7 +43,7 @@ BndPeriodicVI (cGH const * restrict const cctkGH, fullname = CCTK_FullName(vi); assert (fullname); CCTK_VInfo (CCTK_THORNSTRING, - "Applying periodicity boundary conditions to %s", + "Applying periodicity boundary conditions to \"%s\"", fullname); free (fullname); } @@ -109,7 +109,7 @@ BndPeriodicVI (cGH const * restrict const cctkGH, if (data.gsh[dir] < 2*stencil[dir]+1) { CCTK_VWarn (0, __LINE__, __FILE__, CCTK_THORNSTRING, - "The group %s has in the %c-direction only %d grid points. " + "The group \"%s\" has in the %c-direction only %d grid points. " "This is not large enough for a periodic boundary that is %d grid points wide. " "The group needs to have at least %d grid points in that direction.", CCTK_GroupNameFromVarI(vi), "xyz"[dir], data.gsh[dir], @@ -261,6 +261,38 @@ BndPeriodicGN (cGH const * restrict const cctkGH, +void +Periodic_RegisterBC (cGH * restrict const cctkGH) +{ + DECLARE_CCTK_PARAMETERS; + + int f; + CCTK_INT handle; + CCTK_INT faces[6]; + CCTK_INT width[6]; + CCTK_INT ierr; + + faces[0] = faces[1] = periodic || periodic_x; + faces[2] = faces[3] = periodic || periodic_y; + faces[4] = faces[5] = periodic || periodic_z; + + for (f=0; f<6; ++f) { + width[f] = cctkGH->cctk_nghostzones[f/2]; + } + + handle = SymmetryRegister ("periodic"); + if (handle < 0) { + CCTK_WARN (0, "Could not register periodicity boundary condition"); + } + + ierr = SymmetryRegisterGrid (cctkGH, handle, faces, width); + if (ierr < 0) { + CCTK_WARN (0, "Could not register the periodic boundaries -- probably some other thorn has already registered the same boundary faces for a different symmetry"); + } +} + + + void Periodic_ApplyBC (cGH const * restrict const cctkGH) { @@ -304,11 +336,6 @@ Periodic_ApplyBC (cGH const * restrict const cctkGH) stencil = malloc (dim * sizeof *stencil); assert (stencil); -#if 0 - for (d=0; d