On 08/15/2012 07:10 PM, Jean Hertzberg wrote:
I am trying to integrate a scalar over a 3D volume. I was surprised to
find that the Integrate Variables filter does not do this; when
integrating a scalar variable of 1 over a cube of size 1 X 1 X 1,
Integrate Variables returns the value of 6. The documentation says it
will integrate over lines and surfaces only. Suggestions please.

Additional context: I am working with velocity field data, read in via
the Ensight format. I have calculated vorticity, and vorticity
magnitude, and I want the integral of the vorticity magnitude in a
volume defined by an extracted subset.


If your data is a Uniform Rectilinear Grid (vtkImageData), then the volume integral is approximated by the sum of the scalar field multiplied by the spacing. You could put the following into a Programmable Filter:

        scalar_array = numpy.array(inputs[0].PointData['RTData'])
        space = inputs[0].GetSpacing()
        print scalar_array.sum() * space[0] * space[1] * space[2]

(I tested it out on an extracted subset of a wavelet.)
_______________________________________________
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

Follow this link to subscribe/unsubscribe:
http://www.paraview.org/mailman/listinfo/paraview

Reply via email to