[cig-commits] r13939 - in short/3D/PyLith/branches/pylith-swig: . libsrc/meshio modulesrc/meshio pylith pylith/meshio pylith/topology unittests/pytests/meshio

brad at geodynamics.org brad at geodynamics.org
Fri Jan 23 17:14:16 PST 2009


Author: brad
Date: 2009-01-23 17:14:16 -0800 (Fri, 23 Jan 2009)
New Revision: 13939

Added:
   short/3D/PyLith/branches/pylith-swig/modulesrc/meshio/MeshIOAscii.i
   short/3D/PyLith/branches/pylith-swig/modulesrc/meshio/MeshIOObj.i
   short/3D/PyLith/branches/pylith-swig/modulesrc/meshio/meshio.i
   short/3D/PyLith/branches/pylith-swig/pylith/meshio/MeshIOObj.py
Removed:
   short/3D/PyLith/branches/pylith-swig/pylith/meshio/MeshIO.py
Modified:
   short/3D/PyLith/branches/pylith-swig/TODO
   short/3D/PyLith/branches/pylith-swig/libsrc/meshio/MeshIO.hh
   short/3D/PyLith/branches/pylith-swig/modulesrc/meshio/
   short/3D/PyLith/branches/pylith-swig/modulesrc/meshio/Makefile.am
   short/3D/PyLith/branches/pylith-swig/pylith/Makefile.am
   short/3D/PyLith/branches/pylith-swig/pylith/PyLithApp.py
   short/3D/PyLith/branches/pylith-swig/pylith/meshio/MeshIOAscii.py
   short/3D/PyLith/branches/pylith-swig/pylith/meshio/__init__.py
   short/3D/PyLith/branches/pylith-swig/pylith/topology/MeshGenerator.py
   short/3D/PyLith/branches/pylith-swig/pylith/topology/MeshImporter.py
   short/3D/PyLith/branches/pylith-swig/unittests/pytests/meshio/Makefile.am
   short/3D/PyLith/branches/pylith-swig/unittests/pytests/meshio/TestMeshIOAscii.py
   short/3D/PyLith/branches/pylith-swig/unittests/pytests/meshio/testdriver.py
Log:
Started work on updating meshIO Python code and converting module to SWIG.

Modified: short/3D/PyLith/branches/pylith-swig/TODO
===================================================================
--- short/3D/PyLith/branches/pylith-swig/TODO	2009-01-24 00:23:48 UTC (rev 13938)
+++ short/3D/PyLith/branches/pylith-swig/TODO	2009-01-24 01:14:16 UTC (rev 13939)
@@ -5,7 +5,9 @@
 0. SWIG conversion
   TestMesh.test_view()
   TestMesh.test_checkMaterialIds()
+  TestSolutionFields
 
+
 1. Reduce memory use (new labels) [Matt]
 
 2. Nondimensionalize [Brad]

Modified: short/3D/PyLith/branches/pylith-swig/libsrc/meshio/MeshIO.hh
===================================================================
--- short/3D/PyLith/branches/pylith-swig/libsrc/meshio/MeshIO.hh	2009-01-24 00:23:48 UTC (rev 13938)
+++ short/3D/PyLith/branches/pylith-swig/libsrc/meshio/MeshIO.hh	2009-01-24 01:14:16 UTC (rev 13939)
@@ -92,13 +92,13 @@
    *
    * @param mesh PyLith finite-element mesh.
    */
-  void read(topology::Mesh* mesh);
+  void read(pylith::topology::Mesh* mesh);
 
   /** Write mesh to file.
    *
    * @param mesh PyLith finite-element mesh.
    */
-  void write(topology::Mesh* const mesh);
+  void write(pylith::topology::Mesh* const mesh);
 
 // PROTECTED MEMBERS ////////////////////////////////////////////////////
 protected :


Property changes on: short/3D/PyLith/branches/pylith-swig/modulesrc/meshio
___________________________________________________________________
Name: svn:ignore
   + Makefile.in
