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

« back to all changes in this revision

Viewing changes to src/base/cs_coupling.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_COUPLING_H__
 
2
#define __CS_COUPLING_H__
 
3
 
 
4
/*============================================================================
 
5
 * Common functionnality for various coupling types.
 
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
 * Standard C library headers
 
32
 *----------------------------------------------------------------------------*/
 
33
 
 
34
/*----------------------------------------------------------------------------
 
35
 * PLE library headers
 
36
 *----------------------------------------------------------------------------*/
 
37
 
 
38
#include <ple_coupling.h>
 
39
 
 
40
/*----------------------------------------------------------------------------
 
41
 *  Local headers
 
42
 *----------------------------------------------------------------------------*/
 
43
 
 
44
#include "cs_base.h"
 
45
 
 
46
/*----------------------------------------------------------------------------*/
 
47
 
 
48
BEGIN_C_DECLS
 
49
 
 
50
/*=============================================================================
 
51
 * Macro definitions
 
52
 *============================================================================*/
 
53
 
 
54
/*============================================================================
 
55
 * Type definitions
 
56
 *============================================================================*/
 
57
 
 
58
/*=============================================================================
 
59
 * Global variable definitions
 
60
 *============================================================================*/
 
61
 
 
62
/*============================================================================
 
63
 * Public function prototypes for Fortran API
 
64
 *============================================================================*/
 
65
 
 
66
/*----------------------------------------------------------------------------
 
67
 * Synchronize with applications in the same PLE coupling group.
 
68
 *
 
69
 * This function should be called before starting a new time step. The
 
70
 * current time step id is that of the last finished time step, or 0 at
 
71
 * initialization.
 
72
 *
 
73
 * Fortran Interface:
 
74
 *
 
75
 * subroutine cplsyn (ntcmabs, ntcabs, dtref)
 
76
 * *****************
 
77
 *
 
78
 * integer          ntmabs      : <-> : maximum iteration number
 
79
 * integer          ntcabs      : <-- : current iteration number
 
80
 * double precision dtref       : <-> : reference time step value
 
81
 *----------------------------------------------------------------------------*/
 
82
 
 
83
void CS_PROCF(cplsyn, CPLSYN)
 
84
(
 
85
 cs_int_t         *ntmabs,
 
86
 const cs_int_t   *ntcabs,
 
87
 cs_real_t        *dtref
 
88
 );
 
89
 
 
90
/*============================================================================
 
91
 * Public function prototypes
 
92
 *============================================================================*/
 
93
 
 
94
#if defined(HAVE_MPI)
 
95
 
 
96
/*----------------------------------------------------------------------------
 
97
 * Discover other applications in the same MPI root communicator.
 
98
 *
 
99
 * parameters:
 
100
 *   app_name <-- name of this instance of Code_Saturne.
 
101
 *----------------------------------------------------------------------------*/
 
102
 
 
103
void
 
104
cs_coupling_discover_mpi_apps(const char  *app_name);
 
105
 
 
106
/*----------------------------------------------------------------------------
 
107
 * Finalize MPI coupling helper structures.
 
108
 *----------------------------------------------------------------------------*/
 
109
 
 
110
void
 
111
cs_coupling_finalize(void);
 
112
 
 
113
/*----------------------------------------------------------------------------
 
114
 * Return info on other applications in the same MPI root communicator.
 
115
 *
 
116
 * returns:
 
117
 *   info on other applications structure.
 
118
 *----------------------------------------------------------------------------*/
 
119
 
 
120
const ple_coupling_mpi_set_t *
 
121
cs_coupling_get_mpi_apps(void);
 
122
 
 
123
#endif /* HAVE_MPI */
 
124
 
 
125
/*----------------------------------------------------------------------------
 
126
 * Synchronize with applications in the same PLE coupling group.
 
127
 *
 
128
 * This function should be called before starting a new time step. The
 
129
 * current time step id is that of the last finished time step, or 0 at
 
130
 * initialization.
 
131
 *
 
132
 * Default synchronization flags indicating a new iteration or end of
 
133
 * calculation are set automatically, but the user may set additional flags
 
134
 * to this function if necessary.
 
135
 *
 
136
 * parameters:
 
137
 *   flags         <-- optional additional synchronization flags
 
138
 *   current_ts_id <-- current time step id
 
139
 *   max_ts_id     <-> maximum time step id
 
140
 *   ts            <-> suggested time step value
 
141
 *----------------------------------------------------------------------------*/
 
142
 
 
143
void
 
144
cs_coupling_sync_apps(int      flags,
 
145
                      int      current_ts_id,
 
146
                      int     *max_ts_id,
 
147
                      double  *ts);
 
148
 
 
149
/*----------------------------------------------------------------------------
 
150
 * Compute extents of a mesh representation
 
151
 *
 
152
 * parameters:
 
153
 *   mesh          <-- pointer to mesh representation structure
 
154
 *   n_max_extents <-- maximum number of sub-extents (such as element extents)
 
155
 *                     to compute, or -1 to query
 
156
 *   tolerance     <-- addition to local extents of each element:
 
157
 *                     extent = base_extent * (1 + tolerance)
 
158
 *   extents       <-> extents associated with mesh:
 
159
 *                     x_min, y_min, ..., x_max, y_max, ... (size: 2*dim)
 
160
 *
 
161
 * returns:
 
162
 *   the number of extents computed
 
163
 *----------------------------------------------------------------------------*/
 
164
 
 
165
ple_lnum_t
 
166
cs_coupling_mesh_extents(const void  *mesh,
 
167
                         ple_lnum_t   n_max_extents,
 
168
                         double       tolerance,
 
169
                         double       extents[]);
 
