test occ tutorials and test with python default parameters

This commit is contained in:
Christopher Lackner 2019-08-19 20:33:49 +02:00
parent d9897fce99
commit 8855bc8652
2 changed files with 50 additions and 41 deletions

View File

@ -1,34 +1,36 @@
number_elements = {} number_elements = {}
number_elements['cylsphere.geo'] = (243,508,706,2665,16573) number_elements['fichera.geo'] = (35,18,18,35,209,496)
number_elements['cubeandspheres.geo'] = (100,98,98,366,1078) number_elements['shaft.geo'] = (2609,874,1775,2609,11282,64486)
number_elements['ellipsoid.geo'] = (624,596,1255,5384,35591) number_elements['revolution.geo'] = (9143,1252,3868,9143,33305,206010)
number_elements['manyholes2.geo'] = (126463,291489) number_elements['twocubes.geo'] = (42,22,22,42,177,595)
number_elements['sculpture.geo'] = (140,260,477,1316,6395) number_elements['boxcyl.geo'] = (843,146,366,843,3739,18882)
number_elements['ortho.geo'] = (6,6,6,28,180) number_elements['ellipticcyl.geo'] = (2202,324,1106,2202,8311,55941)
number_elements['ellipticcone.geo'] = (574,1750,4635,12578,67070) number_elements['trafo.geo'] = (5154,1358,2389,5154,17998,85820)
number_elements['cube.geo'] = (6,6,6,28,178) number_elements['cubeandspheres.geo'] = (98,100,98,98,366,1078)
number_elements['twobricks.geo'] = (22,22,42,177,587) number_elements['manyholes2.geo'] = (128420)
number_elements['revolution.geo'] = (1237,3779,7958,31475,192314) number_elements['cubeandring.geo'] = (2014,231,613,2014,7838,38997)
number_elements['circle_on_cube.geo'] = (39,173,586,1860,11364) number_elements['period.geo'] = (3262,616,1380,3262,11758,69618)
number_elements['sphereincube.geo'] = (178,328,508,1584,12778) number_elements['sphereincube.geo'] = (505,178,329,505,1665,14230)
number_elements['twocubes.geo'] = (22,22,42,177,587) number_elements['cube.geo'] = (6,6,6,6,43,177)
number_elements['boundarycondition.geo'] = (22,22,39,165,507) number_elements['sphere.geo'] = (126,56,80,126,347,2357)
number_elements['ellipticcyl.geo'] = (325,1090,2113,7594,52464) number_elements['cylsphere.geo'] = (706,241,520,706,2826,17819)
number_elements['trafo.geo'] = (1358,2384,5081,16891,110333) number_elements['ellipticcone.geo'] = (4973,574,1774,4973,13530,71573)
number_elements['boxcyl.geo'] = (146,370,820,3427,17236) number_elements['ortho.geo'] = (6,6,6,6,43,179)
number_elements['sphere.geo'] = (56,80,126,347,2303) number_elements['cylinder.geo'] = (404,101,282,404,1169,8164)
number_elements['torus.geo'] = (2518,2715,5286,24144,169082) number_elements['twocyl.geo'] = (578,158,419,578,1899,13712)
number_elements['shaft.geo'] = (863,1743,2589,10855,59980) number_elements['manyholes.geo'] = (176503,28935,70662)
number_elements['cone.geo'] = (441,706,1173,4298,25551) number_elements['twobricks.geo'] = (42,22,22,42,177,595)
number_elements['cubeandring.geo'] = (226,568,1942,7083,35417) number_elements['lshape3d.geo'] = (18,12,12,18,93,324)
number_elements['manyholes.geo'] = (28638,69054) number_elements['sculpture.geo'] = (477,140,260,477,1331,6816)
number_elements['period.geo'] = (587,1362,3136,10876,64321) number_elements['ellipsoid.geo'] = (1271,661,596,1271,5572,38616)
number_elements['lshape3d.geo'] = (12,12,18,83,317) number_elements['matrix.geo'] = (5209,1946,2817,5209,16398,102850)
number_elements['cubemsphere.geo'] = (737,1414,4090,16091,105619) number_elements['cone.geo'] = (1215,501,698,1215,4437,27682)
number_elements['twocyl.geo'] = (151,418,578,1838,12863) number_elements['cubemcyl.geo'] = (19712,3255,8345,19712,90496,536232)
number_elements['cubemcyl.geo'] = (3102,7714,17803,81423,491425) number_elements['boundarycondition.geo'] = (39,22,22,39,165,508)
number_elements['matrix.geo'] = (1936,2765,5005,15244,93613) number_elements['torus.geo'] = (5522,2530,2740,5522,25614,180197)
number_elements['fichera.geo'] = (18,18,35,211,477) number_elements['circle_on_cube.geo'] = (636,39,189,636,2056,12409)
number_elements['cylinder.geo'] = (84,272,397,1152,7696) number_elements['cubemsphere.geo'] = (4737,776,1498,4737,17815,115493)
number_elements['part1.stl'] = (328,501,1739,4054,76653) number_elements['part1.stl'] = (1228,347,520,1804,4317,84101)
number_elements['hinge.stl'] = (789,1130,2588,6595,125874) number_elements['hinge.stl'] = (1995,789,1130,2612,6945,136803)
number_elements['frame.step'] = (112262,43857,59126)
number_elements['screw.step'] = (798,1521,7252)

