From 19245f3f9a47829a20ab6011fbb4ba782c9e86e1 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Wed, 2 Mar 2011 16:43:36 +0000
Subject: [PATCH] remove embryo of new boundary layer entities:

* the old code has been generalized to deal with these cases
* the new "in entity" boundary layer method(s) will not create a topology of
  "boundary layer entities" anymore, so this is superfluous
---
 Geo/GModel.cpp                  | 51 --------------------------
 Geo/boundaryLayerEdge.h         | 27 --------------
 Geo/boundaryLayerFace.h         | 33 -----------------
 Geo/boundaryLayerVertex.h       | 29 ---------------
 Mesh/CMakeLists.txt             |  2 +-
 Mesh/meshGFace.cpp              |  1 -
 Mesh/meshGFace.h                |  1 -
 Mesh/meshGFaceBoundaryLayer.cpp | 65 ---------------------------------
 doc/gmsh.html                   |  2 +-
 9 files changed, 2 insertions(+), 209 deletions(-)
 delete mode 100644 Geo/boundaryLayerEdge.h
 delete mode 100644 Geo/boundaryLayerFace.h
 delete mode 100644 Geo/boundaryLayerVertex.h
 delete mode 100644 Mesh/meshGFaceBoundaryLayer.cpp

diff --git a/Geo/GModel.cpp b/Geo/GModel.cpp
index 7a26edd833..150f413f51 100644
--- a/Geo/GModel.cpp
+++ b/Geo/GModel.cpp
@@ -23,9 +23,6 @@
 #include "discreteFace.h"
 #include "discreteEdge.h"
 #include "discreteVertex.h"
-#include "boundaryLayerFace.h"
-#include "boundaryLayerEdge.h"
-#include "boundaryLayerVertex.h"
 #include "gmshSurface.h"
 #include "Geo.h"
 #include "SmoothData.h"
@@ -1867,49 +1864,6 @@ GEntity *GModel::extrude(GEntity *e, std::vector<double> p1, std::vector<double>
   return 0;
 }
 
