1
#ifndef __CS_SEARCH_H__
2
#define __CS_SEARCH_H__
4
/*============================================================================
5
* Search elements in arrays
6
*===========================================================================*/
9
This file is part of Code_Saturne, a general-purpose CFD tool.
11
Copyright (C) 1998-2011 EDF S.A.
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
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
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.
28
/*----------------------------------------------------------------------------*/
30
/*----------------------------------------------------------------------------
32
*---------------------------------------------------------------------------*/
36
/*----------------------------------------------------------------------------
38
*---------------------------------------------------------------------------*/
42
/*---------------------------------------------------------------------------*/
46
/*============================================================================
47
* Macro and type definitions
48
*===========================================================================*/
50
/*============================================================================
51
* Public function prototypes
52
*===========================================================================*/
54
/*----------------------------------------------------------------------------
55
* Get the position inside an array related to a value thanks to a binary
56
* search. Array or list must be ordered.
59
* size <-- size of list
60
* gnum <-- find index for this number
61
* lst <-- list of ordered global numbers to scan
64
* id associated to the current number. If not found, returned -1.
65
*---------------------------------------------------------------------------*/
68
cs_search_g_binary(size_t size,
70
const fvm_gnum_t lst[]);
72
/*----------------------------------------------------------------------------
73
* Get the position inside an array related to a value thanks to a binary
74
* search (binary search). Array or list must be ordered.
77
* size <-- size of list
78
* num <-- find index for this number
79
* lst <-- list of ordered numbers to scan
82
* id associated to the current number. If not found, return -1.
83
*---------------------------------------------------------------------------*/
86
cs_search_binary(size_t size,
88
const cs_int_t lst[]);
90
/*----------------------------------------------------------------------------
91
* Get the position inside an array related to a value thanks to a binary
92
* search (binary search). Index must be ordered and without null range.
95
* size <-- size of index -1
96
* gnum <-- number for which we want the position in index
97
* index <-- index array
100
* id in index of gnum. If not found, returned -1.
101
*---------------------------------------------------------------------------*/
104
cs_search_gindex_binary(size_t size,
106
const fvm_gnum_t index[]);
108
/*---------------------------------------------------------------------------*/
112
#endif /* __CS_SEARCH_H__ */