mirror of
https://github.com/NGSolve/netgen.git
synced 2024-12-27 06:10:34 +05:00
8ba6bad6fd
Squashed commit of the following: commit 84f36ffeb409f5fddb389c75ee48b4872b516ae9 Author: Matthias Hochsteger <mhochsteger@cerbsim.com> Date: Fri Oct 16 18:27:15 2020 +0200 revert change in spline partitioning commit d4aef23a22a9beb26c4453267c99dd7533174ced Merge: 15a467aa97dfecd0
Author: Matthias Hochsteger <mhochsteger@cerbsim.com> Date: Fri Oct 16 17:59:00 2020 +0200 Merge branch 'master' into delaunay2d commit 15a467aa7f7cb09f9ea3d984905fe3da69f0b238 Author: Matthias Hochsteger <mhochsteger@cerbsim.com> Date: Fri Oct 16 17:44:31 2020 +0200 delaunay2d - fix trig orientation commit be223412ad972722a51b64a5bccf7ca2bec566c8 Author: Matthias Hochsteger <mhochsteger@cerbsim.com> Date: Fri Oct 16 17:29:46 2020 +0200 fix delaunay swapping commit 48b95ae2ee1cbabcfae79dfd1cb7af1fd69d77f3 Author: Matthias Hochsteger <mhochsteger@cerbsim.com> Date: Fri Oct 16 17:27:51 2020 +0200 testout only with debug settings commit d82b7a7cecb6f65f42b79b666fc58d0116dc0365 Author: Matthias Hochsteger <mhochsteger@cerbsim.com> Date: Fri Oct 16 16:37:10 2020 +0200 delaunay only for large domains commit 1f51eaca1ff7a3777e4f32ba9e35e48d496a2854 Author: Matthias Hochsteger <mhochsteger@cerbsim.com> Date: Fri Oct 16 16:21:33 2020 +0200 compress points in delaunay commit 20a223f36f3912a208db80c717d9dd87851ba43f Merge: 2446b7464c15146d
Author: Matthias Hochsteger <mhochsteger@cerbsim.com> Date: Fri Oct 16 14:31:14 2020 +0200 Merge branch 'master' into delaunay2d commit 2446b74687ee56633a86e748e85343919edbd5ad Author: Matthias Hochsteger <mhochsteger@cerbsim.com> Date: Fri Oct 16 14:22:01 2020 +0200 optimize CalcPartition() and PartitionBoundary() commit 3baa58833348a72f16853530a5d17e73424186df Author: Matthias Hochsteger <mhochsteger@cerbsim.com> Date: Fri Oct 16 12:24:17 2020 +0200 MeshingParameters - delaunay2d option (default is off) commit e79b113dde9b9c4c5b92239817c6058ca468c319 Author: Matthias Hochsteger <mhochsteger@cerbsim.com> Date: Thu Oct 15 16:12:45 2020 +0200 fix windows build error commit 92c7b9c1ed4016458980bbc21c61dae07f4444c7 Author: Matthias Hochsteger <mhochsteger@cerbsim.com> Date: Thu Oct 15 17:51:44 2020 +0200 delaunay bugfix commit 6880194107819cfb2d23206e7e0f48ff5aa3fc10 Author: Matthias Hochsteger <mhochsteger@cerbsim.com> Date: Thu Oct 15 17:51:05 2020 +0200 csg2d - fix bug with splines commit 1d9baa299d49e1f6fa16f4368885601ed01c5de7 Author: Matthias Hochsteger <mhochsteger@cerbsim.com> Date: Wed Oct 14 18:40:23 2020 +0200 CSG2d - faster AddIntersections (search tree per loop) commit 2679ef0dee10cdf486441af47ca4c081aa7eb50b Author: Matthias Hochsteger <mhochsteger@cerbsim.com> Date: Wed Oct 14 17:13:17 2020 +0200 bounding box for Loop commit 894c6345b737693e32cbda368e56f56764e11085 Author: Matthias Hochsteger <mhochsteger@cerbsim.com> Date: Wed Oct 14 12:48:51 2020 +0200 remove debug check, output in blockfill commit 2b0a0892c41e746b12e5e852cdb138acd3d2c4e3 Author: Matthias Hochsteger <mhochsteger@cerbsim.com> Date: Wed Oct 14 12:40:53 2020 +0200 compress mesh after delaunay commit 1de33c87eee3199d4d9b18544f66e53329b47a2f Author: Matthias Hochsteger <mhochsteger@cerbsim.com> Date: Wed Oct 14 12:37:07 2020 +0200 revert change in improve2d commit 41a60e89533e94b93b92202ac17852d3aee9acbb Author: Matthias Hochsteger <mhochsteger@cerbsim.com> Date: Wed Oct 14 12:25:07 2020 +0200 cleanup delaunay2d commit c16aae324969cd5a90748953019933690d013337 Author: Matthias Hochsteger <mhochsteger@cerbsim.com> Date: Wed Oct 14 11:39:56 2020 +0200 sunburst chart - tooltip formatting commit 4d61e1fdeab302ba357904f22f951361935791f0 Author: Matthias Hochsteger <mhochsteger@cerbsim.com> Date: Wed Oct 14 11:03:37 2020 +0200 delaunay seems to work commit 8bd43f54d1efd6862f1b403cdb6c8ce9b5f7b3c6 Merge: 90ac7adb25efdadd
Author: Matthias Hochsteger <mhochsteger@cerbsim.com> Date: Tue Oct 13 12:08:01 2020 +0200 Merge remote-tracking branch 'gitlab/master' into delaunay2d commit 90ac7adb562cf2402345c5dfb4281bd097b5d62d Author: Matthias Hochsteger <mhochsteger@cerbsim.com> Date: Tue Oct 13 12:04:49 2020 +0200 fix Loop::operator= commit 1eb4f2de3b6576f503a073011a208fa8f609524e Author: Matthias Hochsteger <mhochsteger@cerbsim.com> Date: Tue Oct 13 12:04:13 2020 +0200 more statistics in sunburst chart commit db8b97ffbbc7db2a3413c4f8a5528eebe3488d57 Author: Matthias Hochsteger <mhochsteger@cerbsim.com> Date: Tue Oct 13 11:17:28 2020 +0200 more work on delaunay2d commit eaa675f2351252b5fde423f241b10e231d1eb97e Merge: 0eb9f9bd 8f837cb9 Author: Matthias Hochsteger <mhochsteger@cerbsim.com> Date: Mon Oct 12 12:51:31 2020 +0200 Merge remote-tracking branch 'gitlab/delaunay2d' into delaunay2d commit 0eb9f9bd1c31a0e3c3c796c9280b1c1d007ace26 Author: Matthias Hochsteger <mhochsteger@cerbsim.com> Date: Mon Oct 12 12:50:10 2020 +0200 further csg2d optimization commit 8f837cb9a281acca7c33159985da3b6992fe638f Author: Matthias Hochsteger <mhochsteger@cerbsim.com> Date: Tue Oct 6 19:02:31 2020 +0200 csg2d - optimize Loop::operator= commit 7bb4f16b886b20902b0d3563716055fc1734d47e Author: Matthias Hochsteger <mhochsteger@cerbsim.com> Date: Tue Oct 6 10:28:20 2020 +0200 csg2d performance (search tree, inside tests) commit 2c9ebce04d7989223327a1875e1b65bf180c95f5 Author: Matthias Hochsteger <mhochsteger@cerbsim.com> Date: Fri Oct 2 16:33:24 2020 +0200 [WIP] delaunay2d commit 749df2311a3ac1976faaa9f0b60846709a2087b9 Author: Matthias Hochsteger <mhochsteger@cerbsim.com> Date: Thu Oct 1 11:36:03 2020 +0200 something commit cda9fffde33a86b71467debb86848fdb9cfbf80c Author: Matthias Hochsteger <mhochsteger@cerbsim.com> Date: Wed Sep 30 12:06:53 2020 +0200 delaunay2d - fix size of starting trig
197 lines
7.5 KiB
C++
197 lines
7.5 KiB
C++
#ifndef NETGEN_MESHING_PYTHON_MESH_HPP
|
|
#define NETGEN_MESHING_PYTHON_MESH_HPP
|
|
|
|
#include <core/python_ngcore.hpp>
|
|
|
|
#include "meshing.hpp"
|
|
|
|
namespace netgen
|
|
{
|
|
// TODO: Clarify a lot of these parameters
|
|
static string meshingparameter_description = R"delimiter(
|
|
Meshing Parameters
|
|
-------------------
|
|
|
|
maxh: float = 1e10
|
|
Global upper bound for mesh size.
|
|
|
|
grading: float = 0.3
|
|
Mesh grading how fast the local mesh size can change.
|
|
|
|
meshsizefilename: str = None
|
|
Load meshsize from file. Can set local mesh size for points
|
|
and along edges. File must have the format:
|
|
|
|
nr_points
|
|
x1, y1, z1, meshsize
|
|
x2, y2, z2, meshsize
|
|
...
|
|
xn, yn, zn, meshsize
|
|
|
|
nr_edges
|
|
x11, y11, z11, x12, y12, z12, meshsize
|
|
...
|
|
xn1, yn1, zn1, xn2, yn2, zn2, meshsize
|
|
|
|
segmentsperedge: float = 1.
|
|
Minimal number of segments per edge.
|
|
|
|
quad_dominated: bool = False
|
|
Quad-dominated surface meshing.
|
|
|
|
blockfill: bool = True
|
|
Do fast blockfilling.
|
|
|
|
filldist: float = 0.1
|
|
Block fill up to distance
|
|
|
|
delaunay: bool = True
|
|
Use delaunay meshing.
|
|
|
|
delaunay2d : bool = True
|
|
Use delaunay meshing for 2d geometries.
|
|
|
|
Optimization Parameters
|
|
-----------------------
|
|
|
|
optimize3d: str = "cmdmustm"
|
|
3d optimization strategy:
|
|
m .. move nodes
|
|
M .. move nodes, cheap functional
|
|
s .. swap faces
|
|
c .. combine elements
|
|
d .. divide elements
|
|
p .. plot, no pause
|
|
P .. plot, Pause
|
|
h .. Histogramm, no pause
|
|
H .. Histogramm, pause
|
|
|
|
optsteps3d: int = 3
|
|
Number of 3d optimization steps.
|
|
|
|
optimize2d: str = "smcmSmcmSmcm"
|
|
2d optimization strategy:
|
|
s .. swap, opt 6 lines/node
|
|
S .. swap, optimal elements
|
|
m .. move nodes
|
|
p .. plot, no pause
|
|
P .. plot, pause
|
|
c .. combine
|
|
|
|
optsteps2d: int = 3
|
|
Number of 2d optimization steps.
|
|
|
|
elsizeweight: float = 0.2
|
|
Weight of element size w.r.t. element shape in optimization.
|
|
|
|
)delimiter";
|
|
|
|
inline void CreateMPfromKwargs(MeshingParameters& mp, py::kwargs kwargs, bool throw_if_not_all_parsed=true)
|
|
{
|
|
if(kwargs.contains("optimize3d"))
|
|
mp.optimize3d = py::cast<string>(kwargs.attr("pop")("optimize3d"));
|
|
if(kwargs.contains("optsteps3d"))
|
|
mp.optsteps3d = py::cast<int>(kwargs.attr("pop")("optsteps3d"));
|
|
if(kwargs.contains("optimize2d"))
|
|
mp.optimize2d = py::cast<string>(kwargs.attr("pop")("optimize2d"));
|
|
if(kwargs.contains("optsteps2d"))
|
|
mp.optsteps2d = py::cast<int>(kwargs.attr("pop")("optsteps2d"));
|
|
if(kwargs.contains("opterrpow"))
|
|
mp.opterrpow = py::cast<double>(kwargs.attr("pop")("opterrpow"));
|
|
if(kwargs.contains("blockfill"))
|
|
mp.blockfill = py::cast<bool>(kwargs.attr("pop")("blockfill"));
|
|
if(kwargs.contains("filldist"))
|
|
mp.filldist = py::cast<double>(kwargs.attr("pop")("filldist"));
|
|
if(kwargs.contains("safety"))
|
|
mp.safety = py::cast<double>(kwargs.attr("pop")("safety"));
|
|
if(kwargs.contains("relinnersafety"))
|
|
mp.relinnersafety = py::cast<double>(kwargs.attr("pop")("relinnersafety"));
|
|
if(kwargs.contains("uselocalh"))
|
|
mp.uselocalh = py::cast<bool>(kwargs.attr("pop")("uselocalh"));
|
|
if(kwargs.contains("grading"))
|
|
mp.grading = py::cast<double>(kwargs.attr("pop")("grading"));
|
|
if(kwargs.contains("delaunay"))
|
|
mp.delaunay = py::cast<bool>(kwargs.attr("pop")("delaunay"));
|
|
if(kwargs.contains("delaunay2d"))
|
|
mp.delaunay2d = py::cast<bool>(kwargs.attr("pop")("delaunay2d"));
|
|
if(kwargs.contains("maxh"))
|
|
mp.maxh = py::cast<double>(kwargs.attr("pop")("maxh"));
|
|
if(kwargs.contains("minh"))
|
|
mp.minh = py::cast<double>(kwargs.attr("pop")("minh"));
|
|
if(kwargs.contains("meshsizefilename"))
|
|
mp.meshsizefilename = py::cast<string>(kwargs.attr("pop")("meshsizefilename"));
|
|
if(kwargs.contains("startinsurface"))
|
|
mp.startinsurface = py::cast<bool>(kwargs.attr("pop")("startinsurface"));
|
|
if(kwargs.contains("checkoverlap"))
|
|
mp.checkoverlap = py::cast<bool>(kwargs.attr("pop")("checkoverlap"));
|
|
if(kwargs.contains("checkoverlappingboundary"))
|
|
mp.checkoverlappingboundary = py::cast<bool>(kwargs.attr("pop")("checkoverlappingboundary"));
|
|
if(kwargs.contains("checkchartboundary"))
|
|
mp.checkchartboundary = py::cast<bool>(kwargs.attr("pop")("checkchartboundary"));
|
|
if(kwargs.contains("curvaturesafety"))
|
|
mp.curvaturesafety = py::cast<double>(kwargs.attr("pop")("curvaturesafety"));
|
|
if(kwargs.contains("segmentsperedge"))
|
|
mp.segmentsperedge = py::cast<double>(kwargs.attr("pop")("segmentsperedge"));
|
|
if(kwargs.contains("parthread"))
|
|
mp.parthread = py::cast<bool>(kwargs.attr("pop")("parthread"));
|
|
if(kwargs.contains("elsizeweight"))
|
|
mp.elsizeweight = py::cast<double>(kwargs.attr("pop")("elsizeweight"));
|
|
if(kwargs.contains("perfstepsstart"))
|
|
mp.perfstepsstart = py::cast<int>(kwargs.attr("pop")("perfstepsstart"));
|
|
if(kwargs.contains("perfstepsend"))
|
|
mp.perfstepsend = py::cast<int>(kwargs.attr("pop")("perfstepsend"));
|
|
if(kwargs.contains("giveuptol2d"))
|
|
mp.giveuptol2d = py::cast<int>(kwargs.attr("pop")("giveuptol2d"));
|
|
if(kwargs.contains("giveuptol"))
|
|
mp.giveuptol = py::cast<int>(kwargs.attr("pop")("giveuptol"));
|
|
if(kwargs.contains("maxoutersteps"))
|
|
mp.maxoutersteps = py::cast<int>(kwargs.attr("pop")("maxoutersteps"));
|
|
if(kwargs.contains("starshapeclass"))
|
|
mp.starshapeclass = py::cast<int>(kwargs.attr("pop")("starshapeclass"));
|
|
if(kwargs.contains("baseelnp"))
|
|
mp.baseelnp = py::cast<int>(kwargs.attr("pop")("baseelnp"));
|
|
if(kwargs.contains("sloppy"))
|
|
mp.sloppy = py::cast<int>(kwargs.attr("pop")("sloppy"));
|
|
if(kwargs.contains("badellimit"))
|
|
mp.badellimit = py::cast<double>(kwargs.attr("pop")("badellimit"));
|
|
if(kwargs.contains("check_impossible"))
|
|
mp.check_impossible = py::cast<bool>(kwargs.attr("pop")("check_impossible"));
|
|
if(kwargs.contains("only3D_domain_nr"))
|
|
mp.only3D_domain_nr = py::cast<int>(kwargs.attr("pop")("only3D_domain_nr"));
|
|
if(kwargs.contains("secondorder"))
|
|
mp.secondorder = py::cast<bool>(kwargs.attr("pop")("secondorder"));
|
|
if(kwargs.contains("elementorder"))
|
|
mp.elementorder = py::cast<int>(kwargs.attr("pop")("elementorder"));
|
|
if(kwargs.contains("quad"))
|
|
{
|
|
cout << "WARNING: Meshing parameter 'quad' is deprecated, use 'quad_dominated' instead!" << endl;
|
|
mp.quad = py::cast<bool>(kwargs.attr("pop")("quad"));
|
|
}
|
|
if(kwargs.contains("quad_dominated"))
|
|
mp.quad = py::cast<bool>(kwargs.attr("pop")("quad_dominated"));
|
|
if(kwargs.contains("try_hexes"))
|
|
mp.try_hexes = py::cast<bool>(kwargs.attr("pop")("try_hexes"));
|
|
if(kwargs.contains("inverttets"))
|
|
mp.inverttets = py::cast<bool>(kwargs.attr("pop")("inverttets"));
|
|
if(kwargs.contains("inverttrigs"))
|
|
mp.inverttrigs = py::cast<bool>(kwargs.attr("pop")("inverttrigs"));
|
|
if(kwargs.contains("autozrefine"))
|
|
mp.autozrefine = py::cast<bool>(kwargs.attr("pop")("autozrefine"));
|
|
if(kwargs.contains("parallel_meshing"))
|
|
mp.parallel_meshing = py::cast<bool>(kwargs.attr("pop")("parallel_meshing"));
|
|
if(kwargs.contains("nthreads"))
|
|
mp.nthreads = py::cast<int>(kwargs.attr("pop")("nthreads"));
|
|
if(kwargs.contains("closeedgefac"))
|
|
mp.closeedgefac = py::cast<optional<double>>(kwargs.attr("pop")("closeedgefac"));
|
|
if(kwargs.size())
|
|
{
|
|
if(throw_if_not_all_parsed)
|
|
throw Exception(string("Not all kwargs given to GenerateMesh could be parsed:") + string(py::str(kwargs)));
|
|
mp.geometrySpecificParameters = CreateFlagsFromKwArgs(kwargs);
|
|
}
|
|
}
|
|
} // namespace netgen
|
|
|
|
#endif // NETGEN_MESHING_PYTHON_MESH_HPP
|
|
|