| 1 |
// --- begin meshes building -------------- |
| 2 |
real[int] theta(nbsd+1),cost(nbsd),sint(nbsd); |
| 3 |
|
| 4 |
for (int i=0;i<nbsd;i++) |
| 5 |
{ |
| 6 |
real t=i*2*pi/nbsd; |
| 7 |
theta[i]= t; |
| 8 |
theta[i+1]= (i+1)*2*pi/nbsd; |
| 9 |
cost[i]=cos(t); |
| 10 |
sint[i]=sin(t); |
| 11 |
} |
| 12 |
|
| 13 |
|
| 14 |
border g1(t=0,1){x=cost[0]*t;y=sint[0]*t;label=1;}; |
| 15 |
border g2(t=0,1){x=cost[1]*t;y=sint[1]*t;label=1;}; |
| 16 |
border g3(t=0,1){x=cost[2]*t;y=sint[2]*t;label=1;}; |
| 17 |
border g4(t=0,1){x=cost[3]*t;y=sint[3]*t;label=1;}; |
| 18 |
|
| 19 |
border e12(t=theta[0],theta[1]){x=cos(t);y=sin(t);label=labext;}; |
| 20 |
border e23(t=theta[1],theta[2]){x=cos(t);y=sin(t);label=labext;}; |
| 21 |
border e34(t=theta[2],theta[3]){x=cos(t);y=sin(t);label=labext;}; |
| 22 |
border e41(t=theta[3],theta[4]){x=cos(t);y=sin(t);label=labext;}; |
| 23 |
|
| 24 |
int Ng = 5; |
| 25 |
int Ne = 5 ; |
| 26 |
|
| 27 |
plot(g1(Ng)+g2(Ng)+g3(Ng)+g4(Ng) + e12(Ne) + e23(Ne)+ e34(Ne) + e41(Ne) ,wait=1); |
| 28 |
|
| 29 |
mesh Tha = buildmesh( g1(Ng)+g2(Ng)+g3(Ng)+g4(Ng) + e12(Ne) + e23(Ne)+ e34(Ne) + e41(Ne) ); |
| 30 |
|
| 31 |
int [int] regi(4); |
| 32 |
for (int i=0;i<4;i++) |
| 33 |
{ |
| 34 |
real tt = (theta[i]+theta[i+1])*0.5; |
| 35 |
regi[i]=Tha(0.5*cos(tt),0.5*sin(tt)).region; |
| 36 |
} |
| 37 |
|
| 38 |
|
| 39 |
Tha=adaptmesh(Tha,meshsize*3,IsMetric=1,thetamax=60,nbvx=100000); |
| 40 |
Tha=adaptmesh(Tha,meshsize*1.5,IsMetric=1,thetamax=60,nbvx=100000); |
| 41 |
Tha=adaptmesh(Tha,meshsize,IsMetric=1,thetamax=60,nbvx=100000); |
| 42 |
|