[Commits] [svn:einsteintoolkit] incoming/Outflow/ (Rev. 67)
roland.haas at physics.gatech.edu
roland.haas at physics.gatech.edu
Thu May 3 13:29:09 CDT 2012
User: rhaas
Date: 2012/05/03 01:29 PM
Modified:
/Outflow/
interface.ccl, param.ccl
/Outflow/src/
outflow.c
/Outflow/test/
moving_tov.par
Log:
Outflow: add support for named surfaces, fix some compiler warnings
File Changes:
Directory: /Outflow/
====================
File [modified]: interface.ccl
Delta lines: +5 -0
===================================================================
--- Outflow/interface.ccl 2012-05-03 18:08:13 UTC (rev 66)
+++ Outflow/interface.ccl 2012-05-03 18:29:09 UTC (rev 67)
@@ -9,6 +9,11 @@
REQUIRES FUNCTION IO_TruncateOutputFiles
+# translate SphericalSurface name into ID
+CCTK_INT \
+FUNCTION sf_IdFromName (CCTK_INT IN id, CCTK_POINTER_TO_CONST IN name)
+USES FUNCTION sf_IdFromName
+
REAL outflow_flux[num_detectors] TYPE=scalar tags='checkpoint="no"' "flux of mass through the detectors"
REAL fluxdens_projected[num_detectors] TYPE=ARRAY DIM=2 SIZE=SphericalSurface::maxntheta,SphericalSurface::maxnphi DISTRIB=CONSTANT tags='checkpoint="no"' "2D (theta,phi) grid arrays for flux density"
File [modified]: param.ccl
Delta lines: +6 -0
===================================================================
--- Outflow/param.ccl 2012-05-03 18:08:13 UTC (rev 66)
+++ Outflow/param.ccl 2012-05-03 18:29:09 UTC (rev 67)
@@ -25,6 +25,12 @@
0:* :: "valid surface"
} -1
+CCTK_STRING surface_name[100] "the indices of the sphericalsurfaces from which we take the surfaces to compute the outflow on" STEERABLE=always
+{
+ "" :: "use surface_index"
+ ".*" :: "any string"
+} ""
+
BOOLEAN override_radius[100] "do not take radius values from spherical surface" STEERABLE = ALWAYS
{
} "no"
Directory: /Outflow/src/
========================
File [modified]: outflow.c
Delta lines: +9 -7
===================================================================
--- Outflow/src/outflow.c 2012-05-03 18:08:13 UTC (rev 66)
+++ Outflow/src/outflow.c 2012-05-03 18:29:09 UTC (rev 67)
@@ -7,6 +7,7 @@
#include "cctk.h"
#include "cctk_Arguments.h"
#include "cctk_Parameters.h"
+#include "cctk_Functions.h"
#include "util_Table.h"
#include "util_String.h"
@@ -83,7 +84,7 @@
static CCTK_REAL *outflow_allocate_array(CCTK_INT npoints, const char *name);
/* replace '/' by '\' in file name to have Util_TableSet* accept it as a key */
-static const char *sanitize_filename(const char *fn);
+static char *sanitize_filename(const char *fn);
/* write results to disk */
static int Outflow_write_output(CCTK_ARGUMENTS, CCTK_INT det, CCTK_REAL flux,
CCTK_REAL w_lorentz, const CCTK_REAL *threshold_fluxes);
@@ -100,7 +101,7 @@
/**********************************************************************/
/*** IO ***/
/**********************************************************************/
-static const char *sanitize_filename(const char *fn)
+static char *sanitize_filename(const char *fn)
{
char *sfn = Util_Strdup(fn);
if (sfn == NULL) {
@@ -143,7 +144,6 @@
"warn: det=%d, but MAX_NUMBER_DETECTORS=%d, increase",
det,MAX_NUMBER_DETECTORS);
}
- assert(surface_index[det] >= 0);
// filename
Util_asprintf (&filename, "%s/outflow_surface_det_%d_%s.asc", out_dir, det, varname);
@@ -173,9 +173,10 @@
// write header on startup
if (!file_created) {
- const CCTK_INT sn = surface_index[det];
+ const CCTK_INT sn = sf_IdFromName(surface_index[det], surface_name[det]);
const CCTK_INT ntheta=sf_ntheta[sn]-2*nghoststheta[sn];
const CCTK_INT nphi=sf_nphi[sn]-2*nghostsphi[sn];
+ assert(sn >= 0);
fprintf(file,"# 2d Outflow\n");
fprintf(file,"# detector no.=%d ntheta=%d nphi=%d\n",det,ntheta,nphi);
fprintf(file,"# gnuplot column index:\n");
@@ -196,7 +197,7 @@
"\t%%%s", out_format);
assert(len_written < sizeof(format_str_extras)/sizeof(format_str_extras[0]));
- const CCTK_INT sn = surface_index[det];
+ const CCTK_INT sn = sf_IdFromName(surface_index[det], surface_name[det]);
const CCTK_INT ntheta=sf_ntheta[sn]-2*nghoststheta[sn];
const CCTK_INT imin=nghoststheta[sn], imax=sf_ntheta[sn]-nghoststheta[sn]-1;
const CCTK_INT jmin=nghostsphi[sn], jmax=sf_nphi[sn]-nghostsphi[sn]-1;
@@ -204,6 +205,7 @@
const CCTK_REAL oph=sf_origin_phi[sn];
const CCTK_REAL dth=sf_delta_theta[sn];
const CCTK_REAL dph=sf_delta_phi[sn];
+ assert(sn >= 0);
CCTK_REAL th, ph, ct,st, cp,sp,rp;
CCTK_REAL det_x, det_y, det_z;
@@ -438,7 +440,7 @@
for (int i=0; i<num_extras; i++)
assert(extras[i]);
- sn = surface_index[det];
+ sn = sf_IdFromName(surface_index[det], surface_name[det]);
assert(sn>=0);
ntheta=sf_ntheta[sn]-2*nghoststheta[sn];
@@ -911,7 +913,7 @@
continue;
}
- sn=surface_index[det];
+ sn = sf_IdFromName(surface_index[det], surface_name[det]);
if (sn < 0) {
CCTK_VWarn(0, __LINE__, __FILE__, CCTK_THORNSTRING,
"surface number sn=%d is invalid for detector %d", sn,det);
Directory: /Outflow/test/
=========================
File [modified]: moving_tov.par
Delta lines: +2 -1
===================================================================
--- Outflow/test/moving_tov.par 2012-05-03 18:08:13 UTC (rev 66)
+++ Outflow/test/moving_tov.par 2012-05-03 18:29:09 UTC (rev 67)
@@ -122,6 +122,7 @@
SphericalSurface::radius_x[1] = 6.
SphericalSurface::radius_y[1] = 6.
SphericalSurface::radius_z[1] = 5.
+SphericalSurface::name[1] = "ellipsoid"
SphericalSurface::ntheta[0] = 10
SphericalSurface::nphi [0] = 8
@@ -135,7 +136,7 @@
Outflow::compute_every = 2
Outflow::num_detectors = 2
Outflow::surface_index[0] = 0
-Outflow::surface_index[1] = 1
+Outflow::surface_name[1] = "ellipsoid"
Outflow::extra_variables = "grid::x grid::y"
Outflow::interpolator_name = "Lagrange polynomial interpolation"
Outflow::interpolator_pars = "order=4"
More information about the Commits
mailing list