xml format: constant data array possible?

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

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

or, for "NumberOfComponents" != 1:

<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 :slight_smile:

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.

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

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:

<?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.

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 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.