#include "slv_c_utils.h"

adams_c_Sfosub    Sfosub;
/*
* Note:  
* Use mixed case names for the Adams subroutine names when using the C 
* style interface.  For the default subroutine name capitalize the first
* letter and have the remaining letters lower case; Gfosub for example. 
* Doing this insures that Adams Solver correctly distinguishes a C style 
* subroutine from Fortran and calls with the appropriate interface.
*  
*/

void Sfosub(const struct sAdamsSforce* sforce, double time, int dflag, int iflag, double* value)
{

    double  damping, vel;
    int     imar_id, jmar_id;
	int     ipar[2];
    int     errflg;
    size_t  n;
    
	imar_id = sforce->PAR[0]; 
    jmar_id = sforce->PAR[1];
    damping = (sforce->PAR[2]);
    n = sforce->PAR[3];
    if (n==0){
		c_errmes(1,"user defined error message  flag is activated", sforce->ID, "STOP");
	}
	ipar[0]=imar_id;
    ipar[1]=jmar_id;
   
    c_sysfnc("VR", ipar, 2, &vel, &errflg);
    *value =-1.0*damping*vel;
	

}