meshio.py
meshio_wrap.cxx


Modified: short/3D/PyLith/branches/pylith-swig/modulesrc/meshio/Makefile.am
===================================================================
--- short/3D/PyLith/branches/pylith-swig/modulesrc/meshio/Makefile.am	2009-01-24 00:23:48 UTC (rev 13938)
+++ short/3D/PyLith/branches/pylith-swig/modulesrc/meshio/Makefile.am	2009-01-24 01:14:16 UTC (rev 13939)
@@ -13,42 +13,45 @@
 subpackage = meshio
 include $(top_srcdir)/subpackage.am
 
-subpkgpyexec_LTLIBRARIES = meshiomodule.la
+subpkgpyexec_LTLIBRARIES = _meshiomodule.la
 
-meshiomodule_la_LDFLAGS = -module -avoid-version \
+subpkgpyexec_PYTHON = meshio.py
+
+swig_sources = \
+	meshio.i \
+	MeshIOObj.i \
+	MeshIOAscii.i
+
+swig_generated = \
+	meshio_wrap.cxx \
+	meshio.py
+
+_meshiomodule_la_LDFLAGS = -module -avoid-version \
 	$(AM_LDFLAGS) $(PYTHON_LA_LDFLAGS)
 
-dist_meshiomodule_la_SOURCES = meshio.pyxe.src
-nodist_meshiomodule_la_SOURCES = \
-	meshio.pyxe \
-	meshio.c meshio_embed.cpp meshio_embed.h
+dist__meshiomodule_la_SOURCES = $(swig_sources) $(swig_generated)
 
-meshiomodule_la_LIBADD = \
+_meshiomodule_la_LIBADD = \
 	$(top_builddir)/libsrc/libpylith.la \
 	-lspatialdata \
-	$(PETSC_LIB)
-
+	$(PETSC_LIBS)
 if ENABLE_CUBIT
-  meshiomodule_la_LIBADD += -lnetcdf_c++ -lnetcdf
+  _meshiomodule_la_LIBADD += -lnetcdf_c++ -lnetcdf
 endif
 if NO_UNDEFINED
-  meshiomodule_la_LIBADD += $(PYTHON_BLDLIBRARY) $(PYTHON_LIBS) $(PYTHON_SYSLIBS)
+_meshiomodule_la_LIBADD += \
+	$(PYTHON_BLDLIBRARY) $(PYTHON_LIBS) $(PYTHON_SYSLIBS)
 endif
 
-INCLUDES += -I$(PYTHON_INCDIR) $(PETSC_INCLUDE)
+INCLUDES += $(PYTHON_EGG_CPPFLAGS) -I$(NUMPY_INCDIR) -I$(PYTHON_INCDIR) $(PETSC_INCLUDE)
 
-PYREX_INCLUDES = -I$(top_srcdir)/modulesrc/topology
+$(srcdir)/meshio_wrap.cxx $(srcdir)/meshio.py: $(swig_sources)
+	$(SWIG) -Wall -c++ -python $<
 
-meshio.pyx meshio_embed.cpp  meshio_embed.h: meshio.pyxe
-	pyrexembed meshio.pyxe
-meshio.pyxe: $(srcdir)/meshio.pyxe.src
-	cp $(srcdir)/meshio.pyxe.src $@
-meshio_embed.cpp: meshio_embed.h
-meshio_embed.h: meshio.pyx
 
-.pyx.c:
-	pyrexc $< $(PYREX_INCLUDES)
+MAINTAINERCLEANFILES = \
+	$(srcdir)/meshio_wrap.cxx \
+	$(srcdir)/meshio.py
 
-CLEANFILES = meshio.pyxe meshio.pyx meshio.c *_embed.*
 
 # End of file 

