| 1 |
// Usage: |
| 2 |
/* |
| 3 |
extract the list of degre of freedom of 2d finite elemnt |
| 4 |
on connect boundary given by a list of label or on label |
| 5 |
the list is sort in direction of the +/- tangent |
| 6 |
the orientation 1: direct or -1 clockwise |
| 7 |
The parameter are: |
| 8 |
- labs : int[int] ou int to defined the boundary (in) |
| 9 |
- Wh the fespace (in) |
| 10 |
- int[int] doflabs (resize array) (out) |
| 11 |
- int orient : orientation of the border direct (1) or in direct -1 (in) |
| 12 |
*/ |
| 13 |
macro ExtractDofsonBorder(labs,Wh,doflabs,orient) |
| 14 |
{ |
| 15 |
mesh Th=Wh.Th; |
| 16 |
fespace VhExtractDofsonBorder(Th,P1); |
| 17 |
VhExtractDofsonBorder abslabs,onlon,atest; |
| 18 |
real lenborder = int1d(Th,labs,qfe=qf1pElump)(1.); |
| 19 |
if( lenborder >0) |
| 20 |
{ |
| 21 |
if(orient) |
| 22 |
solve Pbabciss(abslabs,atest,solver=GMRES) |
| 23 |
= int2d(Th,qft=qf1pTlump)(abslabs*atest*1e-8/area) |
| 24 |
+ int1d(Th,labs,qfe=qf1pElump)([dx(abslabs),dy(abslabs)]'*[-N.y,+N.x]*atest) |
| 25 |
- int1d(Th,labs,qfe=qf1pElump)(orient*atest); |
| 26 |
else abslabs= 1.; /* no sorting*/ |
| 27 |
real abslabsmax = abs(2*abslabs[].max); |
| 28 |
varf vlabsneg(u,v) = on(labs,u=abslabs-abslabsmax); |
| 29 |
if(0) plot(abslabs,wait=1); |
| 30 |
real[int] absc=vlabsneg(0,Wh); |
| 31 |
doflabs.resize(Wh.ndof); |
| 32 |
doflabs=0:Wh.ndof-1; |
| 33 |
sort(absc,doflabs); |
| 34 |
absc= absc? 1:0; |
| 35 |
doflabs.resize(absc.sum+0.5); |
| 36 |
} |
| 37 |
else |
| 38 |
doflabs.resize(0); |
| 39 |
} |
| 40 |
// |