Coverage for src/beamme/core/element_volume.py: 100%

23 statements  

« prev     ^ index     » next       coverage.py v7.15.2, created at 2026-07-28 15:20 +0000

1# The MIT License (MIT) 

2# 

3# Copyright (c) 2018-2026 BeamMe Authors 

4# 

5# Permission is hereby granted, free of charge, to any person obtaining a copy 

6# of this software and associated documentation files (the "Software"), to deal 

7# in the Software without restriction, including without limitation the rights 

8# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 

9# copies of the Software, and to permit persons to whom the Software is 

10# furnished to do so, subject to the following conditions: 

11# 

12# The above copyright notice and this permission notice shall be included in 

13# all copies or substantial portions of the Software. 

14# 

15# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 

16# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 

17# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 

18# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 

19# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 

20# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 

21# THE SOFTWARE. 

22"""This file defines the base volume element.""" 

23 

24import pyvista as _pv 

25 

26from beamme.core.conf import bme as _bme 

27from beamme.core.element import Element as _Element 

28 

29 

30class VolumeElement(_Element): 

31 """A base class for a volume element.""" 

32 

33 # This class variables stores the information about the element shape in vtk. 

34 vtk_cell_type = None 

35 

36 # Type of this element. 

37 element_type = _bme.element_type.solid 

38 

39 def __init__(self, nodes=None, data={}, **kwargs): 

40 super().__init__(nodes=nodes, **kwargs) 

41 self.data = data 

42 

43 

44class VolumePoint(VolumeElement): 

45 """A point volume element, e.g., for spheres.""" 

46 

47 vtk_cell_type = _pv.CellType.VERTEX 

48 

49 

50class VolumeWEDGE6(VolumeElement): 

51 """A WEDGE6 volume element.""" 

52 

53 vtk_cell_type = _pv.CellType.WEDGE 

54 

55 

56class VolumeHEX8(VolumeElement): 

57 """A HEX8 volume element.""" 

58 

59 vtk_cell_type = _pv.CellType.HEXAHEDRON 

60 

61 

62class VolumeTET4(VolumeElement): 

63 """A TET4 volume element.""" 

64 

65 vtk_cell_type = _pv.CellType.TETRA 

66 

67 

68class VolumeTET10(VolumeElement): 

69 """A TET10 volume element.""" 

70 

71 vtk_cell_type = _pv.CellType.QUADRATIC_TETRA 

72 

73 

74class VolumeHEX20(VolumeElement): 

75 """A HEX20 volume element.""" 

76 

77 vtk_cell_type = _pv.CellType.QUADRATIC_HEXAHEDRON 

78 

79 

80class VolumeHEX27(VolumeElement): 

81 """A HEX27 volume element.""" 

82 

83 vtk_cell_type = _pv.CellType.TRIQUADRATIC_HEXAHEDRON