void updateTentative(int i, int j, std::map<Coordinate, Node<DataType> *> & tentative, std::map<Coordinate, DataType> & accepted, Heap<DataType> & heap, Array2D<DataType, IndexType> & A, const DataType & bandwidth, bool inside) { // Check bounds if (i < 0 || i > A.getRows()-1 || j < 0 || j > A.getCols()-1) return; Coordinate coord(i,j,inside); // Exit if already accepted if (accepted.find(coord) != accepted.end()) return; // Find the tentative value and see if it's been deleted // (it was outside the narrow band) typename std::map<Coordinate, Node<DataType> *>::iterator iter = tentative.find(coord); if (iter != tentative.end() && (*iter).second == NULL) return; // Otherwise, compute tentative value DataType value = computeTentativeValue(i,j, accepted); // The point is new and within the narrowband if (iter == tentative.end() && value <= bandwidth) { //mexPrintf("Adding (%i,%i) as new tentative point", i,j); Node<DataType> * node = new Node<DataType>(coord); node->cost = value; heap.push(node); tentative[coord] = node; } // The point is not new and within the narrowband else if (value <= bandwidth) { //mexPrintf("Updating tentative point (%i,%i)", i,j); Node<DataType> * node = (*iter).second; node->cost = value; heap.update(node); } // The point is outside the narrowband and should be deleted // if possible else if (iter != tentative.end()) { Node<DataType> * node = (*iter).second; heap.remove(node); delete node; (*iter).second = NULL; } //mexPrintf(" with value %f\n", value); }