function tec_to_fem ( tec_file_name, node_coord_file_name, ... element_file_name, node_data_file_name ) %% TEC_TO_FEM converts the data in a TEC file into an FEM model. % % Modified: % % 29 January 2006 % % Author: % % John Burkardt % % Usage: % % tec_to_fem ( 'input.tec', 'node_coord.txt', 'element.txt', 'node_data.txt' ) % % Parameters: % % Input, string TEC_FILE_NAME, the name of the TEC file to be read. % % Output, string NODE_COORD_FILE_NAME, the name of the FEM node coordinate file % to be created. % % Output, string ELEMENT_FILE_NAME, the name of the FEM element file % to be created. % % Output, string NODE_DATA_FILE_NAME, the name of the FEM node data file % to be created. % timestamp; fprintf ( 1, '\n' ); fprintf ( 1, 'TEC_TO_FEM:\n' ); fprintf ( 1, ' (MATLAB version)\n' ); fprintf ( 1, '\n' ); fprintf ( 1, ' Read a TEC file containing finite element data.\n' ); fprintf ( 1, '\n' ); fprintf ( 1, ' Write files for an equivalent FEM model consisting of:\n' ); fprintf ( 1, ' * a node coordinate file,\n' ); fprintf ( 1, ' * an element file,\n' ); fprintf ( 1, ' * a node data file;\n' ); % % Get the TEC file name. % if ( nargin < 1 ) fprintf ( 1, '\n' ); fprintf ( 1, 'TEC_TO_FEM:\n' ); tec_file_name = input ( ... 'Enter the name of the TEC file:' ); end % % Get the node coordinate file name. % if ( nargin < 2 ) fprintf ( 1, '\n' ); fprintf ( 1, 'TEC_TO_FEM:\n' ); node_coord_file_name = input ( ... 'Enter the name of the node coordinate file:' ); end % % Get the element file name. % if ( nargin < 3 ) fprintf ( 1, '\n' ); fprintf ( 1, 'TEC_TO_FEM:\n' ); element_file_name = input ( ... 'Enter the name of the element file:' ); end % % Get the node data file name. % if ( nargin < 4 ) fprintf ( 1, '\n' ); fprintf ( 1, 'TEC_TO_FEM:\n' ); node_data_file_name = input ( ... 'Enter the name of the node data file:' ); end % % Read the TEC data. % [ dim_num, node_num, element_num, element_order, node_data_num, ... node_coord, element_node, node_data ] = tec_read ( tec_file_name ); fprintf ( 1, '\n' ); fprintf ( 1, ' Read the data from "%s".\n', tec_file_name ); % % Write the FEM data. % fem_write ( node_coord_file_name, element_file_name, node_data_file_name, ... dim_num, node_num, element_num, element_order, node_data_num, ... node_coord, element_node, node_data ) fprintf ( 1, '\n' ); fprintf ( 1, ' Wrote the node coordinates to "%s".\n', ... node_coord_file_name ); fprintf ( 1, ' Wrote the element data to "%s".\n', element_file_name ); fprintf ( 1, ' Wrote the node data to "%s".\n', node_data_file_name ); fprintf ( 1, '\n' ); fprintf ( 1, 'TEC_TO_FEM:\n' ); fprintf ( 1, ' Normal end of execution.\n' ); fprintf ( 1, '\n' ); timestamp;