octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [fem-fenics] Function evaluation


From: Marco Vassallo
Subject: Re: [fem-fenics] Function evaluation
Date: Sat, 28 Jun 2014 11:57:02 +0200




On Fri, Jun 27, 2014 at 6:10 PM, Eugenio Gianniti <address@hidden> wrote:

On 27 Jun 2014, at 00:46, Eugenio Gianniti <address@hidden> wrote:


On 26 Jun 2014, at 23:53, Marco Vassallo <address@hidden> wrote:




On Wed, Jun 25, 2014 at 1:06 PM, Eugenio Gianniti <address@hidden> wrote:
Dear Marco,

you can find on the hg repository [1] my latest work on the function evaluation feature and in my blog a post [2] about it. Note that the interface change highlighted in the post has already been implemented, later I will write a post to document it and show how it can be used.

Thanks, the two blogpost where really good.
 

My second doubt is related to the association of fem-fenics functions with function handles. I tried to go through the code base in order to understand what to do, but I cannot quite get it. I expect that the function class should inherit from octave_function, but it is not enough, because if I type "handle = @function" Octave complains about not finding a function or a method to attach to the handle. Basically I grasp that there is some preparation made when a regular function is loaded, probably meant to make it available in the symbol table, that the fem-fenics function class lacks. To be honest, I do not even know if it is possible for something to be at the same time both a function and a variable, which is what I try to accomplish. If you think it is something feasible, I would need an explanation, otherwise I look forward to suggestions on an alternative approach.

I'm not sure if I understand what you want to do.
In the script file you'd llke to have the possibility to do something like this:

.....
u = Function ('u', solution, 1);
....
U = @(x, y) u(x, y);

.....

f = u (1, 2);

Is it right? If yes, what is the code you have written right now for this case?

Yes and no. My first attempt was to just make function inherit from octave_function, hoping it would allow a call like:
U = @u;
but I found out that being a derived class of octave_function is not enough. The syntax you suggest half works, i.e. U gets correctly assigned the @(x, y) u (x,y) “value”, but then trying to use it Octave errors out saying that no indexing operation can be performed for the function type. Probably what is missing is another subsref, since in octave_base_value there are some five signatures, so tomorrow I will try to get the job done following this path.

I managed to make fem-fenics functions callable also via anonymous functions, as suggested. The changeset is already in my repository. I think that this feature is currently quite satisfactory, however let me know if anything should be made better.

 
Yes I've seen, your solution seems to be really good. I think that before moving to the next step, it could be helpful to prepare a new release of the pkg with all the changes you have so far. In order to do that, please update the Description and pkg list files. Once you have done it, please follow the guidelines described here [1]. Remember to delete all the unnecessary files.
Before submitting it to octave-forge, please send it to me so that I can check it.

Marco
[1] http://octave.sourceforge.net/developers.html




reply via email to

[Prev in Thread] Current Thread [Next in Thread]