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