View File

@ -1,12 +1,14 @@
import os, pytest import os, pytest
from netgen.meshing import meshsize from netgen.meshing import meshsize, MeshingParameters, SetMessageImportance
import netgen.gui import netgen.gui
import netgen.csg as csg import netgen.csg as csg
import netgen.stl as stl import netgen.stl as stl
import netgen.csg as csg import netgen.occ as occ
from results import * from results import *
SetMessageImportance(0)
def getFiles(fileEnding): def getFiles(fileEnding):
r, d, files = next(os.walk(os.path.join("..","..","tutorials"))) r, d, files = next(os.walk(os.path.join("..","..","tutorials")))
return (f for f in files if f.endswith(fileEnding)) return (f for f in files if f.endswith(fileEnding))
@ -27,17 +29,22 @@ def getResultFunc(filename):
return resultFunc return resultFunc
def getMeshingparameters(filename): def getMeshingparameters(filename):
standard = (meshsize.very_coarse, meshsize.coarse, meshsize.moderate, meshsize.fine, meshsize.very_fine) standard = [{}] + [{ "mp" : ms } for ms in (meshsize.very_coarse, meshsize.coarse, meshsize.moderate, meshsize.fine, meshsize.very_fine)]
if filename == "shell.geo": if filename == "shell.geo":
return [] # do not test this example cause it needs so long... return [] # do not test this example cause it needs so long...
if filename == "extrusion.geo": if filename == "extrusion.geo":
return [] # this segfaults right now return [] # this segfaults right now
if filename == "manyholes2.geo" or filename == "manyholes.geo": if filename == "manyholes2.geo":
return standard[:2] # this gets too big for finer meshsizes return [standard[1]] # this gets too big for finer meshsizes
if filename in ("manyholes.geo", "frame.step"):
return standard[:3] # this gets too big for finer meshsizes
if filename == "screw.step":
return standard[3:] # coarser meshes don't work here
return standard return standard
# don't test step files as they do not respect all meshing parameters correctly yet. # TODO: step files do not respect gui meshsizes yet.
_geofiles = [f for f in getFiles(".geo")] + [f for f in getFiles(".stl")] # + [f for f in getFiles(".step")] _geofiles = [f for f in getFiles(".geo")] + [f for f in getFiles(".stl")] + [f for f in getFiles(".step")]
def generateMesh(filename, mp): def generateMesh(filename, mp):
if filename.endswith(".geo"): if filename.endswith(".geo"):
@ -46,7 +53,7 @@ def generateMesh(filename, mp):
geo = stl.STLGeometry(os.path.join("..","..","tutorials", filename)) geo = stl.STLGeometry(os.path.join("..","..","tutorials", filename))
elif filename.endswith(".step"): elif filename.endswith(".step"):
geo = occ.OCCGeometry(os.path.join("..","..","tutorials", filename)) geo = occ.OCCGeometry(os.path.join("..","..","tutorials", filename))
return geo.GenerateMesh(mp) return geo.GenerateMesh(**mp)
@pytest.mark.parametrize("filename, checkFunc", [(f, getCheckFunc(f)) for f in _geofiles]) @pytest.mark.parametrize("filename, checkFunc", [(f, getCheckFunc(f)) for f in _geofiles])
def test_geoFiles(filename, checkFunc): def test_geoFiles(filename, checkFunc):