From 8c5ddb696f8c2c131b6b0eb2988f80a836a34b39 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Sun, 1 Jun 2008 09:14:22 +0000
Subject: [PATCH] fixed embedded + adaptive vector

---
 Geo/GModel.h          |  6 ------
 Geo/MElement.cpp      | 35 ++++++++++++++++++++---------------
 Geo/Makefile          |  8 ++++----
 Post/adaptiveData.cpp |  9 +++++----
 utils/embed/Makefile  |  1 +
 5 files changed, 30 insertions(+), 29 deletions(-)

diff --git a/Geo/GModel.h b/Geo/GModel.h
index da676c06c2..b0d299afeb 100644
--- a/Geo/GModel.h
+++ b/Geo/GModel.h
@@ -45,21 +45,15 @@ class GModel
   std::map<int, MVertex*> _vertexMapCache;
 
   GEO_Internals *_geo_internals;
-#if !defined(HAVE_GMSH_EMBEDDED)
   void _createGEOInternals();
   void _deleteGEOInternals();
-#endif
 
   OCC_Internals *_occ_internals;
-#if !defined(HAVE_GMSH_EMBEDDED)
   void _deleteOCCInternals();
-#endif
 
   FM_Internals *_fm_internals;
-#if !defined(HAVE_GMSH_EMBEDDED)
   void _createFMInternals();
   void _deleteFMInternals();
-#endif
  
   // Characteristic Lengths fields
   FieldManager *_fields;
diff --git a/Geo/MElement.cpp b/Geo/MElement.cpp
index be49783219..7944495284 100644
--- a/Geo/MElement.cpp
+++ b/Geo/MElement.cpp
@@ -1,4 +1,4 @@
-// $Id: MElement.cpp,v 1.68 2008-05-19 18:50:32 remacle Exp $
+// $Id: MElement.cpp,v 1.69 2008-06-01 09:14:21 geuzaine Exp $
 //
 // Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 //
@@ -23,13 +23,13 @@
 #include "MElement.h"
 #include "GEntity.h"
 #include "GFace.h"
-#include "GaussLegendre1D.h"
 
 #if defined(HAVE_GMSH_EMBEDDED)
 #  include "GmshEmbedded.h"
 #else
 #  include "Numeric.h"
 #  include "FunctionSpace.h"
+#  include "GaussLegendre1D.h"
 #  include "Message.h"
 #  include "Context.h"
 #  include "qualityMeasures.h"
@@ -825,7 +825,7 @@ MElement *MElementFactory::create(int type, std::vector<MVertex*> &v,
   }
 }
 
-extern int      getNGQTPts(int order);
+extern int getNGQTPts(int order);
 extern IntPt *getGQTPts (int order);
 extern int getNGQTetPts(int order);
 extern IntPt *getGQTetPts(int order);
@@ -836,46 +836,51 @@ extern IntPt *getGQHPts(int order);
 
 IntPt GQL[100]; 
 
