[cig-commits] r6065 - short/3D/PyLith/trunk/modulesrc/utils

brad at geodynamics.org brad at geodynamics.org
Thu Feb 22 21:37:32 PST 2007


Author: brad
Date: 2007-02-22 21:37:32 -0800 (Thu, 22 Feb 2007)
New Revision: 6065

Modified:
   short/3D/PyLith/trunk/modulesrc/utils/petsc.pyxe.src
Log:
Moved PetscInitialize() and PetscFinialize() to C++ shims to force compilation with C++ compiler.

Modified: short/3D/PyLith/trunk/modulesrc/utils/petsc.pyxe.src
===================================================================
--- short/3D/PyLith/trunk/modulesrc/utils/petsc.pyxe.src	2007-02-23 05:15:18 UTC (rev 6064)
+++ short/3D/PyLith/trunk/modulesrc/utils/petsc.pyxe.src	2007-02-23 05:37:32 UTC (rev 6065)
@@ -10,11 +10,9 @@
 # ======================================================================
 #
 
-# ----------------------------------------------------------------------
-cdef extern from "petsc.h":
-  ctypedef int PetscErrorCode
-  PetscErrorCode PetscInitialize(int*, char***, char[], char[])
-  PetscErrorCode PetscFinalize()
+#header{
+#include <petsc.h>
+#}header
 
 # ----------------------------------------------------------------------
 cdef extern from "Python.h":
@@ -41,7 +39,12 @@
   """
   Initialize PETSc.
   """
-  cdef PetscErrorCode err
+  # create shim for 'PetscInitialize'
+  #embed{ int Petsc_initialize(int* argc, char*** argv)
+  PetscErrorCode err = PetscInitialize(argc, argv, NULL, NULL);
+  return err;
+  #}embed
+  cdef int err
   cdef char** argv
   cdef char* arg
   cdef int argc
@@ -53,7 +56,9 @@
     argv[i] = <char*> malloc((strlen(arg)+1)*sizeof(char));
     strcpy(argv[i], arg);
   argv[argc] = NULL;
-  err = PetscInitialize(&argc, &argv, NULL, NULL)
+  err = Petsc_initialize(&argc, &argv);
+  # :TODO: Check error code for success
+  
   for i from 0 <= i < argc:
     free(argv[i])
   free(argv)
@@ -64,8 +69,15 @@
   """
   Finalize PETSc.
   """
-  cdef PetscErrorCode err
-  err = PetscFinalize()
+  # create shim for 'PetscFnitialize'
+  #embed{ int Petsc_finalize()
+  PetscErrorCode err = PetscFinalize();
+  return err;
+  #}embed
+  cdef int err
+  err = Petsc_finalize()
+  # :TODO: Check error code for success
+
   return
 
 



More information about the cig-commits mailing list