def get_hierarchical_mesh(dom, fineLevel): layers = [] l1 = ref.Level(d=dom) layers.append(l1) for i in range(fineLevel): layers.append(layers[i].split()) return layers
def create_gingerbread_layers(fineLevel): layers = [] V, F = load_obj() l1 = ref.Level(d=None, V=V, F=F) layers.append(l1) for i in range(fineLevel): layers.append(layers[i].split()) return layers
def test_creation_of_levels(): dom = ((0, 0), (5, 5)) l1 = ref.Level(dom) l1.create_bases() assert (ref.Node.getNumberOfNodes() == 4) assert (ref.Element.getNumberOfElements() == 2) l2 = l1.split() l2.create_bases() assert (ref.Node.getNumberOfNodes() == 13) assert (ref.Element.getNumberOfElements() == 10) l3 = l2.split() l3.create_bases() assert (ref.Node.getNumberOfNodes() == 38) print('test_creation_of_levels OK')
def test_Gaussian_Quadrature(): l_trash = ref.Level() n1 = ref.Node(0, 0, 0) n2 = ref.Node(1, 0, 0) n3 = ref.Node(0, 1, 0) print(utils.volume_of_tet([0, 0, 0], [1, 0, 0], [0, 1, 0], [0, 0, 0])) e = ref.Element(n1, n2, n3, 0) n1.update_basis() n2.update_basis() n3.update_basis() print("QUAD CODE") l_trash.GaussQuadrature_2d_3point(n1, e)
def test_Another_Quadrature_Method(): l_trash = ref.Level() n1 = ref.Node(0, 0, 0) n2 = ref.Node(4, 0, 0) n3 = ref.Node(0, 4, 0) e = ref.Element(n1, n2, n3, 0) n1.update_basis() n2.update_basis() n3.update_basis() # n1.basis = [[1 for i in range(5)] for j in range(5)] # n2.basis = [[1 for i in range(5)] for j in range(5)] # n3.basis = [[1 for i in range(5)] for j in range(5)] print("MAKE SURE TO REMOVE THE SECOND BASIS TERM IN THE SUM w*b1*b2") print("VOL ", utils.volume_of_tet([0, 0, 0], [4, 0, 0], [0, 4, 0], [0, 0, 1])) m1 = sim.AnotherQuadratureMethod(n2, n3, e) print("ANOTHER QUAD METHOD: ", m1)