|
[Date Index]
[Thread Index]
[Author Index]
C-pointers from Mathematica
- To: mathgroup at smc.vnet.net
- Subject: [mg112968] C-pointers from Mathematica
- From: Bruno Silva <bfasilva at gmail.com>
- Date: Fri, 8 Oct 2010 04:49:53 -0400 (EDT)
Dear all,
I want to use Mathematica to transform a nonlinear PDE to its equivalent
finite difference expression under a particular discretization scheme, and
finally export the result to a C source file.
I manage to do the first part of the job but the problem arrives when
translating Mathematica variable to C-program pointers.
I want to transform T[x] -> * (profile + i), meaning that the value of "T"
at point "x" (inside Mathematica) is equivalent to the "i-th" value in
pointer "profile" (inside file.c).
Because Mathematica doesn't allow me to use the C-pointer sign * that way, I
thought replacing T[x] by a string would solve the problem (
T[x]->"*(profile+i)" ) but this does not work because, as soon as I apply
CForm to the result, the string symbol "..." is kept inside the expression I
would like to write in file.c :
T[x]/.T[x] -> "*(profile+i)"
CForm[%]
Does anyone know how to overcome this difficulty?
Thanks in advance,
Bruno
Prev by Date:
Re: A list based table join?
Next by Date:
Re: A list based table join?
Previous by thread:
F Mathematica crashes
Next by thread:
Re: C-pointers from Mathematica
|