为.vtu文件添加属性的格式

huangapple go评论54阅读模式
英文:

Format for Adding an attribute to .vtu file

问题

我尝试向vtu文件添加一个属性,该属性是一个网格度量,对于网格中的每个三角形都是一个单一值,vtu文件包含以下标头的网格信息:

<VTKFile type="UnstructuredGrid" version="0.1" byte_order="LittleEndian">
	<UnstructuredGrid>
		<Piece NumberOfPoints="468" NumberOfCells="862">
    <Points>
    <DataArray NumberOfComponents="3" type="Float64"  Format="binary">
    *插入节点坐标*
    </DataArray>
    </Points>
    <Cells>
    <DataArray type="Int32" Name="connectivity" Format="binary">
    *插入连接信息*
    </DataArray>
    <DataArray type="Int32" Name="offsets" Format="binary">
    *插入偏移数据*
    </DataArray>
    <DataArray type="Int32" Name="types" Format="binary">
    </DataArray>
     ****这是我插入我的数组的地方
    <DataArray type="Float64" Name="meshmetric" Format="binary">
    *插入网格度量值*
    </DataArray>
    </Cells>
		</Piece>
	</UnstructuredGrid>
</VTKFile>

我在后面添加了我的网格度量数组,但当我在Paraview中加载文件时它不会出现,可能是因为我没有正确放置数组,也可能是因为我不知道如何在Paraview中查看它,或者我需要更改/添加数组中的网格信息<offset><type>

我没有使用Python。

英文:

I am trying to add an attribute to a vtu file, the attribute being a mesh metric which is a single value for each triangle in my mesh, the vtu file containing mesh information with the following headers:

&lt;VTKFile type=&quot;UnstructuredGrid&quot; version=&quot;0.1&quot; byte_order=&quot;LittleEndian&quot;&gt;
	&lt;UnstructuredGrid&gt;
		&lt;Piece NumberOfPoints=&quot;468&quot; NumberOfCells=&quot;862&quot;&gt;
    &lt;Points&gt;
    &lt;DataArray NumberOfComponents=&quot;3&quot; type=&quot;Float64&quot;  Format=&quot;binary&quot;&gt;
    *insert nodes coordinates*
    &lt;/DataArray&gt;
    &lt;/Points&gt;
    &lt;Cells&gt;
    &lt;DataArray type=&quot;Int32&quot; Name=&quot;connectivity&quot; Format=&quot;binary&quot;&gt;
    *insert connectivity info*
    &lt;/DataArray&gt;
    &lt;DataArray type=&quot;Int32&quot; Name=&quot;offsets&quot; Format=&quot;binary&quot;&gt;
    * insert offset data*
    &lt;/DataArray&gt;
    &lt;DataArray type=&quot;Int32&quot; Name=&quot;types&quot; Format=&quot;binary&quot;&gt;
    &lt;/DataArray&gt;
     ****This is where I inserted my array
    &lt;DataArray type=&quot;Float64&quot; Name=&quot;meshmetric&quot; Format=&quot;binary&quot;&gt;
    *insert mesh metric values*
    &lt;/DataArray&gt;
    &lt;/Cells&gt;
		&lt;/Piece&gt;
	&lt;/UnstructuredGrid&gt;
&lt;/VTKFile&gt;

I added my mesh metric array after <types> but it doesn't appear when I load the file to paraview, it could be I didn't place the array correctly b) I didn't know how to view it on paraview. c) I need to change/ add an information to the mesh information in the array &lt;offset&gt; or &lt;type&gt;
I am not using python

答案1

得分: 1

Your meshmetric <DataArray> tag is not inside the correct tag.

<Cells> is here to define the cells themselves. The associated data should be under a <CellData> tag, itself being a sibling of <Cells>. So

<Cells> ... </Cells>
<CellData>
    <DataArray name='meshmetric'>
     ...
    </DataArray>
</CellData>

Some doc is here

英文:

Your meshmetric &lt;DataArray&gt; tag is not inside the correct tag.

&lt;Cells&gt; is here to define the cells themselves. The associated data should be under a &lt;CellData&gt; tag, itself being a sibling of &lt;Cells&gt;. So

&lt;Cells&gt; ... &lt;/Cells&gt;
&lt;CellData&gt;
    &lt;DataArray name=&#39;meshmetric&#39;&gt;
     ...
    &lt;/DataArray&gt;
&lt;/CellData&gt;

Some doc is here

huangapple
  • 本文由 发表于 2023年2月19日 15:09:01
  • 转载请务必保留本文链接:https://go.coder-hub.com/75498530.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定