XML Structured Grid形式は、VTK Structured Grid形式に相当するフォーマットである。例として、2*4*5要素の単位立方体を生成するサンプルデータを示す。
<VTKFile type="StructuredGrid" version="0.1" byte_order="LittleEndian"> <StructuredGrid WholeExtent="0 2 0 4 0 5"> <Piece Extent="0 2 0 4 0 5"> <PointData> </PointData> <CellData> </CellData> <Points> <DataArray type="Float32" Name="Points" NumberOfComponents="3" format="ascii" RangeMin="0" RangeMax="1.7320508076"> 0.0 0.0 0.0 0.5 0.0 0.0 1.0 0.0 0.0 0.0 0.25 0.0 0.5 0.25 0.0 1.0 0.25 0.0 0.0 0.5 0.0 0.5 0.5 0.0 1.0 0.5 0.0 0.0 0.75 0.0 0.5 0.75 0.0 1.0 0.75 0.0 0.0 1.0 0.0 0.5 1.0 0.0 1.0 1.0 0.0 0.0 0.0 0.2 0.5 0.0 0.2 1.0 0.0 0.2 0.0 0.25 0.2 0.5 0.25 0.2 1.0 0.25 0.2 0.0 0.5 0.2 0.5 0.5 0.2 1.0 0.5 0.2 0.0 0.75 0.2 0.5 0.75 0.2 1.0 0.75 0.2 0.0 1.0 0.2 0.5 1.0 0.2 1.0 1.0 0.2 0.0 0.0 0.4 0.5 0.0 0.4 1.0 0.0 0.4 0.0 0.25 0.4 0.5 0.25 0.4 1.0 0.25 0.4 0.0 0.5 0.4 0.5 0.5 0.4 1.0 0.5 0.4 0.0 0.75 0.4 0.5 0.75 0.4 1.0 0.75 0.4 0.0 1.0 0.4 0.5 1.0 0.4 1.0 1.0 0.4 0.0 0.0 0.6 0.5 0.0 0.6 1.0 0.0 0.6 0.0 0.25 0.6 0.5 0.25 0.6 1.0 0.25 0.6 0.0 0.5 0.6 0.5 0.5 0.6 1.0 0.5 0.6 0.0 0.75 0.6 0.5 0.75 0.6 1.0 0.75 0.6 0.0 1.0 0.6 0.5 1.0 0.6 1.0 1.0 0.6 0.0 0.0 0.8 0.5 0.0 0.8 1.0 0.0 0.8 0.0 0.25 0.8 0.5 0.25 0.8 1.0 0.25 0.8 0.0 0.5 0.8 0.5 0.5 0.8 1.0 0.5 0.8 0.0 0.75 0.8 0.5 0.75 0.8 1.0 0.75 0.8 0.0 1.0 0.8 0.5 1.0 0.8 1.0 1.0 0.8 0.0 0.0 1.0 0.5 0.0 1.0 1.0 0.0 1.0 0.0 0.25 1.0 0.5 0.25 1.0 1.0 0.25 1.0 0.0 0.5 1.0 0.5 0.5 1.0 1.0 0.5 1.0 0.0 0.75 1.0 0.5 0.75 1.0 1.0 0.75 1.0 0.0 1.0 1.0 0.5 1.0 1.0 1.0 1.0 1.0 </DataArray> </Points> </Piece> </StructuredGrid> </VTKFile>
VTKFileエレメントのtype属性に、データセット名を指定する。version属性およびbyte_order属性は固定値である。
StructuredGridエレメントには、WholeExtent属性を指定する。WholeExtent属性はx、y、z各方向の節点数であり、要素数でないことに注意が必要である。
同様に、PieceエレメントのExtent属性にも節点数を指定する。
Pointsエレメント内のDataArrayエレメントには、各節点の座標値をx、y、zの順番に指定する。
コメントを残す