From 44e74ca9174705a4fa12d0e5122e06664c10d567 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Thu, 9 Feb 2017 19:27:48 +0000
Subject: [PATCH] start refactoring GEO_Internals

---
 Common/OpenFile.cpp                  |  4 +-
 Geo/GModel.cpp                       |  2 +-
 Geo/GModelCreateTopologyFromMesh.cpp |  8 +--
 Geo/GModelFactory.cpp                |  2 +-
 Geo/GModelIO_GEO.cpp                 | 97 ++++++++++++++++++++++------
 Geo/GModelIO_GEO.h                   | 59 +++++++++++++++++
 Geo/Geo.cpp                          | 68 +++++--------------
 Geo/Geo.h                            | 50 +-------------
 Geo/discreteDiskFace.cpp             | 66 +++++++++----------
 Geo/discreteEdge.cpp                 |  2 +-
 Geo/discreteFace.cpp                 |  8 +--
 Geo/discreteRegion.cpp               |  2 +-
 Parser/Gmsh.tab.cpp                  |  2 +-
 Parser/Gmsh.y                        |  2 +-
 Plugin/FaultZone.cpp                 |  4 +-
 15 files changed, 204 insertions(+), 172 deletions(-)
 create mode 100644 Geo/GModelIO_GEO.h

diff --git a/Common/OpenFile.cpp b/Common/OpenFile.cpp
index 6e9ccffc72..7911eb962e 100644
--- a/Common/OpenFile.cpp
+++ b/Common/OpenFile.cpp
@@ -13,8 +13,8 @@ typedef unsigned long intptr_t;
 #endif
 #include "GmshMessage.h"
 #include "GmshIO.h"
+#include "GModelIO_GEO.h"
 #include "Options.h"
-#include "Geo.h"
 #include "GModel.h"
 #include "Numeric.h"
 #include "Context.h"
@@ -520,7 +520,7 @@ int MergeFile(const std::string &fileName, bool warnIfMissing, bool setBoundingB
       status = GModel::readGEO(fileName);
     }
   }
-  
+
   ComputeMaxEntityNum();
   if(setBoundingBox) SetBoundingBox();
   CTX::instance()->geom.draw = 1;
diff --git a/Geo/GModel.cpp b/Geo/GModel.cpp
index 2b9e9cec1a..fb0cdd244e 100644
--- a/Geo/GModel.cpp
+++ b/Geo/GModel.cpp
@@ -10,6 +10,7 @@
 #include "GmshConfig.h"
 #include "GmshMessage.h"
 #include "GModel.h"
+#include "GModelIO_GEO.h"
 #include "GModelFactory.h"
 #include "GFaceCompound.h"
 #include "GEdgeCompound.h"
@@ -29,7 +30,6 @@
 #include "discreteEdge.h"
 #include "discreteVertex.h"
 #include "gmshSurface.h"
-#include "Geo.h"
 #include "SmoothData.h"
 #include "Context.h"
 #include "OS.h"
diff --git a/Geo/GModelCreateTopologyFromMesh.cpp b/Geo/GModelCreateTopologyFromMesh.cpp
index 0ae7f9bf1c..450c418d1e 100644
--- a/Geo/GModelCreateTopologyFromMesh.cpp
+++ b/Geo/GModelCreateTopologyFromMesh.cpp
@@ -9,7 +9,7 @@
 #include "OS.h"
 #include "GModelCreateTopologyFromMesh.h"
 #include "GModel.h"
-#include "Geo.h"
+#include "GModelIO_GEO.h"
 #include "discreteFace.h"
 #include "discreteEdge.h"
 #include "MPoint.h"
@@ -146,12 +146,12 @@ void createTopologyFromMesh1D ( GModel *gm , int &num) {
       dv->points.push_back(mp);
       dv->addEdge (*it);
       (*it)->setBeginVertex(dv);
-      (*it)->setEndVertex(dv);      
+      (*it)->setEndVertex(dv);
       _topology[*it].insert(dv);
     }
   }
 
-  
+
   // NICE :-)
 }
 
