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

# RE: [femm] Re: Lua sample of line integral

- To: femm@yahoogroups.com
- Subject: RE: [femm] Re: Lua sample of line integral
- From: Keith Gregory <k.gregory@lboro.ac.uk>
- Date: Mon, 20 Aug 2001 22:12:04 +0100
- In-reply-to: <000001c12994$e8f5b540$0200a8c0@.hirstmagnetics>
- References: <253D3D5DE6D6F04092A36D739A8F2976013B04@dvrfile.dvrhome.com>

`Robin,`
`I like the mods. The save bitmap is now working OK and I'm managing to pass filenames between scripts OK, but....`
`show_density_plot() seems to be ignoring the parameters and just does a default plot no matter what.`
`Keith.`
`At 17:26 20/08/01 +0100, you wrote:`

>     If your feeling brave then give the 3.1 patch a try it has a way of passing
>     variables to the post processor
>     (available from the femm files section)

> `the new version of run_post accepts variables as so`
> `in the pre-processor script try`

>     run_post("c:\\my-lua-script.lua","-lua-var=filename=myfilename","-lua-var=ms
>     g=hello-world")

> `then in the post processor`

>     try
>     _ALERT(msg)
>     _ALERT(filename)

> `and you will see hello world for msg and myfilename for filename`

>     You can use these variables any where you would normally use variables in an
>     lua script !!

>     All variables are passed as strings so you will have to use internal
>     conversion routines to get numbers out

>     Hopefully this will make peoples lives a lot easier than using temp files to
>     pass data around
>     (There is no way of passing data back the other way however without using
>     temp files)

> `
> Regards`
> `Robin Cornelius`
> ``

>     -----Original Message-----
>     From:
>     sentto-1333690-616-998317264-robin.cornelius=hirst-magnetics.com@returns
>     .onelist.com
>     [mailto:sentto-1333690-616-998317264-robin.cornelius=hirst-magnetics.com
>     @returns.onelist.com]On Behalf Of Carl Kopin
>     Sent: 20 August 2001 15:22
>     To: femm@yahoogroups.com
>     Subject: RE: [femm] Re: Lua sample of line integral

> `
> Hi Jim,`
> `Try this:`
> `In the preprocessor create your file like this:`

>     handle=openfile('mydata.txt','w')
>     write(handle,'my comment 1\n', 'my comment
>     2\n',data1,'\n',data2[,'\n',data3[,...]])
>     closefile(handle)

> `
> In the postprocessor read your file as follows:`

>     handle=openfile('mydata.txt','r')
>     line1,line2,d1,d2=read(handle,'*l','*n','*n')
>     close(handle)

>     Writing the mydata.txt file is simple, the trick is to properly read it.
>     If you ad a comment line or to in the beginning of your file, you have
>     to read it it/them first before your data, that's why you add '*l' ( the
>     "l" is a lower case L, which means to read whole line) in the beginning
>     one for each line, and then you add the '*n' (to read numbers) as many
>     times as needed to read your data. You don't need to read the whole
>     file, but you must read it from the very beginning to the last point of
>     your interest. You do not need your comment lines in your postprocessor,
>     but you must read them to a "junk" var in order to access the data part.
>     To send/read characters, in the preprocessor use the form of 'my
>     char\n', in the postprocessor use '*w' that stands for word. You can use
>     "new line" (\n) or tab (\t) as your delimiters. (Are spaces OK, too? I
>     am not sure, did not try.)

>     I think, this will help you (and possibly others, too).
>     Other comments are welcomed.
>     Carl

>     -----Original Message-----
>     From: jim271@hotmail.com [mailto:jim271@hotmail.com]
>     Sent: Sunday, August 19, 2001 08:23
>     To: femm@yahoogroups.com
>     Subject: [femm] Re: Lua sample of line integral

> `Dave,`
> `Thank you for the example. This is very helpful.`

>     Dave: " As far as getting information from one iteration to the next,
>     or from the preprocessor to the postprocessor, perhaps the easiest
>     way to do this is via the use of a temporary file. I have used a
>     temporary file in this example to send the current plunger position
>     to the postprocessor so that it can write this piece of info to the
>     output file. "

>     I can get the post processing file to read one variable that is
>     passed by the main script file, but I can't seem to get it to read
>     two or more data values from the same line of the data file.

>     Can someone please show an example of reading multiple variables from
>     a file by the post processor?

> `-- Jim`
> ``
> ``

>     Your use of Yahoo! Groups is subject to
>     http://docs.yahoo.com/info/terms/

> ``
> ``
> ``
> `Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/`
> ``
> ``
> `Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/`

``

- Follow-Ups:
  - RE: [femm] Re: Lua sample of line integral
    - From: "Robin Cornelius" <robin.cornelius@btinternet.com>

- References:
  - RE: [femm] Re: Lua sample of line integral
    - From: "Carl Kopin" <ckopin@davinciresearch.com>
  - RE: [femm] Re: Lua sample of line integral
    - From: "Robin Cornelius" <robin.cornelius@hirst-magnetics.com>

- Prev by Date: Re: [femm] new Lua features
- Next by Date: RE: [femm] Re: Lua sample of line integral
- Previous by thread: RE: [femm] Re: Lua sample of line integral
- Next by thread: RE: [femm] Re: Lua sample of line integral
- Index(es):
  - Date
  - Thread