/[ff3d]/ff3d/solver/SurfaceMeshGenerator.cpp
ViewVC logotype

Diff of /ff3d/solver/SurfaceMeshGenerator.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.33 by delpinux, Thu Sep 4 20:37:36 2003 UTC revision 1.34 by dobj, Fri Sep 12 09:27:09 2003 UTC
# Line 38  Line 38 
38  #include <Problem.hpp>  #include <Problem.hpp>
39    
40  #include <Mesh.hpp>  #include <Mesh.hpp>
41    #include <ConnectivityBuilder.hpp>
42    #include <Connectivity.hpp>
43    #include <Cell.hpp>
44    
45  #include <BoundaryPOVRay.hpp>  #include <BoundaryPOVRay.hpp>
46  #include <BoundaryStructured3DMesh.hpp>  #include <BoundaryStructured3DMesh.hpp>
# Line 198  private: Line 201  private:
201    typedef std::map< PairTriangleNew , IntersectionPoints> PairTriangleToIntersectionPoints;    typedef std::map< PairTriangleNew , IntersectionPoints> PairTriangleToIntersectionPoints;
202    
203    std::map<const Vertex*, const Vertex*>   listOfVertexMesh;    std::map<const Vertex*, const Vertex*>   listOfVertexMesh;
204      std::map<const Triangle*, const Triangle*>   listOfTriangleMeshFront;
205    
206    PairTriangleToIntersectionPoints pairTriangleToIntersectionPoints;    PairTriangleToIntersectionPoints pairTriangleToIntersectionPoints;
207    
# Line 297  private: Line 301  private:
301                                                          const Triangle*& currentTriangle,                                                          const Triangle*& currentTriangle,
302                                                          const Cell* cell);                                                          const Cell* cell);
303    
304    TinyVector<3,size_t>& __putEdgeRef(const size_t& ncase,    void __putEdgeRef(const Triangle*& currentTriangle,
305                                       const Triangle& currentTriangle,                      const size_t numobject,
306                                       TriangleCut& K);                      const ObjectToTreat& O1,
307                        const ObjectToTreat& O2);
308    
309      void __putRefByFront(const size_t numobject,
310                           const ObjectToTreat& O1,
311                           const ObjectToTreat& O2,
312                           const SurfaceMeshOfTriangles& surfmesh,
313                           const Connectivity<Triangle>& connect,
314                           const std::set<const Cell*>& toTreatHexahedra);
315      
316    void __createListTriangle(const TriangleCut& K,    void __createListTriangle(const TriangleCut& K,
317                              const Cell* cell,                              const Cell* cell,
318                              std::vector<Triangle>& triangleListIntersectionNew);                              std::vector<Triangle>& triangleListIntersectionNew);
# Line 581  __operationBoolean(ObjectToTreat& O0, Line 593  __operationBoolean(ObjectToTreat& O0,
593                           hexaList2.begin(), hexaList2.end(),                           hexaList2.begin(), hexaList2.end(),
594                           inserter(toTreatHexahedra, toTreatHexahedra.begin()));                           inserter(toTreatHexahedra, toTreatHexahedra.begin()));
595    
596    ffout(3)<<"nb hexa to treat "<<toTreatHexahedra.size()<<"\n";    ffout(4)<<"nb hexa to treat "<<toTreatHexahedra.size()<<"\n";
597        
598    __calculateIntersection<booleanTest>(O0,O1,O2, toTreatHexahedra);    __calculateIntersection<booleanTest>(O0,O1,O2, toTreatHexahedra);
599  }  }
# Line 601  __calculateIntersection(ObjectToTreat& O Line 613  __calculateIntersection(ObjectToTreat& O
613    //create mesh intersection for the object 0 and 1    //create mesh intersection for the object 0 and 1
614    __createTrianglesIntersection<booleanTest>(0, O1, O2, toTreatHexahedra,    __createTrianglesIntersection<booleanTest>(0, O1, O2, toTreatHexahedra,
615                                               triangleListIntersectionNew, listVertexIntersectionNew);                                               triangleListIntersectionNew, listVertexIntersectionNew);
616    ffout(3)<<"nb triangles in intersection 0 "<<triangleListIntersectionNew.size()<<"\n"<<std::flush;    ffout(4)<<"nb triangles in intersection 0 "<<triangleListIntersectionNew.size()<<"\n"<<std::flush;
617    __createTrianglesIntersection<booleanTest>(1, O2, O1, toTreatHexahedra,    __createTrianglesIntersection<booleanTest>(1, O2, O1, toTreatHexahedra,
618                                               triangleListIntersectionNew, listVertexIntersectionNew);                                               triangleListIntersectionNew, listVertexIntersectionNew);
619    ffout(3)<<"nb triangles in intersection 1 "<<triangleListIntersectionNew.size()<<"\n"<<std::flush;    ffout(4)<<"nb triangles in intersection 1 "<<triangleListIntersectionNew.size()<<"\n"<<std::flush;
620    
621    pairTriangleToIntersectionPoints.clear();    pairTriangleToIntersectionPoints.clear();
622        
# Line 656  void SurfaceMeshGenerator::Internals::__ Line 668  void SurfaceMeshGenerator::Internals::__
668    for(size_t size=0 ; size< triangleList.size() ; ++size) {    for(size_t size=0 ; size< triangleList.size() ; ++size) {
669      const Triangle& T=triangleList[size];      const Triangle& T=triangleList[size];
670      if (listOfVertexMesh.find(&T(0))==listOfVertexMesh.end()) {      if (listOfVertexMesh.find(&T(0))==listOfVertexMesh.end()) {
671        listOfVertexMesh[&T(0)] = &T(0);        listOfVertexMesh[&T(0)] = new Vertex(T(0));;
672      }      }
673      if (listOfVertexMesh.find(&T(1))==listOfVertexMesh.end()) {      if (listOfVertexMesh.find(&T(1))==listOfVertexMesh.end()) {
674        listOfVertexMesh[&T(1)] = &T(1);        listOfVertexMesh[&T(1)] = new Vertex(T(1));;
675      }      }
676      if (listOfVertexMesh.find(&T(2))==listOfVertexMesh.end()) {      if (listOfVertexMesh.find(&T(2))==listOfVertexMesh.end()) {
677        listOfVertexMesh[&T(2)] = &T(2);        listOfVertexMesh[&T(2)] = new Vertex(T(2));;
678      }      }
679    }    }
680  }  }
# Line 677  void SurfaceMeshGenerator::Internals::__ Line 689  void SurfaceMeshGenerator::Internals::__
689    ntr+=listOfVertexMesh.size();    ntr+=listOfVertexMesh.size();
690        
691    s_mesh.setNumberOfVertices(ntr);    s_mesh.setNumberOfVertices(ntr);
692    ffout(3)<<"nb tot vertices "<<s_mesh.numberOfVertices()<<"\n"<<std::flush;    ffout(4)<<"nb tot vertices "<<s_mesh.numberOfVertices()<<"\n"<<std::flush;
693        
694    //! copies vertices into the s_mesh.    //! copies vertices into the s_mesh.
695    int i = 0;    int i = 0;
# Line 705  void SurfaceMeshGenerator::Internals::__ Line 717  void SurfaceMeshGenerator::Internals::__
717    //if(nobjectToTreat==0){    //if(nobjectToTreat==0){
718    ncell+=triangleList.size();    ncell+=triangleList.size();
719    //}    //}
720    //  ffout(3)<<"ncell "<<ncell<<" n0 "<<n0<<" n1 "<<n1<<"\n";    //  ffout(4)<<"ncell "<<ncell<<" n0 "<<n0<<" n1 "<<n1<<"\n";
721        
722    s_mesh.setNumberOfCells(ncell);    s_mesh.setNumberOfCells(ncell);
723    ffout(3)<<"nb tot cells "<<s_mesh.numberOfCells()<<" \n"<<std::flush;    ffout(4)<<"nb tot cells "<<s_mesh.numberOfCells()<<" \n"<<std::flush;
724        
725    for(size_t size=0 ; size< triangleList.size() ; ++size) {    for(size_t size=0 ; size< triangleList.size() ; ++size) {
726      const Triangle& T=triangleList[size];      const Triangle& T=triangleList[size];
# Line 725  void SurfaceMeshGenerator::Internals::__ Line 737  void SurfaceMeshGenerator::Internals::__
737  #warning SHOULD USE BC NUMBER (ie OBJECT NUMBER IN SCENE INSTEAD)  #warning SHOULD USE BC NUMBER (ie OBJECT NUMBER IN SCENE INSTEAD)
738      //    s_mesh.cell(i).reference() = 1;      //    s_mesh.cell(i).reference() = 1;
739      s_mesh.cell(i).setMother(&T.mother());      s_mesh.cell(i).setMother(&T.mother());
740        listOfTriangleMeshFront[&s_mesh.cell(i)]=&T;
741      i++;      i++;
742        
743    }    }
744    // }    // }
745    //listOfVertexMesh.clear();
746  }  }
747    
748  void SurfaceMeshGenerator::Internals::__dataStructureConvertion(ObjectToTreat& O,  void SurfaceMeshGenerator::Internals::__dataStructureConvertion(ObjectToTreat& O,
# Line 807  __calculatePointsIntersection(const Obje Line 822  __calculatePointsIntersection(const Obje
822          }          }
823        }        }
824      } else {      } else {
825        //ffout(3)<<"pas d'intersection dans l'hexa\n";        //ffout(4)<<"pas d'intersection dans l'hexa\n";
826      }      }
827    }    }
828  }  }
# Line 1044  __DeterminatePoint(const size_t& ncase, Line 1059  __DeterminatePoint(const size_t& ncase,
1059          if(inV01 > epsilon and inV02 > epsilon and inV12 > epsilon ) {          if(inV01 > epsilon and inV02 > epsilon and inV12 > epsilon ) {
1060            __InTriangle(P,V,num);            __InTriangle(P,V,num);
1061            if(num==3) {            if(num==3) {
1062              //ffout(3)<<"ajout du point cas 2\n";              //ffout(4)<<"ajout du point cas 2\n";
1063              //ffout(3)<<P[0]<<" "<<P[1]<<" "<<P[2]<<" \n";              //ffout(4)<<P[0]<<" "<<P[1]<<" "<<P[2]<<" \n";
1064              //listVertexIntersectionNew.push_back(new Vertex (P));              //listVertexIntersectionNew.push_back(new Vertex (P));
1065              PIntersection PIn;              PIntersection PIn;
1066  //          if(!(norm2>epsilon)) {  //          if(!(norm2>epsilon)) {
# Line 1137  __inout(const size_t& numobject, Line 1152  __inout(const size_t& numobject,
1152    size_t& refVertex1=(*edgesRefVertex[numobject])[V1];    size_t& refVertex1=(*edgesRefVertex[numobject])[V1];
1153    
1154    if(refVertex0+refVertex1==4 and edgeCut==1) {    if(refVertex0+refVertex1==4 and edgeCut==1) {
1155      ffout(3)<<"warning edge ref 2 cut \n";      ffout(4)<<"warning edge ref 2 cut \n";
1156      ffout(3)<<(*V0)[0]<<" "<<(*V0)[1]<<" "<<(*V0)[2]<<" \n";      ffout(4)<<(*V0)[0]<<" "<<(*V0)[1]<<" "<<(*V0)[2]<<" \n";
1157      ffout(3)<<(*V1)[0]<<" "<<(*V1)[1]<<" "<<(*V1)[2]<<" \n";      ffout(4)<<(*V1)[0]<<" "<<(*V1)[1]<<" "<<(*V1)[2]<<" \n";
1158      refVertex0=0;      refVertex0=0;
1159      refVertex1=0;      refVertex1=0;
1160    } else {    } else {
# Line 1156  __createPointIntersection(std::list<Tria Line 1171  __createPointIntersection(std::list<Tria
1171                            std::list<Triangle*>::iterator currentTriangle,                            std::list<Triangle*>::iterator currentTriangle,
1172                            PIntersection& listVertexIntersectionNew)                            PIntersection& listVertexIntersectionNew)
1173  {      {    
1174    //ffout(3)<< "createpointintersection "<<numobject<<" "<<objectNumber<<"\n";    //ffout(4)<< "createpointintersection "<<numobject<<" "<<objectNumber<<"\n";
1175    //ffout(3)<<"*************************\n";    //ffout(4)<<"*************************\n";
1176    
1177    PairTriangleNew pTriangle;    PairTriangleNew pTriangle;
1178    pTriangle.first=(*currentTriangle1);    pTriangle.first=(*currentTriangle1);
# Line 1170  __createPointIntersection(std::list<Tria Line 1185  __createPointIntersection(std::list<Tria
1185    const TinyVector<3,size_t >& pintercut=Pinter.cutTriangle1();    const TinyVector<3,size_t >& pintercut=Pinter.cutTriangle1();
1186    
1187    if(pintercut[0]+pintercut[1]+pintercut[2]!=0) {    if(pintercut[0]+pintercut[1]+pintercut[2]!=0) {
1188      //ffout(3)<<"le tr est cut\n";      //ffout(4)<<"le tr est cut\n";
1189      assert(pairTriangleToIntersectionPoints.find(pTriangle)==pairTriangleToIntersectionPoints.end());      assert(pairTriangleToIntersectionPoints.find(pTriangle)==pairTriangleToIntersectionPoints.end());
1190      pairTriangleToIntersectionPoints[pTriangle] = Pinter;      pairTriangleToIntersectionPoints[pTriangle] = Pinter;
1191    } else {    } else {
1192      if(Pinter.size()!=0) {      if(Pinter.size()!=0) {
1193        //ffout(3)<<"rajout2 \n";        //ffout(4)<<"rajout2 \n";
1194        pairTriangleToIntersectionPoints[pTriangle] = Pinter;        pairTriangleToIntersectionPoints[pTriangle] = Pinter;
1195      }      }
1196    }    }
# Line 1310  __createCase1(int ncase, Line 1325  __createCase1(int ncase,
1325  //#warning Reference not set.  //#warning Reference not set.
1326          __addTriangle(Triangle(A,B,C,K.reference()),cell,triangleListIntersectionNew);          __addTriangle(Triangle(A,B,C,K.reference()),cell,triangleListIntersectionNew);
1327        } else {        } else {
1328          ffout(3) <<"pbs 10\n"<<std::flush;          ffout(4) <<"pbs 10\n"<<std::flush;
1329          ffout(3)<<V0<<"\n";          ffout(4)<<V0<<"\n";
1330          ffout(3)<<V1<<"\n";          ffout(4)<<V1<<"\n";
1331          ffout(3)<<V2<<"\n";          ffout(4)<<V2<<"\n";
1332        }        }
1333      } else {      } else {
1334        if(edgesCut[1]==1) {        if(edgesCut[1]==1) {
1335          ffout(3)<<"pbs 11\n"<<std::flush;          ffout(4)<<"pbs 11\n"<<std::flush;
1336          ffout(3)<<V0<<"\n";          ffout(4)<<V0<<"\n";
1337          ffout(3)<<V1<<"\n";          ffout(4)<<V1<<"\n";
1338          ffout(3)<<V2<<"\n";          ffout(4)<<V2<<"\n";
1339          ffout(3)<<ncase<<"\n";          ffout(4)<<ncase<<"\n";
1340          ffout(3)<<__determinateNumber(vertexNum[1],pointsIntersection)<<"\n";          ffout(4)<<__determinateNumber(vertexNum[1],pointsIntersection)<<"\n";
1341        } else {        } else {
1342          ffout(3) <<"pbs 111\n";          ffout(4) <<"pbs 111\n";
1343        }        }
1344      }      }
1345      break;      break;
# Line 1340  __createCase1(int ncase, Line 1355  __createCase1(int ncase,
1355          __addTriangle(Triangle(A,B,D,K.reference()),cell,triangleListIntersectionNew);          __addTriangle(Triangle(A,B,D,K.reference()),cell,triangleListIntersectionNew);
1356          __addTriangle(Triangle(A,D,C,K.reference()),cell,triangleListIntersectionNew);          __addTriangle(Triangle(A,D,C,K.reference()),cell,triangleListIntersectionNew);
1357        } else {        } else {
1358          ffout(3)<<"-------- warning trou in 0\n"<<std::flush;          ffout(4)<<"-------- warning trou in 0\n"<<std::flush;
1359          ffout(3)<<V0<<"\n";          ffout(4)<<V0<<"\n";
1360          ffout(3)<<V1<<"\n";          ffout(4)<<V1<<"\n";
1361          ffout(3)<<V2<<"\n";          ffout(4)<<V2<<"\n";
1362  //#warning Reference not set.  //#warning Reference not set.
1363          __addTriangle(Triangle(A,B,D,K.reference()),cell,triangleListIntersectionNew);          __addTriangle(Triangle(A,B,D,K.reference()),cell,triangleListIntersectionNew);
1364        }        }
1365      } else {      } else {
1366        if(edgesCut[1]==1) {        if(edgesCut[1]==1) {
1367          ffout(3)<<"-------- warning trou in\n"<<std::flush;          ffout(4)<<"-------- warning trou in\n"<<std::flush;
1368          const Vertex& B=__determinateNumber(vertexNum[1],pointsIntersection);          const Vertex& B=__determinateNumber(vertexNum[1],pointsIntersection);
1369  //#warning Reference not set.  //#warning Reference not set.
1370          __addTriangle(Triangle(A,B,D,K.reference()),cell,triangleListIntersectionNew);          __addTriangle(Triangle(A,B,D,K.reference()),cell,triangleListIntersectionNew);
1371        } else {        } else {
1372          ffout(3) <<"pbs 1\n"<<std::flush;          ffout(4) <<"pbs 1\n"<<std::flush;
1373        }        }
1374      }      }
1375      break;      break;
1376    }    }
1377    default: {    default: {
1378  #warning is it true? case where only one edge is cut?  #warning is it true? case where only one edge is cut?
1379      ffout(3) << numberPointsInterior<<" be careful 1\n"<<std::flush;      ffout(4) << numberPointsInterior<<" be careful 1\n"<<std::flush;
1380        //case 1 point inside and more than 1 point in the triangle        //case 1 point inside and more than 1 point in the triangle
1381      __createByEdges(K, cell, triangleListIntersectionNew);      __createByEdges(K, cell, triangleListIntersectionNew);
1382    }    }
# Line 1427  __createCase2(int ncase, Line 1442  __createCase2(int ncase,
1442          __addTriangle(Triangle(A,B,C,K.reference()),cell,triangleListIntersectionNew);          __addTriangle(Triangle(A,B,C,K.reference()),cell,triangleListIntersectionNew);
1443          __addTriangle(Triangle(C,B,D,K.reference()),cell,triangleListIntersectionNew);          __addTriangle(Triangle(C,B,D,K.reference()),cell,triangleListIntersectionNew);
1444        } else {        } else {
1445          // ffout(3) <<"pbs 20\n";          // ffout(4) <<"pbs 20\n";
1446  //#warning Reference not set.  //#warning Reference not set.
1447          __addTriangle(Triangle(A,B,C,K.reference()),cell,triangleListIntersectionNew);          __addTriangle(Triangle(A,B,C,K.reference()),cell,triangleListIntersectionNew);
1448        }        }
1449      } else {      } else {
1450        if(edgesCut[1]==1) {        if(edgesCut[1]==1) {
1451          // ffout(3) <<"pbs 210\n";          // ffout(4) <<"pbs 210\n";
1452          const Vertex& C=__determinateNumber(vertexNum[1],pointsIntersection);          const Vertex& C=__determinateNumber(vertexNum[1],pointsIntersection);
1453  //#warning Reference not set.  //#warning Reference not set.
1454          __addTriangle(Triangle(A,B,C,K.reference()),cell,triangleListIntersectionNew);          __addTriangle(Triangle(A,B,C,K.reference()),cell,triangleListIntersectionNew);
1455        } else {        } else {
1456          ffout(3) <<"pbs 21\n"<<std::flush;          ffout(4) <<"pbs 21\n"<<std::flush;
1457          ffout(3)<<V0<<"\n";          ffout(4)<<V0<<"\n";
1458          ffout(3)<<V1<<"\n";          ffout(4)<<V1<<"\n";
1459          ffout(3)<<V2<<"\n";          ffout(4)<<V2<<"\n";
1460        }        }
1461      }      }
1462      break;      break;
# Line 1476  __createCase2(int ncase, Line 1491  __createCase2(int ncase,
1491    }    }
1492    default: {    default: {
1493      //POUR STEPH :  peut generer des tr plats      //POUR STEPH :  peut generer des tr plats
1494      ffout(3) << numberPointsInterior <<"be careful 2\n"<<std::flush;      ffout(4) << numberPointsInterior <<"be careful 2\n"<<std::flush;
1495      //     ffout(3)<<V0<<"\n";      //     ffout(4)<<V0<<"\n";
1496      //   ffout(3)<<V1<<"\n";      //   ffout(4)<<V1<<"\n";
1497      // ffout(3)<<V2<<"\n";      // ffout(4)<<V2<<"\n";
1498      TinyVector<10,const Vertex*> P,Ptemp;      TinyVector<10,const Vertex*> P,Ptemp;
1499      size_t i=0;      size_t i=0;
1500      for(std::map<const Vertex*,const Vertex*>::const_iterator it=pointsInterior.begin();      for(std::map<const Vertex*,const Vertex*>::const_iterator it=pointsInterior.begin();
# Line 1517  __createCase2(int ncase, Line 1532  __createCase2(int ncase,
1532            Ptemp[0]=P[num];            Ptemp[0]=P[num];
1533            P=Ptemp;            P=Ptemp;
1534            --size;            --size;
1535            // ffout(3)<<"size = "<<size<<"\n";            // ffout(4)<<"size = "<<size<<"\n";
1536          }          }
1537  //#warning Reference not set.  //#warning Reference not set.
1538          __addTriangle(Triangle(B,*P[0],*P[1],K.reference()),cell,triangleListIntersectionNew);          __addTriangle(Triangle(B,*P[0],*P[1],K.reference()),cell,triangleListIntersectionNew);
1539          __addTriangle(Triangle(B,*P[1],D,K.reference()),cell,triangleListIntersectionNew);          __addTriangle(Triangle(B,*P[1],D,K.reference()),cell,triangleListIntersectionNew);
1540          //__addTriangle(A,B,D,cell);          //__addTriangle(A,B,D,cell);
1541        } else {        } else {
1542          ffout(3)<<"une seule arete cut pbs\n";          ffout(4)<<"une seule arete cut pbs\n";
1543        }        }
1544      } else {      } else {
1545        ffout(3)<<"une seule arete cut pbs2\n";        ffout(4)<<"une seule arete cut pbs2\n";
1546      }      }
1547    }    }
1548    }    }
# Line 1577  __createLocalListIntersection(const size Line 1592  __createLocalListIntersection(const size
1592          //detection tr plat          //detection tr plat
1593          size_t isDegenerate=0;          size_t isDegenerate=0;
1594          if(__isDegenerate(*(*jt0))) {          if(__isDegenerate(*(*jt0))) {
1595            // ffout(3)<<"degenerate triangle\n";            // ffout(4)<<"degenerate triangle\n";
1596            isDegenerate=1;            isDegenerate=1;
1597          }          }
1598          if(pairTriangleToIntersectionPoints[pairTriangle].size()==2 and isDegenerate==0) {          if(pairTriangleToIntersectionPoints[pairTriangle].size()==2 and isDegenerate==0) {
# Line 1585  __createLocalListIntersection(const size Line 1600  __createLocalListIntersection(const size
1600            const Vertex*& V1=pairTriangleToIntersectionPoints[pairTriangle][1];            const Vertex*& V1=pairTriangleToIntersectionPoints[pairTriangle][1];
1601            if((V0==&(*(*jt0))(0) or V0==&(*(*jt0))(1) or V0==&(*(*jt0))(2))            if((V0==&(*(*jt0))(0) or V0==&(*(*jt0))(1) or V0==&(*(*jt0))(2))
1602               and (V1==&(*(*jt0))(0) or V1==&(*(*jt0))(1) or V1==&(*(*jt0))(2))) {               and (V1==&(*(*jt0))(0) or V1==&(*(*jt0))(1) or V1==&(*(*jt0))(2))) {
1603              //ffout(3)<<"inter confondu avec arete\n";              //ffout(4)<<"inter confondu avec arete\n";
1604              isDegenerate=1;              isDegenerate=1;
1605            }            }
1606          }          }
# Line 1633  __createLocalListIntersection(const size Line 1648  __createLocalListIntersection(const size
1648            size_t r=0;            size_t r=0;
1649            size_t sum=cutTriangle[0]+cutTriangle[1]+cutTriangle[2];            size_t sum=cutTriangle[0]+cutTriangle[1]+cutTriangle[2];
1650            if(sum>3) {            if(sum>3) {
1651              ffout(3)<<"sum "<<sum<<"\n"<<std::flush;              ffout(4)<<"sum "<<sum<<"\n"<<std::flush;
1652            }            }
1653    
1654            switch (sum) {            switch (sum) {
# Line 1658  __createLocalListIntersection(const size Line 1673  __createLocalListIntersection(const size
1673              break;              break;
1674            }            }
1675            default: {            default: {
1676              ffout(3) << "pbs sum = "<<sum<<" size "              ffout(4) << "pbs sum = "<<sum<<" size "
1677                       << pairTriangleToIntersectionPoints[pairTriangle].size()<<" \n";                       << pairTriangleToIntersectionPoints[pairTriangle].size()<<" \n";
1678              ffout(3) << K(0) << "\n";              ffout(4) << K(0) << "\n";
1679              ffout(3) << K(1) << "\n";              ffout(4) << K(1) << "\n";
1680              ffout(3) << K(2) << "\n";              ffout(4) << K(2) << "\n";
1681              ffout(3) << cutTriangle[0] << " " << cutTriangle[1] << " " << cutTriangle[2] << "\n";              ffout(4) << cutTriangle[0] << " " << cutTriangle[1] << " " << cutTriangle[2] << "\n";
1682            }            }
1683            }            }
1684            if(pointsInterior.find(pairTriangleToIntersectionPoints[pairTriangle][r])            if(pointsInterior.find(pairTriangleToIntersectionPoints[pairTriangle][r])
# Line 1673  __createLocalListIntersection(const size Line 1688  __createLocalListIntersection(const size
1688            }            }
1689          }          }
1690        } else {        } else {
1691          // ffout(3) <<"pasintersecte\n";          // ffout(4) <<"pasintersecte\n";
1692        }        }
1693      }      }
1694    }    }
# Line 1693  __determinateEdgeCut(const size_t& numob Line 1708  __determinateEdgeCut(const size_t& numob
1708    if(numobject==0)    if(numobject==0)
1709        objectNumber=1;        objectNumber=1;
1710    MapCellTriangle hexaToTriangle1=*(O2.hexalist);    MapCellTriangle hexaToTriangle1=*(O2.hexalist);
     
