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

« back to all changes in this revision

Viewing changes to include/base/cs_join_perio.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
 
/*============================================================================
2
 
 *
3
 
 *     This file is part of the Code_Saturne Kernel, element of the
4
 
 *     Code_Saturne CFD tool.
5
 
 *
6
 
 *     Copyright (C) 2008-2010 EDF S.A., France
7
 
 *
8
 
 *     contact: saturne-support@edf.fr
9
 
 *
10
 
 *     The Code_Saturne Kernel is free software; you can redistribute it
11
 
 *     and/or modify it under the terms of the GNU General Public License
12
 
 *     as published by the Free Software Foundation; either version 2 of
13
 
 *     the License, or (at your option) any later version.
14
 
 *
15
 
 *     The Code_Saturne Kernel is distributed in the hope that it will be
16
 
 *     useful, but WITHOUT ANY WARRANTY; without even the implied warranty
17
 
 *     of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
 
 *     GNU General Public License for more details.
19
 
 *
20
 
 *     You should have received a copy of the GNU General Public License
21
 
 *     along with the Code_Saturne Kernel; if not, write to the
22
 
 *     Free Software Foundation, Inc.,
23
 
 *     51 Franklin St, Fifth Floor,
24
 
 *     Boston, MA  02110-1301  USA
25
 
 *
26
 
 *============================================================================*/
27
 
 
28
 
#ifndef __CS_JOIN_PERIO_H__
29
 
#define __CS_JOIN_PERIO_H__
30
 
 
31
 
/*============================================================================
32
 
 * Structure and function headers handling with periodicity for joining
33
 
 * operations
34
 
 *===========================================================================*/
35
 
 
36
 
/*----------------------------------------------------------------------------
37
 
 * FVM library headers
38
 
 *---------------------------------------------------------------------------*/
39
 
 
40
 
/*----------------------------------------------------------------------------
41
 
 *  Local headers
42
 
 *---------------------------------------------------------------------------*/
43
 
 
44
 
#include "cs_base.h"
45
 
#include "cs_mesh.h"
46
 
#include "cs_join_set.h"
47
 
#include "cs_join_util.h"
48
 
#include "cs_join_mesh.h"
49
 
 
50
 
/*---------------------------------------------------------------------------*/
51
 
 
52
 
BEGIN_C_DECLS
53
 
 
54
 
/*============================================================================
55
 
 * Local Macro definitions
56
 
 *===========================================================================*/
57
 
 
58
 
/*=============================================================================
59
 
 * Global variables
60
 
 *===========================================================================*/
61
 
 
62
 
extern int  cs_glob_n_join_perio;   /* Number of periodicity defined through
63
 
                                       a joining operation */
64
 
 
65
 
/*============================================================================
66
 
 *  Public function prototypes for Fortran API
67
 
 *============================================================================*/
68
 
 
69
 
/*----------------------------------------------------------------------------
70
 
 * Get the number of periodic transformations already defined
71
 
 *
72
 
 * Fortran Interface:
73
 
 *
74
 
 * SUBROUTINE NUMPER
75
 
 * *****************
76
 
 *
77
 
 * INTEGER   numper      : --> : number of periodicities  op. already defined
78
 
 *----------------------------------------------------------------------------*/
79
 
 
80
 
void CS_PROCF(numper, NUMPER)
81
 
(
82
 
 cs_int_t    *numper
83
 
);
84
 
 
85
 
/*----------------------------------------------------------------------------
86
 
 * Define a translation
87
 
 *
88
 
 * Fortran Interface:
89
 
 *
90
 
 * SUBROUTINE DEFPT1
91
 
 * *****************
92
 
 *
93
 
 * INTEGER        numper    : <-- : number related to the periodic op.
94
 
 * CHARACTER*     criteria  : <-- : boundary face selection criteria
95
 
 * REAL           fraction  : <-- : parameter for merging vertices
96
 
 * REAL           plane     : <-- : parameter for splitting faces
97
 
 * INTEGER        verbosity : <-- : verbosity level
98
 
 * REAL           tx        : <-- : X coordinate of the translation vector
99
 
 * REAL           ty        : <-- : Y coordinate of the translation vector
100
 
 * REAL           tz        : <-- : Z coordinate of the translation vector
101
 
 * INTEGER        crit_len  : <-- : length of criteria
102
 
 *----------------------------------------------------------------------------*/
