Changeset 21625


Ignore:
Timestamp:
03/23/17 14:24:51 (8 years ago)
Author:
Mathieu Morlighem
Message:

CHG: MAXDEPTH is now a macro

Location:
issm/trunk-jpl/src/c/bamg
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified issm/trunk-jpl/src/c/bamg/BamgQuadtree.cpp

    r21623 r21625  
    88namespace bamg {
    99#define ABS(i) ((i)<0 ?-(i) :(i))
     10#define MAXDEPTH 30
    1011        /*DOCUMENTATION What is a BamgQuadtree? {{{
    1112         * A Quadtree is a very simple way to group vertices according
     
    6061
    6162                /*Initialize fields*/
    62                 this->MaxDepth      = 30;
    6363                this->MaxISize      = 1073741824; //2^30
    6464                this->MaxICoord     = 1073741823; //2^30 - 1
     
    7676
    7777                /*Initialize fields*/
    78                 this->MaxDepth      = 30;
    7978                this->MaxISize      = 1073741824; //2^30
    8079                this->MaxICoord     = 1073741823; //2^30 - 1
     
    142141                }
    143142
    144                 /*check that l is not 0 (this should not happen as MaxDepth = 30)*/
     143                /*check that l is not 0 (this should not happen as MAXDEPTH = 30)*/
    145144                _assert_(level>0);
    146145
     
    249248
    250249                /*Initialize level and sizes for largest box*/
    251                 int levelbin = (1L<<this->MaxDepth);// = 2^30
     250                int levelbin = (1L<<MAXDEPTH);// = 2^30
    252251                int        h = this->MaxISize;
    253252                int       hb = this->MaxISize;
     
    303302
    304303                /*Initialize search variables*/
    305                 BamgQuadtreeBox **pb = xNew<BamgQuadtreeBox*>(this->MaxDepth);
    306                 int* pi = xNew<int>(this->MaxDepth);
    307                 int* ii = xNew<int>(this->MaxDepth);
    308                 int* jj = xNew<int>(this->MaxDepth);
     304                BamgQuadtreeBox* pb[MAXDEPTH];
     305                int pi[MAXDEPTH];
     306                int ii[MAXDEPTH];
     307                int jj[MAXDEPTH];
    309308                pb[0]=b;                             //pointer toward the box b
    310309                pi[0]=b->nbitems>0?(int)b->nbitems:4;//number of boxes in b
     
    382381
    383382                /*return nearest vertex pointer*/
    384                 xDelete<BamgQuadtreeBox*>(pb);
    385                 xDelete<int>(pi);
    386                 xDelete<int>(ii);
    387                 xDelete<int>(jj);
    388383                return nearest_v;
    389384        }
     
    439434                Metric* Mx = new Metric(v->m);
    440435
    441                 BamgQuadtreeBox *pb[MaxDepth];
    442                 int  pi[MaxDepth];
    443                 int  ii[MaxDepth], jj[MaxDepth];
     436                BamgQuadtreeBox *pb[MAXDEPTH];
     437                int  pi[MAXDEPTH];
     438                int  ii[MAXDEPTH], jj[MAXDEPTH];
    444439                int l=0; // level
    445440                BamgQuadtreeBox* b;
  • TabularUnified issm/trunk-jpl/src/c/bamg/BamgQuadtree.h

    r21623 r21625  
    3737
    3838                        /*BamgQuadtree public Fields*/
    39                         int              MaxDepth;        // maximum number of subdivision
    4039                        int              MaxICoord;       // maximum integer coordinate 2^MaxDepth -1
    4140                        int              MaxISize;        // maximum integer coordinate 2^MaxDepth
Note: See TracChangeset for help on using the changeset viewer.