-void GModel::createBoundaryLayer(std::vector<GEntity *> e, double h)
-{
-#if defined(HAVE_MESH)
-  // FIXME remove this!
-  Field *f = _fields->newField(0, "MathEval");
-  char s[128];
-  sprintf(s, "%g", h);
-  f->options["F"]->string() = s;
-
-  GModel *gm = this;
-  for(unsigned int i = 0; i < e.size(); i++){
-    if(e[i]->dim() == 1){
-      GEdge *ge = static_cast<GEdge*>(e[i]);
-      GVertex *beg = ge->getBeginVertex();
-      GVertex *end = ge->getEndVertex();
-      GVertex *v0 = new boundaryLayerVertex(gm, gm->getMaxElementaryNumber(0) + 1, beg);
-      gm->add(v0);
-      GVertex *v1 = new boundaryLayerVertex(gm, gm->getMaxElementaryNumber(0) + 1, end);
-      gm->add(v1);
-      GEdge *e0 = new boundaryLayerEdge(gm, gm->getMaxElementaryNumber(1) + 1, v0, v1, ge);
-      gm->add(e0);
-      GEdge *e1 = new boundaryLayerEdge(gm, gm->getMaxElementaryNumber(1) + 1, beg, v0, beg);
-      gm->add(e1);
-      GEdge *e2 = new boundaryLayerEdge(gm, gm->getMaxElementaryNumber(1) + 1, end, v1, end);
-      gm->add(e2);
-      boundaryLayerFace *f0 = new boundaryLayerFace(gm, gm->getMaxElementaryNumber(2) + 1, e, f, ge);
-      std::vector<int> boundEdges;
-      boundEdges.push_back(ge->tag());
-      boundEdges.push_back(e0->tag());
-      boundEdges.push_back(e1->tag());
-      boundEdges.push_back(e2->tag());
-      f0->setBoundEdges(boundEdges);
-      gm->add(f0);
-    }
-    else{
-      Msg::Error("FIXME: GModel boundary layer creation only for edges for now");
-    }
-  }
-
-  glue(CTX::instance()->geom.tolerance);
-#endif
-}
-
 GEntity *GModel::addPipe(GEntity *e, std::vector<GEdge *>  edges)
 {
   if(_factory) 
@@ -2715,11 +2669,6 @@ void GModel::registerBindings(binding *b)
   cm->setDescription(" use an angle threshold to tag edges.");
   cm->setArgNames("angle",NULL);
 
-  cm = cb->addMethod("createBoundaryLayer", &GModel::createBoundaryLayer);
-  cm->setDescription("create a boundary layer using a given field for the "
-                     "extrusion height.");
-  cm->setArgNames("{list of entities}","height",NULL);
-
   cm = cb->addMethod("createPartitionBoundaries", &GModel::createPartitionBoundaries);
   cm->setDescription("Assigns partition tags to boundary elements. Should be called "
                      "only after the partitions have been assigned");
diff --git a/Geo/boundaryLayerEdge.h b/Geo/boundaryLayerEdge.h
deleted file mode 100644
index 6c1a42064e..0000000000
--- a/Geo/boundaryLayerEdge.h
+++ /dev/null
@@ -1,27 +0,0 @@
-// Gmsh - Copyright (C) 1997-2010 C. Geuzaine, J.-F. Remacle
-//
-// See the LICENSE.txt file for license information. Please report all
-// bugs and problems to <gmsh@geuz.org>.
-
-#ifndef _BOUNDARY_LAYER_EDGE_H_
-#define _BOUNDARY_LAYER_EDGE_H_
-
-#include "discreteEdge.h"
-
-class Field;
-
-class boundaryLayerEdge : public discreteEdge {
- private:
-  // original entity from which this part of the boundary layer is
-  // extruded
-  GEntity *_orig;
- public:
-  boundaryLayerEdge(GModel *model, int num, GVertex *_v0, GVertex *_v1, 
-                    GEntity *orig) 
-    : discreteEdge(model, num, _v0, _v1), _orig(orig)  {}
-  virtual ~boundaryLayerEdge() {}
-  virtual GeomType geomType() const { return BoundaryLayerCurve; }
-  GEntity *getOriginalEntity(){ return _orig; }
-};
-
-#endif
diff --git a/Geo/boundaryLayerFace.h b/Geo/boundaryLayerFace.h
deleted file mode 100644
index 32ddd71e09..0000000000
--- a/Geo/boundaryLayerFace.h
+++ /dev/null
@@ -1,33 +0,0 @@
-// Gmsh - Copyright (C) 1997-2010 C. Geuzaine, J.-F. Remacle
-//
-// See the LICENSE.txt file for license information. Please report all
-// bugs and problems to <gmsh@geuz.org>.
-
-#ifndef _BOUNDARY_LAYER_FACE_H_
-#define _BOUNDARY_LAYER_FACE_H_
-
-#include "discreteFace.h"
-
-class Field;
-
-class boundaryLayerFace : public discreteFace {
- private:
-  // list of entities from which the whole boundary layer is created
-  std::vector<GEntity*> _source;
-  // field providing extrude information
-  Field *_field;
-  // original entity from which this part of the boundary layer is
-  // extruded
-  GEntity *_orig;
- public:
-  boundaryLayerFace(GModel *model, int num, std::vector<GEntity*> source, 
-                    Field *field, GEntity *orig) 
-    : discreteFace(model, num), _source(source), _field(field), _orig(orig){}
-  virtual ~boundaryLayerFace() {}
-  GEntity::GeomType geomType() const { return BoundaryLayerSurface; }
-  std::vector<GEntity*> &getSourceEntities(){ return _source; }
-  Field * getField(){ return _field; }
-  GEntity *getSourceEntity(){ return _orig; }
-};
-
-#endif
diff --git a/Geo/boundaryLayerVertex.h b/Geo/boundaryLayerVertex.h
deleted file mode 100644
index 892ba3611f..0000000000
--- a/Geo/boundaryLayerVertex.h
+++ /dev/null
@@ -1,29 +0,0 @@
-// Gmsh - Copyright (C) 1997-2010 C. Geuzaine, J.-F. Remacle
-//
-// See the LICENSE.txt file for license information. Please report all
-// bugs and problems to <gmsh@geuz.org>.
-
-#ifndef _BOUNDARY_LAYER_VERTEX_H_
-#define _BOUNDARY_LAYER_VERTEX_H_
-
-#include "discreteVertex.h"
-
-class boundaryLayerVertex : public discreteVertex {
- private:
-  // original entity from which this part of the boundary layer is
-  // extruded
-  GVertex *_orig;
- public:
-  boundaryLayerVertex(GModel *m, int num, GVertex *orig) 
-    : discreteVertex(m, num), _orig(orig)
-  {
-    // don't wait for Mesh0D to create the mesh vertex, as it is used
-    // to remove duplicates during model creation (before any mesh
-    // generation is performed)
-    mesh_vertices.push_back(new MVertex(orig->x(), orig->y(), orig->z(), this));
-  }
-  virtual ~boundaryLayerVertex(){}
-  virtual GeomType geomType() const { return BoundaryLayerPoint; }
-};
-
-#endif
diff --git a/Mesh/CMakeLists.txt b/Mesh/CMakeLists.txt
index 7d2e4a57b2..9c1fe2771b 100644
--- a/Mesh/CMakeLists.txt
+++ b/Mesh/CMakeLists.txt
@@ -12,7 +12,7 @@ set(SRC
       meshGFaceTransfinite.cpp meshGFaceExtruded.cpp 
       meshGFaceBamg.cpp meshGFaceBDS.cpp meshGFaceDelaunayInsertion.cpp 
       meshGFaceLloyd.cpp meshGFaceOptimize.cpp 
-      meshGFaceQuadrilateralize.cpp meshGFaceBoundaryLayer.cpp 
+      meshGFaceQuadrilateralize.cpp
     meshGRegion.cpp 
       meshGRegionDelaunayInsertion.cpp meshGRegionTransfinite.cpp 
       meshGRegionExtruded.cpp  meshGRegionCarveHole.cpp 
diff --git a/Mesh/meshGFace.cpp b/Mesh/meshGFace.cpp
index c13e515fe9..f4226d1ab0 100644
--- a/Mesh/meshGFace.cpp
+++ b/Mesh/meshGFace.cpp
@@ -1525,7 +1525,6 @@ void meshGFace::operator() (GFace *gf)
   deMeshGFace dem;
   dem(gf);
 
-  if(MeshBoundaryLayerSurface(gf)) return;
   if(MeshTransfiniteSurface(gf)) return;
   if(MeshExtrudedSurface(gf)) return;
   if(gf->meshMaster() != gf->tag()){
diff --git a/Mesh/meshGFace.h b/Mesh/meshGFace.h
index 09158465c3..3ea931e09a 100644
--- a/Mesh/meshGFace.h
+++ b/Mesh/meshGFace.h
@@ -45,7 +45,6 @@ void findTransfiniteCorners(GFace *gf, std::vector<MVertex*> &corners);
 int MeshTransfiniteSurface(GFace *gf);
 int MeshExtrudedSurface(GFace *gf, std::set<std::pair<MVertex*, MVertex*> > 
                         *constrainedEdges=0);
-int MeshBoundaryLayerSurface(GFace *gf);
 void partitionAndRemesh(GFaceCompound *gf);
 bool checkMeshCompound(GFaceCompound *gf, std::list<GEdge*> &edges);
 
diff --git a/Mesh/meshGFaceBoundaryLayer.cpp b/Mesh/meshGFaceBoundaryLayer.cpp
deleted file mode 100644
index 1c3f1af6e7..0000000000
--- a/Mesh/meshGFaceBoundaryLayer.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-// Gmsh - Copyright (C) 1997-2010 C. Geuzaine, J.-F. Remacle
-//
-// See the LICENSE.txt file for license information. Please report all
-// bugs and problems to <gmsh@geuz.org>.
-
-#include <set>
-#include "GModel.h"
-#include "boundaryLayerEdge.h"
-#include "boundaryLayerFace.h"
-
-// utiliser bl.lua comme cas test
-//
-// creer une fonction meshAllBoundaryLayerFaces(GModel *)
-//   et l'appeler dans Mesh/Generator.cpp/Mesh2D()
-//
-// cette fonction 
-//
-//   - utiliserait le maillage 1D de toutes les lignes source des
-//     boundaryLayerFaces (cf boundaryLayerFace.h) pour
-//     creer les points de la couche limite
-//     (categoriser les points sur chaque boundaryLayerFace?)
-//
-//   - "simplifierait" le nuage de point cree en enlevant les points
-//     trop proches? (cf. Geo/MVertexPositionSet)
-//
-//   - utiliser DocRecord pour trianguler les points (cf. Plugin/Triangulate.cpp)
-//
-//   - modifier la triangul sur le bord de la couche limite pour
-//     verifier les contraintes de Blossom
-// 
-//   - appliquer Blossom (cf. meshGFaceOptimize.cpp)
-
-// ceci c'est nul: a changer :-)
-int MeshBoundaryLayerSurface(GFace *gf)
-{
-  // old boundary layers
-  if(gf->geomType() == GEntity::BoundaryLayerSurface &&
-     gf->getNativeType() == GEntity::GmshModel) 
-    return 1;
-  
-  if(gf->geomType() != GEntity::BoundaryLayerSurface)
-    return 0;
-  
-  Msg::Info("Meshing surface %d (boundary layer)", gf->tag());
-
-  boundaryLayerFace *bf = static_cast<boundaryLayerFace*>(gf);
-
-  std::vector<GEntity*> &source(bf->getSourceEntities());
-  if(source.empty()){
-    Msg::Error("No source entities for boundary layer mesh");
-    return 0;
-  }
-  if(source[0]->dim() != 1){
-    Msg::Error("New boundary layer code only implemented in 2D");
-    return 0;
-  }
-
-  GEdge *ge = static_cast<GEdge*>(source[0]);
-  if(ge->getNormals().empty()){
-    Msg::Info("Computing smoothed normal field on source curves");
-  }
-
-  gf->meshStatistics.status = GFace::DONE;
-  return 1;
-}
diff --git a/doc/gmsh.html b/doc/gmsh.html
index 943b7a9315..3cc485ae7a 100644
--- a/doc/gmsh.html
+++ b/doc/gmsh.html
@@ -161,7 +161,7 @@ gmsh, password: gmsh).
 
 <h2><a name="Licensing"></a>Licensing</h2>
 
-Gmsh is copyright (C) 1997-2009 by C. Geuzaine and J.-F. Remacle and
+Gmsh is copyright (C) 1997-2011 by C. Geuzaine and J.-F. Remacle and
 is distributed under the terms of
 the <a href="http://www.gnu.org/copyleft/gpl.html">GNU General Public
 License (GPL)</a> (with an <a href="/gmsh/doc/LICENSE.txt">exception</a>
-- 
GitLab