I want to plot a multi-array I have created with the Boost library. I keep getting stuck inside my gnuplot-third party library (added in order to plot). Im having trouble sending the correct references from my multi-array I think. Here is my code:
//Vector with linspace
vector<double> points;
points = linspace(start_x, diff_x, 21);
//Pointer type and pointer
typedef vector<double> * point_ptr;
point_ptr p; //Pointer of type point_ptr.
p = &points; //Connect pointer to array
// Create a 2D array that is equal to meshgrid
typedef boost::multi_array<double, 2> array_type;
typedef array_type::index index;
array_type U(boost::extents[21][21]);
typedef boost::multi_array_types::index_range range;
array_type::array_view<2>::type myview = U[boost::indices[range()][range()]];
// Assign values to the elements
for (index i = 0; i != 21; ++i)
for (index j = 0; j != 21; ++j)
U[i][j] = (*p)[i];
gp << "set xrange [0:21]\nset yrange [0:21]\n";
gp << "set pm3d\n";
gp << "splot";
gp.send2d(myview);