Cantera  2.0
Functions | Variables
mdp Namespace Reference

The mdp routines are extremely lightweight and fast fortran compatibile malloc routines for allocating multiple dimensioned arrays of doubles ints, char, and pointers using a single call. More...

Functions

void checkFinite (const double tmp)
 Utility routine to check to see that a number is finite.
 
void checkfinite_ (double *tmp)
 Utility routine to link checkFinte() to fortran program.
 
void checkMagnitude (const double tmp, const double trigger=1.0E20)
 utility routine to check that a double stays bounded
 
void checkZeroFinite (const double tmp)
 Utility routine to check to see that a number is neither zero nor indefinite.
 
int MinI (const int &x, const int &y)
 
int MaxI (const int &x, const int &y)
 
static void mdp_alloc_eh (const char *const rname, const int bytes)
 
static void mdp_alloc_eh2 (const char *const rname)
 
static double * smalloc (size_t n)
 
double * mdp_array_alloc (int numdim,...)
 allocates multidimensional pointer arrays of arbitrary length via a single malloc call
 
void mdp_safe_free (void **hndVec)
 Free a vector and set its value to 0.
 
int * mdp_alloc_int_1 (int len, const int defval=MDP_INT_NOINIT)
 Allocate a vector of integers.
 
void mdp_safe_alloc_int_1 (int **array_hdl, int len, const int defval=MDP_INT_NOINIT)
 Allocate a vector of integers, potentially freeing memory first.
 
void mdp_realloc_int_1 (int **array_hdl, int new_len, int old_len, const int defval=MDP_INT_NOINIT)
 Reallocates a one dimensional array of ints, copying old information to the new array.
 
int ** mdp_alloc_int_2 (int len1, int len2, const int defval=MDP_INT_NOINIT)
 Allocate a 2D matrix of integers.
 
double * mdp_alloc_dbl_1 (int nvalues, const double val=MDP_DBL_NOINIT)
 Allocate and initialize a one dimensional array of doubles.
 
void mdp_safe_alloc_dbl_1 (double **hndVec, int nvalues, const double val=MDP_DBL_NOINIT)
 Allocates and/or initializes a one dimensional array of doubles.
 
void mdp_realloc_dbl_1 (double **hndVec, int newLen, int oldLen, const double defVal=MDP_DBL_NOINIT)
 Reallocate a vector of doubles possibly retaining a subset of values.
 
double ** mdp_alloc_dbl_2 (int ndim1, int ndim2, const double val)
 Allocate and initialize a two dimensional array of doubles.
 
char * mdp_alloc_char_1 (int nvalues, const char val= '\0')
 Allocate and initialize a one dimensional array of characters.
 
void mdp_safe_alloc_char_1 (char **arrayHnd, int nvalues, const char val= '\0')
 Allocate and initialize a one dimensional array of characters, deallocating the space before hand.
 
void mdp_safe_alloc_dbl_2 (double ***arrayHndl, int ndim1, int ndim2, const double val=MDP_DBL_NOINIT)
 Allocate and initialize a two dimensional array of doubles.
 
void mdp_realloc_dbl_2 (double ***hndArray, int ndim1, int ndim2, int ndim1Old, int ndim2Old, const double defVal=MDP_DBL_NOINIT)
 Reallocates a two dimensional array of doubles to a new set of dimensions, copying the old results into the new array.
 
char ** mdp_alloc_VecFixedStrings (int numStrings, int lenString)
 Allocate and initialize a vector of fixed-length strings.
 
void mdp_realloc_VecFixedStrings (char ***array_hdl, int numStrings, int numOldStrings, int lenString)
 Reallocate and initialize a vector of fixed-length strings.
 
void mdp_safe_alloc_VecFixedStrings (char ***arrayHnd, int numStrings, int lenString)
 Allocate and initialize an array of strings of fixed length.
 
void ** mdp_alloc_ptr_1 (int numPointers)
 Allocate and initialize a vector of pointers of type pointer to void.
 
void mdp_safe_alloc_ptr_1 (void ***array_hnd, int numPointers)
 Allocate and initialize a vector of pointers of type pointer to void.
 
