diff --git a/libsrc/meshing/python_mesh.cpp b/libsrc/meshing/python_mesh.cpp index fb4b10d2..8b6dd1c8 100644 --- a/libsrc/meshing/python_mesh.cpp +++ b/libsrc/meshing/python_mesh.cpp @@ -21,94 +21,6 @@ namespace netgen extern shared_ptr ng_geometry; extern void Optimize2d (Mesh & mesh, MeshingParameters & mp); - MeshingParameters CreateMPfromKwargs(py::kwargs kwargs) - { - MeshingParameters mp; - if(kwargs.contains("optimize3d")) - mp.optimize3d = py::cast(kwargs["optimize3d"]); - if(kwargs.contains("optsteps3d")) - mp.optsteps3d = py::cast(kwargs["optsteps3d"]); - if(kwargs.contains("optimize2d")) - mp.optimize2d = py::cast(kwargs["optimize2d"]); - if(kwargs.contains("optsteps2d")) - mp.optsteps2d = py::cast(kwargs["optsteps2d"]); - if(kwargs.contains("opterrpow")) - mp.opterrpow = py::cast(kwargs["opterrpow"]); - if(kwargs.contains("blockfill")) - mp.blockfill = py::cast(kwargs["blockfill"]); - if(kwargs.contains("filldist")) - mp.filldist = py::cast(kwargs["filldist"]); - if(kwargs.contains("safety")) - mp.safety = py::cast(kwargs["safety"]); - if(kwargs.contains("relinnersafety")) - mp.relinnersafety = py::cast(kwargs["relinnersafety"]); - if(kwargs.contains("uselocalh")) - mp.uselocalh = py::cast(kwargs["uselocalh"]); - if(kwargs.contains("grading")) - mp.grading = py::cast(kwargs["grading"]); - if(kwargs.contains("delaunay")) - mp.delaunay = py::cast(kwargs["delaunay"]); - if(kwargs.contains("maxh")) - mp.maxh = py::cast(kwargs["maxh"]); - if(kwargs.contains("minh")) - mp.minh = py::cast(kwargs["minh"]); - if(kwargs.contains("meshsizefilename")) - mp.meshsizefilename = py::cast(kwargs["meshsizefilename"]); - if(kwargs.contains("startinsurface")) - mp.startinsurface = py::cast(kwargs["startinsurface"]); - if(kwargs.contains("checkoverlap")) - mp.checkoverlap = py::cast(kwargs["checkoverlap"]); - if(kwargs.contains("checkoverlappingboundary")) - mp.checkoverlappingboundary = py::cast(kwargs["checkoverlappingboundary"]); - if(kwargs.contains("checkchartboundary")) - mp.checkchartboundary = py::cast(kwargs["checkchartboundary"]); - if(kwargs.contains("curvaturesafety")) - mp.curvaturesafety = py::cast(kwargs["curvaturesafety"]); - if(kwargs.contains("segmentsperedge")) - mp.segmentsperedge = py::cast(kwargs["segmentsperedge"]); - if(kwargs.contains("parthread")) - mp.parthread = py::cast(kwargs["parthread"]); - if(kwargs.contains("elsizeweight")) - mp.elsizeweight = py::cast(kwargs["elsizeweight"]); - if(kwargs.contains("perfstepsstart")) - mp.perfstepsstart = py::cast(kwargs["perfstepsstart"]); - if(kwargs.contains("perfstepsend")) - mp.perfstepsend = py::cast(kwargs["perfstepsend"]); - if(kwargs.contains("giveuptol2d")) - mp.giveuptol2d = py::cast(kwargs["giveuptol2d"]); - if(kwargs.contains("giveuptol")) - mp.giveuptol = py::cast(kwargs["giveuptol"]); - if(kwargs.contains("maxoutersteps")) - mp.maxoutersteps = py::cast(kwargs["maxoutersteps"]); - if(kwargs.contains("starshapeclass")) - mp.starshapeclass = py::cast(kwargs["starshapeclass"]); - if(kwargs.contains("baseelnp")) - mp.baseelnp = py::cast(kwargs["baseelnp"]); - if(kwargs.contains("sloppy")) - mp.sloppy = py::cast(kwargs["sloppy"]); - if(kwargs.contains("badellimit")) - mp.badellimit = py::cast(kwargs["badellimit"]); - if(kwargs.contains("check_impossible")) - mp.check_impossible = py::cast(kwargs["check_impossible"]); - if(kwargs.contains("only3D_domain_nr")) - mp.only3D_domain_nr = py::cast(kwargs["only3D_domain_nr"]); - if(kwargs.contains("secondorder")) - mp.secondorder = py::cast(kwargs["secondorder"]); - if(kwargs.contains("elementorder")) - mp.elementorder = py::cast(kwargs["elementorder"]); - if(kwargs.contains("quad")) - mp.quad = py::cast(kwargs["quad"]); - if(kwargs.contains("try_hexes")) - mp.try_hexes = py::cast(kwargs["try_hexes"]); - if(kwargs.contains("inverttets")) - mp.inverttets = py::cast(kwargs["inverttets"]); - if(kwargs.contains("inverttrigs")) - mp.inverttrigs = py::cast(kwargs["inverttrigs"]); - if(kwargs.contains("autozrefine")) - mp.autozrefine = py::cast(kwargs["autozrefine"]); - return mp; - } - #ifdef PARALLEL /** we need allreduce in python-wrapped communicators **/ template diff --git a/libsrc/meshing/python_mesh.hpp b/libsrc/meshing/python_mesh.hpp index d0048691..98762684 100644 --- a/libsrc/meshing/python_mesh.hpp +++ b/libsrc/meshing/python_mesh.hpp @@ -80,5 +80,91 @@ elsizeweight: float = 0.2 )delimiter"; - MeshingParameters CreateMPfromKwargs(py::kwargs kwargs); + inline MeshingParameters CreateMPfromKwargs(py::kwargs kwargs) + { + MeshingParameters mp; + if(kwargs.contains("optimize3d")) + mp.optimize3d = py::cast(kwargs["optimize3d"]); + if(kwargs.contains("optsteps3d")) + mp.optsteps3d = py::cast(kwargs["optsteps3d"]); + if(kwargs.contains("optimize2d")) + mp.optimize2d = py::cast(kwargs["optimize2d"]); + if(kwargs.contains("optsteps2d")) + mp.optsteps2d = py::cast(kwargs["optsteps2d"]); + if(kwargs.contains("opterrpow")) + mp.opterrpow = py::cast(kwargs["opterrpow"]); + if(kwargs.contains("blockfill")) + mp.blockfill = py::cast(kwargs["blockfill"]); + if(kwargs.contains("filldist")) + mp.filldist = py::cast(kwargs["filldist"]); + if(kwargs.contains("safety")) + mp.safety = py::cast(kwargs["safety"]); + if(kwargs.contains("relinnersafety")) + mp.relinnersafety = py::cast(kwargs["relinnersafety"]); + if(kwargs.contains("uselocalh")) + mp.uselocalh = py::cast(kwargs["uselocalh"]); + if(kwargs.contains("grading")) + mp.grading = py::cast(kwargs["grading"]); + if(kwargs.contains("delaunay")) + mp.delaunay = py::cast(kwargs["delaunay"]); + if(kwargs.contains("maxh")) + mp.maxh = py::cast(kwargs["maxh"]); + if(kwargs.contains("minh")) + mp.minh = py::cast(kwargs["minh"]); + if(kwargs.contains("meshsizefilename")) + mp.meshsizefilename = py::cast(kwargs["meshsizefilename"]); + if(kwargs.contains("startinsurface")) + mp.startinsurface = py::cast(kwargs["startinsurface"]); + if(kwargs.contains("checkoverlap")) + mp.checkoverlap = py::cast(kwargs["checkoverlap"]); + if(kwargs.contains("checkoverlappingboundary")) + mp.checkoverlappingboundary = py::cast(kwargs["checkoverlappingboundary"]); + if(kwargs.contains("checkchartboundary")) + mp.checkchartboundary = py::cast(kwargs["checkchartboundary"]); + if(kwargs.contains("curvaturesafety")) + mp.curvaturesafety = py::cast(kwargs["curvaturesafety"]); + if(kwargs.contains("segmentsperedge")) + mp.segmentsperedge = py::cast(kwargs["segmentsperedge"]); + if(kwargs.contains("parthread")) + mp.parthread = py::cast(kwargs["parthread"]); + if(kwargs.contains("elsizeweight")) + mp.elsizeweight = py::cast(kwargs["elsizeweight"]); + if(kwargs.contains("perfstepsstart")) + mp.perfstepsstart = py::cast(kwargs["perfstepsstart"]); + if(kwargs.contains("perfstepsend")) + mp.perfstepsend = py::cast(kwargs["perfstepsend"]); + if(kwargs.contains("giveuptol2d")) + mp.giveuptol2d = py::cast(kwargs["giveuptol2d"]); + if(kwargs.contains("giveuptol")) + mp.giveuptol = py::cast(kwargs["giveuptol"]); + if(kwargs.contains("maxoutersteps")) + mp.maxoutersteps = py::cast(kwargs["maxoutersteps"]); + if(kwargs.contains("starshapeclass")) + mp.starshapeclass = py::cast(kwargs["starshapeclass"]); + if(kwargs.contains("baseelnp")) + mp.baseelnp = py::cast(kwargs["baseelnp"]); + if(kwargs.contains("sloppy")) + mp.sloppy = py::cast(kwargs["sloppy"]); + if(kwargs.contains("badellimit")) + mp.badellimit = py::cast(kwargs["badellimit"]); + if(kwargs.contains("check_impossible")) + mp.check_impossible = py::cast(kwargs["check_impossible"]); + if(kwargs.contains("only3D_domain_nr")) + mp.only3D_domain_nr = py::cast(kwargs["only3D_domain_nr"]); + if(kwargs.contains("secondorder")) + mp.secondorder = py::cast(kwargs["secondorder"]); + if(kwargs.contains("elementorder")) + mp.elementorder = py::cast(kwargs["elementorder"]); + if(kwargs.contains("quad")) + mp.quad = py::cast(kwargs["quad"]); + if(kwargs.contains("try_hexes")) + mp.try_hexes = py::cast(kwargs["try_hexes"]); + if(kwargs.contains("inverttets")) + mp.inverttets = py::cast(kwargs["inverttets"]); + if(kwargs.contains("inverttrigs")) + mp.inverttrigs = py::cast(kwargs["inverttrigs"]); + if(kwargs.contains("autozrefine")) + mp.autozrefine = py::cast(kwargs["autozrefine"]); + return mp; + } } // namespace netgen