int createsparse() /* **-------------------------------------------------------------- ** Input: none ** Output: returns error code ** Purpose: creates sparse representation of coeff. matrix **-------------------------------------------------------------- */ { int errcode = 0; /* Allocate data structures */ ERRCODE(allocsparse()); if (errcode) return(errcode); /* Build node-link adjacency lists with parallel links removed. */ Degree = (int *) calloc(Nnodes+1, sizeof(int)); ERRCODE(MEMCHECK(Degree)); ERRCODE(buildlists(TRUE)); if (!errcode) { xparalinks(); /* Remove parallel links */ countdegree(); /* Find degree of each junction */ } /* (= # of adjacent links) */ /* Re-order nodes to minimize number of non-zero coeffs. */ /* in factorized solution matrix. At same time, adjacency */ /* list is updated with links representing non-zero coeffs. */ Ncoeffs = Nlinks; ERRCODE(reordernodes()); /* Allocate memory for sparse storage of positions of non-zero */ /* coeffs. and store these positions in vector NZSUB. */ ERRCODE(storesparse(Njuncs)); /* Free memory used for adjacency lists and sort */ /* row indexes in NZSUB to optimize linsolve(). */ if (!errcode) freelists(); ERRCODE(ordersparse(Njuncs)); /* Re-build adjacency lists without removing parallel */ /* links for use in future connectivity checking. */ ERRCODE(buildlists(FALSE)); /* Free allocated memory */ free(Degree); return(errcode); } /* End of createsparse */
void nehewidget::initializeGL() { loadGLTextures(); buildlists(); glEnable(GL_TEXTURE_2D); glShadeModel(GL_SMOOTH); glClearColor(0,0,0,0); glClearDepth(1.0); glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LEQUAL); glEnable(GL_LIGHT0); glEnable(GL_LIGHTING); glEnable(GL_COLOR_MATERIAL); glHint(GL_PERSPECTIVE_CORRECTION_HINT,GL_NICEST); }
void GLViewer::paintGL(){ rot += 0.5; if(update_model){ update_model = false; zoom = -1.0f; rot = 0.0f; //vertical_pan = 0.0f; loadGLTextures(); buildlists(); } glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); gluLookAt(0, -zoom * model_size, -zoom * model_size / 2.0 , 0, 0, 0.0, 0, 0, 1); glRotatef(rot, 0, 0, 1); //glRotatef(-xRot / 16.0, 1.0, 0.0, 0.0); //glRotatef(-yRot / 16.0, 0.0, 1.0, 0.0); //glRotatef(-zRot / 16.0, 0.0, 0.0, 1.0); glTranslatef(0, 0, vertical_pan * model_size); glCallList(model_list); }