void mdp_realloc_ptr_1 (void ***array_hdl, int numLen, int numOldLen)
 Reallocate and initialize a vector of pointers.
 
void mdp_copy_VecFixedStrings (char **const copyTo, const char **const copyFrom, int numStrings, size_t maxLenString)
 Copies an array of string vectors from one char ** vector to another.
 
char * mdp_copy_string (const char *const copyFrom)
 Allocates space for and copies a string.
 
void mdp_safe_copy_string (char **stringHnd, const char *const copyFrom)
 Allocates space for and copies a string.
 
void mdp_copy_dbl_1 (double *const copyTo, const double *const copyFrom, const int len)
 Copy a double vector to a double vector.
 
void mdp_copy_dbl_2 (double **const copyTo, const double **const copyFrom, const int len1, const int len2)
 Copy a double array to a double array.
 
void mdp_copy_int_1 (int *const copyTo, const int *const copyFrom, const int len)
 Copies one int vector into one int vector.
 
void mdp_copy_int_2 (int **const copyTo, const int **const copyFrom, const int len1, const int len2)
 Copies one 2D int array into another 2D int array.
 
void mdp_copy_ptr_1 (void *const copyTo, const void *const copyFrom, const int len)
 Copies one ptr vector into another ptr vector.
 
void ** mdp_dupl_ptr_1 (const void *const copyFrom, int len)
 Duplicates one ptr vector into another ptr vector.
 
void mdp_init_dbl_1 (double *const v, const double value, const int len)
 Assigns a single value to a double vector.
 
void mdp_zero_dbl_1 (double *const v, const int len)
 Zeroes a double vector.
 
void mdp_zero_int_1 (int *const v, const int len)
 Zeroes an int vector.
 
void mdp_init_dbl_2 (double **const v, const double value, const int len1, const int len2)
 Assigns a single value to a double matrix.
 
void mdp_init_int_1 (int *const v, const int value, const int len)
 Assigns a single value to an int vector.
 

Variables

int MDP_ALLO_errorOption = 3
 
const int MDP_ALLOC_INTERFACE_ERROR = -230346
 

Detailed Description

The mdp routines are extremely lightweight and fast fortran compatibile malloc routines for allocating multiple dimensioned arrays of doubles ints, char, and pointers using a single call.

These routines don't use the std C+ lib routines.

All calls are essentially wrappers around the routine mdp_alloc_array() which allocates multidimensioned arrays. The arrays contain room for the data and the pointer information that is used to access data in the object.

One convention that is always used is that a pointer that is not malloced always has a value of zero. If the pointer is nonnull, then it may be freed, always (and vica-versa).

Where possible, the low leve routines memcpy and memset are used to copy or zero memory.

No array bounds checking is ever done within these routines. buyer beware. The bounds of arrays are not carried with the array object, ever. Bounds of arrays are input via the parameter list. Normally, for applications this is not a problem, since the application knows what the array dimensions are.

There are several other general principles.

If an allocation size is set to 0, then the actual allocation size is set to 1 within the program. Something is always allocated whenever a call is made to an mdp routine.

All checks for allocations are always checked for success. If a failure is found, thene mdp_alloc_eh() is called for disposition of the error condition.

Error handling behavior is set by the MDP_ALLO_errorOption external int. The default error behavior is to print an error message to stderr, and then throw an exception that inherited from std::exception. Usually std::bad_alloc() is thrown whenever there is a problem.

Function Documentation

void checkFinite ( const double  tmp)

Utility routine to check to see that a number is finite.

Parameters
tmpnumber to be checked

Definition at line 59 of file checkFinite.cpp.

Referenced by checkfinite_(), checkMagnitude(), NonlinearSolver::doCauchyPointSolve(), RootFind::func(), NonlinearSolver::residErrorNorm(), and VCS_SOLVE::vcs_deltag().

void checkfinite_ ( double *  tmp)

Utility routine to link checkFinte() to fortran program.

This routine is accessible from fortran, usually

Parameters
tmpPointer to the number to check
Todo:
link it into the usual way Cantera handles Fortran calls