@@ -680,7 +680,7 @@ void GModel::createTopologyFromMeshNew ( ) {
   std::vector<MVertex*> cc;
   cc.insert(cc.begin(), vs.begin(), vs.end());
   _storeVerticesInEntities(cc);
-  
+
   //  printf("%d vertices\n", getNumVertices());
 
   double t2 = Cpu();
diff --git a/Geo/GModelFactory.cpp b/Geo/GModelFactory.cpp
index 019bdc0f26..0f11c59d02 100644
--- a/Geo/GModelFactory.cpp
+++ b/Geo/GModelFactory.cpp
@@ -17,7 +17,7 @@
 #include "GModel.h"
 #include "Numeric.h"
 #include "ExtrudeParams.h"
-#include "Geo.h"
+#include "GModelIO_GEO.h"
 #include "GmshDefines.h"
 
 GVertex *GeoFactory::addVertex(GModel *gm, double x, double y, double z, double lc)
diff --git a/Geo/GModelIO_GEO.cpp b/Geo/GModelIO_GEO.cpp
index 7aa3a42f10..d2165d2407 100644
--- a/Geo/GModelIO_GEO.cpp
+++ b/Geo/GModelIO_GEO.cpp
@@ -8,8 +8,8 @@
 #include "GmshConfig.h"
 #include "GmshMessage.h"
 #include "GModel.h"
+#include "GModelIO_GEO.h"
 #include "OS.h"
-#include "Geo.h"
 #include "OpenFile.h"
 #include "Numeric.h"
 #include "ListUtils.h"
@@ -27,6 +27,62 @@
 #include "Parser.h"
 #endif
 
+// GEO_Internals routines
+
+int compareVertex(const void *a, const void *b);
+int compareSurfaceLoop(const void *a, const void *b);
+int compareEdgeLoop(const void *a, const void *b);
+int compareCurve(const void *a, const void *b);
+int compareSurface(const void *a, const void *b);
+int compareVolume(const void *a, const void *b);
+int compareLevelSet(const void *a, const void *b);
+int comparePhysicalGroup(const void *a, const void *b);
+
+void Free_Vertex(void *a, void *b);
+void Free_PhysicalGroup(void *a, void *b);
+void Free_EdgeLoop(void *a, void *b);
+void Free_SurfaceLoop(void *a, void *b);
+void Free_Curve(void *a, void *b);
+void Free_Surface(void *a, void *b);
+void Free_Volume(void *a, void *b);
+void Free_LevelSet(void *a, void *b);
+
+void GEO_Internals::alloc_all()
+{
+  MaxPointNum = MaxLineNum = MaxLineLoopNum = MaxSurfaceNum = 0;
+  MaxSurfaceLoopNum = MaxVolumeNum = MaxPhysicalNum = 0;
+  Points = Tree_Create(sizeof(Vertex *), compareVertex);
+  Curves = Tree_Create(sizeof(Curve *), compareCurve);
+  EdgeLoops = Tree_Create(sizeof(EdgeLoop *), compareEdgeLoop);
+  Surfaces = Tree_Create(sizeof(Surface *), compareSurface);
+  SurfaceLoops = Tree_Create(sizeof(SurfaceLoop *), compareSurfaceLoop);
+  Volumes = Tree_Create(sizeof(Volume *), compareVolume);
+  LevelSets = Tree_Create(sizeof(LevelSet *), compareLevelSet);
+  PhysicalGroups = List_Create(5, 5, sizeof(PhysicalGroup *));
+}
+
+void GEO_Internals::free_all()
+{
+  MaxPointNum = MaxLineNum = MaxLineLoopNum = MaxSurfaceNum = 0;
+  MaxSurfaceLoopNum = MaxVolumeNum = MaxPhysicalNum = 0;
+  Tree_Action(Points, Free_Vertex); Tree_Delete(Points);
+  Tree_Action(Curves, Free_Curve); Tree_Delete(Curves);
+  Tree_Action(EdgeLoops, Free_EdgeLoop); Tree_Delete(EdgeLoops);
+  Tree_Action(Surfaces, Free_Surface); Tree_Delete(Surfaces);
+  Tree_Action(SurfaceLoops, Free_SurfaceLoop); Tree_Delete(SurfaceLoops);
+  Tree_Action(Volumes, Free_Volume); Tree_Delete(Volumes);
+  Tree_Action(LevelSets, Free_LevelSet); Tree_Delete(LevelSets);
+  List_Action(PhysicalGroups, Free_PhysicalGroup); List_Delete(PhysicalGroups);
+}
+
+void GEO_Internals::reset_physicals()
+{
+  List_Action(PhysicalGroups, Free_PhysicalGroup);
+  List_Reset(PhysicalGroups);
+}
+
+// GModel interface
+
 void GModel::_createGEOInternals()
 {
   _geo_internals = new GEO_Internals;
@@ -400,9 +456,10 @@ int GModel::importGEOInternals()
         case MSH_PHYSICAL_SURFACE: ge = getFaceByTag(tag); break;
         case MSH_PHYSICAL_VOLUME:  ge = getRegionByTag(tag); break;
       }
-      int pnum = CTX::instance()->geom.orientedPhysicals ? (gmsh_sign(num) * p->Num) : p->Num;
+      int pnum = CTX::instance()->geom.orientedPhysicals ?
+        (gmsh_sign(num) * p->Num) : p->Num;
       if(ge && std::find(ge->physicals.begin(), ge->physicals.end(), pnum) ==
-          ge->physicals.end())
+         ge->physicals.end())
         ge->physicals.push_back(pnum);
     }
   }
