Gridap.jl icon indicating copy to clipboard operation
Gridap.jl copied to clipboard

Improve docs for `testargs` and `return_value`.

Open amartinhuertas opened this issue 4 years ago • 2 comments

Remove testargs and use return_value. Better doc for return_value. Can we extract doc from inference?

amartinhuertas avatar Dec 09 '20 07:12 amartinhuertas

I have realized that removing testargs is not as easy as expected. Thanks to testargs, we can provide a default implementation of return_value for the gradient and the gradient of the gradient of a given function.

h(x) = sqrt(x[1]-one(x[1]))
f = GenericField(h)

Arrays.testargs(::typeof(h),x) = (Point(map(one,x.data)),)

# The following works thanks to testargs
return_value(∇(f),Point(0,0))
return_value(∇∇(f),Point(0,0))

See https://github.com/gridap/Gridap.jl/blob/4342137dfbe635867f39e64ecb01e8dbbc5fa6e7/test/FieldsTests/FieldInterfacesTests.jl#L165

Without testargs I do not know how to achieve this behavior.

So, I would simply keep it and move on to other more priority topics.

fverdugo avatar Dec 09 '20 14:12 fverdugo

I remove this issue from the milestone v0.15.0.

I do not close it since the doc for testargs and return_value can be added anyway at any time.

fverdugo avatar Dec 09 '20 14:12 fverdugo