Added: short/3D/PyLith/branches/pylith-swig/modulesrc/meshio/MeshIOAscii.i
===================================================================
--- short/3D/PyLith/branches/pylith-swig/modulesrc/meshio/MeshIOAscii.i	                        (rev 0)
+++ short/3D/PyLith/branches/pylith-swig/modulesrc/meshio/MeshIOAscii.i	2009-01-24 01:14:16 UTC (rev 13939)
@@ -0,0 +1,61 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+/**
+ * @file modulesrc/meshio/MeshIOAscii.i
+ *
+ * @brief Python interface to C++ MeshIOAscii object.
+ */
+
+namespace pylith {
+  namespace meshio {
+
+    class MeshIOAscii : public MeshIO
+    { // MeshIOAscii
+
+      // PUBLIC METHODS /////////////////////////////////////////////////
+    public :
+
+      /// Constructor
+      MeshIOAscii(void);
+
+      /// Destructor
+      ~MeshIOAscii(void);
+
+      /** Set filename for ASCII file.
+       *
+       * @param filename Name of file
+       */
+      void filename(const char* name);
+      
+      /** Get filename of ASCII file.
+       *
+       * @returns Name of file
+       */
+      const char* filename(void) const;
+
+      // PROTECTED METHODS //////////////////////////////////////////////
+    protected :
+
+      /// Write mesh
+      void _write(void) const;
+      
+      /// Read mesh
+      void _read(void);
+
+    }; // MeshIOAscii
+
+  } // meshio
+} // pylith
+
+
+// End of file 

Added: short/3D/PyLith/branches/pylith-swig/modulesrc/meshio/MeshIOObj.i
===================================================================
--- short/3D/PyLith/branches/pylith-swig/modulesrc/meshio/MeshIOObj.i	                        (rev 0)
+++ short/3D/PyLith/branches/pylith-swig/modulesrc/meshio/MeshIOObj.i	2009-01-24 01:14:16 UTC (rev 13939)
@@ -0,0 +1,110 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+/**
+ * @file modulesrc/meshio/MeshIO.i
+ *
+ * @brief Python interface to C++ MeshIO object.
+ */
+
+namespace pylith {
+  namespace topology {
+    class Mesh;
+  } // topology
+
+  namespace meshio {
+
+    class MeshIO
+    { // MeshIO
+
+      // PUBLIC TYPEDEFS ////////////////////////////////////////////////
+    public :
+      
+      /// Type of points in a group.
+      enum GroupPtType {
+	VERTEX=0,
+	CELL=1,
+      }; // GroupPtType
+      
+      // PUBLIC MEMBERS /////////////////////////////////////////////////
+    public :
+      
+      /// Constructor
+      MeshIO(void);
+      
+      /// Destructor
+      virtual
+      ~MeshIO(void);
+      
+      /** Set debug flag for mesh.
+       *
+       * @param flag True to print debugging information.
+       */
+      void debug(const bool flag);
+      
+      /** Get debug flag for mesh.
+       *
+       * @returns True if debugging is on.
+       */
+      bool debug(void) const;
+      
+      /** Set flag associated with building intermediate mesh topology
+       *  elements.
+       *
+       * @param flag True to build intermediate topology, false not to build
+       */
+      void interpolate(const bool flag);
+      
+      /** Get flag associated with building intermediate mesh topology
+       * elements.
+       *
+       * @returns True if building intermediate topology, false if not building
+       */
+      bool interpolate(void) const;
+      
+      /** Set scales used to nondimensionalize mesh.
+       *
+       * @param dim Nondimensionalizer.
+       */
+      void normalizer(const spatialdata::units::Nondimensional& dim);
+      
+      /** Read mesh from file.
+       *
+       * @param mesh PyLith finite-element mesh.
+       */
+      void read(pylith::topology::Mesh* mesh);
+      
+      /** Write mesh to file.
+       *
+       * @param mesh PyLith finite-element mesh.
+       */
+      void write(pylith::topology::Mesh* const mesh);
+      
+      // PROTECTED MEMBERS //////////////////////////////////////////////
+    protected :
+
+      /// Write mesh
+      virtual
+      void _write(void) const = 0;
+      
+      /// Read mesh
+      virtual
+      void _read(void) = 0;
+      
+    }; // MeshIO
+
+  } // meshio
+} // pylith
+
+
+
+// End of file 

