From 11ae31b56cbb9e4b5acae889c508a01f34e31008 Mon Sep 17 00:00:00 2001 From: Koen Hillewaert <koen.hillewaert@cenaero.be> Date: Sun, 19 Dec 2010 22:12:57 +0000 Subject: [PATCH] interfaced weighted partitioning in command line for batch operations on large meshes --- Common/CommandLine.cpp | 38 ++++++++++++++++++++++++++++++++++++++ Common/Options.cpp | 2 +- 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/Common/CommandLine.cpp b/Common/CommandLine.cpp index 92b6e6ea8f..fa00d8454a 100644 --- a/Common/CommandLine.cpp +++ b/Common/CommandLine.cpp @@ -59,6 +59,7 @@ void PrintUsage(const char *name) Msg::Direct(" -1, -2, -3 Perform 1D, 2D or 3D mesh generation, then exit"); Msg::Direct(" -refine Perform uniform mesh refinement, then exit"); Msg::Direct(" -part int Partition after batch mesh generation"); + Msg::Direct(" -partWeight <tri|quad|tet|prism|hex> = int Weight of a triangle/... during partitioning"); Msg::Direct(" -renumber Renumber the mesh elements after batch mesh generation"); Msg::Direct(" -saveall Save all elements (discard physical group definitions)"); Msg::Direct(" -o file Specify output file name"); @@ -188,6 +189,43 @@ void GetOptions(int argc, char *argv[]) else Msg::Fatal("Missing number"); } + else if (!strcmp(argv[i] + 1,"partWeight")) { + i++; + bool check = true; + opt_mesh_partition_partitioner(0,GMSH_SET,2); // set Metis partitioner + opt_mesh_partition_metis_algorithm(0,GMSH_SET,3); // set partGraphKWay w/ weights + while (check) { + if (argv[i]) { + if (!strcmp(argv[i],"triangle")) { + i++; + opt_mesh_partition_tri_weight(0,GMSH_SET,atoi(argv[i])); + } + else if (!strcmp(argv[i],"quad")) { + i++; + opt_mesh_partition_qua_weight(0,GMSH_SET,atoi(argv[i])); + } + else if (!strcmp(argv[i],"tet")) { + i++; + opt_mesh_partition_tet_weight(0,GMSH_SET,atoi(argv[i])); + } + else if (!strcmp(argv[i],"prism")) { + i++; + opt_mesh_partition_pri_weight(0,GMSH_SET,atoi(argv[i])); + } + else if (!strcmp(argv[i],"pyramid")) { + i++; + opt_mesh_partition_pyr_weight(0,GMSH_SET,atoi(argv[i])); + } + else if (!strcmp(argv[i],"hex")) { + i++; + opt_mesh_partition_hex_weight(0,GMSH_SET,atoi(argv[i])); + } + else check = false; + i++; + } + else check = false; + } + } else if(!strcmp(argv[i] + 1, "new")) { CTX::instance()->files.push_back("-new"); i++; diff --git a/Common/Options.cpp b/Common/Options.cpp index 38adca50a0..2a117c9b24 100644 --- a/Common/Options.cpp +++ b/Common/Options.cpp @@ -6221,7 +6221,7 @@ double opt_mesh_partition_metis_algorithm(OPT_ARGS_NUM) { if(action & GMSH_SET) { int ival = (int)val; - if(ival < 1 || ival > 2) + if(ival < 1 || ival > 3) ival = (CTX::instance()->partitionOptions.num_partitions <= 8) ? 1 : 2; CTX::instance()->partitionOptions.algorithm = ival; } -- GitLab