From d4794513d5d84ca696cbb33f29c1573aab1259c3 Mon Sep 17 00:00:00 2001 From: hawke <> Date: Thu, 20 Nov 2003 07:34:00 +0000 Subject: Fix the memory corruption. Fix the memory corruption. Doesn't converge with refinement, though. darcs-hash:20031120073403-58737-0a5f287cad04535eac0f5403862605f33e020a1f.gz --- CarpetDev/CarpetCG/src/CG.cc | 68 +++++++++++++++----------------------------- 1 file changed, 23 insertions(+), 45 deletions(-) (limited to 'CarpetDev/CarpetCG') diff --git a/CarpetDev/CarpetCG/src/CG.cc b/CarpetDev/CarpetCG/src/CG.cc index 37f8d7cf9..37d45e8d6 100644 --- a/CarpetDev/CarpetCG/src/CG.cc +++ b/CarpetDev/CarpetCG/src/CG.cc @@ -1,4 +1,4 @@ -/* $Header: /home/eschnett/C/carpet/Carpet/CarpetDev/CarpetCG/src/CG.cc,v 1.2 2003/11/19 14:05:36 schnetter Exp $ */ +/* $Header: /home/eschnett/C/carpet/Carpet/CarpetDev/CarpetCG/src/CG.cc,v 1.3 2003/11/20 08:34:03 hawke Exp $ */ #include #include @@ -55,13 +55,14 @@ namespace CarpetCG { int ierr; - int * nboundaryzones; + vector nboundaryzones(2*dim); CCTK_REAL factor; - CCTK_REAL * restrict factors; + vector factors; + + vector fromindex; // Can't pass things through CallLocalFunction. + vector toindex; // Instead assume everything is going from a GF to a GF. - int * fromindex; // Can't pass things through CallLocalFunction. - int * toindex; // Instead assume everything is going from a GF to a GF. CCTK_REAL realconstant; // With only one required constant CCTK_REAL realoutput; // And one output CCTK_REAL realoutput_count; // And one _more_ output @@ -628,45 +629,26 @@ namespace CarpetCG { assert (calcres); assert (applybounds); - if (!common::nboundaryzones) - { - common::nboundaryzones = - (int*)malloc(2 * dim * sizeof *common::nboundaryzones); - nelems = Util_TableGetIntArray - (options_table, 2*dim, common::nboundaryzones, "nboundaryzones"); - if (nelems == UTIL_ERROR_TABLE_NO_SUCH_KEY) { - for (d=0; d