Salome HOME
merge V7_7_BR
[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 coordinates for a 3D pattern.
18   Note, that node coordinates of a 3D pattern can be defined only by
19   relative values in range [0;1].
20 -# The key-points line contains the indices of the nodes to be mapped on geometrical
21   vertices (for a 2D pattern only). Index n refers to the node described 
22   on the n-th line of section 2. The index of the first node is
23   zero. For a 3D pattern the key points are not specified.
24 -# The remaining lines describe nodal connectivity of elements, one line
25   for each element. Each line holds indices of nodes forming an element.
26   Index n refers to the node described on the n-th line of section 2.
27   The first node index is zero. There must be 3 or 4 indices on each
28   line for a 2D pattern (only liner 2d elements are allowed) and 4, 5, 6 or 8
29   indices for a 3D pattern (only linear 3d elements are allowed).
30
31 A 2D pattern must contain at least one element and at least one
32 key-point. All key-points must lie on boundaries.
33
34 A 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 the above 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 or mesh elements:</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 will appear:
103
104 \n For a <b>2D pattern</b>
105
106 \image html patternmapping1.png
107
108 In this dialog you should specify:
109
110 <ul>
111 <li> \b Pattern, which can be loaded from .smp pattern file previously
112   created manually or generated automatically from an existing mesh or
113   sub-mesh.</li>
114 <li> \b Face with the number of vertices equal to the number of
115   key-points in the pattern; the number of key-points on internal
116   boundaries of the pattern must also be equal to the number of vertices
117   on internal boundaries of the face;</li>
118 <li> \b Vertex to which the first key-point should be mapped;</li>
119 </ul>
120
121 Alternatively, it is possible to select <b>Refine selected mesh elements</b> 
122 check-box and apply the pattern to <ul>
123   <li> <b>Mesh Face</b> instead of a geometric Face</li>
124   <li> and select \b Node instead of vertex.</li>
125 </ul>
126
127 Additionally it is possible to: <ul>
128 <li> <b>Reverse the order of key-points</b>. By default, the vertices of
129   a face are ordered counterclockwise.</li>
130 <li> Enable to <b> Create polygons near boundary</b> </li>
131 <li> and <b>Create polyhedrons near boundary</b></li>
132 </ul>
133
134 \n For a <b>3D pattern</b>
135
136 \image html patternmapping2.png
137
138 In this dialog you should specify:
139 <ul>
140 <li> \b Pattern, which can be loaded from .smp pattern file previously
141   created manually or generated automatically from an existing mesh or
142   sub-mesh.</li>
143 <li> A 3D block (Solid) object.</li>
144 <li> Two vertices that specify the order of nodes in the resulting
145   mesh.</li>
146 </ul>
147
148 Alternatively, it is possible to select <b>Refine selected mesh elements</b> 
149 check-box and apply the pattern to
150 <ul>
151   <li> One or several <b>Mesh volumes</b> instead of a geometric 3D object</li>
152   <li> and select two \b Nodes instead of vertices.</li> 
153 </ul>
154 Additionally it is possible to:
155 <ul>
156 <li> Enable to <b> Create polygons near boundary</b> </li>
157 <li> and <b>Create polyhedrons near boundary</b></li>
158 </ul>
159
160 <br>
161 <h3> Automatic Pattern Generation</h3>
162
163 To generate a pattern automatically from an existing mesh or sub-mesh,
164 click \b New button.
165
166 The following dialog box will appear:
167
168 \image html a-patterntype1.png
169
170 In this dialog you should specify:
171
172 <ul>
173 <li> <b>Mesh or Sub-mesh</b>, which is a meshed geometrical face (for a
174 2D pattern) or a meshed solid block (for a 3D pattern). Mesh nodes lying on
175 the face vertices become key-points of the pattern. </li>
176 <li> A custom <b>Pattern Name </b> </li>
177 <li>Additionally, for a 2D pattern you may choose to 
178 <b>Project nodes on the face</b> to get node coordinates instead of using
179 "positions on face" generated by the mesher (if there is any). The faces
180 having a seam edge cannot be used for automatic pattern creation.</li>
181 </ul>
182
183 When a pattern is created from an existing mesh, two cases are possible:
184
185 - A sub-mesh on a face/solid is selected. The pattern is created from the 2d/3d
186 elements bound to the face/solid by the mesher. For a 2D pattern, the node coordinates are either
187 "positions on face" computed by the mesher, or coordinates got by node
188 projection on a geometrical surface, according to the user choice. For
189 a 3D pattern, the node coordinates correspond to the nodes computed by
190 the mesher.
191 - A mesh, where the main shape is a face/solid, is selected. The pattern is
192 created from all 2d/3d elements in a mesh. In addition, if all mesh
193 elements of a 2D pattern are built by the mesher, the user can select
194 how to get node coordinates, otherwise all nodes are projected on
195 a face surface.
196
197
198 <br><h2>Mapping algorithm</h2>
199
200 The mapping algorithm for a 2D case is as follows:
201
202 - The key-points are set counterclockwise in the order corresponding
203   to their location on the pattern boundary. The first key-point is preserved.
204 - The geometrical vertices corresponding to the key-points are found
205   on face boundary. Here, "Reverse order of key-points" flag is set. 
206 \image html image95.gif
207 - The boundary nodes of the pattern are mapped onto the edges of the face: a
208   node located between two key-points on the pattern boundary is
209   mapped on the geometrical edge limited by the corresponding geometrical
210   vertices. The node position on the edge depends on its distance from the
211   key-points. 
212 \image html image96.gif
213 - The coordinates of a non-boundary node in the parametric space of the face
214   are defined in the following way. In the parametric space of the
215   pattern, the  node lies at the intersection of two iso-lines. Both
216   of them intersect the pattern boundary at two
217   points at least. If the mapped positions of boundary nodes are known, it is
218   possible to find, where the points at the intersection of iso-lines
219   and boundaries are mapped. Then it is possible to find
220   the direction of mapped iso-line section and, finally, the positions of
221   two nodes on two mapped isolines. The eventual mapped
222   position of the node is found as an average of the positions on mapped
223   iso-lines. 
224 \image html image97.gif
225
226 The 3D algorithm is similar.
227
228 <b>See Also</b> a sample TUI Script of a 
229 \ref tui_pattern_mapping "Pattern Mapping" operation.
230
231 */