aboutsummaryrefslogtreecommitdiff
path: root/src/Symmetry.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/Symmetry.c')
-rw-r--r--src/Symmetry.c74
1 files changed, 73 insertions, 1 deletions
diff --git a/src/Symmetry.c b/src/Symmetry.c
index 0a2cb58..546ce17 100644
--- a/src/Symmetry.c
+++ b/src/Symmetry.c
@@ -14,11 +14,13 @@
@version $Id$
@@*/
+#include <assert.h>
#include <stdlib.h>
#include "cctk.h"
+#include "cctk_Arguments.h"
#include "cctk_Parameters.h"
-#include "cctk_FortranString.h"
+
#include "Symmetry.h"
/* the rcs ID and its dummy function to use it */
@@ -85,6 +87,11 @@ int CartSymGI (const cGH *GH, int gindex)
first_vindex = CCTK_FirstVarIndexI (gindex);
if (numvars > 0 && first_vindex >= 0)
{
+ char * groupname = CCTK_GroupName (gindex);
+ assert (groupname);
+ CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING,
+ "You should not call the symmetry boundary condition routines for the group \"%s\" through the CartSym* routines any more. The symmetry boundary conditions are now applied automatically when a physical boundary condition is applied.", groupname);
+ free (groupname);
retval = ApplySymmetry (GH, gindex, first_vindex, numvars);
}
else
@@ -192,6 +199,11 @@ int CartSymVI (const cGH *GH, int vindex)
gindex = CCTK_GroupIndexFromVarI (vindex);
if (gindex >= 0)
{
+ char * fullname = CCTK_FullName (vindex);
+ assert (fullname);
+ CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING,
+ "You should not call the symmetry boundary condition routines for the variable \"%s\" through the CartSym* routines any more. The symmetry boundary conditions are now applied automatically when a physical boundary condition is applied.", fullname);
+ free (fullname);
retval = ApplySymmetry (GH, gindex, vindex, 1);
}
else
@@ -657,3 +669,63 @@ static int ApplySymmetry (const cGH *GH, int gindex, int first_vindex,
return (retval);
}
+
+
+
+/*@@
+ @routine CartGrid3D_ApplyBC
+ @date Sat Feb 07
+ @author Erik Schnetter
+ @desc Apply the symmetry boundary conditions
+ @enddesc
+@@*/
+
+void CartGrid3D_ApplyBC (CCTK_ARGUMENTS)
+{
+ DECLARE_CCTK_ARGUMENTS;
+ DECLARE_CCTK_ARGUMENTS;
+
+ int nvars;
+ CCTK_INT * restrict indices;
+ CCTK_INT * restrict faces;
+ CCTK_INT * restrict widths;
+ CCTK_INT * restrict tables;
+ int vi;
+ int gi;
+ int i;
+ int ierr;
+
+ assert (cctkGH);
+
+ nvars = Boundary_SelectedGVs (cctkGH, 0, 0, 0, 0, 0, 0);
+ assert (nvars>=0);
+
+ indices = malloc (nvars * sizeof *indices);
+ assert (indices);
+ faces = malloc (nvars * sizeof *faces);
+ assert (faces);
+ widths = malloc (nvars * sizeof *widths);
+ assert (widths);
+ tables = malloc (nvars * sizeof *tables);
+ assert (tables);
+
+ ierr = Boundary_SelectedGVs
+ (cctkGH, nvars, indices, faces, widths, tables, 0);
+ assert (ierr == nvars);
+
+ for (i=0; i<nvars; ++i) {
+ vi = indices[i];
+ assert (vi>=0 && vi<CCTK_NumVars());
+
+ gi = CCTK_GroupIndexFromVarI (vi);
+ assert (gi>=0);
+
+ ierr = ApplySymmetry (cctkGH, gi, vi, 1);
+ assert (!ierr);
+ }
+
+ free (indices);
+ free (faces);
+ free (widths);
+ free (tables);
+ }