Main Page   Namespace List   Compound List   File List   Namespace Members   Compound Members   File Members  

nrutil.h File Reference

#include <string>

Go to the source code of this file.

Defines

#define float   double

Functions

int erget ()
 Get the code of error (0 if no) set in the module.

const string & ermessage ()
 Get the message string set with the code returned by erget().

const char * ercodemessage (int ercode)
 The error message by code. More...

void erreset ()
 Reset the error code. More...

void nrerror (const char *ermsg, int ercode=recipes_ercode)
 Error code and message setting. More...

float * vector (int, int)
float ** matrix (int, int, int, int)
double * dvector (int, int)
double ** dmatrix (int, int, int, int)
int * ivector (int, int)
int ** imatrix (int, int, int, int)
void free_vector (float *, int, int)
void free_dvector (double *, int, int)
void free_ivector (int *, int, int)
void free_matrix (float **, int, int, int, int)
void free_dmatrix (double **, int, int, int, int)
void free_imatrix (int **, int, int, int, int)
float ** submatrix (float **, int, int, int, int, int, int)
void free_submatrix (float **, int, int, int, int)
float ** convert_matrix (float *, int, int, int, int)
void free_convert_matrix (float **, int, int, int, int)

Variables

const int recipes_ercode = -1
const int ERLO = (0)
const int ERNUL = (-2)
const int ERMEM = (-3)
const int ERNNL = (-4)
const int ERPAR = (-5)
const int ERFATAL = ERPAR
const int ERFIO = (-6)
const int EROFL = (-7)
const int ERNOD = (-8)
const int ERZGR = (-9)
const int ERSPE = (-10)
const int ERGEO = (-11)
const int ERCRV = (-12)
const int ERHI = (-12)


Detailed Description

MASS project: header file for nrutil.cpp and nrutil.c from Numerical Recipes, former rewritten in C++.

The module implements the utilities for handling the dynamic memory storages (vectors and matrices) in the C++ style. The "new" and "delete" instructions are used instead of "malloc" as in original NR's nrutil.c. Thus, no nrerror() is called from the utilities themselves.

In addition to reimplementation of utilities, the error handling system is made with utilities nrerror() for setting and erget(), ermessage() for checking of error codes and their messages. The error codes are collected here for all the modules and made generalized in sense as much as possible. The sense of the error code may be verbalized by call to ercodemessage().

If NR_CPP macro is defined, the C-linkage conventions for NR recipes are not needed. Their source files are assumed to be converted in C++ compatible form and put in the namespace "nr", the same as one for utilities declared in this module.

Author:
N.Shatsky after NR Inc.
Version:
1.5

Define Documentation

#define float   double
 

All the mathematics with "float"-type is done actually in double-type in nr.c, nrutil.cpp and MASS applications


Function Documentation

const char* ercodemessage int    ercode
 

The error message by code.

Parameters:
error  code
Returns:
static character string which corresponds to the code
The codes are limited to the fixed set nr::ERLO..nr::ERHI; their meaning is obtained with this function. The particular cause of the error occured is rather obtained by ermessage().

void erreset  
 

Reset the error code.

This function has to be called to allow the further processing of data outside the nr-module (i.e. in SCIND and ATMOS) where it is blocked on occurence of the error.

void nrerror const char *    ermsg,
int    ercode = recipes_ercode
 

Error code and message setting.

The body of the function is evaluated if no ercode is still set, to prevent the overwriting of the information on the error which occured first. Called from NRs with no second argument. By convention, this function serves for declaring the error occured in any other "scientific" module in MASS Software - SCIND, WEIF, SCAN and ATMOS.


Variable Documentation

const int ERCRV = (-12)
 

ATMOS: Spectrum and response curve do not match

const int ERFIO = (-6)
 

Error code: Bad file info or I/O error

const int ERGEO = (-11)
 

WEIF: Apertures geometry or number are different

const int ERMEM = (-3)
 

Error code: MEMORY allocation error

const int ERNNL = (-4)
 

Error code: Allocation attempt on non-NULL array

const int ERNOD = (-8)
 

Error code: no data supplied for calculations

const int ERNUL = (-2)
 

Error code: NULL pointer supplied

const int EROFL = (-7)
 

Error code: Not expected count series (index storages overfull)

const int ERPAR = (-5)
 

Error code: Non-sense parameter

const int ERSPE = (-10)
 

WEIF: Spectral Energy Distributions are incompatible

const int ERZGR = (-9)
 

WEIF: Altitude grids are incompatible

const int recipes_ercode = -1
 

The code set by nrerror() by default, thus - by any standard recipe.


Generated on Wed Jan 16 00:40:06 2002 for MASS Software by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001