octave-maintainers
[Top][All Lists]
Advanced

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

Re: [fem-fenics] Function evaluation


From: Eugenio Gianniti
Subject: Re: [fem-fenics] Function evaluation
Date: Thu, 26 Jun 2014 22:46:03 +0000


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.

Eugenio



reply via email to

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