[Paraview] Field Data

Karl König kkoenig11 at web.de
Sat Feb 23 06:44:23 EST 2013


Colin,

One way to accomplish this is to have a Programmable Filter generate a
polygonal data set (vtkPolyData) consisting of a single vertex and
convert all field data of the input data set into point data for this
vertex. Then, use one of the various means to select said vertex in
ParaView (lasso select or "Edit - Find Data" or "Spreadsheet View -
Select row") and apply the Plot Selection over Time filter subsequently.

As programmable filter script use something along the lines of:
- - - - -
inp = self.GetInput()
out = self.GetPolyDataOutput()

newPoint = vtk.vtkPoints()
newPoint.InsertPoint(0,0,0,0)
out.SetPoints(newPoint)

newCell = vtk.vtkCellArray()
vertex = vtk.vtkVertex()
vertex.GetPointIds().SetId(0,0)
newCell.InsertNextCell(vertex)
out.SetVerts(newCell)

if not inp.GetFieldData() is None:
    if inp.GetFieldData().GetNumberOfArrays() > 0:
        for fieldArrayIdx in
range(0,inp.GetFieldData().GetNumberOfArrays()):
            data = inp.GetFieldData().GetArray(fieldArrayIdx);
            name = inp.GetFieldData().GetArrayName(fieldArrayIdx);

            # Use first entry of n-th field data array
            if not data is None:
                newData = vtk.vtkFloatArray()
                newData.SetName(name)
                newData.SetNumberOfComponents(1)
                newData.InsertNextValue(data.GetValue(0))
                out.GetPointData().AddArray(newData)
- - - - -

Hope that helps
Karl


Colin McAuliffe wrote, On 21.02.2013 14:11:
> Now, is it possible to plot field data over time? Plot selection over
> time seems not to work, and looking through the mailing list, Plot
> global variables over time will work only for the exodus II reader. Is
> there a way to do it for pvd's or vtu collections?
> 
> Colin



More information about the ParaView mailing list