58 |
{ |
{ |
59 |
private: |
private: |
60 |
class IntersectionPoints |
class IntersectionPoints |
|
//class SurfaceMeshGenerator::Internals::IntersectionPoints |
|
61 |
{ |
{ |
62 |
private: |
private: |
63 |
std::vector<const Vertex* > __listOfPoints; |
std::vector<const Vertex* > __listOfPoints; |
203 |
|
|
204 |
std::vector<ReferenceCounting< std::map<const Vertex*,size_t> > > edgesRefVertex; |
std::vector<ReferenceCounting< std::map<const Vertex*,size_t> > > edgesRefVertex; |
205 |
|
|
|
|
|
206 |
std::map<const Vertex*,TinyVector<2,const Triangle*> > vertexInTriangles; |
std::map<const Vertex*,TinyVector<2,const Triangle*> > vertexInTriangles; |
207 |
std::map<const Triangle*,TinyVector<2,const Vertex*> > triangleWithVertex; |
std::map<const Triangle*,TinyVector<2,const Vertex*> > triangleWithVertex; |
208 |
|
|
246 |
const Vertex*& V1); |
const Vertex*& V1); |
247 |
|
|
248 |
TinyVector<4, real_t> __EquationPlan(const TinyVector<3,const Vertex *> & V); |
TinyVector<4, real_t> __EquationPlan(const TinyVector<3,const Vertex *> & V); |
249 |
|
|
250 |
void __DeterminatePoint(const size_t& ncase, |
void __DeterminatePoint(const size_t& ncase, |
251 |
const Vertex* & Vo0, |
const Vertex* & Vo0, |
252 |
const Vertex* & Vo1, |
const Vertex* & Vo1, |
265 |
|
|
266 |
const Vertex& __determinateNumber(const int& p, |
const Vertex& __determinateNumber(const int& p, |
267 |
const TinyVector<3,TinyVector<2,const Vertex*> >& pointsint); |
const TinyVector<3,TinyVector<2,const Vertex*> >& pointsint); |
268 |
|
|
269 |
void __determinateCase(const int& ncase, |
void __determinateCase(const int& ncase, |
270 |
const TriangleCut & K, |
const TriangleCut & K, |
271 |
TinyVector<3,int>& tt, |
TinyVector<3,int>& tt, |
367 |
// const Shape& S, |
// const Shape& S, |
368 |
// const size_t& ref, |
// const size_t& ref, |
369 |
size_t nobject); |
size_t nobject); |
|
|
|
370 |
|
|
371 |
/// @todo FUNCTION TO REMOVE |
/// @todo FUNCTION TO REMOVE |
372 |
static void __getIntersectionReferences(const Intersection& I, |
static void __getIntersectionReferences(const Intersection& I, |
373 |
std::map<TinyVector<3>, Object*>& otherReferences); |
std::map<TinyVector<3>, Object*>& otherReferences); |
374 |
|
|
375 |
void plotini(size_t nobjectToTreat); |
void plotini(size_t nobjectToTreat); |
376 |
|
|
377 |
public: |
public: |
385 |
{ |
{ |
386 |
private: |
private: |
387 |
ReferenceCounting<Shape> __shape; |
ReferenceCounting<Shape> __shape; |
|
TinyVector<3, real_t> __reference; |
|
388 |
|
|
389 |
public : |
public : |
|
TinyVector<3, real_t>& reference() |
|
|
{ |
|
|
return __reference; |
|
|
} |
|
|
|
|
|
const TinyVector<3, real_t>& reference() const |
|
|
{ |
|
|
return __reference; |
|
|
} |
|
|
|
|
390 |
void setShape(const ReferenceCounting<Shape> s) |
void setShape(const ReferenceCounting<Shape> s) |
391 |
{ |
{ |
392 |
__shape = s; |
__shape = s; |
416 |
const ObjectToTreat& operator=(const ObjectToTreat& O) |
const ObjectToTreat& operator=(const ObjectToTreat& O) |
417 |
{ |
{ |
418 |
__shape = O.__shape; |
__shape = O.__shape; |
|
__reference = O.__reference; |
|
419 |
trianglelist = O.trianglelist; |
trianglelist = O.trianglelist; |
420 |
verticeslist = O.verticeslist; |
verticeslist = O.verticeslist; |
421 |
hexalist = O.hexalist; |
hexalist = O.hexalist; |
431 |
|
|
432 |
ObjectToTreat(const ObjectToTreat& O) |
ObjectToTreat(const ObjectToTreat& O) |
433 |
: __shape(O.__shape), |
: __shape(O.__shape), |
|
__reference(O.__reference), |
|
434 |
trianglelist(O.trianglelist), |
trianglelist(O.trianglelist), |
435 |
verticeslist(O.verticeslist), |
verticeslist(O.verticeslist), |
436 |
hexalist(O.hexalist) |
hexalist(O.hexalist) |
517 |
break; |
break; |
518 |
} |
} |
519 |
default: { |
default: { |
520 |
fferr(0) << '\n' << __FILE__ << ':' << __LINE__ << ": Not implemented\n"; |
fferr(0) << __FILE__ << ':' << __LINE__ << ": Not implemented\n"; |
521 |
std::exit(1); |
std::exit(1); |
522 |
} |
} |
523 |
} |
} |
580 |
hexaList2.begin(), hexaList2.end(), |
hexaList2.begin(), hexaList2.end(), |
581 |
inserter(toTreatHexahedra, toTreatHexahedra.begin())); |
inserter(toTreatHexahedra, toTreatHexahedra.begin())); |
582 |
|
|
583 |
ffout(0)<<"nb hexa to treat "<<toTreatHexahedra.size()<<"\n"; |
ffout(4)<<"nb hexa to treat "<<toTreatHexahedra.size()<<"\n"; |
584 |
|
|
585 |
__calculateIntersection<booleanTest>(O0,O1,O2, toTreatHexahedra); |
__calculateIntersection<booleanTest>(O0,O1,O2, toTreatHexahedra); |
586 |
} |
} |
600 |
//create mesh intersection for the object 0 and 1 |
//create mesh intersection for the object 0 and 1 |
601 |
__createTrianglesIntersection<booleanTest>(0, O1, O2, toTreatHexahedra, |
__createTrianglesIntersection<booleanTest>(0, O1, O2, toTreatHexahedra, |
602 |
triangleListIntersectionNew, listVertexIntersectionNew); |
triangleListIntersectionNew, listVertexIntersectionNew); |
603 |
ffout(0)<<"nb triangles in intersection 0 "<<triangleListIntersectionNew.size()<<"\n"<<std::flush; |
ffout(4)<<"nb triangles in intersection 0 "<<triangleListIntersectionNew.size()<<"\n"<<std::flush; |
604 |
__createTrianglesIntersection<booleanTest>(1, O2, O1, toTreatHexahedra, |
__createTrianglesIntersection<booleanTest>(1, O2, O1, toTreatHexahedra, |
605 |
triangleListIntersectionNew, listVertexIntersectionNew); |
triangleListIntersectionNew, listVertexIntersectionNew); |
606 |
ffout(0)<<"nb triangles in intersection 1 "<<triangleListIntersectionNew.size()<<"\n"<<std::flush; |
ffout(4)<<"nb triangles in intersection 1 "<<triangleListIntersectionNew.size()<<"\n"<<std::flush; |
607 |
|
|
608 |
pairTriangleToIntersectionPoints.clear(); |
pairTriangleToIntersectionPoints.clear(); |
609 |
|
|
676 |
ntr+=listOfVertexMesh.size(); |
ntr+=listOfVertexMesh.size(); |
677 |
|
|
678 |
s_mesh.setNumberOfVertices(ntr); |
s_mesh.setNumberOfVertices(ntr); |
679 |
ffout(0)<<"nb tot vertices "<<s_mesh.numberOfVertices()<<"\n"<<std::flush; |
ffout(4)<<"nb tot vertices "<<s_mesh.numberOfVertices()<<"\n"<<std::flush; |
680 |
|
|
681 |
//! copies vertices into the s_mesh. |
//! copies vertices into the s_mesh. |
682 |
int i = 0; |
int i = 0; |
704 |
//if(nobjectToTreat==0){ |
//if(nobjectToTreat==0){ |
705 |
ncell+=triangleList.size(); |
ncell+=triangleList.size(); |
706 |
//} |
//} |
707 |
// ffout(0)<<"ncell "<<ncell<<" n0 "<<n0<<" n1 "<<n1<<"\n"; |
// ffout(4)<<"ncell "<<ncell<<" n0 "<<n0<<" n1 "<<n1<<"\n"; |
708 |
|
|
709 |
s_mesh.setNumberOfCells(ncell); |
s_mesh.setNumberOfCells(ncell); |
710 |
ffout(0)<<"nb tot cells "<<s_mesh.numberOfCells()<<" \n"<<std::flush; |
ffout(4)<<"nb tot cells "<<s_mesh.numberOfCells()<<" \n"<<std::flush; |
711 |
|
|
712 |
for(size_t size=0 ; size< triangleList.size() ; ++size) { |
for(size_t size=0 ; size< triangleList.size() ; ++size) { |
713 |
const Triangle& T=triangleList[size]; |
const Triangle& T=triangleList[size]; |
806 |
} |
} |
807 |
} |
} |
808 |
} else { |
} else { |
809 |
//ffout(0)<<"pas d'intersection dans l'hexa\n"; |
//ffout(4)<<"pas d'intersection dans l'hexa\n"; |
810 |
} |
} |
811 |
} |
} |
812 |
} |
} |
1041 |
if(inV01 > epsilon and inV02 > epsilon and inV12 > epsilon ) { |
if(inV01 > epsilon and inV02 > epsilon and inV12 > epsilon ) { |
1042 |
__InTriangle(P,V,num); |
__InTriangle(P,V,num); |
1043 |
if(num==3) { |
if(num==3) { |
1044 |
//ffout(0)<<"ajout du point cas 2\n"; |
//ffout(4)<<"ajout du point cas 2\n"; |
1045 |
//ffout(0)<<P[0]<<" "<<P[1]<<" "<<P[2]<<" \n"; |
//ffout(4)<<P[0]<<" "<<P[1]<<" "<<P[2]<<" \n"; |
1046 |
//listVertexIntersectionNew.push_back(new Vertex (P)); |
//listVertexIntersectionNew.push_back(new Vertex (P)); |
1047 |
PIntersection PIn; |
PIntersection PIn; |
1048 |
// if(!(norm2>epsilon)) { |
// if(!(norm2>epsilon)) { |
1134 |
size_t& refVertex1=(*edgesRefVertex[numobject])[V1]; |
size_t& refVertex1=(*edgesRefVertex[numobject])[V1]; |
1135 |
|
|
1136 |
if(refVertex0+refVertex1==4 and edgeCut==1) { |
if(refVertex0+refVertex1==4 and edgeCut==1) { |
1137 |
ffout(1)<<"warning edge ref 2 cut \n"; |
ffout(4)<<"warning edge ref 2 cut \n"; |
1138 |
ffout(1)<<(*V0)[0]<<" "<<(*V0)[1]<<" "<<(*V0)[2]<<" \n"; |
ffout(4)<<(*V0)[0]<<" "<<(*V0)[1]<<" "<<(*V0)[2]<<" \n"; |
1139 |
ffout(1)<<(*V1)[0]<<" "<<(*V1)[1]<<" "<<(*V1)[2]<<" \n"; |
ffout(4)<<(*V1)[0]<<" "<<(*V1)[1]<<" "<<(*V1)[2]<<" \n"; |
1140 |
refVertex0=0; |
refVertex0=0; |
1141 |
refVertex1=0; |
refVertex1=0; |
1142 |
} else { |
} else { |
1153 |
std::list<Triangle*>::iterator currentTriangle, |
std::list<Triangle*>::iterator currentTriangle, |
1154 |
PIntersection& listVertexIntersectionNew) |
PIntersection& listVertexIntersectionNew) |
1155 |
{ |
{ |
1156 |
//ffout(0)<< "createpointintersection "<<numobject<<" "<<objectNumber<<"\n"; |
//ffout(4)<< "createpointintersection "<<numobject<<" "<<objectNumber<<"\n"; |
1157 |
//ffout(0)<<"*************************\n"; |
//ffout(4)<<"*************************\n"; |
1158 |
|
|
1159 |
PairTriangleNew pTriangle; |
PairTriangleNew pTriangle; |
1160 |
pTriangle.first=(*currentTriangle1); |
pTriangle.first=(*currentTriangle1); |
1167 |
const TinyVector<3,size_t >& pintercut=Pinter.cutTriangle1(); |
const TinyVector<3,size_t >& pintercut=Pinter.cutTriangle1(); |
1168 |
|
|
1169 |
if(pintercut[0]+pintercut[1]+pintercut[2]!=0) { |
if(pintercut[0]+pintercut[1]+pintercut[2]!=0) { |
1170 |
//ffout(0)<<"le tr est cut\n"; |
//ffout(4)<<"le tr est cut\n"; |
1171 |
assert(pairTriangleToIntersectionPoints.find(pTriangle)==pairTriangleToIntersectionPoints.end()); |
assert(pairTriangleToIntersectionPoints.find(pTriangle)==pairTriangleToIntersectionPoints.end()); |
1172 |
pairTriangleToIntersectionPoints[pTriangle] = Pinter; |
pairTriangleToIntersectionPoints[pTriangle] = Pinter; |
1173 |
} else { |
} else { |
1174 |
if(Pinter.size()!=0) { |
if(Pinter.size()!=0) { |
1175 |
//ffout(0)<<"rajout2 \n"; |
//ffout(4)<<"rajout2 \n"; |
1176 |
pairTriangleToIntersectionPoints[pTriangle] = Pinter; |
pairTriangleToIntersectionPoints[pTriangle] = Pinter; |
1177 |
} |
} |
1178 |
} |
} |
1234 |
triangleListIntersectionNew.push_back(T); |
triangleListIntersectionNew.push_back(T); |
1235 |
T.reference() = 40; |
T.reference() = 40; |
1236 |
} else { |
} else { |
1237 |
fferr(0) << "\t\tTriangle dégénéré :" |
fferr(4) << "\t\tTriangle dégénéré :" |
1238 |
<< &V0 << ':' << &V1 << ':' << &V2 << '\n'; |
<< &V0 << ':' << &V1 << ':' << &V2 << '\n'; |
1239 |
T.reference() = 2; |
T.reference() = 2; |
1240 |
triangleListIntersectionNew.push_back(T); |
triangleListIntersectionNew.push_back(T); |
1310 |
const Vertex& C=__determinateNumber(vertexNum[1],pointsIntersection); |
const Vertex& C=__determinateNumber(vertexNum[1],pointsIntersection); |
1311 |
__addTriangle(A,B,C,cell,triangleListIntersectionNew); |
__addTriangle(A,B,C,cell,triangleListIntersectionNew); |
1312 |
} else { |
} else { |
1313 |
ffout(0) <<"pbs 10\n"<<std::flush; |
ffout(4) <<"pbs 10\n"<<std::flush; |
1314 |
ffout(0)<<V0<<"\n"; |
ffout(4)<<V0<<"\n"; |
1315 |
ffout(0)<<V1<<"\n"; |
ffout(4)<<V1<<"\n"; |
1316 |
ffout(0)<<V2<<"\n"; |
ffout(4)<<V2<<"\n"; |
1317 |
} |
} |
1318 |
} else { |
} else { |
1319 |
if(edgesCut[1]==1) { |
if(edgesCut[1]==1) { |
1320 |
ffout(0)<<"pbs 11\n"<<std::flush; |
ffout(4)<<"pbs 11\n"<<std::flush; |
1321 |
ffout(0)<<V0<<"\n"; |
ffout(4)<<V0<<"\n"; |
1322 |
ffout(0)<<V1<<"\n"; |
ffout(4)<<V1<<"\n"; |
1323 |
ffout(0)<<V2<<"\n"; |
ffout(4)<<V2<<"\n"; |
1324 |
ffout(0)<<ncase<<"\n"; |
ffout(4)<<ncase<<"\n"; |
1325 |
ffout(0)<<__determinateNumber(vertexNum[1],pointsIntersection)<<"\n"; |
ffout(4)<<__determinateNumber(vertexNum[1],pointsIntersection)<<"\n"; |
1326 |
} else { |
} else { |
1327 |
ffout(0) <<"pbs 111\n"; |
ffout(4) <<"pbs 111\n"; |
1328 |
} |
} |
1329 |
} |
} |
1330 |
break; |
break; |
1339 |
__addTriangle(A,B,D,cell,triangleListIntersectionNew); |
__addTriangle(A,B,D,cell,triangleListIntersectionNew); |
1340 |
__addTriangle(A,D,C,cell,triangleListIntersectionNew); |
__addTriangle(A,D,C,cell,triangleListIntersectionNew); |
1341 |
} else { |
} else { |
1342 |
ffout(0)<<"-------- warning trou in 0\n"<<std::flush; |
ffout(4)<<"-------- warning trou in 0\n"<<std::flush; |
1343 |
ffout(0)<<V0<<"\n"; |
ffout(4)<<V0<<"\n"; |
1344 |
ffout(0)<<V1<<"\n"; |
ffout(4)<<V1<<"\n"; |
1345 |
ffout(0)<<V2<<"\n"; |
ffout(4)<<V2<<"\n"; |
1346 |
__addTriangle(A,B,D,cell,triangleListIntersectionNew); |
__addTriangle(A,B,D,cell,triangleListIntersectionNew); |
1347 |
} |
} |
1348 |
} else { |
} else { |
1349 |
if(edgesCut[1]==1) { |
if(edgesCut[1]==1) { |
1350 |
ffout(0)<<"-------- warning trou in\n"<<std::flush; |
ffout(4)<<"-------- warning trou in\n"<<std::flush; |
1351 |
const Vertex& B=__determinateNumber(vertexNum[1],pointsIntersection); |
const Vertex& B=__determinateNumber(vertexNum[1],pointsIntersection); |
1352 |
__addTriangle(A,B,D,cell,triangleListIntersectionNew); |
__addTriangle(A,B,D,cell,triangleListIntersectionNew); |
1353 |
} else { |
} else { |
1354 |
ffout(0) <<"pbs 1\n"<<std::flush; |
ffout(4) <<"pbs 1\n"<<std::flush; |
1355 |
} |
} |
1356 |
} |
} |
1357 |
break; |
break; |
1358 |
} |
} |
1359 |
default: { |
default: { |
1360 |
#warning is it true? case where only one edge is cut? |
#warning is it true? case where only one edge is cut? |
1361 |
ffout(0) << numberPointsInterior<<" be careful 1\n"<<std::flush; |
ffout(4) << numberPointsInterior<<" be careful 1\n"<<std::flush; |
1362 |
//case 1 point inside and more than 1 point in the triangle |
//case 1 point inside and more than 1 point in the triangle |
1363 |
__createByEdges(K, cell, triangleListIntersectionNew); |
__createByEdges(K, cell, triangleListIntersectionNew); |
1364 |
} |
} |
1423 |
__addTriangle(A,B,C,cell,triangleListIntersectionNew); |
__addTriangle(A,B,C,cell,triangleListIntersectionNew); |
1424 |
__addTriangle(C,B,D,cell,triangleListIntersectionNew); |
__addTriangle(C,B,D,cell,triangleListIntersectionNew); |
1425 |
} else { |
} else { |
1426 |
// ffout(0) <<"pbs 20\n"; |
// ffout(4) <<"pbs 20\n"; |
1427 |
__addTriangle(A,B,C,cell,triangleListIntersectionNew); |
__addTriangle(A,B,C,cell,triangleListIntersectionNew); |
1428 |
} |
} |
1429 |
} else { |
} else { |
1430 |
if(edgesCut[1]==1) { |
if(edgesCut[1]==1) { |
1431 |
// ffout(0) <<"pbs 210\n"; |
// ffout(4) <<"pbs 210\n"; |
1432 |
const Vertex& C=__determinateNumber(vertexNum[1],pointsIntersection); |
const Vertex& C=__determinateNumber(vertexNum[1],pointsIntersection); |
1433 |
__addTriangle(A,B,C,cell,triangleListIntersectionNew); |
__addTriangle(A,B,C,cell,triangleListIntersectionNew); |
1434 |
} else { |
} else { |
1435 |
ffout(0) <<"pbs 21\n"<<std::flush; |
ffout(4) <<"pbs 21\n"<<std::flush; |
1436 |
ffout(0)<<V0<<"\n"; |
ffout(4)<<V0<<"\n"; |
1437 |
ffout(0)<<V1<<"\n"; |
ffout(4)<<V1<<"\n"; |
1438 |
ffout(0)<<V2<<"\n"; |
ffout(4)<<V2<<"\n"; |
1439 |
} |
} |
1440 |
} |
} |
1441 |
break; |
break; |
1468 |
} |
} |
1469 |
default: { |
default: { |
1470 |
//POUR STEPH : peut generer des tr plats |
//POUR STEPH : peut generer des tr plats |
1471 |
ffout(0) << numberPointsInterior <<"be careful 2\n"<<std::flush; |
ffout(4) << numberPointsInterior <<"be careful 2\n"<<std::flush; |
1472 |
// ffout(0)<<V0<<"\n"; |
// ffout(4)<<V0<<"\n"; |
1473 |
// ffout(0)<<V1<<"\n"; |
// ffout(4)<<V1<<"\n"; |
1474 |
// ffout(0)<<V2<<"\n"; |
// ffout(4)<<V2<<"\n"; |
1475 |
TinyVector<10,const Vertex*> P,Ptemp; |
TinyVector<10,const Vertex*> P,Ptemp; |
1476 |
size_t i=0; |
size_t i=0; |
1477 |
for(std::map<const Vertex*,const Vertex*>::const_iterator it=pointsInterior.begin(); |
for(std::map<const Vertex*,const Vertex*>::const_iterator it=pointsInterior.begin(); |
1508 |
Ptemp[0]=P[num]; |
Ptemp[0]=P[num]; |
1509 |
P=Ptemp; |
P=Ptemp; |
1510 |
--size; |
--size; |
1511 |
// ffout(0)<<"size = "<<size<<"\n"; |
// ffout(4)<<"size = "<<size<<"\n"; |
1512 |
} |
} |
1513 |
__addTriangle(B,*P[0],*P[1],cell,triangleListIntersectionNew); |
__addTriangle(B,*P[0],*P[1],cell,triangleListIntersectionNew); |
1514 |
__addTriangle(B,*P[1],D,cell,triangleListIntersectionNew); |
__addTriangle(B,*P[1],D,cell,triangleListIntersectionNew); |
1515 |
//__addTriangle(A,B,D,cell); |
//__addTriangle(A,B,D,cell); |
1516 |
} else { |
} else { |
1517 |
ffout(0)<<"une seule arete cut pbs\n"; |
ffout(4)<<"une seule arete cut pbs\n"; |
1518 |
} |
} |
1519 |
} else { |
} else { |
1520 |
ffout(0)<<"une seule arete cut pbs2\n"; |
ffout(4)<<"une seule arete cut pbs2\n"; |
1521 |
} |
} |
1522 |
} |
} |
1523 |
} |
} |
1567 |
//detection tr plat |
//detection tr plat |
1568 |
size_t isDegenerate=0; |
size_t isDegenerate=0; |
1569 |
if(__isDegenerate(*(*jt0))) { |
if(__isDegenerate(*(*jt0))) { |
1570 |
// ffout(0)<<"degenerate triangle\n"; |
// ffout(4)<<"degenerate triangle\n"; |
1571 |
isDegenerate=1; |
isDegenerate=1; |
1572 |
} |
} |
1573 |
if(pairTriangleToIntersectionPoints[pairTriangle].size()==2 and isDegenerate==0) { |
if(pairTriangleToIntersectionPoints[pairTriangle].size()==2 and isDegenerate==0) { |
1575 |
const Vertex*& V1=pairTriangleToIntersectionPoints[pairTriangle][1]; |
const Vertex*& V1=pairTriangleToIntersectionPoints[pairTriangle][1]; |
1576 |
if((V0==&(*(*jt0))(0) or V0==&(*(*jt0))(1) or V0==&(*(*jt0))(2)) |
if((V0==&(*(*jt0))(0) or V0==&(*(*jt0))(1) or V0==&(*(*jt0))(2)) |
1577 |
and (V1==&(*(*jt0))(0) or V1==&(*(*jt0))(1) or V1==&(*(*jt0))(2))) { |
and (V1==&(*(*jt0))(0) or V1==&(*(*jt0))(1) or V1==&(*(*jt0))(2))) { |
1578 |
//ffout(0)<<"inter confondu avec arete\n"; |
//ffout(4)<<"inter confondu avec arete\n"; |
1579 |
isDegenerate=1; |
isDegenerate=1; |
1580 |
} |
} |
1581 |
} |
} |
1623 |
size_t r=0; |
size_t r=0; |
1624 |
size_t sum=cutTriangle[0]+cutTriangle[1]+cutTriangle[2]; |
size_t sum=cutTriangle[0]+cutTriangle[1]+cutTriangle[2]; |
1625 |
if(sum>3) { |
if(sum>3) { |
1626 |
ffout(0)<<"sum "<<sum<<"\n"<<std::flush; |
ffout(4)<<"sum "<<sum<<"\n"<<std::flush; |
1627 |
} |
} |
1628 |
|
|
1629 |
switch (sum) { |
switch (sum) { |
1648 |
break; |
break; |
1649 |
} |
} |
1650 |
default: { |
default: { |
1651 |
ffout(0) << "pbs sum = "<<sum<<" size " |
ffout(4) << "pbs sum = "<<sum<<" size " |
1652 |
<< pairTriangleToIntersectionPoints[pairTriangle].size()<<" \n"; |
<< pairTriangleToIntersectionPoints[pairTriangle].size()<<" \n"; |
1653 |
ffout(0) << K(0) << "\n"; |
ffout(4) << K(0) << "\n"; |
1654 |
ffout(0) << K(1) << "\n"; |
ffout(4) << K(1) << "\n"; |
1655 |
ffout(0) << K(2) << "\n"; |
ffout(4) << K(2) << "\n"; |
1656 |
ffout(0) << cutTriangle[0] << " " << cutTriangle[1] << " " << cutTriangle[2] << "\n"; |
ffout(4) << cutTriangle[0] << " " << cutTriangle[1] << " " << cutTriangle[2] << "\n"; |
1657 |
} |
} |
1658 |
} |
} |
1659 |
if(pointsInterior.find(pairTriangleToIntersectionPoints[pairTriangle][r]) |
if(pointsInterior.find(pairTriangleToIntersectionPoints[pairTriangle][r]) |
1663 |
} |
} |
1664 |
} |
} |
1665 |
} else { |
} else { |
1666 |
// ffout(0) <<"pasintersecte\n"; |
// ffout(4) <<"pasintersecte\n"; |
1667 |
} |
} |
1668 |
} |
} |
1669 |
} |
} |
1718 |
} |
} |
1719 |
} |
} |
1720 |
else { |
else { |
1721 |
// ffout(0)<<"la paire de triangle n'existe pas!\n"; |
// ffout(4)<<"la paire de triangle n'existe pas!\n"; |
1722 |
} |
} |
1723 |
} |
} |
1724 |
} |
} |
1741 |
|
|
1742 |
if(cutTriangle[0][0]+cutTriangle[1][0]+cutTriangle[2][0]!=0 and ((*edgesRefVertex[numobject])[V0]+ |
if(cutTriangle[0][0]+cutTriangle[1][0]+cutTriangle[2][0]!=0 and ((*edgesRefVertex[numobject])[V0]+ |
1743 |
(*edgesRefVertex[numobject])[V1]+(*edgesRefVertex[numobject])[V2])==6) { |
(*edgesRefVertex[numobject])[V1]+(*edgesRefVertex[numobject])[V2])==6) { |
1744 |
ffout(0)<<"************************ ---------tr a pbs\n"<<std::flush; |
ffout(4)<<"************************ ---------tr a pbs\n"<<std::flush; |
1745 |
ffout(0)<<cutTriangle[0]<<" "<<cutTriangle[1]<<" "<<cutTriangle[2]<<"\n"; |
ffout(4)<<cutTriangle[0]<<" "<<cutTriangle[1]<<" "<<cutTriangle[2]<<"\n"; |
1746 |
ffout(0)<<*V0<<"\n"; |
ffout(4)<<*V0<<"\n"; |
1747 |
ffout(0)<<*V1<<"\n"; |
ffout(4)<<*V1<<"\n"; |
1748 |
ffout(0)<<*V2<<"\n"; |
ffout(4)<<*V2<<"\n"; |
1749 |
} |
} |
1750 |
|
|
1751 |
__inout(numobject,cutTriangle[0][0],V0,V1); |
__inout(numobject,cutTriangle[0][0],V0,V1); |
1837 |
if(vertexInTriangles.find(P[0])!=vertexInTriangles.end()) { |
if(vertexInTriangles.find(P[0])!=vertexInTriangles.end()) { |
1838 |
T[0]=(*vertexInTriangles.find(P[0])).second[0]; |
T[0]=(*vertexInTriangles.find(P[0])).second[0]; |
1839 |
} else { |
} else { |
1840 |
ffout(0)<<"pbs 0 existe pas\n"; |
ffout(4)<<"pbs 0 existe pas\n"; |
1841 |
} |
} |
1842 |
|
|
1843 |
size_t b=0; |
size_t b=0; |
1855 |
P[b+1]=VV[0]; |
P[b+1]=VV[0]; |
1856 |
} |
} |
1857 |
} else { |
} else { |
1858 |
ffout(0)<<"pbs 1 existe pas\n"; |
ffout(4)<<"pbs 1 existe pas\n"; |
1859 |
} |
} |
1860 |
TinyVector<2,const Triangle*> T2; |
TinyVector<2,const Triangle*> T2; |
1861 |
if(vertexInTriangles.find(P[b+1])!=vertexInTriangles.end()) { |
if(vertexInTriangles.find(P[b+1])!=vertexInTriangles.end()) { |
1888 |
place0=2; |
place0=2; |
1889 |
} |
} |
1890 |
|
|
1891 |
//ffout(0)<<"place = "<<place0<<"\n"; |
//ffout(4)<<"place = "<<place0<<"\n"; |
1892 |
const Vertex* Pend=K.pointsIntersection[place0][1]; |
const Vertex* Pend=K.pointsIntersection[place0][1]; |
1893 |
TinyVector<10,const Vertex*> P; |
TinyVector<10,const Vertex*> P; |
1894 |
TinyVector<10,const Triangle*> T; |
TinyVector<10,const Triangle*> T; |
1896 |
if(vertexInTriangles.find(P[0])!=vertexInTriangles.end()) { |
if(vertexInTriangles.find(P[0])!=vertexInTriangles.end()) { |
1897 |
T[0]=(*vertexInTriangles.find(P[0])).second[0]; |
T[0]=(*vertexInTriangles.find(P[0])).second[0]; |
1898 |
} else { |
} else { |
1899 |
ffout(0)<<"pbs 0 existe pas\n"; |
ffout(4)<<"pbs 0 existe pas\n"; |
1900 |
} |
} |
1901 |
|
|
1902 |
size_t b=0; |
size_t b=0; |
1903 |
while(P[b]!=Pend and b<9) { |
while(P[b]!=Pend and b<9) { |
1904 |
//ffout(0)<<"------------------- b "<<b<<"\n"; |
//ffout(4)<<"------------------- b "<<b<<"\n"; |
1905 |
if(triangleWithVertex.find(T[b])!=triangleWithVertex.end()) { |
if(triangleWithVertex.find(T[b])!=triangleWithVertex.end()) { |
1906 |
TinyVector<2,const Vertex*> VV=(*triangleWithVertex.find(T[b])).second; |
TinyVector<2,const Vertex*> VV=(*triangleWithVertex.find(T[b])).second; |
1907 |
if(VV[0]==P[b]) { |
if(VV[0]==P[b]) { |
1908 |
if(Pend!=VV[1]) { |
if(Pend!=VV[1]) { |
1909 |
__addTriangle(*Pend,*P[b],*VV[1],cell,triangleListIntersectionNew); |
__addTriangle(*Pend,*P[b],*VV[1],cell,triangleListIntersectionNew); |
1910 |
// ffout(0)<<"1 "<<*Pend<<"\n"; |
// ffout(4)<<"1 "<<*Pend<<"\n"; |
1911 |
// ffout(0)<<*P[b]<<"\n"; |
// ffout(4)<<*P[b]<<"\n"; |
1912 |
// ffout(0)<<*VV[1]<<"\n"; |
// ffout(4)<<*VV[1]<<"\n"; |
1913 |
} |
} |
1914 |
P[b+1]=VV[1]; |
P[b+1]=VV[1]; |
1915 |
} else { |
} else { |
1916 |
if(Pend!=VV[0]) { |
if(Pend!=VV[0]) { |
1917 |
__addTriangle(*Pend,*P[b],*VV[0],cell,triangleListIntersectionNew); |
__addTriangle(*Pend,*P[b],*VV[0],cell,triangleListIntersectionNew); |
1918 |
//ffout(0)<<"2 "<<*Pend<<"\n"; |
//ffout(4)<<"2 "<<*Pend<<"\n"; |
1919 |
//ffout(0)<<*P[b]<<"\n"; |
//ffout(4)<<*P[b]<<"\n"; |
1920 |
//ffout(0)<<*VV[0]<<"\n"; |
//ffout(4)<<*VV[0]<<"\n"; |
1921 |
} |
} |
1922 |
P[b+1]=VV[0]; |
P[b+1]=VV[0]; |
1923 |
} |
} |
1924 |
} else { |
} else { |
1925 |
ffout(0)<<"pbs 1 existe pas\n"; |
ffout(4)<<"pbs 1 existe pas\n"; |
1926 |
} |
} |
1927 |
|
|
1928 |
TinyVector<2,const Triangle*> T2; |
TinyVector<2,const Triangle*> T2; |
1930 |
T2[0]=(*vertexInTriangles.find(P[b+1])).second[0]; |
T2[0]=(*vertexInTriangles.find(P[b+1])).second[0]; |
1931 |
T2[1]=(*vertexInTriangles.find(P[b+1])).second[1]; |
T2[1]=(*vertexInTriangles.find(P[b+1])).second[1]; |
1932 |
} else { |
} else { |
1933 |
ffout(0)<<"points exisste pas \n"; |
ffout(4)<<"points exisste pas \n"; |
1934 |
} |
} |
1935 |
if(K.edgecut[0][0]==1 and K.edgecut[0][1]==1) { |
if(K.edgecut[0][0]==1 and K.edgecut[0][1]==1) { |
1936 |
if(P[b+1]==K.pointsIntersection[0][1] or P[b+1]==K.pointsIntersection[0][0]) { |
if(P[b+1]==K.pointsIntersection[0][1] or P[b+1]==K.pointsIntersection[0][0]) { |
1947 |
if(T2[0]==T[b]) { |
if(T2[0]==T[b]) { |
1948 |
if(T2[1]==T[b]) { |
if(T2[1]==T[b]) { |
1949 |
//point edge |
//point edge |
1950 |
//ffout(0)<<"here\n"; |
//ffout(4)<<"here\n"; |
1951 |
if(K.edgecut[0][0]==1 and K.edgecut[0][1]==1) { |
if(K.edgecut[0][0]==1 and K.edgecut[0][1]==1) { |
1952 |
//ffout(0)<<"here2\n"; |
//ffout(4)<<"here2\n"; |
1953 |
if(P[b+1]==K.pointsIntersection[0][1]) { |
if(P[b+1]==K.pointsIntersection[0][1]) { |
1954 |
__addTriangle(*Pend,*P[b+1],*K.pointsIntersection[0][0],cell,triangleListIntersectionNew); |
__addTriangle(*Pend,*P[b+1],*K.pointsIntersection[0][0],cell,triangleListIntersectionNew); |
1955 |
P[b+1]=K.pointsIntersection[0][0]; |
P[b+1]=K.pointsIntersection[0][0]; |
1966 |
T2[0]=(*vertexInTriangles.find(P[b+1])).second[0]; |
T2[0]=(*vertexInTriangles.find(P[b+1])).second[0]; |
1967 |
T2[1]=(*vertexInTriangles.find(P[b+1])).second[1]; |
T2[1]=(*vertexInTriangles.find(P[b+1])).second[1]; |
1968 |
} else { |
} else { |
1969 |
ffout(0)<<"le tr e pas\n"; |
ffout(4)<<"le tr e pas\n"; |
1970 |
} |
} |
1971 |
T[b+1]=T2[0]; |
T[b+1]=T2[0]; |
1972 |
} else |
} else |
1973 |
if(P[b+1]!=Pend) { |
if(P[b+1]!=Pend) { |
1974 |
ffout(0)<<"point pas sur edge trou???? \n"; |
ffout(4)<<"point pas sur edge trou???? \n"; |
1975 |
ffout(0)<<*P[b+1]<<"\n"; |
ffout(4)<<*P[b+1]<<"\n"; |
1976 |
ffout(0)<<*Pend<<"\n"; |
ffout(4)<<*Pend<<"\n"; |
1977 |
P[b+1]=Pend; |
P[b+1]=Pend; |
1978 |
} |
} |
1979 |
} else { |
} else { |
1980 |
if(K.edgecut[2][0]==1 and K.edgecut[2][1]==1) { |
if(K.edgecut[2][0]==1 and K.edgecut[2][1]==1) { |
1981 |
//ffout(0)<<"here3\n"; |
//ffout(4)<<"here3\n"; |
1982 |
if(P[b+1]==K.pointsIntersection[2][1]) { |
if(P[b+1]==K.pointsIntersection[2][1]) { |
1983 |
__addTriangle(*Pend,*P[b+1],*K.pointsIntersection[2][0],cell,triangleListIntersectionNew); |
__addTriangle(*Pend,*P[b+1],*K.pointsIntersection[2][0],cell,triangleListIntersectionNew); |
1984 |
P[b+1]=K.pointsIntersection[2][0]; |
P[b+1]=K.pointsIntersection[2][0]; |
1999 |
} |
} |
2000 |
} |
} |
2001 |
} else { |
} else { |
2002 |
ffout(0)<<"pas trouve l'egde et le point\n"; |
ffout(4)<<"pas trouve l'egde et le point\n"; |
2003 |
} |
} |
2004 |
} |
} |
2005 |
} else { |
} else { |
2041 |
if(vertexInTriangles.find(P[0])!=vertexInTriangles.end()) { |
if(vertexInTriangles.find(P[0])!=vertexInTriangles.end()) { |
2042 |
T[0]=(*vertexInTriangles.find(P[0])).second[0]; |
T[0]=(*vertexInTriangles.find(P[0])).second[0]; |
2043 |
} else { |
} else { |
2044 |
ffout(0)<<"pbs 0 existe pas\n"; |
ffout(4)<<"pbs 0 existe pas\n"; |
2045 |
} |
} |
2046 |
|
|
2047 |
size_t b=0; |
size_t b=0; |
2050 |
TinyVector<2,const Vertex*> VV=(*triangleWithVertex.find(T[b])).second; |
TinyVector<2,const Vertex*> VV=(*triangleWithVertex.find(T[b])).second; |
2051 |
if(VV[0]==P[b]) { |
if(VV[0]==P[b]) { |
2052 |
if(VV[1]==P[b]) { |
if(VV[1]==P[b]) { |
2053 |
ffout(0)<<"egal\n"; |
ffout(4)<<"egal\n"; |
2054 |
if(K.pointsIntersection[place2][0]==P[b]) { |
if(K.pointsIntersection[place2][0]==P[b]) { |
2055 |
P[b+1]=K.pointsIntersection[place2][1]; |
P[b+1]=K.pointsIntersection[place2][1]; |
2056 |
__addTriangle(K(in0),*P[b],*P[b+1],cell,triangleListIntersectionNew); |
__addTriangle(K(in0),*P[b],*P[b+1],cell,triangleListIntersectionNew); |
2059 |
P[b+1]=K.pointsIntersection[place2][0]; |
P[b+1]=K.pointsIntersection[place2][0]; |
2060 |
__addTriangle(K(in0),*P[b],*P[b+1],cell,triangleListIntersectionNew); |
__addTriangle(K(in0),*P[b],*P[b+1],cell,triangleListIntersectionNew); |
2061 |
} else { |
} else { |
2062 |
ffout(0)<<"pbs pbs\n"; |
ffout(4)<<"pbs pbs\n"; |
2063 |
ffout(0)<<*P[b]<<"\n"; |
ffout(4)<<*P[b]<<"\n"; |
2064 |
std::exit(0); |
std::exit(0); |
2065 |
} |
} |
2066 |
} |
} |
2073 |
P[b+1]=VV[0]; |
P[b+1]=VV[0]; |
2074 |
} |
} |
2075 |
} else { |
} else { |
2076 |
ffout(0)<<"pbs 1 existe pas\n"; |
ffout(4)<<"pbs 1 existe pas\n"; |
2077 |
} |
} |
2078 |
TinyVector<2,const Triangle*> T2; |
TinyVector<2,const Triangle*> T2; |
2079 |
|
|
2081 |
T2[0]=(*vertexInTriangles.find(P[b+1])).second[0]; |
T2[0]=(*vertexInTriangles.find(P[b+1])).second[0]; |
2082 |
T2[1]=(*vertexInTriangles.find(P[b+1])).second[1]; |
T2[1]=(*vertexInTriangles.find(P[b+1])).second[1]; |
2083 |
} else { |
} else { |
2084 |
ffout(0)<<"pbs tr existe pas\n"; |
ffout(4)<<"pbs tr existe pas\n"; |
2085 |
} |
} |
2086 |
|
|
2087 |
if(T2[0]==T[b] and T2[1]==T[b]) { |
if(T2[0]==T[b] and T2[1]==T[b]) { |
2088 |
// ffout(0)<<"here0\n"; |
// ffout(4)<<"here0\n"; |
2089 |
//point edge |
//point edge |
2090 |
if(P[b+1]!=Pend) { |
if(P[b+1]!=Pend) { |
2091 |
if(K.pointsIntersection[place2][0]==P[b+1]) { |
if(K.pointsIntersection[place2][0]==P[b+1]) { |
2127 |
{ |
{ |
2128 |
//build mesh of object O1 (which is intersected with O2) |
//build mesh of object O1 (which is intersected with O2) |
2129 |
|
|
2130 |
//ffout(0)<<"numero "<<numobject<<" "<<objectNumber<<"\n"<<std::flush; |
//ffout(4)<<"numero "<<numobject<<" "<<objectNumber<<"\n"<<std::flush; |
2131 |
size_t objectNumber=0; |
size_t objectNumber=0; |
2132 |
if(numobject==0) |
if(numobject==0) |
2133 |
objectNumber=1; |
objectNumber=1; |
2181 |
} |
} |
2182 |
|
|
2183 |
size_t nbinters=listVertexIntersectionNew.size(); |
size_t nbinters=listVertexIntersectionNew.size(); |
2184 |
ffout(0)<<"size listVertexIntersectionNew "<<nbinters<<"\n"<<std::flush; |
ffout(4)<<"size listVertexIntersectionNew "<<nbinters<<"\n"<<std::flush; |
2185 |
|
|
2186 |
size_t dd_max=4;//4 |
size_t dd_max=4;//4 |
2187 |
//ffout(0)<<"size liste intersection "<<taille<<"\n"<<std::flush; |
//ffout(4)<<"size liste intersection "<<taille<<"\n"<<std::flush; |
2188 |
for(size_t dd=0 ; dd<dd_max ; ++dd) { |
for(size_t dd=0 ; dd<dd_max ; ++dd) { |
2189 |
ffout(0)<<"num passage "<<dd<<"\n"<<std::flush; |
ffout(4)<<"num passage "<<dd<<"\n"<<std::flush; |
2190 |
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) |
2191 |
{ |
{ |
2192 |
MapCellTriangle::iterator it0=hexaToTriangle0.find(*i); |
MapCellTriangle::iterator it0=hexaToTriangle0.find(*i); |
2235 |
// K is outside but the 3 edges are cut "and there are less than 3 points in K" |
// K is outside but the 3 edges are cut "and there are less than 3 points in K" |
2236 |
|
|
2237 |
// On ne peut normalement pas se trouver ICI. |
// On ne peut normalement pas se trouver ICI. |
2238 |
ffout(0)<<"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"; |
2239 |
__casePinterNotInList(K,*i, triangleListIntersectionNew); |
__casePinterNotInList(K,*i, triangleListIntersectionNew); |
2240 |
std::exit(1); |
std::exit(1); |
2241 |
} |
} |
2253 |
} |
} |
2254 |
if(V[0]!=V[1] and V[1]!=V[2] and V[2]!=V[0]) { |
if(V[0]!=V[1] and V[1]!=V[2] and V[2]!=V[0]) { |
2255 |
__addTriangle(*V[0],*V[1],*V[2],*i,triangleListIntersectionNew); |
__addTriangle(*V[0],*V[1],*V[2],*i,triangleListIntersectionNew); |
2256 |
ffout(0)<<"on comble le trou\n"<<std::flush; |
ffout(4)<<"on comble le trou\n"<<std::flush; |
2257 |
} else { |
} else { |
2258 |
ffout(0)<<"----- deux inter =\n"; |
ffout(4)<<"----- deux inter =\n"; |
2259 |
ffout(0)<<V[0]<<"\n"; |
ffout(4)<<V[0]<<"\n"; |
2260 |
ffout(0)<<V[1]<<"\n"; |
ffout(4)<<V[1]<<"\n"; |
2261 |
ffout(0)<<V[2]<<"\n"; |
ffout(4)<<V[2]<<"\n"; |
2262 |
} |
} |
2263 |
} else { |
} else { |
2264 |
if(vertexInTriangles.size()>3 and |
if(vertexInTriangles.size()>3 and |
2265 |
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){ |
2266 |
//one edge cut but twice |
//one edge cut but twice |
2267 |
ffout(0)<<"createNotIn\n"; |
ffout(4)<<"createNotIn\n"; |
2268 |
//POUR STEPH : createNotIn peut generer des tr plats |
//POUR STEPH : createNotIn peut generer des tr plats |
2269 |
__createNotIn(K,*i, triangleListIntersectionNew); |
__createNotIn(K,*i, triangleListIntersectionNew); |
2270 |
} else { |
} else { |
2271 |
if(vertexInTriangles.size()>3 and |
if(vertexInTriangles.size()>3 and |
2272 |
K.edgecut[0][0]+K.edgecut[1][0]+K.edgecut[2][0]==2) { |
K.edgecut[0][0]+K.edgecut[1][0]+K.edgecut[2][0]==2) { |
2273 |
//two edge cut but twice |
//two edge cut but twice |
2274 |
ffout(0)<<"createNotIn2\n"; |
ffout(4)<<"createNotIn2\n"; |
2275 |
__createNotIn2(K,*i, triangleListIntersectionNew); |
__createNotIn2(K,*i, triangleListIntersectionNew); |
2276 |
} else { |
} else { |
2277 |
if(K.edgecut[0]!=0) { |
if(K.edgecut[0]!=0) { |
2278 |
if(K.pointsIntersection[0][0]==&V0 |
if(K.pointsIntersection[0][0]==&V0 |
2279 |
or K.pointsIntersection[0][0]==&V1 |
or K.pointsIntersection[0][0]==&V1 |
2280 |
or K.pointsIntersection[0][0]==&V2 or vertexInTriangles.size()==1) { |
or K.pointsIntersection[0][0]==&V2 or vertexInTriangles.size()==1) { |
2281 |
// ffout(0)<<"**********normal\n"; |
// ffout(4)<<"**********normal\n"; |
2282 |
} else { |
} else { |
2283 |
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 |
2284 |
and K.edgecut[0][1]+K.edgecut[1][1]+K.edgecut[2][1]==3) { |
and K.edgecut[0][1]+K.edgecut[1][1]+K.edgecut[2][1]==3) { |
2296 |
} |
} |
2297 |
if(vertexInTriangles.size()>3 and |
if(vertexInTriangles.size()>3 and |
2298 |
K.edgecut[0][0]+K.edgecut[1][0]+K.edgecut[2][0]==2){ |
K.edgecut[0][0]+K.edgecut[1][0]+K.edgecut[2][0]==2){ |
2299 |
ffout(0)<<"hhhhhhhh\n"; |
ffout(4)<<"hhhhhhhh\n"; |
2300 |
__createNotIn2(K,*i,triangleListIntersectionNew); |
__createNotIn2(K,*i,triangleListIntersectionNew); |
2301 |
} else { |
} else { |
2302 |
if(vertexInTriangles.size()>3 and |
if(vertexInTriangles.size()>3 and |
2303 |
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) { |
2304 |
ffout(0)<<"case\n"; |
ffout(4)<<"case\n"; |
2305 |
__createNotIn(K,*i,triangleListIntersectionNew); |
__createNotIn(K,*i,triangleListIntersectionNew); |
2306 |
} |
} |
2307 |
} |
} |
2308 |
} else { |
} else { |
2309 |
if(vertexInTriangles.size()>=3) { |
if(vertexInTriangles.size()>=3) { |
2310 |
ffout(0)<<"triangle cut but outside1\n"; |
ffout(4)<<"triangle cut but outside1\n"; |
2311 |
ffout(0)<<V0<<"\n"; |
ffout(4)<<V0<<"\n"; |
2312 |
ffout(0)<<V1<<"\n"; |
ffout(4)<<V1<<"\n"; |
2313 |
ffout(0)<<V2<<"\n"; |
ffout(4)<<V2<<"\n"; |
2314 |
ffout(0)<<"nb points inter "<<vertexInTriangles.size()<<"\n"; |
ffout(4)<<"nb points inter "<<vertexInTriangles.size()<<"\n"; |
2315 |
} |
} |
2316 |
} |
} |
2317 |
} |
} |
2320 |
if(K.pointsIntersection[1][0]==&V0 |
if(K.pointsIntersection[1][0]==&V0 |
2321 |
or K.pointsIntersection[1][0]==&V1 |
or K.pointsIntersection[1][0]==&V1 |
2322 |
or K.pointsIntersection[1][0]==&V2 or vertexInTriangles.size()<3) { |
or K.pointsIntersection[1][0]==&V2 or vertexInTriangles.size()<3) { |
2323 |
// ffout(0)<<"**********normal\n"; |
// ffout(4)<<"**********normal\n"; |
2324 |
} else { |
} else { |
2325 |
ffout(0)<<"triangle cut but outside2\n"; |
ffout(4)<<"triangle cut but outside2\n"; |
2326 |
ffout(0)<<V0<<"\n"; |
ffout(4)<<V0<<"\n"; |
2327 |
ffout(0)<<V1<<"\n"; |
ffout(4)<<V1<<"\n"; |
2328 |
ffout(0)<<V2<<"\n"; |
ffout(4)<<V2<<"\n"; |
2329 |
ffout(0)<<"nb points inter "<<vertexInTriangles.size()<<"\n"; |
ffout(4)<<"nb points inter "<<vertexInTriangles.size()<<"\n"; |
2330 |
} |
} |
2331 |
} else { |
} else { |
2332 |
if(K.edgecut[2]!=0) { |
if(K.edgecut[2]!=0) { |
2333 |
if(K.pointsIntersection[2][0]==&V0 |
if(K.pointsIntersection[2][0]==&V0 |
2334 |
or K.pointsIntersection[2][0]==&V1 |
or K.pointsIntersection[2][0]==&V1 |
2335 |
or K.pointsIntersection[2][0]==&V2 or vertexInTriangles.size()<3) { |
or K.pointsIntersection[2][0]==&V2 or vertexInTriangles.size()<3) { |
2336 |
//ffout(0)<<"**********normal\n"; |
//ffout(4)<<"**********normal\n"; |
2337 |
} else { |
} else { |
2338 |
ffout(0)<<"triangle cut but outside3\n"; |
ffout(4)<<"triangle cut but outside3\n"; |
2339 |
ffout(0)<<V0<<"\n"; |
ffout(4)<<V0<<"\n"; |
2340 |
ffout(0)<<V1<<"\n"; |
ffout(4)<<V1<<"\n"; |
2341 |
ffout(0)<<V2<<"\n"; |
ffout(4)<<V2<<"\n"; |
2342 |
ffout(0)<<"nb points inter "<<vertexInTriangles.size()<<"\n"; |
ffout(4)<<"nb points inter "<<vertexInTriangles.size()<<"\n"; |
2343 |
} |
} |
2344 |
} |
} |
2345 |
} |
} |
2353 |
if(K.pointsIntersection[0][0]!=K.pointsIntersection[1][0] |
if(K.pointsIntersection[0][0]!=K.pointsIntersection[1][0] |
2354 |
and K.pointsIntersection[1][0]!=K.pointsIntersection[2][0] |
and K.pointsIntersection[1][0]!=K.pointsIntersection[2][0] |
2355 |
and K.pointsIntersection[2][0]!=K.pointsIntersection[0][0]) { |
and K.pointsIntersection[2][0]!=K.pointsIntersection[0][0]) { |
2356 |
ffout(0)<<"---------------- 3 edge cut \n"; |
ffout(4)<<"---------------- 3 edge cut \n"; |
2357 |
__createByEdges(K,*i,triangleListIntersectionNew); |
__createByEdges(K,*i,triangleListIntersectionNew); |
2358 |
} else { |
} else { |
2359 |
__createListTriangle(K,*i,triangleListIntersectionNew); |
__createListTriangle(K,*i,triangleListIntersectionNew); |
2362 |
if(nbinters!=0) { |
if(nbinters!=0) { |
2363 |
__createListTriangle(K,*i,triangleListIntersectionNew); |
__createListTriangle(K,*i,triangleListIntersectionNew); |
2364 |
} else { |
} else { |
2365 |
//ffout(0)<<"j ajoute le tr car pas d'intersection dans les 2 listes\n"; |
//ffout(4)<<"j ajoute le tr car pas d'intersection dans les 2 listes\n"; |
2366 |
__addTriangle(V0,V1,V2,*i,triangleListIntersectionNew); |
__addTriangle(V0,V1,V2,*i,triangleListIntersectionNew); |
2367 |
} |
} |
2368 |
} |
} |
2734 |
++itcell; |
++itcell; |
2735 |
} |
} |
2736 |
} else { |
} else { |
2737 |
ffout(0)<<"------jobDone false\n"; |
ffout(4)<<"------jobDone false\n"; |
2738 |
SurfaceMeshGenerator::Internals::MotherCellList::iterator itcell |
SurfaceMeshGenerator::Internals::MotherCellList::iterator itcell |
2739 |
=cellList.begin(); |
=cellList.begin(); |
2740 |
for (EdgePairList::iterator t = localTriangleList.begin(); |
for (EdgePairList::iterator t = localTriangleList.begin(); |
2853 |
break; |
break; |
2854 |
} |
} |
2855 |
default: { |
default: { |
2856 |
fferr(2) << '\n' << __FILE__ << ':' << __LINE__ << ": Not implemented\n"; |
fferr(0) << '\n' << __FILE__ << ':' << __LINE__ << ": Not implemented\n"; |
2857 |
std::exit(1); |
std::exit(1); |
2858 |
} |
} |
2859 |
} |
} |
2894 |
break; |
break; |
2895 |
} |
} |
2896 |
default: { |
default: { |
2897 |
fferr(2) << '\n' << __FILE__ << ':' << __LINE__ << ": Not implemented\n"; |
fferr(0) << __FILE__ << ':' << __LINE__ << ": Not implemented\n"; |
2898 |
std::exit(1); |
std::exit(1); |
2899 |
} |
} |
2900 |
} |
} |
2931 |
break; |
break; |
2932 |
} |
} |
2933 |
default: { |
default: { |
2934 |
fferr(2) << '\n' << __FILE__ << ':' << __LINE__ << ": Not implemented\n"; |
fferr(0) << __FILE__ << ':' << __LINE__ << ": Not implemented\n"; |
2935 |
std::exit(1); |
std::exit(1); |
2936 |
} |
} |
2937 |
} |
} |
2947 |
std::set<const Cell*>& hlist, |
std::set<const Cell*>& hlist, |
2948 |
Structured3DMesh& SMesh); |
Structured3DMesh& SMesh); |
2949 |
|
|
|
|
|
2950 |
void plotmedit(const size_t& nobject, |
void plotmedit(const size_t& nobject, |
2951 |
const SurfaceMeshOfTriangles& s_mesh, |
const SurfaceMeshOfTriangles& s_mesh, |
2952 |
std::set<const Cell*>& toTreatHexahedra, |
std::set<const Cell*>& toTreatHexahedra, |
2953 |
size_t n0,size_t n1); |
size_t n0,size_t n1); |
2954 |
|
|
|
|
|
2955 |
void plothexa(size_t ncase,std::set<const Cell*>& cuttedHexahedra); |
void plothexa(size_t ncase,std::set<const Cell*>& cuttedHexahedra); |
2956 |
|
|
|
|
|
2957 |
void SurfaceMeshGenerator::Internals:: |
void SurfaceMeshGenerator::Internals:: |
2958 |
__generateMesh(Structured3DMesh& SMesh, |
__generateMesh(Structured3DMesh& SMesh, |
2959 |
const Object& object, const size_t& level, |
const Object& object, const size_t& level, |
2960 |
std::stack<ReferenceCounting<ObjectToTreat> >& objectStack) |
std::stack<ReferenceCounting<ObjectToTreat> >& objectStack) |
2961 |
{ |
{ |
2962 |
switch(object.shapeType()) { |
ffout(0) << "object: " << *object.shape(); |
2963 |
|
if(object.hasReference()) { |
2964 |
|
ffout(0) << "reference: " << object.reference() << '\n'; |
2965 |
|
} else { |
2966 |
|
ffout(0) << "has no reference!\n"; |
2967 |
|
} |
2968 |
|
switch ((*object.shape()).type()) { |
2969 |
case Shape::union_: { |
case Shape::union_: { |
2970 |
const Union& U = static_cast<const Union&>(*(object.shape())); |
const Union& U = static_cast<const Union&>(*(object.shape())); |
2971 |
|
|
2988 |
// Set shape function |
// Set shape function |
2989 |
if (j == 1) { // create an union shape |
if (j == 1) { // create an union shape |
2990 |
Union* u = new Union(); |
Union* u = new Union(); |
2991 |
u->push_back(new Object((*O1).shape(), TinyVector<3,real_t>(0,0,0))); |
u->push_back(new Object((*O1).shape())); |
2992 |
u->push_back(new Object((*O2).shape(), TinyVector<3,real_t>(0,0,0))); |
u->push_back(new Object((*O2).shape())); |
2993 |
(*O0).setShape(u); |
(*O0).setShape(u); |
2994 |
} else { //use the union shape contained in O2 |
} else { //use the union shape contained in O2 |
2995 |
Union& u = dynamic_cast<Union&>(*(*O2).shape()); |
Union& u = dynamic_cast<Union&>(*(*O2).shape()); |
2996 |
u.push_back(new Object((*O1).shape(), TinyVector<3,real_t>(0,0,0))); |
u.push_back(new Object((*O1).shape())); |
2997 |
(*O0).setShape((*O2).shape()); |
(*O0).setShape((*O2).shape()); |
2998 |
} |
} |
2999 |
|
|
3023 |
|
|
3024 |
if (j == 1) { // create an intersection shape |
if (j == 1) { // create an intersection shape |
3025 |
Intersection* newI = new Intersection(); |
Intersection* newI = new Intersection(); |
3026 |
newI->push_back(new Object((*O1).shape(), TinyVector<3,real_t>(0,0,0))); |
newI->push_back(new Object((*O1).shape())); |
3027 |
newI->push_back(new Object((*O2).shape(), TinyVector<3,real_t>(0,0,0))); |
newI->push_back(new Object((*O2).shape())); |
3028 |
(*O0).setShape(newI); |
(*O0).setShape(newI); |
3029 |
} else { //use the intersection shape contained in O2 |
} else { //use the intersection shape contained in O2 |
3030 |
Intersection& newI = dynamic_cast<Intersection&>(*(*O2).shape()); |
Intersection& newI = dynamic_cast<Intersection&>(*(*O2).shape()); |
3031 |
newI.push_back(new Object((*O1).shape(), TinyVector<3,real_t>(0,0,0))); |
newI.push_back(new Object((*O1).shape())); |
3032 |
(*O0).setShape((*O2).shape()); |
(*O0).setShape((*O2).shape()); |
3033 |
} |
} |
3034 |
objectStack.push(O0); |
objectStack.push(O0); |
3037 |
break; |
break; |
3038 |
} |
} |
3039 |
case Shape::difference: { |
case Shape::difference: { |
|
|
|
3040 |
fferr(0) << __FILE__ << ':' << __LINE__ << ": Not implemented\n"; |
fferr(0) << __FILE__ << ':' << __LINE__ << ": Not implemented\n"; |
3041 |
std::exit(1); |
std::exit(1); |
|
|
|
3042 |
break; |
break; |
3043 |
} |
} |
3044 |
case Shape::not_: { |
case Shape::not_: { |
3048 |
|
|
3049 |
ObjectToTreat& o = (*objectStack.top()); |
ObjectToTreat& o = (*objectStack.top()); |
3050 |
ReferenceCounting<Shape> s = o.shape(); |
ReferenceCounting<Shape> s = o.shape(); |
3051 |
#warning DO NOT CALL 'new Object' |
o.setShape(new Not(new Object(s))); |
|
o.setShape(new Not(new Object(s, TinyVector<3,real_t>(0,0,0)))); |
|
3052 |
|
|
3053 |
break; |
break; |
3054 |
} |
} |
3058 |
__marchingTetrahedra(SMesh, *o, 0); |
__marchingTetrahedra(SMesh, *o, 0); |
3059 |
|
|
3060 |
objectStack.push(o); |
objectStack.push(o); |
3061 |
std::cout << "Marching cube sur " << objectStack.top() << '\n'; |
ffout(4) << "Marching cube sur " << objectStack.top() << '\n'; |
3062 |
} |
} |
3063 |
} |
} |
3064 |
} |
} |
3199 |
sortie<<" \n"; |
sortie<<" \n"; |
3200 |
sortie<<"Triangles"<<"\n"; |
sortie<<"Triangles"<<"\n"; |
3201 |
sortie<<s_mesh.numberOfCells()<<"\n"; |
sortie<<s_mesh.numberOfCells()<<"\n"; |
3202 |
ffout(0)<<"fin ecriture vertex\n"; |
ffout(4)<<"fin ecriture vertex\n"; |
3203 |
for (size_t i=0; i<s_mesh.numberOfCells(); ++i) { |
for (size_t i=0; i<s_mesh.numberOfCells(); ++i) { |
3204 |
const Triangle& T = s_mesh.cell(i); |
const Triangle& T = s_mesh.cell(i); |
3205 |
// ffout(0)<<s_mesh.vertexNumber(T(0))<<" "<<s_mesh.vertexNumber(T(1))<<" "<<s_mesh.//vertexNumber(T(2))<<"\n"; |
// ffout(4)<<s_mesh.vertexNumber(T(0))<<" "<<s_mesh.vertexNumber(T(1))<<" "<<s_mesh.//vertexNumber(T(2))<<"\n"; |
3206 |
sortie<<s_mesh.vertexNumber(T(0))+8*toTreatHexahedra.size()+1<<" "<<s_mesh.vertexNumber(T(1))+8*toTreatHexahedra.size()+1<<" "<<s_mesh.vertexNumber(T(2))+8*toTreatHexahedra.size()+1; |
sortie<<s_mesh.vertexNumber(T(0))+8*toTreatHexahedra.size()+1<<" "<<s_mesh.vertexNumber(T(1))+8*toTreatHexahedra.size()+1<<" "<<s_mesh.vertexNumber(T(2))+8*toTreatHexahedra.size()+1; |
3207 |
|
|
3208 |
// sortie<<3*i+1+8*toTreatHexahedra.size()<<" "<<3*i+2+8*toTreatHexahedra.size()<<" //"<<3*i+3+8*toTreatHexahedra.size();//<<" "<<1<<"\n"; |
// sortie<<3*i+1+8*toTreatHexahedra.size()<<" "<<3*i+2+8*toTreatHexahedra.size()<<" //"<<3*i+3+8*toTreatHexahedra.size();//<<" "<<1<<"\n"; |
3214 |
// sortie<<" 4"<<"\n"; |
// sortie<<" 4"<<"\n"; |
3215 |
sortie << " " << T.reference() << '\n'; |
sortie << " " << T.reference() << '\n'; |
3216 |
} |
} |
3217 |
ffout(0)<<"fin ecriture triangles\n"; |
ffout(4)<<"fin ecriture triangles\n"; |
3218 |
sortie<<" \n"; |
sortie<<" \n"; |
3219 |
sortie<<"Hexahedra"<<"\n"; |
sortie<<"Hexahedra"<<"\n"; |
3220 |
sortie<<toTreatHexahedra.size()<<" \n"; |
sortie<<toTreatHexahedra.size()<<" \n"; |
3222 |
for(size_t i=0;i<toTreatHexahedra.size();i++) |
for(size_t i=0;i<toTreatHexahedra.size();i++) |
3223 |
sortie<<8*i+1<<" "<<8*i+2<<" "<<8*i+3<<" "<<8*i+4<<" "<<8*i+5<<" "<<8*i+6<<" "<<8*i+7<<" "<<8*i+8<<" 3"<<"\n"; |
sortie<<8*i+1<<" "<<8*i+2<<" "<<8*i+3<<" "<<8*i+4<<" "<<8*i+5<<" "<<8*i+6<<" "<<8*i+7<<" "<<8*i+8<<" 3"<<"\n"; |
3224 |
sortie<<"End"<<" \n"; |
sortie<<"End"<<" \n"; |
3225 |
ffout(0)<<"fin ecriture intersection.mesh\n"; |
ffout(4)<<"fin ecriture intersection.mesh\n"; |
3226 |
} |
} |