/usr/include/freefem++/idp/AddLayer2d.idp is in libfreefem++-dev 3.47+dfsg1-2build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | // AddLayer2d.idf file.. version 0.
// Frederic Hecht 2010
// LGPL licence
// Author Frederic.Hecht@upmc.fr
// -------------------------------
func bool same(mesh & Th1,mesh & Th2)
{
bool ret=0;
//cout << mpirank << " same Th ?? " << Th1.nt << " "<< Th2.nt << " " << Th1.nv << " "<< Th2.nv << endl;
if(Th1.nt == Th2.nt && Th1.nv == Th2.nv)
{
fespace V1(Th1,P1);
fespace V2(Th2,P1);
V1 x1=x,y1=y;
V2 x2=x,y2=y;
real err1= sqrt(int2d(Th1,qft=qf1pTlump)( square(x-x2) + square(y-y2)));
real err2= sqrt(int2d(Th2,qft=qf1pTlump)( square(x-x1) + square(y-y1)));
if(err1+err2 < Th1.nv*1e-6) ret=1;
else if(verbosity>1) cout << "same no same mesh " << err1 << " " << err2 << endl;
}
return ret;
}
func bool AddLayers(mesh & Th,real[int] &ssd,int n,real[int] &unssd)
{
// build a continuous function uussd (P1) and modifies ssd :
// IN: ssd in the caracteristics function on the input sub domain.
// OUT: ssd and unssd
// such that :
// ssd is a boolean function
// unssd is a smooth function
// ssd = 1 when unssd >0;
// add n layer of element (size of the overlap)
// and unssd = 0 ouside of this layer ...
// ---------------------------------
fespace Vh(Th,P1);
fespace Ph(Th,P0);
Ph s;
assert(ssd.n==Ph.ndof);
assert(unssd.n==Vh.ndof);
unssd=0;
s[]= ssd;
Vh u;
varf vM(uuuu,v)=int2d(Th,qforder=1)(uuuu*v/area);
matrix M=vM(Ph,Vh);
for(int i=0;i<n;++i)
{
u[]= M*s[];
u = u>.1;
unssd+= u[];
s[]= M'*u[];
s = s >0.1;
}
unssd /= (n);
u[]=unssd;
ssd=s[];
return true;
}
|