Definition at line 84 of file checkFinite.cpp.

References checkFinite().

void checkMagnitude ( const double  tmp,
const double  trigger = 1.0E20 
)

utility routine to check that a double stays bounded

This routine checks to see if a number stays bounded. The absolute value of the number is required to stay below the trigger.

Parameters
tmpNumber to be checked
triggerbounds on the number. Defaults to 1.0E20

Definition at line 98 of file checkFinite.cpp.

References checkFinite().

void checkZeroFinite ( const double  tmp)

Utility routine to check to see that a number is neither zero nor indefinite.

This check can be used before using the number in a denominator.

Parameters
tmpnumber to be checked

Definition at line 136 of file checkFinite.cpp.

double * mdp_array_alloc ( int  numdim,
  ... 
)

allocates multidimensional pointer arrays of arbitrary length via a single malloc call

The first dimension is the number of dimensions in the allocation

Definition at line 232 of file base/mdp_allo.cpp.

void mdp_safe_free ( void **  hndVec)

Free a vector and set its value to 0.

This function carries out the following operation

free(*hndVec);
*hndVec = 0;
Parameters
hndVecThis is the address of the pointer, expressed as a void **

Note, a key idea behind the mdp suite of routines is that a pointer that can be malloced is either malloced or its value is 0. This routine enforces this convention.

Definition at line 370 of file base/mdp_allo.cpp.

Referenced by NonlinearSolver::beuler_jac(), NonlinearSolver::doAffineNewtonSolve(), and BEulerInt::~BEulerInt().

int * mdp_alloc_int_1 ( int  len,
const int  defval = MDP_INT_NOINIT 
)

Allocate a vector of integers.

The vector is initialized, unless the default int value is set to MDP_INT_NOINIT

Parameters
lenLength of the vector
defvalDefault value for the int, defaults to MDP_INT_NOINIT
Returns
returns a pointer to the vector

Definition at line 464 of file base/mdp_allo.cpp.

void mdp_safe_alloc_int_1 ( int **  array_hdl,
int  len,
const int  defval = MDP_INT_NOINIT 
)

Allocate a vector of integers, potentially freeing memory first.

The vector is initialized, unless the default int value is set to MDP_INT_NOINIT

Input

Parameters
array_hdlPrevious value of pointer. If non-NULL will try to free the memory at this address before doing a new alloc
lenLength of the vector
defvalDefault value for the int, defaults to MDP_INT_NOINIT

Output

Returns
*array_hdl = This value is initialized to the correct address of the array. A NULL value in the position indicates an error.

Definition at line 506 of file base/mdp_allo.cpp.

void mdp_realloc_int_1 ( int **  array_hdl,
int  new_len,
int  old_len,
const int  defval = MDP_INT_NOINIT 
)

Reallocates a one dimensional array of ints, copying old information to the new array.

Reallocates a one dimensional array of ints. This routine always allocates space for at least one int. Calls the smalloc() routine to ensure that all malloc calls go through one location. This routine will then copy the pertinent information from the old array to the new array.

NewArray[0:old_len-1] = OldArray[0:old_len-1]; NewArray[old_len:new_len-1] = defval;

Input

Parameters
array_hdlPrevious value of pointer. If non-NULL will try to free the memory at this address before doing a new alloc
new_lenNew Length of the vector
old_lenNew Length of the vector
defvalDefault value for the int, defaults to MDP_INT_NOINIT

Output

Returns
*array_hdl = This value is initialized to the correct address of the array. A NULL value in the position indicates an error.

Definition at line 545 of file base/mdp_allo.cpp.

int ** mdp_alloc_int_2 ( int  len1,
int  len2,
const int  defval = MDP_INT_NOINIT 
)

Allocate a 2D matrix of integers.

The matrix is initialized, unless the default int value is set to MDP_INT_NOINIT, which is the default.

matrix[len1][len2]

All int data entries are contiguous. Therefore, it may be used as input into BLAS matrix function calls. This can be considered to be in fortran order format with len2 as the number of rows, and len1 as the number of columns.

