1 | #Test Name: SquareBamgMesh
|
---|
2 | import numpy as np
|
---|
3 | import time
|
---|
4 | from model import *
|
---|
5 | from bamg import *
|
---|
6 |
|
---|
7 |
|
---|
8 | #Simple mesh
|
---|
9 | md = bamg(model(), 'domain', '../Exp/Square.exp', 'hmax', 100000.)
|
---|
10 | x1 = md.mesh.x
|
---|
11 | y1 = md.mesh.y
|
---|
12 |
|
---|
13 | #hVertices
|
---|
14 | md = bamg(model(), 'domain', '../Exp/Square.exp', 'hmax', 300000., 'hVertices', np.array([10000., 100000., 400000., 100000.]).reshape(-1, 1))
|
---|
15 | x2 = md.mesh.x
|
---|
16 | y2 = md.mesh.y
|
---|
17 |
|
---|
18 | #big mesh
|
---|
19 | t0 = time.time()
|
---|
20 | md = bamg(model(), 'domain', '../Exp/Square.exp', 'hmax', 3000.)
|
---|
21 | nbelements = md.mesh.numberofelements
|
---|
22 | elapsedtime = time.time() - t0
|
---|
23 | if nbelements > 267895 - 50 and nbelements < 267895 + 50:
|
---|
24 | nbewithinrange = 1.
|
---|
25 | else:
|
---|
26 | nbewithinrange = 0.
|
---|
27 |
|
---|
28 | #Fields and tolerances to track changes
|
---|
29 | field_names = ['x1', 'y1', 'x2', 'y2', 'nbelements', 'elapsed time']
|
---|
30 | # NOTE: Elapsed time tolerance has been increased to 7.0 for this test, but not the MATLAB one
|
---|
31 | field_tolerances = [2e-9, 2e-9, 1e-13, 1e-13, 1e-13, 7.0]
|
---|
32 | field_values = [x1, y1, x2, y2, nbewithinrange, elapsedtime]
|
---|