[Gmsh] Mesh Element size

bpigeard at free.fr bpigeard at free.fr
Wed Feb 15 11:16:45 CET 2017


Hello,

I wanted to come back to the bug #302 that is not solve in newer release (not as
I expect in the comment). So here the Bug fix I'm using. This prevent the random
function to return twice the same value for the current face mesh (which lead to
error if the same value is return 3 times).
The test case (geo file) attach to the bug ticket can confirm the bug fix.

Regards

bpigeard

Index: L:/Soft/src/gmsh/Mesh/meshGFace.cpp
===================================================================
--- L:/Soft/src/gmsh/Mesh/meshGFace.cpp	(revision 24409)
+++ L:/Soft/src/gmsh/Mesh/meshGFace.cpp	(working copy)
@@ -1124,6 +1124,33 @@
       double YY = CTX::instance()->mesh.randFactor * LC2D * (double)rand() /
         (double)RAND_MAX;
       //      printf("%22.15E %22.15E \n",XX,YY);
+	  int cntfind;
+	  do {
+		  cntfind = 0;
+		  for (size_t j = 0; j < i; j++) {
+			  if (doc.points[j].where.h == points[i]->u + XX) {
+				  cntfind += 1;
+				  if (cntfind > 0) {
+					  XX = CTX::instance()->mesh.randFactor * LC2D * (double)rand() /
+						  (double)RAND_MAX;
+					  break;
+				  }
+			  }
+		  }
+	  } while (cntfind >0);
+	  do {
+		  cntfind = 0;
+		  for (size_t j = 0; j < i; j++) {
+			  if (doc.points[j].where.v == points[i]->v + YY) {
+				  cntfind += 1;
+				  if (cntfind > 0) {
+					  YY = CTX::instance()->mesh.randFactor * LC2D * (double)rand() /
+						  (double)RAND_MAX;
+					  break;
+				  }
+			  }
+		  }
+	  } while (cntfind >0);
       doc.points[i].where.h = points[i]->u + XX;
       doc.points[i].where.v = points[i]->v + YY;
       doc.points[i].data = points[i];

Selon Bertrand PIGEARD <bpigeard at gmail.com>:

> Bonjour,
> I'm working on a project to translate GSDII file (2D format for microchip)
> to a 3D geo format, we just had the thickness of layers. (Work base on
> GDS3D http://sourceforge.net/projects/gds3d/ )
>
> The full geometry is ok but we face issue with mesh. So we control the mesh
> size of each point regarding the polygone areaand the mesh around the point.
> We tried to find rules to get the mesh with no error but we still have
> error with edge.
> So can you give us some rules to follow to get the mesh working.
>
> I can provide a geo test file but it's big even while zip (>10M)
>
> Thanks for your work and Happy new year,
>
> Bertrand
>
> PS: I also open a bug related to 2D mesh. The meshGFace random (line 1120
> and 1122) lead to error if the random function get twice the same value.
>





More information about the gmsh mailing list