[cig-commits] r12818 - short/3D/PyLith/trunk/modulesrc/utils
knepley at geodynamics.org
knepley at geodynamics.org
Fri Sep 5 10:20:08 PDT 2008
Author: knepley
Date: 2008-09-05 10:20:07 -0700 (Fri, 05 Sep 2008)
New Revision: 12818
Modified:
short/3D/PyLith/trunk/modulesrc/utils/petsc.pyxe.src
Log:
Added a binary matrix viewer
Modified: short/3D/PyLith/trunk/modulesrc/utils/petsc.pyxe.src
===================================================================
--- short/3D/PyLith/trunk/modulesrc/utils/petsc.pyxe.src 2008-09-05 03:54:06 UTC (rev 12817)
+++ short/3D/PyLith/trunk/modulesrc/utils/petsc.pyxe.src 2008-09-05 17:20:07 UTC (rev 12818)
@@ -138,4 +138,23 @@
return
+def mat_view_binary(mat, filename):
+ """
+ Dump matrix to stdout.
+ """
+ # create shim for 'MatView'
+ #embed{ int Mat_view_binary(void* matVptr, char *filename)
+ Mat* mat = (Mat*) matVptr;
+ PetscViewer viewer;
+ PetscViewerBinaryOpen(PETSC_COMM_WORLD, filename, FILE_MODE_WRITE, &viewer);
+ MatView(*mat, viewer);
+ PetscViewerDestroy(viewer);
+ return 0;
+ #}embed
+ cdef void* matVptr
+ err = Mat_view_binary(PyCObject_AsVoidPtr(mat), filename)
+
+ return
+
+
# End of file
More information about the cig-commits
mailing list