Changeset 3242


Ignore:
Timestamp:
03/10/10 09:13:02 (15 years ago)
Author:
Mathieu Morlighem
Message:

removed some typedefs

Location:
issm/trunk/src/c/Bamgx
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/Bamgx/BamgObjects.h

    r3239 r3242  
    4949        inline void Adj(GeometricalEdge * & on,int &i)
    5050          {int j=i;i=on->DirAdj[i];on=on->Adj[j];}
    51         inline Real4 qualite(const Vertex &va,const Vertex &vb,const Vertex &vc)
    52           {
    53                 Real4 ret;
     51        inline double qualite(const Vertex &va,const Vertex &vb,const Vertex &vc)
     52          {
     53                double ret;
    5454                I2 ia=va,ib=vb,ic=vc;
    5555                I2 ab=ib-ia,bc=ic-ib,ac=ic-ia;
     
    204204                        link=NULL;}; 
    205205        }
    206         inline    Real4 Triangle::qualite()
     206        inline    double Triangle::qualite()
    207207          {
    208208                return det < 0 ? -1 :  bamg::qualite(*TriaVertices[0],*TriaVertices[1],*TriaVertices[2]);
     
    338338        TriangleAdjacent CloseBoundaryEdge(I2 ,Triangle *, double &,double &) ;
    339339        TriangleAdjacent CloseBoundaryEdgeV2(I2 A,Triangle *t, double &a,double &b);
    340         void  swap(Triangle *t1,Int1 a1,
    341                                 Triangle *t2,Int1 a2,
     340        void  swap(Triangle *t1,short a1,
     341                                Triangle *t2,short a2,
    342342                                Vertex *s1,Vertex *s2,Icoor2 det1,Icoor2 det2);
    343343        int SwapForForcingEdge(Vertex   *  & pva ,Vertex  * &   pvb ,
  • issm/trunk/src/c/Bamgx/Bamgx.cpp

    r3233 r3242  
    135135                                for (i=0;i<BTh.nbv;i++){
    136136                                        if (!isnan(bamgmesh_in->hVertices[i])){
    137                                                 BTh[i].m=Metric((Real4)bamgmesh_in->hVertices[i]);
     137                                                BTh[i].m=Metric((float)bamgmesh_in->hVertices[i]);
    138138                                        }
    139139                                }
  • issm/trunk/src/c/Bamgx/meshtype.h

    r3241 r3242  
    1717
    1818        //typedefs
    19         typedef float  Real4;
    2019        typedef double Real8;
    21         typedef short  Int1;
    22         typedef short  Int2;
    2320        typedef long   Int4;
    2421        typedef int  Icoor1; 
     
    2926#endif
    3027        typedef P2<Icoor1,Icoor2> I2;
    31         typedef P2xP2<Int2,Int4>  I2xI2;
     28        typedef P2xP2<short,Int4>  I2xI2;
    3229        typedef P2<Real8,Real8>   R2;
    33         typedef P2<Real4,Real8>   R2xR2;
     30        typedef P2<double,Real8>   R2xR2;
    3431
    3532        //Some parameters
     
    3936        const  int    IsVertexOnVertex = 16;
    4037        const  int    IsVertexOnEdge = 32;
    41         static const  Int2 VerticesOfTriangularEdge[3][2] = {{1,2},{2,0},{0,1}};
    42         static const  Int2 EdgesVertexTriangle[3][2] = {{1,2},{2,0},{0,1}};
    43         static const  Int2 OppositeVertex[3] = {0,1,2};
    44         static const  Int2 OppositeEdge[3] =  {0,1,2};
    45         static const  Int2 NextEdge[3] = {1,2,0};
    46         static const  Int2 PreviousEdge[3] = {2,0,1};
    47         static const  Int2 NextVertex[3] = {1,2,0};
    48         static const  Int2 PreviousVertex[3] = {2,0,1};
     38        static const  short VerticesOfTriangularEdge[3][2] = {{1,2},{2,0},{0,1}};
     39        static const  short EdgesVertexTriangle[3][2] = {{1,2},{2,0},{0,1}};
     40        static const  short OppositeVertex[3] = {0,1,2};
     41        static const  short OppositeEdge[3] =  {0,1,2};
     42        static const  short NextEdge[3] = {1,2,0};
     43        static const  short PreviousEdge[3] = {2,0,1};
     44        static const  short NextVertex[3] = {1,2,0};
     45        static const  short PreviousVertex[3] = {2,0,1};
    4946#if LONG_BIT > 63
    5047        const  Icoor1 MaxICoor   = 1073741823; // 2^30-1 =111...111 (29 times)
     
    129126        inline int BinaryRand(){
    130127#ifdef RAND_MAX
     128                /*RAND_MAX is defined by stdlib.h and is usually 32767*/
    131129                const long HalfRandMax = RAND_MAX/2;
    132130                return rand() < HalfRandMax;
    133131#else
    134                 return rand() & 16384; //2^14 (for sun because RAND_MAX is not def in stdlib.h)
     132                /*For sun machines, RAND_MAX is not defined, use 2^24*/
     133                return rand() & 16384;
    135134#endif
    136135        }
  • issm/trunk/src/c/Bamgx/objects/Geometry.cpp

    r3233 r3242  
    282282                if (bamggeom->Edges){
    283283                        R2     zero2(0,0);
    284                         Real4* len=NULL;
     284                        double* len=NULL;
    285285
    286286                        if(verbose>5) printf("      processing Edges\n");
     
    289289                        //if hvertices==0, initialize len (length of each edge)
    290290                        if (!hvertices) {
    291                                 len = new Real4[nbv];
     291                                len = new double[nbv];
    292292                                for(i=0;i<nbv;i++) len[i]=0;
    293293                        }
     
    325325                                for (i=0;i<nbv;i++)
    326326                                 if (vertices[i].color > 0)
    327                                   vertices[i].m=Metric(len[i] /(Real4) vertices[i].color);
     327                                  vertices[i].m=Metric(len[i] /(double) vertices[i].color);
    328328                                 else
    329329                                  vertices[i].m=Metric(Hmin);
     
    350350                        if(verbose>5) printf("      processing hVertices\n");
    351351                        for (i=0;i< nbv;i++){
    352                                 vertices[i].m=Metric((Real4)bamggeom->hVertices[i]);
     352                                vertices[i].m=Metric((double)bamggeom->hVertices[i]);
    353353                        }
    354354                }
     
    362362                        hvertices=1;
    363363                        for (i=0;i< nbv;i++) {
    364                                 vertices[i].m = Metric((Real4)bamggeom->MetricVertices[i*3+0],(Real4)bamggeom->MetricVertices[i*3+1],(Real4)bamggeom->MetricVertices[i*3+2]);
     364                                vertices[i].m = Metric((double)bamggeom->MetricVertices[i*3+0],(double)bamggeom->MetricVertices[i*3+1],(double)bamggeom->MetricVertices[i*3+2]);
    365365                        }
    366366                }
     
    372372                if(bamggeom->h1h2VpVertices){
    373373                        if(verbose>5) printf("      processing h1h2VpVertices\n");
    374                         Real4 h1,h2,v1,v2;
     374                        double h1,h2,v1,v2;
    375375                        hvertices =1;
    376376                        for (i=0;i< nbv;i++) {
    377                                 h1=(Real4)bamggeom->MetricVertices[i*4+0];
    378                                 h2=(Real4)bamggeom->MetricVertices[i*4+1];
    379                                 v1=(Real4)bamggeom->MetricVertices[i*4+2];
    380                                 v2=(Real4)bamggeom->MetricVertices[i*4+3];
     377                                h1=(double)bamggeom->MetricVertices[i*4+0];
     378                                h2=(double)bamggeom->MetricVertices[i*4+1];
     379                                v1=(double)bamggeom->MetricVertices[i*4+2];
     380                                v2=(double)bamggeom->MetricVertices[i*4+3];
    381381                                vertices[i].m = Metric(MatVVP2x2(1/(h1*h1),1/(h2*h2),D2(v1,v2)));
    382382                        }
  • issm/trunk/src/c/Bamgx/objects/ListofIntersectionTriangles.cpp

    r3234 r3242  
    197197                                                        deti = dt[i];
    198198                                                        detj = dt[j];
    199                                                         Real4 dij = detj-deti;
     199                                                        double dij = detj-deti;
    200200                                                        ba[i] =  detj/dij;
    201201                                                        ba[j] = -deti/dij;
  • issm/trunk/src/c/Bamgx/objects/Metric.h

    r3232 r3242  
    3939                        R2    Orthogonal(const I2 x){return R2(-(a21*x.x+a22*x.y),a11*x.x+a21*x.y);}
    4040                        int   IntersectWith(const Metric M2);
    41                         inline void Box(Real4 &hx,Real4 &hy) const ; 
     41                        inline void Box(double &hx,double &hy) const ; 
    4242                        //operators
    4343                        Metric operator*(Real8 c) const {Real8 c2=c*c;return  Metric(a11*c2,a21*c2,a22*c2);}
     
    116116                a22=v00*M.lambda2+v11*M.lambda1;
    117117        }
    118         inline   void  Metric::Box(Real4 &hx,Real4 &hy) const {
     118        inline   void  Metric::Box(double &hx,double &hy) const {
    119119                Real8 d=  a11*a22-a21*a21;
    120120                hx = sqrt(a22/d);
  • issm/trunk/src/c/Bamgx/objects/Triangle.cpp

    r3234 r3242  
    9292        /*}}}*/
    9393        /*FUNCTION Triangle::Optim{{{1*/
    94         Int4  Triangle::Optim(Int2 i,int koption) {
     94        Int4  Triangle::Optim(short i,int koption) {
    9595                // turn around (positive direction)
    9696                Triangle *t=this;
     
    123123        /*}}}1*/
    124124        /*FUNCTION Triangle::swap{{{1*/
    125         int Triangle::swap(Int2 a,int koption){
     125        int Triangle::swap(short a,int koption){
    126126                if(a/4 !=0) return 0;// arete lock or MarkUnSwap
    127127
    128128                register Triangle *t1=this,*t2=TriaAdjTriangles[a];// les 2 triangles adjacent
    129                 register Int1 a1=a,a2=TriaAdjSharedEdge[a];// les 2 numero de l arete dans les 2 triangles
     129                register short a1=a,a2=TriaAdjSharedEdge[a];// les 2 numero de l arete dans les 2 triangles
    130130                if(a2/4 !=0) return 0; // arete lock or MarkUnSwap
    131131
  • issm/trunk/src/c/Bamgx/objects/Triangle.h

    r3232 r3242  
    2323                        Vertex*   TriaVertices[3];      // 3 vertices if t is triangle, t[i] allowed by access function, (*t)[i] if pointer
    2424                        Triangle* TriaAdjTriangles[3];  // 3 pointers toward the adjacent triangles
    25                         Int1      TriaAdjSharedEdge[3]; // number of the edges in the adjacent triangles the edge number 1 is the edge number TriaAdjSharedEdge[1] in the Adjacent triangle 1
     25                        short     TriaAdjSharedEdge[3]; // number of the edges in the adjacent triangles the edge number 1 is the edge number TriaAdjSharedEdge[1] in the Adjacent triangle 1
    2626
    2727                public:
     
    4545                        //Methods
    4646                        void   Echo();
    47                         int    swap(Int2 a1,int=0);
    48                         Int4   Optim(Int2 a,int =0);
     47                        int    swap(short a1,int=0);
     48                        Int4   Optim(short a,int =0);
    4949                        int    Locked(int a)const { return TriaAdjSharedEdge[a]&4;}
    5050                        int    Hidden(int a)const { return TriaAdjSharedEdge[a]&16;}
     
    5353                        void   SetAllFlag(int a,int f){TriaAdjSharedEdge[a] = (TriaAdjSharedEdge[a] &3) + (1020 & f);}
    5454                        double QualityQuad(int a,int option=1) const;
    55                         Int1   NuEdgeTriangleAdj(int i) const {return TriaAdjSharedEdge[i&3]&3;} // Number of the  adjacent edge in adj tria 
     55                        short  NuEdgeTriangleAdj(int i) const {return TriaAdjSharedEdge[i&3]&3;} // Number of the  adjacent edge in adj tria 
    5656                        TriangleAdjacent FindBoundaryEdge(int i) const;
    5757                        TriangleAdjacent Adj(int i)  const {return TriangleAdjacent(TriaAdjTriangles[i],TriaAdjSharedEdge[i]&3);};
     
    6969                                if (TriaVertices[2] >=vb && TriaVertices[2] <ve) TriaVertices[2] = vb + renu[TriaVertices[2]-vb];   
    7070                        }
    71                         void SetAdjAdj(Int1 a){
     71                        void SetAdjAdj(short a){
    7272                                a &= 3;
    7373                                register Triangle *tt=TriaAdjTriangles[a];
    7474                                TriaAdjSharedEdge [a] &= 55; // remove MarkUnSwap
    75                                 register Int1 aatt = TriaAdjSharedEdge[a] & 3;
     75                                register short aatt = TriaAdjSharedEdge[a] & 3;
    7676                                if(tt){
    7777                                        tt->TriaAdjTriangles[aatt]=this;
    7878                                        tt->TriaAdjSharedEdge[aatt]=a + (TriaAdjSharedEdge[a] & 60 ) ;}// Copy all the mark
    7979                          }
    80                         void SetAdj2(Int1 a,Triangle *t,Int1 aat){
     80                        void SetAdj2(short a,Triangle *t,short aat){
    8181                                TriaAdjTriangles[a]=t;   //the adjacent triangle to the edge a is t
    8282                                TriaAdjSharedEdge[a]=aat; //position of the edge in the adjacent triangle
     
    126126
    127127                        //Inline methods
    128                         inline Real4 qualite() ;
     128                        inline double qualite() ;
    129129                        inline void  Set(const Triangle &,const Triangles &,Triangles &);
    130130                        inline int   In(Vertex *v) const { return TriaVertices[0]==v || TriaVertices[1]==v || TriaVertices[2]==v ;}
  • issm/trunk/src/c/Bamgx/objects/Triangles.cpp

    r3241 r3242  
    369369                        for (i=0;i< nbv;i++){
    370370                                if (!isnan(bamgmesh->hVertices[i])){
    371                                         vertices[i].m=Metric((Real4)bamgmesh->hVertices[i]);
     371                                        vertices[i].m=Metric((double)bamgmesh->hVertices[i]);
    372372                                }
    373373                        }
     
    399399                        int i1,i2;
    400400                        R2 zero2(0,0);
    401                         Real4 *len =0;
     401                        double *len =0;
    402402
    403403                        if(verbose>5) printf("      processing Edges\n");
     
    406406
    407407                        if (!hvertices) {
    408                                 len = new Real4[nbv];
     408                                len = new double[nbv];
    409409                                for(i=0;i<nbv;i++)
    410410                                 len[i]=0;
     
    434434                                for (i=0;i<nbv;i++)
    435435                                 if (vertices[i].color > 0)
    436                                   vertices[i].m=  Metric(len[i] /(Real4) vertices[i].color);
     436                                  vertices[i].m=  Metric(len[i] /(double) vertices[i].color);
    437437                                 else
    438438                                  vertices[i].m=  Metric(Hmin);
     
    14671467
    14681468                //initialize len as 0
    1469                 Real4 * len = new Real4[Gh.nbv];
     1469                double * len = new double[Gh.nbv];
    14701470                for(i=0;i<Gh.nbv;i++) len[i]=0;
    14711471
     
    15191519                for (i=0;i<Gh.nbv;i++){
    15201520                 if (Gh.vertices[i].color > 0)
    1521                   Gh.vertices[i].m=  Metric(len[i] /(Real4) Gh.vertices[i].color);
     1521                  Gh.vertices[i].m=  Metric(len[i] /(double) Gh.vertices[i].color);
    15221522                 else
    15231523                  Gh.vertices[i].m=  Metric(hmin);
     
    37153715                        vi.i=toI2(vi.r);
    37163716                        vi.r=toR2(vi.i);
    3717                         Real4 hx,hy;
     3717                        double hx,hy;
    37183718                        vi.m.Box(hx,hy);
    37193719                        Icoor1 hi=(Icoor1) (hx*coefIcoor),hj=(Icoor1) (hy*coefIcoor);
     
    53615361        /*Intermediary*/
    53625362        /*FUNCTION swap{{{1*/
    5363         void  swap(Triangle *t1,Int1 a1, Triangle *t2,Int1 a2, Vertex *s1,Vertex *s2,Icoor2 det1,Icoor2 det2){
     5363        void  swap(Triangle *t1,short a1, Triangle *t2,short a2, Vertex *s1,Vertex *s2,Icoor2 det1,Icoor2 det2){
    53645364                // --------------------------------------------------------------
    5365                 // Int1 a2=aa[a];// les 2 numero de l arete dans les 2 triangles
     5365                // short a2=aa[a];// les 2 numero de l arete dans les 2 triangles
    53665366                //                               
    53675367                //               sb                     sb   
     
    56315631                TriangleAdjacent tt2 = Adj(tt1);
    56325632                Triangle *t1=tt1,*t2=tt2;// les 2 triangles adjacent
    5633                 Int1 a1=tt1,a2=tt2;// les 2 numero de l arete dans les 2 triangles
     5633                short a1=tt1,a2=tt2;// les 2 numero de l arete dans les 2 triangles
    56345634                if ( a1<0 || a1>=3 ){
    56355635                        throw ErrorException(__FUNCT__,exprintf("a1<0 || a1>=3"));
  • issm/trunk/src/c/Bamgx/objects/Vertex.h

    r3236 r3242  
    2727                        Int4 ReferenceNumber;
    2828                        Direction DirOfSearch;
    29                         Int1 vint;  // the vertex number in triangle; varies between 0 and 2 in t
     29                        short vint;  // the vertex number in triangle; varies between 0 and 2 in t
    3030                        union {
    3131                                Triangle* t; // one triangle which is containing the vertex
Note: See TracChangeset for help on using the changeset viewer.