Changeset 5e4025 in git


Ignore:
Timestamp:
Feb 16, 2010, 6:53:16 PM (14 years ago)
Author:
Martin Monerjan
Branches:
(u'spielwiese', '4a9821a93ffdc22a6696668bd4f6b8c9de3e6c5f')
Children:
cd2d901a045b1d74d20f86f668a4b0e1e3e54de8
Parents:
85583be556e4cc6287cf2babe14599c31aa7a14e
Message:
const getRef2FacetNormal
used in gcone::areEqual, readConeFromFile, f2M


git-svn-id: file:///usr/local/Singular/svn/trunk@12552 2c84dea3-7e68-4137-9b89-c4e89433aadc
Location:
kernel
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • kernel/gfan.cc

    r85583b r5e4025  
    199199}
    200200               
    201 inline intvec *facet::getRef2FacetNormal()
     201inline const intvec *facet::getRef2FacetNormal()
    202202{
    203203        return(this->fNormal);
     
    222222        int notParallelCtr=0;
    223223        int ctr=0;
    224         intvec* fNormal; //No new since ivCopy and therefore getFacetNormal return a new
    225         intvec* sNormal;
     224        const intvec* fNormal; //No new since ivCopy and therefore getFacetNormal return a new
     225        const intvec* sNormal;
    226226        fNormal = f->getRef2FacetNormal();//->getFacetNormal();
    227227        sNormal = s->getRef2FacetNormal();//->getFacetNormal();
     
    231231 //             notParallelCtr++;
    232232//      else//parallelity, so we check the codim2-facets
    233         if(isParallel(*fNormal,*sNormal))
     233        intvec *fNRef=const_cast<intvec*>(fNormal);
     234        intvec *sNRef=const_cast<intvec*>(sNormal);
     235//      if(isParallel(*fNormal,*sNormal))       
     236        if(isParallel(*fNRef,*sNRef))
    234237//      if(fNormal->compare((sNormal))!=0)//Behold! Teh definitive Mandelbug
    235238        {
     
    240243                while(f2Act!=NULL)
    241244                {
    242                         intvec* f2Normal;
     245                        const intvec* f2Normal;
    243246                        f2Normal = f2Act->getRef2FacetNormal();//->getFacetNormal();
     247//                      intvec *f2Ref=const_cast<intvec*>(f2Normal);
    244248                        s2Act = s->codim2Ptr;
    245249                        while(s2Act!=NULL)
    246250                        {
    247                                 intvec* s2Normal;
     251                                const intvec* s2Normal;
    248252                                s2Normal = s2Act->getRef2FacetNormal();//->getFacetNormal();
    249253//                              bool foo=areEqual(f2Normal,s2Normal);
     254//                              intvec *s2Ref=const_cast<intvec*>(s2Normal);
    250255                                int foo=f2Normal->compare(s2Normal);
    251256                                if(foo==0)
     
    12731278        while(fAct!=NULL)
    12741279        {
    1275                 intvec *fNormal;// = new intvec(this->numVars);
    1276                 fNormal = fAct->getFacetNormal();
     1280                const intvec *fNormal;// = new intvec(this->numVars);
     1281                fNormal = fAct->getRef2FacetNormal();//->getFacetNormal();
    12771282                for(int ii=0;ii<rows;ii++)
    12781283                {
    12791284                        intvec *rowvec = new intvec(this->numVars);
    12801285                        makeInt(P,ii+1,*rowvec);//get an integer entry instead of rational
    1281                         if(dotProduct(*fNormal,*rowvec)==0)
     1286                        if(dotProduct(*fNormal,*rowvec)==0)
    12821287                        {
    12831288                                fAct->numCodim2Facets++;
     
    13361341                        }while(exchanged==TRUE && n>=0);
    13371342                }*///if pVariables>2
    1338                 delete fNormal;         
     1343//              delete fNormal;         
    13391344                fAct = fAct->next;
    13401345        }
     
    13441349        if(gcone::hasHomInput==FALSE)
    13451350        {
    1346         fAct=gc.facetPtr;
    1347         while(fAct!=NULL)
    1348         {
    1349                 bool containsStrictlyPosRay=FALSE;
    1350                 facet *codim2Act;
    1351                 codim2Act = fAct->codim2Ptr;
    1352                 while(codim2Act!=NULL)
    1353                 {
    1354 //                      containsStrictlyPosRay=TRUE;
    1355                         intvec *rayvec;
    1356                         rayvec = codim2Act->getFacetNormal();//Mind this is no normal but a ray!
    1357                         //int negCtr=0;
    1358                         if(iv64isStrictlyPositive(rayvec))
    1359                         {
    1360                                 containsStrictlyPosRay=TRUE;
    1361                                 delete(rayvec);
    1362                                 break;
    1363                         }
    1364                         /*for(int ii=0;ii<rayvec->length();ii++)
    1365                         {
    1366                                 if( (*rayvec)[ii] < 0 )
     1351                fAct=gc.facetPtr;
     1352                while(fAct!=NULL)
     1353                {
     1354                        bool containsStrictlyPosRay=FALSE;
     1355                        facet *codim2Act;
     1356                        codim2Act = fAct->codim2Ptr;
     1357                        while(codim2Act!=NULL)
     1358                        {
     1359        //                      containsStrictlyPosRay=TRUE;
     1360                                intvec *rayvec;
     1361                                rayvec = codim2Act->getFacetNormal();//Mind this is no normal but a ray!
     1362                                //int negCtr=0;
     1363                                if(iv64isStrictlyPositive(rayvec))
    13671364                                {
    1368                                         containsStrictlyPosRay=FALSE;                                   
     1365                                        containsStrictlyPosRay=TRUE;
     1366        //                              delete(rayvec);
    13691367                                        break;
    13701368                                }
    1371                         }
    1372                         if(containsStrictlyPosRay==TRUE)
    1373                         {
    1374                                 delete(rayvec);
    1375                                 break;
    1376                         }*/                     
    1377                         delete(rayvec);
    1378                         codim2Act = codim2Act->next;
     1369                                /*for(int ii=0;ii<rayvec->length();ii++)
     1370                                {
     1371                                        if( (*rayvec)[ii] < 0 )
     1372                                        {
     1373                                                containsStrictlyPosRay=FALSE;                                   
     1374                                                break;
     1375                                        }
     1376                                }
     1377                                if(containsStrictlyPosRay==TRUE)
     1378                                {
     1379                                        delete(rayvec);
     1380                                        break;
     1381                                }*/                     
     1382        //                      delete(rayvec);
     1383                                codim2Act = codim2Act->next;
     1384                        }
     1385                        if(containsStrictlyPosRay==FALSE)
     1386                                fAct->isFlippable=FALSE;
     1387                        fAct = fAct->next;
    13791388                }
    1380                 if(containsStrictlyPosRay==FALSE)
    1381                         fAct->isFlippable=FALSE;
    1382                 fAct = fAct->next;
    1383         }
    13841389        }//hasHomInput?
    13851390#ifdef gfanp
     
    17971802                        }
    17981803                        if (isParallel(*check,fNormal)) //pass *check when
     1804//                      if(isParallel((const intvec*)&check,(const intvec*)&fNormal))
    17991805//                      if(fNormal.compare(check)==0)
    18001806                        {
     
    19831989        return res;
    19841990}//int dotProduct
    1985 
     1991inline int gcone::dotProduct(const intvec &iva, const intvec &ivb)                             
     1992{                       
     1993        int res=0;
     1994        for (int i=0;i<this->numVars;i++)
     1995        {
     1996                res = res+(iva[i]*ivb[i]);
     1997        }
     1998        return res;
     1999}
    19862000/** \brief Check whether two intvecs are parallel
    19872001 *
     
    20052019        return res;
    20062020}//bool isParallel
    2007                
     2021// inline int gcone::dotProduct(const intvec *a, const intvec *b)                               
     2022// {                   
     2023//      int res=0;
     2024//      for (int i=0;i<this->numVars;i++)
     2025//      {
     2026//              res = res+((*a)[i]*(*b)[i]);
     2027//      }
     2028//      return res;
     2029// }//int dotProduct
     2030// inline bool gcone::isParallel(const intvec* a, const intvec* b)
     2031// {
     2032//      int lhs,rhs;
     2033//      bool res;
     2034//      lhs=dotProduct(a,b)*dotProduct(a,b);
     2035//      rhs=dotProduct(a,a)*dotProduct(b,b);
     2036//                      //cout << "LHS="<<lhs<<", RHS="<<rhs<<endl;
     2037//      if (lhs==rhs)
     2038//      {
     2039//              res = TRUE;
     2040//      }
     2041//      else
     2042//      {
     2043//              res = FALSE;
     2044//      }
     2045//      return res;
     2046// }
    20082047/** \brief Compute an interior point of a given cone
    20092048 * Result will be written into intvec iv.
     
    30273066                while(fAct!=NULL)
    30283067                {       
    3029                         intvec *iv;
    3030                         iv=fAct->getFacetNormal();
     3068                        const intvec *iv;
     3069                        iv=fAct->getRef2FacetNormal();//->getFacetNormal();
    30313070                        f2Act=fAct->codim2Ptr;
    30323071                        for (int ii=0;ii<iv->length();ii++)
     
    30413080                                }
    30423081                        }
    3043                         delete iv;
     3082//                      delete iv;
    30443083                        while(f2Act!=NULL)
    30453084                        {
    3046                                 intvec *iv2;
    3047                                 iv2=f2Act->getFacetNormal();   
     3085                                const intvec *iv2;
     3086                                iv2=f2Act->getRef2FacetNormal();//->getFacetNormal();   
    30483087                                for(int jj=0;jj<iv2->length();jj++)
    30493088                                {
     
    30573096                                        }
    30583097                                }
    3059                                 delete iv2;
     3098//                              delete iv2;
    30603099                                f2Act = f2Act->next;
    30613100                        }
     
    33713410        while(fAct!=NULL )//&& ii < bound )
    33723411        {
    3373                 intvec *fNormal;
    3374                 fNormal = fAct->getFacetNormal();
     3412                const intvec *fNormal;
     3413                fNormal = fAct->getRef2FacetNormal();//->getFacetNormal();
    33753414                for(int jj=0;jj<this->numVars;jj++)
    33763415                {
     
    33793418                }
    33803419                fAct = fAct->next;
    3381                 delete fNormal;
     3420//              delete fNormal;
    33823421        }       
    33833422        return *res;
  • kernel/gfan.h

    r85583b r5e4025  
    9595                inline intvec *getFacetNormal();
    9696                /** Return a reference to the facet normal*/
    97                 inline intvec *getRef2FacetNormal();
     97                inline const intvec *getRef2FacetNormal();
    9898                /** Method to print the facet normal*/
    9999                inline void printNormal();
     
    206206                inline intvec *ivNeg(intvec *iv);
    207207                inline int dotProduct(intvec &iva, intvec &ivb);
     208                inline int dotProduct(const intvec &iva, const intvec &ivb);
    208209                inline bool isParallel(intvec &a, intvec &b);
     210//              inline int dotProduct(const intvec* a, const intvec *b);
     211//              inline bool isParallel(const intvec* a, const intvec* b);
    209212                inline bool areEqual(intvec &a, intvec &b);
    210213                inline bool areEqual( facet *f,  facet *g);
Note: See TracChangeset for help on using the changeset viewer.