SDDSlib
Loading...
Searching...
No Matches
diffeqResDescrip.c File Reference

Provides a description string corresponding to a given differential equation result code. More...

#include "mdb.h"

Go to the source code of this file.

Macros

#define N_DIFFEQ_RETURNS   8
 

Functions

char * diffeq_result_description (long result_code)
 Return a descriptive string for a given differential equation result code.
 

Variables

struct { 
 
   long   code 
 
   char *   description 
 
diffeq_return [N_DIFFEQ_RETURNS] 
 
static char * unknown = "unknown error"
 

Detailed Description

Provides a description string corresponding to a given differential equation result code.

This file defines a function that, given a result code from a differential equation solver, returns a human-readable description of the result. The possible codes range from error conditions to successful completion indicators.

License
This file is distributed under the terms of the Software License Agreement found in the file LICENSE included with this distribution.
Author
M. Borland, C. Saunders, R. Soliday

Definition in file diffeqResDescrip.c.

Macro Definition Documentation

◆ N_DIFFEQ_RETURNS

#define N_DIFFEQ_RETURNS   8

Definition at line 21 of file diffeqResDescrip.c.

Function Documentation

◆ diffeq_result_description()

char * diffeq_result_description ( long result_code)

Return a descriptive string for a given differential equation result code.

This function maps a numerical result code to a corresponding string describing the outcome of a differential equation integration procedure. If the code is not recognized, the function returns "unknown error".

Parameters
result_codeThe integer code representing the result of a differential equation solver.
Returns
A constant character pointer to a descriptive string for the given code.

Definition at line 47 of file diffeqResDescrip.c.

47 {
48 int i;
49 for (i = 0; i < N_DIFFEQ_RETURNS; i++) {
50 if (result_code == diffeq_return[i].code)
51 return (diffeq_return[i].description);
52 }
53 return unknown;
54}

Variable Documentation

◆ code

long code

Definition at line 24 of file diffeqResDescrip.c.

◆ description

char* description

Definition at line 25 of file diffeqResDescrip.c.

◆ [struct]

struct { ... } diffeq_return[N_DIFFEQ_RETURNS]
Initial value:
= {
{-4, "exit condition failure"},
{-3, "zero stepsize"},
{-2, "can't take initial step"},
{-1, "solution stepped outside of integration interval"},
{0, "initial independent variable value greater than desired final value"},
{1, "differential equations solved already"},
{2, "zero of exit-function found"},
{3, "end of integration interval reached"}}

◆ unknown

char* unknown = "unknown error"
static

Definition at line 35 of file diffeqResDescrip.c.