function nhba = bandwidth ( nnodes, element_num, element_node, node_num, indx ) %% BANDWIDTH determines the bandwidth of the coefficient matrix. % % Modified: % % 05 April 2004 % % Parameters: % % Input, integer NNODES, the number of local nodes per element. % % Input, integer ELEMENT_NUM, the number of elements. % % Input, integer ELEMENT_NODE(NNODES,ELEMENT_NUM); % ELEMENT_NODE(I,J) is the global index of local node I in element J. % % Input, integer NODE_NUM, the number of nodes. % % Input, integer INDX(NODE_NUM), the index of the unknown in the % finite element linear system. % % Output, integer NHBA, the half bandwidth of the matrix. % nhba = 0; for element = 1 : element_num for iln = 1 : nnodes in = element_node(iln,element); i = indx(in); if ( 0 < i ) for jln = 1 : nnodes jn = element_node(jln,element); j = indx(jn); nhba = max ( nhba, j - i ); end end end end