Re: [Paraview] simple Programmable Source

2017-10-11 Thread Cory Quammen
Randy,

Try setting a name on the array with

scalars.SetName('array_name')

This should let you select this array as the color array in ParaView.

- Cory

On Wed, Oct 11, 2017 at 9:48 PM, Heiland, Randy  wrote:

> I create the following in the Pgmable Source in PV, but cannot figure out
> how to color the resulting points or 3D glyphs using the scalar values.
> What am I missing?
> -Randy
>
> # Get a vtk.PolyData object for the output
> pdo = self.GetPolyDataOutput()
>
> # Create points
> num_pts = 3
> newPts = vtk.vtkPoints()
> scalars = vtk.vtkFloatArray()
>
> xval = -1.0
> for idx in range(0, num_pts):
>   # rf. PhysiCell User Guide for these array indices to a cell's position.
>   x = xval
>   y = 0.0
>   z = 0.0
>   newPts.InsertPoint(idx, x,y,z)
>   sval = xval*2
>   scalars.InsertNextValue(sval)
>   xval += 1.0
>
> # Add the points to the vtkPolyData object.
> pdo.SetPoints(newPts)
> pdo.GetPointData().SetScalars(scalars)
>
> verts = vtk.vtkCellArray()
> for idx in range(0, num_pts):
>   verts.InsertNextCell(1)
>   verts.InsertCellPoint(idx)
>
> pdo.SetVerts(verts)
>
>
>
> ___
> 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
>
>


-- 
Cory Quammen
Staff R&D Engineer
Kitware, Inc.
___
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


[Paraview] simple Programmable Source

2017-10-11 Thread Heiland, Randy
I create the following in the Pgmable Source in PV, but cannot figure out how 
to color the resulting points or 3D glyphs using the scalar values. What am I 
missing?
-Randy

# Get a vtk.PolyData object for the output
pdo = self.GetPolyDataOutput()

# Create points
num_pts = 3
newPts = vtk.vtkPoints()
scalars = vtk.vtkFloatArray()

xval = -1.0
for idx in range(0, num_pts):
  # rf. PhysiCell User Guide for these array indices to a cell's position.
  x = xval
  y = 0.0
  z = 0.0
  newPts.InsertPoint(idx, x,y,z)
  sval = xval*2
  scalars.InsertNextValue(sval)
  xval += 1.0

# Add the points to the vtkPolyData object.
pdo.SetPoints(newPts)
pdo.GetPointData().SetScalars(scalars)

verts = vtk.vtkCellArray()
for idx in range(0, num_pts):
  verts.InsertNextCell(1)
  verts.InsertCellPoint(idx)

pdo.SetVerts(verts)




smime.p7s
Description: S/MIME cryptographic signature
___
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


Re: [Paraview] reading MATLAB file

2017-10-11 Thread Heiland, Randy
Not sure, but think it’s irrelevant for my particular use. I'm going to try the 
Programmable Source (Python script) approach (and use scipy.io.loadmat to read 
my .mat file). Maybe I missed it - is there a way to read in this script from a 
file? (copy/pasting into the Pgmable Source widget certainly works; just 
asking)  Thanks! 

> On Oct 11, 2017, at 1:24 PM, Berk Geveci  wrote:
> 
> Is there a Python API to read .mat files? What is the underlying structure? I 
> kind of remember them using HDF5 for some stuff...
> 
> On Tue, Oct 10, 2017 at 2:18 PM, Heiland, Randy  > wrote:
> Hello,
> 
> I have some matlab files I’d like to get into PV. Initially, the data is 
> quite simple: sphere centers, radii, color attribute (a few 100K spheres). In 
> the past, I’ve manually converted the files into .vtk formats using Python w/ 
> scipy to load/parse the .mat files. But I’d like to avoid creating additional 
> files and just read the .mat files directly.
> 
> I *think* I’d like to do this w/ Python still (but without creating files), 
> if that’s an option. Basically, I’d welcome suggestions for the simplest 
> approach, at least initially. I’m not terribly concerned about the “slowness” 
> of Python reading/converting the .mat files.
> 
> Using PV 5.4.1. And the solution needs to be easily adopted by others who 
> will be using PV.
> 
> I’m sure there are concerns that I’ve side-stepped, e.g. would I ever want to 
> use it in client/server mode, etc.
> 
> I’ve seen https://www.paraview.org/Wiki/Plugin_HowTo 
>  and I was also curious if a 
> “Programmable Source” would be an option. 
> 
> thanks! (and it’s nice to re-join the community after a long absence)
> -Randy
> 
> ___
> 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 
> 
> 
> 



smime.p7s
Description: S/MIME cryptographic signature
___
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


[Paraview] 2d decimation

2017-10-11 Thread Scott, W Alan
I tried the decimation filter on a slice, and it ended up with huge holes.
Is this a fool's errand, or should we be able to decimate a slice and not have 
holes?  Do we need a new filter - decimate2d?

