From af50a1c60d392511783f8e3f2ee5034f81ceb234 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jean-Fran=C3=A7ois=20Remacle=20=28students=29?=
 <jean-francois.remacle@uclouvain.be>
Date: Tue, 26 May 2009 15:25:30 +0000
Subject: [PATCH] *** empty log message ***

---
 Geo/GRegionCompound.cpp | 84 +++++++++++++++++++++++++++++++++++++++++
 Geo/GRegionCompound.h   | 44 +++++++++++++++++++++
 2 files changed, 128 insertions(+)
 create mode 100644 Geo/GRegionCompound.cpp
 create mode 100644 Geo/GRegionCompound.h

diff --git a/Geo/GRegionCompound.cpp b/Geo/GRegionCompound.cpp
new file mode 100644
index 0000000000..607e6c3828
--- /dev/null
+++ b/Geo/GRegionCompound.cpp
@@ -0,0 +1,84 @@
+// Gmsh - Copyright (C) 1997-2009 C. Geuzaine, J.-F. Remacle
+//
+// See the LICENSE.txt file for license information. Please report all
+// bugs and problems to <gmsh@geuz.org>.
+//
+// Contributor(s):
+//   Emilie Marchandise
+//
+
+#include <stdlib.h>
+#include "GmshConfig.h"
+#include "GRegionCompound.h"
+#include "Numeric.h"
+
+GRegionCompound::GRegionCompound(GModel *m, int tag, std::vector<GRegion*> &compound)
+  : GRegion(m, tag),  _compound(compound)
+{
+  printf("********* In GRegion compound size =%d  \n", _compound.size());
+  getBoundingFaces();
+}
+
+GRegionCompound::~GRegionCompound()
+{
+}
+
+void GRegionCompound::getBoundingFaces(){
+
+  std::set<GFace*> _unique;
+  std::multiset<GFace*> _touched;
+  std::vector<GRegion*>::iterator it = _compound.begin();
+  for ( ; it != _compound.end(); ++it){
+    printf("face %d \n", (*it)->tag());
+    std::list<GFace*> ed = (*it)->faces();
+   std::list<GFace*> :: iterator ite = ed.begin();
+    for ( ; ite != ed.end(); ++ite){
+     _touched.insert(*ite);
+    }    
+  }    
+  it = _compound.begin();
+  for ( ; it != _compound.end(); ++it){
+    std::list<GFace*> ed = (*it)->faces();
+    std::list<GFace*> :: iterator ite = ed.begin();
+    for ( ; ite != ed.end() ; ++ite){
+      if (!(*ite)->degenerate(0) && _touched.count(*ite) == 1) {	
+	_unique.insert(*ite);      }
+    }    
+  }    
+
+  std::set<GFace*>::iterator itf = _unique.begin();
+  for ( ; itf != _unique.end(); ++itf){
+    l_faces.push_back(*itf);
+    printf("for face %d, add region %d \n", (*itf)->tag(), this->tag());
+    (*itf)->addRegion(this);
+  }
+
+}
+
+
+SBoundingBox3d  GRegionCompound::bounds() const { 
+  Msg::Error("Cannot evaluate bounds on GRegion Compound");
+  return SBoundingBox3d(SPoint3()); 
+}
+
+double GRegionCompound::curvature(double par) const
+{
+
+  double k = 0.0;
+  Msg::Error("Cannot evaluate curvature on GRegionCompound");
+  return k;
+}
+
+GPoint GRegionCompound::point(double par) const
+{
+
+  Msg::Error("Cannot evaluate point on GRegionCompound");
+  return GPoint();
+}
+
+SVector3 GRegionCompound::firstDer(double par) const
+{
+
+  Msg::Error("Cannot evaluate firstDeriv on GRegionCompound");
+  return SVector3();
+} 
diff --git a/Geo/GRegionCompound.h b/Geo/GRegionCompound.h
new file mode 100644
index 0000000000..13ae88ffc3
--- /dev/null
+++ b/Geo/GRegionCompound.h
@@ -0,0 +1,44 @@
+// Gmsh - Copyright (C) 1997-2009 C. Geuzaine, J.-F. Remacle
+//
+// See the LICENSE.txt file for license information. Please report all
+// bugs and problems to <gmsh@geuz.org>.
+
+#ifndef _GREGION_COMPOUND_H_
+#define _GREGION_COMPOUND_H_
+
+#include <list>
+#include <map>
+#include "GRegion.h"
+#include "GFace.h"
+#include "GFaceCompound.h"
+
+/*
+A GRegionCompound is a model region that is the compound of model regions.
+
+It is assumed that all the regions of the compound have been meshed
+first and that all the faces of the compound region are compound surfaces.
+
+The compound can therefore be re-meshed using any surface mesh
+generator of gmsh!
+*/
+
+class GRegionCompound : public GRegion {
+ public:
+  GRegionCompound(GModel *m, int tag, std::vector<GRegion*> &compound);
+  virtual ~GRegionCompound();
+  virtual SBoundingBox3d bounds() const;
+  virtual double curvature(double t) const;
+  virtual GPoint point(double par) const; 
+  virtual SVector3 firstDer(double par) const; 
+  virtual GEntity::GeomType geomType() const { return CompoundVolume; }
+  ModelType getNativeType() const { return GmshModel; }
+  void * getNativePtr() const { return 0; }
+
+ protected:
+ std::vector<GRegion*> _compound;
+void getBoundingFaces();
+
+};
+
+#endif
+
-- 
GitLab