bool OrderedTask::Insert(const OrderedTaskPoint &new_tp, const unsigned position) { if (position >= task_points.size()) return Append(new_tp); if (/* is the new_tp allowed in this context? */ (position > 0 && !new_tp.predecessor_allowed()) || !new_tp.successor_allowed() || /* can a tp be inserted at this position? */ (position > 0 && !task_points[position - 1]->successor_allowed()) || !task_points[position]->predecessor_allowed()) return false; if (active_task_point >= position) active_task_point++; task_points.insert(task_points.begin() + position, new_tp.clone(task_behaviour, m_ordered_behaviour)); if (position) set_neighbours(position - 1); set_neighbours(position); set_neighbours(position + 1); update_geometry(); return true; }
bool OrderedTask::Replace(const OrderedTaskPoint &new_tp, const unsigned position) { if (position >= task_points.size()) return false; if (task_points[position]->equals(&new_tp)) // nothing to do return true; /* is the new_tp allowed in this context? */ if ((position > 0 && !new_tp.predecessor_allowed()) || (position + 1 < task_points.size() && !new_tp.successor_allowed())) return false; delete task_points[position]; task_points[position] = new_tp.clone(task_behaviour, m_ordered_behaviour); if (position) set_neighbours(position - 1); set_neighbours(position); if (position + 1 < task_points.size()) set_neighbours(position + 1); update_geometry(); return true; }
bool OrderedTask::AppendOptionalStart(const OrderedTaskPoint &new_tp) { optional_start_points.push_back(new_tp.clone(task_behaviour, m_ordered_behaviour)); if (task_points.size() > 1) set_neighbours(0); update_geometry(); return true; }
bool OrderedTask::Remove(const unsigned position) { if (position >= task_points.size()) return false; if (active_task_point > position || (active_task_point > 0 && active_task_point == task_points.size() - 1)) active_task_point--; erase(position); set_neighbours(position); if (position) set_neighbours(position - 1); update_geometry(); return true; }
void OrderedTask::select_optional_start(unsigned pos) { assert(pos< optional_start_points.size()); // put task start onto end optional_start_points.push_back(task_points[0]); // set task start from top optional item task_points[0] = optional_start_points[pos]; // remove top optional item from list optional_start_points.erase(optional_start_points.begin()+pos); // update neighbour links set_neighbours(0); if (task_points.size()>1) set_neighbours(1); // we've changed the task, so update geometry update_geometry(); }
bool OrderedTask::Append(const OrderedTaskPoint &new_tp) { if (/* is the new_tp allowed in this context? */ (!task_points.empty() && !new_tp.predecessor_allowed()) || /* can a tp be appended after the last one? */ (task_points.size() >= 1 && !task_points[task_points.size() - 1]->successor_allowed())) return false; task_points.push_back(new_tp.clone(task_behaviour, m_ordered_behaviour)); if (task_points.size() > 1) set_neighbours(task_points.size() - 2); else { // give it a value when we have one tp so it is not uninitialised m_location_min_last = new_tp.GetLocation(); } set_neighbours(task_points.size() - 1); update_geometry(); return true; }
bool OrderedTask::RemoveOptionalStart(const unsigned position) { if (position >= optional_start_points.size()) return false; erase_optional_start(position); if (task_points.size()>1) set_neighbours(0); update_geometry(); return true; }
bool OrderedTask::ReplaceOptionalStart(const OrderedTaskPoint &new_tp, const unsigned position) { if (position >= optional_start_points.size()) return false; if (optional_start_points[position]->equals(&new_tp)) // nothing to do return true; delete optional_start_points[position]; optional_start_points[position] = new_tp.clone(task_behaviour, m_ordered_behaviour); set_neighbours(0); update_geometry(); return true; }
void overlap_input<CoarseGrid, FineGrid, OVLP_RANGES> ::init(typename overlap_input<CoarseGrid, FineGrid, OVLP_RANGES>::coarse_grid_type const& cg, typename overlap_input<CoarseGrid, FineGrid, OVLP_RANGES>:: fine_grid_type const& fg, std::string const& basenm_) { basenm = basenm_; set_coarse_grid(cg); set_fine_grid (fg); total_ranges_v.init(basenm + ".total.vertices"); total_ranges_c.init(basenm + ".total.cells"); set_neighbours(); for(NbIterator N = neighbours.FirstCell(); ! N.IsDone(); ++N) { neighbour_ranges_v[*N].init(basenm + "." + as_string(number(*N)) + ".vertices"); neighbour_ranges_c[*N].init(basenm + "." + as_string(number(*N)) + ".cells"); } }