/[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.53 by dobj, Fri Oct 31 15:44:06 2003 UTC revision 1.54 by dobj, Fri Nov 14 16:17:51 2003 UTC
# Line 68  inline double SDet(const Vertex & V1, co Line 68  inline double SDet(const Vertex & V1, co
68  inline bool checkInterbis(const Vertex &P1, const Vertex &P2, const Vertex &Q1, const Vertex &Q2) {  inline bool checkInterbis(const Vertex &P1, const Vertex &P2, const Vertex &Q1, const Vertex &Q2) {
69      // retourne true si P1P2 inter Q1Q2 != vide      // retourne true si P1P2 inter Q1Q2 != vide
70      assert(!(P1 == P2 || P1 == Q1 || P1 == Q2 || P2 == Q1 || P2 == Q2 || Q1 == Q2));      assert(!(P1 == P2 || P1 == Q1 || P1 == Q2 || P2 == Q1 || P2 == Q2 || Q1 == Q2));
71      const double eps = 1e-12;      //const double eps = 1e-15;
72      /*if (std::abs(SDet(Q1,Q2,P1)) <eps||      /*if (std::abs(SDet(Q1,Q2,P1)) <eps||
73          std::abs(SDet(Q1,Q2,P2)) <eps) {          std::abs(SDet(Q1,Q2,P2)) <eps) {
74          //ffout(0) << " !!!!! NO !!!!!!!" << std::endl;          //ffout(0) << " !!!!! NO !!!!!!!" << std::endl;
75          return true;          return true;
76      }*/      }*/
77      if(std::abs(SDet(P1,P2,Q1))<eps and std::abs(SDet(P1,P2,Q2))<eps and  
        std::abs(SDet(Q1,Q2,P1))<eps and std::abs(SDet(Q1,Q2,P2))<eps) {  
         return true;  
     }  
78      return ((SDet(P1,P2,Q1)*SDet(P1,P2,Q2) < 0) && (SDet(Q1,Q2,P1)*SDet(Q1,Q2,P2) < 0)); // version optimisée      return ((SDet(P1,P2,Q1)*SDet(P1,P2,Q2) < 0) && (SDet(Q1,Q2,P1)*SDet(Q1,Q2,P2) < 0)); // version optimisée
79  }  }
80  class SurfaceMeshGenerator::Internals  class SurfaceMeshGenerator::Internals
# Line 265  private: Line 262  private:
262                      TinyVector<3,const Vertex *> & V,                      TinyVector<3,const Vertex *> & V,
263                      size_t& ncompt);                      size_t& ncompt);
264    
265      void __inout(const size_t& numobject,
266                   const int& ttn0,
267                   const Vertex*& V0,
268                   const Vertex*& V1);
269    
270    TinyVector<4, real_t>  __EquationPlan(const TinyVector<3,const Vertex *> & V);    TinyVector<4, real_t>  __EquationPlan(const TinyVector<3,const Vertex *> & V);
271    
# Line 338  private: Line 339  private:
339                      std::vector<const Vertex*>& points,                      std::vector<const Vertex*>& points,
340                      size_t& in,                      size_t& in,
341                      size_t& in1,                      size_t& in1,
342                      TinyVector<3,size_t>& place);                      TinyVector<3,size_t> place);
343    
   void __create2List(const TriangleCut& K,  
                      TinyVector<2,const Vertex*>& P,  
                      std::vector<const Vertex*>& points,  
                      std::vector<const Vertex*>& pointslist1,  
                      std::vector<const Vertex*>& pointslist2);  
     
