# xml format: constant data array possible?

**URL:** https://discourse.paraview.org/t/xml-format-constant-data-array-possible/7510
**Category:** Development
**Created:** [June 29, 2021, 12:35pm UTC](https://discourse.paraview.org/t/xml-format-constant-data-array-possible/7510 "2021-06-29T12:35:23Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![lens](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/l/13edae/32.png) [@lens](https://discourse.paraview.org/u/lens)
#### Post date: [June 29, 2021, 12:35pm UTC](https://discourse.paraview.org/t/xml-format-constant-data-array-possible/7510/1 "2021-06-29T12:35:23Z")

</div>

Hello there,  
using the ParaView xml format, is it possible to declare a data array as constant/uniform (i.e. all cells get the same value(s))?  
What I want is to only write something like

```auto
<DataArray type="Float64" format="ascii" Name="WaterDepth" NumberOfComponents="1" isUniform="true">1.0</DataArray>

```

or, for `"NumberOfComponents"` != 1:

```auto
<DataArray type="Float64" format="ascii" Name="Velocity" NumberOfComponents="2" isUniform="true">2.0 1.0</DataArray>

```

and then for ParaView to broadcast those values to all cells. So far, I’ve found nothing in the documentation that makes it look possible, but here’s hoping I’m wrong 🙂

---

<div class="post-metadata">

### Author: ![Kenichiro-Yoshimi](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/k/ecc23a/32.png) [@Kenichiro-Yoshimi](https://discourse.paraview.org/u/Kenichiro-Yoshimi)
#### Post date: [July 4, 2021, 1:21am UTC](https://discourse.paraview.org/t/xml-format-constant-data-array-possible/7510/2 "2021-07-04T01:21:21Z")

</div>

Hello,

This is not a direct answer to broadcasting a certain value to all cells as Cell Data, but there is a way to use Field Data to have a common value in all cells.

```xml
    <FieldData>
      <DataArray type="Float64" Name="TimeValue" NumberOfTuples="1" format="ascii" RangeMin="1" RangeMax="1">
        1
      </DataArray>
    </FieldData>

```

---

<div class="post-metadata">

### Author: ![lens](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/l/13edae/32.png) [@lens](https://discourse.paraview.org/u/lens)
#### Post date: [July 16, 2021, 1:09pm UTC](https://discourse.paraview.org/t/xml-format-constant-data-array-possible/7510/3 "2021-07-16T13:09:22Z")

</div>

Hey, thank you for your reply, but I have trouble getting it to work. Can you give me an example that paraview can read? Here’s what I tried, as a template:

```auto
<?xml version="1.0" standalone="yes"?>
<VTKFile version="0.1" byte_order="LittleEndian" type="ImageData">
    <ImageData WholeExtent="0 2 0 2 0 0" Origin="0 0 0" Spacing="1 1 0">
        <Piece Extent="0 2 0 2 0 0">
        	<FieldData>
      			<DataArray type="Float64" Name="TimeValue" NumberOfTuples="1" format="ascii" RangeMin="1" RangeMax="1">1</DataArray>
			</FieldData>
        </Piece>
    </ImageData>
</VTKFile>

```

I also tried adding a cell data node, but I didn’t find any variation with which paraview would display anything except errors or segfaults.

---

<div class="post-metadata">

### Author: ![Kenichiro-Yoshimi](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/k/ecc23a/32.png) [@Kenichiro-Yoshimi](https://discourse.paraview.org/u/Kenichiro-Yoshimi)
#### Post date: [July 16, 2021, 3:53pm UTC](https://discourse.paraview.org/t/xml-format-constant-data-array-possible/7510/4 "2021-07-16T15:53:24Z")

</div>

In the case of 2D image data, when it is loaded, the **Slice** representation is initially used, and since the **Slice** representation might not support the display of FieldData, ParaView would terminate abnormally. Therefore, for 2D image data, it is necessary to have a **Scalar** for PointData or CellData in addition to FieldData, as shown below.

```xml
<?xml version="1.0" standalone="yes"?>
<VTKFile type="ImageData" version="1.0" byte_order="LittleEndian" header_type="UInt64">
  <ImageData WholeExtent="0 2 0 2 0 0" Origin="0 0 0" Spacing="1 1 0">
  <FieldData>
    <DataArray type="Float64" Name="TimeValue" NumberOfTuples="1" format="ascii" RangeMin="1" RangeMax="1">
      1
    </DataArray>
  </FieldData>
  <Piece Extent="0 2 0 2 0 0">
    <PointData Scalars="Iterations">
      <DataArray type="Float32" Name="Iterations" format="ascii" RangeMin="1.8648648262023926" RangeMax="100">
        1.8648648262023926 3.1184606552124023 2.243407726287842 100 100 3.518594980239868
        1.8648648262023926 3.1184606552124023 2.243407726287842
      </DataArray>
    </PointData>
    <CellData>
    </CellData>
  </Piece>
  </ImageData>
</VTKFile>

```

Again, please note that the **Slice** expression is not used when drawing FieldData in a 2D image.

 ![display_field_data](https://discourse.paraview.org/uploads/default/original/2X/d/d4a8a53a201fc17d568bc9db423982f52d6ee24e.png)
