From faa80a3e7094331dfb590ea919ba9a29f316d4b3 Mon Sep 17 00:00:00 2001
From: Akash Anand <akasha@iitk.ac.in>
Date: Tue, 7 Aug 2007 19:32:11 +0000
Subject: [PATCH] Merging patch from Christophe's sources to introduce the FM
 namespace everywhere.

---
 Fltk/GUI_Projection.cpp                       | 40 +++++++++----------
 Geo/FEdge.cpp                                 |  2 +-
 Geo/FEdge.h                                   |  4 +-
 Geo/FFace.cpp                                 |  4 +-
 Geo/FFace.h                                   |  8 ++--
 Geo/FProjectionFace.cpp                       |  2 +-
 Geo/FProjectionFace.h                         |  6 +--
 Geo/FVertex.h                                 |  4 +-
 Geo/GModelIO_F.cpp                            | 30 +++++++-------
 Geo/GModelIO_F.h                              |  2 +-
 contrib/FourierModel/BlendOperator.cpp        |  2 +
 contrib/FourierModel/BlendOperator.h          |  4 ++
 contrib/FourierModel/BlendedPatch.cpp         |  2 +
 contrib/FourierModel/BlendedPatch.h           |  4 ++
 contrib/FourierModel/ContinuationPatch.cpp    |  2 +
 contrib/FourierModel/ContinuationPatch.h      |  4 ++
 contrib/FourierModel/Curve.cpp                |  2 +
 contrib/FourierModel/Curve.h                  |  4 ++
 .../CylindricalProjectionSurface.cpp          |  2 +
 .../CylindricalProjectionSurface.h            |  4 ++
 contrib/FourierModel/ExactPatch.cpp           |  2 +
 contrib/FourierModel/ExactPatch.h             |  5 +++
 contrib/FourierModel/FCurve.cpp               |  2 +
 contrib/FourierModel/FCurve.h                 |  4 ++
 contrib/FourierModel/FM_Edge.cpp              |  2 +
 contrib/FourierModel/FM_Edge.h                |  4 ++
 contrib/FourierModel/FM_Face.cpp              |  2 +
 contrib/FourierModel/FM_Face.h                |  4 ++
 contrib/FourierModel/FM_Info.cpp              |  2 +
 contrib/FourierModel/FM_Info.h                |  4 ++
 contrib/FourierModel/FM_Reader.cpp            |  2 +
 contrib/FourierModel/FM_Reader.h              |  4 ++
 contrib/FourierModel/FM_Vertex.h              |  4 ++
 contrib/FourierModel/FPatch.cpp               |  2 +
 contrib/FourierModel/FPatch.h                 |  4 ++
 contrib/FourierModel/IntersectionCurve.cpp    |  2 +
 contrib/FourierModel/IntersectionCurve.h      |  4 ++
 contrib/FourierModel/Message.cpp              |  2 +
 contrib/FourierModel/Message.h                |  4 ++
 .../ParaboloidProjectionSurface.cpp           |  2 +
 .../ParaboloidProjectionSurface.h             |  4 ++
 contrib/FourierModel/PartitionOfUnity.h       |  4 ++
 contrib/FourierModel/Patch.cpp                |  2 +
 contrib/FourierModel/Patch.h                  |  4 ++
 .../FourierModel/PlaneProjectionSurface.cpp   |  2 +
 contrib/FourierModel/PlaneProjectionSurface.h |  4 ++
 contrib/FourierModel/ProjectionSurface.cpp    |  2 +
 contrib/FourierModel/ProjectionSurface.h      |  4 ++
 .../RevolvedParabolaProjectionSurface.cpp     |  2 +
 .../RevolvedParabolaProjectionSurface.h       |  4 ++
 contrib/FourierModel/Utils.cpp                |  2 +
 contrib/FourierModel/Utils.h                  |  3 --
 52 files changed, 176 insertions(+), 54 deletions(-)

diff --git a/Fltk/GUI_Projection.cpp b/Fltk/GUI_Projection.cpp
index 1c981272ea..e59887bec0 100644
--- a/Fltk/GUI_Projection.cpp
+++ b/Fltk/GUI_Projection.cpp
@@ -23,13 +23,13 @@ static FProjectionFace *createProjectionFaceFromName(char *name)
   int tag = GMODEL->numFace() + 1;
   FProjectionFace *f = 0;
   if(!strcmp(name, "plane"))
-    f = new FProjectionFace(GMODEL, tag, new PlaneProjectionSurface(tag));
+    f = new FProjectionFace(GMODEL, tag, new FM::PlaneProjectionSurface(tag));
   else if(!strcmp(name, "paraboloid"))
-    f = new FProjectionFace(GMODEL, tag, new ParaboloidProjectionSurface(tag));
+    f = new FProjectionFace(GMODEL, tag, new FM::ParaboloidProjectionSurface(tag));
   else if(!strcmp(name, "cylinder"))
-    f = new FProjectionFace(GMODEL, tag, new CylindricalProjectionSurface(tag));
+    f = new FProjectionFace(GMODEL, tag, new FM::CylindricalProjectionSurface(tag));
   else if(!strcmp(name, "revolvedParabola"))
