Blender V2.61 - r43446
Classes | Defines | Typedefs | Functions | Variables

opennl.c File Reference

#include "ONL_opennl.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <ssp_defs.h>
#include <util.h>

Go to the source code of this file.

Classes

struct  __NLCoeff
struct  __NLRowColumn
struct  __NLSparseMatrix
struct  __NLVariable
struct  __NLContext
struct  __NLContext::__NLSuperLUContext

Defines

#define __nl_assert(x)
#define __nl_range_assert(x, min_val, max_val)
#define __nl_assert_not_reached
#define __nl_debug_assert(x)
#define __nl_debug_range_assert(x, min_val, max_val)
#define __nl_parano_assert(x)
#define __nl_parano_range_assert(x, min_val, max_val)
#define MIN(x, y)   (((x) < (y)) ? (x) : (y))
#define MAX(x, y)   (((x) > (y)) ? (x) : (y))
#define __NL_NEW(T)   (T*)(calloc(1, sizeof(T)))
#define __NL_NEW_ARRAY(T, NB)   (T*)(calloc((NB),sizeof(T)))
#define __NL_RENEW_ARRAY(T, x, NB)   (T*)(realloc(x,(NB)*sizeof(T)))
#define __NL_DELETE(x)   free(x); x = NULL
#define __NL_DELETE_ARRAY(x)   free(x); x = NULL
#define __NL_CLEAR(T, x)   memset(x, 0, sizeof(T))
#define __NL_CLEAR_ARRAY(T, x, NB)   memset(x, 0, (NB)*sizeof(T))
#define __NL_ROWS   1
#define __NL_COLUMNS   2
#define __NL_SYMMETRIC   4
#define __NL_STATE_INITIAL   0
#define __NL_STATE_SYSTEM   1
#define __NL_STATE_MATRIX   2
#define __NL_STATE_MATRIX_CONSTRUCTED   3
#define __NL_STATE_SYSTEM_CONSTRUCTED   4
#define __NL_STATE_SYSTEM_SOLVED   5

Typedefs

typedef void(* __NLMatrixFunc )(float *x, float *y)

Functions

