Dear all,
my question is specific and regards the data transfer between Matlab and a
dealii program. In a nutshell, I have to call my dealii program from Matlab
with a Matlab vector as argument (my dealii program needs the values in the
vector). I figured out that Mex files are one way to transfer data to a c++
program.
Here is a snippet of my Matlab script:
function res = fun(p,y)
s = call_my_dealii_program_passing_the_vector_p
res = s - y;
end
My issue is *how to pass the vector 'p' to the dealii program*.
There are MEX files which provide an interface between Matlab and C++
programs. A standard MEX file looks like this:
//file mymex.cpp
#include "mex.h"
//include some more header files from c++ or dealii
//write here the whole class definition and implemenation
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
//this is the interface function to Matlab where also 'p' is passed
//in here, I will also create the instance of my dealii program to run the
typical member //functions ike make_grid(), system_setup(),...
}
The above mex file is compiled within the Matlab gui using a c++ compiler
(mex mymex.cpp).
If I do not include any dealii headers in mymex.cpp , the compilation
works.
However, including dealii headers results in a bunch of error messages when
I compile the program in Matlab (mex mymex.cpp), because environment
variables are not known to Matlab,...
Usually, I just call 'spack load dealii' followed by 'make run' to run my
dealii programs, but I do not know how to 'forward' all this information to
the Matlab compilation process.
All that said, has someone already worked with Mex files together with
dealii?
I also appreciate other approaches to manage the data transfer between
Matlab and dealii.
Best
Simon
--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see
https://groups.google.com/d/forum/dealii?hl=en
---
You received this message because you are subscribed to the Google Groups
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/dealii/b047d35d-b3e3-465b-88d8-c708343086bfn%40googlegroups.com.