1364 |
} |
} |
1365 |
break; |
break; |
1366 |
} |
} |
|
case 1: { |
|
|
std::map<const Vertex*,const Vertex*>::const_iterator it=pointsInterior.begin(); |
|
|
const Vertex& D=*((*it).second); |
|
|
if(edgesCut[0]==1) { |
|
|
const Vertex& B=__determinateNumber(vertexNum[0],pointsIntersection); |
|
|
if(edgesCut[1]==1) { |
|
|
const Vertex& C=__determinateNumber(vertexNum[1],pointsIntersection); |
|
|
if( D==B ) { |
|
|
__addTriangle(Triangle(A,C,D,K.reference()),cell,triangleListIntersectionNew); |
|
|
} else if(C==D){ |
|
|
__addTriangle(Triangle(A,B,D,K.reference()),cell,triangleListIntersectionNew); |
|
|
} else { |
|
|
__addTriangle(Triangle(A,B,D,K.reference()),cell,triangleListIntersectionNew); |
|
|
__addTriangle(Triangle(A,D,C,K.reference()),cell,triangleListIntersectionNew); |
|
|
} |
|
|
} else { |
|
|
ffout(4)<<"-------- warning trou in 0\n"<<std::flush; |
|
|
ffout(4)<<V0<<"\n"; |
|
|
ffout(4)<<V1<<"\n"; |
|
|
ffout(4)<<V2<<"\n"; |
|
|
//#warning Reference not set. |
|
|
__addTriangle(Triangle(A,B,D,K.reference()),cell,triangleListIntersectionNew); |
|
|
} |
|
|
} else { |
|
|
if(edgesCut[1]==1) { |
|
|
ffout(4)<<"-------- warning trou in\n"<<std::flush; |
|
|
const Vertex& B=__determinateNumber(vertexNum[1],pointsIntersection); |
|
|
//#warning Reference not set. |
|
|
__addTriangle(Triangle(A,B,D,K.reference()),cell,triangleListIntersectionNew); |
|
|
} else { |
|
|
ffout(4) <<"pbs 1\n"<<std::flush; |
|
|
} |
|
|
} |
|
|
break; |
|
|
} |
|
1367 |
default: { |
default: { |
1368 |
#warning is it true? case where only one edge is cut? |
#warning is it true? case where only one edge is cut? |
1369 |
ffout(4) << numberPointsInterior<<" be careful 1\n"<<std::flush; |
ffout(4) << numberPointsInterior<<" be careful 1\n"<<std::flush; |
1370 |
//case 1 point inside and more than 1 point in the triangle |
//case 1 point inside and more than 1 point in the triangle |
1371 |
// __createByEdges(K, cell, triangleListIntersectionNew); |
__createByEdges(K, cell, triangleListIntersectionNew); |
1372 |
} |
} |
1373 |
} |
} |
1374 |
} |
} |
1457 |
} else { |
} else { |
1458 |
ffout(4) <<"pbs 20\n"; |
ffout(4) <<"pbs 20\n"; |
1459 |
//#warning Reference not set. |
//#warning Reference not set. |
1460 |
__addTriangle(Triangle(A,B,C,K.reference()),cell,triangleListIntersectionNew); |
//__addTriangle(Triangle(A,B,C,K.reference()),cell,triangleListIntersectionNew); |
1461 |
} |
} |
1462 |
} else { |
} else { |
1463 |
if(edgesCut[1]==1) { |
if(edgesCut[1]==1) { |
1464 |
ffout(4) <<"pbs 210\n"; |
ffout(4) <<"pbs 210\n"; |
1465 |
const Vertex& C=__determinateNumber(vertexNum[1],pointsIntersection); |
const Vertex& C=__determinateNumber(vertexNum[1],pointsIntersection); |
1466 |
//#warning Reference not set. |
//#warning Reference not set. |
1467 |
__addTriangle(Triangle(A,B,C,K.reference()),cell,triangleListIntersectionNew); |
//__addTriangle(Triangle(A,B,C,K.reference()),cell,triangleListIntersectionNew); |
1468 |
} else { |
} else { |
1469 |
ffout(4) <<"pbs 21\n"<<std::flush; |
ffout(4) <<"pbs 21\n"<<std::flush; |
1470 |
ffout(4)<<V0<<"\n"; |
ffout(4)<<V0<<"\n"; |
1614 |
const Vertex*& V1=pairTriangleToIntersectionPoints[pairTriangle][1]; |
const Vertex*& V1=pairTriangleToIntersectionPoints[pairTriangle][1]; |
1615 |
const Triangle T=(*(*jt0)); |
const Triangle T=(*(*jt0)); |
1616 |
real_t epsilon=1e-6; |
real_t epsilon=1e-6; |
1617 |
//if((V0==&(*(*jt0))(0) or V0==&(*(*jt0))(1) or V0==&(*(*jt0))(2)) |
if((V0==&(*(*jt0))(0) or V0==&(*(*jt0))(1) or V0==&(*(*jt0))(2)) |
1618 |
// and (V1==&(*(*jt0))(0) or V1==&(*(*jt0))(1) or V1==&(*(*jt0))(2))) { |
and (V1==&(*(*jt0))(0) or V1==&(*(*jt0))(1) or V1==&(*(*jt0))(2))) { |
|
if(Norm((*V0)-(*V1)) <epsilon and (Norm((*V0)-T(0))<epsilon |
|
|
or Norm((*V0)-T(1))<epsilon |
|
|
or Norm((*V0)-T(2))<epsilon)){ |
|
1619 |
//ffout(4)<<"inter confondu avec arete\n"; |
//ffout(4)<<"inter confondu avec arete\n"; |
1620 |
isDegenerate=1; |
isDegenerate=1; |
1621 |
} |
} |
1625 |
const Vertex*& V=pairTriangleToIntersectionPoints[pairTriangle][b]; |
const Vertex*& V=pairTriangleToIntersectionPoints[pairTriangle][b]; |
1626 |
const Triangle T=(*(*jt0)); |
const Triangle T=(*(*jt0)); |
1627 |
real_t epsilon=1e-6; |
real_t epsilon=1e-6; |
1628 |
if(/*!(V==&(*(*jt0))(0) or V==&(*(*jt0))(1) or V==&(*(*jt0))(2))*/ |
if(!(V==&(*(*jt0))(0) or V==&(*(*jt0))(1) or V==&(*(*jt0))(2)) |
|
(Norm((*V)-T(0))<epsilon |
|
|
or Norm((*V)-T(1))<epsilon |
|
|
or Norm((*V)-T(2))<epsilon) |
|
1629 |
or b==0) { |
or b==0) { |
1630 |
if(vertexInTriangles.find(V)==vertexInTriangles.end()) { |
if(vertexInTriangles.find(V)==vertexInTriangles.end()) { |
1631 |
TinyVector<2,const Triangle*> triangles; |
TinyVector<2,const Triangle*> triangles; |
1792 |
const Triangle* T=&(surfmesh.cell(i)); |
const Triangle* T=&(surfmesh.cell(i)); |
1793 |
const Cell* cell=&((*T).mother()); |
const Cell* cell=&((*T).mother()); |
1794 |
if(toTreatHexahedra.find(cell)!=toTreatHexahedra.end() |
if(toTreatHexahedra.find(cell)!=toTreatHexahedra.end() |
1795 |
/* and ((*edgesRefVertex[numobject])[&(*T)(0)]!=0 |
and ((*edgesRefVertex[numobject])[&(*T)(0)]==2 |
1796 |
or (*edgesRefVertex[numobject])[&(*T)(1)]!=0 |
or (*edgesRefVertex[numobject])[&(*T)(1)]==2 |
1797 |
or (*edgesRefVertex[numobject])[&(*T)(2)]!=0)*/) { |
or (*edgesRefVertex[numobject])[&(*T)(2)]==2)) { |
1798 |
front.push_front(T); |
front.push_front(T); |
1799 |
const Triangle*& TT=(*listOfTriangleMeshFront.find(T)).second; |
const Triangle*& TT=(*listOfTriangleMeshFront.find(T)).second; |
1800 |
// on traite le triangle du front |
// on traite le triangle du front |
1832 |
size_t& refo0=(*edgesRefVertex[numobject])[&(*T)(0)]; |
size_t& refo0=(*edgesRefVertex[numobject])[&(*T)(0)]; |
1833 |
size_t& refo1=(*edgesRefVertex[numobject])[&(*T)(1)]; |
size_t& refo1=(*edgesRefVertex[numobject])[&(*T)(1)]; |
1834 |
size_t& refo2=(*edgesRefVertex[numobject])[&(*T)(2)]; |
size_t& refo2=(*edgesRefVertex[numobject])[&(*T)(2)]; |
1835 |
|
|
1836 |
if((refo0+refo1+refo2!=0 and refo0+refo1+refo2!=6 and edgeo0+edgeo1+edgeo2==0) |
if(((refo0==2 or refo1==2 or refo2==2) and refo0+refo1+refo2<6 and edgeo0+edgeo1+edgeo2==0) |
1837 |
|
/* or (refo0+refo1+refo2!=6 and edgeo0+edgeo1+edgeo2==0 and refo0+refo1+refo2>0)*/ |
1838 |
/*or (edgeo0[0]==1 and refo0+refo1!=2 and refo0+refo1+refo2!=0) |
/*or (edgeo0[0]==1 and refo0+refo1!=2 and refo0+refo1+refo2!=0) |
1839 |
or (edgeo1[0]==1 and refo0+refo2!=2 and refo0+refo1+refo2!=0) |
or (edgeo1[0]==1 and refo0+refo2!=2 and refo0+refo1+refo2!=0) |
1840 |
or (edgeo2[0]==1 and refo2+refo1!=2 and refo0+refo1+refo2!=0)*/) { |
or (edgeo2[0]==1 and refo2+refo1!=2 and refo0+refo1+refo2!=0)*/) { |
1841 |
ffout(4)<<"chouette on garde\n"; |
ffout(4)<<"chouette on garde "<<refo0+refo1+refo2<<"\n"; |
1842 |
erase=0; |
refo0=2; |
1843 |
|
refo1=2; |
1844 |
|
refo2=2; |
1845 |
|
erase=1; |
1846 |
} else { |
} else { |
1847 |
erase=1; |
erase=1; |
1848 |
} |
} |
1870 |
TinyVector<2,int> edge0=Kneigh.edgecut[0]; |
TinyVector<2,int> edge0=Kneigh.edgecut[0]; |
1871 |
TinyVector<2,int> edge1=Kneigh.edgecut[1]; |
TinyVector<2,int> edge1=Kneigh.edgecut[1]; |
1872 |
TinyVector<2,int> edge2=Kneigh.edgecut[2]; |
TinyVector<2,int> edge2=Kneigh.edgecut[2]; |
1873 |
if(ref0+ref1==2 and edge0==0) { |
size_t sum=edge0[0]+edge1[0]+edge2[0]; |
1874 |
test=1; |
if((ref0==2 or ref1==2 or ref2==2) and |
1875 |
ref0=2; |
(ref0!=1 and ref1!=1 and ref2!=1) and sum==0) { |
1876 |
ref1=2; |
ffout(0)<<"ref 2 partout\n"; |
1877 |
} else if(edge0[0]==1 and ref0+ref1!=2 and ref0+ref1+ref2!=0){ |
test=1; |
1878 |
//test=1; |
ref0=2; |
1879 |
} |
ref1=2; |
1880 |
if(ref0+ref2==2 and edge1==0) { |
ref2=2; |
1881 |
test=1; |
} else { |
1882 |
ref0=2; |
if((ref1==2 or ref0==2) and edge0==1){ |
1883 |
ref2=2; |
//ffout(4)<<"ref 1 2 0 partout\n"; |
1884 |
} else if(edge1[0]==1 and ref0+ref2!=2 and ref0+ref1+ref2!=0){ |
//ffout(4)<<ref0<<" "<<ref1<<"\n"; |
1885 |
//test=1; |
if(ref1+ref0!=3) { |
1886 |
} |
test=1; |
1887 |
if(ref2+ref1==2 and edge2==0) { |
} |
1888 |
test=1; |
if(ref0==2) { |
1889 |
ref2=2; |
ref1=1; |
1890 |
ref1=2; |
} else { |
1891 |
} else if(edge2[0]==1 and ref2+ref1!=2 and ref0+ref1+ref2!=0){ |
ref0=1; |
1892 |
//test=1; |
} |
1893 |
} |
} |
1894 |
|
if((ref2==2 or ref0==2) and edge1==1){ |
1895 |
|
//ffout(0)<<"ref 1 2 1 partout\n"; |
1896 |
|
//ffout(4)<<ref0<<" "<<ref2<<"\n"; |
1897 |
|
if(ref2+ref0!=3) { |
1898 |
|
test=1; |
1899 |
|
} |
1900 |
|
if(ref0==2) { |
1901 |
|
ref2=1; |
1902 |
|
} else { |
1903 |
|
ref0=1; |
1904 |
|
} |
1905 |
|
} |
1906 |
|
if((ref2==2 or ref1==2) and edge2==1){ |
1907 |
|
//ffout(0)<<"ref 1 2 2 partout\n"; |
1908 |
|
//ffout(4)<<ref1<<" "<<ref2<<"\n"; |
1909 |
|
if(ref1+ref2!=3) { |
1910 |
|
test=1; |
1911 |
|
} |
1912 |
|
if(ref2==2) { |
1913 |
|
ref1=1; |
1914 |
|
} else { |
1915 |
|
ref2=1; |
1916 |
|
} |
1917 |
|
} |
1918 |
|
} |
1919 |
if(test==1/*ref0+ref1+ref2==6 *//*or edge0[0]+edge1[0]+edge2[0]==1*/) { |
if(test==1/*ref0+ref1+ref2==6 *//*or edge0[0]+edge1[0]+edge2[0]==1*/) { |
1920 |
front.push_front(triangle); |
front.push_front(triangle); |
1921 |
} |
} |
1948 |
size_t& ref0=(*edgesRefVertex[numobject])[&(*Tmesh)(0)]; |
size_t& ref0=(*edgesRefVertex[numobject])[&(*Tmesh)(0)]; |
1949 |
size_t& ref1=(*edgesRefVertex[numobject])[&(*Tmesh)(1)]; |
size_t& ref1=(*edgesRefVertex[numobject])[&(*Tmesh)(1)]; |
1950 |
size_t& ref2=(*edgesRefVertex[numobject])[&(*Tmesh)(2)]; |
size_t& ref2=(*edgesRefVertex[numobject])[&(*Tmesh)(2)]; |
1951 |
if(!(ref0==2 and ref1==2 and ref2==2)) { |
|
1952 |
|
if(ref0+ref1+ref2!=6) { |
1953 |
TinyVector<2,int> edge0=edgecut[0]; |
TinyVector<2,int> edge0=edgecut[0]; |
1954 |
TinyVector<2,int> edge1=edgecut[1]; |
TinyVector<2,int> edge1=edgecut[1]; |
1955 |
TinyVector<2,int> edge2=edgecut[2]; |
TinyVector<2,int> edge2=edgecut[2]; |
1956 |
if(ref0+ref1==2 and edge0==0) { |
size_t sum=edge0[0]+edge1[0]+edge2[0]; |
1957 |
|
if((ref0==2 or ref1==2 or ref2==2) and sum==0) { |
1958 |
ref0=2; |
ref0=2; |
1959 |
ref1=2; |
ref1=2; |
|
} |
|
|
if(ref0+ref2==2 and edge1==0) { |
|
|
ref0=2; |
|
|
ref2=2; |
|
|
} |
|
|
if(ref2+ref1==2 and edge2==0) { |
|
1960 |
ref2=2; |
ref2=2; |
1961 |
ref1=2; |
} else { |
1962 |
|
if((ref1==2 or ref0==2) and edge0==1){ |
1963 |
|
if(ref0==2) { |
1964 |
|
ref1=1; |
1965 |
|
} else { |
1966 |
|
ref0=1; |
1967 |
|
} |
1968 |
|
} |
1969 |
|
if((ref2==2 or ref0==2) and edge1==1){ |
1970 |
|
if(ref0==2) { |
1971 |
|
ref2=1; |
1972 |
|
} else { |
1973 |
|
ref0=1; |
1974 |
|
} |
1975 |
|
} |
1976 |
|
if((ref2==2 or ref1==2) and edge2==1){ |
1977 |
|
if(ref2==2) { |
1978 |
|
ref1=1; |
1979 |
|
} else { |
1980 |
|
ref2=1; |
1981 |
|
} |
1982 |
|
} |
1983 |
} |
} |
1984 |
} |
} |
1985 |
} |
} |
2260 |
|
|
2261 |
const Vertex* Pend=K.pointsIntersection[place1][0]; |
const Vertex* Pend=K.pointsIntersection[place1][0]; |
2262 |
#warning size of Tiny |
#warning size of Tiny |
2263 |
|
size_t b=0; |
2264 |
TinyVector<30,const Vertex*> P; |
TinyVector<30,const Vertex*> P; |
2265 |
TinyVector<30,const Triangle*> T; |
TinyVector<30,const Triangle*> T; |
2266 |
P[0]=K.pointsIntersection[place0][0]; |
P[0]=K.pointsIntersection[place0][0]; |
2267 |
if(vertexInTriangles.find(P[0])!=vertexInTriangles.end()) { |
if(vertexInTriangles.find(P[0])!=vertexInTriangles.end()) { |
2268 |
T[0]=(*vertexInTriangles.find(P[0])).second[0]; |
T[0]=(*vertexInTriangles.find(P[0])).second[0]; |
2269 |
} else { |
} else { |
2270 |
|
b=29; |
2271 |
ffout(4)<<"pbs 0 existe pas\n"; |
ffout(4)<<"pbs 0 existe pas\n"; |
2272 |
} |
} |
2273 |
|
|
|
size_t b=0; |
|
2274 |
while(P[b]!=Pend and b<29) { |
while(P[b]!=Pend and b<29) { |
2275 |
if(triangleWithVertex.find(T[b])!=triangleWithVertex.end()) { |
if(triangleWithVertex.find(T[b])!=triangleWithVertex.end()) { |
2276 |
TinyVector<2,const Vertex*> VV=(*triangleWithVertex.find(T[b])).second; |
TinyVector<2,const Vertex*> VV=(*triangleWithVertex.find(T[b])).second; |
2482 |
K.isInTriangle[k]=0; |
K.isInTriangle[k]=0; |
2483 |
} |
} |
2484 |
} |
} |
2485 |
if((*edgesRefVertex[numobject])[&K(0)]+ (*edgesRefVertex[numobject])[&K(1)]+ (*edgesRefVertex[numobject])[&K(2)]!=0 and |
if( K.isInTriangle[0]+ K.isInTriangle[1]+ K.isInTriangle[2]!=0 and |
2486 |
(*edgesRefVertex[numobject])[&K(0)]+ (*edgesRefVertex[numobject])[&K(1)]+ (*edgesRefVertex[numobject])[&K(2)]!=6 |
K.isInTriangle[0]+ K.isInTriangle[1]+ K.isInTriangle[2]!=3 |
2487 |
and K.edgecut[0]+ K.edgecut[1]+ K.edgecut[2]==0) { |
and K.edgecut[0]+ K.edgecut[1]+ K.edgecut[2]==0) { |
|
|
|
2488 |
ffout(4)<<"cas pbssssss\n"; |
ffout(4)<<"cas pbssssss\n"; |
2489 |
|
ffout(4)<<(*edgesRefVertex[numobject])[&K(0)]<<" "<<(*edgesRefVertex[numobject])[&K(1)]<< |
2490 |
|
" "<<(*edgesRefVertex[numobject])[&K(2)]<<" "<<K.edgecut<<"\n"; |
2491 |
|
|
2492 |
} |
} |
2493 |
if(K.edgecut[0][0]+K.edgecut[1][0]+K.edgecut[2][0]>=6) { |
if(K.edgecut[0][0]+K.edgecut[1][0]+K.edgecut[2][0]>=6) { |
2494 |
ffout(4)<<"on veut rien faire car triangle plat\n"; |
ffout(4)<<"on veut rien faire car triangle plat\n"; |
2504 |
case 0: { |
case 0: { |
2505 |
if(K.edgecut[0]+K.edgecut[1]+K.edgecut[2]==3 and vertexInTriangles.size()<3) { |
if(K.edgecut[0]+K.edgecut[1]+K.edgecut[2]==3 and vertexInTriangles.size()<3) { |
2506 |
ffout(4)<<"tous les points d'inter ne sont pas dans la liste\n"; |
ffout(4)<<"tous les points d'inter ne sont pas dans la liste\n"; |
2507 |
__casePinterNotInList(K,*i, triangleListIntersectionNew); |
//__casePinterNotInList(K,*i, triangleListIntersectionNew); |
2508 |
std::exit(1); |
//std::exit(1); |
2509 |
} else if(K.edgecut[0]+K.edgecut[1]+K.edgecut[2]!=0) { |
} else if(K.edgecut[0]+K.edgecut[1]+K.edgecut[2]!=0) { |
2510 |
if(vertexInTriangles.size()==3) { |
if(vertexInTriangles.size()==3) { |
2511 |
//there are 3 points intersection so we create a triangle |
//there are 3 points intersection so we create a triangle |
2516 |
//one edge cut but twice |
//one edge cut but twice |
2517 |
ffout(4)<<"createNotIn\n"; |
ffout(4)<<"createNotIn\n"; |
2518 |
//POUR STEPH : createNotIn peut generer des tr plats |
//POUR STEPH : createNotIn peut generer des tr plats |
2519 |
//__createNotIn(K,*i, triangleListIntersectionNew); |
__createNotIn(K,*i, triangleListIntersectionNew); |
2520 |
} else { |
} else { |
2521 |
if(vertexInTriangles.size()>3 and numberEdgesCut==2) { |
if(vertexInTriangles.size()>3 and numberEdgesCut==2) { |
2522 |
//two edge cut but twice |
//two edge cut but twice |
2611 |
and K.pointsIntersection[1][0]!=K.pointsIntersection[2][0] |
and K.pointsIntersection[1][0]!=K.pointsIntersection[2][0] |
2612 |
and K.pointsIntersection[2][0]!=K.pointsIntersection[0][0]) { |
and K.pointsIntersection[2][0]!=K.pointsIntersection[0][0]) { |
2613 |
ffout(4)<<"---------------- 3 edge cut \n"; |
ffout(4)<<"---------------- 3 edge cut \n"; |
2614 |
//__createByEdges(K,*i,triangleListIntersectionNew); |
__createByEdges(K,*i,triangleListIntersectionNew); |
2615 |
} else { |
} else { |
2616 |
__createListTriangle(K,*i,triangleListIntersectionNew); |
__createListTriangle(K,*i,triangleListIntersectionNew); |
2617 |
} |
} |
3398 |
(*__internals).__constructionFinalMesh((*objectStack.top()), |
(*__internals).__constructionFinalMesh((*objectStack.top()), |
3399 |
s_mesh); |
s_mesh); |
3400 |
|
|
3401 |
// #warning _________________________________A ENLEVER_________ |
#warning _________________________________A ENLEVER_________ |
3402 |
// Connectivity<Triangle> connect(s_mesh.numberOfCells()); |
Connectivity<Triangle> connect(s_mesh.numberOfCells()); |
3403 |
// ConnectivityBuilder<SurfaceMeshOfTriangles> C(s_mesh,connect); |
ConnectivityBuilder<SurfaceMeshOfTriangles> C(s_mesh,connect); |
3404 |
// size_t compt=0; |
size_t compt=0; |
3405 |
// for(size_t i=0 ; i<s_mesh.numberOfCells() ; ++i) { |
for(size_t i=0 ; i<s_mesh.numberOfCells() ; ++i) { |
3406 |
// const Triangle& T=s_mesh.cell(i); |
const Triangle& T=s_mesh.cell(i); |
3407 |
// TinyVector<3,const Triangle*> V=connect(s_mesh.cellNumber(T)); |
TinyVector<3,const Triangle*> V=connect(s_mesh.cellNumber(T)); |
3408 |
// for(size_t j=0 ; j<3 ; ++j) { |
for(size_t j=0 ; j<3 ; ++j) { |
3409 |
// if(V[j]==0) { |
if(V[j]==0) { |
3410 |
// //ffout(4)<<"attention un des voisins n'existe pas\n"; |
//ffout(4)<<"attention un des voisins n'existe pas\n"; |
3411 |
// ++compt; |
++compt; |
3412 |
// } |
} |
3413 |
// } |
} |
3414 |
// } |
} |
3415 |
// ffout(4)<<"****************************il manque "<<compt<<" sommets\n"; |
ffout(4)<<"****************************il manque "<<compt<<" sommets\n"; |
3416 |
// ///////////////////////////////////////////////////////////////////////////// |
///////////////////////////////////////////////////////////////////////////// |
3417 |
|
|
3418 |
int n0=0, n1=0; |
int n0=0, n1=0; |
3419 |
|
|