TheBoussinesqModel
3.2.1
|
Go to the source code of this file.
Functions | |
int | bubble_sort (LONGVECTOR *v, short print) |
LONGVECTOR * | addresses_bubble_sort (LONGVECTOR *v, short print) |
int | bubble_sort_matrix (LONGVECTOR *v, LONGMATRIX *m, short print) |
LONGVECTOR* addresses_bubble_sort | ( | LONGVECTOR * | v, |
short | |||
) |
v | (LONGVECTOR *) - vector to be sorted |
it makes a bubble sort of the vector v (see the pseudo-code on http://en.wikipedia.org/wiki/Bubble_sort#Pseudocode_implementation )
swap v->element[i] and v->element[i+1]
swap v->element[i] and v->element[i+1]
Definition at line 88 of file sorting.c.
References new_longvector(), LONGVECTOR::nh, LONGVECTOR::nl, and print_longvector_elements().
Referenced by bubble_sort_matrix().
int bubble_sort | ( | LONGVECTOR * | v, |
short | |||
) |
BGEOMETRY BUILDS THE MESH FROM A RASTER FOR THE BOUSSINESQ MODEL
BGEOMETRY Version 0.9375 KMackenzie
file sorting.c
Copyright, 2009 Emanuele Cordano and Riccardo Rigon
This file is part of BGEOMETRY. BGEOMETRY is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
BGEOMETRY is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
int swap(long a, long b) {
long | a,b two (long) integer numbers |
long mk; if (a>b) { mk=a; a=b; b=mk; return 0; } else { return 1; } return 0;
v | (LONGVECTOR *) - vector to be sorted |
it makes a bubble sort of the vector v (see the pseudo-code on http://en.wikipedia.org/wiki/Bubble_sort#Pseudocode_implementation )
swap v->element[i] and v->element[i+1]
Definition at line 52 of file sorting.c.
References LONGVECTOR::nh, LONGVECTOR::nl, and print_longvector_elements().
int bubble_sort_matrix | ( | LONGVECTOR * | v, |
LONGMATRIX * | m, | ||
short | |||
) |
v | (LONGVECTOR *) - vector to be sorted |
M | (LONGMATRIX *) - matrix |
(short) |
It sorts v and then replace
Definition at line 145 of file sorting.c.
References addresses_bubble_sort(), LONGMATRIX::ncl, LONGVECTOR::nh, LONGMATRIX::nrh, and LONGMATRIX::nrl.