#ifndef __CMODEL_VISDMODEL_H
#define __CMODEL_VISDMODEL_H

#ifndef __CMODEL_CONTMODEL_H
#include "base/contmodel.h"  
// #include "contmodel.h"   for user use 
#endif


//------------ user-defined contact model "CM_VisDamp" -----------
const unsigned long ulModelCM_VisDamp = 1002;
class CM_VisDamp : public ContactModel {
  private:
    double kn;          // normal stiffness
    double ks;          // shear stiffness
    double fric;        // friction coefficient
    double cn;          // normal damping constant
		double cs;          // shear damping constant
		double cstr_n;			// contact bond normal strength  
		double cstr_s;			// contact bond shear strength  
		double udotn;		    // relative velocity, normal direction
		double udots;		    // relative velocity, shear direction
		double tdot;		    // relative angular velocity
		double edn;         // dissipated energy, normal direction
    double eds;         // dissipated energy, shear direction
		double edf;         // dissipated enargy by slip (shear direction)
		bool   nt;          // no tensile force switch true:on, false:off
		int    mode;        // switch to change way to slip check (0: default)
		double  cs_force2;  // shear force with viscous term (2D) 
    UMdvect cs_force3;  // shear force with viscous term (3D)
  public:
    // Creators
    EXPORT CM_VisDamp(bool bRegister=false);
    EXPORT ~CM_VisDamp(void) { }

    // Accessors
    EXPORT const char *Name(void) const;
    EXPORT const char **PropNames(void) const;
    EXPORT ContactModel *Clone(PropBlock * =0) const { return(new CM_VisDamp); }
    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 1; }

    // Manipulators
    EXPORT void AcceptProp(int n, double v);
    EXPORT const char *PreCycle(PropBlock &);
    EXPORT void FDlaw(FdBlock &fb, char cDim);
    EXPORT const char *SaveRestore(ModelSaveObject *mso);
};



#endif