103
 
 
104
 
void CS_PROCF(defpt1, DEFPT1)
105
 
(
106
 
 cs_int_t    *numper,
107
 
 const char  *criteria,
108
 
 cs_real_t   *fraction,
109
 
 cs_real_t   *plane,
110
 
 cs_int_t    *verbosity,
111
 
 cs_real_t   *tx,
112
 
 cs_real_t   *ty,
113
 
 cs_real_t   *tz,
114
 
 cs_int_t    *crit_len
115
 
 CS_ARGF_SUPP_CHAINE
116
 
);
117
 
 
118
 
/*----------------------------------------------------------------------------
119
 
 * Define a rotation
120
 
 *
121
 
 * Fortran Interface:
122
 
 *
123
 
 * SUBROUTINE DEFPR1
124
 
 * *****************
125
 
 *
126
 
 * INTEGER        numper    : <-- : number related to the periodic op.
127
 
 * CHARACTER*     criteria : <-- : boundary face selection criteria
128
 
 * REAL           fraction  : <-- : parameter for merging vertices
129
 
 * REAL           plane     : <-- : parameter for splitting faces
130
 
 * INTEGER        verbosity : <-- : verbosity level
131
 
 * REAL           ax       : <-- : X coordinate of the rotation axis
132
 
 * REAL           ay       : <-- : Y coordinate of the rotation axis
133
 
 * REAL           az       : <-- : Z coordinate of the rotation axis
134
 
 * REAL           theta    : <-- : angle of the rotation (radian)
135
 
 * REAL           ix       : <-- : X coordinate of the invariant point
136
 
 * REAL           iy       : <-- : Y coordinate of the invariant point
137
 
 * REAL           iz       : <-- : Z coordinate of the invariant point
138
 
 * INTEGER        crit_len : <-- : length of criteria string
139
 
 *----------------------------------------------------------------------------*/
140
 
 
141
 
void CS_PROCF(defpr1, DEFPR1)
142
 
(
143
 
 cs_int_t    *numper,
144
 
 const char  *criteria,
145
 
 cs_real_t   *fraction,
146
 
 cs_real_t   *plane,
147
 
 cs_int_t    *verbosity,
148
 
 cs_real_t   *ax,
149
 
 cs_real_t   *ay,
150
 
 cs_real_t   *az,
151
 
 cs_real_t   *theta,
152
 
 cs_real_t   *ix,
153
 
 cs_real_t   *iy,
154
 
 cs_real_t   *iz,
155
 
 cs_int_t    *crit_len
156
 
 CS_ARGF_SUPP_CHAINE
157
 
);
158
 
 
159
 
