示例#1
0
文件: ex1.py 项目: qf-18/petsc-dev
#!/usr/bin/python
import sys, petsc4py
petsc4py.init(sys.argv)
from petsc4py import PETSc



if __name__ == "__main__":
    field = PETSc.Shell().create().setURL("./field.py:Field")
    viz   = PETSc.Shell().create().setURL("./viz1.py:Viz")
    field.call("init")
    viz.compose("mesh",field.query("mesh"))
    viz.compose("rho", field.query("rho"))
    viz.call("viewRho")
    del viz
    del field
示例#2
0
文件: ex2.py 项目: nwstegmeier/petsc
#!/usr/bin/python
import sys, petsc4py
petsc4py.init(sys.argv)
from petsc4py import PETSc

if __name__ == "__main__":
    shell = PETSc.Shell().create()
    shell.setName("ex2")
    shell.registerComponent("Field", url="./field.py:Field")
    shell.registerComponent("Viz", url="./viz2.py:Viz")
    shell.registerDependence("Field", "Viz")
    shell.visit("init")
    viz = shell.getComponent("Viz")
    viz.call("viewRho")