function triangles3_write ( file_name, triangle_num, triangle_node, ... node_num, node3_label ) %% TRIANGLES3_WRITE writes the pressure triangles to a file. % % Discussion: % % The first three rows of the array TRIANGLE_NODE(6,NODE) contain % exactly the nodes that make up the pressure triangles. % % However, we must relabel the nodes! % % Modified: % % 22 June 2005 % % Author: % % John Burkardt % % Parameters: % % Input, integer TRIANGLE_NUM, the number of triangles. % % Input, integer TRIANGLE_NODE(6,TRIANGLE_NUM), the nodes that make up each triangle. % % Input, integer NODE_NUM, the number of nodes. % % Input, integer NODE3_LABEL(NODE_NUM), contains the renumbered % label of order3 nodes, and -1 for nodes that are not order3 nodes. % file_unit = fopen ( file_name, 'wt'); if ( file_unit < 0 ) fprintf ( 1, '\n' ); fprintf ( 1, 'TRIANGLES3_WRITE - Warning!\n' ); fprintf ( 1, ' Could not write the file "%s".\n', file_name ); return; end for triangle = 1 : triangle_num fprintf ( file_unit, '%6d %6d %6d\n', ... node3_label ( triangle_node(1:3,triangle) ) ); end fclose ( file_unit );