#ifndef __CMODEL_CM2MODEL_H
#define __CMODEL_CM2MODEL_H

#ifndef __CMODEL_CONTMODEL_H
#include "base/contmodel.h"
#endif


//------------ built-in, user-defined contact model "viscous" -----------
const unsigned long ulModelCM2 = 2;
class CM2 : public ContactModel {
  private:
    double  kn;
    double  ks;
    double  visc;
    bool    bond_when_touch;
    double  con1;
    double  con2;
    bool    bonded;

  public:
    // Creators
    EXPORT CM2(bool bRegister=false);
    EXPORT ~CM2(void) { }

    // Accessors
    EXPORT const char *Name(void) const;
    EXPORT const char **PropNames(void) const;
    EXPORT ContactModel *Clone(PropBlock * =0) const;
    EXPORT double  ReturnProp(int n) const;
    EXPORT double  KnEstimate(void) const { return kn; }
    EXPORT double  KsEstimate(void) const { return ks; }
    EXPORT unsigned long   Version(void) const { return 2; }

    // Manipulators
    EXPORT void AcceptProp(int n, double v);
    EXPORT const char *PreCycle(PropBlock &) {con1=1.0/ks; con2=1.0/(2.0*visc); return(0); }
    EXPORT void FDlaw(FdBlock &fb, char cDim);
    EXPORT const char *SaveRestore(ModelSaveObject *mso);
    EXPORT void remap(PropBlock &pb);
};



#endif

