function element_write ( nnodes, element_num, element_node, output_filename ) %% ELEMENT_WRITE writes the element information to a text file. % % Discussion: % % The element information and the node/solution information can be read % into another program to make plots. % % Modified: % % 24 March 2005 % % Author: % % John Burkardt % % 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, character OUTPUT_FILENAME(*), the name of the file % in which the data should be stored. % output_unit = fopen ( output_filename, 'wt'); if ( output_unit < 0 ) fprintf ( 1, '\n' ); fprintf ( 1, 'ELEMENT_WRITE - Warning!\n' ); fprintf ( 1, ' Could not write the element file.\n' ); return end for element = 1 : element_num for i = 1 : nnodes fprintf ( output_unit, ' %4d', element_node(i,element) ); end fprintf ( output_unit, '\n' ); end fclose ( output_unit );