octave-maintainers
[Top][All Lists]
Advanced

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

Re: [fem-fenics] interpolate


From: Eugenio Gianniti
Subject: Re: [fem-fenics] interpolate
Date: Sat, 17 May 2014 10:25:17 +0000


On 17 May 2014, at 10:09, Marco Vassallo <address@hidden> wrote:




On Sat, May 17, 2014 at 9:30 AM, Eugenio Gianniti <address@hidden> wrote:
Dear Marco,

I am writing the post on the blog as you asked me, but meanwhile I have some doubts I would like to discuss. With the first draft I just focused on obtaining something that compiled and could be used without crashing Octave, but now I am thinking of its meaning from the user’s point of view.

In the first place, having forced a method thought for an object oriented language into Octave, now the interface that interpolate offers is quite counter-intuitive. To address the issue I would make it similar to the interpolate function of the Python version, which gets as input a Function and a FunctionSpace. For the future I believe this to be the best approach, do you agree?

As a second point, dolfin takes as argument the dolfin::GenericFunction class, which is the base class dolfin::Function and dolfin::_expression_ derive from. Is there a way to check if an Octave value is in this hierarchy other than performing each check by hand? My first idea would be to create a small C++ function to do so, with calls such as
args(0).type_id () == function::static_type_id ()
and the one for coefficient, then it returns true if it finds one of the two. Anyway I would think that in Octave there is already something doing this job, may you tell me more about it?

I'm not sure if I understand you correctly.
Instead of doing 

    if (args(0).type_id () == function::static_type_id ())
    ....
  else if (args(0).type_id () == coefficient::static_type_id ())
    ....

you would like to do something like
     if (generic_function(args(0).type_id ()) == true)
      ....

where generic_function is something that return true if it is a coefficient or a function?
marco

Basically yes. Anyway I noticed that function and coefficient offer different methods to get the dolfin object they wrap, so this approach would entail renaming them all over the place or redesigning the hierarchy to fit a generic_function class in. I will just stick with explicitly checking each type and then acting accordingly.

Eugenio

 
Thank you and have a nice weekend,
Eugenio



reply via email to

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