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: Sun, 18 May 2014 13:29:39 +0000

On May 18, 2014 9:17 AM, Marco Vassallo <address@hidden> wrote:
>
>
>
>
> On Sat, May 17, 2014 at 12:25 PM, Eugenio Gianniti <address@hidden> wrote:
>>
>>
>> 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.
>>
> Ok it seems a good plan
> Eugenio thank you very much for your post updating on the interpolate 
> function.
> Can you please add an example explaining how to use the function?

I added a new post [1] with an example and submitted a second patch [2] adding 
a Python-like interface. Let me know what you think of it.

Eugenio

[1] 
http://gsoc2014-eg123.blogspot.it/2014/05/my-first-function-follow-up.html?m=1
[2] http://savannah.gnu.org/patch/?8460

>
> Marco
>
>> Eugenio
>>
>>>  
>>>>
>>>> Thank you and have a nice weekend,
>>>> Eugenio
>>>
>>>
>>
>

reply via email to

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