~ubuntu-branches/ubuntu/precise/code-saturne/precise

« back to all changes in this revision

Viewing changes to src/base/cs_sort.h

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2011-11-24 00:00:08 UTC
  • mfrom: (6.1.9 sid)
  • Revision ID: package-import@ubuntu.com-20111124000008-2vo99e38267942q5
Tags: 2.1.0-3
Install a missing file

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef __CS_SORT_H__
 
2
#define __CS_SORT_H__
 
3
 
 
4
/*============================================================================
 
5
 * Functions related to in-place sorting of arrays.
 
6
 *===========================================================================*/
 
7
 
 
8
/*
 
9
  This file is part of Code_Saturne, a general-purpose CFD tool.
 
10
 
 
11
  Copyright (C) 1998-2011 EDF S.A.
 
12
 
 
13
  This program is free software; you can redistribute it and/or modify it under
 
14
  the terms of the GNU General Public License as published by the Free Software
 
15
  Foundation; either version 2 of the License, or (at your option) any later
 
16
  version.
 
17
 
 
18
  This program is distributed in the hope that it will be useful, but WITHOUT
 
19
  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 
20
  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
 
21
  details.
 
22
 
 
23
  You should have received a copy of the GNU General Public License along with
 
24
  this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
 
25
  Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
26
*/
 
27
 
 
28
/*----------------------------------------------------------------------------*/
 
29
 
 
30
/*----------------------------------------------------------------------------
 
31
 * FVM library headers
 
32
 *---------------------------------------------------------------------------*/
 
33
 
 
34
#include <fvm_defs.h>
 
35
 
 
36
/*----------------------------------------------------------------------------
 
37
 *  Local headers
 
38
 *---------------------------------------------------------------------------*/
 
39
 
 
40
#include "cs_base.h"
 
41
 
 
42
/*---------------------------------------------------------------------------*/
 
43
 
 
44
BEGIN_C_DECLS
 
45
 
 
46
/*=============================================================================
 
47
 * Macro definitions
 
48
 *===========================================================================*/
 
49
 
 
50
/*============================================================================
 
51
 * Type definitions
 
52
 *===========================================================================*/
 
53
 
 
54
/*=============================================================================
 
55
 * Static global variables
 
56
 *===========================================================================*/
 
57
 
 
58
/*=============================================================================
 
59
 * Public function prototypes
 
60
 *===========================================================================*/
 
61
 
 
62
/*----------------------------------------------------------------------------
 
63
 * Sort an array "a" between its left bound "l" and its right bound "r"
 
64
 * thanks to a shell sort (Knuth algorithm).
 
65
 *
 
66
 * parameters:
 
67
 *   l <-- left bound
 
68
 *   r <-- right bound
 
69
 *   a <-> array to sort
 
70
 *---------------------------------------------------------------------------*/
 
71
 
 
72
void
 
73
cs_sort_shell(cs_int_t  l,
 
74
              cs_int_t  r,
 
75
              cs_int_t  a[]);
 
76
 
 
77
/*----------------------------------------------------------------------------
 
78
 * Sort a global array "a" between its left bound "l" and its right bound "r"
 
79
 * thanks to a shell sort (Knuth algorithm).
 
80
 *
 
81
 * parameters:
 
82
 *   l <-- left bound
 
83
 *   r <-- right bound
 
84
 *   a <-> array to sort
 
85
 *---------------------------------------------------------------------------*/
 
86
 
 
87
void
 
88
cs_sort_gnum_shell(cs_int_t    l,
 
89
                   cs_int_t    r,
 
90
                   fvm_gnum_t  a[]);
 
91
 
 
92
/*----------------------------------------------------------------------------
 
93
 * Sort an array "a" and apply the sort to its associated array "b" (local
 
94
 * numbering)
 
95
 * Sort is realized thanks to a shell sort (Knuth algorithm).
 
96
 *
 
97
 * parameters:
 
98
 *   l     -->   left bound
 
99
 *   r     -->   right bound
 
100
 *   a     <->   array to sort
 
101
 *   b     <->   associated array
 
102
 *---------------------------------------------------------------------------*/
 
103
 
 
104
void
 
105
cs_sort_coupled_shell(cs_int_t   l,
 
106
                      cs_int_t   r,
 
107
                      cs_int_t   a[],
 
108
                      cs_int_t   b[]);
 
109
 
 
110
/*----------------------------------------------------------------------------
 
111
 * Sort an array "a" and apply the sort to its associated array "b" (local
 
112
 * numbering)
 
113
 * Sort is realized thanks to a shell sort (Knuth algorithm).
 
114
 *
 
115
 * parameters:
 
116
 *   l     -->   left bound
 
117
 *   r     -->   right bound
 
118
 *   a     <->   array to sort
 
119
 *   b     <->   associated array
 
120
 *---------------------------------------------------------------------------*/
 
121
 
 
122
void
 
123
cs_sort_coupled_gnum_shell(cs_int_t     l,
 
124
                           cs_int_t     r,
 
125
                           fvm_gnum_t   a[],
 
126
                           fvm_gnum_t   b[]);
 
127
 
 
128
/*---------------------------------------------------------------------------*/
 
129
 
 
130
END_C_DECLS
 
131
 
 
132
#endif /* __CS_SORT_H__ */