From 734dd55d49e5168f4afe46a575ff4093af76afc4 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Fri, 23 Sep 2011 11:31:54 +0000
Subject: [PATCH] fix compile

---
 Plugin/NearToFarField.cpp |  8 ++--
 tutorial/t10.geo          | 91 ++++++++++++++++++++++++++++++++++++++-
 tutorial/t11.geo          | 43 +++++++++++++++++-
 3 files changed, 135 insertions(+), 7 deletions(-)

diff --git a/Plugin/NearToFarField.cpp b/Plugin/NearToFarField.cpp
index 08262a265c..9cdab269af 100644
--- a/Plugin/NearToFarField.cpp
+++ b/Plugin/NearToFarField.cpp
@@ -208,13 +208,11 @@ double GMSH_NearToFarFieldPlugin::getFarField(PViewData *eData, PViewData *hData
   delete [] Ls ;   
 
   return farF ;
-
 }
 
 
 PView *GMSH_NearToFarFieldPlugin::execute(PView * v)
 {
-
   double _k0 = (double)NearToFarFieldOptions_Number[0].def;
   double _r_far = (double)NearToFarFieldOptions_Number[1].def;
   int _NbPhi = (int)NearToFarFieldOptions_Number[2].def;
@@ -301,14 +299,14 @@ PView *GMSH_NearToFarFieldPlugin::execute(PView * v)
        int numComp  = eData->getNumComponents(0, ent, ele);
        if(numComp != 3) continue ;
        int numNodes = eData->getNumNodes(0, ent, ele);
-       double x[numNodes], y[numNodes], z[numNodes] ;
-       int tag[numNodes];
+       std::vector<double> x(numNodes), y(numNodes), z(numNodes);
+       std::vector<int> tag(numNodes);
        
        for(int nod = 0; nod < numNodes; nod++)
          tag[nod] = eData->getNode(step, ent, ele, nod, x[nod], y[nod], z[nod]);
        double n[3] = {0.,0.,0.};
        normal3points(x[0], y[0], z[0], x[1], y[1], z[1], x[2], y[2], z[2], n); 
-       double valE[numNodes*numComp], valH[numNodes*numComp] ;      
+       std::vector<double> valE(numNodes*numComp), valH(numNodes*numComp);
        
        for(int nod = 0; nod < numNodes; nod++){
          if(tag[nod]) continue ; // already considered 
diff --git a/tutorial/t10.geo b/tutorial/t10.geo
index ec92665317..d560bdc8df 100644
--- a/tutorial/t10.geo
+++ b/tutorial/t10.geo
@@ -2,7 +2,96 @@
  *
  *  Gmsh tutorial 10
  * 
- *  Remeshing with compounds
+ *  General mesh size fields
  *
  *********************************************************************/
 
+// In addition to specifying target mesh sizes at the points of the
+// geometry (see t1) or using a background mesh (see t7), you can use
+// general mesh size "Fields". 
+
+// Let's create a simple rectangular geometry
+lc = .15;
+Point(1) = {0.0,0.0,0,lc};
+Point(2) = {1,0.0,0,lc};
+Point(3) = {1,1,0,lc};
+Point(4) = {0,1,0,lc};
+Point(5) = {0.2,.5,0,lc};
+Line(1) = {3,2};
+Line(2) = {2,1};
+Line(3) = {1,4};
+Line(4) = {4,3};
+Line Loop(5) = {1,2,3,4};
+Plane Surface(6) = {5};
+
+// Say we would like to obtain mesh elements with size lc/30 near line
+// 1 and point 5, and size lc elsewhere. To achieve this, we can use
+// two fields: "Attractor", and "Threshold". We first define an
+// Attractor field (Field[1]) on points 5 and on line 1. This field
+// returns the distance to point 5 and to (100 equidistant points on)
+// line 1.
+Field[1] = Attractor;
+Field[1].NodesList = {5};
+Field[1].NNodesByEdge = 100;
+Field[1].EdgesList = {1};
+
+// We then define a Threshold field, which uses the return value of
+// the Attractor Field[1] in order to define a simple change in
+// element size around the attractors (i.e., around point 5 and line
+// 1)
+//
+// LcMax -                         /------------------
+//                               /
+//                             /
+//                           /
+// LcMin -o----------------/
+//        |                |       |
+//     Attractor       DistMin   DistMax
+Field[2] = Threshold;
+Field[2].IField = 1;
+Field[2].LcMin = lc / 30;
+Field[2].LcMax = lc;
+Field[2].DistMin = 0.15;
+Field[2].DistMax = 0.5;
+
+// Say we want to modulate the mesh element sizes using a mathematical
+// function of the spatial coordinates. We can do this with the
+// MathEval field:
+Field[3] = MathEval;
+Field[3].F = "Cos(4*3.14*x) * Sin(4*3.14*y) / 10 + 0.101";
+
+// We could also combine MathEval with values coming from other
+// fields. For example, let's define an Attractor around point 1
+Field[4] = Attractor;
+Field[4].NodesList = {1};
+
+// We can then create a MathEval field with a function that depends on
+// the return value of the Attractr Field[4], i.e., depending on the
+// distance to point 1 (here using a cubic law, with minumum element
+// size = lc / 100)
+Field[5] = MathEval;
+Field[5].F = Sprintf("F4^3 + %g", lc / 100);
+
+// We could also use a Box field to impose a step change in element
+// sizes inside a box
+Field[6] = Box;
+Field[6].VIn = lc / 15;
+Field[6].VOut = lc;
+Field[6].XMin = 0.3; 
+Field[6].XMax = 0.6;
+Field[6].YMin = 0.3;
+Field[6].YMax = 0.6;
+
+// Many other types of fields are available: see the reference manual
+// for a complete list. You can also create fields directly in the
+// graphical user interface by selecting Define->Fields in the Mesh
+// module.
+
+// Finally, let's use the minimum of all the fields as the background
+// mesh field
+Field[7] = Min;
+Field[7].FieldsList = {2, 3, 5, 6};
+Background Field = 7;
+
+// Don't extend the elements sizes from the boundary inside the domain
+Mesh.CharacteristicLengthExtendFromBoundary = 0;
diff --git a/tutorial/t11.geo b/tutorial/t11.geo
index 7641cf6733..ace8d20e9f 100644
--- a/tutorial/t11.geo
+++ b/tutorial/t11.geo
@@ -2,7 +2,48 @@
  *
  *  Gmsh tutorial 11
  * 
- *  Unstructured quadrangular meshes with DelQuad and BlossomQuad
+ *  Unstructured quadrangular meshes.
  *
  *********************************************************************/
 
+// We have seen in tutorials t3 and t6 that extruded and transfinite
+// meshes can be "recombined" into quads/prisms/hexahedra by using the
+// "Recombine" keyword. Unstructured meshes can be recombined in the
+// same way: let's define a simple geometry with an analytical mesh
+// size field:
+
+Point(1) = {-1.25, -.5, 0};
+Point(2) = {-1.25, 1.25, 0};
+Point(3) = {1.25, -.5, 0};
+Point(4) = {1.25, 1.25, 0};
+Line(1) = {1, 2}; Line(2) = {2, 4};
+Line(3) = {4, 3}; Line(4) = {3, 1};
+Line Loop(4) = {1,2, 3, 4};
+Plane Surface(100) = {4};
+
+Field[1] = MathEval;
+Field[1].F = "0.01*(1.0+30.*(y-x*x)*(y-x*x) + (1-x)*(1-x))";
+Background Field = 1;
+
+// To generate quadrangles instead of triangles, we can simply add
+Recombine Surface{100};
+
+// If we'd had several surfaces, we could have used 'Recombine Surface
+// "*";'. Yet another way would be to specify the global option
+// "Mesh.RecombineAll = 1;".
+
+// The default recombination algorithm is called "Blossom": it uses a
+// minimum cost perfect matching algorithm to generate fully
+// quadrilateral meshes from triangulations. More details about the
+// algorithm can be found in the following paper: J.-F. Remacle,
+// J. Lambrechts, B. Seny, E. Marchandise, A. Johnen and C. Geuzaine,
+// "Blossom-Quad: a non-uniform quadrilateral mesh generator using a
+// minimum cost perfect matching algorithm", International Journal for
+// Numerical Methods in Engineering, 2011 (in press).
+
+// For even better quadrilateral meshes, you can try the experimental
+// "Delaunay for quads" (DelQuad) meshing algorithm: DelQuad is a
+// triangulation algorithm that enables to create right triangles
+// almost everywhere. Uncomment the following line to try DelQuad:
+
+// Mesh.Algorithm = 8; // DelQuad (experimental)
-- 
GitLab