示例#1
0
文件: nl_api.c 项目: Peiffert/CGoGN
NLboolean nlSolve() {
	NLboolean result ;
	NLdouble start_time = nlCurrentTime() ;
	nlCheckState(NL_STATE_SYSTEM_CONSTRUCTED) ;
	nlCurrentContext->elapsed_time = 0 ;
	result = nlCurrentContext->solver_func() ;
	nlVectorToVariables() ;
	nlCurrentContext->elapsed_time = nlCurrentTime() - start_time ;
	nlTransition(NL_STATE_SYSTEM_CONSTRUCTED, NL_STATE_SOLVED) ;
	return result ;
}
示例#2
0
文件: nl_api.c 项目: Peiffert/CGoGN
void nlRowParameteri(NLenum pname, NLint param) {
    nlCheckState(NL_STATE_MATRIX) ;
    switch(pname) {
    case NL_RIGHT_HAND_SIDE: {
        nlCurrentContext->right_hand_side = (NLdouble)param ;
    } break ;
    case NL_ROW_SCALING: {
        nlCurrentContext->row_scaling = (NLdouble)param ;
    } break ;
    }
}
示例#3
0
文件: nl_api.c 项目: Peiffert/CGoGN
void nlCoefficient(NLuint index, NLdouble value) {
    NLVariable* v = NULL ;
    nlCheckState(NL_STATE_ROW) ;
    nl_debug_range_assert(index, 0, nlCurrentContext->nb_variables - 1) ;
    v = &(nlCurrentContext->variable[index]) ;
    if(v->locked) {
        nlRowColumnAppend(&(nlCurrentContext->al), 0, value) ;
        nlRowColumnAppend(&(nlCurrentContext->xl), 0, v->value) ;
    } else {
        nlRowColumnAppend(&(nlCurrentContext->af), v->index, value) ;
    }
}
示例#4
0
void nlSolverParameterd(NLenum pname, NLdouble param) {
    nlCheckState(NL_STATE_INITIAL) ;
    switch(pname) {
    case NL_SOLVER: {
        nlCurrentContext->solver = (NLenum)param ;
    } break ;
    case NL_NB_VARIABLES: {
        nl_assert(param > 0) ;
        nlCurrentContext->nb_variables = (NLuint)param ;
    } break ;
    case NL_LEAST_SQUARES: {
        nlCurrentContext->least_squares = (NLboolean)param ;
    } break ;
    case NL_MAX_ITERATIONS: {
        nl_assert(param > 0) ;
        nlCurrentContext->max_iterations = (NLuint)param ;
    } break ;
    case NL_THRESHOLD: {
        nl_assert(param >= 0) ;
        nlCurrentContext->threshold = (NLdouble)param ;
    } break ;
    case NL_OMEGA: {
        nl_range_assert(param,1.0,2.0) ;
        nlCurrentContext->omega = (NLdouble)param ;
    } break ;
    case NL_SYMMETRIC: {
        nlCurrentContext->symmetric = (NLboolean)param ;        
    }
    case NL_INNER_ITERATIONS: {
        nl_assert(param > 0) ;
        nlCurrentContext->inner_iterations = (NLuint)param ;
    } break ;
    case NL_PRECONDITIONER: {
        nlCurrentContext->preconditioner = (NLuint)param ;        
    } break ;
    case NL_MATRIX_STORE: {
        nlCurrentContext->matrix_store = (NLenum)param ;
    } break ;
    default: {
        nl_assert_not_reached ;
    } break ;
    }
}
示例#5
0
文件: nl_api.c 项目: Peiffert/CGoGN
void nlUnlockVariable(NLuint index) {
    nlCheckState(NL_STATE_SYSTEM) ;
    nl_debug_range_assert(index, 0, nlCurrentContext->nb_variables - 1) ;
    nlCurrentContext->variable[index].locked = NL_FALSE ;
}
示例#6
0
文件: nl_api.c 项目: Peiffert/CGoGN
void nlSetVariable(NLuint index, NLdouble value) {
    nlCheckState(NL_STATE_SYSTEM) ;
    nl_debug_range_assert(index, 0, nlCurrentContext->nb_variables - 1) ;
    nlCurrentContext->variable[index].value = value ;    
}