program main c*********************************************************************72 c cc triangle_io_test() tests triangle_io(). c c Licensing: c c This code is distributed under the MIT license. c c Modified: c c 11 October 2014 c c Author: c c John Burkardt c implicit none call timestamp ( ) write ( *, '(a)' ) '' write ( *, '(a)' ) 'triangle_io_test():' write ( *, '(a)' ) ' Fortran77 version' write ( *, '(a)' ) ' Test triangle_io().' call test01 ( ) call test02 ( ) call test03 ( ) call test04 ( ) c c Terminate. c write ( *, '(a)' ) '' write ( *, '(a)' ) 'triangle_io_test():' write ( *, '(a)' ) ' Normal end of execution.' write ( *, '(a)' ) '' call timestamp ( ) return end subroutine test01 ( ) c*********************************************************************72 c cc TEST01 gets the example node data and writes it to a file. c c Licensing: c c This code is distributed under the MIT license. c c Modified: c c 11 October 2014 c c Author: c c John Burkardt c implicit none double precision node_att(0,21) integer node_att_num double precision node_coord(2,21) integer node_dim character * ( 255 ) node_filename integer node_marker(1,21) integer node_marker_num integer node_num node_filename = 'example.node' write ( *, '(a)' ) '' write ( *, '(a)' ) 'TEST01:' write ( *, '(a)' ) & ' Get example node data, write to a triangle node file.' c c Get node example size. c call triangle_node_size_example ( node_num, node_dim, & node_att_num, node_marker_num ) c c Print the sizes. c write ( *, '(a)' ) '' write ( *, '(a,i4)' ) ' Number of nodes = ', node_num write ( *, '(a,i4)' ) ' Spatial dimension = ', node_dim write ( *, '(a,i4)' ) & ' Number of node attributes = ', node_att_num write ( *, '(a,i4)' ) & ' Number of node markers = ', node_marker_num c c Get the node data. c call triangle_node_data_example ( node_num, node_dim, & node_att_num, node_marker_num, node_coord, node_att, & node_marker ) c c Print some of the data. c call r8mat_transpose_print_some ( node_dim, node_num, node_coord, & 1, 1, node_dim, 10, ' Coordinates for first 10 nodes:' ) call r8mat_transpose_print_some ( node_att_num, node_num, & node_att, 1, 1, node_att_num, 10, & ' Attributes for first 10 nodes:' ) call i4mat_transpose_print_some ( node_marker_num, node_num, & node_marker, 1, 1, node_marker_num, 10, & ' Markers for first 10 nodes:' ) c c Write the node information to node file. c call triangle_node_write ( node_filename, node_num, node_dim, & node_att_num, node_marker_num, node_coord, node_att, & node_marker ) write ( *, '(a)' ) '' write ( *, '(a)' ) ' Node data written to file "' // & trim ( node_filename ) // '"' return end subroutine test02 ( ) c*********************************************************************72 c cc TEST02 gets the example element data and writes it to a file. c c Licensing: c c This code is distributed under the MIT license. c c Modified: c c 10 October 2014 c c Author: c c John Burkardt c implicit none double precision element_att(0,24) integer element_att_num character * ( 255 ) element_filename integer element_node(3,24) integer element_num integer element_order element_filename = 'element.ele' write ( *, '(a)' ) '' write ( *, '(a)' ) 'TEST02:' write ( *, '(a)' ) & ' Get example element data, write to a triangle element file.' c c Get element example size. c call triangle_element_size_example ( element_num, element_order, & element_att_num ) c c Print the sizes. c write ( *, '(a)' ) '' write ( *, '(a,i4)' ) ' Number of elements = ', element_num write ( *, '(a,i4)' ) ' Order of elements = ', element_order write ( *, '(a,i4)' ) ' Number of element attributes = ', & element_att_num c c Get the data. c call triangle_element_data_example ( element_num, element_order, & element_att_num, element_node, element_att ) c c Print some of the data. c call i4mat_transpose_print_some ( element_order, element_num, & element_node, 1, 1, element_order, 10, & ' Node connectivity of first 10 elements:' ) call r8mat_transpose_print_some ( element_att_num, element_num, & element_att, 1, 1, element_att_num, 10, & ' Attributes for first 10 elements:' ) c c Write the node information to node file. c call triangle_element_write ( element_filename, element_num, & element_order, element_att_num, element_node, element_att ) write ( *, '(a)' ) '' write ( *, '(a)' ) ' Element data written to file "' // & trim ( element_filename ) // '"' return end subroutine test03 ( ) c*********************************************************************72 c cc TEST03 reads the example node data from a file. c c Licensing: c c This code is distributed under the MIT license. c c Modified: c c 10 October 2014 c c Author: c c John Burkardt c implicit none double precision node_att(0,21) integer node_att_num double precision node_coord(2,21) integer node_dim character * ( 255 ) node_filename integer node_marker(1,21) integer node_marker_num integer node_num node_filename = 'example.node' write ( *, '(a)' ) '' write ( *, '(a)' ) 'TEST03:' write ( *, '(a)' ) ' Read node data from a node file.' c c Get the data size. c call triangle_node_size_read ( node_filename, node_num, node_dim, & node_att_num, node_marker_num ) c c Print the sizes. c write ( *, '(a)' ) '' write ( *, '(a)' ) ' Node data read from file "' // & trim ( node_filename ) // '"' write ( *, '(a)' ) '' write ( *, '(a,i4)' ) ' Number of nodes = ', node_num write ( *, '(a,i4)' ) ' Spatial dimension = ', node_dim write ( *, '(a,i4)' ) ' Number of node attributes = ', & node_att_num write ( *, '(a,i4)' ) ' Number of node markers = ', & node_marker_num c c Get the data. c call triangle_node_data_read ( node_filename, node_num, node_dim, & node_att_num, node_marker_num, node_coord, node_att, & node_marker ) c c Print some of the data. c call r8mat_transpose_print_some ( node_dim, node_num, node_coord, & 1, 1, node_dim, 10, ' Coordinates for first 10 nodes:' ) call r8mat_transpose_print_some ( node_att_num, node_num, & node_att, 1, 1, node_att_num, 10, & ' Attributes for first 10 nodes:' ) call i4mat_transpose_print_some ( node_marker_num, node_num, & node_marker, 1, 1, node_marker_num, 10, & ' Markers for first 10 nodes:' ) return end subroutine test04 ( ) c*********************************************************************72 c cc TEST04 reads the example element data from a file. c c Licensing: c c This code is distributed under the MIT license. c c Modified: c c 10 October 2014 c c Author: c c John Burkardt c implicit none double precision element_att(0,24) integer element_att_num character * ( 255 ) element_filename integer element_node(3,24) integer element_num integer element_order element_filename = 'example.ele' write ( *, '(a)' ) '' write ( *, '(a)' ) 'TEST04:' write ( *, '(a)' ) ' Read element data from an element file.' c c Get data size. c call triangle_element_size_read ( element_filename, element_num, & element_order, element_att_num ) c c Print the sizes. c write ( *, '(a)' ) '' write ( *, '(a)' ) ' Element data read from file "' // & trim ( element_filename ) // '"' write ( *, '(a)' ) '' write ( *, '(a,i4)' ) ' Number of elements = ', element_num write ( *, '(a,i4)' ) ' Element order = ', element_order write ( *, '(a,i4)' ) ' Number of element attributes = ', & element_att_num c c Get the data. c call triangle_element_data_read ( element_filename, element_num, & element_order, element_att_num, element_node, element_att ) c c Print some of the data. c call i4mat_transpose_print_some ( element_order, element_num, & element_node, 1, 1, element_order, 10, & ' Connectivity for first 10 elements:' ) call r8mat_transpose_print_some ( element_att_num, element_num, & element_att, 1, 1, element_att_num, 10, & ' Attributes for first 10 elements:' ) return end