33 #include <fast_methods/fm/eikonalsolver.hpp>
34 #include <fast_methods/utils/utils.h>
52 unsigned int n_neighs = 0;
53 unsigned int x_nb = 0;
54 bool stopWavePropagation = 0;
58 grid_->getCell(i).setArrivalTime(0);
59 grid_->getCell(i).setState(FMState::FROZEN);
62 for (
unsigned int s = 0; s < n_neighs; ++s) {
64 if ( (
grid_->getCell(x_nb).getState() == FMState::OPEN) && !
grid_->getCell(x_nb).isOccupied()) {
66 grid_->getCell(x_nb).setState(FMState::NARROW);
74 p =
grid_->getCell(*x).getArrivalTime();
76 grid_->getCell(*x).setArrivalTime(q);
77 if (fabs(p - q) <=
E_) {
79 for (
unsigned int s = 0; s < n_neighs; ++s){
81 if (
grid_->getCell(x_nb).getState() != FMState::NARROW && !
grid_->getCell(x_nb).isOccupied()) {
82 p =
grid_->getCell(x_nb).getArrivalTime();
85 grid_->getCell(x_nb).setArrivalTime(q);
87 grid_->getCell(x_nb).setState(FMState::NARROW);
92 stopWavePropagation =
true;
93 grid_->getCell(*x).setState(FMState::FROZEN);
Abstract class that serves as interface for the actual EikonalSolvers implemented. It requires (at least) the computeInternal method to be implemented,.
virtual void setup()
Checks that the solver is ready to run. Sets the grid unclean.
std::list< unsigned int > active_list_
List wich stores the narrow band of each iteration.
std::array< unsigned int, 2 *grid_t::getNDims()> neighbors_
Auxiliar array which stores the neighbor of each iteration of the computeFM() function.
virtual double solveEikonal(const int &idx)
Solves nD Eikonal equation for cell idx. If heuristics are activated, it will add the estimated trave...
grid_t * grid_
Grid container.
std::vector< unsigned int > init_points_
Initial index.
virtual void reset()
Clears temporal data, so it is ready to run again.
virtual void clear()
Clears the solver, it is not recommended to be used out of the destructor.
static bool isTimeBetterThan(double t1, double t2)
Returns true if t1 is at least epsilon-lower than t2, provides robust comparions for doubles...
Implements Fast Iterative Method.
unsigned int goal_idx_
Goal index.
virtual void computeInternal()
Actual method that implements FIM.
double E_
Error threshold value that reveals if a cell has converged.
virtual void reset()
Clears temporal data, so it is ready to run again.