4.8.3.89. HAVSIN
Language type |
Subroutine |
FORTRAN |
call rd_havsin(x, x0, h0, x1, h1, order, value, errflg) or havsin(x, x0, h0, x1, h1, order, value, errflg) |
C/C++ |
rd_havsin(x, x0, h0, x1, h1, order, &value, &errflg) or havsin(x, x0, h0, x1, h1, order, &value, &errflg) |
Variable Name |
Size |
Description |
x |
double |
The input variable for the defined HAVSIN. |
x0 |
double |
The starting point for the HAVSIN function. |
h0 |
double |
The initial value for the input variable (within the range of x≤x0). |
x1 |
double |
The ending point for the HAVSIN function. |
h1 |
double |
The initial value for the input variable (within the range of x≥x1). |
order |
int |
|
value |
double |
|
error |
logical/int |
If an error is encountered in invoking Predefined subroutine, this variable becomes true. This variable must be declared as a logical variable. |
C---- SUB. DIFFERENTIAL
SUBROUTINE DIFFERENTIAL_USUB
& (TIME,UPAR,NPAR,JFLAG,IFLAG,RESULT)
C---- TO EXPORT * SUBROUTINE
!DEC$ ATTRIBUTES DLLEXPORT,C::DIFFERENTIAL_USUB
C---- INCLUDE SYSTEM CALL
INCLUDE 'SYSCAL.F'
C---- DEFINE VARIABLES
C Parameter Information
C TIME : Simulation time of RD/Solver. (Input)
C UPAR : Parameters defined by user. (Input)
C NPAR : Number of user parameters. (Input)
C JFLAG : When RD/Solver evaluates a Jacobian, the flag is true. (Input)
C IFLAG : When RD/Solver initializes arrays, the flag is true. (Input)
C RESULT : Returned value. (Output)
DOUBLE PRECISION TIME, UPAR(*)
INTEGER NPAR
LOGICAL JFLAG, IFLAG
DOUBLE PRECISION RESULT[REFERENCE]
C---- USER STATEMENT
DOUBLE PRECISION VALUE, VELO, STIME
INTEGER IORD
LOGICAL ERRFLG
STIME = 1.0D0
VELO = 74.0D0
IF ( JFLAG ) THEN
IORD = 1
ELSE
IORD = 0
ENDIF
CALL RD_HAVSIN(TIME,0.0D0,0.0D0,STIME,VELO,IORD,VALUE,ERRFLG)
RESULT = VALUE
RETURN
END
#include "stdafx.h"
#include "DllFunc.h"
HAVSIN_API void __cdecl differential_usub
(double time, double upar[], int npar, int jflag, int iflag, double* result)
{
using namespace rd_syscall;
// Parameter Information
// time: Simulation time of RD/Solver
// upar: Parameters defined by user
// npar: Number of user parameters
// jflag: When RD/Solver evaluates a Jacobian, the flag is true.
// iflag: When RD/Solver initializes arrays, the flag is true.
// result: Returned value
// User statement
double value, velo, stime;
int iord, errflg;
stime = 1.0;
velo = 74.0;
if (jflag) {
iord = 1;
}
else {
iord = 0;
}
rd_havsin(time,0.0,0.0,stime,velo,iord,&value,&errflg);
*result = value;
}