aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschnetter <schnetter@1bf05452-ddb3-4880-bfa1-00436340132b>2004-03-09 14:12:09 +0000
committerschnetter <schnetter@1bf05452-ddb3-4880-bfa1-00436340132b>2004-03-09 14:12:09 +0000
commit73ec59015f5e13f7042f8dcfe2647866b756ddc6 (patch)
tree7b7aeba72d2ef060e0756e00469c5350480192a7
parent89e3c058c239575de1b502474f05c227918d48a1 (diff)
Register with SymBase.
git-svn-id: http://svn.cactuscode.org/arrangements/CactusNumerical/Periodic/trunk@12 1bf05452-ddb3-4880-bfa1-00436340132b
-rw-r--r--interface.ccl13
-rw-r--r--schedule.ccl5
-rw-r--r--src/periodic.c41
-rw-r--r--src/periodic.h3
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],
@@ -262,6 +262,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)
{
int nvars;
@@ -304,11 +336,6 @@ Periodic_ApplyBC (cGH const * restrict const cctkGH)
stencil = malloc (dim * sizeof *stencil);
assert (stencil);
-#if 0
- for (d=0; d<dim; ++d) {
- stencil[d] = widths[i];
- }
-#endif
ierr = CCTK_GroupnghostzonesVI (cctkGH, dim, stencil, vi);
assert (!ierr);
diff --git a/src/periodic.h b/src/periodic.h
index c423c73..32a77e5 100644
--- a/src/periodic.h
+++ b/src/periodic.h
@@ -28,6 +28,9 @@ BndPeriodicGN (cGH const * restrict const cctkGH,
void
+Periodic_RegisterBC (cGH * restrict const cctkGH);
+
+void
Periodic_ApplyBC (cGH const * restrict const cctkGH);
#endif /* defined PERIODIC_H */