Foam::SortableList<T>::SortableList(const SortableList<T>& lst) : List<T>(lst), indices_(lst.indices()) {}
scalar maxVariance(-1.0); label maxDir(-1); forAll(variance, vi) { if (maxVariance < variance[vi]) { maxVariance = variance[vi]; maxDir = vi; } } // maxDir indicates the direction of maximum variance // we create the new root node by taking the two extreme points // in this direction if these extreme points were not deleted in the // cleaning that come before the balance function they are still important // and the tree should therefore take them into account SortableList<scalar> phiMaxDir(chemPoints.size(),0.0); forAll(chemPoints, j) { phiMaxDir[j] = chemPoints[j]->phi()[maxDir]; } phiMaxDir.sort(); // delete reference to all node since the tree is reshaped deleteAllNode(); root_ = nullptr; // add the node for the two extremum bn* newNode = new bn ( chemPoints[phiMaxDir.indices()[0]], chemPoints[phiMaxDir.indices()[phiMaxDir.size()-1]],