Changeset 12934
- Timestamp:
- 08/07/12 13:44:19 (13 years ago)
- Location:
- issm/trunk-jpl/src/c/classes/bamg
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/classes/bamg/Mesh.cpp
r12876 r12934 5644 5644 } 5645 5645 /*}}}*/ 5646 /*FUNCTION CloseBoundaryEdgeV2{{{*/5647 AdjacentTriangle CloseBoundaryEdgeV2(I2 C,Triangle *t, double &a,double &b) {5648 /*Original code from Frederic Hecht <hecht@ann.jussieu.fr> (BAMG v1.01, Mesh2.cpp/CloseBoundaryEdgeV2)*/5649 // walk around the vertex5650 // version 2 for remove the probleme if we fill the hole5651 //int bug=1;5652 // Triangle *torigine = t;5653 // restart:5654 // int dir=0;5655 if (t->link != 0){5656 _error2_("t->link != 0");5657 }5658 // to have a starting edges5659 // try the 3 edge bourna-- in case of internal hole5660 // and choice the best5661 //5662 // the probleme is in case of the fine and long internal hole5663 // for exemple neart the training edge of a wing5664 BamgVertex * s=0,*s1=0, *s0=0;5665 Icoor2 imax = MaxICoor22;5666 Icoor2 l0 = imax,l1 = imax;5667 double dd2 = imax;// infinity5668 AdjacentTriangle er;5669 int cas=-2;5670 for (int j=0;j<3;j++)5671 {5672 AdjacentTriangle ta=t->FindBoundaryEdge(j);5673 if (! (Triangle *) ta) continue;5674 s0 = ta.EdgeVertex(0);5675 s1 = ta.EdgeVertex(1);5676 I2 A = * s0;5677 I2 B = *ta.EdgeVertex(1);5678 I2 AB = B-A,AC=C-A,BC=B-C;5679 Icoor2 ACAC = (AC,AC), BCBC = (BC,BC);5680 Icoor2 AB2 = Norme2_2(AB); // ||AB||^25681 Icoor2 ABAC = (AB,AC); // AB.AC|5682 5683 double d2;5684 if ( ABAC < 0 ) // DIST A5685 {5686 if ( (d2=(double) ACAC) < dd2)5687 {5688 er = ta;5689 l0 = ACAC;5690 l1 = BCBC;5691 cas = 0;5692 s = s0;5693 }5694 }5695 else if (ABAC > AB2) // DIST B5696 {5697 if ( (d2=(double) BCBC) < dd2)5698 {5699 dd2 = d2;5700 er = Adj(ta); // other direction5701 l0 = BCBC;5702 l1 = ACAC;5703 cas = 1;5704 s = s1;5705 }5706 }5707 else // DIST AB5708 {5709 5710 double det_2 = (double) Det(AB,AC);5711 det_2 *= det_2; // square of area*2 of triangle ABC5712 d2 = det_2/ (double) AB2; // hauteur^2 in C of of triangle ABC5713 5714 if (d2 < dd2)5715 {5716 dd2 = d2;5717 er = ta;5718 l0 = (AC,AC);5719 l1 = (BC,BC);5720 s = 0;5721 cas = -1;5722 b = ((double) ABAC/(double) AB2);5723 a = 1 - b;5724 }5725 }5726 }5727 if (cas ==-2){5728 _error2_("cas==-2");5729 }5730 // l1 = ||C s1|| , l0 = ||C s0||5731 // where s0,s1 are the vertex of the edge er5732 5733 if ( s)5734 {5735 t=er;5736 AdjacentTriangle edge(er);5737 5738 int kkk=0;5739 int linkp = t->link == 0;5740 5741 Triangle * tt=t=edge=Adj(Previous(edge));5742 do { // loop over vertex s5743 kkk++;5744 if (edge.EdgeVertex(0)!=s && kkk>=10000){5745 _error2_("edge.EdgeVertex(0)!=s && kkk>=10000");5746 }5747 5748 int link = tt->link == 0;5749 if ((link + linkp) == 1)5750 { // a boundary edge5751 BamgVertex * st = edge.EdgeVertex(1);5752 I2 I=*st;5753 Icoor2 ll = Norme2_2 (C-I);5754 if (ll < l1) { // the other vertex is neart5755 s1=st;5756 l1=ll;5757 er = edge;5758 if(ll<l0) { // change of direction --5759 s1=s;5760 l1=l0;5761 s=st;5762 l0=ll;5763 t=tt;5764 edge=Adj(edge);5765 link=linkp;5766 er = edge;5767 }5768 }5769 }5770 5771 linkp=link;5772 edge=Adj(Previous(edge));5773 tt = edge;5774 } while (t!=tt);5775 5776 if (!(Triangle *) er){5777 _error2_("!(Triangle *) er");5778 }5779 I2 A((I2)*er.EdgeVertex(0));5780 I2 B((I2)*er.EdgeVertex(1));5781 I2 AB=B-A,AC=C-A,CB=B-C;5782 double aa = (double) (AB,AC);5783 double bb = (double) (AB,CB);5784 if (aa<0) a=1,b=0;5785 else if(bb<0) a=0,b=1;5786 else5787 {5788 a = bb/(aa+bb);5789 b = aa/(aa+bb);5790 }5791 }5792 return er;5793 }5794 /*}}}*/5795 5646 /*FUNCTION ForceEdge{{{*/ 5796 5647 int ForceEdge(BamgVertex &a, BamgVertex & b,AdjacentTriangle & taret) { -
issm/trunk-jpl/src/c/classes/bamg/Mesh.h
r12821 r12934 154 154 /*Intermediary*/ 155 155 AdjacentTriangle CloseBoundaryEdge(I2 ,Triangle *, double &,double &) ; 156 AdjacentTriangle CloseBoundaryEdgeV2(I2 A,Triangle *t, double &a,double &b);157 156 void swap(Triangle *t1,short a1, 158 157 Triangle *t2,short a2, -
issm/trunk-jpl/src/c/classes/bamg/macros.h
r12908 r12934 20 20 static const short PreviousVertex[3] = {2,0,1}; 21 21 const Icoor1 MaxICoor = 1073741823; // 2^30-1 =111...111 (29 times one) 22 const Icoor2 MaxICoor22 = (Icoor2(2)*Icoor2(MaxICoor)*Icoor2(MaxICoor));23 22 } 24 23
Note:
See TracChangeset
for help on using the changeset viewer.