Ejemplo n.º 1
0
def setPlotData(tbl, solverName, plotName):
    """Read plot data and put it into a vtkTable

    Use in 'Programmable Filter'. Set output type to 'vtkTable'.
    To get (for instance) the plot data generated by solver 'compressibleInterFoam'
    (if run with pyFoamRunner.py) under the name 'linear' write
from PyFoam.Paraview.Data import setPlotData
setPlotData(self.GetOutput(),"compressibleInterFoam","linear")
    """
    actualFile = path.join("PyFoamRunner." + solverName + ".analyzed",
                           "pickledPlots")
    data = RedoPlot(
        args=[actualFile, "--pickle-file", "--numpy"]).plotNumpy[plotName]

    for n in data.dtype.names:
        vals = data[n]
        col = vtk.vtkDoubleArray()
        col.SetName(n)
        for v in vals:
            col.InsertNextValue(v)
        tbl.AddColumn(col)

    return tbl
Ejemplo n.º 2
0
#!/usr/bin/python 

from PyFoam.Applications.RedoPlot import RedoPlot

RedoPlot()
Ejemplo n.º 3
0
 def pickledPlots(self, pickleFile):
     return RedoPlot(args=[path.join(self.path, pickleFile)],
                     pickleFile=True,
                     pandasData=True)["plotData"]