commit 0398b84419576ba99badd778605dcde20281674b
parent 314c0620697614bef130db6da24225b087debaf6
Author: Christophe Coustet <christophe.coustet@meso-star.com>
Date: Tue, 18 Oct 2022 17:03:19 +0200
Add an option to manage gmsh verbosity level
Diffstat:
2 files changed, 27 insertions(+), 2 deletions(-)
diff --git a/src/scad.h b/src/scad.h
@@ -43,7 +43,18 @@ struct logger;
/* Forward declaration of scad opaque data types */
struct scad_geometry; /* Wrapping of dimTags gmsh description */
-/* A type to specify options for star-cad */
+/* Verbosity levels */
+enum scad_verbosity_levels {
+ scad_verbosity_fatal_errors = 0,
+ scad_verbosity_errors = 1,
+ scad_verbosity_warnings = 2,
+ scad_verbosity_direct = 3,
+ scad_verbosity_information = 4,
+ scad_verbosity_status = 5,
+ scad_verbosity_debug = 99
+};
+
+/* A type to specify options for the gmsh library */
struct scad_options {
struct {
double StlOneSolidPerSurface;
@@ -53,13 +64,16 @@ struct scad_options {
double MeshSizeExtendFromBoundary;
} Mesh;
struct {
+ enum scad_verbosity_levels Verbosity;
+ } General;
+ struct {
int Step;
int SynchronizeOnRunUI;
} Misc;
};
#define SCAD_DEFAULT_OPTIONS__ \
- { { 2, 0, 1, 36, 0 }, { 0, 0 }}
+ { { 2, 0, 1, 36, 0 }, {scad_verbosity_errors}, { 0, 0 }}
static const struct scad_options SCAD_DEFAULT_OPTIONS = SCAD_DEFAULT_OPTIONS__;
diff --git a/src/scad_device.c b/src/scad_device.c
@@ -292,6 +292,15 @@ error:
goto exit;
}
+#define SET_GMSH_OPTION_INT(Option) \
+ gmshOptionSetNumber((#Option), (actual_options->Option), &ierr);\
+ if(ierr) {\
+ log_error(dev, "Could not set option %s to %d.\n",\
+ (#Option), (actual_options->Option));\
+ res = RES_BAD_ARG;\
+ goto error;\
+ }
+
#define SET_GMSH_OPTION_DOUBLE(Option) \
gmshOptionSetNumber((#Option), (actual_options->Option), &ierr);\
if(ierr) {\
@@ -323,6 +332,8 @@ scad_set_options
SET_GMSH_OPTION_DOUBLE(Mesh.MinimumElementsPerTwoPi);
SET_GMSH_OPTION_DOUBLE(Mesh.MeshSizeExtendFromBoundary);
+ SET_GMSH_OPTION_INT(General.Verbosity);
+
if(options) {
/* Check non-gmsh option validity if user-provided */
(void)actual_options->Misc.Step; /* int boolean: always OK */