MantisBT - Open CASCADE
View Issue Details
0024859Open CASCADE[OCCT] OCCT:Codingpublic2014-04-18 17:142016-04-20 15:48
abv 
abv 
normalfeature 
closedfixed 
[OCCT] 6.7.1 
[OCCT] 7.0.0[OCCT] 7.0.0 
0024859: Replace SortTools by STL equivalents
Package SortTools implements several standard sort algorithms as generic classes. In context of effort to get rid of CDL (0024487), as well as for conversion of instances of TCollection classes to NCollection templates (0024750), it is desirable to convert these to normal C++ classes.

Actually we do not need to keep these algorithms in OCCT since these are provided by standard C++ library coming with all modern compilers. This replacement will be possible for NCollection classes as soon as improvement 0024831 is implemented. When TCollection classes are converted to templates, it will be easy to use STL algorithms in all cases.

Here is preliminary analysis of use of classes from SortTools:

1. StraightInsertionSort: has two instances in SortTools, used only for Reals in two places:
   - Adaptor3d_CurveOnSurface.cxx: this use is eliminated in context of 0024742
   - AppDef_Variational.cxx (on local array)

   It can be replaced by std::stable_sort()

2. ShellSort: has two instances in SortTools, used only for Reals in two places:
   - AppDef_Variational.cxx
   - BRepMesh_FastDiscretFace.cxx (on local array)


   It can be replaced by std::sort()

3. HeapSort: has two instances in SortTools (not used) and two instances in BRepMesh

   It can be replaced by either std::make_heap()/sort_heap() or by std::sort()

4. QuickSort: has several instaniations, used in ~ 10 places

   It can be replaced by std::sort()

It is desirable to check how performance is affected by switching to use of STL algorithms.
No tags attached.
parent of 0024831closed apn Make iterators of NCollection classes STL-compatible 
related to 0024447closed bugmaster Includes of ixx and jxx files should be replaced by their content 
child of 0024487closed abv Getting rid of generic CDL classes 
child of 0024750closed abv Replace instantiations of TCollection generic classes by NCollection templates 
Issue History
2014-04-18 17:14abvNew Issue
2014-04-18 17:14abvAssigned To => kgv
2014-04-18 17:15abvRelationship addedchild of 0024487
2014-04-18 17:15abvRelationship addedchild of 0024750
2014-04-18 17:16abvRelationship addedparent of 0024831
2014-04-18 17:16abvSeverityminor => feature
2014-04-18 17:16abvDescription Updatedbug_revision_view_page.php?rev_id=7287#r7287
2014-04-18 19:00abvAssigned Tokgv => dbp
2014-04-18 19:00abvStatusnew => assigned
2014-05-07 16:16abvNote Added: 0029230
2014-05-28 16:04dbpNote Added: 0029579
2014-05-28 16:04dbpAssigned Todbp => abv
2014-05-28 16:04dbpStatusassigned => feedback
2014-06-03 07:39abvRelationship addedrelated to 0024447
2014-06-03 07:43abvNote Added: 0029639
2014-06-03 07:43abvStatusfeedback => resolved
2014-09-11 10:49abvTarget Version6.8.0 => 7.0.0
2015-06-02 22:32gitNote Added: 0041873
2015-07-22 07:42abvNote Added: 0043259
2015-07-22 07:42abvAssigned Toabv => bugmaster
2015-07-22 07:42abvStatusresolved => reviewed
2015-07-22 07:42gitNote Added: 0043260
2015-07-23 11:55abvChangeset attached => occt master e35db416
2015-07-23 11:55abvAssigned Tobugmaster => abv
2015-07-23 11:55abvStatusreviewed => verified
2015-07-23 11:55abvResolutionopen => fixed
2015-07-27 14:18gitNote Added: 0043572
2016-04-20 15:44aivFixed in Version => 7.0.0
2016-04-20 15:48aivStatusverified => closed

Notes
(0029230)
abv   
2014-05-07 16:16   
Note that NCollection package has classes Comparator and QuickSort which are also to be replaced (unless they have some unique features).
(0029579)
dbp   
2014-05-28 16:04   
Dear abv,

OCCT sort tools were replaced on STL algorithms (using C++ comments).
(0029639)
abv   
2014-06-03 07:43   
Fix completed and pushed to CR24859
(0041873)
git   
2015-06-02 22:32   
Branch CR24859_4 has been created by abv.

SHA-1: 459cbeb6ae1cc3c13ec12a085adeb3b3c6aca81f


Detailed log of new commits:

Author: abv
Date: Mon Jun 2 09:55:19 2014 +0400

    0024859: Replace SortTools by STL equivalents
    
    Package SortTools and its derived classes are removed; STL sort algorithms are used instead.
    Comparator objects are mostly reimplemented as local classes.

Author: abv
Date: Mon Jun 2 09:08:25 2014 +0300

    0024750: Replace instantiations of TCollection generic classes by NCollection templates -- manual changes
    
    Forward declaration of TCollection instances as classes are replaced by inclusion of corresponding header.
    Cyclic dependencies between declaration of collection class and its item are resolved by forward declaring a class in collection header.

Author: abv
Date: Sat May 30 15:55:13 2015 +0300

    Automatic upgrade of code by command "occt_upgrade -tcollection"
(0043259)
abv   
2015-07-22 07:42   
Integrated to master
(0043260)
git   
2015-07-22 07:42   
Branch CR24859_4 has been deleted by abv.

SHA-1: 459cbeb6ae1cc3c13ec12a085adeb3b3c6aca81f
(0043572)
git   
2015-07-27 14:18   
Branch CR24859 has been deleted by kgv.

SHA-1: 374443708cb611d059dd766d34af13ba9aa48821