@@ -451,7 +508,9 @@ int GModel::importGEOInternals()
     }
   }
 
-  for (std::multimap<int,std::vector<int> >::iterator it = _geo_internals->meshCompounds.begin() ; it != _geo_internals->meshCompounds.end() ; ++it){
+  for (std::multimap<int, std::vector<int> >::iterator it =
+         _geo_internals->meshCompounds.begin();
+       it != _geo_internals->meshCompounds.end(); ++it){
     int dim = it->first;
     std::vector<int> compound = it->second;
     std::vector<GEntity*> ents;
@@ -464,15 +523,13 @@ int GModel::importGEOInternals()
       case 3: ent = getRegionByTag(tag); break;
       default : Msg::Error("compound mesh with dimension %d",dim);
       }
-      if(ent)ents.push_back(ent);
+      if(ent) ents.push_back(ent);
     }
     for (unsigned int i=0;i<ents.size();i++){
       ents[i]->_compound = ents;
     }
-
   }
 
-
   Msg::Debug("Gmsh model (GModel) imported:");
   Msg::Debug("%d Vertices", vertices.size());
   Msg::Debug("%d Edges", edges.size());
@@ -482,17 +539,21 @@ int GModel::importGEOInternals()
 }
 
 class writeFieldOptionGEO {
-  private :
-    FILE *geo;
-    Field *field;
-  public :
-    writeFieldOptionGEO(FILE *fp,Field *_field) { geo = fp ? fp : stdout; field=_field; }
-    void operator() (std::pair<std::string, FieldOption *> it)
-    {
-      std::string v;
-      it.second->getTextRepresentation(v);
-      fprintf(geo, "Field[%i].%s = %s;\n", field->id, it.first.c_str(), v.c_str());
-    }
+ private :
+  FILE *geo;
+  Field *field;
+ public :
+  writeFieldOptionGEO(FILE *fp, Field *_field)
+  {
+    geo = fp ? fp : stdout;
+    field = _field;
+  }
+  void operator() (std::pair<std::string, FieldOption *> it)
+  {
+    std::string v;
+    it.second->getTextRepresentation(v);
+    fprintf(geo, "Field[%i].%s = %s;\n", field->id, it.first.c_str(), v.c_str());
+  }
 };
 
 class writeFieldGEO {
diff --git a/Geo/GModelIO_GEO.h b/Geo/GModelIO_GEO.h
new file mode 100644
index 0000000000..a39d4f6f27
--- /dev/null
+++ b/Geo/GModelIO_GEO.h
@@ -0,0 +1,59 @@
+// Gmsh - Copyright (C) 1997-2017 C. Geuzaine, J.-F. Remacle
+//
+// See the LICENSE.txt file for license information. Please report all
+// bugs and problems to the public mailing list <gmsh@onelab.info>.
+
+#ifndef _GMODELIO_GEO_H_
+#define _GMODELIO_GEO_H_
+
+#include "Geo.h"
+
+class GEO_Internals{
+ private:
+  void alloc_all();
+  void free_all();
+ public:
+  Tree_T *Points;
+  Tree_T *Curves;
+  Tree_T *Surfaces;
+  Tree_T *Volumes;
+  Tree_T *SurfaceLoops;
+  Tree_T *EdgeLoops;
+  Tree_T *LevelSets;
+  List_T *PhysicalGroups;
+  int MaxPointNum, MaxLineNum, MaxLineLoopNum, MaxSurfaceNum;
+  int MaxSurfaceLoopNum, MaxVolumeNum, MaxPhysicalNum;
+  std::multimap<int, std::vector<int> > meshCompounds;
+
+  struct MasterEdge {
+    int tag; // signed
+    std::vector<double> affineTransform;
+  };
+
+  std::map<int, MasterEdge> periodicEdges;
+
+  struct MasterFace {
+    int tag;
+    // map from slave to master edges
+    std::map<int, int> edgeCounterparts;
+    std::vector<double> affineTransform;
+  };
+
+  std::map<int, MasterFace> periodicFaces;
+
+ public:
+  GEO_Internals(){ alloc_all(); }
+  ~GEO_Internals(){ free_all(); }
+  void destroy(){ free_all(); alloc_all(); }
+  void reset_physicals();
+  void addCompoundMesh(int dim, List_T *_list)
+  {
+    std::vector<int> compound;
+    for(int i = 0; i < List_Nbr(_list); i++)
+      compound.push_back((int)*(double*)List_Pointer(_list, i));
+    meshCompounds.insert(std::make_pair(dim,compound));
+  }
+
+};
+
+#endif
diff --git a/Geo/Geo.cpp b/Geo/Geo.cpp
index a995cf5ca2..dff253d8f1 100644
--- a/Geo/Geo.cpp
+++ b/Geo/Geo.cpp
@@ -7,8 +7,8 @@
 #include <string.h>
 #include "GmshMessage.h"
 #include "Numeric.h"
-#include "Geo.h"
 #include "GModel.h"
+#include "GModelIO_GEO.h"
 #include "GeoInterpolation.h"
 #include "Context.h"
 #include "MVertexRTree.h"
@@ -45,49 +45,49 @@ static int comparePosition(const void *a, const void *b)
   return 0;
 }
 
