From 5354406d1f27f4451af7cbdddb431262c5b7af9e Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Sun, 9 Nov 2008 08:03:55 +0000
Subject: [PATCH] *** empty log message ***

---
 Common/CommandLine.cpp     |   3 +
 Geo/GFaceCompound.cpp      |   3 +-
 Geo/GFaceCompound.h        |  48 ++++++--------
 Geo/Geo.cpp                | 130 +++++++++++++++++++------------------
 Geo/Geo.h                  |   3 +-
 Geo/GeoStringInterface.cpp |   9 +--
 Geo/GeoStringInterface.h   |   3 +-
 7 files changed, 101 insertions(+), 98 deletions(-)

diff --git a/Common/CommandLine.cpp b/Common/CommandLine.cpp
index 9993d83158..b6e7cfe517 100644
--- a/Common/CommandLine.cpp
+++ b/Common/CommandLine.cpp
@@ -157,6 +157,9 @@ char *Get_BuildOptions(void)
 #endif
 #if defined(HAVE_MED)
     strcat(opt, "MED ");
+#endif
+#if defined(HAVE_GMM)
+    strcat(opt, "GMM++ ");
 #endif
     first = 0;
   }
diff --git a/Geo/GFaceCompound.cpp b/Geo/GFaceCompound.cpp
index 5f7ed66885..798c91a853 100644
--- a/Geo/GFaceCompound.cpp
+++ b/Geo/GFaceCompound.cpp
@@ -325,7 +325,8 @@ void GFaceCompound::buildOct() const
   double ssize[3] = {bb.max().x()-bb.min().x(),
 		     bb.max().y()-bb.min().y(),
 		     bb.max().z()-bb.min().z()};
-  oct = Octree_Create(10,origin,ssize,GFaceCompoundBB,GFaceCompoundCentroid,GFaceCompoundInEle);
+  oct = Octree_Create(10, origin, ssize, GFaceCompoundBB, GFaceCompoundCentroid,
+                      GFaceCompoundInEle);
 
   it = _compound.begin();
   count = 0;
diff --git a/Geo/GFaceCompound.h b/Geo/GFaceCompound.h
index 65be742764..14d41029d3 100644
--- a/Geo/GFaceCompound.h
+++ b/Geo/GFaceCompound.h
@@ -10,32 +10,25 @@
 #include "GFace.h"
 
 /*
-A GFaceCompound is a model face that is the
-compound of model faces. 
+A GFaceCompound is a model face that is the compound of model faces.
 
-The user selects 4 corners to the compound. 
+The user selects 4 corners to the compound, which are mmapped to
+points (0,0), (1,0), (1,1) and (0,1) of the compound parametric plane.
 
-Those 2 corners are mapped to points
-(0,0), (1,0), (1,1) and (0,1)
-
-of the compound parametric plane.
-
-It is assumed that all the faces of the
-compound have been meshed first. We use
-this discretization to solve 2 elliptic
-problems on the compound. Those 2 problems
-enables to compute the parametric coordinates 
-of the mesh points. The parametrization of
-the compound consist in a triangulation in
-the (u,v) space with parameter values at nodes.  
-
-The compound can therefore be re-meshed using
-any surface mesh generator of gmsh !
+It is assumed that all the faces of the compound have been meshed
+first. We use this discretization to solve 2 elliptic problems on the
+compound. Those 2 problems enables to compute the parametric
+coordinates of the mesh points. The parametrization of the compound
+consist in a triangulation in the (u,v) space with parameter values at
+nodes.
 
+The compound can therefore be re-meshed using any surface mesh
+generator of gmsh !
 */
 
 #include "GFace.h"
 #include "GEdge.h"
