For backward compatibility (for those who have written many of their codes
with both Opensees and tcl/tk), I would like to support the existing tcl/tk
layer. So it seems I have to do this one.

{
If you're willing to put in a lot more work for better performance (or
if tkinter just works), you could build a wrapper that links to
libtcl, so that you would have your Python interpreter and your TCL
interpreter in the same process.  Then each TCL object would be
wrapped by a Python object, much as in the previous case; but you
wouldn't have to worry about cross-process communication.  This is how
Sage's libpari interface to Pari works.  This is also, I think, how
Python's tkinter tcl/tk-based graphics toolkit works.  I don't know
enough about tkinter, but it's possible that you could use the tkinter
support to run OpenSees programs with very little extra work.
}

Thanks for these specific explainations. They will be very useful for me to
go ahead... :)


On Sun, Nov 23, 2008 at 8:03 PM, Carl Witty <[EMAIL PROTECTED]> wrote:

>
> On Nov 23, 8:44 am, "ahmet alper parker" <[EMAIL PROTECTED]> wrote:
> > Hi,I want to integrate Opensees program into Sage. How can I do that? It
> is
> > extending the tcl language with its own commands. Its site ishttp://
> opensees.berkeley.edu. If anyone has something tp comment on this
> > issue, they are welcome.
> > Regards...
> > AAP
>
> There are lots of possibilities here, with tradeoffs in the amount of
> work required, the ease of use, the execution speed of the resulting
> system, the level of capability, etc.
>
> The easiest would be if you don't need all the capabilities of
> OpenSees.  If you only need to run one (or a few) kinds of simulations
> (but with many different sets of parameters, say), then you could
> write a little TCL/OpenSees program for each kind of simulation that
> takes the parameters on the command line, runs the simulation, and
> then prints out the results; then you could write Python wrappers for
> each of these programs.  In Sage, this is similar to how sage/
> interfaces/phc.py and sage/interfaces/rubik.py work.
>
> If you want to support existing OpenSees users (who are familiar with
> TCL), you could have an interface where you write your OpenSees TCL
> scripts, and then a little wrapper runs TCL/OpenSees, sends over the
> entire TCL script, and reads back the results.
>
> If you want to hide the use of TCL altogether, and provide a Python
> interface to all the capabilities of OpenSees, then you might be able
> to build on sage/interfaces/expect.py .  This is how the Sage wrappers
> for Mathematica/Maxima/Magma/etc. work; there are underlying objects/
> values in the system you're wrapping, and Python objects that
> correspond to these underlying objects.  Each operation on the Python
> objects is actually sent to the underlying system and performed there;
> then a new Python object is created to represent the result (which is
> actually kept in the underlying system).
>
> If you're willing to put in a lot more work for better performance (or
> if tkinter just works), you could build a wrapper that links to
> libtcl, so that you would have your Python interpreter and your TCL
> interpreter in the same process.  Then each TCL object would be
> wrapped by a Python object, much as in the previous case; but you
> wouldn't have to worry about cross-process communication.  This is how
> Sage's libpari interface to Pari works.  This is also, I think, how
> Python's tkinter tcl/tk-based graphics toolkit works.  I don't know
> enough about tkinter, but it's possible that you could use the tkinter
> support to run OpenSees programs with very little extra work.
>
> For vastly more extra work and some extra performance, you could fork
> OpenSees and replace the TCL bindings with Python.  I haven't looked
> at the OpenSees source, so I don't know how hard this would be.  This
> is similar to Sage's pynac, which is a fork of GiNaC modified to use
> Python data structures.
>
> Hope this helps.
>
> Carl
> >
>

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to