1
/*============================================================================
3
* This file is part of the Code_Saturne Kernel, element of the
4
* Code_Saturne CFD tool.
6
* Copyright (C) 2008-2010 EDF S.A., France
8
* contact: saturne-support@edf.fr
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.
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.
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
26
*============================================================================*/
28
#ifndef __CS_JOIN_PERIO_H__
29
#define __CS_JOIN_PERIO_H__
31
/*============================================================================
32
* Structure and function headers handling with periodicity for joining
34
*===========================================================================*/
36
/*----------------------------------------------------------------------------
38
*---------------------------------------------------------------------------*/
40
/*----------------------------------------------------------------------------
42
*---------------------------------------------------------------------------*/
46
#include "cs_join_set.h"
47
#include "cs_join_util.h"
48
#include "cs_join_mesh.h"
50
/*---------------------------------------------------------------------------*/
54
/*============================================================================
55
* Local Macro definitions
56
*===========================================================================*/
58
/*=============================================================================
60
*===========================================================================*/
62
extern int cs_glob_n_join_perio; /* Number of periodicity defined through
63
a joining operation */
65
/*============================================================================
66
* Public function prototypes for Fortran API
67
*============================================================================*/
69
/*----------------------------------------------------------------------------
70
* Get the number of periodic transformations already defined
77
* INTEGER numper : --> : number of periodicities op. already defined
78
*----------------------------------------------------------------------------*/
80
void CS_PROCF(numper, NUMPER)
85
/*----------------------------------------------------------------------------
86
* Define a translation
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
*----------------------------------------------------------------------------*/
104
void CS_PROCF(defpt1, DEFPT1)
107
const char *criteria,
118
/*----------------------------------------------------------------------------
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
*----------------------------------------------------------------------------*/
141
void CS_PROCF(defpr1, DEFPR1)
144
const char *criteria,
159
/*----------------------------------------------------------------------------
160
* Define a general transformation through a homogeneous matrix (4x4)
162
* | r11 r12 r13 tx | t(x,y,z) : translation vector
163
* | r21 r22 r23 ty | r(i,j) : rotation matrix
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
*----------------------------------------------------------------------------*/
192
void CS_PROCF(defpg1, DEFPG1)
195
const char *criteria,
215
/*----------------------------------------------------------------------------
216
* Set advanced parameters for the joining algorithm in case of periodicity
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
*----------------------------------------------------------------------------*/
236
void CS_PROCF(setapp, SETAPP)
244
cs_int_t *max_sub_faces,
250
/*=============================================================================
251
* Public function prototypes
252
*===========================================================================*/
254
/*----------------------------------------------------------------------------
255
* Define a translational periodicity
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
*----------------------------------------------------------------------------*/
267
cs_join_perio_add_translation(int perio_num,
268
const char *sel_criteria,
272
const double trans[3]);
274
/*----------------------------------------------------------------------------
275
* Define a rotational periodicity
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
*----------------------------------------------------------------------------*/
289
cs_join_perio_add_rotation(int perio_num,
290
const char *sel_criteria,
295
const double axis[3],
296
const double invariant[3]);
298
/*----------------------------------------------------------------------------
299
* Define a periodicity using a matrix
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
*----------------------------------------------------------------------------*/
311
cs_join_perio_add_mixed(int perio_num,
312
const char *sel_criteria,
316
double matrix[3][4]);
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.
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
*---------------------------------------------------------------------------*/
330
cs_join_perio_apply(cs_join_t *this_join,
331
cs_join_mesh_t *jmesh,
332
const cs_mesh_t *mesh);
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.
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
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
*---------------------------------------------------------------------------*/
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);
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.
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
*---------------------------------------------------------------------------*/
372
cs_join_perio_split_back(cs_join_t *this_join,
373
cs_join_mesh_t *jmesh,
375
cs_join_gset_t *o2n_hist,
376
cs_join_gset_t **p_n2o_hist);
378
/*----------------------------------------------------------------------------
379
* Define a list of coupled faces by periodicty in global numbering.
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
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
*---------------------------------------------------------------------------*/
396
cs_join_perio_split_update(cs_join_param_t param,
398
const cs_join_face_type_t face_type[],
399
const cs_join_mesh_t *jmesh,
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
*---------------------------------------------------------------------------*/
410
cs_join_perio_transfer_builder(void);
412
/*---------------------------------------------------------------------------*/
416
#endif /* __CS_JOIN_PERIO_H__ */