From afb141ea83e065b293a086fda144d42de84febbf Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Wed, 6 Aug 2008 23:26:57 +0000 Subject: [PATCH] Added experimental option to only mesh visible entities. (You can easily shoot yourself in the foot with this: use with caution!) --- Common/Context.h | 2 +- Common/DefaultOptions.h | 2 ++ Common/Options.cpp | 7 +++++++ Common/Options.h | 1 + Mesh/meshGEdge.cpp | 1 + Mesh/meshGFace.cpp | 1 + Mesh/meshGRegion.cpp | 1 + 7 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Common/Context.h b/Common/Context.h index 4e70291356..81a26ba0b7 100644 --- a/Common/Context.h +++ b/Common/Context.h @@ -164,7 +164,7 @@ class Context_T { int light, light_two_side, light_lines; int format, nb_smoothing, algo2d, algo3d, algo_recombine; int order, second_order_linear, second_order_incomplete; - int second_order_experimental; + int second_order_experimental, mesh_only_visible; int smooth_internal_edges, c1_continuity; int min_circ_points, min_curv_points; double normals, tangents, explode; diff --git a/Common/DefaultOptions.h b/Common/DefaultOptions.h index 9338047f6d..9447ca4c76 100644 --- a/Common/DefaultOptions.h +++ b/Common/DefaultOptions.h @@ -982,6 +982,8 @@ StringXNumber MeshOptions_Number[] = { { F|O, "LineWidth" , opt_mesh_line_width , 1.0 , "Display width of mesh lines (in pixels)" }, + { F|O, "MeshOnlyVisible" , opt_mesh_mesh_only_visible, 0. , + "Mesh only visible entities" }, { F|O, "MetisAlgorithm" , opt_mesh_partition_metis_algorithm, 1. , "METIS partitioning algorithm (1=Recursive, 2=K-way)" }, { F|O, "MetisEdgeMatching" , opt_mesh_partition_metis_edge_matching, 3. , diff --git a/Common/Options.cpp b/Common/Options.cpp index c6a4229249..bf984c53fc 100644 --- a/Common/Options.cpp +++ b/Common/Options.cpp @@ -5104,6 +5104,13 @@ double opt_mesh_algo3d(OPT_ARGS_NUM) return CTX.mesh.algo3d; } +double opt_mesh_mesh_only_visible(OPT_ARGS_NUM) +{ + if(action & GMSH_SET) + CTX.mesh.mesh_only_visible = (int)val; + return CTX.mesh.mesh_only_visible; +} + double opt_mesh_min_circ_points(OPT_ARGS_NUM) { if(action & GMSH_SET) diff --git a/Common/Options.h b/Common/Options.h index 377655857a..8116a49964 100644 --- a/Common/Options.h +++ b/Common/Options.h @@ -475,6 +475,7 @@ double opt_mesh_nb_smoothing(OPT_ARGS_NUM); double opt_mesh_algo2d(OPT_ARGS_NUM); double opt_mesh_algo3d(OPT_ARGS_NUM); double opt_mesh_recombine_algo(OPT_ARGS_NUM); +double opt_mesh_mesh_only_visible(OPT_ARGS_NUM); double opt_mesh_min_circ_points(OPT_ARGS_NUM); double opt_mesh_allow_swap_edge_angle(OPT_ARGS_NUM); double opt_mesh_min_curv_points(OPT_ARGS_NUM); diff --git a/Mesh/meshGEdge.cpp b/Mesh/meshGEdge.cpp index d05c532626..74dc00479e 100644 --- a/Mesh/meshGEdge.cpp +++ b/Mesh/meshGEdge.cpp @@ -271,6 +271,7 @@ void meshGEdge::operator() (GEdge *ge) if(ge->geomType() == GEntity::DiscreteCurve) return; if(ge->geomType() == GEntity::BoundaryLayerCurve) return; if(ge->meshAttributes.Method == MESH_NONE) return; + if(CTX.mesh.mesh_only_visible && !ge->getVisibility()) return; deMeshGEdge dem; dem(ge); diff --git a/Mesh/meshGFace.cpp b/Mesh/meshGFace.cpp index 68a4fe4253..abc6b5b3ea 100644 --- a/Mesh/meshGFace.cpp +++ b/Mesh/meshGFace.cpp @@ -1297,6 +1297,7 @@ void meshGFace::operator() (GFace *gf) if(gf->geomType() == GEntity::BoundaryLayerSurface) return; if(gf->geomType() == GEntity::ProjectionFace) return; if(gf->meshAttributes.Method == MESH_NONE) return; + if(CTX.mesh.mesh_only_visible && !gf->getVisibility()) return; // destroy the mesh if it exists deMeshGFace dem; diff --git a/Mesh/meshGRegion.cpp b/Mesh/meshGRegion.cpp index c4c2f46f8e..e88a2140bc 100644 --- a/Mesh/meshGRegion.cpp +++ b/Mesh/meshGRegion.cpp @@ -544,6 +544,7 @@ void meshGRegion::operator() (GRegion *gr) if(gr->geomType() == GEntity::DiscreteVolume) return; if(gr->meshAttributes.Method == MESH_NONE) return; + if(CTX.mesh.mesh_only_visible && !gr->getVisibility()) return; ExtrudeParams *ep = gr->meshAttributes.extrude; -- GitLab