Source code for Muscat.Containers.ElementsDescription

# -*- 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.
#

# If this file is modified a compilation must executed to export this data
# to the cpp portion of Muscat
from __future__ import annotations
from typing import Dict, Tuple, List, Union
from enum import Enum, unique
from functools import total_ordering


import numpy as np

from Muscat.Types import MuscatIndex


[docs]class GeoSupport(): """Class to store basic information about the geometrical support. This class in not intender for end user. """ def __init__(self, data: Tuple[str, int]) -> None: super().__init__() self.name = data[0] self.dimensionality = data[1] def __rep__(self) -> str: res = "GeoSupport( " + self.name + ")" return res def __str__(self) -> str: return self.__rep__() def __eq__(self, other: object) -> bool: """Overrides the default implementation""" if isinstance(other, GeoSupport): return self.name == other.name return False def __hash__(self) -> int: return id(self.name)
GeoPoint = GeoSupport(("point", 0)) # 0 """Point geometrical support : name point, dimensionality = 0""" GeoBar = GeoSupport(("bar", 1)) # 1 """Bar geometrical support : name bar, dimensionality = 1""" GeoTri = GeoSupport(("tri", 2)) # 2 """Triangle geometrical support : name tri, dimensionality = 2""" GeoQuad = GeoSupport(("quad", 2)) # 3 """Quadrangle geometrical support : name quad, dimensionality = 2""" GeoTet = GeoSupport(("tet", 3)) # 4 """Tetrahedral geometrical support : name tet, dimensionality = 3""" GeoPyr = GeoSupport(("pyr", 3)) # 5 """Pyramidal (square base) geometrical support : name pyr, dimensionality = 3""" GeoWed = GeoSupport(("wed", 3)) # 6 """Wedge geometrical support : name wed, dimensionality = 3""" GeoHex = GeoSupport(("hex", 3)) # 7 """Hexahedral geometrical support : name hex, dimensionality = 3"""
[docs]class ElementDescription(): """Class to store information about the different type of elements. """ def __init__(self, name, geoSupport): self.name = name """Element Name """ self.geoSupport = geoSupport """ the geometrical support of this element """ self.dimension: int = geoSupport.dimensionality """Dimensionality 0,1,2,3 """ self.numberOfNodes = 0 """number of nodes of this elements""" self.linear: bool = True """ true if the the jacobian matrix is constant in the element""" self.degree: int = 1 """ the higher degree of the polynomial """ self.facesL1: List[Tuple[str, np.ndarray]] = [] """First level faces. (triangles for a tetra for example) A list containing a tuples of the elements name and the local connectivity """ self.facesL2: List[Tuple[str, np.ndarray]] = [] """Second level faces. (bars for a tetra for example) A list containing a tuples of the elements name and the local connectivity """ self.facesL3: List[Tuple[str, np.ndarray]] = [] """third level faces. (points for a tetra for example) A list containing a tuples of the elements name and the local connectivity """ self.mirrorPermutation: np.ndarray = [] """Permutation of index to make a valid element again after a mirror operation"""
ElementsInfo: Dict[str, ElementDescription] = {}
[docs]@total_ordering class ElementType(Enum): Point_1: str = 'point1' Bar_2: str = 'bar2' Bar_3: str = 'bar3' Triangle_3: str = 'tri3' Triangle_6: str = 'tri6' Quadrangle_4: str = 'quad4' Quadrangle_8: str = 'quad8' Quadrangle_9: str = 'quad9' Tetrahedron_4: str = 'tet4' Tetrahedron_10: str = 'tet10' Pyramid_5: str = 'pyr5' Pyramid_13: str = 'pyr13' Pyramid_14: str = 'pyr14' Wedge_6: str = 'wed6' Wedge_15: str = 'wed15' Wedge_18: str = 'wed18' Hexahedron_8: str = 'hex8' Hexahedron_20: str = 'hex20' Hexahedron_27: str = 'hex27' def __lt__(self, obj: ElementType): if isinstance(obj, str): return self.value < obj return self.value < obj.value def __eq__(self, other: object) -> bool: if isinstance(other, str): return self.value == other return super().__eq__(other) def __hash__(self): return hash(self.value)
[docs] def encode(self) -> bytes: return self.value.encode()
def __str__(self) -> str: return self.value
ElementTypeLike= Union[str,ElementType] Point_1 = ElementType.Point_1 Bar_2 = ElementType.Bar_2 Bar_3 = ElementType.Bar_3 Triangle_3 = ElementType.Triangle_3 Quadrangle_4 = ElementType.Quadrangle_4 Triangle_6 = ElementType.Triangle_6 Quadrangle_8 = ElementType.Quadrangle_8 Quadrangle_9 = ElementType.Quadrangle_9 Tetrahedron_4 = ElementType.Tetrahedron_4 Tetrahedron_10 = ElementType.Tetrahedron_10 Pyramid_5 = ElementType.Pyramid_5 Pyramid_13 = ElementType.Pyramid_13 Pyramid_14 = ElementType.Pyramid_14 Wedge_6 = ElementType.Wedge_6 Wedge_15 = ElementType.Wedge_15 Wedge_18 = ElementType.Wedge_18 Hexahedron_8 = ElementType.Hexahedron_8 Hexahedron_20 = ElementType.Hexahedron_20 Hexahedron_27 = ElementType.Hexahedron_27 # allElementTypes = Union[ElementType.Point_1, ElementType.Bar_2] ###### the rest is only data ############################################################# numberOfNodes = {} # type: Dict[ElementType, int] mirrorPermutation = {} # type: Dict[ElementType, List[int]] dimensionality = {} # type: Dict[ElementType, int] linear = {} # type: Dict[ElementType, bool] degree = {} # type: Dict[ElementType, int] faces1 = {} # type: Dict[ElementType, List[Tuple[str, List[int] ]] ] faces2 = {} # type: Dict[ElementType, List[Tuple[str, List[int] ]] ] faces3 = {} # type: Dict[ElementType, List[Tuple[str, List[int] ]] ] geoSupport = {} # type: Dict[ElementType, GeoSupport] # 0D geoSupport[Point_1] = GeoPoint numberOfNodes[Point_1] = 1 mirrorPermutation[Point_1] = [0] dimensionality[Point_1] = geoSupport[Point_1].dimensionality linear[Point_1] = True degree[Point_1] = 0 faces1[Point_1] = [] faces2[Point_1] = [] faces3[Point_1] = [] # 1D # linear geoSupport[Bar_2] = GeoBar numberOfNodes[Bar_2] = 2 mirrorPermutation[Bar_2] = [1, 0] dimensionality[Bar_2] = 1 linear[Bar_2] = True degree[Bar_2] = 1 faces1[Bar_2] = [(Point_1, [0]), (Point_1, [1])] faces2[Bar_2] = [] faces3[Bar_2] = [] # quadratic geoSupport[Bar_3] = GeoBar numberOfNodes[Bar_3] = 3 mirrorPermutation[Bar_3] = [1, 0, 2] dimensionality[Bar_3] = 1 linear[Bar_3] = False degree[Bar_3] = 2 faces1[Bar_3] = [(Point_1, [0]), (Point_1, [1])] faces2[Bar_3] = [] faces3[Bar_3] = [] # 2D # linear geoSupport[Triangle_3] = GeoTri numberOfNodes[Triangle_3] = 3 mirrorPermutation[Triangle_3] = [0, 2, 1] dimensionality[Triangle_3] = 2 linear[Triangle_3] = True degree[Triangle_3] = 1 faces1[Triangle_3] = [(Bar_2, [0, 1]), (Bar_2, [1, 2]), (Bar_2, [2, 0])] faces2[Triangle_3] = [(Point_1, [0]), (Point_1, [1]), (Point_1, [2])] faces3[Triangle_3] = [] # non linear geoSupport[Quadrangle_4] = GeoQuad numberOfNodes[Quadrangle_4] = 4 mirrorPermutation[Quadrangle_4] = [1, 0, 3, 2] dimensionality[Quadrangle_4] = 2 linear[Quadrangle_4] = False degree[Quadrangle_4] = 1 faces1[Quadrangle_4] = [(Bar_2, [0, 1]), (Bar_2, [1, 2]), (Bar_2, [2, 3]), (Bar_2, [3, 0])] faces2[Quadrangle_4] = [(Point_1, [0]), (Point_1, [1]), (Point_1, [2]), (Point_1, [3])] faces3[Quadrangle_4] = [] # quadratic geoSupport[Triangle_6] = GeoTri numberOfNodes[Triangle_6] = 6 mirrorPermutation[Triangle_6] = [0, 2, 1, 5, 4, 3] dimensionality[Triangle_6] = 2 linear[Triangle_6] = False degree[Triangle_6] = 2 faces1[Triangle_6] = [(Bar_3, [0, 1, 3]), (Bar_3, [1, 2, 4]), (Bar_3, [2, 0, 5])] faces2[Triangle_6] = [(Point_1, [0]), (Point_1, [1]), (Point_1, [2])] faces3[Triangle_6] = [] geoSupport[Quadrangle_8] = GeoQuad numberOfNodes[Quadrangle_8] = 8 mirrorPermutation[Quadrangle_8] = [0, 3, 2, 1, 7, 6, 5, 4] dimensionality[Quadrangle_8] = 2 linear[Quadrangle_8] = False degree[Quadrangle_8] = 2 faces1[Quadrangle_8] = [(Bar_3, [0, 1, 4]), (Bar_3, [1, 2, 5]), (Bar_3, [2, 3, 6]), (Bar_3, [3, 0, 7])] faces2[Quadrangle_8] = [(Point_1, [0]), (Point_1, [1]), (Point_1, [2]), (Point_1, [3])] faces3[Quadrangle_8] = [] geoSupport[Quadrangle_9] = GeoQuad numberOfNodes[Quadrangle_9] = 9 mirrorPermutation[Quadrangle_9] = [0, 3, 2, 1, 7, 6, 5, 4, 8] dimensionality[Quadrangle_9] = 2 linear[Quadrangle_9] = False degree[Quadrangle_9] = 2 faces1[Quadrangle_9] = [(Bar_3, [0, 1, 4]), (Bar_3, [1, 2, 5]), (Bar_3, [2, 3, 6]), (Bar_3, [3, 0, 7])] faces2[Quadrangle_9] = [(Point_1, [0]), (Point_1, [1]), (Point_1, [2]), (Point_1, [3])] faces3[Quadrangle_9] = [] # 3D # linear geoSupport[Tetrahedron_4] = GeoTet numberOfNodes[Tetrahedron_4] = 4 mirrorPermutation[Tetrahedron_4] = [0, 2, 1, 3] dimensionality[Tetrahedron_4] = 3 linear[Tetrahedron_4] = True degree[Tetrahedron_4] = 1 faces1[Tetrahedron_4] = [(Triangle_3, [0, 2, 1]), (Triangle_3, [0, 1, 3]), (Triangle_3, [1, 2, 3]), (Triangle_3, [2, 0, 3])] faces2[Tetrahedron_4] = [(Bar_2, [0, 1]), (Bar_2, [1, 2]), (Bar_2, [2, 0]), (Bar_2, [0, 3]), (Bar_2, [1, 3]), (Bar_2, [2, 3])] faces3[Tetrahedron_4] = [(Point_1, [0]), (Point_1, [1]), (Point_1, [2]), (Point_1, [3])] # non linear geoSupport[Pyramid_5] = GeoPyr numberOfNodes[Pyramid_5] = 5 mirrorPermutation[Pyramid_5] = [0, 3, 2, 1, 4] dimensionality[Pyramid_5] = 3 linear[Pyramid_5] = False degree[Pyramid_5] = 1 faces1[Pyramid_5] = [(Quadrangle_4, [0, 3, 2, 1]), (Triangle_3, [0, 1, 4]), (Triangle_3, [1, 2, 4]), (Triangle_3, [2, 3, 4]), (Triangle_3, [3, 0, 4])] faces2[Pyramid_5] = [(Bar_2, [0, 1]), (Bar_2, [1, 2]), (Bar_2, [2, 3]), (Bar_2, [3, 0]), (Bar_2, [0, 4]), (Bar_2, [1, 4]), (Bar_2, [2, 4]), (Bar_2, [3, 4])] faces3[Pyramid_5] = [(Point_1, [0]), (Point_1, [1]), (Point_1, [2]), (Point_1, [3]), (Point_1, [4])] # Attention: the order of the nodes of the wedge are # the base in the same order as the triangle (right hand rule pointing in the Z direction) # the top in the same order of the base. The vtk documentation shows some inconsistency. # # base top # # 2 5 # Y|\ Y|\ # | \ | \ # | \ | \ # | \ | \ # |____\ |____\ # 0 X 1 3 X 4 # # z = 0 z = 1 # geoSupport[Wedge_6] = GeoWed numberOfNodes[Wedge_6] = 6 mirrorPermutation[Wedge_6] = [0, 2, 1, 3, 5, 4] dimensionality[Wedge_6] = 3 linear[Wedge_6] = False degree[Wedge_6] = 1 faces1[Wedge_6] = [(Triangle_3, [0, 2, 1]), (Triangle_3, [3, 4, 5]), (Quadrangle_4, [0, 1, 4, 3]), (Quadrangle_4, [1, 2, 5, 4]), (Quadrangle_4, [0, 3, 5, 2])] faces2[Wedge_6] = [(Bar_2, [0, 1]), (Bar_2, [1, 2]), (Bar_2, [2, 0]), (Bar_2, [0, 3]), (Bar_2, [1, 4]), (Bar_2, [2, 5]), (Bar_2, [3, 4]), (Bar_2, [4, 5]), (Bar_2, [5, 3])] faces3[Wedge_6] = [(Point_1, [0]), (Point_1, [1]), (Point_1, [2]), (Point_1, [3]), (Point_1, [4]), (Point_1, [5])] geoSupport[Hexahedron_8] = GeoHex numberOfNodes[Hexahedron_8] = 8 mirrorPermutation[Hexahedron_8] = [0, 3, 2, 1, 4, 7, 6, 5] dimensionality[Hexahedron_8] = 3 linear[Hexahedron_8] = False degree[Hexahedron_8] = 1 faces1[Hexahedron_8] = [(Quadrangle_4, [3, 0, 4, 7]), (Quadrangle_4, [1, 2, 6, 5]), (Quadrangle_4, [0, 1, 5, 4]), (Quadrangle_4, [2, 3, 7, 6]), (Quadrangle_4, [0, 3, 2, 1]), (Quadrangle_4, [4, 5, 6, 7])] faces2[Hexahedron_8] = [(Bar_2, [0, 1]), (Bar_2, [1, 2]), (Bar_2, [2, 3]), (Bar_2, [3, 0]), (Bar_2, [4, 5]), (Bar_2, [5, 6]), (Bar_2, [6, 7]), (Bar_2, [7, 4]), (Bar_2, [0, 4]), (Bar_2, [1, 5]), (Bar_2, [2, 6]), (Bar_2, [3, 7])] faces3[Hexahedron_8] = [(Point_1, [0]), (Point_1, [1]), (Point_1, [2]), (Point_1, [3]), (Point_1, [4]), (Point_1, [5]), (Point_1, [6]), (Point_1, [7])] # quadratic geoSupport[Tetrahedron_10] = GeoTet numberOfNodes[Tetrahedron_10] = 10 mirrorPermutation[Tetrahedron_10] = [0, 2, 1, 3, 6, 5, 4, 7, 9, 8] dimensionality[Tetrahedron_10] = 3 linear[Tetrahedron_10] = False degree[Tetrahedron_10] = 2 faces1[Tetrahedron_10] = [(Triangle_6, [0, 2, 1, 6, 5, 4]), (Triangle_6, [0, 1, 3, 4, 8, 7]), (Triangle_6, [1, 2, 3, 5, 9, 8]), (Triangle_6, [2, 0, 3, 6, 7, 9])] faces2[Tetrahedron_10] = [(Bar_3, [0, 1, 4]), (Bar_3, [1, 2, 5]), (Bar_3, [2, 0, 6]), (Bar_3, [0, 3, 7]), (Bar_3, [1, 3, 8]), (Bar_3, [2, 3, 9])] faces3[Tetrahedron_10] = [(Point_1, [0]), (Point_1, [1]), (Point_1, [2]), (Point_1, [3]), (Point_1, [4])] geoSupport[Pyramid_13] = GeoPyr numberOfNodes[Pyramid_13] = 13 mirrorPermutation[Pyramid_13] = [0, 3, 2, 1, 4, 8, 7, 6, 5, 9, 12, 11, 10] dimensionality[Pyramid_13] = 3 linear[Pyramid_13] = False degree[Pyramid_13] = 2 faces1[Pyramid_13] = [(Quadrangle_8, [0, 3, 2, 1, 8, 7, 6, 5]), (Triangle_6, [0, 1, 4, 5, 10, 9]), (Triangle_6, [1, 2, 4, 6, 11, 10]), (Triangle_6, [2, 3, 4, 7, 12, 11]), (Triangle_6, [3, 0, 4, 8, 9, 12])] faces2[Pyramid_13] = [(Bar_3, [0, 1, 5]), (Bar_3, [1, 2, 6]), (Bar_3, [2, 3, 7]), (Bar_3, [3, 0, 8]), (Bar_3, [0, 4, 9]), (Bar_3, [1, 4, 10]), (Bar_3, [2, 4, 11]), (Bar_3, [3, 4, 12])] faces3[Pyramid_13] = [(Point_1, [0]), (Point_1, [1]), (Point_1, [2]), (Point_1, [3]), (Point_1, [4])] geoSupport[Pyramid_14] = GeoPyr numberOfNodes[Pyramid_14] = 14 mirrorPermutation[Pyramid_14] = [0, 3, 2, 1, 4, 8, 7, 6, 5, 9, 12, 11, 10, 13] dimensionality[Pyramid_14] = 3 linear[Pyramid_14] = False degree[Pyramid_14] = 2 faces1[Pyramid_14] = [(Quadrangle_9, [0, 3, 2, 1, 8, 7, 6, 5, 13]), (Triangle_6, [0, 1, 4, 5, 10, 9]), (Triangle_6, [1, 2, 4, 6, 11, 10]), (Triangle_6, [2, 3, 4, 7, 12, 11]), (Triangle_6, [3, 0, 4, 8, 9, 12])] faces2[Pyramid_14] = [(Bar_3, [0, 1, 5]), (Bar_3, [1, 2, 6]), (Bar_3, [2, 3, 7]), (Bar_3, [3, 0, 8]), (Bar_3, [0, 4, 9]), (Bar_3, [1, 4, 10]), (Bar_3, [2, 4, 11]), (Bar_3, [3, 4, 12])] faces3[Pyramid_14] = [(Point_1, [0]), (Point_1, [1]), (Point_1, [2]), (Point_1, [3]), (Point_1, [4])] geoSupport[Wedge_15] = GeoWed numberOfNodes[Wedge_15] = 15 dimensionality[Wedge_15] = 3 linear[Wedge_15] = False degree[Wedge_15] = 2 mirrorPermutation[Wedge_15] = [0, 2, 1, 3, 5, 4, 8, 7, 6, 11, 10, 9, 12, 14, 13] faces1[Wedge_15] = [(Triangle_6, [0, 2, 1, 8, 7, 6]), (Triangle_6, [3, 4, 5, 9, 10, 11]), (Quadrangle_8, [0, 1, 4, 3, 6, 13, 9, 12]), (Quadrangle_8, [0, 3, 5, 2, 12, 11, 14, 8]), (Quadrangle_8, [2, 5, 4, 1, 14, 10, 13, 7])] faces2[Wedge_15] = [(Bar_3, [0, 1, 6]), (Bar_3, [1, 2, 7]), (Bar_3, [2, 0, 8]), (Bar_3, [3, 4, 9]), (Bar_3, [4, 5, 10]), (Bar_3, [5, 3, 11]), (Bar_3, [0, 3, 12]), (Bar_3, [1, 4, 13]), (Bar_3, [2, 5, 14])] faces3[Wedge_15] = [(Point_1, [0]), (Point_1, [1]), (Point_1, [2]), (Point_1, [3]), (Point_1, [4]), (Point_1, [5])] geoSupport[Wedge_18] = GeoWed numberOfNodes[Wedge_18] = 18 dimensionality[Wedge_18] = 3 linear[Wedge_18] = False degree[Wedge_18] = 2 mirrorPermutation[Wedge_18] = [0, 2, 1, 3, 5, 4, 8, 7, 6, 11, 10, 9, 12, 14, 13, 17, 16, 15] faces1[Wedge_18] = [(Triangle_6, [0, 2, 1, 8, 7, 6]), (Triangle_6, [3, 4, 5, 9, 10, 11]), (Quadrangle_9, [0, 1, 4, 3, 6, 13, 9, 12, 15]), (Quadrangle_9, [0, 3, 5, 2, 12, 11, 14, 8, 17]), (Quadrangle_9, [2, 5, 4, 1, 14, 10, 13, 7, 16])] faces2[Wedge_18] = [(Bar_3, [0, 1, 6]), (Bar_3, [1, 2, 7]), (Bar_3, [2, 0, 8]), (Bar_3, [3, 4, 9]), (Bar_3, [4, 5, 10]), (Bar_3, [5, 3, 11]), (Bar_3, [0, 3, 12]), (Bar_3, [1, 4, 13]), (Bar_3, [2, 5, 14])] faces3[Wedge_18] = [(Point_1, [0]), (Point_1, [1]), (Point_1, [2]), (Point_1, [3]), (Point_1, [4]), (Point_1, [5])] geoSupport[Hexahedron_20] = GeoHex numberOfNodes[Hexahedron_20] = 20 dimensionality[Hexahedron_20] = 3 linear[Hexahedron_20] = False degree[Hexahedron_20] = 2 mirrorPermutation[Hexahedron_20] = [0, 3, 2, 1, 4, 7, 6, 5, 11, 10, 9, 8, 15, 14, 13, 12, 16, 19, 18, 17] faces1[Hexahedron_20] = [(Quadrangle_8, [3, 0, 4, 7, 11, 16, 15, 19]), (Quadrangle_8, [1, 2, 6, 5, 9, 18, 13, 17]), (Quadrangle_8, [0, 1, 5, 4, 8, 17, 12, 16]), (Quadrangle_8, [2, 3, 7, 6, 10, 19, 14, 18]), (Quadrangle_8, [0, 3, 2, 1, 11, 10, 9, 8]), (Quadrangle_8, [4, 5, 6, 7, 12, 13, 14, 15])] faces2[Hexahedron_20] = [(Bar_3, [0, 1, 8]), (Bar_3, [1, 2, 9]), (Bar_3, [2, 3, 10]), (Bar_3, [3, 0, 11]), (Bar_3, [4, 5, 12]), (Bar_3, [5, 6, 13]), (Bar_3, [6, 7, 14]), (Bar_3, [7, 4, 15]), (Bar_3, [0, 4, 16]), (Bar_3, [1, 5, 17]), (Bar_3, [2, 6, 18]), (Bar_3, [3, 7, 19])] faces3[Hexahedron_20] = [(Point_1, [0]), (Point_1, [1]), (Point_1, [2]), (Point_1, [3]), (Point_1, [4]), (Point_1, [5]), (Point_1, [6]), (Point_1, [7])] geoSupport[Hexahedron_27] = GeoHex numberOfNodes[Hexahedron_27] = 27 dimensionality[Hexahedron_27] = 3 linear[Hexahedron_27] = False degree[Hexahedron_27] = 2 mirrorPermutation[Hexahedron_27] = [0, 3, 2, 1, 4, 7, 6, 5, 11, 10, 9, 8, 15, 14, 13, 12, 16, 19, 18, 17, 20, 23, 21, 22, 24, 25, 26] faces1[Hexahedron_27] = [(Quadrangle_9, [3, 0, 4, 7, 11, 16, 15, 19, 20]), (Quadrangle_9, [1, 2, 6, 5, 9, 18, 13, 17, 21]), (Quadrangle_9, [0, 1, 5, 4, 8, 17, 12, 16, 22]), (Quadrangle_9, [2, 3, 7, 6, 10, 19, 14, 18, 23]), (Quadrangle_9, [0, 3, 2, 1, 11, 10, 9, 8, 24]), (Quadrangle_9, [4, 5, 6, 7, 12, 13, 14, 15, 25])] faces2[Hexahedron_27] = [(Bar_3, [0, 1, 8]), (Bar_3, [1, 2, 9]), (Bar_3, [2, 3, 10]), (Bar_3, [3, 0, 11]), (Bar_3, [4, 5, 12]), (Bar_3, [5, 6, 13]), (Bar_3, [6, 7, 14]), (Bar_3, [7, 4, 15]), (Bar_3, [0, 4, 16]), (Bar_3, [1, 5, 17]), (Bar_3, [2, 6, 18]), (Bar_3, [3, 7, 19])] faces3[Hexahedron_27] = [(Point_1, [0]), (Point_1, [1]), (Point_1, [2]), (Point_1, [3]), (Point_1, [4]), (Point_1, [5]), (Point_1, [6]), (Point_1, [7])] """Module variable to store ElementInformation for every type of element The key is the element name, The value is an instance of ElementInformation """ def __MakeDataUnMutable(data): res = [] for e, d in data: data = np.asarray(d, dtype=MuscatIndex) data.flags.writeable = False res.append((e, data)) return res for name, geo in geoSupport.items(): ei = ElementDescription(name, geo) ei.numberOfNodes = numberOfNodes[name] ei.linear = linear[name] ei.degree = degree[name] faces1[name] = __MakeDataUnMutable(faces1[name]) faces2[name] = __MakeDataUnMutable(faces2[name]) faces3[name] = __MakeDataUnMutable(faces3[name]) ei.facesL1 = faces1[name] ei.facesL2 = faces2[name] ei.facesL3 = faces3[name] ei.mirrorPermutation = mirrorPermutation[name] ElementsInfo[name] = ei
[docs]def CheckIntegrity(GUI: bool = False): """CheckIntegrity function. Tests Parameters ---------- GUI : bool, optional if True, generate (in some case) an output on a new window, by default False Returns ------- str ok if all ok """ print(GeoPoint) print(GeoPoint == GeoBar) print(GeoPoint == 1) print(GeoPoint != GeoBar) print(hash(GeoPoint)) assert (ElementType.Bar_2 < ElementType.Bar_3) assert (ElementType.Bar_2 < "bar3") assert (ElementType.Bar_2 != ElementType.Bar_3) assert (ElementType.Bar_2 != "bar3") assert (ElementType.Bar_2 == ElementType.Bar_2) assert (ElementType.Bar_2 == "bar2") ElementType("bar2").encode() assert (str(ElementType.Bar_2) == "bar2") return "ok"
if __name__ == '__main__': # pragma: no cover print(CheckIntegrity(GUI=True))