-    f = new FProjectionFace(GMODEL, tag, new RevolvedParabolaProjectionSurface(tag));
+    f = new FProjectionFace(GMODEL, tag, new FM::RevolvedParabolaProjectionSurface(tag));
   else
     Msg(GERROR, "Unknown projection face `%s'", name);
   if(f){
@@ -126,7 +126,7 @@ projection::projection(FProjectionFace *f, int x, int y, int w, int h, int BB, i
 {
   group = new Fl_Scroll(x, y, w, h);
   SBoundingBox3d bounds = GMODEL->bounds();
-  ProjectionSurface *ps = f->GetProjectionSurface();
+  FM::ProjectionSurface *ps = f->GetProjectionSurface();
   currentParams = new double[ps->GetNumParameters() + 9];
   for(int i = 0; i < ps->GetNumParameters() + 9; i++){
     Fl_Value_Input *v = new Fl_Value_Input(x, y + i * BH, BB, BH);
@@ -321,7 +321,7 @@ projectionEditor::projectionEditor()
 
 void projectionEditor::load(FProjectionFace *face, std::string tag)
 {
-  ProjectionSurface *ps = face->GetProjectionSurface();
+  FM::ProjectionSurface *ps = face->GetProjectionSurface();
   _browser->add(tag.size() ? tag.c_str() : ps->GetName().c_str());
   projection *p =  new projection(face, _paramWin[0], _paramWin[1], _paramWin[2],
 				  _paramWin[3], _paramWin[4], _paramWin[5], this);
@@ -377,7 +377,7 @@ void update_cb(Fl_Widget *w, void *data)
 
   projection *p = e->getCurrentProjection();
   if(p){
-    ProjectionSurface *ps = p->face->GetProjectionSurface();
+    FM::ProjectionSurface *ps = p->face->GetProjectionSurface();
     ps->Rescale(p->parameters[0]->value() / p->currentParams[0],
 		p->parameters[1]->value() / p->currentParams[1],
 		p->parameters[2]->value() / p->currentParams[2]);
@@ -533,7 +533,7 @@ void filter_cb(Fl_Widget *w, void *data)
     SBoundingBox3d bbox = GMODEL->bounds();
     double lc = norm(SVector3(bbox.max(), bbox.min()));
     double threshold = slider->value() * lc;
-    ProjectionSurface *ps = p->face->GetProjectionSurface();
+    FM::ProjectionSurface *ps = p->face->GetProjectionSurface();
     std::vector<GEntity*> &ent(e->getEntities());
     for(unsigned int i = 0; i < ent.size(); i++){
       GVertex *gv = dynamic_cast<GVertex*>(ent[i]);
@@ -634,7 +634,7 @@ void save_projection_cb(Fl_Widget *w, void *data)
   projectionEditor *e = (projectionEditor*)data;
   projection *p = e->getCurrentProjection();
   if(p){
-    ProjectionSurface *ps = p->face->GetProjectionSurface();
+    FM::ProjectionSurface *ps = p->face->GetProjectionSurface();
     if(file_chooser(0, 1, "Save Projection", "*.pro")){
       FILE *fp = fopen(file_chooser_get_name(1), "w");
       if(!fp){
@@ -677,34 +677,34 @@ void compute_cb(Fl_Widget *w, void *data)
     int h3 = e->hardEdges[3]->value();
 
     // create the Fourier faces (with boundaries)
-    ProjectionSurface *ps = p->face->GetProjectionSurface();
+    FM::ProjectionSurface *ps = p->face->GetProjectionSurface();
     if(ps->IsUPeriodic()) {
-      Patch* patchL = new FPatch(0, ps->clone(), u, v, f, 3, uModes, vModes,
-				 uM, vM, h0, h1, h2, h3);
+      FM::Patch* patchL = new FM::FPatch(0, ps->clone(), u, v, f, 3, uModes, vModes,
+					 uM, vM, h0, h1, h2, h3);
       patchL->SetMinU(-0.35);
       patchL->SetMaxU(0.35);
       makeGFace(patchL);
-      Patch* patchR = new FPatch(0, ps->clone(), u, v, f, 3, uModes, vModes,
-				 uM, vM, h0, h1, h2, h3);
+      FM::Patch* patchR = new FM::FPatch(0, ps->clone(), u, v, f, 3, uModes, vModes,
+					 uM, vM, h0, h1, h2, h3);
       patchR->SetMinU(0.15);
       patchR->SetMaxU(0.85);
       makeGFace(patchR);
     }
     else if (ps->IsVPeriodic()) {
-      Patch* patchL = new FPatch(0, ps->clone(), u, v, f, 3, uModes, vModes, 
-				 uM, vM, h0, h1, h2, h3);
+      FM::Patch* patchL = new FM::FPatch(0, ps->clone(), u, v, f, 3, uModes, vModes, 
+					 uM, vM, h0, h1, h2, h3);
       patchL->SetMinV(-0.35);
       patchL->SetMaxV(0.35);
       makeGFace(patchL);
-      Patch* patchR = new FPatch(0, ps->clone(), u, v, f, 3, uModes, vModes,
-				 uM, vM, h0, h1, h2, h3);
+      FM::Patch* patchR = new FM::FPatch(0, ps->clone(), u, v, f, 3, uModes, vModes,
+					 uM, vM, h0, h1, h2, h3);
       patchR->SetMinV(0.15);
       patchR->SetMaxV(0.85);
       makeGFace(patchR);
     }
     else {
-      Patch* patch = new FPatch(0, ps->clone(), u, v, f, 3, uModes, vModes, 
-				uM, vM, h0, h1, h2, h3);
+      FM::Patch* patch = new FM::FPatch(0, ps->clone(), u, v, f, 3, uModes, vModes, 
+					uM, vM, h0, h1, h2, h3);
       makeGFace(patch);
     }
   }
diff --git a/Geo/FEdge.cpp b/Geo/FEdge.cpp
index 82b9f7eabb..2c78d630cc 100644
--- a/Geo/FEdge.cpp
+++ b/Geo/FEdge.cpp
@@ -3,7 +3,7 @@
 
 #if defined(HAVE_FOURIER_MODEL)
 
-FEdge::FEdge(GModel *model, FM_Edge* edge_, int tag, GVertex *v0, GVertex *v1) 
+FEdge::FEdge(GModel *model, FM::FM_Edge* edge_, int tag, GVertex *v0, GVertex *v1) 
   : GEdge(model, tag, v0, v1), edge(edge_) 
 {
   //meshAttributes.Method = TRANSFINI; 
diff --git a/Geo/FEdge.h b/Geo/FEdge.h
index b11b79d4d5..810d36d9a4 100644
--- a/Geo/FEdge.h
+++ b/Geo/FEdge.h
@@ -14,10 +14,10 @@
 
 class FEdge : public GEdge {
  protected:
-  FM_Edge* edge;
+  FM::FM_Edge* edge;
   int edgeNum;
  public:
-  FEdge(GModel *model, FM_Edge* edge_, int tag, GVertex *v0, GVertex *v1);
+  FEdge(GModel *model, FM::FM_Edge* edge_, int tag, GVertex *v0, GVertex *v1);
   virtual ~FEdge() {}
   double period() const { throw ; }
   virtual bool periodic(int dim=0) const { return false; }
diff --git a/Geo/FFace.cpp b/Geo/FFace.cpp
index 57c1ab85d5..6e78bd8443 100644
--- a/Geo/FFace.cpp
+++ b/Geo/FFace.cpp
@@ -5,7 +5,7 @@
 
 #if defined(HAVE_FOURIER_MODEL)
 
-FFace::FFace(GModel *m, FM_Face *face_, int tag, std::list<GEdge*> l_edges_) 
+FFace::FFace(GModel *m, FM::FM_Face *face_, int tag, std::list<GEdge*> l_edges_) 
   : GFace(m,tag), face(face_)
 {
   for (std::list<GEdge*>::iterator it = l_edges_.begin();
@@ -15,7 +15,7 @@ FFace::FFace(GModel *m, FM_Face *face_, int tag, std::list<GEdge*> l_edges_)
   }
 }
 
-FFace::FFace(GModel *m, FM_Face *face_, int tag, std::list<GEdge*> l_edges_,
+FFace::FFace(GModel *m, FM::FM_Face *face_, int tag, std::list<GEdge*> l_edges_,
 	     std::list<int> l_dirs_) : GFace(m,tag), face(face_)
 {
   for (std::list<GEdge*>::iterator it = l_edges_.begin();
diff --git a/Geo/FFace.h b/Geo/FFace.h
index 21e7fad9c7..7bfa020aac 100644
--- a/Geo/FFace.h
+++ b/Geo/FFace.h
@@ -12,10 +12,10 @@
 
 class FFace : public GFace {
  protected:
-  FM_Face *face;
+  FM::FM_Face *face;
  public:
-  FFace(GModel *m, FM_Face *face_, int tag, std::list<GEdge*> l_edges_);
-  FFace(GModel *m, FM_Face *face_, int tag, std::list<GEdge*> l_edges_,
+  FFace(GModel *m, FM::FM_Face *face_, int tag, std::list<GEdge*> l_edges_);
+  FFace(GModel *m, FM::FM_Face *face_, int tag, std::list<GEdge*> l_edges_,
 	std::list<int> l_dirs_);
 
   virtual ~FFace() {}
@@ -42,7 +42,7 @@ class FFace : public GFace {
   ModelType getNativeType() const { return FourierModel; }
   void * getNativePtr() const {throw;} 
   virtual bool surfPeriodic(int dim) const;
-  FM_Face* GetFMFace() { return face; }
+  FM::FM_Face* GetFMFace() { return face; }
 };
 
 #endif
diff --git a/Geo/FProjectionFace.cpp b/Geo/FProjectionFace.cpp
index 224619af27..afaf08ce38 100644
--- a/Geo/FProjectionFace.cpp
+++ b/Geo/FProjectionFace.cpp
@@ -6,7 +6,7 @@ FProjectionFace::FProjectionFace(GModel *m, int num)
   : GFace(m,num), ps_(0) {}
 
 FProjectionFace::
-FProjectionFace(GModel *m, int num, ProjectionSurface* ps)
+FProjectionFace(GModel *m, int num, FM::ProjectionSurface* ps)
   : GFace(m,num), ps_(ps) {}
 
 FProjectionFace::~FProjectionFace() {}
diff --git a/Geo/FProjectionFace.h b/Geo/FProjectionFace.h
index 6c49df7f9c..07663682b3 100644
--- a/Geo/FProjectionFace.h
+++ b/Geo/FProjectionFace.h
@@ -10,11 +10,11 @@
 
 class FProjectionFace : public GFace {
  protected:
-  ProjectionSurface* ps_;
+  FM::ProjectionSurface* ps_;
 
  public:
   FProjectionFace(GModel *m, int num);
-  FProjectionFace(GModel *m, int num, ProjectionSurface* ps);
+  FProjectionFace(GModel *m, int num, FM::ProjectionSurface* ps);
   ~FProjectionFace();
 
   Range<double> parBounds(int i) const;
@@ -38,7 +38,7 @@ class FProjectionFace : public GFace {
   void * getNativePtr() const {throw;} 
   virtual bool surfPeriodic(int dim) const {throw;}
 
-  inline ProjectionSurface* GetProjectionSurface() { return ps_; }
+  inline FM::ProjectionSurface* GetProjectionSurface() { return ps_; }
 };
 
 #endif
diff --git a/Geo/FVertex.h b/Geo/FVertex.h
index 14f610a5fa..c3c86c89c1 100644
--- a/Geo/FVertex.h
+++ b/Geo/FVertex.h
@@ -10,10 +10,10 @@
 
 class FVertex : public GVertex {
  protected:
-  FM_Vertex* v;
+  FM::FM_Vertex* v;
 
  public:
-  FVertex(GModel *m, int num, FM_Vertex* _v) : GVertex(m, num), v(_v)
+  FVertex(GModel *m, int num, FM::FM_Vertex* _v) : GVertex(m, num), v(_v)
   {
     mesh_vertices.push_back(new MVertex(x(), y(), z(), this));
   }
diff --git a/Geo/GModelIO_F.cpp b/Geo/GModelIO_F.cpp
index 778d5a94a0..6982049800 100644
--- a/Geo/GModelIO_F.cpp
+++ b/Geo/GModelIO_F.cpp
@@ -18,7 +18,7 @@
 
 extern GModel *GMODEL;
 
-void makeGFace(Patch* patch)
+void makeGFace(FM::Patch* patch)
 {
   double LL[2], LR[2], UL[2], UR[2];
   LL[0] = 0.0; LL[1] = 0.0;
@@ -31,46 +31,46 @@ void makeGFace(Patch* patch)
   
   int tagVertex = GMODEL->numVertex();
   patch->F(LL[0],LL[1],xx,yy,zz);
-  FM_Vertex* vLL = new FM_Vertex(++tagVertex,xx,yy,zz);
+  FM::FM_Vertex* vLL = new FM::FM_Vertex(++tagVertex,xx,yy,zz);
   GMODEL->add(new FVertex(GMODEL,vLL->GetTag(),vLL));
   patch->F(LR[0],LR[1],xx,yy,zz);
-  FM_Vertex* vLR = new FM_Vertex(++tagVertex,xx,yy,zz);
+  FM::FM_Vertex* vLR = new FM::FM_Vertex(++tagVertex,xx,yy,zz);
   GMODEL->add(new FVertex(GMODEL,vLR->GetTag(),vLR));
   patch->F(UL[0],UL[1],xx,yy,zz);
-  FM_Vertex* vUL = new FM_Vertex(++tagVertex,xx,yy,zz);
+  FM::FM_Vertex* vUL = new FM::FM_Vertex(++tagVertex,xx,yy,zz);
   GMODEL->add(new FVertex(GMODEL,vUL->GetTag(),vUL));
   patch->F(UR[0],UR[1],xx,yy,zz);
-  FM_Vertex* vUR = new FM_Vertex(++tagVertex,xx,yy,zz);
+  FM::FM_Vertex* vUR = new FM::FM_Vertex(++tagVertex,xx,yy,zz);
   GMODEL->add(new FVertex(GMODEL,vUR->GetTag(),vUR));
   
-  Curve* curveB = new FCurve(0,patch,LL,LR);
-  Curve* curveR = new FCurve(0,patch,LR,UR);
-  Curve* curveT = new FCurve(0,patch,UR,UL);
-  Curve* curveL = new FCurve(0,patch,UL,LL);
+  FM::Curve* curveB = new FM::FCurve(0,patch,LL,LR);
+  FM::Curve* curveR = new FM::FCurve(0,patch,LR,UR);
+  FM::Curve* curveT = new FM::FCurve(0,patch,UR,UL);
+  FM::Curve* curveL = new FM::FCurve(0,patch,UL,LL);
   
   int tagEdge = GMODEL->numEdge();
-  FM_Edge* eB = new FM_Edge(++tagEdge,curveB,vLL,vLR);
+  FM::FM_Edge* eB = new FM::FM_Edge(++tagEdge,curveB,vLL,vLR);
   i1 = eB->GetStartPoint()->GetTag();
   i2 = eB->GetEndPoint()->GetTag();
   GMODEL->add(new FEdge(GMODEL,eB,eB->GetTag(),GMODEL->vertexByTag(i1),
 			GMODEL->vertexByTag(i2)));
-  FM_Edge* eR = new FM_Edge(++tagEdge,curveR,vLR,vUR); 
+  FM::FM_Edge* eR = new FM::FM_Edge(++tagEdge,curveR,vLR,vUR); 
   i1 = eR->GetStartPoint()->GetTag();
   i2 = eR->GetEndPoint()->GetTag();
   GMODEL->add(new FEdge(GMODEL,eR,eR->GetTag(),GMODEL->vertexByTag(i1),
 			GMODEL->vertexByTag(i2))); 
-  FM_Edge* eT = new FM_Edge(++tagEdge,curveT,vUR,vUL);
+  FM::FM_Edge* eT = new FM::FM_Edge(++tagEdge,curveT,vUR,vUL);
   i1 = eT->GetStartPoint()->GetTag();
   i2 = eT->GetEndPoint()->GetTag();
   GMODEL->add(new FEdge(GMODEL,eT,eT->GetTag(),GMODEL->vertexByTag(i1),
 			GMODEL->vertexByTag(i2)));
-  FM_Edge* eL = new FM_Edge(++tagEdge,curveL,vUL,vLL); 
+  FM::FM_Edge* eL = new FM::FM_Edge(++tagEdge,curveL,vUL,vLL); 
   i1 = eL->GetStartPoint()->GetTag();
   i2 = eL->GetEndPoint()->GetTag();
   GMODEL->add(new FEdge(GMODEL,eL,eL->GetTag(),GMODEL->vertexByTag(i1),
 			GMODEL->vertexByTag(i2)));
   
-  FM_Face* face = new FM_Face(GMODEL->numFace() + 1,patch);
+  FM::FM_Face* face = new FM::FM_Face(GMODEL->numFace() + 1,patch);
   face->AddEdge(eB); face->AddEdge(eR); 
   face->AddEdge(eT); face->AddEdge(eL);
   std::list<GEdge*> l_edges;
@@ -83,7 +83,7 @@ void makeGFace(Patch* patch)
 
 int GModel::readF(const std::string &filename)
 {
-  FM_Reader* reader = new FM_Reader(filename.c_str());
+  FM::FM_Reader* reader = new FM::FM_Reader(filename.c_str());
   for (int i = 0; i < reader->GetNumPatches(); i++)
     makeGFace(reader->GetPatch(i));
 
diff --git a/Geo/GModelIO_F.h b/Geo/GModelIO_F.h
index 584e492afe..fc3a4fe3f5 100644
--- a/Geo/GModelIO_F.h
+++ b/Geo/GModelIO_F.h
@@ -7,7 +7,7 @@
 
 #include "Patch.h"
 
-void makeGFace(Patch* patch);
+void makeGFace(FM::Patch* patch);
 
 #endif
 
diff --git a/contrib/FourierModel/BlendOperator.cpp b/contrib/FourierModel/BlendOperator.cpp
index da4758f925..a29c52dfd3 100755
--- a/contrib/FourierModel/BlendOperator.cpp
+++ b/contrib/FourierModel/BlendOperator.cpp
@@ -1,5 +1,7 @@
 #include "BlendOperator.h"
 
+using namespace FM;
+
 bool BlendOperator::GetPointOnPatch_
 (int i, double u, double v, int j, double &x, double &y, double &z)
 {
diff --git a/contrib/FourierModel/BlendOperator.h b/contrib/FourierModel/BlendOperator.h
index db8b1f593a..ff8aa33509 100755
--- a/contrib/FourierModel/BlendOperator.h
+++ b/contrib/FourierModel/BlendOperator.h
@@ -6,6 +6,8 @@
 #include "Patch.h"
 #include "ProjectionSurface.h"
 
+namespace FM {
+
 class BlendOperator {
  private:
   std::vector<Patch*> patch_;
@@ -53,4 +55,6 @@ class BlendOperator {
     (int patchTag, double d[3], double &x, double &y, double &z);
 };
 
+}
+
 #endif
diff --git a/contrib/FourierModel/BlendedPatch.cpp b/contrib/FourierModel/BlendedPatch.cpp
index 30f42f1d15..9a4cb6b207 100755
--- a/contrib/FourierModel/BlendedPatch.cpp
+++ b/contrib/FourierModel/BlendedPatch.cpp
@@ -1,5 +1,7 @@
 #include "BlendedPatch.h"
 
+using namespace FM;
+
 BlendedPatch::BlendedPatch
 (Patch* patch, BlendOperator* blendOp) 
   : _coeffData(0),_coeffDerivU(0),_coeffDerivV(0),
diff --git a/contrib/FourierModel/BlendedPatch.h b/contrib/FourierModel/BlendedPatch.h
index 40d0bcf6f5..7fa138168d 100755
--- a/contrib/FourierModel/BlendedPatch.h
+++ b/contrib/FourierModel/BlendedPatch.h
@@ -7,6 +7,8 @@
 #include "BlendOperator.h"
 #include "PartitionOfUnity.h"
 
+namespace FM {
+
 class BlendedPatch {
  private:
   Patch* patch_;
@@ -97,4 +99,6 @@ class BlendedPatch {
     () { return patchTag_; }
 };
 
+}
+
 #endif
diff --git a/contrib/FourierModel/ContinuationPatch.cpp b/contrib/FourierModel/ContinuationPatch.cpp
index 62b6d01f5b..6ac87cbddd 100644
--- a/contrib/FourierModel/ContinuationPatch.cpp
+++ b/contrib/FourierModel/ContinuationPatch.cpp
@@ -2,6 +2,8 @@
 #include "Message.h"
 #include "ContinuationPatch.h"
 
+using namespace FM;
+
 ContinuationPatch::ContinuationPatch
 (PatchInfo* PI, ProjectionSurface* ps)
   : Patch(),_coeffOriginalData(0),_coeffData(0),_coeffDerivU(0),
diff --git a/contrib/FourierModel/ContinuationPatch.h b/contrib/FourierModel/ContinuationPatch.h
index f0c409930c..2e536fdee4 100644
--- a/contrib/FourierModel/ContinuationPatch.h
+++ b/contrib/FourierModel/ContinuationPatch.h
@@ -6,6 +6,8 @@
 #include "FM_Info.h"
 #include "PartitionOfUnity.h"
 
+namespace FM {
+
 // The base class for the patches
 class ContinuationPatch : public Patch {
  protected:
@@ -70,4 +72,6 @@ class ContinuationPatch : public Patch {
   virtual void Dfdfdvdv(double u,double v,double &x,double &y,double &z);
 };
 
+}
+
 #endif
diff --git a/contrib/FourierModel/Curve.cpp b/contrib/FourierModel/Curve.cpp
index 7c9e419fd0..73a1baf49d 100644
--- a/contrib/FourierModel/Curve.cpp
+++ b/contrib/FourierModel/Curve.cpp
@@ -1,5 +1,7 @@
 #include "Curve.h"
 
+using namespace FM;
+
 Curve::Curve() 
 {
   _tag = -1;
diff --git a/contrib/FourierModel/Curve.h b/contrib/FourierModel/Curve.h
index 72e55c8c65..fc5353e033 100644
--- a/contrib/FourierModel/Curve.h
+++ b/contrib/FourierModel/Curve.h
@@ -1,6 +1,8 @@
 #ifndef _CURVE_H_
 #define _CURVE_H_
 
+namespace FM {
+
 // The base class for the patches
 class Curve {
  protected:
@@ -20,4 +22,6 @@ class Curve {
   virtual void Dfdfdtdt(double t, double &x, double &y, double &z) = 0;
 };
 
+}
+
 #endif
diff --git a/contrib/FourierModel/CylindricalProjectionSurface.cpp b/contrib/FourierModel/CylindricalProjectionSurface.cpp
index 9ea0ed6a86..5663749349 100755
--- a/contrib/FourierModel/CylindricalProjectionSurface.cpp
+++ b/contrib/FourierModel/CylindricalProjectionSurface.cpp
@@ -1,5 +1,7 @@
 #include "CylindricalProjectionSurface.h"
 
+using namespace FM;
+
 CylindricalProjectionSurface::CylindricalProjectionSurface
 (int tag) : ProjectionSurface(1.)
 {
diff --git a/contrib/FourierModel/CylindricalProjectionSurface.h b/contrib/FourierModel/CylindricalProjectionSurface.h
index cea0be9fda..783ff6379f 100755
--- a/contrib/FourierModel/CylindricalProjectionSurface.h
+++ b/contrib/FourierModel/CylindricalProjectionSurface.h
@@ -4,6 +4,8 @@
 #include <cmath>
 #include "ProjectionSurface.h"
 
+namespace FM {
+
 class CylindricalProjectionSurface : public ProjectionSurface {
  private:
   double twoPi_;
@@ -81,4 +83,6 @@ class CylindricalProjectionSurface : public ProjectionSurface {
     (double u, double v, double &x, double &y, double &z);
 };
 
+}
+
 #endif
diff --git a/contrib/FourierModel/ExactPatch.cpp b/contrib/FourierModel/ExactPatch.cpp
index d79e8958eb..4a5173771f 100644
--- a/contrib/FourierModel/ExactPatch.cpp
+++ b/contrib/FourierModel/ExactPatch.cpp
@@ -1,6 +1,8 @@
 #include "Message.h"
 #include "ExactPatch.h"
 
+using namespace FM;
+
 ExactPatch::ExactPatch(ProjectionSurface* ps) : Patch()
 {
   SetProjectionSurface(ps);
diff --git a/contrib/FourierModel/ExactPatch.h b/contrib/FourierModel/ExactPatch.h
index a7adf51d16..ebd2949295 100644
--- a/contrib/FourierModel/ExactPatch.h
+++ b/contrib/FourierModel/ExactPatch.h
@@ -5,6 +5,8 @@
 #include "FM_Info.h"
 #include "ProjectionSurface.h"
 
+namespace FM {
+
 // The base class for the patches
 class ExactPatch : public Patch {
  public:
@@ -28,4 +30,7 @@ class ExactPatch : public Patch {
   virtual void Dfdfdudv(double u,double v,double &x,double &y,double &z);
   virtual void Dfdfdvdv(double u,double v,double &x,double &y,double &z);
 };
+
+}
+
 #endif
diff --git a/contrib/FourierModel/FCurve.cpp b/contrib/FourierModel/FCurve.cpp
index 67d87913f6..fcac90e879 100644
--- a/contrib/FourierModel/FCurve.cpp
+++ b/contrib/FourierModel/FCurve.cpp
@@ -1,5 +1,7 @@
 #include "FCurve.h"
 
+using namespace FM;
+
 FCurve::FCurve
 (int tag, Patch* patch) 
   : Curve(tag)
diff --git a/contrib/FourierModel/FCurve.h b/contrib/FourierModel/FCurve.h
index 18267398ae..d024bfd274 100644
--- a/contrib/FourierModel/FCurve.h
+++ b/contrib/FourierModel/FCurve.h
@@ -4,6 +4,8 @@
 #include "Curve.h"
 #include "Patch.h"
 
+namespace FM {
+
 // The base class for the patches
 class FCurve : public Curve {
  protected:
@@ -57,4 +59,6 @@ class FCurve : public Curve {
     (double t, double &x, double &y, double &z);
 };
 
+}
+
 #endif
diff --git a/contrib/FourierModel/FM_Edge.cpp b/contrib/FourierModel/FM_Edge.cpp
index f5641b8c47..90622b4418 100644
--- a/contrib/FourierModel/FM_Edge.cpp
+++ b/contrib/FourierModel/FM_Edge.cpp
@@ -2,6 +2,8 @@
 #include "FM_Edge.h"
 #include "Message.h"
 
+using namespace FM;
+
 void FM_Edge::F(double t, double &x, double &y, double &z)
 {
   if (_curve) {
diff --git a/contrib/FourierModel/FM_Edge.h b/contrib/FourierModel/FM_Edge.h
index 00a6201536..5d6a28987e 100644
--- a/contrib/FourierModel/FM_Edge.h
+++ b/contrib/FourierModel/FM_Edge.h
@@ -4,6 +4,8 @@
 #include "Curve.h"
 #include "FM_Vertex.h"
 
+namespace FM {
+
 class FM_Edge {
  private:
   int _tag;
@@ -45,4 +47,6 @@ class FM_Edge {
   void Dfdfdtdt(double t, double &x, double &y, double &z);
 };
 
+}
+
 #endif
diff --git a/contrib/FourierModel/FM_Face.cpp b/contrib/FourierModel/FM_Face.cpp
index 034ab80fcf..5330b5976f 100644
--- a/contrib/FourierModel/FM_Face.cpp
+++ b/contrib/FourierModel/FM_Face.cpp
@@ -1,6 +1,8 @@
 #include "FM_Face.h"
 #include "Message.h"
 
+using namespace FM;
+
 void FM_Face::F(double u, double v, double &x, double &y, double &z) {
 
   _patch->F(u,v,x,y,z);
diff --git a/contrib/FourierModel/FM_Face.h b/contrib/FourierModel/FM_Face.h
index 9a7fed7dac..b2f26d46e5 100644
--- a/contrib/FourierModel/FM_Face.h
+++ b/contrib/FourierModel/FM_Face.h
@@ -5,6 +5,8 @@
 #include "Patch.h"
 #include "FM_Edge.h"
 
+namespace FM {
+
 class FM_Face {
  private:
   int _tag;
@@ -43,4 +45,6 @@ class FM_Face {
   void GetNormal(double u, double v, double &x, double &y, double &z);
 };
 
+}
+
 #endif
diff --git a/contrib/FourierModel/FM_Info.cpp b/contrib/FourierModel/FM_Info.cpp
index fed31f10e2..29d08d37cb 100644
--- a/contrib/FourierModel/FM_Info.cpp
+++ b/contrib/FourierModel/FM_Info.cpp
@@ -1,5 +1,7 @@
 #include "FM_Info.h"
 
+using namespace FM;
+
 PatchInfo::PatchInfo() : tag(-1) 
 {
   uMin = vMin = 0.;
diff --git a/contrib/FourierModel/FM_Info.h b/contrib/FourierModel/FM_Info.h
index 7332030eda..2d3f8ffd6c 100644
--- a/contrib/FourierModel/FM_Info.h
+++ b/contrib/FourierModel/FM_Info.h
@@ -4,6 +4,8 @@
 #include <complex>
 #include <vector>
 
+namespace FM {
+
 class PatchInfo {
  public:
   int tag;
@@ -58,4 +60,6 @@ class IntersectionInfo {
   virtual ~IntersectionInfo() {}
 };
 
+}
+
 #endif
diff --git a/contrib/FourierModel/FM_Reader.cpp b/contrib/FourierModel/FM_Reader.cpp
index 11666b29cb..bb75dcfa5a 100644
--- a/contrib/FourierModel/FM_Reader.cpp
+++ b/contrib/FourierModel/FM_Reader.cpp
@@ -3,6 +3,8 @@
 #include "Message.h"
 #include "FM_Reader.h"
 
+using namespace FM;
+
 FM_Reader::FM_Reader(const char* fn)
 {
   char c;
diff --git a/contrib/FourierModel/FM_Reader.h b/contrib/FourierModel/FM_Reader.h
index 55bc6f8e2e..199e9d5ed5 100644
--- a/contrib/FourierModel/FM_Reader.h
+++ b/contrib/FourierModel/FM_Reader.h
@@ -17,6 +17,8 @@
 #include "BlendOperator.h"
 #include "BlendedPatch.h"
 
+namespace FM {
+
 class FM_Reader {
  private:
   int _nPatches;
@@ -42,4 +44,6 @@ class FM_Reader {
     (int tag);
 };
 
+}
+
 #endif
diff --git a/contrib/FourierModel/FM_Vertex.h b/contrib/FourierModel/FM_Vertex.h
index b166b7f4fa..b893144563 100644
--- a/contrib/FourierModel/FM_Vertex.h
+++ b/contrib/FourierModel/FM_Vertex.h
@@ -1,6 +1,8 @@
 #ifndef _FM_VERTEX_H_
 #define _FM_VERTEX_H_
 
+namespace FM {
+
 class FM_Vertex {
  private:
   int _tag;
@@ -23,4 +25,6 @@ class FM_Vertex {
   inline void SetZ(double z) { _z = z; }
 };
 
+}
+
 #endif
diff --git a/contrib/FourierModel/FPatch.cpp b/contrib/FourierModel/FPatch.cpp
index 914713ff08..188a6632e4 100644
--- a/contrib/FourierModel/FPatch.cpp
+++ b/contrib/FourierModel/FPatch.cpp
@@ -2,6 +2,8 @@
 #include "Message.h"
 #include "FPatch.h"
 
+using namespace FM;
+
 extern "C" {
   void zgelss_(int &,int &,int &,std::complex<double> *,int &,
                std::complex<double> *,int &,double *,double &,int &,
diff --git a/contrib/FourierModel/FPatch.h b/contrib/FourierModel/FPatch.h
index 93e44ab55d..d3a24e1e5e 100644
--- a/contrib/FourierModel/FPatch.h
+++ b/contrib/FourierModel/FPatch.h
@@ -9,6 +9,8 @@
 #include "PartitionOfUnity.h"
 #include "ProjectionSurface.h"
 
+namespace FM {
+
 // The base class for the patches
 class FPatch : public Patch {
  protected:
@@ -89,4 +91,6 @@ class FPatch : public Patch {
   virtual void Dfdfdvdv(double u,double v,double &x,double &y,double &z);
 };
 
+}
+
 #endif
diff --git a/contrib/FourierModel/IntersectionCurve.cpp b/contrib/FourierModel/IntersectionCurve.cpp
index 53ae11c27c..88424a9520 100644
--- a/contrib/FourierModel/IntersectionCurve.cpp
+++ b/contrib/FourierModel/IntersectionCurve.cpp
@@ -2,6 +2,8 @@
 #include "Message.h"
 #include "IntersectionCurve.h"
 
+using namespace FM;
+
 IntersectionCurve::IntersectionCurve
 (IntersectionInfo* II, std::vector<Patch*> patches) 
   : Curve(), _II(II)
diff --git a/contrib/FourierModel/IntersectionCurve.h b/contrib/FourierModel/IntersectionCurve.h
index 7783a66fa5..b091d05956 100644
--- a/contrib/FourierModel/IntersectionCurve.h
+++ b/contrib/FourierModel/IntersectionCurve.h
@@ -5,6 +5,8 @@
 #include "Patch.h"
 #include "FM_Info.h"
 
+namespace FM {
+
 // The base class for the patches
 class IntersectionCurve : public Curve {
  private:
@@ -37,4 +39,6 @@ class IntersectionCurve : public Curve {
   virtual void Dfdfdtdt(double t, double &x, double &y, double &z);
 };
 
+}
+
 #endif
diff --git a/contrib/FourierModel/Message.cpp b/contrib/FourierModel/Message.cpp
index 0a598674eb..945ce213bf 100644
--- a/contrib/FourierModel/Message.cpp
+++ b/contrib/FourierModel/Message.cpp
@@ -13,6 +13,8 @@
 
 #include "Message.h"
 
+using namespace FM;
+
 int Message::_commRank = 0;
 int Message::_commSize = 1;
 int Message::_verbosity = 3;
diff --git a/contrib/FourierModel/Message.h b/contrib/FourierModel/Message.h
index f5b9a65464..1fd9de2cf2 100644
--- a/contrib/FourierModel/Message.h
+++ b/contrib/FourierModel/Message.h
@@ -3,6 +3,8 @@
 
 #include <stdarg.h>
 
+namespace FM {
+
 // a class to manage messages
 class Message {
  private:
@@ -33,4 +35,6 @@ class Message {
 
 typedef Message Msg;
 
+}
+
 #endif
diff --git a/contrib/FourierModel/ParaboloidProjectionSurface.cpp b/contrib/FourierModel/ParaboloidProjectionSurface.cpp
index 26cb5647ee..da82567e0a 100755
--- a/contrib/FourierModel/ParaboloidProjectionSurface.cpp
+++ b/contrib/FourierModel/ParaboloidProjectionSurface.cpp
@@ -1,5 +1,7 @@
 #include "ParaboloidProjectionSurface.h"
 
+using namespace FM;
+
 ParaboloidProjectionSurface::ParaboloidProjectionSurface
 (int tag) : ProjectionSurface() 
 {
diff --git a/contrib/FourierModel/ParaboloidProjectionSurface.h b/contrib/FourierModel/ParaboloidProjectionSurface.h
index dcefbe038e..92c13ce1cb 100755
--- a/contrib/FourierModel/ParaboloidProjectionSurface.h
+++ b/contrib/FourierModel/ParaboloidProjectionSurface.h
@@ -6,6 +6,8 @@
 #include "Utils.h"
 #include "ProjectionSurface.h"
 
+namespace FM {
+
 class ParaboloidProjectionSurface : public ProjectionSurface {
  public:
   ParaboloidProjectionSurface
@@ -59,4 +61,6 @@ class ParaboloidProjectionSurface : public ProjectionSurface {
     (int i);
 };
 
+}
+
 #endif
diff --git a/contrib/FourierModel/PartitionOfUnity.h b/contrib/FourierModel/PartitionOfUnity.h
index 39f1e2e975..edb081e595 100755
--- a/contrib/FourierModel/PartitionOfUnity.h
+++ b/contrib/FourierModel/PartitionOfUnity.h
@@ -3,6 +3,8 @@
 
 #include <cmath>
 
+namespace FM {
+
 inline double OneSidedPartitionOfUnity(double t0,
 				       double t1,
 				       double t)
@@ -133,4 +135,6 @@ inline double PartitionOfUnityDtDt(double r,
   return PartitionOfUnityDtDtInternalCall(r, start1, end1, end2, start2);
 }
 
+}
+
 #endif
diff --git a/contrib/FourierModel/Patch.cpp b/contrib/FourierModel/Patch.cpp
index 4d4a5472c0..cd5a0c03b0 100644
--- a/contrib/FourierModel/Patch.cpp
+++ b/contrib/FourierModel/Patch.cpp
@@ -1,6 +1,8 @@
 #include <cmath>
 #include "Patch.h"
 
+using namespace FM;
+
 Patch::Patch() :_ps(0), _uMin(0.), _uMax(1.), _vMin(0.), _vMax(1.),
 		_periodicityU(0), _periodicityV(0), _derivative(3), 
 		_tag(-1) {}
diff --git a/contrib/FourierModel/Patch.h b/contrib/FourierModel/Patch.h
index ff004e3da8..f428d514cc 100644
--- a/contrib/FourierModel/Patch.h
+++ b/contrib/FourierModel/Patch.h
@@ -4,6 +4,8 @@
 #include <cmath>
 #include "ProjectionSurface.h"
 
+namespace FM {
+
 // The base class for the patches
 class Patch {
  protected:
@@ -113,4 +115,6 @@ class Patch {
 
 };
 
+}
+
 #endif
diff --git a/contrib/FourierModel/PlaneProjectionSurface.cpp b/contrib/FourierModel/PlaneProjectionSurface.cpp
index f50a616423..e47808f394 100755
--- a/contrib/FourierModel/PlaneProjectionSurface.cpp
+++ b/contrib/FourierModel/PlaneProjectionSurface.cpp
@@ -1,5 +1,7 @@
 #include "PlaneProjectionSurface.h"
 
+using namespace FM;
+
 PlaneProjectionSurface::PlaneProjectionSurface
 (int tag) : ProjectionSurface()
 {
diff --git a/contrib/FourierModel/PlaneProjectionSurface.h b/contrib/FourierModel/PlaneProjectionSurface.h
index b592178996..41a290f409 100755
--- a/contrib/FourierModel/PlaneProjectionSurface.h
+++ b/contrib/FourierModel/PlaneProjectionSurface.h
@@ -4,6 +4,8 @@
 #include <cmath>
 #include "ProjectionSurface.h"
 
+namespace FM {
+
 class PlaneProjectionSurface : public ProjectionSurface {
  public:
   PlaneProjectionSurface
@@ -70,4 +72,6 @@ class PlaneProjectionSurface : public ProjectionSurface {
     (double u, double v, double &x, double &y, double &z);
 };
 
+}
+
 #endif
diff --git a/contrib/FourierModel/ProjectionSurface.cpp b/contrib/FourierModel/ProjectionSurface.cpp
index a5db401194..c1731f5001 100755
--- a/contrib/FourierModel/ProjectionSurface.cpp
+++ b/contrib/FourierModel/ProjectionSurface.cpp
@@ -1,6 +1,8 @@
 #include <cmath>
 #include "ProjectionSurface.h"
 
+using namespace FM;
+
 ProjectionSurface::ProjectionSurface
 (double uPeriod, double vPeriod)
 {
diff --git a/contrib/FourierModel/ProjectionSurface.h b/contrib/FourierModel/ProjectionSurface.h
index 32e2afff3e..41840e7e80 100755
--- a/contrib/FourierModel/ProjectionSurface.h
+++ b/contrib/FourierModel/ProjectionSurface.h
@@ -3,6 +3,8 @@
 
 #include <string>
 
+namespace FM {
+
 class ProjectionSurface {
  private:
   int tag_;
@@ -143,4 +145,6 @@ class ProjectionSurface {
     (double S0, double S1, double S2);
 };
 
+}
+
 #endif
diff --git a/contrib/FourierModel/RevolvedParabolaProjectionSurface.cpp b/contrib/FourierModel/RevolvedParabolaProjectionSurface.cpp
index 33a9880150..21a9cfac48 100755
--- a/contrib/FourierModel/RevolvedParabolaProjectionSurface.cpp
+++ b/contrib/FourierModel/RevolvedParabolaProjectionSurface.cpp
@@ -1,5 +1,7 @@
 #include "RevolvedParabolaProjectionSurface.h"
 
+using namespace FM;
+
 RevolvedParabolaProjectionSurface::RevolvedParabolaProjectionSurface
 (int tag) : ProjectionSurface(1.) 
 {
diff --git a/contrib/FourierModel/RevolvedParabolaProjectionSurface.h b/contrib/FourierModel/RevolvedParabolaProjectionSurface.h
index 94a37ba6ad..29217da97b 100755
--- a/contrib/FourierModel/RevolvedParabolaProjectionSurface.h
+++ b/contrib/FourierModel/RevolvedParabolaProjectionSurface.h
@@ -6,6 +6,8 @@
 #include "Utils.h"
 #include "ProjectionSurface.h"
 
+namespace FM {
+
 class RevolvedParabolaProjectionSurface : public ProjectionSurface {
  private:
   double twoPi_;
@@ -67,4 +69,6 @@ class RevolvedParabolaProjectionSurface : public ProjectionSurface {
     (int i);
 };
 
+}
+
 #endif
diff --git a/contrib/FourierModel/Utils.cpp b/contrib/FourierModel/Utils.cpp
index 9d951238bf..82cdc925c5 100755
--- a/contrib/FourierModel/Utils.cpp
+++ b/contrib/FourierModel/Utils.cpp
@@ -1,6 +1,8 @@
 #include "Utils.h"
 #include "Message.h"
 
+using namespace FM;
+
 std::vector<double> SolveCubic(double a, double b, double c)
 {
   std::vector<double> root;
diff --git a/contrib/FourierModel/Utils.h b/contrib/FourierModel/Utils.h
index 51c1191341..a33fe45c1f 100755
--- a/contrib/FourierModel/Utils.h
+++ b/contrib/FourierModel/Utils.h
@@ -8,9 +8,6 @@
 
 std::vector<double> SolveCubic(double a, double b, double c);
 std::vector<double> SolveCubic(double a, double b, double c, double d);
-void  find(std::vector<int> &a, int length, std::vector<int> &q, int &num);
-int minVec(std::vector<int> &a,int n);
-int maxVec(std::vector<int> &a,int n);
 std::vector<std::vector<int> > ones(int row, int col);
 void plotSceneViewer(int app, char* bffer, std::vector<int>& color,
                       std::vector<std::vector<double> > &x,
-- 
GitLab