Code extracted from: git://xdmf.org/Xdmf.git at commit fb210b8cc8061a7001f679f35e870416261237e5 (master).