From 89b1d8d0e460faa1178b3a00ab04ba79a4afb2cf Mon Sep 17 00:00:00 2001 From: Corentin Carton De Wiart <corentin.cartondewiart@nasa.gov> Date: Wed, 11 Apr 2012 12:46:21 +0000 Subject: [PATCH] add option to ignore ghost elements at reading (to fix bug of post-processing with high-order mesh) --- Common/CommandLine.cpp | 5 +++++ Common/Context.cpp | 1 + Common/Context.h | 1 + Common/DefaultOptions.h | 2 ++ Common/Options.cpp | 7 +++++++ Common/Options.h | 1 + Geo/GModelIO_Mesh.cpp | 24 ++++++++++++------------ 7 files changed, 29 insertions(+), 12 deletions(-) diff --git a/Common/CommandLine.cpp b/Common/CommandLine.cpp index 1cce9b9a02..bad1dd7400 100644 --- a/Common/CommandLine.cpp +++ b/Common/CommandLine.cpp @@ -93,6 +93,7 @@ void PrintUsage(const char *name) Msg::Direct(" -bgm file Load background mesh from file"); Msg::Direct(" -check Perform various consistency checks on mesh"); Msg::Direct(" -mpass int Do several passes on the mesh for complex backround fields"); + Msg::Direct(" -ignorePartBound Ignore partitions boundaries"); #if defined(HAVE_FLTK) Msg::Direct("Post-processing options:"); Msg::Direct(" -link int Select link mode between views (0, 1, 2, 3, 4)"); @@ -492,6 +493,10 @@ void GetOptions(int argc, char *argv[]) else Msg::Fatal("Missing number"); } + else if(!strcmp(argv[i] + 1, "ignorePartBound")) { + i++; + opt_mesh_ignore_part_bound(0, GMSH_SET, 1); + } else if(!strcmp(argv[i] + 1, "edgelmin")) { i++; if(argv[i]) { diff --git a/Common/Context.cpp b/Common/Context.cpp index 14c4827767..64cb56103c 100644 --- a/Common/Context.cpp +++ b/Common/Context.cpp @@ -80,6 +80,7 @@ CTX::CTX() mesh.explode = mesh.angleSmoothNormals = 0.; mesh.numSubEdges = 0; mesh.colorCarousel = 0; + mesh.ignorePartBound = 0; color.mesh.tangents = color.mesh.tetrahedron = color.mesh.triangle = 0; color.mesh.prism = color.mesh.pyramid = color.mesh.hexahedron = 0; color.mesh.tangents = color.mesh.line = color.mesh.quadrangle = 0; diff --git a/Common/Context.h b/Common/Context.h index 30fa944953..8fcab24dfc 100644 --- a/Common/Context.h +++ b/Common/Context.h @@ -43,6 +43,7 @@ struct contextMeshOptions { int cgnsImportOrder; std::map<int,int> algo2d_per_face; int bunin; + int ignorePartBound; }; struct contextGeometryOptions { diff --git a/Common/DefaultOptions.h b/Common/DefaultOptions.h index 458985e624..784ed2e416 100644 --- a/Common/DefaultOptions.h +++ b/Common/DefaultOptions.h @@ -996,6 +996,8 @@ StringXNumber MeshOptions_Number[] = { { F|O, "RandomFactor" , opt_mesh_rand_factor , 1.e-9 , "Random factor used in the 2D meshing algorithm (should be increased if " "RandomFactor * size(triangle)/size(model) approaches machine accuracy)" }, + { F|O, "IgnorePartitionBoundary" , opt_mesh_ignore_part_bound , 0. , + "Ignore partitions boundaries (0=no, 1=yes)"}, #if defined(HAVE_BLOSSOM) { F|O, "RecombinationAlgorithm" , opt_mesh_algo_recombine , 1 , #else diff --git a/Common/Options.cpp b/Common/Options.cpp index d9ce3206ed..0e82a74519 100644 --- a/Common/Options.cpp +++ b/Common/Options.cpp @@ -5588,6 +5588,13 @@ double opt_mesh_clip(OPT_ARGS_NUM) return CTX::instance()->mesh.clip; } +double opt_mesh_ignore_part_bound(OPT_ARGS_NUM) +{ + if(action & GMSH_SET) + CTX::instance()->mesh.ignorePartBound = (int) val; + return CTX::instance()->mesh.ignorePartBound; +} + double opt_solver_listen(OPT_ARGS_NUM) { if(action & GMSH_SET) diff --git a/Common/Options.h b/Common/Options.h index 5ba1277f3a..a24da1d194 100644 --- a/Common/Options.h +++ b/Common/Options.h @@ -452,6 +452,7 @@ double opt_mesh_partition_metis_algorithm(OPT_ARGS_NUM); double opt_mesh_partition_metis_edge_matching(OPT_ARGS_NUM); double opt_mesh_partition_metis_refine_algorithm(OPT_ARGS_NUM); double opt_mesh_clip(OPT_ARGS_NUM); +double opt_mesh_ignore_part_bound(OPT_ARGS_NUM); double opt_solver_listen(OPT_ARGS_NUM); double opt_solver_timeout(OPT_ARGS_NUM); double opt_solver_plugins(OPT_ARGS_NUM); diff --git a/Geo/GModelIO_Mesh.cpp b/Geo/GModelIO_Mesh.cpp index 6729ff742d..127492ebb7 100644 --- a/Geo/GModelIO_Mesh.cpp +++ b/Geo/GModelIO_Mesh.cpp @@ -526,24 +526,24 @@ int GModel::readMSH(const std::string &name) if(dom2 && !doms[1]) Msg::Error("Domain element %d not found for element %d", dom2, num); #endif } - - MElement *e = createElementMSH(this, num, type, physical, elementary, - partition, vertices, elements, physicals, - own, p, doms[0], doms[1]); - + if (CTX::instance()->mesh.ignorePartBound && elementary<0) continue; + MElement *e = createElementMSH(this, num, type, physical, elementary, + partition, vertices, elements, physicals, + own, p, doms[0], doms[1]); + #if (FAST_ELEMENTS==1) elems[num] = e; elemreg[num] = elementary; elemphy[num] = physical; #endif - - for(unsigned int j = 0; j < ghosts.size(); j++) - _ghostCells.insert(std::pair<MElement*, short>(e, ghosts[j])); - if(numElements > 100000) - Msg::ProgressMeter(i + 1, numElements, "Reading elements"); - delete [] indices; + + for(unsigned int j = 0; j < ghosts.size(); j++) + _ghostCells.insert(std::pair<MElement*, short>(e, ghosts[j])); + if(numElements > 100000) + Msg::ProgressMeter(i + 1, numElements, "Reading elements"); + delete [] indices; } - + #if (FAST_ELEMENTS==1) for(int i = 0; i < 10; i++) elements[i].clear(); -- GitLab