From cd3de8c12e786f2d78fc61b419bf964445c2e21e Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Tue, 23 Aug 2011 12:06:24 +0000
Subject: [PATCH] fix minimal compile

---
 Geo/GFaceCompound.cpp               | 30 ----------------------------
 Mesh/meshGFaceDelaunayInsertion.cpp |  4 ----
 Mesh/meshGFaceOptimize.cpp          | 11 +++++++---
 Numeric/Numeric.cpp                 | 31 +++++++++++++++++++++++++++++
 Numeric/Numeric.h                   |  5 +++++
 5 files changed, 44 insertions(+), 37 deletions(-)

diff --git a/Geo/GFaceCompound.cpp b/Geo/GFaceCompound.cpp
index 8922a80eda..fc00182526 100644
--- a/Geo/GFaceCompound.cpp
+++ b/Geo/GFaceCompound.cpp
@@ -53,36 +53,6 @@ static void fixEdgeToValue(GEdge *ed, double value, dofManager<double> &myAssemb
   }
 }
 
-int intersection_segments (SPoint3 &p1, SPoint3 &p2,
-			   SPoint3 &q1, SPoint3 &q2, 
-			   double x[2])
-{
-  double xp_max = std::max(p1.x(),p2.x()); 
-  double yp_max = std::max(p1.y(),p2.y()); 
-  double xq_max = std::max(q1.x(),q2.x()); 
-  double yq_max = std::max(q1.y(),q2.y()); 
-
-  double xp_min = std::min(p1.x(),p2.x()); 
-  double yp_min = std::min(p1.y(),p2.y()); 
-  double xq_min = std::min(q1.x(),q2.x()); 
-  double yq_min = std::min(q1.y(),q2.y()); 
-  if (yq_min > yp_max || xq_min >  xp_max ||
-      yq_max < yp_min || xq_max <  xp_min){
-    return 0;
-  }
-  else{
-    double A[2][2];
-    A[0][0] = p2.x()-p1.x();
-    A[0][1] = q1.x()-q2.x();
-    A[1][0] = p2.y()-p1.y();
-    A[1][1] = q1.y()-q2.y();
-    double b[2] = {q1.x()-p1.x(),q1.y()-p1.y()};
-    sys2x2(A,b,x);
-
-    return (x[0] >= 0.0 && x[0] <= 1. &&
-	    x[1] >= 0.0 && x[1] <= 1.);
-  }
-}
 static void printBound(std::vector<MVertex*> &l, int tag){
   //print boundary
   char name[256];
diff --git a/Mesh/meshGFaceDelaunayInsertion.cpp b/Mesh/meshGFaceDelaunayInsertion.cpp
index 724deb291f..4b8c37725f 100644
--- a/Mesh/meshGFaceDelaunayInsertion.cpp
+++ b/Mesh/meshGFaceDelaunayInsertion.cpp
@@ -655,10 +655,6 @@ void _printTris(char *name, std::set<MTri3*, compareTri3Ptr> &AllTris,
   fclose (ff);
 }
 
-int intersection_segments (SPoint3 &p1, SPoint3 &p2,
-			   SPoint3 &q1, SPoint3 &q2, 
-			   double x[2]);
-
 static MTri3* search4Triangle (MTri3 *t, double pt[2], 
 			       std::vector<double> &Us, std::vector<double> &Vs,
 			       std::set<MTri3*,compareTri3Ptr> &AllTris) {
diff --git a/Mesh/meshGFaceOptimize.cpp b/Mesh/meshGFaceOptimize.cpp
index 2d5e97f62e..e1c4131aaa 100644
--- a/Mesh/meshGFaceOptimize.cpp
+++ b/Mesh/meshGFaceOptimize.cpp
@@ -20,12 +20,15 @@
 #include "Generator.h"
 #include "Context.h"
 #include "OS.h"
-#include "PView.h"
-#include "PViewData.h"
 #include "SVector3.h"
 #include "SPoint3.h"
 
-#ifdef HAVE_MATCH
+#if defined(HAVE_POST)
+#include "PView.h"
+#include "PViewData.h"
+#endif
+
+#if defined(HAVE_MATCH)
 extern "C" int FAILED_NODE;
 extern "C" struct CCdatagroup;
 extern "C" int perfect_match
@@ -2290,6 +2293,7 @@ double Temporary::compute_alignment(const MEdge&_edge, MElement*element1, MEleme
 
 void Temporary::read_data(std::string file_name)
 {
+#if defined(HAVE_POST)
   int i,j,number;
   double x,y,z;
   MElement*element;
@@ -2312,6 +2316,7 @@ void Temporary::read_data(std::string file_name)
 	  gradients[number] = SVector3(x,y,z);
 	}
   }
+#endif
 }
 
 void Temporary::quadrilaterize(std::string file_name,double _w1,double _w2,double _w3)
diff --git a/Numeric/Numeric.cpp b/Numeric/Numeric.cpp
index 569c6661a6..fc48c43e8c 100644
--- a/Numeric/Numeric.cpp
+++ b/Numeric/Numeric.cpp
@@ -1166,3 +1166,34 @@ void signedDistancesPointsEllipseLine(std::vector<double>&distances,
     }
   }
 }
+
+int intersection_segments (SPoint3 &p1, SPoint3 &p2,
+			   SPoint3 &q1, SPoint3 &q2, 
+			   double x[2])
+{
+  double xp_max = std::max(p1.x(),p2.x()); 
+  double yp_max = std::max(p1.y(),p2.y()); 
+  double xq_max = std::max(q1.x(),q2.x()); 
+  double yq_max = std::max(q1.y(),q2.y()); 
+
+  double xp_min = std::min(p1.x(),p2.x()); 
+  double yp_min = std::min(p1.y(),p2.y()); 
+  double xq_min = std::min(q1.x(),q2.x()); 
+  double yq_min = std::min(q1.y(),q2.y()); 
+  if (yq_min > yp_max || xq_min >  xp_max ||
+      yq_max < yp_min || xq_max <  xp_min){
+    return 0;
+  }
+  else{
+    double A[2][2];
+    A[0][0] = p2.x()-p1.x();
+    A[0][1] = q1.x()-q2.x();
+    A[1][0] = p2.y()-p1.y();
+    A[1][1] = q1.y()-q2.y();
+    double b[2] = {q1.x()-p1.x(),q1.y()-p1.y()};
+    sys2x2(A,b,x);
+
+    return (x[0] >= 0.0 && x[0] <= 1. &&
+	    x[1] >= 0.0 && x[1] <= 1.);
+  }
+}
diff --git a/Numeric/Numeric.h b/Numeric/Numeric.h
index b921e32754..d946666d8b 100644
--- a/Numeric/Numeric.h
+++ b/Numeric/Numeric.h
@@ -110,4 +110,9 @@ void signedDistancesPointsEllipseLine (std::vector<double>&distances,
                                        std::vector<SPoint3>&closePts,
                                        const std::vector<SPoint3> &pts,
                                        const SPoint3 &p1, const SPoint3 &p2);
+
+int intersection_segments (SPoint3 &p1, SPoint3 &p2,
+			   SPoint3 &q1, SPoint3 &q2, 
+			   double x[2]);
+
 #endif
-- 
GitLab