Added: short/3D/PyLith/branches/pylith-swig/modulesrc/meshio/meshio.i
===================================================================
--- short/3D/PyLith/branches/pylith-swig/modulesrc/meshio/meshio.i	                        (rev 0)
+++ short/3D/PyLith/branches/pylith-swig/modulesrc/meshio/meshio.i	2009-01-24 01:14:16 UTC (rev 13939)
@@ -0,0 +1,41 @@
+// -*- C++ -*-
+//
+// ======================================================================
+//
+//                           Brad T. Aagaard
+//                        U.S. Geological Survey
+//
+// {LicenseText}
+//
+// ======================================================================
+//
+
+// SWIG interface
+%module meshio
+
+// Header files for module C++ code
+%{
+#include "pylith/meshio/MeshIO.hh"
+#include "pylith/meshio/MeshIOAscii.hh"
+
+#include "pylith/utils/arrayfwd.hh"
+%}
+
+%include "exception.i"
+%exception {
+  try {
+    $action
+  } catch (const std::exception& err) {
+    SWIG_exception(SWIG_RuntimeError, err.what());
+  } // try/catch
+ } // exception
+
+%include "typemaps.i"
+
+// Interfaces
+%include "MeshIOObj.i"
+%include "MeshIOAscii.i"
+
+
+// End of file
+

Modified: short/3D/PyLith/branches/pylith-swig/pylith/Makefile.am
===================================================================
--- short/3D/PyLith/branches/pylith-swig/pylith/Makefile.am	2009-01-24 00:23:48 UTC (rev 13938)
+++ short/3D/PyLith/branches/pylith-swig/pylith/Makefile.am	2009-01-24 01:14:16 UTC (rev 13939)
@@ -79,7 +79,7 @@
 	meshio/CellFilterAvg.py \
 	meshio/DataWriter.py \
 	meshio/DataWriterVTK.py \
-	meshio/MeshIO.py \
+	meshio/MeshIOObj.py \
 	meshio/MeshIOAscii.py \
 	meshio/MeshIOCubit.py \
 	meshio/MeshIOLagrit.py \

Modified: short/3D/PyLith/branches/pylith-swig/pylith/PyLithApp.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/pylith/PyLithApp.py	2009-01-24 00:23:48 UTC (rev 13938)
+++ short/3D/PyLith/branches/pylith-swig/pylith/PyLithApp.py	2009-01-24 01:14:16 UTC (rev 13939)
@@ -88,7 +88,8 @@
     interfaces = None
     if "interfaces" in dir(self.problem):
       interfaces = self.problem.interfaces.components()
-    mesh = self.mesher.create(self.problem.normalizer, interfaces)
+    mesh = self.mesher.create(self.problem.dimension,
+                              self.problem.normalizer, interfaces)
     self._debug.log(resourceUsageString())
     self._logger.stagePop()
 

