Changeset 6d0c34 in git for kernel/gfan.cc


Ignore:
Timestamp:
Nov 25, 2009, 4:15:35 PM (14 years ago)
Author:
Martin Monerjan
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
776bf3ed001f80e10ca0f09d6bf2354a7455f93f
Parents:
f5a31670a1ddd47c1c3ec05c66843294627af2bb
Message:
Only one dd_set_global_constants
Garbage collection in getCodim2Normals, ffG
ddFacets is now deleted after getCodim2Normals, therefore removed from
destructor
modified facet destructor - flipGB and flipRing are deleted in noRevS



git-svn-id: file:///usr/local/Singular/svn/trunk@12324 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/gfan.cc

    rf5a3167 r6d0c34  
    172172        }
    173173        delete this->codim2Ptr;
    174         idDelete((ideal *)&this->flipGB);
    175         rDelete(this->flipRing);
    176         this->flipRing=NULL;
     174        if(this->flipGB!=NULL)
     175                idDelete((ideal *)&this->flipGB);
     176        if(this->flipRing!=NULL)
     177                rDelete(this->flipRing);
     178//      this->flipRing=NULL;
    177179        //this=NULL;
    178180}
     
    419421        }
    420422        this->counter--;
    421         dd_FreeMatrix(this->ddFacets);
     423        //should be deleted in noRevS
     424//      dd_FreeMatrix(this->ddFacets);
    422425        //dd_FreeMatrix(this->ddFacets);
    423426}                       
     
    607610
    608611        dd_rowrange aktmatrixrow=0;     // needed to store the diffs of the expvects in the rows of ddineq
    609         dd_set_global_constants();
     612//      dd_set_global_constants();
    610613        ddrows=rows;
    611614        ddcols=this->numVars;
     
    889892        //codim2Act = this->facetPtr->codim2Ptr;
    890893                       
    891         dd_set_global_constants();
     894//      dd_set_global_constants();
    892895                       
    893896        dd_MatrixPtr ddineq,P,ddakt;
     
    961964                dd_FreePolyhedra(ddpolyh);
    962965                delete iv_intPoint;
     966                dd_FreeMatrix(P);
     967                set_free(impl_linset);
     968                set_free(redset);
     969                free(newpos);
    963970        }//for
    964971        dd_FreeMatrix(ddineq);
     972//      dd_FreeMatrix(P);
     973//      set_free(impl_linset);
     974//      set_free(redset);
     975//      free(newpos);
     976       
    965977}
    966978               
     
    10801092         * compute the difference accordingly
    10811093        */
    1082         dd_set_global_constants();
     1094//      dd_set_global_constants();
    10831095        bool markingsAreCorrect=FALSE;
    10841096        dd_MatrixPtr intPointMatrix;
     
    11951207        interiorPoint(intPointMatrix, *iv_weight);      //iv_weight now contains the interior point
    11961208        dd_FreeMatrix(intPointMatrix);
    1197         dd_free_global_constants();
     1209//      dd_free_global_constants();
    11981210                       
    11991211        /*Step 3
     
    12681280        for (int ii=0;ii<IDELEMS(gb);ii++)
    12691281        {
    1270                 aktpoly = (poly)gb->m[ii];                                                             
     1282                aktpoly = pCopy((poly)gb->m[ii]);       
    12711283                int *v=(int *)omAlloc((this->numVars+1)*sizeof(int));
    12721284                int *leadExpV=(int *)omAlloc((this->numVars+1)*sizeof(int));
     
    12771289                {
    12781290                        aktpoly=pNext(aktpoly); //next term
    1279                         pSetm(aktpoly);
     1291//                      pSetm(aktpoly);
    12801292                        pGetExpV(aktpoly,v);           
    12811293                        /* Convert (int)v into (intvec)check */                 
     
    13031315#endif
    13041316                /*Now initialFormElement must be added to (ideal)initialForm */
    1305                 initialForm->m[ii]=initialFormElement[ii];
     1317                initialForm->m[ii]=pCopy(initialFormElement[ii]);
     1318                pDelete(&initialFormElement[ii]);
    13061319                omFree(leadExpV);
    13071320                omFree(v);             
    13081321        }//for
    13091322        delete check;
     1323        pDelete(&aktpoly);
    13101324}
    13111325
     
    13291343        int size=IDELEMS(H);
    13301344        ideal res=idInit(size,1);
    1331         poly temp1, temp2, temp3;       //polys to temporarily store values for pSub
     1345        poly temp1=pInit();
     1346        poly temp2=pInit();
     1347        poly temp3=pInit();     //polys to temporarily store values for pSub
    13321348        for (int ii=0;ii<size;ii++)
    13331349        {
    13341350//              res->m[ii]=restOfDiv(H->m[ii],G);
    1335                 res->m[ii]=kNF(G, NULL,H->m[ii],0,0);
    1336                 temp1=H->m[ii];
    1337                 temp2=res->m[ii];
     1351//              res->m[ii]=pCopy(kNF(G, NULL,H->m[ii],0,0));
     1352                temp1=pCopy(H->m[ii]);
     1353//              temp2=pCopy(res->m[ii]);
     1354                temp2=pCopy(kNF(G, NULL,H->m[ii],0,0));
    13381355                temp3=pSub(temp1, temp2);
    1339                 res->m[ii]=temp3;
     1356                res->m[ii]=pCopy(temp3);
    13401357                //res->m[ii]=pSub(temp1,temp2); //buggy
    13411358                //pSort(res->m[ii]);
    13421359                //pSetm(res->m[ii]);
    13431360                //cout << "res->m["<<ii<<"]=";pWrite(res->m[ii]);       
    1344         }                       
     1361        }       
     1362        pDelete(&temp1);               
     1363//      pDelete(&temp2);
     1364//      pDelete(&temp3);
    13451365        return res;
    13461366}
     
    15111531        dd_FreeLPData(lp);
    15121532        set_free(ddlinset);
    1513         set_free(ddredrows);                   
     1533        set_free(ddredrows);
     1534//      free(ddnewpos); //segfaults
    15141535                       
    15151536}//void interiorPoint(dd_MatrixPtr const &M)
     
    17451766                         * Destructor must be equipped with necessary checks.
    17461767                        */
    1747 //                      idDelete((ideal *)&fAct->flipGB);
    1748 //                      rDelete(fAct->flipRing);
     1768                        idDelete((ideal *)&fAct->flipGB);
     1769                        rDelete(fAct->flipRing);
    17491770                       
    17501771                        gcTmp->getConeNormals(gcTmp->gcBasis, FALSE);   
    17511772                        gcTmp->getCodim2Normals(*gcTmp);
    17521773                        gcTmp->normalize();
     1774                        //gcTmp->ddFacets should not be needed anymore, so
     1775                        dd_FreeMatrix(gcTmp->ddFacets);
    17531776#ifdef gfan_DEBUG
    17541777//                      gcTmp->showFacets(1);
     
    19711994 * Returns a pointer to new first element of Searchlist
    19721995 */
    1973                 //void enqueueNewFacets(facet &f)
    19741996facet * gcone::enqueueNewFacets(facet &f)
    19751997{
     
    19802002        facet *slEnd;   //Pointer to end of SLA
    19812003        slEnd = &f;
    1982         facet *slEndStatic;     //marks the end before a new facet is added             
     2004//      facet *slEndStatic;     //marks the end before a new facet is added             
    19832005        facet *fAct;
    19842006        fAct = this->facetPtr;
     
    19922014                       
    19932015        /** Flag to indicate a facet that should be added to SLA*/
    1994         bool doNotAdd=FALSE;
     2016//      bool doNotAdd=FALSE;
    19952017        /** \brief  Flag to mark a facet that might be added
    19962018         * The following case may occur:
     
    20012023         * If slAct->next==NULL AND maybe==TRUE we know, that fAct must be added
    20022024         */
    2003         volatile bool maybe=FALSE;
     2025//      volatile bool maybe=FALSE;
    20042026        /**A facet was removed, lengthOfSearchlist-- thus we must not rely on
    20052027         * if(notParallelCtr==lengthOfSearchList) but rather
     
    20152037                lengthOfSearchList++;
    20162038        }
    2017         slEndStatic = slEnd;
     2039//      slEndStatic = slEnd;
    20182040        /*1st step: compare facetNormals*/
    2019         intvec *fNormal=NULL;
    2020         intvec *f2Normal=NULL;
    2021         intvec *slNormal=NULL;
    2022         intvec *sl2Normal=NULL;
     2041        intvec *fNormal=NULL;
     2042//      intvec *f2Normal=NULL;
     2043        intvec *slNormal=NULL;
     2044//      intvec *sl2Normal=NULL;
    20232045                       
    20242046        while(fAct!=NULL)
     
    20262048                if(fAct->isFlippable==TRUE)
    20272049                {
    2028                         maybe=FALSE;
    2029                         doNotAdd=TRUE;
     2050//                      maybe=FALSE;
     2051//                      doNotAdd=TRUE;
    20302052                        fNormal=fAct->getFacetNormal();
    20312053                        slAct = slHead;
     
    21212143                                        }
    21222144                                        removalOccured=TRUE;
     2145                                        lengthOfSearchList--;
    21232146                                        break;//leave the while loop, since we found fAct=slAct thus delete slAct and do not add fAct
    21242147                                }               
     
    26652688        ideal res;     
    26662689        facet *fRoot;   
    2667        
     2690        dd_set_global_constants();
    26682691        if(method==noRevS)
    26692692        {
Note: See TracChangeset for help on using the changeset viewer.