GET_SOLVER

A call to the GET_SOLVER utility subroutine returns either one (1) or zero (0). The returned value is one (1) if the call is made by the Adams Solver (C++) executable. The returned value is zero (0) if the call is made by the Adams Solver (FORTRAN) executable.

Use

Called By

Any user-written subroutine.

Calling Sequence in FORTRAN

INTEGER N
CALL GET_SOLVER(N)

Function Prototype (C/C++)

void c_get_solver( int *n);

Input Arguments

None

Output Arguments

 
N (or n)
An INTEGER (or a pointer to int) equal to either one (1) or zero (0). The returned value is one (1) if the call is made by the Adams Solver (C++) executable. The function returns zero (0) if the call is made by the Adams Solver (FORTRAN.)

Example 1 (FORTRAN)

 
SUBROUTINE CBKSUB(TIME, EVENT, MODE)
C
include 'slv_cbksub.inc'
C Callback subroutine
INTEGER EVENT, MODE(3)
DOUBLE PRECISION TIME
C
C Work variables
INTEGER SOLVER
CHARACTER*200 MESSAGE
C
C Case of event ev_MODEL_INPUT_BEG
IF( EVENT.EQ.ev_MODEL_INPUT_BEG ) THEN
CALL GET_SOLVER(SOLVER)
WRITE(MESSAGE, '(A,I5)') SOLVER is ', SOLVER
CALL USRMES(.TRUE.,MESSAGE, 0, 'INFO')
….
ENDIF
C
 

Example 2 (C/C++)

void Cbksub(const struct sAdamsCbksub *sos, double Time, int Event, int *Info)
{
char buffer[1024];
int solver;
 
if (Event == ev_MODEL_INPUT_BEG)
{
/* Get the running solver */
c_get_solver(&solver);
sprintf(buffer, "The solver is %s", (solver==1 ? "C++" : "FORTRAN"));
c_usrmes(1, buffer, 0, "INFO");
....
}
....