3 \page constructing_meshes_page Constructing meshes
5 \n Construction of a mesh on some geometry consists of:
7 <li> \ref create_mesh_anchor "Creating of a mesh object"</li>
8 <li> \ref evaluate_anchor "Evaluating mesh size"</li>
9 <li> \ref preview_anchor "Previewing the mesh"</li>
10 <li> \ref submesh_order_anchor "Changing submesh priority"</li>
11 <li> \ref compute_anchor "Computing the mesh"</li>
13 Mesh can be \ref use_existing_anchor "computed using your own meshing algorithms"
17 \anchor create_mesh_anchor
18 <h2>Creation of a mesh object</h2>
19 <em>To construct a mesh:</em>
21 <li>Select a geometrical object for meshing.</li>
22 <li>In the \b Mesh menu select <b>Create Mesh</b> or click <em>"Create
23 Mesh"</em> button in the toolbar.
25 \image html image32.png
26 <em>"Create Mesh" button</em>
28 The following dialog box will appear:
30 \image html createmesh-inv.png
33 <li>Apply \subpage basic_meshing_algos_page "meshing algorithms" and
34 \subpage about_hypo_page "hypotheses" which will be used at computation of
37 For example, you need to mesh a 3D object.
39 First, type the name for your mesh in the \b Name box, by default,
40 it is "Mesh_1". Then select the geometrical object you wish to
41 mesh in the Object Browser and click "Select" button near \b Geometry
42 field (if name of the object not yet appeared in \b Geometry field).
44 \image html image120.png
45 <em>"Select" button</em>
47 Now you can define 3D Algorithm and 3D Hypotheses, which will be
48 applied to solids of your geometrical object. Click the <em>"Add
49 Hypothesis"</em> button to add a hypothesis.
51 \image html image121.png
52 <em>"Add Hypothesis" button</em>
54 Click the <em>"Edit Hypothesis"</em> button to change values for the
57 \image html image122.png
58 <em>"Edit Hypothesis" button</em>
60 Most standard 2D and 3D algorithms can work without hypotheses
61 using some default parameters. The use of additional hypotheses
62 is optional (i.e. you may leave "None" in this box).
64 Proceed in the same way with 2D and 1D Algorithms and Hypotheses that
65 will be used to mesh faces and edges of your geometry. (Note
66 that any object has edges, even if their existence is not
67 apparent, for example, a sphere has 4 edges). Note that the
68 choice of hypotheses and of an algorithm of lower dimension depends on
71 Some algorithms generate mesh of several dimensions while others, of
72 only one dimension. In the latter case there must be one Algorithm and zero or several
73 Hypotheses for each dimension of your object, otherwise you will
74 not get any mesh at all. Of course, if you wish to mesh a face,
75 which is a 2D object, you don't need to define 3D Algorithm and
78 In the <b>Object Browser</b> the structure of the new mesh will be
81 \image html image88.jpg
85 <li>a reference to the geometrical object on the basis of
86 which the mesh has been constructed;</li>
87 <li><b>Applied hypotheses</b> folder containing the references
88 to the hypotheses applied at the construction of the mesh;</li>
89 <li><b>Applied algorithms</b> folder containing the references
90 to the algorithms applied at the construction of the mesh.</li>
93 There is an alternative way to assign Algorithms and Hypotheses by
94 clicking <b>Assign a set of hypotheses</b> button and selecting among
95 pre-defined sets of hypotheses. In addition to the standard
96 sets of hypotheses, it is possible to create custom sets by editing
97 CustomMeshers.xml file located in the home directory. CustomMeshers.xml
98 file must describe sets of hypotheses in the
99 same way as ${SMESH_ROOT_DIR}/share/salome/resources/smesh/StdMeshers.xml
100 file does (sets of hypotheses are enclosed between <hypotheses-set-group>
103 \image html hypo_sets.png
104 List of sets of hypotheses: <em>[custom]</em>
105 automatically added to the sets defined by the user
109 Consider trying a sample script for construction of a mesh from our
110 \ref tui_creating_meshes_page "TUI Scripts" section.
112 \anchor evaluate_anchor
113 <h2>Evaluating mesh size</h2>
115 After the mesh object is created and all hypotheses are assigned and
116 before \ref compute_anchor "Compute" operation, it is possible to
117 calculate the eventual mesh size. For this, select the mesh in
118 the <b>Object Browser</b> and from the \b Mesh menu select \b
119 Evaluate. The result of evaluation will be displayed in the following
122 \image html mesh_evaluation_succeed.png
124 \anchor preview_anchor
125 <h2>Previewing the mesh</h2>
127 Before \ref compute_anchor "the mesh computation", it is also possible
128 to see the mesh preview.
130 For this, select the mesh in the Object Browser. From the \b Mesh menu
131 select \b Preview or click "Preview" button in the toolbar or activate
132 "Preview" item from the pop-up menu.
134 \image html mesh_precompute.png
135 <em>"Preview" button</em>
137 Select <b>1D mesh</b> or <b>2D mesh</b> preview mode in the Preview dialog.
139 \image html preview_mesh_1D.png "1D mesh preview shows nodes computed on geometry edges"
141 \image html preview_mesh_2D.png "2D mesh preview shows edge mesh elements, computed on geometry faces"
143 <b>Compute</b> button computes the whole mesh.
145 When the Preview dialog is closed, the question about the storage of temporarily
146 created mesh elements appers:
148 \image html preview_tmp_data.png
150 These elements can be kept in the mesh.
153 \anchor submesh_order_anchor
154 <h2>Changing submesh priority</h2>
156 If the mesh contains concurrent \ref constructing_submeshes_page "submeshes",
157 it is possible to change the priority of their computation, i.e. to
158 change the priority of applying algorithms to the shared sub-shapes of
161 <em>To change submesh priority:</em>
163 Choose "Change submesh priority" from the Mesh menu or a pop-up
164 menu. The opened dialog shows a list of submeshes in the order of
167 There is an example of submesh order modifications of the Mesh created on a Box
168 shape. The main Mesh object:
170 <li><i>1D</i> <b>Wire discretisation</b> with <b>Number of Segments</b>=20</li>
171 <li><i>2D</i> <b>Triangle (Mefisto)</b> with Hypothesis<b>Max Element Area</b>
174 The first submesh object <b>Submesh_1</b> created on <b>Face_1</b> is:
176 <li><i>1D</i> <b>Wire discretisation</b> with <b>Number of Segments</b>=4</li>
177 <li><i>2D</i> <b>Triangle (Mefisto)</b> with Hypothesis<b>MaxElementArea</b>=1200</li>
179 The second submesh object <b>Submesh_2</b> created on <b>Face_2</b> is:
181 <li><i>1D</i> <b>Wire discretisation</b> with <b>Number of Segments</b>=8</li>
182 <li><i>2D</i> <b>Triangle (Mefisto)</b> with Hypothesis<b>MaxElementArea</b>=1200</li>
185 And the last submesh object <b>Submesh_3</b> created on <b>Face_3</b> is:
187 <li><i>1D</i> <b>Wire discretisation</b> with <b>Number of Segments</b>=12</li>
188 <li><i>2D</i> <b>Triangle (Mefisto)</b> with Hypothesis<b>MaxElementArea</b>=1200</li>
191 The sub-meshes become concurrent if they share sub-shapes that can be
192 meshed with different algorithms (or different hypothesises). In the
193 example, we have three submeshes with concurrent algorithms, because
194 they have different hypotheses.
196 The first mesh computation is made with:
198 \image html mesh_order_123.png
199 <em>"Mesh order SubMesh_1, SubMesh_2, SubMesh_3"</em></center>
201 \image html mesh_order_123_res.png
202 <em>"Result mesh with order SubMesh_1, SubMesh_2, SubMesh_3 "</em></center>
204 The next mesh computation is made with:
206 \image html mesh_order_213.png
207 <em>"Mesh order SubMesh_2, SubMesh_1, SubMesh_3"</em></center>
209 \image html mesh_order_213_res.png
210 <em>"Result mesh with order SubMesh_2, SubMesh_1, SubMesh_3 "</em></center>
212 And the last mesh computation is made with:
214 \image html mesh_order_321.png
215 <em>"Mesh order SubMesh_3, SubMesh_2, SubMesh_1"</em></center>
216 <center>\image html mesh_order_321_res.png
217 <em>"Result mesh with order SubMesh_3, SubMesh_2, SubMesh_1 "</em></center>
219 As we can see, each mesh computation has a different number of result
220 elements and a different mesh discretisation on the shared edges (the edges
221 that are shared between <b>Face_1</b>, <b>Face_2</b> and <b>Face_3</b>)
223 Additionally, submesh priority (the order of applied algorithms) can
224 be modified not only in a separate dialog box, but also in
225 the <b>Preview</b>. This helps to preview different mesh results,
226 modifying the order of submeshes.
228 \image html mesh_order_preview.png
229 <em>"Preview with submesh priority list box"</em></center>
231 If there are no concurrent submeshes under the Mesh object, the user
232 will see the following information.
234 \image html mesh_order_no_concurrent.png
235 <em>"No concurrent submeshes detected"</em></center>
238 \anchor compute_anchor
239 <h2>Computing the mesh</h2>
241 It is equally possible to skip \ref evaluate_anchor "the Evaluation"
242 and \ref preview_anchor "the Preview" and to \b Compute the mesh after
243 the hypotheses are assigned. For this, select your mesh in
244 the <b>Object Browser</b>. From the \b Mesh menu select \b Compute or
245 click "Compute" button of the toolbar.
247 \image html image28.png
248 <em>"Compute" button</em>
250 The Mesh Computation information box appears.
252 \image html meshcomputationsucceed.png
254 If the mesh computation failed, the information about the cause of the
257 \image html meshcomputationfail.png
259 After you select the error, <b>Show Sub-shape</b> button allows
260 visualizing in magenta the geometrical entity that causes it.
262 \image html failed_computation.png
263 <em>3D algorithm failed to compute mesh on a box shown using <b>Show
264 Sub-shape</b> button</em>
267 \note Mesh Computation Information box does not appear if you set
268 "Mesh computation/Show a computation result notification" preference
269 to the "Never" value. This option gives the possibility to control mesh
270 computation reporting. There are the following possibilities: always
271 show information box, only if an error occurs or never.
272 By default, the information box is always shown after mesh computation operation.
274 <b>Publish Sub-shape</b> button publishes the sub-shape, whose meshing
275 failed, in GEOM component as a child of the mesh geometry, which
276 allows analyzing the problem geometry and creating a submesh on it in
277 order to locally tune hypotheses.
279 If a cause of failure is an invalid input mesh and the algorithm has
280 provided information on what mesh entities are bad <b>Show bad Mesh</b>
281 button appears in the dialog. Clicked, it shows bad mesh entities in
282 the Viewer in magenta. Sometimes the shown mesh entities are too small
283 or/and hidden by other mesh elements, to see them it can be helpful to
284 switch the mesh to Wireframe visualization mode or to switch off
285 visualization of faces and volumes (if any).
287 \anchor use_existing_anchor
288 <h2>"Use existing edges" and "Use existing faces" algorithms</h2>
290 It is possible to create an 1D or a 2D mesh in a python script
291 (using <em>AddNode, AddEdge</em> and <em>AddFace</em> commands) and
292 then use such sub-meshes in the construction of a 2D or a 3D mesh. For
293 this, there exist two algorithms: <b>Use existing edges</b> and <b>Use
294 existing faces</b>. Scenario of their usage is following. For
295 example, you want to use standard algorithms to generate 1D and 3D
296 meshes and to create 2D mesh by your python code. Then you
298 <li> create a mesh object, assign an 1D algorithm,</li>
299 <li> invoke \b Compute command, which computes an 1D mesh,</li>
300 <li> assign <b>Use existing faces</b> and a 3D algorithm,</li>
301 <li> run your python code, which creates a 2D mesh,</li>
302 <li> invoke \b Compute command, which computes a 3D mesh.</li>
305 Consider trying a sample script demonstrating usage of
306 \ref tui_use_existing_faces "Use existing faces" algorithm for
307 construction of a 2D mesh using Python commands.
309 \image html use_existing_face_sample_mesh.png
310 <em> Mesh computed by \ref tui_use_existing_faces "the sample script"
311 shown in a Shrink mode.</em>