Epetra Package Browser (Single Doxygen Collection)  Development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Functions
Epetra_Util.h File Reference
#include "Epetra_ConfigDefs.h"
#include "Epetra_Object.h"
#include <vector>
Include dependency graph for Epetra_Util.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  Epetra_Util
 Epetra_Util: The Epetra Util Wrapper Class. More...
 

Functions

template<typename T >
int Epetra_Util_binary_search (T item, const T *list, int len, int &insertPoint)
 Utility function to perform a binary-search on a list of data. More...
 
EPETRA_LIB_DLL_EXPORT int Epetra_Util_binary_search (int item, const int *list, int len, int &insertPoint)
 
EPETRA_LIB_DLL_EXPORT int Epetra_Util_binary_search (long long item, const long long *list, int len, int &insertPoint)
 
template<typename T >
int Epetra_Util_binary_search_aux (T item, const int *list, const T *aux_list, int len, int &insertPoint)
 Utility function to perform a binary-search on a list of data. More...
 
EPETRA_LIB_DLL_EXPORT int Epetra_Util_binary_search_aux (int item, const int *list, const int *aux_list, int len, int &insertPoint)
 
EPETRA_LIB_DLL_EXPORT int Epetra_Util_binary_search_aux (long long item, const int *list, const long long *aux_list, int len, int &insertPoint)
 
template<class T >
int Epetra_Util_insert_empty_positions (T *&array, int &usedLength, int &allocatedLength, int insertOffset, int numPositions, int allocChunkSize=32)
 
template<class T >
int Epetra_Util_insert (T item, int offset, T *&list, int &usedLength, int &allocatedLength, int allocChunkSize=32)
 Function to insert an item in a list, at a specified offset. More...
 
template<class T >
T * Epetra_Util_data_ptr (std::vector< T > &vec)
 Function that returns either a pointer to the first entry in the vector or, if the vector is empty, the NULL pointer. More...
 
template<class T >
const T * Epetra_Util_data_ptr (const std::vector< T > &vec)
 Function that returns either a pointer to the first entry in the vector or, if the vector is empty, the NULL pointer. More...
 
int Epetra_Util_ExtractHbData (Epetra_CrsMatrix *A, Epetra_MultiVector *LHS, Epetra_MultiVector *RHS, int &M, int &N, int &nz, int *&ptr, int *&ind, double *&val, int &Nrhs, double *&rhs, int &ldrhs, double *&lhs, int &ldlhs)
 Harwell-Boeing data extraction routine. More...
 

Function Documentation

template<typename T >
int Epetra_Util_binary_search ( item,
const T *  list,
int  len,
int &  insertPoint 
)

Utility function to perform a binary-search on a list of data.

Important assumption: data is assumed to be sorted.

Parameters
itemto be searched for
listto be searched in
lenLength of list
insertPointInput/Output. If item is found, insertPoint is not referenced. If item is not found, insertPoint is set to the offset at which item should be inserted in list such that order (sortedness) would be maintained.
Returns
offset Location in list at which item was found. -1 if not found.

Definition at line 866 of file Epetra_Util.cpp.

EPETRA_LIB_DLL_EXPORT int Epetra_Util_binary_search ( int  item,
const int *  list,
int  len,
int &  insertPoint 
)

Definition at line 898 of file Epetra_Util.cpp.

EPETRA_LIB_DLL_EXPORT int Epetra_Util_binary_search ( long long  item,
const long long *  list,
int  len,
int &  insertPoint 
)

Definition at line 907 of file Epetra_Util.cpp.

template<typename T >
int Epetra_Util_binary_search_aux ( item,
const int *  list,
const T *  aux_list,
int  len,
int &  insertPoint 
)

Utility function to perform a binary-search on a list of data.

Important assumption: data is assumed to be sorted.

Parameters
itemto be searched for
listto be searched in
aux_list
lenLength of list
insertPointInput/Output. If item is found, insertPoint is not referenced. If item is not found, insertPoint is set to the offset at which item should be inserted in list such that order (sortedness) would be maintained.
Returns
offset Location in list at which aux_list[list[i]] item was found. -1 if not found.

Definition at line 917 of file Epetra_Util.cpp.

