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

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

Format for Adding an attribute to .vtu file

问题

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

  1. <VTKFile type="UnstructuredGrid" version="0.1" byte_order="LittleEndian">
  2. <UnstructuredGrid>
  3. <Piece NumberOfPoints="468" NumberOfCells="862">
  4. <Points>
  5. <DataArray NumberOfComponents="3" type="Float64" Format="binary">
  6. *插入节点坐标*
  7. </DataArray>
  8. </Points>
  9. <Cells>
  10. <DataArray type="Int32" Name="connectivity" Format="binary">
  11. *插入连接信息*
  12. </DataArray>
  13. <DataArray type="Int32" Name="offsets" Format="binary">
  14. *插入偏移数据*
  15. </DataArray>
  16. <DataArray type="Int32" Name="types" Format="binary">
  17. </DataArray>
  18. ****这是我插入我的数组的地方
  19. <DataArray type="Float64" Name="meshmetric" Format="binary">
  20. *插入网格度量值*
  21. </DataArray>
  22. </Cells>
  23. </Piece>
  24. </UnstructuredGrid>
  25. </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:

  1. &lt;VTKFile type=&quot;UnstructuredGrid&quot; version=&quot;0.1&quot; byte_order=&quot;LittleEndian&quot;&gt;
  2. &lt;UnstructuredGrid&gt;
  3. &lt;Piece NumberOfPoints=&quot;468&quot; NumberOfCells=&quot;862&quot;&gt;
  4. &lt;Points&gt;
  5. &lt;DataArray NumberOfComponents=&quot;3&quot; type=&quot;Float64&quot; Format=&quot;binary&quot;&gt;
  6. *insert nodes coordinates*
  7. &lt;/DataArray&gt;
  8. &lt;/Points&gt;
  9. &lt;Cells&gt;
  10. &lt;DataArray type=&quot;Int32&quot; Name=&quot;connectivity&quot; Format=&quot;binary&quot;&gt;
  11. *insert connectivity info*
  12. &lt;/DataArray&gt;
  13. &lt;DataArray type=&quot;Int32&quot; Name=&quot;offsets&quot; Format=&quot;binary&quot;&gt;
  14. * insert offset data*
  15. &lt;/DataArray&gt;
  16. &lt;DataArray type=&quot;Int32&quot; Name=&quot;types&quot; Format=&quot;binary&quot;&gt;
  17. &lt;/DataArray&gt;
  18. ****This is where I inserted my array
  19. &lt;DataArray type=&quot;Float64&quot; Name=&quot;meshmetric&quot; Format=&quot;binary&quot;&gt;
  20. *insert mesh metric values*
  21. &lt;/DataArray&gt;
  22. &lt;/Cells&gt;
  23. &lt;/Piece&gt;
  24. &lt;/UnstructuredGrid&gt;
  25. &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

  1. <Cells> ... </Cells>
  2. <CellData>
  3. <DataArray name='meshmetric'>
  4. ...
  5. </DataArray>
  6. </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

  1. &lt;Cells&gt; ... &lt;/Cells&gt;
  2. &lt;CellData&gt;
  3. &lt;DataArray name=&#39;meshmetric&#39;&gt;
  4. ...
  5. &lt;/DataArray&gt;
  6. &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:

确定