00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include <config.h>
00022
00023 #include <stdlib.h>
00024 #include "as.h"
00025
00026
00027
00028
00029
00030 struct as_data *
00031 as_init(int maxneighbors,
00032 int hashsize,
00033 int (*hashfunc)(struct as_coord),
00034 int (*neighborfunc)(struct as_coord, struct as_coord *, void *),
00035 double (*lbcostfunc)(struct as_coord, struct as_coord, void *),
00036 double (*realcostfunc)(struct as_coord, struct as_coord, void *),
00037 double (*seccostfunc)(struct as_coord, struct as_coord, void *),
00038 void *userdata)
00039 {
00040 struct as_data *adp;
00041
00042 AS_NEW(adp, struct as_data, NULL);
00043 AS_NEW_ARRAY(adp->neighbor_coords, struct as_coord,
00044 maxneighbors, NULL);
00045 AS_NEW_ARRAY(adp->neighbor_nodes, struct as_node *,
00046 maxneighbors + 1, NULL);
00047 AS_NEW_ARRAY(adp->hashtab, struct as_hash *, hashsize, NULL);
00048
00049 adp->maxneighbors = maxneighbors;
00050 adp->hashsize = hashsize;
00051 adp->hash = hashfunc;
00052 adp->neighbor = neighborfunc;
00053 adp->lbcost = lbcostfunc;
00054 adp->realcost = realcostfunc;
00055 adp->seccost = seccostfunc;
00056 adp->userdata = userdata;
00057
00058 return adp;
00059 }