programmer's documentation
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
src
base
cs_part_to_block.h
Go to the documentation of this file.
1
#ifndef __CS_PART_TO_BLOCK_H__
2
#define __CS_PART_TO_BLOCK_H__
3
4
/*============================================================================
5
* Convert between general domain partition and block distribution.
6
*============================================================================*/
7
8
/*
9
This file is part of Code_Saturne, a general-purpose CFD tool.
10
11
Copyright (C) 1998-2013 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
#if defined(HAVE_MPI)
31
#include <mpi.h>
32
#endif
33
34
/*----------------------------------------------------------------------------
35
* Local headers
36
*----------------------------------------------------------------------------*/
37
38
#include "
cs_defs.h
"
39
#include "
cs_block_dist.h
"
40
41
/*----------------------------------------------------------------------------*/
42
43
BEGIN_C_DECLS
44
45
/*=============================================================================
46
* Macro definitions
47
*============================================================================*/
48
49
/*============================================================================
50
* Type definitions
51
*============================================================================*/
52
53
/* Opaque general domain partitioning to block distribution structure */
54
55
#if defined(HAVE_MPI)
56
57
typedef
struct
_cs_part_to_block_t cs_part_to_block_t;
58
59
#endif
60
61
/*=============================================================================
62
* Public function prototypes
63
*============================================================================*/
64
65
#if defined(HAVE_MPI)
66
67
/*----------------------------------------------------------------------------
68
* Initialize partition to block distributor based on global entity numbers.
69
*
70
* arguments:
71
* comm <-- communicator
72
* bi <-- block size and range info
73
* n_ents <-- number of elements in partition
74
* global_ent_num <-- global entity numbers
75
*
76
* returns:
77
* initialized partition to block distributor
78
*----------------------------------------------------------------------------*/
79
80
cs_part_to_block_t *
81
cs_part_to_block_create_by_gnum
(MPI_Comm comm,
82
cs_block_dist_info_t
bi,
83
cs_lnum_t
n_ents,
84
const
cs_gnum_t
global_ent_num[]);
85
86
/*----------------------------------------------------------------------------
87
* Destroy a partition to block distributor structure.
88
*
89
* arguments:
90
* d <-> pointer to partition to block distributor structure pointer
91
*----------------------------------------------------------------------------*/
92
93
void
94
cs_part_to_block_destroy
(cs_part_to_block_t **d);
95
96
/*----------------------------------------------------------------------------
97
* Transfer ownership of global entity numbers to a block distributor.
98
*
99
* The global_ent_num[] array should be the same as the one used
100
* for the creation of the block distributor.
101
*
102
* arguments:
103
* d <-- distributor helper
104
* global_ent_num <-> global entity numbers
105
*----------------------------------------------------------------------------*/
106
107
void
108
cs_part_to_block_transfer_gnum
(cs_part_to_block_t *d,
109
cs_gnum_t
global_ent_num[]);
110
111
/*----------------------------------------------------------------------------
112
* Return number of entities associated with local partition
113
*
114
* arguments:
115
* d <-- distribtor helper
116
*
117
* returns:
118
* number of entities associated with distribution receive
119
*----------------------------------------------------------------------------*/
120
121
cs_lnum_t
122
cs_part_to_block_get_n_part_ents
(cs_part_to_block_t *d);
123
124
/*----------------------------------------------------------------------------
125
* Copy array data from general domain partition to block distribution.
126
*
127
* arguments:
128
* d <-- partition to block distributor
129
* datatype <-- type of data considered
130
* stride <-- number of values per entity (interlaced)
131
* part_values <-- values in general domain partition
132
* block_values --> values in block distribution
133
*----------------------------------------------------------------------------*/
134
135
void
136
cs_part_to_block_copy_array
(cs_part_to_block_t *d,
137
cs_datatype_t
datatype,
138
int
stride,
139
const
void
*part_values,
140
void
*block_values);
141
142
/*----------------------------------------------------------------------------
143
* Copy local index from general domain partition to block distribution.
144
*
145
* This is useful for distribution of entity connectivity information.
146
*
147
* arguments:
148
* d <-- partition to block distributor
149
* part_index <-- local index in general partition distribution
150
* (size: n_part_entities + 1)
151
* block_index --> local index in block distribution
152
* (size: n_block_entities + 1)
153
*----------------------------------------------------------------------------*/
154
155
void
156
cs_part_to_block_copy_index
(cs_part_to_block_t *d,
157
const
cs_lnum_t
*part_index,
158
cs_lnum_t
*block_index);
159
160
/*----------------------------------------------------------------------------
161
* Copy indexed data from general domain partition to block distribution.
162
*
163
* This is useful for distribution of entity connectivity information.
164
*
165
* arguments:
166
* d <-- partition to block distributor
167
* datatype <-- type of data considered
168
* part_index <-- local index in general distribution
169
* part_val <-- numbers in general distribution
170
* (size: part_index[n_part_ents])
171
* block_index --> local index in block distribution
172
* block_val --> values in block distribution
173
* (size: block_index[n_block_ents])
174
*----------------------------------------------------------------------------*/
175
176
void
177
cs_part_to_block_copy_indexed
(cs_part_to_block_t *d,
178
cs_datatype_t
datatype,
179
const
cs_lnum_t
*part_index,
180
const
void
*part_val,
181
const
cs_lnum_t
*block_index,
182
void
*block_val);
183
184
#endif
/* defined(HAVE_MPI) */
185
186
/*----------------------------------------------------------------------------*/
187
188
END_C_DECLS
189
190
#endif
/* __CS_PART_TO_BLOCK_H__ */
Generated on Thu Feb 27 2014 19:21:34 by
1.8.3.1