/*----------------------------------------------------------------------------
160
 
 * Define a general transformation through a homogeneous matrix (4x4)
161
 
 *     _               _
162
 
 *    | r11 r12 r13 tx  |  t(x,y,z) : translation vector
163
 
 *    | r21 r22 r23 ty  |  r(i,j)   : rotation matrix
164
 
 *    | r31 r32 r33 tz  |
165
 
 *    |_  0   0   0  1 _|
166
 
 *
167
 
 * Fortran Interface:
168
 
 *
169
 
 * SUBROUTINE DEFPG1
170
 
 * *****************
171
 
 *
172
 
 * INTEGER        numper    : <-- : number related to the periodic op.
173
 
 * CHARACTER*     criteria  : <-- : boundary face selection criteria
174
 
 * REAL           fraction  : <-- : parameter for merging vertices
175
 
 * REAL           plane     : <-- : parameter for splitting faces
176
 
 * INTEGER        verbosity : <-- : verbosity level
177
 
 * REAL           r11       : <-- : coef. (1,1) of the homogeneous matrix
178
 
 * REAL           r12       : <-- : coef. (1,2) of the homogeneous matrix
179
 
 * REAL           r13       : <-- : coef. (1,3) of the homogeneous matrix
180
 
 * REAL           tx        : <-- : coef. (1,4) of the homogeneous matrix
181
 
 * REAL           r21       : <-- : coef. (2,1) of the homogeneous matrix
182
 
 * REAL           r22       : <-- : coef. (2,2) of the homogeneous matrix
183
 
 * REAL           r23       : <-- : coef. (2,3) of the homogeneous matrix
184
 
 * REAL           ty        : <-- : coef. (2,4) of the homogeneous matrix
185
 
 * REAL           r31       : <-- : coef. (3,1) of the homogeneous matrix
186
 
 * REAL           r32       : <-- : coef. (3,2) of the homogeneous matrix
187
 
 * REAL           r33       : <-- : coef. (3,3) of the homogeneous matrix
188
 
 * REAL           tz        : <-- : coef. (3,4) of the homogeneous matrix
189
 
 * INTEGER        crit_len  : <-- : length of criteria string
190
 
 *----------------------------------------------------------------------------*/
191
 
 
192
 
void CS_PROCF(defpg1, DEFPG1)
193
 
(
194
 
 cs_int_t    *numper,
195
 
 const char  *criteria,
196
 
 cs_real_t   *fraction,
197
 
 cs_real_t   *plane,
198
 
 cs_int_t    *verbosity,
199
 
 cs_real_t   *r11,
200
 
 cs_real_t   *r12,
201
 
 cs_real_t   *r13,
202
 
 cs_real_t   *tx,
203
 
 cs_real_t   *r21,
204
 
 cs_real_t   *r22,
205
 
 cs_real_t   *r23,
206
 
 cs_real_t   *ty,
207
 
 cs_real_t   *r31,
208
 
 cs_real_t   *r32,
209
 
 cs_real_t   *r33,
210
 
 cs_real_t   *tz,
211
 
 cs_int_t    *crit_len
212
 
 CS_ARGF_SUPP_CHAINE
213
 
);
214
 
 
215
 
/*----------------------------------------------------------------------------
216
 
 * Set advanced parameters for the joining algorithm in case of periodicity
217
 
 *
218
 
 * Fortran Interface:
219
 
 *
220
 
 * SUBROUTINE SETAPP
221
 
 * *****************
222
 
 *
223
 
 * INTEGER      perio_num         : <-- : perio number
224
 
 * REAL         mtf               : <-- : merge tolerance coefficient
225
 
 * REAL         pmf               : <-- : pre-merge factor
226
 
 * INTEGER      tcm               : <-- : tolerance computation mode
227
 
 * INTEGER      icm               : <-- : intersection computation mode
228
 
 * INTEGER      maxbrk            : <-- : max number of equiv. breaks
229
 
 * INTEGER      max_sub_faces     : <-- : max. possible number of sub-faces
230
 
 *                                        by splitting a selected face
231
 
 * INTEGER      tml               : <-- : tree max level
232
 
 * INTEGER      tmb               : <-- : tree max boxes
233
 
 * REAL         tmr               : <-- : tree max ratio
234
 
 *----------------------------------------------------------------------------*/
235
 
 
236
 
void CS_PROCF(setapp, SETAPP)
237
 
(
238
 
 cs_int_t    *perio_num,
239
 
 cs_real_t   *mtf,
240
 
 cs_real_t   *pmf,
241
 
 cs_int_t    *tcm,
242
 
 cs_int_t    *icm,
243
 
 cs_int_t    *maxbrk,
244
 
 cs_int_t    *max_sub_faces,
245
 
 cs_int_t    *tml,
246
 
 cs_int_t    *tmb,
247
 
 cs_real_t   *tmr
248
 
);
249
 
 
250
 
