[Paraview] Particle attributes in vtkPolyData

Berk Geveci berk.geveci at gmail.com
Mon Apr 10 14:25:04 EDT 2006


Any errors? Can you post the header part of the vtk file (xml)?

On 4/10/06, Randy Hudson <hudson at mcs.anl.gov> wrote:
>
>
> Oh.  Calculator is also unavailable....
>
>
> Berk Geveci wrote:
> > Hmmm. I missed that line. Do the scalars show up in any filter? Array
> > calculator or threshold?
> >
> > On 4/10/06, Randy Hudson <hudson at mcs.anl.gov> wrote:
> >
> >> Which array?  See the 8th line of code I included.
> >>
> >> Berk Geveci wrote:
> >>
> >>> Try naming the array with SetName().
> >>>
> >>> -Berk
> >>>
> >>> On 4/10/06, Randy Hudson <hudson at mcs.anl.gov> wrote:
> >>>
> >>>
> >>>> I've written a reader for ParaView 2.4.2 that reads particles from an
> >>>> HDF5 file and loads them into a vtkPolyData object.
> >>>>
> >>>> It stuffs vtkPoints, vtkCellArray and vtkDoubleArray objects into the
> >>>> same places, in vtkPolyData, as is done in
> >>>> <paraview_src>/VTK/IO/vtkParticleReader.cxx (although I'm not using
> >>>> vtkSmartPointer, fwiw).
> >>>>
> >>>> The issueproblem, though, is that no scalar-attribute-based property
> >>>> shows up on the "Color by" menu on the "Display" tab, so I can't color
> >>>> the particles by the scalar attribute.
> >>>>
> >>>> HOWEVER, if I read the particles into paraview and then use File -->
> >>>> Save Geometry to create a ".pvd" file, and then load THAT back into
> >>>> paraview, the scalar attribute shows up on the "Color by" menu, and the
> >>>> particles CAN be colored by it.
> >>>>
> >>>> It was, therefore, there all along -- and, it would seem, in the right
> >>>> place.
> >>>>
> >>>>
> >>>> Does it looks as though I'm doing things correctly?
> >>>>
> >>>>
> >>>> Here's most of the relevant code:
> >>>>
> >>>>     scalar_var = new double[NumberOfParticles];
> >>>>     for(i=0; i<NumberOfParticles; i++)
> >>>>         scalar_var[i] = particles[i].realProps[varname_index];
> >>>>
> >>>>     aVTKPolyData = vtkPolyData::New();
> >>>>     variable_color1 = vtkDoubleArray::New();
> >>>>     pts1 = vtkPoints::New();
> >>>>     ca1 = vtkCellArray::New();
> >>>>
> >>>>     variable_color1->SetName(varname);
> >>>>     for(i=0; i<NumberOfParticles; i++) {
> >>>>         variable_color1->InsertNextValue(scalar_var[i]);
> >>>>
> >>>>     for(i=0; i<NumberOfParticles; i++) {
> >>>>         pts1->InsertPoint(i, xyz_position[i].x, xyz_position[i].y,
> >>>>     xyz_position[i].z);
> >>>>         ca1->InsertNextCell(1);
> >>>>         ca1->InsertCellPoint(i);
> >>>>     }
> >>>>
> >>>>     aVTKPolyData->SetPoints(pts1);
> >>>>     aVTKPolyData->SetVerts(ca1);
> >>>>     aVTKPolyData->GetPointData()->SetScalars(variable_color1);
> >>>>
> >>>>
> >>>> --
> >>>>
> >>>> Randy.
> >>>>
> >>>>
> >>>> _______________________________________________
> >>>> ParaView mailing list
> >>>> ParaView at paraview.org
> >>>> http://www.paraview.org/mailman/listinfo/paraview
> >>>>
> >>>>
> >>>>
> >>>
> >>>
> >> --
> >>
> >> Randy.
> >>
> >> "Just imagine if chutzpah destabilized the space-time continuum.  Then imagine Ted Kennedy taking to the floor of the Senate to denounce Cheney's accident reporting protocols.  Space and time would fold in on themselves in the well of the Senate and while Ted would vanish in a fzzztt...spork! and a burst of ozone, maybe a cool pterodactyl or woolly mammoth would escape through the rip in existence and terrorize the capitol.
> >>
> >>                                                     Jonah Goldberg.
> >>
> >>
> >>
> >
> >
> >
>
> --
>
> Randy.
>
> "Just imagine if chutzpah destabilized the space-time continuum.  Then imagine Ted Kennedy taking to the floor of the Senate to denounce Cheney's accident reporting protocols.  Space and time would fold in on themselves in the well of the Senate and while Ted would vanish in a fzzztt...spork! and a burst of ozone, maybe a cool pterodactyl or woolly mammoth would escape through the rip in existence and terrorize the capitol.
>
>                                                     Jonah Goldberg.
>
>


More information about the ParaView mailing list