[cig-commits] r5197 - in short/3D/PyLith/trunk: libsrc/meshio modulesrc/meshio pylith/meshio

brad at geodynamics.org brad at geodynamics.org
Tue Nov 7 17:07:13 PST 2006


Author: brad
Date: 2006-11-07 17:07:13 -0800 (Tue, 07 Nov 2006)
New Revision: 5197

Modified:
   short/3D/PyLith/trunk/libsrc/meshio/MeshIO.cc
   short/3D/PyLith/trunk/libsrc/meshio/MeshIO.hh
   short/3D/PyLith/trunk/libsrc/meshio/MeshIO.icc
   short/3D/PyLith/trunk/modulesrc/meshio/meshio.pyxe
   short/3D/PyLith/trunk/pylith/meshio/MeshIO.py
Log:
Added interpolate member to MeshIO.

Modified: short/3D/PyLith/trunk/libsrc/meshio/MeshIO.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/meshio/MeshIO.cc	2006-11-08 00:39:28 UTC (rev 5196)
+++ short/3D/PyLith/trunk/libsrc/meshio/MeshIO.cc	2006-11-08 01:07:13 UTC (rev 5197)
@@ -20,6 +20,7 @@
 // Constructor
 pylith::meshio::MeshIO::MeshIO(void) :
   _useIndexZero(true),
+  _interpolate(false),
   _mesh(0)
 { // constructor
 } // constructor
@@ -73,12 +74,11 @@
   ALE::Obj<sieve_type> sieve = new sieve_type(mesh->comm());
   ALE::Obj<topology_type> topology = new topology_type(mesh->comm());
 
-  const bool interpolate = false;
   ALE::New::SieveBuilder<sieve_type>::buildTopology(sieve, meshDim, 
 						    numCells, 
 						    const_cast<int*>(cells), 
 						    numVertices, 
-						    interpolate, numCorners);
+						    _interpolate, numCorners);
   sieve->stratify();
   topology->setPatch(0, sieve);
   topology->stratify();

Modified: short/3D/PyLith/trunk/libsrc/meshio/MeshIO.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/meshio/MeshIO.hh	2006-11-08 00:39:28 UTC (rev 5196)
+++ short/3D/PyLith/trunk/libsrc/meshio/MeshIO.hh	2006-11-08 01:07:13 UTC (rev 5197)
@@ -38,6 +38,20 @@
   /// Destructor
   virtual ~MeshIO(void);
 
+  /** 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;
+
   /** Read mesh from file.
    *
    * @param mesh Pointer to PETSc mesh object
@@ -121,6 +135,7 @@
 private :
 
   bool _useIndexZero; ///< Flag indicating if indicates start at 0 (T) or 1 (F)
+  bool _interpolate; ///< True if building intermediate topology elements
 
   ALE::Obj<Mesh>* _mesh; ///< Pointer to PETSc mesh object
 

Modified: short/3D/PyLith/trunk/libsrc/meshio/MeshIO.icc
===================================================================
--- short/3D/PyLith/trunk/libsrc/meshio/MeshIO.icc	2006-11-08 00:39:28 UTC (rev 5196)
+++ short/3D/PyLith/trunk/libsrc/meshio/MeshIO.icc	2006-11-08 01:07:13 UTC (rev 5197)
@@ -28,6 +28,20 @@
   _useIndexZero = flag;
 }
 
+// Set flag associated with building intermediate mesh topology
+inline
+void
+pylith::meshio::MeshIO::interpolate(const bool flag) {
+  _interpolate = flag;
+}
+
+// Get flag associated with building intermediate mesh topology
+inline
+bool
+pylith::meshio::MeshIO::interpolate(void) const {
+  return _interpolate;
+}
+
 #endif
 
 // End of file

Modified: short/3D/PyLith/trunk/modulesrc/meshio/meshio.pyxe
===================================================================
--- short/3D/PyLith/trunk/modulesrc/meshio/meshio.pyxe	2006-11-08 00:39:28 UTC (rev 5196)
+++ short/3D/PyLith/trunk/modulesrc/meshio/meshio.pyxe	2006-11-08 01:07:13 UTC (rev 5197)
@@ -96,6 +96,24 @@
     return PyCObject_FromVoidPtr(self.thisptr, MeshIO_destructor)
 
 
+  property interpolate:
+    def __set__(self, flag):
+      """Set interpolate."""
+      # create shim for method 'interpolate'
+      #embed{ void MeshIO_interpolate_set(void* pObj, int flag)
+      ((pylith::meshio::MeshIO*) pObj)->interpolate(flag);
+      #}embed
+      MeshIO_interpolate_set(self.thisptr, flag)
+
+    def __get__(self):
+      """Get interpolate."""
+      # create shim for method 'interpolate'
+      #embed{ int MeshIO_interpolate_get(void* pObj)
+      return ((pylith::meshio::MeshIO*) pObj)->interpolate();
+      #}embed
+      return MeshIO_interpolate_get(self.thisptr)
+
+
 # ----------------------------------------------------------------------
 cdef class MeshIOAscii(MeshIO):
 

Modified: short/3D/PyLith/trunk/pylith/meshio/MeshIO.py
===================================================================
--- short/3D/PyLith/trunk/pylith/meshio/MeshIO.py	2006-11-08 00:39:28 UTC (rev 5196)
+++ short/3D/PyLith/trunk/pylith/meshio/MeshIO.py	2006-11-08 01:07:13 UTC (rev 5197)
@@ -31,7 +31,7 @@
     ## Python object for managing MeshIO facilities and properties.
     ##
     ## \b Properties
-    ## @li \b interpolate Build intermediate mesh topology elements
+    ## @li \b interpolate Build intermediate mesh topology elements (if true)
     ##
     ## \b Facilities
     ## @li None
@@ -52,6 +52,7 @@
     """
     Component.__init__(self, name, facility="meshio")
     self.cppHandle = None
+    self.interpolate = False
     return
 
 
@@ -59,11 +60,12 @@
     """
     Read finite-element mesh and store in Sieve mesh object.
 
-    @returns Sieve mesh object containing finite-element mesh
+    @returns PETSc mesh object containing finite-element mesh
     """
     from pylith.topology.Mesh import Mesh
     mesh = Mesh()
-    mesh.handle = self.cppHandle.read(self.interpolate)
+    self.cppHandle.interpolate = interpolate
+    mesh.cppHandle = self.cppHandle.read(self.interpolate)
     return 
 
 
@@ -71,8 +73,9 @@
     """
     Write finite-element mesh.stored in Sieve mesh object.
 
-    @param mesh Sieve mesh object containing finite-element mesh
+    @param mesh PETSc mesh object containing finite-element mesh
     """
+    self.cppHandle.interpolate = interpolate
     self.cppHandle.write(mesh.handle)
     return
 
@@ -80,12 +83,12 @@
   # PRIVATE METHODS ////////////////////////////////////////////////////
 
   def _configure(self):
-    """Set members based using inventory."""
+    """
+    Set members based using inventory.
+    """
     Component._configure(self)
     self.interpolate = self.inventory.interpolate
     return
 
-# version
-__id__ = "$Id$"
 
 # End of file 



More information about the cig-commits mailing list