-static int compareSurfaceLoop(const void *a, const void *b)
+int compareSurfaceLoop(const void *a, const void *b)
 {
   SurfaceLoop *q = *(SurfaceLoop **)a;
   SurfaceLoop *w = *(SurfaceLoop **)b;
   return q->Num - w->Num;
 }
 
-static int compareEdgeLoop(const void *a, const void *b)
+int compareEdgeLoop(const void *a, const void *b)
 {
   EdgeLoop *q = *(EdgeLoop **)a;
   EdgeLoop *w = *(EdgeLoop **)b;
   return q->Num - w->Num;
 }
 
-static int compareCurve(const void *a, const void *b)
+int compareCurve(const void *a, const void *b)
 {
   Curve *q = *(Curve **)a;
   Curve *w = *(Curve **)b;
   return q->Num - w->Num;
 }
 
-static int compareSurface(const void *a, const void *b)
+int compareSurface(const void *a, const void *b)
 {
   Surface *q = *(Surface **)a;
   Surface *w = *(Surface **)b;
   return q->Num - w->Num;
 }
 
-static int compareVolume(const void *a, const void *b)
+int compareVolume(const void *a, const void *b)
 {
   Volume *q = *(Volume **)a;
   Volume *w = *(Volume **)b;
   return q->Num - w->Num;
 }
 
-static int compareLevelSet(const void *a, const void *b)
+int compareLevelSet(const void *a, const void *b)
 {
   LevelSet *q = *(LevelSet **)a;
   LevelSet *w = *(LevelSet **)b;
   return q->Num - w->Num;
 }
 
-static int comparePhysicalGroup(const void *a, const void *b)
+int comparePhysicalGroup(const void *a, const void *b)
 {
   PhysicalGroup *q = *(PhysicalGroup **)a;
   PhysicalGroup *w = *(PhysicalGroup **)b;
@@ -137,7 +137,7 @@ Vertex *Create_Vertex(int Num, double u, double v, gmshSurface *surf, double lc)
   return pV;
 }
 
