68 |
inline bool checkInterbis(const Vertex &P1, const Vertex &P2, const Vertex &Q1, const Vertex &Q2) { |
inline bool checkInterbis(const Vertex &P1, const Vertex &P2, const Vertex &Q1, const Vertex &Q2) { |
69 |
// retourne true si P1P2 inter Q1Q2 != vide |
// retourne true si P1P2 inter Q1Q2 != vide |
70 |
assert(!(P1 == P2 || P1 == Q1 || P1 == Q2 || P2 == Q1 || P2 == Q2 || Q1 == Q2)); |
assert(!(P1 == P2 || P1 == Q1 || P1 == Q2 || P2 == Q1 || P2 == Q2 || Q1 == Q2)); |
71 |
const double eps = 1e-15; |
const double eps = 1e-12; |
72 |
/*if (std::abs(SDet(Q1,Q2,P1)) <eps|| |
/*if (std::abs(SDet(Q1,Q2,P1)) <eps|| |
73 |
std::abs(SDet(Q1,Q2,P2)) <eps) { |
std::abs(SDet(Q1,Q2,P2)) <eps) { |
74 |
//ffout(0) << " !!!!! NO !!!!!!!" << std::endl; |
//ffout(0) << " !!!!! NO !!!!!!!" << std::endl; |
75 |
return true; |
return true; |
76 |
}*/ |
}*/ |
77 |
|
if(std::abs(SDet(P1,P2,Q1))<eps and std::abs(SDet(P1,P2,Q2))<eps and |
78 |
|
std::abs(SDet(Q1,Q2,P1))<eps and std::abs(SDet(Q1,Q2,P2))<eps) { |
79 |
|
return true; |
80 |
|
} |
81 |
return ((SDet(P1,P2,Q1)*SDet(P1,P2,Q2) < 0) && (SDet(Q1,Q2,P1)*SDet(Q1,Q2,P2) < 0)); // version optimisée |
return ((SDet(P1,P2,Q1)*SDet(P1,P2,Q2) < 0) && (SDet(Q1,Q2,P1)*SDet(Q1,Q2,P2) < 0)); // version optimisée |
82 |
} |
} |
83 |
class SurfaceMeshGenerator::Internals |
class SurfaceMeshGenerator::Internals |
265 |
TinyVector<3,const Vertex *> & V, |
TinyVector<3,const Vertex *> & V, |
266 |
size_t& ncompt); |
size_t& ncompt); |
267 |
|
|
|
void __inout(const size_t& numobject, |
|
|
const int& ttn0, |
|
|
const Vertex*& V0, |
|
|
const Vertex*& V1); |
|
268 |
|
|
269 |
TinyVector<4, real_t> __EquationPlan(const TinyVector<3,const Vertex *> & V); |
TinyVector<4, real_t> __EquationPlan(const TinyVector<3,const Vertex *> & V); |
270 |
|
|
338 |
std::vector<const Vertex*>& points, |
std::vector<const Vertex*>& points, |
339 |
size_t& in, |
size_t& in, |
340 |
size_t& in1, |
size_t& in1, |
341 |
TinyVector<3,size_t> place); |
TinyVector<3,size_t>& place); |
342 |
|
|
343 |
|
void __create2List(const TriangleCut& K, |
344 |
|
TinyVector<2,const Vertex*>& P, |
345 |
|
std::vector<const Vertex*>& points, |
346 |
|
std::vector<const Vertex*>& pointslist1, |
347 |
|
std::vector<const Vertex*>& pointslist2); |
348 |
|
|
349 |
bool __verifExist(const Vertex* Ptemp, |
bool __verifExist(const Vertex* Ptemp, |
350 |
std::vector<const Vertex*>& points); |
std::vector<const Vertex*>& points); |
351 |
bool __findOneEdge(const TriangleCut& K, |
bool __findOneEdge(const TriangleCut& K, |
1119 |
__DeterminatePoint(3,(Vo012[1]),(Vo012[2]),V012,Pinter, listVertexIntersectionNew); |
__DeterminatePoint(3,(Vo012[1]),(Vo012[2]),V012,Pinter, listVertexIntersectionNew); |
1120 |
} |
} |
1121 |
|
|
|
void SurfaceMeshGenerator::Internals:: |
|
|
__inout(const size_t& numobject, |
|
|
const int & edgeCut, |
|
|
const Vertex*& V0, |
|
|
const Vertex*& V1) |
|
|
{// if the edge is not cut , put ref=2 for the 2 vertex |
|
|
size_t& refVertex0=(*edgesRefVertex[numobject])[V0]; |
|
|
size_t& refVertex1=(*edgesRefVertex[numobject])[V1]; |
|
|
|
|
|
if(refVertex0+refVertex1==4 and edgeCut==1) { |
|
|
ffout(4)<<"warning edge ref 2 cut \n"; |
|
|
ffout(4)<<(*V0)[0]<<" "<<(*V0)[1]<<" "<<(*V0)[2]<<" \n"; |
|
|
ffout(4)<<(*V1)[0]<<" "<<(*V1)[1]<<" "<<(*V1)[2]<<" \n"; |
|
|
refVertex0=0; |
|
|
refVertex1=0; |
|
|
} else { |
|
|
// CECILE: ne serait-ce pas plutôt une assertion ? |
|
|
if(refVertex0+refVertex1==2 and edgeCut==0) { |
|
|
refVertex0=2; |
|
|
refVertex1=2; |
|
|
} |
|
|
} |
|
|
} |
|
1122 |
|
|
1123 |
void SurfaceMeshGenerator::Internals:: |
void SurfaceMeshGenerator::Internals:: |
1124 |
__createPointIntersection(std::list<Triangle*>::iterator currentTriangle1, |
__createPointIntersection(std::list<Triangle*>::iterator currentTriangle1, |
1581 |
ref0=2; |
ref0=2; |
1582 |
ref1=2; |
ref1=2; |
1583 |
ref2=2; |
ref2=2; |
1584 |
} else { |
} else { |
1585 |
if((ref1==2 or ref0==2) and edge0==1){ |
if((ref1==2 or ref0==2) and edge0==1 and sum>1 and ref0+ref1!=4){ |
1586 |
//ffout(4)<<"ref 1 2 0 partout\n"; |
//ffout(4)<<"ref 1 2 0 partout\n"; |
1587 |
//ffout(4)<<ref0<<" "<<ref1<<"\n"; |
//ffout(4)<<ref0<<" "<<ref1<<"\n"; |
1588 |
if(ref1+ref0!=3) { |
if(ref1+ref0!=3) { |
1594 |
ref0=1; |
ref0=1; |
1595 |
} |
} |
1596 |
} |
} |
1597 |
if((ref2==2 or ref0==2) and edge1==1){ |
if((ref2==2 or ref0==2) and edge1==1 and sum>1 and ref0+ref2!=4){ |
1598 |
//ffout(0)<<"ref 1 2 1 partout\n"; |
//ffout(0)<<"ref 1 2 1 partout\n"; |
1599 |
//ffout(4)<<ref0<<" "<<ref2<<"\n"; |
//ffout(4)<<ref0<<" "<<ref2<<"\n"; |
1600 |
if(ref2+ref0!=3) { |
if(ref2+ref0!=3) { |
1606 |
ref0=1; |
ref0=1; |
1607 |
} |
} |
1608 |
} |
} |
1609 |
if((ref2==2 or ref1==2) and edge2==1){ |
if((ref2==2 or ref1==2) and edge2==1 and sum>1 and ref1+ref2!=4){ |
1610 |
//ffout(0)<<"ref 1 2 2 partout\n"; |
//ffout(0)<<"ref 1 2 2 partout\n"; |
1611 |
//ffout(4)<<ref1<<" "<<ref2<<"\n"; |
//ffout(4)<<ref1<<" "<<ref2<<"\n"; |
1612 |
if(ref1+ref2!=3) { |
if(ref1+ref2!=3) { |
1660 |
TinyVector<2,int> edge1=edgecut[1]; |
TinyVector<2,int> edge1=edgecut[1]; |
1661 |
TinyVector<2,int> edge2=edgecut[2]; |
TinyVector<2,int> edge2=edgecut[2]; |
1662 |
size_t sum=edge0[0]+edge1[0]+edge2[0]; |
size_t sum=edge0[0]+edge1[0]+edge2[0]; |
1663 |
if((ref0==2 or ref1==2 or ref2==2) and sum==0) { |
if((ref0==2 or ref1==2 or ref2==2) and sum==0 and ref0+ref1!=4) { |
1664 |
ref0=2; |
ref0=2; |
1665 |
ref1=2; |
ref1=2; |
1666 |
ref2=2; |
ref2=2; |
1667 |
} else { |
} else { |
1668 |
if((ref1==2 or ref0==2) and edge0==1){ |
if((ref1==2 or ref0==2) and edge0==1 and sum>1 and ref0+ref2!=4){ |
1669 |
if(ref0==2) { |
if(ref0==2) { |
1670 |
ref1=1; |
ref1=1; |
1671 |
} else { |
} else { |
1672 |
ref0=1; |
ref0=1; |
1673 |
} |
} |
1674 |
} |
} |
1675 |
if((ref2==2 or ref0==2) and edge1==1){ |
if((ref2==2 or ref0==2) and edge1==1 and sum>1 and ref1+ref2!=4){ |
1676 |
if(ref0==2) { |
if(ref0==2) { |
1677 |
ref2=1; |
ref2=1; |
1678 |
} else { |
} else { |
1679 |
ref0=1; |
ref0=1; |
1680 |
} |
} |
1681 |
} |
} |
1682 |
if((ref2==2 or ref1==2) and edge2==1){ |
if((ref2==2 or ref1==2) and edge2==1 and sum>1){ |
1683 |
if(ref2==2) { |
if(ref2==2) { |
1684 |
ref1=1; |
ref1=1; |
1685 |
} else { |
} else { |
1765 |
break; |
break; |
1766 |
} |
} |
1767 |
case 3: { |
case 3: { |
1768 |
if(K.isInTriangle[0]==1) { |
if(K.edgecut[0][0]==1) { |
1769 |
|
in1=2; |
1770 |
|
in=0; |
1771 |
place[0]=0; |
place[0]=0; |
1772 |
if(K.isInTriangle[1]==1) { |
if(K.edgecut[1][0]==1) { |
1773 |
place[1]=1; |
place[1]=1; |
1774 |
place[2]=2; |
place[2]=2; |
1775 |
} else { |
} else { |
1776 |
place[1]=2; |
place[1]=2; |
1777 |
place[2]=1; |
place[2]=1; |
1778 |
} |
} |
1779 |
} else if(K.isInTriangle[1]==1) { |
} else if(K.edgecut[1][0]==1) { |
1780 |
|
in1=1; |
1781 |
|
in=2; |
1782 |
place[0]=1; |
place[0]=1; |
1783 |
place[1]=2; |
place[1]=2; |
1784 |
place[2]=0; |
place[2]=0; |
1785 |
} else { |
} else { |
1786 |
|
in1=0; |
1787 |
|
in=1; |
1788 |
place[0]=2; |
place[0]=2; |
1789 |
place[1]=1; |
place[1]=1; |
1790 |
place[2]=0; |
place[2]=0; |
1842 |
size_t numberInEdges=K.edgecut[0][0]+K.edgecut[1][0]+K.edgecut[2][0] |
size_t numberInEdges=K.edgecut[0][0]+K.edgecut[1][0]+K.edgecut[2][0] |
1843 |
+K.edgecut[0][1]+K.edgecut[1][1]+K.edgecut[2][1]; |
+K.edgecut[0][1]+K.edgecut[1][1]+K.edgecut[2][1]; |
1844 |
size_t nbInter=vertexInTriangles.size(); |
size_t nbInter=vertexInTriangles.size(); |
1845 |
ffout(4)<<"nb Inter avt = "<<nbInter<<"\n"; |
//ffout(4)<<"nb Inter avt = "<<nbInter<<"\n"; |
1846 |
ffout(4)<<"nb points total "<<vertexVectTriangles.size()<<"\n"; |
ffout(4)<<"nb points total "<<vertexVectTriangles.size()<<"\n"; |
1847 |
//premiere etage : verifier que vertexInTriangles contient bien tous les points |
//premiere etage : verifier que vertexInTriangles contient bien tous les points |
1848 |
if(nbInter<vertexVectTriangles.size()) { |
if(nbInter<vertexVectTriangles.size()) { |
1900 |
} |
} |
1901 |
|
|
1902 |
void SurfaceMeshGenerator::Internals:: |
void SurfaceMeshGenerator::Internals:: |
1903 |
|
__create2List(const TriangleCut& K, |
1904 |
|
TinyVector<2,const Vertex*>& P, |
1905 |
|
std::vector<const Vertex*>& points, |
1906 |
|
std::vector<const Vertex*>& pointslist1, |
1907 |
|
std::vector<const Vertex*>& pointslist2) |
1908 |
|
{ |
1909 |
|
size_t taille=points.size(); |
1910 |
|
size_t stopcut=0; |
1911 |
|
size_t number=1; |
1912 |
|
if(P[0]!=P[1]) { |
1913 |
|
number=2; |
1914 |
|
} |
1915 |
|
for(unsigned ie=1;ie<taille;++ie) { |
1916 |
|
const Vertex* Pcut=points[ie]; |
1917 |
|
//ffout(4)<<*Pcut<<"\n"; |
1918 |
|
if(Pcut==P[0]) { |
1919 |
|
__addPoints(Pcut,stopcut,pointslist1,pointslist2); |
1920 |
|
if(stopcut==3) { |
1921 |
|
stopcut=1; |
1922 |
|
} |
1923 |
|
} else { |
1924 |
|
if(number==2) { |
1925 |
|
if(Pcut==P[1]) { |
1926 |
|
__addPoints(Pcut,stopcut,pointslist1,pointslist2); |
1927 |
|
if(stopcut==3) { |
1928 |
|
stopcut=1; |
1929 |
|
} |
1930 |
|
} else { |
1931 |
|
__addPoints(Pcut,stopcut,pointslist1,pointslist2); |
1932 |
|
if(stopcut==3) { |
1933 |
|
stopcut=0; |
1934 |
|
} |
1935 |
|
} |
1936 |
|
} else { |
1937 |
|
__addPoints(Pcut,stopcut,pointslist1,pointslist2); |
1938 |
|
if(stopcut==3) { |
1939 |
|
stopcut=0; |
1940 |
|
} |
1941 |
|
} |
1942 |
|
} |
1943 |
|
} |
1944 |
|
} |
1945 |
|
|
1946 |
|
void SurfaceMeshGenerator::Internals:: |
1947 |
__createList(const TriangleCut& K, |
__createList(const TriangleCut& K, |
1948 |
std::vector<const Vertex*>& points, |
std::vector<const Vertex*>& points, |
1949 |
size_t& in, |
size_t& in, |
1950 |
size_t& in1, |
size_t& in1, |
1951 |
TinyVector<3,size_t> place) |
TinyVector<3,size_t>& place) |
1952 |
{ |
{ |
1953 |
TinyVector<2,const Vertex*> P; |
TinyVector<2,const Vertex*> P; |
1954 |
TinyVector<2,const Triangle*> T; |
TinyVector<2,const Triangle*> T; |
1957 |
size_t numberIn=K.isInTriangle[0]+K.isInTriangle[1]+K.isInTriangle[2]; |
size_t numberIn=K.isInTriangle[0]+K.isInTriangle[1]+K.isInTriangle[2]; |
1958 |
size_t stop=0,iInter=0,iCut=0; |
size_t stop=0,iInter=0,iCut=0; |
1959 |
//initialisation |
//initialisation |
1960 |
if(numberIn==3) { |
if(numberIn==3 or numberIn==2 and stop==0) { |
|
points.push_back(&K(1)); |
|
|
points.push_back(&K(2)); |
|
|
} |
|
|
if(numberIn==2 and stop==0) { |
|
1961 |
points.push_back(&K(in1)); |
points.push_back(&K(in1)); |
1962 |
} |
} |
1963 |
const Vertex* A=&K(in); |
const Vertex* A=&K(in); |
1996 |
} else { |
} else { |
1997 |
ffout(4)<<"******\n"; |
ffout(4)<<"******\n"; |
1998 |
ffout(4)<<"nb Inter "<<nbInter<<"\n"; |
ffout(4)<<"nb Inter "<<nbInter<<"\n"; |
1999 |
ffout(4)<<"P0 = "<<P[0]<<*P[0]<<"\n"; |
//ffout(4)<<"P0 = "<<P[0]<<" "<<*P[0]<<"\n"; |
2000 |
ffout(4)<<"K(2) = "<<K(1)<<&K(1)<<"\n"; |
ffout(4)<<"place = "<<place<<"\n"; |
2001 |
ffout(4)<<"pbs 0 existe pas\n"; |
ffout(4)<<"pbs 0 existe pas\n"; |
2002 |
ffout(4)<<*K.pointsIntersection[1][0]<<"\n"; |
//ffout(4)<<*K.pointsIntersection[2][0]<<"\n"; |
2003 |
ffout(4)<<*K.pointsIntersection[2][0]<<"\n"; |
//ffout(4)<<*K.pointsIntersection[2][1]<<"\n"; |
2004 |
ffout(4)<<*K.pointsIntersection[2][1]<<"\n"; |
points.clear(); |
2005 |
stop=1; |
stop=1; |
2006 |
} |
} |
2007 |
} |
} |
2017 |
} |
} |
2018 |
} |
} |
2019 |
|
|
2020 |
if(iInter==nbInter and nbInter==1 and numberIn==1) { |
if(stop==0 and iInter==nbInter and nbInter==1 and numberIn==1) { |
2021 |
//ATTENTION PEUT ETRE PLUS DE POINTS A PRENDRE |
//ATTENTION PEUT ETRE PLUS DE POINTS A PRENDRE |
2022 |
if(nbCut>1) { |
if(nbCut>1) { |
2023 |
const Vertex* PP=K.pointsIntersection[place[1]][0]; |
const Vertex* PP=K.pointsIntersection[place[1]][0]; |
2184 |
//ffout(4)<<"cas 2\n"; |
//ffout(4)<<"cas 2\n"; |
2185 |
P[1]=VV[1]; |
P[1]=VV[1]; |
2186 |
P[0]=P[1]; |
P[0]=P[1]; |
2187 |
ffout(4)<<P[0]<<"\n"; |
//ffout(4)<<P[0]<<"\n"; |
2188 |
ffout(4)<<*P[0]<<"\n"; |
//ffout(4)<<*P[0]<<"\n"; |
2189 |
points.push_back(P[0]); |
points.push_back(P[0]); |
2190 |
++iInter; |
++iInter; |
2191 |
} |
} |
2243 |
std::vector<Triangle>& triangleListIntersectionNew, |
std::vector<Triangle>& triangleListIntersectionNew, |
2244 |
std::vector<const Vertex*>& points, |
std::vector<const Vertex*>& points, |
2245 |
std::vector<Vertex>& pointstrian) { |
std::vector<Vertex>& pointstrian) { |
2246 |
|
static int toto=0; |
2247 |
size_t taille=points.size(); |
size_t taille=points.size(); |
2248 |
Triangulation trgen; |
Triangulation trgen; |
2249 |
Triangulation::CurveVertex envVertex(taille+1); |
Triangulation::CurveVertex envVertex(taille+1); |
2271 |
std::vector<Triangulation::CurveVertex> curves(0); |
std::vector<Triangulation::CurveVertex> curves(0); |
2272 |
|
|
2273 |
if(taille>3) { |
if(taille>3) { |
2274 |
//ffout(4)<<"je triangule\n"; |
//ffout(4)<<"je triangule\n"; |
2275 |
//ffout(4)<<++toto<<"\n"; |
ffout(4)<<++toto<<"\n"; |
2276 |
//verifions que les points ne s'intersectent pas avant de lancer la triangulation |
//verifions que les points ne s'intersectent pas avant de lancer la triangulation |
2277 |
bool isOK=false; |
bool isOK=false; |
2278 |
//ffout(4)<<"nb de points "<<taille<<"\n"; |
//ffout(4)<<"nb de points "<<taille<<" = ? "<<pointstrian.size()<<"\n"; |
2279 |
size_t ie=1; |
size_t ie=1; |
2280 |
|
|
2281 |
while(ie<taille-2 and !isOK) { |
while(ie<taille-2 and !isOK) { |
2282 |
|
ffout(4)<<"--- "<<ie<<"\n"; |
2283 |
isOK=checkInterbis(pointstrian[0],pointstrian[taille-1],pointstrian[ie],pointstrian[ie+1]); |
isOK=checkInterbis(pointstrian[0],pointstrian[taille-1],pointstrian[ie],pointstrian[ie+1]); |
2284 |
++ie; |
++ie; |
2285 |
} |
} |
2286 |
|
if(isOK) { |
2287 |
|
ffout(4)<<"points qui se coupent!!!!!!!\n"; |
2288 |
|
//std::exit(0); |
2289 |
|
} |
2290 |
if(!isOK) { |
if(!isOK) { |
2291 |
//verification que les points ne sont pas trop proches!! |
//verification que les points ne sont pas trop proches!! |
2292 |
ie=0; |
ie=0; |
2297 |
isOK=(norm<1e-6); |
isOK=(norm<1e-6); |
2298 |
++ie; |
++ie; |
2299 |
} |
} |
2300 |
|
if(isOK) { |
2301 |
|
ffout(4)<<"des points sont trop proches!!!\n"; |
2302 |
|
} |
2303 |
} |
} |
2304 |
if(!isOK) { |
if(!isOK) { |
2305 |
trgen.triangulize(pointstrian, |
trgen.triangulize(pointstrian, |
2310 |
std::ofstream o("full.mesh"); |
std::ofstream o("full.mesh"); |
2311 |
trgen.export_mesh(o); |
trgen.export_mesh(o); |
2312 |
std::list<ConnectedTriangle> L=trgen.getTriangles(); |
std::list<ConnectedTriangle> L=trgen.getTriangles(); |
2313 |
|
if(L.size()==1) { |
2314 |
|
ffout(4)<<"----------pbs mailleur\n"; |
2315 |
|
ffout(4)<<L.size()<<" ecrit\n"; |
2316 |
|
} |
2317 |
|
if(toto==153) { |
2318 |
|
//std::exit(0); |
2319 |
|
} |
2320 |
for(std::list<ConnectedTriangle>::iterator itL=L.begin() ; itL!= L.end() ; itL++) { |
for(std::list<ConnectedTriangle>::iterator itL=L.begin() ; itL!= L.end() ; itL++) { |
2321 |
Triangle T=(*itL); |
Triangle T=(*itL); |
2322 |
Vertex* P0=&T(0); |
Vertex* P0=&T(0); |
2333 |
ffout(4)<<K(1)<<"\n"; |
ffout(4)<<K(1)<<"\n"; |
2334 |
ffout(4)<<K(2)<<"\n"; |
ffout(4)<<K(2)<<"\n"; |
2335 |
} |
} |
|
//ffout(4)<<L.size()<<" ecrit\n"; |
|
2336 |
} else if(taille==3) { |
} else if(taille==3) { |
2337 |
ffout(4)<<"je cree un triangle\n"; |
//ffout(4)<<"je cree un triangle\n"; |
2338 |
__addTriangle(Triangle(*points[0], |
__addTriangle(Triangle(*points[0], |
2339 |
*points[1], |
*points[1], |
2340 |
*points[2], |
*points[2], |
2352 |
__createGeneral(const TriangleCut& K,const Cell* cell, |
__createGeneral(const TriangleCut& K,const Cell* cell, |
2353 |
std::vector<Triangle>& triangleListIntersectionNew) |
std::vector<Triangle>& triangleListIntersectionNew) |
2354 |
{ |
{ |
2355 |
static int toto=0; |
|
2356 |
// pour l'instant on suppose edge cut une seule fois |
// pour l'instant on suppose edge cut une seule fois |
2357 |
size_t in=0,in1=1; |
size_t in=0,in1=1; |
2358 |
TinyVector<3,size_t> place; |
TinyVector<3,size_t> place; |
2379 |
} |
} |
2380 |
|
|
2381 |
///////////////////////////////////////////////////////////////////////////// |
///////////////////////////////////////////////////////////////////////////// |
2382 |
|
Vertex A(-0.8,0.84641,0.775); |
2383 |
|
if(Norm(A-K(0))<1e-6 or Norm(A-K(1))<1e-6 or Norm(A-K(2))<1e-6 ){ |
2384 |
|
ffout(4)<<"=============\n"; |
2385 |
|
ffout(4)<<K(0)<<"\n"; |
2386 |
|
ffout(4)<<K(1)<<"\n"; |
2387 |
|
ffout(4)<<K(2)<<"\n"; |
2388 |
|
ffout(4)<<K.isInTriangle<<"\n"; |
2389 |
|
ffout(4)<<K.edgecut<<"\n"; |
2390 |
|
ffout(4)<<place<<"\n"; |
2391 |
|
} |
2392 |
|
|
2393 |
/* if(K.edgecut[0][0]+K.edgecut[1][0]+K.edgecut[2][0]==3 |
/* if(K.edgecut[0][0]+K.edgecut[1][0]+K.edgecut[2][0]==3 |
2394 |
and K.isInTriangle[0]+K.isInTriangle[1]+K.isInTriangle[2]==1 ) { |
and K.isInTriangle[0]+K.isInTriangle[1]+K.isInTriangle[2]==1 ) { |
2395 |
ffout(4)<<norm01<<" "<<norm02<<" "<<norm21<<"\n"; |
ffout(4)<<norm01<<" "<<norm02<<" "<<norm21<<"\n"; |
2422 |
size_t taille=points.size(); |
size_t taille=points.size(); |
2423 |
// met les points dans le plan du triangle |
// met les points dans le plan du triangle |
2424 |
std::vector<Vertex> pointstrian(taille); |
std::vector<Vertex> pointstrian(taille); |
2425 |
|
ffout(4)<<"points size "<<taille<<"\n"; |
2426 |
__transformVertex(K,points,pointstrian); |
__transformVertex(K,points,pointstrian); |
2427 |
|
|
2428 |
if(K.isInTriangle[0]+K.isInTriangle[1]+K.isInTriangle[2]==2 and |
if(K.isInTriangle[0]+K.isInTriangle[1]+K.isInTriangle[2]==2 and |
2438 |
switch (number) { |
switch (number) { |
2439 |
case 1: { |
case 1: { |
2440 |
P[0]=K.pointsIntersection[place[2]][0]; |
P[0]=K.pointsIntersection[place[2]][0]; |
2441 |
|
P[1]=K.pointsIntersection[place[2]][0]; |
2442 |
break; |
break; |
2443 |
} |
} |
2444 |
case 2: { |
case 2: { |
2449 |
} |
} |
2450 |
std::vector<const Vertex*> pointslist1; |
std::vector<const Vertex*> pointslist1; |
2451 |
std::vector<const Vertex*> pointslist2; |
std::vector<const Vertex*> pointslist2; |
2452 |
|
|
2453 |
size_t stopcut=0; |
__create2List(K,P,points,pointslist1,pointslist2); |
|
for(unsigned ie=1;ie<taille;++ie) { |
|
|
const Vertex* Pcut=points[ie]; |
|
|
//ffout(4)<<*Pcut<<"\n"; |
|
|
const Vertex& Pcutplan=pointstrian[ie]; |
|
|
if(Pcut==P[0]) { |
|
|
__addPoints(Pcut,stopcut,pointslist1,pointslist2); |
|
|
if(stopcut==3) { |
|
|
stopcut=1; |
|
|
} |
|
|
} else { |
|
|
if(number==2) { |
|
|
if(Pcut==P[1]) { |
|
|
__addPoints(Pcut,stopcut,pointslist1,pointslist2); |
|
|
if(stopcut==3) { |
|
|
stopcut=1; |
|
|
} |
|
|
} else { |
|
|
__addPoints(Pcut,stopcut,pointslist1,pointslist2); |
|
|
if(stopcut==3) { |
|
|
stopcut=0; |
|
|
} |
|
|
} |
|
|
} else { |
|
|
__addPoints(Pcut,stopcut,pointslist1,pointslist2); |
|
|
if(stopcut==3) { |
|
|
stopcut=0; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
2454 |
pointslist2.push_back(points[0]); |
pointslist2.push_back(points[0]); |
2455 |
/*//verif des listes |
/*//verif des listes |
2456 |
ffout(4)<<"taille de list1 = "<<pointslist1.size()<<"\n"; |
ffout(4)<<"taille de list1 = "<<pointslist1.size()<<"\n"; |
2491 |
} |
} |
2492 |
std::vector<const Vertex*> pointslist1; |
std::vector<const Vertex*> pointslist1; |
2493 |
std::vector<const Vertex*> pointslist2; |
std::vector<const Vertex*> pointslist2; |
2494 |
size_t stopcut=0; |
if(numberP==1) { |
2495 |
for(unsigned ie=1;ie<taille;++ie) { |
__create2List(K,P,points,pointslist1,pointslist2); |
2496 |
const Vertex* Pcut=points[ie]; |
pointslist1.push_back(&K(in1)); |
2497 |
//ffout(4)<<*Pcut<<"\n"; |
pointslist2.push_back(&K(in1)); |
2498 |
if(Pcut==P[0]) { |
pointslist2.push_back(P[0]); |
2499 |
__addPoints(Pcut,stopcut,pointslist1,pointslist2); |
} else { |
2500 |
if(stopcut==3) { |
//il faut creer 3 list!!! |
2501 |
stopcut=1; |
std::vector<const Vertex*> pointslist3; |
2502 |
} |
size_t stopcut=0; |
2503 |
} else { |
for(unsigned ie=1;ie<taille;++ie) { |
2504 |
if(number==2) { |
const Vertex* Pcut=points[ie]; |
2505 |
if(Pcut==P[1]) { |
if(Pcut==P[0]) { |
2506 |
|
if(stopcut==0) { |
2507 |
__addPoints(Pcut,stopcut,pointslist1,pointslist2); |
__addPoints(Pcut,stopcut,pointslist1,pointslist2); |
2508 |
if(stopcut==3) { |
if(stopcut==3) { |
2509 |
stopcut=1; |
stopcut=1; |
2510 |
} |
} |
2511 |
|
} else if(stopcut==1) { |
2512 |
|
stopcut=0; |
2513 |
|
__addPoints(Pcut,stopcut,pointslist2,pointslist3); |
2514 |
|
if(stopcut==3) { |
2515 |
|
stopcut=2; |
2516 |
|
} else { |
2517 |
|
stopcut=1; |
2518 |
|
} |
2519 |
} else { |
} else { |
2520 |
|
ffout(4)<<"stopcut==2 on devrait avoir fini\n"; |
2521 |
|
} |
2522 |
|
} else if(Pcut==P[1]) { |
2523 |
|
if(stopcut==0) { |
2524 |
__addPoints(Pcut,stopcut,pointslist1,pointslist2); |
__addPoints(Pcut,stopcut,pointslist1,pointslist2); |
2525 |
if(stopcut==3) { |
if(stopcut==3) { |
2526 |
stopcut=0; |
stopcut=1; |
2527 |
} |
} |
2528 |
} |
} else if(stopcut==1) { |
|
} else { |
|
|
__addPoints(Pcut,stopcut,pointslist1,pointslist2); |
|
|
if(stopcut==3) { |
|
2529 |
stopcut=0; |
stopcut=0; |
2530 |
|
__addPoints(Pcut,stopcut,pointslist2,pointslist3); |
2531 |
|
if(stopcut==3) { |
2532 |
|
stopcut=2; |
2533 |
|
} else { |
2534 |
|
stopcut=1; |
2535 |
|
} |
2536 |
|
} else { |
2537 |
|
ffout(4)<<"stopcut==22 on devrait avoir fini\n"; |
2538 |
} |
} |
2539 |
|
} else { |
2540 |
|
if(stopcut==0) { |
2541 |
|
__addPoints(Pcut,stopcut,pointslist1,pointslist2); |
2542 |
|
stopcut=0; |
2543 |
|
} else if(stopcut==1) { |
2544 |
|
stopcut=0; |
2545 |
|
__addPoints(Pcut,stopcut,pointslist2,pointslist3); |
2546 |
|
stopcut=1; |
2547 |
|
} else { |
2548 |
|
stopcut=0; |
2549 |
|
__addPoints(Pcut,stopcut,pointslist3,pointslist3); |
2550 |
|
stopcut=2; |
2551 |
|
} |
2552 |
} |
} |
2553 |
} |
} |
2554 |
} |
pointslist1.push_back(&K(in1)); |
2555 |
pointslist2.push_back(points[0]); |
pointslist2.push_back(&K(in1)); |
2556 |
pointslist2.push_back(points[1]); |
pointslist2.push_back(P[0]); |
2557 |
pointslist2.push_back(P[0]); |
size_t in2=0; |
2558 |
|
if(in+in1==1) { |
2559 |
|
in2=2; |
2560 |
|
} else if(in+in1==2) { |
2561 |
|
in2=1; |
2562 |
|
} |
2563 |
|
pointslist3.push_back(&K(in2)); |
2564 |
|
pointslist3.push_back(&K(in1)); |
2565 |
|
pointslist3.push_back(P[1]); |
2566 |
|
if(pointslist3.size()>=3) { |
2567 |
|
std::vector<Vertex> pointslist3plan(pointslist3.size()); |
2568 |
|
__transformVertex(K,pointslist3,pointslist3plan); |
2569 |
|
__createTriangle(K,cell,triangleListIntersectionNew,pointslist3,pointslist3plan); |
2570 |
|
} |
2571 |
|
|
2572 |
|
|
2573 |
|
} |
2574 |
//on cree les 2 maillages |
//on cree les 2 maillages |
2575 |
if(pointslist1.size()>=3) { |
if(pointslist1.size()>=3) { |
2576 |
std::vector<Vertex> pointslist1plan(pointslist1.size()); |
std::vector<Vertex> pointslist1plan(pointslist1.size()); |
2577 |
__transformVertex(K,pointslist1,pointslist1plan); |
__transformVertex(K,pointslist1,pointslist1plan); |
2578 |
__createTriangle(K,cell,triangleListIntersectionNew,pointslist1,pointslist1plan); |
__createTriangle(K,cell,triangleListIntersectionNew,pointslist1,pointslist1plan); |
2579 |
} |
} |
2580 |
|
ffout(4)<<"taille de list2 = "<<pointslist2.size()<<"\n"; |
2581 |
|
for(unsigned ie=0;ie<pointslist2.size();++ie) { |
2582 |
|
ffout(4)<<*pointslist2[ie]<<"\n"; |
2583 |
|
} |
2584 |
if(pointslist2.size()>=3) { |
if(pointslist2.size()>=3) { |
2585 |
std::vector<Vertex> pointslist2plan(pointslist2.size()); |
std::vector<Vertex> pointslist2plan(pointslist2.size()); |
2586 |
__transformVertex(K,pointslist2,pointslist2plan); |
__transformVertex(K,pointslist2,pointslist2plan); |
2620 |
size_t objectNumber=0; |
size_t objectNumber=0; |
2621 |
if(numobject==0) |
if(numobject==0) |
2622 |
objectNumber=1; |
objectNumber=1; |
2623 |
// (*edgesRefVertex[numobject]).clear(); |
(*edgesRefVertex[numobject]).clear(); |
2624 |
const MapCellTriangle& hexaToTriangle0=*(O1.hexalist); |
const MapCellTriangle& hexaToTriangle0=*(O1.hexalist); |
2625 |
|
|
2626 |
|
|
2724 |
ffout(4)<<"cas pbssssss\n"; |
ffout(4)<<"cas pbssssss\n"; |
2725 |
ffout(4)<<(*edgesRefVertex[numobject])[&K(0)]<<" "<<(*edgesRefVertex[numobject])[&K(1)]<< |
ffout(4)<<(*edgesRefVertex[numobject])[&K(0)]<<" "<<(*edgesRefVertex[numobject])[&K(1)]<< |
2726 |
" "<<(*edgesRefVertex[numobject])[&K(2)]<<" "<<K.edgecut<<"\n"; |
" "<<(*edgesRefVertex[numobject])[&K(2)]<<" "<<K.edgecut<<"\n"; |
2727 |
// __addTriangle(Triangle(K(0),K(1),K(2),K.reference()),*i,triangleListIntersectionNew); |
//__addTriangle(Triangle(K(0),K(1),K(2),K.reference()),*i,triangleListIntersectionNew); |
2728 |
|
|
2729 |
} |
} |
2730 |
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) { |
2775 |
} |
} |
2776 |
case 2: { |
case 2: { |
2777 |
if(K.edgecut[0][0]+K.edgecut[1][0]+K.edgecut[2][0]<2) { |
if(K.edgecut[0][0]+K.edgecut[1][0]+K.edgecut[2][0]<2) { |
2778 |
ffout(4)<<"pbs pas assez d'edge cut \n"; |
ffout(4)<<"------------ pbs pas assez d'edge cut \n"; |
2779 |
|
ffout(4)<<K.edgecut<<"\n"; |
2780 |
|
ffout(4)<<K(0)<<"\n"; |
2781 |
|
ffout(4)<<K(1)<<"\n"; |
2782 |
|
ffout(4)<<K(2)<<"\n"; |
2783 |
} else { |
} else { |
2784 |
ffout(4)<<"---------- case 2\n"; |
ffout(4)<<"---------- case 2\n"; |
2785 |
ffout(4)<<K.edgecut[0]<<" "<<K.edgecut[1]<<" "<<K.edgecut[2]<<"\n"; |
ffout(4)<<K.edgecut[0]<<" "<<K.edgecut[1]<<" "<<K.edgecut[2]<<"\n"; |
3577 |
(*__internals).__constructionFinalMesh((*objectStack.top()), |
(*__internals).__constructionFinalMesh((*objectStack.top()), |
3578 |
s_mesh); |
s_mesh); |
3579 |
|
|
3580 |
#warning _________________________________A ENLEVER_________ |
/*#warning _________________________________A ENLEVER_________ |
3581 |
Connectivity<Triangle> connect(s_mesh.numberOfCells()); |
Connectivity<Triangle> connect(s_mesh.numberOfCells()); |
3582 |
ConnectivityBuilder<SurfaceMeshOfTriangles> C(s_mesh,connect); |
ConnectivityBuilder<SurfaceMeshOfTriangles> C(s_mesh,connect); |
3583 |
size_t compt=0; |
size_t compt=0; |
3593 |
} |
} |
3594 |
ffout(4)<<"****************************il manque "<<compt<<" sommets\n"; |
ffout(4)<<"****************************il manque "<<compt<<" sommets\n"; |
3595 |
///////////////////////////////////////////////////////////////////////////// |
///////////////////////////////////////////////////////////////////////////// |
3596 |
|
*/ |
3597 |
int n0=0, n1=0; |
int n0=0, n1=0; |
3598 |
|
|
3599 |
#warning REMOVE THIS CALL |
#warning REMOVE THIS CALL |