MCPcopy Create free account
hub / github.com/NGSolve/ngsolve / MyQuickSortI

Function MyQuickSortI

parallel/dump.hpp:873–901  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

871
872 template <class T>
873 void MyQuickSortI (FlatArray<T> data, FlatArray<int> index)
874 {
875 if (index.Size() <= 1) return;
876
877 int i = 0;
878 int j = index.Size()-1;
879
880 int midval = index[ (i+j)/2 ];
881
882 do
883 {
884 while (data[index[i]] < data[midval]) i++;
885 while (data[midval] < data[index[j]]) j--;
886 /*
887 while (less (data[index[i]],data[midval]) ) i++;
888 while (less (data[midval], data[index[j]])) j--;
889 */
890
891 if (i <= j)
892 {
893 Swap (index[i], index[j]);
894 i++; j--;
895 }
896 }
897 while (i <= j);
898
899 MyQuickSortI (data, index.Range (0, j+1));
900 MyQuickSortI (data, index.Range (i, index.Size()));
901 }
902
903
904

Callers 1

GatherNodalDataFunction · 0.85

Calls 3

SwapFunction · 0.85
SizeMethod · 0.45
RangeMethod · 0.45

Tested by

no test coverage detected