aboutsummaryrefslogtreecommitdiff
path: root/src/call_derivs_name.c
diff options
context:
space:
mode:
authordiener <diener@f69c4107-0314-4c4f-9ad4-17e986b73f4a>2004-10-06 20:07:54 +0000
committerdiener <diener@f69c4107-0314-4c4f-9ad4-17e986b73f4a>2004-10-06 20:07:54 +0000
commit9928cd0a8e8683d47e385b38b7723ed7ede34b9e (patch)
tree148c7e428624d676bd41aecabc9eda03a3efbc5d /src/call_derivs_name.c
parent9d639bc123f2c23f5db7c436ec63e21c07e8746b (diff)
Moved call_derivs.c to call_derivs_name.c. Created a new differncing routine
(after Erik explained to me that CCTK_ARGUMENTS can be accessed even though they are not passed into the routine) that is called with the variables themselves and not their names. These are provided by the aliased function Diff_gf, so now the x-derivatives of rho can be found with the call: Diff_gv ( cctkGH, 0, rho, drhox ); Also made the determination of the gridspacing use CCTK_DELTA_SPACE (now that I know how to do it) so the routines should now also work with mesh-refinement. git-svn-id: https://svn.cct.lsu.edu/repos/numrel/LSUThorns/SummationByParts/trunk@4 f69c4107-0314-4c4f-9ad4-17e986b73f4a
Diffstat (limited to 'src/call_derivs_name.c')
-rw-r--r--src/call_derivs_name.c105
1 files changed, 105 insertions, 0 deletions
diff --git a/src/call_derivs_name.c b/src/call_derivs_name.c
new file mode 100644
index 0000000..c696e4e
--- /dev/null
+++ b/src/call_derivs_name.c
@@ -0,0 +1,105 @@
+#include "cctk.h"
+#include "cctk_Parameters.h"
+
+#include <assert.h>
+
+void DiffGf ( const CCTK_POINTER cctkGH, const CCTK_INT dir,
+ const char *var_name, const char *dvar_name )
+{
+ CCTK_REAL *var, *dvar;
+ CCTK_INT ni, nj, nk, gsize, ic;
+ CCTK_REAL delta;
+ CCTK_REAL phys_min[3], phys_max[3];
+ CCTK_REAL int_min[3], int_max[3];
+ CCTK_REAL ext_min[3], ext_max[3];
+ CCTK_REAL spacing[3];
+ CCTK_INT ierr;
+ CCTK_INT lsh[3], bbox[6], bb[2], nghostzones[3];
+ void CCTK_FCALL CCTK_FNAME(deriv_gf_2_1)(CCTK_REAL *var, const CCTK_INT *ni,
+ const CCTK_INT *nj, const CCTK_INT *nk,
+ const CCTK_INT *dir,
+ const CCTK_INT *bb,
+ const CCTK_INT *gsize,
+ const CCTK_REAL *delta,
+ CCTK_REAL *dvar);
+ void CCTK_FCALL CCTK_FNAME(deriv_gf_4_2)(CCTK_REAL *var, const CCTK_INT *ni,
+ const CCTK_INT *nj, const CCTK_INT *nk,
+ const CCTK_INT *dir,
+ const CCTK_INT *bb,
+ const CCTK_INT *gsize,
+ const CCTK_REAL *delta,
+ CCTK_REAL *dvar);
+ void CCTK_FCALL CCTK_FNAME(deriv_gf_6_3)(CCTK_REAL *var, const CCTK_INT *ni,
+ const CCTK_INT *nj, const CCTK_INT *nk,
+ const CCTK_INT *dir,
+ const CCTK_INT *bb,
+ const CCTK_INT *gsize,
+ const CCTK_REAL *delta,
+ CCTK_REAL *dvar);
+ DECLARE_CCTK_PARAMETERS
+
+
+ if (CCTK_GrouplshVN(cctkGH, 3, lsh, var_name) < 0)
+ {
+ CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING,
+ "Error getting local size of grid for variable '%s'",var_name);
+ }
+ if (CCTK_GroupbboxVN(cctkGH, 6, bbox, var_name) < 0)
+ {
+ CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING,
+ "Error getting bounding box for variable '%s'",var_name);
+ }
+ if (CCTK_GroupnghostzonesVN(cctkGH, 3, nghostzones, var_name) < 0)
+ {
+ CCTK_VWarn(1, __LINE__, __FILE__, CCTK_THORNSTRING,
+ "Error getting number of ghostzones for variable '%s'",var_name);
+ }
+
+ ni = lsh[0]; nj = lsh[1]; nk = lsh[2];
+
+ ierr = GetDomainSpecification ( 3, phys_min, phys_max, int_min, int_max,
+ ext_min, ext_max, spacing );
+
+ switch(dir) {
+ case 0: {
+ delta = spacing[0];
+ bb[0] = bbox[0]; bb[1] = bbox[1];
+ gsize = nghostzones[0];
+ break;
+ }
+ case 1: {
+ delta = spacing[1];
+ bb[0] = bbox[2]; bb[1] = bbox[3];
+ gsize = nghostzones[1];
+ break;
+ }
+ case 2: {
+ delta = spacing[2];
+ bb[0] = bbox[4]; bb[1] = bbox[5];
+ gsize = nghostzones[2];
+ break;
+ }
+ default:
+ assert(0);
+ }
+
+ var = (CCTK_REAL *)(CCTK_VarDataPtr(cctkGH,0,var_name));
+ dvar = (CCTK_REAL *)(CCTK_VarDataPtr(cctkGH,0,dvar_name));
+
+ switch(order) {
+ case 2: {
+ CCTK_FNAME(deriv_gf_2_1)(var,&ni,&nj,&nk,&dir,bb,&gsize,&delta,dvar);
+ break;
+ }
+ case 4: {
+ CCTK_FNAME(deriv_gf_4_2)(var,&ni,&nj,&nk,&dir,bb,&gsize,&delta,dvar);
+ break;
+ }
+ case 6: {
+ CCTK_FNAME(deriv_gf_6_3)(var,&ni,&nj,&nk,&dir,bb,&gsize,&delta,dvar);
+ break;
+ }
+ default:
+ assert(0);
+ }
+}