diff options
author | tradke <tradke@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2000-03-03 17:06:06 +0000 |
---|---|---|
committer | tradke <tradke@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2000-03-03 17:06:06 +0000 |
commit | 679e5e39f811d223055c540b7b8f1d40de589cad (patch) | |
tree | 4d223974d8c63d96c2ce3e4f39489ecfdb52eb55 /src/comm/CactusDefaultComm.c | |
parent | 976b968fd5d82ae926911759100353bb57e3505d (diff) |
Use a fake dim to allocate arrays if cctk_dim is 0.
Fix for BR 221.
Thomas
git-svn-id: http://svn.cactuscode.org/flesh/trunk@1410 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'src/comm/CactusDefaultComm.c')
-rw-r--r-- | src/comm/CactusDefaultComm.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/src/comm/CactusDefaultComm.c b/src/comm/CactusDefaultComm.c index 9fdcebb5..00067962 100644 --- a/src/comm/CactusDefaultComm.c +++ b/src/comm/CactusDefaultComm.c @@ -69,6 +69,7 @@ cGH *CactusDefaultSetupGH(tFleshConfig *config, int convergence_level) int ntimelevels; int level; int i; + int cctk_dim; retval = NULL; @@ -92,22 +93,23 @@ cGH *CactusDefaultSetupGH(tFleshConfig *config, int convergence_level) thisGH->cctk_dim = CCTK_MaxDim(); /* Need this to be at least one otherwise the memory allocation will fail. */ - if(thisGH->cctk_dim == 0) thisGH->cctk_dim = 1; + cctk_dim = thisGH->cctk_dim; + if(thisGH->cctk_dim == 0) cctk_dim = 1; thisGH->cctk_iteration = 0; - thisGH->cctk_gsh = (int *)malloc(thisGH->cctk_dim*sizeof(int)); - thisGH->cctk_lsh = (int *)malloc(thisGH->cctk_dim*sizeof(int)); - thisGH->cctk_lbnd = (int *)malloc(thisGH->cctk_dim*sizeof(int)); - thisGH->cctk_ubnd = (int *)malloc(thisGH->cctk_dim*sizeof(int)); + thisGH->cctk_gsh = (int *)malloc(cctk_dim*sizeof(int)); + thisGH->cctk_lsh = (int *)malloc(cctk_dim*sizeof(int)); + thisGH->cctk_lbnd = (int *)malloc(cctk_dim*sizeof(int)); + thisGH->cctk_ubnd = (int *)malloc(cctk_dim*sizeof(int)); - thisGH->cctk_lssh = (int *)malloc(CCTK_NSTAGGER*thisGH->cctk_dim*sizeof(int)); - thisGH->cctk_to = (int *)malloc(thisGH->cctk_dim*sizeof(int)); - thisGH->cctk_from = (int *)malloc(thisGH->cctk_dim*sizeof(int)); - thisGH->cctk_bbox = (int *)malloc(2*thisGH->cctk_dim*sizeof(int)); - thisGH->cctk_nghostzones = (int *)malloc(2*thisGH->cctk_dim*sizeof(int)); - thisGH->cctk_levfac = (int *)malloc(thisGH->cctk_dim*sizeof(int)); - thisGH->cctk_delta_space = (CCTK_REAL *)malloc(thisGH->cctk_dim*sizeof(CCTK_REAL)); + thisGH->cctk_lssh = (int *)malloc(CCTK_NSTAGGER*cctk_dim*sizeof(int)); + thisGH->cctk_to = (int *)malloc(cctk_dim*sizeof(int)); + thisGH->cctk_from = (int *)malloc(cctk_dim*sizeof(int)); + thisGH->cctk_bbox = (int *)malloc(2*cctk_dim*sizeof(int)); + thisGH->cctk_nghostzones = (int *)malloc(2*cctk_dim*sizeof(int)); + thisGH->cctk_levfac = (int *)malloc(cctk_dim*sizeof(int)); + thisGH->cctk_delta_space = (CCTK_REAL *)malloc(cctk_dim*sizeof(CCTK_REAL)); /* FIXME : Next line goes when coords are done properly */ - thisGH->cctk_origin_space = (CCTK_REAL *)malloc(thisGH->cctk_dim*sizeof(CCTK_REAL)); + thisGH->cctk_origin_space = (CCTK_REAL *)malloc(cctk_dim*sizeof(CCTK_REAL)); thisGH->cctk_delta_time = 1; thisGH->cctk_convlevel = 0; |