dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #14445
problem with Rectangle::coordinates()
I am trying to use the coordinates() function in c++. When I tested it out using python to see how it worked, I got back what seemed like a 2d numpy array, athough it could have been a one dimensional array of arrays. When I tried to use it in C++ I assumed that I needed to do this:
double **coordinates;
coordinates = rectangle.coordinates();
which gave me an error because the coordinates() function returns a double* not a double**
I wrote a little program to test the output of the coordinates() function:
#include <dolfin.h>
#include <iostream>
using namespace dolfin;
int main()
{
Rectangle rectangle(0.0, 0.0, 1, 2, 3, 7, Rectangle::right);
double *coordinates;
coordinates = rectangle.coordinates();
for (int j = 0; j < 64; j++)
std::cout << coordinates[j] << std::endl;
}
which didn't even compile and I can't make sense of the pages of error msgs I got. I tried commenting out the for loop and there was no change. My question is twofold. First, how do I use this function in C++ and get it to compile, and second, what does the output look like? I assumed the resulting 1d array would be [x0, y0, x1, y1, .... , xn, yn]. Is that in fact the case?
Thank you for your help
Phil
Follow ups