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

« back to all changes in this revision

Viewing changes to src/base/cs_numbering.h

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2011-11-01 17:43:32 UTC
  • mto: (6.1.7 sid)
  • mto: This revision was merged to the branch mainline in revision 11.
  • Revision ID: package-import@ubuntu.com-20111101174332-tl4vk45no0x3emc3
Tags: upstream-2.1.0
ImportĀ upstreamĀ versionĀ 2.1.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef __CS_NUMBERING_H__
 
2
#define __CS_NUMBERING_H__
 
3
 
 
4
/*============================================================================
 
5
 * Numbering information for vectorization or multithreading
 
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
/* Renumbering types */
 
55
 
 
56
typedef enum {
 
57
 
 
58
  CS_NUMBERING_VECTORIZE,  /* Numbered for vectorization */
 
59
  CS_NUMBERING_THREADS     /* Numbered for threads */
 
60
 
 
61
} cs_numbering_type_t;
 
62
 
 
63
/* Renumbering structure */
 
64
 
 
65
typedef struct {
 
66
 
 
67
  cs_numbering_type_t   type; /* Numbering type */
 
68
 
 
69
  int   vector_size;          /* Vector size if vectorized, 1 otherwise */
 
70
 
 
71
  int   n_threads;            /* Number of threads */
 
72
  int   n_groups;             /* Number of associated groups */
 
73
 
 
74
  fvm_lnum_t *group_index;   /* For thread t and group g, the start and end
 
75
                                ids for entities in a given group and thread
 
76
                                are group_index[t*n_groups*2 + g] and
 
77
                                group_index[t*n_groups*2 + g + 1] respectively.
 
78
                                (size: n_groups * n_threads * 2) */
 
79
 
 
80
} cs_numbering_t;
 
81
 
 
82
/*=============================================================================
 
83
 * Global variable definitions
 
84
 *============================================================================*/
 
85
 
 
86
/* Names for numbering types */
 
87
 
 
88
extern const char  *cs_numbering_type_name[];
 
89
 
 
90
/*============================================================================
 
91
 * Public function prototypes for Fortran API
 
92
 *============================================================================*/
 
93
 
 
94
/*=============================================================================
 
95
 * Public function prototypes
 
96
 *============================================================================*/
 
97
 
 
98
/*----------------------------------------------------------------------------
 
99
 * Create a numbering information structure in case of vectorization.
 
100
 *
 
101
 * parameters:
 
102
 *   vector_size <-- vector size used for this vectorization
 
103
 *
 
104
 * returns:
 
105
 *   pointer to created cs_numbering_t structure
 
106
 *---------------------------------------------------------------------------*/
 
107
 
 
108
cs_numbering_t *
 
109
cs_numbering_create_vectorized(int  vector_size);
 
110
 
 
111
/*----------------------------------------------------------------------------
 
112
 * Create a numbering information structure in case of threading.
 
113
 *
 
114
 * parameters:
 
115
 *   n_threads   <-- number of threads
 
116
 *   n_groups    <-- number of groups
 
117
 *   group_index <-- group_index[thread_id*group_id*2 + group_id*2] and
 
118
 *                   group_index[thread_id*group_id*2 + group_id*2 +1] define
 
119
 *                   the start and end ids for entities in a given group and
 
120
 *                   thread; (size: n_groups *2 * n_threads)
 
121
 *
 
122
 * returns:
 
123
 *   pointer to created cs_numbering_t structure
 
124
 *---------------------------------------------------------------------------*/
 
125
 
 
126
cs_numbering_t *
 
127
cs_numbering_create_threaded(int         n_threads,
 
128
                             int         n_groups,
 
129
                             fvm_lnum_t  group_index[]);
 
130
 
 
131
/*----------------------------------------------------------------------------
 
132
 * Destroy a numbering information structure.
 
133
 *
 
134
 * parameters:
 
135
 *   numbering <-> pointer to cs_numbering_t structure pointer (or NULL)
 
136
 *---------------------------------------------------------------------------*/
 
137
 
 
138
void
 
139
cs_numbering_destroy(cs_numbering_t  **numbering);
 
140
 
 
141
/*----------------------------------------------------------------------------
 
142
 * Dump a cs_numbering_t structure.
 
143
 *
 
144
 * parameters:
 
145
 *   numbering <-- pointer to cs_numbering_t structure (or NULL)
 
146
 *---------------------------------------------------------------------------*/
 
147
 
 
148
void
 
149
cs_numbering_dump(const cs_numbering_t  *numbering);
 
150
 
 
151
/*----------------------------------------------------------------------------*/
 
152
 
 
153
END_C_DECLS
 
154
 
 
155
#endif /* __CS_NUMBERING_H__ */