[cig-commits] r6883 - short/3D/PyLith/trunk/modulesrc/topology
leif at geodynamics.org
leif at geodynamics.org
Tue May 15 16:12:17 PDT 2007
Author: leif
Date: 2007-05-15 16:12:16 -0700 (Tue, 15 May 2007)
New Revision: 6883
Modified:
short/3D/PyLith/trunk/modulesrc/topology/Makefile.am
short/3D/PyLith/trunk/modulesrc/topology/topology.pyxe.src
Log:
Made mesh.comm return an mpi.MPI_Comm object. This requires the
latest dev version of pythia (r6882). I fudged PYTHON_EGG_PYXFLAGS,
since Merlin doesn't support it yet.
Modified: short/3D/PyLith/trunk/modulesrc/topology/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/modulesrc/topology/Makefile.am 2007-05-15 23:06:55 UTC (rev 6882)
+++ short/3D/PyLith/trunk/modulesrc/topology/Makefile.am 2007-05-15 23:12:16 UTC (rev 6883)
@@ -30,7 +30,7 @@
topologymodule_la_LIBADD += -lnetcdf_c++ -lnetcdf
endif
-INCLUDES += -I$(PYTHON_INCDIR) $(PETSC_INCLUDE)
+INCLUDES += $(PYTHON_EGG_CPPFLAGS) -I$(PYTHON_INCDIR) $(PETSC_INCLUDE)
topology.pyx topology_embed.cpp topology_embed.h: topology.pyxe
pyrexembed topology.pyxe
@@ -39,8 +39,11 @@
topology_embed.cpp: topology_embed.h
topology_embed.h: topology.pyx
+# NYI
+PYTHON_EGG_PYXFLAGS = $(PYTHON_EGG_CPPFLAGS)/mpi
+
.pyx.c:
- pyrexc $<
+ pyrexc $(PYTHON_EGG_PYXFLAGS) $<
CLEANFILES = topology.pyxe topology.pyx topology.c *_embed.*
Modified: short/3D/PyLith/trunk/modulesrc/topology/topology.pyxe.src
===================================================================
--- short/3D/PyLith/trunk/modulesrc/topology/topology.pyxe.src 2007-05-15 23:06:55 UTC (rev 6882)
+++ short/3D/PyLith/trunk/modulesrc/topology/topology.pyxe.src 2007-05-15 23:12:16 UTC (rev 6883)
@@ -20,9 +20,12 @@
#include <stdexcept>
#include <Python.h>
#include <assert.h>
+#include <mpi.h>
+#include "mpi/pympi.h"
#}header
# ----------------------------------------------------------------------
+
cdef extern from "Python.h":
object PyCObject_FromVoidPtr(void*, void (*destruct)(void*))
void* PyCObject_AsVoidPtr(object)
@@ -64,6 +67,12 @@
return
# ----------------------------------------------------------------------
+
+cimport mpi
+import mpi
+
+# ----------------------------------------------------------------------
+
cdef class Mesh:
cdef void* thisptr # Pointer to C++ object
@@ -310,14 +319,13 @@
Get MPI communicator associated with mesh.
"""
# create shim for method 'comm'
- #embed{ void* Mesh_comm_get(void* objVptr)
- // REPLACE SOME OF THIS STUFF
- void* result = 0; // TEMPORARY (fix this)
+ #embed{ void Mesh_comm_get(void* objVptr, void *vpycomm)
try {
ALE::Obj<ALE::Mesh>* mesh = (ALE::Obj<ALE::Mesh>*) objVptr;
assert(0 != mesh);
assert(!mesh->isNull());
- result = (void*) (*mesh)->comm(); // TEMPORARY (fix this)
+ PyMPICommObject *pycomm = (PyMPICommObject *)vpycomm;
+ pycomm->comm = (*mesh)->comm();
} catch (const std::exception& err) {
PyErr_SetString(PyExc_RuntimeError,
const_cast<char*>(err.what()));
@@ -328,11 +336,11 @@
PyErr_SetString(PyExc_RuntimeError,
"Caught unknown C++ exception.");
} // try/catch
- return result;
#}embed
- # handle = Mesh_comm_get(self.thisptr)
- # return comm
- return 0
+ cdef mpi.MPI_Comm pycomm
+ pycomm = mpi.MPI_Comm()
+ Mesh_comm_get(self.thisptr, <void*>pycomm)
+ return pycomm
# ----------------------------------------------------------------------
More information about the cig-commits
mailing list