[cig-commits] r4539 - in short/3D/PyLith/trunk/pylith: . topology

baagaard at geodynamics.org baagaard at geodynamics.org
Thu Sep 14 17:10:38 PDT 2006


Author: baagaard
Date: 2006-09-14 17:10:37 -0700 (Thu, 14 Sep 2006)
New Revision: 4539

Added:
   short/3D/PyLith/trunk/pylith/topology/MeshImporter.py
Modified:
   short/3D/PyLith/trunk/pylith/PyLithApp.py
   short/3D/PyLith/trunk/pylith/topology/MeshGenerator.py
Log:
Created importer implementation of mesh generator.

Modified: short/3D/PyLith/trunk/pylith/PyLithApp.py
===================================================================
--- short/3D/PyLith/trunk/pylith/PyLithApp.py	2006-09-14 22:37:27 UTC (rev 4538)
+++ short/3D/PyLith/trunk/pylith/PyLithApp.py	2006-09-15 00:10:37 UTC (rev 4539)
@@ -41,8 +41,8 @@
                           validator=pyre.inventory.greaterEqual(0.0*second))
     totalTime.meta['tip'] = "Time duration for simulation."
 
-    from pylith.topology.MeshGenerator import MeshGenerator
-    mesher = pyre.inventory.facility("mesh_generator", factory=MeshGenerator)
+    from pylith.topology.MeshImporter import MeshImporter
+    mesher = pyre.inventory.facility("mesh_generator", factory=MeshImporter)
     mesher.meta['tip'] = "Generates or imports the computational mesh."
 
     from pylith.problems.QuasiStatic import QuasiStatic

Modified: short/3D/PyLith/trunk/pylith/topology/MeshGenerator.py
===================================================================
--- short/3D/PyLith/trunk/pylith/topology/MeshGenerator.py	2006-09-14 22:37:27 UTC (rev 4538)
+++ short/3D/PyLith/trunk/pylith/topology/MeshGenerator.py	2006-09-15 00:10:37 UTC (rev 4539)
@@ -22,10 +22,8 @@
   # PUBLIC METHODS /////////////////////////////////////////////////////
 
   def create(self):
-    #raise NotImplementedError, "MeshGenerator::create() not implemented."
-    from Mesh import Mesh
-    mesh = Mesh()
-    return mesh
+    raise NotImplementedError, "MeshGenerator::create() not implemented."
+    return
 
 
   def __init__(self, name="meshgenerator"):

Added: short/3D/PyLith/trunk/pylith/topology/MeshImporter.py
===================================================================
--- short/3D/PyLith/trunk/pylith/topology/MeshImporter.py	2006-09-14 22:37:27 UTC (rev 4538)
+++ short/3D/PyLith/trunk/pylith/topology/MeshImporter.py	2006-09-15 00:10:37 UTC (rev 4539)
@@ -0,0 +1,73 @@
+#!/usr/bin/env python
+#
+# ----------------------------------------------------------------------
+#
+#                           Brad T. Aagaard
+#                        U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+## @file pylith/topology/MeshImporter.py
+## @brief Python implementation of importing a mesh.
+
+from MeshGenerator import MeshGenerator
+
+# MeshImporter class
+class MeshImporter(Component):
+  """
+  Python implementation of importing a mesh.
+  """
+
+  # INVENTORY //////////////////////////////////////////////////////////
+
+  class Inventory(MeshGenerator.Inventory):
+    """Python object for managing MeshImporter facilities and properties."""
+
+    ## @class Inventory
+    ## Python object for managing MeshImporter facilities and properties.
+    ##
+    ## \b Properties
+    ## @li None
+    ##
+    ## \b Facilities
+    ## @li \b importer Mesh importer
+
+    import pyre.inventory
+
+    from pylith.meshio.MeshIOAscii import MeshIOAscii
+    importer = pyre.inventory.facility("importer", factory=MeshIOAscii)
+    importer.meta['tip'] = "Mesh importer."
+  
+
+  # PUBLIC METHODS /////////////////////////////////////////////////////
+
+  def create(self):
+    """
+    Create a mesh.
+    """
+    return self.importer.read()
+
+
+  def __init__(self, name="meshimporter"):
+    """Constructor."""
+    MeshGenerator.__init__(self, name)
+    return
+
+
+  # PRIVATE METHODS ////////////////////////////////////////////////////
+
+  def _configure(self):
+    """
+    Set members based on inventory.
+    """
+    self.importer = self.inventory.importer
+    return
+  
+
+# version
+__id__ = "$Id$"
+
+# End of file 



More information about the cig-commits mailing list