octave-maintainers
[Top][All Lists]
Advanced

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

Re: problem with fem-fenics


From: Juan Pablo Carbajal
Subject: Re: problem with fem-fenics
Date: Tue, 23 Jul 2013 16:53:55 +0200

On 7/23/13, Marco Vassallo <address@hidden> wrote:
> Hi Jpi,
>
> I've find the way to produce some output with your code,
>  so don't spend time providing me an example.
>
> Thanks again, it is really  a good help for me
>
> marco
>
> From: address@hidden
> To: address@hidden
> Subject: RE: problem with fem-fenics
> Date: Tue, 23 Jul 2013 11:27:39 +0200
> CC: address@hidden
>
>
>
>
>> Date: Mon, 22 Jul 2013 17:18:32 +0200
>> Subject: Re: problem with fem-fenics
>> From: address@hidden
>> To: address@hidden
>> CC: address@hidden
>>
>> On Mon, Jul 22, 2013 at 4:29 PM, Marco Vassallo
>> <address@hidden> wrote:
>> > I would really appreciate also if you could tell me if I can see
>> > somewhere
>> > this code that you have produced in the past.
>>
>> Here you have an example done in Python that manipulates strings, it
>> is slow but it works. Python is very well designed to do this kind of
>> things.
>> http://ubuntuone.com/7I2kMksCiSCysEqelr5WUN
>> Ask me if there is something that is not clear.
>
> Hi Jpi,
> Thanks for the example!
> Could you also tell me how can I run a small example which uses your code?
> Because I'm having some trouble using it :-)
> In fact I think that if I see the output I can also understand
> better how things work.
>
>> If you want to do it in Octave, I would suggest doing some C++ parser
>> using for example tinyxml (1 or 2, though 2 seems more adequate)
>> http://www.grinninglizard.com/tinyxml2/index.html or any other DOM
>> structure. You could use Octave structs, but I think that could be
>> quite painful and un-maintainable. You could also define your own
>> class, though again, seems like re-inventing the wheel. Remeber that
>> you are creating and interface, therefore maintainability should have
>> high priority, because things will change!
>>
>
> Looking at your example, I agree with you that Python seems to be really
> better for this problem,
> so I will try to use it instead of Octave or C++.
>
> Thanks again
>
> marco
>
>> Basically you need the static data (all of your file that will
>> never-ever change dynamically). That can be hard-coded into your
>> parser.
>> Then you need to have an object/function that fills in the xml DOM
>> with the dynamic data. Then you have a XML2C method/function that is
>> in charge of creating the file with the right name and code. A method
>> that finds out how to compile the file and generates the corresponding
>> command would also be useful. For these you need to check for features
>> of the OS, I wouldn't recommend doing this natively form Octave but
>> rather use python or M4 or any other language meant to do this.
>>
>> Finally, do not over do it. Think of ecological-balance, the problem
>> description file is small, therefore your first version of the
>> parser/generator should be small as well. Just spend some time
>> thinking on maintainability and potential extension.
>>
>> Another final comment, :D, among us there are true computer scientist
>> that have worked on automatic-code generation
>> Here is a link to the discussion I had some time ago (at the end I did
>> it with python)
>> http://octave.1599824.n4.nabble.com/Automatic-code-generation-td3990003.html
>> Try asking them directly (keeping list in CC), for ideas suggestions.
>>
>> I hope this helps.
>>
>> JPi
>                                                                               

Hi Marco,

The example is slow, have it in mind, cause it uses regex, which
aren't optimal. That is is an example using strings. A DOM may offer
better performance and flexibility.

Use with care.

Cheers


-- 
JuanPi Carbajal
-----
"Ave Imperator, moritvri te salvtant"
Naumachiarii, AD 52


reply via email to

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