/[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.36 by delpinux, Sun Sep 14 17:17:47 2003 UTC revision 1.37 by dobj, Mon Sep 15 16:13:46 2003 UTC
# Line 303  private: Line 303  private:
303                                                          const Triangle*& currentTriangle,                                                          const Triangle*& currentTriangle,
304                                                          const Cell* cell);                                                          const Cell* cell);
305    
306    void __putEdgeRef(const Triangle*& currentTriangle,    void __putEdgeRef(const Triangle*& Tmesh,
307                        const Triangle*& T,
308                      const size_t numobject,                      const size_t numobject,
309                      const ObjectToTreat& O1,                      const ObjectToTreat& O1,
310                      const ObjectToTreat& O2);                      const ObjectToTreat& O2);
# Line 1331  __createCase1(int ncase, Line 1332  __createCase1(int ncase,
1332          ffout(4)<<V0<<"\n";          ffout(4)<<V0<<"\n";
1333          ffout(4)<<V1<<"\n";          ffout(4)<<V1<<"\n";
1334          ffout(4)<<V2<<"\n";          ffout(4)<<V2<<"\n";
1335            ffout(4)<<edgesCut<<"\n";
1336        }        }
1337      } else {      } else {
1338        if(edgesCut[1]==1) {        if(edgesCut[1]==1) {
# Line 1338  __createCase1(int ncase, Line 1340  __createCase1(int ncase,
1340          ffout(4)<<V0<<"\n";          ffout(4)<<V0<<"\n";
1341          ffout(4)<<V1<<"\n";          ffout(4)<<V1<<"\n";
1342          ffout(4)<<V2<<"\n";          ffout(4)<<V2<<"\n";
1343          ffout(4)<<ncase<<"\n";          ffout(4)<<edgesCut<<"\n";
         ffout(4)<<__determinateNumber(vertexNum[1],pointsIntersection)<<"\n";  
1344        } else {        } else {
1345          ffout(4) <<"pbs 111\n";           // if(edgesCut==0) {
1346               //  __addTriangle(Triangle(V0,V1,V2,K.reference()),cell,triangleListIntersectionNew);
1347              //} else {
1348                  ffout(4) <<"pbs 111\n";
1349                  ffout(4)<<edgesCut<<"\n";
1350              //}
1351        }        }
1352      }      }
1353      break;      break;
# Line 1459  __createCase2(int ncase, Line 1465  __createCase2(int ncase,
1465          ffout(4)<<V0<<"\n";          ffout(4)<<V0<<"\n";
1466          ffout(4)<<V1<<"\n";          ffout(4)<<V1<<"\n";
1467          ffout(4)<<V2<<"\n";          ffout(4)<<V2<<"\n";
1468            ffout(4)<<edgesCut2<<"\n";
1469        }        }
1470      }      }
1471      break;      break;
# Line 1764  __putRefByFront(const size_t numobject, Line 1771  __putRefByFront(const size_t numobject,
1771      objectNumber=1;      objectNumber=1;
1772    size_t nbcell=surfmesh.numberOfCells();    size_t nbcell=surfmesh.numberOfCells();
1773    //initialize the front    //initialize the front
1774      ffout(4)<<"taille de totreatHexahedra = "<<toTreatHexahedra.size()<<"\n";
1775    size_t i=0;    size_t i=0;
1776    while(i<nbcell) {    while(i<nbcell) {
1777      const Triangle* T=&(surfmesh.cell(i));      const Triangle* T=&(surfmesh.cell(i));
1778      const Cell* cell=&((*T).mother());      const Cell* cell=&((*T).mother());
1779      if(toTreatHexahedra.find(cell)!=toTreatHexahedra.end()      if(toTreatHexahedra.find(cell)!=toTreatHexahedra.end()
1780         and (*edgesRefVertex[numobject])[&(*T)(0)]+         /*and ((*edgesRefVertex[numobject])[&(*T)(0)]!=0
1781         (*edgesRefVertex[numobject])[&(*T)(1)]+        or (*edgesRefVertex[numobject])[&(*T)(1)]!=0
1782         (*edgesRefVertex[numobject])[&(*T)(2)]!=0) {        or (*edgesRefVertex[numobject])[&(*T)(2)]!=0)*/) {
1783        front.push_front(T);        front.push_front(T);
1784        const Triangle*& TT=(*listOfTriangleMeshFront.find(T)).second;        const Triangle*& TT=(*listOfTriangleMeshFront.find(T)).second;
1785        // on traite le triangle du front        // on traite le triangle du front
1786        __putEdgeRef(TT,numobject,O1,O2);        __putEdgeRef(T,TT,numobject,O1,O2);
1787      }      }
1788      ++i;      ++i;
1789    }    }
1790        
1791    size_t iter=0;    size_t iter=0;
1792    ffout(0)<<"taille initial du front ="<<front.size()<<"\n";    ffout(0)<<"taille initial du front ="<<front.size()<<"\n";
1793      //if(front.size()==0)
1794          ffout(0)<<"ref de surfmesh = "<<surfmesh.cell(0).reference()<<"\n";
1795    //put reference by front    //put reference by front
1796      size_t erase=0;
1797    while(front.size()!=0 and iter<nbcell) {    while(front.size()!=0 and iter<nbcell) {
1798      std::list<const Triangle*>::iterator er=front.begin() ;      std::list<const Triangle*>::iterator er=front.begin() ;
1799      for(std::list<const Triangle*>::iterator jt0=front.begin() ;      for(std::list<const Triangle*>::iterator jt0=front.begin() ;
1800          jt0!=front.end() ; ++jt0) {          jt0!=front.end() ; ++jt0) {
1801        if(jt0!=front.begin())        if(jt0!=front.begin() and erase==1)
1802          er=front.erase(er);          er=front.erase(er);
1803        er=jt0;        er=jt0;
1804          erase=0;
1805        const Triangle* T=*jt0;        const Triangle* T=*jt0;
1806          const Triangle*& TTo=(*listOfTriangleMeshFront.find(T)).second;
1807          const Vertex& Vo0 = (*TTo)(0);
1808          const Vertex& Vo1 = (*TTo)(1);
1809          const Vertex& Vo2 = (*TTo)(2);
1810          TriangleCut Kneigho(Vo0,Vo1,Vo2,numobject,objectNumber);
1811          const Cell* cello=&((*TTo).mother());
1812          Kneigho.edgecut =__determinateEdgeCut(numobject,O1,O2,TTo,cello);
1813          TinyVector<2,int> edgeo0=Kneigho.edgecut[0];
1814          TinyVector<2,int> edgeo1=Kneigho.edgecut[1];
1815          TinyVector<2,int> edgeo2=Kneigho.edgecut[2];
1816          //__putEdgeRef(T,TTo,numobject,O1,O2);
1817          size_t& refo0=(*edgesRefVertex[numobject])[&(*T)(0)];
1818          size_t& refo1=(*edgesRefVertex[numobject])[&(*T)(1)];
1819          size_t& refo2=(*edgesRefVertex[numobject])[&(*T)(2)];
1820              
1821          if((refo0+refo1+refo2!=0 and refo0+refo1+refo2!=6 and edgeo0+edgeo1+edgeo2==0)
1822             /*or (edgeo0[0]==1 and refo0+refo1!=2 and refo0+refo1+refo2!=0)
1823             or (edgeo1[0]==1 and refo0+refo2!=2 and refo0+refo1+refo2!=0)
1824             or (edgeo2[0]==1 and refo2+refo1!=2 and refo0+refo1+refo2!=0)*/) {
1825              ffout(4)<<"chouette on garde\n";
1826              erase=0;
1827          } else {
1828              erase=1;
1829          }
1830        TinyVector<3,const Triangle*> V=connect(surfmesh.cellNumber(*T));        TinyVector<3,const Triangle*> V=connect(surfmesh.cellNumber(*T));
1831                
1832        for(size_t j=0 ; j<3 ; ++j) {        for(size_t j=0 ; j<3 ; ++j) {
# Line 1798  __putRefByFront(const size_t numobject, Line 1834  __putRefByFront(const size_t numobject,
1834          if(V[j]!=0){          if(V[j]!=0){
1835            const Triangle* triangle=V[j];            const Triangle* triangle=V[j];
1836            const Triangle*& TT=(*listOfTriangleMeshFront.find(triangle)).second;            const Triangle*& TT=(*listOfTriangleMeshFront.find(triangle)).second;
1837            const Vertex& V0 = (*T)(0);            const Vertex& V0 = (*TT)(0);
1838            const Vertex& V1 = (*T)(1);            const Vertex& V1 = (*TT)(1);
1839            const Vertex& V2 = (*T)(2);            const Vertex& V2 = (*TT)(2);
1840            TriangleCut Kneigh(V0,V1,V2,numobject,objectNumber);            TriangleCut Kneigh(V0,V1,V2,numobject,objectNumber);
1841            const Cell* cell=&((*TT).mother());            const Cell* cell=&((*TT).mother());
1842            Kneigh.edgecut =__determinateEdgeCut(numobject,O1,O2,TT,cell);            Kneigh.edgecut =__determinateEdgeCut(numobject,O1,O2,TT,cell);
# Line 1808  __putRefByFront(const size_t numobject, Line 1844  __putRefByFront(const size_t numobject,
1844            size_t& ref1=(*edgesRefVertex[numobject])[&(*triangle)(1)];            size_t& ref1=(*edgesRefVertex[numobject])[&(*triangle)(1)];
1845            size_t& ref2=(*edgesRefVertex[numobject])[&(*triangle)(2)];            size_t& ref2=(*edgesRefVertex[numobject])[&(*triangle)(2)];
1846                        
1847            if(!(ref0==2 and ref1==2 and ref2==2)) {            if(ref0+ref1+ref2!=6) {
1848              //ffout(0)<<"le voisin n'est pas de ref 2\n";              //ffout(0)<<"le voisin n'est pas de ref 2\n";
1849              //ffout(0)<<"avt "<<ref0<<" "<<ref1<<" "<<ref2<<"\n";              //ffout(0)<<"avt "<<ref0<<" "<<ref1<<" "<<ref2<<"\n";
1850                size_t test=0;
1851              TinyVector<2,int> edge0=Kneigh.edgecut[0];              TinyVector<2,int> edge0=Kneigh.edgecut[0];
1852              TinyVector<2,int> edge1=Kneigh.edgecut[1];              TinyVector<2,int> edge1=Kneigh.edgecut[1];
1853              TinyVector<2,int> edge2=Kneigh.edgecut[2];              TinyVector<2,int> edge2=Kneigh.edgecut[2];
1854              if(ref0+ref1==2 and edge0[0]==0) {              if(edge0+edge1+edge2==0 and ref0+ref1+ref2!=0 and ref0+ref1+ref2!=6) {
1855                    ref0=2;
1856                    ref1=2;
1857                    ref2=2;
1858                    test=1;
1859                } else {
1860                if(ref0+ref1==2 and edge0==0) {
1861                  test=1;
1862                ref0=2;                ref0=2;
1863                ref1=2;                ref1=2;
1864                } else if(edge0[0]==1 and ref0+ref1!=2 and ref0+ref1+ref2!=0){
1865                    //test=1;
1866              }              }
1867              if(ref0+ref2==2 and edge1[0]==0) {              if(ref0+ref2==2 and edge1==0) {
1868                  test=1;
1869                ref0=2;                ref0=2;
1870                ref2=2;                ref2=2;
1871                } else if(edge1[0]==1 and ref0+ref2!=2 and ref0+ref1+ref2!=0){
1872                    //test=1;
1873              }              }
1874              if(ref2+ref1==2 and edge2[0]==0) {              if(ref2+ref1==2 and edge2==0) {
1875                  test=1;
1876                ref2=2;                ref2=2;
1877                ref1=2;                ref1=2;
1878                } else if(edge2[0]==1 and ref2+ref1!=2 and ref0+ref1+ref2!=0){
1879                    //test=1;
1880              }              }
1881              if(ref0+ref1+ref2==6 or edge0[0]+edge1[0]+edge2[0]==1) {              }
1882                //ffout(0)<<"on rajoute le triangle au front\n";              if(test==1/*ref0+ref1+ref2==6 */or edge0[0]+edge1[0]+edge2[0]==1) {
1883                front.push_front(triangle);                front.push_front(triangle);
1884              }              }
1885              //ffout(0)<<ref0<<" "<<ref1<<" "<<ref2<<"\n";              //ffout(0)<<ref0<<" "<<ref1<<" "<<ref2<<"\n";
# Line 1835  __putRefByFront(const size_t numobject, Line 1887  __putRefByFront(const size_t numobject,
1887          }          }
1888        }        }
1889      }      }
1890      er=front.erase(er);      if(erase==1 and front.size()==1)
1891            er=front.erase(er);
1892      ++iter;      ++iter;
1893      ffout(0)<<"taille du front = "<<front.size()<<" "<<iter<<" "<<nbcell<<"\n";      ffout(0)<<"taille du front = "<<front.size()<<" "<<iter<<" "<<nbcell<<"\n";
1894    }    }
# Line 1843  __putRefByFront(const size_t numobject, Line 1896  __putRefByFront(const size_t numobject,
1896  }  }
1897    
1898  void SurfaceMeshGenerator::Internals::  void SurfaceMeshGenerator::Internals::
1899  __putEdgeRef(const Triangle*& T,  __putEdgeRef(const Triangle*& Tmesh,
1900                 const Triangle*& T,
1901               const size_t numobject,               const size_t numobject,
1902               const ObjectToTreat& O1,               const ObjectToTreat& O1,
1903               const ObjectToTreat& O2 )               const ObjectToTreat& O2 )
# Line 1854  __putEdgeRef(const Triangle*& T, Line 1908  __putEdgeRef(const Triangle*& T,
1908      TinyVector<3,TinyVector<2,int> > edgecut;      TinyVector<3,TinyVector<2,int> > edgecut;
1909      const Cell* cell=&((*T).mother());      const Cell* cell=&((*T).mother());
1910      edgecut =__determinateEdgeCut(numobject,O1,O2,T,cell);      edgecut =__determinateEdgeCut(numobject,O1,O2,T,cell);
1911      size_t& ref0=(*edgesRefVertex[numobject])[&(*T)(0)];      size_t& ref0=(*edgesRefVertex[numobject])[&(*Tmesh)(0)];
1912      size_t& ref1=(*edgesRefVertex[numobject])[&(*T)(1)];      size_t& ref1=(*edgesRefVertex[numobject])[&(*Tmesh)(1)];
1913      size_t& ref2=(*edgesRefVertex[numobject])[&(*T)(2)];      size_t& ref2=(*edgesRefVertex[numobject])[&(*Tmesh)(2)];
1914      if(!(ref0==2 and ref1==2 and ref2==2)) {      if(!(ref0==2 and ref1==2 and ref2==2)) {
1915          TinyVector<2,int> edge0=edgecut[0];          TinyVector<2,int> edge0=edgecut[0];
1916          TinyVector<2,int> edge1=edgecut[1];          TinyVector<2,int> edge1=edgecut[1];
1917          TinyVector<2,int> edge2=edgecut[2];          TinyVector<2,int> edge2=edgecut[2];
1918          if(ref0+ref1==2 and edge0[0]==0) {          if(ref0+ref1==2 and edge0==0) {
1919              ref0=2;              ref0=2;
1920              ref1=2;              ref1=2;
1921          }          }
1922          if(ref0+ref2==2 and edge1[0]==0) {          if(ref0+ref2==2 and edge1==0) {
1923              ref0=2;              ref0=2;
1924              ref2=2;              ref2=2;
1925          }          }
1926          if(ref2+ref1==2 and edge2[0]==0) {          if(ref2+ref1==2 and edge2==0) {
1927              ref2=2;              ref2=2;
1928              ref1=2;              ref1=2;
1929          }          }
# Line 2290  __createTrianglesIntersection(const size Line 2344  __createTrianglesIntersection(const size
2344                         toTreatHexahedra.begin(), toTreatHexahedra.end(),                         toTreatHexahedra.begin(), toTreatHexahedra.end(),
2345                         inserter(hexaListIn, hexaListIn.begin()));                         inserter(hexaListIn, hexaListIn.begin()));
2346        
     