Alan


___
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


Re: [Paraview] reading MATLAB file

2017-10-11 Thread Berk Geveci
Is there a Python API to read .mat files? What is the underlying structure?
I kind of remember them using HDF5 for some stuff...

On Tue, Oct 10, 2017 at 2:18 PM, Heiland, Randy  wrote:

> Hello,
>
> I have some matlab files I’d like to get into PV. Initially, the data is
> quite simple: sphere centers, radii, color attribute (a few 100K spheres).
> In the past, I’ve manually converted the files into .vtk formats using
> Python w/ scipy to load/parse the .mat files. But I’d like to avoid
> creating additional files and just read the .mat files directly.
>
> I *think* I’d like to do this w/ Python still (but without creating
> files), if that’s an option. Basically, I’d welcome suggestions for the
> simplest approach, at least initially. I’m not terribly concerned about the
> “slowness” of Python reading/converting the .mat files.
>
> Using PV 5.4.1. And the solution needs to be easily adopted by others who
> will be using PV.
>
> I’m sure there are concerns that I’ve side-stepped, e.g. would I ever want
> to use it in client/server mode, etc.
>
> I’ve seen https://www.paraview.org/Wiki/Plugin_HowTo and I was also
> curious if a “Programmable Source” would be an option.
>
> thanks! (and it’s nice to re-join the community after a long absence)
> -Randy
>
> ___
> 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
>
>
___
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


Re: [Paraview] programmable filter, OK in serial, FAILS in mpi

2017-10-11 Thread Berk Geveci
Hi Andre,

Are you running pvserver explicitly? If you run it explicitly and connect
with the GUI to it, the output of print statements should show up on the
terminal you ran mpiexec/mpirun on. Once you do that and we know what the
error is, I should be able to help more.

PS: What is your data source? (file format?)

Best,
-berk

On Tue, Oct 10, 2017 at 6:59 PM, A  wrote:

> I normally run Paraview on my workstation with mpi support (14 cores).
> It's been working fine like this for a year.
>
> For some reason however, the debug/output messages windows dont work when
> running in mpi (e.g. print "hello", returns nothing). But they do work when
> I turn mpi off.
>
> I recently wrote a few new programmable filters, and while they work
> perfectly with mpi off, the hand and dont do anything with mpi on.
>
> Any idea?
>
> -ashton
>
> p.s. heres one of the filters for example;
>
> from paraview.numpy_support import vtk_to_numpy
>
> import vtkCommonDataModelPython
>
> import numpy as np
>
> from scipy.optimize import curve_fit
>
>
> if type(self.GetInputDataObject(0,0)) is 
> vtkCommonDataModelPython.vtkUnstructuredGrid and 
> type(self.GetInputDataObject(0,1)) is vtkCommonDataModelPython.vtkPolyData:
>
> g = 0
>
> p = 1
>
> elif type(self.GetInputDataObject(0,1)) is 
> vtkCommonDataModelPython.vtkUnstructuredGrid and 
> type(self.GetInputDataObject(0,0)) is vtkCommonDataModelPython.vtkPolyData:
>
> g = 1
>
> p = 0
>
> else:
>
> print('ERROR')
>
> return
>
>
> # import the grid
>
> Vs = inputs[g].PointData['Vs']
>
> depth = inputs[g].PointData['depth']
>
> z = inputs[0].PointData['z']
>
>
> # setup output
>
> output.PointData.append(Vs, 'Vs')
>
> output.PointData.append(depth, 'depth')
>
> output.PointData.append(z, 'z')
>
>
> # import the profile
>
> Vs_profile = inputs[p].PointData['Vs']
>
> depth_profile = inputs[p].PointData['depth']
>
>
> def func(x, a, b, c, d,e):
>
> return a + b*x + c*x**2 + d*x**3 + e*x**4
>
>
> nanx = np.argwhere(np.isnan(depth_profile))
>
> nany = np.argwhere(np.isnan(Vs_profile))
>
> nani = np.unique(np.append(nanx,nany))
>
> xdata = numpy.delete(depth_profile, nani)
>
> ydata = numpy.delete(Vs_profile, nani)
>
>
> popt, pcov1 = curve_fit(func, xdata, ydata)
>
>
>
> Vs_theory = popt[0] + popt[1]*depth + popt[2]*depth**2 + popt[3]*depth**3 + 
> popt[4]*depth**4
>
>
> diff = Vs - Vs_theory
>
> per_diff=100*diff/Vs_theory
>
> output.PointData.append(per_diff, 'perturbation')
>
>
>
> ___
> 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
>
>
___
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


Re: [Paraview] [paraview] visualize higher order element.

2017-10-11 Thread Andy Bauer
Hi Mathi,

