Changeset 16233 for issm/trunk-jpl/src/c/bamg/Triangle.cpp
- Timestamp:
- 09/23/13 11:01:34 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/bamg/Triangle.cpp
r16231 r16233 53 53 return AdjacentTriangle(adj[i],AdjEdgeIndex[i]&3); 54 54 };/*}}}*/ 55 /*FUNCTION Triangle::Anisotropy{{{*/56 double Triangle::Anisotropy() const{57 58 double lmin,lmax;59 60 /*Get three vertices A,B and C*/61 R2 A=*this->vertices[0];62 R2 B=*this->vertices[1];63 R2 C=*this->vertices[2];64 65 /*Compute edges*/66 R2 e1=B-A;67 R2 e2=C-A;68 R2 e3=B-C;69 70 /*Compute edge length*/71 double l1=Norme2(e1);72 double l2=Norme2(e2);73 double l3=Norme2(e3);74 75 lmin=l1;76 lmin=min(lmin,l2);77 lmin=min(lmin,l3);78 lmax=l1;79 lmax=max(lmax,l2);80 lmax=max(lmax,l3);81 82 return lmax/lmin;83 };/*}}}*/84 55 /*FUNCTION Triangle::Length{{{*/ 85 56 double Triangle::Length() const{ … … 133 104 134 105 return; 135 }136 /*}}}*/137 /*FUNCTION Triangle::FindBoundaryEdge{{{*/138 AdjacentTriangle Triangle::FindBoundaryEdge(int i) const{139 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Mesh2.cpp/FindBoundaryEdge)*/140 141 /*Intermediary*/142 Triangle* ttc=NULL;143 int k,j,jc;144 145 // call current triangle t146 Triangle* t = (Triangle*)this;147 148 //is the current triangle inside or outside?149 int outside=!link ;150 151 // EdgesVertexTriangle[3][2] = {{1,2},{2,0},{0,1}};152 // initialize j as the first vertex of the ith edge153 j=EdgesVertexTriangle[i][0];154 155 //Loop over the adjacent triangle of t156 k=0;157 do{158 //keep track of outside159 int outsidep = outside;160 //increment k161 k++;162 //Get ttc, adjacent triangle of t with respect to vertex j163 ttc = t->adj[j];164 //is the current triangle inside or outside?165 outside = !ttc->link;166 //if both previous triangle are outside, return167 if (outside+outsidep == 1) return AdjacentTriangle(t,j);168 169 //update t and j170 t = ttc;171 //NextEdge[3] = {1,2,0};172 jc = NextEdge[t->AdjEdgeIndex[j]&3];173 j = NextEdge[jc];174 175 //check number of iterations176 if (k>=2000){177 _error_("too many iteration in Triangle::FindBoundaryEdge (k>=2000)");178 }179 } while (this!= t);180 //not found, return empty triangle181 return AdjacentTriangle(NULL,0);182 106 } 183 107 /*}}}*/
Note:
See TracChangeset
for help on using the changeset viewer.