[cig-commits] r6596 -
short/3D/PyLith/branches/pylith-0.8/pylith3d/module
leif at geodynamics.org
leif at geodynamics.org
Wed Apr 18 11:43:48 PDT 2007
Author: leif
Date: 2007-04-18 11:43:47 -0700 (Wed, 18 Apr 2007)
New Revision: 6596
Modified:
short/3D/PyLith/branches/pylith-0.8/pylith3d/module/PyLithMeshLib.pyx
short/3D/PyLith/branches/pylith-0.8/pylith3d/module/mesh.cc
short/3D/PyLith/branches/pylith-0.8/pylith3d/module/mesh.h
short/3D/PyLith/branches/pylith-0.8/pylith3d/module/petsc.pxd
short/3D/PyLith/branches/pylith-0.8/pylith3d/module/petscmeshfwd.h
Log:
Creating my own forward declarations of "petscmesh.h" functions turns
out to be a bad idea, because such functions can have different
linkage (C or C+) depending upon how PETSC was configured.
Modified: short/3D/PyLith/branches/pylith-0.8/pylith3d/module/PyLithMeshLib.pyx
===================================================================
--- short/3D/PyLith/branches/pylith-0.8/pylith3d/module/PyLithMeshLib.pyx 2007-04-18 00:38:35 UTC (rev 6595)
+++ short/3D/PyLith/branches/pylith-0.8/pylith3d/module/PyLithMeshLib.pyx 2007-04-18 18:43:47 UTC (rev 6596)
@@ -77,8 +77,7 @@
if self.A is not NULL:
_destroyMat(self)
if self.mesh is not NULL:
- petsc.MeshDestroy(self.mesh)
- self.mesh = NULL
+ _destroyMesh(self)
return
@@ -101,6 +100,7 @@
cdef extern object _processMesh "PyLithMeshLib::Mesh::_processMesh" (Mesh self)
cdef extern object _createMat "PyLithMeshLib::Mesh::_createMat " (Mesh self)
cdef extern object _destroyMat "PyLithMeshLib::Mesh::_destroyMat" (Mesh self)
+ cdef extern object _destroyMesh "PyLithMeshLib::Mesh::_destroyMesh" (Mesh self)
cdef extern object _outputMesh "PyLithMeshLib::Mesh::_outputMesh" (Mesh self, char *fileRoot)
Modified: short/3D/PyLith/branches/pylith-0.8/pylith3d/module/mesh.cc
===================================================================
--- short/3D/PyLith/branches/pylith-0.8/pylith3d/module/mesh.cc 2007-04-18 00:38:35 UTC (rev 6595)
+++ short/3D/PyLith/branches/pylith-0.8/pylith3d/module/mesh.cc 2007-04-18 18:43:47 UTC (rev 6596)
@@ -428,6 +428,18 @@
return Py_None;
}
+PyObject *PyLithMeshLib::Mesh::_destroyMesh(PyMeshObject *self)
+
+{
+ if (MeshDestroy(self->mesh)) {
+ PyErr_SetString(PyExc_RuntimeError, "Could not destroy PETSc Mesh");
+ return 0;
+ }
+ self->mesh = 0;
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
PetscErrorCode updateDisplacement(SectionReal displacement, Vec sol) {
VecScatter injection;
Vec lv;
Modified: short/3D/PyLith/branches/pylith-0.8/pylith3d/module/mesh.h
===================================================================
--- short/3D/PyLith/branches/pylith-0.8/pylith3d/module/mesh.h 2007-04-18 00:38:35 UTC (rev 6595)
+++ short/3D/PyLith/branches/pylith-0.8/pylith3d/module/mesh.h 2007-04-18 18:43:47 UTC (rev 6596)
@@ -51,6 +51,9 @@
// destroy a PETSc Mat
PyObject *_destroyMat(PyMeshObject *self);
+ // destroy a PETSc Mesh
+ PyObject *_destroyMesh(PyMeshObject *self);
+
// output a PETSc Mesh and Fields
PyObject *_outputMesh(PyMeshObject *self, char *fileRoot);
Modified: short/3D/PyLith/branches/pylith-0.8/pylith3d/module/petsc.pxd
===================================================================
--- short/3D/PyLith/branches/pylith-0.8/pylith3d/module/petsc.pxd 2007-04-18 00:38:35 UTC (rev 6595)
+++ short/3D/PyLith/branches/pylith-0.8/pylith3d/module/petsc.pxd 2007-04-18 18:43:47 UTC (rev 6596)
@@ -58,7 +58,6 @@
cdef extern from "petscmeshfwd.h": # for compilation speed
struct _p_Mesh
ctypedef _p_Mesh *Mesh
- PetscErrorCode MeshDestroy(Mesh)
cdef extern from "petsclog.h":
Modified: short/3D/PyLith/branches/pylith-0.8/pylith3d/module/petscmeshfwd.h
===================================================================
--- short/3D/PyLith/branches/pylith-0.8/pylith3d/module/petscmeshfwd.h 2007-04-18 00:38:35 UTC (rev 6595)
+++ short/3D/PyLith/branches/pylith-0.8/pylith3d/module/petscmeshfwd.h 2007-04-18 18:43:47 UTC (rev 6596)
@@ -32,14 +32,9 @@
#define pypylith3d_petscmeshfwd_h
-#include <petsc.h>
-
-
typedef struct _p_Mesh *Mesh;
-PetscErrorCode MeshDestroy(Mesh);
-
#endif
// end of file
More information about the cig-commits
mailing list