//PONTOS DA PML.
pinx=1.2;poux=1.4;piny=.4;pouy=.6;pinz=.4;pouz=.6;
lin=.1;lou=.15;
p1 =newp;Point(p1 )={-pinx,-piny,-pouz,lin};
p2 =newp;Point(p2 )={-pinx, piny,-pouz,lin};
p3 =newp;Point(p3 )={ pinx, piny,-pouz,lin};
p4 =newp;Point(p4 )={ pinx,-piny,-pouz,lin};
p5 =newp;Point(p5 )={-poux,-pouy,-pouz,lou};
p6 =newp;Point(p6 )={-poux,-piny,-pouz,lou};
p7 =newp;Point(p7 )={-poux, piny,-pouz,lou};
p8 =newp;Point(p8 )={-poux, pouy,-pouz,lou};
p9 =newp;Point(p9 )={-pinx, pouy,-pouz,lou};
p10=newp;Point(p10)={ pinx, pouy,-pouz,lou};
p11=newp;Point(p11)={ poux, pouy,-pouz,lou};
p12=newp;Point(p12)={ poux, piny,-pouz,lou};
p13=newp;Point(p13)={ poux,-piny,-pouz,lou};
p14=newp;Point(p14)={ poux,-pouy,-pouz,lou};
p15=newp;Point(p15)={ pinx,-pouy,-pouz,lou};
p16=newp;Point(p16)={-pinx,-pouy,-pouz,lou};
//LINES
l1 =newc;Line(l1 )={p1 ,p2 };
l2 =newc;Line(l2 )={p2 ,p3 };
l3 =newc;Line(l3 )={p3 ,p4 };
l4 =newc;Line(l4 )={p4 ,p1 };
l5 =newc;Line(l5 )={p5 ,p6 };
l6 =newc;Line(l6 )={p6 ,p7 };
l7 =newc;Line(l7 )={p7 ,p8 };
l8 =newc;Line(l8 )={p8 ,p9 };
l9 =newc;Line(l9 )={p9 ,p10};
l10=newc;Line(l10)={p10,p11};
l11=newc;Line(l11)={p11,p12};
l12=newc;Line(l12)={p12,p13};
l13=newc;Line(l13)={p13,p14};
l14=newc;Line(l14)={p14,p15};
l15=newc;Line(l15)={p15,p16};
l16=newc;Line(l16)={p16,p5 };
l17=newc;Line(l17)={p6 ,p1 };
l18=newc;Line(l18)={p1 ,p16};
l19=newc;Line(l19)={p2 ,p7 };
l20=newc;Line(l20)={p9 ,p2 };
l21=newc;Line(l21)={p3 ,p10};
l22=newc;Line(l22)={p12,p3 };
l23=newc;Line(l23)={p4 ,p13};
l24=newc;Line(l24)={p15,p4 };
//SURFACES
ll1=newreg;Line Loop(ll1) = {l16,l5,l17,l18};
s1=news   ;Plane Surface(s1) = {ll1};
ll2=newreg;Line Loop(ll2) = {l1,l19,-l6,l17};
s2=news   ;Plane Surface(s2) = {ll2};
ll3=newreg;Line Loop(ll3) = {l7,l8,l20,l19};
s3=news   ;Plane Surface(s3) = {ll3};
ll4=newreg;Line Loop(ll4) = {l2,l21,-l9,l20};
s4=news;Plane Surface(s4) = {ll4};
ll5=newreg;Line Loop(ll5) = {l21,l10,l11,l22};
s5=news   ;Plane Surface(s5) = {ll5};
ll6=newreg;Line Loop(ll6) = {-l12,l22,l3,l23};
s6=news   ;Plane Surface(s6) = {ll6};
ll7=newreg;Line Loop(ll7) = {l23,l13,l14,l24};
s7=news   ;Plane Surface(s7) = {ll7};
ll8=newreg;Line Loop(ll8) = {l18,-l15,l24,l4};
s8=news   ;Plane Surface(s8) = {ll8};
ll9=newreg;Line Loop(ll9) = {l4,l1,l2,l3};
s9=news   ;Plane Surface(s9) = {ll9};


Extrude Surface {s1, {0,0,(pouz-pinz)}};
Extrude Surface {s2, {0,0,(pouz-pinz)}};
Extrude Surface {s3, {0,0,(pouz-pinz)}};
Extrude Surface {s4, {0,0,(pouz-pinz)}};
Extrude Surface {s5, {0,0,(pouz-pinz)}};
Extrude Surface {s6, {0,0,(pouz-pinz)}};
Extrude Surface {s7, {0,0,(pouz-pinz)}};
Extrude Surface {s8, {0,0,(pouz-pinz)}};
Extrude Surface {s9, {0,0,(pouz-pinz)}};

