aboutsummaryrefslogtreecommitdiff
path: root/src
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 /src
parent89e3c058c239575de1b502474f05c227918d48a1 (diff)
Register with SymBase.
git-svn-id: http://svn.cactuscode.org/arrangements/CactusNumerical/Periodic/trunk@12 1bf05452-ddb3-4880-bfa1-00436340132b
Diffstat (limited to 'src')
-rw-r--r--src/periodic.c41
-rw-r--r--src/periodic.h3
2 files changed, 37 insertions, 7 deletions
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 */