-void MLine:: getIntegrationPoints ( int pOrder , int *npts, IntPt **pts) const{
+void MLine::getIntegrationPoints(int pOrder, int *npts, IntPt **pts) const
+{
 #if !defined(HAVE_GMSH_EMBEDDED)
   double *t, *w;
-  int nbP = pOrder/2 + 1;
+  int nbP = pOrder / 2 + 1;
   gmshGaussLegendre1D(nbP, &t, &w);
-  for (int i=0;i<nbP;i++){
+  for (int i = 0; i < nbP; i++){
     GQL[i].pt[0] = t[i];
     GQL[i].pt[1] = 0;
     GQL[i].pt[2] = 0;
     GQL[i].weight = w[i];
   }
   *npts = nbP;
-  *pts  = GQL;
+  *pts = GQL;
 #endif
 }
-void MTriangle:: getIntegrationPoints ( int pOrder , int *npts, IntPt **pts) const
+
+void MTriangle:: getIntegrationPoints(int pOrder, int *npts, IntPt **pts) const
 {
 #if !defined(HAVE_GMSH_EMBEDDED)
   *npts = getNGQTPts(pOrder);
-  *pts  = getGQTPts(pOrder);
+  *pts = getGQTPts(pOrder);
 #endif
 }
-void MTetrahedron:: getIntegrationPoints ( int pOrder , int *npts, IntPt **pts) const
+
+void MTetrahedron::getIntegrationPoints(int pOrder, int *npts, IntPt **pts) const
 {
 #if !defined(HAVE_GMSH_EMBEDDED)
   *npts = getNGQTetPts(pOrder);
-  *pts  = getGQTetPts(pOrder);
+  *pts = getGQTetPts(pOrder);
 #endif
 }
-void MHexahedron:: getIntegrationPoints ( int pOrder , int *npts, IntPt **pts) const
+
+void MHexahedron::getIntegrationPoints(int pOrder, int *npts, IntPt **pts) const
 {
 #if !defined(HAVE_GMSH_EMBEDDED)
   *npts = getNGQHPts(pOrder);
-  *pts  = getGQHPts(pOrder);
+  *pts = getGQHPts(pOrder);
 #endif
 }
-void MQuadrangle:: getIntegrationPoints ( int pOrder , int *npts, IntPt **pts) const
+
+void MQuadrangle::getIntegrationPoints(int pOrder, int *npts, IntPt **pts) const
 {
 #if !defined(HAVE_GMSH_EMBEDDED)
   *npts = getNGQQPts(pOrder);
-  *pts  = getGQQPts(pOrder);
+  *pts = getGQQPts(pOrder);
 #endif
 }
diff --git a/Geo/Makefile b/Geo/Makefile
index 362582d374..07a09e1829 100644
--- a/Geo/Makefile
+++ b/Geo/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.209 2008-05-20 19:25:33 geuzaine Exp $
+# $Id: Makefile,v 1.210 2008-06-01 09:14:21 geuzaine Exp $
 #
 # Copyright (C) 1997-2008 C. Geuzaine, J.-F. Remacle
 #
@@ -283,7 +283,7 @@ MFace.o: MFace.cpp MFace.h MVertex.h SPoint3.h SVector3.h \
 MElement.o: MElement.cpp MElement.h ../Common/GmshDefines.h MVertex.h \
   SPoint3.h MEdge.h SVector3.h MFace.h GEntity.h Range.h SBoundingBox3d.h \
   GFace.h GPoint.h GEdgeLoop.h GEdge.h GVertex.h SPoint2.h Pair.h \
-  ../Numeric/GaussLegendre1D.h ../Numeric/Numeric.h \
-  ../Numeric/NumericEmbedded.h ../Numeric/FunctionSpace.h \
-  ../Common/GmshMatrix.h ../Common/Message.h ../Common/Context.h \
+  ../Numeric/Numeric.h ../Numeric/NumericEmbedded.h \
+  ../Numeric/FunctionSpace.h ../Common/GmshMatrix.h \
+  ../Numeric/GaussLegendre1D.h ../Common/Message.h ../Common/Context.h \
   ../Mesh/qualityMeasures.h
diff --git a/Post/adaptiveData.cpp b/Post/adaptiveData.cpp
index 70cda0048e..fbc5b395d5 100644
--- a/Post/adaptiveData.cpp
+++ b/Post/adaptiveData.cpp
@@ -840,11 +840,11 @@ void adaptiveElements<T>::initWithLowResolution(PViewData *data, int step)
   _posX = new Double_Matrix(numEle, numNodes);
   _posY = new Double_Matrix(numEle, numNodes);
   _posZ = new Double_Matrix(numEle, numNodes);
-  _val = new Double_Matrix(numEle, numVal / numComp);
+  _val = new Double_Matrix(numEle, numVal);
   if(numComp == 3){
-    _valX = new Double_Matrix(numEle, numVal / numComp);
-    _valY = new Double_Matrix(numEle, numVal / numComp);
-    _valZ = new Double_Matrix(numEle, numVal / numComp);
+    _valX = new Double_Matrix(numEle, numVal);
+    _valY = new Double_Matrix(numEle, numVal);
+    _valZ = new Double_Matrix(numEle, numVal);
   }
 
   // store non-interpolated data
@@ -1065,6 +1065,7 @@ adaptiveData::adaptiveData(PViewData *data)
   _outData = new PViewDataList(true);
 
   int numComp = _inData->getNumComponents(0, 0, 0);
+
   std::vector<List_T*> p;
   if(_inData->getNumLines() && _inData->getInterpolationScheme(1, p) >= 2)
     _lines = new adaptiveElements<adaptiveLine>
diff --git a/utils/embed/Makefile b/utils/embed/Makefile
index 33dd8bfbf0..87f3a73b1d 100644
--- a/utils/embed/Makefile
+++ b/utils/embed/Makefile
@@ -10,6 +10,7 @@ SRC = GModel.cpp\
         GModelIO_Mesh.cpp\
       GEntity.cpp\
         GVertex.cpp GEdge.cpp GEdgeLoop.cpp GFace.cpp GRegion.cpp\
+        discreteEdge.cpp discreteFace.cpp discreteRegion.cpp\
       MElement.cpp\
         MFace.cpp MVertex.cpp\
       NumericEmbedded.cpp\
-- 
GitLab