Hello,

I work with a CFD code that uses a structured mesh.  We frequently want to
do math operations that require each cell to have knowledge of its
neighbors.  Things such as a calculating the max of a certain variable, or
a gradient in a given direction.

I'm not sure the best way to accomplish this.  I have a code snippet for
use in the programmable filter that I use (copied below), but its behavior
is similar to the calculator in that it works on individual cells without
knowledge of cell neighbors.

Can somebody A) critique my skeleton code below to let me know if I could
write it better and B) help me with figuring out a method (any method) that
has visibility of neighbor cells?

Thanks

-David Ortley


# Programmable filter snippet:
pdi=self.GetInput()
pdo=self.GetOutput()

numCells = pdi.GetNumberOfCells()
cells = pdi.GetCellData()

# Some array already in the calc results that I'm going to reason on
# say it's pressure or energy or something
orig_array = cells.GetArray("orig_array")

# Storing
new_array = vtk.vtkDoubleArray()
new_array.SetName("new_array")

for i in range(numCells):
    # do some work
    blah  = pkovpr.GetValue(i) * 1.23456789
    # store as new val in array
    new_array.InsertNextValue(blah)

# Add the array I just created to the output so Paraview can do stuff with
it
pdo.GetCellData().AddArray(betaMax)
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the ParaView Wiki at: 
http://paraview.org/Wiki/ParaView

Search the list archives at: http://markmail.org/search/?q=ParaView

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/paraview

Reply via email to