matrix[jcol] refers to the jcol column of the matrix. Therefore, matrix[0] is a pointer to the beginning of the data portion of the structure. The structure will have len1 pointers at the beginning that holds pointers into the top of the columns of the contiguous data.

The entire structure may be deallocated via one free call.

Parameters
len1Outer Length of the vector
len2Inner length of the matrix
defvalDefault value for the int, defaults to MDP_INT_NOINIT
Returns
returns a pointer to the matrix

Definition at line 627 of file base/mdp_allo.cpp.

double * mdp_alloc_dbl_1 ( int  nvalues,
const double  val = MDP_DBL_NOINIT 
)

Allocate and initialize a one dimensional array of doubles.

As per the convention in mdp, this routine always initializes at least one slot.

Parameters
nvaluesLength of the array. If this number is less than one, it is set to one. Therefore, This routine always initializes at least one double.
valinitialization value. Set it to the constant MDP_DBL_NOINIT if you don't want any initialization. memset() is used for zero initialization for fast execution speed.
Returns
Pointer to the initialized array of doubles Failures are indicated by returning the NULL pointer.

Definition at line 677 of file base/mdp_allo.cpp.

Referenced by NonlinearSolver::beuler_jac(), and NonlinearSolver::doAffineNewtonSolve().

void mdp_safe_alloc_dbl_1 ( double **  hndVec,
int  nvalues,
const double  val = MDP_DBL_NOINIT 
)

Allocates and/or initializes a one dimensional array of doubles.

This routine will free any old memory that was located at that position, before it will allocate a new vector.

Parameters
hndVecPrevious value of pointer. If non-NULL will try to free the memory at this address. On output, this value is initialized to the correct address of the array. A NULL value in the position indicates an error.
nvaluesLength of the array
valinitialization value

Definition at line 720 of file base/mdp_allo.cpp.

void mdp_realloc_dbl_1 ( double **  hndVec,
int  newLen,
int  oldLen,
const double  defVal = MDP_DBL_NOINIT 
)

Reallocate a vector of doubles possibly retaining a subset of values.

Reallocates the array and sets:

(*hndVec)[0:oldLen-1] = oldVec[0:oldLen-1] (*hndVec)[oldLen:newLen] = defVal

Input

Parameters
newLenNew Length of the vector

Output

Parameters
oldLenOld Length of the vector

Definition at line 758 of file base/mdp_allo.cpp.

double ** mdp_alloc_dbl_2 ( int  ndim1,
int  ndim2,
const double  val 
)

Allocate and initialize a two dimensional array of doubles.

Allocate a two dimensional array of doubles. The array is in fortran order and can be accessed via the following form:

  dblArray[ndim1][ndim2]

Note, ndim2 is the inner dimension. i.e., the array is in column ordering.

Input

Parameters
ndim1Length of the first dimension of the array
ndim2Length of the second dimension of the array
valInitialization value
Returns
Pointer to the initialized array of doubles. Failures are indicated by returning the NULL pointer.

Definition at line 836 of file base/mdp_allo.cpp.

char * mdp_alloc_char_1 ( int  nvalues,
const char  val = '\0' 
)

Allocate and initialize a one dimensional array of characters.

The array is always initialized.

Input

Parameters
nvaluesLength of the array
valinitialization value. defaults to the NULL char
Returns
Pointer to the initialized character array Failures are indicated by returning the NULL pointer.

Definition at line 892 of file base/mdp_allo.cpp.

void mdp_safe_alloc_char_1 ( char **  arrayHnd,
int  nvalues,
const char  val = '\0' 
)

Allocate and initialize a one dimensional array of characters, deallocating the space before hand.

This routine will free any old memory that was located at that position, before it will allocate a new vector.

The array is always initialized.

@param arrayHnd   Pointer to the global variable that
                   holds the old and (eventually new)
                   address of the array of char to be reallocated
@param  nvalues   Length of the array
@param  val       initialization value. defaults to the NULL char
Returns
Pointer to the initialized character array Failures are indicated by returning the NULL pointer.

Definition at line 933 of file base/mdp_allo.cpp.

