
Public Member Functions | |
| Internals () | |
Private Types | |
| typedef std::list< TinyVector < 3, Edge::Pair > > | EdgePairList |
| typedef std::list< const Cell * > | MotherCellList |
| typedef std::map< TinyVector < 3 >, Object * > | ObjectReferences |
| typedef std::map< Edge::Pair, size_t > | EdgesRef |
| list of cut edges and intersection vertex. | |
| typedef std::map< Edge::Pair, Vertex * > | VerticesList |
| list of cut edges and intersection vertex. | |
| typedef std::vector < ReferenceCounting < MeshedObject > > | ListOfMeshedObject |
| typedef std::map< const Cell *, std::list< Triangle * > > | MapCellTriangle |
| typedef std::pair< const Triangle *, const Triangle * > | PairTriangleNew |
| typedef std::map< std::pair < const Vertex *, const Vertex * > , TinyVector< 2, const Vertex * > > | PIntersection |
| typedef std::map < PairTriangleNew, IntersectionPoints > | PairTriangleToIntersectionPoints |
Private Member Functions | |
| TinyVector< 3 > | __splitEdge (const Edge &e, const Shape &S) |
| void | __dataStructureConvertion (MeshedObject &O, EdgePairList &triangleListes, VerticesList &verticesListes, MotherCellList &cellListObject) |
| void | __constructionVerticesList (const MeshedObject &O0) |
| void | __constructionFinalMesh (const MeshedObject &O0, SurfaceMeshOfTriangles &s_mesh) |
| void | __calculatePointsIntersection (const MeshedObject &O1, const MeshedObject &O2, const std::set< const Cell * > &toTreatHexahedra, PIntersection &listVertexIntersectionNew) |
| void | __InTriangle (const Vertex &P, TinyVector< 3, const Vertex * > &V, size_t &ncompt) |
| void | __inout (const size_t &numobject, const int &ttn0, const Vertex *&V0, const Vertex *&V1) |
| TinyVector< 4, real_t > | __EquationPlan (const TinyVector< 3, const Vertex * > &V) |
| void | __DeterminatePoint (const size_t &ncase, const Vertex *&Vo0, const Vertex *&Vo1, TinyVector< 3, const Vertex * > &V, IntersectionPoints &Pinter, PIntersection &listVertexIntersectionNew) |
| void | __CalculPoint (std::list< Triangle * >::iterator ¤tTriangle, std::list< Triangle * >::iterator ¤tTriangle1, IntersectionPoints &Pinter, PIntersection &listVertexIntersectionNew) |
| void | __createPointIntersection (std::list< Triangle * >::iterator currentTriangle1, std::list< Triangle * >::iterator currentTriangle2, PIntersection &listVertexIntersectionNew) |
| const Vertex & | __determinateNumber (const int &p, const TinyVector< 3, TinyVector< 2, const Vertex * > > &pointsint) |
| void | __determinateCase (const int &ncase, const TriangleCut &K, TinyVector< 3, int > &tt, TinyVector< 3, int > &pp) |
| void | __addTriangle (const Triangle &T, const Cell *cell, std::vector< Triangle > &triangleListIntersectionNew) |
| void | __createLocalListIntersection (const size_t &objectNumber, const MeshedObject &O2, const Triangle *¤tTriangle, TriangleCut &K, const Cell *cell) |
| TinyVector< 3, TinyVector < 2, int > > | __determinateEdgeCut (const size_t &numobject, const MeshedObject &O1, const MeshedObject &O2, const Triangle *¤tTriangle, const Cell *cell) |
| void | __putEdgeRef (const Triangle *&Tmesh, const Triangle *&T, const size_t numobject, const MeshedObject &O1, const MeshedObject &O2) |
| void | __putRefByFront (const size_t numobject, const MeshedObject &O1, const MeshedObject &O2, const SurfaceMeshOfTriangles &surfmesh, const std::set< const Cell * > &toTreatHexahedra) |
| void | __createCase (const TriangleCut &K, size_t &in, size_t &in1, TinyVector< 3, size_t > &place) |
| void | __transformVertex (const TriangleCut &K, std::vector< const Vertex * > &points, std::vector< Vertex > &pointstrian) |
| void | __addPoints (const Vertex *&Pcut, size_t &stopcut, std::vector< const Vertex * > &pointslist1, std::vector< const Vertex * > &pointslist2) |
| void | __addList (const TriangleCut &K) |
| void | __createList (const TriangleCut &K, std::vector< const Vertex * > &points, size_t &in, size_t &in1, TinyVector< 3, size_t > place) |
| bool | __verifExist (const Vertex *Ptemp, std::vector< const Vertex * > &points) |
| bool | __findOneEdge (const TriangleCut &K, const size_t &number, TinyVector< 2, const Vertex * > &P) |
| void | __findInEdges (const TriangleCut &K, TinyVector< 2, const Vertex * > &P, TinyVector< 2, const Triangle * > &T, size_t &iInter, size_t &stop, size_t &in, size_t &in1, TinyVector< 3, size_t > place, std::vector< const Vertex * > &points) |
| void | __findVertex (const TriangleCut &K, TinyVector< 2, const Vertex * > &P, TinyVector< 2, const Triangle * > &T, size_t &iCut, size_t &iInter, size_t &stop, size_t &in, size_t &in1, TinyVector< 3, size_t > place, std::vector< const Vertex * > &points) |
| void | __findTriangle (TinyVector< 2, const Vertex * > &P, TinyVector< 2, const Triangle * > &T, size_t &stop) |
| void | __createGeneral (const TriangleCut &K, const Cell *cell, std::vector< Triangle > &triangleListIntersectionNew) |
| void | __create2SD (const TriangleCut &K, const Cell *cell, std::vector< const Vertex * > &points, std::vector< Vertex > &pointstrian, const TinyVector< 3, size_t > &place, std::vector< Triangle > &triangleListIntersectionNew) |
| void | __create3in (const TriangleCut &K, const Cell *cell, std::vector< const Vertex * > &points, const size_t in, const size_t in1, const TinyVector< 3, size_t > &place, std::vector< Triangle > &triangleListIntersectionNew) |
| void | __createTriangle (const TriangleCut &K, const Cell *cell, std::vector< Triangle > &triangleListIntersectionNew, std::vector< const Vertex * > &points, std::vector< Vertex > &pointtrian) |
| template<typename booleanTest> | |
| void | __createTrianglesIntersection (const size_t numobject, const MeshedObject &O1, const MeshedObject &O2, const std::set< const Cell * > &toTreatHexahedra, std::vector< Triangle > &triangleListIntersectionNew, PIntersection &listVertexIntersectionNew) |
| bool | __createTriangleSurface (VerticesList &verticesListes, EdgePairList &localTriangleList, const Shape &S, std::vector< const Edge * > &cutEdges, const Cell ¤tCell) |
| void | __createSurface (MeshedObject &O, EdgePairList &triangleListes, EdgePairList &localTriangleListesEdges, VerticesList &verticesListes, MotherCellList &cellListObject) |
| bool | __isDegenerate (const Triangle &T) |
| template<typename booleanTest> | |
| void | __calculateIntersection (MeshedObject &O0, const MeshedObject &O1, const MeshedObject &O2, const std::set< const Cell * > &toTreatHexahedra) |
| template<typename booleanTest> | |
| void | __operationBoolean (MeshedObject &O0, const MeshedObject &O1, const MeshedObject &O2) |
| void | __generateMesh (const Domain &omega, const Object &object, const size_t &level, std::stack< ReferenceCounting< MeshedObject > > &objectStack) |
| void | __generateCoarseMesh (const Domain &omega, const Object &object) |
| void | __setMotherCells (SurfaceMeshOfTriangles &surfmesh) |
| ReferenceCounting< Vector < Triangle > > | __marchingTetrahedra (MeshedObject &O) |
| void | plotini (size_t nobjectToTreat) |
Static Private Member Functions | |
| static void | __getIntersectionReferences (const Intersection &I, std::map< TinyVector< 3 >, Object * > &otherReferences) |
Private Attributes | |
| std::map< const Vertex *, const Vertex * > | listOfVertexMesh |
| std::map< const Triangle *, const Triangle * > | listOfTriangleMeshFront |
| PairTriangleToIntersectionPoints | pairTriangleToIntersectionPoints |
| std::vector< ReferenceCounting < std::map< const Vertex *, size_t > > > | edgesRefVertex |
| std::map< const Vertex *, TinyVector< 2, const Triangle * > > | vertexInTriangles |
| std::map< const Vertex *, std::vector< const Triangle * > > | vertexVectTriangles |
| std::map< const Triangle *, TinyVector< 2, const Vertex * > > | triangleWithVertex |
| ReferenceCounting < MeshTetrahedrizor::CellMapping > | __motherCells |
| ReferenceCounting < MeshOfTetrahedra > | __backgroundMesh |
| const Mesh * | __lastBackgoundMesh |
Friends | |
| class | SurfaceMeshGenerator |
Classes | |
| class | IntersectionPoints |
| struct | IntersectionTest |
| class | MeshedObject |
| class | TriangleCut |
| struct | UnionTest |
Definition at line 76 of file SurfaceMeshGenerator.cpp.
typedef std::list<TinyVector<3,Edge::Pair> > SurfaceMeshGenerator::Internals::EdgePairList [private] |
Definition at line 190 of file SurfaceMeshGenerator.cpp.
typedef std::list<const Cell*> SurfaceMeshGenerator::Internals::MotherCellList [private] |
Definition at line 191 of file SurfaceMeshGenerator.cpp.
typedef std::map<TinyVector<3>, Object*> SurfaceMeshGenerator::Internals::ObjectReferences [private] |
Definition at line 193 of file SurfaceMeshGenerator.cpp.
typedef std::map<Edge::Pair, size_t> SurfaceMeshGenerator::Internals::EdgesRef [private] |
typedef std::map<Edge::Pair, Vertex*> SurfaceMeshGenerator::Internals::VerticesList [private] |
typedef std::vector<ReferenceCounting<MeshedObject > > SurfaceMeshGenerator::Internals::ListOfMeshedObject [private] |
Definition at line 201 of file SurfaceMeshGenerator.cpp.
typedef std::map<const Cell*, std::list<Triangle*> > SurfaceMeshGenerator::Internals::MapCellTriangle [private] |
Definition at line 203 of file SurfaceMeshGenerator.cpp.
typedef std::pair<const Triangle*,const Triangle*> SurfaceMeshGenerator::Internals::PairTriangleNew [private] |
Definition at line 205 of file SurfaceMeshGenerator.cpp.
typedef std::map<std::pair<const Vertex*,const Vertex*> , TinyVector<2,const Vertex* > > SurfaceMeshGenerator::Internals::PIntersection [private] |
Definition at line 209 of file SurfaceMeshGenerator.cpp.
typedef std::map< PairTriangleNew , IntersectionPoints> SurfaceMeshGenerator::Internals::PairTriangleToIntersectionPoints [private] |
Definition at line 211 of file SurfaceMeshGenerator.cpp.
| SurfaceMeshGenerator::Internals::Internals | ( | ) | [inline] |
Definition at line 434 of file SurfaceMeshGenerator.cpp.
00435 : __motherCells(0), 00436 __backgroundMesh(0), 00437 __lastBackgoundMesh(0) 00438 { 00439 ; 00440 }
| TinyVector< 3, real_t > SurfaceMeshGenerator::Internals::__splitEdge | ( | const Edge & | e, | |
| const Shape & | S | |||
| ) | [private] |
Definition at line 546 of file SurfaceMeshGenerator.cpp.
References ASSERT, and Shape::inside().
Referenced by __createSurface(), and __createTriangleSurface().
00548 { 00549 int in = -1; // number of the vertex inside 00550 int out = -1; // same thing for outside 00551 00552 for (int j=0; j<2; j++) { 00553 if (e(j).reference() != 1) { 00554 out = j; 00555 } else { 00556 in = j; 00557 } 00558 } 00559 00560 ASSERT((in != -1)&&(out != -1)); 00561 00562 TinyVector<3> vi = e(in); 00563 TinyVector<3> vo = e(out); 00564 TinyVector<3> vs = 0.5*(vi+vo); 00565 00566 for (int l = 0; l<20/*20*/; l++) { // 3% error after 5 iterations. 00567 if(S.inside(vs)) { 00568 vi = vs; 00569 vs = 0.5*(vo+vi); 00570 } else { 00571 vo = vs; 00572 vs = 0.5*(vo+vi); 00573 } 00574 } 00575 00576 return vs; 00577 }

| void SurfaceMeshGenerator::Internals::__dataStructureConvertion | ( | MeshedObject & | O, | |
| EdgePairList & | triangleListes, | |||
| VerticesList & | verticesListes, | |||
| MotherCellList & | cellListObject | |||
| ) | [private] |
Definition at line 728 of file SurfaceMeshGenerator.cpp.
References SurfaceMeshGenerator::Internals::MeshedObject::hexalist, SurfElem::setMother(), SurfaceMeshGenerator::Internals::MeshedObject::trianglelist, and SurfaceMeshGenerator::Internals::MeshedObject::verticeslist.
Referenced by __marchingTetrahedra().
00732 { 00733 //for (size_t numObj = 0; numObj<nb; ++numObj) { 00734 // Data structure convertion 00735 { 00736 #warning keep this ? 00737 size_t n=0; 00738 O.verticeslist 00739 = new Vector<Vertex*>(verticesListes.size()); 00740 Vector<Vertex*>& vertexListbis = (*O.verticeslist); 00741 for (SurfaceMeshGenerator::Internals::VerticesList::iterator 00742 i = verticesListes.begin(); 00743 i != verticesListes.end(); ++i, ++n) { 00744 vertexListbis[n] = (*i).second; 00745 } 00746 } 00747 00748 { 00749 size_t n=0; 00750 O.hexalist 00751 = new std::map<const Cell*, std::list<Triangle*> >; 00752 std::map<const Cell*, std::list<Triangle*> >& hexaToTrianglebis=(*O.hexalist); 00753 00754 O.trianglelist 00755 = new Vector<Triangle> (triangleListes.size()); 00756 Vector<Triangle>& triangleListbis = (*O.trianglelist); 00757 SurfaceMeshGenerator::Internals::MotherCellList::iterator 00758 itcell=cellListObject.begin(); 00759 00760 for (SurfaceMeshGenerator::Internals::EdgePairList::iterator 00761 i = triangleListes.begin(); 00762 i != triangleListes.end(); ++i, ++n) { 00763 SurfaceMeshGenerator::Internals::VerticesList& V = verticesListes; 00764 Triangle T(* V[(*i)[0]], 00765 * V[(*i)[1]], 00766 * V[(*i)[2]], 1); 00767 00768 T.setMother(*itcell, 00769 std::numeric_limits<size_t>::max()); // Le triangle n'est pas une face de la maille 00770 triangleListbis[n] = T; 00771 hexaToTrianglebis[*itcell].push_back(&triangleListbis[n]); 00772 ++itcell; 00773 } 00774 } 00775 00776 verticesListes.clear(); 00777 triangleListes.clear(); 00778 //} 00779 }

| void SurfaceMeshGenerator::Internals::__constructionVerticesList | ( | const MeshedObject & | O0 | ) | [private] |
Definition at line 645 of file SurfaceMeshGenerator.cpp.
References listOfVertexMesh, Vector< T >::size(), and SurfaceMeshGenerator::Internals::MeshedObject::trianglelist.
Referenced by __constructionFinalMesh().
00645 { 00646 00647 const Vector<Triangle>& triangleList=(*O0.trianglelist); 00648 00649 for(size_t size=0 ; size< triangleList.size() ; ++size) { 00650 const Triangle& T=triangleList[size]; 00651 if (listOfVertexMesh.find(&T(0))==listOfVertexMesh.end()) { 00652 listOfVertexMesh[&T(0)] = new Vertex(T(0));; 00653 } 00654 if (listOfVertexMesh.find(&T(1))==listOfVertexMesh.end()) { 00655 listOfVertexMesh[&T(1)] = new Vertex(T(1));; 00656 } 00657 if (listOfVertexMesh.find(&T(2))==listOfVertexMesh.end()) { 00658 listOfVertexMesh[&T(2)] = new Vertex(T(2));; 00659 } 00660 } 00661 }

| void SurfaceMeshGenerator::Internals::__constructionFinalMesh | ( | const MeshedObject & | O0, | |
| SurfaceMeshOfTriangles & | s_mesh | |||
| ) | [private] |
copies vertices into the s_mesh.
Definition at line 663 of file SurfaceMeshGenerator.cpp.
References __constructionVerticesList(), SurfaceMeshOfTriangles::cell(), ffout(), listOfTriangleMeshFront, listOfVertexMesh, SurfElem::mother(), SurfaceMeshOfTriangles::numberOfCells(), Mesh::numberOfVertices(), Cell::reference(), SurfElem::setMother(), SurfaceMeshOfTriangles::setNumberOfCells(), Mesh::setNumberOfVertices(), Vector< T >::size(), SurfaceMeshGenerator::Internals::MeshedObject::trianglelist, and Mesh::vertex().
Referenced by __createTrianglesIntersection().
00664 { 00665 00666 __constructionVerticesList(O0); 00667 00668 size_t ntr=0; 00669 00670 ntr+=listOfVertexMesh.size(); 00671 00672 s_mesh.setNumberOfVertices(ntr); 00673 ffout(4)<<"nb tot vertices "<<s_mesh.numberOfVertices()<<'\n'; 00675 int i = 0; 00676 /* for(size_t v=0 ; v<ntr ; ++v) { 00677 s_mesh.vertex(i) = *listVertexFinal[v]; 00678 listVertexFinal[v] = &s_mesh.vertex(i); 00679 i++; 00680 }*/ 00681 00682 std::set<const Vertex*> newVertices; 00683 std::set<const Vertex*> oldVertices; 00684 00685 for(std::map<const Vertex*, const Vertex*>::iterator it=listOfVertexMesh.begin() ; 00686 it!=listOfVertexMesh.end() ; it++) { 00687 s_mesh.vertex(i) = *((*it).second); 00688 00689 delete ((*it).second); 00690 ((*it).second) = &s_mesh.vertex(i); 00691 i++; 00692 } 00693 00694 const Vector<Triangle>& triangleList=(*O0.trianglelist); 00695 i = 0; 00696 size_t ncell=0; 00697 //if(nobjectToTreat==0){ 00698 ncell+=triangleList.size(); 00699 //} 00700 // ffout(4)<<"ncell "<<ncell<<" n0 "<<n0<<" n1 "<<n1<<"\n"; 00701 00702 s_mesh.setNumberOfCells(ncell); 00703 ffout(4)<<"nb tot cells "<<s_mesh.numberOfCells()<<'\n'; 00704 00705 for(size_t size=0 ; size< triangleList.size() ; ++size) { 00706 const Triangle& T=triangleList[size]; 00707 std::map<const Vertex*, const Vertex*>::iterator 00708 it0=listOfVertexMesh.find(&T(0)); 00709 const Vertex& V0=*((*it0).second); 00710 std::map<const Vertex*, const Vertex*>::iterator 00711 it1=listOfVertexMesh.find(&T(1)); 00712 const Vertex& V1=*((*it1).second); 00713 std::map<const Vertex*, const Vertex*>::iterator 00714 it2=listOfVertexMesh.find(&T(2)); 00715 const Vertex& V2=*((*it2).second); 00716 s_mesh.cell(i) = Triangle(V0,V1,V2, T.reference()); 00717 s_mesh.cell(i).setMother(&T.mother(), 00718 std::numeric_limits<size_t>::max()); // Le triangle n'est pas une face de la maille 00719 listOfTriangleMeshFront[&s_mesh.cell(i)]=&T; 00720 i++; 00721 00722 } 00723 // } 00724 //listOfVertexMesh.clear(); 00725 }

| void SurfaceMeshGenerator::Internals::__calculatePointsIntersection | ( | const MeshedObject & | O1, | |
| const MeshedObject & | O2, | |||
| const std::set< const Cell * > & | toTreatHexahedra, | |||
| PIntersection & | listVertexIntersectionNew | |||
| ) | [private] |
Definition at line 782 of file SurfaceMeshGenerator.cpp.
References __createPointIntersection(), ASSERT, and SurfaceMeshGenerator::Internals::MeshedObject::hexalist.
Referenced by __calculateIntersection().
00786 { 00787 // calculate points intersection between object O1 and O2 00788 const MapCellTriangle& hexaToTriangle0=*(O1.hexalist); 00789 const MapCellTriangle& hexaToTriangle1=*(O2.hexalist); 00790 00791 for(std::set<const Cell*>::const_iterator i=toTreatHexahedra.begin(); 00792 i!=toTreatHexahedra.end(); ++i) { 00793 MapCellTriangle::const_iterator it0=hexaToTriangle0.find(*i); 00794 MapCellTriangle::const_iterator it1=hexaToTriangle1.find(*i); 00795 00796 ASSERT(it0!=hexaToTriangle0.end() and it1!=hexaToTriangle1.end()); 00797 00798 std::list<Triangle*> listTriangle0=(*it0).second; 00799 std::list<Triangle*> listTriangle1=(*it1).second; 00800 00801 for(std::list<Triangle*>::iterator jt0=listTriangle0.begin() ; 00802 jt0!=listTriangle0.end() ; ++jt0) { 00803 for(std::list<Triangle*>::iterator jt1=listTriangle1.begin() ; 00804 jt1!=listTriangle1.end() ; ++jt1) { 00805 __createPointIntersection(jt0,jt1,listVertexIntersectionNew); 00806 } 00807 } 00808 } 00809 }

| void SurfaceMeshGenerator::Internals::__InTriangle | ( | const Vertex & | P, | |
| TinyVector< 3, const Vertex * > & | V, | |||
| size_t & | ncompt | |||
| ) | [private] |
Definition at line 817 of file SurfaceMeshGenerator.cpp.
Referenced by __DeterminatePoint().
00820 { 00821 compt=0; 00822 TinyVector<3,TinyVector<3,real_t> > triangleVector; 00823 triangleVector[0]= -(*V[2]) + (*V[0]); 00824 triangleVector[1]= -(*V[2]) + (*V[1]); 00825 triangleVector[2]= P - (*V[2]); 00826 00827 TinyMatrix<3,3, real_t> A; 00828 for (unsigned i=0; i<3; ++i) { 00829 for (unsigned j=0; j<3; ++j) { 00830 A(i,j)=(*V[j])[i]; 00831 } 00832 } 00833 00834 TinyVector<3, real_t> lambda; 00835 00836 gaussPivot(A,P,lambda); 00837 00838 bool ok=true; 00839 for (size_t i=0; i<3; ++i) { 00840 ok = (lambda[i]>-1e-7)?ok:false; 00841 } 00842 00843 compt = (ok) ? 3 : 0; 00844 }
| void SurfaceMeshGenerator::Internals::__inout | ( | const size_t & | numobject, | |
| const int & | ttn0, | |||
| const Vertex *& | V0, | |||
| const Vertex *& | V1 | |||
| ) | [private] |
Definition at line 1053 of file SurfaceMeshGenerator.cpp.
References edgesRefVertex, and ffout().
01057 {// if the edge is not cut , put ref=2 for the 2 vertex 01058 size_t& refVertex0=(*edgesRefVertex[numobject])[V0]; 01059 size_t& refVertex1=(*edgesRefVertex[numobject])[V1]; 01060 01061 if(refVertex0+refVertex1==4 and edgeCut==1) { 01062 ffout(4)<<"warning edge ref 2 cut \n"; 01063 ffout(4)<<(*V0)[0]<<" "<<(*V0)[1]<<" "<<(*V0)[2]<<" \n"; 01064 ffout(4)<<(*V1)[0]<<" "<<(*V1)[1]<<" "<<(*V1)[2]<<" \n"; 01065 refVertex0=0; 01066 refVertex1=0; 01067 } else { 01068 // CECILE: ne serait-ce pas plutôt une ASSERTION ? 01069 if(refVertex0+refVertex1==2 and edgeCut==0) { 01070 refVertex0=2; 01071 refVertex1=2; 01072 } 01073 } 01074 }

| TinyVector< 4, real_t > SurfaceMeshGenerator::Internals::__EquationPlan | ( | const TinyVector< 3, const Vertex * > & | V | ) | [private] |
Definition at line 847 of file SurfaceMeshGenerator.cpp.
Referenced by __DeterminatePoint().
00847 { 00848 00849 //equation of plan 00850 TinyVector<3> V01=(*V[1])-(*V[0]); 00851 TinyVector<3> V12=(*V[2])-(*V[1]); 00852 TinyVector<3> V02=(*V[2])-(*V[0]); 00853 00854 TinyVector<3> coeffo; 00855 coeffo=V01^V02; 00856 real_t d2 = -(coeffo*(*V[0])); 00857 00858 TinyVector<4> coeff; 00859 coeff[0]=coeffo[0]; 00860 coeff[1]=coeffo[1]; 00861 coeff[2]=coeffo[2]; 00862 coeff[3]=d2; 00863 00864 return coeff; 00865 }
| void SurfaceMeshGenerator::Internals::__DeterminatePoint | ( | const size_t & | ncase, | |
| const Vertex *& | Vo0, | |||
| const Vertex *& | Vo1, | |||
| TinyVector< 3, const Vertex * > & | V, | |||
| IntersectionPoints & | Pinter, | |||
| PIntersection & | listVertexIntersectionNew | |||
| ) | [private] |
Definition at line 868 of file SurfaceMeshGenerator.cpp.
References __EquationPlan(), __InTriangle(), SurfaceMeshGenerator::Internals::IntersectionPoints::addPoint(), SurfaceMeshGenerator::Internals::IntersectionPoints::cutTriangle1(), and SurfaceMeshGenerator::Internals::IntersectionPoints::size().
Referenced by __CalculPoint().
00874 { 00875 //calculate intersection between edge Vo0Vo1 and triangle V 00876 // if ncase<3 the edge is in the first object else the edge is in the second object 00877 // P = point intersection 00878 std::pair<const Vertex*,const Vertex*> pV(Vo0,Vo1); 00879 std::pair<const Vertex*,const Vertex*> pV2(Vo1,Vo0); 00880 00881 // rq: epsilon a 10-6 on loupe des points!!!!! (testStep2.txt) 00882 real_t epsilon=1e-10; 00883 real_t eps=1e-6; 00884 real_t pscalar,k; 00885 size_t num; 00886 Vertex P; 00887 TinyVector<4> coeffo=__EquationPlan(V); 00888 TinyVector<3> coeff; 00889 coeff[0]=coeffo[0]; 00890 coeff[1]=coeffo[1]; 00891 coeff[2]=coeffo[2]; 00892 real_t d=coeffo[3]; 00893 00894 TinyVector<3> Vo01 = (*Vo1) - (*Vo0); 00895 TinyVector<3> V01 = (*V[1]) - (*V[0]); 00896 TinyVector<3> V12 = (*V[2]) - (*V[1]); 00897 TinyVector<3> V02 = (*V[2]) - (*V[0]); 00898 00899 real_t norm1=Norm(Vo01); 00900 pscalar=coeff*Vo01; 00901 num=0; 00902 if(std::abs(pscalar)>1e-10) { 00903 k=-(coeff*(*Vo0)+d)/pscalar; 00904 P=(*Vo0)+k*Vo01; 00905 00906 TinyVector<3> V0P=P-(*V[0]); 00907 TinyVector<3> V1P=P-(*V[1]); 00908 TinyVector<3> V2P=P-(*V[2]); 00909 00910 real_t norm2=Norm(P-(*Vo0)); 00911 real_t norm3=Norm(P-(*Vo1)); 00912 real_t inV01=Norm(V01^V0P); 00913 real_t inV12=Norm(V12^V1P); 00914 real_t inV02=Norm(V02^V2P); 00915 00916 if(/*norm2>epsilon and norm3>epsilon and */std::abs((norm2+norm3)-norm1) < epsilon ) { 00917 if(ncase<3) { 00918 __InTriangle(P,V,num); 00919 if(num==3) { 00920 if(!(norm2>epsilon)) { 00921 //point confondus avec un des sommets 00922 Pinter.addPoint(Vo0); 00923 } else 00924 if(!(norm3>epsilon)) { 00925 //point confondus avec l'autre sommet 00926 Pinter.addPoint(Vo1); 00927 } else { 00928 // CONSIDÈRE QU'IL PEUT Y AVOIR DEUX POINTS D'INTERSECTION SUR L'ARÊTE, MAIS PAS PLUS 00929 if(listVertexIntersectionNew.find(pV)==listVertexIntersectionNew.end() 00930 and listVertexIntersectionNew.find(pV2)==listVertexIntersectionNew.end()) { 00931 listVertexIntersectionNew[pV][0]=new Vertex (P); 00932 listVertexIntersectionNew[pV][1]=new Vertex (P); 00933 Pinter.addPoint(listVertexIntersectionNew[pV][0]); 00934 } else { 00935 if(listVertexIntersectionNew.find(pV)!=listVertexIntersectionNew.end()) { 00936 if(Norm((*(*listVertexIntersectionNew.find(pV)).second[0]) 00937 -P)<eps) { 00938 Pinter.addPoint((*listVertexIntersectionNew.find(pV)).second[0]); 00939 } else 00940 if(Norm((*(*listVertexIntersectionNew.find(pV)).second[1]) - P) < eps) { 00941 Pinter.addPoint((*listVertexIntersectionNew.find(pV)).second[1]); 00942 } else { 00943 listVertexIntersectionNew[pV][1]=new Vertex (P); 00944 Pinter.addPoint(listVertexIntersectionNew[pV][1]); 00945 } 00946 } else { 00947 if(Norm((*(*listVertexIntersectionNew.find(pV2)).second[0]) - P) < eps) { 00948 Pinter.addPoint((*listVertexIntersectionNew.find(pV2)).second[0]); 00949 } else 00950 if(Norm((*(*listVertexIntersectionNew.find(pV2)).second[1]) - P) < eps) { 00951 Pinter.addPoint((*listVertexIntersectionNew.find(pV2)).second[1]); 00952 } else { 00953 listVertexIntersectionNew[pV2][1]=new Vertex (P); 00954 Pinter.addPoint(listVertexIntersectionNew[pV2][1]); 00955 } 00956 } 00957 } 00958 } 00959 Pinter.cutTriangle1()[ncase]=Pinter.size(); 00960 } 00961 } else { 00962 //il ne faut pas que le point soit sur une arete du tr 1 00963 if(inV01 > epsilon and inV02 > epsilon and inV12 > epsilon ) { 00964 __InTriangle(P,V,num); 00965 if(num==3) { 00966 //ffout(4)<<"ajout du point cas 2\n"; 00967 //ffout(4)<<P[0]<<" "<<P[1]<<" "<<P[2]<<" \n"; 00968 //listVertexIntersectionNew.push_back(new Vertex (P)); 00969 PIntersection PIn; 00970 if(!(norm2>epsilon)) { 00971 Pinter.addPoint(Vo0); 00972 } else { 00973 if(!(norm3>epsilon)) { 00974 Pinter.addPoint(Vo1); 00975 } else 00976 { 00977 if(listVertexIntersectionNew.find(pV)==listVertexIntersectionNew.end() 00978 and listVertexIntersectionNew.find(pV2)==listVertexIntersectionNew.end()) { 00979 listVertexIntersectionNew[pV][0]=new Vertex (P); 00980 listVertexIntersectionNew[pV][1]=new Vertex (P); 00981 Pinter.addPoint(listVertexIntersectionNew[pV][0]); 00982 } else { 00983 if(listVertexIntersectionNew.find(pV)!=listVertexIntersectionNew.end()) { 00984 if(Norm((*(*listVertexIntersectionNew.find(pV)).second[0]) 00985 -P)<eps) { 00986 Pinter.addPoint((*listVertexIntersectionNew.find(pV)).second[0]); 00987 } else { 00988 if(Norm((*(*listVertexIntersectionNew.find(pV)).second[1]) 00989 -P)<eps) { 00990 Pinter.addPoint((*listVertexIntersectionNew.find(pV)).second[1]); 00991 } else { 00992 listVertexIntersectionNew[pV][1]=new Vertex (P); 00993 Pinter.addPoint(listVertexIntersectionNew[pV][1]); 00994 } 00995 } 00996 } else { 00997 if(Norm((*(*listVertexIntersectionNew.find(pV2)).second[0]) 00998 -P)<eps) { 00999 Pinter.addPoint((*listVertexIntersectionNew.find(pV2)).second[0]); 01000 } else { 01001 if(Norm((*(*listVertexIntersectionNew.find(pV2)).second[1]) 01002 -P)<eps) { 01003 Pinter.addPoint((*listVertexIntersectionNew.find(pV2)).second[1]); 01004 } else { 01005 listVertexIntersectionNew[pV2][1]=new Vertex (P); 01006 Pinter.addPoint(listVertexIntersectionNew[pV2][1]); 01007 } 01008 } 01009 } 01010 } 01011 } 01012 } 01013 // Pinter.addPoint(listVertexIntersectionNew[listVertexIntersectionNew.size()-1]); 01014 } 01015 } 01016 } 01017 } 01018 } 01019 }

| void SurfaceMeshGenerator::Internals::__CalculPoint | ( | std::list< Triangle * >::iterator & | currentTriangle, | |
| std::list< Triangle * >::iterator & | currentTriangle1, | |||
| IntersectionPoints & | Pinter, | |||
| PIntersection & | listVertexIntersectionNew | |||
| ) | [private] |
Definition at line 1022 of file SurfaceMeshGenerator.cpp.
References __DeterminatePoint().
Referenced by __createPointIntersection().
01026 { 01027 // calculate points intersection between triangle "currentTriangle" and "currentTriangle1" 01028 // this points are in "Pinter" 01029 01030 // NECESSITE DE V012 et Vo012 ? 01031 01032 TinyVector<3,const Vertex * > V012; 01033 const Triangle& T0=*(*currentTriangle1); 01034 V012[0] = &T0(0); 01035 V012[1] = &T0(1); 01036 V012[2] = &T0(2); 01037 TinyVector<3,const Vertex* > Vo012; 01038 Triangle& To0=*(*currentTriangle); 01039 Vo012[0] = &To0(0); 01040 Vo012[1] = &To0(1); 01041 Vo012[2] = &To0(2); 01042 01043 __DeterminatePoint(0,(V012[0]),(V012[1]),Vo012,Pinter, listVertexIntersectionNew); 01044 __DeterminatePoint(1,(V012[0]),(V012[2]),Vo012,Pinter, listVertexIntersectionNew); 01045 __DeterminatePoint(2,(V012[1]),(V012[2]),Vo012,Pinter, listVertexIntersectionNew); 01046 01047 __DeterminatePoint(3,(Vo012[0]),(Vo012[1]),V012,Pinter, listVertexIntersectionNew); 01048 __DeterminatePoint(3,(Vo012[0]),(Vo012[2]),V012,Pinter, listVertexIntersectionNew); 01049 __DeterminatePoint(3,(Vo012[1]),(Vo012[2]),V012,Pinter, listVertexIntersectionNew); 01050 }

| void SurfaceMeshGenerator::Internals::__createPointIntersection | ( | std::list< Triangle * >::iterator | currentTriangle1, | |
| std::list< Triangle * >::iterator | currentTriangle2, | |||
| PIntersection & | listVertexIntersectionNew | |||
| ) | [private] |
Definition at line 1077 of file SurfaceMeshGenerator.cpp.
References __CalculPoint(), pairTriangleToIntersectionPoints, and SurfaceMeshGenerator::Internals::IntersectionPoints::size().
Referenced by __calculatePointsIntersection().
01080 { 01081 //ffout(4)<< "createpointintersection "<<numobject<<" "<<objectNumber<<"\n"; 01082 //ffout(4)<<"*************************\n"; 01083 01084 PairTriangleNew pTriangle; 01085 pTriangle.first=(*currentTriangle1); 01086 pTriangle.second=(*currentTriangle); 01087 01088 IntersectionPoints Pinter; 01089 // CALCUL DU POINT D'INTERSECTION 01090 __CalculPoint(currentTriangle, currentTriangle1, Pinter, listVertexIntersectionNew); 01091 01092 //const TinyVector<3,size_t >& pintercut=Pinter.cutTriangle1(); 01093 01094 if(Pinter.size()!=0) { 01095 //ffout(4)<<"rajout2 \n"; 01096 pairTriangleToIntersectionPoints[pTriangle] = Pinter; 01097 } 01098 01099 if(pairTriangleToIntersectionPoints.find(pTriangle)!= pairTriangleToIntersectionPoints.end()) { 01100 TinyVector<3,size_t >& cutTr2= pairTriangleToIntersectionPoints[pTriangle].cutTriangle2(); 01101 01102 for(size_t i=0 ; i<Pinter.size() ; ++i) { 01103 real_t epsilon=1e-7; 01104 const Triangle& To=(*(*currentTriangle)); 01105 const Vertex& Vo0 = To(0); 01106 const Vertex& Vo1 = To(1); 01107 const Vertex& Vo2 = To(2); 01108 const Vertex& P=*(pairTriangleToIntersectionPoints[pTriangle][i]); 01109 01110 // TESTE SI LE POINT EST SUR UNE DES ARETES EN TESTANT TROIS "EGALITÉ" TRIANGULAIRE 01111 01112 real_t Vo01=Norm(Vo1-Vo0); 01113 real_t Vo12=Norm(Vo2-Vo1); 01114 real_t Vo02=Norm(Vo2-Vo0); 01115 real_t norm0=Norm(P-Vo0); 01116 real_t norm1=Norm(P-Vo1); 01117 real_t norm2=Norm(P-Vo2); 01118 //for filter points 01119 //real_t eps=1e-6; 01120 if(/*norm0>eps and norm1>eps and */std::abs((norm0+norm1)-Vo01)<epsilon) { 01121 cutTr2[0]=i+1; 01122 } 01123 if(/*norm0>eps and norm2>eps and */std::abs((norm0+norm2)-Vo02)<epsilon) { 01124 cutTr2[1]=i+1; 01125 } 01126 if(/*norm2>eps and norm1>eps and */std::abs((norm2+norm1)-Vo12)<epsilon) { 01127 cutTr2[2]=i+1; 01128 } 01129 } 01130 } 01131 }

| const Vertex & SurfaceMeshGenerator::Internals::__determinateNumber | ( | const int & | p, | |
| const TinyVector< 3, TinyVector< 2, const Vertex * > > & | pointsint | |||
| ) | [private] |
Definition at line 1135 of file SurfaceMeshGenerator.cpp.
01137 {//return the point intersection 01138 if(place<=2) { 01139 return *pointsint[place][0]; 01140 } else { 01141 return *pointsint[2][0]; 01142 } 01143 }
| void SurfaceMeshGenerator::Internals::__determinateCase | ( | const int & | ncase, | |
| const TriangleCut & | K, | |||
| TinyVector< 3, int > & | tt, | |||
| TinyVector< 3, int > & | pp | |||
| ) | [private] |
Definition at line 1165 of file SurfaceMeshGenerator.cpp.
References SurfaceMeshGenerator::Internals::TriangleCut::edgecut.
01169 { 01170 //determinate which point is inside 01171 const TinyVector<3,TinyVector<2,int> >& edgesCut2=K.edgecut; 01172 switch(ncase) { 01173 case 0: { 01174 edgesCut[0]=edgesCut2[0][0]; 01175 edgesCut[1]=edgesCut2[1][0]; 01176 edgesCut[2]=edgesCut2[2][0]; 01177 vertexNum[0]=0; 01178 vertexNum[1]=1; 01179 vertexNum[2]=2; 01180 break; 01181 } 01182 case 1: { 01183 edgesCut[0]=edgesCut2[0][0]; 01184 edgesCut[1]=edgesCut2[2][0]; 01185 edgesCut[2]=edgesCut2[1][0]; 01186 vertexNum[0]=0; 01187 vertexNum[1]=2; 01188 vertexNum[2]=1; 01189 break; 01190 } 01191 case 2: { 01192 edgesCut[0]=edgesCut2[1][0]; 01193 edgesCut[1]=edgesCut2[2][0]; 01194 edgesCut[2]=edgesCut2[0][0]; 01195 vertexNum[0]=1; 01196 vertexNum[1]=2; 01197 vertexNum[2]=0; 01198 break; 01199 } 01200 } 01201 }
| void SurfaceMeshGenerator::Internals::__addTriangle | ( | const Triangle & | T, | |
| const Cell * | cell, | |||
| std::vector< Triangle > & | triangleListIntersectionNew | |||
| ) | [private] |
Definition at line 1146 of file SurfaceMeshGenerator.cpp.
References __isDegenerate(), fferr(), and SurfElem::setMother().
Referenced by __createGeneral(), __createTriangle(), and __createTrianglesIntersection().
01149 { 01150 Triangle T(t); 01151 T.setMother(cell, 01152 std::numeric_limits<size_t>::max()); // Le triangle n'est pas une face de la cellule 01153 if(!__isDegenerate(T)) { 01154 triangleListIntersectionNew.push_back(T); 01155 } else { 01156 fferr(3) << "\t\tTriangle dégénéré :" 01157 << &T(0) << ':' << &T(1) << ':' << &T(2) << '\n'; 01158 fferr(3) 01159 << T(0) << ':' << T(1) << ':' << T(2) << '\n'; 01160 // triangleListIntersectionNew.push_back(T); 01161 } 01162 }

| void SurfaceMeshGenerator::Internals::__createLocalListIntersection | ( | const size_t & | objectNumber, | |
| const MeshedObject & | O2, | |||
| const Triangle *& | currentTriangle, | |||
| TriangleCut & | K, | |||
| const Cell * | cell | |||
| ) | [private] |
Definition at line 1204 of file SurfaceMeshGenerator.cpp.
References __isDegenerate(), SurfaceMeshGenerator::Internals::TriangleCut::edgecut, ffout(), SurfaceMeshGenerator::Internals::MeshedObject::hexalist, SurfaceMeshGenerator::Internals::TriangleCut::numobject, pairTriangleToIntersectionPoints, SurfaceMeshGenerator::Internals::TriangleCut::pointsin, SurfaceMeshGenerator::Internals::TriangleCut::pointsIntersection, TinyVector< N, T >::size(), sum(), triangleWithVertex, vertexInTriangles, and vertexVectTriangles.
Referenced by __createTrianglesIntersection().
01209 { 01210 //build the vectors K.pointsIntersection, K.pointsin with points intersection include in K 01211 //put K.edgecut[i]=1 if the edge i is cut 01212 //build vertexInTriangles, triangleWithVertex (for build mesh by front) 01213 //build vertexVectTriangles 01214 TinyVector<3,TinyVector<2,int> >& edgesCut=K.edgecut; 01215 TinyVector<3,TinyVector<2,const Vertex*> > & pointsIntersection=K.pointsIntersection; 01216 std::map<const Vertex* ,const Vertex*>& pointsInterior=K.pointsin; 01217 01218 int numberPointsInterior=pointsInterior.size(); 01219 const size_t& numobject=K.numobject; 01220 const MapCellTriangle& hexaToTriangle1=*(O2.hexalist); 01221 01222 MapCellTriangle::const_iterator it1=hexaToTriangle1.find(cell); 01223 if(it1!=hexaToTriangle1.end()) { 01224 std::list<Triangle*> listTriangle1=(*it1).second; 01225 for(std::list<Triangle*>::iterator jt0=listTriangle1.begin() ; 01226 jt0!=listTriangle1.end() ; ++jt0) { 01227 01228 PairTriangleNew pairTriangle; 01229 if(numobject<objectNumber) { 01230 pairTriangle.first=(currentTriangle); 01231 pairTriangle.second=(*jt0); 01232 } else { 01233 pairTriangle.second=(currentTriangle); 01234 pairTriangle.first=(*jt0); 01235 } 01236 size_t temp=0; 01237 01238 if(pairTriangleToIntersectionPoints.find(pairTriangle)!=pairTriangleToIntersectionPoints.end()) { 01239 TinyVector<3,size_t > cutTriangle; 01240 if(numobject<objectNumber) { 01241 cutTriangle=(pairTriangleToIntersectionPoints[pairTriangle]).cutTriangle1(); 01242 } else { 01243 cutTriangle=(pairTriangleToIntersectionPoints[pairTriangle]).cutTriangle2(); 01244 } 01245 //detection tr plat 01246 size_t isDegenerate=0; 01247 if(__isDegenerate(*(*jt0))) { 01248 // ffout(4)<<"degenerate triangle\n"; 01249 isDegenerate=1; 01250 } 01251 if(pairTriangleToIntersectionPoints[pairTriangle].size()==2 and isDegenerate==0) { 01252 const Vertex*& V0=pairTriangleToIntersectionPoints[pairTriangle][0]; 01253 const Vertex*& V1=pairTriangleToIntersectionPoints[pairTriangle][1]; 01254 const Triangle T=(*(*jt0)); 01255 if((V0==&(*(*jt0))(0) or V0==&(*(*jt0))(1) or V0==&(*(*jt0))(2)) 01256 and (V1==&(*(*jt0))(0) or V1==&(*(*jt0))(1) or V1==&(*(*jt0))(2))) { 01257 //ffout(4)<<"inter confondu avec arete\n"; 01258 isDegenerate=0; 01259 } 01260 } 01261 if(pairTriangleToIntersectionPoints[pairTriangle].size()>=2 and isDegenerate==0) { 01262 for(size_t b=0; b<pairTriangleToIntersectionPoints[pairTriangle].size() ; ++b) { 01263 const Vertex*& V=pairTriangleToIntersectionPoints[pairTriangle][b]; 01264 const Triangle T=(*(*jt0)); 01265 // si on a le point est confondu avec un sommet on n'a pas besoin du triangle pour la connectivite 01266 if(!(V==&(*(*jt0))(0) or V==&(*(*jt0))(1) or V==&(*(*jt0))(2)) and 01267 Norm(*V-(*(*jt0))(0))>1e-6 and Norm(*V-(*(*jt0))(1))>1e-6 and Norm(*V-(*(*jt0))(2))>1e-6 01268 /*or b==0*/) { 01269 vertexVectTriangles[V].push_back(*jt0); 01270 if(vertexInTriangles.find(V)==vertexInTriangles.end()) { 01271 TinyVector<2,const Triangle*> triangles; 01272 triangles[0]=*jt0; 01273 triangles[1]=*jt0; 01274 vertexInTriangles[V]=triangles; 01275 } else { 01276 (*vertexInTriangles.find(V)).second[1]=*jt0; 01277 } 01278 if(triangleWithVertex.find(*jt0)==triangleWithVertex.end()) { 01279 TinyVector<2,const Vertex*> vertexTriangle; 01280 vertexTriangle[0]=V; 01281 vertexTriangle[1]=V; 01282 triangleWithVertex[*jt0]=vertexTriangle; 01283 } else { 01284 (*triangleWithVertex.find(*jt0)).second[1]=V; 01285 } 01286 } else { 01287 //le point est confondu avec un sommet du tr mais dans certains cas on en a besoin qd meme!! 01288 vertexVectTriangles[V].push_back(*jt0); 01289 } 01290 } 01291 } else { 01292 if(pairTriangleToIntersectionPoints[pairTriangle].size()!=0) { 01293 //ffout(4)<<"on a un point non pris... triangle plat??\n"; 01294 //ffout(4)<<(*(*jt0))(0)<<"\n"; 01295 //ffout(4)<<(*(*jt0))(1)<<"\n"; 01296 //ffout(4)<<(*(*jt0))(2)<<"\n"; 01297 //ffout(4)<<*pairTriangleToIntersectionPoints[pairTriangle][0]<<"\n"; 01298 vertexVectTriangles[pairTriangleToIntersectionPoints[pairTriangle][0]].push_back(*jt0); 01299 01300 } 01301 } 01302 01303 for (size_t n=0; n < cutTriangle.size(); ++n) { 01304 if(cutTriangle[n]!=0) { 01305 temp+=1; 01306 if(edgesCut[n][0]==0) { 01307 edgesCut[n][0]=1; 01308 pointsIntersection[n][0]= 01309 (pairTriangleToIntersectionPoints[pairTriangle][cutTriangle[n]-1]); 01310 } else { 01311 edgesCut[n][1]=1; 01312 pointsIntersection[n][1]= 01313 (pairTriangleToIntersectionPoints[pairTriangle][cutTriangle[n]-1]); 01314 } 01315 } 01316 } 01317 01318 if(temp<pairTriangleToIntersectionPoints[pairTriangle].size()) { 01319 numberPointsInterior+=1; 01320 size_t r=0; 01321 size_t sum=cutTriangle[0]+cutTriangle[1]+cutTriangle[2]; 01322 if(sum>5) { 01323 ffout(4)<<"sum "<<sum<<'\n'; 01324 } 01325 01326 switch (sum) { 01327 case 0: { 01328 r=0; 01329 for(size_t i=1 ; i<pairTriangleToIntersectionPoints[pairTriangle].size() ;++i) 01330 pointsInterior[(pairTriangleToIntersectionPoints[pairTriangle][i])]= 01331 (pairTriangleToIntersectionPoints[pairTriangle][i]); 01332 break; 01333 } 01334 case 2: 01335 case 5: { 01336 r=0; 01337 break; 01338 case 4: 01339 case 1: 01340 r=1; 01341 break; 01342 } 01343 case 3: { 01344 r=2; 01345 break; 01346 } 01347 default: { 01348 ffout(4) << "pbs sum = "<<sum<<" size " 01349 << pairTriangleToIntersectionPoints[pairTriangle].size()<<" \n"; 01350 ffout(4) << K(0) << "\n"; 01351 ffout(4) << K(1) << "\n"; 01352 ffout(4) << K(2) << "\n"; 01353 ffout(4) << "cutTriangle "<<cutTriangle[0] << " " << cutTriangle[1] << " " << cutTriangle[2] << "\n"; 01354 ffout(4) << "edgesCut "<<edgesCut[0] << " " << edgesCut[1] << " " << edgesCut[2] << "\n"; 01355 //edgesCut[0]=cutTriangle[0]; 01356 //edgesCut[1]=cutTriangle[1]; 01357 //edgesCut[2]=cutTriangle[2]; 01358 01359 } 01360 } 01361 if(pointsInterior.find(pairTriangleToIntersectionPoints[pairTriangle][r]) 01362 ==pointsInterior.end() and sum<=5) { 01363 pointsInterior[(pairTriangleToIntersectionPoints[pairTriangle][r])] 01364 =(pairTriangleToIntersectionPoints[pairTriangle][r]); 01365 } 01366 } 01367 } else { 01368 // ffout(4) <<"pasintersecte\n"; 01369 } 01370 } 01371 } 01372 }

| TinyVector< 3, TinyVector< 2, int > > SurfaceMeshGenerator::Internals::__determinateEdgeCut | ( | const size_t & | numobject, | |
| const MeshedObject & | O1, | |||
| const MeshedObject & | O2, | |||
| const Triangle *& | currentTriangle, | |||
| const Cell * | cell | |||
| ) | [private] |
Definition at line 1375 of file SurfaceMeshGenerator.cpp.
References SurfaceMeshGenerator::Internals::MeshedObject::hexalist, and pairTriangleToIntersectionPoints.
Referenced by __putEdgeRef(), and __putRefByFront().
01380 { 01381 // put edgecut=1 if the edge is cut 01382 TinyVector<3,TinyVector<2,int> > edgesCut; 01383 edgesCut=0; 01384 size_t objectNumber=0; 01385 if(numobject==0) 01386 objectNumber=1; 01387 const MapCellTriangle& hexaToTriangle1=*(O2.hexalist); 01388 01389 MapCellTriangle::const_iterator it1=hexaToTriangle1.find(cell); 01390 01391 if(it1!=hexaToTriangle1.end()) { 01392 std::list<Triangle*> listTriangle1=(*it1).second; 01393 for(std::list<Triangle*>::iterator jt0=listTriangle1.begin() ; 01394 jt0!=listTriangle1.end() ; ++jt0) { 01395 01396 PairTriangleNew pairTriangle; 01397 if(numobject<objectNumber) { 01398 pairTriangle.first=(currentTriangle); 01399 pairTriangle.second=(*jt0); 01400 } else { 01401 pairTriangle.second=(currentTriangle); 01402 pairTriangle.first=(*jt0); 01403 } 01404 01405 std::map< PairTriangleNew , IntersectionPoints>::iterator i = pairTriangleToIntersectionPoints.find(pairTriangle); 01406 if(i != pairTriangleToIntersectionPoints.end()) { 01407 TinyVector<3,size_t> cutTriangle; 01408 if(numobject<objectNumber) { 01409 cutTriangle=(*i).second.cutTriangle1(); 01410 } else { 01411 cutTriangle=(*i).second.cutTriangle2(); 01412 } 01413 01414 for (size_t n=0; n<3; ++n) { 01415 if(cutTriangle[n]!=0) { 01416 edgesCut[n]=1; 01417 } 01418 } 01419 } 01420 else { 01421 // ffout(4)<<"la paire de triangle n'existe pas!\n"; 01422 } 01423 } 01424 } 01425 return edgesCut; 01426 }
| void SurfaceMeshGenerator::Internals::__putEdgeRef | ( | const Triangle *& | Tmesh, | |
| const Triangle *& | T, | |||
| const size_t | numobject, | |||
| const MeshedObject & | O1, | |||
| const MeshedObject & | O2 | |||
| ) | [private] |
Definition at line 1625 of file SurfaceMeshGenerator.cpp.
References __determinateEdgeCut(), edgesRefVertex, and sum().
Referenced by __putRefByFront().
01630 { 01631 //put edgesRefVertex=2 if the vertex is in the domain 01632 //ffout(0)<<"j'initialise le front\n"; 01633 01634 TinyVector<3,TinyVector<2,int> > edgecut; 01635 const Cell* cell=&((*T).mother()); 01636 edgecut =__determinateEdgeCut(numobject,O1,O2,T,cell); 01637 size_t& ref0=(*edgesRefVertex[numobject])[&(*Tmesh)(0)]; 01638 size_t& ref1=(*edgesRefVertex[numobject])[&(*Tmesh)(1)]; 01639 size_t& ref2=(*edgesRefVertex[numobject])[&(*Tmesh)(2)]; 01640 01641 if(ref0+ref1+ref2!=6) { 01642 TinyVector<2,int> edge0=edgecut[0]; 01643 TinyVector<2,int> edge1=edgecut[1]; 01644 TinyVector<2,int> edge2=edgecut[2]; 01645 size_t sum=edge0[0]+edge1[0]+edge2[0]; 01646 if((ref0==2 or ref1==2 or ref2==2) and sum==0) { 01647 ref0=2; 01648 ref1=2; 01649 ref2=2; 01650 } else { 01651 if((ref1==2 xor ref0==2) and edge0==1 and sum>1){ 01652 if(ref0==2) { 01653 ref1=1; 01654 } else { 01655 ref0=1; 01656 } 01657 } 01658 if((ref2==2 xor ref0==2) and edge1==1 and sum>1 ){ 01659 if(ref0==2) { 01660 ref2=1; 01661 } else { 01662 ref0=1; 01663 } 01664 } 01665 if((ref2==2 xor ref1==2) and edge2==1 and sum>1 ){ 01666 if(ref2==2) { 01667 ref1=1; 01668 } else { 01669 ref2=1; 01670 } 01671 } 01672 } 01673 } 01674 }

| void SurfaceMeshGenerator::Internals::__putRefByFront | ( | const size_t | numobject, | |
| const MeshedObject & | O1, | |||
| const MeshedObject & | O2, | |||
| const SurfaceMeshOfTriangles & | surfmesh, | |||
| const std::set< const Cell * > & | toTreatHexahedra | |||
| ) | [private] |
Definition at line 1429 of file SurfaceMeshGenerator.cpp.
References __determinateEdgeCut(), __putEdgeRef(), SurfaceMeshOfTriangles::cell(), Connectivity< MeshType >::cells(), SurfaceMeshOfTriangles::connectivity(), edgesRefVertex, ffout(), listOfTriangleMeshFront, SurfaceMeshOfTriangles::numberOfCells(), Cell::reference(), and sum().
Referenced by __createTrianglesIntersection().
01433 { 01434 //pour etre sur qu'on traite bien tous les tr qu'il faut 01435 std::map<const Triangle*,size_t> listTreat; 01436 //to put the reference by front 01437 std::list<const Triangle*> front; 01438 int frontSize = 0; 01439 01440 size_t objectNumber=0; 01441 if(numobject==0) 01442 objectNumber=1; 01443 size_t nbcell=surfmesh.numberOfCells(); 01444 //initialize the front 01445 ffout(4)<<"taille de totreatHexahedra = "<<toTreatHexahedra.size()<<"\n"; 01446 size_t i=0; 01447 while(i<nbcell) { 01448 const Triangle* T=&(surfmesh.cell(i)); 01449 const Cell* cell=&((*T).mother()); 01450 if(toTreatHexahedra.find(cell)!=toTreatHexahedra.end() 01451 and ((*edgesRefVertex[numobject])[&(*T)(0)]==2 01452 or (*edgesRefVertex[numobject])[&(*T)(1)]==2 01453 or (*edgesRefVertex[numobject])[&(*T)(2)]==2)) { 01454 front.push_front(T); 01455 listTreat[T]=1; 01456 frontSize++; 01457 const Triangle*& TT=(*listOfTriangleMeshFront.find(T)).second; 01458 // on traite le triangle du front 01459 __putEdgeRef(T,TT,numobject,O1,O2); 01460 } 01461 ++i; 01462 } 01463 01464 size_t iter=0; 01465 ffout(4)<<"taille initial du front ="<< frontSize <<"\n"; 01466 //if(front.size()==0) 01467 if(nbcell != 0) { 01468 ffout(4)<<"ref de surfmesh = "<<surfmesh.cell(0).reference()<<"\n"; 01469 } 01470 //put reference by front 01471 size_t erase=0; 01472 01473 const Connectivity<SurfaceMeshOfTriangles>& connect 01474 = surfmesh.connectivity(); 01475 01476 while(frontSize !=0 and iter<nbcell) { 01477 std::list<const Triangle*>::iterator er=front.begin() ; 01478 for(std::list<const Triangle*>::iterator jt0=front.begin() ; 01479 jt0!=front.end() ; ++jt0) { 01480 if(jt0!=front.begin() and erase==1) { 01481 er=front.erase(er); 01482 frontSize--; 01483 } 01484 er=jt0; 01485 erase=0; 01486 const Triangle* T=*jt0; 01487 const Triangle*& TTo=(*listOfTriangleMeshFront.find(T)).second; 01488 const Vertex& Vo0 = (*TTo)(0); 01489 const Vertex& Vo1 = (*TTo)(1); 01490 const Vertex& Vo2 = (*TTo)(2); 01491 TriangleCut Kneigho(Vo0,Vo1,Vo2,numobject,objectNumber); 01492 const Cell* cello=&((*TTo).mother()); 01493 Kneigho.edgecut =__determinateEdgeCut(numobject,O1,O2,TTo,cello); 01494 TinyVector<2,int> edgeo0=Kneigho.edgecut[0]; 01495 TinyVector<2,int> edgeo1=Kneigho.edgecut[1]; 01496 TinyVector<2,int> edgeo2=Kneigho.edgecut[2]; 01497 //__putEdgeRef(T,TTo,numobject,O1,O2); 01498 size_t& refo0=(*edgesRefVertex[numobject])[&(*T)(0)]; 01499 size_t& refo1=(*edgesRefVertex[numobject])[&(*T)(1)]; 01500 size_t& refo2=(*edgesRefVertex[numobject])[&(*T)(2)]; 01501 if(((refo0==2 or refo1==2 or refo2==2) and refo0+refo1+refo2<6 and edgeo0+edgeo1+edgeo2==0) 01502 /*or (refo0+refo1+refo2!=6 and edgeo0+edgeo1+edgeo2==0 and refo0+refo1+refo2>0)*/ 01503 /*or (edgeo0[0]==1 and refo0+refo1!=2 and refo0+refo1+refo2!=0) 01504 or (edgeo1[0]==1 and refo0+refo2!=2 and refo0+refo1+refo2!=0) 01505 or (edgeo2[0]==1 and refo2+refo1!=2 and refo0+refo1+refo2!=0)*/) { 01506 //ffout(4)<<"chouette on garde "<<refo0+refo1+refo2<<"\n"; 01507 refo0=2; 01508 refo1=2; 01509 refo2=2; 01510 //erase=1; 01511 } else { 01512 erase=1; 01513 } 01514 01515 const TinyVector<3,const Triangle*>& V=connect.cells(*T); 01516 01517 for(size_t j=0 ; j<3 ; ++j) { 01518 //check the neighbours exist 01519 if(V[j]!=0){ 01520 const Triangle* triangle=V[j]; 01521 const Triangle*& TT=(*listOfTriangleMeshFront.find(triangle)).second; 01522 const Vertex& V0 = (*TT)(0); 01523 const Vertex& V1 = (*TT)(1); 01524 const Vertex& V2 = (*TT)(2); 01525 TriangleCut Kneigh(V0,V1,V2,numobject,objectNumber); 01526 const Cell* cell=&((*TT).mother()); 01527 Kneigh.edgecut =__determinateEdgeCut(numobject,O1,O2,TT,cell); 01528 size_t& ref0=(*edgesRefVertex[numobject])[&(*triangle)(0)]; 01529 size_t& ref1=(*edgesRefVertex[numobject])[&(*triangle)(1)]; 01530 size_t& ref2=(*edgesRefVertex[numobject])[&(*triangle)(2)]; 01531 if(ref0+ref1+ref2!=6) { 01532 //ffout(0)<<"le voisin n'est pas de ref 2\n"; 01533 //ffout(0)<<"avt "<<ref0<<" "<<ref1<<" "<<ref2<<"\n"; 01534 size_t test=0; 01535 TinyVector<2,int> edge0=Kneigh.edgecut[0]; 01536 TinyVector<2,int> edge1=Kneigh.edgecut[1]; 01537 TinyVector<2,int> edge2=Kneigh.edgecut[2]; 01538 size_t sum=edge0[0]+edge1[0]+edge2[0]; 01539 if((ref0==2 or ref1==2 or ref2==2) and 01540 (ref0!=1 and ref1!=1 and ref2!=1) and sum==0) { 01541 //ffout(4)<<"ref 2 partout\n"; 01542 test=1; 01543 ref0=2; 01544 ref1=2; 01545 ref2=2; 01546 } else { 01547 if(((ref1==2) xor (ref0==2)) and (edge0==0) and (ref1!=1) and (ref0!=1)) { 01548 ref1=2; 01549 ref0=2; 01550 test=1; 01551 } 01552 if(((ref2==2) xor (ref0==2)) and (edge1==0) and (ref2!=1) and (ref0!=1)) { 01553 ref2=2; 01554 ref0=2; 01555 test=1; 01556 } 01557 if(((ref1==2) xor (ref2==2)) and (edge2==0) and (ref1!=1) and (ref2!=1)) { 01558 ref1=2; 01559 ref2=2; 01560 test=1; 01561 } 01562 if(((ref1==2) xor (ref0==2)) and (edge0==1) and (sum>1)){ 01563 //ffout(4)<<"ref 1 2 0 partout\n"; 01564 //ffout(4)<<ref0<<" "<<ref1<<"\n"; 01565 if(ref1+ref0!=3) { 01566 test=1; 01567 } 01568 if(ref0==2) { 01569 ref1=1; 01570 } else { 01571 ref0=1; 01572 } 01573 } 01574 if(((ref2==2) xor (ref0==2)) and (edge1==1) and (sum>1)) { 01575 //ffout(0)<<"ref 1 2 1 partout\n"; 01576 //ffout(4)<<ref0<<" "<<ref2<<"\n"; 01577 if(ref2+ref0!=3) { 01578 test=1; 01579 } 01580 if(ref0==2) { 01581 ref2=1; 01582 } else { 01583 ref0=1; 01584 } 01585 } 01586 if(((ref2==2) xor (ref1==2)) and (edge2==1) and (sum>1)) { 01587 //ffout(0)<<"ref 1 2 2 partout\n"; 01588 //ffout(4)<<ref1<<" "<<ref2<<"\n"; 01589 if(ref1+ref2!=3) { 01590 test=1; 01591 } 01592 if(ref2==2) { 01593 ref1=1; 01594 } else { 01595 ref2=1; 01596 } 01597 } 01598 } 01599 if(test==1/*ref0+ref1+ref2==6 *//*or edge0[0]+edge1[0]+edge2[0]==1*/) { 01600 front.push_front(triangle); 01601 listTreat[triangle]=1; 01602 frontSize++; 01603 } else if(listTreat.find(triangle)==listTreat.end()) { 01604 //ffout(4)<<"pas encore traite\n"; 01605 front.push_front(triangle); 01606 listTreat[triangle]=1; 01607 frontSize++; 01608 } 01609 //ffout(0)<<ref0<<" "<<ref1<<" "<<ref2<<"\n"; 01610 } 01611 } 01612 } 01613 } 01614 if(erase==1 and frontSize==1) { 01615 er=front.erase(er); 01616 frontSize--; 01617 } 01618 ++iter; 01619 ffout(4)<<"taille du front = "<<front.size()<<" "<<iter<<" "<<nbcell<<"\n"; 01620 } 01621 01622 }

| void SurfaceMeshGenerator::Internals::__createCase | ( | const TriangleCut & | K, | |
| size_t & | in, | |||
| size_t & | in1, | |||
| TinyVector< 3, size_t > & | place | |||
| ) | [private] |
Definition at line 1677 of file SurfaceMeshGenerator.cpp.
References SurfaceMeshGenerator::Internals::TriangleCut::edgecut, and SurfaceMeshGenerator::Internals::TriangleCut::isInTriangle.
Referenced by __createGeneral().
01680 { 01681 size_t numberIn=K.isInTriangle[0]+K.isInTriangle[1]+K.isInTriangle[2]; 01682 01683 switch (numberIn) { 01684 case 0: { 01685 if(K.edgecut[0][0]==1) { 01686 place[0]=0; 01687 if(K.edgecut[1][0]==1) { 01688 place[1]=1; 01689 place[2]=2; 01690 } else { 01691 place[1]=2; 01692 place[2]=1; 01693 } 01694 } else { 01695 if(K.edgecut[1][0]==1) { 01696 place[0]=1; 01697 place[1]=2; 01698 place[2]=0; 01699 } else { 01700 place[0]=2; 01701 place[1]=0; 01702 place[2]=1; 01703 } 01704 } 01705 break; 01706 } 01707 case 1: { 01708 if(K.isInTriangle[1]==1) { 01709 in=1; 01710 in1=in; 01711 place[0]=2; 01712 place[1]=0; 01713 place[2]=1; 01714 } else if(K.isInTriangle[2]==1) { 01715 in=2; 01716 in1=in; 01717 place[0]=1; 01718 place[1]=2; 01719 place[2]=0; 01720 } else { 01721 in1=in; 01722 place[0]=0; 01723 place[1]=1; 01724 place[2]=2; 01725 } 01726 break; 01727 } 01728 case 2: { 01729 if(K.isInTriangle[1]==1 and K.isInTriangle[0]==1) { 01730 in=1; 01731 in1=0; 01732 place[0]=2; 01733 place[1]=1; 01734 place[2]=0; 01735 } else if(K.isInTriangle[2]==1 and K.isInTriangle[1]==1) { 01736 in=2; 01737 in1=1; 01738 place[0]=1; 01739 place[1]=0; 01740 place[2]=2; 01741 } else { 01742 in=0; 01743 in1=2; 01744 place[0]=0; 01745 place[1]=2; 01746 place[2]=1; 01747 } 01748 break; 01749 } 01750 case 3: { 01751 if(K.edgecut[0]==1) { 01752 place[0]=0; 01753 in1=2; 01754 in=0; 01755 if(K.edgecut[1]==1) { 01756 place[1]=1; 01757 place[2]=2; 01758 } else { 01759 place[1]=2; 01760 place[2]=1; 01761 } 01762 } else if(K.edgecut[1]==1) { 01763 in1=1; 01764 in=2; 01765 place[0]=1; 01766 place[1]=2; 01767 place[2]=0; 01768 } else { 01769 in1=0; 01770 in=1; 01771 place[0]=2; 01772 place[1]=1; 01773 place[2]=0; 01774 } 01775 break; 01776 } 01777 } 01778 01779 }
| void SurfaceMeshGenerator::Internals::__transformVertex | ( | const TriangleCut & | K, | |
| std::vector< const Vertex * > & | points, | |||
| std::vector< Vertex > & | pointstrian | |||
| ) | [private] |
Definition at line 1782 of file SurfaceMeshGenerator.cpp.
Referenced by __create2SD(), __create3in(), and __createGeneral().
01785 { 01786 size_t taille=points.size(); 01787 for(unsigned ie=0;ie<taille;++ie) { 01788 const Vertex& P=*points[ie]; 01789 TinyMatrix<3,3, real_t> A; 01790 for (size_t i=0; i<3; ++i) { 01791 for (size_t j=0; j<3; ++j) { 01792 A(i,j)=(K(j))[i]; 01793 } 01794 } 01795 TinyVector<3, real_t> lambda; 01796 gaussPivot(A,P,lambda); 01797 Vertex Pi; 01798 Pi[0]=lambda[0]; 01799 Pi[1]=lambda[1]; 01800 Pi[2]=0; 01801 pointstrian[ie]=Pi; 01802 } 01803 01804 }
| void SurfaceMeshGenerator::Internals::__addPoints | ( | const Vertex *& | Pcut, | |
| size_t & | stopcut, | |||
| std::vector< const Vertex * > & | pointslist1, | |||
| std::vector< const Vertex * > & | pointslist2 | |||
| ) | [private] |
Definition at line 1806 of file SurfaceMeshGenerator.cpp.
Referenced by __create2SD(), and __create3in().
01810 { 01811 if(stopcut==0) { 01812 //ffout(4)<<"00\n"; 01813 pointslist1.push_back(Pcut); 01814 stopcut=3; 01815 } else { 01816 //ffout(4)<<"10\n"; 01817 pointslist2.push_back(Pcut); 01818 } 01819 }
| void SurfaceMeshGenerator::Internals::__addList | ( | const TriangleCut & | K | ) | [private] |
Definition at line 1822 of file SurfaceMeshGenerator.cpp.
References ffout(), SurfaceMeshGenerator::Internals::TriangleCut::isInTriangle, TinyVector< N, T >::size(), triangleWithVertex, vertexInTriangles, and vertexVectTriangles.
Referenced by __createGeneral().
01823 { 01824 01825 // sdp: not used? 01826 // size_t numberInEdges=K.edgecut[0][0]+K.edgecut[1][0]+K.edgecut[2][0] 01827 // +K.edgecut[0][1]+K.edgecut[1][1]+K.edgecut[2][1]; 01828 size_t nbInter=vertexInTriangles.size(); 01829 //ffout(4)<<"nb Inter avt = "<<nbInter<<"\n"; 01830 //if(vertexVectTriangles.size()!=0) { 01831 // ffout(4)<<"nb points total "<<vertexVectTriangles.size()<<"\n"; 01832 //} 01833 01834 //premiere etage : verifier que vertexInTriangles contient bien tous les points 01835 if(nbInter<vertexVectTriangles.size()) { 01836 //il manque des points 01837 for(std::map<const Vertex*,std::vector<const Triangle*> >::iterator it=vertexVectTriangles.begin() 01838 ; it!=vertexVectTriangles.end() ; ++it) { 01839 const Vertex* PP=(*it).first; 01840 //ffout(4)<<"-----\n"; 01841 //ffout(4)<<*PP<<"\n"; 01842 01843 std::vector<const Triangle*> VT=(*it).second; 01844 if(vertexInTriangles.find(PP)==vertexInTriangles.end()) { 01845 //ffout(4)<<"je l'ajoute\n"; 01846 //le point n'existe pas il faut le rajouter 01847 //on cherche a quel triangle l'associer 01848 if(nbInter==0) { 01849 TinyVector<2,const Triangle*> triangles; 01850 triangles[0]=VT[0]; 01851 triangles[1]=VT[0]; 01852 vertexInTriangles[PP]=triangles; 01853 } else { 01854 size_t nn=0,stop2=0; 01855 size_t taille=VT.size(); 01856 //test si le point est confondu avec un point in 01857 if(K.isInTriangle[0]==1 and Norm(K(0)-*PP)<1e-6) { 01858 ffout(4)<<"trop proche 1\n"; 01859 stop2=1; 01860 } 01861 if(K.isInTriangle[1]==1 and Norm(K(1)-*PP)<1e-6) { 01862 ffout(4)<<"trop proche 2\n"; 01863 stop2=1; 01864 } 01865 if(K.isInTriangle[2]==1 and Norm(K(2)-*PP)<1e-6) { 01866 ffout(4)<< Norm(K(2)-*PP)<<" trop proche 3\n"; 01867 ffout(4)<<*PP<<"\n"; 01868 ffout(4)<<K(2)<<"\n"; 01869 stop2=1; 01870 } 01871 while(nn<taille and stop2==0) { 01872 const Triangle* TT=VT[nn]; 01873 if(triangleWithVertex.find(TT)!=triangleWithVertex.end()) { 01874 (*triangleWithVertex.find(TT)).second[1]=PP; 01875 TinyVector<2,const Triangle*> triangles; 01876 triangles[0]=TT; 01877 triangles[1]=TT; 01878 vertexInTriangles[PP]=triangles; 01879 stop2=1; 01880 } 01881 ++nn; 01882 } 01883 if(nn==taille and stop2==0) { 01884 (*triangleWithVertex.find(&K)).second[0]=PP; 01885 TinyVector<2,const Triangle*> triangles; 01886 triangles[0]=&K; 01887 triangles[1]=&K; 01888 vertexInTriangles[PP]=triangles; 01889 ffout(4)<<"bizarreeeeee on a pas trouve le tr\n"; 01890 //ffout(4)<<nn<<" =? "<<taille<<" "<<stop2<<" =? 0\n"; 01891 //ffout(4)<<*PP<<"\n"; 01892 //ffout(4)<<K(0)<<"\n"; 01893 //ffout(4)<<K(1)<<"\n"; 01894 //ffout(4)<<K(2)<<"\n"; 01895 } 01896 } 01897 } else { 01898 01899 } 01900 } 01901 } 01902 }

| void SurfaceMeshGenerator::Internals::__createList | ( | const TriangleCut & | K, | |
| std::vector< const Vertex * > & | points, | |||
| size_t & | in, | |||
| size_t & | in1, | |||
| TinyVector< 3, size_t > | place | |||
| ) | [private] |
Definition at line 1905 of file SurfaceMeshGenerator.cpp.
References __findInEdges(), __findTriangle(), __findVertex(), SurfaceMeshGenerator::Internals::TriangleCut::edgecut, ffout(), SurfaceMeshGenerator::Internals::TriangleCut::isInTriangle, SurfaceMeshGenerator::Internals::TriangleCut::pointsIntersection, and vertexInTriangles.
Referenced by __createGeneral().
01910 { 01911 TinyVector<2,const Vertex*> P; 01912 TinyVector<2,const Triangle*> T; 01913 size_t nbInter=vertexInTriangles.size(); 01914 size_t nbCut=K.edgecut[0][0]+K.edgecut[1][0]+K.edgecut[2][0]; 01915 size_t numberIn=K.isInTriangle[0]+K.isInTriangle[1]+K.isInTriangle[2]; 01916 size_t stop=0,iInter=0,iCut=0; 01917 //initialisation 01918 //if(numberIn==3) { 01919 // points.push_back(&K(1)); 01920 // points.push_back(&K(2)); 01921 //} 01922 if((numberIn==3 or numberIn==2) and stop==0) { 01923 points.push_back(&K(in1)); 01924 } 01925 const Vertex* A=&K(in); 01926 if(numberIn>0) { 01927 points.push_back(A); 01928 //ffout(4)<<*A<<"\n"; 01929 } 01930 if(nbCut>0) { 01931 P[0]=K.pointsIntersection[place[0]][0]; 01932 //attention si on a 2 points d'inter et un point in choisir le point le plus proche de A 01933 if(K.edgecut[place[0]][1]!=0) { 01934 P[1]=K.pointsIntersection[place[0]][1]; 01935 if(numberIn>0) { 01936 real_t norm0=Norm(*A-*P[0]); 01937 real_t norm1=Norm(*A-*P[1]); 01938 if(norm1<norm0) { 01939 ffout(4)<<"--------------- cas inverse\n"; 01940 P[0]=P[1]; 01941 } 01942 } 01943 } 01944 if(P[0]!=A and nbInter!=0) { 01945 points.push_back(P[0]); 01946 } 01947 } else if(nbCut!=0) { 01948 if(P[0]==A) { 01949 ffout(4)<<"pbs point confondu A\n"; 01950 } 01951 std::map<const Vertex*,TinyVector<2,const Triangle*> >::iterator itvert=vertexInTriangles.begin(); 01952 P[0]=(*itvert).first; 01953 } 01954 if(nbCut!=0) { 01955 if(vertexInTriangles.find(P[0])!=vertexInTriangles.end()) { 01956 T[0]=(*vertexInTriangles.find(P[0])).second[0]; 01957 iInter=1; 01958 } else { 01959 ffout(4)<<"******\n"; 01960 ffout(4)<<"nb Inter "<<nbInter<<"\n"; 01961 ffout(4)<<"P0 = "<<P[0]<<*P[0]<<"\n"; 01962 ffout(4)<<"K(2) = "<<K(2)<<&K(2)<<"\n"; 01963 ffout(4)<<"pbs 0 existe pas\n"; 01964 ffout(4)<<place<<"\n"; 01965 //ffout(4)<<*K.pointsIntersection[0][0]<<"\n"; 01966 //ffout(4)<<*K.pointsIntersection[1][0]<<"\n"; 01967 ffout(4)<<K(0)<<"\n"; 01968 ffout(4)<<K(1)<<"\n"; 01969 ffout(4)<<K(2)<<"\n"; 01970 points.clear(); 01971 stop=1; 01972 } 01973 } 01974 01975 //ffout(4)<<"nb de points d'inter "<<nbInter<<"\n"; 01976 if(stop==0 and nbCut==2 ) { 01977 if(K.edgecut[place[1]][0]==1 and K.edgecut[place[0]][0]==1) { 01978 if(Norm(*K.pointsIntersection[place[1]][0]-*K.pointsIntersection[place[0]][0])<1e-12) { 01979 ffout(4)<<"les points sont confondus\n"; 01980 ffout(4)<<*K.pointsIntersection[place[0]][0]<<"\n"; 01981 stop=1; 01982 } 01983 } 01984 } 01985 01986 if(iInter==nbInter and nbInter==1 and numberIn==1) { 01987 //ATTENTION PEUT ETRE PLUS DE POINTS A PRENDRE 01988 if(nbCut>1) { 01989 const Vertex* PP=K.pointsIntersection[place[1]][0]; 01990 if(PP!=P[0]) { 01991 points.push_back(PP); 01992 } else { 01993 if(K.edgecut[place[2]]!=0) { 01994 const Vertex* PP1=K.pointsIntersection[place[2]][0]; 01995 if(PP1!=P[0]) { 01996 points.push_back(PP1); 01997 } 01998 } 01999 } 02000 } 02001 } 02002 02003 while(iInter<nbInter and stop==0) { 02004 //ffout(4)<<"createGeneral "<<iInter<<" "<<nbInter<<"\n"; 02005 //on cherche le voisin de Pi 02006 __findVertex(K,P,T,iCut,iInter,stop,in,in1,place,points); 02007 02008 //on cherche le triangle associe au nouveau Pi pour relancer 02009 size_t k=0; 02010 while(stop==3 or k==0) { 02011 //ffout(4)<<k<<" findTriangle\n"; 02012 __findTriangle(P,T,stop); 02013 if(stop==3) { 02014 //ffout(4)<<"stop3\n"; 02015 __findInEdges(K,P,T,iInter,stop,in,in1,place,points); 02016 } 02017 ++k; 02018 } 02019 02020 } 02021 02022 }

| bool SurfaceMeshGenerator::Internals::__verifExist | ( | const Vertex * | Ptemp, | |
| std::vector< const Vertex * > & | points | |||
| ) | [private] |
Definition at line 2025 of file SurfaceMeshGenerator.cpp.
Referenced by __create3in(), __findInEdges(), and __findVertex().
02027 { 02028 bool exist=false; 02029 for(size_t k=0 ; k<points.size() ; ++k) { 02030 if(points[k]==Pt) { 02031 //ffout(4)<<"je l'ai deja!!\n"; 02032 exist=true; 02033 } 02034 } 02035 return exist; 02036 }
| bool SurfaceMeshGenerator::Internals::__findOneEdge | ( | const TriangleCut & | K, | |
| const size_t & | number, | |||
| TinyVector< 2, const Vertex * > & | P | |||
| ) | [private] |
Definition at line 2039 of file SurfaceMeshGenerator.cpp.
References SurfaceMeshGenerator::Internals::TriangleCut::edgecut, and SurfaceMeshGenerator::Internals::TriangleCut::pointsIntersection.
Referenced by __findInEdges().
02042 { bool find=false; 02043 if(K.edgecut[number][0]!=0) { 02044 if(P[0]==K.pointsIntersection[number][0]) { 02045 //ffout(4)<<"0"<<number<<"\n"; 02046 find=true; 02047 } 02048 } 02049 if(K.edgecut[number][1]!=0 and find==false) { 02050 if(P[0]==K.pointsIntersection[number][1]) { 02051 //ffout(4)<<"1"<<number<<"\n"; 02052 find=true; 02053 } 02054 } 02055 return find; 02056 }
| void SurfaceMeshGenerator::Internals::__findInEdges | ( | const TriangleCut & | K, | |
| TinyVector< 2, const Vertex * > & | P, | |||
| TinyVector< 2, const Triangle * > & | T, | |||
| size_t & | iInter, | |||
| size_t & | stop, | |||
| size_t & | in, | |||
| size_t & | in1, | |||
| TinyVector< 3, size_t > | place, | |||
| std::vector< const Vertex * > & | points | |||
| ) | [private] |
Definition at line 2060 of file SurfaceMeshGenerator.cpp.
References __findOneEdge(), __verifExist(), SurfaceMeshGenerator::Internals::TriangleCut::edgecut, ffout(), SurfaceMeshGenerator::Internals::TriangleCut::pointsIntersection, and vertexInTriangles.
Referenced by __createList(), and __findVertex().
02069 { 02070 //size_t nbCut=K.edgecut[0][0]+K.edgecut[1][0]+K.edgecut[2][0]; 02071 size_t nbInter=vertexInTriangles.size(); 02072 size_t iCut=0; 02073 //ffout(4)<<*P[0]<<"\n"; 02074 //find on which edge we are 02075 bool find=false; 02076 while(find==false and iCut<3) { 02077 find=__findOneEdge(K,iCut,P); 02078 ++iCut; 02079 } 02080 if(iCut==3 and find==false) { 02081 if(iInter!=iInter) { 02082 ffout(4)<<iInter<<" "<<iInter<<"\n"; 02083 ffout(4)<<"pbs on a plus 3\n"; 02084 } 02085 stop=1; 02086 iCut=0; 02087 } else { 02088 --iCut; 02089 } 02090 02091 //ffout(4)<<"iCut "<<iCut<<"\n"; 02092 if(K.edgecut[iCut][1]!=0 and stop!=1) { 02093 //verifier que le point n'est pas deja dans la liste 02094 const Vertex* Ptemp=K.pointsIntersection[iCut][1]; 02095 bool exist=__verifExist(Ptemp,points); 02096 if(!exist) { 02097 P[0]=Ptemp; 02098 points.push_back(P[0]); 02099 //ffout(4)<<P[0]<<"\n"; 02100 //ffout(4)<<*P[0]<<"\n"; 02101 ++iInter; 02102 } else { 02103 exist=__verifExist(K.pointsIntersection[iCut][0],points); 02104 if(!exist) { 02105 P[0]=K.pointsIntersection[iCut][0]; 02106 points.push_back(P[0]); 02107 //ffout(4)<<P[0]<<"\n"; 02108 //ffout(4)<<*P[0]<<"\n"; 02109 ++iInter; 02110 } else { 02111 if(nbInter!=iInter) { 02112 ffout(4)<<"pbs on a plus de points\n"; 02113 ffout(4)<<nbInter<<" "<<iInter<<"\n"; 02114 ffout(4)<<K(0)<<"\n"; 02115 ffout(4)<<K(1)<<"\n"; 02116 ffout(4)<<K(2)<<"\n"; 02117 ffout(4)<<"dernier "<<iCut<<" "<<*K.pointsIntersection[iCut][0]<<"\n"; 02118 } 02119 stop=1; 02120 } 02121 } 02122 } else { 02123 if(nbInter!=iInter) { 02124 ffout(4)<<stop<<" pbs on a plus de points2\n"; 02125 ffout(4)<<nbInter<<" "<<iInter<<"\n"; 02126 ffout(4)<<K(0)<<"\n"; 02127 ffout(4)<<K(1)<<"\n"; 02128 ffout(4)<<K(2)<<"\n"; 02129 } 02130 stop=1; 02131 } 02132 }

| void SurfaceMeshGenerator::Internals::__findVertex | ( | const TriangleCut & | K, | |
| TinyVector< 2, const Vertex * > & | P, | |||
| TinyVector< 2, const Triangle * > & | T, | |||
| size_t & | iCut, | |||
| size_t & | iInter, | |||
| size_t & | stop, | |||
| size_t & | in, | |||
| size_t & | in1, | |||
| TinyVector< 3, size_t > | place, | |||
| std::vector< const Vertex * > & | points | |||
| ) | [private] |
Definition at line 2135 of file SurfaceMeshGenerator.cpp.
References __findInEdges(), __verifExist(), ffout(), and triangleWithVertex.
Referenced by __createList().
02145 { 02146 //size_t nbCut=K.edgecut[0][0]+K.edgecut[1][0]+K.edgecut[2][0]; 02147 //size_t nbInter=vertexInTriangles.size(); 02148 02149 if(triangleWithVertex.find(T[0])!=triangleWithVertex.end()) { 02150 TinyVector<2,const Vertex*> VV=(*triangleWithVertex.find(T[0])).second; 02151 if(VV[0]==P[0]) { 02152 if(VV[1]==P[0]) { 02153 //on est a priori sur une arete 02154 ffout(4)<<"cas findinedges\n"; 02155 __findInEdges(K,P,T,iInter,stop,in,in1,place,points); 02156 } else { 02157 //ffout(4)<<"cas 2\n"; 02158 P[1]=VV[1]; 02159 P[0]=P[1]; 02160 //ffout(4)<<P[0]<<"\n"; 02161 //ffout(4)<<*P[0]<<"\n"; 02162 points.push_back(P[0]); 02163 ++iInter; 02164 } 02165 } else { 02166 //ffout(4)<<"cas 3\n"; 02167 P[1]=VV[0]; 02168 P[0]=P[1]; 02169 //ffout(4)<<P[0]<<"\n"; 02170 //ffout(4)<<*P[0]<<"\n"; 02171 bool exist=__verifExist(P[0],points); 02172 if(!exist) { 02173 points.push_back(P[0]); 02174 ++iInter; 02175 } else { 02176 ffout(4)<<"on a un pbs le point existe deja!!\n"; 02177 stop=1; 02178 } 02179 02180 02181 } 02182 } 02183 }

| void SurfaceMeshGenerator::Internals::__findTriangle | ( | TinyVector< 2, const Vertex * > & | P, | |
| TinyVector< 2, const Triangle * > & | T, | |||
| size_t & | stop | |||
| ) | [private] |
Definition at line 2186 of file SurfaceMeshGenerator.cpp.
References ffout(), and vertexInTriangles.
Referenced by __createList().
02189 { 02190 if(stop==3) { 02191 stop=0; 02192 } 02193 TinyVector<2,const Triangle*> T2; 02194 if(vertexInTriangles.find(P[0])!=vertexInTriangles.end()) { 02195 T2[0]=(*vertexInTriangles.find(P[0])).second[0]; 02196 T2[1]=(*vertexInTriangles.find(P[0])).second[1]; 02197 } else { 02198 ffout(4)<<"pbs tr existe pas\n"; 02199 stop=1; 02200 } 02201 02202 if(T2[0]==T[0]) { 02203 if(T2[1]==T[0]) { 02204 stop=3; 02205 } else { 02206 T[0]=T2[1]; 02207 } 02208 } else { 02209 T[0]=T2[0]; 02210 } 02211 02212 }

| void SurfaceMeshGenerator::Internals::__createGeneral | ( | const TriangleCut & | K, | |
| const Cell * | cell, | |||
| std::vector< Triangle > & | triangleListIntersectionNew | |||
| ) | [private] |
Definition at line 2497 of file SurfaceMeshGenerator.cpp.
References __addList(), __addTriangle(), __create2SD(), __create3in(), __createCase(), __createList(), __createTriangle(), __transformVertex(), ASSERT, SurfaceMeshGenerator::Internals::TriangleCut::edgecut, ffout(), SurfaceMeshGenerator::Internals::TriangleCut::isInTriangle, Cell::reference(), and vertexInTriangles.
Referenced by __createTrianglesIntersection().
02499 { 02500 02501 // pour l'instant on suppose edge cut une seule fois 02502 size_t in=0,in1=1; 02503 TinyVector<3,size_t> place; 02504 std::vector<const Vertex*> points; 02505 02506 real_t epsilon=1e-6; 02507 real_t norm01=Norm(K(0)-K(1)); 02508 real_t norm02=Norm(K(0)-K(2)); 02509 real_t norm21=Norm(K(2)-K(1)); 02510 //test si le triangle est plat!! cad si 2 points sont "confondus" 02511 if(norm01<epsilon or norm02<epsilon or norm21<epsilon) { 02512 ffout(4)<<"le triangle est tres tres tres plat\n"; 02513 } else { 02514 //pour determiner le numero des edges cut et ceux des points in 02515 __createCase(K,in,in1,place); 02516 02517 //pour 3 edges cut et un in il faut changer place 02518 if(K.edgecut[0][0]+K.edgecut[1][0]+K.edgecut[2][0]==3 and 02519 K.isInTriangle[0]+K.isInTriangle[1]+K.isInTriangle[2]==1) { 02520 size_t temp=place[1]; 02521 place[1]=place[2]; 02522 place[2]=temp; 02523 } 02524 02526 //Vertex A(-0.000141,0.129744,0.110641); 02527 //if(Norm(A-K(0))<1e-6 or Norm(A-K(1))<1e-6 or Norm(A-K(2))<1e-6 ){ 02528 // ffout(4)<<"=============\n"; 02529 // ffout(4)<<K(0)<<"\n"; 02530 // ffout(4)<<K(1)<<"\n"; 02531 // ffout(4)<<K(2)<<"\n"; 02532 // ffout(4)<<K.isInTriangle<<"\n"; 02533 // ffout(4)<<K.edgecut<<"\n"; 02534 // ffout(4)<<place<<"\n"; 02535 // } 02536 02538 02539 //add vertex to vertexInTriangles if need 02540 __addList(K); 02541 02542 //create the list "points" 02543 size_t numberOfPoints=vertexInTriangles.size()+K.isInTriangle[0]+K.isInTriangle[1]+K.isInTriangle[2]; 02544 if(numberOfPoints>3) { 02545 __createList(K,points,in,in1,place); 02546 } else if(numberOfPoints==3) { 02547 //dans ce cas on a rien besoin de faire on cree un triangle 02548 //ffout(4)<<"on a juste 3 points\n"; 02549 std::vector<const Vertex*> PP; 02550 for(std::map<const Vertex*,TinyVector<2,const Triangle*> >::iterator jt=vertexInTriangles.begin() 02551 ; jt!=vertexInTriangles.end() ; jt++) { 02552 PP.push_back((*jt).first); 02553 //ffout(4)<<*(*jt).first<<"\n"; 02554 } 02555 for(size_t i=0 ; i<3 ; ++i) { 02556 if(K.isInTriangle[i]==1) { 02557 PP.push_back(&K(i)); 02558 } 02559 } 02560 ASSERT(PP.size()==3); 02561 real_t norm0=Norm(*PP[0]-*PP[1]); 02562 real_t norm1=Norm(*PP[0]-*PP[2]); 02563 real_t norm2=Norm(*PP[2]-*PP[1]); 02564 if(norm0>1e-6 and norm1>1e-6 and norm2>1e-6) { 02565 __addTriangle(Triangle(*PP[0],*PP[1],*PP[2],K.reference()),cell,triangleListIntersectionNew); 02566 } 02567 02568 } else { 02569 ffout(4)<<"moins de 3 points\n"; 02570 } 02571 02572 size_t taille=points.size(); 02573 // met les points dans le plan du triangle 02574 std::vector<Vertex> pointstrian(taille); 02575 //if(taille!=0) { 02576 // ffout(4)<<"points size "<<taille<<"\n"; 02577 //} 02578 //pour mettre les points dans un plan 02579 __transformVertex(K,points,pointstrian); 02580 02581 if(K.isInTriangle[0]+K.isInTriangle[1]+K.isInTriangle[2]==2 and 02582 K.edgecut[place[2]][0]!=0 and taille!=0) { 02583 ffout(4)<<"on est dans un cas a traiter pour le mailleur\n"; 02584 ffout(4)<<K(0)<<"\n"; 02585 ffout(4)<<K(1)<<"\n"; 02586 ffout(4)<<K(2)<<"\n"; 02587 // on veut decomposer la liste en 2 sous listes pour creer 2 sous domaines 02588 __create2SD(K,cell,points,pointstrian,place,triangleListIntersectionNew); 02589 02590 } else if(K.isInTriangle[0]+K.isInTriangle[1]+K.isInTriangle[2]==3) { 02591 ffout(4)<<"----------------- cas 3 in\n"; 02592 ffout(4)<<"place "<<place<<"\n"; 02593 ffout(4)<<K(0)<<"\n"; 02594 ffout(4)<<K(1)<<"\n"; 02595 ffout(4)<<K(2)<<"\n"; 02596 02597 size_t number=K.edgecut[0][0]+K.edgecut[1][0]+K.edgecut[2][0]; 02598 if(number==1) { 02599 __create3in(K,cell,points,in,in1,place,triangleListIntersectionNew); 02600 02601 } else { 02602 ffout(4)<<"il faut le traiter\n"; 02603 } 02604 //for(unsigned ie=0;ie<points.size();++ie) { 02605 // ffout(4)<<*points[ie]<<"\n"; 02606 //} 02607 } else if(taille!=0) { 02608 __createTriangle(K,cell,triangleListIntersectionNew,points,pointstrian); 02609 } 02610 } 02611 }

| void SurfaceMeshGenerator::Internals::__create2SD | ( | const TriangleCut & | K, | |
| const Cell * | cell, | |||
| std::vector< const Vertex * > & | points, | |||
| std::vector< Vertex > & | pointstrian, | |||
| const TinyVector< 3, size_t > & | place, | |||
| std::vector< Triangle > & | triangleListIntersectionNew | |||
| ) | [private] |
Definition at line 2415 of file SurfaceMeshGenerator.cpp.
References __addPoints(), __createTriangle(), __transformVertex(), SurfaceMeshGenerator::Internals::TriangleCut::edgecut, SurfaceMeshGenerator::Internals::TriangleCut::pointsIntersection, and TinyVector< N, T >::size().
Referenced by __createGeneral().
02420 { 02421 // on veut decomposer la liste en 2 sous listes pour creer 2 sous domaines 02422 size_t number=K.edgecut[place[2]][0]+K.edgecut[place[2]][1]; 02423 size_t taille=points.size(); 02424 02425 // pour determiner le ou les points ou on separe les listes 02426 TinyVector<2,const Vertex*> P; 02427 switch (number) { 02428 case 1: { 02429 P[0]=K.pointsIntersection[place[2]][0]; 02430 break; 02431 } 02432 case 2: { 02433 P[0]=K.pointsIntersection[place[2]][0]; 02434 P[1]=K.pointsIntersection[place[2]][1]; 02435 break; 02436 } 02437 } 02438 std::vector<const Vertex*> pointslist1; 02439 std::vector<const Vertex*> pointslist2; 02440 02441 size_t stopcut=0; 02442 for(unsigned ie=1;ie<taille;++ie) { 02443 const Vertex* Pcut=points[ie]; 02444 //ffout(4)<<*Pcut<<"\n"; 02445 // const Vertex& Pcutplan=pointstrian[ie]; 02446 if(Pcut==P[0]) { 02447 __addPoints(Pcut,stopcut,pointslist1,pointslist2); 02448 if(stopcut==3) { 02449 stopcut=1; 02450 } 02451 } else { 02452 if(number==2) { 02453 if(Pcut==P[1]) { 02454 __addPoints(Pcut,stopcut,pointslist1,pointslist2); 02455 if(stopcut==3) { 02456 stopcut=1; 02457 } 02458 } else { 02459 __addPoints(Pcut,stopcut,pointslist1,pointslist2); 02460 if(stopcut==3) { 02461 stopcut=0; 02462 } 02463 } 02464 } else { 02465 __addPoints(Pcut,stopcut,pointslist1,pointslist2); 02466 if(stopcut==3) { 02467 stopcut=0; 02468 } 02469 } 02470 } 02471 } 02472 pointslist2.push_back(points[0]); 02473 //verif des listes 02474 //ffout(4)<<"taille de list1 = "<<pointslist1.size()<<"\n"; 02475 //for(unsigned ie=0;ie<pointslist1.size();++ie) { 02476 // ffout(4)<<*pointslist1[ie]<<"\n"; 02477 //} 02478 //ffout(4)<<"taille de list2 = "<<pointslist2.size()<<"\n"; 02479 //for(unsigned ie=0;ie<pointslist2.size();++ie) { 02480 // ffout(4)<<*pointslist2[ie]<<"\n"; 02481 //} 02482 //on cree les 2 maillages 02483 if(pointslist1.size()>=3) { 02484 std::vector<Vertex> pointslist1plan(pointslist1.size()); 02485 __transformVertex(K,pointslist1,pointslist1plan); 02486 __createTriangle(K,cell,triangleListIntersectionNew,pointslist1,pointslist1plan); 02487 } 02488 if(pointslist2.size()>=3) { 02489 std::vector<Vertex> pointslist2plan(pointslist2.size()); 02490 __transformVertex(K,pointslist2,pointslist2plan); 02491 __createTriangle(K,cell,triangleListIntersectionNew,pointslist2,pointslist2plan); 02492 } 02493 02494 }

| void SurfaceMeshGenerator::Internals::__create3in | ( | const TriangleCut & | K, | |
| const Cell * | cell, | |||
| std::vector< const Vertex * > & | points, | |||
| const size_t | in, | |||
| const size_t | in1, | |||
| const TinyVector< 3, size_t > & | place, | |||
| std::vector< Triangle > & | triangleListIntersectionNew | |||
| ) | [private] |
Definition at line 2318 of file SurfaceMeshGenerator.cpp.
References __addPoints(), __createTriangle(), __transformVertex(), __verifExist(), SurfaceMeshGenerator::Internals::TriangleCut::edgecut, ffout(), and SurfaceMeshGenerator::Internals::TriangleCut::pointsIntersection.
Referenced by __createGeneral().
02323 { 02324 size_t taille=points.size(); 02325 size_t number=K.edgecut[0][0]+K.edgecut[1][0]+K.edgecut[2][0]; 02326 TinyVector<2,const Vertex*> P; 02327 size_t numberP=K.edgecut[place[0]][0]+K.edgecut[place[0]][1]; 02328 switch (numberP) { 02329 case 1: { 02330 P[0]=K.pointsIntersection[place[0]][0]; 02331 break; 02332 } 02333 case 2: { 02334 P[0]=K.pointsIntersection[place[0]][0]; 02335 P[1]=K.pointsIntersection[place[0]][1]; 02336 break; 02337 } 02338 } 02339 std::vector<const Vertex*> pointslist1; 02340 std::vector<const Vertex*> pointslist2; 02341 size_t stopcut=0; 02342 for(unsigned ie=1;ie<taille;++ie) { 02343 const Vertex* Pcut=points[ie]; 02344 //ffout(4)<<*Pcut<<"\n"; 02345 if(Pcut==P[0]) { 02346 __addPoints(Pcut,stopcut,pointslist1,pointslist2); 02347 if(stopcut==3) { 02348 stopcut=1; 02349 } 02350 } else { 02351 if(number==2) { 02352 if(Pcut==P[1]) { 02353 __addPoints(Pcut,stopcut,pointslist1,pointslist2); 02354 if(stopcut==3) { 02355 stopcut=1; 02356 } 02357 } else { 02358 __addPoints(Pcut,stopcut,pointslist1,pointslist2); 02359 if(stopcut==3) { 02360 stopcut=0; 02361 } 02362 } 02363 } else { 02364 __addPoints(Pcut,stopcut,pointslist1,pointslist2); 02365 if(stopcut==3) { 02366 stopcut=0; 02367 } 02368 } 02369 } 02370 } 02371 02372 //on rajoute le 3e sommets 02373 size_t in2=0; 02374 if(in+in1==1) { 02375 in2=2; 02376 } else if(in+in1==2) { 02377 in2=1; 02378 } 02379 pointslist2.push_back(&K(in2)); 02380 //on rajoute le point oppose a l'arete cut 02381 pointslist2.push_back(points[0]); 02382 pointslist1.push_back(points[0]); 02383 //on rajoute le premier point d'inter a la 2e liste 02384 if(!__verifExist(P[0],pointslist2)) { 02385 pointslist2.push_back(P[0]); 02386 } else { 02387 pointslist2.push_back(P[1]); 02388 } 02389 02390 //verif des listes 02391 ffout(4)<<"taille de list1 = "<<pointslist1.size()<<"\n"; 02392 for(unsigned ie=0;ie<pointslist1.size();++ie) { 02393 ffout(4)<<*pointslist1[ie]<<"\n"; 02394 } 02395 ffout(4)<<"taille de list2 = "<<pointslist2.size()<<"\n"; 02396 for(unsigned ie=0;ie<pointslist2.size();++ie) { 02397 ffout(4)<<*pointslist2[ie]<<"\n"; 02398 } 02399 02400 //on cree les 2 maillages 02401 if(pointslist1.size()>=3) { 02402 std::vector<Vertex> pointslist1plan(pointslist1.size()); 02403 __transformVertex(K,pointslist1,pointslist1plan); 02404 __createTriangle(K,cell,triangleListIntersectionNew,pointslist1,pointslist1plan); 02405 } 02406 if(pointslist2.size()>=3) { 02407 std::vector<Vertex> pointslist2plan(pointslist2.size()); 02408 __transformVertex(K,pointslist2,pointslist2plan); 02409 __createTriangle(K,cell,triangleListIntersectionNew,pointslist2,pointslist2plan); 02410 } 02411 02412 }

| void SurfaceMeshGenerator::Internals::__createTriangle | ( | const TriangleCut & | K, | |
| const Cell * | cell, | |||
| std::vector< Triangle > & | triangleListIntersectionNew, | |||
| std::vector< const Vertex * > & | points, | |||
| std::vector< Vertex > & | pointtrian | |||
| ) | [private] |
Definition at line 2215 of file SurfaceMeshGenerator.cpp.
References __addTriangle(), checkInterbis(), Triangulation::export_mesh(), ffout(), Triangulation::getTriangles(), Cell::reference(), and Triangulation::triangulize().
Referenced by __create2SD(), __create3in(), and __createGeneral().
02218 { 02219 // static int toto=0; 02220 size_t taille=points.size(); 02221 Triangulation trgen; 02222 Triangulation::CurveVertex envVertex(taille+1); 02223 std::ofstream sortie("testy2mb"); 02224 sortie.precision(30); 02225 sortie<<taille<<" 0 0 \n"; 02226 for(unsigned ie=0;ie<taille;++ie) { 02227 sortie<<pointstrian[ie][0]<<" "<<pointstrian[ie][1]<<"\n"; 02228 //ffout(4)<<points[ie]<<"\n"; 02229 //ffout(4)<<*points[ie]<<"\n"; 02230 //ffout(4)<<pointstrian[ie]<<"\n"; 02231 //ffout(4)<<"----\n"; 02232 envVertex[ie] = &pointstrian[ie]; 02233 } 02234 envVertex[taille] = envVertex[0]; 02235 sortie<<taille<<" "; 02236 for(unsigned ie=0;ie<taille;++ie) { 02237 sortie<<envVertex[ie]-envVertex[0]<<" "; 02238 } 02239 02240 sortie.close(); 02241 02242 //dans ce cas pas de trou 02243 std::vector<Triangulation::CurveVertex> holes(0); 02244 std::vector<Triangulation::CurveVertex> curves(0); 02245 02246 if(taille>3) { 02247 //ffout(4)<<"je triangule\n"; 02248 // ffout(4)<<"num = "<<++toto<<"\n"; 02249 //verifions que les points ne s'intersectent pas avant de lancer la triangulation 02250 bool isOK=false; 02251 //ffout(4)<<"nb de points "<<taille<<"\n"; 02252 size_t ie=1; 02253 while(ie<taille-2 and !isOK) { 02254 isOK=checkInterbis(pointstrian[0],pointstrian[taille-1],pointstrian[ie],pointstrian[ie+1]); 02255 ++ie; 02256 } 02257 if(!isOK) { 02258 //verification que les points ne sont pas trop proches!! 02259 ie=0; 02260 while(ie<taille-1 and !isOK) { 02261 const Vertex& A=pointstrian[ie]; 02262 const Vertex& B=pointstrian[ie+1]; 02263 real_t norm=Norm(A-B); 02264 isOK=(norm<1e-6); 02265 ++ie; 02266 } 02267 } 02268 if(isOK) { 02269 ffout(4)<<"isok est vraie-----------\n"; 02270 } 02271 if(!isOK) { 02272 // ffout(4)<<"je triangule\n"; 02273 trgen.triangulize(pointstrian, 02274 envVertex, 02275 holes, 02276 curves); 02277 // ffout(4)<<"fin triangule-----\n"; 02278 std::ofstream o("full.mesh"); 02279 trgen.export_mesh(o); 02280 o.close(); 02281 std::list<ConnectedTriangle> L=trgen.getTriangles(); 02282 for(std::list<ConnectedTriangle>::iterator itL=L.begin() ; itL!= L.end() ; itL++) { 02283 Triangle T=(*itL); 02284 Vertex* P0=&T(0); 02285 Vertex* P1=&T(1); 02286 Vertex* P2=&T(2); 02287 __addTriangle(Triangle(*points[P0-&pointstrian[0]], 02288 *points[P1-&pointstrian[0]], 02289 *points[P2-&pointstrian[0]], 02290 K.reference()),cell,triangleListIntersectionNew); 02291 } 02292 } else { 02293 ffout(4)<<"isOK est vraie on a un pbs.....\n"; 02294 ffout(4)<<K(0)<<"\n"; 02295 ffout(4)<<K(1)<<"\n"; 02296 ffout(4)<<K(2)<<"\n"; 02297 } 02298 //ffout(4)<<L.size()<<" ecrit\n"; 02299 } else if(taille==3) { 02300 //ffout(4)<<"je cree un triangle\n"; 02301 //ffout(4)<<*points[0]<<"\n"; 02302 //ffout(4)<<*points[1]<<"\n"; 02303 //ffout(4)<<*points[2]<<"\n"; 02304 __addTriangle(Triangle(*points[0], 02305 *points[1], 02306 *points[2], 02307 K.reference()),cell,triangleListIntersectionNew); 02308 } else { 02309 ffout(4)<<"la taille est inferieur a 3 = "<<taille<<"\n"; 02310 ffout(4)<<K(0)<<"\n"; 02311 ffout(4)<<K(1)<<"\n"; 02312 ffout(4)<<K(2)<<"\n"; 02313 ffout(4)<<"¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡\n"; 02314 } 02315 }

| void SurfaceMeshGenerator::Internals::__createTrianglesIntersection | ( | const size_t | numobject, | |
| const MeshedObject & | O1, | |||
| const MeshedObject & | O2, | |||
| const std::set< const Cell * > & | toTreatHexahedra, | |||
| std::vector< Triangle > & | triangleListIntersectionNew, | |||
| PIntersection & | listVertexIntersectionNew | |||
| ) | [inline, private] |
Definition at line 2615 of file SurfaceMeshGenerator.cpp.
References __addTriangle(), __constructionFinalMesh(), __createGeneral(), __createLocalListIntersection(), __putRefByFront(), edgesRefVertex, ffout(), ConnectivityBuilder< MeshType >::generates(), SurfaceMeshGenerator::Internals::MeshedObject::hexalist, Shape::inside(), listOfTriangleMeshFront, listOfVertexMesh, SurfElem::mother(), Cell::numberOfVertices(), Cell::reference(), SurfaceMeshGenerator::Internals::MeshedObject::shape(), SurfaceMeshGenerator::Internals::MeshedObject::trianglelist, triangleWithVertex, vertexInTriangles, and vertexVectTriangles.
02621 { 02622 //build mesh of object O1 (which is intersected with O2) 02623 02624 size_t nbcell=(*O1.trianglelist).size(); 02625 SurfaceMeshOfTriangles surfmesh(nbcell); 02626 // construction du maillage surfmesh a partir des listes connues 02627 // construction de listOfTriangleMeshFront 02628 __constructionFinalMesh(O1,surfmesh); 02629 02630 ConnectivityBuilder<SurfaceMeshOfTriangles> builder(surfmesh); 02631 builder.generates(Connectivity<SurfaceMeshOfTriangles>::CellToCells); 02632 //ffout(4)<<"numero "<<numobject<<" "<<objectNumber<<'\n'; 02633 size_t objectNumber=0; 02634 if(numobject==0) 02635 objectNumber=1; 02636 // (*edgesRefVertex[numobject]).clear(); 02637 const MapCellTriangle& hexaToTriangle0=*(O1.hexalist); 02638 02639 02640 std::set<const Cell*> hexaList1; 02641 std::set<const Cell*> hexaListIn; 02642 02643 for (MapCellTriangle::const_iterator i=(*O1.hexalist).begin(); i!= (*O1.hexalist).end(); ++i) { 02644 hexaList1.insert((*i).first); 02645 } 02646 //hexaListIn : hexa ou se passent les intersections 02647 std::set_difference (hexaList1.begin(), hexaList1.end(), 02648 toTreatHexahedra.begin(), toTreatHexahedra.end(), 02649 inserter(hexaListIn, hexaListIn.begin())); 02650 02651 ffout(4)<<"taille hexalistIn "<<hexaListIn.size()<<"\n"; 02652 for (std::set<const Cell*>::iterator icell = hexaListIn.begin(); icell != hexaListIn.end(); ++icell) { 02653 02654 MapCellTriangle::const_iterator it0=hexaToTriangle0.find(*icell); 02655 02656 if(it0!=hexaToTriangle0.end()) { 02657 //ffout(4)<<"ici\n"; 02658 Cell& C = const_cast<Cell&>(*(*icell)); 02659 for (size_t i=0; i<C.numberOfVertices(); ++i) { 02660 C(i).reference() = (O1.shape().inside(C(i))?1:0) 02661 + (O2.shape().inside(C(i))?1:0); 02662 } 02663 02664 size_t ref; 02665 if (booleanTest::compute(C)) { 02666 ref=2; 02667 } else { 02668 ref=0; 02669 } 02670 02671 std::list<Triangle*> listTriangle0=(*it0).second; 02672 for(std::list<Triangle*>::iterator jt0=listTriangle0.begin() ; 02673 jt0!=listTriangle0.end() ; ++jt0) { 02674 02675 Triangle& T = (*(*jt0)); 02676 for (size_t n=0; n<3; ++n) { 02677 // if(ref==2) 02678 // ffout(4)<<"ref ="<<ref<<"\n"; 02679 (*edgesRefVertex[numobject])[&T(n)]=ref; 02680 //put ref 2 for points of surfmesh 02681 const Vertex* P0=(*listOfVertexMesh.find(&T(n))).second; 02682 (*edgesRefVertex[numobject])[P0]=ref; 02683 } 02684 02685 if((*edgesRefVertex[numobject])[&T(0)]==2 02686 and (*edgesRefVertex[numobject])[&T(1)]==2 02687 and (*edgesRefVertex[numobject])[&T(2)]==2) { 02688 //si le triangle est dans le domaine on le construit 02689 __addTriangle(T, &T.mother(),triangleListIntersectionNew); 02690 } 02691 } 02692 } 02693 } 02694 02695 //put the reference of points 02696 __putRefByFront(numobject,O1,O2,surfmesh,toTreatHexahedra); 02697 02698 size_t nbinters=listVertexIntersectionNew.size(); 02699 ffout(4)<<"size listVertexIntersectionNew "<<nbinters<<'\n'; 02700 02701 for(std::set<const Cell*>::iterator i=toTreatHexahedra.begin(); 02702 i!=toTreatHexahedra.end() ; ++i) { 02703 MapCellTriangle::const_iterator it0=hexaToTriangle0.find(*i); 02704 02705 if(it0!=hexaToTriangle0.end()) { 02706 std::list<Triangle*> listTriangle0=(*it0).second; 02707 for(std::list<Triangle*>::iterator jt0=listTriangle0.begin() ; 02708 jt0!=listTriangle0.end() ; ++jt0) { 02709 const Triangle* T=(*jt0); 02710 const Vertex& V0 = (*T)(0); 02711 const Vertex& V1 = (*T)(1); 02712 const Vertex& V2 = (*T)(2); 02713 TriangleCut K(V0,V1,V2,numobject,objectNumber); 02714 K.reference()=(*T).reference(); 02715 triangleWithVertex.clear(); 02716 vertexInTriangles.clear(); 02717 vertexVectTriangles.clear(); 02718 02719 //build the vectors K.pointsIntersection, K.pointsin with points intersection include in K 02720 //put K.edgecut[i]=1 if the edge i is cut 02721 //build vertexInTriangles, triangleWithVertex (for build mesh by front) 02722 //build vertexVectTriangles 02723 __createLocalListIntersection(objectNumber,O2,T,K,*i); 02724 std::map< const Vertex* ,const Vertex*> pointsin=K.pointsin; 02725 02726 const Vertex* P0=(*listOfVertexMesh.find(&K(0))).second; 02727 const Vertex* P1=(*listOfVertexMesh.find(&K(1))).second; 02728 const Vertex* P2=(*listOfVertexMesh.find(&K(2))).second; 02729 (*edgesRefVertex[numobject])[&K(0)]=(*edgesRefVertex[numobject])[P0]; 02730 (*edgesRefVertex[numobject])[&K(1)]=(*edgesRefVertex[numobject])[P1]; 02731 (*edgesRefVertex[numobject])[&K(2)]=(*edgesRefVertex[numobject])[P2]; 02732 for(size_t k=0 ; k<3 ; ++k) { 02733 if((*edgesRefVertex[numobject])[&K(k)]==2) { 02734 K.isInTriangle[k]=1; 02735 } else { 02736 K.isInTriangle[k]=0; 02737 } 02738 } 02739 if( K.isInTriangle[0]+ K.isInTriangle[1]+ K.isInTriangle[2]!=0 and 02740 K.isInTriangle[0]+ K.isInTriangle[1]+ K.isInTriangle[2]!=3 02741 and K.edgecut[0]+ K.edgecut[1]+ K.edgecut[2]==0) { 02742 //cad qu'on a au moins un point in et un point out mais qu'aucune arete n'est coupee 02743 ffout(4)<<"cas pbssssss\n"; 02744 ffout(4)<<(*edgesRefVertex[numobject])[&K(0)]<<" "<<(*edgesRefVertex[numobject])[&K(1)]<< 02745 " "<<(*edgesRefVertex[numobject])[&K(2)]<<" "<<K.edgecut<<"\n"; 02746 ffout(4)<<K(0)<<"\n"; 02747 ffout(4)<<K(1)<<"\n"; 02748 ffout(4)<<K(2)<<"\n"; 02749 02750 // __addTriangle(Triangle(K(0),K(1),K(2),K.reference()),*i,triangleListIntersectionNew); 02751 02752 } 02753 if(K.edgecut[0][0]+K.edgecut[1][0]+K.edgecut[2][0]>=6) { 02754 ffout(4)<<"on veut rien faire car triangle plat\n"; 02755 ffout(4)<<"K.isInTriangle "<< K.isInTriangle[0]<<" "<< K.isInTriangle[1]<<" "<< K.isInTriangle[2]<<"\n"; 02756 ffout(4)<<K(0)<<"\n"; 02757 ffout(4)<<K(1)<<"\n"; 02758 ffout(4)<<K(2)<<"\n"; 02759 ffout(4)<<"edge cut "<<K.edgecut<<"\n"; 02760 K.isInTriangle[0]=1; 02761 K.isInTriangle[1]=1; 02762 K.isInTriangle[2]=1; 02763 02764 } 02766 size_t numberVertexInDomain=K.isInTriangle[0]+K.isInTriangle[1]+K.isInTriangle[2]; 02767 switch (numberVertexInDomain) { 02768 case 0: { 02769 if(K.edgecut[0]+K.edgecut[1]+K.edgecut[2]==3 and vertexVectTriangles.size()<3) { 02770 ffout(4)<<"tous les points d'inter ne sont pas dans la liste\n"; 02771 } else { 02772 //ffout(4)<<"------ case 0 in\n"; 02773 __createGeneral(K,*i,triangleListIntersectionNew); 02774 } 02775 break; 02776 } 02777 case 1: { 02778 if(K.edgecut[0]+K.edgecut[1]+K.edgecut[2]==0) { 02779 ffout(4)<<"pbbbbbbbbbbbbbbb\n"; 02780 } 02781 if(K.edgecut[0][0]+K.edgecut[1][0]+K.edgecut[2][0]==3) { 02782 if(K.pointsIntersection[0][0]!=K.pointsIntersection[1][0] 02783 and K.pointsIntersection[1][0]!=K.pointsIntersection[2][0] 02784 and K.pointsIntersection[2][0]!=K.pointsIntersection[0][0]) { 02785 //ffout(4)<<"---------------- 3 edge cut \n"; 02786 __createGeneral(K,*i,triangleListIntersectionNew); 02787 } else { 02788 //ffout(4)<<"1------------\n"; 02789 //ffout(4)<<K.edgecut[0]<<" "<<K.edgecut[1]<<" "<<K.edgecut[2]<<"\n"; 02790 __createGeneral(K, *i, triangleListIntersectionNew); 02791 } 02792 } else { 02793 //ffout(4)<<"2------------\n"; 02794 //ffout(4)<<K.edgecut[0]<<" "<<K.edgecut[1]<<" "<<K.edgecut[2]<<"\n"; 02795 __createGeneral(K, *i, triangleListIntersectionNew); 02796 } 02797 break; 02798 } 02799 case 2: { 02800 if(K.edgecut[0][0]+K.edgecut[1][0]+K.edgecut[2][0]<2) { 02801 ffout(4)<<"pbs pas assez d'edge cut \n"; 02802 } else { 02803 //ffout(4)<<"---------- case 2\n"; 02804 //ffout(4)<<K.edgecut[0]<<" "<<K.edgecut[1]<<" "<<K.edgecut[2]<<"\n"; 02805 __createGeneral(K, *i, triangleListIntersectionNew); 02806 } 02807 break; 02808 } 02809 case 3: { 02810 if(K.edgecut[0]+K.edgecut[1]+K.edgecut[2]==0) { 02811 __addTriangle(*T,*i,triangleListIntersectionNew); 02812 } else { 02813 //ffout(4)<<"------------ 3 in cas traite\n"; 02814 //ffout(4)<<K.edgecut[0]<<" "<<K.edgecut[1]<<" "<<K.edgecut[2]<<"\n"; 02815 __createGeneral(K, *i, triangleListIntersectionNew); 02816 } 02817 break; 02818 } 02819 } 02821 // // K.isInTriangle[i] vaut 1 si le point est a garder pour construire le maillage 0 sinon. 02822 // // K.edgecut[i] vaut 1 si l'arete est coupee 02823 02824 } 02825 } 02826 } 02827 (*edgesRefVertex[numobject]).clear(); 02828 listOfVertexMesh.clear(); 02829 listOfTriangleMeshFront.clear(); 02830 }

| bool SurfaceMeshGenerator::Internals::__createTriangleSurface | ( | VerticesList & | verticesListes, | |
| EdgePairList & | localTriangleList, | |||
| const Shape & | S, | |||
| std::vector< const Edge * > & | cutEdges, | |||
| const Cell & | currentCell | |||
| ) | [private] |
Stores the Edges on which the vertex will be computed.
Addes a triangle to the list.
Sets the triangle vertices (actually just store the edge where it lives).
Orders the Edges using a map !
Addes a triangle to the list.
Sets the triangle vertices (actually just store the edge where it lives).
Addes a triangle to the list.
Sets the triangle vertices (actually just store the edge where it lives).
Definition at line 2833 of file SurfaceMeshGenerator.cpp.
References __splitEdge(), and Edge::reference().
Referenced by __createSurface().
02838 { 02839 bool jobDone=true; 02840 switch (cutEdges.size()) { 02841 case 3: { 02843 02844 for (size_t i=0; i<cutEdges.size(); ++i) { 02845 TinyVector<3> V=__splitEdge(*cutEdges[i], S); 02846 verticesListes[*cutEdges[i]] 02847 = new Vertex(V); 02848 } 02849 02851 localTriangleList.push_front(TinyVector<3,Edge::Pair>()); 02852 // cellList.push_front(¤tCell); 02853 02854 std::vector<TinyVector<3> > V(cutEdges.size()); 02855 for(size_t i=0; i<cutEdges.size(); ++i) { 02856 const Edge& e = *cutEdges[i]; 02857 if(e(0).reference() == 1) { 02858 V[i] = (e(0) - e(1)); 02859 } else { 02860 V[i] = (e(1) - e(0)); 02861 } 02862 } 02863 02864 if ((V[0]^V[1])*V[2] < 0) { 02865 std::swap(cutEdges[1], cutEdges[2]); 02866 } 02867 02869 SurfaceMeshGenerator::Internals::EdgePairList::iterator currentTriangle 02870 = localTriangleList.begin(); 02871 02872 for(size_t i=0; i<cutEdges.size(); ++i) { 02873 (*currentTriangle)[i] = (Edge::Pair)(*cutEdges[i]); 02874 } 02875 02876 break; 02877 } 02878 02879 case 4: { 02880 for (size_t i=0; i<4; ++i) { 02881 TinyVector<3> V=__splitEdge(*cutEdges[i], S); 02882 verticesListes[*cutEdges[i]] 02883 = new Vertex(V); 02884 } 02885 02887 std::map<Edge::Pair, const Edge*> cutEdgesMap; 02888 for(size_t ie=0; ie<cutEdges.size(); ++ie) { 02889 cutEdgesMap[(Edge::Pair)*(cutEdges[ie])] = (cutEdges[ie]); 02890 } 02891 02893 localTriangleList.push_front(TinyVector<3,Edge::Pair>()); 02894 // cellList.push_front(¤tCell); 02895 02896 std::vector<TinyVector<3> > V(cutEdges.size()); 02897 std::map<Edge::Pair, const Edge*>::iterator currentCutEdge=cutEdgesMap.begin(); 02898 for (size_t i=0; i<V.size(); ++i) { 02899 const Edge& e = *(*currentCutEdge).second; 02900 if(e(0).reference() == 1) { 02901 V[i] = (e(0) - e(1)); 02902 } else { 02903 V[i] = (e(1) - e(0)); 02904 } 02905 ++currentCutEdge; 02906 } 02907 02908 bool swapEdge = ((V[0]^V[1])*V[2] > 0); 02909 02911 SurfaceMeshGenerator::Internals::EdgePairList::iterator currentTriangle 02912 = localTriangleList.begin(); 02913 02914 currentCutEdge = cutEdgesMap.begin(); 02915 if (!swapEdge) { 02916 for(size_t i=0; i<3; ++i) { 02917 (*currentTriangle)[i] = (Edge::Pair)(currentCutEdge->first); 02918 ++currentCutEdge; 02919 } 02920 } else { 02921 for(int i=2; i>=0; --i) { 02922 (*currentTriangle)[i] = (Edge::Pair)(currentCutEdge->first); 02923 ++currentCutEdge; 02924 } 02925 } 02926 02928 localTriangleList.push_front(TinyVector<3,Edge::Pair>()); 02929 // cellList.push_front(¤tCell); 02930 02931 currentTriangle = localTriangleList.begin(); 02932 02934 currentCutEdge = cutEdgesMap.begin(); 02935 if (!swapEdge) { 02936 for(int i=2; i>=0; --i) { 02937 ++currentCutEdge; 02938 (*currentTriangle)[i] = (Edge::Pair)(currentCutEdge->first); 02939 } 02940 } else { 02941 for(size_t i=0; i<3; ++i) { 02942 ++currentCutEdge; 02943 (*currentTriangle)[i] = (Edge::Pair)(currentCutEdge->first); 02944 } 02945 } 02946 break; 02947 } 02948 case 1: 02949 case 2: { 02950 //jobDone = false; 02951 break; 02952 } 02953 } 02954 02955 return jobDone; 02956 }

| void SurfaceMeshGenerator::Internals::__createSurface | ( | MeshedObject & | O, | |
| EdgePairList & | triangleListes, | |||
| EdgePairList & | localTriangleListesEdges, | |||
| VerticesList & | verticesListes, | |||
| MotherCellList & | cellListObject | |||
| ) | [private] |
Definition at line 2959 of file SurfaceMeshGenerator.cpp.
References __createTriangleSurface(), __splitEdge(), MeshOfTetrahedra::connectivity(), Mesh::edge(), Connectivity< MeshType >::edges(), fferr(), Shape::inside(), Tetrahedron::NumberOfEdges, Mesh::numberOfEdges(), Mesh::numberOfVertices(), Cell::reference(), Edge::reference(), Vertex::reference(), SurfaceMeshGenerator::Internals::MeshedObject::shape(), ErrorHandler::unexpected, and Mesh::vertex().
Referenced by __marchingTetrahedra().
02964 { 02965 MeshOfTetrahedra& tetrahedraMesh = (*__backgroundMesh); 02966 const Shape& S = O.shape(); 02967 02968 // Sets vertices references 02969 for (size_t i=0; i<tetrahedraMesh.numberOfVertices(); ++i) { 02970 Vertex& V = tetrahedraMesh.vertex(i); 02971 V.reference() = S.inside(V); 02972 } 02973 02974 for (size_t i = 0; i<tetrahedraMesh.numberOfEdges(); i++) { 02975 Edge& e = tetrahedraMesh.edge(i); 02976 #warning THIS TEST IS NOT ENOUGH! THINK TO THE BORDER! 02977 if(e(0).reference() != e(1).reference()) { 02978 verticesListes[e] = new Vertex(__splitEdge(e, S)); 02979 e.reference() = 1; 02980 } else { 02981 e.reference() = 0; 02982 } 02983 } 02984 02985 if (verticesListes.size()==0) { 02986 fferr(1) << "\nwarning :\n" 02987 << "meshing object " << S << " a problem occured ...\n" 02988 << "Check that:\n" 02989 << "- the object is not to small compare to the background mesh\n" 02990 << "- the object intersects the background mesh\n\n"; 02991 } 02992 02993 #warning A garder ? 02994 EdgePairList localTriangleList; 02995 02996 for (MeshOfTetrahedra::iterator i(tetrahedraMesh); 02997 not(i.end()); ++i) { 02998 Tetrahedron& T = (*i); 02999 size_t numberInside 03000 = T(0).reference() 03001 + T(1).reference() 03002 + T(2).reference() 03003 + T(3).reference(); 03004 03005 bool jobDone = true; 03006 if ((numberInside)%4 != 0) { 03007 std::vector<const Edge*> cutEdges; 03008 const Connectivity<MeshOfTetrahedra>::CellToEdgesType& 03009 tetrahedronEdge = tetrahedraMesh.connectivity().edges(T); 03010 03011 for (unsigned l=0; l<Tetrahedron::NumberOfEdges; ++l) { 03012 const Edge& e = *(tetrahedronEdge[l]); 03013 if (e.reference() == 1) { 03014 cutEdges.push_back(&e); 03015 } 03016 } 03017 03018 bool jobDone2=__createTriangleSurface(verticesListes, 03019 localTriangleList, 03020 S, cutEdges, 03021 T); 03022 03023 if(!(jobDone2)) { 03024 jobDone=jobDone2; 03025 } 03026 } 03027 03028 if(jobDone) { 03029 for (SurfaceMeshGenerator::Internals::EdgePairList::iterator t 03030 = localTriangleList.begin(); 03031 t != localTriangleList.end(); ++t) { 03032 triangleListes.push_front(*t); 03033 cellListObject.push_front(&T); 03034 } 03035 } else { 03036 throw ErrorHandler(__FILE__,__LINE__, 03037 "jobDone false", 03038 ErrorHandler::unexpected); 03039 } 03040 localTriangleList.clear(); 03041 } 03042 }

| bool SurfaceMeshGenerator::Internals::__isDegenerate | ( | const Triangle & | T | ) | [private] |
Definition at line 811 of file SurfaceMeshGenerator.cpp.
Referenced by __addTriangle(), and __createLocalListIntersection().
| void SurfaceMeshGenerator::Internals::__calculateIntersection | ( | MeshedObject & | O0, | |
| const MeshedObject & | O1, | |||
| const MeshedObject & | O2, | |||
| const std::set< const Cell * > & | toTreatHexahedra | |||
| ) | [inline, private] |
Definition at line 609 of file SurfaceMeshGenerator.cpp.
References __calculatePointsIntersection(), ffout(), SurfaceMeshGenerator::Internals::MeshedObject::hexalist, pairTriangleToIntersectionPoints, and SurfaceMeshGenerator::Internals::MeshedObject::trianglelist.
00613 { 00614 PIntersection listVertexIntersectionNew; 00615 std::vector<Triangle> triangleListIntersectionNew; 00616 00617 // CALCUL DES INTERSECTIONS 00618 __calculatePointsIntersection(O1, O2, toTreatHexahedra, listVertexIntersectionNew); 00619 00620 //create mesh intersection for the object 0 and 1 00621 // GENERATION DES MAILLAGES 00622 __createTrianglesIntersection<booleanTest>(0, O1, O2, toTreatHexahedra, 00623 triangleListIntersectionNew, listVertexIntersectionNew); 00624 ffout(4)<<"nb triangles in intersection 0 "<<triangleListIntersectionNew.size()<<'\n'; 00625 __createTrianglesIntersection<booleanTest>(1, O2, O1, toTreatHexahedra, 00626 triangleListIntersectionNew, listVertexIntersectionNew); 00627 ffout(4)<<"nb triangles in intersection 1 "<<triangleListIntersectionNew.size()<<'\n'; 00628 00629 pairTriangleToIntersectionPoints.clear(); 00630 00631 //triangle from intersection of objects 0-1 in O0 00632 size_t sizeinter=triangleListIntersectionNew.size(); 00633 00634 O0.trianglelist = new Vector<Triangle> (sizeinter); 00635 O0.hexalist = new std::map<const Cell*, std::list<Triangle*> >; 00636 for(size_t size=0 ; size<sizeinter ; ++size) { 00637 (*O0.trianglelist)[size]=triangleListIntersectionNew[size]; 00638 (*O0.hexalist)[&(*O0.trianglelist)[size].mother()].push_back(&(*O0.trianglelist)[size]); 00639 } 00640 triangleListIntersectionNew.clear(); 00641 listVertexIntersectionNew.clear(); 00642 }

| void SurfaceMeshGenerator::Internals::__operationBoolean | ( | MeshedObject & | O0, | |
| const MeshedObject & | O1, | |||
| const MeshedObject & | O2 | |||
| ) | [inline, private] |
Definition at line 581 of file SurfaceMeshGenerator.cpp.
References ffout(), SurfaceMeshGenerator::Internals::MeshedObject::hexalist, and StaticBase< Information >::instance().
00584 { 00585 std::set<const Cell*> hexaList1; 00586 std::set<const Cell*> hexaList2; 00587 00588 for (MapCellTriangle::const_iterator i=(*O1.hexalist).begin(); i!= (*O1.hexalist).end(); ++i) { 00589 hexaList1.insert((*i).first); 00590 } 00591 for (MapCellTriangle::const_iterator i=(*O2.hexalist).begin(); i!= (*O2.hexalist).end(); ++i) { 00592 hexaList2.insert((*i).first); 00593 } 00594 00595 std::set<const Cell*> toTreatHexahedra; 00596 00597 if (not(Information::instance().coarseMesh())) { 00598 std::set_intersection (hexaList1.begin(), hexaList1.end(), 00599 hexaList2.begin(), hexaList2.end(), 00600 inserter(toTreatHexahedra, toTreatHexahedra.begin())); 00601 ffout(4)<<"nb hexa to treat "<<toTreatHexahedra.size()<<"\n"; 00602 } 00603 00604 __calculateIntersection<booleanTest>(O0,O1,O2, toTreatHexahedra); 00605 }

| void SurfaceMeshGenerator::Internals::__generateMesh | ( | const Domain & | omega, | |
| const Object & | object, | |||
| const size_t & | level, | |||
| std::stack< ReferenceCounting< MeshedObject > > & | objectStack | |||
| ) | [private] |
Definition at line 3078 of file SurfaceMeshGenerator.cpp.
References __marchingTetrahedra(), Difference::begin(), Intersection::begin(), Union::begin(), Shape::cone, Shape::cube, Shape::cylinder, Shape::difference, Difference::end(), Intersection::end(), Union::end(), ffout(), StaticBase< Information >::instance(), Shape::intersection, Shape::not_, Intersection::push_back(), Union::push_back(), Cell::reference(), Domain::reference(), SurfaceMeshGenerator::Internals::MeshedObject::setShape(), SurfaceMeshGenerator::Internals::MeshedObject::shapeReference(), Shape::transformationsList(), SurfaceMeshGenerator::Internals::MeshedObject::trianglelist, and Shape::union_.
03081 { 03082 if(Information::instance().coarseMesh() and object.hasReference()) { 03083 ReferenceCounting<MeshedObject> o = new MeshedObject(); 03084 (*o).setShape(object.shape()->getCopy()); 03085 __marchingTetrahedra(*o); 03086 03087 objectStack.push(o); 03088 ffout(4) << "Marching cube sur " << objectStack.top() << '\n'; 03089 } else { 03090 switch ((*object.shape()).type()) { 03091 case Shape::union_: { 03092 const Union& U = static_cast<const Union&>(*(object.shape())); 03093 03094 size_t j=0; 03095 ObjectTransformer objectTransformer(U.transformationsList()); 03096 for (Union::const_iterator i = U.begin(); 03097 i != U.end(); ++i,++j) { 03098 ReferenceCounting<Object> s = objectTransformer(*(*i)); 03099 __generateMesh(omega, *s, level+1, objectStack); 03100 if (j>0) { 03101 // get first object of the intersection 03102 ReferenceCounting<MeshedObject> O1 = objectStack.top(); 03103 objectStack.pop(); 03104 03105 // get second object of the intersection 03106 ReferenceCounting<MeshedObject> O2 = objectStack.top(); 03107 objectStack.pop(); 03108 03109 ReferenceCounting<MeshedObject> O0 = new MeshedObject(); 03110 __operationBoolean<UnionTest>(*O0,*O1, *O2); 03111 03112 // Set shape function 03113 if (j == 1) { // create an union shape 03114 Union* u = new Union(); 03115 u->push_back(new Object((*O1).shapeReference())); 03116 u->push_back(new Object((*O2).shapeReference())); 03117 (*O0).setShape(u); 03118 } else { //use the union shape contained in O2 03119 Union& u = dynamic_cast<Union&>(*(*O2).shapeReference()); 03120 u.push_back(new Object((*O1).shapeReference())); 03121 (*O0).setShape((*O2).shapeReference()); 03122 } 03123 03124 objectStack.push(O0); 03125 } 03126 } 03127 break; 03128 } 03129 case Shape::intersection: { 03130 const Intersection& I = static_cast<const Intersection&>(*(object.shape())); 03131 03132 size_t j=0; 03133 ObjectTransformer objectTransformer(I.transformationsList()); 03134 for(Intersection::const_iterator i = I.begin(); 03135 i != I.end(); ++i,++j) { 03136 ReferenceCounting<Object> s = objectTransformer(*(*i)); 03137 __generateMesh(omega, *s, level+1, objectStack); 03138 if (j>0) { 03139 // get first object of the intersection 03140 ReferenceCounting<MeshedObject> O1 = objectStack.top(); 03141 objectStack.pop(); 03142 03143 // get second object of the intersection 03144 ReferenceCounting<MeshedObject> O2 = objectStack.top(); 03145 objectStack.pop(); 03146 03147 ReferenceCounting<MeshedObject> O0 = new MeshedObject(); 03148 __operationBoolean<IntersectionTest>(*O0,*O1, *O2); 03149 03150 if (j == 1) { // create an intersection shape 03151 Intersection* newI = new Intersection(); 03152 newI->push_back(new Object((*O1).shapeReference())); 03153 newI->push_back(new Object((*O2).shapeReference())); 03154 (*O0).setShape(newI); 03155 } else { //use the intersection shape contained in O2 03156 Intersection& newI = dynamic_cast<Intersection&>(*(*O2).shapeReference()); 03157 newI.push_back(new Object((*O1).shapeReference())); 03158 (*O0).setShape((*O2).shapeReference()); 03159 } 03160 objectStack.push(O0); 03161 } 03162 } 03163 break; 03164 } 03165 case Shape::difference: { 03166 const Difference& D = static_cast<const Difference&>(*(object.shape())); 03167 03168 ObjectTransformer objectTransformer(D.transformationsList()); 03169 Intersection* I = new Intersection; 03170 03171 Difference::const_iterator i = D.begin(); 03172 ReferenceCounting<Object> s = objectTransformer(*(*i)); 03173 I->push_back(s); 03174 03175 Union* U = new Union; 03176 ++i; 03177 for(; i != D.end(); ++i) { 03178 s = objectTransformer(*(*i)); 03179 U->push_back(s); 03180 } 03181 03182 I->push_back(new Object(new Not(new Object(U)))); 03183 Object o(I); 03184 __generateMesh(omega, o, level+1, objectStack); 03185 break; 03186 } 03187 case Shape::not_: { 03188 const Object& notObject = *(static_cast<const Not&>(*object.shape()).object()); 03189 03190 __generateMesh(omega, notObject, level+1, objectStack); 03191 03192 MeshedObject& o = (*objectStack.top()); 03193 ReferenceCounting<Shape> s = o.shapeReference(); 03194 o.setShape(new Not(new Object(s))); 03195 03196 break; 03197 } 03198 case Shape::cube: { 03199 if (not(Information::instance().coarseMesh())) { 03200 const Cube& c = static_cast<const Cube&>(*object.shape()); 03201 Intersection* I = new Intersection; 03202 for (size_t i=0; i<6; ++i) { 03203 I->push_back(new Object(new Plane(c, i))); 03204 } 03205 03206 Object o(I); 03207 __generateMesh(omega, o, level+1, objectStack); 03208 break; 03209 } 03210 } 03211 case Shape::cylinder: { 03212 if (not(Information::instance().coarseMesh())) { 03213 const Cylinder& c = static_cast<const Cylinder&>(*object.shape()); 03214 Intersection* I = new Intersection; 03215 I->push_back(new Object(new InfiniteCylinder(c))); 03216 I->push_back(new Object(new Plane(c, 0))); 03217 I->push_back(new Object(new Plane(c, 1))); 03218 03219 Object o(I); 03220 __generateMesh(omega, o, level+1, objectStack); 03221 break; 03222 } 03223 } 03224 case Shape::cone: { 03225 if (not(Information::instance().coarseMesh())) { 03226 const Cone& c = static_cast<const Cone&>(*object.shape()); 03227 Intersection* I = new Intersection; 03228 I->push_back(new Object(new InfiniteCone(c))); 03229 I->push_back(new Object(new Plane(c, 0))); 03230 I->push_back(new Object(new Plane(c, 1))); 03231 03232 Object o(I); 03233 __generateMesh(omega, o, level+1, objectStack); 03234 break; 03235 } 03236 } 03237 default: { 03238 ReferenceCounting<MeshedObject> o = new MeshedObject(); 03239 (*o).setShape(object.shape()->getCopy()); 03240 __marchingTetrahedra(*o); 03241 03242 objectStack.push(o); 03243 ffout(4) << "Marching cube sur " << objectStack.top() << '\n'; 03244 } 03245 } 03246 } 03247 MeshedObject& o = (*objectStack.top()); 03248 if(object.hasReference()) { 03249 const size_t ref = omega.reference(object.reference()); 03250 for (size_t i=0; i<(*o.trianglelist).size(); ++i) { 03251 Triangle& t = (*o.trianglelist)[i]; 03252 t.reference()=ref; 03253 } 03254 } 03255 }

| void SurfaceMeshGenerator::Internals::__generateCoarseMesh | ( | const Domain & | omega, | |
| const Object & | object | |||
| ) | [private] |
| void SurfaceMeshGenerator::Internals::__setMotherCells | ( | SurfaceMeshOfTriangles & | surfmesh | ) | [private] |
Definition at line 3060 of file SurfaceMeshGenerator.cpp.
References __motherCells, SurfElem::mother(), and SurfElem::setMother().
03061 { 03062 for (SurfaceMeshOfTriangles::iterator i(surfaceMesh); 03063 not(i.end()); ++i) { 03064 Triangle& triangle = *i; 03065 const Tetrahedron& tetrahedron 03066 = static_cast<const Tetrahedron&>(triangle.mother()); 03067 03068 const size_t tetrahedronNumber 03069 = (*__backgroundMesh).cellNumber(tetrahedron); 03070 03071 triangle.setMother((*__motherCells)[tetrahedronNumber], 03072 std::numeric_limits<size_t>::max()); // Le triangle n'est pas une face de la maille 03073 } 03074 }

| ReferenceCounting< Vector< Triangle > > SurfaceMeshGenerator::Internals::__marchingTetrahedra | ( | MeshedObject & | O | ) | [private] |
Definition at line 3259 of file SurfaceMeshGenerator.cpp.
References __createSurface(), __dataStructureConvertion(), and ffout().
Referenced by __generateMesh().
03260 { 03261 ffout(3) << "Marching tetrahedra\n"; 03262 EdgePairList triangleListes; 03263 EdgePairList localTriangleListesEdges; 03264 VerticesList verticesListes; 03265 MotherCellList cellListObject; 03266 03267 __createSurface(O, triangleListes, localTriangleListesEdges, 03268 verticesListes, cellListObject); 03269 03270 __dataStructureConvertion(O, triangleListes, verticesListes, cellListObject); 03271 ffout(3) << "Marching tetrahedra: done\n"; 03272 return 0; 03273 }

| static void SurfaceMeshGenerator::Internals::__getIntersectionReferences | ( | const Intersection & | I, | |
| std::map< TinyVector< 3 >, Object * > & | otherReferences | |||
| ) | [static, private] |
| void SurfaceMeshGenerator::Internals::plotini | ( | size_t | nobjectToTreat | ) | [private] |
friend class SurfaceMeshGenerator [friend] |
Definition at line 187 of file SurfaceMeshGenerator.cpp.
std::map<const Vertex*, const Vertex*> SurfaceMeshGenerator::Internals::listOfVertexMesh [private] |
Definition at line 213 of file SurfaceMeshGenerator.cpp.
Referenced by __constructionFinalMesh(), __constructionVerticesList(), and __createTrianglesIntersection().
std::map<const Triangle*, const Triangle*> SurfaceMeshGenerator::Internals::listOfTriangleMeshFront [private] |
Definition at line 214 of file SurfaceMeshGenerator.cpp.
Referenced by __constructionFinalMesh(), __createTrianglesIntersection(), and __putRefByFront().
PairTriangleToIntersectionPoints SurfaceMeshGenerator::Internals::pairTriangleToIntersectionPoints [private] |
Definition at line 216 of file SurfaceMeshGenerator.cpp.
Referenced by __calculateIntersection(), __createLocalListIntersection(), __createPointIntersection(), and __determinateEdgeCut().
std::vector<ReferenceCounting< std::map<const Vertex*,size_t> > > SurfaceMeshGenerator::Internals::edgesRefVertex [private] |
Definition at line 218 of file SurfaceMeshGenerator.cpp.
Referenced by __createTrianglesIntersection(), __inout(), __putEdgeRef(), and __putRefByFront().
std::map<const Vertex*,TinyVector<2,const Triangle*> > SurfaceMeshGenerator::Internals::vertexInTriangles [private] |
Definition at line 220 of file SurfaceMeshGenerator.cpp.
Referenced by __addList(), __createGeneral(), __createList(), __createLocalListIntersection(), __createTrianglesIntersection(), __findInEdges(), and __findTriangle().
std::map<const Vertex*,std::vector<const Triangle*> > SurfaceMeshGenerator::Internals::vertexVectTriangles [private] |
Definition at line 221 of file SurfaceMeshGenerator.cpp.
Referenced by __addList(), __createLocalListIntersection(), and __createTrianglesIntersection().
std::map<const Triangle*,TinyVector<2,const Vertex*> > SurfaceMeshGenerator::Internals::triangleWithVertex [private] |
Definition at line 222 of file SurfaceMeshGenerator.cpp.
Referenced by __addList(), __createLocalListIntersection(), __createTrianglesIntersection(), and __findVertex().
ReferenceCounting<MeshTetrahedrizor::CellMapping> SurfaceMeshGenerator::Internals::__motherCells [private] |
Mother cells mapping
Definition at line 425 of file SurfaceMeshGenerator.cpp.
Referenced by __setMotherCells(), and SurfaceMeshGenerator::generateSurfacicMesh().
Tetrahedral working mesh
Definition at line 428 of file SurfaceMeshGenerator.cpp.
Referenced by SurfaceMeshGenerator::generateSurfacicMesh().
const Mesh* SurfaceMeshGenerator::Internals::__lastBackgoundMesh [private] |
Last mesh that was used to generate surfacic meshes
Definition at line 431 of file SurfaceMeshGenerator.cpp.
Referenced by SurfaceMeshGenerator::generateSurfacicMesh().
1.5.6