170
 
 
171
/*----------------------------------------------------------------------------
 
172
 * Find elements in a given mesh containing points: updates the
 
173
 * location[] and distance[] arrays associated with a set of points
 
174
 * for points that are in an element of this mesh, or closer to one
 
175
 * than to previously encountered elements.
 
176
 *
 
177
 * Location is relative to the id of a given element + 1 in
 
178
 * concatenated sections of same element dimension.
 
179
 *
 
180
 * parameters:
 
181
 *   mesh         <-- pointer to mesh representation structure
 
182
 *   tolerance    <-- associated tolerance
 
183
 *   n_points     <-- number of points to locate
 
184
 *   point_coords <-- point coordinates
 
185
 *   location     <-> number of element containing or closest to each
 
186
 *                    point (size: n_points)
 
187
 *   distance     <-> distance from point to element indicated by
 
188
 *                    location[]: < 0 if unlocated, 0 - 1 if inside,
 
189
 *                    and > 1 if outside a volume element, or absolute
 
190
 *                    distance to a surface element (size: n_points)
 
191
 *----------------------------------------------------------------------------*/
 
192
 
 
193
void
 
194
cs_coupling_point_in_mesh(const void         *mesh,
 
195
                          double              tolerance,
 
196
                          ple_lnum_t          n_points,
 
197
                          const ple_coord_t   point_coords[],
 
198
                          ple_lnum_t          location[],
 
199
                          float               distance[]);
 
200
 
 
201
/*----------------------------------------------------------------------------
 
202
 * Find elements in a given mesh containing points: updates the
 
203
 * location[] and distance[] arrays associated with a set of points
 
204
 * for points that are in an element of this mesh, or closer to one
 
205
 * than to previously encountered elements.
 
206
 *
 
207
 * Location is relative to parent element numbers.
 
208
 *
 
209
 * parameters:
 
210
 *   mesh         <-- pointer to mesh representation structure
 
211
 *   tolerance    <-- associated tolerance
 
212
 *   n_points     <-- number of points to locate
 
213
 *   point_coords <-- point coordinates
 
214
 *   location     <-> number of element containing or closest to each
 
215
 *                    point (size: n_points)
 
216
 *   distance     <-> distance from point to element indicated by
 
217
 *                    location[]: < 0 if unlocated, 0 - 1 if inside,
 
218
 *                    and > 1 if outside a volume element, or absolute
 
219
 *                    distance to a surface element (size: n_points)
 
220
 *----------------------------------------------------------------------------*/
 
221
 
 
222
void
 
223
cs_coupling_point_in_mesh_p(const void         *mesh,
 
224
                            double              tolerance,
 
225
                            ple_lnum_t          n_points,
 
226
                            const ple_coord_t   point_coords[],
 
227
                            ple_lnum_t          location[],
 
228
                            float               distance[]);
 
229
 
 
230
/*----------------------------------------------------------------------------
 
231
 * Find elements in a given mesh closest to points: updates the
 
232
 * location[] and distance[] arrays associated with a set of points
 
233
 * for points that are closer to an element of this mesh than to previously
 
234
 * encountered elements.
 
235
 *
 
236
 * This function currently only handles elements of lower dimension than
 
237
 * the spatial dimension.
 
238
 *
 
239
 * Location is relative to the id of a given element + 1 in
 
240
 * concatenated sections of same element dimension.
 
241
 *
 
242
 * parameters:
 
243
 *   mesh         <-- pointer to mesh representation structure
 
244
 *   n_points     <-- number of points to locate
 
245
 *   point_coords <-- point coordinates
 
246
 *   location     <-> number of element containing or closest to each
 
247
 *                    point (size: n_points)
 
248
 *   distance     <-> distance from point to element indicated by
 
249
 *                    location[]: < 0 if unlocated, or absolute
 
250
 *                    distance to a surface element (size: n_points)
 
251
 *----------------------------------------------------------------------------*/
 
252
 
 
253
void
 
254
cs_coupling_point_closest_mesh(const void         *mesh,
 
255
                               ple_lnum_t          n_points,
 
256
                               const ple_coord_t   point_coords[],
 
257
                               ple_lnum_t          location[],
 
258
                               float               distance[]);
 
259
 
 
260
/*----------------------------------------------------------------------------
 
261
 * Find elements in a given mesh closest to points: updates the
 
262
 * location[] and distance[] arrays associated with a set of points
 
263
 * for points that are closer to an element of this mesh than to previously
 
264
 * encountered elements.
 
265
 *
 
266
 * This function currently only handles elements of lower dimension than
 
267
 * the spatial dimension.
 
268
 *
 
269
 * Location is relative to parent element numbers.
 
270
 *
 
271
 * parameters:
 
272
 *   mesh         <-- pointer to mesh representation structure
 
273
 *   n_points     <-- number of points to locate
 
274
 *   point_coords <-- point coordinates
 
275
 *   location     <-> number of element containing or closest to each
 
276
 *                    point (size: n_points)
 
277
 *   distance     <-> distance from point to element indicated by
 
278
 *                    location[]: < 0 if unlocated, or absolute
 
279
 *                    distance to a surface element (size: n_points)
 
280
 *----------------------------------------------------------------------------*/
 
281
 
 
282
void
 
283
cs_coupling_point_closest_mesh_p(const void         *mesh,
 
284
                                 ple_lnum_t          n_points,
 
285
                                 const ple_coord_t   point_coords[],
 
286
                                 ple_lnum_t          location[],
 
287
                                 float               distance[]);
 
288
 
 
289
/*----------------------------------------------------------------------------*/
 
290
 
 
291
END_C_DECLS
 
292
 
 
293
#endif /* __CS_COUPLING_H__ */