/*=============================================================================
251
 
 * Public function prototypes
252
 
 *===========================================================================*/
253
 
 
254
 
/*----------------------------------------------------------------------------
255
 
 * Define a translational periodicity
256
 
 *
257
 
 * parameters:
258
 
 *   perio_num    <-- number related to the periodicity
259
 
 *   sel_criteria <-- boundary face selection criteria
260
 
 *   fraction     <-- value of the fraction parameter
261
 
 *   plane        <-- value of the plane parameter
262
 
 *   verbosity    <-- level of verbosity required
263
 
 *   trans        <-- translation vector
264
 
 *----------------------------------------------------------------------------*/
265
 
 
266
 
void
267
 
cs_join_perio_add_translation(int            perio_num,
268
 
                              const char    *sel_criteria,
269
 
                              double         fraction,
270
 
                              double         plane,
271
 
                              int            verbosity,
272
 
                              const double   trans[3]);
273
 
 
274
 
/*----------------------------------------------------------------------------
275
 
 * Define a rotational periodicity
276
 
 *
277
 
 * parameters:
278
 
 *   perio_num    <-- number related to the periodicity
279
 
 *   sel_criteria <-- boundary face selection criteria
280
 
 *   fraction     <-- value of the fraction parameter
281
 
 *   plane        <-- value of the plane parameter
282
 
 *   verbosity    <-- level of verbosity required
283
 
 *   theta        <-- rotation angle (in degrees)
284
 
 *   axis         <-- axis vector
285
 
 *   invariant    <-- invariant point coordinates
286
 
 *----------------------------------------------------------------------------*/
287
 
 
288
 
void
289
 
cs_join_perio_add_rotation(int            perio_num,
290
 
                           const char    *sel_criteria,
291
 
                           double         fraction,
292
 
                           double         plane,
293
 
                           int            verbosity,
294
 
                           double         theta,
295
 
                           const double   axis[3],
296
 
                           const double   invariant[3]);
297
 
 
298
 
/*----------------------------------------------------------------------------
299
 
 * Define a periodicity using a matrix
300
 
 *
301
 
 * parameters:
302
 
 *   perio_num    <-- number related to the periodicity
303
 
 *   sel_criteria <-- boundary face selection criteria
304
 
 *   fraction     <-- value of the fraction parameter
305
 
 *   plane        <-- value of the plane parameter
306
 
 *   verbosity    <-- level of verbosity required
307
 
 *   matrix       <-- transformation matrix
308
 
 *----------------------------------------------------------------------------*/
309
 
 
310
 
void
311
 
cs_join_perio_add_mixed(int            perio_num,
312
 
                        const char    *sel_criteria,
313
 
                        double         fraction,
314
 
                        double         plane,
315
 
                        int            verbosity,
316
 
                        double         matrix[3][4]);
317
 
 
318
 
/*----------------------------------------------------------------------------
319
 
 * Duplicate and apply transformation to the selected faces and also to
320
 
 * their related vertices. Modify compact_face_gnum to take into account
321
 
 * new periodic faces and create a periodic vertex couple list.
322
 
 *
323
 
 * parameters:
324
 
 *   this_join    <--  high level join structure
325
 
 *   jmesh        <->  local join mesh struct. to duplicate and transform
326
 
 *   mesh         <--  pointer to a cs_mesh_t struct.
327
 
 *---------------------------------------------------------------------------*/
328
 
 
329
 
void
330
 
cs_join_perio_apply(cs_join_t          *this_join,
331
 
                    cs_join_mesh_t     *jmesh,
332
 
                    const cs_mesh_t    *mesh);
333
 
 
334
 
