Changeset 2992


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

minor

File:
1 edited

Legend:

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

    r2989 r2992  
    99#include "meshtype.h"
    1010#include "Metric.h"
    11 
    12 using namespace std;
    1311
    1412namespace bamg {
     
    808806        };
    809807        /*}}}1*/
    810 
    811         inline void Vertex::Set(const Vertex & rec,const Triangles & ,Triangles & ){
    812                 *this  = rec;
    813           }
    814         inline void GeometricalVertex::Set(const GeometricalVertex & rec,const Geometry & ,const Geometry & ){
    815                 *this  = rec;
    816           }
    817         inline void VertexOnVertex::Set(const Triangles & Th ,Int4 i,Triangles & ThNew) {
    818                 *this = Th.VertexOnBThVertex[i]; 
    819                 v = ThNew.vertices + Th.Number(v);
    820 
    821           }
    822         Int4 inline  Vertex::Optim(int i,int koption){
    823                 Int4 ret=0;
    824                 if ( t && (vint >= 0 ) && (vint <3) )
    825                   {
    826                         ret = t->Optim(vint,koption);
    827                         if(!i)
    828                           {
    829                                 t =0; // for no future optime
    830                                 vint= 0; }
    831                   }
    832                 return ret;
    833           }
    834 
     808       
     809        /*INLINE functions{{{1*/
    835810        // to sort in descending order
    836811        template<class T>  inline void  HeapSort(T *c,long n){
     
    858833                }
    859834        }
    860 
    861         //From Metric.cpp
    862835        inline Real8 det3x3(Real8 A[3] ,Real8 B[3],Real8 C[3]){
    863836                return A[0]*( B[1]*C[2]-B[2]*C[1])
    864                      - A[1]*( B[0]*C[2]-B[2]*C[0])
    865                      + A[2]*( B[0]*C[1]-B[1]*C[0]);
     837                  - A[1]*( B[0]*C[2]-B[2]*C[0])
     838                  + A[2]*( B[0]*C[1]-B[1]*C[0]);
    866839        }
    867 
     840        inline  TriangleAdjacent Adj(const TriangleAdjacent & a)
     841          { return  a.Adj();}
     842
     843        inline TriangleAdjacent Next(const TriangleAdjacent & ta)
     844          { return TriangleAdjacent(ta.t,NextEdge[ta.a]);}
     845
     846        inline TriangleAdjacent Previous(const TriangleAdjacent & ta)
     847          { return TriangleAdjacent(ta.t,PreviousEdge[ta.a]);}
     848        inline void Adj(GeometricalEdge * & on,int &i)
     849          {int j=i;i=on->DirAdj[i];on=on->Adj[j];}
     850        inline Real4 qualite(const Vertex &va,const Vertex &vb,const Vertex &vc)
     851          {
     852                Real4 ret;
     853                I2 ia=va,ib=vb,ic=vc;
     854                I2 ab=ib-ia,bc=ic-ib,ac=ic-ia;
     855                Icoor2 deta=Det(ab,ac);
     856                if (deta <=0) ret = -1;
     857                else {
     858                        Real8 a = sqrt((Real8) (ac,ac)),
     859                                        b = sqrt((Real8) (bc,bc)),
     860                                        c = sqrt((Real8) (ab,ab)),
     861                                        p = a+b+c;
     862                        Real8 h= Max(Max(a,b),c),ro=deta/p;
     863                        ret = ro/h;}
     864                        return ret;
     865          }
     866        Icoor2 inline det(const Vertex & a,const Vertex & b,const Vertex & c){
     867                register  Icoor2 bax = b.i.x - a.i.x ,bay = b.i.y - a.i.y;
     868                register  Icoor2 cax = c.i.x - a.i.x ,cay = c.i.y - a.i.y;
     869                return  bax*cay - bay*cax;
     870        }
     871        inline  TriangleAdjacent FindTriangleAdjacent(Edge &E){
     872                Vertex * a = E.v[0];
     873                Vertex * b = E.v[1];
     874
     875                Triangle * t = a->t;
     876                int i = a->vint;
     877                TriangleAdjacent ta(t,EdgesVertexTriangle[i][0]); // Previous edge
     878                if (!t || i<0 || i>=3){
     879                        throw ErrorException(__FUNCT__,exprintf("!t || i<0 !! i>=3"));
     880                }
     881                if ( a!=(*t)(i)){
     882                        throw ErrorException(__FUNCT__,exprintf("a!=(*t)(i)"));
     883                }
     884                int k=0;
     885                do { // turn around vertex in direct sens (trigo)
     886                        k++;
     887                        if (k>=20000){
     888                                throw ErrorException(__FUNCT__,exprintf("k>=20000"));
     889                        }
     890                        //  in no crack => ta.EdgeVertex(1) == a otherwise ???
     891                        if (ta.EdgeVertex(1) ==  a && ta.EdgeVertex(0) ==  b) return ta; // find
     892                        ta = ta.Adj();
     893                        if (ta.EdgeVertex(0) ==  a && ta.EdgeVertex(1) ==  b) return ta; // find
     894                        --ta;
     895                } while (t != (Triangle *)ta);
     896                throw ErrorException(__FUNCT__,exprintf("FindTriangleAdjacent: triangle not found"));
     897                return TriangleAdjacent(0,0);//for compiler
     898        }
     899        inline Vertex* TheVertex(Vertex * a){
     900                // give a unique vertex with smallest number
     901                // in case on crack in mesh
     902                Vertex * r(a), *rr;
     903                Triangle * t = a->t;
     904                int i = a->vint;
     905                TriangleAdjacent ta(t,EdgesVertexTriangle[i][0]); // Previous edge
     906                if (!t || i<0 || i>=3){
     907                        throw ErrorException(__FUNCT__,exprintf("!t || i<0 !! i>=3"));
     908                }
     909                if ( a!=(*t)(i)){
     910                        throw ErrorException(__FUNCT__,exprintf("a!=(*t)(i)"));
     911                }
     912                int k=0;
     913                do { // turn around vertex in direct sens (trigo)
     914                        k++;
     915                        if (k>=20000){
     916                                throw ErrorException(__FUNCT__,exprintf("k>=20000"));
     917                        }
     918                        //  in no crack => ta.EdgeVertex(1) == a
     919                        if ((rr=ta.EdgeVertex(0)) < r) r = rr;
     920                        ta = ta.Adj();
     921                        if ((rr=ta.EdgeVertex(1)) < r) r =rr;
     922                        --ta;
     923                } while (t != (Triangle*) ta); 
     924                return r;
     925        }
     926
     927        /*}}}1*/
     928
     929   /*INLINE functions of CLASS Vertex{{{1*/
     930        inline void Vertex::Set(const Vertex & rec,const Triangles & ,Triangles & ){
     931                *this  = rec;
     932          }
     933        Int4 inline  Vertex::Optim(int i,int koption){
     934                Int4 ret=0;
     935                if ( t && (vint >= 0 ) && (vint <3) )
     936                  {
     937                        ret = t->Optim(vint,koption);
     938                        if(!i)
     939                          {
     940                                t =0; // for no future optime
     941                                vint= 0; }
     942                  }
     943                return ret;
     944          }
     945        /*}}}1*/
     946        /*INLINE functions of CLASS GeometricalVertex{{{1*/
     947        inline void GeometricalVertex::Set(const GeometricalVertex & rec,const Geometry & ,const Geometry & ){
     948                *this  = rec;
     949          }
     950        /*}}}1*/
     951        /*INLINE functions of CLASS VertexOnVertex{{{1*/
     952        inline void VertexOnVertex::Set(const Triangles & Th ,Int4 i,Triangles & ThNew) {
     953                *this = Th.VertexOnBThVertex[i]; 
     954                v = ThNew.vertices + Th.Number(v);
     955
     956          }
     957/*}}}1*/
     958        /*INLINE functions of CLASS Triangles{{{1*/
    868959        inline Triangles::Triangles(Int4 i) :Gh(*new Geometry()),BTh(*this){PreInit(i);}
    869 
    870         TriangleAdjacent CloseBoundaryEdge(I2 ,Triangle *, double &,double &) ;
    871         TriangleAdjacent CloseBoundaryEdgeV2(I2 A,Triangle *t, double &a,double &b);
    872 
    873         Int4 FindTriangle(Triangles &Th, Real8 x, Real8 y, double* a,int & inside);
    874 
     960        inline  void  Triangles::ReMakeTriangleContainingTheVertex()
     961          {
     962                register Int4 i;
     963                for ( i=0;i<nbv;i++)
     964                  {
     965                        vertices[i].vint = 0;
     966                        vertices[i].t=0;
     967                  }
     968                for ( i=0;i<nbt;i++)
     969                 triangles[i].SetTriangleContainingTheVertex();
     970          }
     971
     972        inline  void  Triangles::UnMarkUnSwapTriangle()
     973          {
     974                register Int4 i;
     975                for ( i=0;i<nbt;i++)
     976                 for(int  j=0;j<3;j++)
     977                  triangles[i].SetUnMarkUnSwap(j);
     978          }
     979
     980        inline  void   Triangles::SetVertexFieldOn(){
     981                for (Int4 i=0;i<nbv;i++)
     982                 vertices[i].onGeometry=0;
     983                for (Int4 j=0;j<NbVerticesOnGeomVertex;j++ )
     984                 VerticesOnGeomVertex[j].SetOn();
     985                for (Int4 k=0;k<NbVerticesOnGeomEdge;k++ )
     986                 VerticesOnGeomEdge[k].SetOn();
     987        }             
     988        inline  void   Triangles::SetVertexFieldOnBTh(){
     989                for (Int4 i=0;i<nbv;i++)
     990                 vertices[i].onGeometry=0;
     991                for (Int4 j=0;j<NbVertexOnBThVertex;j++ )
     992                 VertexOnBThVertex[j].SetOnBTh();
     993                for (Int4 k=0;k<NbVertexOnBThEdge;k++ )
     994                 VertexOnBThEdge[k].SetOnBTh();
     995
     996        }
     997        /*}}}1*/
     998        /*INLINE functions of CLASS Triangle{{{1*/
    875999        inline Triangle* Triangle::Quadrangle(Vertex * & v0,Vertex * & v1,Vertex * & v2,Vertex * & v3) const
    8761000          {
     
    9171041                return  q;
    9181042          }
    919 
    920 
    921         inline void Edge::Set(const Triangles & Th ,Int4 i,Triangles & ThNew)
    922           {
    923                 *this = Th.edges[i];
    924                 v[0] = ThNew.vertices + Th.Number(v[0]);   
    925                 v[1] = ThNew.vertices + Th.Number(v[1]);
    926                 if (onGeometry)
    927                  onGeometry =  ThNew.Gh.edges+Th.Gh.Number(onGeometry);
    928                 if (adj[0]) adj[0] =   ThNew.edges +   Th.Number(adj[0]);
    929                 if (adj[1]) adj[1] =   ThNew.edges +   Th.Number(adj[1]);
    930 
    931           }
    932         inline void GeometricalEdge::Set(const GeometricalEdge & rec,const Geometry & Gh ,Geometry & GhNew)
    933           {
    934                 *this = rec;
    935                 v[0] = GhNew.vertices + Gh.Number(v[0]);   
    936                 v[1] = GhNew.vertices + Gh.Number(v[1]);
    937                 if (Adj[0]) Adj[0] =  GhNew.edges + Gh.Number(Adj[0]);     
    938                 if (Adj[1]) Adj[1] =  GhNew.edges + Gh.Number(Adj[1]);     
    939           }
    940 
    941         inline void Curve::Set(const Curve & rec,const Geometry & Gh ,Geometry & GhNew)
    942           {
    943                 *this = rec;
    944                 be = GhNew.edges + Gh.Number(be);   
    945                 ee = GhNew.edges + Gh.Number(ee);
    946                 if(next) next= GhNew.curves + Gh.Number(next);
    947           }
    948 
    9491043        inline void Triangle::Set(const Triangle & rec,const Triangles & Th ,Triangles & ThNew)
    9501044          {
     
    9591053                 link = ThNew.triangles + Th.Number(link);
    9601054          }
    961 
    962         inline void SubDomain::Set(const Triangles & Th ,Int4 i,Triangles & ThNew)
    963           {
    964                 *this = Th.subdomains[i];
    965                 if ( head-Th.triangles<0 || head-Th.triangles>=Th.nbt){
    966                         throw ErrorException(__FUNCT__,exprintf("head-Th.triangles<0 || head-Th.triangles>=Th.nbt"));
    967                 }
    968                 head = ThNew.triangles + Th.Number(head) ;
    969                 if (edge-Th.edges<0 || edge-Th.edges>=Th.nbe);{
    970                         throw ErrorException(__FUNCT__,exprintf("edge-Th.edges<0 || edge-Th.edges>=Th.nbe"));
    971                 }
    972                 edge = ThNew.edges+ Th.Number(edge);
    973           }
    974         inline void GeometricalSubDomain::Set(const GeometricalSubDomain & rec,const Geometry & Gh ,const Geometry & GhNew)
    975           {
    976                 *this = rec;
    977                 edge = Gh.Number(edge) + GhNew.edges;
    978           }
    979         inline void VertexOnEdge::Set(const Triangles & Th ,Int4 i,Triangles & ThNew)
    980           {
    981                 *this = Th.VertexOnBThEdge[i]; 
    982                 v = ThNew.vertices + Th.Number(v);
    983           }
    984 
    985         inline void VertexOnGeom::Set(const VertexOnGeom & rec,const Triangles & Th ,Triangles & ThNew)
    986           {
    987                 *this = rec; 
    988                 mv = ThNew.vertices + Th.Number(mv);
    989                 if (gv)
    990                  if (abscisse < 0 )
    991                   gv = ThNew.Gh.vertices + Th.Gh.Number(gv);
    992                  else
    993                   ge = ThNew.Gh.edges + Th.Gh.Number(ge);
    994 
    995           }
    996         inline Real8 Edge::MetricLength() const
    997           {
    998                 return LengthInterpole(v[0]->m,v[1]->m,v[1]->r - v[0]->r) ;
    999           }
    1000 
    1001         inline  void  Triangles::ReMakeTriangleContainingTheVertex()
    1002           {
    1003                 register Int4 i;
    1004                 for ( i=0;i<nbv;i++)
    1005                   {
    1006                         vertices[i].vint = 0;
    1007                         vertices[i].t=0;
    1008                   }
    1009                 for ( i=0;i<nbt;i++)
    1010                  triangles[i].SetTriangleContainingTheVertex();
    1011           }
    1012 
    1013         inline  void  Triangles::UnMarkUnSwapTriangle()
    1014           {
    1015                 register Int4 i;
    1016                 for ( i=0;i<nbt;i++)
    1017                  for(int  j=0;j<3;j++)
    1018                   triangles[i].SetUnMarkUnSwap(j);
    1019           }
    1020 
    1021         inline  void   Triangles::SetVertexFieldOn(){
    1022                 for (Int4 i=0;i<nbv;i++)
    1023                  vertices[i].onGeometry=0;
    1024                 for (Int4 j=0;j<NbVerticesOnGeomVertex;j++ )
    1025                  VerticesOnGeomVertex[j].SetOn();
    1026                 for (Int4 k=0;k<NbVerticesOnGeomEdge;k++ )
    1027                  VerticesOnGeomEdge[k].SetOn();
    1028           }           
    1029         inline  void   Triangles::SetVertexFieldOnBTh(){
    1030                 for (Int4 i=0;i<nbv;i++)
    1031                  vertices[i].onGeometry=0;
    1032                 for (Int4 j=0;j<NbVertexOnBThVertex;j++ )
    1033                  VertexOnBThVertex[j].SetOnBTh();
    1034                 for (Int4 k=0;k<NbVertexOnBThEdge;k++ )
    1035                  VertexOnBThEdge[k].SetOnBTh();
    1036 
    1037           }           
    1038 
    1039         inline  void  TriangleAdjacent::SetAdj2(const TriangleAdjacent & ta, int l  ){
    1040                 //set Adjacent Triangle of a triangle
    1041                 if(t) {
    1042                         t->TriaAdjTriangles[a]=ta.t;
    1043                         t->TriaAdjSharedEdge[a]=ta.a|l;
    1044                 }
    1045                 if(ta.t) {
    1046                         ta.t->TriaAdjTriangles[ta.a] = t ;
    1047                         ta.t->TriaAdjSharedEdge[ta.a] = a| l ;
    1048                 }
    1049         }
    1050 
    1051 
    1052         inline int  TriangleAdjacent::Locked() const
    1053           { return t->TriaAdjSharedEdge[a] &4;}
    1054         inline int  TriangleAdjacent::Cracked() const
    1055           { return t->TriaAdjSharedEdge[a] &32;}
    1056         inline int  TriangleAdjacent::GetAllFlag_UnSwap() const
    1057           { return t->TriaAdjSharedEdge[a] & 1012;} // take all flag except MarkUnSwap
    1058 
    1059         inline int  TriangleAdjacent::MarkUnSwap() const
    1060           { return t->TriaAdjSharedEdge[a] &8;}
    1061 
    1062         inline void  TriangleAdjacent::SetLock(){ t->SetLocked(a);}
    1063 
    1064         inline void  TriangleAdjacent::SetCracked() { t->SetCracked(a);}
    1065 
    1066         inline  TriangleAdjacent TriangleAdjacent::Adj() const
    1067           { return  t->Adj(a);}
    1068 
    1069         inline Vertex  * TriangleAdjacent::EdgeVertex(const int & i) const
    1070           {return t->TriaVertices[VerticesOfTriangularEdge[a][i]]; }
    1071         inline Vertex  * TriangleAdjacent::OppositeVertex() const
    1072           {return t->TriaVertices[bamg::OppositeVertex[a]]; }
    1073         inline Icoor2 &  TriangleAdjacent::det() const
    1074           { return t->det;}
    1075         inline  TriangleAdjacent Adj(const TriangleAdjacent & a)
    1076           { return  a.Adj();}
    1077 
    1078         inline TriangleAdjacent Next(const TriangleAdjacent & ta)
    1079           { return TriangleAdjacent(ta.t,NextEdge[ta.a]);}
    1080 
    1081         inline TriangleAdjacent Previous(const TriangleAdjacent & ta)
    1082           { return TriangleAdjacent(ta.t,PreviousEdge[ta.a]);}
    1083 
    1084         inline void Adj(GeometricalEdge * & on,int &i)
    1085           {int j=i;i=on->DirAdj[i];on=on->Adj[j];}
    1086 
    1087         inline Real4 qualite(const Vertex &va,const Vertex &vb,const Vertex &vc)
    1088           {
    1089                 Real4 ret;
    1090                 I2 ia=va,ib=vb,ic=vc;
    1091                 I2 ab=ib-ia,bc=ic-ib,ac=ic-ia;
    1092                 Icoor2 deta=Det(ab,ac);
    1093                 if (deta <=0) ret = -1;
    1094                 else {
    1095                         Real8 a = sqrt((Real8) (ac,ac)),
    1096                                         b = sqrt((Real8) (bc,bc)),
    1097                                         c = sqrt((Real8) (ab,ab)),
    1098                                         p = a+b+c;
    1099                         Real8 h= Max(Max(a,b),c),ro=deta/p;
    1100                         ret = ro/h;}
    1101                         return ret;
    1102           }
    1103 
    1104 
    11051055        inline  Triangle::Triangle(Triangles *Th,Int4 i,Int4 j,Int4 k) {
    11061056                Vertex *v=Th->vertices;
     
    11191069                det=0;
    11201070        }
    1121 
    11221071        inline  Triangle::Triangle(Vertex *v0,Vertex *v1,Vertex *v2){
    11231072                TriaVertices[0]=v0;
     
    11311080                        link=NULL;}; 
    11321081        }
    1133 
    11341082        inline    Real4 Triangle::qualite()
    11351083          {
     
    11371085          }
    11381086
    1139 
    1140         Icoor2 inline det(const Vertex & a,const Vertex & b,const Vertex & c){
    1141                 register  Icoor2 bax = b.i.x - a.i.x ,bay = b.i.y - a.i.y;
    1142                 register  Icoor2 cax = c.i.x - a.i.x ,cay = c.i.y - a.i.y;
    1143                 return  bax*cay - bay*cax;
    1144           }
    1145 
    1146 
    1147                 void  swap(Triangle *t1,Int1 a1,
    1148                                         Triangle *t2,Int1 a2,
    1149                                         Vertex *s1,Vertex *s2,Icoor2 det1,Icoor2 det2);
    1150 
    1151                 int inline TriangleAdjacent::swap()
    1152                   { return  t->swap(a);}
    1153 
    1154                 int SwapForForcingEdge(Vertex   *  & pva ,Vertex  * &   pvb ,
    1155                                         TriangleAdjacent & tt1,Icoor2 & dets1,
    1156                                         Icoor2 & detsa,Icoor2 & detsb, int & nbswap);
    1157 
    1158                 int ForceEdge(Vertex &a, Vertex & b,TriangleAdjacent & taret) ;
    1159 
    1160                 inline  TriangleAdjacent FindTriangleAdjacent(Edge &E){
    1161                         Vertex * a = E.v[0];
    1162                         Vertex * b = E.v[1];
    1163 
    1164                         Triangle * t = a->t;
    1165                         int i = a->vint;
    1166                         TriangleAdjacent ta(t,EdgesVertexTriangle[i][0]); // Previous edge
    1167                         if (!t || i<0 || i>=3){
    1168                                 throw ErrorException(__FUNCT__,exprintf("!t || i<0 !! i>=3"));
    1169                         }
    1170                         if ( a!=(*t)(i)){
    1171                                 throw ErrorException(__FUNCT__,exprintf("a!=(*t)(i)"));
    1172                         }
    1173                         int k=0;
    1174                         do { // turn around vertex in direct sens (trigo)
    1175                                 k++;
    1176                                 if (k>=20000){
    1177                                         throw ErrorException(__FUNCT__,exprintf("k>=20000"));
    1178                                 }
    1179                                 //  in no crack => ta.EdgeVertex(1) == a otherwise ???
    1180                                 if (ta.EdgeVertex(1) ==  a && ta.EdgeVertex(0) ==  b) return ta; // find
    1181                                 ta = ta.Adj();
    1182                                 if (ta.EdgeVertex(0) ==  a && ta.EdgeVertex(1) ==  b) return ta; // find
    1183                                 --ta;
    1184                         } while (t != (Triangle *)ta);
    1185                         throw ErrorException(__FUNCT__,exprintf("FindTriangleAdjacent: triangle not found"));
    1186                         return TriangleAdjacent(0,0);//for compiler
    1187                   }
    1188 
    1189                 inline Vertex* TheVertex(Vertex * a){
    1190                         // give a unique vertex with smallest number
    1191                    // in case on crack in mesh
    1192                         Vertex * r(a), *rr;
    1193                         Triangle * t = a->t;
    1194                         int i = a->vint;
    1195                         TriangleAdjacent ta(t,EdgesVertexTriangle[i][0]); // Previous edge
    1196                         if (!t || i<0 || i>=3){
    1197                                 throw ErrorException(__FUNCT__,exprintf("!t || i<0 !! i>=3"));
    1198                         }
    1199                         if ( a!=(*t)(i)){
    1200                                 throw ErrorException(__FUNCT__,exprintf("a!=(*t)(i)"));
    1201                         }
    1202                         int k=0;
    1203                         do { // turn around vertex in direct sens (trigo)
    1204                                 k++;
    1205                                 if (k>=20000){
    1206                                         throw ErrorException(__FUNCT__,exprintf("k>=20000"));
    1207                                 }
    1208                                 //  in no crack => ta.EdgeVertex(1) == a
    1209                                 if ((rr=ta.EdgeVertex(0)) < r) r = rr;
    1210                                 ta = ta.Adj();
    1211                                 if ((rr=ta.EdgeVertex(1)) < r) r =rr;
    1212                                 --ta;
    1213                         } while (t != (Triangle*) ta); 
    1214                         return r;
    1215                   }
     1087        /*}}}1*/
     1088         /*INLINE functions of CLASS Edge{{{1*/
     1089        inline void Edge::Set(const Triangles & Th ,Int4 i,Triangles & ThNew)
     1090          {
     1091                *this = Th.edges[i];
     1092                v[0] = ThNew.vertices + Th.Number(v[0]);   
     1093                v[1] = ThNew.vertices + Th.Number(v[1]);
     1094                if (onGeometry)
     1095                 onGeometry =  ThNew.Gh.edges+Th.Gh.Number(onGeometry);
     1096                if (adj[0]) adj[0] =   ThNew.edges +   Th.Number(adj[0]);
     1097                if (adj[1]) adj[1] =   ThNew.edges +   Th.Number(adj[1]);
     1098
     1099          }
     1100        inline Real8 Edge::MetricLength() const
     1101          {
     1102                return LengthInterpole(v[0]->m,v[1]->m,v[1]->r - v[0]->r) ;
     1103          }
     1104
     1105        /*}}}1*/
     1106         /*INLINE functions of CLASS GeometricalEdge{{{1*/
     1107        inline void GeometricalEdge::Set(const GeometricalEdge & rec,const Geometry & Gh ,Geometry & GhNew)
     1108          {
     1109                *this = rec;
     1110                v[0] = GhNew.vertices + Gh.Number(v[0]);   
     1111                v[1] = GhNew.vertices + Gh.Number(v[1]);
     1112                if (Adj[0]) Adj[0] =  GhNew.edges + Gh.Number(Adj[0]);     
     1113                if (Adj[1]) Adj[1] =  GhNew.edges + Gh.Number(Adj[1]);     
     1114          }
     1115        /*}}}1*/
     1116         /*INLINE functions of CLASS Curve{{{1*/
     1117        inline void Curve::Set(const Curve & rec,const Geometry & Gh ,Geometry & GhNew)
     1118          {
     1119                *this = rec;
     1120                be = GhNew.edges + Gh.Number(be);   
     1121                ee = GhNew.edges + Gh.Number(ee);
     1122                if(next) next= GhNew.curves + Gh.Number(next);
     1123          }
     1124        /*}}}1*/
     1125         /*INLINE functions of CLASS SubDomain{{{1*/
     1126        inline void SubDomain::Set(const Triangles & Th ,Int4 i,Triangles & ThNew)
     1127          {
     1128                *this = Th.subdomains[i];
     1129                if ( head-Th.triangles<0 || head-Th.triangles>=Th.nbt){
     1130                        throw ErrorException(__FUNCT__,exprintf("head-Th.triangles<0 || head-Th.triangles>=Th.nbt"));
     1131                }
     1132                head = ThNew.triangles + Th.Number(head) ;
     1133                if (edge-Th.edges<0 || edge-Th.edges>=Th.nbe);{
     1134                        throw ErrorException(__FUNCT__,exprintf("edge-Th.edges<0 || edge-Th.edges>=Th.nbe"));
     1135                }
     1136                edge = ThNew.edges+ Th.Number(edge);
     1137          }
     1138        /*}}}1*/
     1139         /*INLINE functions of CLASS GeometricalSubDomain{{{1*/
     1140        inline void GeometricalSubDomain::Set(const GeometricalSubDomain & rec,const Geometry & Gh ,const Geometry & GhNew)
     1141          {
     1142                *this = rec;
     1143                edge = Gh.Number(edge) + GhNew.edges;
     1144          }
     1145        /*}}}1*/
     1146        /*INLINE functions of CLASS VertexOnEdge{{{1*/
     1147        inline void VertexOnEdge::Set(const Triangles & Th ,Int4 i,Triangles & ThNew)
     1148          {
     1149                *this = Th.VertexOnBThEdge[i]; 
     1150                v = ThNew.vertices + Th.Number(v);
     1151          }
     1152        /*}}}1*/
     1153        /*INLINE functions of CLASS VertexOnGeom{{{1*/
     1154        inline void VertexOnGeom::Set(const VertexOnGeom & rec,const Triangles & Th ,Triangles & ThNew)
     1155          {
     1156                *this = rec; 
     1157                mv = ThNew.vertices + Th.Number(mv);
     1158                if (gv)
     1159                 if (abscisse < 0 )
     1160                  gv = ThNew.Gh.vertices + Th.Gh.Number(gv);
     1161                 else
     1162                  ge = ThNew.Gh.edges + Th.Gh.Number(ge);
     1163
     1164          }
     1165        /*}}}1*/
     1166         /*INLINE functions of CLASS TriangleAdjacent{{{1*/
     1167        inline  void  TriangleAdjacent::SetAdj2(const TriangleAdjacent & ta, int l  ){
     1168                //set Adjacent Triangle of a triangle
     1169                if(t) {
     1170                        t->TriaAdjTriangles[a]=ta.t;
     1171                        t->TriaAdjSharedEdge[a]=ta.a|l;
     1172                }
     1173                if(ta.t) {
     1174                        ta.t->TriaAdjTriangles[ta.a] = t ;
     1175                        ta.t->TriaAdjSharedEdge[ta.a] = a| l ;
     1176                }
     1177        }
     1178        inline int  TriangleAdjacent::Locked() const
     1179          { return t->TriaAdjSharedEdge[a] &4;}
     1180        inline int  TriangleAdjacent::Cracked() const
     1181          { return t->TriaAdjSharedEdge[a] &32;}
     1182        inline int  TriangleAdjacent::GetAllFlag_UnSwap() const
     1183          { return t->TriaAdjSharedEdge[a] & 1012;} // take all flag except MarkUnSwap
     1184        inline int  TriangleAdjacent::MarkUnSwap() const
     1185          { return t->TriaAdjSharedEdge[a] &8;}
     1186        inline void  TriangleAdjacent::SetLock(){ t->SetLocked(a);}
     1187        inline void  TriangleAdjacent::SetCracked() { t->SetCracked(a);}
     1188        inline  TriangleAdjacent TriangleAdjacent::Adj() const
     1189          { return  t->Adj(a);}
     1190        inline Vertex  * TriangleAdjacent::EdgeVertex(const int & i) const
     1191          {return t->TriaVertices[VerticesOfTriangularEdge[a][i]]; }
     1192        inline Vertex  * TriangleAdjacent::OppositeVertex() const
     1193          {return t->TriaVertices[bamg::OppositeVertex[a]]; }
     1194        inline Icoor2 &  TriangleAdjacent::det() const
     1195          { return t->det;}
     1196        int inline TriangleAdjacent::swap()
     1197          { return  t->swap(a);}
     1198        /*}}}1*/
     1199
     1200        /*Other prototypes {{{1*/
     1201        TriangleAdjacent CloseBoundaryEdge(I2 ,Triangle *, double &,double &) ;
     1202        TriangleAdjacent CloseBoundaryEdgeV2(I2 A,Triangle *t, double &a,double &b);
     1203        Int4 FindTriangle(Triangles &Th, Real8 x, Real8 y, double* a,int & inside);
     1204        void  swap(Triangle *t1,Int1 a1,
     1205                                Triangle *t2,Int1 a2,
     1206                                Vertex *s1,Vertex *s2,Icoor2 det1,Icoor2 det2);
     1207        int SwapForForcingEdge(Vertex   *  & pva ,Vertex  * &   pvb ,
     1208                                TriangleAdjacent & tt1,Icoor2 & dets1,
     1209                                Icoor2 & detsa,Icoor2 & detsb, int & nbswap);
     1210        int ForceEdge(Vertex &a, Vertex & b,TriangleAdjacent & taret) ;
     1211        /*}}}1*/
     1212
    12161213}
    12171214#endif
Note: See TracChangeset for help on using the changeset viewer.