英文:
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>
我在<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:
<VTKFile type="UnstructuredGrid" version="0.1" byte_order="LittleEndian">
	<UnstructuredGrid>
		<Piece NumberOfPoints="468" NumberOfCells="862">
    <Points>
    <DataArray NumberOfComponents="3" type="Float64"  Format="binary">
    *insert nodes coordinates*
    </DataArray>
    </Points>
    <Cells>
    <DataArray type="Int32" Name="connectivity" Format="binary">
    *insert connectivity info*
    </DataArray>
    <DataArray type="Int32" Name="offsets" Format="binary">
    * insert offset data*
    </DataArray>
    <DataArray type="Int32" Name="types" Format="binary">
    </DataArray>
     ****This is where I inserted my array
    <DataArray type="Float64" Name="meshmetric" Format="binary">
    *insert mesh metric values*
    </DataArray>
    </Cells>
		</Piece>
	</UnstructuredGrid>
</VTKFile>
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 <offset> or <type>
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 <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
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。


评论