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