mode of a data set
Specifically, my problem is finite element mesh related: finding the maximum number of elements that share a common node. I guess it is basically a problem of finding the mode of a large set of numbers. Would like to know of some C/C++/Fortran code for this purpse. Thanks.

Re: mode of a data set  fortran pseudocode
! answer by enumeration, message board reformats my post by weird rules, forces me to use doubleline spacing below
subroutine max_cells_of_nodes (max_cells, num_elements, num_nodes, max_vertices, num_vertices, nodes_of_elements) implicit none ! global variable declarations follow ! global variables except for max_cells are assumed to be assigned values in calling routine before calling current routine integer :: max_cells, num_elements, num_nodes, max_vertices ! (max_vertices = maxval(num_vertices)) integer, dimension(num_elements) :: num_vertices integer, dimension(max_vertices, num_elements) :: nodes_of_elements ! local variable declarations follow integer, dimension(num_nodes) :: num_cells ! num_cells is an auxiliary array to track number of elements incident on each node integer :: element, vertex, this_node do element = 1, num_elements do vertex = 1, num_vertices(element) this_node = nodes_of_elements(vertex, element) num_cells(this_node) = num_cells(this_node)+1 end do end do max_cells = maxval(num_cells) ! max_cells is the maximum number of elements that share a common node end subroutine max_cells_of_nodes 
Re: mode of a data set
Check out Rainald Lohner's book:
Applied CFD Techniques: An Introduction Based on Finite Element Methods. 
Re: mode of a data set  fortran pseudocode
whoops, of course there is a bug in my code :) that's what you get for programming in a hurry and not testing!
i forgot to initialize the num_cells array. the following statement should be inserted just before the "do element = 1, num_elements" loop: num_cells = 0 
Re: mode of a data set  fortran pseudocode
Thanks. I had noticed that in your first mail.

All times are GMT 4. The time now is 07:29. 