164 |
|
|
165 |
typedef std::pair<const Triangle*,const Triangle*> PairTriangleNew; |
typedef std::pair<const Triangle*,const Triangle*> PairTriangleNew; |
166 |
//std::vector<Vertex*> listVertexIntersectionNew; |
//std::vector<Vertex*> listVertexIntersectionNew; |
167 |
typedef std::map< std::pair<const Vertex*,const Vertex*> ,const Vertex* > PIntersection; |
typedef std::map< std::pair<const Vertex*,const Vertex*> , |
168 |
|
TinyVector<2,const Vertex* > > PIntersection; |
169 |
PIntersection listVertexIntersectionNew; |
PIntersection listVertexIntersectionNew; |
170 |
|
|
171 |
typedef std::map< PairTriangleNew , IntersectionPoints> PairTriangleToIntersectionPoints; |
typedef std::map< PairTriangleNew , IntersectionPoints> PairTriangleToIntersectionPoints; |
274 |
|
|
275 |
void __createByEdges(const TriangleCut& K,const Cell* cell) ; |
void __createByEdges(const TriangleCut& K,const Cell* cell) ; |
276 |
void __createNotIn(const TriangleCut& K,const Cell* cell); |
void __createNotIn(const TriangleCut& K,const Cell* cell); |
277 |
|
void __createNotIn2(const TriangleCut& K,const Cell* cell); |
278 |
void __createTrianglesIntersection(const size_t& numobject, |
void __createTrianglesIntersection(const size_t& numobject, |
279 |
const size_t& objectNumber); |
const size_t& objectNumber); |
280 |
|
|
295 |
static void __getIntersectionReferences(const Intersection& I, |
static void __getIntersectionReferences(const Intersection& I, |
296 |
std::map<TinyVector<3>, Object*, Internals::__ltv>& otherReferences); |
std::map<TinyVector<3>, Object*, Internals::__ltv>& otherReferences); |
297 |
void plotliste(); |
void plotliste(); |
298 |
|
void plotini(size_t nobjectToTreat); |
299 |
bool triangleplat(const Vertex& V0, |
bool triangleplat(const Vertex& V0, |
300 |
const Vertex& V1, |
const Vertex& V1, |
301 |
const Vertex& V2); |
const Vertex& V2); |
407 |
TinyVector<3> vo = e(out); |
TinyVector<3> vo = e(out); |
408 |
TinyVector<3> vs = (vi+vo)/2; |
TinyVector<3> vs = (vi+vo)/2; |
409 |
|
|
410 |
for (int l = 0; l<10; l++) { // 3% error after 5 iterations. |
for (int l = 0; l<20; l++) { // 3% error after 5 iterations. |
411 |
if(S.inside(vs)) { |
if(S.inside(vs)) { |
412 |
vi = vs; |
vi = vs; |
413 |
vs = (vo+vi)/2; |
vs = (vo+vi)/2; |
618 |
ObjectReferences& otherReferences) { |
ObjectReferences& otherReferences) { |
619 |
size_t nobject = scene.nbObjects(); |
size_t nobject = scene.nbObjects(); |
620 |
size_t nobjectToTreat = otherReferences.size(); |
size_t nobjectToTreat = otherReferences.size(); |
621 |
TinyVector<2,size_t> objpair; |
if(nobjectToTreat==0) |
622 |
objpair[0]=nobject; |
nobjectToTreat=1; |
|
objpair[1]=nobject; |
|
|
|
|
|
|
|
623 |
for(std::set<const Cell*>::iterator i=toTreatHexahedra.begin() ; i!=toTreatHexahedra.end() ; ++i) |
for(std::set<const Cell*>::iterator i=toTreatHexahedra.begin() ; i!=toTreatHexahedra.end() ; ++i) |
624 |
{ |
{ |
625 |
SurfaceMeshGenerator::Internals::HexaTetraAssociation::iterator |
SurfaceMeshGenerator::Internals::HexaTetraAssociation::iterator |
690 |
return true; |
return true; |
691 |
} |
} |
692 |
|
|
693 |
|
void SurfaceMeshGenerator::Internals::plotini(size_t nobjectToTreat) { |
694 |
|
|
695 |
|
std::ofstream sortie2("ini.mesh"); |
696 |
|
|
697 |
|
sortie2<<"MeshVersionFormatted 1"<<" \n"; |
698 |
|
sortie2<<" \n"; |
699 |
|
sortie2<<"Dimension"<<" \n"; |
700 |
|
sortie2<<"3"<<" \n"; |
701 |
|
sortie2<<" \n"; |
702 |
|
sortie2<<"Vertices"<<" \n"; |
703 |
|
size_t nn=0,n0=0,n1=0,compt=0; |
704 |
|
for(size_t numObj=0 ; numObj<nobjectToTreat ; ++numObj) { |
705 |
|
nn+=(*triangleListes [numObj]).size(); |
706 |
|
if(compt==0) |
707 |
|
n0=nn; |
708 |
|
else if(compt==1) |
709 |
|
n1=nn; |
710 |
|
++compt; |
711 |
|
} |
712 |
|
sortie2<<3*nn<<"\n"; |
713 |
|
|
714 |
|
for(size_t numObj=0 ; numObj<nobjectToTreat ; ++numObj) { |
715 |
|
for (SurfaceMeshGenerator::Internals::EdgePairList::iterator |
716 |
|
i = (*triangleListes[numObj]).begin(); |
717 |
|
i != (*triangleListes [numObj]).end(); ++i) { |
718 |
|
SurfaceMeshGenerator::Internals::VerticesList& V = (*verticesListes[numObj]); |
719 |
|
const Vertex& V0=* V[(*i)[0]]; |
720 |
|
const Vertex& V1=* V[(*i)[1]]; |
721 |
|
const Vertex& V2=* V[(*i)[2]]; |
722 |
|
sortie2<<V0.Vector3()[0]<<" "<<V0.Vector3()[1]<<" "<<V0.Vector3()[2]<<" 0 \n"; |
723 |
|
sortie2<<V1.Vector3()[0]<<" "<<V1.Vector3()[1]<<" "<<V1.Vector3()[2]<<" 0 \n"; |
724 |
|
sortie2<<V2.Vector3()[0]<<" "<<V2.Vector3()[1]<<" "<<V2.Vector3()[2]<<" 0 \n"; |
725 |
|
} |
726 |
|
} |
727 |
|
|
728 |
|
sortie2<<" \n"; |
729 |
|
sortie2<<"Triangles"<<"\n"; |
730 |
|
sortie2<<nn<<"\n"; |
731 |
|
|
732 |
|
for(size_t nj=0;nj<nn;++nj) { |
733 |
|
sortie2<<3*nj+1<<" "<<3*nj+2<<" "<<3*nj+3; |
734 |
|
if(nj<n0) |
735 |
|
sortie2<<" 2 \n"; |
736 |
|
else if(nj<n1) |
737 |
|
sortie2<<" 3 \n"; |
738 |
|
else |
739 |
|
sortie2<<" 4 \n"; |
740 |
|
} |
741 |
|
sortie2<<"End"<<" \n"; |
742 |
|
} |
743 |
|
|
744 |
void SurfaceMeshGenerator::Internals::plotliste() { |
void SurfaceMeshGenerator::Internals::plotliste() { |
745 |
|
|
746 |
std::ofstream sortie2("liste2.mesh"); |
std::ofstream sortie2("liste2.mesh"); |
929 |
} |
} |
930 |
else if(listVertexIntersectionNew.find(pV)==listVertexIntersectionNew.end() |
else if(listVertexIntersectionNew.find(pV)==listVertexIntersectionNew.end() |
931 |
and listVertexIntersectionNew.find(pV2)==listVertexIntersectionNew.end()) { |
and listVertexIntersectionNew.find(pV2)==listVertexIntersectionNew.end()) { |
932 |
listVertexIntersectionNew[pV]=new Vertex (P.Vector3()); |
listVertexIntersectionNew[pV][0]=new Vertex (P.Vector3()); |
933 |
Pinter.addPoint(listVertexIntersectionNew[pV]); |
listVertexIntersectionNew[pV][1]=new Vertex (P.Vector3()); |
934 |
|
Pinter.addPoint(listVertexIntersectionNew[pV][0]); |
935 |
} |
} |
936 |
else { |
else { |
937 |
if(listVertexIntersectionNew.find(pV)!=listVertexIntersectionNew.end()) |
if(listVertexIntersectionNew.find(pV)!=listVertexIntersectionNew.end()) { |
938 |
Pinter.addPoint((*listVertexIntersectionNew.find(pV)).second); |
if(Norm((*(*listVertexIntersectionNew.find(pV)).second[0]).Vector3() |
939 |
else |
-P.Vector3())<1e-6) { |
940 |
Pinter.addPoint((*listVertexIntersectionNew.find(pV2)).second); |
Pinter.addPoint((*listVertexIntersectionNew.find(pV)).second[0]); |
941 |
|
} |
942 |
|
else if(Norm((*(*listVertexIntersectionNew.find(pV)).second[1]).Vector3() |
943 |
|
-P.Vector3())<1e-6) { |
944 |
|
Pinter.addPoint((*listVertexIntersectionNew.find(pV)).second[1]); |
945 |
|
} |
946 |
|
else { |
947 |
|
listVertexIntersectionNew[pV][1]=new Vertex (P.Vector3()); |
948 |
|
Pinter.addPoint(listVertexIntersectionNew[pV][1]); |
949 |
|
} |
950 |
|
} |
951 |
|
else { |
952 |
|
if(Norm((*(*listVertexIntersectionNew.find(pV2)).second[0]).Vector3() |
953 |
|
-P.Vector3())<1e-6) { |
954 |
|
Pinter.addPoint((*listVertexIntersectionNew.find(pV2)).second[0]); |
955 |
|
} |
956 |
|
else if(Norm((*(*listVertexIntersectionNew.find(pV2)).second[1]).Vector3() |
957 |
|
-P.Vector3())<1e-6) { |
958 |
|
Pinter.addPoint((*listVertexIntersectionNew.find(pV2)).second[1]); |
959 |
|
} |
960 |
|
else { |
961 |
|
listVertexIntersectionNew[pV2][1]=new Vertex (P.Vector3()); |
962 |
|
Pinter.addPoint(listVertexIntersectionNew[pV2][1]); |
963 |
|
} |
964 |
|
} |
965 |
} |
} |
966 |
Pinter.cutTriangle1[ncase]=Pinter.size(); |
Pinter.cutTriangle1[ncase]=Pinter.size(); |
967 |
|
|
982 |
} |
} |
983 |
else if(listVertexIntersectionNew.find(pV)==listVertexIntersectionNew.end() |
else if(listVertexIntersectionNew.find(pV)==listVertexIntersectionNew.end() |
984 |
and listVertexIntersectionNew.find(pV2)==listVertexIntersectionNew.end()) { |
and listVertexIntersectionNew.find(pV2)==listVertexIntersectionNew.end()) { |
985 |
listVertexIntersectionNew[pV]=new Vertex (P.Vector3()); |
listVertexIntersectionNew[pV][0]=new Vertex (P.Vector3()); |
986 |
Pinter.addPoint(listVertexIntersectionNew[pV]); |
listVertexIntersectionNew[pV][1]=new Vertex (P.Vector3()); |
987 |
|
Pinter.addPoint(listVertexIntersectionNew[pV][0]); |
988 |
} |
} |
989 |
else { |
else { |
990 |
if(listVertexIntersectionNew.find(pV)!=listVertexIntersectionNew.end()) |
if(listVertexIntersectionNew.find(pV)!=listVertexIntersectionNew.end()) { |
991 |
Pinter.addPoint((*listVertexIntersectionNew.find(pV)).second); |
if(Norm((*(*listVertexIntersectionNew.find(pV)).second[0]).Vector3() |
992 |
else |
-P.Vector3())<1e-6) { |
993 |
Pinter.addPoint((*listVertexIntersectionNew.find(pV2)).second); |
Pinter.addPoint((*listVertexIntersectionNew.find(pV)).second[0]); |
994 |
|
} |
995 |
|
else if(Norm((*(*listVertexIntersectionNew.find(pV)).second[1]).Vector3() |
996 |
|
-P.Vector3())<1e-6) { |
997 |
|
Pinter.addPoint((*listVertexIntersectionNew.find(pV)).second[1]); |
998 |
|
} |
999 |
|
else { |
1000 |
|
listVertexIntersectionNew[pV][1]=new Vertex (P.Vector3()); |
1001 |
|
Pinter.addPoint(listVertexIntersectionNew[pV][1]); |
1002 |
|
} |
1003 |
|
} |
1004 |
|
else { |
1005 |
|
if(Norm((*(*listVertexIntersectionNew.find(pV2)).second[0]).Vector3() |
1006 |
|
-P.Vector3())<1e-6) { |
1007 |
|
Pinter.addPoint((*listVertexIntersectionNew.find(pV2)).second[0]); |
1008 |
|
} |
1009 |
|
else if(Norm((*(*listVertexIntersectionNew.find(pV2)).second[1]).Vector3() |
1010 |
|
-P.Vector3())<1e-6) { |
1011 |
|
Pinter.addPoint((*listVertexIntersectionNew.find(pV2)).second[1]); |
1012 |
|
} |
1013 |
|
else { |
1014 |
|
listVertexIntersectionNew[pV2][1]=new Vertex (P.Vector3()); |
1015 |
|
Pinter.addPoint(listVertexIntersectionNew[pV2][1]); |
1016 |
|
} |
1017 |
|
} |
1018 |
|
|
1019 |
} |
} |
1020 |
// Pinter.addPoint(listVertexIntersectionNew[listVertexIntersectionNew.size()-1]); |
// Pinter.addPoint(listVertexIntersectionNew[listVertexIntersectionNew.size()-1]); |
1021 |
} |
} |
1343 |
#warning is it true? |
#warning is it true? |
1344 |
//a faire si plus d' 1 point d'intersection pas dans le triangle |
//a faire si plus d' 1 point d'intersection pas dans le triangle |
1345 |
ffout(0) << numberin<<" be careful 1\n"; |
ffout(0) << numberin<<" be careful 1\n"; |
1346 |
|
//POUR STEPH : peut generer des tr plats |
1347 |
// ffout(0)<<V0.Vector3()<<"\n"; |
// ffout(0)<<V0.Vector3()<<"\n"; |
1348 |
// ffout(0)<<V1.Vector3()<<"\n"; |
// ffout(0)<<V1.Vector3()<<"\n"; |
1349 |
// ffout(0)<<V2.Vector3()<<"\n"; |
// ffout(0)<<V2.Vector3()<<"\n"; |
1527 |
} |
} |
1528 |
} |
} |
1529 |
else if(numberin>2) { |
else if(numberin>2) { |
1530 |
|
//POUR STEPH : createNotIn peut generer des tr plats |
1531 |
ffout(0) << numberin <<"be careful 2\n"; |
ffout(0) << numberin <<"be careful 2\n"; |
1532 |
TinyVector<10,const Vertex*> P,Ptemp; |
TinyVector<10,const Vertex*> P,Ptemp; |
1533 |
size_t i=0; |
size_t i=0; |
1628 |
cc=(pairTriangleToIntersectionPoints[pT]).cutTriangle2; |
cc=(pairTriangleToIntersectionPoints[pT]).cutTriangle2; |
1629 |
} |
} |
1630 |
if(pairTriangleToIntersectionPoints[pT].size()==2) { |
if(pairTriangleToIntersectionPoints[pT].size()==2) { |
1631 |
for(size_t b=0; b<pairTriangleToIntersectionPoints[pT].size() ; ++b) { |
for(size_t b=0; b<pairTriangleToIntersectionPoints[pT].size() ; ++b) { |
1632 |
const Vertex*& V=pairTriangleToIntersectionPoints[pT].listofPoints[b]; |
const Vertex*& V=pairTriangleToIntersectionPoints[pT].listofPoints[b]; |
1633 |
if(vertexInTriangles.find(V)==vertexInTriangles.end()) { |
if(vertexInTriangles.find(V)==vertexInTriangles.end()) { |
1634 |
TinyVector<2,const Triangle*> TT; |
TinyVector<2,const Triangle*> TT; |
1635 |
TT[0]=*jt0; |
TT[0]=*jt0; |
1636 |
TT[1]=*jt0; |
TT[1]=*jt0; |
1637 |
vertexInTriangles[V]=TT; |
vertexInTriangles[V]=TT; |
1638 |
} |
} |
1639 |
else { |
else { |
1640 |
(*vertexInTriangles.find(V)).second[1]=*jt0; |
(*vertexInTriangles.find(V)).second[1]=*jt0; |
1641 |
} |
} |
1642 |
if(triangleWithVertex.find(*jt0)==triangleWithVertex.end()) { |
if(triangleWithVertex.find(*jt0)==triangleWithVertex.end()) { |
1643 |
TinyVector<2,const Vertex*> VV; |
TinyVector<2,const Vertex*> VV; |
1644 |
VV[0]=V; |
VV[0]=V; |
1645 |
VV[1]=V; |
VV[1]=V; |
1646 |
triangleWithVertex[*jt0]=VV; |
triangleWithVertex[*jt0]=VV; |
1647 |
} |
} |
1648 |
else { |
else { |
1649 |
(*triangleWithVertex.find(*jt0)).second[1]=V; |
(*triangleWithVertex.find(*jt0)).second[1]=V; |
1650 |
|
} |
1651 |
} |
} |
1652 |
} |
} |
|
} |
|
1653 |
if(cc[0]!=0) { |
if(cc[0]!=0) { |
1654 |
temp+=1; |
temp+=1; |
1655 |
if(tt[0][0]==0) { |
if(tt[0][0]==0) { |
1811 |
(*edgesRefVertex[numobject])[V1]+(*edgesRefVertex[numobject])[V2])==6) { |
(*edgesRefVertex[numobject])[V1]+(*edgesRefVertex[numobject])[V2])==6) { |
1812 |
ffout(0)<<"************************ ---------tr a pbs\n"; |
ffout(0)<<"************************ ---------tr a pbs\n"; |
1813 |
ffout(0)<<tt[0]<<" "<<tt[1]<<" "<<tt[2]<<"\n"; |
ffout(0)<<tt[0]<<" "<<tt[1]<<" "<<tt[2]<<"\n"; |
1814 |
|
ffout(0)<<*V0<<"\n"; |
1815 |
|
ffout(0)<<*V1<<"\n"; |
1816 |
|
ffout(0)<<*V2<<"\n"; |
1817 |
} |
} |
1818 |
|
|
1819 |
__inout(ncase,numobject,tt[0][0],V0,V1,K); |
__inout(ncase,numobject,tt[0][0],V0,V1,K); |
1939 |
} |
} |
1940 |
} |
} |
1941 |
|
|
1942 |
|
void SurfaceMeshGenerator::Internals:: |
1943 |
|
__createNotIn2(const TriangleCut& K,const Cell* cell) { |
1944 |
|
size_t place0=0; |
1945 |
|
if(K.edgecut[1][0]==1 and K.edgecut[1][1]==1) { |
1946 |
|
place0=1; |
1947 |
|
} |
1948 |
|
else if(K.edgecut[2][0]==1 and K.edgecut[2][1]==1) { |
1949 |
|
place0=2; |
1950 |
|
} |
1951 |
|
const Vertex* Pend=K.pointsIntersection[place0][1]; |
1952 |
|
TinyVector<10,const Vertex*> P; |
1953 |
|
TinyVector<10,const Triangle*> T; |
1954 |
|
P[0]=K.pointsIntersection[place0][0]; |
1955 |
|
if(vertexInTriangles.find(P[0])!=vertexInTriangles.end()) { |
1956 |
|
T[0]=(*vertexInTriangles.find(P[0])).second[0]; |
1957 |
|
} |
1958 |
|
else { |
1959 |
|
ffout(0)<<"pbs 0 existe pas\n"; |
1960 |
|
} |
1961 |
|
size_t b=0; |
1962 |
|
while(P[b]!=Pend and b<9) { |
1963 |
|
if(triangleWithVertex.find(T[b])!=triangleWithVertex.end()) { |
1964 |
|
TinyVector<2,const Vertex*> VV=(*triangleWithVertex.find(T[b])).second; |
1965 |
|
if(VV[0]==P[b]) { |
1966 |
|
if(Pend!=VV[1]) { |
1967 |
|
__addTriangle(*Pend,*P[b],*VV[1],cell); |
1968 |
|
} |
1969 |
|
P[b+1]=VV[1]; |
1970 |
|
} |
1971 |
|
else { |
1972 |
|
if(Pend!=VV[0]) { |
1973 |
|
__addTriangle(*Pend,*P[b],*VV[0],cell); |
1974 |
|
} |
1975 |
|
P[b+1]=VV[0]; |
1976 |
|
} |
1977 |
|
} |
1978 |
|
else { |
1979 |
|
ffout(0)<<"pbs 1 existe pas\n"; |
1980 |
|
} |
1981 |
|
TinyVector<2,const Triangle*> T2; |
1982 |
|
if(vertexInTriangles.find(P[b+1])!=vertexInTriangles.end()) { |
1983 |
|
T2[0]=(*vertexInTriangles.find(P[b+1])).second[0]; |
1984 |
|
T2[1]=(*vertexInTriangles.find(P[b+1])).second[1]; |
1985 |
|
} |
1986 |
|
if(T2[0]==T[b]) { |
1987 |
|
if(T2[1]==T[b]) { |
1988 |
|
//point edge |
1989 |
|
//ffout(0)<<"here\n"; |
1990 |
|
if(K.edgecut[0][0]==1 and K.edgecut[0][1]==1) { |
1991 |
|
if(P[b+1]==K.pointsIntersection[0][1]) { |
1992 |
|
__addTriangle(*Pend,*P[b+1],*K.pointsIntersection[0][0],cell); |
1993 |
|
P[b+1]=K.pointsIntersection[0][0]; |
1994 |
|
if(vertexInTriangles.find(P[b+1])!=vertexInTriangles.end()) { |
1995 |
|
T2[0]=(*vertexInTriangles.find(P[b+1])).second[0]; |
1996 |
|
T2[1]=(*vertexInTriangles.find(P[b+1])).second[1]; |
1997 |
|
} |
1998 |
|
T[b+1]=T2[0]; |
1999 |
|
} |
2000 |
|
else if(P[b+1]==K.pointsIntersection[0][0]){ |
2001 |
|
__addTriangle(*Pend,*P[b+1],*K.pointsIntersection[0][1],cell); |
2002 |
|
P[b+1]=K.pointsIntersection[0][1]; |
2003 |
|
if(vertexInTriangles.find(P[b+1])!=vertexInTriangles.end()) { |
2004 |
|
T2[0]=(*vertexInTriangles.find(P[b+1])).second[0]; |
2005 |
|
T2[1]=(*vertexInTriangles.find(P[b+1])).second[1]; |
2006 |
|
} |
2007 |
|
T[b+1]=T2[0]; |
2008 |
|
} |
2009 |
|
} |
2010 |
|
if(K.edgecut[2][0]==1 and K.edgecut[2][1]==1) { |
2011 |
|
if(P[b+1]==K.pointsIntersection[2][1]) { |
2012 |
|
__addTriangle(*Pend,*P[b+1],*K.pointsIntersection[2][0],cell); |
2013 |
|
P[b+1]=K.pointsIntersection[2][0]; |
2014 |
|
if(vertexInTriangles.find(P[b+1])!=vertexInTriangles.end()) { |
2015 |
|
T2[0]=(*vertexInTriangles.find(P[b+1])).second[0]; |
2016 |
|
T2[1]=(*vertexInTriangles.find(P[b+1])).second[1]; |
2017 |
|
} |
2018 |
|
T[b+1]=T2[0]; |
2019 |
|
|
2020 |
|
} |
2021 |
|
else if(P[b+1]==K.pointsIntersection[2][0]){ |
2022 |
|
__addTriangle(*Pend,*P[b+1],*K.pointsIntersection[2][1],cell); |
2023 |
|
P[b+1]=K.pointsIntersection[2][1]; |
2024 |
|
if(vertexInTriangles.find(P[b+1])!=vertexInTriangles.end()) { |
2025 |
|
T2[0]=(*vertexInTriangles.find(P[b+1])).second[0]; |
2026 |
|
T2[1]=(*vertexInTriangles.find(P[b+1])).second[1]; |
2027 |
|
} |
2028 |
|
T[b+1]=T2[0]; |
2029 |
|
} |
2030 |
|
} |
2031 |
|
else |
2032 |
|
ffout(0)<<"pas trouve l'egde et le point\n"; |
2033 |
|
} |
2034 |
|
else |
2035 |
|
T[b+1]=T2[1]; |
2036 |
|
} |
2037 |
|
else { |
2038 |
|
T[b+1]=T2[0]; |
2039 |
|
} |
2040 |
|
++b; |
2041 |
|
} |
2042 |
|
} |
2043 |
|
|
2044 |
void SurfaceMeshGenerator::Internals:: |
void SurfaceMeshGenerator::Internals:: |
2045 |
__createByEdges(const TriangleCut& K,const Cell* cell) { |
__createByEdges(const TriangleCut& K,const Cell* cell) { |
2230 |
|
|
2231 |
__createLocalListIntersection(objectNumber,T,K,*i); |
__createLocalListIntersection(objectNumber,T,K,*i); |
2232 |
K.isInTriangle =__putEdgeRef(1,*T,K); |
K.isInTriangle =__putEdgeRef(1,*T,K); |
2233 |
|
|
2234 |
if(K.isInTriangle[0]+K.isInTriangle[1]+K.isInTriangle[2]==0 ) { |
if(K.isInTriangle[0]+K.isInTriangle[1]+K.isInTriangle[2]==0 ) { |
2235 |
++err; |
++err; |
2236 |
} |
} |
2253 |
} |
} |
2254 |
else if(vertexInTriangles.size()>3 and |
else if(vertexInTriangles.size()>3 and |
2255 |
K.edgecut[0][0]+K.edgecut[1][0]+K.edgecut[2][0]==1){ |
K.edgecut[0][0]+K.edgecut[1][0]+K.edgecut[2][0]==1){ |
2256 |
|
//one edge cut but twice |
2257 |
|
//ffout(0)<<"createNotIn\n"; |
2258 |
|
//POUR STEPH : createNotIn peut generer des tr plats |
2259 |
__createNotIn(K,*i); |
__createNotIn(K,*i); |
2260 |
} |
} |
2261 |
|
else if(vertexInTriangles.size()>3 and |
2262 |
|
K.edgecut[0][0]+K.edgecut[1][0]+K.edgecut[2][0]==2){ |
2263 |
|
//two edge cut but twice |
2264 |
|
//ffout(0)<<"createNotIn2\n"; |
2265 |
|
__createNotIn2(K,*i); |
2266 |
|
} |
2267 |
else if(K.edgecut[0]!=0) { |
else if(K.edgecut[0]!=0) { |
2268 |
if(K.pointsIntersection[0][0]==&V0 |
if(K.pointsIntersection[0][0]==&V0 |
2269 |
or K.pointsIntersection[0][0]==&V1 |
or K.pointsIntersection[0][0]==&V1 |
2271 |
ffout(0)<<"**********normal\n"; |
ffout(0)<<"**********normal\n"; |
2272 |
} |
} |
2273 |
else { |
else { |
2274 |
ffout(0)<<"triangle cut but outside\n"; |
/* ffout(0)<<"triangle cut but outside1\n"; |
2275 |
ffout(0)<<V0<<"\n"; |
ffout(0)<<V0<<"\n"; |
2276 |
ffout(0)<<V1<<"\n"; |
ffout(0)<<V1<<"\n"; |
2277 |
ffout(0)<<V2<<"\n"; |
ffout(0)<<V2<<"\n"; |
2278 |
ffout(0)<<"nb points inter "<<K.pointsIntersection.size()<<"\n"; |
ffout(0)<<"nb points inter "<<vertexInTriangles.size()<<"\n";*/ |
2279 |
} |
} |
2280 |
} |
} |
2281 |
else if(K.edgecut[1]!=0) { |
else if(K.edgecut[1]!=0) { |
2285 |
ffout(0)<<"**********normal\n"; |
ffout(0)<<"**********normal\n"; |
2286 |
} |
} |
2287 |
else { |
else { |
2288 |
ffout(0)<<"triangle cut but outside\n"; |
/* ffout(0)<<"triangle cut but outside2\n"; |
2289 |
ffout(0)<<V0<<"\n"; |
ffout(0)<<V0<<"\n"; |
2290 |
ffout(0)<<V1<<"\n"; |
ffout(0)<<V1<<"\n"; |
2291 |
ffout(0)<<V2<<"\n"; |
ffout(0)<<V2<<"\n"; |
2292 |
ffout(0)<<"nb points inter "<<K.pointsIntersection.size()<<"\n"; |
ffout(0)<<"nb points inter "<<vertexInTriangles.size()<<"\n";*/ |
2293 |
} |
} |
2294 |
} |
} |
2295 |
else if(K.edgecut[2]!=0) { |
else if(K.edgecut[2]!=0) { |
2299 |
ffout(0)<<"**********normal\n"; |
ffout(0)<<"**********normal\n"; |
2300 |
} |
} |
2301 |
else { |
else { |
2302 |
ffout(0)<<"triangle cut but outside\n"; |
/* ffout(0)<<"triangle cut but outside3\n"; |
2303 |
ffout(0)<<V0<<"\n"; |
ffout(0)<<V0<<"\n"; |
2304 |
ffout(0)<<V1<<"\n"; |
ffout(0)<<V1<<"\n"; |
2305 |
ffout(0)<<V2<<"\n"; |
ffout(0)<<V2<<"\n"; |
2306 |
ffout(0)<<"nb points inter "<<K.pointsIntersection.size()<<"\n"; |
ffout(0)<<"nb points inter "<<vertexInTriangles.size()<<"\n";*/ |
2307 |
} |
} |
2308 |
} |
} |
2309 |
} |
} |
2312 |
if(K.pointsIntersection[0][0]!=K.pointsIntersection[1][0] |
if(K.pointsIntersection[0][0]!=K.pointsIntersection[1][0] |
2313 |
and K.pointsIntersection[1][0]!=K.pointsIntersection[2][0] |
and K.pointsIntersection[1][0]!=K.pointsIntersection[2][0] |
2314 |
and K.pointsIntersection[2][0]!=K.pointsIntersection[0][0]) { |
and K.pointsIntersection[2][0]!=K.pointsIntersection[0][0]) { |
2315 |
ffout(0)<<"---------------- 3 edge cut \n"; |
/*ffout(0)<<"---------------- 3 edge cut \n"; |
2316 |
ffout(0)<<V0<<"\n"; |
ffout(0)<<V0<<"\n"; |
2317 |
ffout(0)<<V1<<"\n"; |
ffout(0)<<V1<<"\n"; |
2318 |
ffout(0)<<V2<<"\n"; |
ffout(0)<<V2<<"\n"; |
2319 |
__createByEdges(K,*i); |
ffout(0)<<"createByEdges\n";*/ |
2320 |
|
__createByEdges(K,*i); |
2321 |
} |
} |
2322 |
else { |
else { |
2323 |
__createListTriangle(K,*i); |
__createListTriangle(K,*i); |
2943 |
std::set<const Cell*>& cuttedHexahedra, |
std::set<const Cell*>& cuttedHexahedra, |
2944 |
size_t nobjother,size_t n0,size_t n1); |
size_t nobjother,size_t n0,size_t n1); |
2945 |
|
|
2946 |
|
|
2947 |
void plothexa(size_t ncase,std::set<const Cell*>& cuttedHexahedra); |
void plothexa(size_t ncase,std::set<const Cell*>& cuttedHexahedra); |
2948 |
|
|
2949 |
|
|
3101 |
} |
} |
3102 |
// ffout(0)<<"nb tr objet1 complet "<<nobjother<<" \n"; |
// ffout(0)<<"nb tr objet1 complet "<<nobjother<<" \n"; |
3103 |
|
|
3104 |
|
(*__internals).plotini(nobjectToTreat); |
3105 |
|
|
3106 |
ffout(0)<<"calculate listes intersection\n"; |
ffout(0)<<"calculate listes intersection\n"; |
3107 |
|
|
3108 |
//create triangleListesIntersectionEdgesPerHexa for all objects |
//create triangleListesIntersectionEdgesPerHexa for all objects |
3312 |
|
|
3313 |
//construction of list vertices |
//construction of list vertices |
3314 |
|
|
3315 |
// SurfaceMeshGenerator::Internals::ListOfTriangleList::const_iterator |
SurfaceMeshGenerator::Internals::ListOfTriangleList::const_iterator |
3316 |
// itcell=((*__internals).listOfTriangleList).begin(); |
itcell=((*__internals).listOfTriangleList).begin(); |
3317 |
SurfaceMeshGenerator::Internals::ListOfTriangleList::const_iterator |
SurfaceMeshGenerator::Internals::ListOfTriangleList::const_iterator |
3318 |
intertr=((*__internals).listOfTriangleListIntersection).begin(); |
intertr=((*__internals).listOfTriangleListIntersection).begin(); |
3319 |
/* for(size_t size=0 ; size< (*(*itcell)).size() ; ++size) { |
if(nobjectToTreat==0){ |
3320 |
|
for(size_t size=0 ; size< (*(*itcell)).size() ; ++size) { |
3321 |
const Triangle& T=(*(*itcell))[size]; |
const Triangle& T=(*(*itcell))[size]; |
3322 |
if((*__internals).listOfVertexMesh.find(&T(0))==(*__internals).listOfVertexMesh.end()) { |
if((*__internals).listOfVertexMesh.find(&T(0))==(*__internals).listOfVertexMesh.end()) { |
3323 |
(*__internals).listOfVertexMesh[&T(0)]=(&T(0)); |
(*__internals).listOfVertexMesh[&T(0)]=(&T(0)); |
3328 |
if((*__internals).listOfVertexMesh.find(&T(2))==(*__internals).listOfVertexMesh.end()) { |
if((*__internals).listOfVertexMesh.find(&T(2))==(*__internals).listOfVertexMesh.end()) { |
3329 |
(*__internals).listOfVertexMesh[&T(2)]=(&T(2)); |
(*__internals).listOfVertexMesh[&T(2)]=(&T(2)); |
3330 |
} |
} |
3331 |
}*/ |
} |
3332 |
|
} |
3333 |
for(size_t size=0 ; size< (*(*intertr)).size() ; ++size) { |
for(size_t size=0 ; size< (*(*intertr)).size() ; ++size) { |
3334 |
const Triangle& T=(*(*intertr))[size]; |
const Triangle& T=(*(*intertr))[size]; |
3335 |
if((*__internals).listOfVertexMesh.find(&T(0))==(*__internals).listOfVertexMesh.end()) { |
if((*__internals).listOfVertexMesh.find(&T(0))==(*__internals).listOfVertexMesh.end()) { |
3376 |
|
|
3377 |
i = 0; |
i = 0; |
3378 |
size_t ncell=0; |
size_t ncell=0; |
3379 |
// ncell+=(*(*itcell)).size(); |
if(nobjectToTreat==0){ |
3380 |
|
ncell+=(*(*itcell)).size(); |
3381 |
|
} |
3382 |
// ffout(0)<<"ncell "<<ncell<<" n0 "<<n0<<" n1 "<<n1<<"\n"; |
// ffout(0)<<"ncell "<<ncell<<" n0 "<<n0<<" n1 "<<n1<<"\n"; |
3383 |
ncell+=(*(*intertr)).size(); |
ncell+=(*(*intertr)).size(); |
3384 |
|
|
3404 |
i++; |
i++; |
3405 |
//motherCell++; |
//motherCell++; |
3406 |
} */ |
} */ |
3407 |
/* for(size_t size=0 ; size< (*(*itcell)).size() ; ++size) { |
if(nobjectToTreat==0){ |
3408 |
|
SurfaceMeshGenerator::Internals::MotherCellList::iterator motherCell |
3409 |
|
= (*__internals).cellList.begin(); |
3410 |
|
for(size_t size=0 ; size< (*(*itcell)).size() ; ++size) { |
3411 |
const Triangle& T=(*(*itcell))[size]; |
const Triangle& T=(*(*itcell))[size]; |
3412 |
std::map<const Vertex*,const Vertex*>::iterator |
std::map<const Vertex*,const Vertex*>::iterator |
3413 |
it0=(*__internals).listOfVertexMesh.find(&T(0)); |
it0=(*__internals).listOfVertexMesh.find(&T(0)); |
3424 |
s_mesh.cell(i).setMother(&T.mother()); |
s_mesh.cell(i).setMother(&T.mother()); |
3425 |
i++; |
i++; |
3426 |
//motherCell++; |
//motherCell++; |
3427 |
}*/ |
} |
3428 |
|
} |
3429 |
for(size_t size=0 ; size< (*(*intertr)).size() ; ++size) { |
for(size_t size=0 ; size< (*(*intertr)).size() ; ++size) { |
3430 |
const Triangle& T=(*(*intertr))[size]; |
const Triangle& T=(*(*intertr))[size]; |
3431 |
std::map<const Vertex*,const Vertex*>::iterator |
std::map<const Vertex*,const Vertex*>::iterator |