#ifndef FORCE_H
#define FORCE_H

#include <vector>

#include "vl/VLd.h"

class Force
{
public:
    virtual ~Force() {}
    
    // Evaluate force function wrt x,v,m
    virtual SparseVecd eval(const Vecd &x, const Vecd &v, const Vecd &m) const = 0;
    
    typedef std::vector< std::pair<int,SparseVecd> > DblSparse_t;
    
    // Evaluate force Jacobians
    virtual DblSparse_t evalDx(const Vecd &x, const Vecd &v, const Vecd &m) const = 0;
    virtual DblSparse_t evalDv(const Vecd &x, const Vecd &v, const Vecd &m) const = 0;

    // relative displacement of spring
    virtual double Displacement(const Vecd &x) const = 0;
};

// Handy function for offset computation
static inline int O(int p, int c) { return 3*p+c; }

#endif
