From 93d7a46d52d8694c005a98d9d0adf7b4d1e360e4 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Fri, 17 Nov 2017 16:15:03 +0100
Subject: [PATCH] pp

---
 Common/gmsh.cpp | 407 ++++++++++++++++++++++++------------------------
 Common/gmsh.h   |   4 +-
 2 files changed, 206 insertions(+), 205 deletions(-)

diff --git a/Common/gmsh.cpp b/Common/gmsh.cpp
index 7a342eb79b..5e197788cc 100644
--- a/Common/gmsh.cpp
+++ b/Common/gmsh.cpp
@@ -34,7 +34,7 @@
 
 static int _initialized = 0;
 
-static bool isInitialized()
+static bool _isInitialized()
 {
   if(!_initialized){
     // make sure stuff gets printed out
@@ -62,7 +62,7 @@ GMSH_API gmshInitialize(int argc, char **argv)
 
 GMSH_API gmshFinalize()
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
+  if(!_isInitialized()) return GMSH_ERROR(-1);
   if(GmshFinalize()){
     _initialized = 0;
     return GMSH_OK;
@@ -73,7 +73,7 @@ GMSH_API gmshFinalize()
 
 GMSH_API gmshOpen(const std::string &fileName)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
+  if(!_isInitialized()) return GMSH_ERROR(-1);
   if(GmshOpenProject(fileName))
     return GMSH_OK;
   return GMSH_ERROR(1);
@@ -81,7 +81,7 @@ GMSH_API gmshOpen(const std::string &fileName)
 
 GMSH_API gmshMerge(const std::string &fileName)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
+  if(!_isInitialized()) return GMSH_ERROR(-1);
   if(GmshMergeFile(fileName))
     return GMSH_OK;
   return GMSH_ERROR(1);
@@ -89,7 +89,7 @@ GMSH_API gmshMerge(const std::string &fileName)
 
 GMSH_API gmshExport(const std::string &fileName)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
+  if(!_isInitialized()) return GMSH_ERROR(-1);
   if(GmshWriteFile(fileName))
     return GMSH_OK;
   return GMSH_ERROR(1);
@@ -97,7 +97,7 @@ GMSH_API gmshExport(const std::string &fileName)
 
 GMSH_API gmshClear()
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
+  if(!_isInitialized()) return GMSH_ERROR(-1);
   if(GmshClearProject())
     return GMSH_OK;
   return GMSH_ERROR(1);
@@ -105,8 +105,8 @@ GMSH_API gmshClear()
 
 // gmshOption
 
-static void splitOptionName(const std::string &fullName, std::string &category,
-                            std::string &name, int &index)
+static void _splitOptionName(const std::string &fullName, std::string &category,
+                             std::string &name, int &index)
 {
   std::string::size_type d = fullName.find_first_of('.');
   if(d == std::string::npos){
@@ -132,10 +132,10 @@ static void splitOptionName(const std::string &fullName, std::string &category,
 
 GMSH_API gmshOptionSetNumber(const std::string &name, const double value)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
+  if(!_isInitialized()) return GMSH_ERROR(-1);
   std::string c, n;
   int i;
-  splitOptionName(name, c, n, i);
+  _splitOptionName(name, c, n, i);
   if(GmshSetOption(c, n, value, i))
     return GMSH_OK;
   return GMSH_ERROR(1);
@@ -143,10 +143,10 @@ GMSH_API gmshOptionSetNumber(const std::string &name, const double value)
 
 GMSH_API gmshOptionGetNumber(const std::string &name, double &value)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
+  if(!_isInitialized()) return GMSH_ERROR(-1);
   std::string c, n;
   int i;
-  splitOptionName(name, c, n, i);
+  _splitOptionName(name, c, n, i);
   if(GmshGetOption(c, n, value, i))
     return GMSH_OK;
   return GMSH_ERROR(1);
@@ -154,10 +154,10 @@ GMSH_API gmshOptionGetNumber(const std::string &name, double &value)
 
 GMSH_API gmshOptionSetString(const std::string &name, const std::string &value)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
+  if(!_isInitialized()) return GMSH_ERROR(-1);
   std::string c, n;
   int i;
-  splitOptionName(name, c, n, i);
+  _splitOptionName(name, c, n, i);
   if(GmshSetOption(c, n, value, i))
     return GMSH_OK;
   return GMSH_ERROR(1);
@@ -165,10 +165,10 @@ GMSH_API gmshOptionSetString(const std::string &name, const std::string &value)
 
 GMSH_API gmshOptionGetString(const std::string &name, std::string &value)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
+  if(!_isInitialized()) return GMSH_ERROR(-1);
   std::string c, n;
   int i;
-  splitOptionName(name, c, n, i);
+  _splitOptionName(name, c, n, i);
   if(GmshGetOption(c, n, value, i))
     return GMSH_OK;
   return GMSH_ERROR(1);
@@ -178,30 +178,30 @@ GMSH_API gmshOptionGetString(const std::string &name, std::string &value)
 
 GMSH_API gmshModelCreate(const std::string &name)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
+  if(!_isInitialized()) return GMSH_ERROR(-1);
   GModel *m = new GModel(name);
   if(m)
     return GMSH_OK;
   return GMSH_ERROR(1);
 }
 
-GMSH_API gmshModelSetCurrent(const std::string &name)
+GMSH_API gmshModelDelete()
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
-  GModel *m = GModel::findByName(name);
+  if(!_isInitialized()) return GMSH_ERROR(-1);
+  GModel *m = GModel::current();
   if(m){
-    GModel::setCurrent(m);
+    delete m;
     return GMSH_OK;
   }
   return GMSH_ERROR(1);
 }
 
-GMSH_API gmshModelDestroy()
+GMSH_API gmshModelSetCurrent(const std::string &name)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
-  GModel *m = GModel::current();
+  if(!_isInitialized()) return GMSH_ERROR(-1);
+  GModel *m = GModel::findByName(name);
   if(m){
-    delete m;
+    GModel::setCurrent(m);
     return GMSH_OK;
   }
   return GMSH_ERROR(1);
@@ -209,7 +209,7 @@ GMSH_API gmshModelDestroy()
 
 GMSH_API gmshModelGetEntities(vector_pair &dimTags, const int dim)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
+  if(!_isInitialized()) return GMSH_ERROR(-1);
   dimTags.clear();
   std::vector<GEntity*> entities;
   GModel::current()->getEntities(entities, dim);
@@ -220,7 +220,7 @@ GMSH_API gmshModelGetEntities(vector_pair &dimTags, const int dim)
 
 GMSH_API gmshModelGetPhysicalGroups(vector_pair &dimTags, const int dim)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
+  if(!_isInitialized()) return GMSH_ERROR(-1);
   dimTags.clear();
   std::map<int, std::vector<GEntity*> > groups[4];
   GModel::current()->getPhysicalGroups(groups);
@@ -237,7 +237,7 @@ GMSH_API gmshModelGetPhysicalGroups(vector_pair &dimTags, const int dim)
 GMSH_API gmshModelAddPhysicalGroup(const int dim, const int tag,
                                    const std::vector<int> &tags)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
+  if(!_isInitialized()) return GMSH_ERROR(-1);
   bool r = GModel::current()->getGEOInternals()->modifyPhysicalGroup
     (dim, tag, 0, tags);
   if(r){
@@ -250,7 +250,7 @@ GMSH_API gmshModelAddPhysicalGroup(const int dim, const int tag,
 GMSH_API gmshModelGetEntitiesForPhysicalGroup(const int dim, const int tag,
                                               std::vector<int> &tags)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
+  if(!_isInitialized()) return GMSH_ERROR(-1);
   tags.clear();
   std::map<int, std::vector<GEntity*> > groups;
   GModel::current()->getPhysicalGroups(dim, groups);
@@ -265,7 +265,7 @@ GMSH_API gmshModelGetEntitiesForPhysicalGroup(const int dim, const int tag,
 GMSH_API gmshModelSetPhysicalName(const int dim, const int tag,
                                   const std::string &name)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
+  if(!_isInitialized()) return GMSH_ERROR(-1);
   GModel::current()->setPhysicalName(name, dim, tag);
   return GMSH_OK;
 }
@@ -273,7 +273,7 @@ GMSH_API gmshModelSetPhysicalName(const int dim, const int tag,
 GMSH_API gmshModelGetPhysicalName(const int dim, const int tag,
                                   std::string &name)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
+  if(!_isInitialized()) return GMSH_ERROR(-1);
   name = GModel::current()->getPhysicalName(dim, tag);
   return GMSH_OK;
 }
@@ -281,7 +281,7 @@ GMSH_API gmshModelGetPhysicalName(const int dim, const int tag,
 GMSH_API gmshModelGetVertexCoordinates(const int tag, double &x, double &y,
                                        double &z)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
+  if(!_isInitialized()) return GMSH_ERROR(-1);
   GVertex *gv = GModel::current()->getVertexByTag(tag);
   if(gv){
     x = gv->x();
@@ -296,7 +296,7 @@ GMSH_API gmshModelGetBoundary(const vector_pair &inDimTags, vector_pair &outDimT
                               const bool combined, const bool oriented,
                               const bool recursive)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
+  if(!_isInitialized()) return GMSH_ERROR(-1);
   outDimTags.clear();
   bool r = GModel::current()->getBoundaryTags(inDimTags, outDimTags, combined,
                                               oriented, recursive);
@@ -309,7 +309,7 @@ GMSH_API gmshModelGetEntitiesInBoundingBox(const double x1, const double y1,
                                            const double y2, const double z2,
                                            vector_pair &dimTags, const int dim)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
+  if(!_isInitialized()) return GMSH_ERROR(-1);
   dimTags.clear();
   SBoundingBox3d box(x1, y1, z1, x2, y2, z2);
   std::vector<GEntity*> entities;
@@ -322,7 +322,7 @@ GMSH_API gmshModelGetEntitiesInBoundingBox(const double x1, const double y1,
 GMSH_API gmshModelGetBoundingBox(const int dim, const int tag, double &x1, double &y1,
                                  double &z1, double &x2, double &y2, double &z2)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
+  if(!_isInitialized()) return GMSH_ERROR(-1);
   GEntity *ge = GModel::current()->getEntityByTag(dim, tag);
   if(!ge) return GMSH_ERROR(1);
   SBoundingBox3d box = ge->bounds();
@@ -338,14 +338,14 @@ GMSH_API gmshModelGetBoundingBox(const int dim, const int tag, double &x1, doubl
 
 GMSH_API gmshModelRemove(const vector_pair &dimTags, const bool recursive)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
+  if(!_isInitialized()) return GMSH_ERROR(-1);
   GModel::current()->remove(dimTags, recursive);
   return GMSH_OK;
 }
 
 GMSH_API gmshModelMesh(int dim)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
+  if(!_isInitialized()) return GMSH_ERROR(-1);
   GModel *m = GModel::current();
   if(m){
     m->mesh(dim);
@@ -358,7 +358,7 @@ GMSH_API gmshModelGetMeshVertices(const int dim, const int tag,
                                   std::vector<int> &vertexTags,
                                   std::vector<double> &coords)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
+  if(!_isInitialized()) return GMSH_ERROR(-1);
   vertexTags.clear();
   coords.clear();
   GEntity *ge = GModel::current()->getEntityByTag(dim, tag);
@@ -374,10 +374,10 @@ GMSH_API gmshModelGetMeshVertices(const int dim, const int tag,
 }
 
 template<class T>
-static void addElementInfo(const std::vector<T*> &ele,
-                           std::vector<int> &elementType,
-                           std::vector<std::vector<int> > &elementTags,
-                           std::vector<std::vector<int> > &vertexTags)
+static void _addElementInfo(const std::vector<T*> &ele,
+                            std::vector<int> &elementType,
+                            std::vector<std::vector<int> > &elementTags,
+                            std::vector<std::vector<int> > &vertexTags)
 {
   if(ele.empty()) return;
   elementType.push_back(ele.front()->getTypeForMSH());
@@ -396,7 +396,7 @@ GMSH_API gmshModelGetMeshElements(const int dim, const int tag,
                                   std::vector<std::vector<int> > &elementTags,
                                   std::vector<std::vector<int> > &vertexTags)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
+  if(!_isInitialized()) return GMSH_ERROR(-1);
   types.clear();
   elementTags.clear();
   vertexTags.clear();
@@ -405,23 +405,23 @@ GMSH_API gmshModelGetMeshElements(const int dim, const int tag,
   switch(dim){
   case 0: {
     GVertex *v = static_cast<GVertex*>(ge);
-    addElementInfo(v->points, types, elementTags, vertexTags);
+    _addElementInfo(v->points, types, elementTags, vertexTags);
     break; }
   case 1: {
     GEdge *e = static_cast<GEdge*>(ge);
-    addElementInfo(e->lines, types, elementTags, vertexTags);
+    _addElementInfo(e->lines, types, elementTags, vertexTags);
     break; }
   case 2: {
     GFace *f = static_cast<GFace*>(ge);
-    addElementInfo(f->triangles, types, elementTags, vertexTags);
-    addElementInfo(f->quadrangles, types, elementTags, vertexTags);
+    _addElementInfo(f->triangles, types, elementTags, vertexTags);
+    _addElementInfo(f->quadrangles, types, elementTags, vertexTags);
     break; }
   case 3: {
     GRegion *r = static_cast<GRegion*>(ge);
-    addElementInfo(r->tetrahedra, types, elementTags, vertexTags);
-    addElementInfo(r->hexahedra, types, elementTags, vertexTags);
-    addElementInfo(r->prisms, types, elementTags, vertexTags);
-    addElementInfo(r->pyramids, types, elementTags, vertexTags);
+    _addElementInfo(r->tetrahedra, types, elementTags, vertexTags);
+    _addElementInfo(r->hexahedra, types, elementTags, vertexTags);
+    _addElementInfo(r->prisms, types, elementTags, vertexTags);
+    _addElementInfo(r->pyramids, types, elementTags, vertexTags);
     break; }
   }
   return GMSH_OK;
@@ -429,7 +429,7 @@ GMSH_API gmshModelGetMeshElements(const int dim, const int tag,
 
 GMSH_API gmshModelSetMeshSize(const vector_pair &dimTags, const double size)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
+  if(!_isInitialized()) return GMSH_ERROR(-1);
   for(unsigned int i = 0; i < dimTags.size(); i++){
     int dim = dimTags[i].first, tag = dimTags[i].second;
     if(dim == 0){
@@ -443,7 +443,7 @@ GMSH_API gmshModelSetMeshSize(const vector_pair &dimTags, const double size)
 GMSH_API gmshModelSetTransfiniteLine(const int tag, const int nPoints,
                                      const std::string &type, const double coef)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
+  if(!_isInitialized()) return GMSH_ERROR(-1);
   GEdge *ge = GModel::current()->getEdgeByTag(tag);
   if(ge){
     ge->meshAttributes.method = MESH_TRANSFINITE;
@@ -464,7 +464,7 @@ GMSH_API gmshModelSetTransfiniteSurface(const int tag,
                                         const std::string &arrangement,
                                         const std::vector<int> &cornerTags)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
+  if(!_isInitialized()) return GMSH_ERROR(-1);
   GFace *gf = GModel::current()->getFaceByTag(tag);
   if(gf){
     gf->meshAttributes.method = MESH_TRANSFINITE;
@@ -490,7 +490,7 @@ GMSH_API gmshModelSetTransfiniteSurface(const int tag,
 GMSH_API gmshModelSetTransfiniteVolume(const int tag,
                                        const std::vector<int> &cornerTags)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
+  if(!_isInitialized()) return GMSH_ERROR(-1);
   GRegion *gr = GModel::current()->getRegionByTag(tag);
   if(gr){
     gr->meshAttributes.method = MESH_TRANSFINITE;
@@ -508,7 +508,7 @@ GMSH_API gmshModelSetTransfiniteVolume(const int tag,
 
 GMSH_API gmshModelSetRecombine(const int dim, const int tag, const double angle)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
+  if(!_isInitialized()) return GMSH_ERROR(-1);
   GFace *gf = GModel::current()->getFaceByTag(tag);
   if(gf){
     gf->meshAttributes.recombine = 1;
@@ -520,7 +520,7 @@ GMSH_API gmshModelSetRecombine(const int dim, const int tag, const double angle)
 
 GMSH_API gmshModelSetSmoothing(const int dim, const int tag, const int val)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
+  if(!_isInitialized()) return GMSH_ERROR(-1);
   if(dim != 2) return GMSH_ERROR(1);
   GFace *gf = GModel::current()->getFaceByTag(tag);
   if(gf){
@@ -532,7 +532,7 @@ GMSH_API gmshModelSetSmoothing(const int dim, const int tag, const int val)
 
 GMSH_API gmshModelSetReverseMesh(const int dim, const int tag, const bool val)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
+  if(!_isInitialized()) return GMSH_ERROR(-1);
   if(dim == 1){
     GEdge *ge = GModel::current()->getEdgeByTag(tag);
     if(ge){
@@ -553,7 +553,7 @@ GMSH_API gmshModelSetReverseMesh(const int dim, const int tag, const bool val)
 GMSH_API gmshModelEmbed(const int dim, const std::vector<int> &tags,
                         const int inDim, const int inTag)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
+  if(!_isInitialized()) return GMSH_ERROR(-1);
   if(inDim == 2){
     GFace *gf = GModel::current()->getFaceByTag(inTag);
     if(gf){
@@ -601,7 +601,7 @@ GMSH_API gmshModelEmbed(const int dim, const std::vector<int> &tags,
 GMSH_API gmshModelGeoAddPoint(const int tag, const double x, const double y,
                               const double z, const double meshSize)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
+  if(!_isInitialized()) return GMSH_ERROR(-1);
   int outTag = tag;
   double xx = CTX::instance()->geom.scalingFactor * x;
   double yy = CTX::instance()->geom.scalingFactor * y;
@@ -616,7 +616,7 @@ GMSH_API gmshModelGeoAddPoint(const int tag, const double x, const double y,
 
 GMSH_API gmshModelGeoAddLine(const int tag, const int startTag, const int endTag)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
+  if(!_isInitialized()) return GMSH_ERROR(-1);
   int outTag = tag;
   if(GModel::current()->getGEOInternals()->addLine(outTag, startTag, endTag)){
     std::vector<int> ret(1, 0); ret.push_back(outTag);
@@ -629,7 +629,7 @@ GMSH_API gmshModelGeoAddCircleArc(const int tag, const int startTag,
                                   const int centerTag, const int endTag,
                                   const double nx, const double ny, const double nz)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
+  if(!_isInitialized()) return GMSH_ERROR(-1);
   int outTag = tag;
   if(GModel::current()->getGEOInternals()->addCircleArc
      (outTag, startTag, centerTag, endTag, nx, ny, nz)){
@@ -644,7 +644,7 @@ GMSH_API gmshModelGeoAddEllipseArc(const int tag, const int startTag,
                                    const int endTag, const double nx, const double ny,
                                    const double nz)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
+  if(!_isInitialized()) return GMSH_ERROR(-1);
   int outTag = tag;
   if(GModel::current()->getGEOInternals()->addEllipseArc
      (outTag, startTag, centerTag, majorTag, endTag, nx, ny, nz)){
@@ -656,7 +656,7 @@ GMSH_API gmshModelGeoAddEllipseArc(const int tag, const int startTag,
 
 GMSH_API gmshModelGeoAddSpline(const int tag, const std::vector<int> &vertexTags)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
+  if(!_isInitialized()) return GMSH_ERROR(-1);
   int outTag = tag;
   if(GModel::current()->getGEOInternals()->addSpline(outTag, vertexTags)){
     std::vector<int> ret(1, 0); ret.push_back(outTag);
@@ -667,7 +667,7 @@ GMSH_API gmshModelGeoAddSpline(const int tag, const std::vector<int> &vertexTags
 
 GMSH_API gmshModelGeoAddBSpline(const int tag, const std::vector<int> &vertexTags)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
+  if(!_isInitialized()) return GMSH_ERROR(-1);
   int outTag = tag;
   if(GModel::current()->getGEOInternals()->addBSpline(outTag, vertexTags)){
     std::vector<int> ret(1, 0); ret.push_back(outTag);
@@ -678,7 +678,7 @@ GMSH_API gmshModelGeoAddBSpline(const int tag, const std::vector<int> &vertexTag
 
 GMSH_API gmshModelGeoAddBezier(const int tag, const std::vector<int> &vertexTags)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
+  if(!_isInitialized()) return GMSH_ERROR(-1);
   int outTag = tag;
   if(GModel::current()->getGEOInternals()->addBezier(outTag, vertexTags)){
     std::vector<int> ret(1, 0); ret.push_back(outTag);
@@ -689,7 +689,7 @@ GMSH_API gmshModelGeoAddBezier(const int tag, const std::vector<int> &vertexTags
 
 GMSH_API gmshModelGeoAddLineLoop(const int tag, const std::vector<int> &edgeTags)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
+  if(!_isInitialized()) return GMSH_ERROR(-1);
   int outTag = tag;
   if(GModel::current()->getGEOInternals()->addLineLoop(outTag, edgeTags)){
     std::vector<int> ret(1, 0); ret.push_back(outTag);
@@ -700,7 +700,7 @@ GMSH_API gmshModelGeoAddLineLoop(const int tag, const std::vector<int> &edgeTags
 
 GMSH_API gmshModelGeoAddPlaneSurface(const int tag, const std::vector<int> &wireTags)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
+  if(!_isInitialized()) return GMSH_ERROR(-1);
   int outTag = tag;
   if(GModel::current()->getGEOInternals()->addPlaneSurface(outTag, wireTags)){
     std::vector<int> ret(1, 0); ret.push_back(outTag);
@@ -712,7 +712,7 @@ GMSH_API gmshModelGeoAddPlaneSurface(const int tag, const std::vector<int> &wire
 GMSH_API gmshModelGeoAddSurfaceFilling(const int tag, const std::vector<int> &wireTags,
                                        const int sphereCenterTag)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
+  if(!_isInitialized()) return GMSH_ERROR(-1);
   int outTag = tag;
   if(GModel::current()->getGEOInternals()->addSurfaceFilling
      (outTag, wireTags, sphereCenterTag)){
@@ -724,7 +724,7 @@ GMSH_API gmshModelGeoAddSurfaceFilling(const int tag, const std::vector<int> &wi
 
 GMSH_API gmshModelGeoAddSurfaceLoop(const int tag, const std::vector<int> &faceTags)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
+  if(!_isInitialized()) return GMSH_ERROR(-1);
   int outTag = tag;
   if(GModel::current()->getGEOInternals()->addSurfaceLoop(outTag, faceTags)){
     std::vector<int> ret(1, 0); ret.push_back(outTag);
@@ -735,7 +735,7 @@ GMSH_API gmshModelGeoAddSurfaceLoop(const int tag, const std::vector<int> &faceT
 
 GMSH_API gmshModelGeoAddVolume(const int tag, const std::vector<int> &shellTags)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
+  if(!_isInitialized()) return GMSH_ERROR(-1);
   int outTag = tag;
   if(GModel::current()->getGEOInternals()->addVolume(outTag, shellTags)){
     std::vector<int> ret(1, 0); ret.push_back(outTag);
@@ -744,9 +744,9 @@ GMSH_API gmshModelGeoAddVolume(const int tag, const std::vector<int> &shellTags)
   return GMSH_ERROR(1);
 }
 
-static ExtrudeParams *getExtrudeParams(const std::vector<int> &numElements,
-                                       const std::vector<double> &heights,
-                                       const bool recombine)
+static ExtrudeParams *_getExtrudeParams(const std::vector<int> &numElements,
+                                        const std::vector<double> &heights,
+                                        const bool recombine)
 {
   ExtrudeParams *e = 0;
   if(numElements.size()){
@@ -773,11 +773,11 @@ GMSH_API gmshModelGeoExtrude(const vector_pair &inDimTags,
                              const std::vector<double> &heights,
                              const bool recombine)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
+  if(!_isInitialized()) return GMSH_ERROR(-1);
   outDimTags.clear();
   if(GModel::current()->getGEOInternals()->extrude
      (inDimTags, dx, dy, dz, outDimTags,
-      getExtrudeParams(numElements, heights, recombine)))
+      _getExtrudeParams(numElements, heights, recombine)))
     return GMSH_OK;
   return GMSH_ERROR(1);
 }
@@ -790,11 +790,11 @@ GMSH_API gmshModelGeoRevolve(const vector_pair &inDimTags,
                              const std::vector<double> &heights,
                              const bool recombine)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
+  if(!_isInitialized()) return GMSH_ERROR(-1);
   outDimTags.clear();
   if(GModel::current()->getGEOInternals()->revolve
     (inDimTags, x, y, z, ax, ay, az, angle, outDimTags,
-     getExtrudeParams(numElements, heights, recombine)))
+     _getExtrudeParams(numElements, heights, recombine)))
     return GMSH_OK;
   return GMSH_ERROR(1);
 }
@@ -808,11 +808,11 @@ GMSH_API gmshModelGeoTwist(const vector_pair &inDimTags,
                            const std::vector<double> &heights,
                            const bool recombine)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
+  if(!_isInitialized()) return GMSH_ERROR(-1);
   outDimTags.clear();
   if(GModel::current()->getGEOInternals()->twist
     (inDimTags, x, y, z, dx, dy, dz, ax, ay, az, angle, outDimTags,
-     getExtrudeParams(numElements, heights, recombine)))
+     _getExtrudeParams(numElements, heights, recombine)))
     return GMSH_OK;
   return GMSH_ERROR(1);
 }
@@ -820,7 +820,7 @@ GMSH_API gmshModelGeoTwist(const vector_pair &inDimTags,
 GMSH_API gmshModelGeoTranslate(const vector_pair &dimTags, const double dx,
                                const double dy, const double dz)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
+  if(!_isInitialized()) return GMSH_ERROR(-1);
   if(GModel::current()->getGEOInternals()->translate(dimTags, dx, dy, dz))
     return GMSH_OK;
   return GMSH_ERROR(1);
@@ -830,7 +830,7 @@ GMSH_API gmshModelGeoRotate(const vector_pair &dimTags, const double x,
                             const double y, const double z, const double ax,
                             const double ay, const double az, const double angle)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
+  if(!_isInitialized()) return GMSH_ERROR(-1);
   if(GModel::current()->getGEOInternals()->rotate
      (dimTags, x, y, z, ax, ay, az, angle))
     return GMSH_OK;
@@ -841,7 +841,7 @@ GMSH_API gmshModelGeoDilate(const vector_pair &dimTags, const double x,
                             const double y, const double z, const double a,
                             const double b, const double c)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
+  if(!_isInitialized()) return GMSH_ERROR(-1);
   if(GModel::current()->getGEOInternals()->dilate
      (dimTags, x, y, z, a, b, c))
     return GMSH_OK;
@@ -851,7 +851,7 @@ GMSH_API gmshModelGeoDilate(const vector_pair &dimTags, const double x,
 GMSH_API gmshModelGeoSymmetry(const vector_pair &dimTags, const double a,
                               const double b, const double c, const double d)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
+  if(!_isInitialized()) return GMSH_ERROR(-1);
   if(GModel::current()->getGEOInternals()->symmetry
      (dimTags, a, b, c, d))
     return GMSH_OK;
@@ -860,7 +860,7 @@ GMSH_API gmshModelGeoSymmetry(const vector_pair &dimTags, const double a,
 
 GMSH_API gmshModelGeoCopy(const vector_pair &inDimTags, vector_pair &outDimTags)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
+  if(!_isInitialized()) return GMSH_ERROR(-1);
   outDimTags.clear();
   if(GModel::current()->getGEOInternals()->copy(inDimTags, outDimTags))
     return GMSH_OK;
@@ -869,7 +869,7 @@ GMSH_API gmshModelGeoCopy(const vector_pair &inDimTags, vector_pair &outDimTags)
 
 GMSH_API gmshModelGeoRemove(const vector_pair &dimTags, const bool recursive)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
+  if(!_isInitialized()) return GMSH_ERROR(-1);
   if(GModel::current()->getGEOInternals()->remove(dimTags, recursive))
     return GMSH_OK;
   return GMSH_ERROR(1);
@@ -877,7 +877,7 @@ GMSH_API gmshModelGeoRemove(const vector_pair &dimTags, const bool recursive)
 
 GMSH_API gmshModelGeoRemoveAllDuplicates()
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
+  if(!_isInitialized()) return GMSH_ERROR(-1);
   GModel::current()->getGEOInternals()->removeAllDuplicates();
   return GMSH_OK;
 }
@@ -886,7 +886,7 @@ GMSH_API gmshModelGeoSetTransfiniteLine(const int tag, const int nPoints,
                                         const std::string &type,
                                         const double coef)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
+  if(!_isInitialized()) return GMSH_ERROR(-1);
   int t =
     (type == "Progression" || type == "Power") ? 1 :
     (type == "Bump") ? 2 :
@@ -902,7 +902,7 @@ GMSH_API gmshModelGeoSetTransfiniteSurface(const int tag,
                                            const std::string &arrangement,
                                            const std::vector<int> &cornerTags)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
+  if(!_isInitialized()) return GMSH_ERROR(-1);
   int t =
     (arrangement == "Right") ? 1 :
     (arrangement == "Left") ? -1 :
@@ -917,21 +917,21 @@ GMSH_API gmshModelGeoSetTransfiniteSurface(const int tag,
 GMSH_API gmshModelGeoSetTransfiniteVolume(const int tag,
                                           const std::vector<int> &cornerTags)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
+  if(!_isInitialized()) return GMSH_ERROR(-1);
   GModel::current()->getGEOInternals()->setTransfiniteVolume(tag, cornerTags);
   return GMSH_OK;
 }
 
 GMSH_API gmshModelGeoSetRecombine(const int dim, const int tag, const double angle)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
+  if(!_isInitialized()) return GMSH_ERROR(-1);
   GModel::current()->getGEOInternals()->setRecombine(dim, tag, angle);
   return GMSH_OK;
 }
 
 GMSH_API gmshModelGeoSetSmoothing(const int dim, const int tag, const int val)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
+  if(!_isInitialized()) return GMSH_ERROR(-1);
   if(dim != 2) return GMSH_ERROR(1);
   GModel::current()->getGEOInternals()->setSmoothing(tag, val);
   return GMSH_OK;
@@ -939,14 +939,14 @@ GMSH_API gmshModelGeoSetSmoothing(const int dim, const int tag, const int val)
 
 GMSH_API gmshModelGeoSetReverseMesh(const int dim, const int tag, const bool val)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
+  if(!_isInitialized()) return GMSH_ERROR(-1);
   GModel::current()->getGEOInternals()->setReverseMesh(dim, tag, val);
   return GMSH_OK;
 }
 
 GMSH_API gmshModelGeoSetMeshSize(const vector_pair &dimTags, const double size)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
+  if(!_isInitialized()) return GMSH_ERROR(-1);
   for(unsigned int i = 0; i < dimTags.size(); i++){
     int dim = dimTags[i].first, tag = dimTags[i].second;
     GModel::current()->getGEOInternals()->setMeshSize(dim, tag, size);
@@ -956,14 +956,14 @@ GMSH_API gmshModelGeoSetMeshSize(const vector_pair &dimTags, const double size)
 
 GMSH_API gmshModelGeoSynchronize()
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
+  if(!_isInitialized()) return GMSH_ERROR(-1);
   GModel::current()->getGEOInternals()->synchronize(GModel::current());
   return GMSH_OK;
 }
 
 // gmshModelOcc
 
-static void createOcc()
+static void _createOcc()
 {
   if(!GModel::current()->getOCCInternals()) GModel::current()->createOCCInternals();
 }
@@ -971,8 +971,8 @@ static void createOcc()
 GMSH_API gmshModelOccAddPoint(const int tag, const double x, const double y,
                               const double z, const double meshSize)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
-  createOcc();
+  if(!_isInitialized()) return GMSH_ERROR(-1);
+  _createOcc();
   int outTag = tag;
   if(GModel::current()->getOCCInternals()->addVertex(outTag, x, y, z, meshSize)){
     std::vector<int> ret(1, 0); ret.push_back(outTag);
@@ -983,8 +983,8 @@ GMSH_API gmshModelOccAddPoint(const int tag, const double x, const double y,
 
 GMSH_API gmshModelOccAddLine(const int tag, const int startTag, const int endTag)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
-  createOcc();
+  if(!_isInitialized()) return GMSH_ERROR(-1);
+  _createOcc();
   int outTag = tag;
   if(GModel::current()->getOCCInternals()->addLine(outTag, startTag, endTag)){
     std::vector<int> ret(1, 0); ret.push_back(outTag);
@@ -996,8 +996,8 @@ GMSH_API gmshModelOccAddLine(const int tag, const int startTag, const int endTag
 GMSH_API gmshModelOccAddCircleArc(const int tag, const int startTag,
                                   const int centerTag, const int endTag)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
-  createOcc();
+  if(!_isInitialized()) return GMSH_ERROR(-1);
+  _createOcc();
   int outTag = tag;
   if(GModel::current()->getOCCInternals()->addCircleArc
      (outTag, startTag, centerTag, endTag)){
@@ -1011,8 +1011,8 @@ GMSH_API gmshModelOccAddCircle(const int tag, const double x, const double y,
                                const double z, const double r, const double angle1,
                                const double angle2)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
-  createOcc();
+  if(!_isInitialized()) return GMSH_ERROR(-1);
+  _createOcc();
   int outTag = tag;
   if(GModel::current()->getOCCInternals()->addCircle
      (outTag, x, y, z, r, angle1, angle2)){
@@ -1025,8 +1025,8 @@ GMSH_API gmshModelOccAddCircle(const int tag, const double x, const double y,
 GMSH_API gmshModelOccAddEllipseArc(const int tag, const int startTag,
                                    const int centerTag, const int endTag)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
-  createOcc();
+  if(!_isInitialized()) return GMSH_ERROR(-1);
+  _createOcc();
   int outTag = tag;
   if(GModel::current()->getOCCInternals()->addEllipseArc
      (outTag, startTag, centerTag, endTag)){
@@ -1040,8 +1040,8 @@ GMSH_API gmshModelOccAddEllipse(const int tag, const double x, const double y,
                                 const double z, const double r1, const double r2,
                                 const double angle1, const double angle2)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
-  createOcc();
+  if(!_isInitialized()) return GMSH_ERROR(-1);
+  _createOcc();
   int outTag = tag;
   if(GModel::current()->getOCCInternals()->addEllipse
      (outTag, x, y, z, r1, r2, angle1, angle2)){
@@ -1053,8 +1053,8 @@ GMSH_API gmshModelOccAddEllipse(const int tag, const double x, const double y,
 
 GMSH_API gmshModelOccAddSpline(const int tag, const std::vector<int> &vertexTags)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
-  createOcc();
+  if(!_isInitialized()) return GMSH_ERROR(-1);
+  _createOcc();
   int outTag = tag;
   if(GModel::current()->getOCCInternals()->addSpline(outTag, vertexTags)){
     std::vector<int> ret(1, 0); ret.push_back(outTag);
@@ -1065,8 +1065,8 @@ GMSH_API gmshModelOccAddSpline(const int tag, const std::vector<int> &vertexTags
 
 GMSH_API gmshModelOccAddBezier(const int tag, const std::vector<int> &vertexTags)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
-  createOcc();
+  if(!_isInitialized()) return GMSH_ERROR(-1);
+  _createOcc();
   int outTag = tag;
   if(GModel::current()->getOCCInternals()->addBezier(outTag, vertexTags)){
     std::vector<int> ret(1, 0); ret.push_back(outTag);
@@ -1077,8 +1077,8 @@ GMSH_API gmshModelOccAddBezier(const int tag, const std::vector<int> &vertexTags
 
 GMSH_API gmshModelOccAddBSpline(const int tag, const std::vector<int> &vertexTags)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
-  createOcc();
+  if(!_isInitialized()) return GMSH_ERROR(-1);
+  _createOcc();
   int outTag = tag;
   if(GModel::current()->getOCCInternals()->addBSpline(outTag, vertexTags)){
     std::vector<int> ret(1, 0); ret.push_back(outTag);
@@ -1090,8 +1090,8 @@ GMSH_API gmshModelOccAddBSpline(const int tag, const std::vector<int> &vertexTag
 GMSH_API gmshModelOccAddWire(const int tag, const std::vector<int> &edgeTags,
                              const bool checkClosed)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
-  createOcc();
+  if(!_isInitialized()) return GMSH_ERROR(-1);
+  _createOcc();
   int outTag = tag;
   if(GModel::current()->getOCCInternals()->addWire
      (outTag, edgeTags, checkClosed)){
@@ -1103,8 +1103,8 @@ GMSH_API gmshModelOccAddWire(const int tag, const std::vector<int> &edgeTags,
 
 GMSH_API gmshModelOccAddLineLoop(const int tag, const std::vector<int> &edgeTags)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
-  createOcc();
+  if(!_isInitialized()) return GMSH_ERROR(-1);
+  _createOcc();
   int outTag = tag;
   if(GModel::current()->getOCCInternals()->addLineLoop(outTag, edgeTags)){
     std::vector<int> ret(1, 0); ret.push_back(outTag);
@@ -1117,8 +1117,8 @@ GMSH_API gmshModelOccAddRectangle(const int tag, const double x, const double y,
                                   const double z, const double dx, const double dy,
                                   const double roundedRadius)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
-  createOcc();
+  if(!_isInitialized()) return GMSH_ERROR(-1);
+  _createOcc();
   int outTag = tag;
   if(GModel::current()->getOCCInternals()->addRectangle
      (outTag, x, y, z, dx, dy, roundedRadius)){
@@ -1131,8 +1131,8 @@ GMSH_API gmshModelOccAddRectangle(const int tag, const double x, const double y,
 GMSH_API gmshModelOccAddDisk(const int tag, const double xc, const double yc,
                              const double zc, const double rx, const double ry)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
-  createOcc();
+  if(!_isInitialized()) return GMSH_ERROR(-1);
+  _createOcc();
   int outTag = tag;
   if(GModel::current()->getOCCInternals()->addDisk
      (outTag, xc, yc, zc, rx, ry)){
@@ -1144,8 +1144,8 @@ GMSH_API gmshModelOccAddDisk(const int tag, const double xc, const double yc,
 
 GMSH_API gmshModelOccAddPlaneSurface(const int tag, const std::vector<int> &wireTags)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
-  createOcc();
+  if(!_isInitialized()) return GMSH_ERROR(-1);
+  _createOcc();
   int outTag = tag;
   if(GModel::current()->getOCCInternals()->addPlaneSurface(outTag, wireTags)){
     std::vector<int> ret(1, 0); ret.push_back(outTag);
@@ -1156,8 +1156,8 @@ GMSH_API gmshModelOccAddPlaneSurface(const int tag, const std::vector<int> &wire
 
 GMSH_API gmshModelOccAddSurfaceFilling(const int tag, const int wireTag)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
-  createOcc();
+  if(!_isInitialized()) return GMSH_ERROR(-1);
+  _createOcc();
   int outTag = tag;
   if(GModel::current()->getOCCInternals()->addSurfaceFilling(outTag, wireTag)){
     std::vector<int> ret(1, 0); ret.push_back(outTag);
@@ -1168,8 +1168,8 @@ GMSH_API gmshModelOccAddSurfaceFilling(const int tag, const int wireTag)
 
 GMSH_API gmshModelOccAddSurfaceLoop(const int tag, const std::vector<int> &faceTags)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
-  createOcc();
+  if(!_isInitialized()) return GMSH_ERROR(-1);
+  _createOcc();
   int outTag = tag;
   if(GModel::current()->getOCCInternals()->addSurfaceLoop(outTag, faceTags)){
     std::vector<int> ret(1, 0); ret.push_back(outTag);
@@ -1180,8 +1180,8 @@ GMSH_API gmshModelOccAddSurfaceLoop(const int tag, const std::vector<int> &faceT
 
 GMSH_API gmshModelOccAddVolume(const int tag, const std::vector<int> &shellTags)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
-  createOcc();
+  if(!_isInitialized()) return GMSH_ERROR(-1);
+  _createOcc();
   int outTag = tag;
   if(GModel::current()->getOCCInternals()->addVolume(outTag, shellTags)){
     std::vector<int> ret(1, 0); ret.push_back(outTag);
@@ -1195,8 +1195,8 @@ GMSH_API gmshModelOccAddSphere(const int tag, const double xc, const double yc,
                                const double angle1, const double angle2,
                                const double angle3)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
-  createOcc();
+  if(!_isInitialized()) return GMSH_ERROR(-1);
+  _createOcc();
   int outTag = tag;
   if(GModel::current()->getOCCInternals()->addSphere
      (outTag, xc, yc, zc, radius, angle1, angle2, angle3)){
@@ -1210,8 +1210,8 @@ GMSH_API gmshModelOccAddBox(const int tag, const double x, const double y,
                             const double z, const double dx, const double dy,
                             const double dz)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
-  createOcc();
+  if(!_isInitialized()) return GMSH_ERROR(-1);
+  _createOcc();
   int outTag = tag;
   if(GModel::current()->getOCCInternals()->addBox
      (outTag, x, y, z, dx, dy, dz)){
@@ -1225,8 +1225,8 @@ GMSH_API gmshModelOccAddCylinder(const int tag, const double x, const double y,
                                  const double z, const double dx, const double dy,
                                  const double dz, const double r, const double angle)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
-  createOcc();
+  if(!_isInitialized()) return GMSH_ERROR(-1);
+  _createOcc();
   int outTag = tag;
   if(GModel::current()->getOCCInternals()->addCylinder
      (outTag, x, y, z, dx, dy, dz, r, angle)){
@@ -1241,8 +1241,8 @@ GMSH_API gmshModelOccAddCone(const int tag, const double x, const double y,
                              const double dz, const double r1, const double r2,
                              const double angle)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
-  createOcc();
+  if(!_isInitialized()) return GMSH_ERROR(-1);
+  _createOcc();
   int outTag = tag;
   if(GModel::current()->getOCCInternals()->addCone
      (outTag, x, y, z, dx, dy, dz, r1, r2, angle)){
@@ -1256,8 +1256,8 @@ GMSH_API gmshModelOccAddWedge(const int tag, const double x, const double y,
                               const double z, const double dx, const double dy,
                               const double dz, const double ltx)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
-  createOcc();
+  if(!_isInitialized()) return GMSH_ERROR(-1);
+  _createOcc();
   int outTag = tag;
   if(GModel::current()->getOCCInternals()->addWedge
      (outTag, x, y, z, dx, dy, dz, ltx)){
@@ -1271,8 +1271,8 @@ GMSH_API gmshModelOccAddTorus(const int tag, const double x, const double y,
                               const double z, const double r1, const double r2,
                               const double angle)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
-  createOcc();
+  if(!_isInitialized()) return GMSH_ERROR(-1);
+  _createOcc();
   int outTag = tag;
   if(GModel::current()->getOCCInternals()->addTorus
      (outTag, x, y, z, r1, r2, angle)){
@@ -1286,8 +1286,8 @@ GMSH_API gmshModelOccAddThruSections(const int tag, const std::vector<int> &wire
                                      vector_pair &outDimTags, const bool makeSolid,
                                      const bool makeRuled)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
-  createOcc();
+  if(!_isInitialized()) return GMSH_ERROR(-1);
+  _createOcc();
   outDimTags.clear();
   if(GModel::current()->getOCCInternals()->addThruSections
     (tag, wireTags, makeSolid, makeRuled, outDimTags))
@@ -1299,8 +1299,8 @@ GMSH_API addThickSolid(const int tag, const int solidTag,
                        const std::vector<int> &excludeFaceTags,
                        const double offset, vector_pair &outDimTags)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
-  createOcc();
+  if(!_isInitialized()) return GMSH_ERROR(-1);
+  _createOcc();
   outDimTags.clear();
   if(GModel::current()->getOCCInternals()->addThickSolid
     (tag, solidTag, excludeFaceTags, offset, outDimTags))
@@ -1315,12 +1315,12 @@ GMSH_API gmshModelOccExtrude(const vector_pair &inDimTags,
                              const std::vector<double> &heights,
                              const bool recombine)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
-  createOcc();
+  if(!_isInitialized()) return GMSH_ERROR(-1);
+  _createOcc();
   outDimTags.clear();
   if(GModel::current()->getOCCInternals()->extrude
     (inDimTags, dx, dy, dz, outDimTags,
-     getExtrudeParams(numElements, heights, recombine)))
+     _getExtrudeParams(numElements, heights, recombine)))
     return GMSH_OK;
   return GMSH_ERROR(1);
 }
@@ -1333,12 +1333,12 @@ GMSH_API gmshModelOccRevolve(const vector_pair &inDimTags,
                              const std::vector<double> &heights,
                              const bool recombine)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
-  createOcc();
+  if(!_isInitialized()) return GMSH_ERROR(-1);
+  _createOcc();
   outDimTags.clear();
   if(GModel::current()->getOCCInternals()->revolve
     (inDimTags, x, y, z, ax, ay, az, angle, outDimTags,
-     getExtrudeParams(numElements, heights, recombine)))
+     _getExtrudeParams(numElements, heights, recombine)))
     return GMSH_OK;
   return GMSH_ERROR(1);
 }
@@ -1346,8 +1346,8 @@ GMSH_API gmshModelOccRevolve(const vector_pair &inDimTags,
 GMSH_API gmshModelOccAddPipe(const vector_pair &inDimTags, const int wireTag,
                              vector_pair &outDimTags)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
-  createOcc();
+  if(!_isInitialized()) return GMSH_ERROR(-1);
+  _createOcc();
   outDimTags.clear();
   if(GModel::current()->getOCCInternals()->addPipe
     (inDimTags, wireTag, outDimTags))
@@ -1360,8 +1360,8 @@ GMSH_API gmshModelOccFillet(const std::vector<int> &regionTags,
                             const double radius, vector_pair &outDimTags,
                             const bool removeRegion)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
-  createOcc();
+  if(!_isInitialized()) return GMSH_ERROR(-1);
+  _createOcc();
   outDimTags.clear();
   if(GModel::current()->getOCCInternals()->fillet
     (regionTags, edgeTags, radius, outDimTags, removeRegion))
@@ -1377,8 +1377,8 @@ GMSH_API gmshModelOccBooleanUnion(const int tag,
                                   const bool removeObject,
                                   const bool removeTool)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
-  createOcc();
+  if(!_isInitialized()) return GMSH_ERROR(-1);
+  _createOcc();
   outDimTags.clear();
   outDimTagsMap.clear();
   if(GModel::current()->getOCCInternals()->booleanUnion
@@ -1396,8 +1396,8 @@ GMSH_API gmshModelOccBooleanIntersection(const int tag,
                                          const bool removeObject,
                                          const bool removeTool)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
-  createOcc();
+  if(!_isInitialized()) return GMSH_ERROR(-1);
+  _createOcc();
   outDimTags.clear();
   outDimTagsMap.clear();
   if(GModel::current()->getOCCInternals()->booleanIntersection
@@ -1415,8 +1415,8 @@ GMSH_API gmshModelOccBooleanDifference(const int tag,
                                        const bool removeObject,
                                        const bool removeTool)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
-  createOcc();
+  if(!_isInitialized()) return GMSH_ERROR(-1);
+  _createOcc();
   outDimTags.clear();
   outDimTagsMap.clear();
   if(GModel::current()->getOCCInternals()->booleanDifference
@@ -1434,8 +1434,8 @@ GMSH_API gmshModelOccBooleanFragments(const int tag,
                                       const bool removeObject,
                                       const bool removeTool)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
-  createOcc();
+  if(!_isInitialized()) return GMSH_ERROR(-1);
+  _createOcc();
   outDimTags.clear();
   outDimTagsMap.clear();
   if(GModel::current()->getOCCInternals()->booleanFragments
@@ -1448,8 +1448,8 @@ GMSH_API gmshModelOccBooleanFragments(const int tag,
 GMSH_API gmshModelOccTranslate(const vector_pair &dimTags, const double dx,
                                const double dy, const double dz)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
-  createOcc();
+  if(!_isInitialized()) return GMSH_ERROR(-1);
+  _createOcc();
   if(GModel::current()->getOCCInternals()->translate(dimTags, dx, dy, dz))
     return GMSH_OK;
   return GMSH_ERROR(1);
@@ -1459,8 +1459,8 @@ GMSH_API gmshModelOccRotate(const vector_pair &dimTags, const double x,
                             const double y, const double z, const double ax,
                             const double ay, const double az, const double angle)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
-  createOcc();
+  if(!_isInitialized()) return GMSH_ERROR(-1);
+  _createOcc();
   if(GModel::current()->getOCCInternals()->rotate
     (dimTags, x, y, z, ax, ay, az, angle))
     return GMSH_OK;
@@ -1471,8 +1471,8 @@ GMSH_API gmshModelOccDilate(const vector_pair &dimTags, const double x,
                             const double y, const double z, const double a,
                             const double b, const double c)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
-  createOcc();
+  if(!_isInitialized()) return GMSH_ERROR(-1);
+  _createOcc();
   if(GModel::current()->getOCCInternals()->dilate
     (dimTags, x, y, z, a, b, c))
     return GMSH_OK;
@@ -1482,8 +1482,8 @@ GMSH_API gmshModelOccDilate(const vector_pair &dimTags, const double x,
 GMSH_API gmshModelOccSymmetry(const vector_pair &dimTags, const double a,
                               const double b, const double c, const double d)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
-  createOcc();
+  if(!_isInitialized()) return GMSH_ERROR(-1);
+  _createOcc();
   if(GModel::current()->getOCCInternals()->symmetry
     (dimTags, a, b, c, d))
     return GMSH_OK;
@@ -1492,8 +1492,8 @@ GMSH_API gmshModelOccSymmetry(const vector_pair &dimTags, const double a,
 
 GMSH_API gmshModelOccCopy(const vector_pair &inDimTags, vector_pair &outDimTags)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
-  createOcc();
+  if(!_isInitialized()) return GMSH_ERROR(-1);
+  _createOcc();
   outDimTags.clear();
   if(GModel::current()->getOCCInternals()->copy(inDimTags, outDimTags))
     return GMSH_OK;
@@ -1502,8 +1502,8 @@ GMSH_API gmshModelOccCopy(const vector_pair &inDimTags, vector_pair &outDimTags)
 
 GMSH_API gmshModelOccRemove(const vector_pair &dimTags, const bool recursive)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
-  createOcc();
+  if(!_isInitialized()) return GMSH_ERROR(-1);
+  _createOcc();
   if(GModel::current()->getOCCInternals()->remove(dimTags, recursive))
     return GMSH_OK;
   return GMSH_ERROR(1);
@@ -1511,8 +1511,8 @@ GMSH_API gmshModelOccRemove(const vector_pair &dimTags, const bool recursive)
 
 GMSH_API gmshModelOccRemoveAllDuplicates()
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
-  createOcc();
+  if(!_isInitialized()) return GMSH_ERROR(-1);
+  _createOcc();
   GModel::current()->getOCCInternals()->removeAllDuplicates();
   return GMSH_OK;
 }
@@ -1522,8 +1522,8 @@ GMSH_API gmshModelOccImportShapes(const std::string &fileName,
                                   const bool highestDimOnly,
                                   const std::string &format)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
-  createOcc();
+  if(!_isInitialized()) return GMSH_ERROR(-1);
+  _createOcc();
   outDimTags.clear();
   if(GModel::current()->getOCCInternals()->importShapes
     (fileName, highestDimOnly, outDimTags, format))
@@ -1533,8 +1533,8 @@ GMSH_API gmshModelOccImportShapes(const std::string &fileName,
 
 GMSH_API gmshModelOccSetMeshSize(const vector_pair &dimTags, const double size)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
-  createOcc();
+  if(!_isInitialized()) return GMSH_ERROR(-1);
+  _createOcc();
   for(unsigned int i = 0; i < dimTags.size(); i++){
     int dim = dimTags[i].first, tag = dimTags[i].second;
     GModel::current()->getOCCInternals()->setMeshSize(dim, tag, size);
@@ -1544,8 +1544,8 @@ GMSH_API gmshModelOccSetMeshSize(const vector_pair &dimTags, const double size)
 
 GMSH_API gmshModelOccSynchronize()
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
-  createOcc();
+  if(!_isInitialized()) return GMSH_ERROR(-1);
+  _createOcc();
   GModel::current()->getOCCInternals()->synchronize(GModel::current());
   return GMSH_OK;
 }
@@ -1554,7 +1554,7 @@ GMSH_API gmshModelOccSynchronize()
 
 GMSH_API gmshModelFieldCreate(const int tag, const std::string &type)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
+  if(!_isInitialized()) return GMSH_ERROR(-1);
 #if defined(HAVE_MESH)
   if(!GModel::current()->getFields()->newField(tag, type)){
     Msg::Error("Cannot create Field %i of type '%s'", tag, type.c_str());
@@ -1566,8 +1566,19 @@ GMSH_API gmshModelFieldCreate(const int tag, const std::string &type)
 #endif
 }
 
+GMSH_API gmshModelFieldDelete(const int tag)
+{
+  if(!_isInitialized()) return GMSH_ERROR(-1);
 #if defined(HAVE_MESH)
-static FieldOption *getFieldOption(const int tag, const std::string &option)
+  GModel::current()->getFields()->deleteField(tag);
+  return GMSH_OK;
+#else
+  return GMSH_ERROR(1);
+#endif
+}
+
+#if defined(HAVE_MESH)
+static FieldOption *_getFieldOption(const int tag, const std::string &option)
 {
   Field *field = GModel::current()->getFields()->get(tag);
   if(!field){
@@ -1587,9 +1598,9 @@ static FieldOption *getFieldOption(const int tag, const std::string &option)
 GMSH_API gmshModelFieldSetNumber(const int tag, const std::string &option,
                                  const double value)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
+  if(!_isInitialized()) return GMSH_ERROR(-1);
 #if defined(HAVE_MESH)
-  FieldOption *o = getFieldOption(tag, option);
+  FieldOption *o = _getFieldOption(tag, option);
   if(!o) return GMSH_ERROR(1);
   try { o->numericalValue(value); }
   catch(...){
@@ -1606,9 +1617,9 @@ GMSH_API gmshModelFieldSetNumber(const int tag, const std::string &option,
 GMSH_API gmshModelFieldSetString(const int tag, const std::string &option,
                                  const std::string &value)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
+  if(!_isInitialized()) return GMSH_ERROR(-1);
 #if defined(HAVE_MESH)
-  FieldOption *o = getFieldOption(tag, option);
+  FieldOption *o = _getFieldOption(tag, option);
   if(!o) return GMSH_ERROR(1);
   try { o->string(value); }
   catch(...){
@@ -1625,9 +1636,9 @@ GMSH_API gmshModelFieldSetString(const int tag, const std::string &option,
 GMSH_API gmshModelFieldSetNumbers(const int tag, const std::string &option,
                                   const std::vector<double> &value)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
+  if(!_isInitialized()) return GMSH_ERROR(-1);
 #if defined(HAVE_MESH)
-  FieldOption *o = getFieldOption(tag, option);
+  FieldOption *o = _getFieldOption(tag, option);
   if(!o) return GMSH_ERROR(1);
   try {
     if(o->getType() == FIELD_OPTION_LIST) {
@@ -1656,7 +1667,7 @@ GMSH_API gmshModelFieldSetNumbers(const int tag, const std::string &option,
 
 GMSH_API gmshModelFieldSetAsBackground(const int tag)
 {
-  if(!isInitialized()) return GMSH_ERROR(-1);
+  if(!_isInitialized()) return GMSH_ERROR(-1);
 #if defined(HAVE_MESH)
   GModel::current()->getFields()->setBackgroundFieldId(tag);
   return GMSH_OK;
@@ -1665,13 +1676,3 @@ GMSH_API gmshModelFieldSetAsBackground(const int tag)
 #endif
 }
 
-GMSH_API gmshModelFieldDelete(const int tag)
-{
-  if(!isInitialized()) return GMSH_ERROR(-1);
-#if defined(HAVE_MESH)
-  GModel::current()->getFields()->deleteField(tag);
-  return GMSH_OK;
-#else
-  return GMSH_ERROR(1);
-#endif
-}
diff --git a/Common/gmsh.h b/Common/gmsh.h
index 3a05835b22..bd3c3c0430 100644
--- a/Common/gmsh.h
+++ b/Common/gmsh.h
@@ -49,8 +49,8 @@ GMSH_API gmshOptionGetString(const std::string &name, std::string &value);
 
 // gmshModel
 GMSH_API gmshModelCreate(const std::string &name);
+GMSH_API gmshModelDelete();
 GMSH_API gmshModelSetCurrent(const std::string &name);
-GMSH_API gmshModelDestroy();
 GMSH_API gmshModelGetEntities(vector_pair &dimTags, const int dim=-1);
 GMSH_API gmshModelGetPhysicalGroups(vector_pair &dimTags, const int dim=-1);
 GMSH_API gmshModelAddPhysicalGroup(const int dim, const int tag,
@@ -293,6 +293,7 @@ GMSH_API gmshModelOccSynchronize();
 // gmshModelField
 
 GMSH_API gmshModelFieldCreate(const int tag, const std::string &type);
+GMSH_API gmshModelFieldDelete(const int tag);
 GMSH_API gmshModelFieldSetNumber(const int tag, const std::string &option,
                                  const double value);
 GMSH_API gmshModelFieldSetString(const int tag, const std::string &option,
@@ -300,7 +301,6 @@ GMSH_API gmshModelFieldSetString(const int tag, const std::string &option,
 GMSH_API gmshModelFieldSetNumbers(const int tag, const std::string &option,
                                   const std::vector<double> &value);
 GMSH_API gmshModelFieldSetAsBackground(const int tag);
-GMSH_API gmshModelFieldDelete(const int tag);
 
 // gmshView
 
-- 
GitLab