MathGroup Archive 1998

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: error from MathLink, plotting results from a c++ simulation

  • To: mathgroup at smc.vnet.net
  • Subject: [mg15047] Re: [mg15019] error from MathLink, plotting results from a c++ simulation
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Wed, 9 Dec 1998 04:12:30 -0500
  • Organization: Universitaet Leipzig, Institut fuer Informatik
  • References: <199812050630.BAA04532@smc.vnet.net.>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi Richard,

a) try to call addtwo.exe with the full path i. e.
lnk=Install["c:/Programs/Wolfram
Research/Mathematica/3.0/AddOns/MathLink/Examples/addtwo/addtwo.exe"]

b) it is a bit strange to simulate the data, write it to a file and let
Mathematica read the file.
   Say you have the data in a array  u of doubles (1 D) and your
simulation makes n steps.
  With

  MLPutFunction(stdlink,"List",n);
  for(i=0; i<n; i++) {
    ..do one time step ..
    MLPutRealList(stdlink,u,LengthOfU);
  }

will avoid the writing & reading the file.

Hope that helps
  Jens


"Richard W. Singerman" wrote:

> Hi,
>
> I'm using Mathematica on a Windows95 machine. I want to use MathLink.
> I've read the developers kit documentation and I'm trying get the
> addtwo.exe to install. However, I get an error message.  Comments would
> be helpful.
>
> Install["addtwo.exe`"]
>
> and
> Install["addtwo.exe"]
>
> give the same response
>
> LinkOpen::"linkf": "\!\(LinkOpen[\"addtwo.exe`\"]\) failed."
>
> However addtwo.exe appears in the path.
>
> Please comment.
>
> Question2:  Once I have this working, I want to use mathematica to
> display results from a C++ simulation of wave propagation.  I wanted to
> see the results as the simulation marched through time steps. I plan
> todo  this by writing each time step result (the wave at a given time)
> to the file tmpwaveresults. Then I would do
>
> MLPutFunction( link, "ToExpression", 1); MLPutString( link,
> "wave=Readlist["tmpwaveresults", Number, RecordLsts->True"]
>
> MLPutFunction( link, "ToExpression", 1);
>     MLPutString(link, "ListDensityPlot[wave]")
>
> I'd like to eventually make a movie of the wave propagation.
>
> Please comment.
>
> --Richard Singerman



  • Prev by Date: Re: What's wrong in this plot?
  • Next by Date: Re: What's wrong in this plot?
  • Previous by thread: error from MathLink, plotting results from a c++ simulation
  • Next by thread: Bug in PolynomialReduce