[Paraview] New variable to a mesh

kenichiro yoshimi rccm.kyoshimi at gmail.com
Tue Feb 20 19:42:53 EST 2018


Hi Moulshree,

The Programmable filter's script would be more flexible to add an
array rather than doing it in the calculator filter since it allows us
to use various NumPy modules.

Here is a simple example that generates a random numpy array and adds
it to the mesh as a vtk array.
----
import numpy as np

input = self.GetInput()
numCells = input.GetNumberOfCells()
np_rand = np.random.rand(numCells)
output.CellData.append(np_rand, "random")
----

Some information can be found here:
https://www.paraview.org/Wiki/Python_Programmable_Filter

Thanks

2018-02-20 17:37 GMT+09:00 Moulshree Tripathi <mouly.23oct91 at gmail.com>:
> Greetings!
>
> I am new to ParaView and have few queries regarding the assigning of a new
> variable in mesh:
>
> 1: I am using calculator filter to add a new array. Is it possible to
> interpolate the values in this array and also is it possible to generate
> random numbers? (say if I want values between 0 to 1 in my array of 2000
> cells)
>
> 2: Is there any other method by which I could assign properties to the mesh?
> (say I want to assign different values to my cell - say hydraulic
> conductivities in inhomogeneous porous medium) How can I do this with
> calculator filter or with any other tool?
>
> I am sorry if the questions are naive.
> Looking forward to your response.
>
> Regards
>
> Moulshree Tripathi
>
> _______________________________________________
> 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:
> https://public.kitware.com/mailman/listinfo/paraview
>


More information about the ParaView mailing list