Extrude Surface {196, {0,0,2*pinz}};
Extrude Surface {218, {0,0,2*pinz}};
Extrude Surface {64,  {0,0,2*pinz}};
Extrude Surface {174, {0,0,2*pinz}};
Extrude Surface {240, {0,0,2*pinz}};
Extrude Surface {86,  {0,0,2*pinz}};
Extrude Surface {152, {0,0,2*pinz}};
Extrude Surface {130, {0,0,2*pinz}};
Extrude Surface {108, {0,0,2*pinz}};

Extrude Surface {262, {0,0,(pouz-pinz)}};
Extrude Surface {284, {0,0,(pouz-pinz)}};
Extrude Surface {306, {0,0,(pouz-pinz)}};
Extrude Surface {328, {0,0,(pouz-pinz)}};
Extrude Surface {350, {0,0,(pouz-pinz)}};
Extrude Surface {372, {0,0,(pouz-pinz)}};
Extrude Surface {394, {0,0,(pouz-pinz)}};
Extrude Surface {416, {0,0,(pouz-pinz)}};
Extrude Surface {438, {0,0,(pouz-pinz)}};


//VOLUMES DAs QUINAS
Surface Loop(639) = {99,30,95,108,103,77};
Volume(640) = {639};
Surface Loop(642) = {152,121,34,143,147,151};
Volume(645) = {642};
Surface Loop(644) = {517,394,579,583,587,592};
Volume(643) = {644};
Surface Loop(646) = {438,623,627,613,561,636};
Volume(647) = {646};
Surface Loop(648) = {499,306,491,495,504,469};
Volume(649) = {648};
Surface Loop(650) = {447,262,451,455,459,460};
Volume(651) = {650};
Surface Loop(652) = {173,38,187,191,195,196};
Volume(653) = {652};
Surface Loop(654) = {59,26,51,55,64,63};
Volume(655) = {654};
qui=1;Physical Volume(qui)={640,645,643,647,649,651,653,655};
//VOLUMEs PARALELOS AO EIXO Z
Surface Loop(656) = {363,108,425,429,415,438};
Volume(657) = {656};
Surface Loop(658) = {249,196,253,257,261,262};
Volume(659) = {658};
Surface Loop(660) = {271,64,293,297,301,306};
Volume(661) = {660};
Surface Loop(662) = {381,152,385,389,319,394};
Volume(663) = {662};
paz=4;Physical Volume(paz)={657,659,661,663};
//VOLUMEs PARALELOS AO EIXO y
Surface Loop(664) = {169,36,161,151,174,173};
Volume(665) = {664};
Surface Loop(666) = {561,372,539,570,565,499};
Volume(667) = {666};
Surface Loop(668) = {521,328,513,517,526,447};
Volume(669) = {668};
Surface Loop(670) = {77,28,73,86,81,59};
Volume(671) = {670};
Physical Volume(3)={665,667,669,671};
////VOLUMEs PARALELOS AO EIXO x
Surface Loop(672) = {130,117,32,121,125,103};
Volume(673) = {672};
Surface Loop(674) = {469,284,473,459,481,482};
Volume(675) = {674};
Surface Loop(676) = {217,40,63,209,195,218};
Volume(677) = {676};
Surface Loop(678) = {543,416,579,609,613,614};
Volume(679) = {678};
Physical Volume(2)={673,675,677,679};
//VOLUMES NORMAIS AO EIXO Y
Surface Loop(680) = {345,130,381,411,415,416};
Volume(681) = {680};
Surface Loop(682) = {283,218,271,275,261,284};
Volume(683) = {682};
NY=6;Physical Volume(NY)={681,683};
///VOLUMES NORMAIS AO EIXO Z
Surface Loop(684) = {543,350,481,539,548,521};
Volume(685) = {684};
Surface Loop(686) = {73,42,217,240,117,169};
Volume(687) = {686};
NZ=7;Physical Volume(NZ)={685,687};
///VOLUMES NORMAIS AO EIXO X
Surface Loop(688) = {323,174,315,319,328,249};
Volume(689) = {688};
Surface Loop(691) = {86,341,363,367,301,372};
Volume(692) = {691};
NX=5;Physical Volume(5)={689,692};
//VOLUME INTERNO
Surface Loop(693) = {240,283,341,345,323,350};
Volume(694) = {693};
//SUPERFÍCIE EXTERNA
Physical Surface(695) = {99,125,143,429,627,385,583,609,411,38,40,26,28,42,36,34,32,30,95,425,623,565,367,81,55,495,297,636,614,592,570,504,482,460,526,548,587,389,147,161,187,253,451,513,315,191,209,51,293,275,257,455,473,491};


vim=8;Physical Volume(vim)={694};


