I'm getting a segmentation fault when I try to use, say "x[i]" in my thorn that inherits "grid", because the array x itself is null. Am I doing this wrong? I see that CartGrid3D executes…
Thanks, Scott
The beginning of the code looks like this...
% cat mythorn.cc
#include <cassert> #include <cstdio> #include <cstdlib> #include <sstream> #include <string> #include <vector> #include <fcntl.h> #include <unistd.h>
#include "cctk.h" #include "cctk_Arguments.h" #include "cctk_Parameters.h" #include "Slab.h" #include "carpet.hh"
using namespace std; using namespace Carpet;
extern "C" void
MyThorn(CCTK_ARGUMENTS) { DECLARE_CCTK_ARGUMENTS; DECLARE_CCTK_PARAMETERS;
CCTK_INFO ("Calling MyThorn");
/* total number of points on this processor */ CCTK_INT nx = cctk_lsh[0]; CCTK_INT ny = cctk_lsh[1]; CCTK_INT nz = cctk_lsh[2];
/* print out x coordinates */ for (int i = 0; i < nx; i++) { printf("x[%d] = %g\n",i,x[i]); }
...
% more interface.ccl
IMPLEMENTS: MyThorn
INHERITS: ADMBase StaticConformal grid
USES INCLUDE HEADER: Slab.h
-- Scott H. Hawley, Ph.D. Asst. Prof. of Physics Chemistry & Physics Dept Office: Hitch 100D Belmont University Tel: +1-615-460-6206 Nashville, TN 37212 USA Fax: +1-615-460-5458 PGP Key at http://sks-keyservers.net