[Paraview] ParaView with VirtualGL

Berk Geveci berk.geveci at kitware.com
Wed Oct 15 19:08:54 EDT 2014


First things first, you need to upgrade to 4.2 :-) It has significant
improvements to the Python API and you are like to need them.

When running in parallel, if you want to restrict which ranks print out
information, you can do something like this:

import vtk
contr = vtk.vtkMultiProcessController.GetGlobalController()
rank = contr.GetLocalProcessId()

if id == 0:
  print 'hello'

You will likely need MPI methods here. See:

http://www.kitware.com/blog/home/post/716

The reason you are seeing the error is that one of the ranks does not have
any data. I can't remember from the top of my head if we automatically
distribute vtu files. Try applying the D3 filter and see what happens.

Best,
-berk

On Wed, Oct 15, 2014 at 6:47 PM, Craig Michoski <michoski at gmail.com> wrote:

> Hi Berk,
>
> Thanks for the response.  I see I'm at the fount.  So, I'm using paraview
> 4.1.0, and loading everything in from vtu files.  The basic python filter
> I'm trying to get running in parallel is this below, for a basic
> integration along a dimension in two of the loaded fields (one a scalar
> alpha_0, the other a two dimensional vector sigma_0_0__sigma_0_1).
>
> ----------------
> import numpy
>
> alpha0 = inputs[0].PointData['alpha_0']
> alpha1 = inputs[0].PointData['alpha_0']
> sigma0 = inputs[0].PointData['sigma_0_0__sigma_0_1']
>
> pdi = self.GetInputDataObject(0,0)
> bg_field = 1
> pdi = self.GetInputDataObject(0,0)
> pdo = self.GetOutputDataObject(0)
> numPoints = pdi.GetNumberOfPoints()
> import time
>
> ind=self.GetInput()
> iin=ind.GetInformation()
> timestep = time.clock()
>
> dx = 100.0
> dy = 100.0
>
> for (j,alpha) in enumerate(alpha0):
>     x1,y1,z1 = pdi.GetPoint(j)[:3]
>     x2,y2,z2 = pdi.GetPoint(j+1)[:3]
>     if abs(x2-x1) <= dx and abs(x2-x1)>0:
>         dx = x2 - x1
>     if abs(y2-y1) <= dy and abs(y2-y1)>1e-6:
>         dy = y2 - y1
>
> counter = 0
> last_step = -1.0
> prev_x = 0.0
> efold = numpy.zeros(numPoints)
> y_first = -1.0
>
> for (j,alpha) in enumerate(alpha0):
>     x,y,z = pdi.GetPoint(j)
>     if x<380.0 and x>70.0 and y==0.0:
>         y_first = []
>         for (i,alpha_1) in enumerate(alpha1):
>             x1,y1,z1 = pdi.GetPoint(i)
>             if x1 == x and y1 == y:
>                 for (k,sigmax) in enumerate(sigma0):
>                     x2,y2,z2 = pdi.GetPoint(i)
>                     if x2 == x1: #and y2 == y1:
>                         if y2 not in y_first:
>                             efold[k] +=  ( 1.0/exp(2.0*alpha_1) ) *
> sigmax[0] * dy  #exp(alpha_1)*sigmax[0]*dy
>                             y_first.append(y2)
>
>                 if x!=last_step:
>                     counter = counter + 1
>                     print "y_integrated_chi_at1(",floor(timestep),",",
> counter,") = ", efold[k]/377.0, ";"
>                     print "x(",counter,") = ", x, ";"
>                     last_step = x
> ----------------
>
> Craig
>
>
> On Wed, Oct 15, 2014 at 5:38 PM, Berk Geveci <berk.geveci at kitware.com>
> wrote:
>
>> Hi Craig,
>>
>> Which version of ParaView are you using?
>>
>> What file format are you loading?
>>
>> Best,
>> -berk
>>
>> On Wed, Oct 15, 2014 at 4:52 PM, Craig Michoski <michoski at gmail.com>
>> wrote:
>>
>>> Ah, okay, I figured out part of my problem.  I had to connect to the
>>> server and display the output on the server side, not just the client
>>> side, which I guess is where the print commands redirects.  Now I have
>>> several other problems.  First:
>>>
>>> 1) the print command outputs n_processor number of outputs.  Can I
>>> make this just one value?  For example, if I am summing a value over a
>>> mesh, I just want to total value output once over the entire mesh?  Is
>>> this possible?
>>>
>>> 2)  I am getting an error when trying to simply get my loaded inputs.
>>> When I do:
>>>
>>> print "Gets here!"
>>>
>>> alpha0 = inputs[0].PointData['alpha_0']
>>>
>>> Traceback (most recent call last):
>>>   File "<string>", line 22, in <module>
>>>   File "<string>", line 8, in RequestData
>>> TypeError: 'NoneType' object has no attribute '__getitem__'
>>>
>>> I don't understand what is hppening here, can anyone help please?
>>>
>>> Craig
>>> _______________________________________________
>>> 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://public.kitware.com/mailman/listinfo/paraview
>>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview/attachments/20141015/79be382f/attachment.html>


More information about the ParaView mailing list