# mode of a data set

 Register Blogs Members List Search Today's Posts Mark Forums Read

 December 17, 2003, 09:54 mode of a data set #1 m malik Guest   Posts: n/a 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.

 December 17, 2003, 14:50 Re: mode of a data set -- fortran pseudocode #2 Ananda Himansu Guest   Posts: n/a ! answer by enumeration, message board reformats my post by weird rules, forces me to use double-line 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

 December 17, 2003, 14:59 Re: mode of a data set #3 Nashat Guest   Posts: n/a Check out Rainald Lohner's book: Applied CFD Techniques: An Introduction Based on Finite Element Methods.

 December 19, 2003, 16:37 Re: mode of a data set -- fortran pseudocode #4 Ananda Himansu Guest   Posts: n/a 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

 December 20, 2003, 10:18 Re: mode of a data set -- fortran pseudocode #5 m malik Guest   Posts: n/a Thanks. I had noticed that in your first mail.

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post Tarak OpenFOAM 6 September 9, 2011 17:51 LWhitson2 Main CFD Forum 3 July 1, 2011 13:50 nicolas CFX 0 August 16, 2006 06:42 jonititan OpenFOAM Installation 4 November 6, 2005 05:16 boling Main CFD Forum 0 November 21, 2003 13:47

All times are GMT -4. The time now is 20:00.