[cig-commits] r6865 - in short/3D/PyLith/trunk/pylith: . topology
brad at geodynamics.org
brad at geodynamics.org
Sat May 12 11:09:09 PDT 2007
Author: brad
Date: 2007-05-12 11:09:09 -0700 (Sat, 12 May 2007)
New Revision: 6865
Added:
short/3D/PyLith/trunk/pylith/topology/Distributor.py
Removed:
short/3D/PyLith/trunk/pylith/topology/Partitioner.py
Modified:
short/3D/PyLith/trunk/pylith/Makefile.am
short/3D/PyLith/trunk/pylith/topology/MeshGenSimple.py
short/3D/PyLith/trunk/pylith/topology/MeshImporter.py
Log:
Changed name of Partitioner to Distributor. Fixed bugs in MeshGenSimple. Modules return module objects, need to enclose within normal Python objects.
Modified: short/3D/PyLith/trunk/pylith/Makefile.am
===================================================================
--- short/3D/PyLith/trunk/pylith/Makefile.am 2007-05-12 05:00:42 UTC (rev 6864)
+++ short/3D/PyLith/trunk/pylith/Makefile.am 2007-05-12 18:09:09 UTC (rev 6865)
@@ -70,8 +70,8 @@
solver/Solver.py \
solver/SolverLinear.py \
topology/__init__.py \
+ topology/Distributor.py \
topology/Mesh.py \
- topology/Partitioner.py \
topology/MeshGenerator.py \
topology/MeshGenSimple.py \
topology/MeshImporter.py \
Copied: short/3D/PyLith/trunk/pylith/topology/Distributor.py (from rev 6864, short/3D/PyLith/trunk/pylith/topology/Partitioner.py)
===================================================================
--- short/3D/PyLith/trunk/pylith/topology/Partitioner.py 2007-05-12 05:00:42 UTC (rev 6864)
+++ short/3D/PyLith/trunk/pylith/topology/Distributor.py 2007-05-12 18:09:09 UTC (rev 6865)
@@ -0,0 +1,97 @@
+#!/usr/bin/env python
+#
+# ----------------------------------------------------------------------
+#
+# Brad T. Aagaard
+# U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+## @file pylith/topology/Distributor.py
+##
+## @brief Python manager for distributing mesh among processors.
+##
+## Factory: mesh_distributor.
+
+from pyre.components.Component import Component
+
+# Distributor class
+class Distributor(Component):
+ """
+ Python manager for distributing mesh among processors.
+
+ Factory: mesh_distributor
+ """
+
+ # INVENTORY //////////////////////////////////////////////////////////
+
+ class Inventory(Component.Inventory):
+ """
+ Python object for managing Distributor facilities and properties.
+ """
+
+ ## @class Inventory
+ ## Python object for managing Distributor facilities and properties.
+ ##
+ ## \b Properties
+ ## @li \b partitioner Name of mesh partitioner {"parmetis", "chaco"}
+ ##
+ ## \b Facilities
+ ## @li None
+
+ import pyre.inventory
+
+ partitioner = pyre.inventory.str("partitioner", default="chaco",
+ validator=pyre.inventory.choice(["chaco",
+ "parmetis"]))
+ partitioner.meta['tip'] = "Name of mesh partitioner."
+
+
+ # PUBLIC METHODS /////////////////////////////////////////////////////
+
+ def __init__(self, name="partitioner"):
+ """
+ Constructor.
+ """
+ Component.__init__(self, name, facility="partitioner")
+ import pylith.topology.topology as bindings
+ self.cppHandle = bindings.Distributor()
+ return
+
+
+ def distribute(self, mesh):
+ """
+ Distribute a Mesh
+ """
+ from Mesh import Mesh
+ newMesh = Mesh()
+ newMesh.cppHandle = self.cppHandle.distribute(mesh.cppHandle,
+ self.partitioner)
+ newMesh.coordsys = mesh.coordsys
+ return newMesh
+
+
+ # PRIVATE METHODS ////////////////////////////////////////////////////
+
+ def _configure(self):
+ """
+ Set members based using inventory.
+ """
+ Component._configure(self)
+ self.partitioner = self.inventory.partitioner
+ return
+
+
+# FACTORIES ////////////////////////////////////////////////////////////
+
+def mesh_partitioner():
+ """
+ Factory associated with Distributor.
+ """
+ return Distributor()
+
+
+# End of file
Modified: short/3D/PyLith/trunk/pylith/topology/MeshGenSimple.py
===================================================================
--- short/3D/PyLith/trunk/pylith/topology/MeshGenSimple.py 2007-05-12 05:00:42 UTC (rev 6864)
+++ short/3D/PyLith/trunk/pylith/topology/MeshGenSimple.py 2007-05-12 18:09:09 UTC (rev 6865)
@@ -17,6 +17,7 @@
## Factory: mesh_generator.
from MeshGenerator import MeshGenerator
+from Mesh import Mesh
# MeshGenSimple class
class MeshGenSimple(MeshGenerator):
@@ -42,7 +43,9 @@
"""
Generate a Mesh from a boundary
"""
- return self.cppHandle.generate(self.boundary)
+ mesh = Mesh()
+ mesh.cppHandle = self.cppHandle.generate(self.boundary)
+ return mesh
def setBoundary(self, boundary):
@@ -57,7 +60,9 @@
"""
Returns a Mesh that is the boundary of the unit cube
"""
- return self.cppHandle.createCubeBoundary(self.debug)
+ mesh = Mesh()
+ mesh.cppHandle = self.cppHandle.createCubeBoundary(self.debug)
+ return mesh
# PRIVATE METHODS ////////////////////////////////////////////////////
Modified: short/3D/PyLith/trunk/pylith/topology/MeshImporter.py
===================================================================
--- short/3D/PyLith/trunk/pylith/topology/MeshImporter.py 2007-05-12 05:00:42 UTC (rev 6864)
+++ short/3D/PyLith/trunk/pylith/topology/MeshImporter.py 2007-05-12 18:09:09 UTC (rev 6865)
@@ -50,11 +50,11 @@
factory=MeshIOAscii)
importer.meta['tip'] = "Mesh importer."
- from Partitioner import Partitioner
- partitioner = pyre.inventory.facility("partitioner",
- family="mesh_partitioner",
- factory=Partitioner)
- partitioner.meta['tip'] = "Mesh partitioner."
+ from Distributor import Distributor
+ distributor = pyre.inventory.facility("distributor",
+ family="mesh_distributor",
+ factory=Distributor)
+ distributor.meta['tip'] = "Mesh distributor."
# PUBLIC METHODS /////////////////////////////////////////////////////
@@ -73,7 +73,7 @@
"""
mesh = self.importer.read(self.debug, self.interpolate)
self._adjustTopology(mesh, faults)
- mesh = self.partitioner.distribute(mesh)
+ mesh = self.distributor.distribute(mesh)
return mesh
@@ -85,7 +85,7 @@
"""
MeshGenerator._configure(self)
self.importer = self.inventory.importer
- self.partitioner = self.inventory.partitioner
+ self.distributor = self.inventory.distributor
return
Deleted: short/3D/PyLith/trunk/pylith/topology/Partitioner.py
===================================================================
--- short/3D/PyLith/trunk/pylith/topology/Partitioner.py 2007-05-12 05:00:42 UTC (rev 6864)
+++ short/3D/PyLith/trunk/pylith/topology/Partitioner.py 2007-05-12 18:09:09 UTC (rev 6865)
@@ -1,92 +0,0 @@
-#!/usr/bin/env python
-#
-# ----------------------------------------------------------------------
-#
-# Brad T. Aagaard
-# U.S. Geological Survey
-#
-# <LicenseText>
-#
-# ----------------------------------------------------------------------
-#
-
-## @file pylith/topology/Partitioner.py
-##
-## @brief Python manager for mesh partitioner.
-##
-## Factory: mesh_partitioner.
-
-from pyre.components.Component import Component
-
-# Partitioner class
-class Partitioner(Component):
- """
- Python manager for mesh partitioner.
-
- Factory: mesh_partitioner
- """
-
- # INVENTORY //////////////////////////////////////////////////////////
-
- class Inventory(Component.Inventory):
- """
- Python object for managing Partitioner facilities and properties.
- """
-
- ## @class Inventory
- ## Python object for managing Partitioner facilities and properties.
- ##
- ## \b Properties
- ## @li \b partitioner Name of mesh partitioner {"parmetis", "chaco"}
- ##
- ## \b Facilities
- ## @li None
-
- import pyre.inventory
-
- partitioner = pyre.inventory.str("partitioner", default="chaco",
- validator=pyre.inventory.choice(["chaco",
- "parmetis"]))
- partitioner.meta['tip'] = "Name of mesh partitioner."
-
-
- # PUBLIC METHODS /////////////////////////////////////////////////////
-
- def __init__(self, name="partitioner"):
- """
- Constructor.
- """
- Component.__init__(self, name, facility="partitioner")
- import pylith.topology.topology as bindings
- self.cppHandle = bindings.Partitioner()
- return
-
-
- def distribute(self, mesh):
- """
- Distribute a Mesh
- """
- return self.cppHandle.distribute(mesh, self.partitioner)
-
-
- # PRIVATE METHODS ////////////////////////////////////////////////////
-
- def _configure(self):
- """
- Set members based using inventory.
- """
- Component._configure(self)
- self.partitioner = self.inventory.partitioner
- return
-
-
-# FACTORIES ////////////////////////////////////////////////////////////
-
-def mesh_partitioner():
- """
- Factory associated with Partitioner.
- """
- return Partitioner()
-
-
-# End of file
More information about the cig-commits
mailing list