Exemple #1
0
/*
 * ***************************************************************************
 * Routine:  Gem_dtor
 *
 * Purpose:  Geometry manager destructor.
 *
 * Author:   Michael Holst
 * ***************************************************************************
 */
VPUBLIC void Gem_dtor(Gem **thee)
{
    int i;

    VASSERT( (*thee) != VNULL );
    if ((*thee) != VNULL) {

        if ((*thee)->iMadePDE) {
            PDE_dtor_default( &((*thee)->pde) );
        }

        Vset_dtor( &((*thee)->vertices) );
        Vset_dtor( &((*thee)->edges) );
        Vset_dtor( &((*thee)->simplices) );
        for (i=0; i<VMAXSQ; i++) {
            Vset_dtor( &((*thee)->sQueM[i]) );
        }

        VDEBUGIO("Gem_dtor: DESTROYING object..");
        if ((*thee)->iMadeVmem) Vmem_dtor( &((*thee)->vmem) );
        Vmem_free( VNULL, 1, sizeof(Gem), (void**)thee );
        VDEBUGIO("..done.\n");

        (*thee) = VNULL;
    }
}
Exemple #2
0
VPUBLIC void Vcsm_dtor2(Vcsm *thee) { 
    int i;

    if ((thee != VNULL) && thee->initFlag) {

        for (i=0; i<thee->msimp; i++) {
            if (thee->nsqm[i] > 0) Vmem_free(thee->vmem, thee->nsqm[i], 
              sizeof(int), (void **)&(thee->sqm[i]));
        }
        for (i=0; i<thee->natom; i++) {
            if (thee->nqsm[i] > 0) Vmem_free(thee->vmem, thee->nqsm[i], 
              sizeof(int), (void **)&(thee->qsm[i]));
        }
        Vmem_free(thee->vmem, thee->msimp, sizeof(int *), 
          (void **)&(thee->sqm));
        Vmem_free(thee->vmem, thee->msimp, sizeof(int),
          (void **)&(thee->nsqm));
        Vmem_free(thee->vmem, thee->natom, sizeof(int *), 
          (void **)&(thee->qsm));
        Vmem_free(thee->vmem, thee->natom, sizeof(int),
          (void **)&(thee->nqsm));

    }
    Vmem_dtor(&(thee->vmem));
}
Exemple #3
0
void apbsfinal_() {
    unsigned long int bytesTotal, highWater;
    int i;

    VASSERT(nosh != VNULL);

     /* Kill the saved potential Vgrids */
    for (i=0; i<2; i++){
      Vgrid_dtor(&permU[i]);
      Vgrid_dtor(&indU[i]);
      Vgrid_dtor(&nlIndU[i]);
    }

    Valist_dtor(&alist[0]);
    /* Saving the kappa and dielectric maps is under consideration.
    killKappaMaps(nosh, kappaMap);
    killDielMaps(nosh, dielXMap, dielYMap, dielZMap);
    */
    NOsh_dtor(&nosh);

    /* Clean up MALOC structures */
    bytesTotal = Vmem_bytesTotal();
    highWater = Vmem_highWaterTotal();

    /*
    printf(" Final APBS memory usage: %4.3f MB total, %4.3f MB high water\n\n",
     (double)(bytesTotal)/(1024.*1024.),(double)(highWater)/(1024.*1024.));
    */

    Vmem_dtor(&mem);
    Vnm_tstop(APBS_TIMER_WALL_CLOCK, "APBS WALL CLOCK");
    Vcom_finalize();
    Vcom_dtor(&com);
}
Exemple #4
0
/*
 * ***************************************************************************
 * Routine:  Bmat_dtor
 *
 * Purpose:  The block sparse matrix destructor.
 *
 * Notes:    This destructor does the reverse of Bmat_ctor, and if 
 *           necessary first reverses Bmat_initStructure
 *           (or Bmat_copyStructure).  I.e., if necessary,
 *           it first frees the large integer and real arrays created by
 *           Bmat_initStructure or Bmat_copyStructure, and then frees the
 *           Bmat object itself at the last moment.
 *
 * Author:   Michael Holst
 * ***************************************************************************
 */