EPETRA_LIB_DLL_EXPORT int Epetra_Util_binary_search_aux ( int  item,
const int *  list,
const int *  aux_list,
int  len,
int &  insertPoint 
)

Definition at line 951 of file Epetra_Util.cpp.

EPETRA_LIB_DLL_EXPORT int Epetra_Util_binary_search_aux ( long long  item,
const int *  list,
const long long *  aux_list,
int  len,
int &  insertPoint 
)

Definition at line 961 of file Epetra_Util.cpp.

template<class T >
int Epetra_Util_insert_empty_positions ( T *&  array,
int &  usedLength,
int &  allocatedLength,
int  insertOffset,
int  numPositions,
int  allocChunkSize = 32 
)

Definition at line 341 of file Epetra_Util.h.

template<class T >
int Epetra_Util_insert ( item,
int  offset,
T *&  list,
int &  usedLength,
int &  allocatedLength,
int  allocChunkSize = 32 
)

Function to insert an item in a list, at a specified offset.

Parameters
itemto be inserted
offsetlocation at which to insert item
listarray into which item is to be inserted. This array may be re-allocated by this function.
usedLengthnumber of items already present in list. Will be updated to reflect the new length.
allocatedLengthcurrent allocated length of list. Will be updated to reflect the new allocated-length, if applicable. Re-allocation occurs only if usedLength==allocatedLength on entry.
allocChunkSizeOptional argument, defaults to 32. Increment by which the array should be expanded, if re-allocation is necessary.
Returns
error-code 0 if successful. -1 if input parameters don't make sense.

Definition at line 398 of file Epetra_Util.h.

template<class T >
T* Epetra_Util_data_ptr ( std::vector< T > &  vec)

Function that returns either a pointer to the first entry in the vector or, if the vector is empty, the NULL pointer.

Parameters
vecvector argument (may be empty)
Returns
Either NULL or a pointer to the first entry in vec

Definition at line 422 of file Epetra_Util.h.

template<class T >
const T* Epetra_Util_data_ptr ( const std::vector< T > &  vec)

Function that returns either a pointer to the first entry in the vector or, if the vector is empty, the NULL pointer.

Parameters
vecconstant vector argument (may be empty)
Returns
Either NULL or a pointer to the first entry in vec

Definition at line 437 of file Epetra_Util.h.

int Epetra_Util_ExtractHbData ( Epetra_CrsMatrix A,
Epetra_MultiVector LHS,
Epetra_MultiVector RHS,
int &  M,
int &  N,
int &  nz,
int *&  ptr,
int *&  ind,
double *&  val,
int &  Nrhs,
double *&  rhs,
int &  ldrhs,
double *&  lhs,
int &  ldlhs 
)

Harwell-Boeing data extraction routine.

This routine will extract data from an existing Epetra_Crs Matrix, and optionally from related rhs and lhs objects in a form that is compatible with software that requires the Harwell-Boeing data format. The matrix must be passed in, but the RHS and LHS arguments may be set to zero (either or both of them). For each of the LHS or RHS arguments, if non-trivial and contain more than one vector, the vectors must have strided access. If both LHS and RHS are non-trivial, they must have the same number of vectors. If the input objects are distributed, the returned matrices will contain the local part of the matrix and vectors only.

Parameters
A(In) Epetra_CrsMatrix.
LHS(In) Left hand side multivector. Set to zero if none not available or needed.
RHS(In) Right hand side multivector. Set to zero if none not available or needed.
M(Out) Local row dimension of matrix.
N(Out) Local column dimension of matrix.
nz(Out) Number of nonzero entries in matrix.
ptr(Out) Offsets into ind and val arrays pointing to start of each row's data.
ind(Out) Column indices of the matrix, in compressed form.
val(Out) Matrix values, in compressed form corresponding to the ind array.
Nrhs(Out) Number of right/left hand sides found (if any) in RHS and LHS.
rhs(Out) Fortran-style 2D array of RHS values.
ldrhs(Out) Stride between columns of rhs.
lhs(Out) Fortran-style 2D array of LHS values.
ldrhs(Out) Stride between columns of lhs.

Definition at line 973 of file Epetra_Util.cpp.