-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmeshgrid.cpp
More file actions
38 lines (34 loc) · 836 Bytes
/
Copy pathmeshgrid.cpp
File metadata and controls
38 lines (34 loc) · 836 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/*************************************************
Function: meshgrid
Description: Create 2-D grid coordinates with
X-coordinates defined by the vector A and
Y-coordinates defined by the vector B.
Author:Ryan
Date:2017-08-29
*************************************************/
#include "BiharmonicSplineInterp.h"
void meshgrid(vector<double> &A, vector<double> &B, vector<vector<double> > &X, vector<vector<double> > &Y)
{
int WIDTH = A.size();
int HEIGHT = B.size();
// Initialize vector X and Y.
X.resize(HEIGHT);
for(int i = 0; i < HEIGHT; i++)
{
X[i].resize(WIDTH);
}
Y.resize(HEIGHT);
for(int i = 0; i < HEIGHT; i++)
{
Y[i].resize(WIDTH);
}
for(int i = 0; i < HEIGHT; i++)
{
for(int j = 0; j < WIDTH; j++)
{
X[i][j] = A[j];
Y[i][j] = B[i];
}
}
}
/*************************************************/