# Structured Grid Help

**URL:** https://discourse.paraview.org/t/structured-grid-help/9693
**Category:** ParaView Support
**Created:** [May 26, 2022, 9:58pm UTC](https://discourse.paraview.org/t/structured-grid-help/9693 "2022-05-26T21:58:24Z")
**Posts on this page:** 14
**Page:** 1

<div class="post-metadata">

### Author: ![bbrout](https://discourse.paraview.org/user_avatar/discourse.paraview.org/bbrout/32/9270_2.png) [@bbrout](https://discourse.paraview.org/u/bbrout)
#### Post date: [May 26, 2022, 8:02pm UTC](https://discourse.paraview.org/t/structured-grid-help/9693/1 "2022-05-26T20:02:36Z")

</div>

Hello. I am trying to draw a sphere. I have managed to animate a surface using DATASET STRUCTURED\_GRID and multiple vtk files which shows a diffusion process over time. So far, so good. Now I want to draw a sphere and deform it. I can produce points for a radius = 1 sphere with theta from 0 to 2 pi and phi from 0 to pi. There are 5000 points. Of course, r is constant and equal to 1, but that is going to vary. So I have 5000 points on a sphere in float format. I was trying to use the following:

# vtk DataFile Version 2.0

Sphere example  
ASCII  
DATASET STRUCTURED\_POINTS  
POINT\_DATA 5000 float  
0.477142 0.649450 0.592073  
0.552779 0.752401 -0.358230  
0.120193 0.163598 -0.979178  
-0.422898 -0.575616 -0.699874 etc for 5000 points

I keep getting the error that the number of points don’t match the matadata.

After this, I’ll be putting data to represent stresses and strains at each point. I’ve tried looking at examples but nothing works and I would like to use C if that is possible. I am way too old school for Python.

Any assistance regarding how to set out the data would be very appreciated. I really don’t understand the difference between structured and unstructured. I believe the lookup table can be used to enter stress and strain data???

Thank you for your time.

---

<div class="post-metadata">

### Author: ![bbrout](https://discourse.paraview.org/user_avatar/discourse.paraview.org/bbrout/32/9270_2.png) [@bbrout](https://discourse.paraview.org/u/bbrout)
#### Post date: [May 26, 2022, 9:02pm UTC](https://discourse.paraview.org/t/structured-grid-help/9693/2 "2022-05-26T21:02:54Z")

</div>

Bit of a correction. I had an error in producing points. Here is the beginning of the dataset:

# vtk DataFile Version 2.0

Sphere example  
ASCII  
DATASET STRUCTURED\_POINTS  
POINT\_DATA 5000 float  
0.000000 0.000000 1.000000  
0.062791 0.000000 0.998027  
0.125333 0.000000 0.992115  
0.187381 0.000000 0.982287

etc

---

<div class="post-metadata">

### Author: ![bbrout](https://discourse.paraview.org/user_avatar/discourse.paraview.org/bbrout/32/9270_2.png) [@bbrout](https://discourse.paraview.org/u/bbrout)
#### Post date: [May 26, 2022, 9:58pm UTC](https://discourse.paraview.org/t/structured-grid-help/9693/3 "2022-05-26T21:58:24Z")

</div>

I guess I should put in the error messages

Warning: In /builds/gitlab-kitware-sciviz-ci/build/superbuild/paraview/src/VTK/IO/Legacy/vtkStructuredPointsReader.cxx, line 282  
vtkStructuredPointsReader (0x184eef00): Not all meta data was read from the file.

Warning: In /builds/gitlab-kitware-sciviz-ci/build/superbuild/paraview/src/VTK/IO/Legacy/vtkStructuredPointsReader.cxx, line 282  
vtkStructuredPointsReader (0x17a1c730): Not all meta data was read from the file.

Warning: In /builds/gitlab-kitware-sciviz-ci/build/superbuild/paraview/src/VTK/IO/Legacy/vtkStructuredPointsReader.cxx, line 282  
vtkStructuredPointsReader (0x17a1c730): Not all meta data was read from the file.

ERROR: In /builds/gitlab-kitware-sciviz-ci/build/superbuild/paraview/src/VTK/IO/Legacy/vtkStructuredPointsReader.cxx, line 455  
vtkStructuredPointsReader (0x17a1c730): Number of points don’t match data values!

Warning: In /builds/gitlab-kitware-sciviz-ci/build/superbuild/paraview/src/VTK/IO/Legacy/vtkStructuredPointsReader.cxx, line 282  
vtkStructuredPointsReader (0x1a554840): Not all meta data was read from the file.

Warning: In /builds/gitlab-kitware-sciviz-ci/build/superbuild/paraview/src/VTK/IO/Legacy/vtkStructuredPointsReader.cxx, line 282  
vtkStructuredPointsReader (0x1a543d30): Not all meta data was read from the file.

Warning: In /builds/gitlab-kitware-sciviz-ci/build/superbuild/paraview/src/VTK/IO/Legacy/vtkStructuredPointsReader.cxx, line 282  
vtkStructuredPointsReader (0x1a543d30): Not all meta data was read from the file.

ERROR: In /builds/gitlab-kitware-sciviz-ci/build/superbuild/paraview/src/VTK/IO/Legacy/vtkStructuredPointsReader.cxx, line 455  
vtkStructuredPointsReader (0x1a543d30): Number of points don’t match data values!

---

<div class="post-metadata">

### Author: ![Christos\_Tsolakis](https://discourse.paraview.org/user_avatar/discourse.paraview.org/christos_tsolakis/32/4450_2.png) [@Christos\_Tsolakis](https://discourse.paraview.org/u/Christos_Tsolakis)
#### Post date: [May 27, 2022, 8:04pm UTC](https://discourse.paraview.org/t/structured-grid-help/9693/4 "2022-05-27T20:04:06Z")

</div>

`Structured Points` requires origin, spacing and dimension to be set for the point which will implicitly define the coordinates of the points. Check the file format documentation [https://kitware.github.io/vtk-examples/site/VTKFileFormats/#dataset-format](https://kitware.github.io/vtk-examples/site/VTKFileFormats/#dataset-format)

---

<div class="post-metadata">

### Author: ![bbrout](https://discourse.paraview.org/user_avatar/discourse.paraview.org/bbrout/32/9270_2.png) [@bbrout](https://discourse.paraview.org/u/bbrout)
#### Post date: [May 27, 2022, 9:49pm UTC](https://discourse.paraview.org/t/structured-grid-help/9693/5 "2022-05-27T21:49:04Z")

</div>

I have read the documentation, many times. I have put in the information as you and the documentation says. It doesn’t work.

The origin is 0 0 0

Dimensions nx ny nz are 5000 5000 5000

Did you read the error messages I posted?

---

<div class="post-metadata">

### Author: ![bbrout](https://discourse.paraview.org/user_avatar/discourse.paraview.org/bbrout/32/9270_2.png) [@bbrout](https://discourse.paraview.org/u/bbrout)
#### Post date: [May 27, 2022, 9:50pm UTC](https://discourse.paraview.org/t/structured-grid-help/9693/6 "2022-05-27T21:50:28Z")

</div>

Also, what is meant by spacing? That is not in the documentation. Is it the distance between coordinate points?

---

<div class="post-metadata">

### Author: ![bbrout](https://discourse.paraview.org/user_avatar/discourse.paraview.org/bbrout/32/9270_2.png) [@bbrout](https://discourse.paraview.org/u/bbrout)
#### Post date: [May 27, 2022, 9:53pm UTC](https://discourse.paraview.org/t/structured-grid-help/9693/7 "2022-05-27T21:53:18Z")

</div>

Also what do you mean by the point that will implicitly define the points?

Furthermore, thank you for your response and help. I am sincerely grateful.

---

<div class="post-metadata">

### Author: ![Christos\_Tsolakis](https://discourse.paraview.org/user_avatar/discourse.paraview.org/christos_tsolakis/32/4450_2.png) [@Christos\_Tsolakis](https://discourse.paraview.org/u/Christos_Tsolakis)
#### Post date: [May 31, 2022, 1:28pm UTC](https://discourse.paraview.org/t/structured-grid-help/9693/8 "2022-05-31T13:28:13Z")

</div>

> Also, what is meant by spacing? That is not in the documentation. Is it the distance between coordinate points?

Yes

> Also what do you mean by the point that will implicitly define the points?

I meant that origin, spacing and dimension will define implicitly the points.  
For example the file below defines a structured grid of `3*4*6 = 72` points, the first point is located at (0,0,0) the distance between the points at each direction is (1,1,1) so the points are :  
(0,0,0), (1,0,0),(2,0,0),  
(0,1,0), (1,1,0),(2,1,0), …

Finally, the list of values at the end defines the value at each point.

You may want to view the file in the `Spreadsheet View` in ParaView to explore the structure of the file better.

```auto
# vtk DataFile Version 3.0
Volume example
ASCII
DATASET STRUCTURED_POINTS
DIMENSIONS 3 4 6
SPACING 1 1 1
ORIGIN 0 0 0
POINT_DATA 72
SCALARS volume_scalars char 1
LOOKUP_TABLE default
0 0 0 0 0 0 0 0 0 0 0 0
0 5 10 15 20 25 25 20 15 10 5 0
0 10 20 30 40 50 50 40 30 20 10 0
0 10 20 30 40 50 50 40 30 20 10 0
0 5 10 15 20 25 25 20 15 10 5 0
0 0 0 0 0 0 0 0 0 0 0 

```

---

<div class="post-metadata">

### Author: ![wascott](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/w/8e8cbc/32.png) [@wascott](https://discourse.paraview.org/u/wascott)
#### Post date: [May 31, 2022, 9:04pm UTC](https://discourse.paraview.org/t/structured-grid-help/9693/9 "2022-05-31T21:04:56Z")

</div>

There is an example of a STRUCTURED\_POINTS dataset (and other structured datasets) in the ParaView’s included Examples. They are found with File/ Open/ Examples. Structured points is VTK/ legacy/ structuredVolume.vtk.

---

<div class="post-metadata">

### Author: ![bbrout](https://discourse.paraview.org/user_avatar/discourse.paraview.org/bbrout/32/9270_2.png) [@bbrout](https://discourse.paraview.org/u/bbrout)
#### Post date: [June 1, 2022, 1:07am UTC](https://discourse.paraview.org/t/structured-grid-help/9693/10 "2022-06-01T01:07:10Z")

</div>

This email didn’t go through from my email account. So I’m repeating it here.

Ohhhh, the origin is the location of the first point!!! It’s not the location of the origin of the coordinate system. That’s huge. Thank you!

Walter, the problem is not with the examples, it’s getting them to work. I’ll keep trying different approaches to see if I can get anything. I have found that structured just means a curvilinear coordinate system. Non-structured is non-curvilinear. It may be I should not be using structured points, so I will try others after trying suggestions from Christos. Thank you so much for your help.

---

<div class="post-metadata">

### Author: ![bbrout](https://discourse.paraview.org/user_avatar/discourse.paraview.org/bbrout/32/9270_2.png) [@bbrout](https://discourse.paraview.org/u/bbrout)
#### Post date: [June 1, 2022, 2:33am UTC](https://discourse.paraview.org/t/structured-grid-help/9693/11 "2022-06-01T02:33:19Z")

</div>

FINALLY!!!

You use a structured grid.  
r is constant =1.0  
theta is in 20 steps from 0 to 2\*pi  
phi is in 10 steps from 0 to pi

therefore:

DIMENSIONS 1 20 10  
POINTS 200 float  
put in the points here…

and voila!! BTW, make dtheta = 2 pi/(ntheta-1) and dphi = pi/(phi-1) and all will be well. It is all in the DIMENSIONS tab. I am going to change r to having varying values to create a stretched or convoluted spheroid, but I am on my way. There may be many values of r but I will keep the first DIMENSION to 1 and go from there. So, in reality, it is kind of already in spherical coordinates only DIMENSION is not what is nx ny nz but nr ntheta and nphi. Kewl.

Thanks a lot for your help. Now to put in stresses, etc.

---

<div class="post-metadata">

### Author: ![bbrout](https://discourse.paraview.org/user_avatar/discourse.paraview.org/bbrout/32/9270_2.png) [@bbrout](https://discourse.paraview.org/u/bbrout)
#### Post date: [June 1, 2022, 2:34am UTC](https://discourse.paraview.org/t/structured-grid-help/9693/12 "2022-06-01T02:34:09Z")

</div>

MASSIVE shout out to Libby for going the extra distance. She was a huge help.

---

<div class="post-metadata">

### Author: ![bbrout](https://discourse.paraview.org/user_avatar/discourse.paraview.org/bbrout/32/9270_2.png) [@bbrout](https://discourse.paraview.org/u/bbrout)
#### Post date: [June 1, 2022, 2:51am UTC](https://discourse.paraview.org/t/structured-grid-help/9693/13 "2022-06-01T02:51:17Z")

</div>

Posting this a second time to check my send email address is correct:

![](https://discourse.paraview.org/uploads/default/original/2X/9/9b4b232cd2d38200c29dd8cca4997fb539b92d34.jpeg)

### Bruce Rout \<[brucerout@gmail.com](mailto:brucerout@gmail.com)\>

8:33 PM (17 minutes ago)

![](https://discourse.paraview.org/uploads/default/original/2X/5/56d45f8a17f5078a20af9962c992ca4678450765.gif)  
 ![](https://discourse.paraview.org/uploads/default/original/2X/5/56d45f8a17f5078a20af9962c992ca4678450765.gif)

to **ParaView**  
 ![](https://discourse.paraview.org/uploads/default/original/2X/5/56d45f8a17f5078a20af9962c992ca4678450765.gif)

FINALLY!!!

Huge shout out to Libby for her help. It’s in the DIMENSIONS section. Basically, it’s kinda already in spherical coordinates. r is a constant so number of r measurements is 1, theta is 20 in this case and nphi is 10. So there are 200 points.

This works:

# vtk DataFile Version 2.0

Sphere example  
ASCII  
DATASET STRUCTURED\_GRID  
DIMENSIONS 1 20 10  
POINTS 200 float  
0.000000 0.000000 1.000000  
0.342020 0.000000 0.939693  
0.642788 0.000000 0.766044  
0.866025 0.000000 0.500000  
0.984808 0.000000 0.173648  
0.984808 0.000 …

I now need to toss in a lookup table to colour various points on the spherical surface. In the near future, r will have varying values as the sphere becomes convoluted. So I may be back with all these silly questions, or it may all work just fine. Thank you all for your help and for hanging in there with me.

For reference: theta goes from 0 to 2_pi and phi goes from 0 to pi. dtheta = 2_pi/(ntheta-1) and dphi = (nphi-1).

Once again, thanks for your patience with me and your guidance.

Yours,

Bruce

---

<div class="post-metadata">

### Author: ![bbrout](https://discourse.paraview.org/user_avatar/discourse.paraview.org/bbrout/32/9270_2.png) [@bbrout](https://discourse.paraview.org/u/bbrout)
#### Post date: [June 3, 2022, 2:08am UTC](https://discourse.paraview.org/t/structured-grid-help/9693/14 "2022-06-03T02:08:11Z")

</div>

Hi, I’m just staring out and have had some success. I have a nice picture of a sphere that rotates. I would like to throw a brick at it. Do I need a separate .vtk datafile for the brick, or is there a way to put both brick and sphere into the same .vtk legacy file? I am using STRUCTURED\_GRID for the sphere. I’d probably use the same for the brick. Unfortunately, I cannot find an answer in the documentation or user guide.

Thank you for your time and help.
