From 69e7a358b872c72857cfb8aa56d9c0bda27fc945 Mon Sep 17 00:00:00 2001 From: dmv Date: Wed, 12 May 2010 05:49:38 +0000 Subject: [PATCH 1/1] 0020868: EDF 1251 SMESH: Pattern 3D mapping Add documentation and sample scripts for 3D pattern mapping --- doc/salome/gui/SMESH/images/image94.gif | Bin 5678 -> 0 bytes doc/salome/gui/SMESH/images/pattern2d.png | Bin 0 -> 578 bytes .../gui/SMESH/input/pattern_mapping.doc | 210 +++++++++++------- .../gui/SMESH/input/tui_modifying_meshes.doc | 90 +++++++- 4 files changed, 219 insertions(+), 81 deletions(-) delete mode 100755 doc/salome/gui/SMESH/images/image94.gif create mode 100644 doc/salome/gui/SMESH/images/pattern2d.png diff --git a/doc/salome/gui/SMESH/images/image94.gif b/doc/salome/gui/SMESH/images/image94.gif deleted file mode 100755 index 7313f5deb3336d5476d340d3b3c36047754adfbc..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5678 zcmeH~=Q|q=!^L&!KzrBTU1lX(ds9_2=s=C2RjrxO+a_r3t@cQaqE=#LATn!{-*}(%;aunI`CZrfa14zNR8^dO&eG59v;0T%^Yct5^Z(+1?Y{*6e-Qxu zr|y5Yz;cPna^XC`5&C0m)FrOF_B3=!d)z;FObU!JrJYIq3LdjGOj-Abn|g`D2T$Jj zWJ+1U#d@&ieYy9Ydkc(l6$1!W4diUXubV8Zc?Pr;YB+!1~ie_`QEe$WdSeQ31lQVJ{K-g+6ky_xjYEh511WDKLp( z<;X0Sk^AdA-}50U2ddKGIraf{PG3aG`}_W{{HS@*d;|SE3#-)P`wKC-oTi!nIgX)! zoG#}1c5Upx4CS0(6LLCokP?Xy4p?^zWc{N!>aecl_9{V2_VtT*JnC*sKES#vC%*%S zwO0W*R;!j%U1EYpgU|;tc2*%LF4LZmMlU{3HUnm+QtnVgg_d`pR;W?OuC?e zpQgOFcJPq_Y~Pw!My0(7>lL6?!e-N!SKKyL<~w;-4zxtst#uJI0RIAg|4f?!ZM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#h@gNopRe`9m*{X`FOjH*SI&NH3`F@Rx|6l3-qvGEneJfKe zUQ%3{VrwIm?wW6wB7bt44E%X{hQ)t#Zn)<1k@_7Yh z)N!h+R0675_35wj7QP?TcUga1YN@4`T574Mt4sE&OYT)JKDCd#&(Nvb8x`hr{SE0| zwM7(#RB4gOv!.smp file. The smp file contains 4 sections: -
    -
  1. The first line holds the number of nodes (N).
  2. -
  3. The next N lines describe nodes coordinates. Each line holds 2 -coordinates of a node.
  4. - -
  5. A key-points line: indices of nodes to be mapped on geometrical -vertices. An index n refers to a node described on an n-th line of -section 2. The first node index is zero.
  6. - -
  7. The rest lines describe nodal connectivity of elements, one line +-# The first line holds the total number of the pattern nodes (N). +-# The next N lines describe nodes coordinates. Each line holds 2 +coordinates of a node for 2D pattern or 3 cordinates for 3D pattern. +Note, that for 3D pattern only relateive values in range [0;1] are +valid for coordinates of the nodes. +-# A key-points line: indices of nodes to be mapped on geometrical +vertices (for 2D pattern only). An index n refers to a node described +on an n-th line of section 2. The first node index is zero. For 3D +pattern key points are not specified. +-# The rest lines describe nodal connectivity of elements, one line for an element. A line holds indices of nodes forming an element. An index n refers to a node described on an n-th line of the section 2. The first node index is zero. There must be 3 or 4 indices on a -line: only 2d elements are allowed.
  8. -
+line for 2D pattern (only 2d elements are allowed) and 4, 5, 6 or 8 +indices for 3D pattern (only 3d elements are allowed). The 2D pattern must contain at least one element and at least one key-point. All key-points must lay on boundaries. -An example of a simple smp file and a preview of a pattern described -in this file: - -\image html image94.gif +The 3D pattern must contain at least one element. + +An example of a simple 2D pattern smp file: + +\code +!!! SALOME 2D mesh pattern file +!!! +!!! Nb of points: +9 + 200 0 !- 0 + 100 0 !- 1 + 0 0 !- 2 + 0 -100 !- 3 + 0 -200 !- 4 + 100 -200 !- 5 + 200 -200 !- 6 + 200 -100 !- 7 + 100 -100 !- 8 +!!! Indices of 4 key-points + 2 0 4 6 +!!! Indices of points of 6 elements + 0 1 8 + 8 5 6 7 + 2 3 8 + 8 3 4 5 + 8 7 0 + 8 1 2 +\endcode + +The image below provides a preview of above described pattern: + +\image html pattern2d.png + +An example of a simple 3D pattern smp file: + +\code +!!! SALOME 3D mesh pattern file +!!! +!!! Nb of points: +9 + 0 0 0 !- 0 + 1 0 0 !- 1 + 0 1 0 !- 2 + 1 1 0 !- 3 + 0 0 1 !- 4 + 1 0 1 !- 5 + 0 1 1 !- 6 + 1 1 1 !- 7 + 0.5 0.5 0.5 !- 8 +!!! Indices of points of 6 elements: + 0 1 5 4 8 + 7 5 1 3 8 + 3 2 6 7 8 + 2 0 4 6 8 + 0 2 3 1 8 + 4 5 7 6 8 +\endcode

Application of pattern mapping

@@ -50,86 +103,89 @@ The following dialog box shall appear: \image html patternmapping1.png +
2D Pattern Mapping dialog box
+ \image html patternmapping2.png +
3D Pattern Mapping dialog box
+ To apply a pattern to a geometrical object, you should specify: -
    -
  • a face having the number of vertices equal to the number of -key-points in the pattern; the number of key-points on internal -boundaries of a pattern must also be equal to the number of vertices -on internal boundaries of a face;
  • -
  • a vertex to which the first key-point should be mapped;
  • -
  • reverse or not the order of key-points. (The order of vertices of -a face is counterclockwise looking from outside).
  • -
+ +-# For 2D pattern + - A face having the number of vertices equal to the number of + key-points in the pattern; the number of key-points on internal + boundaries of a pattern must also be equal to the number of vertices + on internal boundaries of a face; + - A vertex to which the first key-point should be mapped; + - Reverse or not the order of key-points. (The order of vertices of + a face is counterclockwise looking from outside). +-# For 3D pattern + - 3D block (Solid) object; + - Two vertices that specify the order of nodes in the resulting + mesh. Then you either load a .smp pattern file previously created manually by clicking on the "Load pattern" button, or click on the \b -New button for automatic generation. -\n For an automatic generation you just specify a geometrical face -having a mesh built on it. Mesh nodes lying on face vertices become -key-points. Additionally, you may choose the way of getting nodes -coordinates by projecting nodes on the face instead of using +New button for automatic generation of the pattern. + +For an automatic generation you just specify a geometrical face (for +2D) or solid (for 3d) having a mesh built on it. Mesh nodes lying on +face vertices become key-points of 2D pattern. Additionally, for 2D +pattern you may choose the way of getting nodes coordinates by +projecting nodes on the face instead of using "positions on face" generated by mesher (if there is any). Faces having a seam edge can't be used for automatic pattern creation. When creating a pattern from an existing mesh, there are two possible cases: -
    -
  1. A sub-mesh on face is selected. A pattern is created from the 2d -elements bound to a face by mesher. Node coordinates are either + +- A sub-mesh on face/solid is selected. A pattern is created from the 2d/3d +elements bound to a face/solid by mesher. For 2D pattern, node coordinates are either "positions on face" computed by mesher, or coordinates got by node -projection on a geometrical surface, according to your choice.
  2. -
  3. A mesh where the main shape is a face, is selected. A pattern is -created from all the 2d elements in a mesh. If all mesh elements are -build by mesher, the user can select the way of getting nodes -coordinates, else all nodes are projected on a face surface.
  4. -
+projection on a geometrical surface, according to the user choice. For +3D pattern, nodes coordinates correspond to the nodes computed by mesher. +- A mesh where the main shape is a face/solid, is selected. A pattern is +created from all the 2d/3d elements in a mesh. In addition, for 2D +pattern, if all mesh elements are build by mesher, the user can select +the way of getting nodes coordinates, else all nodes are projected on +a face surface. \image html a-patterntype.png +
2D Pattern Creation dialog box
+ \image html a-patterntype1.png +
3D Pattern Creation dialog box
+

Mapping algorithm

-The mapping algorithm is as follows: -
    -
  1. Key-points are set in the order that they are encountered when -walking along a pattern boundary so that elements are on the left. The -first key-point is preserved. -
  2. - -
  3. Find geometrical vertices corresponding to key-points by vertices -order in a face boundary; here, "Reverse order of key-points" flag is -taken into account. - -\image html image95.gif -
  4. - -
  5. Boundary nodes of a pattern are mapped onto edges of a face: a -node located between certain key-points on a pattern boundary is -mapped on a geometrical edge limited by corresponding geometrical -vertices. Node position on an edge reflects its distance from two -key-points. - -\image html image96.gif -
  6. - -
  7. Coordinates of a non-boundary node in a parametric space of a face -are defined as following. In a parametric space of a pattern, a node -lays at the intersection of two iso-lines, each of which intersects a -pattern boundary at least at two points. Knowing mapped positions of -boundary nodes, we find where isoline-boundary intersection points are -mapped to, and hence we can find mapped isolines direction and then, -two node positions on two mapped isolines. The eventual mapped -position of a node is found as an average of positions on mapped -isolines. - -\image html image97.gif -
  8. -
- -
See Also a sample TUI Script of a +The mapping algorithm for 2D case is as follows: + +- Key-points are set in the order that they are encountered when + walking along a pattern boundary so that elements are on the left. The + first key-point is preserved. +- Find geometrical vertices corresponding to key-points by vertices + order in a face boundary; here, "Reverse order of key-points" flag is + taken into account. \image html image95.gif +- Boundary nodes of a pattern are mapped onto edges of a face: a + node located between certain key-points on a pattern boundary is + mapped on a geometrical edge limited by corresponding geometrical + vertices. Node position on an edge reflects its distance from two + key-points. \image html image96.gif +- Coordinates of a non-boundary node in a parametric space of a face + are defined as following. In a parametric space of a pattern, a node + lays at the intersection of two iso-lines, each of which intersects a + pattern boundary at least at two points. Knowing mapped positions of + boundary nodes, we find where isoline-boundary intersection points are + mapped to, and hence we can find mapped isolines direction and then, + two node positions on two mapped isolines. The eventual mapped + position of a node is found as an average of positions on mapped + isolines. \image html image97.gif + +For 3D case the algorithm is similar. + +See Also a sample TUI Script of a \ref tui_pattern_mapping "Pattern Mapping" operation. */ diff --git a/doc/salome/gui/SMESH/input/tui_modifying_meshes.doc b/doc/salome/gui/SMESH/input/tui_modifying_meshes.doc index 66b6361fa..b0eaca1fb 100644 --- a/doc/salome/gui/SMESH/input/tui_modifying_meshes.doc +++ b/doc/salome/gui/SMESH/input/tui_modifying_meshes.doc @@ -768,7 +768,6 @@ mesh.RotationSweepObject(GroupRotate, axisXYZ, angle45, 4, 1e-5) \code import geompy - import smesh # define the geometry @@ -802,17 +801,100 @@ algo2D.MaxElementArea(240) isDone = Mesh_2.Compute() if not isDone: print 'Mesh Mesh_2 : computation failed' -# create a pattern +# create a 2d pattern pattern = smesh.GetPattern() isDone = pattern.LoadFromFace(Mesh_2.GetMesh(), Face_2, 0) if (isDone != 1): print 'LoadFromFace :', pattern.GetErrorCode() # apply the pattern to a face of the first mesh -pattern.ApplyToMeshFaces(Mesh_1.GetMesh(), [17], 0, 0) - +facesToSplit = Mesh_1.GetElementsByType(smesh.SMESH.FACE) +print "Splitting %d rectangular face(s) to %d triangles..."%(len(facesToSplit), 2*len(facesToSplit)) +pattern.ApplyToMeshFaces(Mesh_1.GetMesh(), facesToSplit, 0, 0) isDone = pattern.MakeMesh(Mesh_1.GetMesh(), 0, 0) if (isDone != 1): print 'MakeMesh :', pattern.GetErrorCode() + +# create quadrangle mesh +Mesh_3 = smesh.Mesh(Box_1) +Mesh_3.Segment().NumberOfSegments(1) +Mesh_3.Quadrangle() +Mesh_3.Hexahedron() +isDone = Mesh_3.Compute() +if not isDone: print 'Mesh Mesh_3 : computation failed' + +# create a 3d pattern (hexahedrons) +pattern_hexa = smesh.GetPattern() + +smp_hexa = """!!! Nb of points: +15 + 0 0 0 !- 0 + 1 0 0 !- 1 + 0 1 0 !- 2 + 1 1 0 !- 3 + 0 0 1 !- 4 + 1 0 1 !- 5 + 0 1 1 !- 6 + 1 1 1 !- 7 + 0.5 0 0.5 !- 8 + 0.5 0 1 !- 9 + 0.5 0.5 0.5 !- 10 + 0.5 0.5 1 !- 11 + 1 0 0.5 !- 12 + 1 0.5 0.5 !- 13 + 1 0.5 1 !- 14 + !!! Indices of points of 4 elements: + 8 12 5 9 10 13 14 11 + 0 8 9 4 2 10 11 6 + 2 10 11 6 3 13 14 7 + 0 1 12 8 2 3 13 10""" + +pattern_hexa.LoadFromFile(smp_hexa) + +# apply the pattern to a mesh +volsToSplit = Mesh_3.GetElementsByType(smesh.SMESH.VOLUME) +print "Splitting %d hexa volume(s) to %d hexas..."%(len(volsToSplit), 4*len(volsToSplit)) +pattern_hexa.ApplyToHexahedrons(Mesh_3.GetMesh(), volsToSplit,0,3) +isDone = pattern_hexa.MakeMesh(Mesh_3.GetMesh(), True, True) +if (isDone != 1): print 'MakeMesh :', pattern_hexa.GetErrorCode() + +# create one more quadrangle mesh +Mesh_4 = smesh.Mesh(Box_1) +Mesh_4.Segment().NumberOfSegments(1) +Mesh_4.Quadrangle() +Mesh_4.Hexahedron() +isDone = Mesh_4.Compute() +if not isDone: print 'Mesh Mesh_4 : computation failed' + +# create another 3d pattern (pyramids) +pattern_pyra = smesh.GetPattern() + +smp_pyra = """!!! Nb of points: +9 + 0 0 0 !- 0 + 1 0 0 !- 1 + 0 1 0 !- 2 + 1 1 0 !- 3 + 0 0 1 !- 4 + 1 0 1 !- 5 + 0 1 1 !- 6 + 1 1 1 !- 7 + 0.5 0.5 0.5 !- 8 + !!! Indices of points of 6 elements: + 0 1 5 4 8 + 7 5 1 3 8 + 3 2 6 7 8 + 2 0 4 6 8 + 0 2 3 1 8 + 4 5 7 6 8""" + +pattern_pyra.LoadFromFile(smp_pyra) + +# apply the pattern to a face mesh +volsToSplit = Mesh_4.GetElementsByType(smesh.SMESH.VOLUME) +print "Splitting %d hexa volume(s) to %d hexas..."%(len(volsToSplit), 6*len(volsToSplit)) +pattern_pyra.ApplyToHexahedrons(Mesh_4.GetMesh(), volsToSplit,1,0) +isDone = pattern_pyra.MakeMesh(Mesh_4.GetMesh(), True, True) +if (isDone != 1): print 'MakeMesh :', pattern_pyra.GetErrorCode() \endcode
-- 2.30.2