From abf76c82e550b76cd6fb2efcb2d4366c59af9473 Mon Sep 17 00:00:00 2001
From: Jean-Francois Remacle <jean-francois.remacle@uclouvain.be>
Date: Thu, 23 Nov 2006 16:23:13 +0000
Subject: [PATCH] more opencc stuff (more surface and curve types are
 recognized by gmsh)

---
 Geo/GEntity.h        |  2 ++
 Geo/OCCFace.cpp      | 13 +++++++++----
 Geo/OCCVertex.cpp    | 14 +++++++-------
 Mesh/meshGFace.cpp   |  4 ++--
 Mesh/meshGRegion.cpp |  2 +-
 5 files changed, 21 insertions(+), 14 deletions(-)

diff --git a/Geo/GEntity.h b/Geo/GEntity.h
index 93a19d0865..7781c1ac6e 100644
--- a/Geo/GEntity.h
+++ b/Geo/GEntity.h
@@ -80,6 +80,7 @@ class GEntity {
     Torus,
     RuledSurface,
     ParametricSurface,
+    BSplineSurface,
     DiscreteSurface,
     Volume,
     DiscreteVolume
@@ -106,6 +107,7 @@ class GEntity {
       "Torus",
       "Ruled surface",
       "Parametric surface",
+      "BSpline surface",
       "Discrete surface",
       "Volume",
       "Discrete volume"
diff --git a/Geo/OCCFace.cpp b/Geo/OCCFace.cpp
index 5cb54f105f..7ad9753b4d 100644
--- a/Geo/OCCFace.cpp
+++ b/Geo/OCCFace.cpp
@@ -1,4 +1,4 @@
-// $Id: OCCFace.cpp,v 1.11 2006-11-22 13:57:25 remacle Exp $
+// $Id: OCCFace.cpp,v 1.12 2006-11-23 16:23:13 remacle Exp $
 //
 // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle
 //
@@ -30,6 +30,8 @@
 #if defined(HAVE_OCC)
 #include "Geom_CylindricalSurface.hxx"
 #include "Geom_ConicalSurface.hxx"
+#include "Geom_BSplineSurface.hxx"
+#include "Geom_SphericalSurface.hxx"
 #include "Geom_Plane.hxx"
 #include "gp_Pln.hxx"
 
@@ -176,8 +178,10 @@ GEntity::GeomType OCCFace::geomType() const
     return Cylinder;
   else if (occface->DynamicType() == STANDARD_TYPE(Geom_ConicalSurface))
     return Cone;
-//   else if (occface->DynamicType() == STANDARD_TYPE(Geom_ConicalSurface))
-//     return Cone;
+   else if (occface->DynamicType() == STANDARD_TYPE(Geom_SphericalSurface))
+     return Sphere;
+   else if (occface->DynamicType() == STANDARD_TYPE(Geom_BSplineSurface))
+     return BSplineSurface;
   return Unknown;
 }
 
@@ -190,7 +194,8 @@ double OCCFace::curvature (const SPoint2 &param) const
 
   if (!prop.IsCurvatureDefined())
     {
-      return GFace::curvature (param);
+      Msg(GERROR,"Curvature not defined for face %d",tag());
+      return -1;
     }
   return std::max(fabs(prop.MinCurvature()), fabs(prop.MaxCurvature()));
 }
diff --git a/Geo/OCCVertex.cpp b/Geo/OCCVertex.cpp
index 8a0f100467..d5ec0f4f5f 100644
--- a/Geo/OCCVertex.cpp
+++ b/Geo/OCCVertex.cpp
@@ -1,4 +1,4 @@
-// $Id: OCCVertex.cpp,v 1.6 2006-11-22 13:57:25 remacle Exp $
+// $Id: OCCVertex.cpp,v 1.7 2006-11-23 16:23:13 remacle Exp $
 //
 // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle
 //
@@ -30,12 +30,12 @@ double max_surf_curvature ( const GVertex *gv, double x, double y, double z , co
 {
   std::list<GFace *> faces = _myGEdge->faces();
   std::list<GFace *>::iterator it =  faces.begin();
-  double curv = 0;
+  double curv = 1.e-22;
   while (it != faces.end())
     {
       SPoint2 par = gv->reparamOnFace((*it),1);
       double cc = (*it)->curvature ( par );
-      if (cc < 1.e2)curv = std::max(curv, cc );					      
+      if (cc > 0)curv = std::max(curv, cc );					      
       ++it;
     }  
   return curv;
@@ -99,10 +99,10 @@ SPoint2 OCCVertex::reparamOnFace ( GFace *gf , int dir) const
 double OCCVertex::prescribedMeshSizeAtVertex() const { 
   SBoundingBox3d b = model()->bounds();
   double lc     = 0.1 * norm( SVector3 ( b.max() , b.min() ) ) * CTX.mesh.lc_factor;
-  //  double lc_min = 0.004 * norm(SVector3 ( b.max() , b.min() ) ) * CTX.mesh.lc_factor;
-  //  double maxc = max_curvature_of_surfaces();
-  //  if (maxc !=0)       
-  //    lc = std::max(lc_min,std::min (lc,6.28/(CTX.mesh.min_circ_points*maxc)));
+  double lc_min = 0.004 * norm(SVector3 ( b.max() , b.min() ) ) * CTX.mesh.lc_factor;
+  double maxc = max_curvature_of_surfaces();
+  if (maxc !=0)       
+    lc = std::max(lc_min,std::min (lc,6.28/(CTX.mesh.min_circ_points*maxc)));
   return lc;
 }
 
diff --git a/Mesh/meshGFace.cpp b/Mesh/meshGFace.cpp
index 29d52a2122..b6f013e329 100644
--- a/Mesh/meshGFace.cpp
+++ b/Mesh/meshGFace.cpp
@@ -1,4 +1,4 @@
-// $Id: meshGFace.cpp,v 1.22 2006-11-22 13:57:25 remacle Exp $
+// $Id: meshGFace.cpp,v 1.23 2006-11-23 16:23:13 remacle Exp $
 //
 // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle
 //
@@ -1536,7 +1536,7 @@ void meshGFace :: operator() (GFace *gf)
   if(gf->geomType() == GEntity::DiscreteSurface) return;
 
   // Send a messsage to the GMSH environment
-  Msg(STATUS2, "Meshing surface %d", gf->tag());
+  Msg(STATUS2, "Meshing surface %d (%s)", gf->tag(),gf->getTypeString().c_str());
 
   // TEST TEST 
   //  if (gf->surfPeriodic(2)) return;
diff --git a/Mesh/meshGRegion.cpp b/Mesh/meshGRegion.cpp
index f882267aba..a3cdb468d3 100644
--- a/Mesh/meshGRegion.cpp
+++ b/Mesh/meshGRegion.cpp
@@ -442,7 +442,7 @@ void meshGRegion :: operator() (GRegion *gr)
   // Send a messsage to the GMSH environment
   Msg(STATUS2, "Meshing volume %d", gr->tag());
 
-  if(CTX.mesh.algo3d == DELAUNAY_TETGEN)
+  if(CTX.mesh.algo3d == DELAUNAY_TETGEN || CTX.mesh.algo3d == DELAUNAY_ISO)
     {
 #if !defined(HAVE_TETGEN)
     Msg(GERROR, "Tetgen is not compiled in this version of Gmsh");
-- 
GitLab