File: mortar-msh.idp

package info (click to toggle)
freefem%2B%2B 3.47%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 132,088 kB
  • ctags: 19,726
  • sloc: cpp: 138,951; ansic: 22,605; sh: 4,951; makefile: 2,935; fortran: 1,147; perl: 768; awk: 282; php: 182
file content (42 lines) | stat: -rw-r--r-- 1,249 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// --- begin  meshes  building --------------
real[int] theta(nbsd+1),cost(nbsd),sint(nbsd);

for (int i=0;i<nbsd;i++)
 {
  real t=i*2*pi/nbsd;
  theta[i]= t;
  theta[i+1]= (i+1)*2*pi/nbsd;
  cost[i]=cos(t);
  sint[i]=sin(t);
 }


border g1(t=0,1){x=cost[0]*t;y=sint[0]*t;label=1;};
border g2(t=0,1){x=cost[1]*t;y=sint[1]*t;label=1;};
border g3(t=0,1){x=cost[2]*t;y=sint[2]*t;label=1;};
border g4(t=0,1){x=cost[3]*t;y=sint[3]*t;label=1;};

border e12(t=theta[0],theta[1]){x=cos(t);y=sin(t);label=labext;};
border e23(t=theta[1],theta[2]){x=cos(t);y=sin(t);label=labext;};
border e34(t=theta[2],theta[3]){x=cos(t);y=sin(t);label=labext;};
border e41(t=theta[3],theta[4]){x=cos(t);y=sin(t);label=labext;};

 int Ng = 5;
 int Ne = 5 ;

plot(g1(Ng)+g2(Ng)+g3(Ng)+g4(Ng) + e12(Ne) + e23(Ne)+ e34(Ne) + e41(Ne) ,wait=1);

mesh Tha = buildmesh( g1(Ng)+g2(Ng)+g3(Ng)+g4(Ng) + e12(Ne) + e23(Ne)+ e34(Ne) + e41(Ne) );

int [int] regi(4);
for (int i=0;i<4;i++)
  {
    real tt = (theta[i]+theta[i+1])*0.5;
    regi[i]=Tha(0.5*cos(tt),0.5*sin(tt)).region;
  }


Tha=adaptmesh(Tha,meshsize*3,IsMetric=1,thetamax=60,nbvx=100000);
Tha=adaptmesh(Tha,meshsize*1.5,IsMetric=1,thetamax=60,nbvx=100000);
Tha=adaptmesh(Tha,meshsize,IsMetric=1,thetamax=60,nbvx=100000);