Deleted: short/3D/PyLith/branches/pylith-swig/pylith/meshio/MeshIO.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/pylith/meshio/MeshIO.py	2009-01-24 00:23:48 UTC (rev 13938)
+++ short/3D/PyLith/branches/pylith-swig/pylith/meshio/MeshIO.py	2009-01-24 01:14:16 UTC (rev 13939)
@@ -1,96 +0,0 @@
-#!/usr/bin/env python
-#
-# ----------------------------------------------------------------------
-#
-#                           Brad T. Aagaard
-#                        U.S. Geological Survey
-#
-# <LicenseText>
-#
-# ----------------------------------------------------------------------
-#
-
-## @file pyre/meshio/MeshIO.py
-##
-## @brief Python abstract base class for finite-element mesh I/O.
-##
-## Factory: mesh_io
-
-from pyre.components.Component import Component
-
-# MeshIO class
-class MeshIO(Component):
-  """
-  Python abstract base class for finite-element mesh I/O.
-  """
-
-  # PUBLIC METHODS /////////////////////////////////////////////////////
-
-  def __init__(self, name="meshio"):
-    """
-    Constructor.
-    """
-    Component.__init__(self, name, facility="mesh_io")
-    self.cppHandle = None
-    self.coordsys = None
-    return
-
-
-  def read(self, normalizer, debug, interpolate):
-    """
-    Read finite-element mesh and store in Sieve mesh object.
-
-    @returns PETSc mesh object containing finite-element mesh
-    """
-    self._info.log("Reading finite-element mesh")
-
-    # Set flags
-    self._sync()
-    self.cppHandle.normalizer = normalizer.cppHandle
-    self.cppHandle.debug = debug
-    self.cppHandle.interpolate = interpolate
-
-    # Initialize coordinate system
-    if self.coordsys is None:
-      raise ValueError, "Coordinate system for mesh is unknown."
-    self.coordsys.initialize()
-
-    from pylith.topology.Mesh import Mesh
-    mesh = Mesh()
-    mesh.initialize(self.coordsys)
-
-    # Read mesh
-    self.cppHandle.read(mesh.cppHandle)
-    return mesh
-
-
-  def write(self, mesh):
-    """
-    Write finite-element mesh.stored in Sieve mesh object.
-
-    @param mesh PETSc mesh object containing finite-element mesh
-    """
-    self._info.log("Writing finite-element mesh")
-    self._sync()
-    self.cppHandle.write(mesh.cppHandle)
-    return
-
-
-  # PRIVATE METHODS ////////////////////////////////////////////////////
-
-  def _configure(self):
-    """
-    Set members based using inventory.
-    """
-    Component._configure(self)
-    return
-
-
-  def _sync(self):
-    """
-    Force synchronization between Python and C++.
-    """
-    return
-
-
-# End of file 

Modified: short/3D/PyLith/branches/pylith-swig/pylith/meshio/MeshIOAscii.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/pylith/meshio/MeshIOAscii.py	2009-01-24 00:23:48 UTC (rev 13938)
+++ short/3D/PyLith/branches/pylith-swig/pylith/meshio/MeshIOAscii.py	2009-01-24 01:14:16 UTC (rev 13939)
@@ -17,10 +17,11 @@
 ##
 ## Factory: mesh_io
 
-from MeshIO import MeshIO
+from MeshIOObj import MeshIOObj
+from meshio import MeshIOAscii as ModuleMeshIOAscii
 
 # MeshIOAscii class
-class MeshIOAscii(MeshIO):
+class MeshIOAscii(MeshIOObj, ModuleMeshIOAscii):
   """
   Python object for reading/writing finite-element mesh from simple
   ASCII file.
@@ -30,7 +31,7 @@
 
   # INVENTORY //////////////////////////////////////////////////////////
 
-  class Inventory(MeshIO.Inventory):
+  class Inventory(MeshIOObj.Inventory):
     """
     Python object for managing MeshIOAscii facilities and properties.
     """
@@ -61,7 +62,7 @@
     """
     Constructor.
     """
-    MeshIO.__init__(self, name)
+    MeshIOObj.__init__(self, name)
     return
 
 
@@ -71,22 +72,17 @@
     """
     Set members based using inventory.
     """
-    MeshIO._configure(self)
-    self.filename = self.inventory.filename
+    MeshIOObj._configure(self)
     self.coordsys = self.inventory.coordsys
+    self.filename(self.inventory.filename)
     return
 
 
-  def _sync(self):
+  def _createModuleObj(self):
     """