static void __nl_assertion_failed (char *cond, char *file, int line)
static void __nl_range_assertion_failed (float x, float min_val, float max_val, char *file, int line)
static void __nl_should_not_have_reached (char *file, int line)
static void __nlRowColumnConstruct (__NLRowColumn *c)
static void __nlRowColumnDestroy (__NLRowColumn *c)
static void __nlRowColumnGrow (__NLRowColumn *c)
static void __nlRowColumnAdd (__NLRowColumn *c, NLint index, NLfloat value)
static void __nlRowColumnAppend (__NLRowColumn *c, NLint index, NLfloat value)
static void __nlRowColumnClear (__NLRowColumn *c)
static void __nlSparseMatrixConstruct (__NLSparseMatrix *M, NLuint m, NLuint n, NLenum storage)
static void __nlSparseMatrixDestroy (__NLSparseMatrix *M)
static void __nlSparseMatrixAdd (__NLSparseMatrix *M, NLuint i, NLuint j, NLfloat value)
static void __nlSparseMatrixClear (__NLSparseMatrix *M)
static NLuint __nlSparseMatrixNNZ (__NLSparseMatrix *M)
static void __nlSparseMatrix_mult_rows_symmetric (__NLSparseMatrix *A, NLfloat *x, NLfloat *y)
static void __nlSparseMatrix_mult_rows (__NLSparseMatrix *A, NLfloat *x, NLfloat *y)
static void __nlSparseMatrix_mult_cols_symmetric (__NLSparseMatrix *A, NLfloat *x, NLfloat *y)
static void __nlSparseMatrix_mult_cols (__NLSparseMatrix *A, NLfloat *x, NLfloat *y)
static void __nlSparseMatrixMult (__NLSparseMatrix *A, NLfloat *x, NLfloat *y)
static void __nlSparseMatrix_square (__NLSparseMatrix *AtA, __NLSparseMatrix *A)
static void __nlSparseMatrix_transpose_mult_rows (__NLSparseMatrix *A, NLfloat *x, NLfloat *y)
static void __nlMatrixVectorProd_default (NLfloat *x, NLfloat *y)
NLContext nlNewContext (void)
static void __nlFree_SUPERLU (__NLContext *context)
void nlDeleteContext (NLContext context_in)
void nlMakeCurrent (NLContext context)
NLContext nlGetCurrent (void)
static void __nlCheckState (NLenum state)
static void __nlTransition (NLenum from_state, NLenum to_state)
void nlSolverParameterf (NLenum pname, NLfloat param)
void nlSolverParameteri (NLenum pname, NLint param)
void nlGetBooleanv (NLenum pname, NLboolean *params)
void nlGetFloatv (NLenum pname, NLfloat *params)
void nlGetIntergerv (NLenum pname, NLint *params)
void nlEnable (NLenum pname)
void nlDisable (NLenum pname)
NLboolean nlIsEnabled (NLenum pname)
void nlSetVariable (NLuint rhsindex, NLuint index, NLfloat value)
NLfloat nlGetVariable (NLuint rhsindex, NLuint index)
void nlLockVariable (NLuint index)
void nlUnlockVariable (NLuint index)
NLboolean nlVariableIsLocked (NLuint index)
static void __nlVariablesToVector ()
static void __nlVectorToVariables ()
static void __nlBeginSystem ()
static void __nlEndSystem ()
static void __nlBeginMatrix ()
static void __nlEndMatrixRHS (NLuint rhs)
static void __nlEndMatrix ()
void nlMatrixAdd (NLuint row, NLuint col, NLfloat value)
void nlRightHandSideAdd (NLuint rhsindex, NLuint index, NLfloat value)
void nlRightHandSideSet (NLuint rhsindex, NLuint index, NLfloat value)
void nlBegin (NLenum prim)
void nlEnd (NLenum prim)
static NLboolean __nlFactorize_SUPERLU (__NLContext *context, NLint *permutation)
static NLboolean __nlInvert_SUPERLU (__NLContext *context)
void nlPrintMatrix (void)
NLboolean nlSolveAdvanced (NLint *permutation, NLboolean solveAgain)
NLboolean nlSolve ()

Variables

static __NLContext__nlCurrentContext = NULL

Detailed Description

Definition in file opennl.c.


Define Documentation

#define __nl_assert (   x)
#define __nl_assert_not_reached
#define __NL_CLEAR (   T,
 
)    memset(x, 0, sizeof(T))

Definition at line 146 of file opennl.c.

Referenced by __nlRowColumnDestroy(), __nlSparseMatrixDestroy(), and nlDeleteContext().

#define __NL_CLEAR_ARRAY (   T,
  x,
  NB 
)    memset(x, 0, (NB)*sizeof(T))
#define __NL_COLUMNS   2
#define __nl_debug_assert (   x)

Definition at line 114 of file opennl.c.

#define __nl_debug_range_assert (   x,
  min_val,
  max_val 
)

Definition at line 115 of file opennl.c.

#define __NL_DELETE (   x)    free(x); x = NULL

Definition at line 143 of file opennl.c.

Referenced by nlDeleteContext().

#define __NL_DELETE_ARRAY (   x)    free(x); x = NULL
#define __NL_NEW (   T)    (T*)(calloc(1, sizeof(T)))

Definition at line 140 of file opennl.c.

Referenced by __nlBeginMatrix(), and nlNewContext().

#define __NL_NEW_ARRAY (   T,
  NB 
)    (T*)(calloc((NB),sizeof(T)))
#define __nl_parano_assert (   x)

Definition at line 122 of file opennl.c.

#define __nl_parano_range_assert (   x,
  min_val,
  max_val 
)
#define __nl_range_assert (   x,
  min_val,
  max_val 
)
Value:
{                 \
    if(((x) < (min_val)) || ((x) > (max_val))) {                \
        __nl_range_assertion_failed(x, min_val, max_val,        \
            __FILE__, __LINE__                                \
        );                                                   \
    }                                                          \
}

