Abstract class that serves as interface for the actual solvers implemented. It requires (at least) the computeInternal method to be implemented,. More...
#include <solver.hpp>
Public Member Functions | |
Solver (const std::string &name) | |
virtual void | setEnvironment (grid_t *g) |
Sets and cleans the grid in which operations will be performed. | |
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. | |
virtual void | setup () |
Checks that the solver is ready to run. Sets the grid unclean. | |
void | compute () |
Computes the distances map. Will call setup() if not done already. | |
virtual void | computeInternal ()=0 |
Actual compute function to be implemented in each solver. | |
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. | |
virtual void | reset () |
Clears temporal data, so it is ready to run again. | |
grid_t * | getGrid () const |
Returns a pointer to the grid used. | |
virtual double | getTime () const |
virtual void | printRunInfo () const |
Protected Member Functions | |
int | sanityChecks () |
Performs different check before a solver can proceed. | |
Protected Attributes | |
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. | |
It uses as a main container the nDGridMap class. The nDGridMap template paramenter has to be an FMCell or something inherited from it.
Copyright (C) 2014 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 solver.hpp.