-    Force synchronization between Python and C++.
+    Create C++ MeshIOAscii object.
     """
-    if None == self.cppHandle:
-      import pylith.meshio.meshio as bindings
-      self.cppHandle = bindings.MeshIOAscii()
-    
-    MeshIO._sync(self)
-    self.cppHandle.filename = self.filename
+    ModuleMeshIOAscii.__init__(self)
     return
   
 

Copied: short/3D/PyLith/branches/pylith-swig/pylith/meshio/MeshIOObj.py (from rev 13933, short/3D/PyLith/branches/pylith-swig/pylith/meshio/MeshIO.py)
===================================================================
--- short/3D/PyLith/branches/pylith-swig/pylith/meshio/MeshIOObj.py	                        (rev 0)
+++ short/3D/PyLith/branches/pylith-swig/pylith/meshio/MeshIOObj.py	2009-01-24 01:14:16 UTC (rev 13939)
@@ -0,0 +1,97 @@
+#!/usr/bin/env python
+#
+# ----------------------------------------------------------------------
+#
+#                           Brad T. Aagaard
+#                        U.S. Geological Survey
+#
+# <LicenseText>
+#
+# ----------------------------------------------------------------------
+#
+
+## @file pyre/meshio/MeshIOObj.py
+##
+## @brief Python abstract base class for finite-element mesh I/O.
+##
+## Factory: mesh_io
+
+from pyre.components.Component import Component
+from meshio import MeshIO as ModuleMeshIO
+
+# MeshIOObj class
+class MeshIOObj(Component, ModuleMeshIO):
+  """
+  Python abstract base class for finite-element mesh I/O.
+  """
+
+  # PUBLIC METHODS /////////////////////////////////////////////////////
+
+  def __init__(self, name="meshio"):
+    """
+    Constructor.
+    """
+    Component.__init__(self, name, facility="mesh_io")
+    self.coordsys = None
+    self._createModuleObj()
+    return
+
+
+  def read(self, dim, normalizer, debug, interpolate):
+    """
+    Read finite-element mesh and store in Sieve mesh object.
+
+    @returns PETSc mesh object containing finite-element mesh
+    """
+    self._info.log("Reading finite-element mesh")
+
+    # Set flags
+    self.normalizer(normalizer)
+    self.debug(debug)
+    self.interpolate(interpolate)
+
+    # Initialize coordinate system
+    if self.coordsys is None:
+      raise ValueError, "Coordinate system for mesh is unknown."
+
+    from pylith.mpi.Communicator import petsc_comm_world
+    from pylith.topology.Mesh import Mesh    
+    mesh = Mesh(petsc_comm_world(), dim)
+    mesh.coordsys(self.coordsys)
+    mesh.initialize()
+
+    # Read mesh
+    ModuleMeshIO.read(self, mesh)
+    return mesh
+
+
+  def write(self, mesh):
+    """
+    Write finite-element mesh.stored in Sieve mesh object.
+
+    @param mesh PETSc mesh object containing finite-element mesh
+    """
+    self._info.log("Writing finite-element mesh")
+    ModuleMeshIO.write(self, mesh)
+    return
+
+
+  # PRIVATE METHODS ////////////////////////////////////////////////////
+
+  def _configure(self):
+    """
+    Set members based using inventory.
+    """
+    Component._configure(self)
+    return
+
+
+  def _createModuleObj(self):
+    """
+    Create C++ MeshIO object.
+    """
+    raise NotImplementedError("MeshIO is an abstract base class.")
+    return
+
+
+# End of file 

Modified: short/3D/PyLith/branches/pylith-swig/pylith/meshio/__init__.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/pylith/meshio/__init__.py	2009-01-24 00:23:48 UTC (rev 13938)
+++ short/3D/PyLith/branches/pylith-swig/pylith/meshio/__init__.py	2009-01-24 01:14:16 UTC (rev 13939)
@@ -18,7 +18,7 @@
            'CellFilterAvg',
            'DataWriter',
            'DataWriterVTK',
-           'MeshIO',
+           'MeshIOObj',
            'MeshIOAscii',
            'MeshIOCubit',
            'MeshIOLagrit',

Modified: short/3D/PyLith/branches/pylith-swig/pylith/topology/MeshGenerator.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/pylith/topology/MeshGenerator.py	2009-01-24 00:23:48 UTC (rev 13938)
+++ short/3D/PyLith/branches/pylith-swig/pylith/topology/MeshGenerator.py	2009-01-24 01:14:16 UTC (rev 13939)
@@ -64,7 +64,7 @@
     return
 
 
-  def create(self, normalizer, faults=None):
+  def create(self, dim, normalizer, faults=None):
     """
     Generate a Mesh.
     """

Modified: short/3D/PyLith/branches/pylith-swig/pylith/topology/MeshImporter.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/pylith/topology/MeshImporter.py	2009-01-24 00:23:48 UTC (rev 13938)
+++ short/3D/PyLith/branches/pylith-swig/pylith/topology/MeshImporter.py	2009-01-24 01:14:16 UTC (rev 13939)
@@ -40,16 +40,16 @@
     ## @li None
     ##
     ## \b Facilities
-    ## @li \b importer Mesh importer.
+    ## @li \b reader Mesh reader.
     ## @li \b partitioner Mesh partitioner.
     ## @li \b refiner Mesh refiner.
 
     import pyre.inventory
 
     from pylith.meshio.MeshIOAscii import MeshIOAscii
-    importer = pyre.inventory.facility("importer", family="mesh_io",
+    reader = pyre.inventory.facility("reader", family="mesh_io",
                                        factory=MeshIOAscii)
-    importer.meta['tip'] = "Mesh importer."
+    reader.meta['tip'] = "Mesh reader."
 
     from Distributor import Distributor
     distributor = pyre.inventory.facility("distributor",
@@ -75,7 +75,7 @@
     return
 
 
-  def create(self, normalizer, faults=None):
+  def create(self, dim, normalizer, faults=None):
     """
     Hook for creating mesh.
     """
@@ -85,8 +85,7 @@
     logEvent = "%screate" % self._loggingPrefix
     self._logger.eventBegin(logEvent)    
 
-    normalizer.initialize()    
-    mesh = self.importer.read(normalizer, self.debug, self.interpolate)
+    mesh = self.reader.read(dim, normalizer, self.debug, self.interpolate)
     if self.debug:
       mesh.view()
     self._debug.log(resourceUsageString())
@@ -116,7 +115,7 @@
     Set members based on inventory.
     """
     MeshGenerator._configure(self)