Definition at line 98 of file opennl.c.

Referenced by nlMatrixAdd(), nlRightHandSideAdd(), and nlRightHandSideSet().

#define __NL_RENEW_ARRAY (   T,
  x,
  NB 
)    (T*)(realloc(x,(NB)*sizeof(T)))

Definition at line 142 of file opennl.c.

Referenced by __nlRowColumnGrow().

#define __NL_ROWS   1
#define __NL_STATE_INITIAL   0
#define __NL_STATE_MATRIX   2
#define __NL_STATE_MATRIX_CONSTRUCTED   3

Definition at line 497 of file opennl.c.

Referenced by __nlEndMatrix(), and __nlEndSystem().

#define __NL_STATE_SYSTEM   1
#define __NL_STATE_SYSTEM_CONSTRUCTED   4

Definition at line 498 of file opennl.c.

Referenced by __nlEndSystem(), and nlSolveAdvanced().

#define __NL_STATE_SYSTEM_SOLVED   5

Definition at line 499 of file opennl.c.

Referenced by __nlBeginSystem(), and nlSolveAdvanced().

#define __NL_SYMMETRIC   4

Definition at line 223 of file opennl.c.

Referenced by __nlFactorize_SUPERLU(), __nlSparseMatrixAdd(), and __nlSparseMatrixMult().

#define MAX (   x,
 
)    (((x) > (y)) ? (x) : (y))

Definition at line 134 of file opennl.c.

#define MIN (   x,
 
)    (((x) < (y)) ? (x) : (y))

Definition at line 130 of file opennl.c.


Typedef Documentation

typedef void(* __NLMatrixFunc)(float *x, float *y)

Definition at line 485 of file opennl.c.


Function Documentation

static void __nl_assertion_failed ( char *  cond,
char *  file,
int  line 
) [static]

Definition at line 62 of file opennl.c.

static void __nl_range_assertion_failed ( float  x,
float  min_val,
float  max_val,
char *  file,
int  line 
) [static]

Definition at line 71 of file opennl.c.

static void __nl_should_not_have_reached ( char *  file,
int  line 
) [static]

Definition at line 82 of file opennl.c.

static void __nlBeginMatrix ( ) [static]
static void __nlBeginSystem ( ) [static]
static void __nlCheckState ( NLenum  state) [static]
static void __nlEndMatrix ( ) [static]
static void __nlEndMatrixRHS ( NLuint  rhs) [static]
static void __nlEndSystem ( ) [static]

Definition at line 840 of file opennl.c.

References __NL_STATE_MATRIX_CONSTRUCTED, __NL_STATE_SYSTEM_CONSTRUCTED, and __nlTransition().

Referenced by nlEnd().

static NLboolean __nlFactorize_SUPERLU ( __NLContext context,
NLint permutation 
) [static]
static void __nlFree_SUPERLU ( __NLContext context) [static]
static NLboolean __nlInvert_SUPERLU ( __NLContext context) [static]
static void __nlMatrixVectorProd_default ( NLfloat x,
NLfloat y 
) [static]

Definition at line 536 of file opennl.c.

References __nlSparseMatrixMult(), and __NLContext::M.

Referenced by nlNewContext().

static void __nlRowColumnAdd ( __NLRowColumn c,
NLint  index,
NLfloat  value 
) [static]
static void __nlRowColumnAppend ( __NLRowColumn c,
NLint  index,
NLfloat  value 
) [static]
static void __nlRowColumnClear ( __NLRowColumn c) [static]
static void __nlRowColumnConstruct ( __NLRowColumn c) [static]
static void __nlRowColumnDestroy ( __NLRowColumn c) [static]

Definition at line 169 of file opennl.c.

References __NL_CLEAR, __NL_DELETE_ARRAY, and __NLRowColumn::coeff.

Referenced by __nlSparseMatrixDestroy(), and nlDeleteContext().

