# What are the valid operations on an fespace?

Hi everyone!

I’m a total beginner at using FreeFEM++. I wanted to calculate the negative part of an fespace X by using

max(-X, 0.0);

but it didn’t work. Instead, I used a loop like this:

for(int i = 0; i < Vh.ndof; ++i) {
X[i] = max(-X[i], 0.0);
}

which worked. I understand that max doesn’t apply to fespaces. But some operations do apply. I tried searching the documentation but I couldn’t find a list of what are valid operations. Can anyone help?

You can get max an min of the array of you degrees of freedom like this

cout << X.min<< " "<< X.max <<endl;

first X is not a fespace but a function in fespace.

if you call Vh the fespace, then X is defined by
Vh X;
then
Vh X0 = max(-X,0.0); // work !

Hi Frederic,

Yes, of course, the code looks like

fespace Vh(Th, P1);
Vh X;

OH I see, so

X = max(-X,0);

does not work, but

X0 = max(-X,0);

does. I just wanted to replace X, but I need an intermediate point.

So “max” is a valid operation. Great! Do you know where the others are listed…?