#include <math.h>
#include <time.h>
#include <assert.h>
-#include <common/memory.h>
#include <common/arith.h>
#include <topfish/hierarchy.h>
int **np)
{
int numNeighbors = 0;
- int *neighbors;
int i, j;
int level, node,active_level,found;
v_data neighborsInLevel;
neighborsInLevel = hierarchy->graphs[level][node];
nAllocNeighbors = 2 * neighborsInLevel.nedges;
- neighbors = N_NEW(nAllocNeighbors, int);
+ int *neighbors = gv_calloc(nAllocNeighbors, sizeof(int));
- stack = N_NEW(5 * hierarchy->nlevels + 1, int);
+ stack = gv_calloc(5 * hierarchy->nlevels + 1, sizeof(int));
for (i = 1; i < neighborsInLevel.nedges; i++) {
neighbor = neighborsInLevel.edges[i];
if (active_level == level) {
// neighbor is active - add it
if (numNeighbors >= nAllocNeighbors) {
+ neighbors = gv_recalloc(neighbors, nAllocNeighbors, 2 * nAllocNeighbors + 1,
+ sizeof(int));
nAllocNeighbors = 2 * nAllocNeighbors + 1;
- neighbors = RALLOC(nAllocNeighbors, neighbors, int);
}
neighbors[numNeighbors] =
hierarchy->geom_graphs[level][neighbor].globalIndex;
}
if (!found) {
if (numNeighbors >= nAllocNeighbors) {
+ neighbors = gv_recalloc(neighbors, nAllocNeighbors,
+ 2 * nAllocNeighbors + 1, sizeof(int));
nAllocNeighbors = 2 * nAllocNeighbors + 1;
- neighbors = RALLOC(nAllocNeighbors, neighbors, int);
}
neighbors[numNeighbors] =
hierarchy->geom_graphs[neighborLevel][neighbor].
if (hierarchy->geom_graphs[neighborLevel][neighbor].
active_level == neighborLevel) {
if (numNeighbors >= nAllocNeighbors) {
+ neighbors = gv_recalloc(neighbors, nAllocNeighbors,
+ 2 * nAllocNeighbors + 1, sizeof(int));
nAllocNeighbors = 2 * nAllocNeighbors + 1;
- neighbors =
- RALLOC(nAllocNeighbors, neighbors, int);
}
neighbors[numNeighbors] =
hierarchy->geom_graphs[neighborLevel][neighbor].