-    self.importer = self.inventory.importer
+    self.reader = self.inventory.reader
     self.distributor = self.inventory.distributor
     self.refiner = self.inventory.refiner
     return

Modified: short/3D/PyLith/branches/pylith-swig/unittests/pytests/meshio/Makefile.am
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/pytests/meshio/Makefile.am	2009-01-24 00:23:48 UTC (rev 13938)
+++ short/3D/PyLith/branches/pylith-swig/unittests/pytests/meshio/Makefile.am	2009-01-24 01:14:16 UTC (rev 13939)
@@ -30,8 +30,8 @@
 	TestOutputSolnSubset.py
 
 if ENABLE_CUBIT
-  TESTS += testdriver_cubit.py
-  dist_check_SCRIPTS += testdriver_cubit.py
+#  TESTS += testdriver_cubit.py
+#  dist_check_SCRIPTS += testdriver_cubit.py
 endif	
 
 noinst_tmp = \

Modified: short/3D/PyLith/branches/pylith-swig/unittests/pytests/meshio/TestMeshIOAscii.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/pytests/meshio/TestMeshIOAscii.py	2009-01-24 00:23:48 UTC (rev 13938)
+++ short/3D/PyLith/branches/pylith-swig/unittests/pytests/meshio/TestMeshIOAscii.py	2009-01-24 01:14:16 UTC (rev 13939)
@@ -28,10 +28,7 @@
     """
     Test constructor.
     """
-    iohandler = MeshIOAscii()
-    iohandler._configure()
-    iohandler._sync()
-    self.assertNotEqual(None, iohandler.cppHandle)
+    io = MeshIOAscii()
     return
 
 
@@ -39,10 +36,11 @@
     """
     Test filename().
     """
