/src/contrib/geom-5.1.2.7/src/NMTTools/NMTTools_PaveFiller_0.cpp

http://pythonocc.googlecode.com/ · C++ · 127 lines · 32 code · 3 blank · 92 comment · 3 complexity · bb192341a2b95e69beaeae43f8b9cdfa MD5 · raw file

  1. // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
  2. //
  3. // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
  4. // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
  5. //
  6. // This library is free software; you can redistribute it and/or
  7. // modify it under the terms of the GNU Lesser General Public
  8. // License as published by the Free Software Foundation; either
  9. // version 2.1 of the License.
  10. //
  11. // This library is distributed in the hope that it will be useful,
  12. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. // Lesser General Public License for more details.
  15. //
  16. // You should have received a copy of the GNU Lesser General Public
  17. // License along with this library; if not, write to the Free Software
  18. // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  19. //
  20. // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
  21. //
  22. // File: NMTTools_PaveFiller_0.cxx
  23. // Created: Mon Dec 8 11:45:51 2003
  24. // Author: Peter KURNEV
  25. // <pkv@irinox>
  26. //
  27. #include <NMTTools_PaveFiller.ixx>
  28. #include <TColStd_IndexedMapOfInteger.hxx>
  29. #include <TopAbs_ShapeEnum.hxx>
  30. #include <NMTDS_InterfPool.hxx>
  31. #include <NMTDS_ShapesDataStructure.hxx>
  32. #include <NMTDS_Iterator.hxx>
  33. //=======================================================================
  34. // function:IsSuccesstorsComputed
  35. // purpose:
  36. //=======================================================================
  37. Standard_Boolean NMTTools_PaveFiller::IsSuccessorsComputed(const Standard_Integer aN1,
  38. const Standard_Integer aN2)const
  39. {
  40. Standard_Boolean bComputed;
  41. Standard_Integer i, nSuc, n1, n2, ntmp, aNbS;
  42. TopAbs_ShapeEnum aType;
  43. TColStd_IndexedMapOfInteger aMSuc;
  44. //
  45. n1=aN1;
  46. n2=aN2;
  47. aType=myDS->GetShapeType(aN1);
  48. if (aType!=TopAbs_VERTEX) {
  49. ntmp=n1;
  50. n1=n2;
  51. n2=ntmp;
  52. }
  53. //
  54. myDS->GetAllSuccessors(n2, aMSuc);
  55. aNbS=aMSuc.Extent();
  56. for (i=1; i<=aNbS; ++i) {
  57. nSuc=aMSuc(i);
  58. bComputed=myIP->Contains(n1, nSuc);
  59. if (bComputed) {
  60. break;
  61. }
  62. }
  63. return bComputed;
  64. }
  65. /*
  66. //=======================================================================
  67. // function: ExpectedPoolLength
  68. // purpose:
  69. //=======================================================================
  70. Standard_Integer NMTTools_PaveFiller::ExpectedPoolLength()const
  71. {
  72. Standard_Integer aNbIIs;
  73. Standard_Real aCfPredict=.5;
  74. // Modified Thu Sep 14 14:35:18 2006
  75. // Contribution of Samtech www.samcef.com BEGIN
  76. //const BOPTools_ListOfCoupleOfInteger& aLC=myDSIt.ListOfCouple();
  77. //aNbIIs=aLC.Extent();
  78. aNbIIs=myDSIt->ExpectedLength();
  79. // Contribution of Samtech www.samcef.com END
  80. //
  81. if (aNbIIs==1) {
  82. return aNbIIs;
  83. }
  84. //
  85. aNbIIs=(Standard_Integer) (aCfPredict*(Standard_Real)aNbIIs);
  86. return aNbIIs;
  87. }
  88. */
  89. /*
  90. //=======================================================================
  91. //function : SortTypes
  92. //purpose :
  93. //=======================================================================
  94. void NMTTools_PaveFiller::SortTypes(Standard_Integer& theWhat,
  95. Standard_Integer& theWith)const
  96. {
  97. Standard_Integer aWhat, aWith;
  98. Standard_Boolean aReverseFlag;
  99. TopAbs_ShapeEnum aType1, aType2;
  100. //
  101. aType1= myDS->GetShapeType(theWhat),
  102. aType2= myDS->GetShapeType(theWith);
  103. //
  104. if (aType1==aType2) {
  105. return;
  106. }
  107. //
  108. aReverseFlag=Standard_True;
  109. if (aType1==TopAbs_EDGE && aType2==TopAbs_FACE) {
  110. aReverseFlag=Standard_False;
  111. }
  112. if (aType1==TopAbs_VERTEX &&
  113. (aType2==TopAbs_FACE || aType2==TopAbs_EDGE)) {
  114. aReverseFlag=Standard_False;
  115. }
  116. //
  117. aWhat=(aReverseFlag) ? theWith : theWhat;
  118. aWith=(aReverseFlag) ? theWhat : theWith;
  119. //
  120. theWhat=aWhat;
  121. theWith=aWith;
  122. }
  123. */