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, NamedTuple
from enum import Enum, unique

import numpy as np

from Muscat.Types import MuscatIndex

[docs]def GetElementDescription(elementType: ElementTypeLike) -> ElementDescription: """Return an instance of ElementDescription for the element type elementType Parameters ---------- elementType : ElementTypeLike Element type Returns ------- ElementDescription instance of ElementDescription with the information of the element """ return ElementsInfo[elementType]
[docs]class GeoProp(NamedTuple): name:str dimensionality: int
[docs]@unique class GeoSupport(Enum): GeoPoint = GeoProp("GeoPoint",0) """Point geometrical support : dimensionality = 0""" GeoBar = GeoProp("GeoBar",1) # 1 """Bar geometrical support : dimensionality = 1""" GeoTri = GeoProp("GeoTri",2) # 2 """Triangle geometrical support : dimensionality = 2""" GeoQuad = GeoProp("GeoQuad",2) # 3 """Quadrangle geometrical support : dimensionality = 2""" GeoTet = GeoProp("GeoTet",3) # 4 """Tetrahedral geometrical support : dimensionality = 3""" GeoPyr = GeoProp("GeoPyr",3) # 5 """Pyramidal (square base) geometrical support : dimensionality = 3""" GeoWed = GeoProp("GeoWed",3) # 6 """Wedge geometrical support : dimensionality = 3""" GeoHex = GeoProp("GeoHex",3) # 7 """Hexahedral geometrical support : dimensionality = 3""" @property def dimensionality(self): return self.value.dimensionality
[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"""
[docs]@unique class ElementType(Enum): NA : int = 0 Bar_2: int = 1 Bar_3: int = 2 Hexahedron_20: int = 3 Hexahedron_27: int = 4 Hexahedron_8: int = 5 Point_1: int = 6 Pyramid_13: int = 7 Pyramid_14: int = 8 Pyramid_5: int = 9 Quadrangle_4: int = 10 Quadrangle_8: int = 11 Quadrangle_9: int = 12 Tetrahedron_10: int = 13 Tetrahedron_4: int = 14 Triangle_3: int = 15 Triangle_6: int = 16 Wedge_15: int = 17 Wedge_18: int = 18 Wedge_6: int = 19 def __lt__(self, obj: ElementType): return self.value < obj.value
ElementTypeLike = Union[str,ElementType] ElementsInfo: Dict[ElementTypeLike, ElementDescription] = {} """Dictionary with with the description for all elements. This dictionary contain for every element type ElementDescription singleton with the information about the elements. """ 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] = GeoSupport.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] = GeoSupport.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] = GeoSupport.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] = GeoSupport.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] = GeoSupport.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] = GeoSupport.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] = GeoSupport.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] = GeoSupport.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] = GeoSupport.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] = GeoSupport.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] = GeoSupport.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] = GeoSupport.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] = GeoSupport.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] = GeoSupport.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] = GeoSupport.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] = GeoSupport.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] = GeoSupport.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] = GeoSupport.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] = GeoSupport.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(GeoSupport.GeoPoint) print(GeoSupport.GeoPoint == GeoSupport.GeoBar) print(GeoSupport.GeoPoint == 1) print(GeoSupport.GeoPoint != GeoSupport.GeoBar) print(hash(GeoSupport.GeoPoint)) assert (ElementType.Bar_2 < ElementType.Bar_3) assert (ElementType.Bar_2 < ElementType["Bar_3"]) assert (ElementType.Bar_2 != ElementType.Bar_3) assert (ElementType.Bar_2 != ElementType["Bar_3"]) assert (ElementType.Bar_2 == ElementType.Bar_2) assert (ElementType.Bar_2 == ElementType["Bar_2"]) return "ok"
if __name__ == '__main__': # pragma: no cover print(CheckIntegrity(GUI=True))