[vtkusers] Changing cell data

James C Robinson j.robinson at kepler-systems.com
Fri Aug 5 06:59:51 EDT 2005


Dear All,

 

I have been using VTK a while now. I have the user guide (but not currently
in my possession). 

 

I am visualising a finite element mesh. I can currently do lots with it -
visualise according to materials, according to pressure etc. However, I have
a new variable associated with each element (cell) that is error and I want
to visualise it. My code (C++) for visualising the materials and pressure
looks like this:

 

 

void CMeshviewDoc::CreateMeshActor()

{

    if (CreateLookUpTable) pPressureMapper->SetLookupTable(pLut) ;

    pPressureMapper->SetInput(pGeometry->GetOutput());

            pPressureMapper->SetResolveCoincidentTopologyToShiftZBuffer() ;

            pPressureMapper->SetResolveCoincidentTopologyZShift(0.02) ;

    pMeshPressureActor->SetMapper(pPressureMapper);

 

    if (CreateLookUpTable) pMaterialMapper->SetLookupTable(pMatLut) ;

    pMaterialMapper->SetInput(pGeometry->GetOutput());

            pMaterialMapper->SetResolveCoincidentTopologyToShiftZBuffer() ;

            pMaterialMapper->SetResolveCoincidentTopologyZShift(0.02) ;

            pMaterialMapper->SetScalarModeToUseCellData() ;

    pMeshMaterialActor->SetMapper(pMaterialMapper);

 

// Apply the default opacity

    (pMeshPressureActor->GetProperty())->SetOpacity(VTK_FULLYOPAQUE) ;

    (pMeshMaterialActor->GetProperty())->SetOpacity(VTK_DEFAULT_OPACITY) ;

}

 

I initialise the doc/view by creating a VTK file and reading it in as the
window is opened. I use a vtkUnstructuredGridReader and then a
vtkGeometryFilter (pGeometry) to extract the information. In the file I
create a dummy pressure at each point list that I can manipulate and a real
list of the materials for each cell (which I can then colour using the
pMatLut). However, I also want to be able to associate a double precision
scalar with each cell (and subsequently manipulate it). Has anybody any
ideas how this can be done?

 

Many thanks,

 

James C Robinson, 

*    42 Rivergrove,

         Glanmire,

         Co. Cork,

         Eire

'     +353 21 4822028

         +353 87 2393010

*    jrobinson at eircom.net> 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20050805/60611dae/attachment.htm>


More information about the vtkusers mailing list