/*----------------------------------------------------------------------------
335
 
 * Duplicate and apply transformation to the selected faces and also to
336
 
 * their related vertices. Modify compact_face_gnum to take into account
337
 
 * new periodic faces and create a periodic vertex couple list.
338
 
 *
339
 
 * parameters:
340
 
 *   this_join          <-- pointer to a high level join structure
341
 
 *   jmesh              <-> local join mesh struct. to duplicate and transform
342
 
 *   p_work_jmesh       <-> distributed join mesh struct. on which operations
343
 
 *                          take place
344
 
 *   p_work_edges       <-> join edges struct. related to work_jmesh
345
 
 *   init_max_vtx_gnum  <-- initial max. global numbering for vertices
346
 
 *   n_g_new_vertices   <-- global number of vertices created during the
347
 
 *                          intersection of edges
348
 
 *---------------------------------------------------------------------------*/
349
 
 
350
 
void
351
 
cs_join_perio_merge_back(cs_join_t          *this_join,
352
 
                         cs_join_mesh_t     *jmesh,
353
 
                         cs_join_mesh_t    **p_work_jmesh,
354
 
                         cs_join_edges_t   **p_work_edges,
355
 
                         fvm_gnum_t          init_max_vtx_gnum,
356
 
                         fvm_gnum_t          n_g_new_vertices);
357
 
 
358
 
/*----------------------------------------------------------------------------
359
 
 * Duplicate and apply transformation to the selected faces and also to
360
 
 * their related vertices. Update jmesh structure.
361
 
 * Define a new n2o_hist.
362
 
 *
363
 
 * parameters:
364
 
 *   this_join     <-- pointer to a high level join structure
365
 
 *   jmesh         <-> local join mesh struct. to duplicate and transform
366
 
 *   mesh          <-- pointer to a cs_mesh_t structure
367
 
 *   o2n_hist      <-- old global face -> new local face numbering
368
 
 *   p_n2o_hist    <-- new global face -> old local face numbering
369
 
 *---------------------------------------------------------------------------*/
370
 
 
371
 
void
372
 
cs_join_perio_split_back(cs_join_t          *this_join,
373
 
                         cs_join_mesh_t     *jmesh,
374
 
                         cs_mesh_t          *mesh,
375
 
                         cs_join_gset_t     *o2n_hist,
376
 
                         cs_join_gset_t    **p_n2o_hist);
377
 
 
378
 
/*----------------------------------------------------------------------------
379
 
 * Define a list of coupled faces by periodicty in global numbering.
380
 
 *
381
 
 * For parallel runs:
382
 
 *  - remove isolated periodic faces in the mesh definition
383
 
 *  - define a consistent face connectivity in order to prepare the building
384
 
 *    of periodic vertex couples
385
 
 *
386
 
 *
387
 
 * parameters:
388
 
 *   param        <-- set of parameters for the joining operation
389
 
 *   n_ii_faces   <-- initial local number of interior faces
390
 
 *   face_type    <-- type of faces in join mesh (interior or border ...)
391
 
 *   jmesh        <-- pointer on a cs_join_mesh_t struct.
392
 
 *   mesh         <-> pointer on a cs_mesh_t struct.
393
 
 *---------------------------------------------------------------------------*/
394
 
 
395
 
void
396
 
cs_join_perio_split_update(cs_join_param_t             param,
397
 
                           cs_int_t                    n_ii_faces,
398
 
                           const cs_join_face_type_t   face_type[],
399
 
                           const cs_join_mesh_t       *jmesh,
400
 
                           cs_mesh_t                  *mesh);
401
 
 
402
 
/*----------------------------------------------------------------------------
403
 
 * Use periodic face couples in cs_glob_join_perio_builder to define
404
 
 * cs_glob_mesh_builder
405
 
 * Free all elements which can be freed.
406
 
 * Transfer data to cs_glob_mesh and cs_glob_mesh_builder.
407
 
 *---------------------------------------------------------------------------*/
408
 
 
409
 
void
410
 
cs_join_perio_transfer_builder(void);
411
 
 
412
 
/*---------------------------------------------------------------------------*/
413
 
 
414
 
END_C_DECLS
415
 
 
416
 
#endif /* __CS_JOIN_PERIO_H__ */