Skip to content

Commit

Permalink
Reordering 2nd order symmetric tensor XDMF output
Browse files Browse the repository at this point in the history
here we REORDER uw's 3D 2nd-order symmetric tensor to match XDMF's Tensor6 order
In UW our order is   - (00, 11, 22, 01, 02, 12)
In XDMF the order is - (00, 01, 02, 11, 12, 22)
  • Loading branch information
julesghub committed Mar 23, 2017
1 parent 65de748 commit 2910b34
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion underworld/utils/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,18 @@ def _xdmfAttributeschema( varname, variableType, centering, globalcount, dof_cou
out += "\t\t\t<DataItem Format=\"HDF\" {0} Dimensions=\"{1} {2}\">{3}:/data</DataItem>\n".format(variableType, globalcount, dof_count, datafile )
out += "\t</Attribute>\n"
elif dof_count==6:
# here we REORDER uw's 3D 2nd-order symmetric tensor to match XDMF's Tensor6 order
# In UW our order is - (00, 11, 22, 01, 02, 12)
# In XDMF the order is - (00, 01, 02, 11, 12, 22)

out = "\t<Attribute Type=\"Tensor6\" Center=\"{0}\" Name=\"{1}\">\n".format(centering, varname)
out += "\t\t\t<DataItem Format=\"HDF\" {0} Dimensions=\"{1} {2}\">{3}:/data</DataItem>\n".format(variableType, globalcount, dof_count, datafile )
out += "\t<DataItem ItemType=\"Function\" Dimensions=\"{0} 6\" Function=\"JOIN($0, $3, $4, $1, $5, $2)\">\n".format(globalcount)
for d_i in xrange(dof_count):
out += "\t\t<DataItem ItemType=\"HyperSlab\" Dimensions=\"{0} 1\" Name=\"x{1}\">\n".format(globalcount, d_i)
out += "\t\t\t<DataItem Dimensions=\"3 2\" Format=\"XML\"> 0 {0} 1 1 {1} 1 </DataItem>\n".format(d_i, globalcount)
out += "\t\t\t<DataItem Format=\"HDF\" Dimensions=\"{0} 1\">{1}:/data</DataItem>\n".format(globalcount, datafile )
out += "\t\t</DataItem>\n"
out += "\t</DataItem>\n"
out += "\t</Attribute>\n"
elif dof_count==9:
out = "\t<Attribute Type=\"Tensor\" Center=\"{0}\" Name=\"{1}\">\n".format(centering, varname)
Expand Down

2 comments on commit 2910b34

@jmansour
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@julesghub, what happens in 2d?

@julesghub
Copy link
Member Author

@julesghub julesghub commented on 2910b34 Mar 23, 2017 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.