[vtkusers] Mapping/Interpolate scalars in a suitable way on a Finite Element Mesh

Frank Conradie frank at qfin.net
Thu Oct 14 10:40:18 EDT 2004


Hi Peter

I used a contour filter on an unstructured grid in Python as follows (my
scalars were temperatures):

        geom = vtk.vtkGeometryFilter()
        geom.SetInput(ugrid)

        contour = vtk.vtkBandedPolyDataContourFilter()
        contour.SetInput(geom.GetOutput())
        contour.GenerateValues(num_contours, Tmin, Tmax)
        contour.SetScalarModeToValue()

        mapper.SetInput(contour.GetOutput())
        mapper.SetScalarModeToUseCellData()
        ...

Frank Conradie
Rossland, BC, Canada


----- Original Message -----
From: "Peter Wallin" <petwa055 at student.liu.se>
To: <vtkusers at vtk.org>
Sent: Thursday, October 14, 2004 7:25 AM
Subject: [vtkusers] Mapping/Interpolate scalars in a suitable way on a
Finite Element Mesh


> Hi there!
>
> I have read in a mesh from a Finite Element solver, into VTK and now I
want to map the stresses( point scalars) in a suitable way. The values are
mapped correctly in the points(nodes) but the interior of the cell looks
bad.
>
> I have attached two pictures that shows the mapping. As seen in the
images, the diagonal of the quads has a constant value i.e. the result is
interpreted as two planar triangles. In a case with a quad element and with
a non-planar response surface this is not a good representation.
>
>
> I want the mapping to be like a contour filter that clearly show the
stresses around a certain point(s). Any suggestions? Is it possibly to
somehow use the contourfilter on my scalars?
>
>
>
>
> code extraction...
>
>
> this->lut=vtkLookupTable::New();
> this->lut->SetTableRange(this->filereader->GetOutput()->GetScalarRange());
> this->lut->SetHueRange(0.667, 0.0);
> this->lut->Build();
>
>
> this->bar=vtkScalarBarActor::New();
> this->bar->SetLookupTable(lut);
> this->bar->SetNumberOfLabels(8);
>
>
>
> this->pMapper=vtkPolyDataMapper::New();
> this->pMapper->SetInput(gFilter->GetOutput());
> this->pMapper->SetLookupTable(lut);
>
this->pMapper->SetScalarRange(this->filereader->GetOutput()->GetScalarRange(
));
>
>
> // furhter down the pipeline..
>
>
> this->actor->SetMapper(dataMapper);
> //this->actor->GetProperty()->SetInterpolationToFlat();
> this->actor->GetProperty()->SetInterpolationToGouraud();
> this->actor->GetProperty()->SetAmbient(0.4);
> this->actor->GetProperty()->SetDiffuse(0.2);
> this->actor->GetProperty()->SetSpecular(0.2);
> .....
>
> Best Regards,
>
> Peter
>
>
>


----------------------------------------------------------------------------
----


> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at:
<http://public.kitware.com/cgi-bin/vtkfaq>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>




More information about the vtkusers mailing list