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

« back to all changes in this revision

Viewing changes to src/base/cs_map.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_MAP_H__
 
2
#define __CS_MAP_H__
 
3
 
 
4
/*============================================================================
 
5
 * Map helper structures
 
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
 *  Local headers
 
32
 *----------------------------------------------------------------------------*/
 
33
 
 
34
#include "cs_base.h"
 
35
 
 
36
/*----------------------------------------------------------------------------*/
 
37
 
 
38
BEGIN_C_DECLS
 
39
 
 
40
/*============================================================================
 
41
 * Macro definitions
 
42
 *============================================================================*/
 
43
 
 
44
/*============================================================================
 
45
 * Type definitions
 
46
 *============================================================================*/
 
47
 
 
48
typedef struct _cs_map_name_to_id_t  cs_map_name_to_id_t;
 
49
 
 
50
/*============================================================================
 
51
 *  Global variables
 
52
 *============================================================================*/
 
53
 
 
54
/*=============================================================================
 
55
 * Public function prototypes for Fortran API
 
56
 *============================================================================*/
 
57
 
 
58
/*=============================================================================
 
59
 * Public function prototypes
 
60
 *============================================================================*/
 
61
 
 
62
/*----------------------------------------------------------------------------
 
63
 * Create empty name to id map.
 
64
 *
 
65
 * returns:
 
66
 *   pointer to newly initialized map structure.
 
67
 *----------------------------------------------------------------------------*/
 
68
 
 
69
cs_map_name_to_id_t *
 
70
cs_map_name_to_id_create(void);
 
71
 
 
72
/*----------------------------------------------------------------------------
 
73
 * Destroy name to id map structure.
 
74
 *
 
75
 * parameters:
 
76
 *   m <-> pointer to map structure.
 
77
 *----------------------------------------------------------------------------*/
 
78
 
 
79
void
 
80
cs_map_name_to_id_destroy(cs_map_name_to_id_t **m);
 
81
 
 
82
/*----------------------------------------------------------------------------
 
83
 * Find id matching a key, inserting key if not already present.
 
84
 *
 
85
 * parameters:
 
86
 *   m     <-> pointer to map structure
 
87
 *   key   <-- character string (key)
 
88
 *
 
89
 * returns:
 
90
 *   id matching key (already present or newly inserted)
 
91
 *----------------------------------------------------------------------------*/
 
92
 
 
93
int
 
94
cs_map_name_to_id(cs_map_name_to_id_t  *m,
 
95
                  const char           *key);
 
96
 
 
97
/*----------------------------------------------------------------------------
 
98
 * Return the size of a map.
 
99
 *
 
100
 * parameters:
 
101
 *   m <-- pointer to map structure.
 
102
 *
 
103
 * returns:
 
104
 *   number of entries in map.
 
105
 *----------------------------------------------------------------------------*/
 
106
 
 
107
size_t
 
108
cs_map_name_to_id_size(const cs_map_name_to_id_t *m);
 
109
 
 
110
/*----------------------------------------------------------------------------
 
111
 * Return a given key in a map.
 
112
 *
 
113
 * parameters:
 
114
 *   m  <-- pointer to map structure.
 
115
 *   id <-- key id
 
116
 *
 
117
 * returns:
 
118
 *   pointer to key.
 
119
 *----------------------------------------------------------------------------*/
 
120
 
 
121
const char *
 
122
cs_map_name_to_id_key(const cs_map_name_to_id_t  *m,
 
123
                      size_t                      id);
 
124
 
 
125
/*----------------------------------------------------------------------------*/
 
126
 
 
127
END_C_DECLS
 
128
 
 
129
#endif /* __CS_MAP_H__ */