#pragma once

#include <string>
#include <vector>


class MMPLib 
{
  private :
    void *_meshMMP; // MMPmesh
    void *_algoMMP; // MMPAlgo
    std::vector<int> sources; // source points
    std::vector<int> stops; // stop points
  public :
    ~MMPLib() ;
    MMPLib(std::string mshFile);

    /// @brief Set point source with vertex index
    /// @param idxVertex index of the vertex
    void setPointSource(int idxVertex);

    /// @brief Set stop points (when reached algo stops) by index
    /// @param idxVertex index of the vertex
    void setStopPoint(int idxVertex);

    /// @brief Launch MMP. setPointSource required before, setStopPoint optional.
    void propagate() ;
 
    /// @brief Launch MMP with this start point
    void propagate(double start[3]);
    
    /// @brief Get MMP computed distance at vertex
    /// @param idxVertex Index of the vertex
    /// @return Distance computed
    double getDistance(int idxVertex);

    /// @brief Get MMP computed distance at vertex
    /// @param target coordinates of the point
    /// @return Distance computed
    double getDistance(double target[3]);
    
    /// @brief Generate MSH2 file with distance at vertices
    /// @param mshFile File name
    /// @return 1 if succeed (0 otherwise)
    int printMSHDistances(std::string mshFile);

    /*  MESH    */

    /// @brief Get vertex coordinates by index
    /// @param idxVertex Index of vertex
    /// @param coords Corresponding coordinates
    void getVertex(int idxVertex, std::vector<double>& coords);

    /// @brief Get number of vertices
    /// @return Number of vertices
    int getNumberVertices();
};