-    iohandler = MeshIOAscii()
     value = "hi.txt"
-    iohandler.filename = value
-    self.assertEqual(value, iohandler.filename)
+
+    io = MeshIOAscii()
+    io.filename(value)
+    self.assertEqual(value, io.filename())
     return
 
 
@@ -50,25 +48,29 @@
     """
     Test write() and read().
     """
-    iohandler = MeshIOAscii()
     filenameIn = "data/mesh2Din3D.txt"
     filenameOut = "data/mesh2Din3D_test.txt"
+    dim = 2
+
+    from spatialdata.geocoords.CSCart import CSCart
+    cs = CSCart()
+    cs._configure()
+
+    io = MeshIOAscii()
+    io.inventory.filename = filenameIn
+    io.inventory.coordsys = cs
+    io._configure()
     
     from spatialdata.units.Nondimensional import Nondimensional
     normalizer = Nondimensional()
-    normalizer.initialize()
 
-    from spatialdata.geocoords.CSCart import CSCart
-    iohandler.filename = filenameIn
-    iohandler.coordsys = CSCart()
-    mesh = iohandler.read(normalizer, debug=False, interpolate=False)
+    mesh = io.read(dim, normalizer, debug=False, interpolate=False)
 
     self.assertEqual(2, mesh.dimension())
 
-    iohandler.filename = filenameOut
-    iohandler.write(mesh)
+    io.filename(filenameOut)
+    io.write(mesh)
 
-
     fileE = open(filenameIn, "r")
     linesE = fileE.readlines()
     fileE.close()

Modified: short/3D/PyLith/branches/pylith-swig/unittests/pytests/meshio/testdriver.py
===================================================================
--- short/3D/PyLith/branches/pylith-swig/unittests/pytests/meshio/testdriver.py	2009-01-24 00:23:48 UTC (rev 13938)
+++ short/3D/PyLith/branches/pylith-swig/unittests/pytests/meshio/testdriver.py	2009-01-24 01:14:16 UTC (rev 13939)
@@ -40,7 +40,9 @@
     from pylith.utils.PetscManager import PetscManager
     manager = PetscManager()
     manager.initialize()
+
     unittest.TextTestRunner(verbosity=2).run(self._suite())
+
     manager.finalize()
     return
 
@@ -57,20 +59,20 @@
     from TestMeshIOAscii import TestMeshIOAscii
     suite.addTest(unittest.makeSuite(TestMeshIOAscii))
 
-    from TestMeshIOLagrit import TestMeshIOLagrit
-    suite.addTest(unittest.makeSuite(TestMeshIOLagrit))
+    #from TestMeshIOLagrit import TestMeshIOLagrit
+    #suite.addTest(unittest.makeSuite(TestMeshIOLagrit))
 
-    from TestVertexFilterVecNorm import TestVertexFilterVecNorm
-    suite.addTest(unittest.makeSuite(TestVertexFilterVecNorm))
+    #from TestVertexFilterVecNorm import TestVertexFilterVecNorm
+    #suite.addTest(unittest.makeSuite(TestVertexFilterVecNorm))
 
-    from TestCellFilterAvg import TestCellFilterAvg
-    suite.addTest(unittest.makeSuite(TestCellFilterAvg))
+    #from TestCellFilterAvg import TestCellFilterAvg
+    #suite.addTest(unittest.makeSuite(TestCellFilterAvg))
 
-    from TestOutputManager import TestOutputManager
-    suite.addTest(unittest.makeSuite(TestOutputManager))
+    #from TestOutputManager import TestOutputManager
+    #suite.addTest(unittest.makeSuite(TestOutputManager))
 
-    from TestOutputSolnSubset import TestOutputSolnSubset
-    suite.addTest(unittest.makeSuite(TestOutputSolnSubset))
+    #from TestOutputSolnSubset import TestOutputSolnSubset
+    #suite.addTest(unittest.makeSuite(TestOutputSolnSubset))
 
     return suite
 



More information about the CIG-COMMITS mailing list