Skip to content
Snippets Groups Projects
Commit ba08ae0f authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

nicely handle argc/argv (gmshInitialize) in python

parent c3571cfb
No related branches found
No related tags found
No related merge requests found
%module gmsh
// "int &outTag" in function arguments is replaced by an append of outTag to the
// value returned by the function
%include typemaps.i
// reference to int is appended to the returned values of the function
%apply int &OUTPUT { int &outTag };
// handle gracefully the arguments of gmshInitialize
%include argcargv.i
%apply (int ARGC, char **ARGV) { (int argc, char **argv) }
%{
#include "gmsh.h"
%}
......
......@@ -50,7 +50,6 @@ gmshModelGeoAddLine(2, 3, 2);
gmshModelGeoAddLine(3, 3, 4);
gmshModelGeoAddLine(4, 4, 1);
# The philosophy to construct line loops and surfaces is similar: the second
# arguments are now vectors of integers.
gmshModelGeoAddLineLoop(1, [4, 1, -2, 3]);
......
......@@ -4,13 +4,17 @@
# API functions used, compared to the ones introduced in t1.py.
from gmsh import *
import sys
# If sys.argv is passed, Gmsh will parse the commandline in the same way as the
# standalone Gmsh code.
gmshInitialize(sys.argv);
gmshInitialize();
gmshOptionSetNumber("General.Terminal", 1);
gmshModelCreate("t2");
# Copied from t1.cpp...
# Copied from t1.py...
lc = 1e-2;
gmshModelGeoAddPoint(1, 0, 0, 0, lc);
gmshModelGeoAddPoint(2, .1, 0, 0, lc);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment