|
Subject: faceVariable missing copy method Newsgroups: gmane.comp.python.fipy Date: 2008-07-12 00:11:33 GMT (51 weeks, 1 day, 21 hours and 56 minutes ago) Hi, I think `faceVariable` may be missing a `copy` method. I've included a patch below, which is basically a copy of `cellVariable`'s `copy` method (minus it's `hasOld` attribute and changing the rename from + '_old' to + '_copy'). Also, the patch includes a fix for matplotlib2DViewer.py, which has changed since I originally submitted the patch. Cheers, -Tony In case you're curious about a use case: I wanted to set *almost* all of the exterior faces to a no flux boundary condition. So I naturally I tried >>> no_flux_faces = mesh.getExteriorFaces() >>> no_flux_faces.setValue(array[False], where=faces_with_other_BC) But it turns out the above commands change the faces that the mesh recognizes as exterior (`getExteriorFaces` doesn't automatically copy; for performance reasons, maybe?). So I just tried to copy before modifying: >>> exterior = mesh.getExteriorFaces() >>> no_flux_faces = exterior.copy() But, `faceVariable`'s `copy` method defaults to `Variable`'s `copy` method. As a result, the copied variable doesn't have a `mesh` attribute. |
|
|