| 1 |
/* |
| 2 |
* Copyright(C) 1999-2020 National Technology & Engineering Solutions |
| 3 |
* of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with |
| 4 |
* NTESS, the U.S. Government retains certain rights in this software. |
| 5 |
* |
| 6 |
* See packages/seacas/LICENSE for details |
| 7 |
*/ |
| 8 |
|
| 9 |
#include "params.h" // for MAXSETS |
| 10 |
#include "smalloc.h" // for smalloc |
| 11 |
|
| 12 |
void genvals2d( |
| 13 |
/* Create lists of sets of values to be sorted. */ |
| 14 |
double **xvecs, /* vectors to partition */ |
| 15 |
double *vals[4][MAXSETS], /* ptrs to lists of values */ |
| 16 |
int nvtxs /* number of values */ |
| 17 |
) |
| 18 |
{ |
| 19 |
int nlists = 4; /* number of lists to generate */ |
| 20 |
double *temp[4]; /* place holders for vals */ |
| 21 |
int i; /* loop counter */ |
| 22 |
|
| 23 |
for (i = 0; i < nlists; i++) { |
| 24 |
temp[i] = smalloc(nvtxs * sizeof(double)); |
| 25 |
} |
| 26 |
|
| 27 |
for (i = 1; i <= nvtxs; i++) { |
| 28 |
temp[0][i - 1] = 4 * xvecs[1][i]; |
| 29 |
temp[1][i - 1] = 4 * xvecs[2][i]; |
| 30 |
temp[2][i - 1] = 4 * (xvecs[1][i] + xvecs[2][i]); |
| 31 |
temp[3][i - 1] = 4 * (xvecs[2][i] - xvecs[1][i]); |
| 32 |
} |
| 33 |
|
| 34 |
vals[0][1] = vals[1][0] = vals[2][3] = vals[3][2] = temp[0]; |
| 35 |
vals[0][2] = vals[2][0] = vals[1][3] = vals[3][1] = temp[1]; |
| 36 |
vals[0][3] = vals[3][0] = temp[2]; |
| 37 |
vals[1][2] = vals[2][1] = temp[3]; |
| 38 |
} |