/* -------------------------------- purpose -- free the ETree object created -- 95nov15, cca -------------------------------- */ void ETree_free ( ETree *etree ) { #if MYTRACE > 0 fprintf(stdout, "\n just inside ETree_free(%)", etree) ; fflush(stdout) ; #endif if ( etree == NULL ) { fprintf(stderr, "\n fatal error in ETree_free(%p)" "\n etree is NULL\n", etree) ; exit(-1) ; } ETree_clearData(etree) ; FREE(etree) ; #if MYTRACE > 0 fprintf(stdout, "\n leaving ETree_free(%)", etree) ; fflush(stdout) ; #endif return ; }
/* -------------------------------------------------------- purpose -- to read an ETree object from a formatted file return value -- 1 if success, 0 if failure created -- 95nov15, cca -------------------------------------------------------- */ int ETree_readFromFormattedFile ( ETree *etree, FILE *fp ) { int rc ; int itemp[2] ; /* --------------- check the input --------------- */ if ( etree == NULL || fp == NULL ) { fprintf(stderr, "\n error in ETree_readFromFormattedFile(%p,%p)" "\n bad input\n", etree, fp) ; return(0) ; } /* --------------------- clear the data fields --------------------- */ ETree_clearData(etree) ; /* --------------------------- initialize the ETree object --------------------------- */ ETree_init1(etree, 0, 0) ; /* ----------------------------- read in the two scalar fields ----------------------------- */ if ( (rc = IVfscanf(fp, 2, itemp)) != 2 ) { fprintf(stderr, "\n error in ETree_readFromFormattedFile(%p,%p)" "\n %d items of %d read\n", etree, fp, rc, 2) ; return(0) ; } etree->nfront = itemp[0] ; etree->nvtx = itemp[1] ; /* ----------------------- read in the Tree object ----------------------- */ Tree_readFromFormattedFile(etree->tree, fp) ; /* ------------------------------ read in the nodwghts IV object ------------------------------ */ IV_readFromFormattedFile(etree->nodwghtsIV, fp) ; /* ------------------------------ read in the bndwghts IV object ------------------------------ */ IV_readFromFormattedFile(etree->bndwghtsIV, fp) ; /* -------------------------------- read in the vtxToFront IV object -------------------------------- */ IV_readFromFormattedFile(etree->vtxToFrontIV, fp) ; return(1) ; }