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