void mdp_safe_alloc_dbl_2 ( double ***  arrayHndl,
int  ndim1,
int  ndim2,
const double  val = MDP_DBL_NOINIT 
)

Allocate and initialize a two dimensional array of doubles.

Allocate a two dimensional array of doubles. The array is in fortran order and can be accessed via the following form:

  (*arrayHndl)[ndim1][ndim2]

Note, ndim2 is the inner dimension. i.e., the array is in column ordering.

Input

Parameters
ndim1Length of the first dimension of the array
ndim2Length of the second dimension of the array
valInitialization value
arrayHndlHandle to the array. If nonnull, the array is first freed. Failures are indicated by returning the NULL pointer.

Definition at line 978 of file base/mdp_allo.cpp.

void mdp_realloc_dbl_2 ( double ***  hndArray,
int  ndim1,
int  ndim2,
int  ndim1Old,
int  ndim2Old,
const double  defVal = MDP_DBL_NOINIT 
)

Reallocates a two dimensional array of doubles to a new set of dimensions, copying the old results into the new array.

This routine will then copy the pertinent information from the old array to the new array.

If both old dimensions are set to zero or less, then this routine will free the old memory before mallocing the new memory. This may be a benefit for extremely large mallocs. In all other cases, the new and the old malloced arrays will exist for a short time together.

Input

Parameters
hndArray= Pointer to the global variable that holds the old and (eventually new) address of the array of doubles to be reallocated
ndim1= First dimension of the new array
ndim2= Second dimension of the new array
ndim1Old= First dimension of the old array
ndim2Old= Second dimension of the old array
defVal= Default fill value.

Output

The resulting vector looks like this:

(*hndArray)[0:ndim1Old-1][0:ndim2Old-1] = oldVec[0:ndim1Old-1][0:ndim2Old-1] (*hndArray)[ndim1Old:ndim1][ndim2Old:ndim2] = defVal

Definition at line 1018 of file base/mdp_allo.cpp.

char ** mdp_alloc_VecFixedStrings ( int  numStrings,
int  lenString 
)

Allocate and initialize a vector of fixed-length strings.

Each string is initialized to the NULL string.

Parameters
numStringsNumber of strings
lenStringLength of each string including the trailing null character
Returns
Value is initialized to the correct address of the new array on exit. A NULL value in the position indicates an error.

Definition at line 1140 of file base/mdp_allo.cpp.

void mdp_realloc_VecFixedStrings ( char ***  array_hdl,
int  numStrings,
int  numOldStrings,
int  lenString 
)

Reallocate and initialize a vector of fixed-length strings.

Each new string is initialized to the NULL string. Old strings are copied.

Parameters
array_hdlThe pointer to the char ** location holding the data to be reallocated.
numStringsNumber of strings
numOldStringsNumber of old strings
lenStringLength of each string including the trailing null character

Definition at line 1185 of file base/mdp_allo.cpp.

void mdp_safe_alloc_VecFixedStrings ( char ***  arrayHnd,
int  numStrings,
int  lenString 
)

Allocate and initialize an array of strings of fixed length.

Parameters
numStringsNumber of strings
lenStringLength of each string including the trailing null character
array_hdlValue is initialized to the correct address of the new array on exit. A NULL value in the position indicates an error. If non-NULL on entry the routine will first free the memory at the address.

Definition at line 1245 of file base/mdp_allo.cpp.

void ** mdp_alloc_ptr_1 ( int  numPointers)

Allocate and initialize a vector of pointers of type pointer to void.

All pointers are initialized to the NULL value.

Parameters
numPointersNumber of pointers
Returns
This value is initialized to the correct address of the vector. A NULL value in the position indicates an error.

Definition at line 1285 of file base/mdp_allo.cpp.

void mdp_safe_alloc_ptr_1 ( void ***  array_hnd,
int  numPointers 
)

Allocate and initialize a vector of pointers of type pointer to void.

All pointers are initialized to the NULL value.

Parameters
numPointersNumber of pointers
array_hdlThis value is initialized to the correct address of the array. A NULL value in the position indicates an error. Previous value of pointer. If non-NULL will try to free the memory at this address.