static void __nlRowColumnGrow ( __NLRowColumn c) [static]
static void __nlSparseMatrix_mult_cols ( __NLSparseMatrix A,
NLfloat x,
NLfloat y 
) [static]
static void __nlSparseMatrix_mult_cols_symmetric ( __NLSparseMatrix A,
NLfloat x,
NLfloat y 
) [static]
static void __nlSparseMatrix_mult_rows ( __NLSparseMatrix A,
NLfloat x,
NLfloat y 
) [static]
static void __nlSparseMatrix_mult_rows_symmetric ( __NLSparseMatrix A,
NLfloat x,
NLfloat y 
) [static]
static void __nlSparseMatrix_square ( __NLSparseMatrix AtA,
__NLSparseMatrix A 
) [static]
static void __nlSparseMatrix_transpose_mult_rows ( __NLSparseMatrix A,
NLfloat x,
NLfloat y 
) [static]
static void __nlSparseMatrixAdd ( __NLSparseMatrix M,
NLuint  i,
NLuint  j,
NLfloat  value 
) [static]
static void __nlSparseMatrixClear ( __NLSparseMatrix M) [static]
static void __nlSparseMatrixConstruct ( __NLSparseMatrix M,
NLuint  m,
NLuint  n,
NLenum  storage 
) [static]
static void __nlSparseMatrixDestroy ( __NLSparseMatrix M) [static]
static void __nlSparseMatrixMult ( __NLSparseMatrix A,
NLfloat x,
NLfloat y 
) [static]
static NLuint __nlSparseMatrixNNZ ( __NLSparseMatrix M) [static]
static void __nlTransition ( NLenum  from_state,
NLenum  to_state 
) [static]
static void __nlVariablesToVector ( ) [static]
static void __nlVectorToVariables ( ) [static]
void nlBegin ( NLenum  prim)
void nlDeleteContext ( NLContext  context_in)
void nlDisable ( NLenum  pname)

Definition at line 732 of file opennl.c.

References __nl_assert_not_reached.

void nlEnable ( NLenum  pname)

Definition at line 724 of file opennl.c.

References __nl_assert_not_reached.

void nlEnd ( NLenum  prim)
void nlGetBooleanv ( NLenum  pname,
NLboolean params 
)
NLContext nlGetCurrent ( void  )
void nlGetFloatv ( NLenum  pname,
NLfloat params 
)
void nlGetIntergerv ( NLenum  pname,
NLint params 
)
NLfloat nlGetVariable ( NLuint  rhsindex,
NLuint  index 
)
NLboolean nlIsEnabled ( NLenum  pname)

Definition at line 740 of file opennl.c.

References __nl_assert_not_reached, and NL_FALSE.

void nlLockVariable ( NLuint  index)
void nlMakeCurrent ( NLContext  context)

Definition at line 592 of file opennl.c.

Referenced by nlNewContext(), and p_chart_lscm_solve().

void nlMatrixAdd ( NLuint  row,
NLuint  col,
NLfloat  value 
)
NLContext nlNewContext ( void  )
void nlPrintMatrix ( void  )
void nlRightHandSideAdd ( NLuint  rhsindex,
NLuint  index,
NLfloat  value 
)
void nlRightHandSideSet ( NLuint  rhsindex,
NLuint  index,
NLfloat  value 
)
void nlSetVariable ( NLuint  rhsindex,
NLuint  index,
NLfloat  value 
)
NLboolean nlSolve ( void  )

Definition at line 1262 of file opennl.c.

References NL_FALSE, nlSolveAdvanced(), and NULL.

Referenced by p_abf_matrix_invert().

NLboolean nlSolveAdvanced ( NLint permutation,
NLboolean  solveAgain 
)
void nlSolverParameterf ( NLenum  pname,
NLfloat  param 
)
void nlSolverParameteri ( NLenum  pname,
NLint  param 
)
void nlUnlockVariable ( NLuint  index)
NLboolean nlVariableIsLocked ( NLuint  index)

Variable Documentation

__NLContext* __nlCurrentContext = NULL [static]