n-Dimensional Fast Methods  0.7
 All Classes Functions Variables Typedefs Pages
LSM< grid_t > Class Template Reference

Implements Lock Sweeping Method. More...

#include <lsm.hpp>

Inheritance diagram for LSM< grid_t >:
Collaboration diagram for LSM< grid_t >:

Public Member Functions

 LSM (unsigned maxSweeps=std::numeric_limits< unsigned >::max())
 
 LSM (const char *name, unsigned maxSweeps=std::numeric_limits< unsigned >::max())
 
virtual void computeInternal ()
 Actual method that implements LSM.
 
virtual void reset ()
 Clears temporal data, so it is ready to run again.
 
virtual void printRunInfo () const
 
- Public Member Functions inherited from FSM< grid_t >
 FSM (unsigned maxSweeps=std::numeric_limits< unsigned >::max())
 
 FSM (const char *name, unsigned maxSweeps=std::numeric_limits< unsigned >::max())
 
virtual void setEnvironment (grid_t *g)
 Sets and cleans the grid in which operations will be performed. Since a maximum number of dimensions is assumed, fills the rest with size 1.
 
virtual void setup ()
 Executes EikonalSolver setup and other checks.
 
- Public Member Functions inherited from EikonalSolver< grid_t >
 EikonalSolver (const std::string &name)
 
virtual double solveEikonal (const int &idx)
 Solves nD Eikonal equation for cell idx. If heuristics are activated, it will add the estimated travel time to goal with current velocity. More...
 
- Public Member Functions inherited from Solver< grid_t >
 Solver (const std::string &name)
 
virtual void setInitialAndGoalPoints (const std::vector< unsigned int > &init_points, unsigned int goal_idx)
 Sets the initial and goal points by the indices of the grid.
 
virtual void setInitialPoints (const std::vector< unsigned int > &init_points)
 Sets the initial points by the indices of the grid.
 
virtual void setInitialAndGoalPoints (const std::array< unsigned int, grid_t::getNDims()> &init_coord, const std::array< unsigned int, grid_t::getNDims()> &goal_coord)
 Sets the initial and goal points by the coordinates of the grid.
 
virtual void setInitialPoints (const std::array< unsigned int, grid_t::getNDims()> &init_coord)
 Sets the initial point by the coordinates of the grid.
 
void compute ()
 Computes the distances map. Will call setup() if not done already.
 
template<class T >
T * as ()
 Cast this instance to a desired type.
 
template<class T >
const T * as () const
 Cast this instance to a desired type.
 
const std::string & getName () const
 Returns name of the solver.
 
virtual void clear ()
 Clears the solver, it is not recommended to be used out of the destructor.
 
grid_t * getGrid () const
 Returns a pointer to the grid used.
 
virtual double getTime () const
 

Protected Member Functions

virtual void solveForIdx (unsigned idx)
 Actually executes one solving iteration of the LSM.
 
- Protected Member Functions inherited from FSM< grid_t >
void recursiveIteration (size_t depth, int it=0)
 Equivalent to nesting as many for loops as dimensions. For every most inner loop iteration, solveForIdx() is called for the corresponding idx.
 
virtual void setSweep ()
 Set the sweep variables: initial and final indices for iterations, and the increment of each iteration in every dimension. More...
 
virtual void initializeSweepArrays ()
 Initializes the internal arrays employed.
 
- Protected Member Functions inherited from EikonalSolver< grid_t >
double solveEikonalNDims (unsigned int idx, unsigned int dim)
 Solves the Eikonal equation assuming that Tvalues_ is sorted.
 
- Protected Member Functions inherited from Solver< grid_t >
int sanityChecks ()
 Performs different check before a solver can proceed.
 

Protected Attributes

std::array< unsigned int,
2 *grid_t::getNDims()> 
neighbors_
 Auxiliar array which stores the neighbor of each iteration of the computeFM() function.
 
- Protected Attributes inherited from FSM< grid_t >
unsigned int sweeps_
 Number of sweeps performed.
 
unsigned maxSweeps_
 Number of maximum sweeps to perform.
 
bool keepSweeping_
 Flag to indicate that at least one more sweep is required.
 
bool stopPropagation_
 Flag to stop sweeping (used when goal point has converged).
 
std::array< int,
grid_t::getNDims()> 
incs_
 Sweep directions {-1,1} for each dimension. Extended dimensions always 1.
 
std::array< int,
grid_t::getNDims()> 
inits_
 Initial indices for each dimension. Extended dimensions always 0.
 
std::array< int,
grid_t::getNDims()> 
ends_
 Final indices for each dimension. Extended dimensions always 1.
 
std::array< int,
grid_t::getNDims()> 
dimsize_
 Size of each dimension, extended to the maximum size. Extended dimensions always 1.
 
std::array< int,
grid_t::getNDims()> 
d_
 Auxiliar array to speed up indexing generalization: stores parcial multiplications of dimensions sizes. d_[0] = dimsize_[0]; d_[1] = dimsize_[0]*dimsize_[1]; etc.
 
- Protected Attributes inherited from EikonalSolver< grid_t >
std::vector< double > Tvalues_
 Auxiliar vector with values T0,T1...Tn-1 variables in the Discretized Eikonal Equation.
 
std::array< unsigned int,
2 *grid_t::getNDims()> 
neighbors_
 Auxiliar array which stores the neighbor of each iteration of the computeFM() function.
 
- Protected Attributes inherited from Solver< grid_t >
grid_t * grid_
 Grid container.
 
std::string name_
 Solver name.
 
bool setup_
 Setup status.
 
std::vector< unsigned int > init_points_
 Initial index.
 
unsigned int goal_idx_
 Goal index.
 
std::chrono::time_point
< std::chrono::steady_clock > 
start_
 Time measurement variables.
 
std::chrono::time_point
< std::chrono::steady_clock > 
end_
 
double time_
 Time elapsed by the compute method.
 

Detailed Description

template<class grid_t>
class LSM< grid_t >

Todo:
implement a more robust goal point stopping criterion.

It uses as a main container the nDGridMap class. The nDGridMap type T has to use an FMCell or derived.

The grid is assumed to be squared, that is Delta(x) = Delta(y) = leafsize_

External documentation:
S. Bak, J. McLaughlin, D. Renzi, Some Improvements for the Fast Sweeping Method, SIAM J. Sci. Comput., 32(5), 2853–2874. 2010. [More Info]

NOTE: The sweeping directions are inverted with respect to the paper to make implementation easier. And sweeping is implemented recursively (undetermined number of nested for loops) to achieve n-dimensional behaviour.

Copyright (C) 2015 Javier V. Gomez www.javiervgomez.com

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Definition at line 40 of file lsm.hpp.


The documentation for this class was generated from the following file: