[cig-commits] r6628 - in short/3D/PyLith/trunk: modulesrc/topology
pylith/topology unittests/libtests/faults
knepley at geodynamics.org
knepley at geodynamics.org
Sat Apr 21 20:25:17 PDT 2007
Author: knepley
Date: 2007-04-21 20:25:16 -0700 (Sat, 21 Apr 2007)
New Revision: 6628
Modified:
short/3D/PyLith/trunk/modulesrc/topology/topology.pyxe.src
short/3D/PyLith/trunk/pylith/topology/Mesh.py
short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesive.cc
Log:
Added a preliminary mesh distribution
Modified: short/3D/PyLith/trunk/modulesrc/topology/topology.pyxe.src
===================================================================
--- short/3D/PyLith/trunk/modulesrc/topology/topology.pyxe.src 2007-04-20 22:27:28 UTC (rev 6627)
+++ short/3D/PyLith/trunk/modulesrc/topology/topology.pyxe.src 2007-04-22 03:25:16 UTC (rev 6628)
@@ -12,6 +12,7 @@
#header{
#include <Mesh.hh>
+#include <Distribution.hh>
#include <petscmesh.h>
#include "pylith/utils/petscfwd.h"
@@ -199,6 +200,40 @@
fieldVptr = PyCObject_AsVoidPtr(field)
ptr = Mesh_createMatrix(self.thisptr, fieldVptr)
return PyCObject_FromVoidPtr(ptr, PetscMat_destructor)
+
+ def distribute(self, height = 0, partitioner = None):
+ """
+ Distribute the mesh across processes.
+ """
+ # create shim for MeshDistribute
+ #embed{ void* Mesh_distribute(void* objVptr, int height, char *partitioner)
+ void* result = 0;
+ try {
+ ALE::Obj<ALE::Mesh>* mesh = (ALE::Obj<ALE::Mesh>*) objVptr;
+ ALE::Obj<ALE::Mesh>* newMesh = new ALE::Obj<ALE::Mesh>;
+ assert(0 != mesh);
+ assert(0 != newMesh);
+ assert(!mesh->isNull());
+ assert(height >= 0);
+
+ if (partitioner == NULL) {
+ (*newMesh) = ALE::Distribution<ALE::Mesh>::distributeMesh(*mesh);
+ } else {
+ (*newMesh) = ALE::Distribution<ALE::Mesh>::distributeMesh(*mesh, 0, partitioner);
+ }
+ result = (void*) newMesh;
+ } catch (const std::exception& err) {
+ PyErr_SetString(PyExc_RuntimeError,
+ const_cast<char*>(err.what()));
+ } catch (...) {
+ PyErr_SetString(PyExc_RuntimeError,
+ "Caught unknown C++ exception.");
+ } // try/catch
+ return result;
+ #}embed
+ cdef void* ptr
+ ptr = Mesh_distribute(self.thisptr, height, partitioner)
+ return PyCObject_FromVoidPtr(ptr, MeshPtr_destructor)
def _createHandle(self):
Modified: short/3D/PyLith/trunk/pylith/topology/Mesh.py
===================================================================
--- short/3D/PyLith/trunk/pylith/topology/Mesh.py 2007-04-20 22:27:28 UTC (rev 6627)
+++ short/3D/PyLith/trunk/pylith/topology/Mesh.py 2007-04-22 03:25:16 UTC (rev 6628)
@@ -68,7 +68,8 @@
"""
Distribute mesh across processors.
"""
- self._info.log("WARNING: Mesh::distribute() not implemented.")
+ self._info.log("WARNING: Mesh::distribute() not tested.")
+ self.cppHandle.distribute()
return self
Modified: short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesive.cc
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesive.cc 2007-04-20 22:27:28 UTC (rev 6627)
+++ short/3D/PyLith/trunk/unittests/libtests/faults/TestFaultCohesive.cc 2007-04-22 03:25:16 UTC (rev 6628)
@@ -184,7 +184,6 @@
for (int i=0; i < numPoints; ++i)
CPPUNIT_ASSERT_EQUAL(data.groups[index++], points[i]);
} // for
-
} // _testAdjustTopology
// End of file
More information about the cig-commits
mailing list