344    bool __verifExist(const Vertex* Ptemp,    bool __verifExist(const Vertex* Ptemp,
345                      std::vector<const Vertex*>& points);                      std::vector<const Vertex*>& points);
346    bool  __findOneEdge(const TriangleCut& K,    bool  __findOneEdge(const TriangleCut& K,
# Line 949  __DeterminatePoint(const size_t& ncase, Line 944  __DeterminatePoint(const size_t& ncase,
944    std::pair<const Vertex*,const Vertex*> pV(Vo0,Vo1);    std::pair<const Vertex*,const Vertex*> pV(Vo0,Vo1);
945    std::pair<const Vertex*,const Vertex*> pV2(Vo1,Vo0);    std::pair<const Vertex*,const Vertex*> pV2(Vo1,Vo0);
946    
947      // rq: a 10-6 on loupe des points!!!!! (testStep2.txt)      // rq: epsilon a 10-6 on loupe des points!!!!! (testStep2.txt)
948    real_t epsilon=1e-10;    real_t epsilon=1e-10;
949      real_t eps=1e-6;
950    real_t pscalar,k;    real_t pscalar,k;
951    size_t num;    size_t num;
952    Vertex P;    Vertex P;
# Line 1004  __DeterminatePoint(const size_t& ncase, Line 1000  __DeterminatePoint(const size_t& ncase,
1000                } else {                } else {
1001                  if(listVertexIntersectionNew.find(pV)!=listVertexIntersectionNew.end()) {                  if(listVertexIntersectionNew.find(pV)!=listVertexIntersectionNew.end()) {
1002                    if(Norm((*(*listVertexIntersectionNew.find(pV)).second[0])                    if(Norm((*(*listVertexIntersectionNew.find(pV)).second[0])
1003                            -P)<1e-6) {                            -P)<eps) {
1004                      Pinter.addPoint((*listVertexIntersectionNew.find(pV)).second[0]);                      Pinter.addPoint((*listVertexIntersectionNew.find(pV)).second[0]);
1005                    } else                    } else
1006                      if(Norm((*(*listVertexIntersectionNew.find(pV)).second[1]) - P) < 1e-6) {                      if(Norm((*(*listVertexIntersectionNew.find(pV)).second[1]) - P) < eps) {
1007                        Pinter.addPoint((*listVertexIntersectionNew.find(pV)).second[1]);                        Pinter.addPoint((*listVertexIntersectionNew.find(pV)).second[1]);
1008                      } else {                      } else {
1009                        listVertexIntersectionNew[pV][1]=new Vertex (P);                        listVertexIntersectionNew[pV][1]=new Vertex (P);
1010                        Pinter.addPoint(listVertexIntersectionNew[pV][1]);                        Pinter.addPoint(listVertexIntersectionNew[pV][1]);
1011                      }                      }
1012                  } else {                  } else {
1013                    if(Norm((*(*listVertexIntersectionNew.find(pV2)).second[0]) - P) < 1e-6) {                    if(Norm((*(*listVertexIntersectionNew.find(pV2)).second[0]) - P) < eps) {
1014                      Pinter.addPoint((*listVertexIntersectionNew.find(pV2)).second[0]);                      Pinter.addPoint((*listVertexIntersectionNew.find(pV2)).second[0]);
1015                    } else                    } else
1016                      if(Norm((*(*listVertexIntersectionNew.find(pV2)).second[1]) - P) < 1e-6) {                      if(Norm((*(*listVertexIntersectionNew.find(pV2)).second[1]) - P) < eps) {
1017                        Pinter.addPoint((*listVertexIntersectionNew.find(pV2)).second[1]);                        Pinter.addPoint((*listVertexIntersectionNew.find(pV2)).second[1]);
1018                      } else {                      } else {
1019                        listVertexIntersectionNew[pV2][1]=new Vertex (P);                        listVertexIntersectionNew[pV2][1]=new Vertex (P);
# Line 1052  __DeterminatePoint(const size_t& ncase, Line 1048  __DeterminatePoint(const size_t& ncase,
1048                    } else {                    } else {
1049                      if(listVertexIntersectionNew.find(pV)!=listVertexIntersectionNew.end()) {                      if(listVertexIntersectionNew.find(pV)!=listVertexIntersectionNew.end()) {
1050                        if(Norm((*(*listVertexIntersectionNew.find(pV)).second[0])                        if(Norm((*(*listVertexIntersectionNew.find(pV)).second[0])
1051                                -P)<1e-6) {                                -P)<eps) {
1052                          Pinter.addPoint((*listVertexIntersectionNew.find(pV)).second[0]);                          Pinter.addPoint((*listVertexIntersectionNew.find(pV)).second[0]);
1053                        } else {                        } else {
1054                          if(Norm((*(*listVertexIntersectionNew.find(pV)).second[1])                          if(Norm((*(*listVertexIntersectionNew.find(pV)).second[1])
1055                                  -P)<1e-6) {                                  -P)<eps) {
1056                            Pinter.addPoint((*listVertexIntersectionNew.find(pV)).second[1]);                            Pinter.addPoint((*listVertexIntersectionNew.find(pV)).second[1]);
1057                          } else {                          } else {
1058                            listVertexIntersectionNew[pV][1]=new Vertex (P);                            listVertexIntersectionNew[pV][1]=new Vertex (P);
# Line 1065  __DeterminatePoint(const size_t& ncase, Line 1061  __DeterminatePoint(const size_t& ncase,
1061                        }                        }
1062                      } else {                      } else {
1063                        if(Norm((*(*listVertexIntersectionNew.find(pV2)).second[0])                        if(Norm((*(*listVertexIntersectionNew.find(pV2)).second[0])
1064                                -P)<1e-6) {                                -P)<eps) {
1065                          Pinter.addPoint((*listVertexIntersectionNew.find(pV2)).second[0]);                          Pinter.addPoint((*listVertexIntersectionNew.find(pV2)).second[0]);
1066                        } else {                        } else {
1067                          if(Norm((*(*listVertexIntersectionNew.find(pV2)).second[1])                          if(Norm((*(*listVertexIntersectionNew.find(pV2)).second[1])
1068                                  -P)<1e-6) {                                  -P)<eps) {
1069                            Pinter.addPoint((*listVertexIntersectionNew.find(pV2)).second[1]);                            Pinter.addPoint((*listVertexIntersectionNew.find(pV2)).second[1]);
1070                          } else {                          } else {
1071                            listVertexIntersectionNew[pV2][1]=new Vertex (P);                            listVertexIntersectionNew[pV2][1]=new Vertex (P);
# Line 1119  __CalculPoint(std::list<Triangle*>::iter Line 1115  __CalculPoint(std::list<Triangle*>::iter
1115    __DeterminatePoint(3,(Vo012[1]),(Vo012[2]),V012,Pinter, listVertexIntersectionNew);    __DeterminatePoint(3,(Vo012[1]),(Vo012[2]),V012,Pinter, listVertexIntersectionNew);
1116  }  }
1117    
1118    void SurfaceMeshGenerator::Internals::
1119    __inout(const size_t& numobject,
1120            const int & edgeCut,
1121            const Vertex*& V0,
1122            const Vertex*& V1)
1123    {// if the edge is not cut , put ref=2 for the 2 vertex
1124      size_t& refVertex0=(*edgesRefVertex[numobject])[V0];
1125      size_t& refVertex1=(*edgesRefVertex[numobject])[V1];
1126    
1127      if(refVertex0+refVertex1==4 and edgeCut==1) {
1128        ffout(4)<<"warning edge ref 2 cut \n";
1129        ffout(4)<<(*V0)[0]<<" "<<(*V0)[1]<<" "<<(*V0)[2]<<" \n";
1130        ffout(4)<<(*V1)[0]<<" "<<(*V1)[1]<<" "<<(*V1)[2]<<" \n";
1131        refVertex0=0;
1132        refVertex1=0;
1133      } else {
1134        // CECILE: ne serait-ce pas plutôt une assertion ?
1135        if(refVertex0+refVertex1==2 and edgeCut==0) {
1136          refVertex0=2;
1137          refVertex1=2;
1138        }
1139      }
1140    }
1141    
1142  void SurfaceMeshGenerator::Internals::  void SurfaceMeshGenerator::Internals::
1143  __createPointIntersection(std::list<Triangle*>::iterator currentTriangle1,  __createPointIntersection(std::list<Triangle*>::iterator currentTriangle1,
# Line 1336  __createLocalListIntersection(const size Line 1355  __createLocalListIntersection(const size
1355            }            }
1356          } else {          } else {
1357              if(pairTriangleToIntersectionPoints[pairTriangle].size()!=0) {              if(pairTriangleToIntersectionPoints[pairTriangle].size()!=0) {
1358                  ffout(4)<<"on a un point non pris... triangle plat??\n";                  //ffout(4)<<"on a un point non pris... triangle plat??\n";
1359                  //ffout(4)<<(*(*jt0))(0)<<"\n";                  //ffout(4)<<(*(*jt0))(0)<<"\n";
1360                  //ffout(4)<<(*(*jt0))(1)<<"\n";                  //ffout(4)<<(*(*jt0))(1)<<"\n";
1361                  //ffout(4)<<(*(*jt0))(2)<<"\n";                  //ffout(4)<<(*(*jt0))(2)<<"\n";
1362                  ffout(4)<<*pairTriangleToIntersectionPoints[pairTriangle][0]<<"\n";                  //ffout(4)<<*pairTriangleToIntersectionPoints[pairTriangle][0]<<"\n";
1363                  vertexVectTriangles[pairTriangleToIntersectionPoints[pairTriangle][0]].push_back(*jt0);                  vertexVectTriangles[pairTriangleToIntersectionPoints[pairTriangle][0]].push_back(*jt0);
1364              }                  
1365                }
1366          }          }
1367    
1368          for (size_t n=0; n < cutTriangle.size(); ++n) {          for (size_t n=0; n < cutTriangle.size(); ++n) {
# Line 1499  __putRefByFront(const size_t numobject, Line 1519  __putRefByFront(const size_t numobject,
1519        frontSize++;        frontSize++;
1520        const Triangle*& TT=(*listOfTriangleMeshFront.find(T)).second;        const Triangle*& TT=(*listOfTriangleMeshFront.find(T)).second;
1521        // on traite le triangle du front        // on traite le triangle du front
1522          Vertex A(-0.000141,0.129744,0.110641);
1523          if(Norm(A-(*T)(0))<1e-6 or Norm(A-(*T)(1))<1e-6 or Norm(A-(*T)(2))<1e-6 ){
1524              ffout(4)<<"=============\n";
1525              ffout(4)<<(*T)(0)<<"\n";
1526              ffout(4)<<(*T)(1)<<"\n";
1527              ffout(4)<<(*T)(2)<<"\n";
1528              ffout(4)<<(*edgesRefVertex[numobject])[&(*T)(0)]<<"\n";
1529              ffout(4)<<(*edgesRefVertex[numobject])[&(*T)(1)]<<"\n";
1530              ffout(4)<<(*edgesRefVertex[numobject])[&(*T)(2)]<<"\n";
1531          }
1532          
1533        __putEdgeRef(T,TT,numobject,O1,O2);        __putEdgeRef(T,TT,numobject,O1,O2);
1534          if(Norm(A-(*T)(0))<1e-6 or Norm(A-(*T)(1))<1e-6 or Norm(A-(*T)(2))<1e-6 ){
1535              ffout(4)<<(*edgesRefVertex[numobject])[&(*T)(0)]<<"\n";
1536              ffout(4)<<(*edgesRefVertex[numobject])[&(*T)(1)]<<"\n";
1537              ffout(4)<<(*edgesRefVertex[numobject])[&(*T)(2)]<<"\n";
1538              ffout(4)<<"=============\n";
1539    
1540          }
1541      }      }
1542      ++i;      ++i;
1543    }    }
# Line 1582  __putRefByFront(const size_t numobject, Line 1620  __putRefByFront(const size_t numobject,
1620                ref1=2;                ref1=2;
1621                ref2=2;                ref2=2;
1622              }  else {              }  else {
1623                  if((ref1==2 or ref0==2) and edge0==0 and (ref1!=1 and ref0!=1)) {
1624                      ref1=2;
1625                      ref0=2;
1626                  }
1627                  if((ref2==2 or ref0==2) and edge1==0 and (ref2!=1 and ref0!=1)) {
1628                        ref2=2;
1629                        ref0=2;
1630                  }
1631                  if((ref1==2 or ref2==2) and edge2==0 and (ref1!=1 and ref2!=1)) {
1632                        ref1=2;
1633                        ref2=2;
1634                  }
1635                if((ref1==2 or ref0==2) and edge0==1 and sum>1 and ref0+ref1!=4){                if((ref1==2 or ref0==2) and edge0==1 and sum>1 and ref0+ref1!=4){
1636    
1637                  //ffout(4)<<"ref 1 2 0 partout\n";                  //ffout(4)<<"ref 1 2 0 partout\n";
1638                  //ffout(4)<<ref0<<" "<<ref1<<"\n";                  //ffout(4)<<ref0<<" "<<ref1<<"\n";
1639                  if(ref1+ref0!=3) {                  if(ref1+ref0!=3) {
# Line 1594  __putRefByFront(const size_t numobject, Line 1645  __putRefByFront(const size_t numobject,
1645                    ref0=1;                    ref0=1;
1646                  }                  }
1647                }                }
1648                if((ref2==2 or ref0==2) and edge1==1 and sum>1 and ref0+ref2!=4){                if((ref2==2 or ref0==2) and edge1==1){
1649                  //ffout(0)<<"ref 1 2 1 partout\n";                  //ffout(0)<<"ref 1 2 1 partout\n";
1650                  //ffout(4)<<ref0<<" "<<ref2<<"\n";                  //ffout(4)<<ref0<<" "<<ref2<<"\n";
1651                  if(ref2+ref0!=3) {                  if(ref2+ref0!=3) {
# Line 1606  __putRefByFront(const size_t numobject, Line 1657  __putRefByFront(const size_t numobject,
1657                    ref0=1;                    ref0=1;
1658                  }                  }
1659                }                }
1660                if((ref2==2 or ref1==2) and edge2==1 and sum>1 and ref1+ref2!=4){                if((ref2==2 or ref1==2) and edge2==1){
1661                  //ffout(0)<<"ref 1 2 2 partout\n";                  //ffout(0)<<"ref 1 2 2 partout\n";
1662                  //ffout(4)<<ref1<<" "<<ref2<<"\n";                  //ffout(4)<<ref1<<" "<<ref2<<"\n";
1663                  if(ref1+ref2!=3) {                  if(ref1+ref2!=3) {
# Line 1660  __putEdgeRef(const Triangle*& Tmesh, Line 1711  __putEdgeRef(const Triangle*& Tmesh,
1711      TinyVector<2,int> edge1=edgecut[1];      TinyVector<2,int> edge1=edgecut[1];
1712      TinyVector<2,int> edge2=edgecut[2];      TinyVector<2,int> edge2=edgecut[2];
1713      size_t sum=edge0[0]+edge1[0]+edge2[0];      size_t sum=edge0[0]+edge1[0]+edge2[0];
1714      if((ref0==2 or ref1==2 or ref2==2)  and sum==0 and ref0+ref1!=4) {      if((ref0==2 or ref1==2 or ref2==2)  and sum==0) {
1715        ref0=2;        ref0=2;
1716        ref1=2;        ref1=2;
1717        ref2=2;        ref2=2;
1718      } else {      } else {
1719        if((ref1==2 or ref0==2) and edge0==1 and sum>1 and ref0+ref2!=4){        if((ref1==2 or ref0==2) and edge0==1){
1720          if(ref0==2) {          if(ref0==2) {
1721            ref1=1;            ref1=1;
1722          } else {          } else {
1723            ref0=1;            ref0=1;
1724          }          }
1725        }        }
1726        if((ref2==2 or ref0==2) and edge1==1 and sum>1 and ref1+ref2!=4){        if((ref2==2 or ref0==2) and edge1==1 and sum>1 and ref0+ref2!=4){
1727    
1728          if(ref0==2) {          if(ref0==2) {
1729            ref2=1;            ref2=1;
1730          } else {          } else {
1731            ref0=1;            ref0=1;
1732          }          }
1733        }        }
1734        if((ref2==2 or ref1==2) and edge2==1 and sum>1){        if((ref2==2 or ref1==2) and edge2==1 and sum>1 and ref2+ref1!=4){
1735    
1736          if(ref2==2) {          if(ref2==2) {
1737            ref1=1;            ref1=1;
1738          } else {          } else {
# Line 1765  __createCase(const TriangleCut& K , Line 1818  __createCase(const TriangleCut& K ,
1818      break;      break;
1819    }    }
1820    case 3: {    case 3: {
1821        if(K.edgecut[0][0]==1) {        if(K.isInTriangle[0]==1) {
           in1=2;  
           in=0;  
1822            place[0]=0;            place[0]=0;
1823            if(K.edgecut[1][0]==1) {            if(K.isInTriangle[1]==1) {
1824                place[1]=1;                place[1]=1;
1825                place[2]=2;                place[2]=2;
1826            } else {            } else {
1827                place[1]=2;                place[1]=2;
1828                place[2]=1;                place[2]=1;
1829            }            }
1830        } else if(K.edgecut[1][0]==1) {        } else if(K.isInTriangle[1]==1) {
           in1=1;  
           in=2;  
1831            place[0]=1;            place[0]=1;
1832            place[1]=2;            place[1]=2;
1833            place[2]=0;            place[2]=0;
1834        } else {        } else {
           in1=0;  
           in=1;  
1835            place[0]=2;            place[0]=2;
1836            place[1]=1;            place[1]=1;
1837            place[2]=0;            place[2]=0;
# Line 1843  __addList(const TriangleCut& K) Line 1890  __addList(const TriangleCut& K)
1890      +K.edgecut[0][1]+K.edgecut[1][1]+K.edgecut[2][1];      +K.edgecut[0][1]+K.edgecut[1][1]+K.edgecut[2][1];
1891      size_t nbInter=vertexInTriangles.size();      size_t nbInter=vertexInTriangles.size();
1892      //ffout(4)<<"nb Inter avt = "<<nbInter<<"\n";      //ffout(4)<<"nb Inter avt = "<<nbInter<<"\n";
1893      ffout(4)<<"nb points total "<<vertexVectTriangles.size()<<"\n";      if(vertexVectTriangles.size()!=0) {
1894          ffout(4)<<"nb points total "<<vertexVectTriangles.size()<<"\n";
1895        }
1896    
1897      //premiere etage : verifier que vertexInTriangles contient bien tous les points      //premiere etage : verifier que vertexInTriangles contient bien tous les points
1898      if(nbInter<vertexVectTriangles.size()) {      if(nbInter<vertexVectTriangles.size()) {
1899          //il manque des points          //il manque des points
# Line 1857  __addList(const TriangleCut& K) Line 1907  __addList(const TriangleCut& K)
1907              if(vertexInTriangles.find(PP)==vertexInTriangles.end()) {              if(vertexInTriangles.find(PP)==vertexInTriangles.end()) {
1908                  //ffout(4)<<"je l'ajoute\n";                  //ffout(4)<<"je l'ajoute\n";
1909                  //le point n'existe pas il faut le rajouter                  //le point n'existe pas il faut le rajouter
1910    //on cherche a quel triangle l'associer                  //on cherche a quel triangle l'associer
1911                  if(nbInter==0) {                  if(nbInter==0) {
1912                      TinyVector<2,const Triangle*> triangles;                      TinyVector<2,const Triangle*> triangles;
1913                      triangles[0]=VT[0];                      triangles[0]=VT[0];
# Line 1868  __addList(const TriangleCut& K) Line 1918  __addList(const TriangleCut& K)
1918                      size_t taille=VT.size();                      size_t taille=VT.size();
1919                      //test si le point est confondu avec un point in                      //test si le point est confondu avec un point in
1920                      if(K.isInTriangle[0]==1 and Norm(K(0)-*PP)<1e-6) {                      if(K.isInTriangle[0]==1 and Norm(K(0)-*PP)<1e-6) {
1921                            ffout(4)<<"trop proche 1\n";
1922                          stop2=1;                          stop2=1;
1923                      }                      }
1924                      if(K.isInTriangle[1]==1 and Norm(K(1)-*PP)<1e-6) {                      if(K.isInTriangle[1]==1 and Norm(K(1)-*PP)<1e-6) {
1925                            ffout(4)<<"trop proche 2\n";
1926                          stop2=1;                          stop2=1;
1927                      }                      }
1928                      if(K.isInTriangle[2]==1 and Norm(K(2)-*PP)<1e-6) {                      if(K.isInTriangle[2]==1 and Norm(K(2)-*PP)<1e-6) {
1929                            ffout(4)<< Norm(K(2)-*PP)<<" trop proche 3\n";
1930                            ffout(4)<<*PP<<"\n";
1931                            ffout(4)<<K(2)<<"\n";
1932                          stop2=1;                          stop2=1;
1933                      }                      }
1934                      while(nn<taille and stop2==0) {                      while(nn<taille and stop2==0) {
# Line 1889  __addList(const TriangleCut& K) Line 1944  __addList(const TriangleCut& K)
1944                          ++nn;                          ++nn;
1945                      }                      }
1946                      if(nn==taille and stop2==0) {                      if(nn==taille and stop2==0) {
1947                            (*triangleWithVertex.find(&K)).second[0]=PP;
1948                            TinyVector<2,const Triangle*> triangles;
1949                            triangles[0]=&K;
1950                            triangles[1]=&K;
1951                            vertexInTriangles[PP]=triangles;
1952                          ffout(4)<<"bizarreeeeee on a pas trouve le tr\n";                          ffout(4)<<"bizarreeeeee on a pas trouve le tr\n";
1953                            //ffout(4)<<nn<<" =? "<<taille<<" "<<stop2<<" =? 0\n";
1954                            //ffout(4)<<*PP<<"\n";
1955                            //ffout(4)<<K(0)<<"\n";
1956                            //ffout(4)<<K(1)<<"\n";
1957                            //ffout(4)<<K(2)<<"\n";
1958                      }                      }
1959                  }                  }
1960              } else {              } else {
# Line 1900  __addList(const TriangleCut& K) Line 1965  __addList(const TriangleCut& K)
1965  }  }
1966    
1967  void SurfaceMeshGenerator::Internals::  void SurfaceMeshGenerator::Internals::
 __create2List(const TriangleCut& K,  
               TinyVector<2,const Vertex*>& P,  
               std::vector<const Vertex*>& points,  
               std::vector<const Vertex*>& pointslist1,  
               std::vector<const Vertex*>& pointslist2)  
 {  
     size_t taille=points.size();  
     size_t stopcut=0;  
     size_t number=1;  
     if(P[0]!=P[1]) {  
         number=2;  
     }  
     for(unsigned ie=1;ie<taille;++ie) {  
         const Vertex* Pcut=points[ie];  
         //ffout(4)<<*Pcut<<"\n";  
         if(Pcut==P[0]) {  
             __addPoints(Pcut,stopcut,pointslist1,pointslist2);  
             if(stopcut==3) {  
                 stopcut=1;  
             }  
         } else {  
             if(number==2) {  
                 if(Pcut==P[1]) {  
                     __addPoints(Pcut,stopcut,pointslist1,pointslist2);  
                     if(stopcut==3) {  
                         stopcut=1;  
                     }  
                 } else {  
                     __addPoints(Pcut,stopcut,pointslist1,pointslist2);  
                     if(stopcut==3) {  
                         stopcut=0;  
                     }  
                 }  
             } else {  
                 __addPoints(Pcut,stopcut,pointslist1,pointslist2);  
                 if(stopcut==3) {  
                     stopcut=0;  
                 }  
             }  
         }  
     }  
 }  
   
 void SurfaceMeshGenerator::Internals::  
1968  __createList(const TriangleCut& K,  __createList(const TriangleCut& K,
1969               std::vector<const Vertex*>& points,               std::vector<const Vertex*>& points,
1970               size_t& in,               size_t& in,
1971               size_t& in1,               size_t& in1,
1972               TinyVector<3,size_t>& place)               TinyVector<3,size_t> place)
1973  {  {
1974    TinyVector<2,const Vertex*> P;    TinyVector<2,const Vertex*> P;
1975    TinyVector<2,const Triangle*> T;    TinyVector<2,const Triangle*> T;
# Line 1957  __createList(const TriangleCut& K, Line 1978  __createList(const TriangleCut& K,
1978    size_t numberIn=K.isInTriangle[0]+K.isInTriangle[1]+K.isInTriangle[2];    size_t numberIn=K.isInTriangle[0]+K.isInTriangle[1]+K.isInTriangle[2];
1979    size_t stop=0,iInter=0,iCut=0;    size_t stop=0,iInter=0,iCut=0;
1980    //initialisation    //initialisation
1981    if(numberIn==3 or numberIn==2 and stop==0) {    if(numberIn==3) {
1982          points.push_back(&K(1));
1983          points.push_back(&K(2));
1984      }
1985      if(numberIn==2 and stop==0) {
1986      points.push_back(&K(in1));      points.push_back(&K(in1));
1987    }    }
1988    const Vertex* A=&K(in);    const Vertex* A=&K(in);
# Line 1996  __createList(const TriangleCut& K, Line 2021  __createList(const TriangleCut& K,
2021      } else {      } else {
2022        ffout(4)<<"******\n";        ffout(4)<<"******\n";
2023        ffout(4)<<"nb Inter "<<nbInter<<"\n";        ffout(4)<<"nb Inter "<<nbInter<<"\n";
2024        //ffout(4)<<"P0 = "<<P[0]<<" "<<*P[0]<<"\n";        ffout(4)<<"P0 = "<<P[0]<<*P[0]<<"\n";
2025        ffout(4)<<"place = "<<place<<"\n";        ffout(4)<<"K(2) = "<<K(2)<<&K(2)<<"\n";
2026        ffout(4)<<"pbs 0 existe pas\n";        ffout(4)<<"pbs 0 existe pas\n";
2027        //ffout(4)<<*K.pointsIntersection[2][0]<<"\n";        ffout(4)<<*K.pointsIntersection[0][0]<<"\n";
2028        //ffout(4)<<*K.pointsIntersection[2][1]<<"\n";        ffout(4)<<*K.pointsIntersection[1][0]<<"\n";
2029          ffout(4)<<K(0)<<"\n";
2030          ffout(4)<<K(1)<<"\n";
2031          ffout(4)<<K(2)<<"\n";
2032        points.clear();        points.clear();
2033        stop=1;        stop=1;
2034      }      }
# Line 2017  __createList(const TriangleCut& K, Line 2045  __createList(const TriangleCut& K,
2045      }      }
2046    }    }
2047    
2048    if(stop==0 and iInter==nbInter and nbInter==1 and numberIn==1) {    if(iInter==nbInter and nbInter==1 and numberIn==1) {
2049      //ATTENTION PEUT ETRE PLUS DE POINTS A PRENDRE      //ATTENTION PEUT ETRE PLUS DE POINTS A PRENDRE
2050      if(nbCut>1) {      if(nbCut>1) {
2051        const Vertex* PP=K.pointsIntersection[place[1]][0];        const Vertex* PP=K.pointsIntersection[place[1]][0];
# Line 2143  __findInEdges(const TriangleCut& K, Line 2171  __findInEdges(const TriangleCut& K,
2171          ++iInter;          ++iInter;
2172        } else {        } else {
2173          if(nbInter!=iInter) {          if(nbInter!=iInter) {
           ffout(4)<<nbInter<<" "<<iInter<<"\n";  
2174            ffout(4)<<"pbs on a plus de points\n";            ffout(4)<<"pbs on a plus de points\n";
2175              ffout(4)<<nbInter<<" "<<iInter<<"\n";
2176              ffout(4)<<K(0)<<"\n";
2177              ffout(4)<<K(1)<<"\n";
2178              ffout(4)<<K(2)<<"\n";
2179              ffout(4)<<"dernier "<<iCut<<" "<<*K.pointsIntersection[iCut][0]<<"\n";
2180          }          }
2181          stop=1;          stop=1;
2182        }        }
2183      }      }
2184    } else {    } else {
2185      if(nbInter!=iInter) {      if(nbInter!=iInter) {
2186          ffout(4)<<stop<<" pbs on a plus de points2\n";
2187        ffout(4)<<nbInter<<" "<<iInter<<"\n";        ffout(4)<<nbInter<<" "<<iInter<<"\n";
2188        ffout(4)<<"pbs on a plus de points2\n";        ffout(4)<<K(0)<<"\n";
2189          ffout(4)<<K(1)<<"\n";
2190          ffout(4)<<K(2)<<"\n";
2191      }      }
2192      stop=1;      stop=1;
2193    }    }
# Line 2271  std::vector<Triangulation::CurveVertex> Line 2306  std::vector<Triangulation::CurveVertex>
2306  std::vector<Triangulation::CurveVertex> curves(0);  std::vector<Triangulation::CurveVertex> curves(0);
2307            
2308      if(taille>3) {      if(taille>3) {
2309         //ffout(4)<<"je triangule\n";          ffout(4)<<"je triangule\n";
2310          ffout(4)<<++toto<<"\n";          ffout(4)<<"num = "<<++toto<<"\n";
2311          //verifions que les points ne s'intersectent pas avant de lancer la triangulation          //verifions que les points ne s'intersectent pas avant de lancer la triangulation
2312          bool isOK=false;          bool isOK=false;
2313          //ffout(4)<<"nb de points "<<taille<<" = ? "<<pointstrian.size()<<"\n";          //ffout(4)<<"nb de points "<<taille<<"\n";
2314          size_t ie=1;          size_t ie=1;
           
2315          while(ie<taille-2 and !isOK) {          while(ie<taille-2 and !isOK) {
             ffout(4)<<"--- "<<ie<<"\n";  
2316              isOK=checkInterbis(pointstrian[0],pointstrian[taille-1],pointstrian[ie],pointstrian[ie+1]);              isOK=checkInterbis(pointstrian[0],pointstrian[taille-1],pointstrian[ie],pointstrian[ie+1]);
2317              ++ie;              ++ie;
2318          }          }
         if(isOK) {  
             ffout(4)<<"points qui se coupent!!!!!!!\n";  
 //std::exit(0);  
         }  
2319          if(!isOK) {          if(!isOK) {
2320              //verification que les points ne sont pas trop proches!!              //verification que les points ne sont pas trop proches!!
2321              ie=0;              ie=0;
# Line 2297  std::vector<Triangulation::CurveVertex> Line 2326  std::vector<Triangulation::CurveVertex>
2326                  isOK=(norm<1e-6);                  isOK=(norm<1e-6);
2327                  ++ie;                  ++ie;
2328              }              }
2329              if(isOK) {          }
2330                  ffout(4)<<"des points sont trop proches!!!\n";          if(isOK) {
2331              }              ffout(4)<<"isok est vraie-----------\n";
2332          }          }
2333          if(!isOK) {          if(!isOK) {
2334              trgen.triangulize(pointstrian,              trgen.triangulize(pointstrian,
2335                         envVertex,                         envVertex,
2336                         holes,                         holes,
2337                         curves);                         curves);
2338              //ffout(4)<<"fin triangule-----\n";              ffout(4)<<"fin triangule-----\n";
2339              std::ofstream o("full.mesh");              std::ofstream o("full.mesh");
2340              trgen.export_mesh(o);              trgen.export_mesh(o);
2341                o.close();
2342              std::list<ConnectedTriangle> L=trgen.getTriangles();              std::list<ConnectedTriangle> L=trgen.getTriangles();
             if(L.size()==1) {  
                 ffout(4)<<"----------pbs mailleur\n";  
                 ffout(4)<<L.size()<<" ecrit\n";  
             }  
             if(toto==153) {  
 //std::exit(0);  
             }  
2343              for(std::list<ConnectedTriangle>::iterator itL=L.begin() ; itL!= L.end() ; itL++) {              for(std::list<ConnectedTriangle>::iterator itL=L.begin() ; itL!= L.end() ; itL++) {
2344                  Triangle T=(*itL);                  Triangle T=(*itL);
2345                  Vertex* P0=&T(0);                  Vertex* P0=&T(0);
# Line 2333  std::vector<Triangulation::CurveVertex> Line 2356  std::vector<Triangulation::CurveVertex>
2356              ffout(4)<<K(1)<<"\n";              ffout(4)<<K(1)<<"\n";
2357              ffout(4)<<K(2)<<"\n";              ffout(4)<<K(2)<<"\n";
2358          }          }
2359            //ffout(4)<<L.size()<<" ecrit\n";
2360      } else if(taille==3) {      } else if(taille==3) {
2361          //ffout(4)<<"je cree un triangle\n";          ffout(4)<<"je cree un triangle\n";
2362          __addTriangle(Triangle(*points[0],          __addTriangle(Triangle(*points[0],
2363                          *points[1],                          *points[1],
2364                          *points[2],                          *points[2],
# Line 2358  __createGeneral(const TriangleCut& K,con Line 2382  __createGeneral(const TriangleCut& K,con
2382    TinyVector<3,size_t> place;    TinyVector<3,size_t> place;
2383    std::vector<const Vertex*> points;    std::vector<const Vertex*> points;
2384        
2385    real_t epsilon=1e-7;    real_t epsilon=1e-6;
2386    real_t norm01=Norm(K(0)-K(1));    real_t norm01=Norm(K(0)-K(1));
2387    real_t norm02=Norm(K(0)-K(2));    real_t norm02=Norm(K(0)-K(2));
2388    real_t norm21=Norm(K(2)-K(1));    real_t norm21=Norm(K(2)-K(1));
# Line 2366  __createGeneral(const TriangleCut& K,con Line 2390  __createGeneral(const TriangleCut& K,con
2390    if(norm01<epsilon or norm02<epsilon or norm21<epsilon) {    if(norm01<epsilon or norm02<epsilon or norm21<epsilon) {
2391      ffout(4)<<"le triangle est tres tres tres plat\n";      ffout(4)<<"le triangle est tres tres tres plat\n";
2392    } else {    } else {
2393          if(norm01<epsilon or norm02<epsilon or norm21<epsilon) {
2394              ffout(4)<<"le triangle est tres tres tres plat\n";
2395          }
2396      //pour determiner le numero des edges cut et ceux des points in      //pour determiner le numero des edges cut et ceux des points in
2397      __createCase(K,in,in1,place);      __createCase(K,in,in1,place);
2398    
# Line 2379  __createGeneral(const TriangleCut& K,con Line 2405  __createGeneral(const TriangleCut& K,con
2405      }      }
2406    
2407         /////////////////////////////////////////////////////////////////////////////         /////////////////////////////////////////////////////////////////////////////
2408      Vertex A(-0.8,0.84641,0.775);      Vertex A(-0.000141,0.129744,0.110641);
2409      if(Norm(A-K(0))<1e-6 or Norm(A-K(1))<1e-6 or Norm(A-K(2))<1e-6 ){      if(Norm(A-K(0))<1e-6 or Norm(A-K(1))<1e-6 or Norm(A-K(2))<1e-6 ){
2410          ffout(4)<<"=============\n";          ffout(4)<<"=============\n";
2411          ffout(4)<<K(0)<<"\n";          ffout(4)<<K(0)<<"\n";
# Line 2413  __createGeneral(const TriangleCut& K,con Line 2439  __createGeneral(const TriangleCut& K,con
2439      }*/      }*/
2440      /////////////////////////////////////////////////////////////////////////////      /////////////////////////////////////////////////////////////////////////////
2441            
2442      //add vertex to VertexInTriangles if need      //add vertex to vertexInTriangles if need
2443      __addList(K);      __addList(K);
2444    
2445      //create the list "points"      //create the list "points"
2446      __createList(K,points,in,in1,place);      size_t numberOfPoints=vertexInTriangles.size()+K.isInTriangle[0]+K.isInTriangle[1]+K.isInTriangle[2];
2447        if(numberOfPoints>3) {
2448            __createList(K,points,in,in1,place);
2449        } else if(numberOfPoints==3) {
2450            //dans ce cas on a rien besoin de faire on cree un triangle
2451            ffout(4)<<"on a juste 3 points\n";
2452            std::vector<const Vertex*> PP;
2453            for(std::map<const Vertex*,TinyVector<2,const Triangle*> >::iterator jt=vertexInTriangles.begin()
2454         ; jt!=vertexInTriangles.end() ; jt++) {
2455                PP.push_back((*jt).first);
2456            }
2457            if(K.isInTriangle[0]==1) {
2458                PP.push_back(&K(0));
2459            }
2460            if(K.isInTriangle[1]==1) {
2461                PP.push_back(&K(1));
2462            }
2463            if(K.isInTriangle[2]==1) {
2464                PP.push_back(&K(2));
2465            }
2466            assert(PP.size()==3);
2467            real_t norm0=Norm(*PP[0]-*PP[1]);
2468            real_t norm1=Norm(*PP[0]-*PP[2]);
2469            real_t norm2=Norm(*PP[2]-*PP[1]);
2470            if(norm0>1e-6 and norm1>1e-6 and norm2>1e-6) {
2471                __addTriangle(Triangle(*PP[0],*PP[1],*PP[2],K.reference()),cell,triangleListIntersectionNew);
2472            }
2473            
2474        } else {
2475            ffout(4)<<"moins de 3 points\n";
2476        }
2477    
2478      size_t taille=points.size();      size_t taille=points.size();
2479      // met les points dans le plan du triangle      // met les points dans le plan du triangle
2480      std::vector<Vertex> pointstrian(taille);      std::vector<Vertex> pointstrian(taille);
2481      ffout(4)<<"points size "<<taille<<"\n";      if(taille!=0) {
2482          ffout(4)<<"points size "<<taille<<"\n";
2483        }
2484    
2485      __transformVertex(K,points,pointstrian);      __transformVertex(K,points,pointstrian);
2486            
2487      if(K.isInTriangle[0]+K.isInTriangle[1]+K.isInTriangle[2]==2 and      if(K.isInTriangle[0]+K.isInTriangle[1]+K.isInTriangle[2]==2 and
2488         K.edgecut[place[2]][0]!=0) {         K.edgecut[place[2]][0]!=0 and taille!=0) {
2489          ffout(4)<<"on est dans un cas a traiter pour le mailleur\n";          ffout(4)<<"on est dans un cas a traiter pour le mailleur\n";
2490          ffout(4)<<K(0)<<"\n";          ffout(4)<<K(0)<<"\n";
2491          ffout(4)<<K(1)<<"\n";          ffout(4)<<K(1)<<"\n";
# Line 2438  __createGeneral(const TriangleCut& K,con Line 2497  __createGeneral(const TriangleCut& K,con
2497          switch (number) {          switch (number) {
2498              case 1: {              case 1: {
2499                  P[0]=K.pointsIntersection[place[2]][0];                  P[0]=K.pointsIntersection[place[2]][0];
                 P[1]=K.pointsIntersection[place[2]][0];  
2500                  break;                  break;
2501              }              }
2502              case 2: {              case 2: {
# Line 2449  __createGeneral(const TriangleCut& K,con Line 2507  __createGeneral(const TriangleCut& K,con
2507          }          }
2508          std::vector<const Vertex*> pointslist1;          std::vector<const Vertex*> pointslist1;
2509          std::vector<const Vertex*> pointslist2;          std::vector<const Vertex*> pointslist2;
2510            
2511          __create2List(K,P,points,pointslist1,pointslist2);          size_t stopcut=0;
2512            for(unsigned ie=1;ie<taille;++ie) {
2513                const Vertex* Pcut=points[ie];
2514                //ffout(4)<<*Pcut<<"\n";
2515                const Vertex& Pcutplan=pointstrian[ie];
2516                if(Pcut==P[0]) {
2517                    __addPoints(Pcut,stopcut,pointslist1,pointslist2);
2518                    if(stopcut==3) {
2519                        stopcut=1;
2520                    }
2521                } else {
2522                    if(number==2) {
2523                        if(Pcut==P[1]) {
2524                            __addPoints(Pcut,stopcut,pointslist1,pointslist2);
2525                            if(stopcut==3) {
2526                                stopcut=1;
2527                            }
2528                        } else {
2529                            __addPoints(Pcut,stopcut,pointslist1,pointslist2);
2530                            if(stopcut==3) {
2531                                stopcut=0;
2532                            }
2533                        }
2534                    } else {
2535                        __addPoints(Pcut,stopcut,pointslist1,pointslist2);
2536                        if(stopcut==3) {
2537                            stopcut=0;
2538                        }
2539                    }
2540                }
2541            }
2542          pointslist2.push_back(points[0]);          pointslist2.push_back(points[0]);
2543          /*//verif des listes          //verif des listes
2544          ffout(4)<<"taille de list1 = "<<pointslist1.size()<<"\n";          ffout(4)<<"taille de list1 = "<<pointslist1.size()<<"\n";
2545          for(unsigned ie=0;ie<pointslist1.size();++ie) {          for(unsigned ie=0;ie<pointslist1.size();++ie) {
2546              ffout(4)<<*pointslist1[ie]<<"\n";              ffout(4)<<*pointslist1[ie]<<"\n";
# Line 2460  __createGeneral(const TriangleCut& K,con Line 2548  __createGeneral(const TriangleCut& K,con
2548          ffout(4)<<"taille de list2 = "<<pointslist2.size()<<"\n";          ffout(4)<<"taille de list2 = "<<pointslist2.size()<<"\n";
2549          for(unsigned ie=0;ie<pointslist2.size();++ie) {          for(unsigned ie=0;ie<pointslist2.size();++ie) {
2550              ffout(4)<<*pointslist2[ie]<<"\n";              ffout(4)<<*pointslist2[ie]<<"\n";
2551          }*/          }
2552          //on cree les 2 maillages          //on cree les 2 maillages
2553          if(pointslist1.size()>=3) {          if(pointslist1.size()>=3) {
2554              std::vector<Vertex> pointslist1plan(pointslist1.size());              std::vector<Vertex> pointslist1plan(pointslist1.size());
# Line 2473  __createGeneral(const TriangleCut& K,con Line 2561  __createGeneral(const TriangleCut& K,con
2561              __createTriangle(K,cell,triangleListIntersectionNew,pointslist2,pointslist2plan);              __createTriangle(K,cell,triangleListIntersectionNew,pointslist2,pointslist2plan);
2562          }          }
2563      } else if(K.isInTriangle[0]+K.isInTriangle[1]+K.isInTriangle[2]==3) {      } else if(K.isInTriangle[0]+K.isInTriangle[1]+K.isInTriangle[2]==3) {
2564          ffout(4)<<"cas 3 in\n";          ffout(4)<<"----------------- cas 3 in\n";
2565          size_t number=K.edgecut[0][0]+K.edgecut[1][0]+K.edgecut[2][0];          size_t number=K.edgecut[0][0]+K.edgecut[1][0]+K.edgecut[2][0];
2566          if(number==1) {          if(number==1) {
2567              TinyVector<2,const Vertex*> P;              TinyVector<2,const Vertex*> P;
# Line 2491  __createGeneral(const TriangleCut& K,con Line 2579  __createGeneral(const TriangleCut& K,con
2579              }              }
2580              std::vector<const Vertex*> pointslist1;              std::vector<const Vertex*> pointslist1;
2581              std::vector<const Vertex*> pointslist2;              std::vector<const Vertex*> pointslist2;
2582              if(numberP==1) {              size_t stopcut=0;
2583                  __create2List(K,P,points,pointslist1,pointslist2);              for(unsigned ie=1;ie<taille;++ie) {
2584                  pointslist1.push_back(&K(in1));                  const Vertex* Pcut=points[ie];
2585                  pointslist2.push_back(&K(in1));                  //ffout(4)<<*Pcut<<"\n";
2586                  pointslist2.push_back(P[0]);                  if(Pcut==P[0]) {
2587              } else {                      __addPoints(Pcut,stopcut,pointslist1,pointslist2);
2588                  //il faut creer 3 list!!!                      if(stopcut==3) {
2589                  std::vector<const Vertex*> pointslist3;                          stopcut=1;
2590                  size_t stopcut=0;                      }
2591                  for(unsigned ie=1;ie<taille;++ie) {                  } else {
2592                      const Vertex* Pcut=points[ie];                      if(number==2) {
2593                      if(Pcut==P[0]) {                          if(Pcut==P[1]) {
                         if(stopcut==0) {  
2594                              __addPoints(Pcut,stopcut,pointslist1,pointslist2);                              __addPoints(Pcut,stopcut,pointslist1,pointslist2);
2595                              if(stopcut==3) {                              if(stopcut==3) {
2596                                  stopcut=1;                                  stopcut=1;
2597                              }                              }
                         } else if(stopcut==1) {  
                             stopcut=0;  
                             __addPoints(Pcut,stopcut,pointslist2,pointslist3);  
                             if(stopcut==3) {  
                                 stopcut=2;  
                             } else {  
                                 stopcut=1;  
                             }  
2598                          } else {                          } else {
                             ffout(4)<<"stopcut==2 on devrait avoir fini\n";  
                         }  
                     } else if(Pcut==P[1]) {  
                         if(stopcut==0) {  
2599                              __addPoints(Pcut,stopcut,pointslist1,pointslist2);                              __addPoints(Pcut,stopcut,pointslist1,pointslist2);
2600                              if(stopcut==3) {                              if(stopcut==3) {
2601                                  stopcut=1;                                  stopcut=0;
                             }  
                         } else if(stopcut==1) {  
                             stopcut=0;  
                             __addPoints(Pcut,stopcut,pointslist2,pointslist3);  
                             if(stopcut==3) {  
                                 stopcut=2;  
                             } else {  
                                 stopcut=1;  
2602                              }                              }
                         } else {  
                             ffout(4)<<"stopcut==22 on devrait avoir fini\n";  
2603                          }                          }
2604                      } else {                      } else {
2605                              if(stopcut==0) {                          __addPoints(Pcut,stopcut,pointslist1,pointslist2);
2606                                  __addPoints(Pcut,stopcut,pointslist1,pointslist2);                          if(stopcut==3) {
2607                                  stopcut=0;                              stopcut=0;
2608                              } else if(stopcut==1) {                          }
                                 stopcut=0;  
                                 __addPoints(Pcut,stopcut,pointslist2,pointslist3);  
                                 stopcut=1;  
                             } else {  
                                 stopcut=0;  
                                 __addPoints(Pcut,stopcut,pointslist3,pointslist3);  
                                 stopcut=2;  
                             }  
2609                      }                      }
2610                  }                  }
                 pointslist1.push_back(&K(in1));  
                 pointslist2.push_back(&K(in1));  
                 pointslist2.push_back(P[0]);  
                 size_t in2=0;  
                 if(in+in1==1) {  
                     in2=2;  
                 } else if(in+in1==2) {  
                     in2=1;  
                 }  
                 pointslist3.push_back(&K(in2));  
                 pointslist3.push_back(&K(in1));  
                 pointslist3.push_back(P[1]);  
                 if(pointslist3.size()>=3) {  
                      std::vector<Vertex> pointslist3plan(pointslist3.size());  
                     __transformVertex(K,pointslist3,pointslist3plan);  
                     __createTriangle(K,cell,triangleListIntersectionNew,pointslist3,pointslist3plan);  
                 }  
                   
   
2611              }              }
2612                pointslist2.push_back(points[0]);
2613                pointslist2.push_back(points[1]);
2614                pointslist2.push_back(P[0]);
2615    
2616              //on cree les 2 maillages              //on cree les 2 maillages
2617              if(pointslist1.size()>=3) {              if(pointslist1.size()>=3) {
2618                   std::vector<Vertex> pointslist1plan(pointslist1.size());                   std::vector<Vertex> pointslist1plan(pointslist1.size());
2619                  __transformVertex(K,pointslist1,pointslist1plan);                  __transformVertex(K,pointslist1,pointslist1plan);
2620                  __createTriangle(K,cell,triangleListIntersectionNew,pointslist1,pointslist1plan);                  __createTriangle(K,cell,triangleListIntersectionNew,pointslist1,pointslist1plan);
2621              }              }
             ffout(4)<<"taille de list2 = "<<pointslist2.size()<<"\n";  
             for(unsigned ie=0;ie<pointslist2.size();++ie) {  
                 ffout(4)<<*pointslist2[ie]<<"\n";  
             }  
2622              if(pointslist2.size()>=3) {              if(pointslist2.size()>=3) {
2623                  std::vector<Vertex> pointslist2plan(pointslist2.size());                  std::vector<Vertex> pointslist2plan(pointslist2.size());
2624                  __transformVertex(K,pointslist2,pointslist2plan);                  __transformVertex(K,pointslist2,pointslist2plan);
# Line 2620  __createTrianglesIntersection(const size Line 2658  __createTrianglesIntersection(const size
2658    size_t objectNumber=0;    size_t objectNumber=0;
2659    if(numobject==0)    if(numobject==0)
2660      objectNumber=1;      objectNumber=1;
2661    (*edgesRefVertex[numobject]).clear();    // (*edgesRefVertex[numobject]).clear();
2662    const MapCellTriangle& hexaToTriangle0=*(O1.hexalist);    const MapCellTriangle& hexaToTriangle0=*(O1.hexalist);
2663    
2664        
# Line 2724  __createTrianglesIntersection(const size Line 2762  __createTrianglesIntersection(const size
2762            ffout(4)<<"cas pbssssss\n";            ffout(4)<<"cas pbssssss\n";
2763            ffout(4)<<(*edgesRefVertex[numobject])[&K(0)]<<" "<<(*edgesRefVertex[numobject])[&K(1)]<<            ffout(4)<<(*edgesRefVertex[numobject])[&K(0)]<<" "<<(*edgesRefVertex[numobject])[&K(1)]<<
2764              " "<<(*edgesRefVertex[numobject])[&K(2)]<<" "<<K.edgecut<<"\n";              " "<<(*edgesRefVertex[numobject])[&K(2)]<<" "<<K.edgecut<<"\n";
2765             //__addTriangle(Triangle(K(0),K(1),K(2),K.reference()),*i,triangleListIntersectionNew);            // __addTriangle(Triangle(K(0),K(1),K(2),K.reference()),*i,triangleListIntersectionNew);
2766    
2767          }          }
2768          if(K.edgecut[0][0]+K.edgecut[1][0]+K.edgecut[2][0]>=6) {          if(K.edgecut[0][0]+K.edgecut[1][0]+K.edgecut[2][0]>=6) {
# Line 2763  __createTrianglesIntersection(const size Line 2801  __createTrianglesIntersection(const size
2801                __createGeneral(K,*i,triangleListIntersectionNew);                __createGeneral(K,*i,triangleListIntersectionNew);
2802              } else {              } else {
2803                ffout(4)<<"1------------\n";                ffout(4)<<"1------------\n";
2804                ffout(4)<<K.edgecut[0]<<" "<<K.edgecut[1]<<" "<<K.edgecut[2]<<"\n";                //ffout(4)<<K.edgecut[0]<<" "<<K.edgecut[1]<<" "<<K.edgecut[2]<<"\n";
2805                __createGeneral(K, *i, triangleListIntersectionNew);                __createGeneral(K, *i, triangleListIntersectionNew);
2806              }              }
2807            } else {            } else {
2808              ffout(4)<<"2------------\n";              ffout(4)<<"2------------\n";
2809              ffout(4)<<K.edgecut[0]<<" "<<K.edgecut[1]<<" "<<K.edgecut[2]<<"\n";              //ffout(4)<<K.edgecut[0]<<" "<<K.edgecut[1]<<" "<<K.edgecut[2]<<"\n";
2810              __createGeneral(K, *i, triangleListIntersectionNew);              __createGeneral(K, *i, triangleListIntersectionNew);
2811            }            }
2812            break;            break;
2813          }          }
2814          case 2: {          case 2: {
2815            if(K.edgecut[0][0]+K.edgecut[1][0]+K.edgecut[2][0]<2) {            if(K.edgecut[0][0]+K.edgecut[1][0]+K.edgecut[2][0]<2) {
2816              ffout(4)<<"------------ pbs pas assez d'edge cut \n";              ffout(4)<<"pbs pas assez d'edge cut \n";
               ffout(4)<<K.edgecut<<"\n";  
               ffout(4)<<K(0)<<"\n";  
               ffout(4)<<K(1)<<"\n";  
               ffout(4)<<K(2)<<"\n";  
2817            } else {            } else {
2818              ffout(4)<<"---------- case 2\n";              ffout(4)<<"---------- case 2\n";
2819              ffout(4)<<K.edgecut[0]<<" "<<K.edgecut[1]<<" "<<K.edgecut[2]<<"\n";              //ffout(4)<<K.edgecut[0]<<" "<<K.edgecut[1]<<" "<<K.edgecut[2]<<"\n";
2820              __createGeneral(K, *i, triangleListIntersectionNew);              __createGeneral(K, *i, triangleListIntersectionNew);
2821            }            }
2822            break;            break;
# Line 2791  __createTrianglesIntersection(const size Line 2825  __createTrianglesIntersection(const size
2825            if(K.edgecut[0]+K.edgecut[1]+K.edgecut[2]==0) {            if(K.edgecut[0]+K.edgecut[1]+K.edgecut[2]==0) {
2826              __addTriangle(*T,*i,triangleListIntersectionNew);              __addTriangle(*T,*i,triangleListIntersectionNew);
2827            } else {            } else {
2828              if(K.edgecut[0][0]+K.edgecut[1][0]+K.edgecut[2][0]==3) {                ffout(4)<<"------------ 3 in cas traite\n";
2829                  __createGeneral(K, *i, triangleListIntersectionNew);                __createGeneral(K, *i, triangleListIntersectionNew);
               ffout(4)<<"cas a traiter-------------\n";  
             } else {  
                 ffout(4)<<"cas pas traite\n";  
                 ffout(4)<<K.edgecut[0][0]<<" "<<K.edgecut[1][0]<<" "<<K.edgecut[2][0]<<"\n";  
                 __createGeneral(K, *i, triangleListIntersectionNew);  
             }  
2830            }            }
2831            break;            break;
2832          }          }
# Line 3591  generateSurfacicMesh(const Domain& omega Line 3619  generateSurfacicMesh(const Domain& omega
3619        }        }
3620      }      }
3621    }    }
3622    ffout(4)<<"****************************il manque "<<compt<<" sommets\n";    ffout(4)<<"****************************il manque "<<compt<<" sommets\n";*/
3623    /////////////////////////////////////////////////////////////////////////////    /////////////////////////////////////////////////////////////////////////////
3624  */  
3625    int n0=0, n1=0;    int n0=0, n1=0;
3626    
3627  #warning REMOVE THIS CALL  #warning REMOVE THIS CALL

Legend:
Removed from v.1.53  
changed lines
  Added in v.1.54

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