void nlDeleteContext(NLContext context_in) { __NLContext* context = (__NLContext*)(context_in); if(__nlCurrentContext == context) { __nlCurrentContext = NULL; } if(context->alloc_M) { __nlSparseMatrixDestroy(&context->M); } if(context->alloc_af) { __nlRowColumnDestroy(&context->af); } if(context->alloc_al) { __nlRowColumnDestroy(&context->al); } if(context->alloc_variable) { __NL_DELETE_ARRAY(context->variable); } if(context->alloc_x) { __NL_DELETE_ARRAY(context->x); } if(context->alloc_b) { __NL_DELETE_ARRAY(context->b); } if (context->slu.alloc_slu) { __nlFree_SUPERLU(context); } #ifdef NL_PARANOID __NL_CLEAR(__NLContext, context); #endif __NL_DELETE(context); }
static void __nlSparseMatrixDestroy(__NLSparseMatrix* M) { NLuint i; __NL_DELETE_ARRAY(M->diag); if(M->storage & __NL_ROWS) { for(i=0; i<M->m; i++) { __nlRowColumnDestroy(&(M->row[i])); } __NL_DELETE_ARRAY(M->row); } if(M->storage & __NL_COLUMNS) { for(i=0; i<M->n; i++) { __nlRowColumnDestroy(&(M->column[i])); } __NL_DELETE_ARRAY(M->column); } #ifdef NL_PARANOID __NL_CLEAR(__NLSparseMatrix,M); #endif }
void nlDeleteContext(NLContext context_in) { __NLContext* context = (__NLContext*)(context_in); int i; if(__nlCurrentContext == context) { __nlCurrentContext = NULL; } if(context->alloc_M) { __nlSparseMatrixDestroy(&context->M); } if(context->alloc_MtM) { __nlSparseMatrixDestroy(&context->MtM); } if(context->alloc_variable) { for(i=0; i<context->nb_variables; i++) { if(context->variable[i].a) { __nlRowColumnDestroy(context->variable[i].a); __NL_DELETE(context->variable[i].a); } } __NL_DELETE_ARRAY(context->variable); } if(context->alloc_b) { __NL_DELETE_ARRAY(context->b); } if(context->alloc_Mtb) { __NL_DELETE_ARRAY(context->Mtb); } if(context->alloc_x) { __NL_DELETE_ARRAY(context->x); } if (context->slu.alloc_slu) { __nlFree_SUPERLU(context); } #ifdef NL_PARANOID __NL_CLEAR(__NLContext, context); #endif __NL_DELETE(context); }
static void __nlRowColumnDestroy(__NLRowColumn* c) { __NL_DELETE_ARRAY(c->coeff); #ifdef NL_PARANOID __NL_CLEAR(__NLRowColumn, c); #endif }