1 // Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License.
9 // This library is distributed in the hope that it will be useful
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 // File: NMTTools_PaveFiller_3.cxx
21 // Created: Mon Dec 8 16:06:56 2003
22 // Author: Peter KURNEV
26 #include <NMTTools_PaveFiller.ixx>
29 #include <TopoDS_Shape.hxx>
30 #include <TopoDS_Vertex.hxx>
31 #include <TopoDS_Face.hxx>
33 #include <BOPTools_VSInterference.hxx>
34 #include <BOPTools_CArray1OfVSInterference.hxx>
36 #include <NMTDS_ShapesDataStructure.hxx>
37 #include <TopExp_Explorer.hxx>
39 // Modified Thu Sep 14 14:35:18 2006
40 // Contribution of Samtech www.samcef.com BEGIN
42 Standard_Boolean Contains(const TopoDS_Face& aF,
43 const TopoDS_Vertex& aV);
44 // Contribution of Samtech www.samcef.com END
45 //=======================================================================
46 // function: PerformVF
48 //=======================================================================
49 void NMTTools_PaveFiller::PerformVF()
51 myIsDone=Standard_False;
53 Standard_Boolean aJustAddInterference;
54 Standard_Integer n1, n2, anIndexIn, aFlag, aWhat, aWith, aNbVSs, aBlockLength, iSDV;
59 BOPTools_CArray1OfVSInterference& aVSs=myIntrPool->VSInterferences();
62 myDSIt.Initialize(TopAbs_VERTEX, TopAbs_FACE);
64 // BlockLength correction
65 aNbVSs=ExpectedPoolLength();
66 aBlockLength=aVSs.BlockLength();
67 if (aNbVSs > aBlockLength) {
68 aVSs.SetBlockLength(aNbVSs);
71 for (; myDSIt.More(); myDSIt.Next()) {
72 myDSIt.Current(n1, n2, aJustAddInterference);
74 if (! myIntrPool->IsComputed(n1, n2)) {
75 if (! IsSuccesstorsComputed(n1, n2)) {
79 SortTypes(aWhat, aWith);
81 iSDV=FindSDVertex(aWhat);
83 if(aJustAddInterference) {
84 myIntrPool->AddInterference(aWhat, aWith, BooleanOperations_VertexSurface, anIndexIn);
88 aV1=TopoDS::Vertex(myDS->Shape(aWhat));
90 aV1=TopoDS::Vertex(myDS->Shape(iSDV));
93 aF2=TopoDS::Face(myDS->Shape(aWith));
95 // Modified Thu Sep 14 14:35:18 2006
96 // Contribution of Samtech www.samcef.com BEGIN
97 if (Contains(aF2, aV1)) {
100 // Contribution of Samtech www.samcef.com END
102 aFlag=myContext.ComputeVS (aV1, aF2, aU, aV);
106 // Add Interference to the Pool
107 BOPTools_VSInterference anInterf (aWhat, aWith, aU, aV);
108 anIndexIn=aVSs.Append(anInterf);
110 // SetState for Vertex in DS;
111 myDS->SetState (aWhat, BooleanOperations_ON);
112 // Insert Vertex in Interference Object
113 BOPTools_VSInterference& aVS=aVSs(anIndexIn);
114 aVS.SetNewShape(aWhat);
116 myIntrPool->AddInterference(aWhat, aWith, BooleanOperations_VertexSurface, anIndexIn);
120 myIsDone=Standard_True;
122 // Modified Thu Sep 14 14:35:18 2006
123 // Contribution of Samtech www.samcef.com BEGIN
124 //=======================================================================
125 //function : Contains
127 //=======================================================================
128 Standard_Boolean Contains(const TopoDS_Face& aF,
129 const TopoDS_Vertex& aV)
131 Standard_Boolean bRet;
132 TopExp_Explorer aExp;
135 aExp.Init(aF, TopAbs_VERTEX);
136 for (; aExp.More(); aExp.Next()) {
137 const TopoDS_Shape& aVF=aExp.Current();
138 if (aVF.IsSame(aV)) {
145 // Contribution of Samtech www.samcef.com END