Definition at line 1324 of file base/mdp_allo.cpp.

void mdp_realloc_ptr_1 ( void ***  array_hdl,
int  numLen,
int  numOldLen 
)

Reallocate and initialize a vector of pointers.

All old pointers are copied Each new pointer not associated with an old pointer is initialized to NULL.

Parameters
array_hdlThe pointer to the char ** location holding the data to be reallocated.
numLenNumber of new pointers
numOldLenNumber of old pointers

Definition at line 1363 of file base/mdp_allo.cpp.

void mdp_copy_VecFixedStrings ( char **const  copyTo,
const char **const  copyFrom,
int  numStrings,
size_t  maxLenString 
)

Copies an array of string vectors from one char ** vector to another.

The space must have already been allocated within copyFrom and copyTo arrays. Overwrites are prevented by the proper application of the variable maxLenString. Strings are forced to be null-terminated Therefore copyTo[maxLenString-1] = '/0'

Input

Parameters
copyFromvector of C strings. It should be null terminated
numStringsnumber of strings
maxLenStringmaximum of the size of the string arrays, copyTo and copyFrom. This is used as the argument to strncpy() function.

Output

Parameters
copyTovector of strings

Definition at line 1421 of file base/mdp_allo.cpp.

References mdp_copy_VecFixedStrings().

Referenced by mdp_copy_VecFixedStrings().

char * mdp_copy_string ( const char *const  copyFrom)

Allocates space for and copies a string.

Parameters
copyFromnull terminated string. If NULL is supplied, then nothing is malloced and a NULL value is returned.
Returns
This value is initialized to the correct address of the array. A NULL value in the position either indicates an error, or that the original pointer to the string was NULL.

Definition at line 1465 of file base/mdp_allo.cpp.

void mdp_safe_copy_string ( char **  stringHnd,
const char *const  copyFrom 
)

Allocates space for and copies a string.

Parameters
stringHndPrevious value of pointer. If non-NULL will try to free the memory at this address.
copyFromnull terminated string. If NULL is supplied, then nothing is malloced and a NULL value is returned.
Returns
This value is initialized to the correct address of the array. A NULL value in the position either indicates an error, or that the original pointer to the string was NULL.

Definition at line 1501 of file base/mdp_allo.cpp.

void mdp_copy_dbl_1 ( double *const  copyTo,
const double *const  copyFrom,
const int  len 
)

Copy a double vector to a double vector.

copyTo[len] = copyFrom[len]

Input

Parameters
copyFromVector to copy ( length >= len)
lenLength of the copy

Output

Parameters
copyToVector to receive the copy ( length >= len)

Definition at line 1542 of file base/mdp_allo.cpp.

References mdp_copy_dbl_1().

Referenced by NonlinearSolver::dampDogLeg(), NonlinearSolver::doAffineNewtonSolve(), mdp_copy_dbl_1(), BEulerInt::solve_nonlinear_problem(), NonlinearSolver::solve_nonlinear_problem(), and BEulerInt::step().

void mdp_copy_dbl_2 ( double **const  copyTo,
const double **const  copyFrom,
const int  len1,
const int  len2 
)

Copy a double array to a double array.

This routine carries out a straight copy on the effective 1D description of each of the arrays. It copies the first len1*len2 doubless stored within copyFrom into the the first len1*len2 double slots in copyTo. It does not account for the actual dimensions of the two arrays.

Input

Parameters
copyFromVector to copy ( length >= len1 * len2)
len1Length of the first dimension
len2Length of the second dimension

Output

Parameters
copyToArray to receive the copy ( length >= len1 * len2)

Definition at line 1570 of file base/mdp_allo.cpp.

References mdp_copy_dbl_2().

Referenced by mdp_copy_dbl_2().

void mdp_copy_int_1 ( int *const  copyTo,
const int *const  copyFrom,
const int  len 
)

Copies one int vector into one int vector.

Input

Parameters
copyFromVector of values to be copied
lenLength of the vector

Output

*copyTo = Vector of values to receive the copy

