1
/*============================================================================
2
* Define (conforming or non-conforming) mesh joinings.
3
*============================================================================*/
8
This file is part of Code_Saturne, a general-purpose CFD tool.
10
Copyright (C) 1998-2011 EDF S.A.
12
This program is free software; you can redistribute it and/or modify it under
13
the terms of the GNU General Public License as published by the Free Software
14
Foundation; either version 2 of the License, or (at your option) any later
17
This program is distributed in the hope that it will be useful, but WITHOUT
18
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
19
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
22
You should have received a copy of the GNU General Public License along with
23
this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
24
Street, Fifth Floor, Boston, MA 02110-1301, USA.
27
/*----------------------------------------------------------------------------*/
29
#if defined(HAVE_CONFIG_H)
30
#include "cs_config.h"
33
/*----------------------------------------------------------------------------
34
* Standard C library headers
35
*----------------------------------------------------------------------------*/
37
/*----------------------------------------------------------------------------
39
*----------------------------------------------------------------------------*/
41
/*----------------------------------------------------------------------------
43
*----------------------------------------------------------------------------*/
45
/*----------------------------------------------------------------------------
47
*----------------------------------------------------------------------------*/
52
/*----------------------------------------------------------------------------
53
* Header for the current file
54
*----------------------------------------------------------------------------*/
56
#include "cs_prototypes.h"
58
/*----------------------------------------------------------------------------*/
62
/*============================================================================
63
* User function definitions
64
*============================================================================*/
66
/*----------------------------------------------------------------------------
67
* Define mesh joinings.
69
* This is done by calling the cs_join_add() function for each joining
72
* The arguments to cs_join_add() are:
73
* sel_criteria <-- boundary face selection criteria string
74
* fraction <-- value of the fraction parameter;
75
* the initial tolerance radius associated to each vertex
76
* is equal to the lenght of the shortest incident edge,
77
* multiplied by this fraction.
78
* plane <-- value of the plane parameter;
79
* when subdividing faces, 2 faces are considered
80
* coplanar and may be joined if angle between their
81
* normals (in degrees) does not exceed this parameter.
82
* verbosity <-- level of verbosity required
84
* The function returns a number (1 to n) associated with the
85
* new joining. This number may optionnally be used to assign advanced
86
* parameters to the joining.
87
*----------------------------------------------------------------------------*/
93
int verbosity = 1, visualization;
94
float fraction = 0.10, plane = 0.25;
95
return; /* REMOVE_LINE_FOR_USE_OF_SUBROUTINE */
99
verbosity = 1; /* debug level if >= 3 */
100
visualization = 1; /* debug level if >= 3 */
102
/* Add a joining operation */
103
/* ----------------------- */
105
join_num = cs_join_add("98 or 99",
111
/*--------------------------------------------------------------------------*/
113
/* Example with advanced parameters;
114
Advanced parameters may be modified to solve errors during the
115
joining step or to get a better mesh quality. */
118
/* Merge tolerance factor:
119
* used to locally modify the tolerance associated to each
120
* vertex BEFORE the merge step.
121
* = 0 => no vertex merge;
122
* < 1 => vertex merge is more strict. It may increase the number
123
* of tolerance reduction and so define smaller subset of
124
* vertices to merge together but it can drive to loose
127
* > 1 => vertex merge is less strict. The subset of vertices able
128
* to be merged together is greater. */
133
* this parameter is used to define a bound under which two vertices
134
* are merged before the merge step.
135
* Tolerance limit for the pre-merge = pmf * fraction. */
139
/* Tolerance computation mode:
141
* 1: (default) tol = min. edge length related to a vertex * fraction
142
* 2: tolerance is computed like in mode 1 with in addition, the
143
* multiplication by a coefficient equal to the max sin(e1, e2)
144
* where e1 and e2 are two edges sharing the same vertex V for which
145
* we want to compute the tolerance.
146
* 11: as 1 but taking into account only the selected faces
147
* 12: as 2 but taking into account only the selected faces */
151
/* Intersection computation mode:
152
* 1: (default) Original algorithm.
153
* Try to snap intersection to extremity.
154
* 2: New intersection algorithm.
155
* Avoid snapping intersection to extremity. */
159
/* Maximum number of equivalence breaks which is
160
* enabled during the merge step. */
164
/* Maximum number of sub-faces when splitting a selected face. */
166
int max_sub_face = 100;
168
/* tml, tmb and tmr are parameters of the searching algorithm for
169
* face intersections between selected faces (octree structure).
170
* Useful to adjust speed vs. memory consumption. */
173
* deepest level reachable when building the tree */
178
* max. number of bounding boxes which can be linked to a leaf of the tree
179
* (not necessary true for the deepest level) */
184
* stop refining the tree structure when
185
* number of bounding boxes > tmr * number of faces to locate.
186
* In parallel, a separate (usually lower) value may be set for
187
* the initial coarse tree used to determine distribution.
188
* Reducing this will help reduce memory consumption. */
191
double tmr_distrib = 2.0;
193
/* Set advanced parameters */
195
cs_join_set_advanced_param(join_num,
197
max_break, max_sub_face,
198
tml, tmb, tmr, tmr_distrib);