[cig-commits] r15077 - in short/3D/PyLith/trunk: modulesrc/include modulesrc/utils pylith/utils

brad at geodynamics.org brad at geodynamics.org
Thu May 28 13:39:36 PDT 2009


Author: brad
Date: 2009-05-28 13:39:35 -0700 (Thu, 28 May 2009)
New Revision: 15077

Modified:
   short/3D/PyLith/trunk/modulesrc/include/chararray.i
   short/3D/PyLith/trunk/modulesrc/utils/petsc_general.i
   short/3D/PyLith/trunk/pylith/utils/PetscManager.py
Log:
Removed debugging output. Add null to argv in PetscInitialize.

Modified: short/3D/PyLith/trunk/modulesrc/include/chararray.i
===================================================================
--- short/3D/PyLith/trunk/modulesrc/include/chararray.i	2009-05-28 17:36:31 UTC (rev 15076)
+++ short/3D/PyLith/trunk/modulesrc/include/chararray.i	2009-05-28 20:39:35 UTC (rev 15077)
@@ -72,7 +72,7 @@
   if (PyList_Check($input)) {
     const int size = PyList_Size($input);
     $1 = size;
-    $2 = (size > 0) ? new char*[size] : 0;
+    $2 = (size > 0) ? new char*[size+1] : 0;
     for (int i = 0; i < size; i++) {
       PyObject *s = PyList_GetItem($input,i);
       if (PyString_Check(s))
@@ -83,6 +83,7 @@
 	return NULL;
       } // else
     } // for
+    $2[size] = 0; // Must terminate argv with null!
   } else {
     PyErr_SetString(PyExc_TypeError, "Expected list of strings.");
     return NULL;
@@ -91,8 +92,6 @@
 
 // This cleans up the char** array we malloc'd before the function call
 %typemap(freearg) (int argc, char** argv) {
-  for (int i=0; i < $1; ++i)
-    std::cout << "ARGV["<<i<<"]: '" << $2[i] << "'" << std::endl;
   delete[] $2;
 }
 

Modified: short/3D/PyLith/trunk/modulesrc/utils/petsc_general.i
===================================================================
--- short/3D/PyLith/trunk/modulesrc/utils/petsc_general.i	2009-05-28 17:36:31 UTC (rev 15076)
+++ short/3D/PyLith/trunk/modulesrc/utils/petsc_general.i	2009-05-28 20:39:35 UTC (rev 15077)
@@ -18,7 +18,7 @@
 	     char** argv)
   { // initialize
     PetscErrorCode err = 
-      PetscInitialize(&argc, &argv, NULL, NULL); CHKERRQ(err);
+      PetscInitialize(&argc, &argv, PETSC_NULL, PETSC_NULL); CHKERRQ(err);
     return 0;
   } // initialize
 %} // inline

Modified: short/3D/PyLith/trunk/pylith/utils/PetscManager.py
===================================================================
--- short/3D/PyLith/trunk/pylith/utils/PetscManager.py	2009-05-28 17:36:31 UTC (rev 15076)
+++ short/3D/PyLith/trunk/pylith/utils/PetscManager.py	2009-05-28 20:39:35 UTC (rev 15077)
@@ -52,7 +52,6 @@
     if len(options) > 0:
       for arg in options:
         args.append(arg)
-    print "PETSC INITIALIZE ARGS",args
     petsc.initialize(args)
     return
 



More information about the CIG-COMMITS mailing list