[Gmsh] Swaping the orientation of the triangles in Transfinite Surfaces (with Alternate)
Jose Paulo Moitinho de Almeida
moitinho at civil.ist.utl.pt
Thu May 16 18:40:52 CEST 2013
I wanted to create a triangular Transfinite Surface mesh , but was not able to
control the position of the initial triangle created by gmsh (the corners
always have only element, as in 1.png).
After looking at the code I swapped the logic in Mesh/meshGFaceTransfinite.cpp
from
((i % 2 == 0 && j % 2 == 1) ||
(i % 2 == 1 && j % 2 == 0)))){
to
((i % 2 == 0 && j % 2 == 0) ||
(i % 2 == 1 && j % 2 == 1)))){
and managed to obtain the result that I wanted (in 2.png).
Is there an easier way to achieve this?
If there isn't, it would not be too complicated to include an additional
option to Transfinite Surface, so that instead of "Left, Right and Alternate"
we could opt between "Left, Right AlternateLeft and AlternateRight", with
Alternate still legal and equivalent to the current option.
I should be able to propose a patch (not now...), but before I start opinions
are welcome.
Regards
ZP
PS: I also considered the idea of adding an additional option, which would
create a mesh where both diagonals are always inserted, so that using
Transfinite Line{1,2,3,4} = 2;
Transfinite Surface {6} = {1, 2, 3, 4} "OtherNewOption";
in the attached file, would result in 3.png.
I understand that an additional set of vertices is needed, and this is not so
immediate. Would it be too complicated to include them in the code?
-------------- next part --------------
Point(1) = {0, 0, 0, 1};
Point(2) = {1, 0, 0, 1};
Point(3) = {1, 1, 0, 1};
Point(4) = {0, 1, 0, 1};
Line(1) = {1, 2};
Line(2) = {2, 3};
Line(3) = {3, 4};
Line(4) = {4, 1};
Line Loop(5) = {3, 4, 1, 2};
Plane Surface(6) = {5};
Transfinite Line{1,2,3,4} = 3;
Transfinite Surface {6} = {1, 2, 3, 4} Alternate;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 1.png
Type: image/png
Size: 7087 bytes
Desc: not available
URL: <http://www.geuz.org/pipermail/gmsh/attachments/20130516/49a0f1bf/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 2.png
Type: image/png
Size: 5141 bytes
Desc: not available
URL: <http://www.geuz.org/pipermail/gmsh/attachments/20130516/49a0f1bf/attachment-0001.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 3.png
Type: image/png
Size: 4947 bytes
Desc: not available
URL: <http://www.geuz.org/pipermail/gmsh/attachments/20130516/49a0f1bf/attachment-0002.png>