-static void Free_Vertex(void *a, void *b)
+void Free_Vertex(void *a, void *b)
 {
   Vertex *v = *(Vertex **)a;
   if(v) {
@@ -163,7 +163,7 @@ PhysicalGroup *Create_PhysicalGroup(int Num, int typ, List_T *intlist)
   return p;
 }
 
-static void Free_PhysicalGroup(void *a, void *b)
+void Free_PhysicalGroup(void *a, void *b)
 {
   PhysicalGroup *p = *(PhysicalGroup **)a;
   if(p) {
@@ -188,7 +188,7 @@ EdgeLoop *Create_EdgeLoop(int Num, List_T *intlist)
   return l;
 }
 
-static void Free_EdgeLoop(void *a, void *b)
+void Free_EdgeLoop(void *a, void *b)
 {
   EdgeLoop *l = *(EdgeLoop **)a;
   if(l) {
@@ -213,7 +213,7 @@ SurfaceLoop *Create_SurfaceLoop(int Num, List_T *intlist)
   return l;
 }
 
-static void Free_SurfaceLoop(void *a, void *b)
+void Free_SurfaceLoop(void *a, void *b)
 {
   SurfaceLoop *l = *(SurfaceLoop **)a;
   if(l) {
@@ -636,7 +636,7 @@ Curve *Create_Curve(int Num, int Typ, int Order, List_T *Liste,
   return pC;
 }
 
-static void Free_Curve(void *a, void *b)
+void Free_Curve(void *a, void *b)
 {
   Curve *pC = *(Curve **)a;
   if(pC) {
@@ -675,7 +675,7 @@ Surface *Create_Surface(int Num, int Typ)
   return (pS);
 }
 
-static void Free_Surface(void *a, void *b)
+void Free_Surface(void *a, void *b)
 {
   Surface *pS = *(Surface **)a;
   if(pS) {
@@ -712,7 +712,7 @@ Volume *Create_Volume(int Num, int Typ)
   return pV;
 }
 
-static void Free_Volume(void *a, void *b)
+void Free_Volume(void *a, void *b)
 {
   Volume *pV = *(Volume **)a;
   if(pV) {
@@ -736,7 +736,7 @@ LevelSet *Create_LevelSet(int Num, gLevelset *l)
   return pL;
 }
 
-static void Free_LevelSet(void *a, void *b)
+void Free_LevelSet(void *a, void *b)
 {
   LevelSet *pL = *(LevelSet **)a;
   if(pL) {
@@ -4865,42 +4865,6 @@ void setVolumeSurfaces(Volume *v, List_T *loops)
   }
 }
 
-// GEO_Internals routines
-
-void GEO_Internals::alloc_all()
-{
-  MaxPointNum = MaxLineNum = MaxLineLoopNum = MaxSurfaceNum = 0;
-  MaxSurfaceLoopNum = MaxVolumeNum = MaxPhysicalNum = 0;
-  Points = Tree_Create(sizeof(Vertex *), compareVertex);
-  Curves = Tree_Create(sizeof(Curve *), compareCurve);
-  EdgeLoops = Tree_Create(sizeof(EdgeLoop *), compareEdgeLoop);
-  Surfaces = Tree_Create(sizeof(Surface *), compareSurface);
-  SurfaceLoops = Tree_Create(sizeof(SurfaceLoop *), compareSurfaceLoop);
-  Volumes = Tree_Create(sizeof(Volume *), compareVolume);
-  LevelSets = Tree_Create(sizeof(LevelSet *), compareLevelSet);
-  PhysicalGroups = List_Create(5, 5, sizeof(PhysicalGroup *));
-}
-
-void GEO_Internals::free_all()
-{
-  MaxPointNum = MaxLineNum = MaxLineLoopNum = MaxSurfaceNum = 0;
-  MaxSurfaceLoopNum = MaxVolumeNum = MaxPhysicalNum = 0;
-  Tree_Action(Points, Free_Vertex); Tree_Delete(Points);
-  Tree_Action(Curves, Free_Curve); Tree_Delete(Curves);
-  Tree_Action(EdgeLoops, Free_EdgeLoop); Tree_Delete(EdgeLoops);
-  Tree_Action(Surfaces, Free_Surface); Tree_Delete(Surfaces);
-  Tree_Action(SurfaceLoops, Free_SurfaceLoop); Tree_Delete(SurfaceLoops);
-  Tree_Action(Volumes, Free_Volume); Tree_Delete(Volumes);
-  Tree_Action(LevelSets, Free_LevelSet); Tree_Delete(LevelSets);
-  List_Action(PhysicalGroups, Free_PhysicalGroup); List_Delete(PhysicalGroups);
-}
-
-void GEO_Internals::reset_physicals()
-{
-  List_Action(PhysicalGroups, Free_PhysicalGroup);
-  List_Reset(PhysicalGroups);
-}
-
 int select_contour(int type, int num, List_T * List)
 {
   int k = 0;
diff --git a/Geo/Geo.h b/Geo/Geo.h
index 24798c6aab..2b1ce89b69 100644
--- a/Geo/Geo.h
+++ b/Geo/Geo.h
@@ -302,56 +302,8 @@ class PhysicalGroup{
   List_T *Entities;
 };
 
-class GEO_Internals{
- private:
-  void alloc_all();
-  void free_all();
- public:
-
-  Tree_T *Points;
-  Tree_T *Curves;
-  Tree_T *Surfaces;
-  Tree_T *Volumes;
-  Tree_T *SurfaceLoops;
-  Tree_T *EdgeLoops;
-  Tree_T *LevelSets;
-  List_T *PhysicalGroups;
-  int MaxPointNum, MaxLineNum, MaxLineLoopNum, MaxSurfaceNum;
-  int MaxSurfaceLoopNum, MaxVolumeNum, MaxPhysicalNum;
-  std::multimap<int, std::vector<int> > meshCompounds;
-
-  struct MasterEdge {
-    int tag; // signed
-    std::vector<double> affineTransform;
-  };
-
-  std::map<int, MasterEdge> periodicEdges;
-
-  struct MasterFace {
-    int tag;
-    // map from slave to master edges
-    std::map<int, int> edgeCounterparts;
-    std::vector<double> affineTransform;
-  };
-
-  std::map<int, MasterFace> periodicFaces;
-
- public:
-  GEO_Internals(){ alloc_all(); }
-  ~GEO_Internals(){ free_all(); }
-  void destroy(){ free_all(); alloc_all(); }
-  void reset_physicals();
-  void addCompoundMesh(int dim, List_T *_list)
-  {
-    std::vector<int> compound;
-    for(int i = 0; i < List_Nbr(_list); i++)
-      compound.push_back((int)*(double*)List_Pointer(_list, i));
-    meshCompounds.insert(std::make_pair(dim,compound));
-  }
-
-};
-
 int compareVertex(const void *a, const void *b);
+int compareCurve(const void *a, const void *b);
 
 void Projette(Vertex *v, double mat[3][3]);
 
diff --git a/Geo/discreteDiskFace.cpp b/Geo/discreteDiskFace.cpp
index 6556c860e9..09e9bf667d 100644
--- a/Geo/discreteDiskFace.cpp
+++ b/Geo/discreteDiskFace.cpp
@@ -3,7 +3,7 @@
 // See the LICENSE.txt file for license information. Please report all
 // bugs and problems to the public mailing list <gmsh@geuz.org>.
 
-#include <queue> 
+#include <queue>
 #include <stdlib.h>
 #include "GmshConfig.h"
 
@@ -15,7 +15,7 @@
 #include "discreteEdge.h"
 #include "MTriangle.h"
 #include "MEdge.h"
-#include "Geo.h"
+#include "GModelIO_GEO.h"
 #include "Context.h"
 #include "OS.h"
 #include "ANN/ANN.h"
@@ -290,7 +290,7 @@ discreteDiskFace::discreteDiskFace(GFace *gf, triangulation* diskTriangulation,
   parametrize();
   buildOct(CAD);
   //putOnView(gf->tag(),diskTriangulation->idNum,true,true);
-  //printParamMesh();  
+  //printParamMesh();
 }
 /*end BUILDER*/
 
@@ -311,7 +311,7 @@ void discreteDiskFace::buildOct(std::vector<GFace*> *CAD) const
   const int maxElePerBucket = 15;
   oct = Octree_Create(maxElePerBucket, origin, ssize, discreteDiskFaceBB,
 		      discreteDiskFaceCentroid, discreteDiskFaceInEle);
-  
+
   _ddft = new discreteDiskFaceTriangle[discrete_triangles.size()];
   int c = 0;
   for(unsigned int i = 0; i < discrete_triangles.size(); ++i){
@@ -326,7 +326,7 @@ void discreteDiskFace::buildOct(std::vector<GFace*> *CAD) const
     my_ddft->tri = t;
 
     Octree_Insert(my_ddft, oct);
-    
+
   }
   Octree_Arrange(oct);
 }
@@ -336,12 +336,12 @@ bool discreteDiskFace::parametrize() const
 { // #improveme
 
   linearSystem<double> * lsys_u, *lsys_v;
-  
+
 
 #ifdef HAVE_MUMPS
   lsys_u = new linearSystemMUMPS<double>;
   lsys_v = new linearSystemMUMPS<double>;
-#else  
+#else
   linearSystemCSRGmm<double> * lsys_u1 = new linearSystemCSRGmm<double>;
   linearSystemCSRGmm<double> * lsys_v1 = new linearSystemCSRGmm<double>;
   lsys_u1->setGmres(1);
@@ -351,7 +351,7 @@ bool discreteDiskFace::parametrize() const
 #endif
   dofManager<double> myAssemblerU(lsys_u);   // hashing
   dofManager<double> myAssemblerV(lsys_v);
-  
+
   for(size_t i = 0; i < _U0.size(); i++){
     MVertex *v = _U0[i];
     const double theta = 2 * M_PI * _coords[i];
@@ -568,18 +568,18 @@ void discreteDiskFace::optimize()
   lines.push_back(new MLine(sp2mv[coordinates[_U0[_U0.size()-1]]],sp2mv[coordinates[_U0[0]]]));
   de->setTopo(lines);
   de->createGeometry();// !!!! setTopo ... MLine's
- 
-  
-  
+
+
+
   // optimization
   if(_order >1)
     HighOrderMeshOptimizer(paramDisk, optParams);
   else
     MeshQualityOptimizer(paramDisk,opt);
 
- 
-  
-  
+
+
+
   // update the parametrization
   paramTriangles = e2e[0];
   for(unsigned int i=0; i< paramTriangles.size(); i++){
@@ -602,10 +602,10 @@ void discreteDiskFace::optimize()
   }
   dgf->mesh_vertices.clear();
   dgf->mesh_vertices = newMV;
-  
+
   // cleaning
   delete paramDisk;
-  
+
 #endif
 }
 
@@ -908,7 +908,7 @@ GPoint discreteDiskFace::intersectionWithCircle(const SVector3 &n1, const SVecto
 						double uv[2]) const
 {
 
-  
+
   SVector3 n = crossprod(n1,n2);
   n.normalize();
   //  printf("n %g %g %g\n",n.x(), n.y(), n.z());
@@ -939,7 +939,7 @@ GPoint discreteDiskFace::intersectionWithCircle(const SVector3 &n1, const SVecto
     m[0][0] = n.y();
     m[0][1] = n.z();
     m[1][0] = t.y();
-    m[1][1] = t.z();      
+    m[1][1] = t.z();
     if (fabs(det2x2(m)) > 1.e-12){
       sys2x2(m,rhs,r);
       x0 = SVector3(0,r[0],r[1]);
@@ -948,17 +948,17 @@ GPoint discreteDiskFace::intersectionWithCircle(const SVector3 &n1, const SVecto
       m[0][0] = n.x();
       m[0][1] = n.z();
       m[1][0] = t.x();
-      m[1][1] = t.z();      
+      m[1][1] = t.z();
       if (fabs(det2x2(m)) > 1.e-12){
-	sys2x2(m,rhs,r);	
+	sys2x2(m,rhs,r);
 	x0 = SVector3(r[0],0,r[1]);
       }
       else {
 	m[0][0] = n.x();
 	m[0][1] = n.y();
 	m[1][0] = t.x();
-	m[1][1] = t.y();      
-	if (sys2x2(m,rhs,r))	{	  
+	m[1][1] = t.y();
+	if (sys2x2(m,rhs,r))	{
 	  x0 = SVector3(r[0],r[1],0);
 	}
 	else{
@@ -966,8 +966,8 @@ GPoint discreteDiskFace::intersectionWithCircle(const SVector3 &n1, const SVecto
 	  continue;
 	}
       }
-    }    
-    
+    }
+
     const double a = 1.0;
     const double b = -2*dot(d,p-x0);
     const double c = dot(p-x0,p-x0) - R*R;
@@ -1004,7 +1004,7 @@ GPoint discreteDiskFace::intersectionWithCircle(const SVector3 &n1, const SVecto
   //  printf("Point(1) = {%g,%g,%g};\n",p.x(),p.y(),p.z());
   //  printf("Point(2) = {%g,%g,%g};\n",p.x()+d*n1.x(),p.y()+d*n1.y(),p.z()+d*n1.z());
   //  printf("Point(3) = {%g,%g,%g};\n",p.x()+d*n2.x(),p.y()+d*n2.y(),p.z()+d*n2.z());
-  
+
   //  //  printf("Circle(4) = {2,1,3};\n");
   //  printf("{%g,%g,%g};\n",n1.x(),n1.y(),n1.z());
   //  printf("{%g,%g,%g};\n",n2.x(),n2.y(),n2.z());
@@ -1084,7 +1084,7 @@ GPoint discreteDiskFace::intersectionWithCircle2(const SVector3 &n1, const SVect
       const double ta = (-b + sign*sqrt(delta)) / (2.*a);
       const double tb = (-b - sign*sqrt(delta)) / (2.*a);
       SVector3 s[2] =  {q + m * ta, q + m * tb};
-      for (int IT=0;IT<2;IT++){	
+      for (int IT=0;IT<2;IT++){
 	double mat[2][2], b[2],uv[2];
 	mat[0][0] = dot(t1,t1);
 	mat[1][1] = dot(t2,t2);
@@ -1111,7 +1111,7 @@ GPoint discreteDiskFace::intersectionWithCircle2(const SVector3 &n1, const SVect
   //  printf("Point(1) = {%g,%g,%g};\n",p.x(),p.y(),p.z());
   //  printf("Point(2) = {%g,%g,%g};\n",p.x()+d*n1.x(),p.y()+d*n1.y(),p.z()+d*n1.z());
   //  printf("Point(3) = {%g,%g,%g};\n",p.x()+d*n2.x(),p.y()+d*n2.y(),p.z()+d*n2.z());
-  
+
   //  //  printf("Circle(4) = {2,1,3};\n");
   //  printf("{%g,%g,%g};\n",n1.x(),n1.y(),n1.z());
   //  printf("{%g,%g,%g};\n",n2.x(),n2.y(),n2.z());
@@ -1163,7 +1163,7 @@ static double computeDistanceLinePoint (MVertex *v1, MVertex *v2, MVertex *v){
 }
 */
 inline double computeDistance (MVertex *v1, double d1, MVertex *v2, double d2, MVertex *v){
-  
+
   //       o------------a
   //
   //
@@ -1289,7 +1289,7 @@ double triangulation::geodesicDistance ()
     if (Fixed.size() == v2t.size())break;
   }
 
-  
+
   char name[256];
   sprintf(name,"geodesicDistance%d.pos",iter);
   FILE *f = fopen(name,"w");
@@ -1306,7 +1306,7 @@ double triangulation::geodesicDistance ()
   }
   fprintf(f,"};\n");
   fclose(f);
-  
+
 
   return CLOSEST;
 }
@@ -1318,15 +1318,15 @@ void discreteDiskFace::printAtlasMesh()
   char buffer[256];
   sprintf(buffer,"atlas_mesh%d.msh",initialTriangulation->idNum);
   FILE* pmesh = Fopen(buffer,"w");
-	
+
   std::set<MVertex*> meshvertices;
-	
+
   for(unsigned int i=0; i<initialTriangulation->tri.size(); ++i){
       MElement* tri = initialTriangulation->tri[i];
       for(unsigned int j=0; j<3; j++)
 	if (meshvertices.find(tri->getVertex(j))==meshvertices.end()) meshvertices.insert(tri->getVertex(j));
   }
-	
+
   fprintf(pmesh,"$MeshFormat\n2.2 0 8\n$EndMeshFormat\n$Nodes\n%u\n",(unsigned int)meshvertices.size());
   int count = 1;
   for(std::set<MVertex*>::iterator it = meshvertices.begin(); it!=meshvertices.end(); ++it){
diff --git a/Geo/discreteEdge.cpp b/Geo/discreteEdge.cpp
index 21f06d83c5..f412c7c309 100644
--- a/Geo/discreteEdge.cpp
+++ b/Geo/discreteEdge.cpp
@@ -17,7 +17,7 @@
 #include "MTetrahedron.h"
 #include "MHexahedron.h"
 #include "MPyramid.h"
-#include "Geo.h"
+#include "GModelIO_GEO.h"
 #include "OS.h"
 #include "Curvature.h"
 #include "GEdgeCompound.h"
diff --git a/Geo/discreteFace.cpp b/Geo/discreteFace.cpp
index 92e5649694..482596c52a 100644
--- a/Geo/discreteFace.cpp
+++ b/Geo/discreteFace.cpp
@@ -7,7 +7,7 @@
 #include "GmshMessage.h"
 #include "discreteFace.h"
 #include "discreteDiskFace.h"
-#include "Geo.h"
+#include "GModelIO_GEO.h"
 #include "GFaceCompound.h"
 #include "Context.h"
 #include "OS.h"
@@ -20,7 +20,6 @@
 #include "linearSystemPETSc.h"
 #endif
 
-
 #include "MPoint.h"
 
 #if defined(HAVE_METIS)
@@ -29,9 +28,8 @@ extern "C" {
 }
 #endif
 
-
-static inline double getAlpha(MTriangle* tri, int edj){
-
+static inline double getAlpha(MTriangle* tri, int edj)
+{
   double alpha;
   if (edj==0)
     alpha = 0.;
diff --git a/Geo/discreteRegion.cpp b/Geo/discreteRegion.cpp
index 99cb92aa69..a0836d54b1 100644
--- a/Geo/discreteRegion.cpp
+++ b/Geo/discreteRegion.cpp
@@ -6,7 +6,7 @@
 #include "GmshConfig.h"
 #include "discreteRegion.h"
 #include "MVertex.h"
-#include "Geo.h"
+#include "GModelIO_GEO.h"
 #include "Context.h"
 
 #if defined(HAVE_MESH)
diff --git a/Parser/Gmsh.tab.cpp b/Parser/Gmsh.tab.cpp
index c19128867d..ce2171f757 100644
--- a/Parser/Gmsh.tab.cpp
+++ b/Parser/Gmsh.tab.cpp
@@ -520,8 +520,8 @@
 #include "Numeric.h"
 #include "Context.h"
 #include "GModel.h"
+#include "GModelIO_GEO.h"
 #include "GModelIO_OCC.h"
-#include "Geo.h"
 #include "GeoInterpolation.h"
 #include "Options.h"
 #include "Parser.h"
diff --git a/Parser/Gmsh.y b/Parser/Gmsh.y
index 7268ca0364..07a67d3107 100644
--- a/Parser/Gmsh.y
+++ b/Parser/Gmsh.y
@@ -19,8 +19,8 @@
 #include "Numeric.h"
 #include "Context.h"
 #include "GModel.h"
+#include "GModelIO_GEO.h"
 #include "GModelIO_OCC.h"
-#include "Geo.h"
 #include "GeoInterpolation.h"
 #include "Options.h"
 #include "Parser.h"
diff --git a/Plugin/FaultZone.cpp b/Plugin/FaultZone.cpp
index 58da884a96..edcdfa0d6a 100644
--- a/Plugin/FaultZone.cpp
+++ b/Plugin/FaultZone.cpp
@@ -10,9 +10,8 @@
 #include "Context.h"
 #include "GmshMessage.h"
 #include "FaultZone.h"
-
-#include "Geo.h"
 #include "GModel.h"
+#include "GModelIO_GEO.h"
 #include "SVector3.h"
 #include "GEdge.h"
 #include "GFace.h"
@@ -803,4 +802,3 @@ void GMSH_FaultZoneMesher::ModifyJointNodePosition(double eps){
     mVert->z() += vect.z();
   }
 }
-
-- 
GitLab