Source code for Muscat.IO.XdmfTools

# -*- coding: utf-8 -*-
#
# This file is subject to the terms and conditions defined in
# file 'LICENSE.txt', which is part of this source code package.
#

"""Xdmf tools
"""

import Muscat.Containers.ElementsDescription as ED

XdmfName = {}
XdmfName[ED.Point_1] = "Polyvertex"
XdmfName[ED.Bar_2] = "Polyline"
XdmfName[ED.Triangle_3] = "Triangle"
XdmfName[ED.Quadrangle_4] = "Quadrilateral"
XdmfName[ED.Tetrahedron_4] = "Tetrahedron"
XdmfName[ED.Pyramid_5] = "Pyramid"
XdmfName[ED.Wedge_6] = "Wedge"
XdmfName[ED.Hexahedron_8] = "Hexahedron"


XdmfName[ED.Bar_3] = "Edge_3"
XdmfName[ED.Triangle_6] = "Triangle_6"
XdmfName[ED.Quadrangle_9] = "Quadrilateral_9"
XdmfName[ED.Quadrangle_8] = "Quadrilateral_8"
XdmfName[ED.Tetrahedron_10] = "Tetrahedron_10"
XdmfName[ED.Pyramid_13] = "Pyramid_13"
XdmfName[ED.Wedge_15] = "Wedge_15"
XdmfName[ED.Wedge_18] = "Wedge_18"
XdmfName[ED.Hexahedron_20] = "Hexahedron_20"
XdmfName[ED.Hexahedron_27] = "Hexahedron_27"

XdmfNumber = {}
XdmfNumber[ED.Point_1] = 0x1
XdmfNumber[ED.Bar_2] = 0x2
XdmfNumber[ED.Triangle_3] = 0x4
XdmfNumber[ED.Quadrangle_4] = 0x5
XdmfNumber[ED.Tetrahedron_4] = 0x6
XdmfNumber[ED.Pyramid_5] = 0x7
XdmfNumber[ED.Wedge_6] = 0x8
XdmfNumber[ED.Hexahedron_8] = 0x9

XdmfNumber[ED.Bar_3] = 0x22
XdmfNumber[ED.Triangle_6] = 0x24
XdmfNumber[ED.Quadrangle_9] = 0x23
XdmfNumber[ED.Quadrangle_8] = 0x25
XdmfNumber[ED.Tetrahedron_10] = 0x26
XdmfNumber[ED.Pyramid_13] = 0x27
XdmfNumber[ED.Wedge_15] = 0x28
XdmfNumber[ED.Wedge_18] = 0x29
XdmfNumber[ED.Hexahedron_20] = 0x30
XdmfNumber[ED.Hexahedron_27] = 0x32

XdmfNumberToEN = {v: k for k, v in XdmfNumber.items()}
XdmfNameToEN = {v: k for k, v in XdmfName.items()}


[docs]class FieldNotFound(ValueError): """Exception to treat Field Not found""" def __init__(self, value): self.value = 'Field "' + value + '" not found, Sorry!!' def __str__(self): return repr(self.value) # pragma: no cover
[docs]def HasHdf5Support(): try: import h5py return True except: # pragma: no cover return False
[docs]def CheckIntegrity(): FieldNotFound("toto") return "OK"
if __name__ == "__main__": print(CheckIntegrity()) # pragma: no cover