Dear community,

Is there a clever way to access the exact coefficients of the P_{1} basis functions?

Regards,

/Fotios Kasolis

Dear community,

Is there a clever way to access the exact coefficients of the P_{1} basis functions?

Regards,

/Fotios Kasolis

By using the [] operator:

fespace Vh(Th,P1);

Vh f;

for(int i=0; i<Vh.ndof; ++i)

cout<<f[][i]<<"\n";

Dear @arousta,

Unfortunately, this is not right. This way you can only get the components of a finite element function. What I need is something like

```
border C(t = 0.0, 2.0*pi){ x = cos(t); y = sin(t); }
mesh T = buildmesh(C(100));
fespace V1(T, P1);
fespace V0(T, P0);
V1 f = 0.0;
V0 a, b;
for (int cnt=0; cnt<V1.ndof; cnt++) {
f[][cnt] = 1;
a = dx(f);
b = dy(f);
f[][cnt] = 0;
}
```

where `a`

and `b`

are the required values. I just want to avoid the loop, since these values are somewhere computed in the base code (somehow), and my mesh has 1e7 elements. On the other hand, something like `varf acoef(void,v)=int2d(T)(dx(v))`

has to be computed on V1 but can be made to result in average coefficients.