Dear friends:
The function "DBPutQuadvar1" in silo library need input into the following two dimensional array "comp" which in defined as following in the tutorial:
But it output different results. Does the vector<vector<double>> works in the same way with the 2D c array?
Could you please give me some suggestions.
Regards
> vector<vector<double>> works in the same way with the 2D c array?
No. An MxN 2D c array is an array of arrays; it contains M*N contiguous elements
What we require here - double *comp[2]; - is a 1D array containing two pointers:
We can create it this way:
1 2 3 4 5 6
// create the vector: uv_var consists of 2 vectors, each vector is of size Grid.NX*Grid.NY
vector<vector<double>> uv_var( 2, vector<double>(Grid.NX*Grid.NY) );
// create a c-style array containing two pointers (pointing to the first items in the vectors uv_var[0] and uv_var[1])
double* comp[2] = { std::addressof( uv_var[0].front() ) , std::addressof( uv_var[1].front() ) };
// pass comp to the library