Package SortTools and its derived classes are removed; STL sort algorithms are used instead.
Comparator objects are mostly reimplemented as local classes.
p Precision
p Quantity
p Resource
-p SortTools
p Standard
p StdFail
p Storage
#include <Precision.hxx>
#include <AppDef_MyLineTool.hxx>
-#include <SortTools_StraightInsertionSortOfReal.hxx>
-#include <SortTools_ShellSortOfReal.hxx>
-#include <TCollection_CompareOfReal.hxx>
#include <TColStd_HArray2OfInteger.hxx>
#include <TColStd_Array2OfInteger.hxx>
#include <TColStd_Array2OfReal.hxx>
#include <PLib_HermitJacobi.hxx>
#include <FEmTool_HAssemblyTable.hxx>
+// Add this line:
+#include <algorithm>
+
#if defined(WNT)
# include <stdio.h>
# include <stdarg.h>
const Standard_Real BigValue = 1.e37, SmallValue = 1.e-6, SmallestValue = 1.e-9;
- // SortTools_StraightInsertionSortOfReal Sort;
- TCollection_CompareOfReal CompReal;
Handle(TColStd_HArray1OfReal) CurrentTi, NewTi, OldTi;
Handle(TColStd_HArray2OfInteger) Dependence;
Standard_Boolean lestim, lconst, ToOptim, iscut;
if (lestim && isnear) {
// (1.7) Optimization of ti by ACR.
- // Sort.Sort(CurrentTi->ChangeArray1(), CompReal);
- SortTools_StraightInsertionSortOfReal::Sort(CurrentTi->ChangeArray1(), CompReal);
+
+ std::stable_sort (CurrentTi->begin(), CurrentTi->end());
+
Standard_Integer Decima = 4;
CCurrent->Length(0., 1., CBLONG);
OldTi->ChangeArray1() = CurrentTi->Array1();
// (2.2) Optimization des ti by ACR.
- // Sort.Sort(CurrentTi->ChangeArray1(), CompReal);
- SortTools_StraightInsertionSortOfReal::Sort(CurrentTi->ChangeArray1(), CompReal);
+
+ std::stable_sort (CurrentTi->begin(), CurrentTi->end());
+
Standard_Integer Decima = 4;
CCurrent->Length(0., 1., CBLONG);
// (3.2) On arrange les ti : Trie + recadrage sur (0,1)
// ---> On trie, afin d'assurer l'ordre par la suite.
- // Sort.Sort(CurrentTi->ChangeArray1(), CompReal);
- SortTools_StraightInsertionSortOfReal::Sort(CurrentTi->ChangeArray1(), CompReal);
+
+ std::stable_sort (CurrentTi->begin(), CurrentTi->end());
if ((CurrentTi->Value(1)!= 0.) ||
(CurrentTi->Value(NbrPnt)!= 1.)) {
for(i = InKnots.Lower(); i <= InKnots.Upper(); i++) OutKnots(i) = InKnots(i);
for(i = NbElmOld + 1; i <= NbElm; i++) OutKnots(i + i0) = NewKnots(i);
- // SortTools_ShellSortOfReal Sort;
- TCollection_CompareOfReal CompReal;
-
- // Sort.Sort(OutKnots, CompReal);
- SortTools_ShellSortOfReal::Sort(OutKnots, CompReal);
+ std::sort (OutKnots.begin(), OutKnots.end());
}
else
iscut = Standard_False;
#include <TColStd_HArray1OfReal.hxx>
#include <TColgp_Array1OfPnt2d.hxx>
#include <TColGeom2d_SequenceOfCurve.hxx>
-#include <SortTools_ShellSortOfReal.hxx>
-#include <TCollection_CompareOfReal.hxx>
#include <TopTools_SequenceOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
class BRepMesh_Vertex;
class gp_Pnt;
class BRepMesh_FaceAttribute;
-class TopTools_DataMapOfShapeReal;
-
//! Algorithm to mesh a shape with respect of the <br>
//! frontier the deflection and by option the shared <br>
#include <Standard_ErrorHandler.hxx>
#include <Standard_Failure.hxx>
-#include <SortTools_ShellSortOfReal.hxx>
-#include <TCollection_CompareOfReal.hxx>
#include <TColStd_Array1OfReal.hxx>
#include <TColStd_ListOfInteger.hxx>
#include <TColStd_SequenceOfReal.hxx>
for (j = 1; j <= anInitLen; j++)
aParamArray(j) = theParams(j);
- TCollection_CompareOfReal aCompare;
- SortTools_ShellSortOfReal::Sort(aParamArray, aCompare);
+ std::sort (aParamArray.begin(), aParamArray.end());
- // mandadory pre-filtering using the first (minimal) filter value
+ // mandatory pre-filtering using the first (minimal) filter value
Standard_Real aP1, aP2;
aP1 = aParamArray(1);
aParamTmp.Append(aP1);
#include <TColgp_Array1OfPnt2d.hxx>
#include <Standard_DimensionError.hxx>
#include <Standard_Real.hxx>
-#include <TCollection_CompareOfReal.hxx>
-#include <SortTools_QuickSortOfReal.hxx>
#include <Precision.hxx>
+#include <algorithm>
+
//=======================================================================
//function : HermiteCoeff
//purpose : calculate the Hermite coefficients of degree 3 from BS and
Standard_Integer cas=0,mark=0,dercas=0, //loop marks
min,max; //Pole min and max indices
Standard_Real Us1,Us2,a; //bounderies value of the knots to be inserted
-// gp_Pnt2d P ;
- TCollection_CompareOfReal Comp;
U4=0.0;U5=1.0; //default value
if (Ux!=1.0){
TColStd_Array1OfReal knots(1,Knots->Length());
knots=Knots->ChangeArray1();
- SortTools_QuickSortOfReal::Sort(knots,Comp); //sort of the array of knots
+
+ //sort of the array of knots
+ std::sort (knots.begin(), knots.end());
Polesinit(0).SetCoord(0.0,Herm(0)); //poles of the Hermite polynome in the BSpline form
Polesinit(1).SetCoord(0.0,Herm(0)+Herm(1)/3.0);
Standard_Integer cas=0,mark=0,dercas=0, //loop marks
min,max; //Pole min and max indices
Standard_Real Us1,Us2,a; //bounderies value of the knots to be inserted
-// gp_Pnt2d P ;
- TCollection_CompareOfReal Comp;
U4=0.0;U5=1.0; //default value
if (Ux!=1.0){
TColStd_Array1OfReal knots(1,Knots->Length());
knots=Knots->ChangeArray1();
- SortTools_QuickSortOfReal::Sort(knots,Comp); //sort of the array of knots
+
+ //sort of the array of knots
+ std::sort (knots.begin(), knots.end());
Polesinit(0).SetCoord(0.0,Herm(0)); //poles of the Hermite polynome in the BSpline form
Polesinit(1).SetCoord(0.0,Herm(0)+Herm(1)/3.0);
TColStd,
BRepAdaptor,
BRepTopAdaptor,
- SortTools,
TopTools,
math,
gp,
class Range;
class CommonPrt;
class Root;
- class Compare;
- class CompareRange;
class EdgeEdge;
imported Array1OfRange;
- class QuickSort instantiates
- QuickSort from SortTools (Root from IntTools,
- Array1OfRoots from IntTools,
- Compare from IntTools);
-
- class QuickSortRange instantiates
- QuickSort from SortTools (Range from IntTools,
- Array1OfRange from IntTools,
- CompareRange from IntTools);
- imported SequenceOfCommonPrts;
-
- imported IndexedDataMapOfTransientAddress;
+ imported SequenceOfCommonPrts;
+
+ imported IndexedDataMapOfTransientAddress;
imported ListOfCurveRangeSample;
#include <BRep_Tool.hxx>
#include <IntTools_Root.hxx>
#include <IntTools_Array1OfRoots.hxx>
-#include <IntTools_Compare.hxx>
-#include <IntTools_QuickSort.hxx>
#include <IntTools_Root.hxx>
#include <gce_MakeCirc.hxx>
#include <TColStd_ListIteratorOfListOfReal.hxx>
#include <gce_ErrorType.hxx>
-#ifdef WNT
-#pragma warning ( disable : 4101 )
-#endif
+#include <algorithm>
+
//=======================================================================
//function : IntTools::GetRadius
//purpose :
}
}
+//=======================================================================
+
+namespace {
+ // Auxiliary: comparator function for sorting roots
+ bool IntTools_RootComparator (const IntTools_Root& theLeft, const IntTools_Root& theRight)
+ {
+ return theLeft.Root() < theRight.Root();
+ }
+};
+
//=======================================================================
//function : SortRoots
//purpose :
//=======================================================================
void IntTools::SortRoots(IntTools_SequenceOfRoots& mySequenceOfRoots,
- const Standard_Real myEpsT)
+ const Standard_Real /*myEpsT*/)
{
Standard_Integer j, aNbRoots;
aNbRoots=mySequenceOfRoots.Length();
- IntTools_Array1OfRoots anArray1OfRoots(1, aNbRoots);
- IntTools_Compare aComparator(myEpsT);
-
+ IntTools_Array1OfRoots anArray1OfRoots(1, aNbRoots);
for (j=1; j<=aNbRoots; j++) {
anArray1OfRoots(j)=mySequenceOfRoots(j);
}
- IntTools_QuickSort aQS;
- aQS.Sort(anArray1OfRoots, aComparator);
+ std::sort (anArray1OfRoots.begin(), anArray1OfRoots.end(), IntTools_RootComparator);
mySequenceOfRoots.Clear();
for (j=1; j<=aNbRoots; j++) {
+++ /dev/null
--- Created on: 2000-05-22
--- Created by: Peter KURNEV
--- Copyright (c) 2000-2014 OPEN CASCADE SAS
---
--- This file is part of Open CASCADE Technology software library.
---
--- This library is free software; you can redistribute it and/or modify it under
--- the terms of the GNU Lesser General Public License version 2.1 as published
--- by the Free Software Foundation, with special exception defined in the file
--- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
--- distribution for complete text of the license and disclaimer of any warranty.
---
--- Alternatively, this file may be used under the terms of Open CASCADE
--- commercial license or contractual agreement.
-
-class Compare from IntTools
-
- ---Purpose: Auxiliary class to provide a sorting Roots.
-
-uses
- Root from IntTools
-
-is
- Create
- returns Compare from IntTools;
- ---Purpose:
- --- Empty constructor
- ---
-
- Create (aTol:Real from Standard)
- returns Compare from IntTools;
- ---Purpose:
- --- Initializes me by tolerance
- ---
-
- IsLower (me; Left, Right: Root from IntTools)
- ---Purpose:
- --- Returns True if <Left> is lower than <Right>.
- ---
- returns Boolean from Standard;
-
- IsGreater (me; Left, Right: Root from IntTools)
- ---Level: Public
- ---Purpose:
- --- Returns True if <Left> is greater than <Right>.
- ---
- returns Boolean from Standard;
-
- IsEqual(me; Left, Right: Root from IntTools)
- ---Level: Public
- ---Purpose:
- --- Returns True when <Right> and <Left> are equal.
- ---
- returns Boolean from Standard ;
-
-
-fields
- myTol: Real from Standard;
-
-end Compare;
+++ /dev/null
-// Created on: 2000-05-22
-// Created by: Peter KURNEV
-// Copyright (c) 2000-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#include <IntTools_Compare.ixx>
-//=======================================================================
-//function :IntTools_Compare::IntTools_Compare
-//purpose :
-//=======================================================================
-IntTools_Compare::IntTools_Compare() :myTol(1.e-12) {}
-
-//=======================================================================
-//function :IntTools_Compare::IntTools_Compare
-//purpose :
-//=======================================================================
- IntTools_Compare::IntTools_Compare(const Standard_Real aTol)
-{
- myTol=aTol;
-}
-
-//=======================================================================
-//function :IsLower
-//purpose :
-//=======================================================================
- Standard_Boolean IntTools_Compare::IsLower(const IntTools_Root& aLeft,
- const IntTools_Root& aRight)const
-{
- return aLeft.Root()<aRight.Root();
-}
-
-//=======================================================================
-//function :IsGreater
-//purpose :
-//=======================================================================
- Standard_Boolean IntTools_Compare::IsGreater(const IntTools_Root& aLeft,
- const IntTools_Root& aRight)const
-{
- return !IsLower(aLeft,aRight);
-}
-
-//=======================================================================
-//function :IsEqual
-//purpose :
-//=======================================================================
- Standard_Boolean IntTools_Compare::IsEqual(const IntTools_Root& aLeft,
- const IntTools_Root& aRight)const
-{
- Standard_Real a, b;
- a=aLeft.Root();
- b=aRight.Root();
- return fabs(a-b) < myTol;
-}
-
-
-
-
-
-
+++ /dev/null
--- Created on: 2000-10-24
--- Created by: Peter KURNEV
--- Copyright (c) 2000-2014 OPEN CASCADE SAS
---
--- This file is part of Open CASCADE Technology software library.
---
--- This library is free software; you can redistribute it and/or modify it under
--- the terms of the GNU Lesser General Public License version 2.1 as published
--- by the Free Software Foundation, with special exception defined in the file
--- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
--- distribution for complete text of the license and disclaimer of any warranty.
---
--- Alternatively, this file may be used under the terms of Open CASCADE
--- commercial license or contractual agreement.
-
-class CompareRange from IntTools
-
- ---Purpose: Auxiliary class to provide a sorting Ranges,
- -- taking into account a value of Left .
-
-uses
- Range from IntTools
---raises
-
-is
- Create
- returns CompareRange from IntTools;
- ---Purpose:
- --- Empty constructor
- ---
-
- Create (aTol:Real from Standard)
- returns CompareRange from IntTools;
- ---Purpose:
- --- Initializes me by tolerance
- ---
-
- IsLower (me; Left, Right: Range from IntTools)
- ---Purpose:
- --- Returns True if <Left> is lower than <Right>.
- ---
- returns Boolean from Standard;
-
- IsGreater (me; Left, Right: Range from IntTools)
- ---Level: Public
- ---Purpose:
- --- Returns True if <Left> is greater than <Right>.
- ---
- returns Boolean from Standard;
-
- IsEqual(me; Left, Right: Range from IntTools)
- ---Level: Public
- ---Purpose:
- --- Returns True when <Right> and <Left> are equal.
- ---
- returns Boolean from Standard ;
-
-fields
- myTol: Real from Standard;
-
-end CompareRange;
+++ /dev/null
-// Created on: 2000-10-24
-// Created by: Peter KURNEV
-// Copyright (c) 2000-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#include <IntTools_CompareRange.ixx>
-//=======================================================================
-//function :IntTools_CompareRange::IntTools_CompareRange
-//purpose :
-//=======================================================================
-IntTools_CompareRange::IntTools_CompareRange() :myTol(1.e-12) {}
-
-//=======================================================================
-//function :IntTools_CompareRange::IntTools_CompareRange
-//purpose :
-//=======================================================================
- IntTools_CompareRange::IntTools_CompareRange(const Standard_Real aTol)
-{
- myTol=aTol;
-}
-
-//=======================================================================
-//function :IsLower
-//purpose :
-//=======================================================================
- Standard_Boolean IntTools_CompareRange::IsLower(const IntTools_Range& aLeft,
- const IntTools_Range& aRight)const
-{
- return aLeft.First()<aRight.First();
-}
-
-//=======================================================================
-//function :IsGreater
-//purpose :
-//=======================================================================
- Standard_Boolean IntTools_CompareRange::IsGreater(const IntTools_Range& aLeft,
- const IntTools_Range& aRight)const
-{
- return !IsLower(aLeft,aRight);
-}
-
-//=======================================================================
-//function :IsEqual
-//purpose :
-//=======================================================================
- Standard_Boolean IntTools_CompareRange::IsEqual(const IntTools_Range& aLeft,
- const IntTools_Range& aRight)const
-{
- Standard_Real a, b;
- a=aLeft.First();
- b=aRight.First();
- return fabs(a-b) < myTol;
-}
-
-
-
#include <IntTools_Range.hxx>
#include <IntTools_Tools.hxx>
#include <IntTools_Array1OfRange.hxx>
-#include <IntTools_QuickSortRange.hxx>
-#include <IntTools_CompareRange.hxx>
#include <IntTools_CommonPrt.hxx>
#include <IntTools_Root.hxx>
#include <IntTools_BeanFaceIntersector.hxx>
#include <GeomAdaptor_HSurface.hxx>
#include <IntCurveSurface_IntersectionPoint.hxx>
-#ifdef WNT
-#pragma warning ( disable : 4101 )
-#endif
+#include <algorithm>
static
Standard_Boolean IsCoplanar (const BRepAdaptor_Curve& ,
AddDerivativePoints(anArgs, aFunc);
}
+
+//=======================================================================
+
+namespace {
+ // Auxiliary: comparator function for sorting ranges
+ bool IntTools_RangeComparator (const IntTools_Range& theLeft, const IntTools_Range& theRight)
+ {
+ return theLeft.First() < theRight.First();
+ }
+}
+
//=======================================================================
//function : AddDerivativePoints
//purpose :
anArray1OfRange(n+i).SetLast (aFSeq(i));
}
- IntTools_QuickSortRange aQuickSortRange;
- IntTools_CompareRange aComparator;
- aQuickSortRange.Sort (anArray1OfRange, aComparator);
+ std::sort (anArray1OfRange.begin(), anArray1OfRange.end(), IntTools_RangeComparator);
// filling the output arrays
myArgsArray.Resize(k);
-- initialize a variable.
uses
- TCollection,MMgt,SortTools,TColStd
+ TCollection,
+ MMgt,
+ TColStd
is
enumeration FormatType is
imported DataMapIteratorOfDataMapOfAsciiStringExtendedString;
- class QuickSortOfArray1 instantiates
- QuickSort from SortTools(AsciiString from TCollection,
- Array1OfAsciiString from TColStd,
- LexicalCompare from Resource) ;
-
---Class:
class LexicalCompare ;
#include <Resource_Manager.hxx>
#include <Resource_Manager.ixx>
#include <Resource_DataMapIteratorOfDataMapOfAsciiStringAsciiString.hxx>
-#include <Resource_QuickSortOfArray1.hxx>
#include <Resource_LexicalCompare.hxx>
#include <OSD_Path.hxx>
#include <errno.h>
+#include <algorithm>
+
#define END 0
#define EMPTY 1
#define COMMENT 2
for ( Index = 1; Iter.More(); Iter.Next())
KeyArray(Index++)= Iter.Key();
- Resource_LexicalCompare Comp;
- Resource_QuickSortOfArray1::Sort(KeyArray, Comp);
+ std::sort (KeyArray.begin(), KeyArray.end());
TCollection_AsciiString Line, Value;
for (Index = 1 ; Index <= NbKey ; Index++) {
-SelectMgr_CompareResults.hxx
SelectMgr_FrustumBuilder.hxx
SelectMgr_FrustumBuilder.cxx
SelectMgr_IndexedMapOfOwner.hxx
pointer SOPtr to SelectableObject from SelectMgr;
- imported CompareResults;
imported transient class IndexedMapOfOwner;
imported SelectableObjectSet;
imported FrustumBuilder;
+++ /dev/null
-// Created on: 2003-10-23
-// Created by: Alexander GRIGORIEV
-// Copyright (c) 2003-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#include <SelectMgr_IndexedDataMapOfOwnerCriterion.hxx>
-#include <SelectMgr_SortCriterion.hxx>
-#include <TCollection_CompareOfInteger.hxx>
-
-// Purpose: Redefine CompareOfInteger from TCollection, to be used
-// in method SortResult from class ViewerSelector
-
-class SelectMgr_CompareResults: public TCollection_CompareOfInteger
-{
- public:
- SelectMgr_CompareResults
- (const SelectMgr_IndexedDataMapOfOwnerCriterion& aMapOfCriterion)
- : myMapOfCriterion (aMapOfCriterion) {}
- Standard_Boolean IsLower
- (const Standard_Integer&, const Standard_Integer&) const;
- Standard_Boolean IsGreater
- (const Standard_Integer&, const Standard_Integer&) const;
- private:
- const SelectMgr_IndexedDataMapOfOwnerCriterion& myMapOfCriterion;
- void operator= (const SelectMgr_CompareResults& );
-};
-
-//=======================================================================
-//function : IsLower
-//purpose : The sort order should be inverse (the greatest to come first)
-//=======================================================================
-
-inline Standard_Boolean SelectMgr_CompareResults::IsLower
- (const Standard_Integer &Left,const Standard_Integer &Right) const
-{
- return (myMapOfCriterion.FindFromIndex(Left) >
- myMapOfCriterion.FindFromIndex(Right));
-}
-
-//=======================================================================
-//function : IsGreater
-//purpose : The sort order should be inverse (the greatest to come first)
-//=======================================================================
-
-inline Standard_Boolean SelectMgr_CompareResults::IsGreater
- (const Standard_Integer &Left,const Standard_Integer &Right) const
-{
- return (myMapOfCriterion.FindFromIndex(Left) <
- myMapOfCriterion.FindFromIndex(Right));
-}
#include <OSD_Environment.hxx>
#include <Precision.hxx>
#include <SelectMgr_ViewerSelector.hxx>
-#include <SelectMgr_CompareResults.hxx>
#include <SelectBasics_EntityOwner.hxx>
#include <SelectBasics_SensitiveEntity.hxx>
#include <SelectBasics_PickResult.hxx>
#include <SelectMgr_EntityOwner.hxx>
#include <SelectMgr_SortCriterion.hxx>
#include <SelectMgr_SensitiveEntitySet.hxx>
-#include <SortTools_QuickSortOfInteger.hxx>
#include <TColStd_Array1OfInteger.hxx>
#include <TCollection_AsciiString.hxx>
#include <TColStd_HArray1OfInteger.hxx>
#include <TColStd_ListOfInteger.hxx>
+#include <algorithm>
+
+namespace {
+ // Comparison operator for sorting selection results
+ class CompareResults
+ {
+ public:
+
+ CompareResults (const SelectMgr_IndexedDataMapOfOwnerCriterion& aMapOfCriterion)
+ : myMapOfCriterion (aMapOfCriterion)
+ {
+ }
+
+ Standard_Boolean operator() (Standard_Integer theLeft, Standard_Integer theRight) const
+ {
+ return myMapOfCriterion.FindFromIndex(theLeft) > myMapOfCriterion.FindFromIndex(theRight);
+ }
+
+ private:
+ void operator = (const CompareResults&);
+
+ private:
+ const SelectMgr_IndexedDataMapOfOwnerCriterion& myMapOfCriterion;
+ };
+}
//=======================================================================
// function: SelectMgr_ToleranceMap
for (I=1; I <= anExtent; I++)
thearr(I)=I;
- SortTools_QuickSortOfInteger::Sort (thearr,
- SelectMgr_CompareResults(mystored));
+ std::sort (thearr.begin(), thearr.end(), CompareResults (mystored));
+
}
//=======================================================================
+++ /dev/null
--- Created on: 1991-03-07
--- Created by: Herve Legrand
--- Copyright (c) 1991-1999 Matra Datavision
--- Copyright (c) 1999-2014 OPEN CASCADE SAS
---
--- This file is part of Open CASCADE Technology software library.
---
--- This library is free software; you can redistribute it and/or modify it under
--- the terms of the GNU Lesser General Public License version 2.1 as published
--- by the Free Software Foundation, with special exception defined in the file
--- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
--- distribution for complete text of the license and disclaimer of any warranty.
---
--- Alternatively, this file may be used under the terms of Open CASCADE
--- commercial license or contractual agreement.
-
--- Revised: Fri Oct 30 1992
--- By : Mireille MERCIEN
-
-
-package SortTools
-
- ---Purpose: This package provides the basic sorting tools generally
- -- used.
-
-uses TCollection,
- TColStd
-
-is
- generic class HeapSort;
-
- generic class QuickSort;
-
- generic class ShellSort;
-
- generic class StraightInsertionSort;
-
-
- -- The table below summarizes the most important characteristics that
- -- must be considered when selecting a particular sorting algorithm.
- -- A sorting algorithm is known as stable if the initial order of items
- -- with equals keys is preserved after the sorting operation.
-
- ------------------------------------------------------------------------
- -- Algorithm Stable Comparisons Moves
- -- Min Avg Max Min Avg Max
- ------------------------------------------------------------------------
- -- 2 2
- -- QuickSort No nlogn nlogn n nlogn nlogn n
- --
- ------------------------------------------------------------------------
- --
- -- HeapSort No nlogn nlogn nlogn nlogn nlogn nlogn
- --
- ------------------------------------------------------------------------
- -- 1.25 1.25
- -- ShellSort No - n - - n -
- --
- ------------------------------------------------------------------------
- -- 2 2 2 2
- -- StraightInsertion Yes n n n n n n
- --
- -------------------------------------------------------------------------
-
- --+ Heap sort exhibits an interesting time complexity, in that it runs
- -- on the order of nlogn for the best, average, and worst case.
- --+ Quick sort is still faster on the average(its constant of proportiona-
- -- lity is lower), but it does not guarantee such good worst-case perfor-
- -- mance.
- --+ Shell sort is not sensitive to the initial ordering and offers accepta-
- -- ble running time even for moderately larges arrays (say, 1000 elements).
- --+ Insertion sort is the method of choice for "almost sorted" arrays with
- -- few inversions : for such cases, it will outperform even the more
- -- sophisticated method (quick sort, heap sort).
-
-
--- Instantiations --
--- ************** --
-------------------------------------------------------------------------
-
---
--- Instantiations QuickSort (Integer,Real)
--- ***************************************
- class QuickSortOfInteger instantiates QuickSort(Integer,
- Array1OfInteger from TColStd,
- CompareOfInteger from TCollection);
- class QuickSortOfReal instantiates QuickSort(Real,
- Array1OfReal from TColStd,
- CompareOfReal from TCollection );
-
--- Instantiations HeapSort (Integer,Real)
--- ***************************************
- class HeapSortOfInteger instantiates HeapSort(Integer,
- Array1OfInteger from TColStd,
- CompareOfInteger from TCollection);
- class HeapSortOfReal instantiates HeapSort(Real,
- Array1OfReal from TColStd,
- CompareOfReal from TCollection);
-
--- Instantiations ShellSort (Integer,Real)
--- ***************************************
- class ShellSortOfInteger instantiates ShellSort(Integer,
- Array1OfInteger from TColStd,
- CompareOfInteger from TCollection);
- class ShellSortOfReal instantiates ShellSort(Real,
- Array1OfReal from TColStd,
- CompareOfReal from TCollection );
-
--- Instantiations StraightInsertionSort (Integer,Real)
--- ***************************************************
- class StraightInsertionSortOfInteger instantiates
- StraightInsertionSort(Integer,
- Array1OfInteger from TColStd,
- CompareOfInteger from TCollection);
- class StraightInsertionSortOfReal instantiates
- StraightInsertionSort(Real,
- Array1OfReal from TColStd,
- CompareOfReal from TCollection);
-
-end SortTools;
-
+++ /dev/null
--- Created on: 1991-03-05
--- Created by: Herve Legrand
--- Copyright (c) 1991-1999 Matra Datavision
--- Copyright (c) 1999-2014 OPEN CASCADE SAS
---
--- This file is part of Open CASCADE Technology software library.
---
--- This library is free software; you can redistribute it and/or modify it under
--- the terms of the GNU Lesser General Public License version 2.1 as published
--- by the Free Software Foundation, with special exception defined in the file
--- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
--- distribution for complete text of the license and disclaimer of any warranty.
---
--- Alternatively, this file may be used under the terms of Open CASCADE
--- commercial license or contractual agreement.
-
-generic class HeapSort from SortTools (Item as any;
- Array as Array1 from TCollection(Item);
- Comparator as any)
-
- ---Purpose: This class provides the HeapSort algorithm.
-
-is
-
- Sort(myclass; TheArray : in out Array; Comp : Comparator);
- ---Purpose: Sort an array using the HeapSort algorithm.
- ---Level: Public
-
-end;
-
+++ /dev/null
-// Copyright (c) 1998-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-// SortTools_HeapSort.gxx
-// cree le 04/11/91 par ASI
-// Reference : Software Conponents with ADA, Grady Booch.
-
-void Shift(Array& TheArray,
- const Comparator& Comp,
- const Standard_Integer Left, const Standard_Integer Right)
-{
- Item Temp = TheArray(Left);
- Standard_Integer Front = Left;
- Standard_Integer Back = Front * 2;
- while (Back <= Right) {
- if (Back < Right) {
- if(Comp.IsLower(TheArray(Back), TheArray(Back + 1))) {
- Back = Back + 1;
- }
- }
- if(!Comp.IsLower(Temp, TheArray(Back))) break;
- TheArray(Front) = TheArray(Back);
- Front = Back;
- if(Front * 2 > TheArray.Upper()) break;
- Back = Front * 2;
- }
- TheArray(Front) = Temp;
-}
-
-void SortTools_HeapSort::Sort(Array& TheArray,
- const Comparator& Comp)
-{
- Item TempItem;
- Standard_Integer Left;
- Standard_Integer Right;
-
- Left = ((TheArray.Upper() - TheArray.Lower() + 1) / 2) + 1;
- Right = TheArray.Upper();
- while (Left > TheArray.Lower()) {
- Left = Left - 1;
- Shift(TheArray, Comp, Left, Right);
- }
- while (Right > TheArray.Lower()) {
- TempItem = TheArray(TheArray.Lower());
- TheArray(TheArray.Lower()) = TheArray(Right);
- TheArray(Right) = TempItem;
- Right = Right - 1;
- Shift(TheArray, Comp, Left, Right);
- }
-}
-
-
-
-
-
+++ /dev/null
--- Created on: 1991-03-05
--- Created by: Herve Legrand, Mireille MERCIEN
--- Copyright (c) 1991-1999 Matra Datavision
--- Copyright (c) 1999-2014 OPEN CASCADE SAS
---
--- This file is part of Open CASCADE Technology software library.
---
--- This library is free software; you can redistribute it and/or modify it under
--- the terms of the GNU Lesser General Public License version 2.1 as published
--- by the Free Software Foundation, with special exception defined in the file
--- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
--- distribution for complete text of the license and disclaimer of any warranty.
---
--- Alternatively, this file may be used under the terms of Open CASCADE
--- commercial license or contractual agreement.
-
-generic class QuickSort from SortTools (Item as any;
- Array as Array1 from TCollection(Item);
- Comparator as any)
-
- ---Purpose: This class provides the QuickSort algorithm.
-
-is
-
- Sort(myclass; TheArray : in out Array; Comp : Comparator);
- ---Purpose: Sort an array using the QuickSort algorithm.
- ---Level: Public
-
-end;
-
+++ /dev/null
-// Copyright (c) 1998-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-// SortTools_QuickSort.gxx
-// cree le 04/11/91 par ASI
-// Reference : Software Conponents with ADA, Grady Booch.
-
-inline void Exchange(Item& Left, Item& Right)
-{
- Item Temp = Left;
- Left = Right;
- Right = Temp;
-}
-
-static void SortRecursive(Array& TheArray,
- const Comparator& Comp,
- const Standard_Integer Left,
- const Standard_Integer Right)
-{
- Item Pivot;
- Standard_Integer Front, Back, Middle;
-
- if(Left < Right) {
- Middle = (Left + Right) / 2;
- if(Comp.IsLower(TheArray(Middle), TheArray(Left))) {
- Exchange(TheArray(Middle), TheArray(Left));
- }
- if(Comp.IsLower(TheArray(Right), TheArray(Left))) {
- Exchange(TheArray(Right), TheArray(Left));
- }
- if(Comp.IsLower(TheArray(Right), TheArray(Middle))) {
- Exchange(TheArray(Right), TheArray(Middle));
- }
- Pivot = TheArray(Middle);
- Exchange(TheArray(Middle), TheArray(Right - 1));
- Front = Left + 1;
- Back = Right - 1;
- if(Back != TheArray.Lower()) {
- Back = Back - 1;
- }
- for(;;) {
- while (Comp.IsLower(TheArray(Front), Pivot)) {
- Front = Front + 1;
- }
- while (Comp.IsLower(Pivot, TheArray(Back))) {
- Back = Back - 1;
- }
- if(Front <= Back) {
- if(Front == TheArray.Upper()) return;
- if(Back == TheArray.Lower()) return;
- Exchange(TheArray(Front), TheArray(Back));
- Front = Front + 1;
- Back = Back - 1;
- }
- if(Front > Back) break;
- }
- SortRecursive(TheArray, Comp, Left, Back);
- SortRecursive(TheArray, Comp, Front, Right);
- }
-}
-
-void SortTools_QuickSort::Sort(Array& TheArray,
- const Comparator& Comp)
-{
- SortRecursive(TheArray, Comp, TheArray.Lower(), TheArray.Upper());
-}
-
-
-
-
-
+++ /dev/null
--- Created on: 1991-03-05
--- Created by: Herve Legrand,Mireille MERCIEN
--- Copyright (c) 1991-1999 Matra Datavision
--- Copyright (c) 1999-2014 OPEN CASCADE SAS
---
--- This file is part of Open CASCADE Technology software library.
---
--- This library is free software; you can redistribute it and/or modify it under
--- the terms of the GNU Lesser General Public License version 2.1 as published
--- by the Free Software Foundation, with special exception defined in the file
--- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
--- distribution for complete text of the license and disclaimer of any warranty.
---
--- Alternatively, this file may be used under the terms of Open CASCADE
--- commercial license or contractual agreement.
-
-generic class ShellSort from SortTools (Item as any;
- Array as Array1 from TCollection(Item);
- Comparator as any)
-
- ---Purpose: This class provides the ShellSort algorithm.
-
-is
-
- Sort(myclass; TheArray : in out Array; Comp : Comparator);
- ---Purpose: Sort an array using the ShellSort algorithm.
- ---Level: Public
-
-end;
+++ /dev/null
-// Copyright (c) 1998-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-// SortTools_ShellSort.gxx
-// cree le 04/11/91 par ASI
-// Reference : Software Conponents with ADA, Grady Booch.
-
-void SortTools_ShellSort::Sort(Array& TheArray,
- const Comparator& Comp)
-{
-
- Item TempItem;
- Standard_Integer Outer;
- Standard_Integer Inner;
- Standard_Integer Inc = 1;
-
- for(;;) {
- if((9 * Inc) + 4 >= TheArray.Upper() - TheArray.Lower() + 1) break;
- Inc = (Inc * 3) + 1;
- }
- for(;;) {
- Outer = TheArray.Lower() + Inc;
- for(;;) {
- TempItem = TheArray(Outer);
- Inner = Outer;
- while (Comp.IsLower(TempItem, TheArray(Inner - Inc))) {
- TheArray(Inner) = TheArray(Inner - Inc);
- Inner = Inner - Inc;
- if(Inner - Inc < TheArray.Lower()) break;
- }
- TheArray(Inner) = TempItem;
- if(Outer + Inc > TheArray.Upper()) break;
- Outer = Outer + Inc;
- }
- if(Inc == 1) break;
- Inc = (Inc - 1) / 3;
- }
-}
-
-
-
-
-
+++ /dev/null
--- Created on: 1991-03-05
--- Created by: Herve Legrand, Mireille MERCIEN
--- Copyright (c) 1991-1999 Matra Datavision
--- Copyright (c) 1999-2014 OPEN CASCADE SAS
---
--- This file is part of Open CASCADE Technology software library.
---
--- This library is free software; you can redistribute it and/or modify it under
--- the terms of the GNU Lesser General Public License version 2.1 as published
--- by the Free Software Foundation, with special exception defined in the file
--- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
--- distribution for complete text of the license and disclaimer of any warranty.
---
--- Alternatively, this file may be used under the terms of Open CASCADE
--- commercial license or contractual agreement.
-
-generic class StraightInsertionSort from SortTools (
- Item as any;
- Array as Array1 from TCollection(Item);
- Comparator as any)
-
- ---Purpose: This class provides the StraightInsertionSort algorithm.
-
-is
-
- Sort(myclass; TheArray : in out Array; Comp : Comparator);
- ---Purpose: Sort an array using the StraightInsertionSort algorithm.
- ---Level: Public
-
-end;
+++ /dev/null
-// Copyright (c) 1998-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-// SortTools_StraightInsertionSort.gxx
-// cree le 04/11/91 par ASI
-// Reference : Software Conponents with ADA, Grady Booch.
-
-void SortTools_StraightInsertionSort::Sort(Array& TheArray,
- const Comparator& Comp)
-{
- Item TempItem;
- Standard_Integer J;
-
- for(Standard_Integer I = TheArray.Lower() + 1; I <= TheArray.Upper(); I++) {
- TempItem = TheArray(I);
- J = I;
- while (Comp.IsLower(TempItem, TheArray(J - 1))) {
- TheArray(J) = TheArray(J - 1);
- J = J - 1;
- if (J == TheArray.Lower()) break;
- }
- TheArray(J) = TempItem;
- }
-}
-
-
-
-
-
-TCollection_Compare.gxx
-TCollection_CMPLRS.edl
TCollection_WOKSteps.edl
enumeration Side is Left , Right;
- deferred generic class Compare ;
-
- private deferred class PrivCompareOfInteger
- instantiates Compare from TCollection(Integer from Standard);
-
- private deferred class PrivCompareOfReal
- instantiates Compare from TCollection(Real from Standard);
-
- class CompareOfInteger;
-
- class CompareOfReal;
-
-
NextPrimeForMap(I : Integer) returns Integer;
---Purpose: Returns a prime number greater than <I> suitable
-- to dimension a Map. When <I> becomes great there
+++ /dev/null
--- Created on: 1998-02-20
--- Created by: euclid
--- Copyright (c) 1998-1999 Matra Datavision
--- Copyright (c) 1999-2014 OPEN CASCADE SAS
---
--- This file is part of Open CASCADE Technology software library.
---
--- This library is free software; you can redistribute it and/or modify it under
--- the terms of the GNU Lesser General Public License version 2.1 as published
--- by the Free Software Foundation, with special exception defined in the file
--- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
--- distribution for complete text of the license and disclaimer of any warranty.
---
--- Alternatively, this file may be used under the terms of Open CASCADE
--- commercial license or contractual agreement.
-
-@if ( %DebugMode == "False" ) then
-
- @if ( %Station == "sun" ) then
- @set %CMPLRS_CXX_ModeOpt = " -O3 -DNo_Exception ";
- @endif;
-
- @if ( %Station == "ao1" ) then
- @string %CMPLRS_CXX_ModeOpt += " -O3 -DNo_Exception ";
- @endif;
-
- @if ( %Station == "sil" ) then
- @set %CMPLRS_CXX_ModeOpt = " -O2 -DNo_Exception ";
- @endif;
-
- @if ( %Station == "hp" ) then
- @set %CMPLRS_CXX_ModeOpt = " +O3 -DNo_Exception ";
- @endif;
-
-@endif;
-
+++ /dev/null
--- Created on: 1991-05-14
--- Created by: Annick PANCHER
--- Copyright (c) 1991-1999 Matra Datavision
--- Copyright (c) 1999-2014 OPEN CASCADE SAS
---
--- This file is part of Open CASCADE Technology software library.
---
--- This library is free software; you can redistribute it and/or modify it under
--- the terms of the GNU Lesser General Public License version 2.1 as published
--- by the Free Software Foundation, with special exception defined in the file
--- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
--- distribution for complete text of the license and disclaimer of any warranty.
---
--- Alternatively, this file may be used under the terms of Open CASCADE
--- commercial license or contractual agreement.
-
--- Revised: Mireille MERCIEN
-
-
-deferred generic class Compare from TCollection ( Item as any )
-
- ---Purpose: Defines a comparison operator which can be used by
- -- any ordered structure. The way to compare items
- -- has to be described in subclasses, which inherit
- -- from instantiations of Compare.
-
-is
-
- IsLower (me; Left, Right: Item)
- ---Level: Public
- ---Purpose: returns True if <Left> is lower than <Right>.
- returns Boolean
- is virtual;
-
- IsGreater (me; Left, Right: Item)
- ---Level: Public
- ---Purpose: returns True if <Left> is greater than <Right>.
- returns Boolean
- is virtual;
-
- IsEqual(me; Left, Right: Item)
- ---Level: Public
- ---Purpose: returns True when <Right> and <Left> are equal.
- returns Boolean
- is virtual;
-
-end;
-
-
+++ /dev/null
-// Created on: 1992-08-27
-// Created by: Mireille MERCIEN
-// Copyright (c) 1992-1999 Matra Datavision
-// Copyright (c) 1992-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#include <Standard_NotImplemented.hxx>
-
-// -----------
-// IsLower :
-// -----------
-Standard_Boolean TCollection_Compare::IsLower (const Item& ,
- const Item& ) const
-{
- Standard_NotImplemented::Raise();
- return Standard_False;
-}
-
-// -----------
-// IsGreater :
-// -----------
-Standard_Boolean TCollection_Compare::IsGreater (const Item& ,
- const Item& ) const
-{
- Standard_NotImplemented::Raise();
- return Standard_False;
-}
-
-// -----------
-// IsEqual :
-// -----------
-Standard_Boolean TCollection_Compare::IsEqual (const Item& Left,
- const Item& Right) const
-{
- return (Left == Right) ;
-}
-
-
+++ /dev/null
--- Created on: 1992-08-27
--- Created by: Mireille MERCIEN
--- Copyright (c) 1992-1999 Matra Datavision
--- Copyright (c) 1999-2014 OPEN CASCADE SAS
---
--- This file is part of Open CASCADE Technology software library.
---
--- This library is free software; you can redistribute it and/or modify it under
--- the terms of the GNU Lesser General Public License version 2.1 as published
--- by the Free Software Foundation, with special exception defined in the file
--- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
--- distribution for complete text of the license and disclaimer of any warranty.
---
--- Alternatively, this file may be used under the terms of Open CASCADE
--- commercial license or contractual agreement.
-
-class CompareOfInteger from TCollection
- inherits
- PrivCompareOfInteger
-
-is
-
- Create ;
-
- IsLower (me; Left, Right: Integer)
- ---Level: Public
- ---Purpose: Returns True if <Left> is lower than <Right>.
- returns Boolean
- is redefined;
-
- IsGreater (me; Left, Right: Integer)
- ---Level: Public
- ---Purpose: Returns True if <Left> is greater than <Right>.
- returns Boolean
- is redefined;
-
-end;
+++ /dev/null
-// Created on: 1992-08-27
-// Created by: Mireille MERCIEN
-// Copyright (c) 1992-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#include <TCollection_CompareOfInteger.ixx>
-
-// -----------
-// Create :
-// -----------
-TCollection_CompareOfInteger::TCollection_CompareOfInteger()
-{
-}
-
-// -----------
-// IsLower :
-// -----------
-Standard_Boolean TCollection_CompareOfInteger::IsLower (
- const Standard_Integer &Left,const Standard_Integer &Right) const
-{
- return (Left < Right) ;
-}
-
-// -----------
-// IsGreater :
-// -----------
-Standard_Boolean TCollection_CompareOfInteger::IsGreater (
- const Standard_Integer &Left,const Standard_Integer &Right) const
-{
- return (Left > Right) ;
-}
+++ /dev/null
--- Created on: 1992-08-27
--- Created by: Mireille MERCIEN
--- Copyright (c) 1992-1999 Matra Datavision
--- Copyright (c) 1999-2014 OPEN CASCADE SAS
---
--- This file is part of Open CASCADE Technology software library.
---
--- This library is free software; you can redistribute it and/or modify it under
--- the terms of the GNU Lesser General Public License version 2.1 as published
--- by the Free Software Foundation, with special exception defined in the file
--- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
--- distribution for complete text of the license and disclaimer of any warranty.
---
--- Alternatively, this file may be used under the terms of Open CASCADE
--- commercial license or contractual agreement.
-
-class CompareOfReal from TCollection
- inherits
- PrivCompareOfReal
-
-is
-
- Create;
-
- IsLower (me; Left, Right: Real)
- ---Level: Public
- ---Purpose: Returns True if <Left> is lower than <Right>.
- returns Boolean
- is redefined;
-
- IsGreater (me; Left, Right: Real)
- ---Level: Public
- ---Purpose: Returns True if <Left> is greater than <Right>.
- returns Boolean
- is redefined;
-
-end;
+++ /dev/null
-// Created on: 1992-08-27
-// Created by: Mireille MERCIEN
-// Copyright (c) 1992-1999 Matra Datavision
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#include <TCollection_CompareOfReal.ixx>
-
-// -----------
-// Create :
-// -----------
-TCollection_CompareOfReal::TCollection_CompareOfReal()
-{
-}
-
-// -----------
-// IsLower :
-// -----------
-Standard_Boolean TCollection_CompareOfReal::IsLower (
- const Standard_Real &Left,const Standard_Real &Right) const
-{
- return (Left < Right) ;
-}
-
-// -----------
-// IsGreater :
-// -----------
-Standard_Boolean TCollection_CompareOfReal::IsGreater (
- const Standard_Real &Left,const Standard_Real &Right) const
-{
- return (Left > Right) ;
-}
-
-
-
-
-
Plugin
Quantity
Resource
-SortTools
Standard
StdFail
Storage
math_PSOParticlesPool.hxx
math_PSOParticlesPool.cxx
math_Array1OfValueAndWeight.hxx
+math_ValueAndWeight.hxx
package math
-uses StdFail, TColStd, TCollection, Standard, SortTools
+uses StdFail, TColStd, TCollection, Standard
is
class EigenValuesSearcher; -- for Kronrod method
class ComputeGaussPointsAndWeights;
class ComputeKronrodPointsAndWeights;
- class ValueAndWeight;
+ imported ValueAndWeight;
imported Array1OfValueAndWeight;
- class CompareOfValueAndWeight;
- class QuickSortOfValueAndWeight
- instantiates QuickSort from SortTools (ValueAndWeight from math,
- Array1OfValueAndWeight from math,
- CompareOfValueAndWeight from math);
class DoubleTab;
+++ /dev/null
--- Created on: 2005-12-20
--- Created by: Julia GERASIMOVA
--- Copyright (c) 2005-2014 OPEN CASCADE SAS
---
--- This file is part of Open CASCADE Technology software library.
---
--- This library is free software; you can redistribute it and/or modify it under
--- the terms of the GNU Lesser General Public License version 2.1 as published
--- by the Free Software Foundation, with special exception defined in the file
--- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
--- distribution for complete text of the license and disclaimer of any warranty.
---
--- Alternatively, this file may be used under the terms of Open CASCADE
--- commercial license or contractual agreement.
-
-class CompareOfValueAndWeight from math
-
-uses
-
- ValueAndWeight from math
-
-is
- Create;
-
- IsLower (me; Left, Right: ValueAndWeight)
- ---Level: Public
- ---Purpose: Returns True if <Left.Value()> is lower than <Right.Value()>.
- returns Boolean from Standard;
-
- IsGreater (me; Left, Right: ValueAndWeight)
- ---Level: Public
- ---Purpose: Returns True if <Left.Value()> is greater than <Right.Value()>.
- returns Boolean from Standard;
-
- IsEqual(me; Left, Right: ValueAndWeight)
- ---Level: Public
- ---Purpose: returns True when <Right> and <Left> are equal.
- returns Boolean from Standard;
-
-end;
-
+++ /dev/null
-// Created on: 2005-12-20
-// Created by: Julia GERASIMOVA
-// Copyright (c) 2005-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#include <math_CompareOfValueAndWeight.ixx>
-
-// -----------
-// Create :
-// -----------
-math_CompareOfValueAndWeight::math_CompareOfValueAndWeight()
-{
-}
-
-// -----------
-// IsLower :
-// -----------
-Standard_Boolean math_CompareOfValueAndWeight::IsLower(const math_ValueAndWeight& Left,
- const math_ValueAndWeight& Right) const
-{
- return (Left.Value() < Right.Value());
-}
-
-// -----------
-// IsGreater :
-// -----------
-Standard_Boolean math_CompareOfValueAndWeight::IsGreater(const math_ValueAndWeight& Left,
- const math_ValueAndWeight& Right) const
-{
- return (Left.Value() > Right.Value());
-}
-
-// -----------
-// IsEqual :
-// -----------
-Standard_Boolean math_CompareOfValueAndWeight::IsEqual(const math_ValueAndWeight& Left,
- const math_ValueAndWeight& Right) const
-{
- return (Left.Value() == Right.Value());
-}
#include <math_EigenValuesSearcher.hxx>
#include <math_Array1OfValueAndWeight.hxx>
-#include <math_CompareOfValueAndWeight.hxx>
-#include <math_QuickSortOfValueAndWeight.hxx>
#include <Standard_ErrorHandler.hxx>
+#include <algorithm>
+
math_ComputeGaussPointsAndWeights::math_ComputeGaussPointsAndWeights(const Standard_Integer Number)
{
myIsDone = Standard_False;
VWarray(i) = EVW;
}
- math_CompareOfValueAndWeight theComparator;
- math_QuickSortOfValueAndWeight::Sort(VWarray, theComparator);
+ std::sort (VWarray.begin(), VWarray.end());
for (i = 1; i <= Number; i++) {
myPoints->ChangeValue(i) = VWarray(i).Value();
#include <math_ComputeKronrodPointsAndWeights.ixx>
#include <math_EigenValuesSearcher.hxx>
#include <math_Array1OfValueAndWeight.hxx>
-#include <math_CompareOfValueAndWeight.hxx>
-#include <math_QuickSortOfValueAndWeight.hxx>
#include <Standard_ErrorHandler.hxx>
+#include <algorithm>
+
math_ComputeKronrodPointsAndWeights::math_ComputeKronrodPointsAndWeights(const Standard_Integer Number)
{
myIsDone = Standard_False;
VWarray(i) = EVW;
}
- math_CompareOfValueAndWeight theComparator;
- math_QuickSortOfValueAndWeight::Sort(VWarray, theComparator);
+ std::sort (VWarray.begin(), VWarray.end());
for (i = 1; i <= a2NP1; i++) {
myPoints->ChangeValue(i) = VWarray(i).Value();
+++ /dev/null
--- Created on: 2005-12-20
--- Created by: Julia GERASIMOVA
--- Copyright (c) 2005-2014 OPEN CASCADE SAS
---
--- This file is part of Open CASCADE Technology software library.
---
--- This library is free software; you can redistribute it and/or modify it under
--- the terms of the GNU Lesser General Public License version 2.1 as published
--- by the Free Software Foundation, with special exception defined in the file
--- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
--- distribution for complete text of the license and disclaimer of any warranty.
---
--- Alternatively, this file may be used under the terms of Open CASCADE
--- commercial license or contractual agreement.
-
-class ValueAndWeight from math
-
-is
- Create
- returns ValueAndWeight;
-
- Create(Value : Real from Standard;
- Weight : Real from Standard)
- returns ValueAndWeight;
-
- Value(me)
- returns Real from Standard;
-
- Weight(me)
- returns Real from Standard;
-
-fields
-
- myValue : Real from Standard;
- myWeight : Real from Standard;
-
-end ValueAndWeight;
+++ /dev/null
-// Created on: 2005-12-20
-// Created by: Julia GERASIMOVA
-// Copyright (c) 2005-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#include <math_ValueAndWeight.ixx>
-
-math_ValueAndWeight::math_ValueAndWeight()
-{
-}
-
-math_ValueAndWeight::math_ValueAndWeight(const Standard_Real Value,
- const Standard_Real Weight)
- : myValue(Value),
- myWeight(Weight)
-{
-}
-
-Standard_Real math_ValueAndWeight::Value() const
-{
- return myValue;
-}
-
-Standard_Real math_ValueAndWeight::Weight() const
-{
- return myWeight;
-}
--- /dev/null
+// Created on: 2005-12-20
+// Created by: Julia GERASIMOVA
+// Copyright (c) 2005-2014 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _math_ValueAndWeight_HeaderFile
+#define _math_ValueAndWeight_HeaderFile
+
+#include <Standard.hxx>
+#include <Standard_DefineAlloc.hxx>
+#include <Standard_Macro.hxx>
+
+#include <Standard_Real.hxx>
+
+//! Simple container storing two reals: value and weight
+class math_ValueAndWeight
+{
+public:
+
+ DEFINE_STANDARD_ALLOC
+
+ math_ValueAndWeight () : myValue(0.), myWeight(0.) {}
+
+ math_ValueAndWeight (Standard_Real theValue, Standard_Real theWeight)
+ : myValue(theValue), myWeight(theWeight)
+ {}
+
+ Standard_Real Value() const { return myValue; }
+
+ Standard_Real Weight() const { return myWeight; }
+
+
+private:
+ Standard_Real myValue;
+ Standard_Real myWeight;
+};
+
+//! Comparison operator for math_ValueAndWeight, needed for sorting algorithms
+inline bool operator < (const math_ValueAndWeight& theLeft,
+ const math_ValueAndWeight& theRight)
+{
+ return theLeft.Value() < theRight.Value();
+}
+
+#endif // _math_ValueAndWeight_HeaderFile