Commit 71ce46ee authored by Baptiste Durand's avatar Baptiste Durand

Reduce calls to gmsh.fltk in tests + black + minor fixes

parent 91066980
......@@ -153,7 +153,7 @@ msh.set_periodicity_pairs(micro_bndry[1], micro_bndry[3])
logger.info("Periodicity constraint : Done")
logger.info("Cleaning model")
factory.remove([(1, l.tag) for l in macro_ll.sides])
factory.remove([(1, s.tag) for s in macro_ll.sides])
factory.synchronize()
factory.removeAllDuplicates()
factory.synchronize()
......@@ -164,4 +164,3 @@ geo.PhysicalGroup.set_group_mesh(1)
gmsh.model.mesh.generate(2)
gmsh.write(str(mesh_file))
run(f"gmsh {str(mesh_file)} &", shell=True, check=True)
gmsh.fltk.run()
......@@ -451,7 +451,6 @@ def Gmsh2DPartFromRVE(cell: Gmsh2DRVE, nb_cells, part_name=None):
tag = cell.phy_surf[i].tag + 1000
name = cell.phy_surf[i].name
phy_surfaces.append(geo.PhysicalGroup(all_surfaces, 2, name, tag))
# gmsh.fltk.run()
for gp in cell.phy_surf:
gp.remove_gmsh()
factory.synchronize()
......
......@@ -88,7 +88,7 @@ def conversion_to_xdmf(i_path, o_path, cell_reg, facet_reg, dim, subdomains=Fals
raise NotImplementedError("3D meshes are not supported yet.")
# * INFO :
else:
ValueError
raise ValueError
meshio.write(o_path, geo_only)
......
......@@ -191,7 +191,7 @@ def test_reconstruction_with_constraint():
def test_select_solver():
"The solver Mumps is selected."
"""The solver Mumps is selected."""
logger = logging.getLogger("test_reconstruction")
nb_x = nb_y = 20
L_x = 2
......
......@@ -434,46 +434,21 @@ def test_ll_modif():
gmsh.model.add(name)
t = math.tan(math.pi / 6)
vertcs_lists = []
vertcs_lists.append(
[
geo.Point(np.array(c), 0.05)
for c in [
(0, 0),
(2, 0),
(2 - SR2, 0 + SR2),
(2, 2),
(2 - 1, 2 + t),
(0, 2),
]
]
) # angles : pi/4, pi/2 and 2*pi/3
vertcs_lists.append(
[
geo.Point(np.array(c), 0.05)
for c in [
(3, 0),
(5, 0),
(5 - SR2, 0 + SR2),
(5, 2),
(5 - 1, 2 + t),
(3, 2),
]
]
)
vertcs_lists.append(
[
geo.Point(np.array(c), 0.05)
for c in [
(6, 0),
(8, 0),
(8 - SR2, 0 + SR2),
(8, 2),
(8 - 1, 2 + t),
(6, 2),
]
]
)
vertcs_lists = [None, None, None]
vertcs_lists[0] = [
geo.Point(np.array(c), 0.05)
for c in [(0, 0), (2, 0), (2 - SR2, 0 + SR2), (2, 2), (2 - 1, 2 + t), (0, 2),]
] # angles : pi/4, pi/2 and 2*pi/3
vertcs_lists[1] = [
geo.Point(np.array(c), 0.05)
for c in [(3, 0), (5, 0), (5 - SR2, 0 + SR2), (5, 2), (5 - 1, 2 + t), (3, 2),]
]
vertcs_lists[2] = [
geo.Point(np.array(c), 0.05)
for c in [(6, 0), (8, 0), (8 - SR2, 0 + SR2), (8, 2), (8 - 1, 2 + t), (6, 2),]
]
vertcs_lists = [v_list_1, v_list_2, v_list_3]
lls = [geo.LineLoop(vl, explicit=False) for vl in vertcs_lists]
plt.figure()
......@@ -566,8 +541,8 @@ def test_gather_line():
gp_l = geo.PhysicalGroup(l_list, 1, n)
gp_l.add_gmsh()
gps.append(gp_l)
for l in l_list:
l.plot2D(col)
for ln in l_list:
ln.plot2D(col)
factory.synchronize()
gmsh.option.setNumber("Mesh.SaveAll", 1)
......@@ -862,11 +837,6 @@ if __name__ == "__main__":
# test_mesh_only_phy_groups()
# * Bloc de fin
gmsh.fltk.run()
# gmsh.fltk.run()
plt.show()
# * Il faut fermer toutes les fenêtres avant de passer à la GUI gmsh. (pertinent en mode non interactive) #noqa
# gmsh.fltk.run()
# ! A revoir, ça génère des "kernel died" dans Spyder, pas idéal
# # gmsh.fltk.initialize()
# gmsh.finalize()
# plt.show()
......@@ -19,15 +19,14 @@ from ho_homog import geometry, homog2d, materials, mesh_generate, part
logger = logging.getLogger("Test_homog2d")
logger.setLevel(logging.DEBUG)
formatter = logging.Formatter(
'%(asctime)s :: %(levelname)s :: %(name)s :: %(message)s',
"%H:%M:%S")
"%(asctime)s :: %(levelname)s :: %(name)s :: %(message)s", "%H:%M:%S"
)
stream_handler = logging.StreamHandler()
stream_handler.setLevel(logging.DEBUG)
stream_handler.setFormatter(formatter)
logger.addHandler(stream_handler)
np.set_printoptions(suppress=False, floatmode='fixed', precision=8,
linewidth=150)
np.set_printoptions(suppress=False, floatmode="fixed", precision=8, linewidth=150)
def test_homog_EGG_pantograph_1x1(generate_mesh=False):
......@@ -35,15 +34,16 @@ def test_homog_EGG_pantograph_1x1(generate_mesh=False):
start = time.time()
if generate_mesh:
geometry.init_geo_tools()
geometry.set_gmsh_option('Mesh.MshFileVersion', 4.1)
geometry.set_gmsh_option("Mesh.MshFileVersion", 4.1)
a = 1
b, k = a, a/3
r = 0.02
panto_test = mesh_generate_2D.Gmsh2DRVE.pantograph(
a, b, k, r, nb_cells=(1, 1), soft_mat=False, name='panto_rve_1x1')
lc_ratio = 1/6
lc_min_max = (lc_ratio*r*a, lc_ratio*a)
panto_test.main_mesh_refinement((2*r*a, a), lc_min_max, False)
panto_test = mesh_generate.pantograph.pantograph_RVE(
a, b, k, r, nb_cells=(1, 1), soft_mat=False, name="panto_rve_1x1"
)
lc_ratio = 1 / 6
lc_min_max = (lc_ratio * r * a, lc_ratio * a)
panto_test.main_mesh_refinement((2 * r * a, a), lc_min_max, False)
panto_test.mesh_generate()
gmsh.model.mesh.renumberNodes()
gmsh.model.mesh.renumberElements()
......@@ -51,8 +51,8 @@ def test_homog_EGG_pantograph_1x1(generate_mesh=False):
mesh = meshio.read("panto_rve_1x1.msh")
mesh.points = mesh.points[:, :2]
geo_only = meshio.Mesh(
points=mesh.points,
cells={"triangle": mesh.cells["triangle"]})
points=mesh.points, cells={"triangle": mesh.cells["triangle"]}
)
meshio.write("panto_rve_1x1.xdmf", geo_only)
geometry.reset()
......@@ -63,12 +63,15 @@ def test_homog_EGG_pantograph_1x1(generate_mesh=False):
"panto_rve_1x1.xdmf", gen_vect, material)
hom_model = homog2d.Fenics2DHomogenization(rve)
*localzt_dicts, constit_tensors = hom_model.homogenizationScheme('EGG')
*localzt_dicts, constit_tensors = hom_model.homogenizationScheme("EGG")
Chom_ref = np.array(
[[2.58608139e-04, 3.45496903e-04, 5.16572422e-12],
[3.45496903e-04, 3.81860676e-02, 6.48384646e-11],
[5.16572422e-12, 6.48384646e-11, 3.27924466e-04]])
[
[2.58608139e-04, 3.45496903e-04, 5.16572422e-12],
[3.45496903e-04, 3.81860676e-02, 6.48384646e-11],
[5.16572422e-12, 6.48384646e-11, 3.27924466e-04],
]
)
D_ref = np.array(
[
......@@ -81,10 +84,13 @@ def test_homog_EGG_pantograph_1x1(generate_mesh=False):
]
)
Chom = constit_tensors['E']['E']
G = constit_tensors['E']['EGGbis']
D = (constit_tensors['EG']['EG']
- np.vstack((G[:, :6], G[:, 6:])) - np.vstack((G[:, :6], G[:, 6:])).T)
Chom = constit_tensors["E"]["E"]
G = constit_tensors["E"]["EGGbis"]
D = (
constit_tensors["EG"]["EG"]
- np.vstack((G[:, :6], G[:, 6:]))
- np.vstack((G[:, :6], G[:, 6:])).T
)
logger.debug(f"Chom : \n {Chom}")
logger.debug(f"D : \n {D}")
logger.debug(f"Duration : {time.time() - start}")
......@@ -109,14 +115,15 @@ def test_homogeneous_pantograph(generate_mesh=False, save_results=False):
start = time.time()
if generate_mesh:
geometry.init_geo_tools()
geometry.set_gmsh_option('Mesh.MshFileVersion', 4.1)
geometry.set_gmsh_option("Mesh.MshFileVersion", 4.1)
a = 1
b, k, r = a, a/3, 0.1*a
geo_model = mesh_generate_2D.Gmsh2DRVE.pantograph(
a, b, k, r, soft_mat=True, name='homogeneous_panto')
b, k, r = a, a / 3, 0.1 * a
geo_model = mesh_generate.pantograph.pantograph_RVE(
a, b, k, r, soft_mat=True, name="homogeneous_panto"
)
lc_ratio = 1
lc_min_max = (lc_ratio*r, lc_ratio)
d_min_max = (2*r, a)
lc_min_max = (lc_ratio * r, lc_ratio)
d_min_max = (2 * r, a)
geo_model.main_mesh_refinement(d_min_max, lc_min_max, False)
geo_model.soft_mesh_refinement(d_min_max, lc_min_max, False)
geo_model.mesh_generate()
......@@ -126,8 +133,8 @@ def test_homogeneous_pantograph(generate_mesh=False, save_results=False):
mesh = meshio.read("homogeneous_panto.msh")
mesh.points = mesh.points[:, :2]
geo_only = meshio.Mesh(
points=mesh.points,
cells={"triangle": mesh.cells["triangle"]})
points=mesh.points, cells={"triangle": mesh.cells["triangle"]}
)
meshio.write("homogeneous_panto.xdmf", geo_only)
geometry.reset()
......@@ -137,30 +144,36 @@ def test_homogeneous_pantograph(generate_mesh=False, save_results=False):
rve = part.Fenics2DRVE.file_2_Fenics_2DRVE(
"homogeneous_panto.xdmf", gen_vect, material)
hom_model = homog2d.Fenics2DHomogenization(rve)
*localzt_dicts, constit_tensors = hom_model.homogenizationScheme('EGG')
*localzt_dicts, constit_tensors = hom_model.homogenizationScheme("EGG")
Chom_ref = np.array(
[[1.09890110, 0.329670330, 0],
[0.329670330, 1.09890110, 0],
[0, 0, 0.769230769]])
[
[1.09890110, 0.329670330, 0],
[0.329670330, 1.09890110, 0],
[0, 0, 0.769230769],
]
)
D_ref = np.zeros((6, 6))
Chom = constit_tensors['E']['E']
G = constit_tensors['E']['EGGbis']
D = (constit_tensors['EG']['EG']
- np.vstack((G[:, :6], G[:, 6:])) - np.vstack((G[:, :6], G[:, 6:])).T)
Chom = constit_tensors["E"]["E"]
G = constit_tensors["E"]["EGGbis"]
D = (
constit_tensors["EG"]["EG"]
- np.vstack((G[:, :6], G[:, 6:]))
- np.vstack((G[:, :6], G[:, 6:])).T
)
print(Chom)
if save_results:
with fe.XDMFFile("homogeneous_panto_results.xdmf") as ofile:
ofile.parameters["flush_output"] = False
ofile.parameters["functions_share_mesh"] = True
for i, E_ in enumerate(('E11', 'E22', 'E12')):
loc_eps = fe.project(localzt_dicts[2]['E'][i], hom_model.W)
for i, E_ in enumerate(("E11", "E22", "E12")):
loc_eps = fe.project(localzt_dicts[2]["E"][i], hom_model.W)
loc_eps.rename(E_, E_)
ofile.write(loc_eps, 0.)
ofile.write(loc_eps, 0.0)
assert Chom == approx(Chom_ref)
assert D == approx(D_ref)
logger.debug("End test_homogeneous_pantograph")
logger.debug(f"Duration : {time.time() - start}")
test_homog_EGG_pantograph_1x1(False)
# test_homog_EGG_pantograph_1x1(False)
# test_homogeneous_pantograph(False, True)
......@@ -20,17 +20,18 @@ factory = model.occ
plt.ion()
#? COMPARER AVEC DES MAILLAGES PRODUITS A LA MAIN JUSTE AVEC LA GUI GMSH ?
# ? COMPARER AVEC DES MAILLAGES PRODUITS A LA MAIN JUSTE AVEC LA GUI GMSH ?
rect_vtcs = [geo.Point(np.array(c)) for c in [(-2, -1), (2 , -1), (2, 1), (-2 , 1)]]
rect_vtcs = [geo.Point(np.array(c)) for c in [(-2, -1), (2, -1), (2, 1), (-2, 1)]]
mid_N = geo.Point(np.array((0, 1)))
mid_S = geo.Point(np.array((0, -1)))
attrac_NW = geo.Point(np.array((-1, 0.5)))
attrac_mid = geo.Line(mid_N, mid_S)
rect_ll = geo.LineLoop(rect_vtcs,False)
rect_ll = geo.LineLoop(rect_vtcs, False)
rect_s = geo.PlaneSurface(rect_ll)
def test_MathEval():
"""
Test of MathEval subclass of the Field base class.
......@@ -40,19 +41,20 @@ def test_MathEval():
"""
name = "test_MathEval"
model.add(name)
rect_vtcs = [geo.Point(np.array(c)) for c in [(-4, -2), (4 , -2), (4, 2), (-4 , 2)]]
rect_ll = geo.LineLoop(rect_vtcs,False)
rect_vtcs = [geo.Point(np.array(c)) for c in [(-4, -2), (4, -2), (4, 2), (-4, 2)]]
rect_ll = geo.LineLoop(rect_vtcs, False)
rect_s = geo.PlaneSurface(rect_ll)
rect_s.add_gmsh()
f = msh.MathEvalField("(Cos(3.14*x) * Sin(3.14*y)+1)*0.1+0.005")
f.add_gmsh() #Optional
f.add_gmsh() # Optional
msh.set_background_mesh(f)
factory.synchronize()
model.mesh.generate(2)
gmsh.write("%s.msh"%name)
os.system("gmsh %s.msh &" %name)
gmsh.write("%s.msh" % name)
os.system("gmsh %s.msh &" % name)
def test_Min():
"""
......@@ -64,8 +66,8 @@ def test_Min():
"""
name = "test_Min"
model.add(name)
rect_vtcs = [geo.Point(np.array(c)) for c in [(-4, -2), (4 , -2), (4, 2), (-4 , 2)]]
rect_ll = geo.LineLoop(rect_vtcs,False)
rect_vtcs = [geo.Point(np.array(c)) for c in [(-4, -2), (4, -2), (4, 2), (-4, 2)]]
rect_ll = geo.LineLoop(rect_vtcs, False)
rect_s = geo.PlaneSurface(rect_ll)
rect_s.add_gmsh()
......@@ -77,8 +79,9 @@ def test_Min():
factory.synchronize()
model.mesh.generate(2)
gmsh.write("%s.msh"%name)
os.system("gmsh %s.msh &" %name)
gmsh.write("%s.msh" % name)
os.system("gmsh %s.msh &" % name)
def test_Threshold():
"""
......@@ -88,7 +91,7 @@ def test_Threshold():
"""
name = "test_Threshold"
model.add(name)
rect_vtcs = [geo.Point(np.array(c)) for c in [(-4, -2), (4 , -2), (4, 2), (-4 , 2)]]
rect_vtcs = [geo.Point(np.array(c)) for c in [(-4, -2), (4, -2), (4, 2), (-4, 2)]]
mid_N = geo.Point(np.array((0, 2)))
mid_S = geo.Point(np.array((0, -2)))
attrac_NW = geo.Point(np.array((-2, 1)))
......@@ -97,15 +100,18 @@ def test_Threshold():
rect_s = geo.PlaneSurface(rect_ll)
rect_s.add_gmsh()
f = msh.AttractorField(points=[attrac_NW], curves=[attrac_mid], nb_pts_discretization=10)
f = msh.AttractorField(
points=[attrac_NW], curves=[attrac_mid], nb_pts_discretization=10
)
g = msh.ThresholdField(f, 0.2, 1, 0.03, 0.2, True)
msh.set_background_mesh(g)
factory.synchronize()
model.mesh.generate(2)
gmsh.write("%s.msh"%name)
os.system("gmsh %s.msh &" %name)
gmsh.write("%s.msh" % name)
os.system("gmsh %s.msh &" % name)
def test_Restrict():
"""
......@@ -115,7 +121,7 @@ def test_Restrict():
"""
name = "test_Restrict"
model.add(name)
vtcs_1 = [geo.Point(np.array(c)) for c in [(-1, -1), (1, -1), (1, 1), (-1 , 1)]]
vtcs_1 = [geo.Point(np.array(c)) for c in [(-1, -1), (1, -1), (1, 1), (-1, 1)]]
vtcs_2 = [geo.Point(np.array(c)) for c in [(0, 0), (2, 0), (2, 2), (0, 2)]]
ll_1 = geo.LineLoop(vtcs_1, explicit=False)
ll_2 = geo.LineLoop(vtcs_2, explicit=False)
......@@ -127,13 +133,12 @@ def test_Restrict():
f = msh.MathEvalField("0.1")
g = msh.MathEvalField("(x-0.25)*(x-0.25)+0.02")
h = msh.RestrictField(g, surfaces=[surf_1])
msh.set_background_mesh([f,h])
msh.set_background_mesh([f, h])
factory.synchronize()
model.mesh.generate(2)
gmsh.write("%s.msh"%name)
os.system("gmsh %s.msh &" %name)
gmsh.write("%s.msh" % name)
os.system("gmsh %s.msh &" % name)
def test_refine_function():
......@@ -144,7 +149,7 @@ def test_refine_function():
"""
name = "test_refine_function"
model.add(name)
rect_vtcs = [geo.Point(np.array(c)) for c in [(-4, -2), (4 , -2), (4, 2), (-4 , 2)]]
rect_vtcs = [geo.Point(np.array(c)) for c in [(-4, -2), (4, -2), (4, 2), (-4, 2)]]
mid_N = geo.Point(np.array((0, 2)))
mid_S = geo.Point(np.array((0, -2)))
attrac_NW = geo.Point(np.array((-2, 1)))
......@@ -153,13 +158,19 @@ def test_refine_function():
rect_s = geo.PlaneSurface(rect_ll)
rect_s.add_gmsh()
f = msh.set_mesh_refinement([0.2, 1], [0.03, 0.2], attractors={'points':[attrac_NW], 'curves':[attrac_mid]}, sigmoid_interpol=True)
f = msh.set_mesh_refinement(
[0.2, 1],
[0.03, 0.2],
attractors={"points": [attrac_NW], "curves": [attrac_mid]},
sigmoid_interpol=True,
)
msh.set_background_mesh(f)
factory.synchronize()
model.mesh.generate(2)
gmsh.write("%s.msh"%name)
os.system("gmsh %s.msh &" %name)
gmsh.write("%s.msh" % name)
os.system("gmsh %s.msh &" % name)
def test_fctn_restrict():
"""
......@@ -169,7 +180,7 @@ def test_fctn_restrict():
"""
name = "test_Restrict_with_fctn"
model.add(name)
vtcs_1 = [geo.Point(np.array(c)) for c in [(-1, -1), (1, -1), (1, 1), (-1 , 1)]]
vtcs_1 = [geo.Point(np.array(c)) for c in [(-1, -1), (1, -1), (1, 1), (-1, 1)]]
vtcs_2 = [geo.Point(np.array(c)) for c in [(0, 0), (2, 0), (2, 2), (0, 2)]]
ll_1 = geo.LineLoop(vtcs_1, explicit=False)
ll_2 = geo.LineLoop(vtcs_2, explicit=False)
......@@ -182,21 +193,25 @@ def test_fctn_restrict():
g = msh.MathEvalField("(x-0.25)*(x-0.25)+0.02")
h = msh.MathEvalField("(y-0.25)*(y-0.25)+0.02")
gr = msh.RestrictField(g, surfaces=[surf_1], curves=surf_1.ext_contour.sides)
hr = msh.RestrictField(h, surfaces=[surf_2], curves=surf_2.ext_contour.sides+surf_1.ext_contour.sides)
msh.set_background_mesh([f,gr,hr])
hr = msh.RestrictField(
h, surfaces=[surf_2], curves=surf_2.ext_contour.sides + surf_1.ext_contour.sides
)
msh.set_background_mesh([f, gr, hr])
factory.synchronize()
model.mesh.generate(2)
gmsh.write("%s.msh"%name)
os.system("gmsh %s.msh &" %name)
gmsh.write("%s.msh" % name)
os.system("gmsh %s.msh &" % name)
# ? | ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄|
# ? | All field tests |
# ? | succeeded ! |
# ? | _________|
# ? (\__/) ||
# ? (•ㅅ•) ||
# ? /   づ
#? | ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄|
#? | All field tests |
#? | succeeded ! |
#? | _________|
#? (\__/) ||
#? (•ㅅ•) ||
#? /   づ
def test_translation2matrix():
mtx1 = msh.translation2matrix(np.array([5, 0]))
......@@ -204,33 +219,38 @@ def test_translation2matrix():
mtx3 = msh.translation2matrix(np.array([1, 1, 0]), 1)
print("translation by the vector (5,0) in the XY plane :\n", mtx1)
print("translation by the vector (1, 2, 3):\n", mtx2)
print("translation in the direction of the first bissectrice of the XY plane by a distance of 1:\n", mtx3)
print(
"translation in the direction of the first bissectrice of the XY plane by a distance of 1:\n",
mtx3,
)
def test_periodic():
name = "periodic"
model.add(name)
vtcs = [geo.Point(np.array(c),0.5) for c in [(-2, +1), (0, +1), (+2, +1), (+2, -1), (0, -1), (-2, -1)]]
vtcs = [
geo.Point(np.array(c), 0.5)
for c in [(-2, +1), (0, +1), (+2, +1), (+2, -1), (0, -1), (-2, -1)]
]
vtcs[0].mesh_size = 0.01
vtcs[2].mesh_size = 0.05
sides = [geo.Line(vtcs[i-1], vtcs[i]) for i in range(len(vtcs))]
surf = geo.PlaneSurface(geo.LineLoop(sides,explicit=True))
sides = [geo.Line(vtcs[i - 1], vtcs[i]) for i in range(len(vtcs))]
surf = geo.PlaneSurface(geo.LineLoop(sides, explicit=True))
surf.add_gmsh()
data = gmsh.model.getEntities()
print("model name : %s"%name)
print("model name : %s" % name)
print(data)
factory.synchronize()
msh.set_periodicity_pairs([sides[3]], [sides[0]], np.array((4,0)))
msh.set_periodicity_pairs([sides[-1],sides[-2]], [sides[1],sides[2]], np.array((0,-2)))
msh.set_periodicity_pairs([sides[3]], [sides[0]], np.array((4, 0)))
msh.set_periodicity_pairs(
[sides[-1], sides[-2]], [sides[1], sides[2]], np.array((0, -2))
)
gmsh.model.mesh.generate(2)
gmsh.write("%s.brep"%name)
gmsh.write("%s.msh"%name)
os.system("gmsh %s.brep &" %name)
os.system("gmsh %s.msh &" %name)
gmsh.fltk.run()
gmsh.write("%s.brep" % name)
gmsh.write("%s.msh" % name)
os.system("gmsh %s.brep &" % name)
os.system("gmsh %s.msh &" % name)
def test_order_curves():
......@@ -250,16 +270,26 @@ def test_order_curves():
line_W = geo.Line(geo.Point(np.array((-4, -2))), geo.Point(np.array((-4, 2))))
line_S = geo.Line(geo.Point(np.array((-4, -2))), geo.Point(np.array((4, -2))))
line_E = geo.Line(geo.Point(np.array((4, -2))), geo.Point(np.array((4, 2))))
lines = {'N':line_N, 'E':line_E, 'S':line_S, 'W':line_W}
lines = {"N": line_N, "E": line_E, "S": line_S, "W": line_W}
holes = list()
hole_shape = [np.array(c) for c in [(-0.2, 0), (0, -0.4), (0.2, 0), (0, 0.4)]]
translations = [(-3, 2.1), (-1, 2.1), (1, 2.1), (3, 2.1),
(-3, -2.1), (-1, -2.1), (1, -2.1), (3, -2.1),
(4.1, -1), (4.1, 1),
(-4.1, -1), (-4.1, 1)]
translations = [
(-3, 2.1),
(-1, 2.1),
(1, 2.1),
(3, 2.1),
(-3, -2.1),
(-1, -2.1),
(1, -2.1),
(3, -2.1),
(4.1, -1),
(4.1, 1),
(-4.1, -1),
(-4.1, 1),
]
translations = [np.array(t) for t in translations]
for t in translations:
holes.append([geo.Point(c+t, 0.05) for c in hole_shape])
holes.append([geo.Point(c + t, 0.05) for c in hole_shape])
rect_ll = geo.LineLoop(rect_vtcs, explicit=False)
hole_ll = [geo.LineLoop(h, explicit=False) for h in holes]
......@@ -274,34 +304,34 @@ def test_order_curves():
ax.set_ylim(-2.1, 2.1)
for crv in final_s.boundary:
crv.plot("blue")
boundaries = {'N':[], 'E':[], 'S':[], 'W':[]}