[Gmsh] Finding largest surface numbers within a boolean output
Sathyanarayan Rao
sathyanarayan.rao at uclouvain.be
Mon Mar 5 12:07:42 CET 2018
Hello,
Is it possible to find largest surface number contained in an entity ?
For example , if I have
aaa() = BooleanFragments{ Surface {1}; Delete; }{ Surface {aa()}; Delete; };
The resulting surfaces in aaa() , usually the last surface number is the one I need and is there a way to find it ?
However, if I print ------------------------- > Printf("news=",news);
It doesnt give me the last surface number of aaa(). In the above BooleanFragment, surface 1 is the largest surface with
smaller surfaces within it. However, in aaa(), the surface 1 gets mapped to aaa(largest number).
For example in the .geo code, surface 50 is the one I need to find it automatically. Please let me know if there is a way ?
// mesh size description
cl_1 = 2.000000e-01;
cl_2 = 5.000000e-02;
SetFactory("OpenCASCADE");
// boundary points that forms Rhizotron
Rectangle(1) = {-1.100000e+00,-1.100000e+00,0,2.200000e+00,1.100000e+00,0};
// Mesh Parameters
Mesh.CharacteristicLengthExtendFromBoundary = 1;
Mesh.CharacteristicLengthMax = 2.000000e-01;
Geometry.NumSubEdges = 100;
// no. of spline surfaces = 7
X1 ={0.14522,0.045787,0.045787,0.045787,-0.015546,-0.076883,-0.13821,-0.30221,-0.46621,-0.63021,-0.66251,-0.69481,-0.72711,-0.76191,-0.79671,-0.83151,-0.85905,-0.88658,-0.91411};
Y1 ={-0.04208,-0.04208,-0.12994,-0.21781,-0.24374,-0.26968,-0.29561,-0.38891,-0.48221,-0.57551,-0.61651,-0.65751,-0.69851,-0.74148,-0.78445,-0.82741,-0.85665,-0.88588,-0.91511};
X[] = X1[];Y[] = Y1[];
d = 9.942868e-02;
//Printf("newp=", newp);
P1 = newp; P2 = newp+1;P3 = newl; Point(P1) = {X[0],Y[0],0,cl_2}; Point(P2) = {X[1],Y[1],0,cl_2}; Line(P3) = {P1,P2};
nR = #X[ ];p0 = newp;p = p0;
For i In {1:nR-1}
Point(newp) = {X[i], Y[i], 0, cl_2};
EndFor
L1 = newl;L2 = newl+1; p2 = newp-1;Spline(L1) = {p0 : p0 + nR - 2}; Wire(L2) = {L1};Extrude { Line{P3}; } Using Wire {L2}
X2 ={-0.05197,0.03961,0.1224,0.20519,0.28797,0.37076,0.45355};
Y2 ={-0.26271,-0.22399,-0.35629,-0.48859,-0.62089,-0.75319,-0.88549};
X[] = X2[];Y[] = Y2[];
d = 9.942868e-02;
//Printf("newp=", newp);
P1 = newp; P2 = newp+1;P3 = newl; Point(P1) = {X[0],Y[0],0,cl_2}; Point(P2) = {X[1],Y[1],0,cl_2}; Line(P3) = {P1,P2};
nR = #X[ ];p0 = newp;p = p0;
For i In {1:nR-1}
Point(newp) = {X[i], Y[i], 0, cl_2};
EndFor
L1 = newl;L2 = newl+1; p2 = newp-1;Spline(L1) = {p0 : p0 + nR - 2}; Wire(L2) = {L1};Extrude { Line{P3}; } Using Wire {L2}
X3 ={-0.043606,0.047975,0.26057,0.47317,0.68577};
Y3 ={-0.25434,-0.21563,-0.40098,-0.58633,-0.77168};
X[] = X3[];Y[] = Y3[];
d = 9.942868e-02;
//Printf("newp=", newp);
P1 = newp; P2 = newp+1;P3 = newl; Point(P1) = {X[0],Y[0],0,cl_2}; Point(P2) = {X[1],Y[1],0,cl_2}; Line(P3) = {P1,P2};
nR = #X[ ];p0 = newp;p = p0;
For i In {1:nR-1}
Point(newp) = {X[i], Y[i], 0, cl_2};
EndFor
L1 = newl;L2 = newl+1; p2 = newp-1;Spline(L1) = {p0 : p0 + nR - 2}; Wire(L2) = {L1};Extrude { Line{P3}; } Using Wire {L2}
X4 ={-0.078759,0.032787,0.16553,0.29827,0.43101,0.56375};
Y4 ={-0.27797,-0.23081,-0.38589,-0.54097,-0.69605,-0.85113};
X[] = X4[];Y[] = Y4[];
d = 1.211050e-01;
//Printf("newp=", newp);
P1 = newp; P2 = newp+1;P3 = newl; Point(P1) = {X[0],Y[0],0,cl_2}; Point(P2) = {X[1],Y[1],0,cl_2}; Line(P3) = {P1,P2};
nR = #X[ ];p0 = newp;p = p0;
For i In {1:nR-1}
Point(newp) = {X[i], Y[i], 0, cl_2};
EndFor
L1 = newl;L2 = newl+1; p2 = newp-1;Spline(L1) = {p0 : p0 + nR - 2}; Wire(L2) = {L1};Extrude { Line{P3}; } Using Wire {L2}
X5 ={-0.10976,0.0017856,0.041831,0.081876,0.12192,0.16197,0.20201,0.24206,0.2821};
Y5 ={-0.30897,-0.26181,-0.35576,-0.44971,-0.54365,-0.6376,-0.73154,-0.82549,-0.91943};
X[] = X5[];Y[] = Y5[];
d = 1.211050e-01;
//Printf("newp=", newp);
P1 = newp; P2 = newp+1;P3 = newl; Point(P1) = {X[0],Y[0],0,cl_2}; Point(P2) = {X[1],Y[1],0,cl_2}; Line(P3) = {P1,P2};
nR = #X[ ];p0 = newp;p = p0;
For i In {1:nR-1}
Point(newp) = {X[i], Y[i], 0, cl_2};
EndFor
L1 = newl;L2 = newl+1; p2 = newp-1;Spline(L1) = {p0 : p0 + nR - 2}; Wire(L2) = {L1};Extrude { Line{P3}; } Using Wire {L2}
X6 ={-0.069089,0.042456,0.11646,0.19046,0.26446,0.33846,0.41246};
Y6 ={-0.2683,-0.22114,-0.35382,-0.48649,-0.61917,-0.75184,-0.88452};
X[] = X6[];Y[] = Y6[];
d = 1.211050e-01;
//Printf("newp=", newp);
P1 = newp; P2 = newp+1;P3 = newl; Point(P1) = {X[0],Y[0],0,cl_2}; Point(P2) = {X[1],Y[1],0,cl_2}; Line(P3) = {P1,P2};
nR = #X[ ];p0 = newp;p = p0;
For i In {1:nR-1}
Point(newp) = {X[i], Y[i], 0, cl_2};
EndFor
L1 = newl;L2 = newl+1; p2 = newp-1;Spline(L1) = {p0 : p0 + nR - 2}; Wire(L2) = {L1};Extrude { Line{P3}; } Using Wire {L2}
X7 ={-0.24535,-0.1373,-0.090537,-0.043773,0.0029906,0.049754,0.096518,0.14328};
Y7 ={-0.35617,-0.2947,-0.3903,-0.4859,-0.5815,-0.6771,-0.7727,-0.8683};
X[] = X7[];Y[] = Y7[];
d = 1.243110e-01;
//Printf("newp=", newp);
P1 = newp; P2 = newp+1;P3 = newl; Point(P1) = {X[0],Y[0],0,cl_2}; Point(P2) = {X[1],Y[1],0,cl_2}; Line(P3) = {P1,P2};
nR = #X[ ];p0 = newp;p = p0;
For i In {1:nR-1}
Point(newp) = {X[i], Y[i], 0, cl_2};
EndFor
L1 = newl;L2 = newl+1; p2 = newp-1;Spline(L1) = {p0 : p0 + nR - 2}; Wire(L2) = {L1};Extrude { Line{P3}; } Using Wire {L2}
aa() = BooleanUnion{ Surface {2}; Delete; }{ Surface {3:7}; Delete; };
Characteristic Length { PointsOf{ Surface{aa()}; } } = cl_2;
aaa() = BooleanFragments{ Surface {1}; Delete; }{ Surface {aa()}; Delete; };
Printf("news=",news);
________________________________
Best Regards,
Sathyanarayan Rao, PhD student
Earth and Life Institute/Environmental Sciences (ELI-e)
Université catholique de Louvain
c.037, Croix du Sud 2, Louvain-la-Neuve, Belgium
Phone: 010473827 ( intercom 73827)
________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://onelab.info/pipermail/gmsh/attachments/20180305/01a3c460/attachment-0001.html>
More information about the gmsh
mailing list