Changeset 5151


Ignore:
Timestamp:
08/11/10 11:50:47 (15 years ago)
Author:
Mathieu Morlighem
Message:

moved some functions from h to cpp

Location:
issm/trunk/src/c/objects/Bamg
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/objects/Bamg/GeometricalEdge.cpp

    r5149 r5151  
    1616
    1717        /*Methods*/
     18        /*FUNCTION GeometricalEdge::Cracked{{{1*/
     19        int    GeometricalEdge::Cracked() const  {
     20                return type &1; 
     21        }/*}}}*/
     22        /*FUNCTION GeometricalEdge::F{{{1*/
     23        R2 GeometricalEdge::F(double theta) const{
     24                /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, MeshGeom.cpp/F)*/
     25                // parametrization of the curve edge
     26
     27           R2 A=v[0]->r,B=v[1]->r;
     28                double ca,cb,cta,ctb;
     29                if ( theta<-1e-12){
     30                        ISSMERROR("theta<-1e-12");
     31                }
     32                if ( theta>1+1e-12){
     33                        ISSMERROR("theta>1+1e-12");
     34                }
     35                if (TgA())
     36                 if (TgB()) // interpolation d'hermite
     37                        { cb =  theta*theta*(3-2*theta);
     38                         ca =  1-cb;     
     39                         cta = (1-theta)*(1-theta)*theta;
     40                         ctb = (theta-1)*theta*theta ;
     41                        }
     42                 else { // 1-t*t, t-t*t, t*t
     43                         double t = theta;
     44                         cb = t*t;
     45                         ca = 1-cb;
     46                         cta= t-cb;
     47                         ctb=0;   
     48                 }   
     49                else
     50                 if (TgB()){
     51                         double t = 1-theta;
     52                         ca = t*t;
     53                         cb = 1-ca;
     54                         ctb= -t+ca;
     55                         cta=0;   
     56                 }
     57                 else {
     58                         ca =(1-theta),cb = theta,cta=ctb=0; // lagrange P1
     59                 }
     60                return A*ca + B*cb + tg[0]* cta + tg[1] * ctb;
     61          }
     62        /*}}}1*/
     63        /*FUNCTION GeometricalEdge::Mark{{{1*/
     64        int    GeometricalEdge::Mark()    const  {
     65                return type &16;
     66        }/*}}}*/
    1867        /*FUNCTION GeometricalEdge::R1tg{{{1*/
    1968        double GeometricalEdge::R1tg(double theta,R2 & t) const{
     
    88137        }
    89138        /*}}}1*/
    90         /*FUNCTION GeometricalEdge::F{{{1*/
    91         R2 GeometricalEdge::F(double theta) const{
    92                 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, MeshGeom.cpp/F)*/
    93                 // parametrization of the curve edge
    94 
    95            R2 A=v[0]->r,B=v[1]->r;
    96                 double ca,cb,cta,ctb;
    97                 if ( theta<-1e-12){
    98                         ISSMERROR("theta<-1e-12");
    99                 }
    100                 if ( theta>1+1e-12){
    101                         ISSMERROR("theta>1+1e-12");
    102                 }
    103                 if (TgA())
    104                  if (TgB()) // interpolation d'hermite
    105                         { cb =  theta*theta*(3-2*theta);
    106                          ca =  1-cb;     
    107                          cta = (1-theta)*(1-theta)*theta;
    108                          ctb = (theta-1)*theta*theta ;
    109                         }
    110                  else { // 1-t*t, t-t*t, t*t
    111                          double t = theta;
    112                          cb = t*t;
    113                          ca = 1-cb;
    114                          cta= t-cb;
    115                          ctb=0;   
    116                  }   
    117                 else
    118                  if (TgB()){
    119                          double t = 1-theta;
    120                          ca = t*t;
    121                          cb = 1-ca;
    122                          ctb= -t+ca;
    123                          cta=0;   
    124                  }
    125                  else {
    126                          ca =(1-theta),cb = theta,cta=ctb=0; // lagrange P1
    127                  }
    128                 return A*ca + B*cb + tg[0]* cta + tg[1] * ctb;
    129           }
    130         /*}}}1*/
     139        /*FUNCTION GeometricalEdge::Required{{{1*/
     140        int    GeometricalEdge::Required()       {
     141                return type &64;
     142        }/*}}}*/
    131143        /*FUNCTION GeometricalEdge::Set {{{1*/
    132144        void GeometricalEdge::Set(const GeometricalEdge & rec,const Geometry & Gh ,Geometry & GhNew){
     
    138150        }
    139151        /*}}}*/
    140 
     152        /*FUNCTION GeometricalEdge::SetCracked{{{1*/
     153        void   GeometricalEdge::SetCracked()     {
     154                type |= 1;
     155        }/*}}}*/
     156        /*FUNCTION GeometricalEdge::SetTgA{{{1*/
     157        void   GeometricalEdge::SetTgA()         {
     158                type |=4;
     159        }/*}}}*/
     160        /*FUNCTION GeometricalEdge::SetTgB{{{1*/
     161        void   GeometricalEdge::SetTgB()         {
     162                type |=8;
     163        }/*}}}*/
     164        /*FUNCTION GeometricalEdge::SetMark{{{1*/
     165        void   GeometricalEdge::SetMark()        {
     166                type |=16;
     167        }/*}}}*/
     168        /*FUNCTION GeometricalEdge::SetUnMark{{{1*/
     169        void   GeometricalEdge::SetUnMark()      {
     170                type &= 1007 /* 1023-16*/;
     171        }/*}}}*/
     172        /*FUNCTION GeometricalEdge::SetRequired{{{1*/
     173        void   GeometricalEdge::SetRequired()    {
     174                type |= 64;
     175        }/*}}}*/
     176          /*FUNCTION GeometricalEdge::Tg{{{1*/
     177        int    GeometricalEdge::Tg(int i) const  {
     178                return i==0 ? TgA() : TgB();
     179        }/*}}}*/
     180        /*FUNCTION GeometricalEdge::TgA{{{1*/
     181        int    GeometricalEdge::TgA()     const  {
     182                return type &4; 
     183        }/*}}}*/
     184        /*FUNCTION GeometricalEdge::TgB{{{1*/
     185        int    GeometricalEdge::TgB()     const  {
     186                return type &8; 
     187        }/*}}}*/
    141188}
  • issm/trunk/src/c/objects/Bamg/GeometricalEdge.h

    r5148 r5151  
    2929                        R2     F(double theta) const ; // parametrization of the curve edge
    3030                        double R1tg(double theta,R2 &t) const ; // 1/radius of curvature + tangente
    31                         int    Tg(int i) const  {return i==0 ? TgA() : TgB(); }
    32                         int    Cracked() const  {return type &1;  }
    33                         int    TgA()     const  {return type &4;  }
    34                         int    TgB()     const  {return type &8;  }
    35                         int    Mark()    const  {return type &16; }
    36                         int    Required()       {return type &64; }
    37                         void   SetCracked()     { type |= 1;}
    38                         void   SetTgA()         { type |=4; }
    39                         void   SetTgB()         { type |=8; }
    40                         void   SetMark()        { type |=16;}
    41                         void   SetUnMark()      { type &= 1007 /* 1023-16*/;}
    42                         void   SetRequired()    { type |= 64; }
     31                        int    Tg(int i) const;
     32                        int    Cracked() const;
     33                        int    TgA()     const;
     34                        int    TgB()     const;
     35                        int    Mark()    const;
     36                        int    Required();
     37                        void   SetCracked();
     38                        void   SetTgA();
     39                        void   SetTgB();
     40                        void   SetMark();
     41                        void   SetUnMark();
     42                        void   SetRequired();
    4343                        void   Set(const GeometricalEdge & rec,const Geometry & Th ,Geometry & ThNew);
    4444        };
  • issm/trunk/src/c/objects/Bamg/MatVVP2x2.cpp

    r3913 r5151  
    4141        }
    4242        /*}}}1*/
     43        /*FUNCTION MatVVP2x2::MatVVP2x2(double r1,double r2,const D2 vp1){{{1*/
     44        MatVVP2x2::MatVVP2x2(double r1,double r2,const D2 vp1): lambda1(r1),lambda2(r2),v(vp1){
     45
     46        }/*}}}*/
    4347
    4448        /*Methods*/
     49        /*FUNCTION MatVVP2x2::Abs{{{1*/
     50        void   MatVVP2x2::Abs(){
     51                lambda1=bamg::Abs(lambda1),lambda2=bamg::Abs(lambda2);
     52        }/*}}}*/
     53        /*FUNCTION MatVVP2x2::Aniso{{{1*/
     54        double MatVVP2x2::Aniso() const  {
     55                return sqrt( Aniso2());
     56        }/*}}}*/
     57        /*FUNCTION MatVVP2x2::Aniso2{{{1*/
     58        double MatVVP2x2::Aniso2() const  {
     59                return lmax()/lmin();
     60        }/*}}}*/
     61        /*FUNCTION MatVVP2x2::BoundAniso{{{1*/
     62        void   MatVVP2x2::BoundAniso(const double c){
     63                BoundAniso2(1/(c*c));
     64        }/*}}}*/
    4565        /*FUNCTION MatVVP2x2::Echo {{{1*/
    4666        void MatVVP2x2::Echo(void){
     
    5575        }
    5676        /*}}}*/
     77        /*FUNCTION MatVVP2x2::hmin{{{1*/
     78        double MatVVP2x2::hmin() const {
     79                return sqrt(1/bamg::Max3(lambda1,lambda2,1e-30));
     80        }/*}}}*/
     81        /*FUNCTION MatVVP2x2::hmax{{{1*/
     82        double MatVVP2x2::hmax() const {
     83                return sqrt(1/bamg::Max(bamg::Min(lambda1,lambda2),1e-30));
     84        }/*}}}*/
     85        /*FUNCTION MatVVP2x2::Isotrope{{{1*/
     86        void   MatVVP2x2::Isotrope() {
     87                lambda1=lambda2=bamg::Max(lambda1,lambda2);
     88        }/*}}}*/
     89        /*FUNCTION MatVVP2x2::lmax{{{1*/
     90        double MatVVP2x2::lmax() const {
     91                return bamg::Max3(lambda1,lambda2,1e-30);
     92        }/*}}}*/
     93        /*FUNCTION MatVVP2x2::lmin{{{1*/
     94        double MatVVP2x2::lmin() const {
     95                return bamg::Max(bamg::Min(lambda1,lambda2),1e-30);
     96        }/*}}}*/
     97        /*FUNCTION MatVVP2x2::Min{{{1*/
     98        void   MatVVP2x2::Min(double a) {
     99                lambda1=bamg::Min(a,lambda1); lambda2=bamg::Min(a,lambda2) ;
     100        }/*}}}*/
     101        /*FUNCTION MatVVP2x2::Max{{{1*/
     102        void   MatVVP2x2::Max(double a) {
     103                lambda1=bamg::Max(a,lambda1); lambda2=bamg::Max(a,lambda2) ;
     104        }/*}}}*/
     105        /*FUNCTION MatVVP2x2::Minh{{{1*/
     106        void   MatVVP2x2::Minh(double h) {
     107                Min(1.0/(h*h));
     108        }/*}}}*/
     109        /*FUNCTION MatVVP2x2::Maxh{{{1*/
     110        void   MatVVP2x2::Maxh(double h) {
     111                Max(1.0/(h*h));
     112        }/*}}}*/
     113        /*FUNCTION MatVVP2x2::pow{{{1*/
     114        void   MatVVP2x2::pow(double p){
     115                lambda1=::pow(lambda1,p);lambda2=::pow(lambda2,p);
     116        }/*}}}*/
    57117
    58118}
  • issm/trunk/src/c/objects/Bamg/Metric.cpp

    r5148 r5151  
    1414
    1515        /*Constructor/Destructor*/
     16        /*FUNCTION Metric::Metric(){{{1*/
     17        Metric::Metric(){
     18
     19        }/*}}}*/
     20        /*FUNCTION Metric::Metric(double a){{{1*/
     21        Metric::Metric(double a): a11(1/(a*a)),a21(0),a22(1/(a*a)){
     22       
     23        }/*}}}*/
     24        /*FUNCTION Metric::Metric(double a,double b,double c){{{1*/
     25        Metric::Metric(double a,double b,double c) :a11(a),a21(b),a22(c){
     26       
     27        }/*}}}*/
    1628        /*FUNCTION Metric::Metric(const double  a[3],const  Metric m0, const  Metric m1,const  Metric  m2 ){{{1*/
    1729        Metric::Metric(const double  a[3],const  Metric m0, const  Metric m1,const  Metric m2 ){
     
    3547        }
    3648        /*}}}1*/
    37         /*FUNCTION Metric::Metric( double  a,const  Metric ma, double  b,const  Metric mb){{{1*/
    38         Metric::Metric( double  a,const  Metric ma, double  b,const  Metric mb) {
     49        /*FUNCTION Metric::Metric(double  a,const  Metric ma, double  b,const  Metric mb){{{1*/
     50        Metric::Metric(double  a,const  Metric ma, double  b,const  Metric mb) {
    3951                /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Metric.cpp/MatVVP2x2)*/
    4052
     
    5567
    5668        /*Methods*/
     69        /*FUNCTION Metric::det{{{1*/
     70        double Metric::det() const {
     71                return a11*a22-a21*a21;
     72        }  /*}}}*/
    5773        /*FUNCTION Metric::Echo {{{1*/
    5874        void Metric::Echo(void){
     
    117133        }
    118134        /*}}}1*/
     135        /*FUNCTION Metric::mul{{{1*/
     136        R2     Metric::mul(const R2 x)const {
     137                return R2(a11*x.x+a21*x.y,a21*x.x+a22*x.y);
     138        }/*}}}*/
    119139
    120140        /*Intermediary*/
  • issm/trunk/src/c/objects/Bamg/Metric.h

    r5124 r5151  
    1717
    1818                public:
     19
    1920                        //fields
    2021                        double a11,a21,a22;
     22
    2123                        //friends
    2224                        friend class MatVVP2x2;
     25
    2326                        //functions
    24                         Metric(){};
     27                        Metric();
    2528                        Metric(const MatVVP2x2);
    26                         Metric(double a): a11(1/(a*a)),a21(0),a22(1/(a*a)){}
    27                         Metric(double a,double b,double c) :a11(a),a21(b),a22(c){}
     29                        Metric(double a);
     30                        Metric(double a,double b,double c);
    2831                        Metric( double  a,const  Metric ma, double  b,const  Metric mb);
    2932                        Metric(const double  a[3],const  Metric m0,const  Metric m1,const  Metric m2 );
    30                         void  Echo();
    31                         R2    mul(const R2 x)const {return R2(a11*x.x+a21*x.y,a21*x.x+a22*x.y);}
    32                         double det() const {return a11*a22-a21*a21;} 
    33                         R2    Orthogonal(const R2 x){return R2(-(a21*x.x+a22*x.y),a11*x.x+a21*x.y);}
    34                         R2    Orthogonal(const I2 x){return R2(-(a21*x.x+a22*x.y),a11*x.x+a21*x.y);}
    35                         int   IntersectWith(const Metric M2);
    36                         inline void Box(double &hx,double &hy) const ; 
     33                        void        Echo();
     34                        R2          mul(const R2 x)const;
     35                        double      det() const;
     36                        int         IntersectWith(const  Metric M2);
     37                        inline void Box(double &hx,double &hy) const;
     38
     39                        /*The following functions must remain the the header file because it is called before Metric
     40                         * is compiled by other classes*/
     41                        R2 Orthogonal(const R2 x){ return R2(-(a21*x.x+a22*x.y),a11*x.x+a21*x.y); }
     42                        R2 Orthogonal(const I2 x){ return R2(-(a21*x.x+a22*x.y),a11*x.x+a21*x.y); }
     43
    3744                        //operators
    3845                        Metric operator*(double c) const {double c2=c*c;return  Metric(a11*c2,a21*c2,a22*c2);}
     
    4653        class MatVVP2x2{
    4754                public:
     55
    4856                        //fields
    4957                        double lambda1,lambda2;
    5058                        D2     v;
     59
    5160                        //friends
    5261                        friend  class Metric;
     62
    5363                        //functions
    5464                        MatVVP2x2(const Metric );
    55                         MatVVP2x2(double r1,double r2,const D2 vp1): lambda1(r1),lambda2(r2),v(vp1){}
    56                         void  Echo();
    57                         void  Abs(){lambda1=bamg::Abs(lambda1),lambda2=bamg::Abs(lambda2);}
    58                         void  pow(double p){lambda1=::pow(lambda1,p);lambda2=::pow(lambda2,p);}
    59                         void  Min(double a) { lambda1=bamg::Min(a,lambda1); lambda2=bamg::Min(a,lambda2) ;}
    60                         void  Max(double a) { lambda1=bamg::Max(a,lambda1); lambda2=bamg::Max(a,lambda2) ;}
    61                         void Minh(double h) {Min(1.0/(h*h));}
    62                         void Maxh(double h) {Max(1.0/(h*h));}
    63                         void Isotrope() {lambda1=lambda2=bamg::Max(lambda1,lambda2);}
    64                         double hmin() const {return sqrt(1/bamg::Max3(lambda1,lambda2,1e-30));}
    65                         double hmax() const {return sqrt(1/bamg::Max(bamg::Min(lambda1,lambda2),1e-30));}
    66                         double lmax() const {return bamg::Max3(lambda1,lambda2,1e-30);}
    67                         double lmin() const {return bamg::Max(bamg::Min(lambda1,lambda2),1e-30);}
    68                         double Aniso2() const  { return lmax()/lmin();}
    69                         double Aniso() const  { return sqrt( Aniso2());}
    70                         void BoundAniso(const double c){ BoundAniso2(1/(c*c));}
     65                        MatVVP2x2(double r1,double r2,const D2 vp1);
     66                        void   Echo();
     67                        void   Abs();
     68                        void   pow(double  p);
     69                        void   Min(double  a);
     70                        void   Max(double  a);
     71                        void   Minh(double h);
     72                        void   Maxh(double h);
     73                        void   Isotrope();
     74                        double hmin()   const;
     75                        double hmax()   const;
     76                        double lmax()   const;
     77                        double lmin()   const;
     78                        double Aniso2() const;
     79                        double Aniso()  const;
     80                        void   BoundAniso(const  double c);
    7181                        inline void BoundAniso2(const double coef);
     82
    7283                        //operators
    7384                        void operator *=(double coef){ lambda1*=coef;lambda2*=coef;}
  • issm/trunk/src/c/objects/Bamg/Triangle.cpp

    r5149 r5151  
    4242
    4343        /*Methods*/
     44        /*FUNCTION Triangle::Adj{{{1*/
     45        AdjacentTriangle Triangle::Adj(int i)  const {
     46                return AdjacentTriangle(adj[i],AdjEdgeNumber[i]&3);
     47        };/*}}}*/
    4448        /*FUNCTION Triangle::Echo {{{1*/
    4549        void Triangle::Echo(void){
     
    120124        }
    121125        /*}}}1*/
     126        /*FUNCTION Triangle::GetAllflag{{{1*/
     127        int    Triangle::GetAllflag(int a){
     128                return AdjEdgeNumber[a] & 1020;
     129        }/*}}}*/
     130        /*FUNCTION Triangle::Hidden{{{1*/
     131        int    Triangle::Hidden(int a)const {
     132                return AdjEdgeNumber[a]&16;
     133        } /*}}}*/
     134        /*FUNCTION Triangle::Locked{{{1*/
     135        int    Triangle::Locked(int a)const {
     136                return AdjEdgeNumber[a]&4;
     137        } /*}}}*/
     138        /*FUNCTION Triangle::NuEdgeTriangleAdj{{{1*/
     139        short  Triangle::NuEdgeTriangleAdj(int i) const {
     140                // Number of the  adjacent edge in adj tria 
     141                return AdjEdgeNumber[i&3]&3;
     142        }/*}}}*/
    122143        /*FUNCTION Triangle::Optim{{{1*/
    123144        long  Triangle::Optim(short i,int koption) {
     
    197218        }
    198219        /*}}}*/
     220        /*FUNCTION Triangle::Renumbering(Triangle *tb,Triangle *te, long *renu){{{1*/
     221        void  Triangle::Renumbering(Triangle *tb,Triangle *te, long *renu){
     222
     223                if (link  >=tb && link  <te) link  = tb + renu[link -tb];
     224                if (adj[0] >=tb && adj[0] <te) adj[0] = tb + renu[adj[0]-tb];
     225                if (adj[1] >=tb && adj[1] <te) adj[1] = tb + renu[adj[1]-tb];
     226                if (adj[2] >=tb && adj[2] <te) adj[2] = tb + renu[adj[2]-tb];   
     227        }/*}}}*/
     228        /*FUNCTION Triangle::Renumbering(BamgVertex *vb,BamgVertex *ve, long *renu){{{1*/
     229        void Triangle::Renumbering(BamgVertex *vb,BamgVertex *ve, long *renu){
     230                if (vertices[0] >=vb && vertices[0] <ve) vertices[0] = vb + renu[vertices[0]-vb];
     231                if (vertices[1] >=vb && vertices[1] <ve) vertices[1] = vb + renu[vertices[1]-vb];
     232                if (vertices[2] >=vb && vertices[2] <ve) vertices[2] = vb + renu[vertices[2]-vb];   
     233        }/*}}}*/
    199234        /*FUNCTION Triangle::Set {{{1*/
    200235        void Triangle::Set(const Triangle & rec,const Mesh & Th ,Mesh & ThNew){
     
    210245        }
    211246        /*}}}*/
     247        /*FUNCTION Triangle::SetAdjAdj{{{1*/
     248        void Triangle::SetAdjAdj(short a){
     249                // Copy all the mark
     250                a &= 3;
     251                register Triangle *tt=adj[a];
     252                AdjEdgeNumber [a] &= 55; // remove MarkUnSwap
     253                register short aatt = AdjEdgeNumber[a] & 3;
     254                if(tt){
     255                        tt->adj[aatt]=this;
     256                        tt->AdjEdgeNumber[aatt]=a + (AdjEdgeNumber[a] & 60 ) ;
     257                }
     258        }/*}}}*/
     259        /*FUNCTION Triangle::SetAdj2{{{1*/
     260        void Triangle::SetAdj2(short a,Triangle *t,short aat){
     261                adj[a]=t;    //the adjacent triangle to the edge a is t
     262                AdjEdgeNumber[a]=aat; //position of the edge in the adjacent triangle
     263                if(t) { //if t!=NULL add adjacent triangle to t (this)
     264                        t->adj[aat]=this;
     265                        t->AdjEdgeNumber[aat]=a;
     266                }
     267        }/*}}}*/
     268        /*FUNCTION Triangle::SetAllFlag{{{1*/
     269        void   Triangle::SetAllFlag(int a,int f){
     270                AdjEdgeNumber[a] = (AdjEdgeNumber[a] &3) + (1020 & f);
     271        }/*}}}*/
     272        /*FUNCTION Triangle::SetDet{{{1*/
     273        void Triangle::SetDet() {
     274                if(vertices[0] && vertices[1] && vertices[2])    det = bamg::det(*vertices[0],*vertices[1],*vertices[2]);
     275                else det = -1;
     276        }/*}}}*/
     277        /*FUNCTION Triangle::SetHidden{{{1*/
     278        void Triangle::SetHidden(int a){
     279                //Get Adjacent Triangle number a
     280                register Triangle* t = adj[a];
     281                //if it exist
     282                //C|=D -> C=(C|D) bitwise inclusive OR
     283                if(t) t->AdjEdgeNumber[AdjEdgeNumber[a] & 3] |=16;
     284                AdjEdgeNumber[a] |= 16;
     285        }/*}}}*/
     286        /*FUNCTION Triangle::SetLocked{{{1*/
     287        void Triangle::SetLocked(int a){
     288                //mark the edge as on Boundary
     289                register Triangle * t = adj[a];
     290                t->AdjEdgeNumber[AdjEdgeNumber[a] & 3] |=4;
     291                AdjEdgeNumber[a] |= 4;
     292        }/*}}}*/
     293        /*FUNCTION Triangle::SetMarkUnSwap{{{1*/
     294        void Triangle::SetMarkUnSwap(int a){
     295                register Triangle * t = adj[a];
     296                t->AdjEdgeNumber[AdjEdgeNumber[a] & 3] |=8;
     297                AdjEdgeNumber[a] |=8 ;
     298        }/*}}}*/
     299        /*FUNCTION Triangle::SetSingleVertexToTriangleConnectivity{{{1*/
     300        void Triangle::SetSingleVertexToTriangleConnectivity() {
     301                if (vertices[0]) (vertices[0]->t=this,vertices[0]->vint=0);
     302                if (vertices[1]) (vertices[1]->t=this,vertices[1]->vint=1);
     303                if (vertices[2]) (vertices[2]->t=this,vertices[2]->vint=2);
     304        }/*}}}*/
     305        /*FUNCTION Triangle::SetUnMarkUnSwap{{{1*/
     306        void Triangle::SetUnMarkUnSwap(int a){
     307                register Triangle * t = adj[a];
     308                t->AdjEdgeNumber[AdjEdgeNumber[a] & 3] &=55; // 23 + 32
     309                AdjEdgeNumber[a] &=55 ;
     310        }/*}}}*/
    212311        /*FUNCTION Triangle::swap{{{1*/
    213312        int Triangle::swap(short a,int koption){
     
    325424        }
    326425        /*}}}1*/
     426        /*FUNCTION Triangle::TriangleAdj{{{1*/
     427        Triangle* Triangle::TriangleAdj(int i) const {
     428                return adj[i&3];
     429        }/*}}}*/
    327430
    328431}
  • issm/trunk/src/c/objects/Bamg/Triangle.h

    r5148 r5151  
    4040
    4141                        //Methods
    42                         void   Echo();
    43                         int    swap(short a1,int=0);
    44                         long   Optim(short a,int =0);
    45                         int    Locked(int a)const { return AdjEdgeNumber[a]&4;}
    46                         int    Hidden(int a)const { return AdjEdgeNumber[a]&16;}
    47                         int    GetAllflag(int a){return AdjEdgeNumber[a] & 1020;}
    48                         void   SetAllFlag(int a,int f){AdjEdgeNumber[a] = (AdjEdgeNumber[a] &3) + (1020 & f);}
    49                         double QualityQuad(int a,int option=1) const;
    50                         short  NuEdgeTriangleAdj(int i) const {return AdjEdgeNumber[i&3]&3;} // Number of the  adjacent edge in adj tria 
    51                         AdjacentTriangle FindBoundaryEdge(int i) const;
    52                         AdjacentTriangle Adj(int i)  const {return AdjacentTriangle(adj[i],AdjEdgeNumber[i]&3);};
    53                         Triangle* TriangleAdj(int i) const {return adj[i&3];}
    54                         Triangle* Quadrangle(BamgVertex * & v0,BamgVertex * & v1,BamgVertex * & v2,BamgVertex * & v3) const ;
    55                         void  Renumbering(Triangle *tb,Triangle *te, long *renu){
    56                                 if (link  >=tb && link  <te) link  = tb + renu[link -tb];
    57                                 if (adj[0] >=tb && adj[0] <te) adj[0] = tb + renu[adj[0]-tb];
    58                                 if (adj[1] >=tb && adj[1] <te) adj[1] = tb + renu[adj[1]-tb];
    59                                 if (adj[2] >=tb && adj[2] <te) adj[2] = tb + renu[adj[2]-tb];   
    60                         }
    61                         void Renumbering(BamgVertex *vb,BamgVertex *ve, long *renu){
    62                                 if (vertices[0] >=vb && vertices[0] <ve) vertices[0] = vb + renu[vertices[0]-vb];
    63                                 if (vertices[1] >=vb && vertices[1] <ve) vertices[1] = vb + renu[vertices[1]-vb];
    64                                 if (vertices[2] >=vb && vertices[2] <ve) vertices[2] = vb + renu[vertices[2]-vb];   
    65                         }
    66                         void SetAdjAdj(short a){
    67                                 a &= 3;
    68                                 register Triangle *tt=adj[a];
    69                                 AdjEdgeNumber [a] &= 55; // remove MarkUnSwap
    70                                 register short aatt = AdjEdgeNumber[a] & 3;
    71                                 if(tt){
    72                                         tt->adj[aatt]=this;
    73                                         tt->AdjEdgeNumber[aatt]=a + (AdjEdgeNumber[a] & 60 ) ;}// Copy all the mark
    74                           }
    75                         void SetAdj2(short a,Triangle *t,short aat){
    76                                 adj[a]=t;    //the adjacent triangle to the edge a is t
    77                                 AdjEdgeNumber[a]=aat; //position of the edge in the adjacent triangle
    78                                 if(t) { //if t!=NULL add adjacent triangle to t (this)
    79                                         t->adj[aat]=this;
    80                                         t->AdjEdgeNumber[aat]=a;
    81                                 }
    82                         }
    83                         void SetSingleVertexToTriangleConnectivity() {
    84                                 if (vertices[0]) (vertices[0]->t=this,vertices[0]->vint=0);
    85                                 if (vertices[1]) (vertices[1]->t=this,vertices[1]->vint=1);
    86                                 if (vertices[2]) (vertices[2]->t=this,vertices[2]->vint=2);
    87                         }
    88                         void SetHidden(int a){
    89                                 //Get Adjacent Triangle number a
    90                                 register Triangle* t = adj[a];
    91                                 //if it exist
    92                                 //C|=D -> C=(C|D) bitwise inclusive OR
    93                                 if(t) t->AdjEdgeNumber[AdjEdgeNumber[a] & 3] |=16;
    94                                 AdjEdgeNumber[a] |= 16;
    95                         }
    96 
    97                         void SetLocked(int a){
    98                                 //mark the edge as on Boundary
    99                                 register Triangle * t = adj[a];
    100                                 t->AdjEdgeNumber[AdjEdgeNumber[a] & 3] |=4;
    101                                 AdjEdgeNumber[a] |= 4;
    102                         }
    103                         void SetMarkUnSwap(int a){
    104                                 register Triangle * t = adj[a];
    105                                 t->AdjEdgeNumber[AdjEdgeNumber[a] & 3] |=8;
    106                                 AdjEdgeNumber[a] |=8 ;
    107                         }
    108                         void SetUnMarkUnSwap(int a){
    109                                 register Triangle * t = adj[a];
    110                                 t->AdjEdgeNumber[AdjEdgeNumber[a] & 3] &=55; // 23 + 32
    111                                 AdjEdgeNumber[a] &=55 ;
    112                         }
    113                         void SetDet() {
    114                                 if(vertices[0] && vertices[1] && vertices[2])    det = bamg::det(*vertices[0],*vertices[1],*vertices[2]);
    115                                 else det = -1; }
     42                        void              Echo();
     43                        int               swap(short a1,int=0);
     44                        long              Optim(short a,int =0);
     45                        int               Locked(int a)const;
     46                        int               Hidden(int a)const;
     47                        int               GetAllflag(int a);
     48                        void              SetAllFlag(int a,int f);
     49                        double            QualityQuad(int a,int option=1) const;
     50                        short             NuEdgeTriangleAdj(int i) const;
     51                        AdjacentTriangle  FindBoundaryEdge(int  i) const;
     52                        AdjacentTriangle  Adj(int i) const;
     53                        Triangle         *TriangleAdj(int i) const;
     54                        Triangle         *Quadrangle(BamgVertex  *& v0,BamgVertex *& v1,BamgVertex *& v2,BamgVertex *& v3) const;
     55                        void              Renumbering(Triangle   *tb,Triangle *te, long *renu);
     56                        void              Renumbering(BamgVertex *vb,BamgVertex *ve, long *renu);
     57                        void              SetAdjAdj(short a);
     58                        void              SetAdj2(short a,Triangle *t,short aat);
     59                        void              SetSingleVertexToTriangleConnectivity();
     60                        void              SetHidden(int a);
     61                        void              SetLocked(int a);
     62                        void              SetMarkUnSwap(int a);
     63                        void              SetUnMarkUnSwap(int a);
     64                        void              SetDet();
    11665
    11766                        //Inline methods
  • issm/trunk/src/c/objects/Bamg/VertexOnVertex.cpp

    r5149 r5151  
    1010
    1111        /*Constructors/Destructors*/
     12        /*FUNCTION VertexOnVertex::VertexOnVertex(){{{1*/
     13        VertexOnVertex::VertexOnVertex() {
     14       
     15        };/*}}}*/
     16        /*FUNCTION VertexOnVertex::VertexOnVertex(BamgVertex * w,BamgVertex *bw){{{1*/
     17        VertexOnVertex::VertexOnVertex(BamgVertex * w,BamgVertex *bw) :v(w),bv(bw){
     18       
     19        }/*}}}*/
    1220
    1321        /*Methods*/
     
    1826        }
    1927        /*}}}*/
     28        /*FUNCTION VertexOnVertex::SetOnBTh{{{1*/
     29        void VertexOnVertex::SetOnBTh(){
     30                v->BackgroundVertexHook=bv;v->vint=IsVertexOnVertex;
     31        }/*}}}*/
    2032
    2133}
  • issm/trunk/src/c/objects/Bamg/VertexOnVertex.h

    r5148 r5151  
    1717
    1818                        //Constructors
    19                         VertexOnVertex(BamgVertex * w,BamgVertex *bw) :v(w),bv(bw){}
    20                         VertexOnVertex() {};
     19                        VertexOnVertex();
     20                        VertexOnVertex(BamgVertex * w,BamgVertex *bw);
    2121
    2222                        //Methods
    23                         void SetOnBTh(){v->BackgroundVertexHook=bv;v->vint=IsVertexOnVertex;}
     23                        void SetOnBTh();
    2424                        void Set(const Mesh &,long,Mesh &);
    2525        };
Note: See TracChangeset for help on using the changeset viewer.