1711    
1712    MapCellTriangle::iterator it1=hexaToTriangle1.find(cell);    MapCellTriangle::iterator it1=hexaToTriangle1.find(cell);
1713            
# Line 1710  __determinateEdgeCut(const size_t& numob Line 1724  __determinateEdgeCut(const size_t& numob
1724          pairTriangle.second=(currentTriangle);          pairTriangle.second=(currentTriangle);
1725          pairTriangle.first=(*jt0);          pairTriangle.first=(*jt0);
1726        }        }
   
1727        if(pairTriangleToIntersectionPoints.find(pairTriangle)!=        if(pairTriangleToIntersectionPoints.find(pairTriangle)!=
1728           pairTriangleToIntersectionPoints.end()) {           pairTriangleToIntersectionPoints.end()) {
   
1729          TinyVector<3,size_t> cutTriangle;          TinyVector<3,size_t> cutTriangle;
1730          if(numobject<objectNumber) {          if(numobject<objectNumber) {
1731            cutTriangle=(pairTriangleToIntersectionPoints[pairTriangle]).cutTriangle1();            cutTriangle=(pairTriangleToIntersectionPoints[pairTriangle]).cutTriangle1();
# Line 1728  __determinateEdgeCut(const size_t& numob Line 1740  __determinateEdgeCut(const size_t& numob
1740          }          }
1741        }        }
1742        else {        else {
1743          // ffout(3)<<"la paire de triangle n'existe pas!\n";          // ffout(4)<<"la paire de triangle n'existe pas!\n";
1744        }        }
1745      }      }
1746    }    }
1747    return edgesCut;    return edgesCut;
1748  }  }
1749    
1750  TinyVector<3,size_t>& SurfaceMeshGenerator::Internals::  void SurfaceMeshGenerator::Internals::
1751  __putEdgeRef(const size_t& ncase,  __putRefByFront(const size_t numobject,
1752               const Triangle& currentTriangle,                  const ObjectToTreat& O1,
1753               TriangleCut& K)                  const ObjectToTreat& O2,
1754  {                  const SurfaceMeshOfTriangles& surfmesh,
1755      //put edgesRefVertex=2 if the vertex is in the domain                  const Connectivity<Triangle>& connect,
1756    const TinyVector<3,TinyVector<2,int> >&  cutTriangle=K.edgecut;                  const std::set<const Cell*>& toTreatHexahedra) {
1757    TinyVector<3,size_t>& isIn=K.isInTriangle;    //to put the reference by front
1758    size_t numobject=K.numobject;    std::list<const Triangle*> front;
   const Vertex* V0=&currentTriangle(0);  
   const Vertex* V1=&currentTriangle(1);  
   const Vertex* V2=&currentTriangle(2);  
1759    
1760          size_t objectNumber=0;
1761    if(ncase==1 and    if(numobject==0)
1762       cutTriangle[0][0]+cutTriangle[1][0]+cutTriangle[2][0]!=0 and ((*edgesRefVertex[numobject])[V0]+      objectNumber=1;
1763                                          (*edgesRefVertex[numobject])[V1]+(*edgesRefVertex[numobject])[V2])==6) {    size_t nbcell=surfmesh.numberOfCells();
1764      ffout(3)<<"************************ ---------tr a pbs\n"<<std::flush;    //initialize the front
1765      ffout(3)<<cutTriangle[0]<<" "<<cutTriangle[1]<<" "<<cutTriangle[2]<<"\n";    size_t i=0;
1766      ffout(3)<<*V0<<"\n";    while(i<nbcell) {
1767      ffout(3)<<*V1<<"\n";      const Triangle* T=&(surfmesh.cell(i));
1768      ffout(3)<<*V2<<"\n";      const Cell* cell=&((*T).mother());
1769    } else {      if(toTreatHexahedra.find(cell)!=toTreatHexahedra.end()
1770    __inout(numobject,cutTriangle[0][0],V0,V1);         and (*edgesRefVertex[numobject])[&(*T)(0)]+
1771    __inout(numobject,cutTriangle[1][0],V0,V2);         (*edgesRefVertex[numobject])[&(*T)(1)]+
1772    __inout(numobject,cutTriangle[2][0],V1,V2);         (*edgesRefVertex[numobject])[&(*T)(2)]!=0) {
1773          front.push_front(T);
1774          const Triangle*& TT=(*listOfTriangleMeshFront.find(T)).second;
1775          // on traite le triangle du front
1776          __putEdgeRef(TT,numobject,O1,O2);
1777        }
1778        ++i;
1779    }    }
1780      
1781    if(ncase==0) {    size_t iter=0;
1782      if(cutTriangle[0][0]+cutTriangle[1][0]+cutTriangle[2][0]==0 and ((*edgesRefVertex[numobject])[V0]+    ffout(0)<<"taille initial du front ="<<front.size()<<"\n";
1783                                            (*edgesRefVertex[numobject])[V1]+(*edgesRefVertex[numobject])[V2])>=4) {    //put reference by front
1784        (*edgesRefVertex[numobject])[V0]=2;    while(front.size()!=0 and iter<nbcell) {
1785        (*edgesRefVertex[numobject])[V1]=2;      std::list<const Triangle*>::iterator er=front.begin() ;
1786        (*edgesRefVertex[numobject])[V2]=2;      for(std::list<const Triangle*>::iterator jt0=front.begin() ;
1787      }            jt0!=front.end() ; ++jt0) {
1788    } else {        if(jt0!=front.begin())
1789      if(ncase==1) {          er=front.erase(er);
1790        for (size_t n=0; n<3; ++n) {        er=jt0;
1791          if((*edgesRefVertex[numobject])[&K(n)]==2 ) {        const Triangle* T=*jt0;
1792            isIn[n]=1;        TinyVector<3,const Triangle*> V=connect(surfmesh.cellNumber(*T));
1793          } else {        
1794            isIn[n]=0;        for(size_t j=0 ; j<3 ; ++j) {
1795            //check the neighbours exist
1796            if(V[j]!=0){
1797              const Triangle* triangle=V[j];
1798              const Triangle*& TT=(*listOfTriangleMeshFront.find(triangle)).second;
1799              const Vertex& V0 = (*T)(0);
1800              const Vertex& V1 = (*T)(1);
1801              const Vertex& V2 = (*T)(2);
1802              TriangleCut Kneigh(V0,V1,V2,numobject,objectNumber);
1803              const Cell* cell=&((*TT).mother());
1804              Kneigh.edgecut =__determinateEdgeCut(numobject,O1,O2,TT,cell);
1805              size_t& ref0=(*edgesRefVertex[numobject])[&(*triangle)(0)];
1806              size_t& ref1=(*edgesRefVertex[numobject])[&(*triangle)(1)];
1807              size_t& ref2=(*edgesRefVertex[numobject])[&(*triangle)(2)];
1808              
1809              if(!(ref0==2 and ref1==2 and ref2==2)) {
1810                //ffout(0)<<"le voisin n'est pas de ref 2\n";
1811                //ffout(0)<<"avt "<<ref0<<" "<<ref1<<" "<<ref2<<"\n";
1812                TinyVector<2,int> edge0=Kneigh.edgecut[0];
1813                TinyVector<2,int> edge1=Kneigh.edgecut[1];
1814                TinyVector<2,int> edge2=Kneigh.edgecut[2];
1815                if(ref0+ref1==2 and edge0[0]==0) {
1816                  ref0=2;
1817                  ref1=2;
1818                }
1819                if(ref0+ref2==2 and edge1[0]==0) {
1820                  ref0=2;
1821                  ref2=2;
1822                }
1823                if(ref2+ref1==2 and edge2[0]==0) {
1824                  ref2=2;
1825                  ref1=2;
1826                }
1827                if(ref0+ref1+ref2==6 or edge0[0]+edge1[0]+edge2[0]==1) {
1828                  //ffout(0)<<"on rajoute le triangle au front\n";
1829                  front.push_front(triangle);
1830                }
1831                //ffout(0)<<ref0<<" "<<ref1<<" "<<ref2<<"\n";
1832              }
1833          }          }
1834        }        }
1835      }      }
1836        er=front.erase(er);
1837        ++iter;
1838        ffout(0)<<"taille du front = "<<front.size()<<" "<<iter<<" "<<nbcell<<"\n";
1839    }    }
1840      
   return isIn;  
1841  }  }
1842    
1843  void SurfaceMeshGenerator::Internals::  void SurfaceMeshGenerator::Internals::
1844    __putEdgeRef(const Triangle*& T,
1845                 const size_t numobject,
1846                 const ObjectToTreat& O1,
1847                 const ObjectToTreat& O2 )
1848    {
1849        //put edgesRefVertex=2 if the vertex is in the domain
1850        //ffout(0)<<"j'initialise le front\n";
1851    
1852        TinyVector<3,TinyVector<2,int> > edgecut;
1853        const Cell* cell=&((*T).mother());
1854        edgecut =__determinateEdgeCut(numobject,O1,O2,T,cell);
1855        size_t& ref0=(*edgesRefVertex[numobject])[&(*T)(0)];
1856        size_t& ref1=(*edgesRefVertex[numobject])[&(*T)(1)];
1857        size_t& ref2=(*edgesRefVertex[numobject])[&(*T)(2)];
1858        if(!(ref0==2 and ref1==2 and ref2==2)) {
1859            TinyVector<2,int> edge0=edgecut[0];
1860            TinyVector<2,int> edge1=edgecut[1];
1861            TinyVector<2,int> edge2=edgecut[2];
1862            if(ref0+ref1==2 and edge0[0]==0) {
1863                ref0=2;
1864                ref1=2;
1865            }
1866            if(ref0+ref2==2 and edge1[0]==0) {
1867                ref0=2;
1868                ref2=2;
1869            }
1870            if(ref2+ref1==2 and edge2[0]==0) {
1871                ref2=2;
1872                ref1=2;
1873            }
1874        }
1875     }
1876    
1877    void SurfaceMeshGenerator::Internals::
1878  __createListTriangle(const TriangleCut& K,  __createListTriangle(const TriangleCut& K,
1879                       const Cell* cell,                       const Cell* cell,
1880                       std::vector<Triangle>& triangleListIntersectionNew)                       std::vector<Triangle>& triangleListIntersectionNew)
# Line 1842  __createNotIn(const TriangleCut& K,const Line 1931  __createNotIn(const TriangleCut& K,const
1931    
1932    const Vertex* Pend=K.pointsIntersection[place0][1];    const Vertex* Pend=K.pointsIntersection[place0][1];
1933    #warning size TinyVector    #warning size TinyVector
1934    TinyVector<10,const Vertex*> P;    TinyVector<30,const Vertex*> P;
1935    TinyVector<10,const Triangle*> T;    TinyVector<30,const Triangle*> T;
1936    P[0]=K.pointsIntersection[place0][0];    P[0]=K.pointsIntersection[place0][0];
1937    
1938    if(vertexInTriangles.find(P[0])!=vertexInTriangles.end()) {    if(vertexInTriangles.find(P[0])!=vertexInTriangles.end()) {
1939      T[0]=(*vertexInTriangles.find(P[0])).second[0];      T[0]=(*vertexInTriangles.find(P[0])).second[0];
1940    } else {    } else {
1941      ffout(3)<<"pbs 0 existe pas\n";      ffout(4)<<"pbs 0 existe pas\n";
1942    }    }
1943    
1944    size_t b=0;    size_t b=0;
1945    
1946    while(P[b]!=Pend and b<9) {    while(P[b]!=Pend and b<29) {
1947      if(triangleWithVertex.find(T[b])!=triangleWithVertex.end()) {      if(triangleWithVertex.find(T[b])!=triangleWithVertex.end()) {
1948        TinyVector<2,const Vertex*> VV=(*triangleWithVertex.find(T[b])).second;        TinyVector<2,const Vertex*> VV=(*triangleWithVertex.find(T[b])).second;
1949        if(VV[0]==P[b]) {        if(VV[0]==P[b]) {
# Line 1871  __createNotIn(const TriangleCut& K,const Line 1960  __createNotIn(const TriangleCut& K,const
1960          P[b+1]=VV[0];          P[b+1]=VV[0];
1961        }        }
1962      } else {      } else {
1963        ffout(3)<<"pbs 1 existe pas\n";        ffout(4)<<"pbs 1 existe pas\n";
1964          b=30;
1965      }      }
1966      TinyVector<2,const Triangle*> T2;      TinyVector<2,const Triangle*> T2;
1967      if(vertexInTriangles.find(P[b+1])!=vertexInTriangles.end()) {      if(vertexInTriangles.find(P[b+1])!=vertexInTriangles.end()) {
# Line 1904  __createNotIn2(const TriangleCut& K,cons Line 1994  __createNotIn2(const TriangleCut& K,cons
1994        place0=2;        place0=2;
1995      }      }
1996    
1997    //ffout(3)<<"place = "<<place0<<"\n";    //ffout(4)<<"place = "<<place0<<"\n";
1998    const Vertex* Pend=K.pointsIntersection[place0][1];    const Vertex* Pend=K.pointsIntersection[place0][1];
1999    TinyVector<10,const Vertex*> P;    TinyVector<30,const Vertex*> P;
2000    TinyVector<10,const Triangle*> T;    TinyVector<30,const Triangle*> T;
2001    P[0]=K.pointsIntersection[place0][0];    P[0]=K.pointsIntersection[place0][0];
2002    if(vertexInTriangles.find(P[0])!=vertexInTriangles.end()) {    if(vertexInTriangles.find(P[0])!=vertexInTriangles.end()) {
2003      T[0]=(*vertexInTriangles.find(P[0])).second[0];      T[0]=(*vertexInTriangles.find(P[0])).second[0];
2004    } else {    } else {
2005      ffout(3)<<"pbs 0 existe pas\n";      ffout(4)<<"pbs 0 existe pas\n";
2006    }    }
2007    
2008    size_t b=0;    size_t b=0;
2009    while(P[b]!=Pend and b<9) {    while(P[b]!=Pend and b<29) {
2010      //ffout(3)<<"------------------- b "<<b<<"\n";      //ffout(4)<<"------------------- b "<<b<<"\n";
2011      if(triangleWithVertex.find(T[b])!=triangleWithVertex.end()) {      if(triangleWithVertex.find(T[b])!=triangleWithVertex.end()) {
2012        TinyVector<2,const Vertex*> VV=(*triangleWithVertex.find(T[b])).second;        TinyVector<2,const Vertex*> VV=(*triangleWithVertex.find(T[b])).second;
2013        if(VV[0]==P[b]) {        if(VV[0]==P[b]) {
2014          if(Pend!=VV[1]) {          if(Pend!=VV[1]) {
2015  //#warning Reference not set.  //#warning Reference not set.
2016            __addTriangle(Triangle(*Pend,*P[b],*VV[1],K.reference()),cell,triangleListIntersectionNew);            __addTriangle(Triangle(*Pend,*P[b],*VV[1],K.reference()),cell,triangleListIntersectionNew);
2017            //  ffout(3)<<"1 "<<*Pend<<"\n";            //  ffout(4)<<"1 "<<*Pend<<"\n";
2018            //  ffout(3)<<*P[b]<<"\n";            //  ffout(4)<<*P[b]<<"\n";
2019            //  ffout(3)<<*VV[1]<<"\n";            //  ffout(4)<<*VV[1]<<"\n";
2020          }          }
2021          P[b+1]=VV[1];          P[b+1]=VV[1];
2022        } else {        } else {
2023          if(Pend!=VV[0]) {          if(Pend!=VV[0]) {
2024  //#warning Reference not set.  //#warning Reference not set.
2025            __addTriangle(Triangle(*Pend,*P[b],*VV[0],K.reference()),cell,triangleListIntersectionNew);            __addTriangle(Triangle(*Pend,*P[b],*VV[0],K.reference()),cell,triangleListIntersectionNew);
2026            //ffout(3)<<"2 "<<*Pend<<"\n";            //ffout(4)<<"2 "<<*Pend<<"\n";
2027            //ffout(3)<<*P[b]<<"\n";            //ffout(4)<<*P[b]<<"\n";
2028            //ffout(3)<<*VV[0]<<"\n";            //ffout(4)<<*VV[0]<<"\n";
2029          }          }
2030          P[b+1]=VV[0];          P[b+1]=VV[0];
2031        }        }
2032      } else {      } else {
2033        ffout(3)<<"pbs 1 existe pas\n";        ffout(4)<<"pbs 1 existe pas\n";
2034          b=30;
2035      }      }
2036    
2037      TinyVector<2,const Triangle*> T2;      TinyVector<2,const Triangle*> T2;
# Line 1948  __createNotIn2(const TriangleCut& K,cons Line 2039  __createNotIn2(const TriangleCut& K,cons
2039        T2[0]=(*vertexInTriangles.find(P[b+1])).second[0];        T2[0]=(*vertexInTriangles.find(P[b+1])).second[0];
2040        T2[1]=(*vertexInTriangles.find(P[b+1])).second[1];        T2[1]=(*vertexInTriangles.find(P[b+1])).second[1];
2041      } else {      } else {
2042        ffout(3)<<"points exisste pas \n";        ffout(4)<<"points exisste pas \n";
2043          b=30;
2044      }      }
2045      if(K.edgecut[0][0]==1 and K.edgecut[0][1]==1) {      if(K.edgecut[0][0]==1 and K.edgecut[0][1]==1) {
2046        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]) {
# Line 1965  __createNotIn2(const TriangleCut& K,cons Line 2057  __createNotIn2(const TriangleCut& K,cons
2057      if(T2[0]==T[b]) {      if(T2[0]==T[b]) {
2058        if(T2[1]==T[b]) {        if(T2[1]==T[b]) {
2059          //point edge          //point edge
2060          //ffout(3)<<"here\n";          //ffout(4)<<"here\n";
2061          if(K.edgecut[0][0]==1 and K.edgecut[0][1]==1) {          if(K.edgecut[0][0]==1 and K.edgecut[0][1]==1) {
2062            //ffout(3)<<"here2\n";            //ffout(4)<<"here2\n";
2063            if(P[b+1]==K.pointsIntersection[0][1]) {            if(P[b+1]==K.pointsIntersection[0][1]) {
2064  //#warning Reference not set.  //#warning Reference not set.
2065              __addTriangle(Triangle(*Pend,*P[b+1],*K.pointsIntersection[0][0],              __addTriangle(Triangle(*Pend,*P[b+1],*K.pointsIntersection[0][0],
# Line 1988  __createNotIn2(const TriangleCut& K,cons Line 2080  __createNotIn2(const TriangleCut& K,cons
2080                  T2[0]=(*vertexInTriangles.find(P[b+1])).second[0];                  T2[0]=(*vertexInTriangles.find(P[b+1])).second[0];
2081                  T2[1]=(*vertexInTriangles.find(P[b+1])).second[1];                  T2[1]=(*vertexInTriangles.find(P[b+1])).second[1];
2082                } else {                } else {
2083                  ffout(3)<<"le tr e pas\n";                  ffout(4)<<"le tr e pas\n";
2084                }                }
2085                T[b+1]=T2[0];                T[b+1]=T2[0];
2086              } else              } else
2087                if(P[b+1]!=Pend) {                if(P[b+1]!=Pend) {
2088                  ffout(3)<<"point pas sur edge trou???? \n";                  ffout(4)<<"point pas sur edge trou???? \n";
2089                  ffout(3)<<*P[b+1]<<"\n";                  ffout(4)<<*P[b+1]<<"\n";
2090                  ffout(3)<<*Pend<<"\n";                  ffout(4)<<*Pend<<"\n";
2091                  P[b+1]=Pend;                  P[b+1]=Pend;
2092                }                }
2093          } else {          } else {
2094            if(K.edgecut[2][0]==1 and K.edgecut[2][1]==1) {            if(K.edgecut[2][0]==1 and K.edgecut[2][1]==1) {
2095              //ffout(3)<<"here3\n";              //ffout(4)<<"here3\n";
2096              if(P[b+1]==K.pointsIntersection[2][1]) {              if(P[b+1]==K.pointsIntersection[2][1]) {
2097  //#warning Reference not set.  //#warning Reference not set.
2098                __addTriangle(Triangle(*Pend,*P[b+1],*K.pointsIntersection[2][0],                __addTriangle(Triangle(*Pend,*P[b+1],*K.pointsIntersection[2][0],
# Line 2025  __createNotIn2(const TriangleCut& K,cons Line 2117  __createNotIn2(const TriangleCut& K,cons
2117                }                }
2118              }              }
2119            } else {            } else {
2120              ffout(3)<<"pas trouve l'egde et le point\n";              ffout(4)<<"pas trouve l'egde et le point\n";
2121            }            }
2122          }          }
2123        } else {        } else {
# Line 2043  __createByEdges(const TriangleCut& K,con Line 2135  __createByEdges(const TriangleCut& K,con
2135                  std::vector<Triangle>& triangleListIntersectionNew)                  std::vector<Triangle>& triangleListIntersectionNew)
2136  {  {
2137      //createtriangles if one point is in Triangle      //createtriangles if one point is in Triangle
2138      // and two edges are cuts      // and two or 3? edges are cuts
2139    size_t in0=0,place0=0,place1=1,place2=2;    size_t in0=0,place0=0,place1=1,place2=2;
2140    
2141    if(K.isInTriangle[1]==1) {    if(K.isInTriangle[1]==1) {
# Line 2061  __createByEdges(const TriangleCut& K,con Line 2153  __createByEdges(const TriangleCut& K,con
2153    
2154    const Vertex* Pend=K.pointsIntersection[place1][0];    const Vertex* Pend=K.pointsIntersection[place1][0];
2155    #warning size of Tiny    #warning size of Tiny
2156    TinyVector<10,const Vertex*> P;    TinyVector<30,const Vertex*> P;
2157    TinyVector<10,const Triangle*> T;    TinyVector<30,const Triangle*> T;
2158    P[0]=K.pointsIntersection[place0][0];    P[0]=K.pointsIntersection[place0][0];
2159    if(vertexInTriangles.find(P[0])!=vertexInTriangles.end()) {    if(vertexInTriangles.find(P[0])!=vertexInTriangles.end()) {
2160      T[0]=(*vertexInTriangles.find(P[0])).second[0];      T[0]=(*vertexInTriangles.find(P[0])).second[0];
2161    } else {    } else {
2162      ffout(3)<<"pbs 0 existe pas\n";      ffout(4)<<"pbs 0 existe pas\n";
2163    }    }
2164    
2165    size_t b=0;    size_t b=0;
2166    while(P[b]!=Pend and b<9) {    while(P[b]!=Pend and b<29) {
2167      if(triangleWithVertex.find(T[b])!=triangleWithVertex.end()) {      if(triangleWithVertex.find(T[b])!=triangleWithVertex.end()) {
2168        TinyVector<2,const Vertex*> VV=(*triangleWithVertex.find(T[b])).second;        TinyVector<2,const Vertex*> VV=(*triangleWithVertex.find(T[b])).second;
2169        if(VV[0]==P[b]) {        if(VV[0]==P[b]) {
2170          if(VV[1]==P[b]) {          if(VV[1]==P[b]) {
2171            ffout(3)<<"egal\n";            ffout(4)<<"b ="<<b<<" egal\n";
2172            if(K.pointsIntersection[place2][0]==P[b]) {            if(K.pointsIntersection[place2][0]==P[b]) {
2173              P[b+1]=K.pointsIntersection[place2][1];              P[b+1]=K.pointsIntersection[place2][1];
2174  //#warning Reference not set.  //#warning Reference not set.
# Line 2087  __createByEdges(const TriangleCut& K,con Line 2179  __createByEdges(const TriangleCut& K,con
2179  //#warning Reference not set.  //#warning Reference not set.
2180                __addTriangle(Triangle(K(in0),*P[b],*P[b+1],K.reference()),cell,triangleListIntersectionNew);                __addTriangle(Triangle(K(in0),*P[b],*P[b+1],K.reference()),cell,triangleListIntersectionNew);
2181              } else {              } else {
2182                ffout(3)<<"pbs pbs\n";                ffout(4)<<"pbs pbs\n";
2183                ffout(3)<<*P[b]<<"\n";                ffout(4)<<*P[b]<<"\n";
2184                std::exit(0);                P[b+1]=K.pointsIntersection[place2][1];
2185                  //std::exit(0);
2186              }              }
2187            }            }
2188          } else {          } else {
# Line 2103  __createByEdges(const TriangleCut& K,con Line 2196  __createByEdges(const TriangleCut& K,con
2196          P[b+1]=VV[0];          P[b+1]=VV[0];
2197        }        }
2198      } else {      } else {
2199        ffout(3)<<"pbs 1 existe pas\n";        ffout(4)<<"pbs 1 existe pas\n";
2200          b=30;
2201      }      }
2202      TinyVector<2,const Triangle*> T2;      TinyVector<2,const Triangle*> T2;
2203    
# Line 2111  __createByEdges(const TriangleCut& K,con Line 2205  __createByEdges(const TriangleCut& K,con
2205        T2[0]=(*vertexInTriangles.find(P[b+1])).second[0];        T2[0]=(*vertexInTriangles.find(P[b+1])).second[0];
2206        T2[1]=(*vertexInTriangles.find(P[b+1])).second[1];        T2[1]=(*vertexInTriangles.find(P[b+1])).second[1];
2207      } else {      } else {
2208        ffout(3)<<"pbs tr existe pas\n";        ffout(4)<<"pbs tr existe pas\n";
2209          b=30;
2210      }      }
2211    
2212      if(T2[0]==T[b] and T2[1]==T[b]) {      if(T2[0]==T[b] and T2[1]==T[b]) {
2213        // ffout(3)<<"here0\n";        // ffout(4)<<"here0\n";
2214        //point edge        //point edge
2215        if(P[b+1]!=Pend) {        if(P[b+1]!=Pend) {
2216          if(K.pointsIntersection[place2][0]==P[b+1]) {          if(K.pointsIntersection[place2][0]==P[b+1]) {
# Line 2158  void SurfaceMeshGenerator::Internals::__ Line 2253  void SurfaceMeshGenerator::Internals::__
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(Triangle(*V[0],*V[1],*V[2],K.reference()),cell,triangleListIntersectionNew);          __addTriangle(Triangle(*V[0],*V[1],*V[2],K.reference()),cell,triangleListIntersectionNew);
2256          ffout(3)<<"on comble le trou\n"<<std::flush;          ffout(4)<<"on comble le trou\n"<<std::flush;
2257      } else {      } else {
2258          ffout(3)<<"----- deux inter =\n";          ffout(4)<<"----- deux inter =\n";
2259          ffout(3)<<V[0]<<"\n";          ffout(4)<<V[0]<<"\n";
2260          ffout(3)<<V[1]<<"\n";          ffout(4)<<V[1]<<"\n";
2261          ffout(3)<<V[2]<<"\n";          ffout(4)<<V[2]<<"\n";
2262      }      }
2263  }  }
2264  template <typename booleanTest>  template <typename booleanTest>
# Line 2176  __createTrianglesIntersection(const size Line 2271  __createTrianglesIntersection(const size
2271                                PIntersection& listVertexIntersectionNew)                                PIntersection& listVertexIntersectionNew)
2272  {  {
2273      //build mesh of object O1 (which is intersected with O2)      //build mesh of object O1 (which is intersected with O2)
2274        
2275    //ffout(3)<<"numero "<<numobject<<" "<<objectNumber<<"\n"<<std::flush;      size_t nbcell=(*O1.trianglelist).size();
2276        SurfaceMeshOfTriangles surfmesh(nbcell);
2277        __constructionFinalMesh(O1,surfmesh);
2278        Connectivity<Triangle> connect(nbcell);
2279        ConnectivityBuilder<SurfaceMeshOfTriangles> C(surfmesh,connect);
2280      //ffout(4)<<"numero "<<numobject<<" "<<objectNumber<<"\n"<<std::flush;
2281    size_t objectNumber=0;    size_t objectNumber=0;
2282    if(numobject==0)    if(numobject==0)
2283      objectNumber=1;      objectNumber=1;
# Line 2193  __createTrianglesIntersection(const size Line 2293  __createTrianglesIntersection(const size
2293    std::set_difference (hexaList1.begin(), hexaList1.end(),    std::set_difference (hexaList1.begin(), hexaList1.end(),
2294                         toTreatHexahedra.begin(), toTreatHexahedra.end(),                         toTreatHexahedra.begin(), toTreatHexahedra.end(),
2295                         inserter(hexaListIn, hexaListIn.begin()));                         inserter(hexaListIn, hexaListIn.begin()));
2296      
2297      
2298    for (std::set<const Cell*>::iterator icell = hexaListIn.begin(); icell != hexaListIn.end(); ++icell) {    for (std::set<const Cell*>::iterator icell = hexaListIn.begin(); icell != hexaListIn.end(); ++icell) {
2299      Cell& C = const_cast<Cell&>(*(*icell));      Cell& C = const_cast<Cell&>(*(*icell));
2300      for (size_t i=0; i<C.numberOfVertices(); ++i) {      for (size_t i=0; i<C.numberOfVertices(); ++i) {
# Line 2209  __createTrianglesIntersection(const size Line 2310  __createTrianglesIntersection(const size
2310      }      }
2311    
2312      MapCellTriangle::iterator it0=hexaToTriangle0.find(*icell);      MapCellTriangle::iterator it0=hexaToTriangle0.find(*icell);
2313        
2314      if(it0!=hexaToTriangle0.end()) {      if(it0!=hexaToTriangle0.end()) {
2315        std::list<Triangle*> listTriangle0=(*it0).second;        std::list<Triangle*> listTriangle0=(*it0).second;
2316    
# Line 2225  __createTrianglesIntersection(const size Line 2326  __createTrianglesIntersection(const size
2326             and (*edgesRefVertex[numobject])[&T(1)]==2             and (*edgesRefVertex[numobject])[&T(1)]==2
2327             and (*edgesRefVertex[numobject])[&T(2)]==2) {             and (*edgesRefVertex[numobject])[&T(2)]==2) {
2328            __addTriangle(T, &T.mother(),triangleListIntersectionNew);            __addTriangle(T, &T.mother(),triangleListIntersectionNew);
2329                //put ref 2 for points of surfmesh
2330                const Vertex* P0=(*listOfVertexMesh.find(&T(0))).second;
2331                const Vertex* P1=(*listOfVertexMesh.find(&T(1))).second;
2332                const Vertex* P2=(*listOfVertexMesh.find(&T(2))).second;
2333                (*edgesRefVertex[numobject])[P0]=2;
2334                (*edgesRefVertex[numobject])[P1]=2;
2335                (*edgesRefVertex[numobject])[P2]=2;
2336          }          }
2337        }        }
2338      }      }
2339    }    }
2340    
2341      __putRefByFront(numobject,O1,O2,surfmesh,connect,toTreatHexahedra);
2342        
2343    size_t nbinters=listVertexIntersectionNew.size();    size_t nbinters=listVertexIntersectionNew.size();
2344    ffout(3)<<"size listVertexIntersectionNew "<<nbinters<<"\n"<<std::flush;    ffout(4)<<"size listVertexIntersectionNew "<<nbinters<<"\n"<<std::flush;
2345        
   size_t dd_max=4;//4  
   //ffout(3)<<"size liste intersection "<<taille<<"\n"<<std::flush;  
   for(size_t dd=0 ; dd<dd_max ; ++dd) {  
     ffout(3)<<"num passage "<<dd<<"\n"<<std::flush;  
     for(std::set<const Cell*>::iterator i=toTreatHexahedra.begin() ; i!=toTreatHexahedra.end() ; ++i)  
       {  
         MapCellTriangle::iterator it0=hexaToTriangle0.find(*i);  
         if(it0!=hexaToTriangle0.end()) {  
           std::list<Triangle*> listTriangle0=(*it0).second;  
           for(std::list<Triangle*>::iterator jt0=listTriangle0.begin();  
               jt0!=listTriangle0.end() ; ++jt0) {  
             const Triangle* T=(*jt0);  
             const Vertex& V0 = (*T)(0);  
             const Vertex& V1 = (*T)(1);  
             const Vertex& V2 = (*T)(2);  
             TriangleCut K(V0,V1,V2,numobject,objectNumber);  
   
             K.edgecut =__determinateEdgeCut(numobject,O1,O2,T,*i);  
   
             __putEdgeRef(0,(*T),K);  
           }  
         }  
       }  
   }  
   
2346    for(std::set<const Cell*>::iterator i=toTreatHexahedra.begin();    for(std::set<const Cell*>::iterator i=toTreatHexahedra.begin();
2347        i!=toTreatHexahedra.end() ; ++i) {        i!=toTreatHexahedra.end() ; ++i) {
2348      MapCellTriangle::iterator it0=hexaToTriangle0.find(*i);      MapCellTriangle::iterator it0=hexaToTriangle0.find(*i);
# Line 2277  __createTrianglesIntersection(const size Line 2362  __createTrianglesIntersection(const size
2362                    
2363          __createLocalListIntersection(objectNumber,O2,T,K,*i);          __createLocalListIntersection(objectNumber,O2,T,K,*i);
2364                    
2365          __putEdgeRef(1,*T,K);          const Vertex* P0=(*listOfVertexMesh.find(&K(0))).second;
2366            const Vertex* P1=(*listOfVertexMesh.find(&K(1))).second;
2367            const Vertex* P2=(*listOfVertexMesh.find(&K(2))).second;
2368            (*edgesRefVertex[numobject])[&K(0)]=(*edgesRefVertex[numobject])[P0];
2369            (*edgesRefVertex[numobject])[&K(1)]=(*edgesRefVertex[numobject])[P1];
2370            (*edgesRefVertex[numobject])[&K(2)]=(*edgesRefVertex[numobject])[P2];
2371            for(size_t k=0 ; k<3 ; ++k) {
2372            if((*edgesRefVertex[numobject])[&K(k)]==2) {
2373                K.isInTriangle[k]=1;
2374            } else {
2375                K.isInTriangle[k]=0;
2376            }
2377            }
2378                    
2379                    
2380  ///////////////////////creation des triangles//////////////////////////////  ///////////////////////creation des triangles//////////////////////////////
# Line 2285  __createTrianglesIntersection(const size Line 2382  __createTrianglesIntersection(const size
2382          switch (numberVertexInDomain) {          switch (numberVertexInDomain) {
2383          case 0: {          case 0: {
2384            if(K.edgecut[0]+K.edgecut[1]+K.edgecut[2]==3 and vertexInTriangles.size()<3) {            if(K.edgecut[0]+K.edgecut[1]+K.edgecut[2]==3 and vertexInTriangles.size()<3) {
2385              ffout(3)<<"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";
2386              __casePinterNotInList(K,*i, triangleListIntersectionNew);              __casePinterNotInList(K,*i, triangleListIntersectionNew);
2387              std::exit(1);              std::exit(1);
2388            } else if(K.edgecut[0]+K.edgecut[1]+K.edgecut[2]!=0) {            } else if(K.edgecut[0]+K.edgecut[1]+K.edgecut[2]!=0) {
# Line 2296  __createTrianglesIntersection(const size Line 2393  __createTrianglesIntersection(const size
2393                  size_t numberEdgesCut=K.edgecut[0][0]+K.edgecut[1][0]+K.edgecut[2][0];                  size_t numberEdgesCut=K.edgecut[0][0]+K.edgecut[1][0]+K.edgecut[2][0];
2394                if(vertexInTriangles.size()>3 and numberEdgesCut==1){                if(vertexInTriangles.size()>3 and numberEdgesCut==1){
2395                  //one edge cut but twice                  //one edge cut but twice
2396                  ffout(3)<<"createNotIn\n";                  ffout(4)<<"createNotIn\n";
2397                  //POUR STEPH : createNotIn peut generer des tr plats                  //POUR STEPH : createNotIn peut generer des tr plats
2398                  __createNotIn(K,*i, triangleListIntersectionNew);                  __createNotIn(K,*i, triangleListIntersectionNew);
2399                } else {                } else {
2400                  if(vertexInTriangles.size()>3 and numberEdgesCut==2) {                  if(vertexInTriangles.size()>3 and numberEdgesCut==2) {
2401                    //two edge cut but twice                    //two edge cut but twice
2402                    ffout(3)<<"createNotIn2\n";                    ffout(4)<<"createNotIn2\n";
2403                    __createNotIn2(K,*i, triangleListIntersectionNew);                    __createNotIn2(K,*i, triangleListIntersectionNew);
2404                  } else {                  } else {
2405                    if(K.edgecut[0]!=0) {                    if(K.edgecut[0]!=0) {
2406                      if(K.pointsIntersection[0][0]==&V0                      if(K.pointsIntersection[0][0]==&V0
2407                         or K.pointsIntersection[0][0]==&V1                         or K.pointsIntersection[0][0]==&V1
2408                         or K.pointsIntersection[0][0]==&V2 or vertexInTriangles.size()==1) {                         or K.pointsIntersection[0][0]==&V2 or vertexInTriangles.size()==1) {
2409                        // ffout(3)<<"**********normal\n";                        // ffout(4)<<"**********normal\n";
2410                      } else {                      } else {
2411                        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
2412                           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) {
# Line 2327  __createTrianglesIntersection(const size Line 2424  __createTrianglesIntersection(const size
2424                          }                          }
2425                          if(vertexInTriangles.size()>3 and                          if(vertexInTriangles.size()>3 and
2426                             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){
2427                             ffout(3)<<"hhhhhhhh\n";                             ffout(4)<<"hhhhhhhh\n";
2428                              ffout(3)<<K(0)<<"\n";                              ffout(4)<<K(0)<<"\n";
2429                              ffout(3)<<K(1)<<"\n";                              ffout(4)<<K(1)<<"\n";
2430                              ffout(3)<<K(2)<<"\n";                              ffout(4)<<K(2)<<"\n";
2431                            __createNotIn2(K,*i,triangleListIntersectionNew);                            __createNotIn2(K,*i,triangleListIntersectionNew);
2432                          } else {                          } else {
2433                            if(vertexInTriangles.size()>3 and                            if(vertexInTriangles.size()>3 and
2434                               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) {
2435                              ffout(3)<<"case\n";                              ffout(4)<<"case\n";
2436                              __createNotIn(K,*i,triangleListIntersectionNew);                              __createNotIn(K,*i,triangleListIntersectionNew);
2437                            }                            }
2438                          }                          }
2439                        } else {                        } else {
2440                          if(vertexInTriangles.size()>=3) {                          if(vertexInTriangles.size()>=3) {
2441                            ffout(3)<<"triangle cut but outside1\n";                            ffout(4)<<"triangle cut but outside1\n";
2442                            ffout(3)<<V0<<"\n";                            ffout(4)<<V0<<"\n";
2443                            ffout(3)<<V1<<"\n";                            ffout(4)<<V1<<"\n";
2444                            ffout(3)<<V2<<"\n";                            ffout(4)<<V2<<"\n";
2445                            ffout(3)<<"nb points inter "<<vertexInTriangles.size()<<"\n";                            ffout(4)<<"nb points inter "<<vertexInTriangles.size()<<"\n";
2446                          }                          }
2447                        }                        }
2448                      }                      }
# Line 2354  __createTrianglesIntersection(const size Line 2451  __createTrianglesIntersection(const size
2451                        if(K.pointsIntersection[1][0]==&V0                        if(K.pointsIntersection[1][0]==&V0
2452                           or K.pointsIntersection[1][0]==&V1                           or K.pointsIntersection[1][0]==&V1
2453                           or K.pointsIntersection[1][0]==&V2 or vertexInTriangles.size()<3) {                           or K.pointsIntersection[1][0]==&V2 or vertexInTriangles.size()<3) {
2454                          //  ffout(3)<<"**********normal\n";                          //  ffout(4)<<"**********normal\n";
2455                        } else {                        } else {
2456                          ffout(3)<<"triangle cut but outside2\n";                          ffout(4)<<"triangle cut but outside2\n";
2457                          ffout(3)<<V0<<"\n";                          ffout(4)<<V0<<"\n";
2458                          ffout(3)<<V1<<"\n";                          ffout(4)<<V1<<"\n";
2459                          ffout(3)<<V2<<"\n";                          ffout(4)<<V2<<"\n";
2460                          ffout(3)<<"nb points inter "<<vertexInTriangles.size()<<"\n";                          ffout(4)<<"nb points inter "<<vertexInTriangles.size()<<"\n";
2461                        }                        }
2462                      } else {                      } else {
2463                        if(K.edgecut[2]!=0) {                        if(K.edgecut[2]!=0) {
2464                          if(K.pointsIntersection[2][0]==&V0                          if(K.pointsIntersection[2][0]==&V0
2465                             or K.pointsIntersection[2][0]==&V1                             or K.pointsIntersection[2][0]==&V1
2466                             or K.pointsIntersection[2][0]==&V2 or vertexInTriangles.size()<3) {                             or K.pointsIntersection[2][0]==&V2 or vertexInTriangles.size()<3) {
2467                            //ffout(3)<<"**********normal\n";                            //ffout(4)<<"**********normal\n";
2468                          } else {                          } else {
2469                            ffout(3)<<"triangle cut but outside3\n";                            ffout(4)<<"triangle cut but outside3\n";
2470                            ffout(3)<<V0<<"\n";                            ffout(4)<<V0<<"\n";
2471                            ffout(3)<<V1<<"\n";                            ffout(4)<<V1<<"\n";
2472                            ffout(3)<<V2<<"\n";                            ffout(4)<<V2<<"\n";
2473                            ffout(3)<<"nb points inter "<<vertexInTriangles.size()<<"\n";                            ffout(4)<<"nb points inter "<<vertexInTriangles.size()<<"\n";
2474                          }                          }
2475                        }                        }
2476                      }                      }
# Line 2389  __createTrianglesIntersection(const size Line 2486  __createTrianglesIntersection(const size
2486              if(K.pointsIntersection[0][0]!=K.pointsIntersection[1][0]              if(K.pointsIntersection[0][0]!=K.pointsIntersection[1][0]
2487                 and K.pointsIntersection[1][0]!=K.pointsIntersection[2][0]                 and K.pointsIntersection[1][0]!=K.pointsIntersection[2][0]
2488                  and K.pointsIntersection[2][0]!=K.pointsIntersection[0][0]) {                  and K.pointsIntersection[2][0]!=K.pointsIntersection[0][0]) {
2489                   ffout(3)<<"---------------- 3 edge cut \n";                   ffout(4)<<"---------------- 3 edge cut \n";
2490                  __createByEdges(K,*i,triangleListIntersectionNew);                  __createByEdges(K,*i,triangleListIntersectionNew);
2491              } else {              } else {
2492                  __createListTriangle(K,*i,triangleListIntersectionNew);                  __createListTriangle(K,*i,triangleListIntersectionNew);
# Line 2408  __createTrianglesIntersection(const size Line 2505  __createTrianglesIntersection(const size
2505                __addTriangle(*T,*i,triangleListIntersectionNew);                __addTriangle(*T,*i,triangleListIntersectionNew);
2506              } else {              } else {
2507                  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) {
2508                      ffout(3)<<"cas a traiter-------------\n";                      ffout(4)<<"cas a traiter-------------\n";
2509                  } else {                  } else {
2510                      ffout(3)<<"cas pas traite\n";                      ffout(4)<<K.edgecut[0][0]<<" "<<K.edgecut[1][0]<<" "<<K.edgecut[2][0]<<"\n";
2511                        ffout(4)<<"cas pas traite\n";
2512                  }                  }
2513              }              }
2514            break;            break;
2515          }          }
2516          }          }
2517            
2518    
2519  //////////////////////////////////////////////////////////////////////////  //////////////////////////////////////////////////////////////////////////
2520  //      // K.isInTriangle[i] vaut 1 si le point est a garder pour construire le maillage 0 sinon.  //      // K.isInTriangle[i] vaut 1 si le point est a garder pour construire le maillage 0 sinon.
# Line 2425  __createTrianglesIntersection(const size Line 2524  __createTrianglesIntersection(const size
2524  //          // 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"
2525  //  //
2526  //        // On ne peut normalement pas se trouver ICI.  //        // On ne peut normalement pas se trouver ICI.
2527  //        ffout(3)<<"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";
2528  //        __casePinterNotInList(K,*i, triangleListIntersectionNew);  //        __casePinterNotInList(K,*i, triangleListIntersectionNew);
2529  //        std::exit(1);  //        std::exit(1);
2530  //      }  //      }
# Line 2444  __createTrianglesIntersection(const size Line 2543  __createTrianglesIntersection(const size
2543  //          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]) {
2544  //#warning Reference not set.  //#warning Reference not set.
2545  //            __addTriangle(Triangle(*V[0],*V[1],*V[2],(*T).reference()),*i,triangleListIntersectionNew);  //            __addTriangle(Triangle(*V[0],*V[1],*V[2],(*T).reference()),*i,triangleListIntersectionNew);
2546  //            ffout(3)<<"on comble le trou\n"<<std::flush;  //            ffout(4)<<"on comble le trou\n"<<std::flush;
2547  //          } else {  //          } else {
2548  //            ffout(3)<<"----- deux inter =\n";  //            ffout(4)<<"----- deux inter =\n";
2549  //            ffout(3)<<V[0]<<"\n";  //            ffout(4)<<V[0]<<"\n";
2550  //            ffout(3)<<V[1]<<"\n";  //            ffout(4)<<V[1]<<"\n";
2551  //            ffout(3)<<V[2]<<"\n";  //            ffout(4)<<V[2]<<"\n";
2552  //          }  //          }
2553  //        } else {  //        } else {
2554  //          if(vertexInTriangles.size()>3 and  //          if(vertexInTriangles.size()>3 and
2555  //             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){
2556  //            //one edge cut but twice  //            //one edge cut but twice
2557  //            ffout(3)<<"createNotIn\n";  //            ffout(4)<<"createNotIn\n";
2558  //            //POUR STEPH : createNotIn peut generer des tr plats  //            //POUR STEPH : createNotIn peut generer des tr plats
2559  //            __createNotIn(K,*i, triangleListIntersectionNew);  //            __createNotIn(K,*i, triangleListIntersectionNew);
2560  //          } else {  //          } else {
2561  //            if(vertexInTriangles.size()>3 and  //            if(vertexInTriangles.size()>3 and
2562  //               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) {
2563  //            //two edge cut but twice  //            //two edge cut but twice
2564  //            ffout(3)<<"createNotIn2\n";  //            ffout(4)<<"createNotIn2\n";
2565  //            __createNotIn2(K,*i, triangleListIntersectionNew);  //            __createNotIn2(K,*i, triangleListIntersectionNew);
2566  //            } else {  //            } else {
2567  //              if(K.edgecut[0]!=0) {  //              if(K.edgecut[0]!=0) {
2568  //                if(K.pointsIntersection[0][0]==&V0  //                if(K.pointsIntersection[0][0]==&V0
2569  //                   or K.pointsIntersection[0][0]==&V1  //                   or K.pointsIntersection[0][0]==&V1
2570  //                   or K.pointsIntersection[0][0]==&V2 or vertexInTriangles.size()==1) {  //                   or K.pointsIntersection[0][0]==&V2 or vertexInTriangles.size()==1) {
2571  //                  // ffout(3)<<"**********normal\n";  //                  // ffout(4)<<"**********normal\n";
2572  //                } else {  //                } else {
2573  //                  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
2574  //                     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) {
# Line 2487  __createTrianglesIntersection(const size Line 2586  __createTrianglesIntersection(const size
2586  //                    }  //                    }
2587  //                    if(vertexInTriangles.size()>3 and  //                    if(vertexInTriangles.size()>3 and
2588  //                       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){
2589  //                      ffout(3)<<"hhhhhhhh\n";  //                      ffout(4)<<"hhhhhhhh\n";
2590  //                      __createNotIn2(K,*i,triangleListIntersectionNew);  //                      __createNotIn2(K,*i,triangleListIntersectionNew);
2591  //                    } else {  //                    } else {
2592  //                      if(vertexInTriangles.size()>3 and  //                      if(vertexInTriangles.size()>3 and
2593  //                         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) {
2594  //                        ffout(3)<<"case\n";  //                        ffout(4)<<"case\n";
2595  //                        __createNotIn(K,*i,triangleListIntersectionNew);  //                        __createNotIn(K,*i,triangleListIntersectionNew);
2596  //                      }  //                      }
2597  //                    }  //                    }
2598  //                  } else {  //                  } else {
2599  //                    if(vertexInTriangles.size()>=3) {  //                    if(vertexInTriangles.size()>=3) {
2600  //                      ffout(3)<<"triangle cut but outside1\n";  //                      ffout(4)<<"triangle cut but outside1\n";
2601  //                      ffout(3)<<V0<<"\n";  //                      ffout(4)<<V0<<"\n";
2602  //                      ffout(3)<<V1<<"\n";  //                      ffout(4)<<V1<<"\n";
2603  //                      ffout(3)<<V2<<"\n";  //                      ffout(4)<<V2<<"\n";
2604  //                      ffout(3)<<"nb points inter "<<vertexInTriangles.size()<<"\n";  //                      ffout(4)<<"nb points inter "<<vertexInTriangles.size()<<"\n";
2605  //                    }  //                    }
2606  //                  }  //                  }
2607  //                }  //                }
# Line 2511  __createTrianglesIntersection(const size Line 2610  __createTrianglesIntersection(const size
2610  //                  if(K.pointsIntersection[1][0]==&V0  //                  if(K.pointsIntersection[1][0]==&V0
2611  //                     or K.pointsIntersection[1][0]==&V1  //                     or K.pointsIntersection[1][0]==&V1
2612  //                     or K.pointsIntersection[1][0]==&V2 or vertexInTriangles.size()<3) {  //                     or K.pointsIntersection[1][0]==&V2 or vertexInTriangles.size()<3) {
2613  //                    //  ffout(3)<<"**********normal\n";  //                    //  ffout(4)<<"**********normal\n";
2614  //                  } else {  //                  } else {
2615  //                    ffout(3)<<"triangle cut but outside2\n";  //                    ffout(4)<<"triangle cut but outside2\n";
2616  //                    ffout(3)<<V0<<"\n";  //                    ffout(4)<<V0<<"\n";
2617  //                    ffout(3)<<V1<<"\n";  //                    ffout(4)<<V1<<"\n";
2618  //                    ffout(3)<<V2<<"\n";  //                    ffout(4)<<V2<<"\n";
2619  //                    ffout(3)<<"nb points inter "<<vertexInTriangles.size()<<"\n";  //                    ffout(4)<<"nb points inter "<<vertexInTriangles.size()<<"\n";
2620  //                  }  //                  }
2621  //                } else {  //                } else {
2622  //                  if(K.edgecut[2]!=0) {  //                  if(K.edgecut[2]!=0) {
2623  //                    if(K.pointsIntersection[2][0]==&V0  //                    if(K.pointsIntersection[2][0]==&V0
2624  //                       or K.pointsIntersection[2][0]==&V1  //                       or K.pointsIntersection[2][0]==&V1
2625  //                       or K.pointsIntersection[2][0]==&V2 or vertexInTriangles.size()<3) {  //                       or K.pointsIntersection[2][0]==&V2 or vertexInTriangles.size()<3) {
2626  //                      //ffout(3)<<"**********normal\n";  //                      //ffout(4)<<"**********normal\n";
2627  //                    } else {  //                    } else {
2628  //                      ffout(3)<<"triangle cut but outside3\n";  //                      ffout(4)<<"triangle cut but outside3\n";
2629  //                      ffout(3)<<V0<<"\n";  //                      ffout(4)<<V0<<"\n";
2630  //                      ffout(3)<<V1<<"\n";  //                      ffout(4)<<V1<<"\n";
2631  //                      ffout(3)<<V2<<"\n";  //                      ffout(4)<<V2<<"\n";
2632  //                      ffout(3)<<"nb points inter "<<vertexInTriangles.size()<<"\n";  //                      ffout(4)<<"nb points inter "<<vertexInTriangles.size()<<"\n";
2633  //                    }  //                    }
2634  //                  }  //                  }
2635  //                }  //                }
# Line 2544  __createTrianglesIntersection(const size Line 2643  __createTrianglesIntersection(const size
2643  //        if(K.pointsIntersection[0][0]!=K.pointsIntersection[1][0]  //        if(K.pointsIntersection[0][0]!=K.pointsIntersection[1][0]
2644  //           and K.pointsIntersection[1][0]!=K.pointsIntersection[2][0]  //           and K.pointsIntersection[1][0]!=K.pointsIntersection[2][0]
2645  //           and K.pointsIntersection[2][0]!=K.pointsIntersection[0][0]) {  //           and K.pointsIntersection[2][0]!=K.pointsIntersection[0][0]) {
2646  //          ffout(3)<<"---------------- 3 edge cut \n";  //          ffout(4)<<"---------------- 3 edge cut \n";
2647  //          __createByEdges(K,*i,triangleListIntersectionNew);  //          __createByEdges(K,*i,triangleListIntersectionNew);
2648  //        } else {  //        } else {
2649  //          __createListTriangle(K,*i,triangleListIntersectionNew);  //          __createListTriangle(K,*i,triangleListIntersectionNew);
# Line 2553  __createTrianglesIntersection(const size Line 2652  __createTrianglesIntersection(const size
2652  //        if(nbinters!=0) {  //        if(nbinters!=0) {
2653  //          __createListTriangle(K,*i,triangleListIntersectionNew);  //          __createListTriangle(K,*i,triangleListIntersectionNew);
2654  //        } else {  //        } else {
2655  //          //ffout(3)<<"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";
2656  //#warning Reference not set.  //#warning Reference not set.
2657  //          __addTriangle(Triangle(V0,V1,V2,(*T).reference()),*i,triangleListIntersectionNew);  //          __addTriangle(Triangle(V0,V1,V2,(*T).reference()),*i,triangleListIntersectionNew);
2658  //        }  //        }
# Line 2563  __createTrianglesIntersection(const size Line 2662  __createTrianglesIntersection(const size
2662    }    }
2663  }  }
2664      (*edgesRefVertex[numobject]).clear();      (*edgesRefVertex[numobject]).clear();
2665        listOfVertexMesh.clear();
2666        listOfTriangleMeshFront.clear();
2667  }  }
2668    
2669  bool SurfaceMeshGenerator::Internals::  bool SurfaceMeshGenerator::Internals::
# Line 2926  __createSurface(Structured3DMesh& SMesh, Line 3027  __createSurface(Structured3DMesh& SMesh,
3027                ++itcell;                ++itcell;
3028              }              }
3029            } else {            } else {
3030                ffout(3)<<"------jobDone false\n";                ffout(4)<<"------jobDone false\n";
3031              SurfaceMeshGenerator::Internals::MotherCellList::iterator itcell              SurfaceMeshGenerator::Internals::MotherCellList::iterator itcell
3032                =cellList.begin();                =cellList.begin();
3033              for (EdgePairList::iterator t = localTriangleList.begin();              for (EdgePairList::iterator t = localTriangleList.begin();
# Line 3245  __generateMesh(const Domain& omega, Line 3346  __generateMesh(const Domain& omega,
3346      __marchingTetrahedra(SMesh, *o, 0);      __marchingTetrahedra(SMesh, *o, 0);
3347    
3348      objectStack.push(o);      objectStack.push(o);
3349      ffout(3) << "Marching cube sur " << objectStack.top() << '\n';      ffout(4) << "Marching cube sur " << objectStack.top() << '\n';
3350    }    }
3351    }    }
3352    
# Line 3404  void plotmedit(const size_t& nobject, Line 3505  void plotmedit(const size_t& nobject,
3505    sortie<<" \n";    sortie<<" \n";
3506    sortie<<"Triangles"<<"\n";    sortie<<"Triangles"<<"\n";
3507    sortie<<s_mesh.numberOfCells()<<"\n";    sortie<<s_mesh.numberOfCells()<<"\n";
3508    ffout(3)<<"fin ecriture vertex\n";    ffout(4)<<"fin ecriture vertex\n";
3509    for (size_t i=0; i<s_mesh.numberOfCells(); ++i) {    for (size_t i=0; i<s_mesh.numberOfCells(); ++i) {
3510      const Triangle& T = s_mesh.cell(i);      const Triangle& T = s_mesh.cell(i);
3511      // ffout(3)<<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";
3512      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;
3513            
3514      // 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";
# Line 3419  void plotmedit(const size_t& nobject, Line 3520  void plotmedit(const size_t& nobject,
3520  //       sortie<<" 4"<<"\n";  //       sortie<<" 4"<<"\n";
3521      sortie << " " << T.reference() << '\n';      sortie << " " << T.reference() << '\n';
3522    }    }
3523    ffout(3)<<"fin ecriture triangles\n";    ffout(4)<<"fin ecriture triangles\n";
3524    sortie<<" \n";    sortie<<" \n";
3525    sortie<<"Hexahedra"<<"\n";    sortie<<"Hexahedra"<<"\n";
3526    sortie<<toTreatHexahedra.size()<<" \n";    sortie<<toTreatHexahedra.size()<<" \n";
# Line 3427  void plotmedit(const size_t& nobject, Line 3528  void plotmedit(const size_t& nobject,
3528    for(size_t i=0;i<toTreatHexahedra.size();i++)    for(size_t i=0;i<toTreatHexahedra.size();i++)
3529      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";
3530    sortie<<"End"<<" \n";    sortie<<"End"<<" \n";
3531    ffout(3)<<"fin ecriture intersection.mesh\n";    ffout(4)<<"fin ecriture intersection.mesh\n";
3532  }  }

Legend:
Removed from v.1.33  
changed lines
  Added in v.1.34

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26