diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f8bd00d3..ceb751b8 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -69,10 +69,16 @@ test_win: script: - pip install pytest-check - cd tests\pytest + - python test_tutorials.py new_results.json - cd %NETGEN_BUILD_DIR%\netgen - ctest -C Release -V --output-on-failure - cd .. needs: ["build_win"] + artifacts: + paths: + - tests/pytest/new_results.json + when: always + expire_in: 1 week cleanup_win: <<: *win diff --git a/libsrc/core/CMakeLists.txt b/libsrc/core/CMakeLists.txt index d91a1bbe..d6a2eef8 100644 --- a/libsrc/core/CMakeLists.txt +++ b/libsrc/core/CMakeLists.txt @@ -23,8 +23,28 @@ if(EMSCRIPTEN) target_compile_options(ngcore PUBLIC -sNO_DISABLE_EXCEPTION_CATCHING) endif() -if (CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9) - target_link_libraries(ngcore PUBLIC stdc++fs) +if (CMAKE_CXX_COMPILER_ID MATCHES "GNU") + # Python packages on Linux are compiled with the old ABI, + # make sure that the same ABI is used in plugins aswell + try_run( + ret_val can_compile + ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/_get_glibcxx_use_cxx11_abi.cpp + RUN_OUTPUT_VARIABLE use_glibcxx_cxx11_abi + ) + target_compile_definitions(ngcore PUBLIC -D_GLIBCXX_USE_CXX11_ABI=${use_glibcxx_cxx11_abi}) + if(USE_PYTHON) + try_run( + ret_val can_compile + ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/_get_gxx_abi.cpp + RUN_OUTPUT_VARIABLE cxx_abi_version + ) + if(${can_compile} AND (${ret_val} EQUAL 0)) + # Different python modules using pybind11 need to use the same C++ ABI version + # for compatibility + message(STATUS "GNU C++ ABI version: ${cxx_abi_version}") + target_compile_options(ngcore PUBLIC "-fabi-version=${cxx_abi_version}") + endif() + endif(USE_PYTHON) endif() if(USE_PYTHON) diff --git a/libsrc/core/_get_glibcxx_use_cxx11_abi.cpp b/libsrc/core/_get_glibcxx_use_cxx11_abi.cpp new file mode 100644 index 00000000..63588187 --- /dev/null +++ b/libsrc/core/_get_glibcxx_use_cxx11_abi.cpp @@ -0,0 +1,13 @@ +#include + +int main() { + #ifdef _GLIBCXX_USE_CXX11_ABI + if(_GLIBCXX_USE_CXX11_ABI) + std::cout << 1; + else + std::cout << 0; + #else // _GLIBCXX_USE_CXX11_ABI + std::cout << 0; + #endif // _GLIBCXX_USE_CXX11_ABI + return 0; +} diff --git a/libsrc/core/_get_gxx_abi.cpp b/libsrc/core/_get_gxx_abi.cpp new file mode 100644 index 00000000..ac1579f0 --- /dev/null +++ b/libsrc/core/_get_gxx_abi.cpp @@ -0,0 +1,7 @@ +#include + +int main() { + if (__GXX_ABI_VERSION >= 2000 || __GXX_ABI_VERSION < 1000) return 1; + std::cout << (__GXX_ABI_VERSION % 100); + return 0; +} diff --git a/libsrc/meshing/basegeom.cpp b/libsrc/meshing/basegeom.cpp index 6ece1891..c9902f71 100644 --- a/libsrc/meshing/basegeom.cpp +++ b/libsrc/meshing/basegeom.cpp @@ -767,7 +767,10 @@ namespace netgen PointIndex pi = vert->nr + 1; if(glob2loc[pi] == 0) { - meshing.AddPoint(mesh[pi], pi); + auto gi = face.Project(mesh[pi]); + MultiPointGeomInfo mgi; + mgi.AddPointGeomInfo(gi); + meshing.AddPoint(mesh[pi], pi, &mgi); cntp++; glob2loc[pi] = cntp; } diff --git a/libsrc/meshing/improve3.cpp b/libsrc/meshing/improve3.cpp index d7aa8b5d..1fcb11af 100644 --- a/libsrc/meshing/improve3.cpp +++ b/libsrc/meshing/improve3.cpp @@ -288,7 +288,7 @@ double MeshOptimize3d :: CombineImproveEdge ( elem.Touch(); if (!mesh.LegalTet(elem)) - badness_new += 1e4; + badness_new += GetLegalPenalty(); } } @@ -543,9 +543,9 @@ double MeshOptimize3d :: SplitImproveEdge (Table & elem if (newel2[l] == pi1) newel2[l] = ptmp; } - if (!mesh.LegalTet (oldel)) bad1 += 1e6; - if (!mesh.LegalTet (newel1)) bad2 += 1e6; - if (!mesh.LegalTet (newel2)) bad2 += 1e6; + if (!mesh.LegalTet (oldel)) bad1 += GetLegalPenalty(); + if (!mesh.LegalTet (newel1)) bad2 += GetLegalPenalty(); + if (!mesh.LegalTet (newel2)) bad2 += GetLegalPenalty(); } d_badness = bad2-bad1; @@ -819,7 +819,7 @@ double MeshOptimize3d :: SwapImproveEdge ( if (!mesh.LegalTet(el31) || !mesh.LegalTet(el32) || !mesh.LegalTet(el33)) - bad1 += 1e4; + bad1 += GetLegalPenalty(); el21[0] = pi3; el21[1] = pi4; @@ -841,7 +841,7 @@ double MeshOptimize3d :: SwapImproveEdge ( if (!mesh.LegalTet(el21) || !mesh.LegalTet(el22)) - bad2 += 1e4; + bad2 += GetLegalPenalty(); if ((goal == OPT_CONFORM) && NotTooBad(bad1, bad2)) @@ -967,7 +967,7 @@ double MeshOptimize3d :: SwapImproveEdge ( !mesh.LegalTet(el2) || !mesh.LegalTet(el3) || !mesh.LegalTet(el4)) - bad1 += 1e4; + bad1 += GetLegalPenalty(); } el1[0] = pi3; el1[1] = pi5; @@ -1002,7 +1002,7 @@ double MeshOptimize3d :: SwapImproveEdge ( !mesh.LegalTet(el2) || !mesh.LegalTet(el3) || !mesh.LegalTet(el4)) - bad2 += 1e4; + bad2 += GetLegalPenalty(); } @@ -1038,7 +1038,7 @@ double MeshOptimize3d :: SwapImproveEdge ( !mesh.LegalTet(el2b) || !mesh.LegalTet(el3b) || !mesh.LegalTet(el4b)) - bad3 += 1e4; + bad3 += GetLegalPenalty(); } bool swap2, swap3; @@ -1188,7 +1188,7 @@ double MeshOptimize3d :: SwapImproveEdge ( bad2 += CalcBad (mesh.Points(), hel, 0); hel.Touch(); - if (!mesh.LegalTet(hel)) bad2 += 1e4; + if (!mesh.LegalTet(hel)) bad2 += GetLegalPenalty(); hel[2] = suroundpts[k % nsuround]; hel[1] = suroundpts[(k+1) % nsuround]; @@ -1197,7 +1197,7 @@ double MeshOptimize3d :: SwapImproveEdge ( bad2 += CalcBad (mesh.Points(), hel, 0); hel.Touch(); - if (!mesh.LegalTet(hel)) bad2 += 1e4; + if (!mesh.LegalTet(hel)) bad2 += GetLegalPenalty(); } // (*testout) << "bad2," << l << " = " << bad2 << endl; @@ -2404,7 +2404,7 @@ double MeshOptimize3d :: SwapImprove2 ( ElementIndex eli1, int face, if (!mesh.LegalTet(elem) || !mesh.LegalTet(elem2)) - bad1 += 1e4; + bad1 += GetLegalPenalty(); el31.PNum(1) = pi1; @@ -2437,7 +2437,7 @@ double MeshOptimize3d :: SwapImprove2 ( ElementIndex eli1, int face, if (!mesh.LegalTet(el31) || !mesh.LegalTet(el32) || !mesh.LegalTet(el33)) - bad2 += 1e4; + bad2 += GetLegalPenalty(); d_badness = bad2 - bad1; diff --git a/libsrc/meshing/improve3.hpp b/libsrc/meshing/improve3.hpp index 9415740a..e35ac924 100644 --- a/libsrc/meshing/improve3.hpp +++ b/libsrc/meshing/improve3.hpp @@ -70,6 +70,12 @@ public: return netgen::CalcTotalBad (points, elements, mp); } + + double GetLegalPenalty() + { + return goal == OPT_LEGAL ? 1e15 : 1e6; + } + }; diff --git a/libsrc/meshing/meshfunc.cpp b/libsrc/meshing/meshfunc.cpp index 1c666436..e62606a8 100644 --- a/libsrc/meshing/meshfunc.cpp +++ b/libsrc/meshing/meshfunc.cpp @@ -753,7 +753,6 @@ namespace netgen int it = 10; int nillegal, oldn; - PrintMessage (1, "Remove Illegal Elements"); // return, if non-pure tet-mesh /* if (!mesh3d.PureTetMesh()) @@ -762,6 +761,8 @@ namespace netgen mesh3d.CalcSurfacesOfNode(); nillegal = mesh3d.MarkIllegalElements(); + if(nillegal) + PrintMessage (1, "Remove Illegal Elements"); MeshingParameters dummymp; MeshOptimize3d optmesh(mesh3d, dummymp, OPT_LEGAL); diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 9223cc1c..fabe9c53 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -4,13 +4,20 @@ if(have_options) get_target_property(ngcore_compile_options ngcore INTERFACE_COMPILE_OPTIONS) endif(have_options) -configure_file(config_template.py ${CMAKE_CURRENT_BINARY_DIR}/config.py @ONLY) +configure_file(config/config_template.py ${CMAKE_CURRENT_BINARY_DIR}/config.py @ONLY) configure_file(version_template.py ${CMAKE_CURRENT_BINARY_DIR}/version.py @ONLY) install(FILES + config/__init__.py + config/__main__.py ${CMAKE_CURRENT_BINARY_DIR}/config.py + DESTINATION ${NG_INSTALL_DIR_PYTHON}/${NG_INSTALL_SUFFIX}/config/ + COMPONENT netgen + ) + +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/version.py - __main__.py __init__.py config_cli.py + __main__.py __init__.py meshing.py csg.py geom2d.py stl.py gui.py NgOCC.py occ.py read_gmsh.py read_meshio.py webgui.py diff --git a/python/config/__init__.py b/python/config/__init__.py new file mode 100644 index 00000000..27c9ec62 --- /dev/null +++ b/python/config/__init__.py @@ -0,0 +1 @@ +from .config import * diff --git a/python/config/__main__.py b/python/config/__main__.py new file mode 100644 index 00000000..6760d400 --- /dev/null +++ b/python/config/__main__.py @@ -0,0 +1,4 @@ +from .config import get_cmake_dir + +if __name__ == '__main__': + print(get_cmake_dir()) diff --git a/python/config_template.py b/python/config/config_template.py similarity index 98% rename from python/config_template.py rename to python/config/config_template.py index ba1dd6e1..153336b6 100644 --- a/python/config_template.py +++ b/python/config/config_template.py @@ -60,7 +60,7 @@ version = NETGEN_VERSION_GIT def get_cmake_dir(): import os.path as p - d_python = p.dirname(p.dirname(__file__)) + d_python = p.dirname(p.dirname(p.dirname(__file__))) py_to_cmake = p.relpath( NG_INSTALL_DIR_CMAKE, NG_INSTALL_DIR_PYTHON diff --git a/python/config_cli.py b/python/config_cli.py deleted file mode 100644 index 572f9750..00000000 --- a/python/config_cli.py +++ /dev/null @@ -1,10 +0,0 @@ -import netgen.config - -if __name__=="__main__": - import argparse - parser = argparse.ArgumentParser() - parser.add_argument("--cmake-dir", help="print path to CMake config files", action='store_true') - args = parser.parse_args() - if(args.cmake_dir): - print(netgen.config.get_cmake_dir()) - diff --git a/setup.py b/setup.py index 8d16161c..26dbd900 100644 --- a/setup.py +++ b/setup.py @@ -49,7 +49,7 @@ if 'NETGEN_ARCH' in os.environ and os.environ['NETGEN_ARCH'] == 'avx2': if 'darwin' in sys.platform: flag = "'-Xarch_x86_64;-march=core-avx2'" elif 'win' in sys.platform: - flag = '/AVX2' + flag = '/arch:AVX2' else: flag = '-march=core-avx2' cmake_args += [f'-DNG_COMPILE_FLAGS={flag}'] diff --git a/tests/pytest/compare_results.py b/tests/pytest/compare_results.py index f95e97c8..5a5f9538 100644 --- a/tests/pytest/compare_results.py +++ b/tests/pytest/compare_results.py @@ -14,6 +14,8 @@ def readData(a, files): ne3d=[] file=[] for f in files: + if f == 'cylinder.geo': + continue for t in a[f]: if t['ne1d']>0: ne1d.append(t['ne1d']) diff --git a/tests/pytest/results.json b/tests/pytest/results.json index ed19e006..8f58035e 100644 --- a/tests/pytest/results.json +++ b/tests/pytest/results.json @@ -133,9 +133,9 @@ ], "ne1d": 136, "ne2d": 204, - "ne3d": 306, - "quality_histogram": "[0, 0, 0, 2, 4, 7, 11, 10, 9, 15, 15, 20, 21, 38, 44, 41, 34, 24, 9, 2]", - "total_badness": 514.31347847 + "ne3d": 298, + "quality_histogram": "[0, 0, 0, 2, 4, 7, 10, 10, 9, 12, 13, 23, 22, 27, 43, 47, 35, 25, 8, 1]", + "total_badness": 498.40723523 }, { "angles_tet": [ @@ -302,9 +302,9 @@ ], "ne1d": 32, "ne2d": 208, - "ne3d": 457, - "quality_histogram": "[0, 0, 0, 4, 6, 7, 19, 15, 24, 25, 34, 39, 28, 61, 38, 46, 40, 39, 19, 13]", - "total_badness": 786.17360323 + "ne3d": 477, + "quality_histogram": "[0, 0, 0, 1, 4, 9, 20, 22, 19, 29, 46, 33, 45, 51, 50, 47, 41, 32, 20, 8]", + "total_badness": 817.64355327 }, { "angles_tet": [ @@ -319,7 +319,7 @@ "ne2d": 420, "ne3d": 626, "quality_histogram": "[0, 0, 0, 10, 8, 19, 21, 14, 37, 71, 91, 75, 76, 62, 48, 37, 18, 18, 18, 3]", - "total_badness": 1193.0076866 + "total_badness": 1193.0076867 }, { "angles_tet": [ @@ -477,8 +477,8 @@ }, { "angles_tet": [ - 17.294, - 155.18 + 25.216, + 134.34 ], "angles_trig": [ 22.715, @@ -486,14 +486,14 @@ ], "ne1d": 134, "ne2d": 142, - "ne3d": 187, - "quality_histogram": "[0, 0, 0, 0, 0, 1, 0, 1, 0, 4, 8, 17, 23, 31, 18, 28, 31, 16, 7, 2]", - "total_badness": 269.564478 + "ne3d": 186, + "quality_histogram": "[0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 8, 19, 24, 28, 20, 28, 31, 15, 7, 2]", + "total_badness": 265.13433105 }, { "angles_tet": [ - 14.206, - 159.84 + 20.8, + 134.83 ], "angles_trig": [ 19.613, @@ -501,9 +501,9 @@ ], "ne1d": 190, "ne2d": 242, - "ne3d": 438, - "quality_histogram": "[0, 0, 0, 0, 2, 0, 0, 4, 3, 15, 37, 52, 36, 66, 71, 58, 42, 38, 11, 3]", - "total_badness": 658.29595492 + "ne3d": 437, + "quality_histogram": "[0, 0, 0, 0, 1, 0, 0, 4, 3, 15, 34, 53, 36, 68, 71, 58, 42, 38, 11, 3]", + "total_badness": 652.96404483 }, { "angles_tet": [ @@ -777,9 +777,9 @@ ], "ne1d": 68, "ne2d": 272, - "ne3d": 1132, - "quality_histogram": "[0, 0, 0, 0, 0, 0, 1, 3, 6, 12, 37, 66, 114, 174, 197, 195, 150, 113, 52, 12]", - "total_badness": 1578.3627501 + "ne3d": 1115, + "quality_histogram": "[0, 0, 0, 0, 0, 0, 1, 3, 4, 14, 31, 67, 113, 183, 202, 178, 149, 99, 58, 13]", + "total_badness": 1554.8534163 }, { "angles_tet": [ @@ -860,18 +860,18 @@ }, { "angles_tet": [ - 16.406, + 14.788, 156.92 ], "angles_trig": [ - 19.37, - 130.41 + 11.549, + 134.56 ], "ne1d": 36, "ne2d": 152, - "ne3d": 471, - "quality_histogram": "[0, 0, 0, 0, 0, 5, 9, 22, 43, 37, 39, 53, 46, 32, 40, 41, 49, 27, 21, 7]", - "total_badness": 798.57500814 + "ne3d": 548, + "quality_histogram": "[0, 0, 0, 0, 1, 7, 24, 35, 41, 59, 44, 55, 57, 51, 39, 38, 48, 26, 19, 4]", + "total_badness": 980.19781779 }, { "angles_tet": [ @@ -946,9 +946,9 @@ ], "ne1d": 48, "ne2d": 100, - "ne3d": 103, - "quality_histogram": "[0, 0, 0, 2, 1, 4, 13, 15, 10, 11, 10, 5, 5, 3, 6, 10, 8, 0, 0, 0]", - "total_badness": 227.02057451 + "ne3d": 102, + "quality_histogram": "[0, 0, 0, 2, 1, 4, 12, 15, 11, 11, 10, 5, 4, 3, 6, 10, 8, 0, 0, 0]", + "total_badness": 224.10472313 }, { "angles_tet": [ @@ -1464,13 +1464,13 @@ ], "angles_trig": [ 8.9881, - 149.17 + 142.67 ], "ne1d": 298, "ne2d": 502, "ne3d": 598, - "quality_histogram": "[0, 0, 3, 5, 10, 16, 29, 40, 43, 39, 54, 62, 60, 51, 45, 59, 38, 25, 14, 5]", - "total_badness": 1148.0390643 + "quality_histogram": "[0, 0, 1, 4, 10, 14, 29, 39, 46, 40, 56, 63, 61, 50, 43, 60, 37, 26, 14, 5]", + "total_badness": 1132.0903047 }, { "angles_tet": [ @@ -1744,9 +1744,9 @@ ], "ne1d": 2746, "ne2d": 10428, - "ne3d": 22186, - "quality_histogram": "[0, 0, 0, 1, 2, 10, 36, 143, 315, 668, 1305, 2125, 2629, 3075, 2870, 2714, 2456, 2053, 1436, 348]", - "total_badness": 32307.652049 + "ne3d": 22177, + "quality_histogram": "[0, 0, 0, 1, 2, 10, 37, 141, 314, 667, 1312, 2125, 2625, 3088, 2860, 2703, 2437, 2076, 1429, 350]", + "total_badness": 32293.784552 }, { "angles_tet": [ @@ -1776,9 +1776,9 @@ ], "ne1d": 10202, "ne2d": 41054, - "ne3d": 96973, - "quality_histogram": "[0, 0, 0, 0, 3, 14, 77, 228, 649, 1728, 3712, 6466, 9529, 12137, 13060, 13497, 13477, 12189, 8049, 2158]", - "total_badness": 134173.65203 + "ne3d": 97037, + "quality_histogram": "[0, 0, 0, 0, 3, 14, 76, 230, 646, 1720, 3702, 6469, 9523, 12171, 13058, 13512, 13508, 12168, 8074, 2163]", + "total_badness": 134237.53167 } ], "matrix.geo": [ @@ -1808,9 +1808,9 @@ ], "ne1d": 106, "ne2d": 314, - "ne3d": 869, - "quality_histogram": "[0, 0, 5, 33, 47, 52, 74, 69, 102, 93, 83, 80, 65, 49, 43, 32, 22, 18, 2, 0]", - "total_badness": 2092.2409402 + "ne3d": 876, + "quality_histogram": "[0, 0, 5, 33, 47, 50, 72, 68, 97, 92, 81, 76, 63, 51, 44, 32, 29, 28, 7, 1]", + "total_badness": 2078.9282016 }, { "angles_tet": [ @@ -2060,33 +2060,33 @@ }, { "angles_tet": [ - 7.025, - 170.6 + 12.454, + 162.07 ], "angles_trig": [ - 11.507, - 146.85 + 10.412, + 140.67 ], "ne1d": 160, "ne2d": 234, - "ne3d": 401, - "quality_histogram": "[0, 0, 2, 8, 9, 14, 19, 17, 22, 28, 36, 35, 47, 49, 24, 32, 29, 21, 8, 1]", - "total_badness": 786.54568096 + "ne3d": 390, + "quality_histogram": "[0, 0, 0, 5, 7, 13, 24, 18, 26, 26, 32, 36, 45, 41, 22, 33, 30, 21, 10, 1]", + "total_badness": 745.1543892 }, { "angles_tet": [ - 13.089, + 13.042, 161.3 ], "angles_trig": [ - 13.837, - 144.46 + 13.898, + 141.37 ], "ne1d": 232, "ne2d": 494, - "ne3d": 1204, - "quality_histogram": "[0, 0, 0, 0, 13, 21, 39, 41, 71, 83, 112, 118, 152, 145, 117, 108, 72, 68, 39, 5]", - "total_badness": 2092.5543831 + "ne3d": 1188, + "quality_histogram": "[0, 0, 0, 0, 8, 21, 41, 30, 61, 76, 112, 110, 137, 141, 109, 124, 85, 89, 38, 6]", + "total_badness": 2016.0253302 }, { "angles_tet": [ @@ -2156,8 +2156,8 @@ 170.92 ], "angles_trig": [ - 1.7241, - 168.81 + 2.5035, + 155.48 ], "ne1d": 572, "ne2d": 742, @@ -2172,13 +2172,13 @@ ], "angles_trig": [ 3.4703, - 156.24 + 155.55 ], "ne1d": 724, "ne2d": 1340, "ne3d": 2199, - "quality_histogram": "[3, 12, 30, 54, 49, 61, 53, 72, 84, 127, 177, 184, 234, 256, 262, 206, 179, 101, 48, 7]", - "total_badness": 4491.5892664 + "quality_histogram": "[3, 12, 31, 52, 50, 61, 53, 72, 84, 126, 178, 184, 234, 254, 262, 206, 180, 102, 48, 7]", + "total_badness": 4492.7256936 }, { "angles_tet": [ @@ -2413,38 +2413,38 @@ "shaft.geo": [ { "angles_tet": [ - 11.54, - 166.59 + 5.9923, + 168.9 ], "angles_trig": [ - 12.767, - 152.23 + 10.45, + 155.97 ], "ne1d": 708, "ne2d": 1656, - "ne3d": 2609, - "quality_histogram": "[0, 0, 0, 9, 27, 37, 48, 57, 80, 156, 230, 362, 300, 233, 232, 285, 255, 174, 101, 23]", - "total_badness": 4340.100648 + "ne3d": 2645, + "quality_histogram": "[0, 1, 14, 31, 44, 52, 49, 56, 80, 150, 244, 358, 301, 220, 224, 284, 254, 169, 90, 24]", + "total_badness": 4677.5910875 }, { "angles_tet": [ - 10.898, - 157.91 + 8.5237, + 165.9 ], "angles_trig": [ 10.094, - 120.23 + 120.04 ], "ne1d": 410, "ne2d": 542, - "ne3d": 667, - "quality_histogram": "[0, 0, 0, 1, 1, 6, 4, 8, 18, 31, 32, 49, 57, 72, 72, 72, 40, 84, 60, 60]", - "total_badness": 979.60058088 + "ne3d": 717, + "quality_histogram": "[0, 0, 0, 2, 1, 4, 3, 9, 19, 28, 37, 57, 65, 82, 74, 80, 80, 88, 62, 26]", + "total_badness": 1058.1207822 }, { "angles_tet": [ - 13.369, - 156.78 + 13.382, + 157.07 ], "angles_trig": [ 14.807, @@ -2452,9 +2452,9 @@ ], "ne1d": 510, "ne2d": 912, - "ne3d": 1773, - "quality_histogram": "[0, 0, 0, 0, 2, 21, 34, 63, 77, 90, 135, 161, 195, 192, 222, 216, 175, 108, 64, 18]", - "total_badness": 2865.6214541 + "ne3d": 1820, + "quality_histogram": "[0, 0, 0, 2, 7, 27, 46, 83, 98, 117, 134, 154, 181, 195, 223, 189, 172, 107, 66, 19]", + "total_badness": 3049.4355671 }, { "angles_tet": [ @@ -2467,9 +2467,9 @@ ], "ne1d": 708, "ne2d": 1656, - "ne3d": 2496, - "quality_histogram": "[0, 0, 0, 1, 9, 3, 11, 39, 78, 158, 211, 341, 291, 258, 242, 300, 255, 187, 90, 22]", - "total_badness": 3916.6882733 + "ne3d": 2553, + "quality_histogram": "[0, 0, 0, 1, 8, 3, 11, 32, 83, 164, 227, 330, 314, 265, 249, 303, 271, 182, 88, 22]", + "total_badness": 4003.23251 }, { "angles_tet": [ @@ -2980,18 +2980,18 @@ }, { "angles_tet": [ - 2.7715, - 172.56 + 2.7899, + 172.79 ], "angles_trig": [ - 5.1767, - 165.44 + 5.1656, + 163.81 ], "ne1d": 0, "ne2d": 648, - "ne3d": 3591, - "quality_histogram": "[7, 99, 277, 463, 516, 456, 339, 316, 239, 207, 166, 114, 108, 81, 65, 60, 40, 22, 16, 0]", - "total_badness": 14148.85468 + "ne3d": 3545, + "quality_histogram": "[7, 92, 302, 447, 533, 448, 365, 262, 259, 198, 148, 117, 83, 62, 67, 57, 45, 23, 21, 9]", + "total_badness": 14086.983422 }, { "angles_tet": [ @@ -3081,9 +3081,9 @@ ], "ne1d": 390, "ne2d": 516, - "ne3d": 1332, - "quality_histogram": "[0, 1, 5, 13, 16, 44, 80, 117, 127, 149, 156, 138, 121, 106, 86, 80, 52, 27, 11, 3]", - "total_badness": 2755.5110729 + "ne3d": 1330, + "quality_histogram": "[0, 1, 5, 14, 16, 42, 76, 118, 126, 151, 160, 134, 120, 106, 86, 80, 53, 28, 11, 3]", + "total_badness": 2746.9153651 }, { "angles_tet": [ @@ -3097,8 +3097,8 @@ "ne1d": 512, "ne2d": 864, "ne3d": 2356, - "quality_histogram": "[0, 0, 0, 3, 9, 13, 43, 64, 120, 145, 190, 205, 312, 384, 344, 235, 134, 88, 43, 24]", - "total_badness": 3889.567942 + "quality_histogram": "[0, 0, 0, 3, 9, 13, 43, 64, 120, 144, 192, 205, 312, 383, 344, 235, 134, 88, 43, 24]", + "total_badness": 3889.9503966 }, { "angles_tet": [ @@ -3367,14 +3367,14 @@ 161.08 ], "angles_trig": [ - 13.77, - 138.15 + 15.704, + 148.08 ], "ne1d": 102, "ne2d": 234, - "ne3d": 431, - "quality_histogram": "[0, 0, 0, 0, 5, 11, 17, 27, 44, 29, 15, 24, 36, 41, 37, 38, 61, 32, 12, 2]", - "total_badness": 764.91980689 + "ne3d": 445, + "quality_histogram": "[0, 0, 0, 0, 5, 11, 17, 23, 47, 28, 34, 35, 45, 31, 29, 41, 44, 30, 19, 6]", + "total_badness": 795.41761043 }, { "angles_tet": [ @@ -3422,4 +3422,4 @@ "total_badness": 12938.174838 } ] -} \ No newline at end of file +} diff --git a/tests/pytest/test_tutorials.py b/tests/pytest/test_tutorials.py index f6e3c6df..2d25804c 100644 --- a/tests/pytest/test_tutorials.py +++ b/tests/pytest/test_tutorials.py @@ -73,7 +73,7 @@ def getMeshingparameters(filename): if filename == "screw.step": return standard[3:] # coarser meshes don't work here if filename == "cylinder.geo": - return standard[0:-1] # very fine gives inconsistent reults + return [] # gives inconsistent reults if filename == "cylsphere.geo": return standard[0:2] + standard[3:] # coarse gives inconsistent reults (other mesh on MacOS) if filename == "part1.stl": @@ -133,8 +133,8 @@ def test_geoFiles(filename, mp, i, refdata): checkData(mesh, mp, ref[i]) -def generateResultFile(): - import re, time +def generateResultFile(output_file='results.json'): + import time data = {} with TaskManager(): for _file in _geofiles + _additional_testfiles: @@ -155,8 +155,9 @@ def generateResultFile(): print("needed", time.time() - start, "seconds") s = json.dumps(data, sort_keys=True, indent=4) - open("results.json", "w").write(s) + open(output_file, "w").write(s) print("done") if __name__ == "__main__": - generateResultFile() + import sys + generateResultFile(*sys.argv[1:])