VPUBLIC void Bmat_dtor(Bmat **thee)
{
    int p, q;

    /* VASSERT( (*thee) != VNULL ); */
    if ((*thee) != VNULL) {

        /* first free any coarse guy */
        if ( (*thee)->coarse != VNULL ) {
            Bmat_dtor( &((*thee)->coarse) );
        }

        /* next free the large integer and real nonzero structure */
        Bmat_killStructure(*thee);

        /* kill the submatrices themselves */
        Mat_dtor( &((*thee)->AG) );
        for (p=0; p<(*thee)->numB; p++) {
            for (q=0; q<(*thee)->numB; q++) {
                if ( !(*thee)->mirror[p][q] ) {
                    Mat_dtor( &((*thee)->AD[p][q]) );
                }
            }
        }

        /* now kill the object itself */
        VDEBUGIO("Bmat_dtor: DESTROYING object..");
        if ((*thee)->iMadeVmem) Vmem_dtor( &((*thee)->vmem) );
        Vmem_free( VNULL, 1, sizeof(Bmat), (void**)thee );
        VDEBUGIO("..done.\n");

        (*thee) = VNULL;
    }
}
Exemple #5
0
VPUBLIC void Vgreen_dtor2(Vgreen *thee) { 

#ifdef HAVE_TREE
    treecleanup(thee);
#endif
    Vmem_dtor(&(thee->vmem));

}
Exemple #6
0
/* Main (stub) destructor */
VPUBLIC void Vclist_dtor2(Vclist *thee) {

    VclistCell *cell;
    int i;

    for (i=0; i<thee->n; i++) {
        cell = &(thee->cells[i]);
        VclistCell_dtor2(cell);
    }
    Vmem_free(thee->vmem, thee->n, sizeof(VclistCell), 
            (void **)&(thee->cells));
    Vmem_dtor(&(thee->vmem));

}
Exemple #7
0
/*
 * ***************************************************************************
 * Routine:  MCsh_dtor
 *
 * Purpose:  The MCsh destructor.
 *
 * Author:   Michael Holst
 * ***************************************************************************
 */
VPUBLIC void MCsh_dtor(MCsh **thee)
{
    VASSERT( (*thee) != VNULL );
    if ((*thee) != VNULL) {

        AM_dtor(   &((*thee)->am) );
        Aprx_dtor( &((*thee)->aprx) );
        Gem_dtor(  &((*thee)->gm) );
        Vsh_dtor(  &((*thee)->vsh) );

        VDEBUGIO("MCsh_dtor: DESTROYING object..");
        Vmem_dtor( &((*thee)->vmem) );
        Vmem_free( VNULL, 1, sizeof(MCsh), (void**)thee );
        VDEBUGIO("..done.\n");

        (*thee) = VNULL;
    }
}
Exemple #8
0
/*
 * ***************************************************************************
 * Routine:  Bnode_dtor
 *
 * Purpose:  The Block node destructor.
 *
 * Author:   Michael Holst
 * ***************************************************************************
 */
VPUBLIC void Bnode_dtor(Bnode **thee)
{
    int i;

    /* VASSERT( (*thee) != VNULL ); */
    if ((*thee) != VNULL) {

        for (i=0; i<(*thee)->numB; i++) {
            Node_dtor( (&(*thee)->ND[i]) );
        }

        VDEBUGIO("Bnode_dtor: DESTROYING object..");
        if ((*thee)->iMadeVmem) Vmem_dtor( &((*thee)->vmem) );
        Vmem_free( VNULL, 1, sizeof(Bnode), (void**)thee );
        VDEBUGIO("..done.\n"); 

        (*thee) = VNULL;
    }
}
Exemple #9
0
/*
 * ***************************************************************************
 * Routine:  Slu_dtor
 *
 * Purpose:  The Slu destructor.
 *
 * Author:   Michael Holst and Stephen Bond
 * ***************************************************************************
 */
VPUBLIC void Slu_dtor(Slu **thee)
{
    VASSERT( (*thee) != VNULL );
    if ((*thee) != VNULL) {

        /* destroy the factorization */
        if( (*thee)->statLU == 1 ) {
            umfpack_di_free_numeric( &((*thee)->work) );
            (*thee)->statLU = 0;
        }

        /* finally destroy this container */
        VDEBUGIO("Slu_dtor: DESTROYING object..");
        if ((*thee)->iMadeVmem) Vmem_dtor( &((*thee)->vmem) );
        Vmem_free( VNULL, 1, sizeof(Slu), (void**)thee );
        VDEBUGIO("..done.\n");

        (*thee) = VNULL;

    }
}
Exemple #10
0
/* ///////////////////////////////////////////////////////////////////////////
// Routine:  Vpee_dtor2
//
// Author:   Nathan Baker
/////////////////////////////////////////////////////////////////////////// */
VPUBLIC void Vpee_dtor2(Vpee *thee) {
    Vmem_dtor(&(thee->mem));
}