When I looked at the file in ParaView it seems like the connectivity is
wrong with your cells. If you try the Clean to Grid filter that should fix
your problem. I would suggest fixing the connectivity though as the best
way to manage the data since the Clean to Grid filter will merge coincident
points and may inadvertently mess up your point data fields for the
coincident points. Note that the Clean to Grid filter reduced the number of
points in your grid from 2,006,480 to 451,792.

Cheers,
Andy

On Wed, Oct 11, 2017 at 10:17 AM, Ezhilmathi Krishnasamy <
ezhkr...@student.liu.se> wrote:

> Hi Andy,
>
> Any idea or info about this extracting the surface of the geometry
> in higher order element mesh (or solution).
>
> Kind regards,
> Mathi
>
> On 20 September 2017 at 21:32, Ezhilmathi Krishnasamy <
> ezhkr...@student.liu.se> wrote:
>
>> Hi Andy,
>>
>> Thanks!
>>
>> I am attaching you the image here, I would like to see the sphere surface
>> inside the
>> cube. Instead I am still seeing the elements.
>>
>> Kind regards,
>> Mathi​
>>  sol.vtu
>> 
>> ​
>>
>> On 20 September 2017 at 21:15, Andy Bauer  wrote:
>>
>>> Hi,
>>>
>>> What do you mean by the extract operator? ParaView has a variety of
>>> filters (similar to VisIt's operators) for performing extracts of different
>>> types. Could you also share your dataset? That may make it easier to
>>> diagnose the issue.
>>>
>>> Best,
>>> Andy
>>>
>>> On Wed, Sep 20, 2017 at 2:33 PM, Ezhilmathi Krishnasamy <
>>> ezhkr...@student.liu.se> wrote:
>>>
 Hi,

 I have fluid domain as a cube and inside this cube I have sphere. In
 the linear element mesh if I use extract operator and apply the clip as
 well I can see the sphere surface.

 But where as in higher order element mesh.
 If i follow the same procedure, I don't see the sphere surface instead
 I see only the elements in the cube.

 Could anyone please tell me how to solve this problem.

 Kind regards,
 Mathi


 Sent from my iPhone
 ___
 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

>>>
>>>
>>
>
___
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


Re: [Paraview] [paraview] visualize higher order element.

2017-10-11 Thread Ezhilmathi Krishnasamy
Hi Andy,

Any idea or info about this extracting the surface of the geometry
in higher order element mesh (or solution).

Kind regards,
Mathi

On 20 September 2017 at 21:32, Ezhilmathi Krishnasamy <
ezhkr...@student.liu.se> wrote:

> Hi Andy,
>
> Thanks!
>
> I am attaching you the image here, I would like to see the sphere surface
> inside the
> cube. Instead I am still seeing the elements.
>
> Kind regards,
> Mathi​
>  sol.vtu
> 
> ​
>
> On 20 September 2017 at 21:15, Andy Bauer  wrote:
>
>> Hi,
>>
>> What do you mean by the extract operator? ParaView has a variety of
>> filters (similar to VisIt's operators) for performing extracts of different
>> types. Could you also share your dataset? That may make it easier to
>> diagnose the issue.
>>
>> Best,
>> Andy
>>
>> On Wed, Sep 20, 2017 at 2:33 PM, Ezhilmathi Krishnasamy <
>> ezhkr...@student.liu.se> wrote:
>>
>>> Hi,
>>>
>>> I have fluid domain as a cube and inside this cube I have sphere. In the
>>> linear element mesh if I use extract operator and apply the clip as well I
>>> can see the sphere surface.
>>>
>>> But where as in higher order element mesh.
>>> If i follow the same procedure, I don't see the sphere surface instead I
>>> see only the elements in the cube.
>>>
>>> Could anyone please tell me how to solve this problem.
>>>
>>> Kind regards,
>>> Mathi
>>>
>>>
>>> Sent from my iPhone
>>> ___
>>> 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
>>>
>>
>>
>
___
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


Re: [Paraview] Lambda-2 vortices computation

2017-10-11 Thread Ezhilmathi Krishnasamy
Hi Andy,

Thanks it worked! and also there is a forum discussion about it.
https://www.paraview.org/pipermail/paraview/2017-June/040299.html

Kind regards,
Mathi

On 7 October 2017 at 13:27, Andy Bauer  wrote:

> Hi,
>
> I think the best way is to use the Gradient of Unstructured DataSet filter
> to compute the velocity gradient and then use the Calculator or Python
> Calculator filter to compute lambda-2.
>
> Cheers,
> Andy
>
> On Fri, Oct 6, 2017 at 4:40 PM, Ezhilmathi Krishnasamy <
> ezhkr...@student.liu.se> wrote:
>
>> Hi,
>>
>> Could anyone tell me how to calculate the lambda-2 vorticity computation
>> in
>> Paraview.
>>
>> Kind regards,
>> Mathi
>>
>> ___
>> 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
>>
>>
>
___
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