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_1.cxx
21 // Created: Mon Dec 8 11:47:55 2003
22 // Author: Peter KURNEV
25 #include <NMTTools_PaveFiller.ixx>
27 #include <TopAbs_ShapeEnum.hxx>
28 #include <BOPTools_ListOfCoupleOfInteger.hxx>
29 #include <NMTDS_ShapesDataStructure.hxx>
30 #include <BooleanOperations_OnceExplorer.hxx>
32 //=======================================================================
33 //function : SortTypes
35 //=======================================================================
36 void NMTTools_PaveFiller::SortTypes(Standard_Integer& theWhat,
37 Standard_Integer& theWith)const
39 Standard_Boolean aReverseFlag=Standard_True;
41 TopAbs_ShapeEnum aType1= myDS->GetShapeType(theWhat),
42 aType2= myDS->GetShapeType(theWith);
47 if (aType1==TopAbs_EDGE && aType2==TopAbs_FACE){
48 aReverseFlag=Standard_False;
51 if (aType1==TopAbs_VERTEX &&
52 (aType2==TopAbs_FACE || aType2==TopAbs_EDGE)) {
53 aReverseFlag=Standard_False;
56 Standard_Integer aWhat, aWith;
57 aWhat=(aReverseFlag) ? theWith : theWhat;
58 aWith=(aReverseFlag) ? theWhat : theWith;
63 //=======================================================================
64 // function: ExpectedPoolLength
66 //=======================================================================
67 Standard_Integer NMTTools_PaveFiller::ExpectedPoolLength()const
69 Standard_Integer aNbIIs;
70 Standard_Real aCfPredict=.5;
71 // Modified Thu Sep 14 14:35:18 2006
72 // Contribution of Samtech www.samcef.com BEGIN
73 //const BOPTools_ListOfCoupleOfInteger& aLC=myDSIt.ListOfCouple();
74 //aNbIIs=aLC.Extent();
75 aNbIIs=myDSIt.ExpectedLength();
76 // Contribution of Samtech www.samcef.com END
82 aNbIIs=(Standard_Integer) (aCfPredict*(Standard_Real)aNbIIs);
86 //=======================================================================
87 // function:IsSuccesstorsComputed
89 //=======================================================================
90 Standard_Boolean NMTTools_PaveFiller::IsSuccesstorsComputed(const Standard_Integer aN1,
91 const Standard_Integer aN2)const
93 Standard_Integer nSuc, n1, n2;
95 BooleanOperations_OnceExplorer aExp(*myDS);
96 TopAbs_ShapeEnum aType=myDS->GetShapeType(aN1);
101 if (aType!=TopAbs_VERTEX) {
102 Standard_Integer ntmp=n1;
107 aType=myDS->GetShapeType(n2);
108 if (aType==TopAbs_EDGE) {
109 aExp.Init(n2, TopAbs_VERTEX);
110 for (; aExp.More(); aExp.Next()) {
112 if (myIntrPool->IsComputed(n1, nSuc)) {
113 return Standard_True;
116 return Standard_False;
119 else if (aType==TopAbs_FACE) {
120 aExp.Init(n2, TopAbs_VERTEX);
121 for (; aExp.More(); aExp.Next()) {
123 if (myIntrPool->IsComputed(n1, nSuc)) {
124 return Standard_True;
128 aExp.Init(n2, TopAbs_EDGE);
129 for (; aExp.More(); aExp.Next()) {
131 if (myIntrPool->IsComputed(n1, nSuc)) {
132 return Standard_True;
135 return Standard_False;
138 return Standard_False;