From cb6ecc8001936ddd49857881830dd1954b80e857 Mon Sep 17 00:00:00 2001
From: Jean-Francois Remacle <jean-francois.remacle@uclouvain.be>
Date: Wed, 15 Nov 2006 14:35:03 +0000
Subject: [PATCH] more occ devt.

---
 Geo/GModelIO_OCC.cpp | 11 ++++++++++-
 Geo/Makefile         | 11 ++++++-----
 Geo/OCCEdge.h        |  1 +
 Geo/OCCFace.cpp      | 13 ++++++++++++-
 Geo/OCCFace.h        |  3 ++-
 Geo/OCCVertex.h      |  1 +
 6 files changed, 32 insertions(+), 8 deletions(-)

diff --git a/Geo/GModelIO_OCC.cpp b/Geo/GModelIO_OCC.cpp
index d91df015ce..32055b81cf 100644
--- a/Geo/GModelIO_OCC.cpp
+++ b/Geo/GModelIO_OCC.cpp
@@ -1,4 +1,4 @@
-  // $Id: GModelIO_OCC.cpp,v 1.1 2006-11-15 13:19:56 geuzaine Exp $
+  // $Id: GModelIO_OCC.cpp,v 1.2 2006-11-15 14:35:03 remacle Exp $
 //
 // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle
 //
@@ -26,6 +26,7 @@
 #include "OCCVertex.h"
 #include "OCCEdge.h"
 #include "OCCFace.h"
+#include "OCCRegion.h"
 
 class OCC_Internals
 {
@@ -313,6 +314,14 @@ void OCC_Internals :: buildGModel (GModel *model)
       OCCFace *f = new OCCFace (model, face, i, emap);
       model->add(f);
     }
+  // building geom regions
+  int nvolumes = somap.Extent();
+  for (int i = 1; i <= nvolumes; i++)
+    {
+      TopoDS_Solid solid = TopoDS::Solid(somap(i));
+      OCCRegion *r = new OCCRegion (model, solid, i, fmap);
+      model->add(r);
+    }
 
 }
 
diff --git a/Geo/Makefile b/Geo/Makefile
index 5a50b492f7..145032d249 100644
--- a/Geo/Makefile
+++ b/Geo/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.107 2006-11-15 13:19:56 geuzaine Exp $
+# $Id: Makefile,v 1.108 2006-11-15 14:35:03 remacle Exp $
 #
 # Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle
 #
@@ -38,15 +38,16 @@ SRC = CAD.cpp \
       MVertex.cpp \
       MElement.cpp \
       GModel.cpp\
-        GModelIO_Mesh.cpp\
-        GModelIO_Geo.cpp\
-        GModelIO_Fourier.cpp\
-        GModelIO_OCC.cpp\
+      GModelIO_Mesh.cpp\
+      GModelIO_Geo.cpp\
+      GModelIO_Fourier.cpp\
+      GModelIO_OCC.cpp\
       gmshEdge.cpp\
       gmshFace.cpp\
       gmshRegion.cpp\
       OCCEdge.cpp\
       OCCFace.cpp\
+      OCCRegion.cpp\
       SVector3.cpp\
       SBoundingBox3d.cpp\
       projectionFace.cpp\
diff --git a/Geo/OCCEdge.h b/Geo/OCCEdge.h
index 8d9e5245dd..31c89d2113 100644
--- a/Geo/OCCEdge.h
+++ b/Geo/OCCEdge.h
@@ -46,6 +46,7 @@ class OCCEdge : public GEdge {
   virtual int containsParam(double pt) const;
   virtual SVector3 firstDer(double par) const;
   virtual SPoint2 reparamOnFace(GFace * face, double epar, int dir) const { throw; }
+  ModelType getNativeType() const { return OpenCascadeModel; }
   void * getNativePtr() const { return (void*) &c; }
   virtual double parFromPoint(const SPoint3 &pt) const;
   virtual int minimumMeshSegments () const;
diff --git a/Geo/OCCFace.cpp b/Geo/OCCFace.cpp
index fee6ed52ff..3fd9dbe05b 100644
--- a/Geo/OCCFace.cpp
+++ b/Geo/OCCFace.cpp
@@ -1,4 +1,4 @@
-// $Id: OCCFace.cpp,v 1.2 2006-11-14 20:20:18 remacle Exp $
+// $Id: OCCFace.cpp,v 1.3 2006-11-15 14:35:03 remacle Exp $
 //
 // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle
 //
@@ -195,4 +195,15 @@ int OCCFace::containsPoint(const SPoint3 &pt) const
 { 
   Msg(GERROR,"Not Done Yet ...");
 }
+// void OCCFace::buildVisTriangulation ();
+// {
+//   TopLoc_Location loc;
+//   Handle(Poly_Triangulation) triangulation = BRep_Tool::Triangulation (occface, loc);
+//   int ntriangles = triangulation -> NbTriangles();
+//   for (int j = 1; j <= ntriangles; j++)
+//     {
+//       Poly_Triangle triangle = (triangulation -> Triangles())(j);
+//     }  
+// }
+
 #endif
diff --git a/Geo/OCCFace.h b/Geo/OCCFace.h
index 7f476cde4d..23a2153f8d 100644
--- a/Geo/OCCFace.h
+++ b/Geo/OCCFace.h
@@ -31,7 +31,7 @@ class OCCFace : public GFace {
   TopoDS_Face s;
   Handle(Geom_Surface) occface;
   double umin, umax, vmin, vmax;
-
+  void buildVisTriangulation ();
  public:
   OCCFace(GModel *m, TopoDS_Face s, int num, TopTools_IndexedMapOfShape &emap);
 
@@ -58,6 +58,7 @@ class OCCFace : public GFace {
   virtual bool periodic(int dim) const { return false; }
   virtual bool degenerate(int dim) const { return false; }
   virtual double period(int dir) const {throw;}
+  ModelType getNativeType() const { return OpenCascadeModel; }
   void * getNativePtr() const { return (void*)&s; }
   virtual bool surfPeriodic(int dim) const {throw;}
   virtual SPoint2 parFromPoint(const SPoint3 &) const;
diff --git a/Geo/OCCVertex.h b/Geo/OCCVertex.h
index 3b74e43a5c..699284b2d1 100644
--- a/Geo/OCCVertex.h
+++ b/Geo/OCCVertex.h
@@ -56,6 +56,7 @@ class OCCVertex : public GVertex {
     gp_Pnt pnt = BRep_Tool::Pnt (v);
     return pnt.Z();
   }
+  ModelType getNativeType() const { return OpenCascadeModel; }
   void * getNativePtr() const { return (void*) &v; }
   virtual double prescribedMeshSizeAtVertex() const { 
     SBoundingBox3d b = model()->bounds();
-- 
GitLab