Salome HOME
0020889: EDF 1433 SMESH: SplitHexaToTetra: add the 24 tetras mode
[modules/smesh.git] / doc / salome / gui / SMESH / input / pattern_mapping.doc
1 /*!
2
3 \page pattern_mapping_page Pattern mapping
4
5 <br><h2>About patterns</h2>
6
7 The pattern describes a mesh to generate: positions of nodes within a
8 geometrical domain and nodal connectivity of elements. As well, a
9 pattern specifies the so-called key-points, i.e. nodes that will be
10 located at geometrical vertices. Pattern description is stored in
11 \<pattern_name\>.smp file.
12
13 The smp file contains 4 sections:
14
15 -# The first line holds the total number of the pattern nodes (N).
16 -# The next N lines describe nodes coordinates. Each line holds 2
17 coordinates of a node for 2D pattern or 3 cordinates for 3D pattern.
18 Note, that for 3D pattern only relateive values in range [0;1] are
19 valid for coordinates of the nodes.
20 -# A key-points line: indices of nodes to be mapped on geometrical
21 vertices (for 2D pattern only). An index n refers to a node described 
22 on an n-th line of section 2. The first node index is zero. For 3D 
23 pattern key points are not specified.
24 -# The rest lines describe nodal connectivity of elements, one line
25 for an element. A line holds indices of nodes forming an element. An
26 index n refers to a node described on an n-th line of the section
27 2. The first node index is zero. There must be 3 or 4 indices on a
28 line for 2D pattern (only 2d elements are allowed) and 4, 5, 6 or 8
29 indices for 3D pattern (only 3d elements are allowed).
30
31 The 2D pattern must contain at least one element and at least one
32 key-point. All key-points must lay on boundaries.
33
34 The 3D pattern must contain at least one element.
35
36 An example of a simple 2D pattern smp file:
37
38 \code
39 !!! SALOME 2D mesh pattern file
40 !!!
41 !!! Nb of points:
42 9
43         200     0       !- 0
44         100     0       !- 1
45           0     0       !- 2
46           0  -100       !- 3
47           0  -200       !- 4
48         100  -200       !- 5
49         200  -200       !- 6
50         200  -100       !- 7
51         100  -100       !- 8
52 !!! Indices of 4 key-points
53  2 0 4 6
54 !!! Indices of points of 6 elements
55  0 1 8
56  8 5 6 7
57  2 3 8
58  8 3 4 5
59  8 7 0
60  8 1 2
61 \endcode
62
63 The image below provides a preview of above described pattern:
64
65 \image html pattern2d.png
66
67 An example of a simple 3D pattern smp file:
68
69 \code
70 !!! SALOME 3D mesh pattern file
71 !!!
72 !!! Nb of points:
73 9
74         0        0        0   !- 0
75         1        0        0   !- 1
76         0        1        0   !- 2
77         1        1        0   !- 3
78         0        0        1   !- 4
79         1        0        1   !- 5
80         0        1        1   !- 6
81         1        1        1   !- 7
82       0.5      0.5      0.5   !- 8
83 !!! Indices of points of 6 elements:
84  0 1 5 4 8
85  7 5 1 3 8
86  3 2 6 7 8
87  2 0 4 6 8
88  0 2 3 1 8
89  4 5 7 6 8
90 \endcode
91
92 <br><h2>Application of pattern mapping</h2>
93
94 <em>To apply pattern mapping to a geometrical object:</em>
95
96 From the \b Modification menu choose the <b>Pattern Mapping</b> item or click 
97 <em>"Pattern mapping"</em> button in the toolbar.
98
99 \image html image98.png
100 <center><em>"Pattern mapping" button</em></center>
101
102 The following dialog box shall appear:
103
104 \image html patternmapping1.png
105
106 <center><b> 2D Pattern Mapping dialog box</b></center>
107
108 \image html patternmapping2.png
109
110 <center><b> 3D Pattern Mapping dialog box</b></center>
111
112 To apply a pattern to a geometrical object, you should specify:
113
114 -# For 2D pattern
115    - A face having the number of vertices equal to the number of
116      key-points in the pattern; the number of key-points on internal
117      boundaries of a pattern must also be equal to the number of vertices
118      on internal boundaries of a face;
119    - A vertex to which the first key-point should be mapped;
120    - Reverse or not the order of key-points. (The order of vertices of
121      a face is counterclockwise looking from outside).
122 -# For 3D pattern
123    - 3D block (Solid) object;
124    - Two vertices that specify the order of nodes in the resulting
125      mesh.
126
127 Then you either load a .smp pattern file previously created manually
128 by clicking on the <em>"Load pattern"</em> button, or click on the \b
129 New button for automatic generation of the pattern.
130
131 For an automatic generation you just specify a geometrical face (for
132 2D) or solid (for 3d) having a mesh built on it. Mesh nodes lying on
133 face vertices become key-points of 2D pattern. Additionally, for 2D
134 pattern you may choose the way of getting nodes coordinates by
135 <b>projecting nodes on the face</b> instead of using
136 "positions on face" generated by mesher (if there is any). Faces
137 having a seam edge can't be used for automatic pattern creation.
138
139 When creating a pattern from an existing mesh, there are two possible
140 cases:
141
142 - A sub-mesh on face/solid is selected. A pattern is created from the 2d/3d
143 elements bound to a face/solid by mesher. For 2D pattern, node coordinates are either
144 "positions on face" computed by mesher, or coordinates got by node
145 projection on a geometrical surface, according to the user choice. For
146 3D pattern, nodes coordinates correspond to the nodes computed by mesher.
147 - A mesh where the main shape is a face/solid, is selected. A pattern is
148 created from all the 2d/3d elements in a mesh. In addition, for 2D
149 pattern, if all mesh elements are build by mesher, the user can select
150 the way of getting nodes coordinates, else all nodes are projected on
151 a face surface.
152
153 \image html a-patterntype.png
154
155 <center><b> 2D Pattern Creation dialog box</b></center>
156
157 \image html a-patterntype1.png
158
159 <center><b> 3D Pattern Creation dialog box</b></center>
160
161 <br><h2>Mapping algorithm</h2>
162
163 The mapping algorithm for 2D case is as follows:
164
165 - Key-points are set in the order that they are encountered when
166   walking along a pattern boundary so that elements are on the left. The
167   first key-point is preserved.
168 - Find geometrical vertices corresponding to key-points by vertices
169   order in a face boundary; here, "Reverse order of key-points" flag is
170   taken into account. \image html image95.gif
171 - Boundary nodes of a pattern are mapped onto edges of a face: a
172   node located between certain key-points on a pattern boundary is
173   mapped on a geometrical edge limited by corresponding geometrical
174   vertices. Node position on an edge reflects its distance from two
175   key-points. \image html image96.gif
176 - Coordinates of a non-boundary node in a parametric space of a face
177  are defined as following. In a parametric space of a pattern, a node
178  lays at the intersection of two iso-lines, each of which intersects a
179  pattern boundary at least at two points. Knowing mapped positions of
180  boundary nodes, we find where isoline-boundary intersection points are
181  mapped to, and hence we can find mapped isolines direction and then,
182  two node positions on two mapped isolines. The eventual mapped
183  position of a node is found as an average of positions on mapped
184  isolines. \image html image97.gif
185
186 For 3D case the algorithm is similar.
187
188 <b>See Also</b> a sample TUI Script of a 
189 \ref tui_pattern_mapping "Pattern Mapping" operation.
190
191 */