Definition at line 1603 of file base/mdp_allo.cpp.

References mdp_copy_int_1().

Referenced by mdp_copy_int_1().

void mdp_copy_int_2 ( int **const  copyTo,
const int **const  copyFrom,
const int  len1,
const int  len2 
)

Copies one 2D int array into another 2D int array.

This routine carries out a straight copy. Actually it copies the first len1*len2 ints stored within copyFrom into the the first len1*len2 int slots in copyTo. It does not account for the actual dimensions of the two arrays.

Parameters
copyFromVector of values to be copied
len1Length of the first array
len2Length of the second array

Output

copyToVector of values to receive the copy

Definition at line 1632 of file base/mdp_allo.cpp.

References mdp_copy_int_2().

Referenced by mdp_copy_int_2().

void mdp_copy_ptr_1 ( void *const  copyTo,
const void *const  copyFrom,
const int  len 
)

Copies one ptr vector into another ptr vector.

Parameters
copyFromVector of ptr values to be copied
lenLength of the vector
copyToVector of values to receive the copy

Definition at line 1665 of file base/mdp_allo.cpp.

References mdp_copy_ptr_1().

Referenced by mdp_copy_ptr_1().

void ** mdp_dupl_ptr_1 ( const void *const  copyFrom,
int  len 
)

Duplicates one ptr vector into another ptr vector.

Mallocs a copy of one vector of pointers and returns the pointer to the copy.

Input

Parameters
*copyFromVector of ptr values to be copied
lenLength of the vector

Output

Returns
Vector of values to receive the copy

Definition at line 1694 of file base/mdp_allo.cpp.

References mdp_dupl_ptr_1().

Referenced by mdp_dupl_ptr_1().

void mdp_init_dbl_1 ( double *const  v,
const double  value,
const int  len 
)

Assigns a single value to a double vector.

Parameters
vVector of values to be assigned
valueValue to assign with
lenLength of the vector

Definition at line 1727 of file base/mdp_allo.cpp.

References mdp_init_dbl_1().

Referenced by mdp_init_dbl_1(), and NonlinearSolver::solve_nonlinear_problem().

void mdp_zero_dbl_1 ( double *const  v,
const int  len 
)

Zeroes a double vector.

Parameters
v= Vector of values to be assigned
len= Length of the vector

Definition at line 1772 of file base/mdp_allo.cpp.

References mdp_zero_dbl_1().

Referenced by mdp_zero_dbl_1().

void mdp_zero_int_1 ( int *const  v,
const int  len 
)

Zeroes an int vector.

Parameters
v= Vector of values to be assigned
len= Length of the vector

Definition at line 1795 of file base/mdp_allo.cpp.

References mdp_zero_int_1().

Referenced by mdp_zero_int_1().

void mdp_init_dbl_2 ( double **const  v,
const double  value,
const int  len1,
const int  len2 
)

Assigns a single value to a double matrix.

Contiguous data for the matrix is assumed.

Input

Parameters
vmatrix of values to be assigned
valuevalue to assign with
len1Length one of the vector
len2length two of the vector

Definition at line 1818 of file base/mdp_allo.cpp.

References mdp_init_dbl_2().

Referenced by mdp_init_dbl_2().

void mdp_init_int_1 ( int *const  v,
const int  value,
const int  len 
)

Assigns a single value to an int vector.

Parameters
vVector of values to be assigned
valueValue to assign with
lenLength of the vector

Definition at line 1867 of file base/mdp_allo.cpp.

References mdp_init_int_1().

Referenced by mdp_init_int_1().

Variable Documentation

int MDP_ALLO_errorOption = 3

Error Handling 7 print and exit 6 exit 5 print and create a divide by zero for stack trace analysis. 4 create a divide by zero for stack analysis trace 3 print a message and throw the std::bad_alloc() exception. 2 throw the std::bad_alloc() exception and be quiet. 1 print a message and return from package with the NULL pointer 0 Keep completely silent about the matter and return with a null pointer.

-> Right now, the only way to change this option is to right here

The default is to set it to 3.

Definition at line 46 of file base/mdp_allo.cpp.