2347    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) {
2348      Cell& C = const_cast<Cell&>(*(*icell));      Cell& C = const_cast<Cell&>(*(*icell));
2349      for (size_t i=0; i<C.numberOfVertices(); ++i) {      for (size_t i=0; i<C.numberOfVertices(); ++i) {
# Line 2316  __createTrianglesIntersection(const size Line 2369  __createTrianglesIntersection(const size
2369          Triangle& T = (*(*jt0));          Triangle& T = (*(*jt0));
2370          for (size_t n=0; n<3; ++n) {          for (size_t n=0; n<3; ++n) {
2371            (*edgesRefVertex[numobject])[&T(n)]=ref;            (*edgesRefVertex[numobject])[&T(n)]=ref;
2372                //put ref 2 for points of surfmesh
2373                const Vertex* P0=(*listOfVertexMesh.find(&T(n))).second;
2374                (*edgesRefVertex[numobject])[P0]=ref;
2375          }          }
2376    
2377          if((*edgesRefVertex[numobject])[&T(0)]==2          if((*edgesRefVertex[numobject])[&T(0)]==2
2378             and (*edgesRefVertex[numobject])[&T(1)]==2             and (*edgesRefVertex[numobject])[&T(1)]==2
2379             and (*edgesRefVertex[numobject])[&T(2)]==2) {             and (*edgesRefVertex[numobject])[&T(2)]==2) {
2380            __addTriangle(T, &T.mother(),triangleListIntersectionNew);            __addTriangle(T, &T.mother(),triangleListIntersectionNew);
             //put ref 2 for points of surfmesh  
             const Vertex* P0=(*listOfVertexMesh.find(&T(0))).second;  
             const Vertex* P1=(*listOfVertexMesh.find(&T(1))).second;  
             const Vertex* P2=(*listOfVertexMesh.find(&T(2))).second;  
             (*edgesRefVertex[numobject])[P0]=2;  
             (*edgesRefVertex[numobject])[P1]=2;  
             (*edgesRefVertex[numobject])[P2]=2;  
2381          }          }
2382        }        }
2383      }      }
# Line 2372  __createTrianglesIntersection(const size Line 2421  __createTrianglesIntersection(const size
2421              K.isInTriangle[k]=0;              K.isInTriangle[k]=0;
2422          }          }
2423          }          }
2424                    if((*edgesRefVertex[numobject])[&K(0)]+ (*edgesRefVertex[numobject])[&K(1)]+ (*edgesRefVertex[numobject])[&K(2)]!=0 and
2425        (*edgesRefVertex[numobject])[&K(0)]+ (*edgesRefVertex[numobject])[&K(1)]+ (*edgesRefVertex[numobject])[&K(2)]!=6
2426        and  K.edgecut[0]+ K.edgecut[1]+ K.edgecut[2]==0) {
2427    
2428                ffout(4)<<"cas pbssssss\n";
2429            }
2430                    
2431  ///////////////////////creation des triangles//////////////////////////////  ///////////////////////creation des triangles//////////////////////////////
2432          size_t numberVertexInDomain=K.isInTriangle[0]+K.isInTriangle[1]+K.isInTriangle[2];          size_t numberVertexInDomain=K.isInTriangle[0]+K.isInTriangle[1]+K.isInTriangle[2];
# Line 2479  __createTrianglesIntersection(const size Line 2533  __createTrianglesIntersection(const size
2533            break;              break;  
2534          }          }
2535          case 1: {          case 1: {
2536                if(K.edgecut[0]+K.edgecut[1]+K.edgecut[2]==0) {
2537                    ffout(4)<<"pbbbbbbbbbbbbbbb\n";
2538                }
2539            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) {
2540              if(K.pointsIntersection[0][0]!=K.pointsIntersection[1][0]              if(K.pointsIntersection[0][0]!=K.pointsIntersection[1][0]
2541                 and K.pointsIntersection[1][0]!=K.pointsIntersection[2][0]                 and K.pointsIntersection[1][0]!=K.pointsIntersection[2][0]

Legend:
Removed from v.1.36  
changed lines
  Added in v.1.37

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