[petsc-users] VTKViewer with petsc4py

Blaise Bourdin bourdin at lsu.edu
Fri Jul 30 23:01:11 CDT 2010


> On 30 July 2010 23:50, Blaise Bourdin <bourdin at lsu.edu> wrote:
>> Great! that works.
>> 
>> Now my problem is with DASetUniformCoordinates or DASetCoordinates. Do they exist in petsc4py? I can't see them when I do a dir(da).
>> 
> 
> No, they are not available. However, adding them should be really
> easy. Not sure iff I'll be able to do that this weekend. In any case,
> I'll have to ask you to "hg clone http://path/to/petsc4py-dev" and "hg
> update release-1.1". If you can beat me and add the missing calls,
> patches are going to be very welcome.
Here is the patch for DASetUniformCoordinates I don't really know what I am doing, but it seems reasonable. I'll work on the others this weekend.

diff -r 493264e77f7c src/PETSc/DA.pyx
--- a/src/PETSc/DA.pyx	Thu Jul 08 12:51:39 2010 -0300
+++ b/src/PETSc/DA.pyx	Fri Jul 30 22:58:33 2010 -0500
@@ -287,6 +287,8 @@ cdef class DA(Object):
         CHKERR( DALocalToLocalBegin(self.da, vl.vec, im, vlg.vec) )
         CHKERR( DALocalToLocalEnd  (self.da, vl.vec, im, vlg.vec) )
 
+    def setUniformCoordinates(self, xmin, xmax, ymin, ymax, zmin, zmax):
+        CHKERR( DASetUniformCoordinates(self.da, xmin, xmax, ymin, ymax, zmin, zmax) )
     #
 
     def getAO(self):
diff -r 493264e77f7c src/PETSc/petscda.pxi
--- a/src/PETSc/petscda.pxi	Thu Jul 08 12:51:39 2010 -0300
+++ b/src/PETSc/petscda.pxi	Fri Jul 30 22:58:33 2010 -0500
@@ -56,10 +56,10 @@ cdef extern from "petscda.h" nogil:
                           PetscInt*,PetscInt*,PetscInt*,
                           PetscInt*,PetscInt*,PetscInt*)
 
-    #int DASetUniformCoordinates(PetscDA,
-    #                            PetscReal,PetscReal,
-    #                            PetscReal,PetscReal,
-    #                            PetscReal,PetscReal)
+    int DASetUniformCoordinates(PetscDA,
+                                PetscReal,PetscReal,
+                                PetscReal,PetscReal,
+                                PetscReal,PetscReal)
     #int DASetCoordinates(PetscDA,PetscVec)
     #int DAGetCoordinates(PetscDA,PetscVec*)
     #int DAGetGhostedCoordinates(PetscDA,PetscVec*)


> 
> PS: The DA support is somewhat unfinished, I've never used DA's too much.

I don't need much. I just need to read a few tecplot files, do some basic post-processing and save them. What you have should be enough, once the coordinates stuff is added.


Blaise 



-- 
Department of Mathematics and Center for Computation & Technology
Louisiana State University, Baton Rouge, LA 70803, USA
Tel. +1 (225) 578 1612, Fax  +1 (225) 578 4276 http://www.math.lsu.edu/~bourdin









More information about the petsc-users mailing list