void createHashTables() // // Input: none // Output: returns error code // Purpose: allocates memory for object ID hash tables // { int j; MemPoolAllocated = FALSE; for (j = 0; j < MAX_OBJ_TYPES ; j++) { Htable[j] = HTcreate(); if ( Htable[j] == NULL ) report_writeErrorMsg(ERR_MEMORY, ""); } // --- initialize memory pool used to store object ID's if ( AllocInit() == NULL ) report_writeErrorMsg(ERR_MEMORY, ""); else MemPoolAllocated = TRUE; }
int openqual() /* **-------------------------------------------------------------- ** Input: none ** Output: returns error code ** Purpose: opens WQ solver system **-------------------------------------------------------------- */ { int errcode = 0; int n; /* Allocate memory pool for WQ segments */ OutOfMemory = FALSE; if (AllocInit() == NULL) errcode = 101; /* Allocate scratch array & reaction rate array*/ X = (float *) calloc(MAX((Nnodes+1),(Nlinks+1)),sizeof(float)); R = (float *) calloc((Nlinks+1), sizeof(float)); ERRCODE(MEMCHECK(X)); ERRCODE(MEMCHECK(R)); /* Allocate memory for WQ solver */ n = Nlinks+Ntanks+1; FirstSeg = (Pseg *) calloc(n, sizeof(Pseg)); LastSeg = (Pseg *) calloc(n, sizeof(Pseg)); FlowDir = (char *) calloc(n, sizeof(char)); n = Nnodes+1; VolIn = (float *) calloc(n, sizeof(float)); MassIn = (float *) calloc(n, sizeof(float)); ERRCODE(MEMCHECK(FirstSeg)); ERRCODE(MEMCHECK(LastSeg)); ERRCODE(MEMCHECK(FlowDir)); ERRCODE(MEMCHECK(VolIn)); ERRCODE(MEMCHECK(MassIn)); return(errcode); }