+
 typedef struct {
   SPoint2 p1, p2, p3;
   MTriangle *t;
@@ -46,13 +39,14 @@ class Octree;
 class GFaceCompound : public GFace {
  protected:
   std::list<GFace*> _compound;
-  std::list<GEdge*> _U0,_U1,_V0,_V1;
+  std::list<GEdge*> _U0, _U1, _V0, _V1;
   mutable GFaceCompoundTriangle *_gfct;
   mutable Octree *oct;
   mutable std::map<MVertex*,SPoint2> coordinates;
-  void buildOct()const ;
+  void buildOct() const ;
   void parametrize(bool) const ;
-  void parametrize() const {
+  void parametrize() const
+  {
     if (!oct){
       parametrize(0);
       parametrize(1);
@@ -60,7 +54,7 @@ class GFaceCompound : public GFace {
     }
   }
   void getBoundingEdges();
-  void getTriangle (double u, double v, MTriangle **t, double &_u, double &_v) const;
+  void getTriangle(double u, double v, MTriangle **t, double &_u, double &_v) const;
 public:
   GFaceCompound(GModel *m, int tag, 
 		std::list<GFace*> &compound,
@@ -69,14 +63,14 @@ public:
 		std::list<GEdge*> &V0,
 		std::list<GEdge*> &V1);
   virtual ~GFaceCompound();
-  Range<double> parBounds(int i) const{return Range<double>(0, 1);} 
+  Range<double> parBounds(int i) const { return Range<double>(0, 1); } 
   virtual GPoint point(double par1, double par2) const; 
   virtual Pair<SVector3,SVector3> firstDer(const SPoint2 &param) const; 
-  virtual GEntity::GeomType geomType() const {return CompoundSurface;} 
+  virtual GEntity::GeomType geomType() const { return CompoundSurface; }
   ModelType getNativeType() const { return GmshModel; }
   void * getNativePtr() const { return 0; }
-  SPoint2 getCoordinates (MVertex *v) const { parametrize() ; return coordinates[v];}
-  virtual bool buildRepresentationCross(){};
+  SPoint2 getCoordinates (MVertex *v) const { parametrize() ; return coordinates[v]; }
+  virtual bool buildRepresentationCross(){}
 };
 
 #endif
diff --git a/Geo/Geo.cpp b/Geo/Geo.cpp
index 22d0be8ba8..71d2605425 100644
--- a/Geo/Geo.cpp
+++ b/Geo/Geo.cpp
@@ -2961,89 +2961,91 @@ bool ProjectPointOnSurface(Surface *s, Vertex &p, double u[2])
 
 // Split line
 
-static Curve *_create_splitted_curve(Curve *c,List_T *nodes){
+static Curve *_create_splitted_curve(Curve *c,List_T *nodes)
+{
   int  beg, end;
-  List_Read(nodes,0,&beg);
-  List_Read(nodes,List_Nbr(nodes)-1,&end);
-  int id=NEWLINE();
-  Curve *cnew=NULL;
+  List_Read(nodes, 0, &beg);
+  List_Read(nodes, List_Nbr(nodes) - 1, &end);
+  int id = NEWLINE();
+  Curve *cnew = NULL;
   switch(c->Typ){
-    case MSH_SEGM_LINE:
-      cnew = Create_Curve(id, c->Typ, 1, nodes, NULL, -1, -1, 0., 1.);
-      break;
-    case MSH_SEGM_SPLN:
-	    cnew = Create_Curve(id, c->Typ, 3, nodes, NULL, -1, -1, 0., 1.);
-      break;
-    case MSH_SEGM_BSPLN:
-      cnew = Create_Curve(id, c->Typ, 2, nodes, NULL, -1, -1, 0., 1.);
+  case MSH_SEGM_LINE:
+    cnew = Create_Curve(id, c->Typ, 1, nodes, NULL, -1, -1, 0., 1.);
+    break;
+  case MSH_SEGM_SPLN:
+    cnew = Create_Curve(id, c->Typ, 3, nodes, NULL, -1, -1, 0., 1.);
     break;
-    default : //should never reach this point...
-      Msg::Error("Cannot split a curve with type %i.\n",c->Typ);
-      return NULL;
+  case MSH_SEGM_BSPLN:
+    cnew = Create_Curve(id, c->Typ, 2, nodes, NULL, -1, -1, 0., 1.);
+    break;
+  default : //should never reach this point...
+    Msg::Error("Cannot split a curve with type %i", c->Typ);
+    return NULL;
   }
-	Tree_Add(GModel::current()->getGEOInternals()->Curves, &cnew);
-	CreateReversedCurve(cnew);
+  Tree_Add(GModel::current()->getGEOInternals()->Curves, &cnew);
+  CreateReversedCurve(cnew);
   return cnew;
 }
 
-bool SplitCurve(int line_id, List_T *vertices_id, List_T *shapes){
-  Curve *c=FindCurve(line_id);
+bool SplitCurve(int line_id, List_T *vertices_id, List_T *shapes)
+{
+  Curve *c = FindCurve(line_id);
   if(!c){
-    Msg::Error("Curve %i does not exists.",line_id);
+    Msg::Error("Curve %i does not exists", line_id);
     return false;
   }
   switch (c->Typ){
-    case MSH_SEGM_LINE:
-    case MSH_SEGM_SPLN:
-    case MSH_SEGM_BSPLN:
-      break;
-    default:
-      Msg::Error("Cannot split curve %i with type %i.",line_id,c->Typ);
-      return false;
+  case MSH_SEGM_LINE:
+  case MSH_SEGM_SPLN:
+  case MSH_SEGM_BSPLN:
+    break;
+  default:
+    Msg::Error("Cannot split curve %i with type %i", line_id, c->Typ);
+    return false;
   }
   std::set<int>v_break;
-  for(int i=0;i<List_Nbr(vertices_id);i++){
+  for(int i = 0; i < List_Nbr(vertices_id); i++){
     int id;
-    List_Read(vertices_id,i,&id);
+    List_Read(vertices_id, i, &id);
     v_break.insert(id);
   }
-  bool is_periodic=c->beg==c->end;
-  bool first_periodic=true;
-  bool last_periodic=false;
-  List_T *new_list=List_Create(1,List_Nbr(c->Control_Points)/10,sizeof(int));
+  bool is_periodic = (c->beg == c->end);
+  bool first_periodic = true;
+  bool last_periodic = false;
+  List_T *new_list = List_Create(1, List_Nbr(c->Control_Points) / 10, sizeof(int));
   Vertex *pv;
-  for (int i=0;i<List_Nbr(c->Control_Points);i++){
-    List_Read(c->Control_Points,i,&pv);
-    List_Add(new_list,&pv->Num);
-    if(v_break.find(pv->Num)!=v_break.end() && List_Nbr(new_list)>1){
+  for (int i = 0; i < List_Nbr(c->Control_Points); i++){
+    List_Read(c->Control_Points, i, &pv);
+    List_Add(new_list, &pv->Num);
+    if(v_break.find(pv->Num) != v_break.end() && List_Nbr(new_list) > 1){
       if(last_periodic)
         break;
       if(!(is_periodic&&first_periodic)){
-        Curve *cnew=_create_splitted_curve(c,new_list);
-        List_Add(shapes,&cnew);
+        Curve *cnew = _create_splitted_curve(c, new_list);
+        List_Add(shapes, &cnew);
       }
-      first_periodic=false;
+      first_periodic = false;
       List_Reset(new_list);
-      List_Add(new_list,&pv->Num);
+      List_Add(new_list, &pv->Num);
     }
-    if(i==(List_Nbr(c->Control_Points)-1) && is_periodic && ! first_periodic){
-      i=0;
-      last_periodic=true;
+    if( i== (List_Nbr(c->Control_Points) - 1) && is_periodic && ! first_periodic){
+      i = 0;
+      last_periodic = true;
     }
   }
-  if(List_Nbr(new_list)>1){
-    Curve *cnew=_create_splitted_curve(c,new_list);
-    List_Add(shapes,&cnew);
+  if(List_Nbr(new_list) > 1){
+    Curve *cnew = _create_splitted_curve(c, new_list);
+    List_Add(shapes, &cnew);
   }
-  //replace original curve by the new curves in all surfaces
-  //(and for the opposite curve)
-  List_T *rshapes=List_Create(2,1,sizeof(Shape));
-  int N=List_Nbr(shapes);
-  for(int i=0;i<List_Nbr(shapes);i++){
-    Curve *cc,*rcc;
-    List_Read(shapes,N-i-1,&cc);
+  // replace original curve by the new curves in all surfaces (and for
+  // the opposite curve)
+  List_T *rshapes = List_Create(2, 1, sizeof(Shape));
+  int N = List_Nbr(shapes);
+  for(int i = 0; i < List_Nbr(shapes); i++){
+    Curve *cc, *rcc;
+    List_Read(shapes, N - i - 1, &cc);
     rcc=FindCurve(-cc->Num);
-    List_Add(rshapes,&rcc);
+    List_Add(rshapes, &rcc);
   }
   List_T *Surfs = Tree2List(GModel::current()->getGEOInternals()->Surfaces);
   for(int i = 0; i < List_Nbr(Surfs); i++) {
@@ -3051,18 +3053,18 @@ bool SplitCurve(int line_id, List_T *vertices_id, List_T *shapes){
     List_Read(Surfs, i, &s);
     for(int j = 0; j < List_Nbr(s->Generatrices); j++) {
       Curve *surface_curve;
-      List_Read(s->Generatrices,j,&surface_curve);
-      if(surface_curve->Num==c->Num){
-        List_Remove(s->Generatrices,j);
-        List_Insert_In_List(shapes,j,s->Generatrices);
-      }else if(surface_curve->Num==-c->Num){
-        List_Remove(s->Generatrices,j);
-        List_Insert_In_List(rshapes,j,s->Generatrices);
+      List_Read(s->Generatrices, j, &surface_curve);
+      if(surface_curve->Num == c->Num){
+        List_Remove(s->Generatrices, j);
+        List_Insert_In_List(shapes, j, s->Generatrices);
+      }else if(surface_curve->Num == -c->Num){
+        List_Remove(s->Generatrices, j);
+        List_Insert_In_List(rshapes, j, s->Generatrices);
       }
     }
   }
   List_Delete(Surfs);
-  DeleteShape(c->Typ,c->Num);
+  DeleteShape(c->Typ, c->Num);
   List_Delete(new_list);
   List_Delete(rshapes);
 }
diff --git a/Geo/Geo.h b/Geo/Geo.h
index 13a9b1694c..2fb3a998ba 100644
--- a/Geo/Geo.h
+++ b/Geo/Geo.h
@@ -223,7 +223,8 @@ Surface *Create_Surface(int Num, int Typ);
 Volume *Create_Volume(int Num, int Typ);
 EdgeLoop *Create_EdgeLoop(int Num, List_T * intlist);
 SurfaceLoop *Create_SurfaceLoop(int Num, List_T * intlist);
-PhysicalGroup *Create_PhysicalGroup(int Num, int typ, List_T * intlist,  List_T *bndlist[4] = 0);
+PhysicalGroup *Create_PhysicalGroup(int Num, int typ, List_T * intlist,
+                                    List_T *bndlist[4] = 0);
 
 void End_Curve(Curve * c);
 void End_Surface(Surface * s);
diff --git a/Geo/GeoStringInterface.cpp b/Geo/GeoStringInterface.cpp
index 72a8d43cbd..11721ba74f 100644
--- a/Geo/GeoStringInterface.cpp
+++ b/Geo/GeoStringInterface.cpp
@@ -122,7 +122,6 @@ static std::string list2string(List_T *list)
   return sstream.str();
 }
 
-
 void delet(List_T *list, std::string filename, std::string what)
 {
   std::ostringstream sstream;
@@ -374,8 +373,10 @@ void protude(List_T *list, std::string filename, std::string what,
 	  << what << "{" << list2string(list) << "};\n}";
   add_infile(sstream.str(), filename);
 }
-void split_edge(int edge_id, List_T *vertices,std::string filename){
+
+void split_edge(int edge_id, List_T *vertices,std::string filename)
+{
   std::ostringstream sstream;
-  sstream<<"Split Line("<<edge_id<<") {"<<list2string(vertices)<<"};";
-  add_infile(sstream.str(), filename,true);
+  sstream << "Split Line(" << edge_id << ") {" << list2string(vertices) << "};";
+  add_infile(sstream.str(), filename, true);
 }
diff --git a/Geo/GeoStringInterface.h b/Geo/GeoStringInterface.h
index 62b9b51843..7a0b4a96f5 100644
--- a/Geo/GeoStringInterface.h
+++ b/Geo/GeoStringInterface.h
@@ -51,5 +51,6 @@ void extrude(List_T *list, std::string filename, std::string what, std::string t
 void protude(List_T *list, std::string filename, std::string what, 
              std::string ax, std::string ay, std::string az, 
              std::string px, std::string py, std::string pz, std::string angle);
-void split_edge(int edge_id, List_T *vertices,std::string filename);
+void split_edge(int edge_id, List_T *vertices, std::string filename);
+
 #endif
-- 
GitLab