<div dir="ltr">Hi,<div><br></div><div>I confirm that with the current snapshot available (3.0.7-git-299ed78), I do not have the issue (cf convergence plot of the error vs the number of points on the spline attached)</div><div><br></div><div>Thanks again.</div><div><br></div><div>Matt.</div></div><div class="gmail_extra"><br><div class="gmail_quote">2018-08-06 11:55 GMT+02:00 Christophe Geuzaine <span dir="ltr"><<a href="mailto:cgeuzaine@uliege.be" target="_blank">cgeuzaine@uliege.be</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
<br>
> On 6 Aug 2018, at 11:50, Matthieu Lecouvez <<a href="mailto:matthieu.lecouvez@gmail.com">matthieu.lecouvez@gmail.com</a>> wrote:<br>
> <br>
> Hi,<br>
> <br>
</span><span class="">> Thanks for you answer. Decreasing the Geometry.Tolerance has no effect on the result (with the built-in kernel or the OCC kernel).<br>
> <br>
> I think the issue was in OCC_Internals::_addSpline of GMSH. In the released versions of GMSH (3.0.5, which I use, and 3.0.6), we can only use the Spline command in gmsh with OCC kernel (mode == 0 in the aforementioned function). Then GMSH calls the OCC function GeomAPI_PointsToBSpline(<wbr>ctrlPoints), with the default parameters DegMin=3, DegMax=8 (see OCC files GeomAPI_PointsToBSpline.cdl:46 and GeomAPI_PointsToBSpline.cxx), which probably lead to the accuracy problem I had.<br>
> <br>
> This is not the case anymore in the master branch of GMSH. The Spline command now calls the OCC class GeomAPI_Interpolate, as you mentioned, which is only degree 3 (see OCC file GeomAPI_Interpolate.cxx:711-<wbr>728), but we can now also use the BSpline gmsh command with the OCC kernel which should create a general OCC Geom_BSplineCurve class.<br>
> <br>
> I cannot easily compile GMSH with OCC support, so I will wait for the next release (do you have any estimated release date?) to check that the problem is corrected.<br>
> <br>
<br>
</span>Just download the "latest automatic snapshot" from the web site : this is rebuilt every time a change is made on the master branch.<br>
<span class="HOEnZb"><font color="#888888"><br>
Christophe<br>
</font></span><div><div class="h5"><br>
<br>
> Anyway, thanks for your great work, it is greatly appreciated!<br>
> <br>
> Matthieu.<br>
> <br>
> <br>
> 2018-07-26 17:46 GMT+02:00 Christophe Geuzaine <<a href="mailto:cgeuzaine@uliege.be">cgeuzaine@uliege.be</a>>:<br>
> <br>
> Hi Matthieu - They are both cubic splines (the built-in kernel uses a Catmull-Rom splines). Can you try descreasing Geometry.Tolerance to see if it has an effect? We use that parameter as the tolerance passed to the OpenCASCADE bspline construction routine (GeomAPI_Interpolate).<br>
> <br>
> Christophe<br>
> <br>
>> On 17 Jul 2018, at 23:44, Matthieu Lecouvez <<a href="mailto:matthieu.lecouvez@gmail.com">matthieu.lecouvez@gmail.com</a>> wrote:<br>
>> <br>
>> Hi,<br>
>> <br>
>> I am currently doing some tests with the OpenCascade kernel, which is VERY convenient to build complex geometries thanks to the boolean operations.<br>
>> <br>
>> However during these experimentation, I came up with a test case where, for my application (electromagnetic simulations), using either the built-in kernel or the OCC one leads to different results. Switching the kernel is simply done by commenting or uncommenting the "SetFactory" command. The geometry for the (2D) problem cannot be exported but makes use of only simple elementary entities (Line, Circle, Plane Surface) and some splines that are the results of optimization processes and thus cannot be described analytically.<br>
>> <br>
>> After some research, I found that the Spline command leads to two different type of spline in each kernel (nurbs in the built-in kernel, bspline in OCC if I'm correct?)<br>
>> <br>
>> From what I understood for the OCC source code, the spline that GMSH uses in the OCC kernel is simply a third order curve (and NOT a cubic spline) ? Can someone confirm that?<br>
>> <br>
>> The main issue with this is that providing more points to describe the spline in the OCC kernel does not improve the accuracy of the spline: basically the interpolated spline just converges to some curve very quickly and after only 5 or 6 points adding more points does not help for accuracy. This is not the behavior of the Spline of the built-in kernel.<br>
>> <br>
>> To show this behavior, I have realized the 1D mesh of a quarter of a circle described using a Spline (instead of Circle) and a variable number of points, with both kernels. Then I compute the maximum error |x^2+y^2-1|. The attached png file shows the evolution of this error versus the number of points used to described the Spline for each kernel. For the built-in kernel, the error converges to zero (using more points to describe the Spline leads to a better accuracy of the geometry), which is not the case for the OpenCascade kernel.<br>
>> <br>
>> I realize this issue seems to be the wanted behavior (as Spline in OCC are bspline) but I was wondering if anyone had the same issue, and more importantly if there is any plan in GMSH and/or OpenCascade to use more accurate splines with the OCC kernel at some point ?<br>
>> <br>
>> Thanks for reading this (too) long email and for any input you can provide regarding splines in OCC.<br>
>> <br>
>> Matthieu Lecouvez<br>
>> <br>
>> PS: I can provide the script used for the plot, if anyone is interested.<br>
>> <br>
>> <Max_error_of_R2.png>_________<wbr>______________________________<wbr>________<br>
>> gmsh mailing list<br>
>> <a href="mailto:gmsh@onelab.info">gmsh@onelab.info</a><br>
>> <a href="http://onelab.info/mailman/listinfo/gmsh" rel="noreferrer" target="_blank">http://onelab.info/mailman/<wbr>listinfo/gmsh</a><br>
> <br>
> — <br>
> Prof. Christophe Geuzaine<br>
> University of Liege, Electrical Engineering and Computer Science <br>
> <a href="http://www.montefiore.ulg.ac.be/~geuzaine" rel="noreferrer" target="_blank">http://www.montefiore.ulg.ac.<wbr>be/~geuzaine</a><br>
> <br>
> Free software: <a href="http://gmsh.info" rel="noreferrer" target="_blank">http://gmsh.info</a> | <a href="http://getdp.info" rel="noreferrer" target="_blank">http://getdp.info</a> | <a href="http://onelab.info" rel="noreferrer" target="_blank">http://onelab.info</a><br>
> <br>
> <br>
<br>
</div></div>— <br>
<div class="HOEnZb"><div class="h5">Prof. Christophe Geuzaine<br>
University of Liege, Electrical Engineering and Computer Science <br>
<a href="http://www.montefiore.ulg.ac.be/~geuzaine" rel="noreferrer" target="_blank">http://www.montefiore.ulg.ac.<wbr>be/~geuzaine</a><br>
<br>
Free software: <a href="http://gmsh.info" rel="noreferrer" target="_blank">http://gmsh.info</a> | <a href="http://getdp.info" rel="noreferrer" target="_blank">http://getdp.info</a> | <a href="http://onelab.info" rel="noreferrer" target="_blank">http://onelab.info</a><br>
<br>
</div></div></blockquote></div><br></div>