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