[Users] Inherits: grid should initialize 1-d coordinate gridfunctions?

Ian Hinder ian.hinder at aei.mpg.de
Fri Aug 5 03:41:53 CDT 2011


On 5 Aug 2011, at 05:32, Scott Hawley wrote:

> 
> 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…

Can you show the part of your schedule.ccl file that executes this function?  Are you calling your function in local mode?  Calling in local mode is necessary to have access to grid functions. 


> 
> 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
> 
> 
> 
> 
> _______________________________________________
> Users mailing list
> Users at einsteintoolkit.org
> http://lists.einsteintoolkit.org/mailman/listinfo/users

-- 
Ian Hinder
ian.hinder at aei.mpg.de



More information about the Users mailing list