[cig-commits] r6881 - in short/3D/PyLith/trunk: modulesrc/topology
pylith/meshio pylith/topology
brad at geodynamics.org
brad at geodynamics.org
Tue May 15 14:24:26 PDT 2007
Author: brad
Date: 2007-05-15 14:24:25 -0700 (Tue, 15 May 2007)
New Revision: 6881
Modified:
short/3D/PyLith/trunk/modulesrc/topology/topology.pyxe.src
short/3D/PyLith/trunk/pylith/meshio/MeshIO.py
short/3D/PyLith/trunk/pylith/topology/Mesh.py
Log:
Worked on cleaning up getting communicator from C++ Mesh back to Python.
Modified: short/3D/PyLith/trunk/modulesrc/topology/topology.pyxe.src
===================================================================
--- short/3D/PyLith/trunk/modulesrc/topology/topology.pyxe.src 2007-05-15 19:34:47 UTC (rev 6880)
+++ short/3D/PyLith/trunk/modulesrc/topology/topology.pyxe.src 2007-05-15 21:24:25 UTC (rev 6881)
@@ -304,6 +304,37 @@
return Mesh_dimension_get(self.thisptr)
+ property comm:
+ def __get__(self):
+ """
+ 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)
+ try {
+ ALE::Obj<ALE::Mesh>* mesh = (ALE::Obj<ALE::Mesh>*) objVptr;
+ assert(0 != mesh);
+ assert(!mesh->isNull());
+ result = (void*) (*mesh)->comm(); // TEMPORARY (fix this)
+ } catch (const std::exception& err) {
+ PyErr_SetString(PyExc_RuntimeError,
+ const_cast<char*>(err.what()));
+ } catch (const ALE::Exception& err) {
+ PyErr_SetString(PyExc_RuntimeError,
+ const_cast<char*>(err.msg().c_str()));
+ } catch (...) {
+ PyErr_SetString(PyExc_RuntimeError,
+ "Caught unknown C++ exception.");
+ } // try/catch
+ return result;
+ #}embed
+ # handle = Mesh_comm_get(self.thisptr)
+ # return comm
+ return 0
+
+
# ----------------------------------------------------------------------
cdef class MeshGenSimple:
Modified: short/3D/PyLith/trunk/pylith/meshio/MeshIO.py
===================================================================
--- short/3D/PyLith/trunk/pylith/meshio/MeshIO.py 2007-05-15 19:34:47 UTC (rev 6880)
+++ short/3D/PyLith/trunk/pylith/meshio/MeshIO.py 2007-05-15 21:24:25 UTC (rev 6881)
@@ -60,7 +60,7 @@
# Read mesh
import mpi
- if 0 == mpi.MPI_Comm_rank(mpi.MPI_COMM_WORLD):
+ if 0 == mpi.MPI_Comm_rank(mesh.comm()):
self.cppHandle.read(mesh.cppHandle)
return mesh
Modified: short/3D/PyLith/trunk/pylith/topology/Mesh.py
===================================================================
--- short/3D/PyLith/trunk/pylith/topology/Mesh.py 2007-05-15 19:34:47 UTC (rev 6880)
+++ short/3D/PyLith/trunk/pylith/topology/Mesh.py 2007-05-15 21:24:25 UTC (rev 6881)
@@ -65,6 +65,18 @@
return dim
+ def comm(self):
+ """
+ Get MPI communicator associated with mesh.
+ """
+ #comm = None
+ #if not self.cppHandle is None:
+ # comm = self.cppHandle.comm
+ import mpi
+ comm = mpi.MPI_COMM_WORLD
+ return comm
+
+
# PUBLIC METHODS /////////////////////////////////////////////////////
def _configure(self):
More information about the cig-commits
mailing list