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

brad at geodynamics.org brad at geodynamics.org
Thu Aug 29 17:18:50 PDT 2013


Author: brad
Date: 2013-08-29 17:18:50 -0700 (Thu, 29 Aug 2013)
New Revision: 22743

Modified:
   short/3D/PyLith/trunk/libsrc/pylith/topology/Mesh.cc
   short/3D/PyLith/trunk/libsrc/pylith/topology/Mesh.hh
   short/3D/PyLith/trunk/libsrc/pylith/topology/Mesh.icc
   short/3D/PyLith/trunk/modulesrc/topology/Mesh.i
Log:
Improved Mesh::view(). Use arg to set view options.

Modified: short/3D/PyLith/trunk/libsrc/pylith/topology/Mesh.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/topology/Mesh.cc	2013-08-29 23:59:35 UTC (rev 22742)
+++ short/3D/PyLith/trunk/libsrc/pylith/topology/Mesh.cc	2013-08-30 00:18:50 UTC (rev 22743)
@@ -205,6 +205,28 @@
 } // commRank
 
 // ----------------------------------------------------------------------
+// Print mesh to stdout.
+void
+pylith::topology::Mesh::view(const char* label,
+			     const char* viewOption) const
+{ // view
+  PYLITH_METHOD_BEGIN;
+
+  assert(_dmMesh);
+
+  std::ostringstream optionname, optionprefix;
+  optionname  << "-" << label << "_dm_view";
+  optionprefix << label << "_";
+
+  PetscErrorCode err;
+  err = DMSetOptionsPrefix(_dmMesh, optionprefix.str().c_str());PYLITH_CHECK_ERROR(err);
+  err = PetscOptionsSetValue(optionname.str().c_str(), viewOption);PYLITH_CHECK_ERROR(err);
+  err = DMSetFromOptions(_dmMesh);PYLITH_CHECK_ERROR(err);
+
+  PYLITH_METHOD_END;
+} // view
+
+// ----------------------------------------------------------------------
 // Return the names of all vertex groups.
 void
 pylith::topology::Mesh::groups(int* numNames, 

Modified: short/3D/PyLith/trunk/libsrc/pylith/topology/Mesh.hh
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/topology/Mesh.hh	2013-08-29 23:59:35 UTC (rev 22742)
+++ short/3D/PyLith/trunk/libsrc/pylith/topology/Mesh.hh	2013-08-30 00:18:50 UTC (rev 22743)
@@ -174,11 +174,20 @@
    */
   int commRank(void) const;
 
-  /** Print mesh to stdout.
+  /** View mesh.
    *
    * @param label Label for mesh.
+   * @param viewOption View option
+   *
+   * PETSc mesh view options include:
+   *   short summary [empty]
+   *   detail summary ::ascii_info_detail
+   *   detail in a file :refined.mesh:ascii_info_detail
+   *   latex in a file  :refined.tex:ascii_latex
+   *   VTK vtk:refined.vtk:ascii_vtk
    */
-  void view(const char* label) const;
+  void view(const char* label,
+	    const char* viewOption ="") const;
 
   /** Return the names of all vertex groups.
    *

Modified: short/3D/PyLith/trunk/libsrc/pylith/topology/Mesh.icc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/topology/Mesh.icc	2013-08-29 23:59:35 UTC (rev 22742)
+++ short/3D/PyLith/trunk/libsrc/pylith/topology/Mesh.icc	2013-08-30 00:18:50 UTC (rev 22743)
@@ -177,19 +177,6 @@
   PYLITH_METHOD_RETURN(ncells);
 }
 
-// ----------------------------------------------------------------------
-// Print mesh to stdout.
-inline
-void
-pylith::topology::Mesh::view(const char* label) const {
-  PYLITH_METHOD_BEGIN;
-
-  assert(_dmMesh);
-  PetscErrorCode err = DMView(_dmMesh, PETSC_VIEWER_STDOUT_WORLD);PYLITH_CHECK_ERROR(err);
-
-  PYLITH_METHOD_END;
-}
-
 #endif
 
 

Modified: short/3D/PyLith/trunk/modulesrc/topology/Mesh.i
===================================================================
--- short/3D/PyLith/trunk/modulesrc/topology/Mesh.i	2013-08-29 23:59:35 UTC (rev 22742)
+++ short/3D/PyLith/trunk/modulesrc/topology/Mesh.i	2013-08-30 00:18:50 UTC (rev 22743)
@@ -112,11 +112,20 @@
        */
       const MPI_Comm comm(void) const;
     
-      /** Print mesh to stdout.
+      /** View mesh.
        *
        * @param label Label for mesh.
+       * @param viewOption View option
+       *
+       * PETSc mesh view options include:
+       *   short summary [empty]
+       *   detail summary ::ascii_info_detail
+       *   detail in a file :refined.mesh:ascii_info_detail
+       *   latex in a file  :refined.tex:ascii_latex
+       *   VTK vtk:refined.vtk:ascii_vtk
        */
-      void view(const char* label);
+      void view(const char* label,
+		const char* viewOption) const;
 
       /** Return the names of all vertex groups.
        *



More information about the CIG-COMMITS mailing list