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: Mon, 22 Jul 2013 17:18:32 +0200

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.

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!

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


reply via email to

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