# Multiple Scalars per Cell or Face

Hello,

Aside from array scalars, VTK currently supports point or cell scalars, which means either the scalars array needs to match the number of points or cells. I’d like to plot scalars such that each point of each cell had an assigned scalar. This is possible when each cell contains isolated points, but if cells share common points, it is impossible to assign scalars to each point of each cell.

Other than duplicating points in order to truly isolate cells within VTK, is there any way to add scalars to each point of each cell?

2 Likes

Hello, Alex,

Hmmm… In Open Inventor we have nomething called indexed vertexes, that is: you can create two vertexes sharing the same XYZ, so you can assign different scalars without duplicating geometry. In VTK, I think your best shot is to create `vtkCell`s of type `vtkVertex`. A `vtkVertex` is a cell wich is a single point. Of course you can create as many `vtkVertex`es as you like sharing the same `vtkPoint`.

all the best,

Paulo

1 Like

I think @Paulo_Carvalho’s approach using the `vtkVertex` cell approach in a `vtkUnstructuredGrid` would be the best approach as far as data storage goes. However, if the mesh has any cells other than vertices (e.g. quads, triangles, tetrahedrals, etc.) then you’ll immediately run into problems with missing cell data (though I suppose you could just fill those cells with NaNs but that might turn into a whole lotta NaNs that have to be stored).

Also, I can’t really wrap my head around how you might display this kind of data… would you interpolate the values at the nodes for each 2/3D cell across the cell? Or how might you display two values at the same vertex without using some sort of geometric distortion?

As I’m hoping to plot 3D cells, vertices won’t work in this case. As for an example of the results plot:

These are finite element stresses, which are continuous within elements but discontinuous between elements, hence why they share the same points, but different scalar data per point. The best I can come up with is representing each cell with unique, though co-located points, that way you can assign each cell with unique scalars.

2 Likes

Looks like a usecase for a vtkExplicitStructuredGrid

That’s an interesting data structure. Does it also support higher order cells or only linear ones?

I would say yes but I defer to @JPouderoux for a definitive answer.

I have the same requirement. I want also to visualize scalars to each point of each cell.
Have you find a satisfying and well working solution?

Thanks!
Best Regards,
Florian

@goflo My approach is the same as that of @akaszynski : split the points into multiple co-located points and contour every cell by itself.