for option
do
case $option in
- -with-ihm | --with-ihm)
+ -with-gui | --with-gui)
SMESH_WITH_GUI="yes"
break;;
- -without-ihm | --without-ihm | -with-ihm=no | --with-ihm=no)
+ -without-gui | --without-gui | -with-gui=no | --with-gui=no)
SMESH_WITH_GUI="no"
break;;
esac
filesl=`find .`; \
for filen in $${filesl}; do \
sed 's/\([^s1e]\)smeshDC\|^smeshDC/\1smesh/g' $${filen} > ./tmp; \
- mv -f tmp $${filen}; \
+ sed 's/smesh:://g' ./tmp > ./tmp1; \
+ rm -f tmp; \
+ mv -f tmp1 $${filen}; \
done; \
cd ..; \
echo "Running doxygen in directory: "`pwd`; \
\image html b-mberofsegments.png
-<br><b>Scale Distribution</b> - each next segment differs from the
-previous according to the formula: <b>A</b>i+1 = <b>A</b>i * k, where \b k is a
-<b>Scale Factor</b>.
+<br><b>Scale Distribution</b> - length of segments gradually changes depending on the <b>Scale Factor</b>, which is a ratio of the first segment length to the last segment length.
\image html a-nbsegments2.png
\image html addnode.png
In this dialog box set coordinates for your node in the \b Coordinates
-set of fields and click the \b Apply or \b OK button. Your node will be
+set of fields and click the \b Apply or <b>Apply and Close</b> button. Your node will be
created:
\image html add_node.png
In this dialog box specify the nodes which will form your edge by
selecting them in the 3D viewer with pressed Shift button and click
-the \b Apply or \b OK button. Your edge will be created:
+the \b Apply or <b>Apply and Close</b> button. Your edge will be created:
\image html add_edge.png
In this dialog box specify the nodes which will form your triangle by
selecting them in the 3D viewer with pressed Shift button and click
-the \b Apply or \b OK button. Your triangle will be created:
+the \b Apply or <b>Apply and Close</b> button. Your triangle will be created:
\image html add_triangle.png
In this dialog box specify the nodes which will form your quadrangle
by selecting them in the 3D viewer with pressed Shift button and click
-the \b Apply or \b OK button. Your quadrangle will be created:
+the \b Apply or <b>Apply and Close</b> button. Your quadrangle will be created:
\image html add_quadrangle.png
In this dialog box specify the nodes which will form your polygon by
selecting them in the 3D viewer with pressed Shift button and click
-the \b Apply or \b OK button.
+the \b Apply or <b>Apply and Close</b> button.
\image html add_polygone.png
In this dialog box specify the nodes which will form your tetrahedron
by selecting them in the 3D viewer with pressed Shift button and click
-the \b Apply or \b OK button. Your tetrahedron will be created:
+the \b Apply or <b>Apply and Close</b> button. Your tetrahedron will be created:
\image html image70.jpg
In this dialog box specify the nodes which will form your hexahedron
by selecting them in the 3D viewer with pressed Shift button and click
-the \b Apply or \b OK button. Your hexahedron will be created:
+the \b Apply or <b>Apply and Close</b> button. Your hexahedron will be created:
\image html image71.jpg
select \b Face as <b>Elements Type</b>, you will be able to select the faces
which will form your polyhedron in the 3D viewer with pressed Shift
button. If you've managed to obtain the necessary result, click the
-\b Apply or \b OK button. Your polyhedron will be created:
+\b Apply or <b>Apply and Close</b> button. Your polyhedron will be created:
\image html add_polyhedron.png
table. To define the middle nodes for each edge double-click on the
respective field and input the number of the node. All edges and the
object formed by them will be displayed in the Object browser. When
-all edges are defined you will be able to click \b OK or \b Apply button to
+all edges are defined you will be able to click \b Apply or <b>Apply and Close</b> button to
add the element to the mesh.
\image html aqt.png
<li>For meshing of 2D entities (<b>faces</b>):</li>
<ul>
-<li>Triangle meshing algorithms (Mefisto and Netgen 1D-2D ) - Faces
+<li>Triangle meshing algorithms (Mefisto, Netgen 1D-2D and BLSUFR ) - Faces
are split into triangular elements.</li>
<li>Quadrangle meshing algorithm (Mapping) - Faces are split into
quadrangular elements.</li>
<ul>
<li>Hexahedron meshing algorithm (i,j,k) - Volumes are split into
hexahedral (cubic) elements.</li>
-<li>Tetrahedron (Netgen) meshing algorithm - Volumes are split into
+<li>Tetrahedron (Netgen and GHS3D) meshing algorithms - Volumes are split into
tetrahedral (pyramidal) elements.</li>
</ul>
\image html image126.gif
</ul>
+Note that BLSURF and GHS3D are commercial meshers.\n
+
There also is a number of more specific algorithms:
<ul>
<li>\ref projection_algos_page "for meshing by projection of another mesh"</li>
--- /dev/null
+/*!
+
+\page blsurf_hypo_page BLSURF Parameters hypothesis
+
+\n BLSURF Parameters hypothesis works only with <b>BLSURF</b> 2d
+algorithm. This algorithm is a commercial software.
+
+\image html blsurf_parameters.png
+
+<ul>
+<li><b>Name</b> - allows to define the name of the hypothesis (BLSURF
+Parameters by default).</li>
+
+<li><b>Physical Mesh</b> - if is set to "Custom", allows to set size
+of mesh elements to generate in <b>User size</b> field.
+</li>
+
+<li><b>User size</b> - size of mesh elements to generate. </li>
+
+<li><b>Max Physical Size</b> - is an upper limit of mesh element size. </li>
+
+<li><b>Min Physical Size</b> - is a lower limit of mesh element size. </li>
+
+<li><b>Geometrical mesh</b> - if is set to "Custom", allows to set
+mesh element deflection from curves and surfaces and element
+size change rate in <b>Angle Mesh S</b>, <b>Angle Mesh C</b> and
+<b>Gradation</b> fields correspondingly. These fields control
+computation of element size, so called <i>geometrical size</i>, conform to
+the surface geometry considering local curvatures. \n
+The eventual element size at each point will be minimum of <b>User
+size</b>, if given, and the <i>geometrical size</i>. </li>
+
+<li><b>Angle Mesh S</b> - maximal allowed angle in degrees at a mesh
+node between the mesh face and the tangent to the geometrical surface. </li>
+
+<li><b>Angle Mesh C</b> - maximal allowed angle in degrees at a mesh
+node between the mesh edge and the tangent to the geometrical curve. </li>
+
+<li><b>Max Geometrical Size</b> - is an upper limit of <i>geometrical size</i>.</li>
+
+<li><b>Min Geometrical Size</b> - is a lower limit of <i>geometrical size</i>.</li>
+
+<li><b>Gradation</b> - maximal allowed ratio between the lengths of
+two adjacent edges. </li>
+
+<li><b>Allow Quadrangles</b> - to create quadrilateral elements.</li>
+
+<li><b>Patch independent</b> - if this box is checked on, geometrical
+edges are not respected and all geometrical faces are meshed as one
+hyper-face.</li>
+
+\image html blsurf_parameters_advanced.png
+
+<li><b>Topology</b> - allows creation of a conform mesh on a shell of
+not sewed faces.
+<ul>
+ <li>"From CAD" means that mesh conformity is assured by conformity
+ of a shape.</li>
+ <li>"Pre-process" and "Pre-process++" let BLSURF software
+ pre-process the geometrical model to eventually produce a conform
+ mesh. </li>
+</ul>
+
+<li><b>Verbosity level</b> - Defines the percentage of "verbosity" of
+BLSURF [0-100].</li>
+
+<li><b>Add option</b> - provides a choice of multiple advanced
+options, each of which, if selected, appear in a table where you can
+enter a value of the option and edit it later.</li>
+
+<li><b>Clear option</b> - removes option selected in the table.
+
+</ul>
+
+\n
+Commonly usable options are following. The name <i>diag</i> stands there for
+the diagonal of the bounding box of the geometrical object to mesh.
+
+<ul>
+<li><b>topo_eps1</b> (real) - is the tolerance level inside a CAD
+patch. By default is equal to <i>diag</i> × 10-4. This tolerance is used to
+identify nodes to merge within one geometrical face when \b Topology
+option is to pre-process. Default is <i>diag</i>/10.0.</li>
+
+<li><b>topo_eps2</b> (real) - is the tolerance level between two CAD
+patches. By default is equal to <i>diag</i> × 10-4. This tolerance is used to
+identify nodes to merge over different geometrical faces when
+\b Topology option is to pre-process. Default is <i>diag</i>/10.0.</li>
+
+<li>\b LSS (real) - is an abbreviation for "length of sub-segment". It is
+a maximal allowed length of a mesh edge. Default is 0.5.</li>
+
+<li>\b frontal (integer)
+<ul>
+<li> 1 - the mesh generator inserts points with an advancing front method.</li>
+<li> 0 - it inserts them with an algebraic method (on internal edges). This method is
+slightly faster but generates less regular meshes. </li>
+</ul>
+Default is 0.</li>
+
+<li>\b hinterpol_flag (integer) - determines the computation of an
+interpolated value <i>v</i> between two points <i>P1</i> and <i>P2</i> on a
+curve. Let <i>h1</i> be the value at point <i>P1,</i> <i>h2</i> be the value at point
+<i>P2,</i> and <i>t</i> be a parameter varying from 0 to 1 when moving from <i>P1
+to</i> <i>P2</i> .
+<ul>
+<li>0 - the interpolation is linear: <i>v = h1 + t (h2 - h1 )</i></li>
+<li>1 - the interpolation is geometric: <i>v = h1 * pow( h2/h1, t)</i></li>
+<li>2 - the interpolation is sinusoidal: <i>v = (h1+h2)/2 +
+(h1-h2)/2*cos(PI*t)</i></li>
+</ul>
+Default is 0.</li>
+
+<li>\b hmean_flag (integer) - determines the computation of the mean of several
+values:<ul>
+<li>-1 - the minimum is computed.</li>
+<li>0 or 2 - the arithmetic mean computed.
+<li>1 - the geometric mean is computed.</li>
+</ul>
+Default is 0.</li>
+
+<li>\b CheckAdjacentEdges, \b CheckCloseEdges and \b CheckWellDefined
+(integers) - give number of calls of equally named subroutines the
+purpose of which is to improve the mesh of domains having narrow
+parts. At each iteration,\b CheckCloseEdges decreases the sizes of the
+edges when two boundary curves are neighboring,\b CheckAdjacentEdges
+balances the sizes of adjacent edges, and \b CheckWellDefined checks if
+the parametric domain is well defined. Default values are 0.</li>
+
+
+<li>\b CoefRectangle (real)- defines the relative thickness of the rectangles
+used by subroutine \b CheckCloseEdges (see above). Default is 0.25.</li>
+
+<li>\b eps_collapse (real) - if is more than 0.0, BLSURF removes
+curves whose lengths are less than \b eps_collapse. Here, to obtain an
+approximate value of the length of a curve, the latter is arbitrarily
+split into 20 edges. Default is 0.0.</li>
+
+<li>\b eps_ends (real) - is used to detect curves whose lengths are very
+small, which sometimes constitutes an error. A message is printed
+if<i> fabs(P2-P1) < eps_ends</i>, where <i>P1</i> and <i>P2</i> are the
+extremities of a curve. Default is <i>diag</i>/500.0.</li>
+
+<li>\b prefix (char) - is a prefix of the files generated by
+BLSURF. Default is "x".</li>
+
+<li>\b refs (integer) - reference of a surface, used when exporting
+files. Default is 1.</li>
+</ul>
+
+\n
+The following advanced options are not documented and you can use them
+at your own risk.
+\n\n Interger variables:
+<ul>
+<li> addsurf_ivertex</li>
+<li> background </li>
+<li> coiter </li>
+<li> communication </li>
+<li> decim </li>
+<li> export_flag </li>
+<li> file_h </li>
+<li> gridnu </li>
+<li> gridnv </li>
+<li> intermedfile </li>
+<li> memory </li>
+<li> normals </li>
+<li> optim </li>
+<li> pardom_flag </li>
+<li> pinch </li>
+<li> rigid </li>
+<li> surforient </li>
+<li> tconf </li>
+<li> topo_collapse </li>
+</ul>
+Real variables:
+<ul>
+<li> addsurf_angle </li>
+<li> addsurf_R </li>
+<li> addsurf_H </li>
+<li> addsurf_FG </li>
+<li> addsurf_r </li>
+<li> addsurf_PA </li>
+<li> angle_compcurv </li>
+<li> angle_ridge </li>
+<li> eps_pardom </li>
+</ul>
+String variables:
+<ul>
+<li> export_format </li>
+<li> export_option </li>
+<li> import_option </li>
+</ul>
+
+
+\n
+Currently BLSURF plugin has the following limitations.
+<ul>
+ <li>Mesh contains inverted elements, if it is based on shape,
+ consisting of more than one face (box, cone, torus...) and if
+ the option "Allow Quadrangles (Test)" was checked before
+ computation.</li>
+
+ <li>SIGFPE exception is raised at trying to compute mesh, based on
+ box, with checked option "Patch independent".</li>
+
+ <li>It has been found out that BLSURF algorithm can't be used as a
+ local algorithm (on sub-meshes) and as a provider of low-level
+ mesh for some 3D algorithms because BLSURF mesher (and
+ consequently plugin) does not provide information on node
+ parameters on edges (U) and faces (U,V). For example the
+ following combinations of algorithms are impossible:
+ <ul>
+ <li> global MEFISTO or Quadrangle(mapping) + local BLSURF;</li>
+ <li> BLSUFR + Projection 2D from faces meshed by BLSURF;</li>
+ <li> local BLSURF + Extrusion 3D;</li>
+ </ul>
+ </li>
+</ul>
+
+*/
</ul>
</li>
-<li>Click the \b Apply or \b OK button to confirm the operation.</li>
+<li>Click the \b Apply or <b>Apply and Close</b> button to confirm the operation.</li>
</ol>
<br><b>See Also</b> a sample TUI Script of a
\image html image99.gif
-To get a new object from \b Clipping, click \b Ok.
+To get a new object from \b Clipping, click \b Apply.
*/
\image html meshcomputationfail.png
After you select the error, <b>Show Subshape</b> button allows
-visualizing the mesh elements that cause it.
+visualizing the geometrical entity that causes it.
\image html failed_computation.png
-<b>Publish Subshape</b> button allows importing it in a separate MED
-or UNV file.
+<b>Publish Subshape</b> button publishes the subshape, whose meshing
+failed, in GEOM component as a child of the mesh geometry, which
+allows analyzing the problem geometry and creating a submesh on it in
+order to locally tune hypotheses.
<b>NOTE</b> It is possible to define a 1D or a 2D mesh in a
python script and then use such submeshes in the construction of a 3D
\n <b>Select from</b> set of fields allows to choose a submesh or an existing
group whose elements of the previously defined type will be added to
the list of elements which will form your group.
-\n <b>Color Number</b> (integer only, ranging from 0 to 9999) - allows to
-assign to the group a certain index, for example, defining boundary
-conditions. This feature introduces a useful element of preprocessing
-in Mesh module. Note that <b>Color number</b> attribute has nothing to do
-with the colors used for the display of the elements of the group.
+\n <b>Color</b> - allows to assign to the group a certain color, for
+example, defining boundary conditions. This feature introduces a
+useful element of preprocessing in Mesh module. Note that <b>Color</b> attribute defines
+the colors used for the display of the elements of the group.
+\n <b>Warning</b> The Med Color group interface may change in future versions of Salome.
+
\image html creategroup.png
<li>\ref a2d_meshing_hypo_page</li>
<li>\ref max_element_volume_hypo_page</li>
<li>\ref netgen_2d_3d_hypo_page</li>
+<li>\ref ghs3d_hypo_page</li>
+<li>\ref blsurf_hypo_page</li>
<li>\ref additional_hypo_page</li>
</ul>
<li>\subpage constructing_submeshes_page</li>
</ul>
</li>
-<li>Click the \b Apply or \b OK button to confirm the operation.</li>
+<li>Click the \b Apply or <b>Apply and Close</b> button to confirm the operation.</li>
</ol>
\image html image52.jpg
<li>\subpage a2d_meshing_hypo_page</li>
<li>\subpage max_element_volume_hypo_page</li>
<li>\subpage netgen_2d_3d_hypo_page</li>
+<li>\subpage ghs3d_hypo_page</li>
+<li>\subpage blsurf_hypo_page</li>
<li>\subpage additional_hypo_page</li>
</ul>
select one or several groups you wish to delete in the 3D viewer or in
the Object Browser.
\n The selected groups will be listed in <b>Delete groups with contents</b>
-menu. Then click Ok button to remove the selected groups and close the
-menu or Apply button to remove them and proceed with the selection.
+menu. Then click <b>Apply and Close</b> button to remove the selected groups and close the
+menu or \b Apply button to remove them and proceed with the selection.
\image html deletegroups.png
</li>
<li>Enter the ID of the required edge in the \b Edge field or select
this edge in the 3D viewer.</li>
-<li>Click the \b Apply or \b OK button.</li>
+<li>Click the \b Apply or <b>Apply and Close</b> button.</li>
</ol>
\image html image38.jpg
In this dialog box you can modify the name of your group and add or
remove the elements forming it. For more information see
\ref creating_groups_page "Creating Groups" page.
-<li>Click the \b OK or \b Apply button to confirm modification of the
+<li>Click the \b Apply or <b>Apply and Close</b> button to confirm modification of the
group.</li>
</ol>
\image html image106.gif
<center><em>"Remove" button</em></center>
+<b>Linear variation of the angles</b> option allows defining the angle of gradual rotation for the whole path.
+At each step the shape will be rotated by angle/nb. of steps.
+
</li>
</ul>
</li>
--- /dev/null
+/*!
+
+\page ghs3d_hypo_page GHS3D Parameters hypothesis
+
+\n GHS3D Parameters hypothesis works only with <b>Tetrahedron (GHS3D)</b>
+algorithm. This algorithm is a commercial software.
+
+\image html ghs3d_parameters_basic.png
+
+<ul>
+<li><b>Name</b> - allows to define the name of the hypothesis (GHS3D
+Parameters by default).</li>
+
+<li><b>To mesh holes</b> - if this box is checked, the algorithm will
+create mesh also in holes inside a solid shape, else only the outermost
+shape will be meshed. Volumic elements created within holes are bound
+to the solid.</li>
+
+<li><b>Optimization level</b> - sets the desired optimization level.
+Optimization levels are: none, light, medium, strong, in increasing
+order of "quality vs speed" ratio.
+</li>
+
+\image html ghs3d_parameters_advanced.png
+
+<li><b>Maximum memory size</b> - launches ghs3d software with
+work space limited to specified Megabytes of memory. If this option is
+checked off, the software will be launched with 0.7 * total RAM space. </li>
+
+<li><b>Initial memory size</b> - starts ghs3d software with
+specified Megabytes of work space. If this option is checked off, the
+software will be started with 100 Megabytes of working space. </li>
+
+<li><b>Working directory</b> - defines folder for input and output
+files of ghs3d software, which are files starting with "GHS3D_" prefix. </li>
+
+<li><b>Keep working files</b> - allows to check input and output files
+of ghs3d software, while usually these files are removed after mesher launch.</li>
+
+<li><b>Verbose level</b> - to choose verbosity level in the range 0 to 10.
+<ul> <li>0, no standard output,
+</li><li>2, prints the data, quality statistics of the skin and final
+meshes and indicates when the final mesh is being saved. In addition
+the software gives indication regarding the CPU time.
+</li><li>10, same as 2 plus the main steps in the computation, quality
+statistics histogram of the skin mesh, quality statistics histogram
+together with the characteristics of the final mesh.
+</li></ul></li>
+
+<li><b>To create new nodes</b> - if this option is checked off, ghs3d
+tries to create tetrahedrons using only nodes of 2D mesh.</li>
+
+<li><b>To use boundary recovery version</b> - enables using a
+boundary recovery module which tries to
+create volume meshes starting from very poor quality surface meshes
+(almost flat triangles on the surface, high density propagation,
+extreme aspect ratios, etc.) which fails with the standard version. The
+resulting volume mesh will however most likely have a very poor
+quality (poor aspect ratio of elements, tetrahedra with a very small
+positive volume).</li>
+
+<li><b>Option as text</b> - allows entering any text that will be
+used as command line option of ghs3d. This is for giving
+advanced options in a free from. </li>
+
+</ul>
+
+*/
\ No newline at end of file
<li>\ref a2d_meshing_hypo_page</li>
<li>\ref max_element_volume_hypo_page</li>
<li>\ref netgen_2d_3d_hypo_page</li>
+<li>\ref ghs3d_hypo_page</li>
+<li>\ref blsurf_hypo_page</li>
<li>\ref additional_hypo_page</li>
</ul>
<li>\ref constructing_submeshes_page</li>
\image html mergeelems.png
<ul>
-<li>\b Name is the name of the mesh whose elements will be merged.</li>
-<li>\b Tolerance is a maximum distance between elements sufficient for
-merging.
-<ul>
-<li>\b Detect button generates the list of coincident elements for the given
-\b Tolerance.</li>
-</ul>
-</li>
-<li><b>Coincident elements</b> is a list of groupes of elements for
-merging. All elements of each group will form one after the operation.
-<ul>
-<li>\b Remove button deletes the selected group from the list.</li>
-<li>\b Add button adds to the list a group of elements selected in the
-viewer with pressed "Shift" key.</li>
-<li><b>Select all</b> checkbox selects all groups.</li>
-</ul>
-</li>
-<li><b>Edit selected group</b> list allows editing the selected
-group:
-<br><br>
-\image html add.gif
-<center>adds to the group the element selected in the viewer.</center>
-<br>
-\image html remove.gif
-<center>removes from the group the selected element.</center>
-<br>
-\image html sort.gif
-<center>moves the selected element to the first position in the
-group. This means that all other elements will be merged into this
-one.</center><br>
-</li>
+ <li>\b Name is the name of the mesh whose elements will be merged.</li>
+ <li>\b Tolerance is a maximum distance between elements sufficient for merging.
+ <ul>
+ <li>\b Detect button generates the list of coincident elements for the given \b Tolerance.</li>
+ </ul></li>
+ <li><b>Coincident elements</b> is a list of groupes of elements for
+ merging. All elements of each group will form one after the operation.
+ <ul>
+ <li>\b Remove button deletes the selected group from the list.</li>
+ <li>\b Add button adds to the list a group of elements selected in the
+ viewer with pressed "Shift" key.</li>
+ <li><b>Select all</b> checkbox selects all groups.</li>
+ </ul></li>
+ <li><b>Edit selected group</b> list allows editing the selected group:
+ <br><br>
+ \image html add.gif
+ <center>adds to the group the element selected in the viewer.</center>
+ <br>
+ \image html remove.gif
+ <center>removes from the group the selected element.</center>
+ <br>
+ \image html sort.gif
+ <center>moves the selected element to the first position in the
+ group. This means that all other elements will be merged into this
+ one.</center>
+ <br>
+ </li>
+ <li>To confirm your choice click \b Apply or <b>Apply and Close</b> button.</li>
</ul>
-</li>
-<li>To confirm your choice click \b OK or \b Apply button.</li>
-</ol>
In this picture you see a triangle which coincides with one of the
elements of the mesh. After we apply <b>Merge Elements</b> functionality, the
\image html meshtrianglemergeelem1.png
-<br><b>See Also</b> a sample TUI Script of a
-\ref tui_merging_elements "Merge Elements" operation.
+<br><b>See Also</b> a sample TUI Script of a
+\ref tui_merging_elements "Merge Elements" operation.
*/
</li>
</ul>
</li>
-<li>To confirm your choice click \b OK or \b Apply button.</li>
+<li>To confirm your choice click \b Apply or <b>Apply and Close</b> button.</li>
</ol>
\image html merging_nodes1.png
select this node in the 3D viewer. The coordinates of your node will
be automatically displayed in the \b Coordinates set of fields.</li>
<li>Set new coordinates for your node in the \b Coordinates set of fields.</li>
-<li>Click the \b Apply or \b OK button.</li>
+<li>Click the \b Apply or <b>Apply and Close</b> button.</li>
</ol>
\image html moving_nodes1.png
<ul>
<li>\ref removing_nodes_anchor "Nodes"</li>
<li>\ref removing_elements_anchor "Elements"</li>
+<li>\ref clear_mesh_anchor "Clear Mesh Data"</li>
</ul>
<br>
In this dialog box you can specify one or several elements of your
mesh (with pressed Shift button) by choosing them in the 3D viewer.
</li>
-<li>Click OK or Apply to confirm deletion of the specified elements.</li>
+<li>Click \b Apply or <b>Apply and Close</b> to confirm deletion of the specified elements.</li>
</ol>
\image html remove_elements1.png
\image html remove_elements2.png
+
+<br>
+\anchor clear_mesh_anchor
+<h2>Clearing Mesh Data</h2>
+
+<em>To remove all nodes and all types of cells in your mesh at once:</em>
+<ol>
+<li>Select your mesh in the Object Browser or in the 3D viewer.</li>
+
+<li>From the Modification menu choose Remove and from the associated
+submenu select the Clear Mesh Data, or just click <em>"Clear Mesh Data"</em>
+button in the toolbar. You can also right-click on the mesh in the
+Object Browser and select Clear Mesh Data in the pop-up menu.
+</ol>
+
+\image html mesh_clear.png
+<center><em>"Clear Mesh Data" button</em></center>
+
+
<br><b>See Also</b> a sample TUI Script of a
\ref tui_removing_nodes_and_elements "Removing Nodes and Elements" operation.
<li>Fill the \b Mesh field by selecting your mesh in the Object
Browser or in the 3D viewer.</li>
-<li>Click the \b Apply or \b OK button to perform the operation.</li>
+<li>Click the \b Apply or <b>Apply and Close</b> button to perform the operation.</li>
</ol>
<br>
<li>Fill the \b Mesh field by selecting your mesh in the Object
Browser or in the 3D viewer.</li>
-<li>Click the \b Apply or \b OK button to perform the operation.</li>
+<li>Click the \b Apply or <b>Apply and Close</b> button to perform the operation.</li>
</ol>
<br><b>See Also</b> a sample TUI Script of a
submesh,</li>
<li>specify the axis (point and vector) around which the elements will
be revolved,</li>
-<li>angle of rotation,</li>
-<li>number of steps,</li>
+<li>angle of rotation and number of steps,</li>
+<ul> <li> Angle by Step - the elements are extruded by the specified angle at each step (i.e. for Angle=30 and Number of Steps=2, the elements will be extruded
+ by 30 degrees twice for a total of 30*2=60)</li>
+
+\image html revolutionsn2.png
+
+<li> Total Angle - the elements are extruded by the specified angle only once and the number of steps defines the number of iterations
+(i.e.for Angle=30 and Number of Steps=2, the elements will be extruded by 30/2=15 degrees twice for a total of 30). </li>
+
+\image html revolutionsn1.png
+
+</ul>
<li>tolerance of rotation</li>
</ul>
+
+<li> <b>Preview</b> checkbox allows showing the results of parameter-setting in the viewer </li>
<li> <b>Generate Groups</b> checkbox allows copying the groups of
elements of the source mesh to the newly created one. </li>
</li>
<li>Click the \b Apply or \b OK button.</li>
</ol>
-\image html image78.jpg
<br><b>See Also</b> a sample TUI Script of a
\ref tui_revolution "Revolution" operation.
\n Each <b>Entity type</b> has its specific list of criteria, however all
filters have common syntax. For each criterion you should specify the
<b>Threshold Value</b> and whether we search for the elements that should be
-\b More, \b Less or \b Equal to this \b Value. You should also specify if the
-criterion is \b Unary or \b Binary.
+\b More, \b Less or \b Equal to this \b Value. You can also nagate the
+sense of a criterion using \b Unary operator Not and you should
+specify logical relations between criteria using \b Binary operators
+Or and And.
\n Some criteria should have the additional parameter of \b Tolerance.
When we create a <b>Standalone Group</b> using filters (for this click
existing filter from <b>Selection filter library</b> and <b>Add
to...</b> button gives you a possibility to save your current filter
in the Library.
+\n <b>Note:</b> If button <b>Apply and Close</b> is disabled, there
+is no selected mesh in Object Browser and the filter can not be
+created. You have to select the mesh and the button will be enabled.
\image html a-filteronedges.png
-*/
\ No newline at end of file
+Some criteria are applicable to all <b>Entity types</b>:
+<ul><li>
+<b>Belong to Geom</b> selects entities whose all nodes belong to a
+submesh on the shape defined by <b>Threshold Value</b>. The threshold shape
+must be sub-shape of the main shape of mesh.
+</li><li>
+<b>Lying on Geom</b> selects entities whose at least one node belongs to a
+submesh on the shape defined by <b>Threshold Value</b>. The threshold shape
+must be sub-shape of the main shape of mesh.
+</li><li>
+<b>Range of IDs</b> allows selection of entities having certain
+IDs. <b>Threshold Value</b> can be like this: "1,2,3,50-60,63,67,70-78"
+</li>
+</ul>
+
+The following criteria are applicable to all <b>Entity types</b> except <b>Volumes</b>:
+<ul><li>
+<b>Belong to Plane</b> selects entities whose all nodes belong to a
+specified plane within a given <b>Tolerance</b>.
+</li><li>
+<b>Belong to Cylinder</b> selects entities whose all nodes belong to a
+specified cylinder within a given <b>Tolerance</b>.
+</li><li>
+<b>Belong to Surface</b> selects entities whose all nodes belong to a
+specified arbitrary surface within a given <b>Tolerance</b>.
+</li>
+</ul>
+
+Additional criteria to select mesh <b>Edges</b> are the following:
+<ul><li>
+<b>Free Borders</b> selects free 1D mesh elements, i.e. edges belonging to
+one face only. See also a
+\ref free_borders_page "Free Borders quality control".
+</li><li>
+<b>Borders at Multi-Connections</b> selects edges belonging to several faces.
+The number of faces should be more, less or equal (within a given <b>Tolerance</b>)
+to the predefined <b>Threshold Value</b>. See also a
+\ref borders_at_multi_connection_page "Borders at Multi-Connection quality control".
+</li><li>
+<b>Length</b> selects edges with a value of length, which is more, less or equal
+(within a given <b>Tolerance</b>) to the predefined <b>Threshold Value</b>.
+See also a
+\ref length_page "Length quality control".
+</li>
+</ul>
+
+Additional criteria to select mesh <b>Faces</b> are the following:
+<ul><li>
+<b>Aspect ratio</b> selects 2D mesh elements with an aspect ratio (see also an
+\ref aspect_ratio_page "Aspect Ratio quality control"), which is more, less or equal
+(within a given <b>Tolerance</b>) to the predefined <b>Threshold Value</b>.
+</li><li>
+<b>Warping</b> selects quadrangles with warping angle (see also a
+\ref warping_page "Warping quality control"), which is more, less or equal
+(within a given <b>Tolerance</b>) to the predefined <b>Threshold Value</b>.
+</li><li>
+<b>Minimum angle</b> selects triangles and quadrangles with minimum angle (see also a
+\ref minimum_angle_page "Minimum angle quality control"), which is more, less or equal
+(within a given <b>Tolerance</b>) to the predefined <b>Threshold Value</b>.
+</li><li>
+<b>Taper</b> selects quadrangles cells with taper value (see also a
+\ref taper_page "Taper quality control"), which is more, less or equal (within a given
+<b>Tolerance</b>) to the predefined <b>Threshold Value</b>.
+</li><li>
+<b>Skew</b> selects triangles and quadrangles with skew value (see also a
+\ref skew_page "Skew quality control"), which is more, less or equal (within a given
+<b>Tolerance</b>) to the predefined <b>Threshold Value</b>.
+</li><li>
+<b>Area</b> selects triangles and quadrangles with a value of area (see also an
+\ref area_page "Area quality control"), which is more, less or equal (within a given
+<b>Tolerance</b>) to the predefined <b>Threshold Value</b>.
+</li><li>
+<b>Free edges</b> selects 2D mesh elements consisting of edges belonging to
+one element of mesh only. See also a
+\ref free_edges_page "Free Edges quality control".
+</li><li>
+<b>Borders at Multi-Connections 2D</b> selects cells consisting of edges belonging to
+several elements of mesh. The number of mesh elements should be more, less or equal
+(within a given <b>Tolerance</b>) to the predefined <b>Threshold Value</b>.
+See also a
+\ref borders_at_multi_connection_2d_page "Borders at Multi-Connection 2D quality control".
+</li><li>
+<b>Length 2D</b> selects triangles and quadrangles combining of the edges with a value of
+length, which is more, less or equal (within a given <b>Tolerance</b>) to the predefined
+<b>Threshold Value</b>. See also a
+\ref length_2d_page "Length 2D quality control".
+</li>
+</ul>
+
+Additional criteria to select mesh <b>Volumes</b> are the following:
+<ul><li>
+<b>Aspect ratio 3D</b> selects 3D mesh elements with an aspect ratio (see also an
+\ref aspect_ratio_3d_page "Aspect Ratio 3D quality control"), which is more, less or equal
+(within a given <b>Tolerance</b>) to the predefined <b>Threshold Value</b>.
+</li><li>
+<b>Volume</b> selects 3D mesh elements with a value of volume (see also a
+\ref volume_page "Volume quality control"), which is more, less or equal (within a given
+<b>Tolerance</b>) to the predefined <b>Threshold Value</b>.
+</li><li>
+<b>Bad oriented volume</b> selects mesh volumes, which are incorrectly oriented from
+the point of view of MED convention.
+</li>
+</ul>
+
+
+*/
<li>Check in the dialog box one of the radio buttons corresponding to
the type of sewing operation you would like to perform.</li>
<li>Fill the other fields available in the dialog box.</li>
-<li>Click the \b OK or \b Apply button to perform the operation of sewing.</li>
+<li>Click the \b Apply or <b>Apply and Close</b> button to perform the operation of sewing.</li>
</ol>
<br>
\n Python package smesh defines several classes, destined for easy and
clear mesh creation and edition (see the \ref introduction_to_mesh_python_page "example").
+\n Documentation for smesh package is now available in two forms.
+
+\n 1. Here you can find <a href="smeshpy_doc/modules.html">structured
+ documentation for smesh package</a>, where all methods and
+ classes are grouped by their functionality, like it is done in
+ the GUI documentation.
+
+\n 2. And here the \ref smeshDC "linear documentation for smesh package"
+ is represented, grouped only by classes, declared in the smesh.py file.
+
\n Please draw your attention to the below notes before address to
-the \ref smeshDC "documentation for smesh.py"
+the documentation"
-\n 1. The main page of the \ref smeshDC "documentation for smesh.py"
- contains a list of data structures and a list of functions,
- provided by the package smesh.py. The first item in the data
- structures list (\ref smeshDC::smeshDC "class smesh") also
- represents documentation for methods of the package smesh.py itself.
+\n 1. The main page of the \ref smeshDC "linear documentation for smesh package"
+ contains a list of data structures and a list of
+ functions, provided by the package smesh.py. The first item in
+ the data structures list (\ref smeshDC::smeshDC "class smesh")
+ also represents documentation for methods of the package
+ smesh.py itself.
\n 2. Package smesh.py gives interface to create and manage
meshes. Please, use it to create an empty mesh or to import
data structures list).
\n 4. Class Mesh allows to assign algorithms to a mesh.
-\n \t Please note, that there are always available some algorithms,
+\n Please note, that there are always available some algorithms,
included in standard Salome installation:
- REGULAR(1D), COMPOSITE(1D), MEFISTO(2D), Quadrangle(2D), Hexa(3D), etc.
- NETGEN(1D-2D,2D,1D-2D-3D,3D),
\n others are based on commercial meshers:
- - GHS3D(3D).
+ - GHS3D(3D), BLSURF(2D).
-\n \t To add hypotheses, please use interfaces, provided by the
+\n To add hypotheses, please use interfaces, provided by the
assigned algorithms.
*/
\n When <b>Create as new mesh</b> radio button is selected, the source mesh (or elements) remains at its previous location and a new mesh is created at the new location and appears in the Object Browser with the default name MeshName_mirrored (you can change this name in the adjacent box).
\n <b> Copy groups </b> checkbox allows copying the groups of elements of the source mesh to the newly created one.
-.
+
\par
<br><b>See Also</b> a sample TUI Script of a
\ref tui_symmetry "Symmetry" operation.
-*/
\ No newline at end of file
+*/
</ul>
</li>
-<li>Click the \b Apply or \b OK button to confirm the operation.</li>
+<li>Click the \b Apply or <b>Apply and Close</b> button to confirm the operation.</li>
</ol>
If some selected triangle elements have no adjacent edges with one of
</li>
<li>Enter the ID of the required edge in the \b Edge field or select
this edge in the 3D viewer.</li>
-<li>Click the \b Apply or \b OK button.</li>
+<li>Click the \b Apply or <b>Apply and Close</b> button.</li>
</ol>
\image html uniting_two_triangles1.png
\image html image135.gif
<center>Group12</center>
</li>
-<li>Click the \b Ok or \b Apply button to confirm creation of the group.</li>
+<li>Click the \b Apply or <b>Apply and Close</b> button to confirm creation of the group.</li>
</ol>
<b>See Also</b> a sample TUI Script of a
\image html image136.gif
<center>Group12a</center>
</li>
-<li>Click the \b Ok or \b Apply button to confirm creation of the group.</li>
+<li>Click the \b Apply or <b>Apply and Close</b> button to confirm creation of the group.</li>
</ol>
<b>See Also</b> a sample TUI Script of an
\image html image137.gif
<center>Group12b</center>
</li>
-<li>Click the \b Ok or \b Apply button to confirm creation of the
+<li>Click the \b Apply or <b>Apply and Close</b> button to confirm creation of the
group.</li>
</ol>
};
struct ComputeError
{
- short code; // ComputeErrorName or, if negative, algo specific code
- string comment; // textual problem description
- string algoName;
- short subShapeID; // id of subshape of a shape to mesh
+ short code; // ComputeErrorName or, if negative, algo specific code
+ string comment; // textual problem description
+ string algoName;
+ short subShapeID; // id of subshape of a shape to mesh
+ boolean hasBadMesh; // there are elements preventing computation available for visualization
};
typedef sequence<ComputeError> compute_error_array;
in GEOM::GEOM_Object theSubObject )
raises ( SALOME::SALOME_Exception );
+ /*!
+ * Return mesh elements preventing computation of a subshape
+ */
+ MeshPreviewStruct GetBadInputElements( in SMESH_Mesh theMesh,
+ in short theSubShapeID )
+ raises ( SALOME::SALOME_Exception );
+
/*!
* Return indeces of faces, edges and vertices of given subshapes
* within theMainObject
HYP_ALREADY_EXIST,// such hypothesis already exist
HYP_BAD_DIM, // bad dimension
HYP_BAD_SUBSHAPE, // shape is neither the main one, nor its subshape, nor a group
- HYP_BAD_GEOMETRY // geometry mismatches algorithm's expectation
+ HYP_BAD_GEOMETRY, // geometry mismatches algorithm's expectation
+ HYP_NEED_SHAPE // algorithm can work on shape only
};
/*!
const long EXTRUSION_FLAG_BOUNDARY = 1;
const long EXTRUSION_FLAG_SEW = 2;
+ /*!
+ * Structure used in mesh edit preview data (MeshPreviewStruct)
+ */
+ struct ElementSubType { ElementType SMDS_ElementType;
+ boolean isPoly;
+ long nbNodesInElement; };
+
+ typedef sequence<ElementSubType> types_array;
+
+ /*!
+ * Structure containing mesh edit preview data
+ */
+ struct MeshPreviewStruct { nodes_array nodesXYZ;
+ long_array elementConnectivities;
+ types_array elementTypes; };
+
interface SMESH_IDSource
{
/*!
GEOM::GEOM_Object GetShapeToMesh()
raises (SALOME::SALOME_Exception);
+ /*!
+ * Remove all nodes and elements
+ */
+ void Clear()
+ raises (SALOME::SALOME_Exception);
/*!
* Get the subMesh object associated to a subShape. The subMesh object
module SMESH
{
- /*!
- * Structure used in mesh edit preview data
- */
- struct ElementSubType { ElementType SMDS_ElementType;
- boolean isPoly;
- long nbNodesInElement; };
-
- typedef sequence<ElementSubType> types_array;
-
- /*!
- * Structure containing mesh edit preview data
- */
- struct MeshPreviewStruct { nodes_array nodesXYZ;
- long_array elementConnectivities;
- types_array elementTypes; };
-
/*!
* This interface makes modifications on the Mesh - removing elements and nodes etc.
*/
mesh_area.png \
mesh_aspect.png \
mesh_aspect_3d.png \
+ mesh_clear.png \
mesh_compute.png \
mesh_diagonal.png \
mesh_edit.png \
mesh_tree_algo_quad.png \
mesh_tree_algo_regular.png \
mesh_tree_algo_tetra.png \
- mesh_tree_algo_netgen_2d3d.png \
- mesh_tree_algo_netgen_2d.png \
mesh_tree_hypo_area.png \
mesh_tree_hypo_length.png \
mesh_tree_hypo.png \
mesh_tree_hypo_segment.png \
mesh_tree_hypo_volume.png \
- mesh_tree_hypo_netgen.png \
- mesh_tree_hypo_netgen_2d.png \
mesh_tree_mesh.png \
mesh_tree_importedmesh.png \
mesh_tree_mesh_warn.png \
<parameter name="GHS3DPlugin" value="${GHS3DPlugin_ROOT_DIR}/share/salome/resources/ghs3dplugin"/>
<parameter name="BLSURFPlugin" value="${BLSURFPlugin_ROOT_DIR}/share/salome/resources"/>
<parameter name="HexoticPLUGIN" value="${HexoticPlugin_ROOT_DIR}/share/salome/resources"/>
+ <parameter name="GHS3DPRLPlugin" value="${GHS3DPRLPLUGIN_ROOT_DIR}/share/salome/resources"/>
</section>
</document>
<hypotheses-set-group>
<hypotheses-set name="Automatic Tetrahedralization"
- hypos="AutomaticLength, LengthFromEdges"
+ hypos="AutomaticLength"
algos="Regular_1D, MEFISTO_2D, NETGEN_3D"/>
<hypotheses-set name="Automatic Hexahedralization"
for(; aGrIter != myGroupNames.end(); aGrIter++){
aStr << "_" << *aGrIter;
}
+ string aValue = aStr.str();
+ // PAL19785,0019867 - med forbids whitespace to be the last char in the name
+ int maxSize;
+ if ( theWrapper->GetVersion() == MED::eV2_1 )
+ maxSize = MED::GetNOMLength<MED::eV2_1>();
+ else
+ maxSize = MED::GetNOMLength<MED::eV2_2>();
+ int lastCharPos = min( maxSize, (int) aValue.size() ) - 1;
+ while ( isspace( aValue[ lastCharPos ] ))
+ aValue.resize( lastCharPos-- );
MED::PFamilyInfo anInfo;
- string aValue = aStr.str();
if(myId == 0 || myGroupAttributVal == 0){
anInfo = theWrapper->CrFamilyInfo(theMeshInfo,
aValue,
myGroupNames.insert(string(theGroup->GetStoreName()));
Quantity_Color aColor = theGroup->GetColor();
- myGroupAttributVal = aColor.Hue();
+ double aRed = aColor.Red();
+ double aGreen = aColor.Green();
+ double aBlue = aColor.Blue();
+ int aR = int( aRed*255 );
+ int aG = int( aGreen*255 );
+ int aB = int( aBlue*255 );
+// cout << "aRed = " << aR << endl;
+// cout << "aGreen = " << aG << endl;
+// cout << "aBlue = " << aB << endl;
+ myGroupAttributVal = (int)(aR*1000000 + aG*1000 + aB);
+ //cout << "myGroupAttributVal = " << myGroupAttributVal << endl;
}
//=============================================================================
TInt aNbGrp = aFamilyInfo->GetNbGroup();
if(MYDEBUG) MESSAGE("belong to " << aNbGrp << " groups");
+ bool isAttrOk = false;
+ if(aFamilyInfo->GetNbAttr() == aNbGrp)
+ isAttrOk = true;
for (TInt iGr = 0; iGr < aNbGrp; iGr++) {
std::string aGroupName = aFamilyInfo->GetGroupName(iGr);
+ if(isAttrOk){
+ TInt anAttrVal = aFamilyInfo->GetAttrVal(iGr);
+ aFamily->SetGroupAttributVal(anAttrVal);
+ }
+
if(MYDEBUG) MESSAGE(aGroupName);
aFamily->AddGroupName(aGroupName);
+
}
aFamily->SetId( aFamId );
myFamilies[aFamId] = aFamily;
}
if (aMeshInfo->GetType() == MED::eSTRUCTURE){
- bool aRes = buildMeshGrille(aMed,aMeshInfo);
+ /*bool aRes = */buildMeshGrille(aMed,aMeshInfo);
continue;
}
{
element = *anElemsIter;
theGroup->SMDSGroup().Add(element);
+ int aGroupAttrVal = aFamily->GetGroupAttributVal();
+ if( aGroupAttrVal != 0)
+ theGroup->SetColorGroup(aGroupAttrVal);
}
if ( element )
theGroup->SetType( theGroup->SMDSGroup().GetType() );
}
};
typedef boost::shared_ptr<TCoordHelper> TCoordHelperPtr;
-
+
+
+ //-------------------------------------------------------
+ /*!
+ * \brief Class helping to use either SMDS_EdgeIterator, SMDS_FaceIterator
+ * or SMDS_VolumeIterator in the same code
+ */
+ //-------------------------------------------------------
+ struct TElemIterator
+ {
+ virtual const SMDS_MeshElement* next() = 0;
+ virtual ~TElemIterator() {}
+ };
+ typedef boost::shared_ptr<TElemIterator> PElemIterator;
+
+ template< class SMDSIteratorPtr > class TypedElemIterator: public TElemIterator
+ {
+ SMDSIteratorPtr myItPtr;
+ public:
+ TypedElemIterator(SMDSIteratorPtr it): myItPtr(it) {}
+ virtual const SMDS_MeshElement* next() {
+ if ( myItPtr->more() ) return myItPtr->next();
+ else return 0;
+ }
+ };
+ typedef TypedElemIterator< SMDS_EdgeIteratorPtr > TEdgeIterator;
+ typedef TypedElemIterator< SMDS_FaceIteratorPtr > TFaceIterator;
+ typedef TypedElemIterator< SMDS_VolumeIteratorPtr > TVolumeIterator;
+
+ //-------------------------------------------------------
+ /*!
+ * \brief Structure describing element type
+ */
+ //-------------------------------------------------------
+ struct TElemTypeData
+ {
+ EEntiteMaillage _entity;
+ EGeometrieElement _geomType;
+ TInt _nbElems;
+ SMDSAbs_ElementType _smdsType;
+
+ TElemTypeData (EEntiteMaillage entity, EGeometrieElement geom, TInt nb, SMDSAbs_ElementType type)
+ : _entity(entity), _geomType(geom), _nbElems( nb ), _smdsType( type ) {}
+ };
+
+
+ typedef NCollection_DataMap< Standard_Address, int > TElemFamilyMap;
+ //typedef map<const SMDS_MeshElement *, int> TElemFamilyMap;
+
+ //================================================================================
+ /*!
+ * \brief Fills element to famaly ID map for element type.
+ * Removes all families of anElemType
+ */
+ //================================================================================
+
+ void fillElemFamilyMap( TElemFamilyMap & anElemFamMap,
+ list<DriverMED_FamilyPtr> & aFamilies,
+ const SMDSAbs_ElementType anElemType)
+ {
+ anElemFamMap.Clear();
+ //anElemFamMap.clear();
+ list<DriverMED_FamilyPtr>::iterator aFamsIter = aFamilies.begin();
+ while ( aFamsIter != aFamilies.end() )
+ {
+ if ((*aFamsIter)->GetType() != anElemType) {
+ aFamsIter++;
+ }
+ else {
+ int aFamId = (*aFamsIter)->GetId();
+ const set<const SMDS_MeshElement *>& anElems = (*aFamsIter)->GetElements();
+ set<const SMDS_MeshElement *>::const_iterator anElemsIter = anElems.begin();
+ for (; anElemsIter != anElems.end(); anElemsIter++)
+ {
+ anElemFamMap.Bind( (Standard_Address)*anElemsIter, aFamId );
+ //anElemFamMap[*anElemsIter] = aFamId;
+ }
+ // remove a family from the list
+ aFamilies.erase( aFamsIter++ );
+ }
+ }
+ }
+
+ //================================================================================
+ /*!
+ * \brief For an element, return family ID found in the map or a default one
+ */
+ //================================================================================
+
+ int getFamilyId( const TElemFamilyMap & anElemFamMap,
+ const SMDS_MeshElement* anElement,
+ const int aDefaultFamilyId)
+ {
+ if ( anElemFamMap.IsBound( (Standard_Address) anElement ))
+ return anElemFamMap( (Standard_Address) anElement );
+// TElemFamilyMap::iterator elem_famNum = anElemFamMap.find( anElement );
+// if ( elem_famNum != anElemFamMap.end() )
+// return elem_famNum->second;
+ return aDefaultFamilyId;
+ }
}
-
Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
{
Status aResult = DRS_OK;
INFOS("SMDS_MESH with hasConstructionEdges() or hasConstructionFaces() do not supports!!!");
return DRS_FAIL;
}
- try{
+ try {
MESSAGE("Perform - myFile : "<<myFile);
// Creating the MED mesh for corresponding SMDS structure
MESSAGE("Add - aMeshName : "<<aMeshName<<"; "<<aMeshInfo->GetName());
myMed->SetMeshInfo(aMeshInfo);
- // Storing SMDS groups and sub-meshes
- //-----------------------------------
+ // Storing SMDS groups and sub-meshes as med families
+ //----------------------------------------------------
int myNodesDefaultFamilyId = 0;
int myEdgesDefaultFamilyId = 0;
int myFacesDefaultFamilyId = 0;
myVolumesDefaultFamilyId = REST_VOLUMES_FAMILY;
MESSAGE("Perform - aFamilyInfo");
- map<const SMDS_MeshElement *, int> anElemFamMap;
+ //cout << " DriverMED_Family::MakeFamilies() " << endl;
list<DriverMED_FamilyPtr> aFamilies;
if (myAllSubMeshes) {
aFamilies = DriverMED_Family::MakeFamilies
myDoGroupOfFaces && nbFaces,
myDoGroupOfVolumes && nbVolumes);
}
- list<DriverMED_FamilyPtr>::iterator aFamsIter = aFamilies.begin();
-
- for (; aFamsIter != aFamilies.end(); aFamsIter++)
+ //cout << " myMed->SetFamilyInfo() " << endl;
+ list<DriverMED_FamilyPtr>::iterator aFamsIter;
+ for (aFamsIter = aFamilies.begin(); aFamsIter != aFamilies.end(); aFamsIter++)
{
PFamilyInfo aFamilyInfo = (*aFamsIter)->GetFamilyInfo(myMed,aMeshInfo);
myMed->SetFamilyInfo(aFamilyInfo);
- int aFamId = (*aFamsIter)->GetId();
-
- const set<const SMDS_MeshElement *>& anElems = (*aFamsIter)->GetElements();
- set<const SMDS_MeshElement *>::const_iterator anElemsIter = anElems.begin();
- for (; anElemsIter != anElems.end(); anElemsIter++)
- {
- anElemFamMap[*anElemsIter] = aFamId;
- }
}
// Storing SMDS nodes to the MED file for the MED mesh
typedef map<TInt,TInt> TNodeIdMap;
TNodeIdMap aNodeIdMap;
#endif
- TInt aNbElems = myMesh->NbNodes();
- MED::TIntVector anElemNums(aNbElems);
- MED::TIntVector aFamilyNums(aNbElems);
- MED::TFloatVector aCoordinates(aNbElems*aMeshDimension);
- for(TInt iNode = 0, aStartId = 0; aCoordHelperPtr->Next(); iNode++, aStartId += aMeshDimension){
+ const EModeSwitch theMode = eFULL_INTERLACE;
+ const ERepere theSystem = eCART;
+ const EBooleen theIsElemNum = eVRAI;
+ const EBooleen theIsElemNames = eFAUX;
+ const EConnectivite theConnMode = eNOD;
+
+ TInt aNbNodes = myMesh->NbNodes();
+ //cout << " myMed->CrNodeInfo() aNbNodes = " << aNbNodes << endl;
+ PNodeInfo aNodeInfo = myMed->CrNodeInfo(aMeshInfo, aNbNodes,
+ theMode, theSystem, theIsElemNum, theIsElemNames);
+
+ //cout << " fillElemFamilyMap( SMDSAbs_Node )" << endl;
+ // find family numbers for nodes
+ TElemFamilyMap anElemFamMap;
+ fillElemFamilyMap( anElemFamMap, aFamilies, SMDSAbs_Node );
+
+ for (TInt iNode = 0; aCoordHelperPtr->Next(); iNode++)
+ {
+ // coordinates
+ TCoordSlice aTCoordSlice = aNodeInfo->GetCoordSlice( iNode );
for(TInt iCoord = 0; iCoord < aMeshDimension; iCoord++){
- aCoordinates[aStartId+iCoord] = aCoordHelperPtr->GetCoord(iCoord);
+ aTCoordSlice[iCoord] = aCoordHelperPtr->GetCoord(iCoord);
}
+ // node number
int aNodeID = aCoordHelperPtr->GetID();
- anElemNums[iNode] = aNodeID;
+ aNodeInfo->SetElemNum( iNode, aNodeID );
#ifdef _EDF_NODE_IDS_
aNodeIdMap[aNodeID] = iNode+1;
#endif
+ // family number
const SMDS_MeshNode* aNode = aCoordHelperPtr->GetNode();
- if (anElemFamMap.find(aNode) != anElemFamMap.end())
- aFamilyNums[iNode] = anElemFamMap[aNode];
- else
- aFamilyNums[iNode] = myNodesDefaultFamilyId;
+ int famNum = getFamilyId( anElemFamMap, aNode, myNodesDefaultFamilyId );
+ aNodeInfo->SetFamNum( iNode, famNum );
}
+ anElemFamMap.Clear();
- MED::TStringVector aCoordNames(aMeshDimension);
- MED::TStringVector aCoordUnits(aMeshDimension);
- for(TInt iCoord = 0; iCoord < aMeshDimension; iCoord++){
- aCoordNames[iCoord] = aCoordHelperPtr->GetName(iCoord);
- aCoordUnits[iCoord] = aCoordHelperPtr->GetUnit(iCoord);
+ // coordinate names and units
+ for (TInt iCoord = 0; iCoord < aMeshDimension; iCoord++) {
+ aNodeInfo->SetCoordName( iCoord, aCoordHelperPtr->GetName(iCoord));
+ aNodeInfo->SetCoordUnit( iCoord, aCoordHelperPtr->GetUnit(iCoord));
}
- const ERepere SMDS_COORDINATE_SYSTEM = eCART;
-
- PNodeInfo aNodeInfo = myMed->CrNodeInfo(aMeshInfo,
- aCoordinates,
- eFULL_INTERLACE,
- SMDS_COORDINATE_SYSTEM,
- aCoordNames,
- aCoordUnits,
- aFamilyNums,
- anElemNums);
- MESSAGE("Perform - aNodeInfo->GetNbElem() = "<<aNbElems);
+ //cout << " SetNodeInfo(aNodeInfo)" << endl;
+ MESSAGE("Perform - aNodeInfo->GetNbElem() = "<<aNbNodes);
myMed->SetNodeInfo(aNodeInfo);
+ aNodeInfo.reset(); // free memory used for arrays
+
+
+ // Storing SMDS elements to the MED file for the MED mesh
+ //-------------------------------------------------------
+ // Write one element type at once in order to minimize memory usage (PAL19276)
+
+ const SMDS_MeshInfo& nbElemInfo = myMesh->GetMeshInfo();
+ // poly elements are not supported by med-2.1
+ bool polyTypesSupported = myMed->CrPolygoneInfo(aMeshInfo,eMAILLE,ePOLYGONE,0,0);
+ TInt nbPolygonNodes = 0, nbPolyhedronNodes = 0, nbPolyhedronFaces = 0;
- // Storing others SMDS elements to the MED file for the MED mesh
- //--------------------------------------------------------------
- EEntiteMaillage SMDS_MED_ENTITY = eMAILLE;
- const EConnectivite SMDS_MED_CONNECTIVITY = eNOD;
+ // collect info on all geom types
- // Storing SMDS Edges
- if(TInt aNbElems = myMesh->NbEdges()){
+ list< TElemTypeData > aTElemTypeDatas;
+
+ EEntiteMaillage anEntity = eMAILLE;
#ifdef _ELEMENTS_BY_DIM_
- SMDS_MED_ENTITY = eARETE;
+ anEntity = eARETE;
#endif
- // count edges of diff types
- int aNbSeg3 = 0, aNbSeg2 = 0;
- SMDS_EdgeIteratorPtr anIter = myMesh->edgesIterator();
- while ( anIter->more() )
- if ( anIter->next()->NbNodes() == 3 )
- ++aNbSeg3;
- aNbSeg2 = aNbElems - aNbSeg3;
-
- TInt aNbSeg2Conn = MED::GetNbNodes(eSEG2);
- MED::TIntVector aSeg2ElemNums, aSeg2FamilyNums, aSeg2Conn;
- aSeg2ElemNums .reserve( aNbSeg2 );
- aSeg2FamilyNums.reserve( aNbSeg2 );
- aSeg2Conn .reserve( aNbSeg2*aNbSeg2Conn );
-
- TInt aNbSeg3Conn = MED::GetNbNodes(eSEG3);
- MED::TIntVector aSeg3ElemNums, aSeg3FamilyNums, aSeg3Conn;
- aSeg3ElemNums .reserve( aNbSeg3 );
- aSeg3FamilyNums.reserve( aNbSeg3 );
- aSeg3Conn .reserve( aNbSeg3*aNbSeg3Conn );
-
- anIter = myMesh->edgesIterator();
- while ( anIter->more() ) {
- const SMDS_MeshEdge* anElem = anIter->next();
- TInt aNbNodes = anElem->NbNodes();
-
- TInt aNbConnectivity;
- MED::TIntVector* anElemNums;
- MED::TIntVector* aFamilyNums;
- MED::TIntVector* aConnectivity;
- switch(aNbNodes){
- case 2:
- aNbConnectivity = aNbSeg2Conn;
- anElemNums = &aSeg2ElemNums;
- aFamilyNums = &aSeg2FamilyNums;
- aConnectivity = &aSeg2Conn;
- break;
- case 3:
- aNbConnectivity = aNbSeg3Conn;
- anElemNums = &aSeg3ElemNums;
- aFamilyNums = &aSeg3FamilyNums;
- aConnectivity = &aSeg3Conn;
- break;
- default:
- break;
- }
-
- for(TInt iNode = 0; iNode < aNbNodes; iNode++) {
- const SMDS_MeshElement* aNode = anElem->GetNode( iNode );
-#ifdef _EDF_NODE_IDS_
- aConnectivity->push_back( aNodeIdMap[aNode->GetID()] );
-#else
- aConnectivity->push_back( aNode->GetID() );
+ aTElemTypeDatas.push_back( TElemTypeData(anEntity,
+ eSEG2,
+ nbElemInfo.NbEdges( ORDER_LINEAR ),
+ SMDSAbs_Edge));
+ aTElemTypeDatas.push_back( TElemTypeData(anEntity,
+ eSEG3,
+ nbElemInfo.NbEdges( ORDER_QUADRATIC ),
+ SMDSAbs_Edge));
+#ifdef _ELEMENTS_BY_DIM_
+ anEntity = eFACE;
#endif
- }
+ aTElemTypeDatas.push_back( TElemTypeData(anEntity,
+ eTRIA3,
+ nbElemInfo.NbTriangles( ORDER_LINEAR ),
+ SMDSAbs_Face));
+ aTElemTypeDatas.push_back( TElemTypeData(anEntity,
+ eTRIA6,
+ nbElemInfo.NbTriangles( ORDER_QUADRATIC ),
+ SMDSAbs_Face));
+ aTElemTypeDatas.push_back( TElemTypeData(anEntity,
+ eQUAD4,
+ nbElemInfo.NbQuadrangles( ORDER_LINEAR ),
+ SMDSAbs_Face));
+ aTElemTypeDatas.push_back( TElemTypeData(anEntity,
+ eQUAD8,
+ nbElemInfo.NbQuadrangles( ORDER_QUADRATIC ),
+ SMDSAbs_Face));
+ if ( polyTypesSupported ) {
+ aTElemTypeDatas.push_back( TElemTypeData(anEntity,
+ ePOLYGONE,
+ nbElemInfo.NbPolygons(),
+ SMDSAbs_Face));
+ // we need one more loop on poly elements to count nb of their nodes
+ aTElemTypeDatas.push_back( TElemTypeData(anEntity,
+ ePOLYGONE,
+ nbElemInfo.NbPolygons(),
+ SMDSAbs_Face));
+ }
+#ifdef _ELEMENTS_BY_DIM_
+ anEntity = eMAILLE;
+#endif
+ aTElemTypeDatas.push_back( TElemTypeData(anEntity,
+ eTETRA4,
+ nbElemInfo.NbTetras( ORDER_LINEAR ),
+ SMDSAbs_Volume));
+ aTElemTypeDatas.push_back( TElemTypeData(anEntity,
+ eTETRA10,
+ nbElemInfo.NbTetras( ORDER_QUADRATIC ),
+ SMDSAbs_Volume));
+ aTElemTypeDatas.push_back( TElemTypeData(anEntity,
+ ePYRA5,
+ nbElemInfo.NbPyramids( ORDER_LINEAR ),
+ SMDSAbs_Volume));
+ aTElemTypeDatas.push_back( TElemTypeData(anEntity,
+ ePYRA13,
+ nbElemInfo.NbPyramids( ORDER_QUADRATIC ),
+ SMDSAbs_Volume));
+ aTElemTypeDatas.push_back( TElemTypeData(anEntity,
+ ePENTA6,
+ nbElemInfo.NbPrisms( ORDER_LINEAR ),
+ SMDSAbs_Volume));
+ aTElemTypeDatas.push_back( TElemTypeData(anEntity,
+ ePENTA15,
+ nbElemInfo.NbPrisms( ORDER_QUADRATIC ),
+ SMDSAbs_Volume));
+ aTElemTypeDatas.push_back( TElemTypeData(anEntity,
+ eHEXA8,
+ nbElemInfo.NbHexas( ORDER_LINEAR ),
+ SMDSAbs_Volume));
+ aTElemTypeDatas.push_back( TElemTypeData(anEntity,
+ eHEXA20,
+ nbElemInfo.NbHexas( ORDER_QUADRATIC ),
+ SMDSAbs_Volume));
+ if ( polyTypesSupported ) {
+ aTElemTypeDatas.push_back( TElemTypeData(anEntity,
+ ePOLYEDRE,
+ nbElemInfo.NbPolyhedrons(),
+ SMDSAbs_Volume));
+ // we need one more loop on poly elements to count nb of their nodes
+ aTElemTypeDatas.push_back( TElemTypeData(anEntity,
+ ePOLYEDRE,
+ nbElemInfo.NbPolyhedrons(),
+ SMDSAbs_Volume));
+ }
- anElemNums->push_back(anElem->GetID());
+ vector< bool > isElemFamMapBuilt( SMDSAbs_NbElementTypes, false );
- map<const SMDS_MeshElement*,int>::iterator edge_fam = anElemFamMap.find( anElem );
- if ( edge_fam != anElemFamMap.end() )
- aFamilyNums->push_back( edge_fam->second );
- else
- aFamilyNums->push_back( myEdgesDefaultFamilyId );
- }
-
- if ( aNbSeg2 ) {
- PCellInfo aCellInfo = myMed->CrCellInfo(aMeshInfo,
- SMDS_MED_ENTITY,
- eSEG2,
- aSeg2Conn,
- SMDS_MED_CONNECTIVITY,
- aSeg2FamilyNums,
- aSeg2ElemNums);
- myMed->SetCellInfo(aCellInfo);
- }
- if ( aNbSeg3 ) {
- PCellInfo aCellInfo = myMed->CrCellInfo(aMeshInfo,
- SMDS_MED_ENTITY,
- eSEG3,
- aSeg3Conn,
- SMDS_MED_CONNECTIVITY,
- aSeg3FamilyNums,
- aSeg3ElemNums);
- myMed->SetCellInfo(aCellInfo);
+ // loop on all geom types of elements
+
+ list< TElemTypeData >::iterator aElemTypeData = aTElemTypeDatas.begin();
+ for ( ; aElemTypeData != aTElemTypeDatas.end(); ++aElemTypeData )
+ {
+ if ( aElemTypeData->_nbElems == 0 )
+ continue;
+
+ // iterator on elements of a current type
+ PElemIterator elemIterator;
+ int defaultFamilyId = 0;
+ switch ( aElemTypeData->_smdsType ) {
+ case SMDSAbs_Edge:
+ elemIterator = PElemIterator( new TEdgeIterator( myMesh->edgesIterator() ));
+ defaultFamilyId = myEdgesDefaultFamilyId;
+ break;
+ case SMDSAbs_Face:
+ elemIterator = PElemIterator( new TFaceIterator( myMesh->facesIterator() ));
+ defaultFamilyId = myFacesDefaultFamilyId;
+ break;
+ case SMDSAbs_Volume:
+ elemIterator = PElemIterator( new TVolumeIterator( myMesh->volumesIterator() ));
+ defaultFamilyId = myVolumesDefaultFamilyId;
+ break;
+ default:
+ continue;
}
- }
+ int iElem = 0;
- // Storing SMDS Faces
- if(TInt aNbElems = myMesh->NbFaces()){
- SMDS_FaceIteratorPtr anIter = myMesh->facesIterator();
-#ifdef _ELEMENTS_BY_DIM_
- SMDS_MED_ENTITY = eFACE;
-#endif
- TInt aNbTriaConn = MED::GetNbNodes(eTRIA3);
- MED::TIntVector anTriaElemNums;
- anTriaElemNums.reserve(aNbElems);
- MED::TIntVector aTriaFamilyNums;
- aTriaFamilyNums.reserve(aNbElems);
- MED::TIntVector aTriaConn;
- aTriaConn.reserve(aNbElems*aNbTriaConn);
-
- TInt aNbTria6Conn = MED::GetNbNodes(eTRIA6);
- MED::TIntVector anTria6ElemNums;
- anTria6ElemNums.reserve(aNbElems);
- MED::TIntVector aTria6FamilyNums;
- aTria6FamilyNums.reserve(aNbElems);
- MED::TIntVector aTria6Conn;
- aTria6Conn.reserve(aNbElems*aNbTria6Conn);
-
- TInt aNbQuadConn = MED::GetNbNodes(eQUAD4);
- MED::TIntVector aQuadElemNums;
- aQuadElemNums.reserve(aNbElems);
- MED::TIntVector aQuadFamilyNums;
- aQuadFamilyNums.reserve(aNbElems);
- MED::TIntVector aQuadConn;
- aQuadConn.reserve(aNbElems*aNbQuadConn);
-
- TInt aNbQuad8Conn = MED::GetNbNodes(eQUAD8);
- MED::TIntVector aQuad8ElemNums;
- aQuad8ElemNums.reserve(aNbElems);
- MED::TIntVector aQuad8FamilyNums;
- aQuad8FamilyNums.reserve(aNbElems);
- MED::TIntVector aQuad8Conn;
- aQuad8Conn.reserve(aNbElems*aNbQuad8Conn);
-
- MED::TIntVector aPolygoneElemNums;
- aPolygoneElemNums.reserve(aNbElems);
- MED::TIntVector aPolygoneInds;
- aPolygoneInds.reserve(aNbElems + 1);
- aPolygoneInds.push_back(1); // reference on the first element in the connectivities
- MED::TIntVector aPolygoneFamilyNums;
- aPolygoneFamilyNums.reserve(aNbElems);
- MED::TIntVector aPolygoneConn;
- aPolygoneConn.reserve(aNbElems*aNbQuadConn);
-
- for(TInt iElem = 0; iElem < aNbElems && anIter->more(); iElem++){
- const SMDS_MeshFace* anElem = anIter->next();
- TInt aNbNodes = anElem->NbNodes();
- SMDS_ElemIteratorPtr aNodesIter = anElem->nodesIterator();
- TInt aNbConnectivity;
- MED::TIntVector* anElemNums;
- MED::TIntVector* aFamilyNums;
- MED::TIntVector* aConnectivity;
- if (anElem->IsPoly()) {
- aNbConnectivity = aNbNodes;
- anElemNums = &aPolygoneElemNums;
- aFamilyNums = &aPolygoneFamilyNums;
- aConnectivity = &aPolygoneConn;
- }
- else {
- switch(aNbNodes){
- case 3:
- aNbConnectivity = aNbTriaConn;
- anElemNums = &anTriaElemNums;
- aFamilyNums = &aTriaFamilyNums;
- aConnectivity = &aTriaConn;
- break;
- case 4:
- aNbConnectivity = aNbQuadConn;
- anElemNums = &aQuadElemNums;
- aFamilyNums = &aQuadFamilyNums;
- aConnectivity = &aQuadConn;
- break;
- case 6:
- aNbConnectivity = aNbTria6Conn;
- anElemNums = &anTria6ElemNums;
- aFamilyNums = &aTria6FamilyNums;
- aConnectivity = &aTria6Conn;
- break;
- case 8:
- aNbConnectivity = aNbQuad8Conn;
- anElemNums = &aQuad8ElemNums;
- aFamilyNums = &aQuad8FamilyNums;
- aConnectivity = &aQuad8Conn;
- break;
- default:
- break;
+ //cout << " Treat type " << aElemTypeData->_geomType << " nb = " <<aElemTypeData->_nbElems<< endl;
+ // Treat POLYGONs
+ // ---------------
+ if ( aElemTypeData->_geomType == ePOLYGONE )
+ {
+ if ( nbPolygonNodes == 0 ) {
+ // Count nb of nodes
+ while ( const SMDS_MeshElement* anElem = elemIterator->next() ) {
+ if ( anElem->IsPoly() ) {
+ nbPolygonNodes += anElem->NbNodes();
+ if ( ++iElem == aElemTypeData->_nbElems )
+ break;
+ }
}
}
- MED::TIntVector aVector(aNbNodes);
- for(TInt iNode = 0; aNodesIter->more(); iNode++){
- const SMDS_MeshElement* aNode = aNodesIter->next();
+ else {
+ // Store in med file
+ PPolygoneInfo aPolygoneInfo = myMed->CrPolygoneInfo(aMeshInfo,
+ aElemTypeData->_entity,
+ aElemTypeData->_geomType,
+ aElemTypeData->_nbElems,
+ nbPolygonNodes,
+ theConnMode, theIsElemNum,
+ theIsElemNames);
+ TElemNum & index = *(aPolygoneInfo->myIndex.get());
+ index[0] = 1;
+
+ while ( const SMDS_MeshElement* anElem = elemIterator->next() )
+ {
+ if ( !anElem->IsPoly() )
+ continue;
+
+ // index
+ TInt aNbNodes = anElem->NbNodes();
+ index[ iElem+1 ] = index[ iElem ] + aNbNodes;
+
+ // connectivity
+ TConnSlice aTConnSlice = aPolygoneInfo->GetConnSlice( iElem );
+ for(TInt iNode = 0; iNode < aNbNodes; iNode++) {
+ const SMDS_MeshElement* aNode = anElem->GetNode( iNode );
#ifdef _EDF_NODE_IDS_
- aVector[iNode] = aNodeIdMap[aNode->GetID()];
+ aTConnSlice[ iNode ] = aNodeIdMap[aNode->GetID()];
#else
- aVector[iNode] = aNode->GetID();
+ aTConnSlice[ iNode ] = aNode->GetID();
#endif
- }
+ }
+ // element number
+ aPolygoneInfo->SetElemNum( iElem, anElem->GetID() );
- TInt aSize = aConnectivity->size();
- aConnectivity->resize(aSize+aNbConnectivity);
- // There is some differences between SMDS and MED in cells mapping
- switch(aNbNodes){
- case 4:
- (*aConnectivity)[aSize+0] = aVector[0];
- (*aConnectivity)[aSize+1] = aVector[1];
- (*aConnectivity)[aSize+2] = aVector[3];
- (*aConnectivity)[aSize+3] = aVector[2];
- default:
- for(TInt iNode = 0; iNode < aNbNodes; iNode++)
- (*aConnectivity)[aSize+iNode] = aVector[iNode];
- }
+ // family number
+ int famNum = getFamilyId( anElemFamMap, anElem, defaultFamilyId );
+ aPolygoneInfo->SetFamNum( iElem, famNum );
- if (anElem->IsPoly()) {
- // fill indices for polygonal element
- TInt aPrevPos = aPolygoneInds.back();
- aPolygoneInds.push_back(aPrevPos + aNbNodes);
+ if ( ++iElem == aPolygoneInfo->GetNbElem() )
+ break;
+ }
+ // if(TInt aNbElems = aPolygoneElemNums.size())
+ // // add one element in connectivities,
+ // // referenced by the last element in indices
+ // aPolygoneConn.push_back(0);
+ //cout << " SetPolygoneInfo(aPolygoneInfo)" << endl;
+ myMed->SetPolygoneInfo(aPolygoneInfo);
}
- anElemNums->push_back(anElem->GetID());
+ }
- if (anElemFamMap.find(anElem) != anElemFamMap.end())
- aFamilyNums->push_back(anElemFamMap[anElem]);
- else
- aFamilyNums->push_back(myFacesDefaultFamilyId);
- }
- if(TInt aNbElems = anTriaElemNums.size()){
- PCellInfo aCellInfo = myMed->CrCellInfo(aMeshInfo,
- SMDS_MED_ENTITY,
- eTRIA3,
- aTriaConn,
- SMDS_MED_CONNECTIVITY,
- aTriaFamilyNums,
- anTriaElemNums);
- MESSAGE("Perform - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<eTRIA3<<"; aNbElems = "<<aNbElems);
- myMed->SetCellInfo(aCellInfo);
- }
- if(TInt aNbElems = aQuadElemNums.size()){
- PCellInfo aCellInfo = myMed->CrCellInfo(aMeshInfo,
- SMDS_MED_ENTITY,
- eQUAD4,
- aQuadConn,
- SMDS_MED_CONNECTIVITY,
- aQuadFamilyNums,
- aQuadElemNums);
- MESSAGE("Perform - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<eQUAD4<<"; aNbElems = "<<aNbElems);
- myMed->SetCellInfo(aCellInfo);
- }
- if(TInt aNbElems = anTria6ElemNums.size()){
- PCellInfo aCellInfo = myMed->CrCellInfo(aMeshInfo,
- SMDS_MED_ENTITY,
- eTRIA6,
- aTria6Conn,
- SMDS_MED_CONNECTIVITY,
- aTria6FamilyNums,
- anTria6ElemNums);
- MESSAGE("Perform - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<eTRIA6<<"; aNbElems = "<<aNbElems);
- myMed->SetCellInfo(aCellInfo);
- }
- if(TInt aNbElems = aQuad8ElemNums.size()){
- PCellInfo aCellInfo = myMed->CrCellInfo(aMeshInfo,
- SMDS_MED_ENTITY,
- eQUAD8,
- aQuad8Conn,
- SMDS_MED_CONNECTIVITY,
- aQuad8FamilyNums,
- aQuad8ElemNums);
- MESSAGE("Perform - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<eQUAD8<<"; aNbElems = "<<aNbElems);
- myMed->SetCellInfo(aCellInfo);
- }
- if(TInt aNbElems = aPolygoneElemNums.size()){
- // add one element in connectivities,
- // referenced by the last element in indices
- aPolygoneConn.push_back(0);
-
- PPolygoneInfo aCellInfo = myMed->CrPolygoneInfo(aMeshInfo,
- SMDS_MED_ENTITY,
- ePOLYGONE,
- aPolygoneInds,
- aPolygoneConn,
- SMDS_MED_CONNECTIVITY,
- aPolygoneFamilyNums,
- aPolygoneElemNums);
- MESSAGE("Perform - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<ePOLYGONE<<"; aNbElems = "<<aNbElems);
- myMed->SetPolygoneInfo(aCellInfo);
- }
- }
-
- // Storing SMDS Volumes
- if(TInt aNbElems = myMesh->NbVolumes()){
- SMDS_VolumeIteratorPtr anIter = myMesh->volumesIterator();
-#ifdef _ELEMENTS_BY_DIM_
- SMDS_MED_ENTITY = eMAILLE;
-#endif
- TInt aNbTetraConn = MED::GetNbNodes(eTETRA4);
- MED::TIntVector anTetraElemNums;
- anTetraElemNums.reserve(aNbElems);
- MED::TIntVector aTetraFamilyNums;
- aTetraFamilyNums.reserve(aNbElems);
- MED::TIntVector aTetraConn;
- aTetraConn.reserve(aNbElems*aNbTetraConn);
-
- TInt aNbPyraConn = MED::GetNbNodes(ePYRA5);
- MED::TIntVector anPyraElemNums;
- anPyraElemNums.reserve(aNbElems);
- MED::TIntVector aPyraFamilyNums;
- aPyraFamilyNums.reserve(aNbElems);
- MED::TIntVector aPyraConn;
- aPyraConn.reserve(aNbElems*aNbPyraConn);
-
- TInt aNbPentaConn = MED::GetNbNodes(ePENTA6);
- MED::TIntVector anPentaElemNums;
- anPentaElemNums.reserve(aNbElems);
- MED::TIntVector aPentaFamilyNums;
- aPentaFamilyNums.reserve(aNbElems);
- MED::TIntVector aPentaConn;
- aPentaConn.reserve(aNbElems*aNbPentaConn);
-
- TInt aNbHexaConn = MED::GetNbNodes(eHEXA8);
- MED::TIntVector aHexaElemNums;
- aHexaElemNums.reserve(aNbElems);
- MED::TIntVector aHexaFamilyNums;
- aHexaFamilyNums.reserve(aNbElems);
- MED::TIntVector aHexaConn;
- aHexaConn.reserve(aNbElems*aNbHexaConn);
-
- TInt aNbTetra10Conn = MED::GetNbNodes(eTETRA10);
- MED::TIntVector anTetra10ElemNums;
- anTetra10ElemNums.reserve(aNbElems);
- MED::TIntVector aTetra10FamilyNums;
- aTetra10FamilyNums.reserve(aNbElems);
- MED::TIntVector aTetra10Conn;
- aTetra10Conn.reserve(aNbElems*aNbTetra10Conn);
-
- TInt aNbPyra13Conn = MED::GetNbNodes(ePYRA13);
- MED::TIntVector anPyra13ElemNums;
- anPyra13ElemNums.reserve(aNbElems);
- MED::TIntVector aPyra13FamilyNums;
- aPyra13FamilyNums.reserve(aNbElems);
- MED::TIntVector aPyra13Conn;
- aPyra13Conn.reserve(aNbElems*aNbPyra13Conn);
-
- TInt aNbPenta15Conn = MED::GetNbNodes(ePENTA15);
- MED::TIntVector anPenta15ElemNums;
- anPenta15ElemNums.reserve(aNbElems);
- MED::TIntVector aPenta15FamilyNums;
- aPenta15FamilyNums.reserve(aNbElems);
- MED::TIntVector aPenta15Conn;
- aPenta15Conn.reserve(aNbElems*aNbPenta15Conn);
-
- TInt aNbHexa20Conn = MED::GetNbNodes(eHEXA20);
- MED::TIntVector aHexa20ElemNums;
- aHexa20ElemNums.reserve(aNbElems);
- MED::TIntVector aHexa20FamilyNums;
- aHexa20FamilyNums.reserve(aNbElems);
- MED::TIntVector aHexa20Conn;
- aHexa20Conn.reserve(aNbElems*aNbHexa20Conn);
-
- MED::TIntVector aPolyedreElemNums;
- aPolyedreElemNums.reserve(aNbElems);
- MED::TIntVector aPolyedreInds;
- aPolyedreInds.reserve(aNbElems + 1);
- aPolyedreInds.push_back(1); // reference on the first element in the faces
- MED::TIntVector aPolyedreFaces;
- aPolyedreFaces.reserve(aNbElems + 1);
- aPolyedreFaces.push_back(1); // reference on the first element in the connectivities
- MED::TIntVector aPolyedreFamilyNums;
- aPolyedreFamilyNums.reserve(aNbElems);
- MED::TIntVector aPolyedreConn;
- aPolyedreConn.reserve(aNbElems*aNbHexaConn);
-
- for(TInt iElem = 0; iElem < aNbElems && anIter->more(); iElem++){
- const SMDS_MeshVolume* anElem = anIter->next();
-
- MED::TIntVector* anElemNums;
- MED::TIntVector* aFamilyNums;
-
- if (anElem->IsPoly()) {
- const SMDS_PolyhedralVolumeOfNodes* aPolyedre =
- (const SMDS_PolyhedralVolumeOfNodes*) anElem;
- if (!aPolyedre) {
- MESSAGE("Warning: bad volumic element");
- continue;
+ // Treat POLYEDREs
+ // ----------------
+ else if (aElemTypeData->_geomType == ePOLYEDRE )
+ {
+ if ( nbPolyhedronNodes == 0 ) {
+ // Count nb of nodes
+ while ( const SMDS_MeshElement* anElem = elemIterator->next() ) {
+ const SMDS_PolyhedralVolumeOfNodes* aPolyedre =
+ dynamic_cast<const SMDS_PolyhedralVolumeOfNodes*>( anElem );
+ if ( aPolyedre ) {
+ nbPolyhedronNodes += aPolyedre->NbNodes();
+ nbPolyhedronFaces += aPolyedre->NbFaces();
+ if ( ++iElem == aElemTypeData->_nbElems )
+ break;
+ }
}
-
- anElemNums = &aPolyedreElemNums;
- aFamilyNums = &aPolyedreFamilyNums;
-
- TInt aNodeId, aNbFaces = aPolyedre->NbFaces();
- for (int iface = 1; iface <= aNbFaces; iface++) {
- int aNbFaceNodes = aPolyedre->NbFaceNodes(iface);
- for (int inode = 1; inode <= aNbFaceNodes; inode++) {
- aNodeId = aPolyedre->GetFaceNode(iface, inode)->GetID();
+ }
+ else {
+ // Store in med file
+ PPolyedreInfo aPolyhInfo = myMed->CrPolyedreInfo(aMeshInfo,
+ aElemTypeData->_entity,
+ aElemTypeData->_geomType,
+ aElemTypeData->_nbElems,
+ nbPolyhedronFaces+1,
+ nbPolyhedronNodes,
+ theConnMode,
+ theIsElemNum,
+ theIsElemNames);
+ TElemNum & index = *(aPolyhInfo->myIndex.get());
+ TElemNum & faces = *(aPolyhInfo->myFaces.get());
+ TElemNum & conn = *(aPolyhInfo->myConn.get());
+ index[0] = 1;
+ faces[0] = 1;
+
+ TInt iFace = 0, iNode = 0;
+ while ( const SMDS_MeshElement* anElem = elemIterator->next() )
+ {
+ const SMDS_PolyhedralVolumeOfNodes* aPolyedre =
+ dynamic_cast<const SMDS_PolyhedralVolumeOfNodes*>( anElem );
+ if ( !aPolyedre )
+ continue;
+
+ // index
+ TInt aNbFaces = aPolyedre->NbFaces();
+ index[ iElem+1 ] = index[ iElem ] + aNbFaces;
+
+ // face index
+ for (TInt f = 1; f <= aNbFaces; ++f, ++iFace ) {
+ int aNbFaceNodes = aPolyedre->NbFaceNodes( f );
+ faces[ iFace+1 ] = faces[ iFace ] + aNbFaceNodes;
+ }
+ // connectivity
+ SMDS_ElemIteratorPtr nodeIt = anElem->nodesIterator();
+ while ( nodeIt->more() ) {
+ const SMDS_MeshElement* aNode = nodeIt->next();
#ifdef _EDF_NODE_IDS_
- aPolyedreConn.push_back(aNodeIdMap[aNodeId]);
+ conn[ iNode ] = aNodeIdMap[aNode->GetID()];
#else
- aPolyedreConn.push_back(aNodeId);
+ conn[ iNode ] = aNode->GetID();
#endif
+ ++iNode;
}
- TInt aPrevPos = aPolyedreFaces.back();
- aPolyedreFaces.push_back(aPrevPos + aNbFaceNodes);
+ // element number
+ aPolyhInfo->SetElemNum( iElem, anElem->GetID() );
+
+ // family number
+ int famNum = getFamilyId( anElemFamMap, anElem, defaultFamilyId );
+ aPolyhInfo->SetFamNum( iElem, famNum );
+
+ if ( ++iElem == aPolyhInfo->GetNbElem() )
+ break;
}
- TInt aPrevPos = aPolyedreInds.back();
- aPolyedreInds.push_back(aPrevPos + aNbFaces);
+ //cout << " SetPolyedreInfo(aPolyhInfo )" << endl;
+ myMed->SetPolyedreInfo(aPolyhInfo);
+ }
+ } // if (aElemTypeData->_geomType == ePOLYEDRE )
+ else
+ {
+ // Treat standard types
+ // ---------------------
+
+ // allocate data arrays
+ PCellInfo aCellInfo = myMed->CrCellInfo( aMeshInfo,
+ aElemTypeData->_entity,
+ aElemTypeData->_geomType,
+ aElemTypeData->_nbElems,
+ theConnMode,
+ theIsElemNum,
+ theIsElemNames);
+ // build map of family numbers for this type
+ if ( !isElemFamMapBuilt[ aElemTypeData->_smdsType ])
+ {
+ //cout << " fillElemFamilyMap()" << endl;
+ fillElemFamilyMap( anElemFamMap, aFamilies, aElemTypeData->_smdsType );
+ isElemFamMapBuilt[ aElemTypeData->_smdsType ] = true;
}
- else {
- TInt aNbNodes = anElem->NbNodes();
- SMDS_ElemIteratorPtr aNodesIter = anElem->nodesIterator();
- TInt aNbConnectivity;
- MED::TIntVector* aConnectivity;
- switch(aNbNodes){
- case 4:
- aNbConnectivity = aNbTetraConn;
- anElemNums = &anTetraElemNums;
- aFamilyNums = &aTetraFamilyNums;
- aConnectivity = &aTetraConn;
- break;
- case 5:
- aNbConnectivity = aNbPyraConn;
- anElemNums = &anPyraElemNums;
- aFamilyNums = &aPyraFamilyNums;
- aConnectivity = &aPyraConn;
- break;
- case 6:
- aNbConnectivity = aNbPentaConn;
- anElemNums = &anPentaElemNums;
- aFamilyNums = &aPentaFamilyNums;
- aConnectivity = &aPentaConn;
- break;
- case 8:
- aNbConnectivity = aNbHexaConn;
- anElemNums = &aHexaElemNums;
- aFamilyNums = &aHexaFamilyNums;
- aConnectivity = &aHexaConn;
- break;
- case 10:
- aNbConnectivity = aNbTetra10Conn;
- anElemNums = &anTetra10ElemNums;
- aFamilyNums = &aTetra10FamilyNums;
- aConnectivity = &aTetra10Conn;
- break;
- case 13:
- aNbConnectivity = aNbPyra13Conn;
- anElemNums = &anPyra13ElemNums;
- aFamilyNums = &aPyra13FamilyNums;
- aConnectivity = &aPyra13Conn;
- break;
- case 15:
- aNbConnectivity = aNbPenta15Conn;
- anElemNums = &anPenta15ElemNums;
- aFamilyNums = &aPenta15FamilyNums;
- aConnectivity = &aPenta15Conn;
- break;
- case 20:
- aNbConnectivity = aNbHexa20Conn;
- anElemNums = &aHexa20ElemNums;
- aFamilyNums = &aHexa20FamilyNums;
- aConnectivity = &aHexa20Conn;
- }
- TInt aSize = aConnectivity->size();
- aConnectivity->resize(aSize + aNbConnectivity);
+ TInt aNbNodes = MED::GetNbNodes(aElemTypeData->_geomType);
+ while ( const SMDS_MeshElement* anElem = elemIterator->next() )
+ {
+ if ( anElem->NbNodes() != aNbNodes || anElem->IsPoly() )
+ continue; // other geometry
- MED::TIntVector aVector(aNbNodes);
- for(TInt iNode = 0; aNodesIter->more(); iNode++){
- const SMDS_MeshElement* aNode = aNodesIter->next();
+ // connectivity
+ TConnSlice aTConnSlice = aCellInfo->GetConnSlice( iElem );
+ for (TInt iNode = 0; iNode < aNbNodes; iNode++) {
+ const SMDS_MeshElement* aNode = anElem->GetNode( iNode );
#ifdef _EDF_NODE_IDS_
- aVector[iNode] = aNodeIdMap[aNode->GetID()];
+ aTConnSlice[ iNode ] = aNodeIdMap[aNode->GetID()];
#else
- aVector[iNode] = aNode->GetID();
+ aTConnSlice[ iNode ] = aNode->GetID();
#endif
}
- // There is some difference between SMDS and MED in cells mapping
- switch(aNbNodes){
- case 5:
- (*aConnectivity)[aSize+0] = aVector[0];
- (*aConnectivity)[aSize+1] = aVector[3];
- (*aConnectivity)[aSize+2] = aVector[2];
- (*aConnectivity)[aSize+3] = aVector[1];
- (*aConnectivity)[aSize+4] = aVector[4];
- default:
- for(TInt iNode = 0; iNode < aNbNodes; iNode++)
- (*aConnectivity)[aSize+iNode] = aVector[iNode];
- }
- }
+ // element number
+ aCellInfo->SetElemNum( iElem, anElem->GetID() );
- anElemNums->push_back(anElem->GetID());
+ // family number
+ int famNum = getFamilyId( anElemFamMap, anElem, defaultFamilyId );
+ aCellInfo->SetFamNum( iElem, famNum );
- if (anElemFamMap.find(anElem) != anElemFamMap.end())
- aFamilyNums->push_back(anElemFamMap[anElem]);
- else
- aFamilyNums->push_back(myVolumesDefaultFamilyId);
+ if ( ++iElem == aCellInfo->GetNbElem() )
+ break;
+ }
+ // store data in a file
+ //cout << " SetCellInfo(aCellInfo)" << endl;
+ myMed->SetCellInfo(aCellInfo);
}
- if(TInt aNbElems = anTetraElemNums.size()){
- PCellInfo aCellInfo = myMed->CrCellInfo(aMeshInfo,
- SMDS_MED_ENTITY,
- eTETRA4,
- aTetraConn,
- SMDS_MED_CONNECTIVITY,
- aTetraFamilyNums,
- anTetraElemNums);
- MESSAGE("Perform - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<eTETRA4<<"; aNbElems = "<<aNbElems);
- myMed->SetCellInfo(aCellInfo);
- }
- if(TInt aNbElems = anPyraElemNums.size()){
- PCellInfo aCellInfo = myMed->CrCellInfo(aMeshInfo,
- SMDS_MED_ENTITY,
- ePYRA5,
- aPyraConn,
- SMDS_MED_CONNECTIVITY,
- aPyraFamilyNums,
- anPyraElemNums);
- MESSAGE("Perform - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<ePYRA5<<"; aNbElems = "<<aNbElems);
- myMed->SetCellInfo(aCellInfo);
- }
- if(TInt aNbElems = anPentaElemNums.size()){
- PCellInfo aCellInfo = myMed->CrCellInfo(aMeshInfo,
- SMDS_MED_ENTITY,
- ePENTA6,
- aPentaConn,
- SMDS_MED_CONNECTIVITY,
- aPentaFamilyNums,
- anPentaElemNums);
- MESSAGE("Perform - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<ePENTA6<<"; aNbElems = "<<aNbElems);
- myMed->SetCellInfo(aCellInfo);
- }
- if(TInt aNbElems = aHexaElemNums.size()){
- PCellInfo aCellInfo = myMed->CrCellInfo(aMeshInfo,
- SMDS_MED_ENTITY,
- eHEXA8,
- aHexaConn,
- SMDS_MED_CONNECTIVITY,
- aHexaFamilyNums,
- aHexaElemNums);
- MESSAGE("Perform - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<eHEXA8<<"; aNbElems = "<<aNbElems);
- myMed->SetCellInfo(aCellInfo);
- }
- if(TInt aNbElems = anTetra10ElemNums.size()){
- PCellInfo aCellInfo = myMed->CrCellInfo(aMeshInfo,
- SMDS_MED_ENTITY,
- eTETRA10,
- aTetra10Conn,
- SMDS_MED_CONNECTIVITY,
- aTetra10FamilyNums,
- anTetra10ElemNums);
- MESSAGE("Perform - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<eTETRA10<<"; aNbElems = "<<aNbElems);
- myMed->SetCellInfo(aCellInfo);
- }
- if(TInt aNbElems = anPyra13ElemNums.size()){
- PCellInfo aCellInfo = myMed->CrCellInfo(aMeshInfo,
- SMDS_MED_ENTITY,
- ePYRA13,
- aPyra13Conn,
- SMDS_MED_CONNECTIVITY,
- aPyra13FamilyNums,
- anPyra13ElemNums);
- MESSAGE("Perform - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<ePYRA13<<"; aNbElems = "<<aNbElems);
- myMed->SetCellInfo(aCellInfo);
- }
- if(TInt aNbElems = anPenta15ElemNums.size()){
- PCellInfo aCellInfo = myMed->CrCellInfo(aMeshInfo,
- SMDS_MED_ENTITY,
- ePENTA15,
- aPenta15Conn,
- SMDS_MED_CONNECTIVITY,
- aPenta15FamilyNums,
- anPenta15ElemNums);
- MESSAGE("Perform - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<ePENTA15<<"; aNbElems = "<<aNbElems);
- myMed->SetCellInfo(aCellInfo);
- }
- if(TInt aNbElems = aHexa20ElemNums.size()){
- PCellInfo aCellInfo = myMed->CrCellInfo(aMeshInfo,
- SMDS_MED_ENTITY,
- eHEXA20,
- aHexa20Conn,
- SMDS_MED_CONNECTIVITY,
- aHexa20FamilyNums,
- aHexa20ElemNums);
- MESSAGE("Perform - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<eHEXA20<<"; aNbElems = "<<aNbElems);
- myMed->SetCellInfo(aCellInfo);
- }
+ } // loop on geom types
+
- if(TInt aNbElems = aPolyedreElemNums.size()){
- // add one element in connectivities,
- // referenced by the last element in faces
- aPolyedreConn.push_back(0);
-
- PPolyedreInfo aCellInfo = myMed->CrPolyedreInfo(aMeshInfo,
- SMDS_MED_ENTITY,
- ePOLYEDRE,
- aPolyedreInds,
- aPolyedreFaces,
- aPolyedreConn,
- SMDS_MED_CONNECTIVITY,
- aPolyedreFamilyNums,
- aPolyedreElemNums);
- MESSAGE("Perform - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<ePOLYEDRE<<"; aNbElems = "<<aNbElems);
- myMed->SetPolyedreInfo(aCellInfo);
- }
- }
}
catch(const std::exception& exc) {
INFOS("Follow exception was cought:\n\t"<<exc.what());
if (aNodesNb > 0) {
SMDS_MeshGroup* aNodesGroup = (SMDS_MeshGroup*) myGroup->AddSubGroup(SMDSAbs_Node);
std::string aGrName = (useSuffix) ? aRec.GroupName + "_Nodes" : aRec.GroupName;
+ int i = aGrName.find( "\r" );
+ if (i > 0)
+ aGrName.erase (i, 2);
myGroupNames.insert(TGroupNamesMap::value_type(aNodesGroup, aGrName));
myGroupId.insert(TGroupIdMap::value_type(aNodesGroup, aLabel));
aEdgesGroup = (SMDS_MeshGroup*) myGroup->AddSubGroup(SMDSAbs_Edge);
if (!useSuffix && createdGroup) useSuffix = true;
std::string aEdgesGrName = (useSuffix) ? aRec.GroupName + "_Edges" : aRec.GroupName;
+ int i = aEdgesGrName.find( "\r" );
+ if (i > 0)
+ aEdgesGrName.erase (i, 2);
myGroupNames.insert(TGroupNamesMap::value_type(aEdgesGroup, aEdgesGrName));
myGroupId.insert(TGroupIdMap::value_type(aEdgesGroup, aLabel));
createdGroup = true;
aFacesGroup = (SMDS_MeshGroup*) myGroup->AddSubGroup(SMDSAbs_Face);
if (!useSuffix && createdGroup) useSuffix = true;
std::string aFacesGrName = (useSuffix) ? aRec.GroupName + "_Faces" : aRec.GroupName;
+ int i = aFacesGrName.find( "\r" );
+ if (i > 0)
+ aFacesGrName.erase (i, 2);
myGroupNames.insert(TGroupNamesMap::value_type(aFacesGroup, aFacesGrName));
myGroupId.insert(TGroupIdMap::value_type(aFacesGroup, aLabel));
createdGroup = true;
aVolumeGroup = (SMDS_MeshGroup*) myGroup->AddSubGroup(SMDSAbs_Volume);
if (!useSuffix && createdGroup) useSuffix = true;
std::string aVolumeGrName = (useSuffix) ? aRec.GroupName + "_Volumes" : aRec.GroupName;
+ int i = aVolumeGrName.find( "\r" );
+ if (i > 0)
+ aVolumeGrName.erase (i, 2);
myGroupNames.insert(TGroupNamesMap::value_type(aVolumeGroup, aVolumeGrName));
myGroupId.insert(TGroupIdMap::value_type(aVolumeGroup, aLabel));
createdGroup = true;
std::getline(in_stream, aRec.GroupName, '\n'); // Finalise previous reading
std::getline(in_stream, aRec.GroupName, '\n');
-
+
int aElType;
int aElId;
int aNum;
mnarcf3 = new Z[mxarcf];
if( mnarcf3 == NULL )
{
- cout << "aptrte: MC saturee mnarcf3=" << mnarcf3 << endl;
+ MESSAGE ( "aptrte: MC saturee mnarcf3=" << mnarcf3 );
goto ERREUR;
}
teamqt( nutysu, aretmx, airemx,
//Fix for Bug 13314:
//Incorrect "Min value" in Scalar Bar in Mesh:
- myScalarBarActor->SetLabelFormat("%.4g");
+ // myScalarBarActor->SetLabelFormat("%.4g");
+ // changes was commented because of regression bug IPAL 19981
mgr = SUIT_Session::session()->resourceMgr();
if( !mgr )
// Executable to find out a lower RAM limit (MB), i.e. at what size of freeRAM
// reported by sysinfo, no more memory can be allocated.
// This is not done inside a function of SALOME because allocated memory is not returned
-// to the system
+// to the system. (PAL16631)
#ifndef WIN32
#include <sys/sysinfo.h>
#include <iostream>
#endif
-int main (int argc, char ** argv) {
+int main (int argc, char ** argv)
+{
+ // To better understand what is going on here, consult bug [SALOME platform 0019911]
#ifndef WIN32
struct sysinfo si;
int err = sysinfo( &si );
return -1;
unsigned long freeRamKb = ( si.freeram * si.mem_unit ) / 1024;
- const unsigned long stepKb = 8; // less nb leads to hung up on Mandriva2006 without swap
- // (other platforms not tested w/o swap)
+ // totat RAM size in Gb, float is in order not to have 1 instead of 1.9
+ float totalramGb = float( si.totalram * si.mem_unit ) / 1024 / 1024 / 1024;
+
+ // nb Kbites to allocate at one step. Small nb leads to hung up
+ const int stepKb = int( 5 * totalramGb );
unsigned long nbSteps = freeRamKb / stepKb * 2;
try {
#include <sys/sysinfo.h>
#endif
+// number of added entitis to check memory after
+#define CHECKMEMORY_INTERVAL 1000
+
//================================================================================
/*!
* \brief Raise an exception if free memory (ram+swap) too low
else
limit = int( limit * 1.5 );
#ifdef _DEBUG_
- cout << "SMDS_Mesh::CheckMemory() memory limit = " << limit << " MB" << endl;
+ MESSAGE ( "SMDS_Mesh::CheckMemory() memory limit = " << limit << " MB" );
#endif
}
if ( doNotRaise )
return 0;
#ifdef _DEBUG_
- cout<<"SMDS_Mesh::CheckMemory() throws as free memory too low: " << freeMb <<" MB" << endl;
+ MESSAGE ("SMDS_Mesh::CheckMemory() throws as free memory too low: " << freeMb <<" MB" );
#endif
throw std::bad_alloc();
#else
// find the MeshNode corresponding to ID
const SMDS_MeshElement *node = myNodeIDFactory->MeshElement(ID);
if(!node){
- CheckMemory();
+ if ( myNodes.Extent() % CHECKMEMORY_INTERVAL == 0 ) CheckMemory();
SMDS_MeshNode * node=new SMDS_MeshNode(x, y, z);
myNodes.Add(node);
myNodeIDFactory->BindID(ID,node);
{
if ( !n1 || !n2 ) return 0;
- CheckMemory();
+ if ( myEdges.Extent() % CHECKMEMORY_INTERVAL == 0 ) CheckMemory();
+
SMDS_MeshEdge * edge=new SMDS_MeshEdge(n1,n2);
if(myElementIDFactory->BindID(ID, edge)) {
SMDS_MeshNode *node1,*node2;
return NULL;
if ( !e1 || !e2 || !e3 ) return 0;
- CheckMemory();
+ if ( myFaces.Extent() % CHECKMEMORY_INTERVAL == 0 ) CheckMemory();
+
SMDS_MeshFace * face = new SMDS_FaceOfEdges(e1,e2,e3);
myFaces.Add(face);
myInfo.myNbTriangles++;
if (!hasConstructionEdges())
return NULL;
if ( !e1 || !e2 || !e3 || !e4 ) return 0;
- CheckMemory();
+ if ( myFaces.Extent() % CHECKMEMORY_INTERVAL == 0 ) CheckMemory();
SMDS_MeshFace * face = new SMDS_FaceOfEdges(e1,e2,e3,e4);
myFaces.Add(face);
myInfo.myNbQuadrangles++;
{
SMDS_MeshVolume* volume = 0;
if ( !n1 || !n2 || !n3 || !n4) return volume;
- CheckMemory();
+ if ( myVolumes.Extent() % CHECKMEMORY_INTERVAL == 0 ) CheckMemory();
if(hasConstructionFaces()) {
SMDS_MeshFace * f1=FindFaceOrCreate(n1,n2,n3);
SMDS_MeshFace * f2=FindFaceOrCreate(n1,n2,n4);
{
SMDS_MeshVolume* volume = 0;
if ( !n1 || !n2 || !n3 || !n4 || !n5) return volume;
- CheckMemory();
+ if ( myVolumes.Extent() % CHECKMEMORY_INTERVAL == 0 ) CheckMemory();
if(hasConstructionFaces()) {
SMDS_MeshFace * f1=FindFaceOrCreate(n1,n2,n3,n4);
SMDS_MeshFace * f2=FindFaceOrCreate(n1,n2,n5);
{
SMDS_MeshVolume* volume = 0;
if ( !n1 || !n2 || !n3 || !n4 || !n5 || !n6) return volume;
- CheckMemory();
+ if ( myVolumes.Extent() % CHECKMEMORY_INTERVAL == 0 ) CheckMemory();
if(hasConstructionFaces()) {
SMDS_MeshFace * f1=FindFaceOrCreate(n1,n2,n3);
SMDS_MeshFace * f2=FindFaceOrCreate(n4,n5,n6);
{
SMDS_MeshVolume* volume = 0;
if ( !n1 || !n2 || !n3 || !n4 || !n5 || !n6 || !n7 || !n8) return volume;
- CheckMemory();
+ if ( myVolumes.Extent() % CHECKMEMORY_INTERVAL == 0 ) CheckMemory();
if(hasConstructionFaces()) {
SMDS_MeshFace * f1=FindFaceOrCreate(n1,n2,n3,n4);
SMDS_MeshFace * f2=FindFaceOrCreate(n5,n6,n7,n8);
if (!hasConstructionFaces())
return NULL;
if ( !f1 || !f2 || !f3 || !f4) return 0;
- CheckMemory();
+ if ( myVolumes.Extent() % CHECKMEMORY_INTERVAL == 0 ) CheckMemory();
SMDS_MeshVolume * volume = new SMDS_VolumeOfFaces(f1,f2,f3,f4);
myVolumes.Add(volume);
myInfo.myNbTetras++;
if (!hasConstructionFaces())
return NULL;
if ( !f1 || !f2 || !f3 || !f4 || !f5) return 0;
- CheckMemory();
+ if ( myVolumes.Extent() % CHECKMEMORY_INTERVAL == 0 ) CheckMemory();
SMDS_MeshVolume * volume = new SMDS_VolumeOfFaces(f1,f2,f3,f4,f5);
myVolumes.Add(volume);
myInfo.myNbPyramids++;
if (!hasConstructionFaces())
return NULL;
if ( !f1 || !f2 || !f3 || !f4 || !f5 || !f6) return 0;
- CheckMemory();
+ if ( myVolumes.Extent() % CHECKMEMORY_INTERVAL == 0 ) CheckMemory();
SMDS_MeshVolume * volume = new SMDS_VolumeOfFaces(f1,f2,f3,f4,f5,f6);
myVolumes.Add(volume);
myInfo.myNbPrisms++;
{
SMDS_MeshFace * face;
- CheckMemory();
+ if ( myFaces.Extent() % CHECKMEMORY_INTERVAL == 0 ) CheckMemory();
if (hasConstructionEdges())
{
MESSAGE("Error : Not implemented");
const int ID)
{
SMDS_MeshVolume* volume;
- CheckMemory();
+ if ( myVolumes.Extent() % CHECKMEMORY_INTERVAL == 0 ) CheckMemory();
if (hasConstructionFaces()) {
MESSAGE("Error : Not implemented");
return NULL;
const SMDS_MeshNode * node3)
{
if ( !node1 || !node2 || !node3) return 0;
- CheckMemory();
+ if ( myFaces.Extent() % CHECKMEMORY_INTERVAL == 0 ) CheckMemory();
if(hasConstructionEdges())
{
SMDS_MeshEdge *edge1, *edge2, *edge3;
const SMDS_MeshNode * node4)
{
if ( !node1 || !node2 || !node3 || !node4 ) return 0;
- CheckMemory();
+ if ( myFaces.Extent() % CHECKMEMORY_INTERVAL == 0 ) CheckMemory();
if(hasConstructionEdges())
{
SMDS_MeshEdge *edge1, *edge2, *edge3, *edge4;
SMDS_MeshEdge * toReturn=NULL;
toReturn=const_cast<SMDS_MeshEdge*>(FindEdge(node1,node2));
if(toReturn==NULL) {
- CheckMemory();
+ if ( myEdges.Extent() % CHECKMEMORY_INTERVAL == 0 ) CheckMemory();
toReturn=new SMDS_MeshEdge(node1,node2);
myEdges.Add(toReturn);
myInfo.myNbEdges++;
if (type == SMDSAbs_Face)
vTool.GetAllExistingFaces( myElems );
else
- vTool.GetAllExistingFaces( myElems );
+ vTool.GetAllExistingEdges( myElems );
}
/// Return true if and only if there are other object in this iterator
virtual bool more() { return myIndex < myElems.size(); }
if ( error ) {
_error = error->myName;
_comment = error->myComment;
+ _badInputElements = error->myBadElements;
return error->IsOK();
}
return true;
SMESH_ComputeErrorPtr SMESH_Algo::GetComputeError() const
{
- return SMESH_ComputeError::New( _error, _comment, this );
+ SMESH_ComputeErrorPtr err = SMESH_ComputeError::New( _error, _comment, this );
+ // hope this method is called by only SMESH_subMesh after this->Compute()
+ err->myBadElements.splice( err->myBadElements.end(),
+ (list<const SMDS_MeshElement*>&) _badInputElements );
+ return err;
}
//================================================================================
{
_error = COMPERR_OK;
_comment.clear();
+ list<const SMDS_MeshElement*>::iterator elem = _badInputElements.begin();
+ for ( ; elem != _badInputElements.end(); ++elem )
+ if ( (*elem)->GetID() < 1 )
+ delete *elem;
+ _badInputElements.clear();
}
+//================================================================================
+/*!
+ * \brief store a bad input element preventing computation,
+ * which may be a temporary one i.e. not residing the mesh,
+ * then it will be deleted by InitComputeError()
+ */
+//================================================================================
+
+void SMESH_Algo::addBadInputElement(const SMDS_MeshElement* elem)
+{
+ if ( elem )
+ _badInputElements.push_back( elem );
+}
* \brief store error and return error->IsOK()
*/
bool error(SMESH_ComputeErrorPtr error);
+ /*!
+ * \brief store a bad input element preventing computation,
+ * which may be a temporary one i.e. not residing the mesh,
+ * then it will be deleted by InitComputeError()
+ */
+ void addBadInputElement(const SMDS_MeshElement* elem);
protected:
int _error; //!< SMESH_ComputeErrorName or anything algo specific
std::string _comment; //!< any text explaining what is wrong in Compute()
+ std::list<const SMDS_MeshElement*> _badInputElements; //!< to explain COMPERR_BAD_INPUT_MESH
};
#endif
return true;
}
#ifdef DEBUG_PARAM_COMPUTE
- cout << "PARAM GUESS: " << params.X() << " "<< params.Y() << " "<< params.X() << endl;
+ MESSAGE ( "PARAM GUESS: " << params.X() << " "<< params.Y() << " "<< params.X() );
myNbIterations++; // how many times call ShellPoint()
#endif
ShellPoint( params, P );
#endif
}
#ifdef DEBUG_PARAM_COMPUTE
- cout << "F = " << theFxyz(1) <<
- " DRV: " << theDf(1,1) << " " << theDf(1,2) << " " << theDf(1,3) << endl;
+ MESSAGE ( "F = " << theFxyz(1) << " DRV: " << theDf(1,1) << " " << theDf(1,2) << " " << theDf(1,3) );
myNbIterations +=3; // how many times call ShellPoint()
#endif
}
#ifdef DEBUG_PARAM_COMPUTE
mySumDist += distance();
- cout << " ------ SOLUTION: ( "<< myParam.X() <<" "<< myParam.Y() <<" "<< myParam.Z() <<" )"<<endl
- << " ------ DIST : " << distance() << "\t Tol=" << myTolerance << "\t Nb LOOPS=" << nbLoops << endl
- << " ------ NB IT: " << myNbIterations << ", SUM DIST: " << mySumDist << endl;
+ MESSAGE ( " ------ SOLUTION: ( "<< myParam.X() <<" "<< myParam.Y() <<" "<< myParam.Z() <<" )"<<endl
+ << " ------ DIST : " << distance() << "\t Tol=" << myTolerance << "\t Nb LOOPS=" << nbLoops << endl
+ << " ------ NB IT: " << myNbIterations << ", SUM DIST: " << mySumDist );
#endif
theParams = myParam;
}
#ifdef DEBUG_PARAM_COMPUTE
- cout << " #### POINT " <<thePoint.X()<<" "<<thePoint.Y()<<" "<<thePoint.Z()<<" ####"<< endl;
+ MESSAGE ( " #### POINT " <<thePoint.X()<<" "<<thePoint.Y()<<" "<<thePoint.Z()<<" ####" );
#endif
if ( myTolerance < 0 ) myTolerance = 1e-6;
return computeParameters( thePoint, theParams, solution );
}
#ifdef DEBUG_PARAM_COMPUTE
- cout << "PARAMS: ( " << params.X() <<" "<< params.Y() <<" "<< params.Z() <<" )"<< endl;
- cout << "DIST: " << sqrt( sqDist ) << endl;
+ MESSAGE ( "PARAMS: ( " << params.X() <<" "<< params.Y() <<" "<< params.Z() <<" )" );
+ MESSAGE ( "DIST: " << sqrt( sqDist ) );
#endif
if ( sqDist < sqDistance ) { // get better
#ifdef DEBUG_PARAM_COMPUTE
myNbIterations += nbLoops*4; // how many times ShellPoint called
mySumDist += sqrt( sqDistance );
- cout << " ------ SOLUTION: ( "<<solution.X()<<" "<<solution.Y()<<" "<<solution.Z()<<" )"<<endl
- << " ------ DIST : " << sqrt( sqDistance ) << "\t Tol=" << myTolerance << "\t Nb LOOPS=" << nbLoops << endl
- << " ------ NB IT: " << myNbIterations << ", SUM DIST: " << mySumDist << endl;
+ MESSAGE ( " ------ SOLUTION: ( "<<solution.X()<<" "<<solution.Y()<<" "<<solution.Z()<<" )"<< std::endl
+ << " ------ DIST : " << sqrt( sqDistance ) << "\t Tol=" << myTolerance << "\t Nb LOOPS=" << nbLoops << std::endl
+ << " ------ NB IT: " << myNbIterations << ", SUM DIST: " << mySumDist );
#endif
theParams = solution;
if ( iE++ > theNbVertexInWires.back() ) {
#ifdef _DEBUG_
gp_Pnt p = BRep_Tool::Pnt( theFirstVertex );
- cout << " : Warning : vertex "<< theFirstVertex.TShape().operator->()
- << " ( " << p.X() << " " << p.Y() << " " << p.Z() << " )"
- << " not found in outer wire of face "<< theFace.TShape().operator->()
- << " with vertices: " << endl;
+ MESSAGE ( " : Warning : vertex "<< theFirstVertex.TShape().operator->()
+ << " ( " << p.X() << " " << p.Y() << " " << p.Z() << " )"
+ << " not found in outer wire of face "<< theFace.TShape().operator->()
+ << " with vertices: " );
wExp.Init( *wlIt, theFace );
for ( int i = 0; wExp.More(); wExp.Next(), i++ )
{
edge = TopoDS::Edge( edge.Oriented( wExp.Orientation() ));
TopoDS_Vertex v = TopExp::FirstVertex( edge, true );
gp_Pnt p = BRep_Tool::Pnt( v );
- cout << i << " " << v.TShape().operator->() << " "
- << p.X() << " " << p.Y() << " " << p.Z() << " " << endl;
+ MESSAGE_ADD ( i << " " << v.TShape().operator->() << " "
+ << p.X() << " " << p.Y() << " " << p.Z() << " " << std::endl );
}
#endif
break; // break infinite loop
#define SMESH_ComputeError_HeaderFile
#include <string>
+#include <list>
#include <boost/shared_ptr.hpp>
class SMESH_Algo;
+class SMDS_MeshElement;
struct SMESH_ComputeError;
typedef boost::shared_ptr<SMESH_ComputeError> SMESH_ComputeErrorPtr;
std::string myComment;
const SMESH_Algo* myAlgo;
+ std::list<const SMDS_MeshElement*> myBadElements; //!< to explain COMPERR_BAD_INPUT_MESH
+
static SMESH_ComputeErrorPtr New( int error = COMPERR_OK,
std::string comment = "",
const SMESH_Algo* algo = 0)
};
-#define case2char(err) case err: return #err;
+#define _case2char(err) case err: return #err;
std::string SMESH_ComputeError::CommonName() const
{
switch( myName ) {
- case2char(COMPERR_OK );
- case2char(COMPERR_BAD_INPUT_MESH);
- case2char(COMPERR_STD_EXCEPTION );
- case2char(COMPERR_OCC_EXCEPTION );
- case2char(COMPERR_SLM_EXCEPTION );
- case2char(COMPERR_EXCEPTION );
- case2char(COMPERR_MEMORY_PB );
- case2char(COMPERR_ALGO_FAILED );
+ _case2char(COMPERR_OK );
+ _case2char(COMPERR_BAD_INPUT_MESH);
+ _case2char(COMPERR_STD_EXCEPTION );
+ _case2char(COMPERR_OCC_EXCEPTION );
+ _case2char(COMPERR_SLM_EXCEPTION );
+ _case2char(COMPERR_EXCEPTION );
+ _case2char(COMPERR_MEMORY_PB );
+ _case2char(COMPERR_ALGO_FAILED );
default:;
}
return "";
HYP_ALREADY_EXIST,// such hypothesis already exist
HYP_BAD_DIM, // bad dimension
HYP_BAD_SUBSHAPE, // shape is neither the main one, nor its subshape, nor a group
- HYP_BAD_GEOMETRY // shape geometry mismatches algorithm's expectation
+ HYP_BAD_GEOMETRY, // shape geometry mismatches algorithm's expectation
+ HYP_NEED_SHAPE // algorithm can work on shape only
};
static bool IsStatusFatal(Hypothesis_Status theStatus)
{ return theStatus >= HYP_UNKNOWN_FATAL; }
SMESH_Group *aGroup = (*itg).second;
delete aGroup;
}
+ _mapGroup.clear();
}
//=============================================================================
return aSolid;
}
+//=======================================================================
+/*!
+ * \brief Remove all nodes and elements
+ */
+//=======================================================================
+
+void SMESH_Mesh::Clear()
+{
+ // clear sub-meshes; get ready to re-compute as a side-effect
+
+ if ( SMESH_subMesh *sm = GetSubMeshContaining( GetShapeToMesh() ) )
+ {
+ SMESH_subMeshIteratorPtr smIt = sm->getDependsOnIterator(/*includeSelf=*/true,
+ /*complexShapeFirst=*/false);
+ while ( smIt->more() )
+ {
+ sm = smIt->next();
+ TopAbs_ShapeEnum shapeType = sm->GetSubShape().ShapeType();
+ if ( shapeType == TopAbs_VERTEX || shapeType < TopAbs_SOLID )
+ // all other shapes depends on vertices so they are already cleaned
+ sm->ComputeStateEngine( SMESH_subMesh::CLEAN );
+ // to recompute even if failed
+ sm->ComputeStateEngine( SMESH_subMesh::CHECK_COMPUTE_STATE );
+ }
+ }
+
+ // clear entities not on sub-meshes
+
+ SMDS_VolumeIteratorPtr vIt = _myMeshDS->volumesIterator();
+ while ( vIt->more() )
+ _myMeshDS->RemoveFreeElement( vIt->next(), 0 );
+
+ SMDS_FaceIteratorPtr fIt = _myMeshDS->facesIterator();
+ while ( fIt->more() )
+ _myMeshDS->RemoveFreeElement( fIt->next(), 0 );
+
+ SMDS_EdgeIteratorPtr eIt = _myMeshDS->edgesIterator();
+ while ( eIt->more() )
+ _myMeshDS->RemoveFreeElement( eIt->next(), 0 );
+
+ SMDS_NodeIteratorPtr nIt = _myMeshDS->nodesIterator();
+ while ( nIt->more() ) {
+ const SMDS_MeshNode * node = nIt->next();
+ if ( node->NbInverseElements() == 0 )
+ _myMeshDS->RemoveFreeNode( node, 0 );
+ else
+ _myMeshDS->RemoveNode(node);
+ }
+}
+
//=======================================================================
//function : UNVToMesh
//purpose :
*/
static const TopoDS_Solid& PseudoShape();
+ /*!
+ * \brief Remove all nodes and elements
+ */
+ void Clear();
int UNVToMesh(const char* theFileName);
/*!
return SEW_TOPO_DIFF_SETS_OF_ELEMENTS;
}
#ifdef DEBUG_MATCHING_NODES
- cout << " Link 1: " << link[0].first->GetID() <<" "<< link[0].second->GetID()
- << " F 1: " << face[0];
- cout << "| Link 2: " << link[1].first->GetID() <<" "<< link[1].second->GetID()
- << " F 2: " << face[1] << " | Bind: "<<endl ;
+ MESSAGE ( " Link 1: " << link[0].first->GetID() <<" "<< link[0].second->GetID()
+ << " F 1: " << face[0] << "| Link 2: " << link[1].first->GetID() <<" "
+ << link[1].second->GetID() << " F 2: " << face[1] << " | Bind: " ) ;
#endif
int nbN = nbNodes[0];
{
list<const SMDS_MeshNode*>::iterator n2 = notLinkNodes[1].begin();
for ( int i = 0 ; i < nbN - 2; ++i ) {
#ifdef DEBUG_MATCHING_NODES
- cout << (*n1)->GetID() << " to " << (*n2)->GetID() << endl;
+ MESSAGE ( (*n1)->GetID() << " to " << (*n2)->GetID() );
#endif
nReplaceMap.insert( make_pair( *(n1++), *(n2++) ));
}
else // new in set == encountered for the first time: add
{
#ifdef DEBUG_MATCHING_NODES
- cout << "Add link 1: " << n1->GetID() << " " << n2->GetID() << " ";
- cout << " | link 2: " << nReplaceMap[n1]->GetID() << " " << nReplaceMap[n2]->GetID() << " " << endl;
+ MESSAGE ( "Add link 1: " << n1->GetID() << " " << n2->GetID() << " "
+ << " | link 2: " << nReplaceMap[n1]->GetID() << " " << nReplaceMap[n2]->GetID() << " " );
#endif
linkList[0].push_back ( NLink( n1, n2 ));
linkList[1].push_back ( NLink( nReplaceMap[n1], nReplaceMap[n2] ));
ok = ( V == vert.Current() );
if ( !ok ) {
#ifdef _DEBUG_
- cout << "SMESH_MesherHelper::GetNodeUV(); Vertex " << vertexID
- << " not in face " << GetMeshDS()->ShapeToIndex( F ) << endl;
+ MESSAGE ( "SMESH_MesherHelper::GetNodeUV(); Vertex " << vertexID
+ << " not in face " << GetMeshDS()->ShapeToIndex( F ) );
#endif
// get UV of a vertex closest to the node
double dist = 1e100;
#include <Bnd_Box.hxx>
#include <Bnd_Box2d.hxx>
#include <ElSLib.hxx>
+#include <Extrema_ExtPC.hxx>
#include <Extrema_GenExtPS.hxx>
#include <Extrema_POnSurf.hxx>
#include <Geom2d_Curve.hxx>
#include <GeomAdaptor_Surface.hxx>
#include <Geom_Curve.hxx>
#include <Geom_Surface.hxx>
-//#include <IntAna2d_AnaIntersection.hxx>
#include <TopAbs_ShapeEnum.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
TopoDS_Edge & edge = *elIt;
list< TPoint* > & ePoints = getShapePoints( edge );
double f, l;
- Handle(Geom2d_Curve) C2d;
- if ( !theProject )
- C2d = BRep_Tool::CurveOnSurface( edge, face, f, l );
+ Handle(Geom2d_Curve) C2d = BRep_Tool::CurveOnSurface( edge, face, f, l );
bool isForward = ( edge.Orientation() == TopAbs_FORWARD );
TopoDS_Shape v1 = TopExp::FirstVertex( edge, true ); // always FORWARD
const SMDS_EdgePosition* epos =
static_cast<const SMDS_EdgePosition*>(node->GetPosition().get());
double u = epos->GetUParameter();
- paramNodeMap.insert( TParamNodeMap::value_type( u, node ));
+ paramNodeMap.insert( make_pair( u, node ));
+ }
+ if ( paramNodeMap.size() != eSubMesh->NbNodes() ) {
+ // wrong U on edge, project
+ Extrema_ExtPC proj;
+ BRepAdaptor_Curve aCurve( edge );
+ proj.Initialize( aCurve, f, l );
+ paramNodeMap.clear();
+ nIt = eSubMesh->GetNodes();
+ for ( int iNode = 0; nIt->more(); ++iNode ) {
+ const SMDS_MeshNode* node = smdsNode( nIt->next() );
+ proj.Perform( gp_Pnt( node->X(), node->Y(), node->Z()));
+ double u = 0;
+ if ( proj.IsDone() ) {
+ for ( int i = 1, nb = proj.NbExt(); i <= nb; ++i )
+ if ( proj.IsMin( i )) {
+ u = proj.Point( i ).Parameter();
+ break;
+ }
+ } else {
+ u = isForward ? iNode : eSubMesh->NbNodes() - iNode;
+ }
+ paramNodeMap.insert( make_pair( u, node ));
+ }
}
// put U in [0,1] so that the first key-point has U==0
double du = l - f;
bndBox.Get( minPar[0], minPar[1], maxPar[0], maxPar[1] );
eBndBox.Get( eMinPar[0], eMinPar[1], eMaxPar[0], eMaxPar[1] );
#ifdef DBG_SETFIRSTEDGE
- cout << "EDGES: X: " << eMinPar[0] << " - " << eMaxPar[0] << " Y: "
- << eMinPar[1] << " - " << eMaxPar[1] << endl;
+ MESSAGE ( "EDGES: X: " << eMinPar[0] << " - " << eMaxPar[0] << " Y: "
+ << eMinPar[1] << " - " << eMaxPar[1] );
#endif
for ( int iC = 1, i = 0; i < 2; iC++, i++ ) // loop on 2 coordinates
{
for ( iE = 0 ; iE < nbEdges; iE++ )
{
#ifdef DBG_SETFIRSTEDGE
- cout << " VARIANT " << iE << endl;
+ MESSAGE ( " VARIANT " << iE );
#endif
// evaluate the distance between UV computed by the 2 methods:
// by isos intersection ( myXYZ ) and by edge p-curves ( myUV )
TPoint* p = (*pIt);
dist += ( p->myUV - gp_XY( p->myXYZ.X(), p->myXYZ.Y() )).SquareModulus();
#ifdef DBG_SETFIRSTEDGE
- cout << " ISO : ( " << p->myXYZ.X() << ", "<< p->myXYZ.Y() << " ) PCURVE : ( " <<
- p->myUV.X() << ", " << p->myUV.Y() << ") " << endl;
+ MESSAGE ( " ISO : ( " << p->myXYZ.X() << ", "<< p->myXYZ.Y() << " ) PCURVE : ( " <<
+ p->myUV.X() << ", " << p->myUV.Y() << ") " );
#endif
}
}
#ifdef DBG_SETFIRSTEDGE
- cout << "dist -- " << dist << endl;
+ MESSAGE ( "dist -- " << dist );
#endif
if ( dist < minDist ) {
minDist = dist;
#ifdef _DEBUG_
vector< TPoint >::const_iterator pVecIt = myPoints.begin();
for ( int i = 0; pVecIt != myPoints.end(); pVecIt++, i++ )
- cout << i << ": " << *pVecIt;
+ MESSAGE_ADD ( std::endl << i << ": " << *pVecIt );
#endif
}
bool SMESH_subMesh::CanAddHypothesis(const SMESH_Hypothesis* theHypothesis) const
{
int aHypDim = theHypothesis->GetDim();
- if(_father->HasShapeToMesh()) {
- int aShapeDim = SMESH_Gen::GetShapeDim(_subShape);
- if ( aHypDim <= aShapeDim )
- return true;
- }
- else
- //Only 3D hypothesis may be assigned to the mesh w/o geometry
- return aHypDim == 3;
-// if ( aHypDim < aShapeDim )
-// return ( _father->IsMainShape( _subShape ));
+ int aShapeDim = SMESH_Gen::GetShapeDim(_subShape);
+ if ( aHypDim <= aShapeDim )
+ return true;
return false;
}
// check if a shape needed by algo is present
// -------------------------------------------
algo = static_cast< SMESH_Algo* >( anHyp );
- if(_father->GetShapeToMesh() != SMESH_Mesh::PseudoShape())
- if ( !_father->HasShapeToMesh() && algo->NeedShape() )
- return SMESH_Hypothesis::HYP_BAD_GEOMETRY;
+ if ( !_father->HasShapeToMesh() && algo->NeedShape() )
+ return SMESH_Hypothesis::HYP_NEED_SHAPE;
// ----------------------
// check mesh conformity
// ----------------------
if ( ! CanAddHypothesis( anHyp )) // check dimension
return SMESH_Hypothesis::HYP_BAD_DIM;
- if(anHyp->GetDim() == 3 && !_father->HasShapeToMesh()
- && event == ADD_ALGO) {
- //Only NETGEN_3D and GHS3D_3D can be assigned to the Mesh w/o geometryy
- bool isNetgen3D = (strcmp( "NETGEN_3D", anHyp->GetName()) == 0);
- bool isGhs3d = (strcmp( "GHS3D_3D", anHyp->GetName()) == 0);
- if( !isNetgen3D && !isGhs3d)
- return SMESH_Hypothesis::HYP_BAD_DIM;
- }
-
-
-
if ( /*!anHyp->IsAuxiliary() &&*/ GetSimilarAttached( _subShape, anHyp ) )
return SMESH_Hypothesis::HYP_ALREADY_EXIST;
_computeState = READY_TO_COMPUTE;
SMESHDS_SubMesh* smDS = GetSubMeshDS();
if ( smDS && smDS->NbNodes() ) {
- _computeState = COMPUTE_OK;
+ if ( event == CLEAN ) {
+ CleanDependants();
+ cleanSubMesh( this );
+ }
+ else
+ _computeState = COMPUTE_OK;
}
else if ( event == COMPUTE && !_alwaysComputed ) {
const TopoDS_Vertex & V = TopoDS::Vertex( _subShape );
SetAlgoState(MISSING_HYP);
break;
}
+ TopoDS_Shape shape = _subShape;
// check submeshes needed
if (_father->HasShapeToMesh() ) {
- bool subComputed = SubMeshesComputed();
+ bool subComputed = false;
+ if (!algo->OnlyUnaryInput())
+ shape = GetCollection( gen, algo, subComputed );
+ else
+ subComputed = SubMeshesComputed();
ret = ( algo->NeedDescretBoundary() ? subComputed :
( !subComputed || _father->IsNotConformAllowed() ));
if (!ret) {
ret = false;
_computeState = FAILED_TO_COMPUTE;
_computeError = SMESH_ComputeError::New(COMPERR_OK,"",algo);
- TopoDS_Shape shape = _subShape;
try {
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
OCC_CATCH_SIGNALS;
}
else
{
- if (!algo->OnlyUnaryInput()) {
- shape = GetCollection( gen, algo );
- }
ret = algo->Compute((*_father), shape);
}
if ( !ret )
_computeError = algo->GetComputeError();
}
catch ( std::bad_alloc& exc ) {
- printf("std::bad_alloc thrown inside algo->Compute()\n");
+ MESSAGE("std::bad_alloc thrown inside algo->Compute()");
if ( _computeError ) {
_computeError->myName = COMPERR_MEMORY_PB;
//_computeError->myComment = exc.what();
throw exc;
}
catch ( Standard_OutOfMemory& exc ) {
- printf("Standard_OutOfMemory thrown inside algo->Compute()\n");
+ MESSAGE("Standard_OutOfMemory thrown inside algo->Compute()");
if ( _computeError ) {
_computeError->myName = COMPERR_MEMORY_PB;
//_computeError->myComment = exc.what();
switch (event)
{
case MODIF_ALGO_STATE:
+ algo = gen->GetAlgo((*_father), _subShape);
+ if (algo && !algo->NeedDescretBoundary())
+ CleanDependsOn(); // clean sub-meshes with event CLEAN
if (_algoState == HYP_OK)
_computeState = READY_TO_COMPUTE;
else
text << " \"" << _computeError->myComment << "\"";
#ifdef _DEBUG_
- cout << text << endl;
+ MESSAGE_BEGIN ( text );
// Show vertices location of a failed shape
TopTools_IndexedMapOfShape vMap;
TopExp::MapShapes( _subShape, TopAbs_VERTEX, vMap );
- cout << "Subshape vertices " << ( vMap.Extent()>10 ? "(first 10):" : ":") << endl;
+ MESSAGE_ADD ( "Subshape vertices " << ( vMap.Extent()>10 ? "(first 10):" : ":") );
for ( int iv = 1; iv <= vMap.Extent() && iv < 11; ++iv ) {
gp_Pnt P( BRep_Tool::Pnt( TopoDS::Vertex( vMap( iv ) )));
- cout << "#" << _father->GetMeshDS()->ShapeToIndex( vMap( iv )) << " ";
- cout << P.X() << " " << P.Y() << " " << P.Z() << " " << endl;
+ MESSAGE_ADD ( "#" << _father->GetMeshDS()->ShapeToIndex( vMap( iv )) << " "
+ << P.X() << " " << P.Y() << " " << P.Z() << " " );
}
#else
INFOS( text );
// meshed at once along with _subShape
//=======================================================================
-TopoDS_Shape SMESH_subMesh::GetCollection(SMESH_Gen * theGen, SMESH_Algo* theAlgo)
+TopoDS_Shape SMESH_subMesh::GetCollection(SMESH_Gen * theGen,
+ SMESH_Algo* theAlgo,
+ bool & theSubComputed)
{
MESSAGE("SMESH_subMesh::GetCollection");
+ theSubComputed = SubMeshesComputed();
+
TopoDS_Shape mainShape = _father->GetMeshDS()->ShapeToMesh();
if ( mainShape.IsSame( _subShape ))
if (anAlgo == theAlgo &&
anAlgo->GetUsedHypothesis( *_father, S, ignoreAuxiliaryHyps ) == aUsedHyp)
aBuilder.Add( aCompound, S );
+ if ( !subMesh->SubMeshesComputed() )
+ theSubComputed = false;
}
}
* \brief Return a shape containing all sub-shapes of the MainShape that can be
* meshed at once along with _subShape
*/
- TopoDS_Shape GetCollection(SMESH_Gen * theGen, SMESH_Algo* theAlgo);
+ TopoDS_Shape GetCollection(SMESH_Gen * theGen,
+ SMESH_Algo* theAlgo,
+ bool & theSubComputed);
/*!
* \brief Apply theAlgo to all subshapes in theCollection
// just set client mesh pointer to server mesh pointer
//SMESH_Mesh* aMesh = reinterpret_cast<SMESH_Mesh*>(theMesh->GetMeshPtr());
CORBA::LongLong pointeur = theMesh->GetMeshPtr();
- cerr <<"SMESH_Client::SMESH_Client pointeur " << pointeur << endl;
+ if( MYDEBUG )
+ MESSAGE("SMESH_Client::SMESH_Client pointeur "<<pointeur);
SMESH_Mesh* aMesh = reinterpret_cast<SMESH_Mesh*> (pointeur);
- cerr <<"SMESH_Client::SMESH_Client aMesh " << aMesh << endl;
+ if ( MYDEBUG )
+ MESSAGE("SMESH_Client::SMESH_Client aMesh "<<aMesh);
if(aMesh->GetMeshDS()->IsEmbeddedMode()){
mySMESHDSMesh = aMesh->GetMeshDS();
mySMDSMesh = mySMESHDSMesh;
void SMESHDS_GroupBase::SetColorGroup(int theColorGroup)
{
- if( theColorGroup < 0 || theColorGroup > 360 )
- {
- MESSAGE("SMESHDS_GroupBase::SetColorGroup : Value must be in range [0,360]");
+ int aRed = ( theColorGroup/1000000 );
+ int aGreen = ( theColorGroup -aRed*1000000)/1000;
+ int aBlue = ( theColorGroup - aRed*1000000 - aGreen*1000 );
+ double aR = aRed/255.0;
+ double aG = aGreen/255.0;
+ double aB = aBlue/255.0;
+ if ( aR < 0. || aR > 1. || // PAL19395
+ aG < 0. || aG > 1. ||
+ aB < 0. || aB > 1. )
+// #ifdef _DEBUG_
+// cout << "SMESHDS_GroupBase::SetColorGroup("<<theColorGroup<<"), invalid color ignored"<<endl;
+// #endif
return;
- }
-
- Quantity_Color aColor( (double)theColorGroup, 1.0, 1.0, Quantity_TOC_HLS );
+ Quantity_Color aColor( aR, aG, aB, Quantity_TOC_RGB );
SetColor( aColor );
}
int SMESHDS_GroupBase::GetColorGroup() const
{
Quantity_Color aColor = GetColor();
- double aHue = aColor.Hue();
- if( aHue < 0 )
- return 0;
- return (int)( aHue );
+ double aRed = aColor.Red();
+ double aGreen = aColor.Green();
+ double aBlue = aColor.Blue();
+ int aR = int( aRed *255 );
+ int aG = int( aGreen*255 );
+ int aB = int( aBlue *255 );
+ int aRet = (int)(aR*1000000 + aG*1000 + aB);
+
+ return aRet;
}
$(BOOST_CPPFLAGS) \
$(CORBA_CXXFLAGS) \
$(CORBA_INCLUDES) \
+ $(MED2_INCLUDES) \
+ $(HDF5_INCLUDES) \
-I$(srcdir)/../OBJECT \
-I$(srcdir)/../SMESHFiltersSelection \
-I$(srcdir)/../SMDS \
// Definitions
//=============================================================
- void ImportMeshesFromFile(SMESH::SMESH_Gen_ptr theComponentMesh,
- int theCommandID)
+ void ImportMeshesFromFile( SMESH::SMESH_Gen_ptr theComponentMesh,
+ int theCommandID )
{
QStringList filter;
std::string myExtension;
- if(theCommandID == 113){
- filter.append(QObject::tr("MED files (*.med)"));
- filter.append(QObject::tr("All files (*)"));
- }else if (theCommandID == 112){
- filter.append(QObject::tr("IDEAS files (*.unv)"));
- }else if (theCommandID == 111){
- filter.append(QObject::tr("DAT files (*.dat)"));
- }
- QString filename = SUIT_FileDlg::getFileName(SMESHGUI::desktop(),
- "",
- filter,
- QObject::tr("Import mesh"),
- true);
- if(!filename.isEmpty()) {
+ if ( theCommandID == 113 ) {
+ filter.append( QObject::tr( "MED files (*.med)" ) );
+ filter.append( QObject::tr( "All files (*)" ) );
+ }
+ else if ( theCommandID == 112 ) {
+ filter.append( QObject::tr( "IDEAS files (*.unv)" ) );
+ }
+ else if ( theCommandID == 111 ) {
+ filter.append( QObject::tr( "DAT files (*.dat)" ) );
+ }
+
+ QString anInitialPath = "";
+ if ( SUIT_FileDlg::getLastVisitedPath().isEmpty() )
+ anInitialPath = QDir::currentPath();
+
+ QStringList filenames = SUIT_FileDlg::getOpenFileNames( SMESHGUI::desktop(),
+ anInitialPath,
+ filter,
+ QObject::tr( "SMESH_IMPORT_MESH" ) );
+ if ( filenames.count() > 0 ) {
SUIT_OverrideCursor wc;
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
- try {
+ QStringList errors;
+ bool isEmpty = false;
+ for ( QStringList::ConstIterator it = filenames.begin(); it != filenames.end(); ++it ) {
+ QString filename = *it;
SMESH::mesh_array_var aMeshes = new SMESH::mesh_array;
- switch ( theCommandID ) {
- case 112:
- {
- aMeshes->length( 1 );
- aMeshes[0] = theComponentMesh->CreateMeshesFromUNV(filename.toLatin1().data());
- break;
- }
- case 113:
- {
- SMESH::DriverMED_ReadStatus res;
- aMeshes = theComponentMesh->CreateMeshesFromMED(filename.toLatin1().data(),res);
- if ( res != SMESH::DRS_OK ) {
- wc.suspend();
- SUIT_MessageBox::warning(SMESHGUI::desktop(),
- QObject::tr("SMESH_WRN_WARNING"),
- QObject::tr(QString("SMESH_DRS_%1").arg(res).
- toLatin1().data()));
- aMeshes->length( 0 );
- wc.resume();
+ try {
+ switch ( theCommandID ) {
+ case 111:
+ {
+ // DAT format (currently unsupported)
+ errors.append( QString( "%1 :\n\t%2" ).arg( filename ).
+ arg( QObject::tr( "SMESH_ERR_NOT_SUPPORTED_FORMAT" ) ) );
+ break;
+ }
+ case 112:
+ {
+ // UNV format
+ aMeshes->length( 1 );
+ aMeshes[0] = theComponentMesh->CreateMeshesFromUNV( filename.toLatin1().constData() );
+ if ( aMeshes[0]->_is_nil() )
+ errors.append( QString( "%1 :\n\t%2" ).arg( filename ).
+ arg( QObject::tr( "SMESH_ERR_UNKNOWN_IMPORT_ERROR" ) ) );
+ break;
+ }
+ case 113:
+ {
+ // MED format
+ SMESH::DriverMED_ReadStatus res;
+ aMeshes = theComponentMesh->CreateMeshesFromMED( filename.toLatin1().constData(), res );
+ if ( res != SMESH::DRS_OK ) {
+ errors.append( QString( "%1 :\n\t%2" ).arg( filename ).
+ arg( QObject::tr( QString( "SMESH_DRS_%1" ).arg( res ).toLatin1().data() ) ) );
+ }
+ break;
}
- break;
}
}
+ catch ( const SALOME::SALOME_Exception& S_ex ) {
+ errors.append( QString( "%1 :\n\t%2" ).arg( filename ).
+ arg( QObject::tr( "SMESH_ERR_UNKNOWN_IMPORT_ERROR" ) ) );
+ }
- bool isEmpty = false;
for ( int i = 0, iEnd = aMeshes->length(); i < iEnd; i++ ) {
_PTR(SObject) aMeshSO = SMESH::FindSObject( aMeshes[i] );
if ( aMeshSO ) {
_PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
_PTR(AttributePixMap) aPixmap = aBuilder->FindOrCreateAttribute( aMeshSO, "AttributePixMap" );
- aPixmap->SetPixMap("ICON_SMESH_TREE_MESH_IMPORTED");
+ aPixmap->SetPixMap( "ICON_SMESH_TREE_MESH_IMPORTED" );
if ( theCommandID == 112 ) // mesh names aren't taken from the file for UNV import
SMESH::SetName( aMeshSO, QFileInfo(filename).fileName() );
- } else
+ }
+ else {
isEmpty = true;
+ }
}
+ }
- if ( isEmpty ) {
- wc.suspend();
- SUIT_MessageBox::warning(SMESHGUI::desktop(),
- QObject::tr("SMESH_WRN_WARNING"),
- QObject::tr("SMESH_DRS_EMPTY"));
- wc.resume();
- }
-
- SMESHGUI::GetSMESHGUI()->updateObjBrowser();
+ // update Object browser
+ SMESHGUI::GetSMESHGUI()->updateObjBrowser();
+
+ // show Error message box if there were errors
+ if ( errors.count() > 0 ) {
+ SUIT_MessageBox::critical( SMESHGUI::desktop(),
+ QObject::tr( "SMESH_ERROR" ),
+ QObject::tr( "SMESH_IMPORT_ERRORS" ) + "\n" + errors.join( "\n" ) );
}
- catch (const SALOME::SALOME_Exception& S_ex){
- wc.suspend();
- SalomeApp_Tools::QtCatchCorbaException(S_ex);
- wc.resume();
+
+ // show warning message box, if some imported mesh is empty
+ if ( isEmpty ) {
+ SUIT_MessageBox::warning( SMESHGUI::desktop(),
+ QObject::tr( "SMESH_WRN_WARNING" ),
+ QObject::tr( "SMESH_DRS_SOME_EMPTY" ) );
}
}
}
-
void ExportMeshToFile( int theCommandID )
{
LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
return;
}
// PAL18696
- QString v21( aMesh->GetVersionString( SMESH::MED_V2_1, 2));
- QString v22( aMesh->GetVersionString( SMESH::MED_V2_2, 2));
+ QString v21 (aMesh->GetVersionString(SMESH::MED_V2_1, 2));
+ QString v22 (aMesh->GetVersionString(SMESH::MED_V2_2, 2));
aFilterMap.insert( QString("MED ") + v21 + " (*.med)", SMESH::MED_V2_1 );
aFilterMap.insert( QString("MED ") + v22 + " (*.med)", SMESH::MED_V2_2 );
}
if ( resMgr )
toCreateGroups = resMgr->booleanValue( "SMESH", "auto_groups", false );
- if ( theCommandID != 122 && theCommandID != 125 && theCommandID != 140 && theCommandID != 141)
-
- aFilename = SUIT_FileDlg::getFileName(SMESHGUI::desktop(), "", aFilter, aTitle, false);
+ QString anInitialPath = "";
+ if ( SUIT_FileDlg::getLastVisitedPath().isEmpty() )
+ anInitialPath = QDir::currentPath();
+ if ( theCommandID != 122 && theCommandID != 125 && theCommandID != 140 && theCommandID != 141) {
+ if ( anInitialPath.isEmpty() ) anInitialPath = SUIT_FileDlg::getLastVisitedPath();
+ aFilename = SUIT_FileDlg::getFileName(SMESHGUI::desktop(), anInitialPath + QString("/") + anIObject->getName(),
+ aFilter, aTitle, false);
+ }
else if(theCommandID == 140 || theCommandID == 141) { // Export to STL
QStringList filters;
QMap<QString, int>::const_iterator it = aFilterMapSTL.begin();
fd->setWindowTitle( aTitle );
fd->setFilters( filters );
fd->selectFilter( QObject::tr("STL ASCII (*.stl)") );
+ if ( !anInitialPath.isEmpty() )
+ fd->setDirectory( anInitialPath );
+ fd->selectFile(anIObject->getName());
bool is_ok = false;
while (!is_ok) {
if ( fd->exec() )
}
delete fd;
}
- else {
+ else { // Export to MED
QStringList filters;
+ QString aDefaultFilter;
QMap<QString, SMESH::MED_VERSION>::const_iterator it = aFilterMap.begin();
- for ( ; it != aFilterMap.end(); ++it )
+ for ( ; it != aFilterMap.end(); ++it ) {
filters.push_back( it.key() );
+ if (it.value() == SMESH::MED_V2_2)
+ aDefaultFilter = it.key();
+ }
//SUIT_FileDlg* fd = new SUIT_FileDlg( SMESHGUI::desktop(), false, true, true );
SalomeApp_CheckFileDlg* fd = new SalomeApp_CheckFileDlg
( SMESHGUI::desktop(), false, QObject::tr("SMESH_AUTO_GROUPS"), true, true );
fd->setWindowTitle( aTitle );
fd->setFilters( filters );
- //fd->selectFilter( QObject::tr("MED 2.2 (*.med)") );
- fd->selectFilter( filters.last() );
+ //fd->setSelectedFilter( QObject::tr("MED 2.2 (*.med)") );
+ fd->selectFilter(aDefaultFilter);
fd->SetChecked(toCreateGroups);
+ if ( !anInitialPath.isEmpty() )
+ fd->setDirectory( anInitialPath );
+ fd->selectFile(anIObject->getName());
bool is_ok = false;
while (!is_ok) {
if ( fd->exec() )
LightApp_SelectionMgr* aSel = SMESHGUI::selectionMgr();
SALOME_ListIO selected; aSel->selectedObjects( selected, QString::null, false );
+ _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
+ _PTR(StudyBuilder) aStudyBuilder = aStudy->NewBuilder();
+ _PTR(GenericAttribute) anAttr;
+ _PTR(AttributeIOR) anIOR;
+
+ int objectCount = 0;
QString aParentComponent = QString::null;
for( SALOME_ListIteratorOfListIO anIt( selected ); anIt.More(); anIt.Next() )
{
+ _PTR(SObject) aSO = aStudy->FindObjectID(anIt.Value()->getEntry());
+ if (aSO) {
+ // check if object is not reference
+ _PTR(SObject) refobj;
+ if ( !aSO->ReferencedObject( refobj ) )
+ objectCount++;
+ }
+
QString cur = anIt.Value()->getComponentDataType();
if( aParentComponent.isNull() )
aParentComponent = cur;
aParentComponent = "";
}
+ if ( objectCount == 0 )
+ return; // No Valid Objects Selected
+
if ( aParentComponent != SMESHGUI::GetSMESHGUI()->name() ) {
SUIT_MessageBox::warning( SMESHGUI::desktop(),
QObject::tr("ERR_ERROR"),
SUIT_ViewManager* vm = anApp->activeViewManager();
int nbSf = vm->getViewsCount();
- _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
- _PTR(StudyBuilder) aStudyBuilder = aStudy->NewBuilder();
- _PTR(GenericAttribute) anAttr;
- _PTR(AttributeIOR) anIOR;
-
SALOME_ListIteratorOfListIO It(selected);
aStudyBuilder->NewCommand(); // There is a transaction
continue;
}
+ _PTR(SObject) refobj;
+ if ( aSO && aSO->ReferencedObject( refobj ) )
+ continue; // skip references
+
// put the whole hierarchy of sub-objects of the selected SO into a list and
// then treat them all starting from the deepest objects (at list back)
( new SMESHGUI_BuildCompoundDlg( this ) )->show();
}
break;
+
case 407: // DIAGONAL INVERSION
case 408: // Delete diagonal
{
if( aSel )
aSel->selectedObjects( selected );
+ bool isAny = false; // iss there any appropriate object selected
+
SALOME_ListIteratorOfListIO It( selected );
for ( ; It.More(); It.Next() )
{
{
aName = anAttr;
QString newName = QString(aName->Value().c_str());
- newName = LightApp_NameDlg::getName(desktop(), newName);
- if ( !newName.isEmpty() )
- {
- //old source: aStudy->renameIObject( IObject, newName );
- aName->SetValue( newName.toLatin1().data() );
- // if current object is group update group's name
- SMESH::SMESH_GroupBase_var aGroup =
- SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IObject);
- if (!aGroup->_is_nil() )
- aGroup->SetName( newName.toLatin1().data() );
-
- updateObjBrowser();
+ // check type to prevent renaming of inappropriate objects
+ int aType = SMESHGUI_Selection::type(IObject->getEntry(), aStudy);
+ if (aType == MESH || aType == GROUP ||
+ aType == SUBMESH || aType == SUBMESH_COMPOUND ||
+ aType == SUBMESH_SOLID || aType == SUBMESH_FACE ||
+ aType == SUBMESH_EDGE || aType == SUBMESH_VERTEX ||
+ aType == HYPOTHESIS || aType == ALGORITHM)
+ {
+ isAny = true;
+ newName = LightApp_NameDlg::getName(desktop(), newName);
+ if ( !newName.isEmpty() )
+ {
+ //old source: aStudy->renameIObject( IObject, newName );
+ aName->SetValue( newName.toLatin1().constData() );
+
+ // if current object is group update group's name
+ SMESH::SMESH_GroupBase_var aGroup =
+ SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IObject);
+ if (!aGroup->_is_nil() )
+ aGroup->SetName( newName.toLatin1().constData() );
+
+ updateObjBrowser();
+ }
}
}
}
+ } // for
+
+ if (!isAny) {
+ SUIT_MessageBox::warning(desktop(),
+ QObject::tr("SMESH_WRN_WARNING"),
+ QObject::tr("SMESH_WRN_NO_APPROPRIATE_SELECTION"));
}
break;
}
}
break;
}
+ case 4043: { // CLEAR_MESH
+
+ if(checkLock(aStudy)) break;
+
+ SALOME_ListIO selected;
+ if( LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr() )
+ aSel->selectedObjects( selected );
+
+ SUIT_OverrideCursor wc;
+ SALOME_ListIteratorOfListIO It (selected);
+ for ( ; It.More(); It.Next() )
+ {
+ Handle(SALOME_InteractiveObject) IOS = It.Value();
+ SMESH::SMESH_Mesh_var aMesh =
+ SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IOS);
+ if ( aMesh->_is_nil()) continue;
+ try {
+ SMESH::UpdateView(SMESH::eErase, IOS->getEntry());
+ aMesh->Clear();
+ _PTR(SObject) aMeshSObj = SMESH::FindSObject(aMesh);
+ SMESH::ModifiedMesh( aMeshSObj, false, true);
+ // hide groups and submeshes
+ _PTR(ChildIterator) anIter =
+ SMESH::GetActiveStudyDocument()->NewChildIterator( aMeshSObj );
+ for ( anIter->InitEx(true); anIter->More(); anIter->Next() )
+ {
+ _PTR(SObject) so = anIter->Value();
+ SMESH::UpdateView(SMESH::eErase, so->GetID().c_str());
+ }
+ }
+ catch (const SALOME::SALOME_Exception& S_ex){
+ wc.suspend();
+ SalomeApp_Tools::QtCatchCorbaException(S_ex);
+ wc.resume();
+ }
+ }
+ SMESH::UpdateView();
+ updateObjBrowser();
+ break;
+ }
case 4051: // RENUMBERING NODES
{
if(checkLock(aStudy)) break;
createSMESHAction( 4032, "HEXA", "ICON_DLG_HEXAS" );
createSMESHAction( 4041, "REMOVE_NODES", "ICON_DLG_REM_NODE" );
createSMESHAction( 4042, "REMOVE_ELEMENTS", "ICON_DLG_REM_ELEMENT" );
+ createSMESHAction( 4043, "CLEAR_MESH" , "ICON_CLEAR_MESH" );
createSMESHAction( 4051, "RENUM_NODES", "ICON_DLG_RENUMBERING_NODES" );
createSMESHAction( 4052, "RENUM_ELEMENTS", "ICON_DLG_RENUMBERING_ELEMENTS" );
createSMESHAction( 4061, "TRANS", "ICON_SMESH_TRANSLATION_VECTOR" );
createMenu( 5105, toolsId, -1 );
- createMenu( 702, meshId, -1 );
+ createMenu( 702, meshId, -1 ); // "Mesh" menu
createMenu( 703, meshId, -1 );
createMenu( 704, meshId, -1 );
createMenu( 710, meshId, -1 );
createMenu( 4041, removeId, -1 );
createMenu( 4042, removeId, -1 );
+ createMenu( 4043, removeId, -1 );
createMenu( 4051, renumId, -1 );
createMenu( 4052, renumId, -1 );
createTool( separator(), addRemTb );
createTool( 4041, addRemTb );
createTool( 4042, addRemTb );
+ createTool( 4043, addRemTb );
createTool( separator(), addRemTb );
createTool( 4051, addRemTb );
createTool( 4052, addRemTb );
createTool( 214, dispModeTb );
QString lc = "$"; // VSR : instead of QtxPopupSelection::defEquality();
- QString dc = "selcount"; // VSR : insetad of QtxPopupSelection::defSelCountParam()
+ QString dc = "selcount"; // VSR : instead of QtxPopupSelection::defSelCountParam()
myRules.clear();
QString OB = "'ObjectBrowser'",
createPopupItem( 801, OB, mesh ); // CREATE_GROUP
createPopupItem( 802, OB, subMesh ); // CONSTRUCT_GROUP
popupMgr()->insert( separator(), -1, 0 );
- createPopupItem( 1100, OB, hypo, "" /*"&& $hasReference={false}"*/ ); // EDIT HYPOTHESIS
+ createPopupItem( 1100, OB, hypo); // EDIT HYPOTHESIS
createPopupItem( 1102, OB, hyp_alg ); // REMOVE HYPOTHESIS / ALGORITHMS
- createPopupItem( 1101, OB, mesh_group + " " + hyp_alg, "" /*"&& $hasReference={false}"*/ ); // RENAME
+ createPopupItem( 1101, OB, mesh_group + " " + hyp_alg ); // RENAME
+ popupMgr()->insert( separator(), -1, 0 );
+ createPopupItem( 4043, OB, mesh ); // CLEAR_MESH
popupMgr()->insert( separator(), -1, 0 );
QString only_one_non_empty = QString( " && %1=1 && numberOfNodes>0" ).arg( dc );
+
createPopupItem( 125, OB, mesh, only_one_non_empty ); // EXPORT_MED
createPopupItem( 126, OB, mesh, only_one_non_empty ); // EXPORT_UNV
createPopupItem( 141, OB, mesh, only_one_non_empty ); // EXPORT_STL
this, SLOT( onViewManagerActivated( SUIT_ViewManager* ) ) );
}
+//================================================================================
+/*!
+ * \brief Return true if SMESH or GEOM objects are selected.
+ * Is called form LightApp_Module::activateModule() which clear selection if
+ * not isSelectionCompatible()
+ */
+//================================================================================
+
+bool SMESHGUI::isSelectionCompatible()
+{
+ bool isCompatible = true;
+ SALOME_ListIO selected;
+ if ( LightApp_SelectionMgr *Sel = selectionMgr() )
+ Sel->selectedObjects( selected );
+
+ SALOME_ListIteratorOfListIO It( selected );
+ for ( ; isCompatible && It.More(); It.Next())
+ isCompatible =
+ ( strcmp("GEOM", It.Value()->getComponentDataType()) == 0 ) ||
+ ( strcmp("SMESH", It.Value()->getComponentDataType()) == 0 );
+
+ return isCompatible;
+}
+
bool SMESHGUI::activateModule( SUIT_Study* study )
{
bool res = SalomeApp_Module::activateModule( study );
action(112)->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_U)); // Import UNV
action(113)->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_M)); // Import MED
+ action( 33)->setEnabled(true); // Delete: Key_Delete
+ action(1101)->setEnabled(true); // Rename: Key_F2
+
return res;
}
action(112)->setShortcut(QKeySequence()); // Import UNV
action(113)->setShortcut(QKeySequence()); // Import MED
+ action( 33)->setEnabled(false); // Delete: Key_Delete
+ action(1101)->setEnabled(false); // Rename: Key_F2
+
return SalomeApp_Module::deactivateModule( study );
}
return QString( anIOR.in() );
}
+void SMESHGUI::contextMenuPopup( const QString& client, QMenu* menu, QString& title )
+{
+ SalomeApp_Module::contextMenuPopup( client, menu, title );
+ SALOME_ListIO lst;
+ selectionMgr()->selectedObjects( lst );
+ if ( ( client == "OCCViewer" || client == "VTKViewer" ) && lst.Extent() == 1 ) {
+ Handle(SALOME_InteractiveObject) io = lst.First();
+ SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( application()->activeStudy() );
+ _PTR(Study) study = appStudy->studyDS();
+ _PTR(SObject) obj = study->FindObjectID( io->getEntry() );
+ if ( obj ) {
+ QString aName = QString( obj->GetName().c_str() );
+ while ( aName.at( aName.length() - 1 ) == ' ' ) // Remove extraspaces in Name of Popup
+ aName.remove( (aName.length() - 1), 1 );
+ title = aName;
+ }
+ }
+}
+
LightApp_Selection* SMESHGUI::createSelection() const
{
return new SMESHGUI_Selection();
void EmitSignalStudyFrameChanged();
void EmitSignalCloseAllDialogs();
+ virtual void contextMenuPopup( const QString&, QMenu*, QString& );
virtual void createPreferences();
virtual void preferencesChanged( const QString&, const QString& );
virtual LightApp_Operation* createOperation( const int ) const;
+ virtual bool isSelectionCompatible();
+
private:
void OnEditDelete();
GroupButtonsLayout->setSpacing(SPACING);
GroupButtonsLayout->setMargin(MARGIN);
- buttonOk = new QPushButton(tr("SMESH_BUT_OK"), GroupButtons);
+ buttonOk = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), GroupButtons);
buttonOk->setAutoDefault(true);
buttonOk->setDefault(true);
buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons);
-class SMESHGUI_IdEditItem: public QTableWidgetItem
+/*!
+ \class BusyLocker
+ \brief Simple 'busy state' flag locker.
+ \internal
+*/
+
+class BusyLocker
{
public:
- SMESHGUI_IdEditItem(const QString& text ):
- QTableWidgetItem(text, QTableWidgetItem::UserType+100) {};
- ~SMESHGUI_IdEditItem() {};
+ //! Constructor. Sets passed boolean flag to \c true.
+ BusyLocker( bool& busy ) : myBusy( busy ) { myBusy = true; }
+ //! Destructor. Clear external boolean flag passed as parameter to the constructor to \c false.
+ ~BusyLocker() { myBusy = false; }
+private:
+ bool& myBusy; //! External 'busy state' boolean flag
+};
+
+/*!
+ \class IdEditItem
+ \brief Simple editable table item.
+ \internal
+*/
+
+class IdEditItem: public QTableWidgetItem
+{
+public:
+ IdEditItem(const QString& text );
+ ~IdEditItem();
QWidget* createEditor() const;
};
-QWidget* SMESHGUI_IdEditItem::createEditor() const
+IdEditItem::IdEditItem(const QString& text )
+ : QTableWidgetItem(text, QTableWidgetItem::UserType+100)
+{
+}
+
+IdEditItem::~IdEditItem()
+{
+}
+
+QWidget* IdEditItem::createEditor() const
{
QLineEdit *aLineEdit = new QLineEdit(text(), tableWidget());
aLineEdit->setValidator( new SMESHGUI_IdValidator(tableWidget(), 1) );
: QDialog( SMESH::GetDesktop( theModule ) ),
mySMESHGUI( theModule ),
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
- myType( theType )
+ myType( theType ),
+ myBusy( false )
{
setModal( false );
setAttribute( Qt::WA_DeleteOnClose, true );
aGroupButtonsLayout->setSpacing(SPACING);
aGroupButtonsLayout->setMargin(MARGIN);
- buttonOk = new QPushButton(tr("SMESH_BUT_OK"), GroupButtons);
+ buttonOk = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), GroupButtons);
buttonOk->setAutoDefault(true);
buttonOk->setDefault(true);
buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons);
void SMESHGUI_AddQuadraticElementDlg::Init()
{
myRadioButton1->setChecked(true);
- myIsEditCorners = true;
mySMESHGUI->SetActiveDialogBox((QDialog*)this);
myActor = 0;
for ( int row = 0; row < myTable->rowCount(); row++ )
{
myTable->setItem( row, 0, new QTableWidgetItem( "" ) );
+ myTable->item( row, 0 )->setFlags(0);
- SMESHGUI_IdEditItem* anEditItem = new SMESHGUI_IdEditItem( "" );
+ IdEditItem* anEditItem = new IdEditItem( "" );
anEditItem->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled);
myTable->setItem(row, 1, anEditItem);
myTable->setItem( row, 2, new QTableWidgetItem( "" ) );
+ myTable->item( row, 2 )->setFlags(0);
}
/* signals and slots connections */
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->SetSelectionMode( NodeSelection );
- myBusy = false;
-
SetEditCorners();
}
//=================================================================================
void SMESHGUI_AddQuadraticElementDlg::ClickOnApply()
{
- if (IsValid() && !mySMESHGUI->isActiveStudyLocked()) {
- myBusy = true;
-
- std::vector<int> anIds;
+ if ( mySMESHGUI->isActiveStudyLocked() || myBusy || !IsValid() )
+ return;
- switch (myType) {
- case QUAD_EDGE:
- anIds.push_back(myTable->item(0, 0)->text().toInt());
- anIds.push_back(myTable->item(0, 2)->text().toInt());
- anIds.push_back(myTable->item(0, 1)->text().toInt());
- break;
- case QUAD_TRIANGLE:
- case QUAD_QUADRANGLE:
- case QUAD_TETRAHEDRON:
- case QUAD_PYRAMID:
- case QUAD_PENTAHEDRON:
- case QUAD_HEXAHEDRON:
- for ( int row = 0; row < myNbCorners; row++ )
- anIds.push_back(myTable->item(row, 0)->text().toInt());
- for ( int row = 0; row < myTable->rowCount(); row++ )
- anIds.push_back(myTable->item(row, 1)->text().toInt());
- break;
- }
- if ( myReverseCB->isChecked())
- SMESH::ReverseConnectivity( anIds, myType );
+ BusyLocker lock( myBusy );
+
+ std::vector<int> anIds;
+
+ switch (myType) {
+ case QUAD_EDGE:
+ anIds.push_back(myTable->item(0, 0)->text().toInt());
+ anIds.push_back(myTable->item(0, 2)->text().toInt());
+ anIds.push_back(myTable->item(0, 1)->text().toInt());
+ break;
+ case QUAD_TRIANGLE:
+ case QUAD_QUADRANGLE:
+ case QUAD_TETRAHEDRON:
+ case QUAD_PYRAMID:
+ case QUAD_PENTAHEDRON:
+ case QUAD_HEXAHEDRON:
+ for ( int row = 0; row < myNbCorners; row++ )
+ anIds.push_back(myTable->item(row, 0)->text().toInt());
+ for ( int row = 0; row < myTable->rowCount(); row++ )
+ anIds.push_back(myTable->item(row, 1)->text().toInt());
+ break;
+ }
+ if ( myReverseCB->isChecked())
+ SMESH::ReverseConnectivity( anIds, myType );
- int aNumberOfIds = anIds.size();
- SMESH::long_array_var anArrayOfIdeces = new SMESH::long_array;
- anArrayOfIdeces->length( aNumberOfIds );
+ int aNumberOfIds = anIds.size();
+ SMESH::long_array_var anArrayOfIdeces = new SMESH::long_array;
+ anArrayOfIdeces->length( aNumberOfIds );
- for (int i = 0; i < aNumberOfIds; i++)
- anArrayOfIdeces[i] = anIds[ i ];
+ for (int i = 0; i < aNumberOfIds; i++)
+ anArrayOfIdeces[i] = anIds[ i ];
- SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
- switch (myType) {
- case QUAD_EDGE:
- aMeshEditor->AddEdge(anArrayOfIdeces.inout()); break;
- case QUAD_TRIANGLE:
- case QUAD_QUADRANGLE:
- aMeshEditor->AddFace(anArrayOfIdeces.inout()); break;
- case QUAD_TETRAHEDRON:
- case QUAD_PYRAMID:
- case QUAD_PENTAHEDRON:
- case QUAD_HEXAHEDRON:
- aMeshEditor->AddVolume(anArrayOfIdeces.inout()); break;
- }
+ SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
+ switch (myType) {
+ case QUAD_EDGE:
+ aMeshEditor->AddEdge(anArrayOfIdeces.inout()); break;
+ case QUAD_TRIANGLE:
+ case QUAD_QUADRANGLE:
+ aMeshEditor->AddFace(anArrayOfIdeces.inout()); break;
+ case QUAD_TETRAHEDRON:
+ case QUAD_PYRAMID:
+ case QUAD_PENTAHEDRON:
+ case QUAD_HEXAHEDRON:
+ aMeshEditor->AddVolume(anArrayOfIdeces.inout()); break;
+ }
- SALOME_ListIO aList; aList.Append( myActor->getIO() );
- mySelector->ClearIndex();
- mySelectionMgr->setSelectedObjects( aList, false );
+ SALOME_ListIO aList; aList.Append( myActor->getIO() );
+ mySelector->ClearIndex();
+ mySelectionMgr->setSelectedObjects( aList, false );
- SMESH::UpdateView();
- mySimulation->SetVisibility(false);
+ mySimulation->SetVisibility(false);
+ SMESH::UpdateView();
- buttonOk->setEnabled(false);
- buttonApply->setEnabled(false);
-
- UpdateTable();
- SetEditCorners();
+ UpdateTable();
+ SetEditCorners();
- myBusy = false;
- }
+ updateButtons();
}
//=================================================================================
void SMESHGUI_AddQuadraticElementDlg::onTextChange (const QString& theNewText)
{
if (myBusy) return;
- myBusy = true;
+ BusyLocker lock( myBusy );
- buttonOk->setEnabled(false);
- buttonApply->setEnabled(false);
-
mySimulation->SetVisibility(false);
// hilight entered nodes
QStringList aListId = theNewText.split(" ", QString::SkipEmptyParts);
bool allOk = true;
for (int i = 0; i < aListId.count(); i++) {
- if( const SMDS_MeshNode * n = aMesh->FindNode( aListId[ i ].toInt() ) )
+ if ( const SMDS_MeshNode * n = aMesh->FindNode( aListId[ i ].toInt() ) )
+ {
newIndices.Add( n->GetID() );
+ }
else
- {
- allOk = false;
- break;
- }
+ {
+ allOk = false;
+ break;
+ }
}
mySelector->AddOrRemoveIndex( myActor->getIO(), newIndices, false );
UpdateTable( allOk );
}
- if( IsValid() ) {
- buttonOk->setEnabled(true);
- buttonApply->setEnabled(true);
- }
-
- if ( sender() == myTable )
- displaySimulation();
-
- myBusy = false;
+ updateButtons();
+ displaySimulation();
}
//=================================================================================
void SMESHGUI_AddQuadraticElementDlg::SelectionIntoArgument()
{
if (myBusy) return;
+ BusyLocker lock( myBusy );
if ( myIsEditCorners )
- {
- // clear
- myActor = 0;
-
- myBusy = true;
- myCornerNodes->setText("");
- myBusy = false;
-
- if (!GroupButtons->isEnabled()) // inactive
- return;
-
- buttonOk->setEnabled(false);
- buttonApply->setEnabled(false);
-
- mySimulation->SetVisibility(false);
-
- // get selected mesh
- SALOME_ListIO aList;
- mySelectionMgr->selectedObjects(aList,SVTK_Viewer::Type());
+ {
+ // clear
+ myActor = 0;
+
+ myCornerNodes->setText("");
+
+ if (!GroupButtons->isEnabled()) // inactive
+ return;
+
+ mySimulation->SetVisibility(false);
- if (aList.Extent() != 1)
- {
- UpdateTable();
- return;
- }
+ // get selected mesh
+ SALOME_ListIO aList;
+ mySelectionMgr->selectedObjects(aList,SVTK_Viewer::Type());
+
+ if (aList.Extent() != 1)
+ {
+ UpdateTable();
+ updateButtons();
+ return;
+ }
- Handle(SALOME_InteractiveObject) anIO = aList.First();
- myMesh = SMESH::GetMeshByIO(anIO);
- if (myMesh->_is_nil())
- return;
+ Handle(SALOME_InteractiveObject) anIO = aList.First();
+ myMesh = SMESH::GetMeshByIO(anIO);
+ if (myMesh->_is_nil()) {
+ updateButtons();
+ return;
+ }
- myActor = SMESH::FindActorByEntry(anIO->getEntry());
+ myActor = SMESH::FindActorByEntry(anIO->getEntry());
- }
+ }
- if (!myActor)
+ if (!myActor) {
+ updateButtons();
return;
+ }
// get selected nodes
QString aString = "";
int nbNodes = SMESH::GetNameOfSelectedNodes(mySelector,myActor->getIO(),aString);
if ( myIsEditCorners )
- {
- myBusy = true;
- myCornerNodes->setText(aString);
- myBusy = false;
-
- UpdateTable();
- }
+ {
+ myCornerNodes->setText(aString);
+
+ UpdateTable();
+ }
else if ( myTable->isEnabled() && nbNodes == 1 )
- {
- myBusy = true;
- int theRow = myTable->currentRow(), theCol = myTable->currentColumn();
- if ( theCol == 1 )
- myTable->item(theRow, 1)->setText(aString);
- myBusy = false;
- }
+ {
+ int theRow = myTable->currentRow(), theCol = myTable->currentColumn();
+ if ( theCol == 1 )
+ myTable->item(theRow, 1)->setText(aString);
+ }
- if ( IsValid() )
- {
- buttonOk->setEnabled( true );
- buttonApply->setEnabled( true );
- }
-
+ updateButtons();
displaySimulation();
}
//=================================================================================
void SMESHGUI_AddQuadraticElementDlg::displaySimulation()
{
- if (!myIsEditCorners) {
+ if ( IsValid() )
+ {
SMESH::TElementSimulation::TVTKIds anIds;
// Collect ids from the dialog
int anID;
bool ok;
int aDisplayMode = VTK_SURFACE;
-
+
if ( myType == QUAD_EDGE )
- {
- anIds.push_back( myActor->GetObject()->GetNodeVTKId( myTable->item(0, 0)->text().toInt() ) );
- anIds.push_back( myActor->GetObject()->GetNodeVTKId( myTable->item(0, 2)->text().toInt() ) );
- anID = myTable->item(0, 1)->text().toInt(&ok);
- if (!ok) anID = myTable->item(0, 0)->text().toInt();
- anIds.push_back( myActor->GetObject()->GetNodeVTKId(anID) );
- aDisplayMode = VTK_WIREFRAME;
- }
+ {
+ anIds.push_back( myActor->GetObject()->GetNodeVTKId( myTable->item(0, 0)->text().toInt() ) );
+ anIds.push_back( myActor->GetObject()->GetNodeVTKId( myTable->item(0, 2)->text().toInt() ) );
+ anID = myTable->item(0, 1)->text().toInt(&ok);
+ if (!ok) anID = myTable->item(0, 0)->text().toInt();
+ anIds.push_back( myActor->GetObject()->GetNodeVTKId(anID) );
+ aDisplayMode = VTK_WIREFRAME;
+ }
else
+ {
+ for ( int row = 0; row < myNbCorners; row++ )
+ anIds.push_back( myActor->GetObject()->GetNodeVTKId( myTable->item(row, 0)->text().toInt() ) );
+
+ for ( int row = 0; row < myTable->rowCount(); row++ )
{
- for ( int row = 0; row < myNbCorners; row++ )
- anIds.push_back( myActor->GetObject()->GetNodeVTKId( myTable->item(row, 0)->text().toInt() ) );
-
- for ( int row = 0; row < myTable->rowCount(); row++ )
- {
- anID = myTable->item(row, 1)->text().toInt(&ok);
- if (!ok) {
- anID = myTable->item(row, 0)->text().toInt();
- aDisplayMode = VTK_WIREFRAME;
- }
- anIds.push_back( myActor->GetObject()->GetNodeVTKId(anID) );
- }
+ anID = myTable->item(row, 1)->text().toInt(&ok);
+ if (!ok) {
+ anID = myTable->item(row, 0)->text().toInt();
+ aDisplayMode = VTK_WIREFRAME;
+ }
+ anIds.push_back( myActor->GetObject()->GetNodeVTKId(anID) );
}
+ }
mySimulation->SetPosition(myActor,myType,anIds,aDisplayMode,myReverseCB->isChecked());
- SMESH::UpdateView();
}
+ else
+ {
+ mySimulation->SetVisibility(false);
+ }
+ SMESH::UpdateView();
}
//=================================================================================
{
myCornerNodes->setFocus();
myIsEditCorners = true;
-
SelectionIntoArgument();
+ updateButtons();
}
//=================================================================================
//=================================================================================
void SMESHGUI_AddQuadraticElementDlg::onReverse (int state)
{
- if (!IsValid())
- return;
-
- if (state >= 0) {
- mySimulation->SetVisibility(false);
- displaySimulation();
- }
+ mySimulation->SetVisibility(false);
+ displaySimulation();
+ updateButtons();
}
bool ok;
for ( int row = 0; row < myTable->rowCount(); row++ )
- {
- int anID = myTable->item(row, 1)->text().toInt(&ok);
- if ( !ok )
- return false;
-
- const SMDS_MeshNode * aNode = aMesh->FindNode(anID);
- if ( !aNode )
- return false;
- }
+ {
+ int anID = myTable->item(row, 1)->text().toInt(&ok);
+ if ( !ok )
+ return false;
+
+ const SMDS_MeshNode * aNode = aMesh->FindNode(anID);
+ if ( !aNode )
+ return false;
+ }
return true;
}
QStringList aListCorners = myCornerNodes->text().split(" ", QString::SkipEmptyParts);
if ( aListCorners.count() == myNbCorners && theConersValidity )
- {
- myTable->setEnabled( true );
-
- // clear the Middle column
- for ( int row = 0; row < myTable->rowCount(); row++ )
- myTable->item( row, 1 )->setText("");
-
- int* aFirstColIds;
- int* aLastColIds;
-
- switch (myType) {
- case QUAD_EDGE:
- aFirstColIds = FirstEdgeIds;
- aLastColIds = LastEdgeIds;
- break;
- case QUAD_TRIANGLE:
- aFirstColIds = FirstTriangleIds;
- aLastColIds = LastTriangleIds;
- break;
- case QUAD_QUADRANGLE:
- aFirstColIds = FirstQuadrangleIds;
- aLastColIds = LastQuadrangleIds;
- break;
- case QUAD_TETRAHEDRON:
- aFirstColIds = FirstTetrahedronIds;
- aLastColIds = LastTetrahedronIds;
- break;
- case QUAD_PYRAMID:
- aFirstColIds = FirstPyramidIds;
- aLastColIds = LastPyramidIds;
- break;
- case QUAD_PENTAHEDRON:
- aFirstColIds = FirstPentahedronIds;
- aLastColIds = LastPentahedronIds;
- break;
- case QUAD_HEXAHEDRON:
- aFirstColIds = FirstHexahedronIds;
- aLastColIds = LastHexahedronIds;
- break;
- }
-
- // fill the First and the Last columns
- for (int i = 0, iEnd = myTable->rowCount(); i < iEnd; i++)
- myTable->item( i, 0 )->setText( aListCorners[ aFirstColIds[i] ] );
-
- for (int i = 0, iEnd = myTable->rowCount(); i < iEnd; i++)
- myTable->item( i, 2 )->setText( aListCorners[ aLastColIds[i] ] );
+ {
+ myTable->setEnabled( true );
+
+ // clear the Middle column
+ for ( int row = 0; row < myTable->rowCount(); row++ )
+ myTable->item( row, 1 )->setText("");
+
+ int* aFirstColIds;
+ int* aLastColIds;
+
+ switch (myType) {
+ case QUAD_EDGE:
+ aFirstColIds = FirstEdgeIds;
+ aLastColIds = LastEdgeIds;
+ break;
+ case QUAD_TRIANGLE:
+ aFirstColIds = FirstTriangleIds;
+ aLastColIds = LastTriangleIds;
+ break;
+ case QUAD_QUADRANGLE:
+ aFirstColIds = FirstQuadrangleIds;
+ aLastColIds = LastQuadrangleIds;
+ break;
+ case QUAD_TETRAHEDRON:
+ aFirstColIds = FirstTetrahedronIds;
+ aLastColIds = LastTetrahedronIds;
+ break;
+ case QUAD_PYRAMID:
+ aFirstColIds = FirstPyramidIds;
+ aLastColIds = LastPyramidIds;
+ break;
+ case QUAD_PENTAHEDRON:
+ aFirstColIds = FirstPentahedronIds;
+ aLastColIds = LastPentahedronIds;
+ break;
+ case QUAD_HEXAHEDRON:
+ aFirstColIds = FirstHexahedronIds;
+ aLastColIds = LastHexahedronIds;
+ break;
}
+
+ // fill the First and the Last columns
+ for (int i = 0, iEnd = myTable->rowCount(); i < iEnd; i++)
+ myTable->item( i, 0 )->setText( aListCorners[ aFirstColIds[i] ] );
+
+ for (int i = 0, iEnd = myTable->rowCount(); i < iEnd; i++)
+ myTable->item( i, 2 )->setText( aListCorners[ aLastColIds[i] ] );
+ }
else
- {
- // clear table
- for ( int row = 0; row < myTable->rowCount(); row++ )
- for ( int col = 0; col < myTable->columnCount(); col++ )
- if ( QTableWidgetItem* aTWI = myTable->item(row, col) ) aTWI->setText("");
-
- myTable->setEnabled( false );
- }
+ {
+ // clear table
+ for ( int row = 0; row < myTable->rowCount(); row++ )
+ for ( int col = 0; col < myTable->columnCount(); col++ )
+ if ( QTableWidgetItem* aTWI = myTable->item(row, col) ) aTWI->setText("");
+
+ myTable->setEnabled( false );
+ }
}
//=================================================================================
void SMESHGUI_AddQuadraticElementDlg::onCellDoubleClicked( int theRow, int theCol )
{
- if ( theCol == 1 )
- myIsEditCorners = false;
-
+ myIsEditCorners = false;
displaySimulation();
+ updateButtons();
}
//=================================================================================
void SMESHGUI_AddQuadraticElementDlg::onCellTextChange(int theRow, int theCol)
{
- onTextChange( myTable->item(theRow, theCol)->text() );
+ myIsEditCorners = false;
+ displaySimulation();
+ updateButtons();
}
//=================================================================================
ClickOnHelp();
}
}
+
+void SMESHGUI_AddQuadraticElementDlg::updateButtons()
+{
+ bool valid = IsValid();
+ buttonOk->setEnabled( valid );
+ buttonApply->setEnabled( valid );
+}
void displaySimulation();
void UpdateTable( bool = true );
bool IsValid();
+ void updateButtons();
SMESHGUI* mySMESHGUI; /* Current SMESHGUI object */
LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */
GroupButtonsLayout->setSpacing(SPACING);
GroupButtonsLayout->setMargin(MARGIN);
- buttonOk = new QPushButton(tr("SMESH_BUT_OK"), GroupButtons);
+ buttonOk = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), GroupButtons);
buttonOk->setAutoDefault(true);
buttonOk->setDefault(true);
buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons);
GroupButtonsLayout->setSpacing(SPACING);
GroupButtonsLayout->setMargin(MARGIN);
- buttonOk = new QPushButton(tr("SMESH_BUT_OK"), GroupButtons);
+ buttonOk = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), GroupButtons);
buttonOk->setAutoDefault(true);
buttonOk->setDefault(true);
buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons);
{
// no need to delete child widgets, Qt does it all for us
std::for_each(myPlanes.begin(),myPlanes.end(),TSetVisiblity(false));
- SMESH::RenderViewWindow(SMESH::GetViewWindow(mySMESHGUI));
+
+ if (SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow(mySMESHGUI))
+ SMESH::RenderViewWindow(aViewWindow);
}
double SMESHGUI_ClippingDlg::getDistance() const
#include "SMESHGUI_MeshUtils.h"
#include "SMESHGUI_VTKUtils.h"
#include "SMESHGUI_HypothesesUtils.h"
+#include "SMESHGUI_MeshEditPreview.h"
+#include "SMESH_ActorUtils.h"
#include <SMDS_SetIterator.hxx>
#include <SMDS_Mesh.hxx>
}
}
-enum TCol { COL_ALGO = 0, COL_SHAPE, COL_ERROR, COL_SHAPEID, COL_PUBLISHED, NB_COLUMNS };
+enum TCol {
+ COL_ALGO = 0, COL_SHAPE, COL_ERROR, COL_SHAPEID, COL_PUBLISHED, COL_BAD_MESH, NB_COLUMNS
+};
//using namespace SMESH;
{
char* myBuf;
MemoryReserve(): myBuf( new char[1024*1024*1] ){} // 1M
- ~MemoryReserve() { delete [] myBuf; }
+ void release() { delete [] myBuf; myBuf = 0; }
+ ~MemoryReserve() { release(); }
};
// =========================================================================================
if ( !actor ) {
actor = GEOM_Actor::New();
if ( actor ) {
- actor->setInputShape(shape,0,0);
- //actor->SetProperty(myProperty);
+ actor->SetShape(shape,0,0);
+ actor->SetProperty(myProperty);
actor->SetShadingProperty(myProperty);
actor->SetWireframeProperty(myProperty);
actor->SetPreviewProperty(myProperty);
/*!
* \brief Return a list of selected rows
*/
- bool getSelectedRows(QTableWidget* table, QList<int>& rows)
+ int getSelectedRows(QTableWidget* table, QList<int>& rows)
{
rows.clear();
QList<QTableWidgetSelectionRange> selRanges = table->selectedRanges();
if ( rows.isEmpty() && table->currentRow() > -1 )
rows.append( table->currentRow() );
- return !rows.isEmpty();
+ return rows.count();
}
} // namespace SMESH
*/
//=======================================================================
-SMESHGUI_ComputeDlg::SMESHGUI_ComputeDlg(): SMESHGUI_Dialog( 0, false, true, OK/* | Help*/ )
+SMESHGUI_ComputeDlg::SMESHGUI_ComputeDlg(): SMESHGUI_Dialog( 0, false, true, Close/* | Help*/ )
{
QVBoxLayout* aDlgLay = new QVBoxLayout (mainFrame());
aDlgLay->setMargin( 0 );
myTable = new QTableWidget( 1, NB_COLUMNS, myCompErrorGroup);
myShowBtn = new QPushButton(tr("SHOW_SHAPE"), myCompErrorGroup);
myPublishBtn = new QPushButton(tr("PUBLISH_SHAPE"), myCompErrorGroup);
+ myBadMeshBtn = new QPushButton(tr("SHOW_BAD_MESH"), myCompErrorGroup);
//myTable->setReadOnly( true ); // VSR: check
myTable->setEditTriggers( QAbstractItemView::NoEditTriggers );
myTable->hideColumn( COL_PUBLISHED );
myTable->hideColumn( COL_SHAPEID );
+ myTable->hideColumn( COL_BAD_MESH );
myTable->horizontalHeader()->setResizeMode( COL_ERROR, QHeaderView::Interactive );
QStringList headers;
QGridLayout* grpLayout = new QGridLayout(myCompErrorGroup);
grpLayout->setSpacing(SPACING);
grpLayout->setMargin(MARGIN);
- grpLayout->addWidget( myTable, 0, 0, 3, 1 );
+ grpLayout->addWidget( myTable, 0, 0, 4, 1 );
grpLayout->addWidget( myShowBtn, 0, 1 );
grpLayout->addWidget( myPublishBtn, 1, 1 );
- grpLayout->setRowStretch( 2, 1 );
+ grpLayout->addWidget( myBadMeshBtn, 2, 1 );
+ grpLayout->setRowStretch( 3, 1 );
// Hypothesis definition errors
{
myDlg = new SMESHGUI_ComputeDlg;
myTShapeDisplayer = new SMESH::TShapeDisplayer();
+ myBadMeshDisplayer = 0;
+
//myHelpFileName = "/files/about_meshes.htm"; // V3
myHelpFileName = "about_meshes_page.html"; // V4
// connect signals and slots
connect(myDlg->myShowBtn, SIGNAL (clicked()), SLOT(onPreviewShape()));
connect(myDlg->myPublishBtn, SIGNAL (clicked()), SLOT(onPublishShape()));
+ connect(myDlg->myBadMeshBtn, SIGNAL (clicked()), SLOT(onShowBadMesh()));
connect(table(), SIGNAL(itemSelectionChanged()), SLOT(currentCellChanged()));
connect(table(), SIGNAL(currentCellChanged(int,int,int,int)), SLOT(currentCellChanged()));
}
// check selection
- SMESH::SMESH_Mesh_var aMesh;
+ myMesh = SMESH::SMESH_Mesh::_nil();
myMainShape = GEOM::GEOM_Object::_nil();
LightApp_SelectionMgr *Sel = selectionMgr();
}
Handle(SALOME_InteractiveObject) IObject = selected.First();
- aMesh = SMESH::GetMeshByIO(IObject);
- if (aMesh->_is_nil()) {
+ myMesh = SMESH::GetMeshByIO(IObject);
+ if (myMesh->_is_nil()) {
SUIT_MessageBox::warning(desktop(),
tr("SMESH_WRN_WARNING"),
tr("SMESH_WRN_NO_AVAILABLE_DATA"));
bool computeFailed = true, memoryLack = false;
- _PTR(SObject) aMeshSObj = SMESH::FindSObject(aMesh);
- myMainShape = aMesh->GetShapeToMesh();
- bool hasShape = aMesh->HasShapeToMesh();
+ _PTR(SObject) aMeshSObj = SMESH::FindSObject(myMesh);
+ myMainShape = myMesh->GetShapeToMesh();
+ bool hasShape = myMesh->HasShapeToMesh();
bool shapeOK = myMainShape->_is_nil() ? !hasShape : hasShape;
if ( shapeOK && aMeshSObj )
{
myDlg->myMeshName->setText( aMeshSObj->GetName().c_str() );
SMESH::SMESH_Gen_var gen = getSMESHGUI()->GetSMESHGen();
- SMESH::algo_error_array_var errors = gen->GetAlgoState(aMesh,myMainShape);
+ SMESH::algo_error_array_var errors = gen->GetAlgoState(myMesh,myMainShape);
if ( errors->length() > 0 ) {
aHypErrors = SMESH::GetMessageOnAlgoStateErrors( errors.in() );
}
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
OCC_CATCH_SIGNALS;
#endif
- if (gen->Compute(aMesh, myMainShape))
+ if (gen->Compute(myMesh, myMainShape))
computeFailed = false;
}
catch(const SALOME::SALOME_Exception & S_ex){
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
OCC_CATCH_SIGNALS;
#endif
- aCompErrors = gen->GetComputeErrors( aMesh, myMainShape );
+ aCompErrors = gen->GetComputeErrors( myMesh, myMainShape );
// check if there are memory problems
for ( int i = 0; (i < aCompErrors->length()) && !memoryLack; ++i )
memoryLack = ( aCompErrors[ i ].code == SMESH::COMPERR_MEMORY_PB );
// NPAL16631: if ( !memoryLack )
{
- SMESH::ModifiedMesh(aMeshSObj, !computeFailed, aMesh->NbNodes() == 0);
+ SMESH::ModifiedMesh(aMeshSObj, !computeFailed, myMesh->NbNodes() == 0);
update( UF_ObjBrowser | UF_Model );
// SHOW MESH
}
catch (...) {
#ifdef _DEBUG_
- cout << "Exception thrown during mesh visualization" << endl;
+ MESSAGE ( "Exception thrown during mesh visualization" );
#endif
if ( SMDS_Mesh::CheckMemory(true) ) { // has memory to show warning?
SMESH::OnVisuException();
Sel->setSelectedObjects( selected );
}
}
+
+ if ( memoryLack )
+ aMemoryReserve.release();
+
myDlg->setWindowTitle(tr( computeFailed ? "SMESH_WRN_COMPUTE_FAILED" : "SMESH_COMPUTE_SUCCEED"));
myDlg->myMemoryLackGroup->hide();
}
else if ( noCompError && noHypoError )
{
- myDlg->myFullInfo->SetInfoByMesh( aMesh );
+ myDlg->myFullInfo->SetInfoByMesh( myMesh );
myDlg->myFullInfo->show();
myDlg->myBriefInfo->hide();
myDlg->myHypErrorGroup->hide();
else
{
QTableWidget* tbl = myDlg->myTable;
- myDlg->myBriefInfo->SetInfoByMesh( aMesh );
+ myDlg->myBriefInfo->SetInfoByMesh( myMesh );
myDlg->myBriefInfo->show();
myDlg->myFullInfo->hide();
else tbl->showColumn( COL_SHAPE );
tbl->setColumnWidth( COL_ERROR, 200 );
+ bool hasBadMesh = false;
for ( int row = 0; row < aCompErrors->length(); ++row )
{
SMESH::ComputeError & err = aCompErrors[ row ];
if ( !tbl->item( row, COL_PUBLISHED ) ) tbl->setItem( row, COL_PUBLISHED, new QTableWidgetItem( text ) );
else tbl->item( row, COL_PUBLISHED )->setText( text ); // if text=="", "PUBLISH" button enabled
+ text = err.hasBadMesh ? "hasBadMesh" : "";
+ if ( !tbl->item( row, COL_BAD_MESH ) ) tbl->setItem( row, COL_BAD_MESH, new QTableWidgetItem( text ) );
+ else tbl->item( row, COL_BAD_MESH )->setText( text );
+ if ( err.hasBadMesh ) hasBadMesh = true;
+
//tbl->item( row, COL_ERROR )->setWordWrap( true ); // VSR: TODO ???
tbl->resizeRowToContents( row );
}
tbl->resizeColumnToContents( COL_ALGO );
tbl->resizeColumnToContents( COL_SHAPE );
+ if ( hasBadMesh )
+ myDlg->myBadMeshBtn->show();
+ else
+ myDlg->myBadMeshBtn->hide();
+
tbl->setCurrentCell(0,0);
currentCellChanged(); // to update buttons
}
{
SMESHGUI_Operation::stopOperation();
myTShapeDisplayer->SetVisibility( false );
+ if ( myBadMeshDisplayer ) {
+ myBadMeshDisplayer->SetVisibility( false );
+ // delete it in order not to have problems at its destruction when the viewer
+ // where it worked is dead due to e.g. study closing
+ delete myBadMeshDisplayer;
+ myBadMeshDisplayer = 0;
+ }
}
//================================================================================
currentCellChanged(); // to update buttons
}
+//================================================================================
+/*!
+ * \brief show mesh elements preventing computation of a submesh of current row
+ */
+//================================================================================
+
+void SMESHGUI_ComputeOp::onShowBadMesh()
+{
+ myTShapeDisplayer->SetVisibility( false );
+ QList<int> rows;
+ if ( SMESH::getSelectedRows( table(), rows ) == 1 ) {
+ bool hasBadMesh = ( !table()->item(rows.front(), COL_BAD_MESH)->text().isEmpty() );
+ if ( hasBadMesh ) {
+ int curSub = table()->item(rows.front(), COL_SHAPEID)->text().toInt();
+ SMESHGUI* gui = getSMESHGUI();
+ SMESH::SMESH_Gen_var gen = gui->GetSMESHGen();
+ SVTK_ViewWindow* view = SMESH::GetViewWindow( gui );
+ if ( myBadMeshDisplayer ) delete myBadMeshDisplayer;
+ myBadMeshDisplayer = new SMESHGUI_MeshEditPreview( view );
+ SMESH::MeshPreviewStruct_var aMeshData = gen->GetBadInputElements(myMesh,curSub);
+ vtkFloatingPointType aPointSize = SMESH::GetFloat("SMESH:node_size",3);
+ vtkFloatingPointType aLineWidth = SMESH::GetFloat("SMESH:element_width",1);
+ // delete property !!!!!!!!!!
+ vtkProperty* prop = vtkProperty::New();
+ prop->SetLineWidth( aLineWidth * 3 );
+ prop->SetPointSize( aPointSize * 3 );
+ prop->SetColor( 250, 0, 250 );
+ myBadMeshDisplayer->GetActor()->SetProperty( prop );
+ myBadMeshDisplayer->SetData( aMeshData._retn() );
+ }
+ }
+}
+
//================================================================================
/*!
* \brief SLOT called when a selected cell in table() changed
void SMESHGUI_ComputeOp::currentCellChanged()
{
myTShapeDisplayer->SetVisibility( false );
+ if ( myBadMeshDisplayer )
+ myBadMeshDisplayer->SetVisibility( false );
- bool publishEnable = 0, showEnable = 0, showOnly = 1;
+ bool publishEnable = 0, showEnable = 0, showOnly = 1, hasBadMesh = 0;
QList<int> rows;
- SMESH::getSelectedRows( table(), rows );
+ int nbSelected = SMESH::getSelectedRows( table(), rows );
int row;
foreach ( row, rows )
{
else {
showEnable = true;
}
+
+ if ( !table()->item(row, COL_BAD_MESH)->text().isEmpty() )
+ hasBadMesh = true;
}
myDlg->myPublishBtn->setEnabled( publishEnable );
- myDlg->myShowBtn->setEnabled( showEnable );
+ myDlg->myShowBtn ->setEnabled( showEnable );
+ myDlg->myBadMeshBtn->setEnabled( hasBadMesh && ( nbSelected == 1 ));
}
//================================================================================
SMESHGUI_ComputeOp::~SMESHGUI_ComputeOp()
{
- if ( myTShapeDisplayer ) delete myTShapeDisplayer;
+ delete myTShapeDisplayer;
+ if ( myBadMeshDisplayer )
+ delete myBadMeshDisplayer;
}
//================================================================================
class QTableWidget;
class QLabel;
class SMESHGUI_ComputeDlg;
+class SMESHGUI_MeshEditPreview;
namespace SMESH
{
private slots:
void onPreviewShape();
void onPublishShape();
+ void onShowBadMesh();
void currentCellChanged();
private:
SMESHGUI_ComputeDlg* myDlg;
+ SMESH::SMESH_Mesh_var myMesh;
GEOM::GEOM_Object_var myMainShape;
SMESH::TShapeDisplayer* myTShapeDisplayer;
+ SMESHGUI_MeshEditPreview* myBadMeshDisplayer;
};
/*!
QTableWidget* myTable;
QPushButton* myShowBtn;
QPushButton* myPublishBtn;
+ QPushButton* myBadMeshBtn;
SMESHGUI_MeshInfosBox* myBriefInfo;
SMESHGUI_MeshInfosBox* myFullInfo;
GroupButtonsLayout->setSpacing( SPACING );
GroupButtonsLayout->setMargin( MARGIN );
- buttonOk = new QPushButton( tr( "SMESH_BUT_OK" ), GroupButtons );
+ buttonOk = new QPushButton( tr( "SMESH_BUT_APPLY_AND_CLOSE" ), GroupButtons );
buttonOk->setAutoDefault( true );
buttonOk->setDefault( true );
buttonApply = new QPushButton( tr( "SMESH_BUT_APPLY" ), GroupButtons );
{
QGroupBox* aFrame = new QGroupBox(theParent);
- myOkBtn = new QPushButton(tr("SMESH_BUT_OK" ), aFrame);
- myApplyBtn = new QPushButton(tr("SMESH_BUT_APPLY"), aFrame);
- myCloseBtn = new QPushButton(tr("SMESH_BUT_CLOSE"), aFrame);
- myHelpBtn = new QPushButton(tr("SMESH_BUT_HELP"), aFrame);
+ myOkBtn = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), aFrame);
+ myApplyBtn = new QPushButton(tr("SMESH_BUT_APPLY"), aFrame);
+ myCloseBtn = new QPushButton(tr("SMESH_BUT_CLOSE"), aFrame);
+ myHelpBtn = new QPushButton(tr("SMESH_BUT_HELP"), aFrame);
QHBoxLayout* aLay = new QHBoxLayout(aFrame);
aLay->setMargin(MARGIN);
typeName( pr + MESH ) = tr( "DLG_MESH" );
typeName( pr + HYPOTHESIS ) = tr( "DLG_HYPO" );
typeName( pr + ALGORITHM ) = tr( "DLG_ALGO" );
+ setButtonText(1, tr("SMESH_BUT_APPLY_AND_CLOSE")); //rename OK to Apply and Close
if ( flags & Close )
setButtonPosition( Right, Close );
}
GroupButtonsLayout->setSpacing(SPACING);
GroupButtonsLayout->setMargin(MARGIN);
- buttonOk = new QPushButton(tr("SMESH_BUT_OK"), GroupButtons);
+ buttonOk = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), GroupButtons);
buttonOk->setAutoDefault(true);
buttonOk->setDefault(true);
buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons);
QHBoxLayout* GroupButtonsLayout = new QHBoxLayout(GroupButtons);
GroupButtonsLayout->setSpacing(SPACING); GroupButtonsLayout->setMargin(MARGIN);
- OkButton = new QPushButton(tr("SMESH_BUT_OK"), GroupButtons);
+ OkButton = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), GroupButtons);
OkButton->setAutoDefault(true);
OkButton->setDefault(true);
GroupButtonsLayout->setSpacing(SPACING);
GroupButtonsLayout->setMargin(MARGIN);
- buttonOk = new QPushButton(tr("SMESH_BUT_OK"), GroupButtons);
+ buttonOk = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), GroupButtons);
buttonOk->setAutoDefault(true);
buttonOk->setDefault(true);
buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons);
aLay->setMargin(MARGIN);
aLay->setSpacing(SPACING);
- myButtons[ BTN_OK ] = new QPushButton(tr("SMESH_BUT_OK" ), aGrp);
- myButtons[ BTN_Apply ] = new QPushButton(tr("SMESH_BUT_APPLY"), aGrp);
- myButtons[ BTN_Cancel ] = new QPushButton(tr("SMESH_BUT_CANCEL"), aGrp);
- myButtons[ BTN_Close ] = new QPushButton(tr("SMESH_BUT_CLOSE"), aGrp);
- myButtons[ BTN_Help ] = new QPushButton(tr("SMESH_BUT_HELP"), aGrp);
+ myButtons[ BTN_OK ] = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), aGrp);
+ myButtons[ BTN_Apply ] = new QPushButton(tr("SMESH_BUT_APPLY"), aGrp);
+ myButtons[ BTN_Cancel ] = new QPushButton(tr("SMESH_BUT_CANCEL"), aGrp);
+ myButtons[ BTN_Close ] = new QPushButton(tr("SMESH_BUT_CLOSE"), aGrp);
+ myButtons[ BTN_Help ] = new QPushButton(tr("SMESH_BUT_HELP"), aGrp);
aLay->addWidget(myButtons[ BTN_OK ]);
aLay->addSpacing(10);
// name : SMESHGUI_FilterDlg::SetGroupIds
// Purpose : Set mesh
//=======================================================================
-void SMESHGUI_FilterDlg::SetMesh (SMESH::SMESH_Mesh_ptr theMesh)
+void SMESHGUI_FilterDlg::SetMesh (SMESH::SMESH_Mesh_var theMesh)
{
myMesh = theMesh;
+ if ( myMesh->_is_nil() ) {
+ myButtons[BTN_OK]->setEnabled(false);
+ myButtons[BTN_Apply]->setEnabled(false);
+ }
}
//=======================================================================
int aRow, aCol;
const SALOME_ListIO& aList = mySelector->StoredIObjects();
+ if ( myMesh->_is_nil() && aList.Extent()>0 ) {
+ myMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(aList.First());
+ if ( !(myMesh->_is_nil()) ) {
+ myButtons[BTN_OK]->setEnabled(true);
+ myButtons[BTN_Apply]->setEnabled(true);
+ }
+ }
+
if (aList.Extent() != 1 ||
!myTable->CurrentCell(aRow, aCol) ||
myTable->GetCriterionType(aRow) != SMESH::FT_BelongToGeom &&
}
}
+
//=======================================================================
// name : SMESHGUI_FilterDlg::onCriterionChanged
// Purpose : SLOT called when cretarion of current row changed. Update selection
void Init( const int );
void SetSelection();
- void SetMesh( SMESH::SMESH_Mesh_ptr );
+ void SetMesh (SMESH::SMESH_Mesh_var);
void SetSourceWg( QWidget* );
static SMESH::Filter::Criterion createCriterion();
SMESHGUI* mySMESHGUI;
LightApp_SelectionMgr* mySelectionMgr;
SVTK_Selector* mySelector;
- SMESH::SMESH_Mesh_ptr myMesh;
+ SMESH::SMESH_Mesh_var myMesh;
QWidget* mySourceWg;
SALOME_DataMapOfIOMapOfInteger myIObjects;
aLay->setMargin(MARGIN);
aLay->setSpacing(SPACING);
- myButtons[ BTN_OK ] = new QPushButton(tr("SMESH_BUT_OK" ), aGrp);
+ myButtons[ BTN_OK ] = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), aGrp);
myButtons[ BTN_Apply ] = new QPushButton(tr("SMESH_BUT_APPLY"), aGrp);
myButtons[ BTN_Cancel ] = new QPushButton(tr("SMESH_BUT_CANCEL"), aGrp);
// SALOME KERNEL includes
#include <SALOMEDSClient_Study.hxx>
+// VTK Includes
+#include <vtkRenderer.h>
+#include <vtkActorCollection.h>
+
// OCCT includes
#include <TColStd_MapOfInteger.hxx>
: QDialog( SMESH::GetDesktop( theModule ) ),
mySMESHGUI( theModule ),
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
- mySelector(SMESH::GetViewWindow( theModule )->GetSelector()),
+ mySelector( SMESH::GetViewWindow( theModule )->GetSelector() ),
myIsBusy( false ),
+ myNameChanged( false ),
myActor( 0 )
{
- initDialog(true);
- if (!theMesh->_is_nil())
- init(theMesh);
- else {
- mySelectSubMesh->setEnabled(false);
- mySelectGroup->setEnabled(false);
- myGeomGroupBtn->setEnabled(false);
- myGeomGroupLine->setEnabled(false);
+ initDialog( true );
+ if ( !theMesh->_is_nil() )
+ init( theMesh );
+ else
+ {
+ mySelectSubMesh->setEnabled( false );
+ mySelectGroup->setEnabled( false );
+ myGeomGroupBtn->setEnabled( false );
+ myGeomGroupLine->setEnabled( false );
}
}
: QDialog( SMESH::GetDesktop( theModule ) ),
mySMESHGUI( theModule ),
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
- mySelector(SMESH::GetViewWindow( theModule )->GetSelector()),
- myIsBusy( false )
+ mySelector( SMESH::GetViewWindow( theModule )->GetSelector() ),
+ myIsBusy( false ),
+ myNameChanged( false )
{
- initDialog(false);
- if (!theGroup->_is_nil())
- init(theGroup);
- else {
- mySelectSubMesh->setEnabled(false);
- mySelectGroup->setEnabled(false);
+ initDialog( false );
+ if ( !theGroup->_is_nil() )
+ init( theGroup );
+ else
+ {
+ mySelectSubMesh->setEnabled( false );
+ mySelectGroup->setEnabled( false );
myCurrentLineEdit = myMeshGroupLine;
- setSelectionMode(5);
+ setSelectionMode( 5 );
}
}
// function : SMESHGUI_GroupDlg()
// purpose :
//=================================================================================
-void SMESHGUI_GroupDlg::initDialog(bool create)
+void SMESHGUI_GroupDlg::initDialog( bool create)
{
setModal( false );
setAttribute( Qt::WA_DeleteOnClose, true );
myShapeByMeshOp = 0;
myGeomPopup = 0;
myGeomObjects = new GEOM::ListOfGO();
- myGeomObjects->length(0);
+ myGeomObjects->length( 0 );
- QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
+ QPixmap image0( SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap( "SMESH", tr( "ICON_SELECT" ) ) );
- setWindowTitle(create ? tr("SMESH_CREATE_GROUP_TITLE") : tr("SMESH_EDIT_GROUP_TITLE"));
+ setWindowTitle( create ? tr( "SMESH_CREATE_GROUP_TITLE" ) : tr( "SMESH_EDIT_GROUP_TITLE" ) );
myHelpFileName = create ? "creating_groups_page.html" : "editing_groups_page.html";
- setSizeGripEnabled(true);
+ setSizeGripEnabled( true);
- QGridLayout* aMainLayout = new QGridLayout(this);
+ QGridLayout* aMainLayout = new QGridLayout( this );
aMainLayout->setMargin( MARGIN );
aMainLayout->setSpacing( SPACING );
/***************************************************************/
- QLabel* meshGroupLab = new QLabel(create ? tr("SMESH_MESH") : tr("SMESH_GROUP"), this);
- myMeshGroupBtn = new QPushButton(this);
- myMeshGroupBtn->setIcon(image0);
- myMeshGroupLine = new QLineEdit(this);
- myMeshGroupLine->setReadOnly(true);
+ QLabel* meshGroupLab = new QLabel( create ? tr( "SMESH_MESH" ) : tr( "SMESH_GROUP" ), this );
+ myMeshGroupBtn = new QPushButton( this );
+ myMeshGroupBtn->setIcon( image0 );
+ myMeshGroupLine = new QLineEdit( this );
+ myMeshGroupLine->setReadOnly( true );
/***************************************************************/
- QGroupBox* aTypeBox = new QGroupBox(tr("SMESH_ELEMENTS_TYPE"), this);
- myTypeGroup = new QButtonGroup(this);
+ QGroupBox* aTypeBox = new QGroupBox( tr( "SMESH_ELEMENTS_TYPE" ), this );
+ myTypeGroup = new QButtonGroup( this );
QHBoxLayout* aTypeBoxLayout = new QHBoxLayout( aTypeBox );
aTypeBoxLayout->setMargin( MARGIN );
aTypeBoxLayout->setSpacing( SPACING );
QStringList types;
- types.append(tr("MESH_NODE"));
- types.append(tr("SMESH_EDGE"));
- types.append(tr("SMESH_FACE"));
- types.append(tr("SMESH_VOLUME"));
+ types.append( tr( "MESH_NODE" ) );
+ types.append( tr( "SMESH_EDGE" ) );
+ types.append( tr( "SMESH_FACE" ) );
+ types.append( tr( "SMESH_VOLUME" ) );
QRadioButton* rb;
- for (int i = 0; i < types.count(); i++) {
- rb = new QRadioButton(types[i], aTypeBox);
- myTypeGroup->addButton(rb, i);
+ for ( int i = 0; i < types.count(); i++ )
+ {
+ rb = new QRadioButton( types[i], aTypeBox );
+ myTypeGroup->addButton( rb, i );
aTypeBoxLayout->addWidget( rb );
}
- aTypeBox->setEnabled(create);
+ aTypeBox->setEnabled( create );
myTypeId = -1;
/***************************************************************/
- QLabel* aName = new QLabel(tr("SMESH_NAME"), this);
- aName->setMinimumWidth(50);
- myName = new QLineEdit(this);
+ QLabel* aName = new QLabel( tr( "SMESH_NAME" ), this );
+ aName->setMinimumWidth( 50 );
+ myName = new QLineEdit( this );
/***************************************************************/
- QGroupBox* aGrpTypeBox = new QGroupBox(tr("SMESH_GROUP_TYPE"), this);
- myGrpTypeGroup = new QButtonGroup(this);
+ QGroupBox* aGrpTypeBox = new QGroupBox( tr( "SMESH_GROUP_TYPE" ), this );
+ myGrpTypeGroup = new QButtonGroup( this );
QHBoxLayout* aGrpTypeBoxLayout = new QHBoxLayout( aGrpTypeBox );
aGrpTypeBoxLayout->setMargin( MARGIN );
aGrpTypeBoxLayout->setSpacing( SPACING );
- QRadioButton* rb1 = new QRadioButton( tr("SMESH_GROUP_STANDALONE"), aGrpTypeBox);
- QRadioButton* rb2 = new QRadioButton( tr("SMESH_GROUP_GEOMETRY"), aGrpTypeBox);
- myGrpTypeGroup->addButton(rb1, 0);
- myGrpTypeGroup->addButton(rb2, 1);
- aGrpTypeBoxLayout->addWidget(rb1);
- aGrpTypeBoxLayout->addWidget(rb2);
- aGrpTypeBox->setEnabled(create);
+ QRadioButton* rb1 = new QRadioButton( tr( "SMESH_GROUP_STANDALONE" ), aGrpTypeBox );
+ QRadioButton* rb2 = new QRadioButton( tr( "SMESH_GROUP_GEOMETRY" ), aGrpTypeBox );
+ myGrpTypeGroup->addButton( rb1, 0 );
+ myGrpTypeGroup->addButton( rb2, 1 );
+ aGrpTypeBoxLayout->addWidget( rb1 );
+ aGrpTypeBoxLayout->addWidget( rb2 );
+ aGrpTypeBox->setEnabled( create );
myGrpTypeId = -1;
/***************************************************************/
- myWGStack = new QStackedWidget(this);
+ myWGStack = new QStackedWidget( this );
QWidget* wg1 = new QWidget( myWGStack );
QWidget* wg2 = new QWidget( myWGStack );
/***************************************************************/
- QGroupBox* aContentBox = new QGroupBox(tr("SMESH_CONTENT"), wg1);
- QGridLayout* aContentBoxLayout = new QGridLayout(aContentBox);
- aContentBoxLayout->setMargin(MARGIN);
- aContentBoxLayout->setSpacing(SPACING);
-
- QLabel* aLabel = new QLabel(tr("SMESH_ID_ELEMENTS"), aContentBox);
- myElements = new QListWidget(aContentBox);
- myElements->setSelectionMode(QListWidget::ExtendedSelection);
-
- myFilter = new QPushButton(tr("SMESH_BUT_FILTER"), aContentBox);
- QPushButton* aAddBtn = new QPushButton(tr("SMESH_BUT_ADD"), aContentBox);
- QPushButton* aRemoveBtn = new QPushButton(tr("SMESH_BUT_REMOVE"), aContentBox);
- QPushButton* aSortBtn = new QPushButton(tr("SMESH_BUT_SORT"), aContentBox);
-
- aContentBoxLayout->addWidget(aLabel, 0, 0);
- aContentBoxLayout->addWidget(myElements, 1, 0, 6, 1);
- aContentBoxLayout->addWidget(myFilter, 1, 1);
- aContentBoxLayout->addWidget(aAddBtn, 3, 1);
- aContentBoxLayout->addWidget(aRemoveBtn, 4, 1);
- aContentBoxLayout->addWidget(aSortBtn, 6, 1);
-
- aContentBoxLayout->setColumnStretch(0, 1);
- aContentBoxLayout->setRowStretch(2, 1);
- aContentBoxLayout->setRowStretch(5, 1);
+ QGroupBox* aContentBox = new QGroupBox( tr( "SMESH_CONTENT" ), wg1 );
+ QGridLayout* aContentBoxLayout = new QGridLayout( aContentBox );
+ aContentBoxLayout->setMargin( MARGIN );
+ aContentBoxLayout->setSpacing( SPACING );
+
+ QLabel* aLabel = new QLabel( tr( "SMESH_ID_ELEMENTS" ), aContentBox );
+ myElements = new QListWidget( aContentBox );
+ myElements->setSelectionMode( QListWidget::ExtendedSelection );
+
+ myFilter = new QPushButton( tr( "SMESH_BUT_FILTER" ), aContentBox );
+ QPushButton* aAddBtn = new QPushButton( tr( "SMESH_BUT_ADD" ), aContentBox );
+ QPushButton* aRemoveBtn = new QPushButton( tr( "SMESH_BUT_REMOVE" ), aContentBox );
+ QPushButton* aSortBtn = new QPushButton( tr( "SMESH_BUT_SORT" ), aContentBox );
+
+ aContentBoxLayout->addWidget( aLabel, 0, 0 );
+ aContentBoxLayout->addWidget( myElements, 1, 0, 6, 1 );
+ aContentBoxLayout->addWidget( myFilter, 1, 1 );
+ aContentBoxLayout->addWidget( aAddBtn, 3, 1 );
+ aContentBoxLayout->addWidget( aRemoveBtn, 4, 1 );
+ aContentBoxLayout->addWidget( aSortBtn, 6, 1 );
+
+ aContentBoxLayout->setColumnStretch( 0, 1 );
+ aContentBoxLayout->setRowStretch( 2, 1 );
+ aContentBoxLayout->setRowStretch( 5, 1 );
/***************************************************************/
- QGroupBox* aSelectBox = new QGroupBox(tr("SMESH_SELECT_FROM"), wg1);
- QGridLayout* aSelectBoxLayout = new QGridLayout(aSelectBox);
- aSelectBoxLayout->setMargin(MARGIN);
- aSelectBoxLayout->setSpacing(SPACING);
-
- mySelectSubMesh = new QCheckBox(tr("SMESH_SUBMESH"), aSelectBox);
- mySubMeshBtn = new QPushButton(aSelectBox);
- mySubMeshBtn->setIcon(image0);
- mySubMeshLine = new QLineEdit(aSelectBox);
- mySubMeshLine->setReadOnly(true);
- onSelectSubMesh(false);
-
- mySelectGroup = new QCheckBox(tr("SMESH_GROUP"), aSelectBox);
- myGroupBtn = new QPushButton(aSelectBox);
- myGroupBtn->setIcon(image0);
- myGroupLine = new QLineEdit(aSelectBox);
- myGroupLine->setReadOnly(true);
- onSelectGroup(false);
-
- aSelectBoxLayout->addWidget(mySelectSubMesh, 0, 0);
- aSelectBoxLayout->addWidget(mySubMeshBtn, 0, 1);
- aSelectBoxLayout->addWidget(mySubMeshLine, 0, 2);
- aSelectBoxLayout->addWidget(mySelectGroup, 1, 0);
- aSelectBoxLayout->addWidget(myGroupBtn, 1, 1);
- aSelectBoxLayout->addWidget(myGroupLine, 1, 2);
+ QGroupBox* aSelectBox = new QGroupBox( tr( "SMESH_SELECT_FROM" ), wg1 );
+ QGridLayout* aSelectBoxLayout = new QGridLayout( aSelectBox );
+ aSelectBoxLayout->setMargin( MARGIN );
+ aSelectBoxLayout->setSpacing( SPACING );
+
+ mySelectSubMesh = new QCheckBox( tr( "SMESH_SUBMESH" ), aSelectBox );
+ mySubMeshBtn = new QPushButton( aSelectBox );
+ mySubMeshBtn->setIcon( image0 );
+ mySubMeshLine = new QLineEdit( aSelectBox );
+ mySubMeshLine->setReadOnly( true );
+ onSelectSubMesh( false );
+
+ mySelectGroup = new QCheckBox( tr( "SMESH_GROUP" ), aSelectBox );
+ myGroupBtn = new QPushButton( aSelectBox );
+ myGroupBtn->setIcon( image0 );
+ myGroupLine = new QLineEdit( aSelectBox );
+ myGroupLine->setReadOnly( true );
+ onSelectGroup( false );
+
+ aSelectBoxLayout->addWidget( mySelectSubMesh, 0, 0 );
+ aSelectBoxLayout->addWidget( mySubMeshBtn, 0, 1 );
+ aSelectBoxLayout->addWidget( mySubMeshLine, 0, 2 );
+ aSelectBoxLayout->addWidget( mySelectGroup, 1, 0 );
+ aSelectBoxLayout->addWidget( myGroupBtn, 1, 1 );
+ aSelectBoxLayout->addWidget( myGroupLine, 1, 2 );
/***************************************************************/
- QVBoxLayout* wg1Layout = new QVBoxLayout(wg1);
- wg1Layout->setMargin(0);
- wg1Layout->setSpacing(SPACING);
- wg1Layout->addWidget(aContentBox);
- wg1Layout->addWidget(aSelectBox);
- wg1Layout->setStretchFactor(aContentBox, 10);
+ QVBoxLayout* wg1Layout = new QVBoxLayout( wg1 );
+ wg1Layout->setMargin( 0 );
+ wg1Layout->setSpacing( SPACING );
+ wg1Layout->addWidget( aContentBox );
+ wg1Layout->addWidget( aSelectBox );
+ wg1Layout->setStretchFactor( aContentBox, 10 );
/***************************************************************/
- QLabel* geomObject = new QLabel(tr("SMESH_OBJECT_GEOM"), wg2);
- myGeomGroupBtn = new QToolButton(wg2);
- myGeomGroupBtn->setIcon(image0);
- myGeomGroupBtn->setCheckable(true);
- myGeomGroupLine = new QLineEdit(wg2);
- myGeomGroupLine->setReadOnly(true); //VSR ???
- onSelectGeomGroup(false);
+ QLabel* geomObject = new QLabel( tr( "SMESH_OBJECT_GEOM" ), wg2 );
+ myGeomGroupBtn = new QToolButton( wg2 );
+ myGeomGroupBtn->setIcon( image0 );
+ myGeomGroupBtn->setCheckable( true );
+ myGeomGroupLine = new QLineEdit( wg2 );
+ myGeomGroupLine->setReadOnly( true ); //VSR ???
+ onSelectGeomGroup( false );
- myGeomGroupBtn->setEnabled(create);
- myGeomGroupLine->setEnabled(create);
+ myGeomGroupBtn->setEnabled( create );
+ myGeomGroupLine->setEnabled( create );
/***************************************************************/
QGridLayout* wg2Layout = new QGridLayout( wg2 );
- wg2Layout->setMargin(0);
- wg1Layout->setSpacing(SPACING);
- wg2Layout->addWidget(geomObject, 0, 0);
- wg2Layout->addWidget(myGeomGroupBtn, 0, 1);
- wg2Layout->addWidget(myGeomGroupLine,0, 2);
- wg2Layout->setRowStretch(1, 5);
+ wg2Layout->setMargin( 0 );
+ wg1Layout->setSpacing( SPACING );
+ wg2Layout->addWidget( geomObject, 0, 0 );
+ wg2Layout->addWidget( myGeomGroupBtn, 0, 1 );
+ wg2Layout->addWidget( myGeomGroupLine,0, 2 );
+ wg2Layout->setRowStretch( 1, 5 );
/***************************************************************/
myWGStack->insertWidget( 0, wg1 );
myWGStack->insertWidget( 1, wg2 );
/***************************************************************/
- QGroupBox* aColorBox = new QGroupBox(tr("SMESH_SET_COLOR"), this);
+ QGroupBox* aColorBox = new QGroupBox(tr( "SMESH_SET_COLOR" ), this);
QHBoxLayout* aColorBoxLayout = new QHBoxLayout(aColorBox);
aColorBoxLayout->setMargin(MARGIN);
aColorBoxLayout->setSpacing(SPACING);
- QLabel* aColorLab = new QLabel(tr("SMESH_CHECK_COLOR"), aColorBox );
+ QLabel* aColorLab = new QLabel(tr( "SMESH_CHECK_COLOR" ), aColorBox );
myColorBtn = new QtxColorButton(aColorBox);
myColorBtn->setSizePolicy( QSizePolicy::MinimumExpanding,
myColorBtn->sizePolicy().verticalPolicy() );
aBtnLayout->setMargin(MARGIN);
aBtnLayout->setSpacing(SPACING);
- myOKBtn = new QPushButton(tr("SMESH_BUT_OK"), aButtons);
+ myOKBtn = new QPushButton(tr( "SMESH_BUT_APPLY_AND_CLOSE" ), aButtons);
myOKBtn->setAutoDefault(true);
myOKBtn->setDefault(true);
- myApplyBtn = new QPushButton(tr("SMESH_BUT_APPLY"), aButtons);
+ myApplyBtn = new QPushButton(tr( "SMESH_BUT_APPLY" ), aButtons);
myApplyBtn->setAutoDefault(true);
- myCloseBtn = new QPushButton(tr("SMESH_BUT_CLOSE"), aButtons);
+ myCloseBtn = new QPushButton(tr( "SMESH_BUT_CLOSE" ), aButtons);
myCloseBtn->setAutoDefault(true);
- myHelpBtn = new QPushButton(tr("SMESH_BUT_HELP"), aButtons);
+ myHelpBtn = new QPushButton(tr( "SMESH_BUT_HELP" ), aButtons);
myHelpBtn->setAutoDefault(true);
aBtnLayout->addWidget(myOKBtn);
myTypeGroup->button(0)->setChecked(true);
updateButtons();
- //myName->setText(GetDefaultName(tr("SMESH_GROUP")));
+ //myName->setText(GetDefaultName(tr( "SMESH_GROUP" )));
}
//=================================================================================
_PTR(Study) aStudy = appStudy->studyDS();
std::set<std::string> aSet;
- _PTR(SComponent) aMeshCompo (aStudy->FindComponent("SMESH"));
+ _PTR(SComponent) aMeshCompo (aStudy->FindComponent( "SMESH" ));
if (aMeshCompo) {
_PTR(ChildIterator) it (aStudy->NewChildIterator(aMeshCompo));
_PTR(SObject) obj;
mySelectionMgr->installFilter(myMeshFilter);
/* init data from current selection */
+ restoreShowEntityMode();
myMesh = SMESH::SMESH_Mesh::_duplicate(theMesh);
+ setShowEntityMode();
myGroup = SMESH::SMESH_Group::_nil();
myGroupOnGeom = SMESH::SMESH_GroupOnGeom::_nil();
- myActor = SMESH::FindActorByObject(myMesh);
- SMESH::SetPickable(myActor);
+ // NPAL19389: create a group with a selection in another group
+ // set actor of myMesh, if it is visible, else try
+ // any visible actor of group or submesh of myMesh
+ SetAppropriateActor();
setDefaultGroupColor();
//=================================================================================
void SMESHGUI_GroupDlg::init (SMESH::SMESH_GroupBase_ptr theGroup)
{
+ restoreShowEntityMode();
myMesh = theGroup->GetMesh();
+ setShowEntityMode();
+ myNameChanged = true;
+ myName->blockSignals(true);
myName->setText(theGroup->GetName());
+ myName->blockSignals(false);
myName->home(false);
- myOldName = myName->text();
SALOMEDS::Color aColor = theGroup->GetColor();
setGroupColor( aColor );
myGroup = SMESH::SMESH_Group::_narrow( theGroup );
- if ( !myGroup->_is_nil() )
- {
- myActor = SMESH::FindActorByObject(myMesh);
- if ( !myActor )
- myActor = SMESH::FindActorByObject(myGroup);
- SMESH::SetPickable(myActor);
+ if (!myGroup->_is_nil())
+ {
+ // NPAL19389: create a group with a selection in another group
+ // set actor of myMesh, if it is visible, else set
+ // actor of myGroup, if it is visible, else try
+ // any visible actor of group or submesh of myMesh
+ // commented, because an attempt to set selection on not displayed cells leads to error
+ //SetAppropriateActor();
+ myActor = SMESH::FindActorByObject(myMesh);
+ if ( !myActor )
+ myActor = SMESH::FindActorByObject(myGroup);
+ SMESH::SetPickable(myActor);
- myGrpTypeGroup->button(0)->setChecked(true);
- onGrpTypeChanged(0);
+ myGrpTypeGroup->button(0)->setChecked(true);
+ onGrpTypeChanged(0);
- myCurrentLineEdit = 0;
- myElements->clear();
- setSelectionMode(aType);
- myTypeId = aType;
+ myCurrentLineEdit = 0;
+ myElements->clear();
+ setSelectionMode(aType);
+ myTypeId = aType;
- myIdList.clear();
- if (!myGroup->IsEmpty()) {
- SMESH::long_array_var anElements = myGroup->GetListOfID();
- int k = anElements->length();
- for (int i = 0; i < k; i++) {
- myIdList.append(anElements[i]);
- myElements->addItem(QString::number(anElements[i]));
- }
- myElements->selectAll();
+ setShowEntityMode(); // depends on myTypeId
+
+ myIdList.clear();
+ if (!myGroup->IsEmpty()) {
+ SMESH::long_array_var anElements = myGroup->GetListOfID();
+ int k = anElements->length();
+ for (int i = 0; i < k; i++) {
+ myIdList.append(anElements[i]);
+ myElements->addItem(QString::number(anElements[i]));
}
+ myElements->selectAll();
}
+ }
else
+ {
+ myGroupOnGeom = SMESH::SMESH_GroupOnGeom::_narrow( theGroup );
+
+ if ( !myGroupOnGeom->_is_nil() )
{
- myGroupOnGeom = SMESH::SMESH_GroupOnGeom::_narrow( theGroup );
+ // NPAL19389: create a group with a selection in another group
+ // set actor of myMesh, if it is visible, else set
+ // actor of myGroupOnGeom, if it is visible, else try
+ // any visible actor of group or submesh of myMesh
+ // commented, because an attempt to set selection on not displayed cells leads to error
+ //SetAppropriateActor();
+ myActor = SMESH::FindActorByObject(myMesh);
+ if ( !myActor )
+ myActor = SMESH::FindActorByObject(myGroupOnGeom);
+ SMESH::SetPickable(myActor);
- if ( !myGroupOnGeom->_is_nil() )
- {
- myActor = SMESH::FindActorByObject(myMesh);
- if ( !myActor )
- myActor = SMESH::FindActorByObject(myGroup);
- SMESH::SetPickable(myActor);
-
- myGrpTypeGroup->button(1)->setChecked(true);
- onGrpTypeChanged(1);
-
- QString aShapeName("");
- _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
- GEOM::GEOM_Object_var aGroupShape = myGroupOnGeom->GetShape();
- if (!aGroupShape->_is_nil())
- {
- _PTR(SObject) aGroupShapeSO = aStudy->FindObjectID(aGroupShape->GetStudyEntry());
- aShapeName = aGroupShapeSO->GetName().c_str();
- }
- myGeomGroupLine->setText( aShapeName );
- myName->setText("Group On " + aShapeName);
- }
+ myGrpTypeGroup->button(1)->setChecked(true);
+ onGrpTypeChanged(1);
+
+ QString aShapeName( "" );
+ _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
+ GEOM::GEOM_Object_var aGroupShape = myGroupOnGeom->GetShape();
+ if (!aGroupShape->_is_nil())
+ {
+ _PTR(SObject) aGroupShapeSO = aStudy->FindObjectID(aGroupShape->GetStudyEntry());
+ aShapeName = aGroupShapeSO->GetName().c_str();
+ }
+ myGeomGroupLine->setText( aShapeName );
+ myNameChanged = true;
+ myName->blockSignals(true);
+ myName->setText( "Group On " + aShapeName);
+ myName->blockSignals(false);
}
+ }
}
//=================================================================================
//=================================================================================
void SMESHGUI_GroupDlg::onNameChanged (const QString& text)
{
+ myOldName = myName->text();
updateButtons();
+ myNameChanged = !myName->text().trimmed().isEmpty();
}
//=================================================================================
myElements->clear();
if (myCurrentLineEdit == 0)
setSelectionMode(id);
+ myTypeId = id;
+ setShowEntityMode();
}
- myTypeId = id;
}
//=================================================================================
{
if (myGrpTypeId != id) {
myWGStack->setCurrentIndex( id );
- if (id == 0)
- myName->setText(myOldName);
+ myName->blockSignals(true);
+ myName->setText(myOldName);
+ myName->blockSignals(false);
onSelectGeomGroup(id == 1);
}
myGrpTypeId = id;
SMESH::setFileType ( aMeshGroupSO, "COULEURGROUP" );
/* init for next operation */
- myName->setText("");
+ myName->setText( "" );
myElements->clear();
myGroup = SMESH::SMESH_Group::_nil();
if (op->IsDone()) {
// publish the GEOM group in study
- QString aNewGeomGroupName ("Auto_group_for_");
+ QString aNewGeomGroupName ( "Auto_group_for_" );
aNewGeomGroupName += myName->text();
SALOMEDS::SObject_var aNewGroupSO =
geomGen->AddInStudy(aSMESHGen->GetCurrentStudy(), aGroupVar,
SMESH::setFileType ( aMeshGroupSO,"COULEURGROUP" );
/* init for next operation */
- myName->setText("");
+ myName->setText( "" );
myGroupOnGeom = SMESH::SMESH_GroupOnGeom::_nil();
}
else { // edition
//=================================================================================
void SMESHGUI_GroupDlg::onListSelectionChanged()
{
- // MESSAGE("SMESHGUI_GroupDlg::onListSelectionChanged(); myActor = " << myActor);
+ // MESSAGE( "SMESHGUI_GroupDlg::onListSelectionChanged(); myActor = " << myActor);
if( myIsBusy || !myActor) return;
myIsBusy = true;
int aNbSel = aList.Extent();
myElements->clearSelection();
- if (myCurrentLineEdit) {
- myCurrentLineEdit->setText("");
+ if (myCurrentLineEdit)
+ {
+ myCurrentLineEdit->setText( "" );
QString aString = "";
- if (myCurrentLineEdit == myMeshGroupLine) {
+ if (myCurrentLineEdit == myMeshGroupLine)
+ {
mySelectSubMesh->setEnabled(false);
mySelectGroup->setEnabled(false);
- myGroupLine->setText("");
- mySubMeshLine->setText("");
+ myGroupLine->setText( "" );
+ mySubMeshLine->setText( "" );
myGeomGroupBtn->setEnabled(false);
myGeomGroupLine->setEnabled(false);
- myGeomGroupLine->setText("");
+ myGeomGroupLine->setText( "" );
myGeomObjects = new GEOM::ListOfGO();
myGeomObjects->length(0);
if (myGeomGroupBtn->isChecked())
myGeomGroupBtn->setChecked(false);
if (!myCreate)
- myName->setText("");
+ myName->setText( "" );
myElements->clear();
if (aNbSel != 1 ) {
myGroup = SMESH::SMESH_Group::_nil();
- myGroupOnGeom = SMESH::SMESH_GroupOnGeom::_nil();
+ myGroupOnGeom = SMESH::SMESH_GroupOnGeom::_nil();
+ restoreShowEntityMode();
myMesh = SMESH::SMESH_Mesh::_nil();
- updateGeomPopup();
+ updateGeomPopup();
updateButtons();
myIsBusy = false;
return;
Handle(SALOME_InteractiveObject) IO = aList.First();
if (myCreate) {
- myMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO);
- updateGeomPopup();
+ restoreShowEntityMode();
+ myMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IO);
+ setShowEntityMode();
+ updateGeomPopup();
if (myMesh->_is_nil())
{
updateButtons();
}
myGroup = SMESH::SMESH_Group::_nil();
- myActor = SMESH::FindActorByObject(myMesh);
- SMESH::SetPickable(myActor);
+ // NPAL19389: create a group with a selection in another group
+ // set actor of myMesh, if it is visible, else try
+ // any visible actor of group or submesh of myMesh
+ SetAppropriateActor();
aString = aList.First()->getName();
myMeshGroupLine->setText(aString);
myGeomGroupBtn->setEnabled(true);
myGeomGroupLine->setEnabled(true);
updateButtons();
- } else {
+ }
+ else {
SMESH::SMESH_GroupBase_var aGroup = SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IO);
if (aGroup->_is_nil())
{
return;
if (myGrpTypeId == 0)
+ {
+ if (myTypeId == -1)
+ onTypeChanged(0);
+ else
{
- if (myTypeId == -1)
- onTypeChanged(0);
- else
- {
- myElements->clear();
- setSelectionMode(myTypeId);
- }
+ myElements->clear();
+ setSelectionMode(myTypeId);
}
+ }
myIsBusy = false;
return;
- } else if (myCurrentLineEdit == myGeomGroupLine) {
-
+ }
+ else if (myCurrentLineEdit == myGeomGroupLine)
+ {
myGeomObjects = new GEOM::ListOfGO();
// The mesh SObject
_PTR(SObject) aMeshSO = SMESH::FindSObject(myMesh);
if (aNbSel == 0 || !aMeshSO)
- {
- myGeomObjects->length(0);
- updateButtons();
- myIsBusy = false;
- return;
- }
+ {
+ myGeomObjects->length(0);
+ updateButtons();
+ myIsBusy = false;
+ return;
+ }
myGeomObjects->length(aNbSel);
int i = 0;
SALOME_ListIteratorOfListIO anIt (aList);
- for ( ; anIt.More(); anIt.Next()) {
-
- testResult = Standard_False;
- aGeomGroup = GEOMBase::ConvertIOinGEOMObject(anIt.Value(), testResult);
-
- // Check if the object is a geometry group
- if (!testResult || CORBA::is_nil(aGeomGroup))
- continue;
-
+ for (; anIt.More(); anIt.Next())
+ {
+ testResult = Standard_False;
+ aGeomGroup = GEOMBase::ConvertIOinGEOMObject(anIt.Value(), testResult);
- // Check if group constructed on the same shape as a mesh or on its child
- _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
- GEOM::GEOM_IGroupOperations_var anOp =
- SMESH::GetGEOMGen()->GetIGroupOperations(aStudy->StudyId());
+ // Check if the object is a geometry group
+ if (!testResult || CORBA::is_nil(aGeomGroup))
+ continue;
- // The main shape of the group
- GEOM::GEOM_Object_var aGroupMainShape;
- if (aGeomGroup->GetType() == 37)
- aGroupMainShape = anOp->GetMainShape(aGeomGroup);
- else
- aGroupMainShape = GEOM::GEOM_Object::_duplicate(aGeomGroup);
- _PTR(SObject) aGroupMainShapeSO =
- //aStudy->FindObjectIOR(aStudy->ConvertObjectToIOR(aGroupMainShape));
- aStudy->FindObjectID(aGroupMainShape->GetStudyEntry());
-
- _PTR(SObject) anObj, aRef;
- bool isRefOrSubShape = false;
- if (aMeshSO->FindSubObject(1, anObj) && anObj->ReferencedObject(aRef)) {
- //if (strcmp(aRef->GetID(), aGroupMainShapeSO->GetID()) == 0) {
- if (aRef->GetID() == aGroupMainShapeSO->GetID()) {
- isRefOrSubShape = true;
- } else {
- _PTR(SObject) aFather = aGroupMainShapeSO->GetFather();
- _PTR(SComponent) aComponent = aGroupMainShapeSO->GetFatherComponent();
- //while (!isRefOrSubShape && strcmp(aFather->GetID(), aComponent->GetID()) != 0) {
- while (!isRefOrSubShape && aFather->GetID() != aComponent->GetID()) {
- //if (strcmp(aRef->GetID(), aFather->GetID()) == 0)
- if (aRef->GetID() == aFather->GetID())
- isRefOrSubShape = true;
- else
- aFather = aFather->GetFather();
- }
- }
- }
- if (isRefOrSubShape)
- myGeomObjects[i++] = aGeomGroup;
+ // Check if group constructed on the same shape as a mesh or on its child
+ _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
+ GEOM::GEOM_IGroupOperations_var anOp =
+ SMESH::GetGEOMGen()->GetIGroupOperations(aStudy->StudyId());
+
+ // The main shape of the group
+ GEOM::GEOM_Object_var aGroupMainShape;
+ if (aGeomGroup->GetType() == 37)
+ aGroupMainShape = anOp->GetMainShape(aGeomGroup);
+ else
+ aGroupMainShape = GEOM::GEOM_Object::_duplicate(aGeomGroup);
+ _PTR(SObject) aGroupMainShapeSO =
+ //aStudy->FindObjectIOR(aStudy->ConvertObjectToIOR(aGroupMainShape));
+ aStudy->FindObjectID(aGroupMainShape->GetStudyEntry());
+
+ _PTR(SObject) anObj, aRef;
+ bool isRefOrSubShape = false;
+ if (aMeshSO->FindSubObject(1, anObj) && anObj->ReferencedObject(aRef)) {
+ //if (strcmp(aRef->GetID(), aGroupMainShapeSO->GetID()) == 0) {
+ if (aRef->GetID() == aGroupMainShapeSO->GetID()) {
+ isRefOrSubShape = true;
+ } else {
+ _PTR(SObject) aFather = aGroupMainShapeSO->GetFather();
+ _PTR(SComponent) aComponent = aGroupMainShapeSO->GetFatherComponent();
+ //while (!isRefOrSubShape && strcmp(aFather->GetID(), aComponent->GetID()) != 0) {
+ while (!isRefOrSubShape && aFather->GetID() != aComponent->GetID()) {
+ //if (strcmp(aRef->GetID(), aFather->GetID()) == 0)
+ if (aRef->GetID() == aFather->GetID())
+ isRefOrSubShape = true;
+ else
+ aFather = aFather->GetFather();
+ }
+ }
+ }
+ if (isRefOrSubShape)
+ myGeomObjects[i++] = aGeomGroup;
}
myGeomObjects->length(i);
aNbSel = i;
}
- if(aNbSel >= 1) {
- if(aNbSel > 1) {
- if(myCurrentLineEdit == mySubMeshLine)
- aString = tr("SMESH_SUBMESH_SELECTED").arg(aNbSel);
- else if(myCurrentLineEdit == myGroupLine)
- aString = tr("SMESH_GROUP_SELECTED").arg(aNbSel);
- else if(myCurrentLineEdit == myGeomGroupLine)
- aString = tr("%1 Objects").arg(aNbSel);
- } else {
- aString = aList.First()->getName();
+ if (aNbSel >= 1) {
+ if (aNbSel > 1) {
+ if (myCurrentLineEdit == mySubMeshLine)
+ aString = tr( "SMESH_SUBMESH_SELECTED" ).arg(aNbSel);
+ else if (myCurrentLineEdit == myGroupLine)
+ aString = tr( "SMESH_GROUP_SELECTED" ).arg(aNbSel);
+ else if (myCurrentLineEdit == myGeomGroupLine)
+ aString = tr( "%1 Objects" ).arg(aNbSel);
+ }
+ else {
+ aString = aList.First()->getName();
}
}
myCurrentLineEdit->setText(aString);
- myOldName = myName->text();
- myName->setText(aString);
myCurrentLineEdit->home(false);
+ // 07.06.2008 skl for IPAL19574:
+ // change name of group only if it is empty
+ if( myName->text().trimmed().isEmpty() || !myNameChanged ) {
+ myOldName = myName->text();
+ myName->blockSignals(true);
+ myName->setText(aString);
+ myName->blockSignals(false);
+ }
updateButtons();
+ }
+ else // !myCurrentLineEdit: local selection of nodes or elements
+ {
+ if (aNbSel == 1 && myActor && myActor->hasIO())
+ {
+#ifdef ENABLE_SWITCH_ACTOR_DURING_ELEMENTS_SELECTION
+ // NPAL19389: create a group with a selection in another group
+ // Switch myActor to the newly selected one, if the last
+ // is visible and belongs to group or submesh of myMesh
+ Handle(SALOME_InteractiveObject) curIO = myActor->getIO();
+ Handle(SALOME_InteractiveObject) selIO = aList.First();
+ if (curIO->hasEntry() && selIO->hasEntry()) {
+ const char* selEntry = selIO->getEntry();
+ if (strcmp(curIO->getEntry(), selEntry) != 0) {
+ // different objects: selected and myActor
+ SVTK_ViewWindow* aViewWindow = SMESH::GetCurrentVtkView();
+ if (aViewWindow && aViewWindow->isVisible(selIO)) {
+ // newly selected actor is visible
+
+ // mesh entry
+ _PTR(SObject) aSObject = SMESH::FindSObject(myMesh);
+ if (aSObject) {
+ CORBA::String_var meshEntry = aSObject->GetID().c_str();
+ int len = strlen(meshEntry);
+
+ if (strncmp(selEntry, meshEntry, len) == 0) {
+ // selected object is myMesh or a part of it
+ SMESH_Actor* anActor = SMESH::FindActorByEntry(selEntry);
+ if (anActor) {
+ myActor = anActor;
+ SMESH::SetPickable(myActor);
+ }
+ }
+ }
+ }
+ }
+ }
+ // NPAL19389 END
+#endif // ENABLE_SWITCH_ACTOR_DURING_ELEMENTS_SELECTION
- } else {
- if (aNbSel == 1 && myActor ) {
QString aListStr = "";
int aNbItems = 0;
if (myTypeId == 0) {
if (aNbItems > 0) {
QListWidgetItem* anItem;
QList<QListWidgetItem*> listItemsToSel;
- QStringList anElements = aListStr.split(" ", QString::SkipEmptyParts);
+ QStringList anElements = aListStr.split( " ", QString::SkipEmptyParts);
for (QStringList::iterator it = anElements.begin(); it != anElements.end(); ++it) {
QList<QListWidgetItem*> found = myElements->findItems(*it, Qt::MatchExactly);
foreach(anItem, found)
myActor = SMESH::FindActorByObject(myMesh);
}
+ // somehow, if we display the mesh, while selecting from another actor,
+ // the mesh becomes pickable, and there is no way to select any element
+ if (myActor)
+ SMESH::SetPickable(myActor);
+
myIsBusy = false;
}
setSelectionMode(4);
}
else {
- mySubMeshLine->setText("");
+ mySubMeshLine->setText( "" );
myCurrentLineEdit = 0;
if (myTypeId != -1)
setSelectionMode(myTypeId);
setSelectionMode(5);
}
else {
- myGroupLine->setText("");
+ myGroupLine->setText( "" );
myCurrentLineEdit = 0;
if (myTypeId != -1)
setSelectionMode(myTypeId);
else {
myGeomGroupBtn->setChecked(false);
myGeomObjects->length(0);
- myGeomGroupLine->setText("");
+ myGeomGroupLine->setText( "" );
myCurrentLineEdit = 0;
if (myTypeId != -1)
setSelectionMode(myTypeId);
aNbItems = SMESH::GetNameOfSelectedElements(mySelector, myActor->getIO(), aListStr);
}
if (aNbItems > 0) {
- QStringList anElements = aListStr.split(" ", QString::SkipEmptyParts);
+ QStringList anElements = aListStr.split( " ", QString::SkipEmptyParts);
for (QStringList::iterator it = anElements.begin(); it != anElements.end(); ++it) {
QList<QListWidgetItem*> found = myElements->findItems(*it, Qt::MatchExactly);
if (found.count() == 0) {
SMESH::RemoveFilters(); // PAL6938 -- clean all mesh entity filters
SMESH::SetPointRepresentation(false);
SMESH::SetPickable();
+ restoreShowEntityMode();
}
mySelectionMgr->clearSelected();
{
LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
if (app)
- app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
+ app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString( "" ), myHelpFileName);
else {
QString platform;
#ifdef WIN32
#else
platform = "application";
#endif
- SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
- tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
- arg(app->resourceMgr()->stringValue("ExternalBrowser",
+ SUIT_MessageBox::warning(this, tr( "WRN_WARNING" ),
+ tr( "EXTERNAL_BROWSER_CANNOT_SHOW_PAGE" ).
+ arg(app->resourceMgr()->stringValue( "ExternalBrowser",
platform)).
arg(myHelpFileName));
}
if ( enable ) {
if ( !myGeomPopup ) {
myGeomPopup = new QMenu(this);
- myActions[myGeomPopup->addAction( tr("DIRECT_GEOM_SELECTION") )] = DIRECT_GEOM_INDEX;
- myActions[myGeomPopup->addAction( tr("GEOM_BY_MESH_ELEM_SELECTION") )] = GEOM_BY_MESH_INDEX;
+ myActions[myGeomPopup->addAction( tr( "DIRECT_GEOM_SELECTION" ) )] = DIRECT_GEOM_INDEX;
+ myActions[myGeomPopup->addAction( tr( "GEOM_BY_MESH_ELEM_SELECTION" ) )] = GEOM_BY_MESH_INDEX;
connect( myGeomPopup, SIGNAL( triggered( QAction* ) ), SLOT( onGeomPopup( QAction* ) ) );
}
connect( myGeomGroupBtn, SIGNAL( toggled(bool) ), this, SLOT( onGeomSelectionButton(bool) ));
setGroupQColor( aQColor );
}
+
+//=================================================================================
+// function : SetAppropriateActor()
+// purpose : Find more appropriate of visible actors, set it to myActor, allow picking
+// NPAL19389: create a group with a selection in another group.
+// if mesh actor is not visible - find any first visible group or submesh
+//=================================================================================
+bool SMESHGUI_GroupDlg::SetAppropriateActor()
+{
+ bool isActor = false;
+
+ if (myMesh->_is_nil()) return false;
+
+ SVTK_ViewWindow* aViewWindow = SMESH::GetCurrentVtkView();
+
+ // try mesh actor
+ myActor = SMESH::FindActorByObject(myMesh);
+ if (myActor && myActor->hasIO())
+ {
+ isActor = true;
+ if (aViewWindow && !aViewWindow->isVisible(myActor->getIO()))
+ isActor = false;
+ }
+
+ // try current group actor
+ if (!isActor) {
+ if (!myGroup->_is_nil()) {
+ myActor = SMESH::FindActorByObject(myGroup);
+ if (myActor && myActor->hasIO())
+ {
+ isActor = true;
+ if (aViewWindow && !aViewWindow->isVisible(myActor->getIO()))
+ isActor = false;
+ }
+ }
+ }
+
+ // try current group on geometry actor
+ if (!isActor) {
+ if (!myGroupOnGeom->_is_nil()) {
+ myActor = SMESH::FindActorByObject(myGroupOnGeom);
+ if (myActor && myActor->hasIO())
+ {
+ isActor = true;
+ if (aViewWindow && !aViewWindow->isVisible(myActor->getIO()))
+ isActor = false;
+ }
+ }
+ }
+
+ // try any visible actor of group or submesh of current mesh
+ if (!isActor && aViewWindow) {
+ // mesh entry
+ _PTR(SObject) aSObject = SMESH::FindSObject(myMesh);
+ if (aSObject) {
+ CORBA::String_var meshEntry = aSObject->GetID().c_str();
+ int len = strlen(meshEntry);
+
+ // iterate on all actors in current view window, search for
+ // any visible actor, that belongs to group or submesh of current mesh
+ vtkActorCollection *aCollection = aViewWindow->getRenderer()->GetActors();
+ aCollection->InitTraversal();
+ for (vtkActor *anAct = aCollection->GetNextActor();
+ anAct && !isActor;
+ anAct = aCollection->GetNextActor())
+ {
+ SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct);
+ if (anActor && anActor->hasIO()) {
+ Handle(SALOME_InteractiveObject) anIO = anActor->getIO();
+ if (aViewWindow->isVisible(anIO)) {
+ if (anIO->hasEntry() && strncmp(anIO->getEntry(), meshEntry, len) == 0) {
+ myActor = anActor;
+ isActor = true;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (isActor)
+ SMESH::SetPickable(myActor);
+
+ return isActor;
+}
+
+//=======================================================================
+//function : setShowEntityMode
+//purpose : make shown only entity corresponding to my type
+//=======================================================================
+void SMESHGUI_GroupDlg::setShowEntityMode()
+{
+ if ( !myMesh->_is_nil() ) {
+ if ( SMESH_Actor* actor = SMESH::FindActorByObject(myMesh) ) {
+ if (!myStoredShownEntity)
+ myStoredShownEntity = actor->GetEntityMode();
+ switch ( myTypeId ) {
+ case 0: restoreShowEntityMode(); break;
+ case 1: actor->SetEntityMode( SMESH_Actor::eEdges ); break;
+ case 2: actor->SetEntityMode( SMESH_Actor::eFaces ); break;
+ case 3: actor->SetEntityMode( SMESH_Actor::eVolumes ); break;
+ }
+ }
+ }
+}
+
+//=======================================================================
+//function : restoreShowEntityMode
+//purpose : restore ShowEntity mode of myActor
+//=======================================================================
+void SMESHGUI_GroupDlg::restoreShowEntityMode()
+{
+ if ( myStoredShownEntity && !myMesh->_is_nil() ) {
+ if ( SMESH_Actor* actor = SMESH::FindActorByObject(myMesh) ) {
+ actor->SetEntityMode(myStoredShownEntity);
+ }
+ }
+ myStoredShownEntity = 0;
+}
void setSelectionMode( int );
void updateButtons();
void updateGeomPopup();
+ bool SetAppropriateActor();
+ void setShowEntityMode();
+ void restoreShowEntityMode();
void setGroupColor( const SALOMEDS::Color& );
SALOMEDS::Color getGroupColor() const;
SMESH_Actor* myActor; /* Current mesh actor */
int myGrpTypeId; /* Current group type id : standalone or group on geometry */
int myTypeId; /* Current type id = radio button id */
+ int myStoredShownEntity; /* Store ShowEntity mode of myMesh */
QLineEdit* myCurrentLineEdit; /* Current LineEdit */
SVTK_Selector* mySelector;
QString myHelpFileName;
QMap<QAction*, int> myActions;
+
+ bool myNameChanged; //added by skl for IPAL19574
};
#endif // SMESHGUI_GROUPDLG_H
{
QGroupBox* aFrame = new QGroupBox(theParent);
- myOkBtn = new QPushButton(tr("SMESH_BUT_OK" ), aFrame);
+ myOkBtn = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), aFrame);
myApplyBtn = new QPushButton(tr("SMESH_BUT_APPLY"), aFrame);
myCloseBtn = new QPushButton(tr("SMESH_BUT_CLOSE"), aFrame);
myHelpBtn = new QPushButton(tr("SMESH_BUT_HELP"), aFrame);
// Init list of available hypotheses, if needed
InitAvailableHypotheses();
- bool checkGeometry = !isNeedGeometry;
+ bool checkGeometry = ( !isNeedGeometry && isAlgo );
// fill list of hypotheses/algorithms
THypothesisDataMap& pMap = isAlgo ? myAlgorithmsMap : myHypothesesMap;
THypothesisDataMap::iterator anIter;
QFrame* aFrame = new QFrame(theParent);
aFrame->setFrameStyle(QFrame::Box | QFrame::Sunken);
- myOkBtn = new QPushButton(tr("SMESH_BUT_OK" ), aFrame);
+ myOkBtn = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), aFrame);
myApplyBtn = new QPushButton(tr("SMESH_BUT_APPLY"), aFrame);
myCloseBtn = new QPushButton(tr("SMESH_BUT_CLOSE"), aFrame);
myHelpBtn = new QPushButton(tr("SMESH_BUT_HELP"), aFrame);
QFrame* aFrame = new QFrame(theParent);
aFrame->setFrameStyle(QFrame::Box | QFrame::Sunken);
- myOkBtn = new QPushButton(tr("SMESH_BUT_OK" ), aFrame);
+ myOkBtn = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), aFrame);
myApplyBtn = new QPushButton(tr("SMESH_BUT_APPLY"), aFrame);
myCloseBtn = new QPushButton(tr("SMESH_BUT_CLOSE"), aFrame);
myHelpBtn = new QPushButton(tr("SMESH_BUT_HELP"), aFrame);
{
QGroupBox* aFrame = new QGroupBox(theParent);
- myOkBtn = new QPushButton (tr("SMESH_BUT_OK" ), aFrame);
+ myOkBtn = new QPushButton (tr("SMESH_BUT_APPLY_AND_CLOSE"), aFrame);
myApplyBtn = new QPushButton (tr("SMESH_BUT_APPLY"), aFrame);
myCloseBtn = new QPushButton (tr("SMESH_BUT_CLOSE"), aFrame);
myHelpBtn = new QPushButton (tr("SMESH_BUT_HELP"), aFrame);
QHBoxLayout* GroupButtonsLayout = new QHBoxLayout( GroupButtons );
GroupButtonsLayout->setSpacing( SPACING );
GroupButtonsLayout->setMargin( MARGIN );
- buttonOk = new QPushButton( tr( "SMESH_BUT_OK" ), GroupButtons );
+ buttonOk = new QPushButton( tr( "SMESH_BUT_APPLY_AND_CLOSE" ), GroupButtons );
buttonOk->setAutoDefault( true );
buttonOk->setDefault( true );
buttonApply = new QPushButton( tr( "SMESH_BUT_APPLY" ), GroupButtons );
QHBoxLayout* myButtonGrpLayout = new QHBoxLayout( myButtonGrp );
myButtonGrpLayout->setSpacing( SPACING_SIZE ); myButtonGrpLayout->setMargin( MARGIN_SIZE );
- myOkBtn = new QPushButton( tr( "SMESH_BUT_OK" ), myButtonGrp );
+ myOkBtn = new QPushButton( tr( "SMESH_BUT_APPLY_AND_CLOSE" ), myButtonGrp );
myOkBtn->setAutoDefault( true ); myOkBtn->setDefault( true );
myApplyBtn = new QPushButton( tr( "SMESH_BUT_APPLY" ), myButtonGrp );
myApplyBtn->setAutoDefault( true );
GroupButtonsLayout->setSpacing(SPACING);
GroupButtonsLayout->setMargin(MARGIN);
- buttonOk = new QPushButton(tr("SMESH_BUT_OK"), GroupButtons);
+ buttonOk = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), GroupButtons);
buttonOk->setAutoDefault(true);
buttonOk->setDefault(true);
buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons);
GroupButtonsLayout->setSpacing(SPACING);
GroupButtonsLayout->setMargin(MARGIN);
- buttonOk = new QPushButton(tr("SMESH_BUT_OK"), GroupButtons);
+ buttonOk = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), GroupButtons);
buttonOk->setAutoDefault(true);
buttonOk->setDefault(true);
buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons);
GroupButtonsLayout->setSpacing(SPACING);
GroupButtonsLayout->setMargin(MARGIN);
- buttonOk = new QPushButton(tr("SMESH_BUT_OK"), GroupButtons);
+ buttonOk = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), GroupButtons);
buttonOk->setAutoDefault(true);
buttonOk->setDefault(true);
buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons);
GroupButtonsLayout->setSpacing(SPACING);
GroupButtonsLayout->setMargin(MARGIN);
- buttonOk = new QPushButton(tr("SMESH_BUT_OK"), GroupButtons);
+ buttonOk = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), GroupButtons);
buttonOk->setAutoDefault(true);
buttonOk->setDefault(true);
buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons);
GroupButtonsLayout->setSpacing(SPACING);
GroupButtonsLayout->setMargin(MARGIN);
- buttonOk = new QPushButton(tr("SMESH_BUT_OK"), GroupButtons);
+ buttonOk = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), GroupButtons);
buttonOk->setAutoDefault(true);
buttonOk->setDefault(true);
buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons);
GroupButtonsLayout->setSpacing(SPACING);
GroupButtonsLayout->setMargin(MARGIN);
- buttonOk = new QPushButton(tr("SMESH_BUT_OK"), GroupButtons);
+ buttonOk = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), GroupButtons);
buttonOk->setAutoDefault(true);
buttonOk->setDefault(true);
buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons);
if (aListId.count() == 1)
{
int elemID = (aListId.first()).toInt();
- myGeomObj = SMESHGUI::GetSMESHGen()->GetGeometryByMeshElement
- ( myMesh.in(), elemID, myDlg->myGeomName->text().toLatin1().data());
+ myGeomObj = GEOM::GEOM_Object::_duplicate(
+ SMESHGUI::GetSMESHGen()->GetGeometryByMeshElement
+ ( myMesh.in(), elemID, myDlg->myGeomName->text().toLatin1().constData()) );
}
else
{
#define MARGIN 11
/*!
- * Class : SMESHGUI_DiagValidator
- * Description : validate munual input of edge like "id1-id2"
- */
-class SMESHGUI_DiagValidator: public QValidator
+ \class BusyLocker
+ \brief Simple 'busy state' flag locker.
+ \internal
+*/
+
+class BusyLocker
{
public:
- SMESHGUI_DiagValidator (QWidget* parent):
- QValidator(parent) {}
-
- State validate (QString& text, int& pos) const
- {
- text = text.trimmed();
- text.replace(QRegExp("[^0-9]+"), "-");
- if (text == "-")
- text = "";
- int ind = text.indexOf(QRegExp("-[0-9]+-"));
- if (ind > 0) { // leave only two ids
- ind = text.indexOf('-', ind + 1);
- if (ind > 0)
- text.truncate(ind);
- }
- if (pos > text.length())
- pos = text.length();
- return Acceptable;
- }
+ //! Constructor. Sets passed boolean flag to \c true.
+ BusyLocker( bool& busy ) : myBusy( busy ) { myBusy = true; }
+ //! Destructor. Clear external boolean flag passed as parameter to the constructor to \c false.
+ ~BusyLocker() { myBusy = false; }
+private:
+ bool& myBusy; //! External 'busy state' boolean flag
};
/*!
QPushButton* aBtn = new QPushButton(aMainGrp);
aBtn->setIcon(aPix);
myEdge = new QLineEdit(aMainGrp);
- myEdge->setValidator(new SMESHGUI_DiagValidator(this));
+ myEdge->setValidator(new QRegExpValidator(QRegExp("[\\d]*-[\\d]*"), this));
aLay->addWidget(aLab);
aLay->addWidget(aBtn);
{
QGroupBox* aFrame = new QGroupBox(theParent);
- myOkBtn = new QPushButton(tr("SMESH_BUT_OK" ), aFrame);
+ myOkBtn = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), aFrame);
myApplyBtn = new QPushButton(tr("SMESH_BUT_APPLY"), aFrame);
myCloseBtn = new QPushButton(tr("SMESH_BUT_CLOSE"), aFrame);
myHelpBtn = new QPushButton(tr("SMESH_BUT_HELP"), aFrame);
void SMESHGUI_SingleEditDlg::onTextChange (const QString& theNewText)
{
if (myBusy) return;
+ BusyLocker lock(myBusy);
myOkBtn->setEnabled(false);
myApplyBtn->setEnabled(false);
// hilight entered edge
if(myActor){
if(SMDS_Mesh* aMesh = myActor->GetObject()->GetMesh()){
- myBusy = true; // block onSelectionDone()
Handle(SALOME_InteractiveObject) anIO = myActor->getIO();
SALOME_ListIO aList;
aList.Append(anIO);
TColStd_IndexedMapOfInteger selectedIndices;
TColStd_MapOfInteger newIndices;
mySelector->GetIndex(anIO,selectedIndices);
- myBusy = false;
- QStringList aListId = theNewText.split("-", QString::SkipEmptyParts);
- if (aListId.count() != 2)
+ int id1, id2;
+ if ( !getNodeIds(myEdge->text(), id1, id2) )
return;
- int i;
- bool allOk = true;
- const SMDS_MeshNode* a2Nodes[2];
- for (i = 0; i < aListId.count(); i++) {
- if(const SMDS_MeshNode *aNode = aMesh->FindNode(aListId[ i ].toInt()))
- a2Nodes[ i ] = aNode;
- else
- allOk = false;
- }
-
- // find a triangle and an edge nb
- const SMDS_MeshElement* tria[2];
- allOk &= a2Nodes[0] != a2Nodes[1] && findTriangles(a2Nodes[0],a2Nodes[1],tria[0],tria[1]);
- myBusy = true; // block onSelectionDone()
- if(allOk)
+ const SMDS_MeshNode* aNode1 = aMesh->FindNode( id1 );
+ const SMDS_MeshNode* aNode2 = aMesh->FindNode( id2 );
+
+ if ( !aNode1 || !aNode2 || aNode1 == aNode2 )
+ return;
+
+ // find a triangle and an edge index
+ const SMDS_MeshElement* tria1;
+ const SMDS_MeshElement* tria2;
+
+ if ( findTriangles(aNode1,aNode2,tria1,tria2) )
{
- newIndices.Add(tria[0]->GetID());
+ newIndices.Add(tria1->GetID());
- const SMDS_MeshNode* a3Nodes [3];
+ const SMDS_MeshNode* a3Nodes[3];
SMDS_ElemIteratorPtr it;
- int edgeInd = 2;
- for (i = 0, it = tria[0]->nodesIterator(); it->more(); i++) {
+ int edgeInd = 2, i;
+ for (i = 0, it = tria1->nodesIterator(); it->more(); i++) {
a3Nodes[ i ] = static_cast<const SMDS_MeshNode*>(it->next());
- if (i > 0) {
- allOk = (a3Nodes[ i ] == a2Nodes[ 0 ] && a3Nodes[ i - 1] == a2Nodes[ 1 ]) ||
- (a3Nodes[ i ] == a2Nodes[ 1 ] && a3Nodes[ i - 1] == a2Nodes[ 0 ]);
- if (allOk) {
- edgeInd = i - 1;
- break;
- }
+ if (i > 0 && ( a3Nodes[ i ] == aNode1 && a3Nodes[ i - 1] == aNode2 ||
+ a3Nodes[ i ] == aNode2 && a3Nodes[ i - 1] == aNode1 ) ) {
+ edgeInd = i - 1;
+ break;
}
}
newIndices.Add(-edgeInd-1);
}
mySelector->AddOrRemoveIndex(anIO,newIndices, false);
SMESH::GetViewWindow(mySMESHGUI)->highlight( anIO, true, true );
-
- myBusy = false;
}
}
}
void SMESHGUI_SingleEditDlg::onSelectionDone()
{
if (myBusy) return;
+ BusyLocker lock(myBusy);
int anId1 = 0, anId2 = 0;
findTriangles( aMesh->FindNode( anId1 ), aMesh->FindNode( anId2 ), tria[0],tria[1] ) )
{
QString aText = QString("%1-%2").arg(anId1).arg(anId2);
- myBusy = true;
myEdge->setText(aText);
- myBusy = false;
myOkBtn->setEnabled(true);
myApplyBtn->setEnabled(true);
GroupButtonsLayout->setSpacing(SPACING);
GroupButtonsLayout->setMargin(MARGIN);
- buttonOk = new QPushButton(tr("SMESH_BUT_OK"), GroupButtons);
+ buttonOk = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), GroupButtons);
buttonOk->setAutoDefault(true);
buttonOk->setDefault(true);
buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons);
if (mySMESHGUI->isActiveStudyLocked())
return;
- if (myNbOkElements &&
- (myNbOkNodes || LineEditNodes->text().trimmed().isEmpty())) {
+ if (myNbOkElements && (myNbOkNodes || LineEditNodes->text().trimmed().isEmpty())) {
QStringList aListElementsId = myElementsId.split(" ", QString::SkipEmptyParts);
QStringList aListNodesId = LineEditNodes->text().split(" ", QString::SkipEmptyParts);
for (int i = 0; i < aListElementsId.count(); i++)
anElementsId[i] = aListElementsId[i].toInt();
- if (myNbOkNodes) {
+ if ( myNbOkNodes && aListNodesId.count() > 0 ) {
aNodesId->length(aListNodesId.count());
for (int i = 0; i < aListNodesId.count(); i++)
aNodesId[i] = aListNodesId[i].toInt();
if (myBusy) return;
// clear
- myActor = 0;
QString aString = "";
myBusy = true;
myNbOkElements = 0;
buttonOk->setEnabled(false);
buttonApply->setEnabled(false);
+ myActor = 0;
}
myBusy = false;
else if (myEditCurrentArgument == LineEditNodes)
myNbOkNodes = true;
- if (myNbOkElements) {
+ if (myNbOkElements && (myNbOkNodes || LineEditNodes->text().trimmed().isEmpty())) {
buttonOk->setEnabled(true);
buttonApply->setEnabled(true);
}
myEditCurrentArgument = LineEditElements;
SMESH::SetPointRepresentation(false);
if (CheckBoxMesh->isChecked()) {
- mySelectionMgr->setSelectionModes(ActorSelection);
- mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter);
+ // mySelectionMgr->setSelectionModes(ActorSelection);
+ if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
+ aViewWindow->SetSelectionMode(ActorSelection);
+ mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter);
} else {
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->SetSelectionMode(CellSelection);
+ aViewWindow->SetSelectionMode(FaceSelection);
}
- } else if (send == SelectNodesButton) {
+ } else if (send == SelectNodesButton) {
+ LineEditNodes->clear();
myEditCurrentArgument = LineEditNodes;
SMESH::SetPointRepresentation(true);
- if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
+ if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) {
aViewWindow->SetSelectionMode(NodeSelection);
+ }
}
myEditCurrentArgument->setFocus();
mySMESHGUI->SetActiveDialogBox(this);
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->SetSelectionMode(CellSelection);
+ aViewWindow->SetSelectionMode(FaceSelection);
SelectionIntoArgument();
}
SMESH::SetPointRepresentation(false);
if (toSelectMesh) {
- mySelectionMgr->setSelectionModes(ActorSelection);
+ if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
+ aViewWindow->SetSelectionMode(ActorSelection);
+ // mySelectionMgr->setSelectionModes(ActorSelection);
mySelectionMgr->installFilter(myMeshOrSubMeshOrGroupFilter);
LineEditElements->setReadOnly(true);
LineEditElements->setValidator(0);
} else {
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->SetSelectionMode(CellSelection);
+ aViewWindow->SetSelectionMode(FaceSelection);
LineEditElements->setReadOnly(false);
LineEditElements->setValidator(myIdValidator);
onTextChange(LineEditElements->text());
GroupButtonsLayout->setSpacing(SPACING);
GroupButtonsLayout->setMargin(MARGIN);
- buttonOk = new QPushButton(tr("SMESH_BUT_OK"), GroupButtons);
+ buttonOk = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), GroupButtons);
buttonOk->setAutoDefault(true);
buttonOk->setDefault(true);
buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons);
GroupButtonsLayout->setSpacing(SPACING);
GroupButtonsLayout->setMargin(MARGIN);
- buttonOk = new QPushButton(tr("SMESH_BUT_OK"), GroupButtons);
+ buttonOk = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), GroupButtons);
buttonOk->setAutoDefault(true);
buttonOk->setDefault(true);
buttonApply = new QPushButton(tr("SMESH_BUT_APPLY"), GroupButtons);
QObject::tr("SMESH_VISU_PROBLEM"));
} catch (...) {
// no more memory at all: last resort
- cout<< "SMESHGUI_VTKUtils::OnVisuException(), exception even at showing a message!!!" <<endl;
- cout<< "Try to remove all visual data..." <<endl;
+ MESSAGE_BEGIN ( "SMESHGUI_VTKUtils::OnVisuException(), exception even at showing a message!!!" <<
+ std::endl << "Try to remove all visual data..." );
if (theVISU_MemoryReserve) {
delete theVISU_MemoryReserve;
theVISU_MemoryReserve = 0;
RemoveAllObjectsWithActors();
SUIT_MessageBox::warning(SMESHGUI::desktop(), QObject::tr("SMESH_WRN_WARNING"),
QObject::tr("SMESH_VISU_PROBLEM_CLEAR"));
- cout<< "...done" << endl;
+ MESSAGE_END ( "...done" );
}
}
//================================================================================
}
catch (...) {
#ifdef _DEBUG_
- cout << "Exception in SMESHGUI_VTKUtils::GetVisualObj()" << endl;
+ MESSAGE ( "Exception in SMESHGUI_VTKUtils::GetVisualObj()" );
#endif
RemoveVisualObjectWithActors( theEntry ); // remove this object
OnVisuException();
int usedMB = aVisualObj->GetUnstructuredGrid()->GetActualMemorySize() / 1024;
if ( freeMB > 0 && usedMB * 30 > freeMB ) {
#ifdef _DEBUG_
- cout << "SMESHGUI_VTKUtils::GetVisualObj(), freeMB=" << freeMB
- << ", usedMB=" << usedMB<< endl;
+ MESSAGE ( "SMESHGUI_VTKUtils::GetVisualObj(), freeMB=" << freeMB
+ << ", usedMB=" << usedMB );
#endif
bool continu = false;
if ( usedMB * 10 > freeMB )
}
catch (...) {
#ifdef _DEBUG_
- cout << "Exception in SMESHGUI_VTKUtils::RepaintCurrentView()" << endl;
+ MESSAGE ( "Exception in SMESHGUI_VTKUtils::RepaintCurrentView()" );
#endif
OnVisuException();
}
}
catch (...) {
#ifdef _DEBUG_
- cout << "Exception in SMESHGUI_VTKUtils::RepaintViewWindow(SVTK_ViewWindow)" << endl;
+ MESSAGE ( "Exception in SMESHGUI_VTKUtils::RepaintViewWindow(SVTK_ViewWindow*)" );
#endif
OnVisuException();
}
}
catch (...) {
#ifdef _DEBUG_
- cout << "Exception in SMESHGUI_VTKUtils::RenderViewWindow(SVTK_ViewWindow)" << endl;
+ MESSAGE ( "Exception in SMESHGUI_VTKUtils::RenderViewWindow(SVTK_ViewWindow*)" );
#endif
OnVisuException();
}
}
catch (...) {
#ifdef _DEBUG_
- cout << "Exception in SMESHGUI_VTKUtils::FitAll()" << endl;
+ MESSAGE ( "Exception in SMESHGUI_VTKUtils::FitAll()" );
#endif
OnVisuException();
}
}
catch (...) {
#ifdef _DEBUG_
- cout << "Exception in SMESHGUI_VTKUtils::DisplayActor()" << endl;
+ MESSAGE ( "Exception in SMESHGUI_VTKUtils::DisplayActor()" );
#endif
OnVisuException();
}
+++ /dev/null
-# Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
-# This is a Qt message file in .po format. Each msgid starts with
-# a scope. This scope should *NOT* be translated - eg. "Foo::Bar"
-# would be translated to "Pub", not "Foo::Pub".
-msgid ""
-msgstr ""
-"Project-Id-Version: PROJECT VERSION\n"
-"POT-Creation-Date: 2002-05-28 10:57:43 AM CEST\n"
-"PO-Revision-Date: YYYY-MM-DD\n"
-"Last-Translator: FULLNAME <EMAIL@ADDRESS>\n"
-"Content-Type: text/plain; charset=iso-8859-1\n"
-
-
-#-----------------------------------------------------------
-# Divers Mesh
-#-----------------------------------------------------------
-
-#ObjectBrowser Icon
-msgid "ICON_OBJBROWSER_SMESH"
-msgstr "mesh.png"
-
-#Select Icon
-msgid "ICON_SELECT"
-msgstr "select1.png"
-
-#Mesh Init
-msgid "ICON_DLG_INIT_MESH"
-msgstr "mesh_init.png"
-
-#
-msgid "ICON_DLG_ADD_SUBMESH"
-msgstr "mesh_add_sub.png"
-
-#Move Node
-msgid "ICON_DLG_MOVE_NODE"
-msgstr "mesh_move_node.png"
-
-#Remove Node
-msgid "ICON_DLG_REM_NODE"
-msgstr "mesh_rem_node.png"
-
-#Remove Element
-msgid "ICON_DLG_REM_ELEMENT"
-msgstr "mesh_rem_element.png"
-
-#Orientation
-msgid "ICON_DLG_MESH_ORIENTATION"
-msgstr "mesh_orientation.png"
-
-#
-msgid "ICON_DLG_MESH_DIAGONAL"
-msgstr "mesh_diagonal.png"
-
-#Connectivity
-msgid "ICON_DLG_CONNECTIVITY"
-msgstr "mesh_connectivity.png"
-
-#Smoothing
-msgid "ICON_DLG_SMOOTHING"
-msgstr "mesh_smoothing.png"
-
-#Renumbering nodes
-msgid "ICON_DLG_RENUMBERING_NODES"
-msgstr "mesh_renumbering_nodes.png"
-
-#Renumbering elements
-msgid "ICON_DLG_RENUMBERING_ELEMENTS"
-msgstr "mesh_renumbering_elements.png"
-
-#Rotation
-msgid "ICON_DLG_MESH_ROTATION"
-msgstr "mesh_rotation.png"
-
-#Translation by vector
-msgid "ICON_SMESH_TRANSLATION_VECTOR"
-msgstr "mesh_translation_vector.png"
-
-#Translation by two points
-msgid "ICON_SMESH_TRANSLATION_POINTS"
-msgstr "mesh_translation_points.png"
-
-#Symmetry by point
-msgid "ICON_SMESH_SYMMETRY_POINT"
-msgstr "mesh_symmetry_point.png"
-
-#Symmetry by axis
-msgid "ICON_SMESH_SYMMETRY_AXIS"
-msgstr "mesh_symmetry_axis.png"
-
-#Symmetry by plane
-msgid "ICON_SMESH_SYMMETRY_PLANE"
-msgstr "mesh_symmetry_plane.png"
-
-#Sew free borders
-msgid "ICON_SMESH_SEWING_FREEBORDERS"
-msgstr "mesh_sew_freeborders.png"
-
-#Sew conform free borders
-msgid "ICON_SMESH_SEWING_CONFORM_FREEBORDERS"
-msgstr "mesh_sew_conform_freeborders.png"
-
-#Sew border to side
-msgid "ICON_SMESH_SEWING_BORDERTOSIDE"
-msgstr "mesh_sew_bordertoside.png"
-
-#Sew side elements
-msgid "ICON_SMESH_SEWING_SIDEELEMENTS"
-msgstr "mesh_sew_sideelements.png"
-
-#Merge nodes
-msgid "ICON_SMESH_MERGE_NODES"
-msgstr "mesh_merge_nodes.png"
-
-#-----------------------------------------------------------
-# Hypothesis
-#-----------------------------------------------------------
-
-#Set Algo
-msgid "ICON_DLG_ADD_ALGORITHM"
-msgstr "mesh_set_algo.png"
-
-#Set Hypo
-msgid "ICON_DLG_ADD_HYPOTHESIS"
-msgstr "mesh_set_hypo.png"
-
-#Edit Hypo.
-msgid "ICON_DLG_EDIT_MESH"
-msgstr "mesh_edit.png"
-
-
-#-----------------------------------------------------------
-# Elements
-#-----------------------------------------------------------
-
-#Vertex
-msgid "ICON_DLG_NODE"
-msgstr "mesh_vertex.png"
-
-#Line
-msgid "ICON_DLG_EDGE"
-msgstr "mesh_line.png"
-
-#triangle
-msgid "ICON_DLG_TRIANGLE"
-msgstr "mesh_triangle.png"
-
-#Quadrangle
-msgid "ICON_DLG_QUADRANGLE"
-msgstr "mesh_quad.png"
-
-#triangle
-msgid "ICON_DLG_TETRAS"
-msgstr "mesh_tetra.png"
-
-#Quadrangle
-msgid "ICON_DLG_HEXAS"
-msgstr "mesh_hexa.png"
-
-#Quadratic Edge
-msgid "ICON_DLG_QUADRATIC_EDGE"
-msgstr "mesh_quad_edge.png"
-
-#Quadratic Triangle
-msgid "ICON_DLG_QUADRATIC_TRIANGLE"
-msgstr "mesh_quad_triangle.png"
-
-#Quadratic Quadrangle
-msgid "ICON_DLG_QUADRATIC_QUADRANGLE"
-msgstr "mesh_quad_quadrangle.png"
-
-#Quadratic Tetrahedron
-msgid "ICON_DLG_QUADRATIC_TETRAHEDRON"
-msgstr "mesh_quad_tetrahedron.png"
-
-#Quadratic Pyramid
-msgid "ICON_DLG_QUADRATIC_PYRAMID"
-msgstr "mesh_quad_pyramid.png"
-
-#Quadratic Pentahedron
-msgid "ICON_DLG_QUADRATIC_PENTAHEDRON"
-msgstr "mesh_quad_pentahedron.png"
-
-#Quadratic Hexahedron
-msgid "ICON_DLG_QUADRATIC_HEXAHEDRON"
-msgstr "mesh_quad_hexahedron.png"
-#-----------------------------------------------------------
-# ObjectBrowser
-#-----------------------------------------------------------
-
-#mesh_tree_mesh
-msgid "ICON_SMESH_TREE_MESH"
-msgstr "mesh_tree_mesh.png"
-
-#mesh_tree_group
-msgid "ICON_SMESH_TREE_GROUP"
-msgstr "mesh_tree_group.png"
-
-#mesh_tree_algo
-msgid "ICON_SMESH_TREE_ALGO"
-msgstr "mesh_tree_algo.png"
-
-#mesh_tree_hypo
-msgid "ICON_SMESH_TREE_HYPO"
-msgstr "mesh_tree_hypo.png"
-
-#mesh_tree_mesh_warn
-msgid "ICON_SMESH_TREE_MESH_WARN"
-msgstr "mesh_tree_mesh_warn.png"
-
-#mesh_tree_mesh
-msgid "ICON_SMESH_TREE_MESH_IMPORTED"
-msgstr "mesh_tree_importedmesh.png"
-
-
-#-----------------------------------------------------------
-# Group
-#-----------------------------------------------------------
-
-msgid "ICON_EDIT_GROUP"
-msgstr "mesh_edit_group.png"
-
-msgid "ICON_CONSTRUCT_GROUP"
-msgstr "mesh_make_group.png"
-
-#-----------------------------------------------------------
-# Mesh pattern
-#-----------------------------------------------------------
-
-msgid "ICON_PATTERN_2d"
-msgstr "mesh_algo_mefisto.png"
-
-msgid "ICON_PATTERN_3d"
-msgstr "mesh_algo_hexa.png"
-
-msgid "ICON_PATTERN_SAMPLE_2D"
-msgstr "pattern_sample_2d.png"
-
-msgid "ICON_PATTERN_SAMPLE_3D"
-msgstr "pattern_sample_3D.png"
-
-#-----------------------------------------------------------
-# Add/Remove buttons
-#-----------------------------------------------------------
-
-msgid "ICON_APPEND"
-msgstr "mesh_add.png"
-
-msgid "ICON_REMOVE"
-msgstr "mesh_remove.png"
\ No newline at end of file
+++ /dev/null
-<!DOCTYPE TS>
-<TS version="1.1" >
- <context>
- <name>@default</name>
- <message>
- <source>ICON_APPEND</source>
- <translation>mesh_add.png</translation>
- </message>
- <message>
- <source>ICON_CREATE_GROUP</source>
- <translation>mesh_group.png</translation>
- </message>
- <message>
- <source>ICON_CONSTRUCT_GROUP</source>
- <translation>mesh_make_group.png</translation>
- </message>
- <message>
- <source>ICON_DLG_ADD_SUBMESH</source>
- <translation>mesh_add_sub.png</translation>
- </message>
- <message>
- <source>ICON_DLG_EDGE</source>
- <translation>mesh_line.png</translation>
- </message>
- <message>
- <source>ICON_DLG_EDIT_MESH</source>
- <translation>mesh_edit.png</translation>
- </message>
- <message>
- <source>ICON_DLG_HEXAS</source>
- <translation>mesh_hexa.png</translation>
- </message>
- <message>
- <source>ICON_DLG_INIT_MESH</source>
- <translation>mesh_init.png</translation>
- </message>
- <message>
- <source>ICON_DLG_MESH_DIAGONAL</source>
- <translation>mesh_diagonal.png</translation>
- </message>
- <message>
- <source>ICON_DLG_MESH_ORIENTATION</source>
- <translation>mesh_orientation.png</translation>
- </message>
- <message>
- <source>ICON_DLG_MESH_ROTATION</source>
- <translation>mesh_rotation.png</translation>
- </message>
- <message>
- <source>ICON_DLG_MOVE_NODE</source>
- <translation>mesh_move_node.png</translation>
- </message>
- <message>
- <source>ICON_DLG_NODE</source>
- <translation>mesh_vertex.png</translation>
- </message>
- <message>
- <source>ICON_DLG_QUADRANGLE</source>
- <translation>mesh_quad.png</translation>
- </message>
- <message>
- <source>ICON_DLG_QUADRATIC_EDGE</source>
- <translation>mesh_quad_edge.png</translation>
- </message>
- <message>
- <source>ICON_DLG_QUADRATIC_HEXAHEDRON</source>
- <translation>mesh_quad_hexahedron.png</translation>
- </message>
- <message>
- <source>ICON_DLG_QUADRATIC_PENTAHEDRON</source>
- <translation>mesh_quad_pentahedron.png</translation>
- </message>
- <message>
- <source>ICON_DLG_QUADRATIC_PYRAMID</source>
- <translation>mesh_quad_pyramid.png</translation>
- </message>
- <message>
- <source>ICON_DLG_QUADRATIC_QUADRANGLE</source>
- <translation>mesh_quad_quadrangle.png</translation>
- </message>
- <message>
- <source>ICON_DLG_QUADRATIC_TETRAHEDRON</source>
- <translation>mesh_quad_tetrahedron.png</translation>
- </message>
- <message>
- <source>ICON_DLG_QUADRATIC_TRIANGLE</source>
- <translation>mesh_quad_triangle.png</translation>
- </message>
- <message>
- <source>ICON_DLG_REM_ELEMENT</source>
- <translation>mesh_rem_element.png</translation>
- </message>
- <message>
- <source>ICON_DLG_REM_NODE</source>
- <translation>mesh_rem_node.png</translation>
- </message>
- <message>
- <source>ICON_DLG_RENUMBERING_ELEMENTS</source>
- <translation>mesh_renumbering_elements.png</translation>
- </message>
- <message>
- <source>ICON_DLG_RENUMBERING_NODES</source>
- <translation>mesh_renumbering_nodes.png</translation>
- </message>
- <message>
- <source>ICON_DLG_SMOOTHING</source>
- <translation>mesh_smoothing.png</translation>
- </message>
- <message>
- <source>ICON_DLG_TETRAS</source>
- <translation>mesh_tetra.png</translation>
- </message>
- <message>
- <source>ICON_DLG_TRIANGLE</source>
- <translation>mesh_triangle.png</translation>
- </message>
- <message>
- <source>ICON_EDIT_GROUP</source>
- <translation>mesh_edit_group.png</translation>
- </message>
- <message>
- <source>ICON_OBJBROWSER_SMESH</source>
- <translation>mesh.png</translation>
- </message>
- <message>
- <source>ICON_PATTERN_2d</source>
- <translation>mesh_algo_mefisto.png</translation>
- </message>
- <message>
- <source>ICON_PATTERN_3d</source>
- <translation>mesh_algo_hexa.png</translation>
- </message>
- <message>
- <source>ICON_PATTERN_SAMPLE_2D</source>
- <translation>pattern_sample_2d.png</translation>
- </message>
- <message>
- <source>ICON_PATTERN_SAMPLE_3D</source>
- <translation>pattern_sample_3D.png</translation>
- </message>
- <message>
- <source>ICON_REMOVE</source>
- <translation>mesh_remove.png</translation>
- </message>
- <message>
- <source>ICON_SELECT</source>
- <translation>select1.png</translation>
- </message>
- <message>
- <source>ICON_SMESH_MERGE_NODES</source>
- <translation>mesh_merge_nodes.png</translation>
- </message>
- <message>
- <source>ICON_SMESH_SEWING_BORDERTOSIDE</source>
- <translation>mesh_sew_bordertoside.png</translation>
- </message>
- <message>
- <source>ICON_SMESH_SEWING_CONFORM_FREEBORDERS</source>
- <translation>mesh_sew_conform_freeborders.png</translation>
- </message>
- <message>
- <source>ICON_SMESH_SEWING_FREEBORDERS</source>
- <translation>mesh_sew_freeborders.png</translation>
- </message>
- <message>
- <source>ICON_SMESH_SEWING_SIDEELEMENTS</source>
- <translation>mesh_sew_sideelements.png</translation>
- </message>
- <message>
- <source>ICON_SMESH_SYMMETRY_AXIS</source>
- <translation>mesh_symmetry_axis.png</translation>
- </message>
- <message>
- <source>ICON_SMESH_SYMMETRY_PLANE</source>
- <translation>mesh_symmetry_plane.png</translation>
- </message>
- <message>
- <source>ICON_SMESH_SYMMETRY_POINT</source>
- <translation>mesh_symmetry_point.png</translation>
- </message>
- <message>
- <source>ICON_SMESH_TRANSLATION_POINTS</source>
- <translation>mesh_translation_points.png</translation>
- </message>
- <message>
- <source>ICON_SMESH_TRANSLATION_VECTOR</source>
- <translation>mesh_translation_vector.png</translation>
- </message>
- <message>
- <source>ICON_SMESH_TREE_ALGO</source>
- <translation>mesh_tree_algo.png</translation>
- </message>
- <message>
- <source>ICON_SMESH_TREE_GROUP</source>
- <translation>mesh_tree_group.png</translation>
- </message>
- <message>
- <source>ICON_SMESH_TREE_HYPO</source>
- <translation>mesh_tree_hypo.png</translation>
- </message>
- <message>
- <source>ICON_SMESH_TREE_MESH</source>
- <translation>mesh_tree_mesh.png</translation>
- </message>
- <message>
- <source>ICON_SMESH_TREE_MESH_IMPORTED</source>
- <translation>mesh_tree_importedmesh.png</translation>
- </message>
- <message>
- <source>ICON_SMESH_TREE_MESH_WARN</source>
- <translation>mesh_tree_mesh_warn.png</translation>
- </message>
- </context>
-</TS>
<source>ICON_WIRE</source>
<translation>mesh_wireframe.png</translation>
</message>
+ <message>
+ <source>ICON_CLEAR_MESH</source>
+ <translation>mesh_clear.png</translation>
+ </message>
</context>
</TS>
<source>SMESH_BUT_OK</source>
<translation>&Ok</translation>
</message>
+ <message>
+ <source>SMESH_BUT_APPLY_AND_CLOSE</source>
+ <translation>A&pply and Close</translation>
+ </message>
<message>
<source>SMESH_BUT_REMOVE</source>
<translation>&Remove</translation>
</message>
<message>
<source>SMESH_DRS_2</source>
- <translation>MED file has overlapped ranges of element numbers,
- the numbers from the file are ignored</translation>
+ <translation>MED file has overlapped ranges of element numbers, the numbers from the file are ignored</translation>
</message>
<message>
<source>SMESH_DRS_3</source>
</message>
<message>
<source>SMESH_DRS_4</source>
- <translation> The file is incorrect,
-some information will be missed</translation>
+ <translation>The file is incorrect, some data is missed</translation>
</message>
<message>
<source>SMESH_DRS_EMPTY</source>
- <translation> The file is empty,
-there is nothing to be published</translation>
+ <translation>The file is empty, there is nothing to be published</translation>
</message>
<message>
<source>SMESH_DX</source>
<source>SMESH_HYP_12</source>
<translation>Geomerty mismatches algorithm's expectation</translation>
</message>
+ <message>
+ <source>SMESH_HYP_13</source>
+ <translation>Algorithm can't work without shape</translation>
+ </message>
<message>
<source>SMESH_HYP_2</source>
<translation>There are concurrent hypotheses on a shape</translation>
<source>MEN_FILE_INFO</source>
<translation>MED file information</translation>
</message>
+ <message>
+ <source>SMESH_WRN_NO_APPROPRIATE_SELECTION</source>
+ <translation>No appropriate objects selected</translation>
+ </message>
+ <message>
+ <source>MEN_CLEAR_MESH</source>
+ <translation>Clear Mesh Data</translation>
+ </message>
+ <message>
+ <source>TOP_CLEAR_MESH</source>
+ <translation>Clear Mesh Data</translation>
+ </message>
+ <message>
+ <source>STB_CLEAR_MESH</source>
+ <translation>Clear Mesh Data</translation>
+ </message>
+ <message>
+ <source>SMESH_IMPORT_MESH</source>
+ <translation>Import mesh data from files</translation>
+ </message>
+ <message>
+ <source>SMESH_ERR_NOT_SUPPORTED_FORMAT</source>
+ <translation>Unsupported file format</translation>
+ </message>
+ <message>
+ <source>SMESH_ERR_UNKNOWN_IMPORT_ERROR</source>
+ <translation>Unknown error</translation>
+ </message>
+ <message>
+ <source>SMESH_IMPORT_ERRORS</source>
+ <translation>Import operation has finished with errors:</translation>
+ </message>
+ <message>
+ <source>SMESH_DRS_SOME_EMPTY</source>
+ <translation>One or more mesh files were empty, data has not been published</translation>
+ </message>
</context>
<context>
<name>SMESHGUI</name>
<source>SHOW_SHAPE</source>
<translation>Show SubShape</translation>
</message>
+ <message>
+ <source>SHOW_BAD_MESH</source>
+ <translation>Show bad Mesh</translation>
+ </message>
</context>
<context>
<name>SMESHGUI_ConvToQuadDlg</name>
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
// finish conversion
theGen->Flush();
#ifdef DUMP_CONVERSION
- cout << endl << " ######## RESULT ######## " << endl<< endl;
+ MESSAGE_BEGIN ( std::endl << " ######## RESULT ######## " << std::endl<< std::endl );
#endif
// reorder commands after conversion
list< Handle(_pyCommand) >::iterator cmd;
for ( cmd = theGen->GetCommands().begin(); cmd != theGen->GetCommands().end(); ++cmd )
{
#ifdef DUMP_CONVERSION
- cout << "## COM " << (*cmd)->GetOrderNb() << ": "<< (*cmd)->GetString() << endl;
+ MESSAGE_ADD ( "## COM " << (*cmd)->GetOrderNb() << ": "<< (*cmd)->GetString() << std::endl );
#endif
if ( !(*cmd)->IsEmpty() ) {
aScript += "\n";
Handle(_pyCommand) aCommand = myCommands.back();
#ifdef DUMP_CONVERSION
- cout << "## COM " << myNbCommands << ": "<< aCommand->GetString() << endl;
+ MESSAGE ( "## COM " << myNbCommands << ": "<< aCommand->GetString() );
#endif
_pyID objID = aCommand->GetObject();
"GetNodeInverseElements","GetShapeID","GetShapeIDForElem","GetElemNbNodes",
"GetElemNode","IsMediumNode","IsMediumNodeOfAnyElem","ElemNbEdges","ElemNbFaces",
"IsPoly","IsQuadratic","BaryCenter","GetHypothesisList", "SetAutoColor", "GetAutoColor",
- "" }; // <- mark of end
+ "Clear"
+ ,"" }; // <- mark of end
sameMethods.Insert( names );
}
"SewBorderToSide","SewSideElements","ChangeElemNodes","GetLastCreatedNodes",
"GetLastCreatedElems",
"MirrorMakeMesh","MirrorObjectMakeMesh","TranslateMakeMesh",
- "TranslateObjectMakeMesh","RotateMakeMesh","RotateObjectMakeMesh",
- "" }; // <- mark of the end
+ "TranslateObjectMakeMesh","RotateMakeMesh","RotateObjectMakeMesh"
+ ,"" }; // <- mark of the end
sameMethods.Insert( names );
}
- //theGen->AddMeshAccessorMethod( theCommand ); // for *Object()
if ( sameMethods.Contains( theCommand->GetMethod() )) {
theCommand->SetObject( myMesh );
}
else {
// editor creation command is needed only if any editor function is called
+ theGen->AddMeshAccessorMethod( theCommand ); // for *Object()
if ( !myCreationCmdStr.IsEmpty() ) {
GetCreationCmd()->GetString() = myCreationCmdStr;
myCreationCmdStr.Clear();
TPythonDump pd;
pd << "aCriterion = SMESH.Filter.Criterion(" << aCriterion << "," << aCompare
<< "," << aThreshold << ",'" << aThresholdStr;
- if (strlen(aThresholdID) > 0)
- pd << "',salome.ObjectToID(" << aThresholdID
- << ")," << aUnary << "," << aBinary << "," << aTolerance
- << "," << aTypeOfElem << "," << aPrecision << ")";
+ if (aThresholdID)
+ pd << "',salome.ObjectToID(" << aThresholdID
+ << ")," << aUnary << "," << aBinary << "," << aTolerance
+ << "," << aTypeOfElem << "," << aPrecision << ")";
else
- pd << "',''," << aUnary << "," << aBinary << "," << aTolerance
- << "," << aTypeOfElem << "," << aPrecision << ")";
+ pd << "',''," << aUnary << "," << aBinary << "," << aTolerance
+ << "," << aTypeOfElem << "," << aPrecision << ")";
}
SMESH::Predicate_ptr aPredicate = SMESH::Predicate::_nil();
#include CORBA_SERVER_HEADER(SMESH_Group)
#include CORBA_SERVER_HEADER(SMESH_Filter)
+#include CORBA_SERVER_HEADER(SMESH_MeshEditor)
#include "DriverMED_W_SMESHDS_Mesh.h"
#include "DriverMED_R_SMESHDS_Mesh.h"
errStruct.subShapeID = sm->GetId();
SALOMEDS::SObject_var algoSO = GetAlgoSO( error->myAlgo );
if ( !algoSO->_is_nil() )
- errStruct.algoName = algoSO->GetName();
+ errStruct.algoName = algoSO->GetName();
else
- errStruct.algoName = error->myAlgo->GetName();
+ errStruct.algoName = error->myAlgo->GetName();
+ errStruct.hasBadMesh = !error->myBadElements.empty();
}
}
error_array->length( nbErr );
return error_array._retn();
}
+//
+//================================================================================
+/*!
+ * \brief Return mesh elements preventing computation of a subshape
+ */
+//================================================================================
+
+SMESH::MeshPreviewStruct*
+SMESH_Gen_i::GetBadInputElements( SMESH::SMESH_Mesh_ptr theMesh,
+ CORBA::Short theSubShapeID )
+ throw ( SALOME::SALOME_Exception )
+{
+ Unexpect aCatch(SALOME_SalomeException);
+ if(MYDEBUG) MESSAGE( "SMESH_Gen_i::GetBadInputElements()" );
+
+ if ( CORBA::is_nil( theMesh ) )
+ THROW_SALOME_CORBA_EXCEPTION( "bad Mesh reference",SALOME::BAD_PARAM );
+
+ SMESH::MeshPreviewStruct_var result = new SMESH::MeshPreviewStruct;
+ try {
+ // mesh servant
+ if ( SMESH_Mesh_i* meshServant = SMESH::DownCast<SMESH_Mesh_i*>( theMesh ))
+ {
+ // mesh implementation
+ ::SMESH_Mesh& mesh = meshServant->GetImpl();
+ // submesh by subshape id
+ if ( SMESH_subMesh * sm = mesh.GetSubMeshContaining( theSubShapeID ))
+ {
+ // compute error
+ SMESH_ComputeErrorPtr error = sm->GetComputeError();
+ if ( error && !error->myBadElements.empty())
+ {
+ typedef map<const SMDS_MeshElement*, int > TNode2LocalIDMap;
+ typedef TNode2LocalIDMap::iterator TNodeLocalID;
+
+ // get nodes of elements and count elements
+ TNode2LocalIDMap mapNode2LocalID;
+ list< TNodeLocalID > connectivity;
+ int i, nbElements = 0, nbConnNodes = 0;
+
+ list<const SMDS_MeshElement*>::iterator elemIt = error->myBadElements.begin();
+ list<const SMDS_MeshElement*>::iterator elemEnd = error->myBadElements.end();
+ for ( ; elemIt != elemEnd; ++elemIt, ++nbElements )
+ {
+ SMDS_ElemIteratorPtr nIt = (*elemIt)->nodesIterator();
+ while ( nIt->more() )
+ connectivity.push_back
+ ( mapNode2LocalID.insert( make_pair( nIt->next(), ++nbConnNodes)).first );
+ }
+ // fill node coords and assign local ids to the nodes
+ int nbNodes = mapNode2LocalID.size();
+ result->nodesXYZ.length( nbNodes );
+ TNodeLocalID node2ID = mapNode2LocalID.begin();
+ for ( i = 0; i < nbNodes; ++i, ++node2ID ) {
+ node2ID->second = i;
+ const SMDS_MeshNode* node = (const SMDS_MeshNode*) node2ID->first;
+ result->nodesXYZ[i].x = node->X();
+ result->nodesXYZ[i].y = node->Y();
+ result->nodesXYZ[i].z = node->Z();
+ }
+ // fill connectivity
+ result->elementConnectivities.length( nbConnNodes );
+ list< TNodeLocalID >::iterator connIt = connectivity.begin();
+ for ( i = 0; i < nbConnNodes; ++i, ++connIt ) {
+ result->elementConnectivities[i] = (*connIt)->second;
+ }
+ // fill element types
+ result->elementTypes.length( nbElements );
+ for ( i = 0, elemIt = error->myBadElements.begin(); i <nbElements; ++i, ++elemIt )
+ {
+ const SMDS_MeshElement* elem = *elemIt;
+ result->elementTypes[i].SMDS_ElementType = (SMESH::ElementType) elem->GetType();
+ result->elementTypes[i].isPoly = elem->IsPoly();
+ result->elementTypes[i].nbNodesInElement = elem->NbNodes();
+ }
+ }
+ }
+ }
+ }
+ catch ( SALOME_Exception& S_ex ) {
+ INFOS( "catch exception "<< S_ex.what() );
+ }
+
+ return result._retn();
+}
+
//================================================================================
/*!
* \brief Returns errors of hypotheses definintion
- * \param theMesh - the mesh
- * \param theSubObject - the main or sub- shape
- * \retval SMESH::algo_error_array* - sequence of errors
+ * \param theMesh - the mesh
+ * \param theSubObject - the main or sub- shape
+ * \retval SMESH::algo_error_array* - sequence of errors
*/
//================================================================================
GEOM::GEOM_Object_ptr theSubObject )
throw ( SALOME::SALOME_Exception );
+ // Return mesh elements preventing computation of a subshape
+ SMESH::MeshPreviewStruct* GetBadInputElements( SMESH::SMESH_Mesh_ptr theMesh,
+ CORBA::Short theSubShapeID )
+ throw ( SALOME::SALOME_Exception );
+
// Get sub-shapes unique ID's list
SMESH::long_array* GetSubShapesId( GEOM::GEOM_Object_ptr theMainShapeObject,
const SMESH::object_array& theListOfSubShape )
// Add New Hypothesis
string aPmName = isAlgo ? "ICON_SMESH_TREE_ALGO_" : "ICON_SMESH_TREE_HYPO_";
aPmName += theHyp->GetName();
+ // prepend plugin name to pixmap name
+ string pluginName = myHypCreatorMap[string(theHyp->GetName())]->GetModuleName();
+ if ( pluginName != "StdMeshers" )
+ aPmName = pluginName + "::" + aPmName;
aHypSO = publish( theStudy, theHyp, aRootSO, 0, aPmName.c_str() );
}
: SALOME::GenericObj_i( thePOA ),
SMESH_GroupBase_i( thePOA, theMeshServant, theLocalID )
{
- MESSAGE("SMESH_Group_i; this = "<<this );
+ //MESSAGE("SMESH_Group_i; this = "<<this );
}
SMESH_GroupOnGeom_i::SMESH_GroupOnGeom_i( PortableServer::POA_ptr thePOA, SMESH_Mesh_i* theMeshServant, const int theLocalID )
: SALOME::GenericObj_i( thePOA ),
SMESH_GroupBase_i( thePOA, theMeshServant, theLocalID )
{
- MESSAGE("SMESH_GroupOnGeom_i; this = "<<this );
+ //MESSAGE("SMESH_GroupOnGeom_i; this = "<<this );
}
//=============================================================================
int NbNodes = IDsOfNodes.length();
if (NbNodes < 3)
{
- return false;
+ return 0;
}
std::vector<const SMDS_MeshNode*> nodes (NbNodes);
if ( isOut ) {
#ifdef _DEBUG_
- cout << "FACE " << FaceID << " (" << u << "," << v << ") out of "
- << " u( " << surf.FirstUParameter()
- << "," << surf.LastUParameter()
- << ") v( " << surf.FirstVParameter()
- << "," << surf.LastVParameter()
- << ")" << endl;
+ MESSAGE ( "FACE " << FaceID << " (" << u << "," << v << ") out of "
+ << " u( " << surf.FirstUParameter()
+ << "," << surf.LastUParameter()
+ << ") v( " << surf.FirstVParameter()
+ << "," << surf.LastVParameter() << ")" );
#endif
THROW_SALOME_CORBA_EXCEPTION("Invalid UV", SALOME::BAD_PARAM);
}
if ( !myPreviewMode ) {
TPythonDump() << "nodeID = " << this
- << ".MoveClosestNodeToPoint( "<< x << ", " << y << ", " << z << " )";
+ << ".MoveClosestNodeToPoint( "<< x << ", " << y << ", " << z
+ << ", " << nodeID << " )";
}
return nodeID;
#include <string>
#include <iostream>
#include <sstream>
+#include <sys/stat.h>
#ifdef _DEBUG_
static int MYDEBUG = 0;
//=======================================================================
GEOM::GEOM_Object_ptr SMESH_Mesh_i::GetShapeToMesh()
- throw (SALOME::SALOME_Exception)
+ throw (SALOME::SALOME_Exception)
{
Unexpect aCatch(SALOME_SalomeException);
GEOM::GEOM_Object_var aShapeObj;
return aShapeObj._retn();
}
+//================================================================================
+/*!
+ * \brief Remove all nodes and elements
+ */
+//================================================================================
+
+void SMESH_Mesh_i::Clear() throw (SALOME::SALOME_Exception)
+{
+ Unexpect aCatch(SALOME_SalomeException);
+ try {
+ _impl->Clear();
+ }
+ catch(SALOME_Exception & S_ex) {
+ THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), SALOME::BAD_PARAM);
+ }
+ TPythonDump() << _this() << ".Clear()";
+}
+
//=============================================================================
/*!
*
THROW_SALOME_CORBA_EXCEPTION("ImportMEDFile(): unknown exception", SALOME::BAD_PARAM);
}
- myFile = theFileName;
CreateGroupServants();
+ int major, minor, release;
+ if( !MED::getMEDVersion( theFileName, major, minor, release ) )
+ major = minor = release = -1;
+ myFileInfo = new SALOME_MED::MedFileInfo();
+ myFileInfo->fileName = theFileName;
+ myFileInfo->fileSize = 0;
+#ifdef WIN32
+ struct _stati64 d;
+ if ( ::_stati64( theFileName, &d ) != -1 )
+#else
+ struct stat64 d;
+ if ( ::stat64( theFileName, &d ) != -1 )
+#endif
+ myFileInfo->fileSize = d.st_size;
+ myFileInfo->major = major;
+ myFileInfo->minor = minor;
+ myFileInfo->release = release;
+
return ConvertDriverMEDReadStatus(status);
}
RETURNCASE( HYP_BAD_DIM );
RETURNCASE( HYP_BAD_SUBSHAPE );
RETURNCASE( HYP_BAD_GEOMETRY );
+ RETURNCASE( HYP_NEED_SHAPE );
default:;
}
return SMESH::HYP_UNKNOWN_FATAL;
TPythonDump() << _this() << ".RemoveGroup( " << aGroupSO << " )";
// Remove group's SObject
- aStudy->NewBuilder()->RemoveObject( aGroupSO );
+ aStudy->NewBuilder()->RemoveObjectWithChildren( aGroupSO );
}
}
return _impl->HasDuplicatedGroupNamesMED();
}
-static void PrepareForWriting (const char* file)
+void SMESH_Mesh_i::PrepareForWriting (const char* file)
{
TCollection_AsciiString aFullName ((char*)file);
OSD_Path aPath (aFullName);
CORBA::LongLong SMESH_Mesh_i::GetMeshPtr()
{
CORBA::LongLong pointeur = CORBA::LongLong(_impl);
- cerr << "CORBA::LongLong SMESH_Mesh_i::GetMeshPtr() " << pointeur << endl;
+ if ( MYDEBUG )
+ MESSAGE("CORBA::LongLong SMESH_Mesh_i::GetMeshPtr() "<<pointeur);
return pointeur;
}
* \brief Return information about imported file
*/
//=============================================================================
+
SALOME_MED::MedFileInfo* SMESH_Mesh_i::GetMEDFileInfo()
{
- SALOME_MED::MedFileInfo_var res = new SALOME_MED::MedFileInfo();
-
- const char* name = myFile.c_str();
- res->fileName = name;
- res->fileSize = 0;//myFileInfo.size();
- int major, minor, release;
- if( !MED::getMEDVersion( name, major, minor, release ) )
- {
- major = -1;
- minor = -1;
- release = -1;
+ SALOME_MED::MedFileInfo_var res( myFileInfo );
+ if ( !res.operator->() ) {
+ res = new SALOME_MED::MedFileInfo;
+ res->fileName = "";
+ res->fileSize = res->major = res->minor = res->release = -1;
}
- res->major = major;
- res->minor = minor;
- res->release = release;
return res._retn();
}
GEOM::GEOM_Object_ptr GetShapeToMesh()
throw (SALOME::SALOME_Exception);
+ void Clear()
+ throw (SALOME::SALOME_Exception);
+
SMESH::Hypothesis_Status AddHypothesis(GEOM::GEOM_Object_ptr aSubShapeObject,
SMESH::SMESH_Hypothesis_ptr anHyp)
throw (SALOME::SALOME_Exception);
static SMESH::Hypothesis_Status
ConvertHypothesisStatus (SMESH_Hypothesis::Hypothesis_Status theStatus);
+ static void PrepareForWriting (const char* file);
+
//int importMEDFile( const char* theFileName, const char* theMeshName );
SMESH::SMESH_subMesh_ptr createSubMesh( GEOM::GEOM_Object_ptr theSubShapeObject );
std::map<int, SMESH::SMESH_subMesh_ptr> _mapSubMeshIor;
std::map<int, SMESH::SMESH_GroupBase_ptr> _mapGroups;
std::map<int, SMESH::SMESH_Hypothesis_ptr> _mapHypo;
- string myFile;
+ SALOME_MED::MedFileInfo_var myFileInfo;
};
#endif
\brief Module smesh
"""
-## \package smeshDC
-# To get started, please look at smeshDC::smeshDC documentation for general services of smesh package.
-# You can find the smeshDC::smeshDC documentation also by the first
-# item in the Data Structures list on this page.
-# See also the list of Data Structures and the list of Functions
-# for other classes and methods of smesh python interface.
-
+## @defgroup l1_auxiliary Auxiliary methods and structures
+## @defgroup l1_creating Creating meshes
+## @{
+## @defgroup l2_impexp Importing and exporting meshes
+## @defgroup l2_construct Constructing meshes
+## @defgroup l2_algorithms Defining Algorithms
+## @{
+## @defgroup l3_algos_basic Basic meshing algorithms
+## @defgroup l3_algos_proj Projection Algorithms
+## @defgroup l3_algos_radialp Radial Prism
+## @defgroup l3_algos_segmarv Segments around Vertex
+## @defgroup l3_algos_3dextr 3D extrusion meshing algorithm
+
+## @}
+## @defgroup l2_hypotheses Defining hypotheses
+## @{
+## @defgroup l3_hypos_1dhyps 1D Meshing Hypotheses
+## @defgroup l3_hypos_2dhyps 2D Meshing Hypotheses
+## @defgroup l3_hypos_maxvol Max Element Volume hypothesis
+## @defgroup l3_hypos_netgen Netgen 2D and 3D hypotheses
+## @defgroup l3_hypos_ghs3dh GHS3D Parameters hypothesis
+## @defgroup l3_hypos_blsurf BLSURF Parameters hypothesis
+## @defgroup l3_hypos_hexotic Hexotic Parameters hypothesis
+## @defgroup l3_hypos_additi Additional Hypotheses
+
+## @}
+## @defgroup l2_submeshes Constructing submeshes
+## @defgroup l2_compounds Building Compounds
+## @defgroup l2_editing Editing Meshes
+
+## @}
+## @defgroup l1_meshinfo Mesh Information
+## @defgroup l1_controls Quality controls and Filtering
+## @defgroup l1_grouping Grouping elements
+## @{
+## @defgroup l2_grps_create Creating groups
+## @defgroup l2_grps_edit Editing groups
+## @defgroup l2_grps_operon Using operations on groups
+## @defgroup l2_grps_delete Deleting Groups
+
+## @}
+## @defgroup l1_modifying Modifying meshes
+## @{
+## @defgroup l2_modif_add Adding nodes and elements
+## @defgroup l2_modif_del Removing nodes and elements
+## @defgroup l2_modif_edit Modifying nodes and elements
+## @defgroup l2_modif_renumber Renumbering nodes and elements
+## @defgroup l2_modif_trsf Transforming meshes (Translation, Rotation, Symmetry, Sewing, Merging)
+## @defgroup l2_modif_movenode Moving nodes
+## @defgroup l2_modif_throughp Mesh through point
+## @defgroup l2_modif_invdiag Diagonal inversion of elements
+## @defgroup l2_modif_unitetri Uniting triangles
+## @defgroup l2_modif_changori Changing orientation of elements
+## @defgroup l2_modif_cutquadr Cutting quadrangles
+## @defgroup l2_modif_smooth Smoothing
+## @defgroup l2_modif_extrurev Extrusion and Revolution
+## @defgroup l2_modif_patterns Pattern mapping
+## @defgroup l2_modif_tofromqu Convert to/from Quadratic Mesh
+
+## @}
import salome
import geompyDC
-import SMESH # necessary for back compatibility
+import SMESH # This is necessary for back compatibility
from SMESH import *
import StdMeshers
noNETGENPlugin = 1
pass
-# Types of algo
+## @addtogroup l1_auxiliary
+## @{
+
+# Types of algorithms
REGULAR = 1
PYTHON = 2
COMPOSITE = 3
LAPLACIAN_SMOOTH = SMESH_MeshEditor.LAPLACIAN_SMOOTH
CENTROIDAL_SMOOTH = SMESH_MeshEditor.CENTROIDAL_SMOOTH
-# Fineness enumeration(for NETGEN)
+# Fineness enumeration (for NETGEN)
VeryCoarse = 0
-Coarse = 1
-Moderate = 2
-Fine = 3
-VeryFine = 4
-Custom = 5
+Coarse = 1
+Moderate = 2
+Fine = 3
+VeryFine = 4
+Custom = 5
+
+# Optimization level of GHS3D
+None_Optimization, Light_Optimization, Medium_Optimization, Strong_Optimization = 0,1,2,3
+
+# Topology treatment way of BLSURF
+FromCAD, PreProcess, PreProcessPlus = 0,1,2
+
+# Element size flag of BLSURF
+DefaultSize, DefaultGeom, Custom = 0,0,1
PrecisionConfusion = 1e-07
attr = sobj.FindAttribute("AttributeName")[1]
return attr.Value()
-## Sets name to object
+## Sets a name to the object
def SetName(obj, name):
ior = salome.orb.object_to_string(obj)
sobj = salome.myStudy.FindObjectIOR(ior)
attr = sobj.FindAttribute("AttributeName")[1]
attr.SetValue(name)
-## Print error message if a hypothesis was not assigned.
+## Prints error message if a hypothesis was not assigned.
def TreatHypoStatus(status, hypName, geomName, isAlgo):
if isAlgo:
hypType = "algorithm"
if status == HYP_UNKNOWN_FATAL :
reason = "for unknown reason"
elif status == HYP_INCOMPATIBLE :
- reason = "this hypothesis mismatches algorithm"
+ reason = "this hypothesis mismatches the algorithm"
elif status == HYP_NOTCONFORM :
- reason = "not conform mesh would be built"
+ reason = "a non-conform mesh would be built"
elif status == HYP_ALREADY_EXIST :
- reason = hypType + " of the same dimension already assigned to this shape"
+ reason = hypType + " of the same dimension is already assigned to this shape"
elif status == HYP_BAD_DIM :
- reason = hypType + " mismatches shape"
+ reason = hypType + " mismatches the shape"
elif status == HYP_CONCURENT :
reason = "there are concurrent hypotheses on sub-shapes"
elif status == HYP_BAD_SUBSHAPE :
- reason = "shape is neither the main one, nor its subshape, nor a valid group"
+ reason = "the shape is neither the main one, nor its subshape, nor a valid group"
elif status == HYP_BAD_GEOMETRY:
- reason = "geometry mismatches algorithm's expectation"
+ reason = "geometry mismatches the expectation of the algorithm"
elif status == HYP_HIDDEN_ALGO:
- reason = "it is hidden by an algorithm of upper dimension generating all-dimensions elements"
+ reason = "it is hidden by an algorithm of an upper dimension, which generates elements of all dimensions"
elif status == HYP_HIDING_ALGO:
- reason = "it hides algorithm(s) of lower dimension by generating all-dimensions elements"
+ reason = "it hides algorithms of lower dimensions by generating elements of all dimensions"
+ elif status == HYP_NEED_SHAPE:
+ reason = "Algorithm can't work without shape"
else:
return
hypName = '"' + hypName + '"'
print hypName, "was not assigned to",geomName,":", reason
pass
-## Convert angle in degrees to radians
+## Converts an angle from degrees to radians
def DegreesToRadians(AngleInDegrees):
from math import pi
return AngleInDegrees * pi / 180.0
-## Methods of package smesh.py: general services of MESH component.
-#
-# This class has been designed to provide general services of the MESH component.
-# All methods of this class are accessible directly from the smesh.py package.
-# Use these methods to create an empty mesh, to import mesh from a file,
-# and also to create patterns and filtering criteria.
+# end of l1_auxiliary
+## @}
+
+# All methods of this class are accessible directly from the smesh.py package.
class smeshDC(SMESH._objref_SMESH_Gen):
- ## To set current study and Geometry component
+ ## Sets the current study and Geometry component
+ # @ingroup l1_auxiliary
def init_smesh(self,theStudy,geompyD):
self.geompyD=geompyD
self.SetGeomEngine(geompyD)
self.SetCurrentStudy(theStudy)
- ## Create an empty Mesh. This mesh can have underlying geometry.
- # @param obj Geometrical object to build the mesh on. If not defined,
- # the mesh will not have underlying geometry.
- # @param name A name for the new mesh.
- # @return instance of Mesh class.
+ ## Creates an empty Mesh. This mesh can have an underlying geometry.
+ # @param obj the Geometrical object on which the mesh is built. If not defined,
+ # the mesh will have no underlying geometry.
+ # @param name the name for the new mesh.
+ # @return an instance of Mesh class.
+ # @ingroup l2_construct
def Mesh(self, obj=0, name=0):
return Mesh(self,self.geompyD,obj,name)
- ## Returns long value from enumeration
- # To be used for SMESH.FunctorType enumeration
+ ## Returns a long value from enumeration
+ # Should be used for SMESH.FunctorType enumeration
+ # @ingroup l1_controls
def EnumToLong(self,theItem):
return theItem._v
- ## Get PointStruct from vertex
- # @param theVertex is GEOM object(vertex)
+ ## Gets PointStruct from vertex
+ # @param theVertex a GEOM object(vertex)
# @return SMESH.PointStruct
+ # @ingroup l1_auxiliary
def GetPointStruct(self,theVertex):
[x, y, z] = self.geompyD.PointCoordinates(theVertex)
return PointStruct(x,y,z)
- ## Get DirStruct from vector
- # @param theVector is GEOM object(vector)
+ ## Gets DirStruct from vector
+ # @param theVector a GEOM object(vector)
# @return SMESH.DirStruct
+ # @ingroup l1_auxiliary
def GetDirStruct(self,theVector):
vertices = self.geompyD.SubShapeAll( theVector, geompyDC.ShapeType["VERTEX"] )
if(len(vertices) != 2):
dirst = DirStruct(pnt)
return dirst
- ## Make DirStruct from a triplet
- # @param x,y,z are vector components
+ ## Makes DirStruct from a triplet
+ # @param x,y,z vector components
# @return SMESH.DirStruct
+ # @ingroup l1_auxiliary
def MakeDirStruct(self,x,y,z):
pnt = PointStruct(x,y,z)
return DirStruct(pnt)
## Get AxisStruct from object
- # @param theObj is GEOM object(line or plane)
+ # @param theObj a GEOM object (line or plane)
# @return SMESH.AxisStruct
+ # @ingroup l1_auxiliary
def GetAxisStruct(self,theObj):
edges = self.geompyD.SubShapeAll( theObj, geompyDC.ShapeType["EDGE"] )
if len(edges) > 1:
# From SMESH_Gen interface:
# ------------------------
- ## Set the current mode
+ ## Sets the current mode
+ # @ingroup l1_auxiliary
def SetEmbeddedMode( self,theMode ):
#self.SetEmbeddedMode(theMode)
SMESH._objref_SMESH_Gen.SetEmbeddedMode(self,theMode)
- ## Get the current mode
+ ## Gets the current mode
+ # @ingroup l1_auxiliary
def IsEmbeddedMode(self):
#return self.IsEmbeddedMode()
return SMESH._objref_SMESH_Gen.IsEmbeddedMode(self)
- ## Set the current study
+ ## Sets the current study
+ # @ingroup l1_auxiliary
def SetCurrentStudy( self, theStudy ):
#self.SetCurrentStudy(theStudy)
SMESH._objref_SMESH_Gen.SetCurrentStudy(self,theStudy)
- ## Get the current study
+ ## Gets the current study
+ # @ingroup l1_auxiliary
def GetCurrentStudy(self):
#return self.GetCurrentStudy()
return SMESH._objref_SMESH_Gen.GetCurrentStudy(self)
- ## Create Mesh object importing data from given UNV file
+ ## Creates a Mesh object importing data from the given UNV file
# @return an instance of Mesh class
+ # @ingroup l2_impexp
def CreateMeshesFromUNV( self,theFileName ):
aSmeshMesh = SMESH._objref_SMESH_Gen.CreateMeshesFromUNV(self,theFileName)
aMesh = Mesh(self, self.geompyD, aSmeshMesh)
return aMesh
- ## Create Mesh object(s) importing data from given MED file
+ ## Creates a Mesh object(s) importing data from the given MED file
# @return a list of Mesh class instances
+ # @ingroup l2_impexp
def CreateMeshesFromMED( self,theFileName ):
aSmeshMeshes, aStatus = SMESH._objref_SMESH_Gen.CreateMeshesFromMED(self,theFileName)
aMeshes = []
aMeshes.append(aMesh)
return aMeshes, aStatus
- ## Create Mesh object importing data from given STL file
+ ## Creates a Mesh object importing data from the given STL file
# @return an instance of Mesh class
+ # @ingroup l2_impexp
def CreateMeshesFromSTL( self, theFileName ):
aSmeshMesh = SMESH._objref_SMESH_Gen.CreateMeshesFromSTL(self,theFileName)
aMesh = Mesh(self, self.geompyD, aSmeshMesh)
return aMesh
## From SMESH_Gen interface
- # @return list of integer values
+ # @return the list of integer values
+ # @ingroup l1_auxiliary
def GetSubShapesId( self, theMainObject, theListOfSubObjects ):
return SMESH._objref_SMESH_Gen.GetSubShapesId(self,theMainObject, theListOfSubObjects)
- ## From SMESH_Gen interface. Creates pattern
- # @return an instance of SMESH_Pattern
+ ## From SMESH_Gen interface. Creates a pattern
+ # @return an instance of SMESH_Pattern
+ #
+ # <a href="../tui_modifying_meshes_page.html#tui_pattern_mapping">Example of Patterns usage</a>
+ # @ingroup l2_modif_patterns
def GetPattern(self):
return SMESH._objref_SMESH_Gen.GetPattern(self)
## Creates an empty criterion
# @return SMESH.Filter.Criterion
+ # @ingroup l1_controls
def GetEmptyCriterion(self):
Type = self.EnumToLong(FT_Undefined)
Compare = self.EnumToLong(FT_Undefined)
return Filter.Criterion(Type, Compare, Threshold, ThresholdStr, ThresholdID,
UnaryOp, BinaryOp, Tolerance, TypeOfElement, Precision)
- ## Creates a criterion by given parameters
- # @param elementType is the type of elements(NODE, EDGE, FACE, VOLUME)
- # @param CritType is type of criterion( FT_Taper, FT_Area, FT_RangeOfIds, FT_LyingOnGeom etc. )
- # @param Compare belong to {FT_LessThan, FT_MoreThan, FT_EqualTo}
- # @param Treshold is threshold value (range of ids as string, shape, numeric)
- # @param UnaryOp is FT_LogicalNOT or FT_Undefined
- # @param BinaryOp is binary logical operation FT_LogicalAND, FT_LogicalOR or
- # FT_Undefined(must be for the last criterion in criteria)
+ ## Creates a criterion by the given parameters
+ # @param elementType the type of elements(NODE, EDGE, FACE, VOLUME)
+ # @param CritType the type of criterion (FT_Taper, FT_Area, FT_RangeOfIds, FT_LyingOnGeom etc.)
+ # @param Compare belongs to {FT_LessThan, FT_MoreThan, FT_EqualTo}
+ # @param Treshold the threshold value (range of ids as string, shape, numeric)
+ # @param UnaryOp FT_LogicalNOT or FT_Undefined
+ # @param BinaryOp a binary logical operation FT_LogicalAND, FT_LogicalOR or
+ # FT_Undefined (must be for the last criterion of all criteria)
# @return SMESH.Filter.Criterion
+ # @ingroup l1_controls
def GetCriterion(self,elementType,
CritType,
Compare = FT_EqualTo,
if CritType in [FT_BelongToGeom, FT_BelongToPlane, FT_BelongToGenSurface,
FT_BelongToCylinder, FT_LyingOnGeom]:
- # Check treshold
+ # Checks the treshold
if isinstance(aTreshold, geompyDC.GEOM._objref_GEOM_Object):
aCriterion.ThresholdStr = GetName(aTreshold)
aCriterion.ThresholdID = salome.ObjectToID(aTreshold)
else:
- print "Error: Treshold should be a shape."
+ print "Error: The treshold should be a shape."
return None
elif CritType == FT_RangeOfIds:
- # Check treshold
+ # Checks the treshold
if isinstance(aTreshold, str):
aCriterion.ThresholdStr = aTreshold
else:
- print "Error: Treshold should be a string."
+ print "Error: The treshold should be a string."
return None
elif CritType in [FT_FreeBorders, FT_FreeEdges, FT_BadOrientedVolume]:
- # Here we do not need treshold
+ # At this point the treshold is unnecessary
if aTreshold == FT_LogicalNOT:
aCriterion.UnaryOp = self.EnumToLong(FT_LogicalNOT)
elif aTreshold in [FT_LogicalAND, FT_LogicalOR]:
aTreshold = float(aTreshold)
aCriterion.Threshold = aTreshold
except:
- print "Error: Treshold should be a number."
+ print "Error: The treshold should be a number."
return None
if Treshold == FT_LogicalNOT or UnaryOp == FT_LogicalNOT:
return aCriterion
- ## Creates filter by given parameters of criterion
- # @param elementType is the type of elements in the group
- # @param CritType is type of criterion( FT_Taper, FT_Area, FT_RangeOfIds, FT_LyingOnGeom etc. )
- # @param Compare belong to {FT_LessThan, FT_MoreThan, FT_EqualTo}
- # @param Treshold is threshold value (range of id ids as string, shape, numeric)
- # @param UnaryOp is FT_LogicalNOT or FT_Undefined
+ ## Creates a filter with the given parameters
+ # @param elementType the type of elements in the group
+ # @param CritType the type of criterion ( FT_Taper, FT_Area, FT_RangeOfIds, FT_LyingOnGeom etc. )
+ # @param Compare belongs to {FT_LessThan, FT_MoreThan, FT_EqualTo}
+ # @param Treshold the threshold value (range of id ids as string, shape, numeric)
+ # @param UnaryOp FT_LogicalNOT or FT_Undefined
# @return SMESH_Filter
+ # @ingroup l1_controls
def GetFilter(self,elementType,
CritType=FT_Undefined,
Compare=FT_EqualTo,
aFilter.SetCriteria(aCriteria)
return aFilter
- ## Creates numerical functor by its type
- # @param theCrierion is FT_...; functor type
+ ## Creates a numerical functor by its type
+ # @param theCriterion FT_...; functor type
# @return SMESH_NumericalFunctor
+ # @ingroup l1_controls
def GetFunctor(self,theCriterion):
aFilterMgr = self.CreateFilterManager()
if theCriterion == FT_AspectRatio:
else:
print "Error: given parameter is not numerucal functor type."
+
import omniORB
-#Register the new proxy for SMESH_Gen
+#Registering the new proxy for SMESH_Gen
omniORB.registerObjref(SMESH._objref_SMESH_Gen._NP_RepositoryId, smeshDC)
# Public class: Mesh
# ==================
-## Class to define a mesh
-#
-# This class allows to define and manage a mesh.
-# It has a set of methods to build a mesh on the given geometry, including definition of sub-meshes.
-# Also it has methods to define groups of mesh elements, to modify a mesh (by addition of
-# new nodes and elements and by changind of existing entities), to take information
+## This class allows defining and managing a mesh.
+# It has a set of methods to build a mesh on the given geometry, including the definition of sub-meshes.
+# It also has methods to define groups of mesh elements, to modify a mesh (by addition of
+# new nodes and elements and by changing the existing entities), to get information
# about a mesh and to export a mesh into different formats.
class Mesh:
## Constructor
#
- # Creates mesh on the shape \a obj (or the empty mesh if obj is equal to 0),
- # sets GUI name of this mesh to \a name.
+ # Creates a mesh on the shape \a obj (or an empty mesh if \a obj is equal to 0) and
+ # sets the GUI name of this mesh to \a name.
+ # @param smeshpyD an instance of smeshDC class
+ # @param geompyD an instance of geompyDC class
# @param obj Shape to be meshed or SMESH_Mesh object
# @param name Study name of the mesh
+ # @ingroup l2_construct
def __init__(self, smeshpyD, geompyD, obj=0, name=0):
self.smeshpyD=smeshpyD
self.geompyD=geompyD
elif obj != 0:
SetName(self.mesh, GetName(obj))
+ if not self.geom:
+ self.geom = self.mesh.GetShapeToMesh()
+
self.editor = self.mesh.GetMeshEditor()
- ## Method that inits the Mesh object from instance of SMESH_Mesh interface
- # @param theMesh is SMESH_Mesh object
+ ## Initializes the Mesh object from an instance of SMESH_Mesh interface
+ # @param theMesh a SMESH_Mesh object
+ # @ingroup l2_construct
def SetMesh(self, theMesh):
self.mesh = theMesh
self.geom = self.mesh.GetShapeToMesh()
- ## Method that returns the mesh, that is instance of SMESH_Mesh interface
- # @return SMESH_Mesh object
+ ## Returns the mesh, that is an instance of SMESH_Mesh interface
+ # @return a SMESH_Mesh object
+ # @ingroup l2_construct
def GetMesh(self):
return self.mesh
- ## Get mesh name
- # @return name of the mesh as a string
+ ## Gets the name of the mesh
+ # @return the name of the mesh as a string
+ # @ingroup l2_construct
def GetName(self):
name = GetName(self.GetMesh())
return name
- ## Set name to mesh
- # @param name a new name for the mesh
+ ## Sets a name to the mesh
+ # @param name a new name of the mesh
+ # @ingroup l2_construct
def SetName(self, name):
SetName(self.GetMesh(), name)
- ## Get the subMesh object associated to \a theSubObject geometrical object.
- # The subMesh object gives access to nodes and elements IDs.
- # @param theSubObject A geometrical object (shape)
- # @return object of type SMESH_SubMesh, representing part of mesh, which lays on the given shape
- def GetSubMesh(self, theSubObject, name):
- submesh = self.mesh.GetSubMesh(theSubObject, name)
+ ## Gets the subMesh object associated to a \a theSubObject geometrical object.
+ # The subMesh object gives access to the IDs of nodes and elements.
+ # @param theSubObject a geometrical object (shape)
+ # @param theName a name for the submesh
+ # @return an object of type SMESH_SubMesh, representing a part of mesh, which lies on the given shape
+ # @ingroup l2_submeshes
+ def GetSubMesh(self, theSubObject, theName):
+ submesh = self.mesh.GetSubMesh(theSubObject, theName)
return submesh
- ## Method that returns the shape associated to the mesh
- # @return GEOM_Object
+ ## Returns the shape associated to the mesh
+ # @return a GEOM_Object
+ # @ingroup l2_construct
def GetShape(self):
return self.geom
- ## Method that associates given shape to the mesh(entails the mesh recreation)
- # @param geom shape to be meshed (GEOM_Object)
+ ## Associates the given shape to the mesh (entails the recreation of the mesh)
+ # @param geom the shape to be meshed (GEOM_Object)
+ # @ingroup l2_construct
def SetShape(self, geom):
self.mesh = self.smeshpyD.CreateMesh(geom)
- ## Return true if hypotheses are defined well
- # @param theSubObject subshape of a mesh shape
+ ## Returns true if the hypotheses are defined well
+ # @param theSubObject a subshape of a mesh shape
# @return True or False
+ # @ingroup l2_construct
def IsReadyToCompute(self, theSubObject):
return self.smeshpyD.IsReadyToCompute(self.mesh, theSubObject)
- ## Return errors of hypotheses definition.
- # Errors list is empty if everything is OK.
- # @param theSubObject subshape of a mesh shape
+ ## Returns errors of hypotheses definition.
+ # The list of errors is empty if everything is OK.
+ # @param theSubObject a subshape of a mesh shape
# @return a list of errors
+ # @ingroup l2_construct
def GetAlgoState(self, theSubObject):
return self.smeshpyD.GetAlgoState(self.mesh, theSubObject)
- ## Return geometrical object the given element is built on.
+ ## Returns a geometrical object on which the given element was built.
# The returned geometrical object, if not nil, is either found in the
- # study or is published by this method with the given name
- # @param theElementID an id of the mesh element
- # @param theGeomName user defined name of geometrical object
+ # study or published by this method with the given name
+ # @param theElementID the id of the mesh element
+ # @param theGeomName the user-defined name of the geometrical object
# @return GEOM::GEOM_Object instance
+ # @ingroup l2_construct
def GetGeometryByMeshElement(self, theElementID, theGeomName):
return self.smeshpyD.GetGeometryByMeshElement( self.mesh, theElementID, theGeomName )
- ## Returns mesh dimension depending on that of the underlying shape
+ ## Returns the mesh dimension depending on the dimension of the underlying shape
# @return mesh dimension as an integer value [0,3]
+ # @ingroup l1_auxiliary
def MeshDimension(self):
shells = self.geompyD.SubShapeAllIDs( self.geom, geompyDC.ShapeType["SHELL"] )
if len( shells ) > 0 :
## Creates a segment discretization 1D algorithm.
# If the optional \a algo parameter is not set, this algorithm is REGULAR.
# \n If the optional \a geom parameter is not set, this algorithm is global.
- # Otherwise, this algorithm define a submesh based on \a geom subshape.
- # @param algo type of desired algorithm. Possible values are:
+ # Otherwise, this algorithm defines a submesh based on \a geom subshape.
+ # @param algo the type of the required algorithm. Possible values are:
# - smesh.REGULAR,
- # - smesh.PYTHON for discretization via python function,
+ # - smesh.PYTHON for discretization via a python function,
# - smesh.COMPOSITE for meshing a set of edges on one face side as a whole.
- # @param geom If defined, subshape to be meshed
- # @return instance of Mesh_Segment or Mesh_Segment_Python, or Mesh_CompositeSegment class
+ # @param geom If defined is the subshape to be meshed
+ # @return an instance of Mesh_Segment or Mesh_Segment_Python, or Mesh_CompositeSegment class
+ # @ingroup l3_algos_basic
def Segment(self, algo=REGULAR, geom=0):
## if Segment(geom) is called by mistake
if isinstance( algo, geompyDC.GEOM._objref_GEOM_Object):
else:
return Mesh_Segment(self, geom)
- ## Enable creation of nodes and segments usable by 2D algoritms.
- # Added nodes and segments must be bound to edges and vertices by
+ ## Enables creation of nodes and segments usable by 2D algoritms.
+ # The added nodes and segments must be bound to edges and vertices by
# SetNodeOnVertex(), SetNodeOnEdge() and SetMeshElementOnShape()
- # If the optional \a geom parameter is not sets, this algorithm is global.
- # \n Otherwise, this algorithm define a submesh based on \a geom subshape.
- # @param geom subshape to be manually meshed
+ # If the optional \a geom parameter is not set, this algorithm is global.
+ # \n Otherwise, this algorithm defines a submesh based on \a geom subshape.
+ # @param geom the subshape to be manually meshed
# @return StdMeshers_UseExisting_1D algorithm that generates nothing
+ # @ingroup l3_algos_basic
def UseExistingSegments(self, geom=0):
algo = Mesh_UseExisting(1,self,geom)
return algo.GetAlgorithm()
- ## Enable creation of nodes and faces usable by 3D algoritms.
- # Added nodes and faces must be bound to geom faces by SetNodeOnFace()
+ ## Enables creation of nodes and faces usable by 3D algoritms.
+ # The added nodes and faces must be bound to geom faces by SetNodeOnFace()
# and SetMeshElementOnShape()
- # If the optional \a geom parameter is not sets, this algorithm is global.
- # \n Otherwise, this algorithm define a submesh based on \a geom subshape.
- # @param geom subshape to be manually meshed
+ # If the optional \a geom parameter is not set, this algorithm is global.
+ # \n Otherwise, this algorithm defines a submesh based on \a geom subshape.
+ # @param geom the subshape to be manually meshed
# @return StdMeshers_UseExisting_2D algorithm that generates nothing
+ # @ingroup l3_algos_basic
def UseExistingFaces(self, geom=0):
algo = Mesh_UseExisting(2,self,geom)
return algo.GetAlgorithm()
## Creates a triangle 2D algorithm for faces.
- # If the optional \a geom parameter is not sets, this algorithm is global.
- # \n Otherwise, this algorithm define a submesh based on \a geom subshape.
+ # If the optional \a geom parameter is not set, this algorithm is global.
+ # \n Otherwise, this algorithm defines a submesh based on \a geom subshape.
# @param algo values are: smesh.MEFISTO || smesh.NETGEN_1D2D || smesh.NETGEN_2D || smesh.BLSURF
- # @param geom If defined, subshape to be meshed (GEOM_Object)
+ # @param geom If defined, the subshape to be meshed (GEOM_Object)
# @return an instance of Mesh_Triangle algorithm
+ # @ingroup l3_algos_basic
def Triangle(self, algo=MEFISTO, geom=0):
## if Triangle(geom) is called by mistake
if (isinstance(algo, geompyDC.GEOM._objref_GEOM_Object)):
return Mesh_Triangle(self, algo, geom)
## Creates a quadrangle 2D algorithm for faces.
- # If the optional \a geom parameter is not sets, this algorithm is global.
- # \n Otherwise, this algorithm define a submesh based on \a geom subshape.
- # @param geom If defined, subshape to be meshed (GEOM_Object)
+ # If the optional \a geom parameter is not set, this algorithm is global.
+ # \n Otherwise, this algorithm defines a submesh based on \a geom subshape.
+ # @param geom If defined, the subshape to be meshed (GEOM_Object)
# @return an instance of Mesh_Quadrangle algorithm
+ # @ingroup l3_algos_basic
def Quadrangle(self, geom=0):
return Mesh_Quadrangle(self, geom)
## Creates a tetrahedron 3D algorithm for solids.
- # The parameter \a algo permits to choice the algorithm: NETGEN or GHS3D
- # If the optional \a geom parameter is not sets, this algorithm is global.
- # \n Otherwise, this algorithm define a submesh based on \a geom subshape.
+ # The parameter \a algo permits to choose the algorithm: NETGEN or GHS3D
+ # If the optional \a geom parameter is not set, this algorithm is global.
+ # \n Otherwise, this algorithm defines a submesh based on \a geom subshape.
# @param algo values are: smesh.NETGEN, smesh.GHS3D, smesh.FULL_NETGEN
- # @param geom If defined, subshape to be meshed (GEOM_Object)
+ # @param geom If defined, the subshape to be meshed (GEOM_Object)
# @return an instance of Mesh_Tetrahedron algorithm
+ # @ingroup l3_algos_basic
def Tetrahedron(self, algo=NETGEN, geom=0):
## if Tetrahedron(geom) is called by mistake
if ( isinstance( algo, geompyDC.GEOM._objref_GEOM_Object)):
return Mesh_Tetrahedron(self, algo, geom)
## Creates a hexahedron 3D algorithm for solids.
- # If the optional \a geom parameter is not sets, this algorithm is global.
- # \n Otherwise, this algorithm define a submesh based on \a geom subshape.
+ # If the optional \a geom parameter is not set, this algorithm is global.
+ # \n Otherwise, this algorithm defines a submesh based on \a geom subshape.
# @param algo possible values are: smesh.Hexa, smesh.Hexotic
- # @param geom If defined, subshape to be meshed (GEOM_Object)
+ # @param geom If defined, the subshape to be meshed (GEOM_Object)
# @return an instance of Mesh_Hexahedron algorithm
+ # @ingroup l3_algos_basic
def Hexahedron(self, algo=Hexa, geom=0):
## if Hexahedron(geom, algo) or Hexahedron(geom) is called by mistake
if ( isinstance(algo, geompyDC.GEOM._objref_GEOM_Object) ):
elif geom == 0: algo, geom = Hexa, algo
return Mesh_Hexahedron(self, algo, geom)
- ## Deprecated, only for compatibility!
+ ## Deprecated, used only for compatibility!
# @return an instance of Mesh_Netgen algorithm
+ # @ingroup l3_algos_basic
def Netgen(self, is3D, geom=0):
return Mesh_Netgen(self, is3D, geom)
## Creates a projection 1D algorithm for edges.
- # If the optional \a geom parameter is not sets, this algorithm is global.
- # Otherwise, this algorithm define a submesh based on \a geom subshape.
- # @param geom If defined, subshape to be meshed
+ # If the optional \a geom parameter is not set, this algorithm is global.
+ # Otherwise, this algorithm defines a submesh based on \a geom subshape.
+ # @param geom If defined, the subshape to be meshed
# @return an instance of Mesh_Projection1D algorithm
+ # @ingroup l3_algos_proj
def Projection1D(self, geom=0):
return Mesh_Projection1D(self, geom)
## Creates a projection 2D algorithm for faces.
- # If the optional \a geom parameter is not sets, this algorithm is global.
- # Otherwise, this algorithm define a submesh based on \a geom subshape.
- # @param geom If defined, subshape to be meshed
+ # If the optional \a geom parameter is not set, this algorithm is global.
+ # Otherwise, this algorithm defines a submesh based on \a geom subshape.
+ # @param geom If defined, the subshape to be meshed
# @return an instance of Mesh_Projection2D algorithm
+ # @ingroup l3_algos_proj
def Projection2D(self, geom=0):
return Mesh_Projection2D(self, geom)
## Creates a projection 3D algorithm for solids.
- # If the optional \a geom parameter is not sets, this algorithm is global.
- # Otherwise, this algorithm define a submesh based on \a geom subshape.
- # @param geom If defined, subshape to be meshed
+ # If the optional \a geom parameter is not set, this algorithm is global.
+ # Otherwise, this algorithm defines a submesh based on \a geom subshape.
+ # @param geom If defined, the subshape to be meshed
# @return an instance of Mesh_Projection3D algorithm
+ # @ingroup l3_algos_proj
def Projection3D(self, geom=0):
return Mesh_Projection3D(self, geom)
## Creates a 3D extrusion (Prism 3D) or RadialPrism 3D algorithm for solids.
- # If the optional \a geom parameter is not sets, this algorithm is global.
- # Otherwise, this algorithm define a submesh based on \a geom subshape.
- # @param geom If defined, subshape to be meshed
+ # If the optional \a geom parameter is not set, this algorithm is global.
+ # Otherwise, this algorithm defines a submesh based on \a geom subshape.
+ # @param geom If defined, the subshape to be meshed
# @return an instance of Mesh_Prism3D or Mesh_RadialPrism3D algorithm
+ # @ingroup l3_algos_radialp l3_algos_3dextr
def Prism(self, geom=0):
shape = geom
if shape==0:
return Mesh_Prism3D(self, geom)
return Mesh_RadialPrism3D(self, geom)
- ## Compute the mesh and return the status of the computation
+ ## Computes the mesh and returns the status of the computation
# @return True or False
+ # @ingroup l2_construct
def Compute(self, geom=0):
if geom == 0 or not isinstance(geom, geompyDC.GEOM._objref_GEOM_Object):
if self.geom == 0:
- print "Compute impossible: mesh is not constructed on geom shape."
- return 0
+ geom = self.mesh.GetShapeToMesh()
else:
geom = self.geom
ok = False
import traceback
print "Mesh computation failed, exception caught:"
traceback.print_exc()
- if not ok:
+ if True:#not ok:
errors = self.smeshpyD.GetAlgoState( self.mesh, geom )
allReasons = ""
for err in errors:
reason = ('Hypothesis of %s %sD algorithm "%s" has a bad parameter value'
% ( glob, dim, name ))
elif err.state == HYP_BAD_GEOMETRY:
- reason = ('%s %sD algorithm "%s" is assigned to geometry mismatching'
- 'its expectation' % ( glob, dim, name ))
+ reason = ('%s %sD algorithm "%s" is assigned to mismatching'
+ 'geometry' % ( glob, dim, name ))
else:
reason = "For unknown reason."+\
" Revise Mesh.Compute() implementation in smeshDC.py!"
if allReasons != "":
print '"' + GetName(self.mesh) + '"',"has not been computed:"
print allReasons
- else:
+ ok = False
+ elif not ok:
print '"' + GetName(self.mesh) + '"',"has not been computed."
pass
pass
pass
return ok
- ## Compute tetrahedral mesh using AutomaticLength + MEFISTO + NETGEN
- # The parameter \a fineness [0,-1] defines mesh fineness
+ ## Removes all nodes and elements
+ # @ingroup l2_construct
+ def Clear(self):
+ self.mesh.Clear()
+ if salome.sg.hasDesktop():
+ smeshgui = salome.ImportComponentGUI("SMESH")
+ smeshgui.Init(salome.myStudyId)
+ smeshgui.SetMeshIcon( salome.ObjectToID( self.mesh ), False, True )
+ salome.sg.updateObjBrowser(1)
+
+ ## Computes a tetrahedral mesh using AutomaticLength + MEFISTO + NETGEN
+ # @param fineness [0,-1] defines mesh fineness
# @return True or False
+ # @ingroup l3_algos_basic
def AutomaticTetrahedralization(self, fineness=0):
dim = self.MeshDimension()
# assign hypotheses
pass
return self.Compute()
- ## Compute hexahedral mesh using AutomaticLength + Quadrangle + Hexahedron
- # The parameter \a fineness [0,-1] defines mesh fineness
+ ## Computes an hexahedral mesh using AutomaticLength + Quadrangle + Hexahedron
+ # @param fineness [0,-1] defines mesh fineness
# @return True or False
+ # @ingroup l3_algos_basic
def AutomaticHexahedralization(self, fineness=0):
dim = self.MeshDimension()
- # assign hypotheses
+ # assign the hypotheses
self.RemoveGlobalHypotheses()
self.Segment().AutomaticLength(fineness)
if dim > 1 :
pass
return self.Compute()
- ## Assign hypothesis
- # @param hyp is a hypothesis to assign
- # @param geom is subhape of mesh geometry
+ ## Assigns a hypothesis
+ # @param hyp a hypothesis to assign
+ # @param geom a subhape of mesh geometry
# @return SMESH.Hypothesis_Status
+ # @ingroup l2_hypotheses
def AddHypothesis(self, hyp, geom=0):
if isinstance( hyp, Mesh_Algorithm ):
hyp = hyp.GetAlgorithm()
pass
if not geom:
geom = self.geom
+ if not geom:
+ geom = self.mesh.GetShapeToMesh()
pass
status = self.mesh.AddHypothesis(geom, hyp)
isAlgo = hyp._narrow( SMESH_Algo )
TreatHypoStatus( status, GetName( hyp ), GetName( geom ), isAlgo )
return status
- ## Unassign hypothesis
- # @param hyp is a hypothesis to unassign
- # @param geom is subhape of mesh geometry
+ ## Unassigns a hypothesis
+ # @param hyp a hypothesis to unassign
+ # @param geom a subshape of mesh geometry
# @return SMESH.Hypothesis_Status
+ # @ingroup l2_hypotheses
def RemoveHypothesis(self, hyp, geom=0):
if isinstance( hyp, Mesh_Algorithm ):
hyp = hyp.GetAlgorithm()
status = self.mesh.RemoveHypothesis(geom, hyp)
return status
- ## Get the list of hypothesis added on a geom
- # @param geom is subhape of mesh geometry
- # @return sequence of SMESH_Hypothesis
+ ## Gets the list of hypotheses added on a geometry
+ # @param geom a subshape of mesh geometry
+ # @return the sequence of SMESH_Hypothesis
+ # @ingroup l2_hypotheses
def GetHypothesisList(self, geom):
return self.mesh.GetHypothesisList( geom )
## Removes all global hypotheses
+ # @ingroup l2_hypotheses
def RemoveGlobalHypotheses(self):
current_hyps = self.mesh.GetHypothesisList( self.geom )
for hyp in current_hyps:
pass
pass
- ## Create a mesh group based on geometric object \a grp
- # and give a \a name, \n if this parameter is not defined
+ ## Creates a mesh group based on the geometric object \a grp
+ # and gives a \a name, \n if this parameter is not defined
# the name is the same as the geometric group name \n
# Note: Works like GroupOnGeom().
- # @param grp is a geometric group, a vertex, an edge, a face or a solid
- # @param name is the name of the mesh group
+ # @param grp a geometric group, a vertex, an edge, a face or a solid
+ # @param name the name of the mesh group
# @return SMESH_GroupOnGeom
+ # @ingroup l2_grps_create
def Group(self, grp, name=""):
return self.GroupOnGeom(grp, name)
- ## Deprecated, only for compatibility! Please, use ExportMED() method instead.
- # Export the mesh in a file with the MED format and choice the \a version of MED format
- # @param f is the file name
+ ## Deprecated, used only for compatibility! Please, use ExportMED() method instead.
+ # Exports the mesh in a file in MED format and chooses the \a version of MED format
+ # @param f the file name
# @param version values are SMESH.MED_V2_1, SMESH.MED_V2_2
+ # @ingroup l2_impexp
def ExportToMED(self, f, version, opt=0):
self.mesh.ExportToMED(f, opt, version)
- ## Export the mesh in a file with the MED format
+ ## Exports the mesh in a file in MED format
# @param f is the file name
# @param auto_groups boolean parameter for creating/not creating
# the groups Group_On_All_Nodes, Group_On_All_Faces, ... ;
# the typical use is auto_groups=false.
# @param version MED format version(MED_V2_1 or MED_V2_2)
+ # @ingroup l2_impexp
def ExportMED(self, f, auto_groups=0, version=MED_V2_2):
self.mesh.ExportToMED(f, auto_groups, version)
- ## Export the mesh in a file with the DAT format
- # @param f is the file name
+ ## Exports the mesh in a file in DAT format
+ # @param f the file name
+ # @ingroup l2_impexp
def ExportDAT(self, f):
self.mesh.ExportDAT(f)
- ## Export the mesh in a file with the UNV format
- # @param f is the file name
+ ## Exports the mesh in a file in UNV format
+ # @param f the file name
+ # @ingroup l2_impexp
def ExportUNV(self, f):
self.mesh.ExportUNV(f)
- ## Export the mesh in a file with the STL format
- # @param f is the file name
- # @param ascii defined the kind of file contents
+ ## Export the mesh in a file in STL format
+ # @param f the file name
+ # @param ascii defines the file encoding
+ # @ingroup l2_impexp
def ExportSTL(self, f, ascii=1):
self.mesh.ExportSTL(f, ascii)
# ----------------------
## Creates an empty mesh group
- # @param elementType is the type of elements in the group
- # @param name is the name of the mesh group
+ # @param elementType the type of elements in the group
+ # @param name the name of the mesh group
# @return SMESH_Group
+ # @ingroup l2_grps_create
def CreateEmptyGroup(self, elementType, name):
return self.mesh.CreateGroup(elementType, name)
- ## Creates a mesh group based on geometric object \a grp
- # and give a \a name, \n if this parameter is not defined
- # the name is the same as the geometric group name
- # @param grp is a geometric group, a vertex, an edge, a face or a solid
- # @param name is the name of the mesh group
+ ## Creates a mesh group based on the geometrical object \a grp
+ # and gives a \a name, \n if this parameter is not defined
+ # the name is the same as the geometrical group name
+ # @param grp a geometrical group, a vertex, an edge, a face or a solid
+ # @param name the name of the mesh group
+ # @param typ the type of elements in the group. If not set, it is
+ # automatically detected by the type of the geometry
# @return SMESH_GroupOnGeom
+ # @ingroup l2_grps_create
def GroupOnGeom(self, grp, name="", typ=None):
if name == "":
name = grp.GetName()
else:
return self.mesh.CreateGroupFromGEOM(typ, name, grp)
- ## Create a mesh group by the given ids of elements
- # @param groupName is the name of the mesh group
- # @param elementType is the type of elements in the group
- # @param elemIDs is the list of ids
+ ## Creates a mesh group by the given ids of elements
+ # @param groupName the name of the mesh group
+ # @param elementType the type of elements in the group
+ # @param elemIDs the list of ids
# @return SMESH_Group
+ # @ingroup l2_grps_create
def MakeGroupByIds(self, groupName, elementType, elemIDs):
group = self.mesh.CreateGroup(elementType, groupName)
group.Add(elemIDs)
return group
- ## Create a mesh group by the given conditions
- # @param groupName is the name of the mesh group
- # @param elementType is the type of elements in the group
- # @param CritType is type of criterion( FT_Taper, FT_Area, FT_RangeOfIds, FT_LyingOnGeom etc. )
- # @param Compare belong to {FT_LessThan, FT_MoreThan, FT_EqualTo}
- # @param Treshold is threshold value (range of id ids as string, shape, numeric)
- # @param UnaryOp is FT_LogicalNOT or FT_Undefined
+ ## Creates a mesh group by the given conditions
+ # @param groupName the name of the mesh group
+ # @param elementType the type of elements in the group
+ # @param CritType the type of criterion( FT_Taper, FT_Area, FT_RangeOfIds, FT_LyingOnGeom etc. )
+ # @param Compare belongs to {FT_LessThan, FT_MoreThan, FT_EqualTo}
+ # @param Treshold the threshold value (range of id ids as string, shape, numeric)
+ # @param UnaryOp FT_LogicalNOT or FT_Undefined
# @return SMESH_Group
+ # @ingroup l2_grps_create
def MakeGroup(self,
groupName,
elementType,
group = self.MakeGroupByCriterion(groupName, aCriterion)
return group
- ## Create a mesh group by the given criterion
- # @param groupName is the name of the mesh group
- # @param Criterion is the instance of Criterion class
+ ## Creates a mesh group by the given criterion
+ # @param groupName the name of the mesh group
+ # @param Criterion the instance of Criterion class
# @return SMESH_Group
+ # @ingroup l2_grps_create
def MakeGroupByCriterion(self, groupName, Criterion):
aFilterMgr = self.smeshpyD.CreateFilterManager()
aFilter = aFilterMgr.CreateFilter()
group = self.MakeGroupByFilter(groupName, aFilter)
return group
- ## Create a mesh group by the given criteria(list of criterions)
- # @param groupName is the name of the mesh group
- # @param Criteria is the list of criterions
+ ## Creates a mesh group by the given criteria (list of criteria)
+ # @param groupName the name of the mesh group
+ # @param theCriteria the list of criteria
# @return SMESH_Group
+ # @ingroup l2_grps_create
def MakeGroupByCriteria(self, groupName, theCriteria):
aFilterMgr = self.smeshpyD.CreateFilterManager()
aFilter = aFilterMgr.CreateFilter()
group = self.MakeGroupByFilter(groupName, aFilter)
return group
- ## Create a mesh group by the given filter
- # @param groupName is the name of the mesh group
- # @param Criterion is the instance of Filter class
+ ## Creates a mesh group by the given filter
+ # @param groupName the name of the mesh group
+ # @param theFilter the instance of Filter class
# @return SMESH_Group
+ # @ingroup l2_grps_create
def MakeGroupByFilter(self, groupName, theFilter):
anIds = theFilter.GetElementsId(self.mesh)
anElemType = theFilter.GetElementType()
group = self.MakeGroupByIds(groupName, anElemType, anIds)
return group
- ## Pass mesh elements through the given filter and return ids
- # @param theFilter is SMESH_Filter
- # @return list of ids
+ ## Passes mesh elements through the given filter and return IDs of fitting elements
+ # @param theFilter SMESH_Filter
+ # @return a list of ids
+ # @ingroup l1_controls
def GetIdsFromFilter(self, theFilter):
return theFilter.GetElementsId(self.mesh)
- ## Verify whether 2D mesh element has free edges(edges connected to one face only)\n
- # Returns list of special structures(borders).
- # @return list of SMESH.FreeEdges.Border structure: edge id and two its nodes ids.
+ ## Verifies whether a 2D mesh element has free edges (edges connected to one face only)\n
+ # Returns a list of special structures (borders).
+ # @return a list of SMESH.FreeEdges.Border structure: edge id and ids of two its nodes.
+ # @ingroup l1_controls
def GetFreeBorders(self):
aFilterMgr = self.smeshpyD.CreateFilterManager()
aPredicate = aFilterMgr.CreateFreeEdges()
aBorders = aPredicate.GetBorders()
return aBorders
- ## Remove a group
+ ## Removes a group
+ # @ingroup l2_grps_delete
def RemoveGroup(self, group):
self.mesh.RemoveGroup(group)
- ## Remove group with its contents
+ ## Removes a group with its contents
+ # @ingroup l2_grps_delete
def RemoveGroupWithContents(self, group):
self.mesh.RemoveGroupWithContents(group)
- ## Get the list of groups existing in the mesh
- # @return sequence of SMESH_GroupBase
+ ## Gets the list of groups existing in the mesh
+ # @return a sequence of SMESH_GroupBase
+ # @ingroup l2_grps_create
def GetGroups(self):
return self.mesh.GetGroups()
- ## Get number of groups existing in the mesh
- # @return quantity of groups as an integer value
+ ## Gets the number of groups existing in the mesh
+ # @return the quantity of groups as an integer value
+ # @ingroup l2_grps_create
def NbGroups(self):
return self.mesh.NbGroups()
- ## Get the list of names of groups existing in the mesh
+ ## Gets the list of names of groups existing in the mesh
# @return list of strings
+ # @ingroup l2_grps_create
def GetGroupNames(self):
groups = self.GetGroups()
names = []
names.append(group.GetName())
return names
- ## Union of two groups
- # New group is created. All mesh elements that are
- # present in initial groups are added to the new one
+ ## Produces a union of two groups
+ # A new group is created. All mesh elements that are
+ # present in the initial groups are added to the new one
# @return an instance of SMESH_Group
+ # @ingroup l2_grps_operon
def UnionGroups(self, group1, group2, name):
return self.mesh.UnionGroups(group1, group2, name)
- ## Intersection of two groups
- # New group is created. All mesh elements that are
- # present in both initial groups are added to the new one.
+ ## Prodices an intersection of two groups
+ # A new group is created. All mesh elements that are common
+ # for the two initial groups are added to the new one.
# @return an instance of SMESH_Group
+ # @ingroup l2_grps_operon
def IntersectGroups(self, group1, group2, name):
return self.mesh.IntersectGroups(group1, group2, name)
- ## Cut of two groups
- # New group is created. All mesh elements that are present in
- # main group but do not present in tool group are added to the new one
+ ## Produces a cut of two groups
+ # A new group is created. All mesh elements that are present in
+ # the main group but are not present in the tool group are added to the new one
# @return an instance of SMESH_Group
+ # @ingroup l2_grps_operon
def CutGroups(self, mainGroup, toolGroup, name):
return self.mesh.CutGroups(mainGroup, toolGroup, name)
# Get some info about mesh:
# ------------------------
- ## Get the log of nodes and elements added or removed since previous
- # clear of the log.
+ ## Returns the log of nodes and elements added or removed
+ # since the previous clear of the log.
# @param clearAfterGet log is emptied after Get (safe if concurrents access)
# @return list of log_block structures:
# commandType
# number
# coords
# indexes
+ # @ingroup l1_auxiliary
def GetLog(self, clearAfterGet):
return self.mesh.GetLog(clearAfterGet)
- ## Clear the log of nodes and elements added or removed since previous
+ ## Clears the log of nodes and elements added or removed since the previous
# clear. Must be used immediately after GetLog if clearAfterGet is false.
+ # @ingroup l1_auxiliary
def ClearLog(self):
self.mesh.ClearLog()
- ## Toggle auto color mode on the object.
- # @param theAutoColor flag which toggles auto color mode.
+ ## Toggles auto color mode on the object.
+ # @param theAutoColor the flag which toggles auto color mode.
+ # @ingroup l1_auxiliary
def SetAutoColor(self, theAutoColor):
self.mesh.SetAutoColor(theAutoColor)
- ## Get flag of object auto color mode.
+ ## Gets flag of object auto color mode.
# @return True or False
+ # @ingroup l1_auxiliary
def GetAutoColor(self):
return self.mesh.GetAutoColor()
- ## Get the internal Id
+ ## Gets the internal ID
# @return integer value, which is the internal Id of the mesh
+ # @ingroup l1_auxiliary
def GetId(self):
return self.mesh.GetId()
## Get the study Id
# @return integer value, which is the study Id of the mesh
+ # @ingroup l1_auxiliary
def GetStudyId(self):
return self.mesh.GetStudyId()
- ## Check group names for duplications.
- # Consider maximum group name length stored in MED file.
+ ## Checks the group names for duplications.
+ # Consider the maximum group name length stored in MED file.
# @return True or False
+ # @ingroup l1_auxiliary
def HasDuplicatedGroupNamesMED(self):
return self.mesh.HasDuplicatedGroupNamesMED()
- ## Obtain mesh editor tool
+ ## Obtains the mesh editor tool
# @return an instance of SMESH_MeshEditor
+ # @ingroup l1_modifying
def GetMeshEditor(self):
return self.mesh.GetMeshEditor()
- ## Get MED Mesh
+ ## Gets MED Mesh
# @return an instance of SALOME_MED::MESH
+ # @ingroup l1_auxiliary
def GetMEDMesh(self):
return self.mesh.GetMEDMesh()
# Get informations about mesh contents:
# ------------------------------------
- ## Returns number of nodes in mesh
+ ## Returns the number of nodes in the mesh
# @return an integer value
+ # @ingroup l1_meshinfo
def NbNodes(self):
return self.mesh.NbNodes()
- ## Returns number of elements in mesh
+ ## Returns the number of elements in the mesh
# @return an integer value
+ # @ingroup l1_meshinfo
def NbElements(self):
return self.mesh.NbElements()
- ## Returns number of edges in mesh
+ ## Returns the number of edges in the mesh
# @return an integer value
+ # @ingroup l1_meshinfo
def NbEdges(self):
return self.mesh.NbEdges()
- ## Returns number of edges with given order in mesh
- # @param elementOrder is order of elements:
+ ## Returns the number of edges with the given order in the mesh
+ # @param elementOrder the order of elements:
# ORDER_ANY, ORDER_LINEAR or ORDER_QUADRATIC
# @return an integer value
+ # @ingroup l1_meshinfo
def NbEdgesOfOrder(self, elementOrder):
return self.mesh.NbEdgesOfOrder(elementOrder)
- ## Returns number of faces in mesh
+ ## Returns the number of faces in the mesh
# @return an integer value
+ # @ingroup l1_meshinfo
def NbFaces(self):
return self.mesh.NbFaces()
- ## Returns number of faces with given order in mesh
- # @param elementOrder is order of elements:
+ ## Returns the number of faces with the given order in the mesh
+ # @param elementOrder the order of elements:
# ORDER_ANY, ORDER_LINEAR or ORDER_QUADRATIC
# @return an integer value
+ # @ingroup l1_meshinfo
def NbFacesOfOrder(self, elementOrder):
return self.mesh.NbFacesOfOrder(elementOrder)
- ## Returns number of triangles in mesh
+ ## Returns the number of triangles in the mesh
# @return an integer value
+ # @ingroup l1_meshinfo
def NbTriangles(self):
return self.mesh.NbTriangles()
- ## Returns number of triangles with given order in mesh
- # @param elementOrder is order of elements:
+ ## Returns the number of triangles with the given order in the mesh
+ # @param elementOrder is the order of elements:
# ORDER_ANY, ORDER_LINEAR or ORDER_QUADRATIC
# @return an integer value
+ # @ingroup l1_meshinfo
def NbTrianglesOfOrder(self, elementOrder):
return self.mesh.NbTrianglesOfOrder(elementOrder)
- ## Returns number of quadrangles in mesh
+ ## Returns the number of quadrangles in the mesh
# @return an integer value
+ # @ingroup l1_meshinfo
def NbQuadrangles(self):
return self.mesh.NbQuadrangles()
- ## Returns number of quadrangles with given order in mesh
- # @param elementOrder is order of elements:
+ ## Returns the number of quadrangles with the given order in the mesh
+ # @param elementOrder the order of elements:
# ORDER_ANY, ORDER_LINEAR or ORDER_QUADRATIC
# @return an integer value
+ # @ingroup l1_meshinfo
def NbQuadranglesOfOrder(self, elementOrder):
return self.mesh.NbQuadranglesOfOrder(elementOrder)
- ## Returns number of polygons in mesh
+ ## Returns the number of polygons in the mesh
# @return an integer value
+ # @ingroup l1_meshinfo
def NbPolygons(self):
return self.mesh.NbPolygons()
- ## Returns number of volumes in mesh
+ ## Returns the number of volumes in the mesh
# @return an integer value
+ # @ingroup l1_meshinfo
def NbVolumes(self):
return self.mesh.NbVolumes()
- ## Returns number of volumes with given order in mesh
- # @param elementOrder is order of elements:
+ ## Returns the number of volumes with the given order in the mesh
+ # @param elementOrder the order of elements:
# ORDER_ANY, ORDER_LINEAR or ORDER_QUADRATIC
# @return an integer value
+ # @ingroup l1_meshinfo
def NbVolumesOfOrder(self, elementOrder):
return self.mesh.NbVolumesOfOrder(elementOrder)
- ## Returns number of tetrahedrons in mesh
+ ## Returns the number of tetrahedrons in the mesh
# @return an integer value
+ # @ingroup l1_meshinfo
def NbTetras(self):
return self.mesh.NbTetras()
- ## Returns number of tetrahedrons with given order in mesh
- # @param elementOrder is order of elements:
+ ## Returns the number of tetrahedrons with the given order in the mesh
+ # @param elementOrder the order of elements:
# ORDER_ANY, ORDER_LINEAR or ORDER_QUADRATIC
# @return an integer value
+ # @ingroup l1_meshinfo
def NbTetrasOfOrder(self, elementOrder):
return self.mesh.NbTetrasOfOrder(elementOrder)
- ## Returns number of hexahedrons in mesh
+ ## Returns the number of hexahedrons in the mesh
# @return an integer value
+ # @ingroup l1_meshinfo
def NbHexas(self):
return self.mesh.NbHexas()
- ## Returns number of hexahedrons with given order in mesh
- # @param elementOrder is order of elements:
+ ## Returns the number of hexahedrons with the given order in the mesh
+ # @param elementOrder the order of elements:
# ORDER_ANY, ORDER_LINEAR or ORDER_QUADRATIC
# @return an integer value
+ # @ingroup l1_meshinfo
def NbHexasOfOrder(self, elementOrder):
return self.mesh.NbHexasOfOrder(elementOrder)
- ## Returns number of pyramids in mesh
+ ## Returns the number of pyramids in the mesh
# @return an integer value
+ # @ingroup l1_meshinfo
def NbPyramids(self):
return self.mesh.NbPyramids()
- ## Returns number of pyramids with given order in mesh
- # @param elementOrder is order of elements:
+ ## Returns the number of pyramids with the given order in the mesh
+ # @param elementOrder the order of elements:
# ORDER_ANY, ORDER_LINEAR or ORDER_QUADRATIC
# @return an integer value
+ # @ingroup l1_meshinfo
def NbPyramidsOfOrder(self, elementOrder):
return self.mesh.NbPyramidsOfOrder(elementOrder)
- ## Returns number of prisms in mesh
+ ## Returns the number of prisms in the mesh
# @return an integer value
+ # @ingroup l1_meshinfo
def NbPrisms(self):
return self.mesh.NbPrisms()
- ## Returns number of prisms with given order in mesh
- # @param elementOrder is order of elements:
+ ## Returns the number of prisms with the given order in the mesh
+ # @param elementOrder the order of elements:
# ORDER_ANY, ORDER_LINEAR or ORDER_QUADRATIC
# @return an integer value
+ # @ingroup l1_meshinfo
def NbPrismsOfOrder(self, elementOrder):
return self.mesh.NbPrismsOfOrder(elementOrder)
- ## Returns number of polyhedrons in mesh
+ ## Returns the number of polyhedrons in the mesh
# @return an integer value
+ # @ingroup l1_meshinfo
def NbPolyhedrons(self):
return self.mesh.NbPolyhedrons()
- ## Returns number of submeshes in mesh
+ ## Returns the number of submeshes in the mesh
# @return an integer value
+ # @ingroup l1_meshinfo
def NbSubMesh(self):
return self.mesh.NbSubMesh()
- ## Returns list of mesh elements ids
- # @return list of integer values
+ ## Returns the list of mesh elements IDs
+ # @return the list of integer values
+ # @ingroup l1_meshinfo
def GetElementsId(self):
return self.mesh.GetElementsId()
- ## Returns list of ids of mesh elements with given type
- # @param elementType is required type of elements
+ ## Returns the list of IDs of mesh elements with the given type
+ # @param elementType the required type of elements
# @return list of integer values
+ # @ingroup l1_meshinfo
def GetElementsByType(self, elementType):
return self.mesh.GetElementsByType(elementType)
- ## Returns list of mesh nodes ids
- # @return list of integer values
+ ## Returns the list of mesh nodes IDs
+ # @return the list of integer values
+ # @ingroup l1_meshinfo
def GetNodesId(self):
return self.mesh.GetNodesId()
- # Get informations about mesh elements:
+ # Get the information about mesh elements:
# ------------------------------------
- ## Returns type of mesh element
- # @return value from SMESH::ElementType enumeration
+ ## Returns the type of mesh element
+ # @return the value from SMESH::ElementType enumeration
+ # @ingroup l1_meshinfo
def GetElementType(self, id, iselem):
return self.mesh.GetElementType(id, iselem)
- ## Returns list of submesh elements ids
- # @param Shape is geom object(subshape) IOR
- # Shape must be subshape of a ShapeToMesh()
- # @return list of integer values
+ ## Returns the list of submesh elements IDs
+ # @param Shape a geom object(subshape) IOR
+ # Shape must be the subshape of a ShapeToMesh()
+ # @return the list of integer values
+ # @ingroup l1_meshinfo
def GetSubMeshElementsId(self, Shape):
if ( isinstance( Shape, geompyDC.GEOM._objref_GEOM_Object)):
ShapeID = Shape.GetSubShapeIndices()[0]
ShapeID = Shape
return self.mesh.GetSubMeshElementsId(ShapeID)
- ## Returns list of submesh nodes ids
- # @param Shape is geom object(subshape) IOR
- # Shape must be subshape of a ShapeToMesh()
- # @return list of integer values
+ ## Returns the list of submesh nodes IDs
+ # @param Shape a geom object(subshape) IOR
+ # Shape must be the subshape of a ShapeToMesh()
+ # @param all If true, gives all nodes of submesh elements, otherwise gives only submesh nodes
+ # @return the list of integer values
+ # @ingroup l1_meshinfo
def GetSubMeshNodesId(self, Shape, all):
if ( isinstance( Shape, geompyDC.GEOM._objref_GEOM_Object)):
ShapeID = Shape.GetSubShapeIndices()[0]
ShapeID = Shape
return self.mesh.GetSubMeshNodesId(ShapeID, all)
- ## Returns list of ids of submesh elements with given type
- # @param Shape is geom object(subshape) IOR
- # Shape must be subshape of a ShapeToMesh()
- # @return list of integer values
+ ## Returns the list of IDs of submesh elements with the given type
+ # @param Shape a geom object(subshape) IOR
+ # Shape must be a subshape of a ShapeToMesh()
+ # @return the list of integer values
+ # @ingroup l1_meshinfo
def GetSubMeshElementType(self, Shape):
if ( isinstance( Shape, geompyDC.GEOM._objref_GEOM_Object)):
ShapeID = Shape.GetSubShapeIndices()[0]
ShapeID = Shape
return self.mesh.GetSubMeshElementType(ShapeID)
- ## Get mesh description
+ ## Gets the mesh description
# @return string value
+ # @ingroup l1_meshinfo
def Dump(self):
return self.mesh.Dump()
- # Get information about nodes and elements of mesh by its ids:
+ # Get the information about nodes and elements of a mesh by its IDs:
# -----------------------------------------------------------
- ## Get XYZ coordinates of node
- # \n If there is not node for given ID - returns empty list
+ ## Gets XYZ coordinates of a node
+ # \n If there is no nodes for the given ID - returns an empty list
# @return a list of double precision values
+ # @ingroup l1_meshinfo
def GetNodeXYZ(self, id):
return self.mesh.GetNodeXYZ(id)
- ## For given node returns list of IDs of inverse elements
- # \n If there is not node for given ID - returns empty list
- # @return list of integer values
+ ## Returns list of IDs of inverse elements for the given node
+ # \n If there is no node for the given ID - returns an empty list
+ # @return a list of integer values
+ # @ingroup l1_meshinfo
def GetNodeInverseElements(self, id):
return self.mesh.GetNodeInverseElements(id)
- ## @brief Return position of a node on shape
+ ## @brief Returns the position of a node on the shape
# @return SMESH::NodePosition
+ # @ingroup l1_meshinfo
def GetNodePosition(self,NodeID):
return self.mesh.GetNodePosition(NodeID)
- ## If given element is node returns IDs of shape from position
- # \n If there is not node for given ID - returns -1
- # @return integer value
+ ## If the given element is a node, returns the ID of shape
+ # \n If there is no node for the given ID - returns -1
+ # @return an integer value
+ # @ingroup l1_meshinfo
def GetShapeID(self, id):
return self.mesh.GetShapeID(id)
- ## For given element returns ID of result shape after
- # FindShape() from SMESH_MeshEditor
- # \n If there is not element for given ID - returns -1
- # @return integer value
+ ## Returns the ID of the result shape after
+ # FindShape() from SMESH_MeshEditor for the given element
+ # \n If there is no element for the given ID - returns -1
+ # @return an integer value
+ # @ingroup l1_meshinfo
def GetShapeIDForElem(self,id):
return self.mesh.GetShapeIDForElem(id)
- ## Returns number of nodes for given element
- # \n If there is not element for given ID - returns -1
- # @return integer value
+ ## Returns the number of nodes for the given element
+ # \n If there is no element for the given ID - returns -1
+ # @return an integer value
+ # @ingroup l1_meshinfo
def GetElemNbNodes(self, id):
return self.mesh.GetElemNbNodes(id)
- ## Returns ID of node by given index for given element
- # \n If there is not element for given ID - returns -1
- # \n If there is not node for given index - returns -2
- # @return integer value
+ ## Returns the node ID the given index for the given element
+ # \n If there is no element for the given ID - returns -1
+ # \n If there is no node for the given index - returns -2
+ # @return an integer value
+ # @ingroup l1_meshinfo
def GetElemNode(self, id, index):
return self.mesh.GetElemNode(id, index)
- ## Returns IDs of nodes of given element
- # @return list of integer values
+ ## Returns the IDs of nodes of the given element
+ # @return a list of integer values
+ # @ingroup l1_meshinfo
def GetElemNodes(self, id):
return self.mesh.GetElemNodes(id)
- ## Returns true if given node is medium node in given quadratic element
+ ## Returns true if the given node is the medium node in the given quadratic element
+ # @ingroup l1_meshinfo
def IsMediumNode(self, elementID, nodeID):
return self.mesh.IsMediumNode(elementID, nodeID)
- ## Returns true if given node is medium node in one of quadratic elements
+ ## Returns true if the given node is the medium node in one of quadratic elements
+ # @ingroup l1_meshinfo
def IsMediumNodeOfAnyElem(self, nodeID, elementType):
return self.mesh.IsMediumNodeOfAnyElem(nodeID, elementType)
- ## Returns number of edges for given element
+ ## Returns the number of edges for the given element
+ # @ingroup l1_meshinfo
def ElemNbEdges(self, id):
return self.mesh.ElemNbEdges(id)
- ## Returns number of faces for given element
+ ## Returns the number of faces for the given element
+ # @ingroup l1_meshinfo
def ElemNbFaces(self, id):
return self.mesh.ElemNbFaces(id)
- ## Returns true if given element is polygon
+ ## Returns true if the given element is a polygon
+ # @ingroup l1_meshinfo
def IsPoly(self, id):
return self.mesh.IsPoly(id)
- ## Returns true if given element is quadratic
+ ## Returns true if the given element is quadratic
+ # @ingroup l1_meshinfo
def IsQuadratic(self, id):
return self.mesh.IsQuadratic(id)
- ## Returns XYZ coordinates of bary center for given element
- # \n If there is not element for given ID - returns empty list
+ ## Returns XYZ coordinates of the barycenter of the given element
+ # \n If there is no element for the given ID - returns an empty list
# @return a list of three double values
+ # @ingroup l1_meshinfo
def BaryCenter(self, id):
return self.mesh.BaryCenter(id)
# Mesh edition (SMESH_MeshEditor functionality):
# ---------------------------------------------
- ## Removes elements from mesh by ids
- # @param IDsOfElements is list of ids of elements to remove
+ ## Removes the elements from the mesh by ids
+ # @param IDsOfElements is a list of ids of elements to remove
# @return True or False
+ # @ingroup l2_modif_del
def RemoveElements(self, IDsOfElements):
return self.editor.RemoveElements(IDsOfElements)
## Removes nodes from mesh by ids
- # @param IDsOfNodes is list of ids of nodes to remove
+ # @param IDsOfNodes is a list of ids of nodes to remove
# @return True or False
+ # @ingroup l2_modif_del
def RemoveNodes(self, IDsOfNodes):
return self.editor.RemoveNodes(IDsOfNodes)
- ## Add node to mesh by coordinates
+ ## Add a node to the mesh by coordinates
# @return Id of the new node
+ # @ingroup l2_modif_add
def AddNode(self, x, y, z):
return self.editor.AddNode( x, y, z)
-
- ## Create edge either linear or quadratic (this is determined
- # by number of given nodes).
- # @param IdsOfNodes List of node IDs for creation of element.
- # Needed order of nodes in this list corresponds to description
+ ## Creates a linear or quadratic edge (this is determined
+ # by the number of given nodes).
+ # @param IDsOfNodes the list of node IDs for creation of the element.
+ # The order of nodes in this list should correspond to the description
# of MED. \n This description is located by the following link:
# http://www.salome-platform.org/salome2/web_med_internet/logiciels/medV2.2.2_doc_html/html/modele_de_donnees.html#3.
- # @return Id of the new edge
+ # @return the Id of the new edge
+ # @ingroup l2_modif_add
def AddEdge(self, IDsOfNodes):
return self.editor.AddEdge(IDsOfNodes)
- ## Create face either linear or quadratic (this is determined
- # by number of given nodes).
- # @param IdsOfNodes List of node IDs for creation of element.
- # Needed order of nodes in this list corresponds to description
+ ## Creates a linear or quadratic face (this is determined
+ # by the number of given nodes).
+ # @param IDsOfNodes the list of node IDs for creation of the element.
+ # The order of nodes in this list should correspond to the description
# of MED. \n This description is located by the following link:
# http://www.salome-platform.org/salome2/web_med_internet/logiciels/medV2.2.2_doc_html/html/modele_de_donnees.html#3.
- # @return Id of the new face
+ # @return the Id of the new face
+ # @ingroup l2_modif_add
def AddFace(self, IDsOfNodes):
return self.editor.AddFace(IDsOfNodes)
- ## Add polygonal face to mesh by list of nodes ids
- # @return Id of the new face
+ ## Adds a polygonal face to the mesh by the list of node IDs
+ # @param IdsOfNodes the list of node IDs for creation of the element.
+ # @return the Id of the new face
+ # @ingroup l2_modif_add
def AddPolygonalFace(self, IdsOfNodes):
return self.editor.AddPolygonalFace(IdsOfNodes)
- ## Create volume both similar and quadratic (this is determed
- # by number of given nodes).
- # @param IdsOfNodes List of node IDs for creation of element.
- # Needed order of nodes in this list corresponds to description
+ ## Creates both simple and quadratic volume (this is determined
+ # by the number of given nodes).
+ # @param IDsOfNodes the list of node IDs for creation of the element.
+ # The order of nodes in this list should correspond to the description
# of MED. \n This description is located by the following link:
# http://www.salome-platform.org/salome2/web_med_internet/logiciels/medV2.2.2_doc_html/html/modele_de_donnees.html#3.
- # @return Id of the new volumic element
+ # @return the Id of the new volumic element
+ # @ingroup l2_modif_add
def AddVolume(self, IDsOfNodes):
return self.editor.AddVolume(IDsOfNodes)
- ## Create volume of many faces, giving nodes for each face.
- # @param IdsOfNodes List of node IDs for volume creation face by face.
- # @param Quantities List of integer values, Quantities[i]
- # gives quantity of nodes in face number i.
- # @return Id of the new volumic element
+ ## Creates a volume of many faces, giving nodes for each face.
+ # @param IdsOfNodes the list of node IDs for volume creation face by face.
+ # @param Quantities the list of integer values, Quantities[i]
+ # gives the quantity of nodes in face number i.
+ # @return the Id of the new volumic element
+ # @ingroup l2_modif_add
def AddPolyhedralVolume (self, IdsOfNodes, Quantities):
return self.editor.AddPolyhedralVolume(IdsOfNodes, Quantities)
- ## Create volume of many faces, giving IDs of existing faces.
- # @param IdsOfFaces List of face IDs for volume creation.
+ ## Creates a volume of many faces, giving the IDs of the existing faces.
+ # @param IdsOfFaces the list of face IDs for volume creation.
#
- # Note: The created volume will refer only to nodes
- # of the given faces, not to the faces itself.
- # @return Id of the new volumic element
+ # Note: The created volume will refer only to the nodes
+ # of the given faces, not to the faces themselves.
+ # @return the Id of the new volumic element
+ # @ingroup l2_modif_add
def AddPolyhedralVolumeByFaces (self, IdsOfFaces):
return self.editor.AddPolyhedralVolumeByFaces(IdsOfFaces)
- ## @brief Bind a node to a vertex
- # @param NodeID - node ID
- # @param Vertex - vertex or vertex ID
- # @return True if succeed else raise an exception
+ ## @brief Binds a node to a vertex
+ # @param NodeID a node ID
+ # @param Vertex a vertex or vertex ID
+ # @return True if succeed else raises an exception
+ # @ingroup l2_modif_add
def SetNodeOnVertex(self, NodeID, Vertex):
if ( isinstance( Vertex, geompyDC.GEOM._objref_GEOM_Object)):
VertexID = Vertex.GetSubShapeIndices()[0]
return True
- ## @brief Store node position on an edge
- # @param NodeID - node ID
- # @param Edge - edge or edge ID
- # @param paramOnEdge - parameter on edge where the node is located
- # @return True if succeed else raise an exception
+ ## @brief Stores the node position on an edge
+ # @param NodeID a node ID
+ # @param Edge an edge or edge ID
+ # @param paramOnEdge a parameter on the edge where the node is located
+ # @return True if succeed else raises an exception
+ # @ingroup l2_modif_add
def SetNodeOnEdge(self, NodeID, Edge, paramOnEdge):
if ( isinstance( Edge, geompyDC.GEOM._objref_GEOM_Object)):
EdgeID = Edge.GetSubShapeIndices()[0]
raise ValueError, inst.details.text
return True
- ## @brief Store node position on a face
- # @param NodeID - node ID
- # @param Face - face or face ID
- # @param u - U parameter on face where the node is located
- # @param v - V parameter on face where the node is located
- # @return True if succeed else raise an exception
+ ## @brief Stores node position on a face
+ # @param NodeID a node ID
+ # @param Face a face or face ID
+ # @param u U parameter on the face where the node is located
+ # @param v V parameter on the face where the node is located
+ # @return True if succeed else raises an exception
+ # @ingroup l2_modif_add
def SetNodeOnFace(self, NodeID, Face, u, v):
if ( isinstance( Face, geompyDC.GEOM._objref_GEOM_Object)):
FaceID = Face.GetSubShapeIndices()[0]
raise ValueError, inst.details.text
return True
- ## @brief Bind a node to a solid
- # @param NodeID - node ID
- # @param Solid - solid or solid ID
- # @return True if succeed else raise an exception
+ ## @brief Binds a node to a solid
+ # @param NodeID a node ID
+ # @param Solid a solid or solid ID
+ # @return True if succeed else raises an exception
+ # @ingroup l2_modif_add
def SetNodeInVolume(self, NodeID, Solid):
if ( isinstance( Solid, geompyDC.GEOM._objref_GEOM_Object)):
SolidID = Solid.GetSubShapeIndices()[0]
return True
## @brief Bind an element to a shape
- # @param ElementID - element ID
- # @param Shape - shape or shape ID
- # @return True if succeed else raise an exception
+ # @param ElementID an element ID
+ # @param Shape a shape or shape ID
+ # @return True if succeed else raises an exception
+ # @ingroup l2_modif_add
def SetMeshElementOnShape(self, ElementID, Shape):
if ( isinstance( Shape, geompyDC.GEOM._objref_GEOM_Object)):
ShapeID = Shape.GetSubShapeIndices()[0]
return True
- ## Move node with given id
- # @param NodeID id of the node
- # @param x new X coordinate
- # @param y new Y coordinate
- # @param z new Z coordinate
+ ## Moves the node with the given id
+ # @param NodeID the id of the node
+ # @param x a new X coordinate
+ # @param y a new Y coordinate
+ # @param z a new Z coordinate
# @return True if succeed else False
+ # @ingroup l2_modif_movenode
def MoveNode(self, NodeID, x, y, z):
return self.editor.MoveNode(NodeID, x, y, z)
- ## Find a node closest to a point
- # @param x X coordinate of a point
- # @param y Y coordinate of a point
- # @param z Z coordinate of a point
- # @return id of a node
+ ## Finds the node closest to a point
+ # @param x the X coordinate of a point
+ # @param y the Y coordinate of a point
+ # @param z the Z coordinate of a point
+ # @return the ID of a node
+ # @ingroup l2_modif_throughp
def FindNodeClosestTo(self, x, y, z):
preview = self.mesh.GetMeshEditPreviewer()
return preview.MoveClosestNodeToPoint(x, y, z, -1)
- ## Find a node closest to a point and move it to a point location
- # @param x X coordinate of a point
- # @param y Y coordinate of a point
- # @param z Z coordinate of a point
- # @return id of a moved node
+ ## Finds the node closest to a point and moves it to a point location
+ # @param x the X coordinate of a point
+ # @param y the Y coordinate of a point
+ # @param z the Z coordinate of a point
+ # @return the ID of a moved node
+ # @ingroup l2_modif_throughp
def MeshToPassThroughAPoint(self, x, y, z):
return self.editor.MoveClosestNodeToPoint(x, y, z, -1)
- ## Replace two neighbour triangles sharing Node1-Node2 link
- # with ones built on the same 4 nodes but having other common link.
- # @param NodeID1 first node id
- # @param NodeID2 second node id
- # @return false if proper faces not found
+ ## Replaces two neighbour triangles sharing Node1-Node2 link
+ # with the triangles built on the same 4 nodes but having other common link.
+ # @param NodeID1 the ID of the first node
+ # @param NodeID2 the ID of the second node
+ # @return false if proper faces were not found
+ # @ingroup l2_modif_invdiag
def InverseDiag(self, NodeID1, NodeID2):
return self.editor.InverseDiag(NodeID1, NodeID2)
- ## Replace two neighbour triangles sharing Node1-Node2 link
+ ## Replaces two neighbour triangles sharing Node1-Node2 link
# with a quadrangle built on the same 4 nodes.
- # @param NodeID1 first node id
- # @param NodeID2 second node id
- # @return false if proper faces not found
+ # @param NodeID1 the ID of the first node
+ # @param NodeID2 the ID of the second node
+ # @return false if proper faces were not found
+ # @ingroup l2_modif_unitetri
def DeleteDiag(self, NodeID1, NodeID2):
return self.editor.DeleteDiag(NodeID1, NodeID2)
- ## Reorient elements by ids
- # @param IDsOfElements if undefined reorient all mesh elements
+ ## Reorients elements by ids
+ # @param IDsOfElements if undefined reorients all mesh elements
# @return True if succeed else False
+ # @ingroup l2_modif_changori
def Reorient(self, IDsOfElements=None):
if IDsOfElements == None:
IDsOfElements = self.GetElementsId()
return self.editor.Reorient(IDsOfElements)
- ## Reorient all elements of the object
- # @param theObject is mesh, submesh or group
+ ## Reorients all elements of the object
+ # @param theObject mesh, submesh or group
# @return True if succeed else False
+ # @ingroup l2_modif_changori
def ReorientObject(self, theObject):
if ( isinstance( theObject, Mesh )):
theObject = theObject.GetMesh()
return self.editor.ReorientObject(theObject)
- ## Fuse neighbour triangles into quadrangles.
+ ## Fuses the neighbouring triangles into quadrangles.
# @param IDsOfElements The triangles to be fused,
- # @param theCriterion is FT_...; used to choose a neighbour to fuse with.
- # @param MaxAngle is a max angle between element normals at which fusion
+ # @param theCriterion is FT_...; used to choose a neighbour to fuse with.
+ # @param MaxAngle is the maximum angle between element normals at which the fusion
# is still performed; theMaxAngle is mesured in radians.
# @return TRUE in case of success, FALSE otherwise.
+ # @ingroup l2_modif_unitetri
def TriToQuad(self, IDsOfElements, theCriterion, MaxAngle):
if IDsOfElements == []:
IDsOfElements = self.GetElementsId()
return self.editor.TriToQuad(IDsOfElements, self.smeshpyD.GetFunctor(theCriterion), MaxAngle)
- ## Fuse neighbour triangles of the object into quadrangles
+ ## Fuses the neighbouring triangles of the object into quadrangles
# @param theObject is mesh, submesh or group
# @param theCriterion is FT_...; used to choose a neighbour to fuse with.
- # @param MaxAngle is a max angle between element normals at which fusion
+ # @param MaxAngle a max angle between element normals at which the fusion
# is still performed; theMaxAngle is mesured in radians.
# @return TRUE in case of success, FALSE otherwise.
+ # @ingroup l2_modif_unitetri
def TriToQuadObject (self, theObject, theCriterion, MaxAngle):
if ( isinstance( theObject, Mesh )):
theObject = theObject.GetMesh()
return self.editor.TriToQuadObject(theObject, self.smeshpyD.GetFunctor(theCriterion), MaxAngle)
- ## Split quadrangles into triangles.
+ ## Splits quadrangles into triangles.
# @param IDsOfElements the faces to be splitted.
- # @param theCriterion is FT_...; used to choose a diagonal for splitting.
+ # @param theCriterion FT_...; used to choose a diagonal for splitting.
# @return TRUE in case of success, FALSE otherwise.
+ # @ingroup l2_modif_cutquadr
def QuadToTri (self, IDsOfElements, theCriterion):
if IDsOfElements == []:
IDsOfElements = self.GetElementsId()
return self.editor.QuadToTri(IDsOfElements, self.smeshpyD.GetFunctor(theCriterion))
- ## Split quadrangles into triangles.
- # @param theObject object to taking list of elements from, is mesh, submesh or group
- # @param theCriterion is FT_...; used to choose a diagonal for splitting.
+ ## Splits quadrangles into triangles.
+ # @param theObject the object from which the list of elements is taken, this is mesh, submesh or group
+ # @param theCriterion FT_...; used to choose a diagonal for splitting.
# @return TRUE in case of success, FALSE otherwise.
+ # @ingroup l2_modif_cutquadr
def QuadToTriObject (self, theObject, theCriterion):
if ( isinstance( theObject, Mesh )):
theObject = theObject.GetMesh()
return self.editor.QuadToTriObject(theObject, self.smeshpyD.GetFunctor(theCriterion))
- ## Split quadrangles into triangles.
- # @param theElems The faces to be splitted
- # @param the13Diag is used to choose a diagonal for splitting.
+ ## Splits quadrangles into triangles.
+ # @param IDsOfElements the faces to be splitted
+ # @param Diag13 is used to choose a diagonal for splitting.
# @return TRUE in case of success, FALSE otherwise.
+ # @ingroup l2_modif_cutquadr
def SplitQuad (self, IDsOfElements, Diag13):
if IDsOfElements == []:
IDsOfElements = self.GetElementsId()
return self.editor.SplitQuad(IDsOfElements, Diag13)
- ## Split quadrangles into triangles.
- # @param theObject is object to taking list of elements from, is mesh, submesh or group
+ ## Splits quadrangles into triangles.
+ # @param theObject the object from which the list of elements is taken, this is mesh, submesh or group
+ # @param Diag13 is used to choose a diagonal for splitting.
# @return TRUE in case of success, FALSE otherwise.
+ # @ingroup l2_modif_cutquadr
def SplitQuadObject (self, theObject, Diag13):
if ( isinstance( theObject, Mesh )):
theObject = theObject.GetMesh()
return self.editor.SplitQuadObject(theObject, Diag13)
- ## Find better splitting of the given quadrangle.
- # @param IDOfQuad ID of the quadrangle to be splitted.
- # @param theCriterion is FT_...; a criterion to choose a diagonal for splitting.
+ ## Finds a better splitting of the given quadrangle.
+ # @param IDOfQuad the ID of the quadrangle to be splitted.
+ # @param theCriterion FT_...; a criterion to choose a diagonal for splitting.
# @return 1 if 1-3 diagonal is better, 2 if 2-4
# diagonal is better, 0 if error occurs.
+ # @ingroup l2_modif_cutquadr
def BestSplit (self, IDOfQuad, theCriterion):
return self.editor.BestSplit(IDOfQuad, self.smeshpyD.GetFunctor(theCriterion))
- ## Split quadrangle faces near triangular facets of volumes
+ ## Splits quadrangle faces near triangular facets of volumes
#
+ # @ingroup l1_auxiliary
def SplitQuadsNearTriangularFacets(self):
faces_array = self.GetElementsByType(SMESH.FACE)
for face_id in faces_array:
isVolumeFound = True
self.SplitQuad([face_id], True) # diagonal 1-3
- ## @brief Split hexahedrons into tetrahedrons.
+ ## @brief Splits hexahedrons into tetrahedrons.
#
- # Use pattern mapping functionality for splitting.
- # @param theObject object to take list of hexahedrons from; is mesh, submesh or group.
- # @param theNode000,theNode001 is in range [0,7]; give an orientation of the
- # pattern relatively each hexahedron: the (0,0,0) key-point of pattern
- # will be mapped into <theNode000>-th node of each volume, the (0,0,1)
- # key-point will be mapped into <theNode001>-th node of each volume.
- # The (0,0,0) key-point of used pattern corresponds to not split corner.
+ # This operation uses pattern mapping functionality for splitting.
+ # @param theObject the object from which the list of hexahedrons is taken; this is mesh, submesh or group.
+ # @param theNode000,theNode001 within the range [0,7]; gives the orientation of the
+ # pattern relatively each hexahedron: the (0,0,0) key-point of the pattern
+ # will be mapped into <VAR>theNode000</VAR>-th node of each volume, the (0,0,1)
+ # key-point will be mapped into <VAR>theNode001</VAR>-th node of each volume.
+ # The (0,0,0) key-point of the used pattern corresponds to a non-split corner.
# @return TRUE in case of success, FALSE otherwise.
+ # @ingroup l1_auxiliary
def SplitHexaToTetras (self, theObject, theNode000, theNode001):
# Pattern: 5.---------.6
# /|#* /|
## @brief Split hexahedrons into prisms.
#
- # Use pattern mapping functionality for splitting.
- # @param theObject object to take list of hexahedrons from; is mesh, submesh or group.
- # @param theNode000,theNode001 is in range [0,7]; give an orientation of the
- # pattern relatively each hexahedron: the (0,0,0) key-point of pattern
- # will be mapped into <theNode000>-th node of each volume, the (0,0,1)
- # key-point will be mapped into <theNode001>-th node of each volume.
- # The edge (0,0,0)-(0,0,1) of used pattern connects two not split corners.
+ # Uses the pattern mapping functionality for splitting.
+ # @param theObject the object (mesh, submesh or group) from where the list of hexahedrons is taken;
+ # @param theNode000,theNode001 (within the range [0,7]) gives the orientation of the
+ # pattern relatively each hexahedron: keypoint (0,0,0) of the pattern
+ # will be mapped into the <VAR>theNode000</VAR>-th node of each volume, keypoint (0,0,1)
+ # will be mapped into the <VAR>theNode001</VAR>-th node of each volume.
+ # Edge (0,0,0)-(0,0,1) of used pattern connects two not split corners.
# @return TRUE in case of success, FALSE otherwise.
+ # @ingroup l1_auxiliary
def SplitHexaToPrisms (self, theObject, theNode000, theNode001):
# Pattern: 5.---------.6
# /|# /|
isDone = pattern.MakeMesh(self.mesh, False, False)
if not isDone: print 'Pattern.MakeMesh :', pattern.GetErrorCode()
- # split quafrangle faces near triangular facets of volumes
+ # Splits quafrangle faces near triangular facets of volumes
self.SplitQuadsNearTriangularFacets()
return isDone
- ## Smooth elements
- # @param IDsOfElements list if ids of elements to smooth
- # @param IDsOfFixedNodes list of ids of fixed nodes.
+ ## Smoothes elements
+ # @param IDsOfElements the list if ids of elements to smooth
+ # @param IDsOfFixedNodes the list of ids of fixed nodes.
# Note that nodes built on edges and boundary nodes are always fixed.
- # @param MaxNbOfIterations maximum number of iterations
+ # @param MaxNbOfIterations the maximum number of iterations
# @param MaxAspectRatio varies in range [1.0, inf]
# @param Method is Laplacian(LAPLACIAN_SMOOTH) or Centroidal(CENTROIDAL_SMOOTH)
# @return TRUE in case of success, FALSE otherwise.
+ # @ingroup l2_modif_smooth
def Smooth(self, IDsOfElements, IDsOfFixedNodes,
MaxNbOfIterations, MaxAspectRatio, Method):
if IDsOfElements == []:
return self.editor.Smooth(IDsOfElements, IDsOfFixedNodes,
MaxNbOfIterations, MaxAspectRatio, Method)
- ## Smooth elements belong to given object
- # @param theObject object to smooth
- # @param IDsOfFixedNodes list of ids of fixed nodes.
+ ## Smoothes elements which belong to the given object
+ # @param theObject the object to smooth
+ # @param IDsOfFixedNodes the list of ids of fixed nodes.
# Note that nodes built on edges and boundary nodes are always fixed.
- # @param MaxNbOfIterations maximum number of iterations
+ # @param MaxNbOfIterations the maximum number of iterations
# @param MaxAspectRatio varies in range [1.0, inf]
# @param Method is Laplacian(LAPLACIAN_SMOOTH) or Centroidal(CENTROIDAL_SMOOTH)
# @return TRUE in case of success, FALSE otherwise.
+ # @ingroup l2_modif_smooth
def SmoothObject(self, theObject, IDsOfFixedNodes,
- MaxNbOfIterations, MaxxAspectRatio, Method):
+ MaxNbOfIterations, MaxAspectRatio, Method):
if ( isinstance( theObject, Mesh )):
theObject = theObject.GetMesh()
return self.editor.SmoothObject(theObject, IDsOfFixedNodes,
- MaxNbOfIterations, MaxxAspectRatio, Method)
+ MaxNbOfIterations, MaxAspectRatio, Method)
- ## Parametric smooth the given elements
- # @param IDsOfElements list if ids of elements to smooth
- # @param IDsOfFixedNodes list of ids of fixed nodes.
+ ## Parametrically smoothes the given elements
+ # @param IDsOfElements the list if ids of elements to smooth
+ # @param IDsOfFixedNodes the list of ids of fixed nodes.
# Note that nodes built on edges and boundary nodes are always fixed.
- # @param MaxNbOfIterations maximum number of iterations
+ # @param MaxNbOfIterations the maximum number of iterations
# @param MaxAspectRatio varies in range [1.0, inf]
# @param Method is Laplacian(LAPLACIAN_SMOOTH) or Centroidal(CENTROIDAL_SMOOTH)
# @return TRUE in case of success, FALSE otherwise.
+ # @ingroup l2_modif_smooth
def SmoothParametric(self, IDsOfElements, IDsOfFixedNodes,
MaxNbOfIterations, MaxAspectRatio, Method):
if IDsOfElements == []:
return self.editor.SmoothParametric(IDsOfElements, IDsOfFixedNodes,
MaxNbOfIterations, MaxAspectRatio, Method)
- ## Parametric smooth elements belong to given object
- # @param theObject object to smooth
- # @param IDsOfFixedNodes list of ids of fixed nodes.
+ ## Parametrically smoothes the elements which belong to the given object
+ # @param theObject the object to smooth
+ # @param IDsOfFixedNodes the list of ids of fixed nodes.
# Note that nodes built on edges and boundary nodes are always fixed.
- # @param MaxNbOfIterations maximum number of iterations
+ # @param MaxNbOfIterations the maximum number of iterations
# @param MaxAspectRatio varies in range [1.0, inf]
- # @param Method is Laplacian(LAPLACIAN_SMOOTH) or Centroidal(CENTROIDAL_SMOOTH)
+ # @param Method Laplacian(LAPLACIAN_SMOOTH) or Centroidal(CENTROIDAL_SMOOTH)
# @return TRUE in case of success, FALSE otherwise.
+ # @ingroup l2_modif_smooth
def SmoothParametricObject(self, theObject, IDsOfFixedNodes,
MaxNbOfIterations, MaxAspectRatio, Method):
if ( isinstance( theObject, Mesh )):
return self.editor.SmoothParametricObject(theObject, IDsOfFixedNodes,
MaxNbOfIterations, MaxAspectRatio, Method)
- ## Converts all mesh to quadratic one, deletes old elements, replacing
- # them with quadratic ones with the same id.
+ ## Converts the mesh to quadratic, deletes old elements, replacing
+ # them with quadratic with the same id.
+ # @ingroup l2_modif_tofromqu
def ConvertToQuadratic(self, theForce3d):
self.editor.ConvertToQuadratic(theForce3d)
- ## Converts all mesh from quadratic to ordinary ones,
+ ## Converts the mesh from quadratic to ordinary,
# deletes old quadratic elements, \n replacing
# them with ordinary mesh elements with the same id.
# @return TRUE in case of success, FALSE otherwise.
+ # @ingroup l2_modif_tofromqu
def ConvertFromQuadratic(self):
return self.editor.ConvertFromQuadratic()
## Renumber mesh nodes
+ # @ingroup l2_modif_renumber
def RenumberNodes(self):
self.editor.RenumberNodes()
## Renumber mesh elements
+ # @ingroup l2_modif_renumber
def RenumberElements(self):
self.editor.RenumberElements()
- ## Generate new elements by rotation of the elements around the axis
- # @param IDsOfElements list of ids of elements to sweep
- # @param Axix axis of rotation, AxisStruct or line(geom object)
- # @param AngleInRadians angle of Rotation
- # @param NbOfSteps number of steps
+ ## Generates new elements by rotation of the elements around the axis
+ # @param IDsOfElements the list of ids of elements to sweep
+ # @param Axis the axis of rotation, AxisStruct or line(geom object)
+ # @param AngleInRadians the angle of Rotation
+ # @param NbOfSteps the number of steps
# @param Tolerance tolerance
- # @param MakeGroups to generate new groups from existing ones
- # @param TotalAngle gives meaning of AngleInRadians: if True then it is an anglular size
- # of all steps, else - size of each step
- # @return list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise
- def RotationSweep(self, IDsOfElements, Axix, AngleInRadians, NbOfSteps, Tolerance,
+ # @param MakeGroups forces the generation of new groups from existing ones
+ # @param TotalAngle gives meaning of AngleInRadians: if True then it is an angular size
+ # of all steps, else - size of each step
+ # @return the list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise
+ # @ingroup l2_modif_extrurev
+ def RotationSweep(self, IDsOfElements, Axis, AngleInRadians, NbOfSteps, Tolerance,
MakeGroups=False, TotalAngle=False):
if IDsOfElements == []:
IDsOfElements = self.GetElementsId()
- if ( isinstance( Axix, geompyDC.GEOM._objref_GEOM_Object)):
- Axix = self.smeshpyD.GetAxisStruct(Axix)
+ if ( isinstance( Axis, geompyDC.GEOM._objref_GEOM_Object)):
+ Axis = self.smeshpyD.GetAxisStruct(Axis)
if TotalAngle and NbOfSteps:
AngleInRadians /= NbOfSteps
if MakeGroups:
- return self.editor.RotationSweepMakeGroups(IDsOfElements, Axix,
+ return self.editor.RotationSweepMakeGroups(IDsOfElements, Axis,
AngleInRadians, NbOfSteps, Tolerance)
- self.editor.RotationSweep(IDsOfElements, Axix, AngleInRadians, NbOfSteps, Tolerance)
+ self.editor.RotationSweep(IDsOfElements, Axis, AngleInRadians, NbOfSteps, Tolerance)
return []
- ## Generate new elements by rotation of the elements of object around the axis
- # @param theObject object wich elements should be sweeped
- # @param Axix axis of rotation, AxisStruct or line(geom object)
- # @param AngleInRadians angle of Rotation
+ ## Generates new elements by rotation of the elements of object around the axis
+ # @param theObject object which elements should be sweeped
+ # @param Axis the axis of rotation, AxisStruct or line(geom object)
+ # @param AngleInRadians the angle of Rotation
# @param NbOfSteps number of steps
# @param Tolerance tolerance
- # @param MakeGroups to generate new groups from existing ones
- # @param TotalAngle gives meaning of AngleInRadians: if True then it is an anglular size
- # of all steps, else - size of each step
- # @return list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise
- def RotationSweepObject(self, theObject, Axix, AngleInRadians, NbOfSteps, Tolerance,
+ # @param MakeGroups forces the generation of new groups from existing ones
+ # @param TotalAngle gives meaning of AngleInRadians: if True then it is an angular size
+ # of all steps, else - size of each step
+ # @return the list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise
+ # @ingroup l2_modif_extrurev
+ def RotationSweepObject(self, theObject, Axis, AngleInRadians, NbOfSteps, Tolerance,
MakeGroups=False, TotalAngle=False):
if ( isinstance( theObject, Mesh )):
theObject = theObject.GetMesh()
- if ( isinstance( Axix, geompyDC.GEOM._objref_GEOM_Object)):
- Axix = self.smeshpyD.GetAxisStruct(Axix)
+ if ( isinstance( Axis, geompyDC.GEOM._objref_GEOM_Object)):
+ Axis = self.smeshpyD.GetAxisStruct(Axis)
if TotalAngle and NbOfSteps:
AngleInRadians /= NbOfSteps
if MakeGroups:
- return self.editor.RotationSweepObjectMakeGroups(theObject, Axix, AngleInRadians,
+ return self.editor.RotationSweepObjectMakeGroups(theObject, Axis, AngleInRadians,
NbOfSteps, Tolerance)
- self.editor.RotationSweepObject(theObject, Axix, AngleInRadians, NbOfSteps, Tolerance)
+ self.editor.RotationSweepObject(theObject, Axis, AngleInRadians, NbOfSteps, Tolerance)
return []
- ## Generate new elements by extrusion of the elements with given ids
- # @param IDsOfElements list of elements ids for extrusion
+ ## Generates new elements by extrusion of the elements with given ids
+ # @param IDsOfElements the list of elements ids for extrusion
# @param StepVector vector, defining the direction and value of extrusion
# @param NbOfSteps the number of steps
- # @param MakeGroups to generate new groups from existing ones
- # @return list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise
+ # @param MakeGroups forces the generation of new groups from existing ones
+ # @return the list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise
+ # @ingroup l2_modif_extrurev
def ExtrusionSweep(self, IDsOfElements, StepVector, NbOfSteps, MakeGroups=False):
if IDsOfElements == []:
IDsOfElements = self.GetElementsId()
self.editor.ExtrusionSweep(IDsOfElements, StepVector, NbOfSteps)
return []
- ## Generate new elements by extrusion of the elements with given ids
+ ## Generates new elements by extrusion of the elements with given ids
# @param IDsOfElements is ids of elements
# @param StepVector vector, defining the direction and value of extrusion
# @param NbOfSteps the number of steps
- # @param ExtrFlags set flags for performing extrusion
+ # @param ExtrFlags sets flags for extrusion
# @param SewTolerance uses for comparing locations of nodes if flag
# EXTRUSION_FLAG_SEW is set
- # @param MakeGroups to generate new groups from existing ones
+ # @param MakeGroups forces the generation of new groups from existing ones
# @return list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise
- def AdvancedExtrusion(self, IDsOfElements, StepVector, NbOfSteps, ExtrFlags, SewTolerance, MakeGroups=False):
+ # @ingroup l2_modif_extrurev
+ def AdvancedExtrusion(self, IDsOfElements, StepVector, NbOfSteps,
+ ExtrFlags, SewTolerance, MakeGroups=False):
if ( isinstance( StepVector, geompyDC.GEOM._objref_GEOM_Object)):
StepVector = self.smeshpyD.GetDirStruct(StepVector)
if MakeGroups:
ExtrFlags, SewTolerance)
return []
- ## Generate new elements by extrusion of the elements belong to object
- # @param theObject object wich elements should be processed
+ ## Generates new elements by extrusion of the elements which belong to the object
+ # @param theObject the object which elements should be processed
# @param StepVector vector, defining the direction and value of extrusion
# @param NbOfSteps the number of steps
- # @param MakeGroups to generate new groups from existing ones
+ # @param MakeGroups forces the generation of new groups from existing ones
# @return list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise
+ # @ingroup l2_modif_extrurev
def ExtrusionSweepObject(self, theObject, StepVector, NbOfSteps, MakeGroups=False):
if ( isinstance( theObject, Mesh )):
theObject = theObject.GetMesh()
self.editor.ExtrusionSweepObject(theObject, StepVector, NbOfSteps)
return []
- ## Generate new elements by extrusion of the elements belong to object
- # @param theObject object wich elements should be processed
+ ## Generates new elements by extrusion of the elements which belong to the object
+ # @param theObject object which elements should be processed
# @param StepVector vector, defining the direction and value of extrusion
# @param NbOfSteps the number of steps
# @param MakeGroups to generate new groups from existing ones
# @return list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise
+ # @ingroup l2_modif_extrurev
def ExtrusionSweepObject1D(self, theObject, StepVector, NbOfSteps, MakeGroups=False):
if ( isinstance( theObject, Mesh )):
theObject = theObject.GetMesh()
self.editor.ExtrusionSweepObject1D(theObject, StepVector, NbOfSteps)
return []
- ## Generate new elements by extrusion of the elements belong to object
- # @param theObject object wich elements should be processed
+ ## Generates new elements by extrusion of the elements which belong to the object
+ # @param theObject object which elements should be processed
# @param StepVector vector, defining the direction and value of extrusion
# @param NbOfSteps the number of steps
- # @param MakeGroups to generate new groups from existing ones
+ # @param MakeGroups forces the generation of new groups from existing ones
# @return list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise
+ # @ingroup l2_modif_extrurev
def ExtrusionSweepObject2D(self, theObject, StepVector, NbOfSteps, MakeGroups=False):
if ( isinstance( theObject, Mesh )):
theObject = theObject.GetMesh()
self.editor.ExtrusionSweepObject2D(theObject, StepVector, NbOfSteps)
return []
- ## Generate new elements by extrusion of the given elements
- # A path of extrusion must be a meshed edge.
- # @param IDsOfElements is ids of elements
+ ## Generates new elements by extrusion of the given elements
+ # The path of extrusion must be a meshed edge.
+ # @param IDsOfElements ids of elements
# @param PathMesh mesh containing a 1D sub-mesh on the edge, along which proceeds the extrusion
- # @param PathShape is shape(edge); as the mesh can be complex, the edge is used to define the sub-mesh for the path
- # @param NodeStart the first or the last node on the edge. It is used to define the direction of extrusion
- # @param HasAngles allows the shape to be rotated around the path to get the resulting mesh in a helical fashion
+ # @param PathShape shape(edge) defines the sub-mesh for the path
+ # @param NodeStart the first or the last node on the edge. Defines the direction of extrusion
+ # @param HasAngles allows the shape to be rotated around the path
+ # to get the resulting mesh in a helical fashion
# @param Angles list of angles
- # @param HasRefPoint allows to use base point
- # @param RefPoint point around which the shape is rotated(the mass center of the shape by default).
- # User can specify any point as the Base Point and the shape will be rotated with respect to this point.
- # @param MakeGroups to generate new groups from existing ones
- # @param LinearVariation makes compute rotation angles as linear variation of given Angles along path steps
+ # @param HasRefPoint allows using the reference point
+ # @param RefPoint the point around which the shape is rotated (the mass center of the shape by default).
+ # The User can specify any point as the Reference Point.
+ # @param MakeGroups forces the generation of new groups from existing ones
+ # @param LinearVariation forces the computation of rotation angles as linear
+ # variation of the given Angles along path steps
# @return list of created groups (SMESH_GroupBase) and SMESH::Extrusion_Error if MakeGroups=True,
# only SMESH::Extrusion_Error otherwise
+ # @ingroup l2_modif_extrurev
def ExtrusionAlongPath(self, IDsOfElements, PathMesh, PathShape, NodeStart,
HasAngles, Angles, HasRefPoint, RefPoint,
MakeGroups=False, LinearVariation=False):
return self.editor.ExtrusionAlongPath(IDsOfElements, PathMesh, PathShape,
NodeStart, HasAngles, Angles, HasRefPoint, RefPoint)
- ## Generate new elements by extrusion of the elements belong to object
- # A path of extrusion must be a meshed edge.
- # @param IDsOfElements is ids of elements
- # @param PathMesh mesh containing a 1D sub-mesh on the edge, along which proceeds the extrusion
- # @param PathShape is shape(edge); as the mesh can be complex, the edge is used to define the sub-mesh for the path
- # @param NodeStart the first or the last node on the edge. It is used to define the direction of extrusion
- # @param HasAngles allows the shape to be rotated around the path to get the resulting mesh in a helical fashion
+ ## Generates new elements by extrusion of the elements which belong to the object
+ # The path of extrusion must be a meshed edge.
+ # @param theObject the object which elements should be processed
+ # @param PathMesh mesh containing a 1D sub-mesh on the edge, along which the extrusion proceeds
+ # @param PathShape shape(edge) defines the sub-mesh for the path
+ # @param NodeStart the first or the last node on the edge. Defines the direction of extrusion
+ # @param HasAngles allows the shape to be rotated around the path
+ # to get the resulting mesh in a helical fashion
# @param Angles list of angles
- # @param HasRefPoint allows to use base point
- # @param RefPoint point around which the shape is rotated(the mass center of the shape by default).
- # User can specify any point as the Base Point and the shape will be rotated with respect to this point.
- # @param MakeGroups to generate new groups from existing ones
- # @param LinearVariation makes compute rotation angles as linear variation of given Angles along path steps
+ # @param HasRefPoint allows using the reference point
+ # @param RefPoint the point around which the shape is rotated (the mass center of the shape by default).
+ # The User can specify any point as the Reference Point.
+ # @param MakeGroups forces the generation of new groups from existing ones
+ # @param LinearVariation forces the computation of rotation angles as linear
+ # variation of the given Angles along path steps
# @return list of created groups (SMESH_GroupBase) and SMESH::Extrusion_Error if MakeGroups=True,
# only SMESH::Extrusion_Error otherwise
+ # @ingroup l2_modif_extrurev
def ExtrusionAlongPathObject(self, theObject, PathMesh, PathShape, NodeStart,
HasAngles, Angles, HasRefPoint, RefPoint,
MakeGroups=False, LinearVariation=False):
NodeStart, HasAngles, Angles, HasRefPoint,
RefPoint)
- ## Symmetrical copy of mesh elements
+ ## Creates a symmetrical copy of mesh elements
# @param IDsOfElements list of elements ids
# @param Mirror is AxisStruct or geom object(point, line, plane)
# @param theMirrorType is POINT, AXIS or PLANE
- # If the Mirror is geom object this parameter is unnecessary
- # @param Copy allows to copy element(Copy is 1) or to replace with its mirroring(Copy is 0)
- # @param MakeGroups to generate new groups from existing ones (if Copy)
+ # If the Mirror is a geom object this parameter is unnecessary
+ # @param Copy allows to copy element (Copy is 1) or to replace with its mirroring (Copy is 0)
+ # @param MakeGroups forces the generation of new groups from existing ones (if Copy)
# @return list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise
+ # @ingroup l2_modif_trsf
def Mirror(self, IDsOfElements, Mirror, theMirrorType, Copy=0, MakeGroups=False):
if IDsOfElements == []:
IDsOfElements = self.GetElementsId()
self.editor.Mirror(IDsOfElements, Mirror, theMirrorType, Copy)
return []
- ## Create a new mesh by symmetrical copy of mesh elements
- # @param IDsOfElements list of elements ids
- # @param Mirror is AxisStruct or geom object(point, line, plane)
+ ## Creates a new mesh by a symmetrical copy of mesh elements
+ # @param IDsOfElements the list of elements ids
+ # @param Mirror is AxisStruct or geom object (point, line, plane)
# @param theMirrorType is POINT, AXIS or PLANE
- # If the Mirror is geom object this parameter is unnecessary
+ # If the Mirror is a geom object this parameter is unnecessary
# @param MakeGroups to generate new groups from existing ones
- # @param NewMeshName is a name of new mesh to create
+ # @param NewMeshName a name of the new mesh to create
# @return instance of Mesh class
+ # @ingroup l2_modif_trsf
def MirrorMakeMesh(self, IDsOfElements, Mirror, theMirrorType, MakeGroups=0, NewMeshName=""):
if IDsOfElements == []:
IDsOfElements = self.GetElementsId()
MakeGroups, NewMeshName)
return Mesh(self.smeshpyD,self.geompyD,mesh)
- ## Symmetrical copy of object
+ ## Creates a symmetrical copy of the object
# @param theObject mesh, submesh or group
- # @param Mirror is AxisStruct or geom object(point, line, plane)
+ # @param Mirror AxisStruct or geom object (point, line, plane)
# @param theMirrorType is POINT, AXIS or PLANE
- # If the Mirror is geom object this parameter is unnecessary
- # @param Copy allows to copy element(Copy is 1) or to replace with its mirroring(Copy is 0)
- # @param MakeGroups to generate new groups from existing ones (if Copy)
+ # If the Mirror is a geom object this parameter is unnecessary
+ # @param Copy allows copying the element (Copy is 1) or replacing it with its mirror (Copy is 0)
+ # @param MakeGroups forces the generation of new groups from existing ones (if Copy)
# @return list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise
+ # @ingroup l2_modif_trsf
def MirrorObject (self, theObject, Mirror, theMirrorType, Copy=0, MakeGroups=False):
if ( isinstance( theObject, Mesh )):
theObject = theObject.GetMesh()
self.editor.MirrorObject(theObject, Mirror, theMirrorType, Copy)
return []
- ## Create a new mesh by symmetrical copy of object
+ ## Creates a new mesh by a symmetrical copy of the object
# @param theObject mesh, submesh or group
- # @param Mirror is AxisStruct or geom object(point, line, plane)
- # @param theMirrorType is POINT, AXIS or PLANE
- # If the Mirror is geom object this parameter is unnecessary
- # @param MakeGroups to generate new groups from existing ones
- # @param NewMeshName is a name of new mesh to create
+ # @param Mirror AxisStruct or geom object (point, line, plane)
+ # @param theMirrorType POINT, AXIS or PLANE
+ # If the Mirror is a geom object this parameter is unnecessary
+ # @param MakeGroups forces the generation of new groups from existing ones
+ # @param NewMeshName the name of the new mesh to create
# @return instance of Mesh class
+ # @ingroup l2_modif_trsf
def MirrorObjectMakeMesh (self, theObject, Mirror, theMirrorType,MakeGroups=0, NewMeshName=""):
if ( isinstance( theObject, Mesh )):
theObject = theObject.GetMesh()
## Translates the elements
# @param IDsOfElements list of elements ids
- # @param Vector direction of translation(DirStruct or vector)
- # @param Copy allows to copy the translated elements
- # @param MakeGroups to generate new groups from existing ones (if Copy)
+ # @param Vector the direction of translation (DirStruct or vector)
+ # @param Copy allows copying the translated elements
+ # @param MakeGroups forces the generation of new groups from existing ones (if Copy)
# @return list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise
+ # @ingroup l2_modif_trsf
def Translate(self, IDsOfElements, Vector, Copy, MakeGroups=False):
if IDsOfElements == []:
IDsOfElements = self.GetElementsId()
self.editor.Translate(IDsOfElements, Vector, Copy)
return []
- ## Create a new mesh of translated elements
+ ## Creates a new mesh of translated elements
# @param IDsOfElements list of elements ids
- # @param Vector direction of translation(DirStruct or vector)
- # @param MakeGroups to generate new groups from existing ones
- # @param NewMeshName is a name of new mesh to create
+ # @param Vector the direction of translation (DirStruct or vector)
+ # @param MakeGroups forces the generation of new groups from existing ones
+ # @param NewMeshName the name of the newly created mesh
# @return instance of Mesh class
+ # @ingroup l2_modif_trsf
def TranslateMakeMesh(self, IDsOfElements, Vector, MakeGroups=False, NewMeshName=""):
if IDsOfElements == []:
IDsOfElements = self.GetElementsId()
return Mesh ( self.smeshpyD, self.geompyD, mesh )
## Translates the object
- # @param theObject object to translate(mesh, submesh, or group)
- # @param Vector direction of translation(DirStruct or geom vector)
- # @param Copy allows to copy the translated elements
- # @param MakeGroups to generate new groups from existing ones (if Copy)
+ # @param theObject the object to translate (mesh, submesh, or group)
+ # @param Vector direction of translation (DirStruct or geom vector)
+ # @param Copy allows copying the translated elements
+ # @param MakeGroups forces the generation of new groups from existing ones (if Copy)
# @return list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise
+ # @ingroup l2_modif_trsf
def TranslateObject(self, theObject, Vector, Copy, MakeGroups=False):
if ( isinstance( theObject, Mesh )):
theObject = theObject.GetMesh()
self.editor.TranslateObject(theObject, Vector, Copy)
return []
- ## Create a new mesh from translated object
- # @param theObject object to translate(mesh, submesh, or group)
- # @param Vector direction of translation(DirStruct or geom vector)
- # @param MakeGroups to generate new groups from existing ones
- # @param NewMeshName is a name of new mesh to create
+ ## Creates a new mesh from the translated object
+ # @param theObject the object to translate (mesh, submesh, or group)
+ # @param Vector the direction of translation (DirStruct or geom vector)
+ # @param MakeGroups forces the generation of new groups from existing ones
+ # @param NewMeshName the name of the newly created mesh
# @return instance of Mesh class
+ # @ingroup l2_modif_trsf
def TranslateObjectMakeMesh(self, theObject, Vector, MakeGroups=False, NewMeshName=""):
if (isinstance(theObject, Mesh)):
theObject = theObject.GetMesh()
## Rotates the elements
# @param IDsOfElements list of elements ids
- # @param Axis axis of rotation(AxisStruct or geom line)
- # @param AngleInRadians angle of rotation(in radians)
- # @param Copy allows to copy the rotated elements
- # @param MakeGroups to generate new groups from existing ones (if Copy)
+ # @param Axis the axis of rotation (AxisStruct or geom line)
+ # @param AngleInRadians the angle of rotation (in radians)
+ # @param Copy allows copying the rotated elements
+ # @param MakeGroups forces the generation of new groups from existing ones (if Copy)
# @return list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise
+ # @ingroup l2_modif_trsf
def Rotate (self, IDsOfElements, Axis, AngleInRadians, Copy, MakeGroups=False):
if IDsOfElements == []:
IDsOfElements = self.GetElementsId()
self.editor.Rotate(IDsOfElements, Axis, AngleInRadians, Copy)
return []
- ## Create a new mesh of rotated elements
+ ## Creates a new mesh of rotated elements
# @param IDsOfElements list of element ids
- # @param Axis axis of rotation(AxisStruct or geom line)
- # @param AngleInRadians angle of rotation(in radians)
- # @param MakeGroups to generate new groups from existing ones
- # @param NewMeshName is a name of new mesh to create
+ # @param Axis the axis of rotation (AxisStruct or geom line)
+ # @param AngleInRadians the angle of rotation (in radians)
+ # @param MakeGroups forces the generation of new groups from existing ones
+ # @param NewMeshName the name of the newly created mesh
# @return instance of Mesh class
+ # @ingroup l2_modif_trsf
def RotateMakeMesh (self, IDsOfElements, Axis, AngleInRadians, MakeGroups=0, NewMeshName=""):
if IDsOfElements == []:
IDsOfElements = self.GetElementsId()
return Mesh( self.smeshpyD, self.geompyD, mesh )
## Rotates the object
- # @param theObject object to rotate(mesh, submesh, or group)
- # @param Axis axis of rotation(AxisStruct or geom line)
- # @param AngleInRadians angle of rotation(in radians)
- # @param Copy allows to copy the rotated elements
- # @param MakeGroups to generate new groups from existing ones (if Copy)
+ # @param theObject the object to rotate( mesh, submesh, or group)
+ # @param Axis the axis of rotation (AxisStruct or geom line)
+ # @param AngleInRadians the angle of rotation (in radians)
+ # @param Copy allows copying the rotated elements
+ # @param MakeGroups forces the generation of new groups from existing ones (if Copy)
# @return list of created groups (SMESH_GroupBase) if MakeGroups=True, empty list otherwise
+ # @ingroup l2_modif_trsf
def RotateObject (self, theObject, Axis, AngleInRadians, Copy, MakeGroups=False):
if (isinstance(theObject, Mesh)):
theObject = theObject.GetMesh()
self.editor.RotateObject(theObject, Axis, AngleInRadians, Copy)
return []
- ## Create a new mesh from a rotated object
- # @param theObject object to rotate (mesh, submesh, or group)
- # @param Axis axis of rotation(AxisStruct or geom line)
- # @param AngleInRadians angle of rotation(in radians)
- # @param MakeGroups to generate new groups from existing ones
- # @param NewMeshName is a name of new mesh to create
+ ## Creates a new mesh from the rotated object
+ # @param theObject the object to rotate (mesh, submesh, or group)
+ # @param Axis the axis of rotation (AxisStruct or geom line)
+ # @param AngleInRadians the angle of rotation (in radians)
+ # @param MakeGroups forces the generation of new groups from existing ones
+ # @param NewMeshName the name of the newly created mesh
# @return instance of Mesh class
+ # @ingroup l2_modif_trsf
def RotateObjectMakeMesh(self, theObject, Axis, AngleInRadians, MakeGroups=0,NewMeshName=""):
if (isinstance( theObject, Mesh )):
theObject = theObject.GetMesh()
MakeGroups, NewMeshName)
return Mesh( self.smeshpyD, self.geompyD, mesh )
- ## Find group of nodes close to each other within Tolerance.
- # @param Tolerance tolerance value
- # @return list of group of nodes
+ ## Finds groups of ajacent nodes within Tolerance.
+ # @param Tolerance the value of tolerance
+ # @return the list of groups of nodes
+ # @ingroup l2_modif_trsf
def FindCoincidentNodes (self, Tolerance):
return self.editor.FindCoincidentNodes(Tolerance)
- ## Find group of nodes close to each other within Tolerance.
- # @param Tolerance tolerance value
+ ## Finds groups of ajacent nodes within Tolerance.
+ # @param Tolerance the value of tolerance
# @param SubMeshOrGroup SubMesh or Group
- # @return list of group of nodes
+ # @return the list of groups of nodes
+ # @ingroup l2_modif_trsf
def FindCoincidentNodesOnPart (self, SubMeshOrGroup, Tolerance):
return self.editor.FindCoincidentNodesOnPart(SubMeshOrGroup, Tolerance)
- ## Merge nodes
- # @param GroupsOfNodes list of group of nodes
+ ## Merges nodes
+ # @param GroupsOfNodes the list of groups of nodes
+ # @ingroup l2_modif_trsf
def MergeNodes (self, GroupsOfNodes):
self.editor.MergeNodes(GroupsOfNodes)
- ## Find elements built on the same nodes.
+ ## Finds the elements built on the same nodes.
# @param MeshOrSubMeshOrGroup Mesh or SubMesh, or Group of elements for searching
# @return a list of groups of equal elements
+ # @ingroup l2_modif_trsf
def FindEqualElements (self, MeshOrSubMeshOrGroup):
return self.editor.FindEqualElements(MeshOrSubMeshOrGroup)
- ## Merge elements in each given group.
+ ## Merges elements in each given group.
# @param GroupsOfElementsID groups of elements for merging
+ # @ingroup l2_modif_trsf
def MergeElements(self, GroupsOfElementsID):
self.editor.MergeElements(GroupsOfElementsID)
- ## Remove all but one of elements built on the same nodes.
+ ## Leaves one element and removes all other elements built on the same nodes.
+ # @ingroup l2_modif_trsf
def MergeEqualElements(self):
self.editor.MergeEqualElements()
- ## Sew free borders
+ ## Sews free borders
# @return SMESH::Sew_Error
+ # @ingroup l2_modif_trsf
def SewFreeBorders (self, FirstNodeID1, SecondNodeID1, LastNodeID1,
FirstNodeID2, SecondNodeID2, LastNodeID2,
CreatePolygons, CreatePolyedrs):
FirstNodeID2, SecondNodeID2, LastNodeID2,
CreatePolygons, CreatePolyedrs)
- ## Sew conform free borders
+ ## Sews conform free borders
# @return SMESH::Sew_Error
+ # @ingroup l2_modif_trsf
def SewConformFreeBorders (self, FirstNodeID1, SecondNodeID1, LastNodeID1,
FirstNodeID2, SecondNodeID2):
return self.editor.SewConformFreeBorders(FirstNodeID1, SecondNodeID1, LastNodeID1,
FirstNodeID2, SecondNodeID2)
- ## Sew border to side
+ ## Sews border to side
# @return SMESH::Sew_Error
+ # @ingroup l2_modif_trsf
def SewBorderToSide (self, FirstNodeIDOnFreeBorder, SecondNodeIDOnFreeBorder, LastNodeIDOnFreeBorder,
FirstNodeIDOnSide, LastNodeIDOnSide, CreatePolygons, CreatePolyedrs):
return self.editor.SewBorderToSide(FirstNodeIDOnFreeBorder, SecondNodeIDOnFreeBorder, LastNodeIDOnFreeBorder,
FirstNodeIDOnSide, LastNodeIDOnSide, CreatePolygons, CreatePolyedrs)
- ## Sew two sides of a mesh. Nodes belonging to Side1 are
- # merged with nodes of elements of Side2.
- # Number of elements in theSide1 and in theSide2 must be
- # equal and they should have similar node connectivity.
- # The nodes to merge should belong to sides borders and
+ ## Sews two sides of a mesh. The nodes belonging to Side1 are
+ # merged with the nodes of elements of Side2.
+ # The number of elements in theSide1 and in theSide2 must be
+ # equal and they should have similar nodal connectivity.
+ # The nodes to merge should belong to side borders and
# the first node should be linked to the second.
# @return SMESH::Sew_Error
+ # @ingroup l2_modif_trsf
def SewSideElements (self, IDsOfSide1Elements, IDsOfSide2Elements,
NodeID1OfSide1ToMerge, NodeID1OfSide2ToMerge,
NodeID2OfSide1ToMerge, NodeID2OfSide2ToMerge):
NodeID1OfSide1ToMerge, NodeID1OfSide2ToMerge,
NodeID2OfSide1ToMerge, NodeID2OfSide2ToMerge)
- ## Set new nodes for given element.
+ ## Sets new nodes for the given element.
# @param ide the element id
# @param newIDs nodes ids
- # @return If number of nodes is not corresponded to type of element - returns false
+ # @return If the number of nodes does not correspond to the type of element - returns false
+ # @ingroup l2_modif_edit
def ChangeElemNodes(self, ide, newIDs):
return self.editor.ChangeElemNodes(ide, newIDs)
- ## If during last operation of MeshEditor some nodes were
- # created this method returns list of its IDs, \n
- # if new nodes not created - returns empty list
- # @return list of integer values (can be empty)
+ ## If during the last operation of MeshEditor some nodes were
+ # created, this method returns the list of their IDs, \n
+ # if new nodes were not created - returns empty list
+ # @return the list of integer values (can be empty)
+ # @ingroup l1_auxiliary
def GetLastCreatedNodes(self):
return self.editor.GetLastCreatedNodes()
- ## If during last operation of MeshEditor some elements were
- # created this method returns list of its IDs, \n
- # if new elements not creared - returns empty list
- # @return list of integer values (can be empty)
+ ## If during the last operation of MeshEditor some elements were
+ # created this method returns the list of their IDs, \n
+ # if new elements were not created - returns empty list
+ # @return the list of integer values (can be empty)
+ # @ingroup l1_auxiliary
def GetLastCreatedElems(self):
return self.editor.GetLastCreatedElems()
-## Mother class to define algorithm, recommended to do not use directly.
+## The mother class to define algorithm, it is not recommended to use it directly.
#
# More details.
+# @ingroup l2_algorithms
class Mesh_Algorithm:
# @class Mesh_Algorithm
# @brief Class Mesh_Algorithm
self.subm = None
self.algo = None
- ## Find hypothesis in study by its type name and parameters.
- # Find only those hypothesis, which was created in smeshpyD engine.
+ ## Finds a hypothesis in the study by its type name and parameters.
+ # Finds only the hypotheses created in smeshpyD engine.
# @return SMESH.SMESH_Hypothesis
def FindHypothesis (self, hypname, args, CompareMethod, smeshpyD):
study = smeshpyD.GetCurrentStudy()
scomp = study.FindComponent(smeshpyD.ComponentDataType())
if scomp is not None:
res,hypRoot = scomp.FindSubObject(SMESH.Tag_HypothesisRoot)
- # is hypotheses root label exists?
+ # Check if the root label of the hypotheses exists
if res and hypRoot is not None:
iter = study.NewChildIterator(hypRoot)
- # check all published hypotheses
+ # Check all published hypotheses
while iter.More():
hypo_so_i = iter.Value()
attr = hypo_so_i.FindAttribute("AttributeIOR")[1]
anIOR = attr.Value()
hypo_o_i = salome.orb.string_to_object(anIOR)
if hypo_o_i is not None:
- # is hypothesis?
+ # Check if this is a hypothesis
hypo_i = hypo_o_i._narrow(SMESH.SMESH_Hypothesis)
if hypo_i is not None:
- # belongs to this engine?
+ # Check if the hypothesis belongs to current engine
if smeshpyD.GetObjectId(hypo_i) > 0:
- # is it the needed hypothesis?
+ # Check if this is the required hypothesis
if hypo_i.GetName() == hypname:
- # check args
+ # Check arguments
if CompareMethod(hypo_i, args):
# found!!!
return hypo_i
pass
return None
- ## Find algorithm in study by its type name.
- # Find only those algorithm, which was created in smeshpyD engine.
+ ## Finds the algorithm in the study by its type name.
+ # Finds only the algorithms, which have been created in smeshpyD engine.
# @return SMESH.SMESH_Algo
def FindAlgorithm (self, algoname, smeshpyD):
study = smeshpyD.GetCurrentStudy()
scomp = study.FindComponent(smeshpyD.ComponentDataType())
if scomp is not None:
res,hypRoot = scomp.FindSubObject(SMESH.Tag_AlgorithmsRoot)
- # is algorithms root label exists?
+ # Check if the root label of the algorithms exists
if res and hypRoot is not None:
iter = study.NewChildIterator(hypRoot)
- # check all published algorithms
+ # Check all published algorithms
while iter.More():
algo_so_i = iter.Value()
attr = algo_so_i.FindAttribute("AttributeIOR")[1]
anIOR = attr.Value()
algo_o_i = salome.orb.string_to_object(anIOR)
if algo_o_i is not None:
- # is algorithm?
+ # Check if this is an algorithm
algo_i = algo_o_i._narrow(SMESH.SMESH_Algo)
if algo_i is not None:
- # belongs to this engine?
+ # Checks if the algorithm belongs to the current engine
if smeshpyD.GetObjectId(algo_i) > 0:
- # is it the needed algorithm?
+ # Check if this is the required algorithm
if algo_i.GetName() == algoname:
# found!!!
return algo_i
pass
return None
- ## If the algorithm is global, return 0; \n
- # else return the submesh associated to this algorithm.
+ ## If the algorithm is global, returns 0; \n
+ # else returns the submesh associated to this algorithm.
def GetSubMesh(self):
return self.subm
- ## Return the wrapped mesher.
+ ## Returns the wrapped mesher.
def GetAlgorithm(self):
return self.algo
- ## Get list of hypothesis that can be used with this algorithm
+ ## Gets the list of hypothesis that can be used with this algorithm
def GetCompatibleHypothesis(self):
mylist = []
if self.algo:
mylist = self.algo.GetCompatibleHypothesis()
return mylist
- ## Get name of algo
+ ## Gets the name of the algorithm
def GetName(self):
GetName(self.algo)
- ## Set name to algo
+ ## Sets the name to the algorithm
def SetName(self, name):
SetName(self.algo, name)
- ## Get id of algo
+ ## Gets the id of the algorithm
def GetId(self):
return self.algo.GetId()
## Class to define a segment 1D algorithm for discretization
#
# More details.
+# @ingroup l3_algos_basic
class Mesh_Segment(Mesh_Algorithm):
## Private constructor.
Mesh_Algorithm.__init__(self)
self.Create(mesh, geom, "Regular_1D")
- ## Define "LocalLength" hypothesis to cut an edge in several segments with the same length
+ ## Defines "LocalLength" hypothesis to cut an edge in several segments with the same length
# @param l for the length of segments that cut an edge
- # @param UseExisting if ==true - search existing hypothesis created with
- # same parameters, else (default) - create new
- # @param p precision, used for number of segments calculation.
- # It must be pozitive, meaningfull values are in range [0,1].
- # In general, number of segments is calculated with formula:
+ # @param UseExisting if ==true - searches for an existing hypothesis created with
+ # the same parameters, else (default) - creates a new one
+ # @param p precision, used for calculation of the number of segments.
+ # The precision should be a positive, meaningful value within the range [0,1].
+ # In general, the number of segments is calculated with the formula:
# nb = ceil((edge_length / l) - p)
# Function ceil rounds its argument to the higher integer.
# So, p=0 means rounding of (edge_length / l) to the higher integer,
# p=1 means rounding of (edge_length / l) to the lower integer.
# Default value is 1e-07.
# @return an instance of StdMeshers_LocalLength hypothesis
+ # @ingroup l3_hypos_1dhyps
def LocalLength(self, l, UseExisting=0, p=1e-07):
hyp = self.Hypothesis("LocalLength", [l,p], UseExisting=UseExisting,
CompareMethod=self.CompareLocalLength)
return hyp
## Private method
- ## Check if the given "LocalLength" hypothesis has the same parameters as given arguments
+ ## Checks if the given "LocalLength" hypothesis has the same parameters as the given arguments
def CompareLocalLength(self, hyp, args):
if IsEqual(hyp.GetLength(), args[0]):
return IsEqual(hyp.GetPrecision(), args[1])
return False
- ## Define "NumberOfSegments" hypothesis to cut an edge in several fixed number of segments
+ ## Defines "NumberOfSegments" hypothesis to cut an edge in a fixed number of segments
# @param n for the number of segments that cut an edge
# @param s for the scale factor (optional)
- # @param UseExisting if ==true - search existing hypothesis created with
- # same parameters, else (default) - create new
+ # @param UseExisting if ==true - searches for an existing hypothesis created with
+ # the same parameters, else (default) - create a new one
# @return an instance of StdMeshers_NumberOfSegments hypothesis
+ # @ingroup l3_hypos_1dhyps
def NumberOfSegments(self, n, s=[], UseExisting=0):
if s == []:
hyp = self.Hypothesis("NumberOfSegments", [n], UseExisting=UseExisting,
return hyp
## Private method
- ## Check if the given "NumberOfSegments" hypothesis has the same parameters as given arguments
+ ## Checks if the given "NumberOfSegments" hypothesis has the same parameters as the given arguments
def CompareNumberOfSegments(self, hyp, args):
if hyp.GetNumberOfSegments() == args[0]:
if len(args) == 1:
return True
return False
- ## Define "Arithmetic1D" hypothesis to cut an edge in several segments with arithmetic length increasing
- # @param start for the length of the first segment
- # @param end for the length of the last segment
- # @param UseExisting if ==true - search existing hypothesis created with
- # same parameters, else (default) - create new
+ ## Defines "Arithmetic1D" hypothesis to cut an edge in several segments with increasing arithmetic length
+ # @param start defines the length of the first segment
+ # @param end defines the length of the last segment
+ # @param UseExisting if ==true - searches for an existing hypothesis created with
+ # the same parameters, else (default) - creates a new one
# @return an instance of StdMeshers_Arithmetic1D hypothesis
+ # @ingroup l3_hypos_1dhyps
def Arithmetic1D(self, start, end, UseExisting=0):
hyp = self.Hypothesis("Arithmetic1D", [start, end], UseExisting=UseExisting,
CompareMethod=self.CompareArithmetic1D)
return hyp
## Private method
- ## Check if the given "Arithmetic1D" hypothesis has the same parameters as given arguments
+ ## Check if the given "Arithmetic1D" hypothesis has the same parameters as the given arguments
def CompareArithmetic1D(self, hyp, args):
if IsEqual(hyp.GetLength(1), args[0]):
if IsEqual(hyp.GetLength(0), args[1]):
return True
return False
- ## Define "StartEndLength" hypothesis to cut an edge in several segments with geometric length increasing
- # @param start for the length of the first segment
- # @param end for the length of the last segment
- # @param UseExisting if ==true - search existing hypothesis created with
- # same parameters, else (default) - create new
+ ## Defines "StartEndLength" hypothesis to cut an edge in several segments with increasing geometric length
+ # @param start defines the length of the first segment
+ # @param end defines the length of the last segment
+ # @param UseExisting if ==true - searches for an existing hypothesis created with
+ # the same parameters, else (default) - creates a new one
# @return an instance of StdMeshers_StartEndLength hypothesis
+ # @ingroup l3_hypos_1dhyps
def StartEndLength(self, start, end, UseExisting=0):
hyp = self.Hypothesis("StartEndLength", [start, end], UseExisting=UseExisting,
CompareMethod=self.CompareStartEndLength)
hyp.SetLength(end , 0)
return hyp
- ## Check if the given "StartEndLength" hypothesis has the same parameters as given arguments
+ ## Check if the given "StartEndLength" hypothesis has the same parameters as the given arguments
def CompareStartEndLength(self, hyp, args):
if IsEqual(hyp.GetLength(1), args[0]):
if IsEqual(hyp.GetLength(0), args[1]):
return True
return False
- ## Define "Deflection1D" hypothesis
+ ## Defines "Deflection1D" hypothesis
# @param d for the deflection
- # @param UseExisting if ==true - search existing hypothesis created with
- # same parameters, else (default) - create new
+ # @param UseExisting if ==true - searches for an existing hypothesis created with
+ # the same parameters, else (default) - create a new one
+ # @ingroup l3_hypos_1dhyps
def Deflection1D(self, d, UseExisting=0):
hyp = self.Hypothesis("Deflection1D", [d], UseExisting=UseExisting,
CompareMethod=self.CompareDeflection1D)
hyp.SetDeflection(d)
return hyp
- ## Check if the given "Deflection1D" hypothesis has the same parameters as given arguments
+ ## Check if the given "Deflection1D" hypothesis has the same parameters as the given arguments
def CompareDeflection1D(self, hyp, args):
return IsEqual(hyp.GetDeflection(), args[0])
- ## Define "Propagation" hypothesis that propagate all other hypothesis on all others edges that are in
- # the opposite side in the case of quadrangular faces
+ ## Defines "Propagation" hypothesis that propagates all other hypotheses on all other edges that are at
+ # the opposite side in case of quadrangular faces
+ # @ingroup l3_hypos_additi
def Propagation(self):
return self.Hypothesis("Propagation", UseExisting=1, CompareMethod=self.CompareEqualHyp)
- ## Define "AutomaticLength" hypothesis
+ ## Defines "AutomaticLength" hypothesis
# @param fineness for the fineness [0-1]
- # @param UseExisting if ==true - search existing hypothesis created with
- # same parameters, else (default) - create new
+ # @param UseExisting if ==true - searches for an existing hypothesis created with the
+ # same parameters, else (default) - create a new one
+ # @ingroup l3_hypos_1dhyps
def AutomaticLength(self, fineness=0, UseExisting=0):
hyp = self.Hypothesis("AutomaticLength",[fineness],UseExisting=UseExisting,
CompareMethod=self.CompareAutomaticLength)
hyp.SetFineness( fineness )
return hyp
- ## Check if the given "AutomaticLength" hypothesis has the same parameters as given arguments
+ ## Checks if the given "AutomaticLength" hypothesis has the same parameters as the given arguments
def CompareAutomaticLength(self, hyp, args):
return IsEqual(hyp.GetFineness(), args[0])
- ## Define "SegmentLengthAroundVertex" hypothesis
+ ## Defines "SegmentLengthAroundVertex" hypothesis
# @param length for the segment length
- # @param vertex for the length localization: vertex index [0,1] | vertex object.
- # Any other integer value means what hypo will be set on the
+ # @param vertex for the length localization: the vertex index [0,1] | vertex object.
+ # Any other integer value means that the hypothesis will be set on the
# whole 1D shape, where Mesh_Segment algorithm is assigned.
- # @param UseExisting if ==true - search existing hypothesis created with
- # same parameters, else (default) - create new
+ # @param UseExisting if ==true - searches for an existing hypothesis created with
+ # the same parameters, else (default) - creates a new one
+ # @ingroup l3_algos_segmarv
def LengthNearVertex(self, length, vertex=0, UseExisting=0):
import types
store_geom = self.geom
hyp.SetLength( length )
return hyp
- ## Check if the given "LengthNearVertex" hypothesis has the same parameters as given arguments
+ ## Checks if the given "LengthNearVertex" hypothesis has the same parameters as the given arguments
+ # @ingroup l3_algos_segmarv
def CompareLengthNearVertex(self, hyp, args):
return IsEqual(hyp.GetLength(), args[0])
- ## Define "QuadraticMesh" hypothesis, forcing construction of quadratic edges.
- # If the 2D mesher sees that all boundary edges are quadratic ones,
+ ## Defines "QuadraticMesh" hypothesis, forcing construction of quadratic edges.
+ # If the 2D mesher sees that all boundary edges are quadratic,
# it generates quadratic faces, else it generates linear faces using
- # medium nodes as if they were vertex ones.
+ # medium nodes as if they are vertices.
# The 3D mesher generates quadratic volumes only if all boundary faces
- # are quadratic ones, else it fails.
+ # are quadratic, else it fails.
+ #
+ # @ingroup l3_hypos_additi
def QuadraticMesh(self):
hyp = self.Hypothesis("QuadraticMesh", UseExisting=1, CompareMethod=self.CompareEqualHyp)
return hyp
# Public class: Mesh_CompositeSegment
# --------------------------
-## Class to define a segment 1D algorithm for discretization
-#
-# More details.
+## Defines a segment 1D algorithm for discretization
+#
+# @ingroup l3_algos_basic
class Mesh_CompositeSegment(Mesh_Segment):
## Private constructor.
# Public class: Mesh_Segment_Python
# ---------------------------------
-## Class to define a segment 1D algorithm for discretization with python function
+## Defines a segment 1D algorithm for discretization with python function
#
-# More details.
+# @ingroup l3_algos_basic
class Mesh_Segment_Python(Mesh_Segment):
## Private constructor.
import Python1dPlugin
self.Create(mesh, geom, "Python_1D", "libPython1dEngine.so")
- ## Define "PythonSplit1D" hypothesis based on the Erwan Adam patch, awaiting equivalent SALOME functionality
+ ## Defines "PythonSplit1D" hypothesis
# @param n for the number of segments that cut an edge
- # @param func for the python function that calculate the length of all segments
- # @param UseExisting if ==true - search existing hypothesis created with
- # same parameters, else (default) - create new
+ # @param func for the python function that calculates the length of all segments
+ # @param UseExisting if ==true - searches for the existing hypothesis created with
+ # the same parameters, else (default) - creates a new one
+ # @ingroup l3_hypos_1dhyps
def PythonSplit1D(self, n, func, UseExisting=0):
hyp = self.Hypothesis("PythonSplit1D", [n], "libPython1dEngine.so",
UseExisting=UseExisting, CompareMethod=self.ComparePythonSplit1D)
hyp.SetPythonLog10RatioFunction(func)
return hyp
- ## Check if the given "PythonSplit1D" hypothesis has the same parameters as given arguments
+ ## Checks if the given "PythonSplit1D" hypothesis has the same parameters as the given arguments
def ComparePythonSplit1D(self, hyp, args):
#if hyp.GetNumberOfSegments() == args[0]:
# if hyp.GetPythonLog10RatioFunction() == args[1]:
# Public class: Mesh_Triangle
# ---------------------------
-## Class to define a triangle 2D algorithm
+## Defines a triangle 2D algorithm
#
-# More details.
+# @ingroup l3_algos_basic
class Mesh_Triangle(Mesh_Algorithm):
# default values
elif algoType == BLSURF:
import BLSURFPlugin
self.Create(mesh, geom, "BLSURF", "libBLSURFEngine.so")
- self.SetPhysicalMesh()
+ #self.SetPhysicalMesh() - PAL19680
elif algoType == NETGEN:
if noNETGENPlugin:
print "Warning: NETGENPlugin module unavailable"
self.Create(mesh, geom, "NETGEN_2D_ONLY", "libNETGENEngine.so")
pass
- ## Define "MaxElementArea" hypothesis to give the maximum area of each triangle
+ ## Defines "MaxElementArea" hypothesis basing on the definition of the maximum area of each triangle
# @param area for the maximum area of each triangle
- # @param UseExisting if ==true - search existing hypothesis created with
- # same parameters, else (default) - create new
+ # @param UseExisting if ==true - searches for an existing hypothesis created with the
+ # same parameters, else (default) - creates a new one
#
# Only for algoType == MEFISTO || NETGEN_2D
+ # @ingroup l3_hypos_2dhyps
def MaxElementArea(self, area, UseExisting=0):
if self.algoType == MEFISTO or self.algoType == NETGEN_2D:
hyp = self.Hypothesis("MaxElementArea", [area], UseExisting=UseExisting,
print "Netgen 1D-2D algo doesn't support this hypothesis"
return None
- ## Check if the given "MaxElementArea" hypothesis has the same parameters as given arguments
+ ## Checks if the given "MaxElementArea" hypothesis has the same parameters as the given arguments
def CompareMaxElementArea(self, hyp, args):
return IsEqual(hyp.GetMaxElementArea(), args[0])
- ## Define "LengthFromEdges" hypothesis to build triangles
+ ## Defines "LengthFromEdges" hypothesis to build triangles
# based on the length of the edges taken from the wire
#
# Only for algoType == MEFISTO || NETGEN_2D
+ # @ingroup l3_hypos_2dhyps
def LengthFromEdges(self):
if self.algoType == MEFISTO or self.algoType == NETGEN_2D:
hyp = self.Hypothesis("LengthFromEdges", UseExisting=1, CompareMethod=self.CompareEqualHyp)
print "Netgen 1D-2D algo doesn't support this hypothesis"
return None
- ## Set PhysicalMesh
- # @param thePhysicalMesh is:
- # DefaultSize or Custom
- def SetPhysicalMesh(self, thePhysicalMesh=1):
- if self.params == 0:
- self.Parameters()
- self.params.SetPhysicalMesh(thePhysicalMesh)
+ ## Sets a way to define size of mesh elements to generate.
+ # @param thePhysicalMesh is: DefaultSize or Custom.
+ # @ingroup l3_hypos_blsurf
+ def SetPhysicalMesh(self, thePhysicalMesh=DefaultSize):
+ # Parameter of BLSURF algo
+ self.Parameters().SetPhysicalMesh(thePhysicalMesh)
- ## Set PhySize flag
+ ## Sets size of mesh elements to generate.
+ # @ingroup l3_hypos_blsurf
def SetPhySize(self, theVal):
- if self.params == 0:
- self.Parameters()
- self.params.SetPhySize(theVal)
-
- ## Set GeometricMesh
- # @param theGeometricMesh is:
- # DefaultGeom or Custom
+ # Parameter of BLSURF algo
+ self.Parameters().SetPhySize(theVal)
+
+ ## Sets lower boundary of mesh element size (PhySize).
+ # @ingroup l3_hypos_blsurf
+ def SetPhyMin(self, theVal=-1):
+ # Parameter of BLSURF algo
+ self.Parameters().SetPhyMin(theVal)
+
+ ## Sets upper boundary of mesh element size (PhySize).
+ # @ingroup l3_hypos_blsurf
+ def SetPhyMax(self, theVal=-1):
+ # Parameter of BLSURF algo
+ self.Parameters().SetPhyMax(theVal)
+
+ ## Sets a way to define maximum angular deflection of mesh from CAD model.
+ # @param theGeometricMesh is: DefaultGeom or Custom
+ # @ingroup l3_hypos_blsurf
def SetGeometricMesh(self, theGeometricMesh=0):
- if self.params == 0:
- self.Parameters()
- if self.params.GetPhysicalMesh() == 0: theGeometricMesh = 1
+ # Parameter of BLSURF algo
+ if self.Parameters().GetPhysicalMesh() == 0: theGeometricMesh = 1
self.params.SetGeometricMesh(theGeometricMesh)
- ## Set AngleMeshS flag
+ ## Sets angular deflection (in degrees) of a mesh face from CAD surface.
+ # @ingroup l3_hypos_blsurf
def SetAngleMeshS(self, theVal=_angleMeshS):
- if self.params == 0:
- self.Parameters()
- if self.params.GetGeometricMesh() == 0: theVal = self._angleMeshS
+ # Parameter of BLSURF algo
+ if self.Parameters().GetGeometricMesh() == 0: theVal = self._angleMeshS
self.params.SetAngleMeshS(theVal)
- ## Set Gradation flag
+ ## Sets angular deflection (in degrees) of a mesh edge from CAD curve.
+ # @ingroup l3_hypos_blsurf
+ def SetAngleMeshC(self, theVal=_angleMeshS):
+ # Parameter of BLSURF algo
+ if self.Parameters().GetGeometricMesh() == 0: theVal = self._angleMeshS
+ self.params.SetAngleMeshC(theVal)
+
+ ## Sets lower boundary of mesh element size computed to respect angular deflection.
+ # @ingroup l3_hypos_blsurf
+ def SetGeoMin(self, theVal=-1):
+ # Parameter of BLSURF algo
+ self.Parameters().SetGeoMin(theVal)
+
+ ## Sets upper boundary of mesh element size computed to respect angular deflection.
+ # @ingroup l3_hypos_blsurf
+ def SetGeoMax(self, theVal=-1):
+ # Parameter of BLSURF algo
+ self.Parameters().SetGeoMax(theVal)
+
+ ## Sets maximal allowed ratio between the lengths of two adjacent edges.
+ # @ingroup l3_hypos_blsurf
def SetGradation(self, theVal=_gradation):
- if self.params == 0:
- self.Parameters()
- if self.params.GetGeometricMesh() == 0: theVal = self._gradation
+ # Parameter of BLSURF algo
+ if self.Parameters().GetGeometricMesh() == 0: theVal = self._gradation
self.params.SetGradation(theVal)
- ## Set QuadAllowed flag
- #
- # Only for algoType == NETGEN || NETGEN_2D
+ ## Sets topology usage way.
+ # @param way defines how mesh conformity is assured <ul>
+ # <li>FromCAD - mesh conformity is assured by conformity of a shape</li>
+ # <li>PreProcess or PreProcessPlus - by pre-processing a CAD model</li></ul>
+ # @ingroup l3_hypos_blsurf
+ def SetTopology(self, way):
+ # Parameter of BLSURF algo
+ self.Parameters().SetTopology(way)
+
+ ## To respect geometrical edges or not.
+ # @ingroup l3_hypos_blsurf
+ def SetDecimesh(self, toIgnoreEdges=False):
+ # Parameter of BLSURF algo
+ self.Parameters().SetDecimesh(toIgnoreEdges)
+
+ ## Sets verbosity level in the range 0 to 100.
+ # @ingroup l3_hypos_blsurf
+ def SetVerbosity(self, level):
+ # Parameter of BLSURF algo
+ self.Parameters().SetVerbosity(level)
+
+ ## Sets advanced option value.
+ # @ingroup l3_hypos_blsurf
+ def SetOptionValue(self, optionName, level):
+ # Parameter of BLSURF algo
+ self.Parameters().SetOptionValue(optionName,level)
+
+ ## Sets QuadAllowed flag.
+ # Only for algoType == NETGEN || NETGEN_2D || BLSURF
+ # @ingroup l3_hypos_netgen l3_hypos_blsurf
def SetQuadAllowed(self, toAllow=True):
if self.algoType == NETGEN_2D:
if toAllow: # add QuadranglePreference
pass
pass
return
- if self.params == 0:
- self.Parameters()
- if self.params:
+ if self.Parameters():
self.params.SetQuadAllowed(toAllow)
return
- ## Define "Netgen 2D Parameters" hypothesis
+ ## Defines "Netgen 2D Parameters" hypothesis
#
- # Only for algoType == NETGEN
+ # @ingroup l3_hypos_netgen
def Parameters(self):
+ # Only for algoType == NETGEN
+ if self.params:
+ return self.params
if self.algoType == NETGEN:
self.params = self.Hypothesis("NETGEN_Parameters_2D", [],
"libNETGENEngine.so", UseExisting=0)
return self.params
return None
- ## Set MaxSize
+ ## Sets MaxSize
#
# Only for algoType == NETGEN
+ # @ingroup l3_hypos_netgen
def SetMaxSize(self, theSize):
- if self.params == 0:
- self.Parameters()
- if self.params is not None:
+ if self.Parameters():
self.params.SetMaxSize(theSize)
- ## Set SecondOrder flag
+ ## Sets SecondOrder flag
#
# Only for algoType == NETGEN
+ # @ingroup l3_hypos_netgen
def SetSecondOrder(self, theVal):
- if self.params == 0:
- self.Parameters()
- if self.params is not None:
+ if self.Parameters():
self.params.SetSecondOrder(theVal)
- ## Set Optimize flag
+ ## Sets Optimize flag
#
# Only for algoType == NETGEN
+ # @ingroup l3_hypos_netgen
def SetOptimize(self, theVal):
- if self.params == 0:
- self.Parameters()
- if self.params is not None:
+ if self.Parameters():
self.params.SetOptimize(theVal)
- ## Set Fineness
+ ## Sets Fineness
# @param theFineness is:
# VeryCoarse, Coarse, Moderate, Fine, VeryFine or Custom
#
# Only for algoType == NETGEN
+ # @ingroup l3_hypos_netgen
def SetFineness(self, theFineness):
- if self.params == 0:
- self.Parameters()
- if self.params is not None:
+ if self.Parameters():
self.params.SetFineness(theFineness)
- ## Set GrowthRate
+ ## Sets GrowthRate
#
# Only for algoType == NETGEN
+ # @ingroup l3_hypos_netgen
def SetGrowthRate(self, theRate):
- if self.params == 0:
- self.Parameters()
- if self.params is not None:
+ if self.Parameters():
self.params.SetGrowthRate(theRate)
- ## Set NbSegPerEdge
+ ## Sets NbSegPerEdge
#
# Only for algoType == NETGEN
+ # @ingroup l3_hypos_netgen
def SetNbSegPerEdge(self, theVal):
- if self.params == 0:
- self.Parameters()
- if self.params is not None:
+ if self.Parameters():
self.params.SetNbSegPerEdge(theVal)
- ## Set NbSegPerRadius
+ ## Sets NbSegPerRadius
#
# Only for algoType == NETGEN
+ # @ingroup l3_hypos_netgen
def SetNbSegPerRadius(self, theVal):
- if self.params == 0:
- self.Parameters()
- if self.params is not None:
+ if self.Parameters():
self.params.SetNbSegPerRadius(theVal)
- ## Set Decimesh flag
- def SetDecimesh(self, toAllow=False):
- if self.params == 0:
- self.Parameters()
- self.params.SetDecimesh(toAllow)
-
pass
# Public class: Mesh_Quadrangle
# -----------------------------
-## Class to define a quadrangle 2D algorithm
+## Defines a quadrangle 2D algorithm
#
-# More details.
+# @ingroup l3_algos_basic
class Mesh_Quadrangle(Mesh_Algorithm):
## Private constructor.
Mesh_Algorithm.__init__(self)
self.Create(mesh, geom, "Quadrangle_2D")
- ## Define "QuadranglePreference" hypothesis, forcing construction
- # of quadrangles if the number of nodes on opposite edges is not the same
- # in the case where the global number of nodes on edges is even
+ ## Defines "QuadranglePreference" hypothesis, forcing construction
+ # of quadrangles if the number of nodes on the opposite edges is not the same
+ # while the total number of nodes on edges is even
+ #
+ # @ingroup l3_hypos_additi
def QuadranglePreference(self):
hyp = self.Hypothesis("QuadranglePreference", UseExisting=1,
CompareMethod=self.CompareEqualHyp)
# Public class: Mesh_Tetrahedron
# ------------------------------
-## Class to define a tetrahedron 3D algorithm
+## Defines a tetrahedron 3D algorithm
#
-# More details.
+# @ingroup l3_algos_basic
class Mesh_Tetrahedron(Mesh_Algorithm):
params = 0
self.Create(mesh, geom, "NETGEN_3D", "libNETGENEngine.so")
pass
- elif algoType == GHS3D:
- import GHS3DPlugin
- self.Create(mesh, geom, "GHS3D_3D" , "libGHS3DEngine.so")
- pass
-
elif algoType == FULL_NETGEN:
if noNETGENPlugin:
print "Warning: NETGENPlugin module has not been imported."
self.Create(mesh, geom, "NETGEN_2D3D", "libNETGENEngine.so")
pass
+ elif algoType == GHS3D:
+ import GHS3DPlugin
+ self.Create(mesh, geom, "GHS3D_3D" , "libGHS3DEngine.so")
+ pass
+
self.algoType = algoType
- ## Define "MaxElementVolume" hypothesis to give the maximun volume of each tetrahedral
- # @param vol for the maximum volume of each tetrahedral
- # @param UseExisting if ==true - search existing hypothesis created with
- # same parameters, else (default) - create new
+ ## Defines "MaxElementVolume" hypothesis to give the maximun volume of each tetrahedron
+ # @param vol for the maximum volume of each tetrahedron
+ # @param UseExisting if ==true - searches for the existing hypothesis created with
+ # the same parameters, else (default) - creates a new one
+ # @ingroup l3_hypos_maxvol
def MaxElementVolume(self, vol, UseExisting=0):
hyp = self.Hypothesis("MaxElementVolume", [vol], UseExisting=UseExisting,
CompareMethod=self.CompareMaxElementVolume)
hyp.SetMaxElementVolume(vol)
return hyp
- ## Check if the given "MaxElementVolume" hypothesis has the same parameters as given arguments
+ ## Checks if the given "MaxElementVolume" hypothesis has the same parameters as the given arguments
def CompareMaxElementVolume(self, hyp, args):
return IsEqual(hyp.GetMaxElementVolume(), args[0])
- ## Define "Netgen 3D Parameters" hypothesis
+ ## Defines "Netgen 3D Parameters" hypothesis
+ # @ingroup l3_hypos_netgen
def Parameters(self):
+ if self.params:
+ return self.params
if (self.algoType == FULL_NETGEN):
self.params = self.Hypothesis("NETGEN_Parameters", [],
"libNETGENEngine.so", UseExisting=0)
return self.params
- else:
- print "Algo doesn't support this hypothesis"
- return None
+ if (self.algoType == GHS3D):
+ self.params = self.Hypothesis("GHS3D_Parameters", [],
+ "libGHS3DEngine.so", UseExisting=0)
+ return self.params
+
+ print "Algo doesn't support this hypothesis"
+ return None
- ## Set MaxSize
+ ## Sets MaxSize
+ # Parameter of FULL_NETGEN
+ # @ingroup l3_hypos_netgen
def SetMaxSize(self, theSize):
- if self.params == 0:
- self.Parameters()
- self.params.SetMaxSize(theSize)
+ self.Parameters().SetMaxSize(theSize)
- ## Set SecondOrder flag
+ ## Sets SecondOrder flag
+ # Parameter of FULL_NETGEN
+ # @ingroup l3_hypos_netgen
def SetSecondOrder(self, theVal):
- if self.params == 0:
- self.Parameters()
- self.params.SetSecondOrder(theVal)
+ self.Parameters().SetSecondOrder(theVal)
- ## Set Optimize flag
+ ## Sets Optimize flag
+ # Parameter of FULL_NETGEN
+ # @ingroup l3_hypos_netgen
def SetOptimize(self, theVal):
- if self.params == 0:
- self.Parameters()
- self.params.SetOptimize(theVal)
+ self.Parameters().SetOptimize(theVal)
- ## Set Fineness
+ ## Sets Fineness
# @param theFineness is:
# VeryCoarse, Coarse, Moderate, Fine, VeryFine or Custom
+ # Parameter of FULL_NETGEN
+ # @ingroup l3_hypos_netgen
def SetFineness(self, theFineness):
- if self.params == 0:
- self.Parameters()
- self.params.SetFineness(theFineness)
+ self.Parameters().SetFineness(theFineness)
- ## Set GrowthRate
+ ## Sets GrowthRate
+ # Parameter of FULL_NETGEN
+ # @ingroup l3_hypos_netgen
def SetGrowthRate(self, theRate):
- if self.params == 0:
- self.Parameters()
- self.params.SetGrowthRate(theRate)
+ self.Parameters().SetGrowthRate(theRate)
- ## Set NbSegPerEdge
+ ## Sets NbSegPerEdge
+ # Parameter of FULL_NETGEN
+ # @ingroup l3_hypos_netgen
def SetNbSegPerEdge(self, theVal):
- if self.params == 0:
- self.Parameters()
- self.params.SetNbSegPerEdge(theVal)
+ self.Parameters().SetNbSegPerEdge(theVal)
- ## Set NbSegPerRadius
+ ## Sets NbSegPerRadius
+ # Parameter of FULL_NETGEN
+ # @ingroup l3_hypos_netgen
def SetNbSegPerRadius(self, theVal):
- if self.params == 0:
- self.Parameters()
- self.params.SetNbSegPerRadius(theVal)
+ self.Parameters().SetNbSegPerRadius(theVal)
+
+ ## To mesh "holes" in a solid or not. Default is to mesh.
+ # @ingroup l3_hypos_ghs3dh
+ def SetToMeshHoles(self, toMesh):
+ # Parameter of GHS3D
+ self.Parameters().SetToMeshHoles(toMesh)
+
+ ## Set Optimization level:
+ # None_Optimization, Light_Optimization, Medium_Optimization, Strong_Optimization.
+ # Default is Medium_Optimization
+ # @ingroup l3_hypos_ghs3dh
+ def SetOptimizationLevel(self, level):
+ # Parameter of GHS3D
+ self.Parameters().SetOptimizationLevel(level)
+
+ ## Maximal size of memory to be used by the algorithm (in Megabytes).
+ # @ingroup l3_hypos_ghs3dh
+ def SetMaximumMemory(self, MB):
+ # Advanced parameter of GHS3D
+ self.Parameters().SetMaximumMemory(MB)
+
+ ## Initial size of memory to be used by the algorithm (in Megabytes) in
+ # automatic memory adjustment mode.
+ # @ingroup l3_hypos_ghs3dh
+ def SetInitialMemory(self, MB):
+ # Advanced parameter of GHS3D
+ self.Parameters().SetInitialMemory(MB)
+
+ ## Path to working directory.
+ # @ingroup l3_hypos_ghs3dh
+ def SetWorkingDirectory(self, path):
+ # Advanced parameter of GHS3D
+ self.Parameters().SetWorkingDirectory(path)
+
+ ## To keep working files or remove them. Log file remains in case of errors anyway.
+ # @ingroup l3_hypos_ghs3dh
+ def SetKeepFiles(self, toKeep):
+ # Advanced parameter of GHS3D
+ self.Parameters().SetKeepFiles(toKeep)
+
+ ## To set verbose level [0-10]. <ul>
+ #<li> 0 - no standard output,
+ #<li> 2 - prints the data, quality statistics of the skin and final meshes and
+ # indicates when the final mesh is being saved. In addition the software
+ # gives indication regarding the CPU time.
+ #<li>10 - same as 2 plus the main steps in the computation, quality statistics
+ # histogram of the skin mesh, quality statistics histogram together with
+ # the characteristics of the final mesh.</ul>
+ # @ingroup l3_hypos_ghs3dh
+ def SetVerboseLevel(self, level):
+ # Advanced parameter of GHS3D
+ self.Parameters().SetVerboseLevel(level)
+
+ ## To create new nodes.
+ # @ingroup l3_hypos_ghs3dh
+ def SetToCreateNewNodes(self, toCreate):
+ # Advanced parameter of GHS3D
+ self.Parameters().SetToCreateNewNodes(toCreate)
+
+ ## To use boundary recovery version which tries to create mesh on a very poor
+ # quality surface mesh.
+ # @ingroup l3_hypos_ghs3dh
+ def SetToUseBoundaryRecoveryVersion(self, toUse):
+ # Advanced parameter of GHS3D
+ self.Parameters().SetToUseBoundaryRecoveryVersion(toUse)
+
+ ## Sets command line option as text.
+ # @ingroup l3_hypos_ghs3dh
+ def SetTextOption(self, option):
+ # Advanced parameter of GHS3D
+ self.Parameters().SetTextOption(option)
# Public class: Mesh_Hexahedron
# ------------------------------
-## Class to define a hexahedron 3D algorithm
+## Defines a hexahedron 3D algorithm
#
-# More details.
+# @ingroup l3_algos_basic
class Mesh_Hexahedron(Mesh_Algorithm):
params = 0
self.Create(mesh, geom, "Hexotic_3D", "libHexoticEngine.so")
pass
- ## Define "MinMaxQuad" hypothesis to give the three hexotic parameters
+ ## Defines "MinMaxQuad" hypothesis to give three hexotic parameters
+ # @ingroup l3_hypos_hexotic
def MinMaxQuad(self, min=3, max=8, quad=True):
self.params = self.Hypothesis("Hexotic_Parameters", [], "libHexoticEngine.so",
UseExisting=0)
# Public class: Mesh_Netgen
# ------------------------------
-## Class to define a NETGEN-based 2D or 3D algorithm
-# that need no discrete boundary (i.e. independent)
+## Defines a NETGEN-based 2D or 3D algorithm
+# that needs no discrete boundary (i.e. independent)
#
# This class is deprecated, only for compatibility!
#
# More details.
+# @ingroup l3_algos_basic
class Mesh_Netgen(Mesh_Algorithm):
is3D = 0
self.Create(mesh, geom, "NETGEN_2D", "libNETGENEngine.so")
pass
- ## Define hypothesis containing parameters of the algorithm
+ ## Defines the hypothesis containing parameters of the algorithm
def Parameters(self):
if self.is3D:
hyp = self.Hypothesis("NETGEN_Parameters", [],
# Public class: Mesh_Projection1D
# ------------------------------
-## Class to define a projection 1D algorithm
+## Defines a projection 1D algorithm
+# @ingroup l3_algos_proj
#
-# More details.
class Mesh_Projection1D(Mesh_Algorithm):
+
## Private constructor.
def __init__(self, mesh, geom=0):
Mesh_Algorithm.__init__(self)
self.Create(mesh, geom, "Projection_1D")
- ## Define "Source Edge" hypothesis, specifying a meshed edge to
- # take a mesh pattern from, and optionally association of vertices
- # between the source edge and a target one (where a hipothesis is assigned to)
- # @param edge to take nodes distribution from
- # @param mesh to take nodes distribution from (optional)
- # @param srcV is vertex of \a edge to associate with \a tgtV (optional)
- # @param tgtV is vertex of \a the edge where the algorithm is assigned,
+ ## Defines "Source Edge" hypothesis, specifying a meshed edge, from where
+ # a mesh pattern is taken, and, optionally, the association of vertices
+ # between the source edge and a target edge (to which a hypothesis is assigned)
+ # @param edge from which nodes distribution is taken
+ # @param mesh from which nodes distribution is taken (optional)
+ # @param srcV a vertex of \a edge to associate with \a tgtV (optional)
+ # @param tgtV a vertex of \a the edge to which the algorithm is assigned,
# to associate with \a srcV (optional)
- # @param UseExisting if ==true - search existing hypothesis created with
- # same parameters, else (default) - create new
+ # @param UseExisting if ==true - searches for the existing hypothesis created with
+ # the same parameters, else (default) - creates a new one
def SourceEdge(self, edge, mesh=None, srcV=None, tgtV=None, UseExisting=0):
hyp = self.Hypothesis("ProjectionSource1D", [edge,mesh,srcV,tgtV],
UseExisting=0)
hyp.SetVertexAssociation( srcV, tgtV )
return hyp
- ## Check if the given "SourceEdge" hypothesis has the same parameters as given arguments
+ ## Checks if the given "SourceEdge" hypothesis has the same parameters as the given arguments
#def CompareSourceEdge(self, hyp, args):
- # # seems to be not really useful to reuse existing "SourceEdge" hypothesis
+ # # it does not seem to be useful to reuse the existing "SourceEdge" hypothesis
# return False
# Public class: Mesh_Projection2D
# ------------------------------
-## Class to define a projection 2D algorithm
+## Defines a projection 2D algorithm
+# @ingroup l3_algos_proj
#
-# More details.
class Mesh_Projection2D(Mesh_Algorithm):
## Private constructor.
def __init__(self, mesh, geom=0):
Mesh_Algorithm.__init__(self)
self.Create(mesh, geom, "Projection_2D")
- ## Define "Source Face" hypothesis, specifying a meshed face to
- # take a mesh pattern from, and optionally association of vertices
- # between the source face and a target one (where a hipothesis is assigned to)
- # @param face to take mesh pattern from
- # @param mesh to take mesh pattern from (optional)
- # @param srcV1 is vertex of \a face to associate with \a tgtV1 (optional)
- # @param tgtV1 is vertex of \a the face where the algorithm is assigned,
- # to associate with \a srcV1 (optional)
- # @param srcV2 is vertex of \a face to associate with \a tgtV1 (optional)
- # @param tgtV2 is vertex of \a the face where the algorithm is assigned,
- # to associate with \a srcV2 (optional)
- # @param UseExisting if ==true - search existing hypothesis created with
- # same parameters, else (default) - create new
+
+ ## Defines "Source Face" hypothesis, specifying a meshed face, from where
+ # a mesh pattern is taken, and, optionally, the association of vertices
+ # between the source face and the target face (to which a hypothesis is assigned)
+ # @param face from which the mesh pattern is taken
+ # @param mesh from which the mesh pattern is taken (optional)
+ # @param srcV1 a vertex of \a face to associate with \a tgtV1 (optional)
+ # @param tgtV1 a vertex of \a the face to which the algorithm is assigned,
+ # to associate with \a srcV1 (optional)
+ # @param srcV2 a vertex of \a face to associate with \a tgtV1 (optional)
+ # @param tgtV2 a vertex of \a the face to which the algorithm is assigned,
+ # to associate with \a srcV2 (optional)
+ # @param UseExisting if ==true - forces the search for the existing hypothesis created with
+ # the same parameters, else (default) - forces the creation a new one
#
- # Note: association vertices must belong to one edge of a face
+ # Note: all association vertices must belong to one edge of a face
def SourceFace(self, face, mesh=None, srcV1=None, tgtV1=None,
srcV2=None, tgtV2=None, UseExisting=0):
hyp = self.Hypothesis("ProjectionSource2D", [face,mesh,srcV1,tgtV1,srcV2,tgtV2],
hyp.SetVertexAssociation( srcV1, srcV2, tgtV1, tgtV2 )
return hyp
- ## Check if the given "SourceFace" hypothesis has the same parameters as given arguments
+ ## Checks if the given "SourceFace" hypothesis has the same parameters as the given arguments
#def CompareSourceFace(self, hyp, args):
- # # seems to be not really useful to reuse existing "SourceFace" hypothesis
+ # # it does not seem to be useful to reuse the existing "SourceFace" hypothesis
# return False
# Public class: Mesh_Projection3D
# ------------------------------
-## Class to define a projection 3D algorithm
+## Defines a projection 3D algorithm
+# @ingroup l3_algos_proj
#
-# More details.
class Mesh_Projection3D(Mesh_Algorithm):
## Private constructor.
Mesh_Algorithm.__init__(self)
self.Create(mesh, geom, "Projection_3D")
- ## Define "Source Shape 3D" hypothesis, specifying a meshed solid to
- # take a mesh pattern from, and optionally association of vertices
- # between the source solid and a target one (where a hipothesis is assigned to)
- # @param solid to take mesh pattern from
- # @param mesh to take mesh pattern from (optional)
- # @param srcV1 is vertex of \a solid to associate with \a tgtV1 (optional)
- # @param tgtV1 is vertex of \a the solid where the algorithm is assigned,
+ ## Defines the "Source Shape 3D" hypothesis, specifying a meshed solid, from where
+ # the mesh pattern is taken, and, optionally, the association of vertices
+ # between the source and the target solid (to which a hipothesis is assigned)
+ # @param solid from where the mesh pattern is taken
+ # @param mesh from where the mesh pattern is taken (optional)
+ # @param srcV1 a vertex of \a solid to associate with \a tgtV1 (optional)
+ # @param tgtV1 a vertex of \a the solid where the algorithm is assigned,
# to associate with \a srcV1 (optional)
- # @param srcV2 is vertex of \a solid to associate with \a tgtV1 (optional)
- # @param tgtV2 is vertex of \a the solid where the algorithm is assigned,
+ # @param srcV2 a vertex of \a solid to associate with \a tgtV1 (optional)
+ # @param tgtV2 a vertex of \a the solid to which the algorithm is assigned,
# to associate with \a srcV2 (optional)
- # @param UseExisting - if ==true - search existing hypothesis created with
- # same parameters, else (default) - create new
+ # @param UseExisting - if ==true - searches for the existing hypothesis created with
+ # the same parameters, else (default) - creates a new one
#
# Note: association vertices must belong to one edge of a solid
def SourceShape3D(self, solid, mesh=0, srcV1=0, tgtV1=0,
hyp.SetVertexAssociation( srcV1, srcV2, tgtV1, tgtV2 )
return hyp
- ## Check if the given "SourceShape3D" hypothesis has the same parameters as given arguments
+ ## Checks if the given "SourceShape3D" hypothesis has the same parameters as given arguments
#def CompareSourceShape3D(self, hyp, args):
# # seems to be not really useful to reuse existing "SourceShape3D" hypothesis
# return False
# Public class: Mesh_Prism
# ------------------------
-## Class to define a 3D extrusion algorithm
+## Defines a 3D extrusion algorithm
+# @ingroup l3_algos_3dextr
#
-# More details.
class Mesh_Prism3D(Mesh_Algorithm):
## Private constructor.
# Public class: Mesh_RadialPrism
# -------------------------------
-## Class to define a Radial Prism 3D algorithm
+## Defines a Radial Prism 3D algorithm
+# @ingroup l3_algos_radialp
#
-# More details.
class Mesh_RadialPrism3D(Mesh_Algorithm):
## Private constructor.
def Get3DHypothesis(self):
return self.distribHyp
- ## Private method creating 1D hypothes and storing it in the LayerDistribution
- # hypothes. Returns the created hypothes
+ ## Private method creating a 1D hypothesis and storing it in the LayerDistribution
+ # hypothesis. Returns the created hypothesis
def OwnHypothesis(self, hypType, args=[], so="libStdMeshersEngine.so"):
#print "OwnHypothesis",hypType
if not self.nbLayers is None:
self.mesh.GetMesh().RemoveHypothesis( self.geom, self.nbLayers )
self.mesh.GetMesh().AddHypothesis( self.geom, self.distribHyp )
- study = self.mesh.smeshpyD.GetCurrentStudy() # prevent publishing of own 1D hypothesis
+ study = self.mesh.smeshpyD.GetCurrentStudy() # prevents publishing own 1D hypothesis
hyp = self.mesh.smeshpyD.CreateHypothesis(hypType, so)
- self.mesh.smeshpyD.SetCurrentStudy( study ) # anable publishing
+ self.mesh.smeshpyD.SetCurrentStudy( study ) # enables publishing
self.distribHyp.SetLayerDistribution( hyp )
return hyp
- ## Define "NumberOfLayers" hypothesis, specifying a number of layers of
+ ## Defines "NumberOfLayers" hypothesis, specifying the number of layers of
# prisms to build between the inner and outer shells
- # @param UseExisting if ==true - search existing hypothesis created with
- # same parameters, else (default) - create new
+ # @param n number of layers
+ # @param UseExisting if ==true - searches for the existing hypothesis created with
+ # the same parameters, else (default) - creates a new one
def NumberOfLayers(self, n, UseExisting=0):
self.mesh.GetMesh().RemoveHypothesis( self.geom, self.distribHyp )
self.nbLayers = self.Hypothesis("NumberOfLayers", [n], UseExisting=UseExisting,
self.nbLayers.SetNumberOfLayers( n )
return self.nbLayers
- ## Check if the given "NumberOfLayers" hypothesis has the same parameters as given arguments
+ ## Checks if the given "NumberOfLayers" hypothesis has the same parameters as the given arguments
def CompareNumberOfLayers(self, hyp, args):
return IsEqual(hyp.GetNumberOfLayers(), args[0])
- ## Define "LocalLength" hypothesis, specifying segment length
- # to build between the inner and outer shells
- # @param l for the length of segments
- # @param p for the precision of rounding
+ ## Defines "LocalLength" hypothesis, specifying the segment length
+ # to build between the inner and the outer shells
+ # @param l the length of segments
+ # @param p the precision of rounding
def LocalLength(self, l, p=1e-07):
hyp = self.OwnHypothesis("LocalLength", [l,p])
hyp.SetLength(l)
hyp.SetPrecision(p)
return hyp
- ## Define "NumberOfSegments" hypothesis, specifying a number of layers of
- # prisms to build between the inner and outer shells
- # @param n for the number of segments
- # @param s for the scale factor (optional)
+ ## Defines "NumberOfSegments" hypothesis, specifying the number of layers of
+ # prisms to build between the inner and the outer shells.
+ # @param n the number of layers
+ # @param s the scale factor (optional)
def NumberOfSegments(self, n, s=[]):
if s == []:
hyp = self.OwnHypothesis("NumberOfSegments", [n])
hyp.SetNumberOfSegments(n)
return hyp
- ## Define "Arithmetic1D" hypothesis, specifying distribution of segments
- # to build between the inner and outer shells as arithmetic length increasing
- # @param start for the length of the first segment
- # @param end for the length of the last segment
+ ## Defines "Arithmetic1D" hypothesis, specifying the distribution of segments
+ # to build between the inner and the outer shells with a length that changes in arithmetic progression
+ # @param start the length of the first segment
+ # @param end the length of the last segment
def Arithmetic1D(self, start, end ):
hyp = self.OwnHypothesis("Arithmetic1D", [start, end])
hyp.SetLength(start, 1)
hyp.SetLength(end , 0)
return hyp
- ## Define "StartEndLength" hypothesis, specifying distribution of segments
- # to build between the inner and outer shells as geometric length increasing
+ ## Defines "StartEndLength" hypothesis, specifying distribution of segments
+ # to build between the inner and the outer shells as geometric length increasing
# @param start for the length of the first segment
# @param end for the length of the last segment
def StartEndLength(self, start, end):
hyp.SetLength(end , 0)
return hyp
- ## Define "AutomaticLength" hypothesis, specifying number of segments
+ ## Defines "AutomaticLength" hypothesis, specifying the number of segments
# to build between the inner and outer shells
- # @param fineness for the fineness [0-1]
+ # @param fineness defines the quality of the mesh within the range [0-1]
def AutomaticLength(self, fineness=0):
hyp = self.OwnHypothesis("AutomaticLength")
hyp.SetFineness( fineness )
StdMeshers_FaceSide.hxx \
StdMeshers_CompositeSegment_1D.hxx \
StdMeshers_UseExisting_1D2D.hxx \
+ StdMeshers_QuadToTriaAdaptor.hxx \
SMESH_StdMeshers.hxx
# Libraries targets
StdMeshers_SegmentLengthAroundVertex.cxx \
StdMeshers_FaceSide.cxx \
StdMeshers_CompositeSegment_1D.cxx \
- StdMeshers_UseExisting_1D2D.cxx
+ StdMeshers_UseExisting_1D2D.cxx \
+ StdMeshers_QuadToTriaAdaptor.cxx
# additionnal information to compil and link file
#ifdef _DEBUG_
if ( normPar > 1 || normPar < 0) {
dump("DEBUG");
- cout << "WRONG normPar: "<<normPar<< " prevNormPar="<<prevNormPar
- << " u="<<u << " myFirst[i]="<<myFirst[i]<< " myLast[i]="<<myLast[i]
- << " paramSize="<<paramSize<<endl;
+ MESSAGE ( "WRONG normPar: "<<normPar<< " prevNormPar="<<prevNormPar
+ << " u="<<u << " myFirst[i]="<<myFirst[i]<< " myLast[i]="<<myLast[i]
+ << " paramSize="<<paramSize );
}
#endif
u2node.insert( make_pair( normPar, node ));
#ifdef _DEBUG_
if ( EdgeIndex >= myEdge.size() ) {
dump("DEBUG");
- cout << "WRONg EdgeIndex " << 1+EdgeIndex
- << " myNormPar.size()="<<myNormPar.size()
- << " myNormPar["<< EdgeIndex<<"]="<< myNormPar[ EdgeIndex ]
- << " uvPt.normParam="<<uvPt.normParam <<endl;
+ MESSAGE ( "WRONg EdgeIndex " << 1+EdgeIndex
+ << " myNormPar.size()="<<myNormPar.size()
+ << " myNormPar["<< EdgeIndex<<"]="<< myNormPar[ EdgeIndex ]
+ << " uvPt.normParam="<<uvPt.normParam );
}
#endif
paramSize = myNormPar[ EdgeIndex ] - prevNormPar;
void StdMeshers_FaceSide::dump(const char* msg) const
{
#ifdef _DEBUG_
- cout << endl;
- if (msg) cout << msg <<endl;
- cout<<"NB EDGES: "<< myEdge.size() <<endl;
- cout << "nbPoints: "<<myNbPonits<<" vecSize: " << myPoints.size()<<" "<<myFalsePoints.size() <<endl;
+ if (msg) MESSAGE ( std::endl << msg );
+ MESSAGE_BEGIN ("NB EDGES: "<< myEdge.size() );
+ MESSAGE_ADD ( "nbPoints: "<<myNbPonits<<" vecSize: " << myPoints.size()<<" "<<myFalsePoints.size() );
for ( int i=0; i<myEdge.size(); ++i)
{
- cout << "\t"<<i+1<<endl;
- cout << "\tEDGE: ";
- if (myEdge[i].IsNull())
- cout<<"NULL"<<endl;
+ MESSAGE_ADD ( "\t"<<i+1 );
+ MESSAGE_ADD ( "\tEDGE: " );
+ if (myEdge[i].IsNull()) {
+ MESSAGE_ADD ( "NULL" );
+ }
else {
TopAbs::Print(myEdge[i].Orientation(),cout)<<" "<<myEdge[i].TShape().operator->()<<endl;
- cout << "\tV1: " << TopExp::FirstVertex( myEdge[i], 1).TShape().operator->()
- << " V2: " << TopExp::LastVertex( myEdge[i], 1).TShape().operator->() << endl;
+ MESSAGE_ADD ( "\tV1: " << TopExp::FirstVertex( myEdge[i], 1).TShape().operator->()
+ << " V2: " << TopExp::LastVertex( myEdge[i], 1).TShape().operator->() );
+ }
+ MESSAGE_ADD ( "\tC2d: ");
+
+ if (myC2d[i].IsNull()) {
+ MESSAGE_ADD ( "NULL" );
+ }
+ else {
+ MESSAGE_ADD ( myC2d[i].operator->() );
}
- cout << "\tC2d: ";
- if (myC2d[i].IsNull()) cout<<"NULL"<<endl;
- else cout << myC2d[i].operator->()<<endl;
- cout << "\tF: "<<myFirst[i]<< " L: "<< myLast[i]<<endl;
- cout << "\tnormPar: "<<myNormPar[i]<<endl;
+
+ MESSAGE_ADD ( "\tF: "<<myFirst[i]<< " L: "<< myLast[i] );
+ MESSAGE_END ( "\tnormPar: "<<myNormPar[i]<<endl );
}
#endif
}
return true;
}
+//=======================================================================
+//function : isCloser
+//purpose :
+//=======================================================================
+
+inline bool isCloser(const int i, const int j, const int nbhoriz,
+ const FaceQuadStruct* quad, const gp_Pnt2d uv,
+ double & minDist)
+{
+ int ij = j * nbhoriz + i;
+ gp_Pnt2d uv2( quad->uv_grid[ij].u, quad->uv_grid[ij].v );
+ double dist = uv.SquareDistance( uv2 );
+ if ( dist < minDist ) {
+ minDist = dist;
+ return true;
+ }
+ return false;
+}
+
//=======================================================================
//function : findIJ
//purpose : return i,j of the node
static bool findIJ (const SMDS_MeshNode* node, const FaceQuadStruct * quad, int& I, int& J)
{
- I = J = 0;
const SMDS_FacePosition* fpos =
static_cast<const SMDS_FacePosition*>(node->GetPosition().get());
if ( ! fpos ) return false;
gp_Pnt2d uv( fpos->GetUParameter(), fpos->GetVParameter() );
double minDist = DBL_MAX;
- int nbhoriz = Min(quad->side[0]->NbPoints(), quad->side[2]->NbPoints());
- int nbvertic = Min(quad->side[1]->NbPoints(), quad->side[3]->NbPoints());
- for (int i = 1; i < nbhoriz - 1; i++) {
- for (int j = 1; j < nbvertic - 1; j++) {
- int ij = j * nbhoriz + i;
- gp_Pnt2d uv2( quad->uv_grid[ij].u, quad->uv_grid[ij].v );
- double dist = uv.SquareDistance( uv2 );
- if ( dist < minDist ) {
- minDist = dist;
- I = i;
- J = j;
- }
- }
+ const int nbhoriz = quad->side[0]->NbPoints();
+ const int nbvertic = quad->side[1]->NbPoints();
+ I = nbhoriz/2; J = nbvertic/2;
+ int oldI, oldJ;
+ do {
+ oldI = I; oldJ = J;
+ while ( I + 2 < nbhoriz && isCloser( I + 1, J, nbhoriz, quad, uv, minDist ))
+ I += 1;
+ if ( I == oldI )
+ while ( I - 1 > 0 && isCloser( I - 1, J, nbhoriz, quad, uv, minDist ))
+ I -= 1;
+ if ( minDist < DBL_MIN )
+ break;
+
+ while ( J + 2 < nbvertic && isCloser( I, J + 1, nbhoriz, quad, uv, minDist ))
+ J += 1;
+ if ( J == oldJ )
+ while ( J - 1 > 0 && isCloser( I, J - 1, nbhoriz, quad, uv, minDist ))
+ J -= 1;
+ if ( minDist < DBL_MIN )
+ break;
+
+ } while ( I != oldI || J != oldJ );
+
+ if ( minDist > DBL_MIN ) {
+ for (int i = 1; i < nbhoriz - 1; i++)
+ for (int j = 1; j < nbvertic - 1; j++)
+ if ( isCloser( i, j, nbhoriz, quad, uv, minDist ))
+ I = i, J = j;
}
return true;
}
const vector<UVPtStruct>& uvPtVec = wires[ iW ]->GetUVPtStruct();
if ( uvPtVec.size() != wires[ iW ]->NbPoints() ) {
return error(COMPERR_BAD_INPUT_MESH,SMESH_Comment("Unexpected nb of points on wire ")
- << iW << uvPtVec.size()<<" != "<<wires[ iW ]->NbPoints());
+ << iW << ": " << uvPtVec.size()<<" != "<<wires[ iW ]->NbPoints()
+ << ", probably because of invalid node parameters on geom edges");
}
if ( m + uvPtVec.size()-1 > mefistoToDS.size() ) {
MESSAGE("Wrong mefistoToDS.size: "<<mefistoToDS.size()<<" < "<<m + uvPtVec.size()-1);
}
break; // try by vertex closeness
}
+ case TopAbs_COMPOUND: {
+ // ----------------------------------------------------------------------
+ if ( IsPropagationPossible( theMesh1, theMesh2 )) {
+ // find a boundary edge for theShape1
+ TopoDS_Edge E;
+ for(TopExp_Explorer exp(theShape1, TopAbs_EDGE); exp.More(); exp.Next() ) {
+ E = TopoDS::Edge( exp.Current() );
+ int NbFacesFromShape1 = 0;
+ const TopTools_ListOfShape& EAncestors = theMesh1->GetAncestors(E);
+ TopTools_ListIteratorOfListOfShape itea(EAncestors);
+ for(; itea.More(); itea.Next()) {
+ if( itea.Value().ShapeType() != TopAbs_FACE ) continue;
+ TopoDS_Face face = TopoDS::Face(itea.Value());
+ for(TopExp_Explorer expf(theShape1, TopAbs_FACE); expf.More(); expf.Next() ) {
+ if(face.IsSame(expf.Current())) {
+ NbFacesFromShape1++;
+ break;
+ }
+ }
+ }
+ if(NbFacesFromShape1==1) break;
+ }
+ // find association for vertices of edge E
+ TopoDS_Vertex VV1[2], VV2[2];
+ for(TopExp_Explorer eexp(E, TopAbs_VERTEX); eexp.More(); eexp.Next()) {
+ TopoDS_Vertex V1 = TopoDS::Vertex( eexp.Current() );
+ // look for an edge ending in E whose one vertex is in theShape1
+ // and the other, in theShape2
+ const TopTools_ListOfShape& Ancestors = theMesh1->GetAncestors(V1);
+ TopTools_ListIteratorOfListOfShape ita(Ancestors);
+ for(; ita.More(); ita.Next()) {
+ if( ita.Value().ShapeType() != TopAbs_EDGE ) continue;
+ TopoDS_Edge edge = TopoDS::Edge(ita.Value());
+ bool FromShape1 = false;
+ for(TopExp_Explorer expe(theShape1, TopAbs_EDGE); expe.More(); expe.Next() ) {
+ if(edge.IsSame(expe.Current())) {
+ FromShape1 = true;
+ break;
+ }
+ }
+ if(!FromShape1) {
+ // is it an edge between theShape1 and theShape2?
+ TopExp_Explorer expv(edge, TopAbs_VERTEX);
+ TopoDS_Vertex V2 = TopoDS::Vertex( expv.Current() );
+ if(V2.IsSame(V1)) {
+ expv.Next();
+ V2 = TopoDS::Vertex( expv.Current() );
+ }
+ bool FromShape2 = false;
+ for ( expv.Init( theShape2, TopAbs_VERTEX ); expv.More(); expv.Next()) {
+ if ( V2.IsSame( expv.Current() )) {
+ FromShape2 = true;
+ break;
+ }
+ }
+ if ( FromShape2 ) {
+ if ( VV1[0].IsNull() )
+ VV1[0] = V1, VV2[0] = V2;
+ else
+ VV1[1] = V1, VV2[1] = V2;
+ break; // from loop on ancestors of V1
+ }
+ }
+ }
+ }
+ if ( !VV1[1].IsNull() ) {
+ InsertAssociation( VV1[0], VV2[0], theMap, bidirect);
+ InsertAssociation( VV1[1], VV2[1], theMap, bidirect);
+ return FindSubShapeAssociation( theShape1, theMesh1, theShape2, theMesh2, theMap);
+ }
+ }
+ break; // try by vertex closeness
+ }
default:;
}
#include "utilities.h"
#include <BRep_Tool.hxx>
+#include <Bnd_B2d.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
if ( !_sourceHypo )
return false;
- SMESH_Mesh * srcMesh = _sourceHypo->GetSourceMesh();
+ SMESH_Mesh * srcMesh = _sourceHypo->GetSourceMesh();
SMESH_Mesh * tgtMesh = & theMesh;
if ( !srcMesh )
srcMesh = tgtMesh;
// Prepare to mapping
// --------------------
+ SMESH_MesherHelper helper( theMesh );
+ helper.SetSubShape( tgtFace );
+
+ // Check if node projection to a face is needed
+ Bnd_B2d uvBox;
+ SMDS_ElemIteratorPtr faceIt = srcSubMesh->GetSubMeshDS()->GetElements();
+ for ( int nbN = 0; nbN < 3 && faceIt->more(); ) {
+ const SMDS_MeshElement* face = faceIt->next();
+ SMDS_ElemIteratorPtr nodeIt = face->nodesIterator();
+ while ( nodeIt->more() ) {
+ const SMDS_MeshNode* node = static_cast<const SMDS_MeshNode*>( nodeIt->next() );
+ if ( node->GetPosition()->GetTypeOfPosition() == SMDS_TOP_FACE ) {
+ nbN++;
+ uvBox.Add( helper.GetNodeUV( srcFace, node ));
+ }
+ }
+ }
+ const bool toProjectNodes = ( uvBox.IsVoid() || uvBox.SquareExtent() < DBL_MIN );
+
// Load pattern from the source face
SMESH_Pattern mapper;
- mapper.Load( srcMesh, srcFace );
+ mapper.Load( srcMesh, srcFace, toProjectNodes );
if ( mapper.GetErrorCode() != SMESH_Pattern::ERR_OK )
return error(COMPERR_BAD_INPUT_MESH,"Can't load mesh pattern from the source face");
SMESH_MeshEditor editor( tgtMesh );
SMESH_MeshEditor::TListOfListOfNodes groupsOfNodes;
- SMESH_MesherHelper helper( theMesh );
- helper.SetSubShape( tgtFace );
-
// Make groups of nodes to merge
// loop on edge and vertex submeshes of a target face
// Merge
+ int nbFaceBeforeMerge = tgtSubMesh->GetSubMeshDS()->NbElements();
editor.MergeNodes( groupsOfNodes );
+ int nbFaceAtferMerge = tgtSubMesh->GetSubMeshDS()->NbElements();
+ if ( nbFaceBeforeMerge != nbFaceAtferMerge )
+ return error(COMPERR_BAD_INPUT_MESH, "Probably invalid node parameters on geom faces");
// ---------------------------
// Check elements orientation
// clear propagation chain
clearPropagationChain( subMesh );
}
- return;
- case SMESH_subMesh::MODIF_HYP: // hyp modif
+ // return; -- hyp is modified any way
+ default:
+ //case SMESH_subMesh::MODIF_HYP: // hyp modif
// clear mesh in a chain
DBGMSG( "MODIF_HYP on HAS_PROPAG_HYP " << subMesh->GetId() );
SMESH_subMeshIteratorPtr smIt = data->GetChain();
--- /dev/null
+// SMESH SMESH : implementaion of SMESH idl descriptions
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//
+// File : StdMeshers_QuadToTriaAdaptor.cxx
+// Module : SMESH
+// Created : Wen May 07 16:37:07 2008
+// Author : Sergey KUUL (skl)
+
+
+#include "StdMeshers_QuadToTriaAdaptor.hxx"
+
+//#include <TColgp_HArray1OfPnt.hxx>
+//#include <TColgp_HArray1OfVec.hxx>
+#include <TopExp_Explorer.hxx>
+#include <TopoDS.hxx>
+#include <SMESH_Algo.hxx>
+#include <TColgp_HSequenceOfPnt.hxx>
+#include <TColStd_MapOfInteger.hxx>
+#include <TColStd_HSequenceOfInteger.hxx>
+#include <IntAna_Quadric.hxx>
+#include <IntAna_IntConicQuad.hxx>
+#include <gp_Lin.hxx>
+#include <gp_Pln.hxx>
+#include <SMDS_FaceOfNodes.hxx>
+
+#include <NCollection_Array1.hxx>
+typedef NCollection_Array1<TColStd_SequenceOfInteger> StdMeshers_Array1OfSequenceOfInteger;
+
+
+//=======================================================================
+//function : StdMeshers_QuadToTriaAdaptor
+//purpose :
+//=======================================================================
+
+StdMeshers_QuadToTriaAdaptor::StdMeshers_QuadToTriaAdaptor()
+{
+}
+
+
+//================================================================================
+/*!
+ * \brief Destructor
+ */
+//================================================================================
+
+StdMeshers_QuadToTriaAdaptor::~StdMeshers_QuadToTriaAdaptor()
+{}
+
+
+//=======================================================================
+//function : FindBestPoint
+//purpose : Auxilare for Compute()
+// V - normal to (P1,P2,PC)
+//=======================================================================
+static gp_Pnt FindBestPoint(const gp_Pnt& P1, const gp_Pnt& P2,
+ const gp_Pnt& PC, const gp_Vec& V)
+{
+ double a = P1.Distance(P2);
+ double b = P1.Distance(PC);
+ double c = P2.Distance(PC);
+ if( a < (b+c)/2 )
+ return PC;
+ else {
+ // find shift along V in order to a became equal to (b+c)/2
+ double shift = sqrt( a*a + (b*b-c*c)*(b*b-c*c)/16/a/a - (b*b+c*c)/2 );
+ gp_Dir aDir(V);
+ gp_Pnt Pbest( PC.X() + aDir.X()*shift, PC.Y() + aDir.Y()*shift,
+ PC.Z() + aDir.Z()*shift );
+ return Pbest;
+ }
+}
+
+
+//=======================================================================
+//function : HasIntersection3
+//purpose : Auxilare for HasIntersection()
+// find intersection point between triangle (P1,P2,P3)
+// and segment [PC,P]
+//=======================================================================
+static bool HasIntersection3(const gp_Pnt& P, const gp_Pnt& PC, gp_Pnt& Pint,
+ const gp_Pnt& P1, const gp_Pnt& P2, const gp_Pnt& P3)
+{
+ //cout<<"HasIntersection3"<<endl;
+ //cout<<" PC("<<PC.X()<<","<<PC.Y()<<","<<PC.Z()<<")"<<endl;
+ //cout<<" P("<<P.X()<<","<<P.Y()<<","<<P.Z()<<")"<<endl;
+ //cout<<" P1("<<P1.X()<<","<<P1.Y()<<","<<P1.Z()<<")"<<endl;
+ //cout<<" P2("<<P2.X()<<","<<P2.Y()<<","<<P2.Z()<<")"<<endl;
+ //cout<<" P3("<<P3.X()<<","<<P3.Y()<<","<<P3.Z()<<")"<<endl;
+ gp_Vec VP1(P1,P2);
+ gp_Vec VP2(P1,P3);
+ IntAna_Quadric IAQ(gp_Pln(P1,VP1.Crossed(VP2)));
+ IntAna_IntConicQuad IAICQ(gp_Lin(PC,gp_Dir(gp_Vec(PC,P))),IAQ);
+ if(IAICQ.IsDone()) {
+ if( IAICQ.IsInQuadric() )
+ return false;
+ if( IAICQ.NbPoints() == 1 ) {
+ gp_Pnt PIn = IAICQ.Point(1);
+ double preci = 1.e-6;
+ // check if this point is internal for segment [PC,P]
+ bool IsExternal =
+ ( (PC.X()-PIn.X())*(P.X()-PIn.X()) > preci ) ||
+ ( (PC.Y()-PIn.Y())*(P.Y()-PIn.Y()) > preci ) ||
+ ( (PC.Z()-PIn.Z())*(P.Z()-PIn.Z()) > preci );
+ if(IsExternal) {
+ return false;
+ }
+ // check if this point is internal for triangle (P1,P2,P3)
+ gp_Vec V1(PIn,P1);
+ gp_Vec V2(PIn,P2);
+ gp_Vec V3(PIn,P3);
+ if( V1.Magnitude()<preci || V2.Magnitude()<preci ||
+ V3.Magnitude()<preci ) {
+ Pint = PIn;
+ return true;
+ }
+ gp_Vec VC1 = V1.Crossed(V2);
+ gp_Vec VC2 = V2.Crossed(V3);
+ gp_Vec VC3 = V3.Crossed(V1);
+ if(VC1.Magnitude()<preci) {
+ if(VC2.IsOpposite(VC3,preci)) {
+ return false;
+ }
+ }
+ else if(VC2.Magnitude()<preci) {
+ if(VC1.IsOpposite(VC3,preci)) {
+ return false;
+ }
+ }
+ else if(VC3.Magnitude()<preci) {
+ if(VC1.IsOpposite(VC2,preci)) {
+ return false;
+ }
+ }
+ else {
+ if( VC1.IsOpposite(VC2,preci) || VC1.IsOpposite(VC3,preci) ||
+ VC2.IsOpposite(VC3,preci) ) {
+ return false;
+ }
+ }
+ Pint = PIn;
+ return true;
+ }
+ }
+
+ return false;
+}
+
+
+//=======================================================================
+//function : HasIntersection
+//purpose : Auxilare for CheckIntersection()
+//=======================================================================
+static bool HasIntersection(const gp_Pnt& P, const gp_Pnt& PC, gp_Pnt& Pint,
+ Handle(TColgp_HSequenceOfPnt)& aContour)
+{
+ if(aContour->Length()==3) {
+ return HasIntersection3( P, PC, Pint, aContour->Value(1),
+ aContour->Value(2), aContour->Value(3) );
+ }
+ else {
+ bool check = false;
+ if( (aContour->Value(1).Distance(aContour->Value(2)) > 1.e-6) &&
+ (aContour->Value(1).Distance(aContour->Value(3)) > 1.e-6) &&
+ (aContour->Value(2).Distance(aContour->Value(3)) > 1.e-6) ) {
+ check = HasIntersection3( P, PC, Pint, aContour->Value(1),
+ aContour->Value(2), aContour->Value(3) );
+ }
+ if(check) return true;
+ if( (aContour->Value(1).Distance(aContour->Value(4)) > 1.e-6) &&
+ (aContour->Value(1).Distance(aContour->Value(3)) > 1.e-6) &&
+ (aContour->Value(4).Distance(aContour->Value(3)) > 1.e-6) ) {
+ check = HasIntersection3( P, PC, Pint, aContour->Value(1),
+ aContour->Value(3), aContour->Value(4) );
+ }
+ if(check) return true;
+ }
+
+ return false;
+}
+
+
+//=======================================================================
+//function : CheckIntersection
+//purpose : Auxilare for Compute()
+// NotCheckedFace - for optimization
+//=======================================================================
+bool StdMeshers_QuadToTriaAdaptor::CheckIntersection
+ (const gp_Pnt& P, const gp_Pnt& PC,
+ gp_Pnt& Pint, SMESH_Mesh& aMesh,
+ const TopoDS_Shape& aShape,
+ const TopoDS_Shape& NotCheckedFace)
+{
+ SMESHDS_Mesh * meshDS = aMesh.GetMeshDS();
+ //cout<<" CheckIntersection: meshDS->NbFaces() = "<<meshDS->NbFaces()<<endl;
+ bool res = false;
+ double dist = RealLast();
+ gp_Pnt Pres;
+ for (TopExp_Explorer exp(aShape,TopAbs_FACE);exp.More();exp.Next()) {
+ const TopoDS_Shape& aShapeFace = exp.Current();
+ if(aShapeFace==NotCheckedFace)
+ continue;
+ const SMESHDS_SubMesh * aSubMeshDSFace = meshDS->MeshElements(aShapeFace);
+ if ( aSubMeshDSFace ) {
+ SMDS_ElemIteratorPtr iteratorElem = aSubMeshDSFace->GetElements();
+ while ( iteratorElem->more() ) { // loop on elements on a face
+ const SMDS_MeshElement* face = iteratorElem->next();
+ Handle(TColgp_HSequenceOfPnt) aContour = new TColgp_HSequenceOfPnt;
+ SMDS_ElemIteratorPtr nodeIt = face->nodesIterator();
+ if( !face->IsQuadratic() ) {
+ while ( nodeIt->more() ) {
+ const SMDS_MeshNode* node = static_cast<const SMDS_MeshNode*>( nodeIt->next() );
+ aContour->Append(gp_Pnt(node->X(), node->Y(), node->Z()));
+ }
+ }
+ else {
+ int nn = 0;
+ while ( nodeIt->more() ) {
+ nn++;
+ const SMDS_MeshNode* node = static_cast<const SMDS_MeshNode*>( nodeIt->next() );
+ aContour->Append(gp_Pnt(node->X(), node->Y(), node->Z()));
+ if(nn==face->NbNodes()/2) break;
+ }
+ }
+ if( HasIntersection(P, PC, Pres, aContour) ) {
+ res = true;
+ double tmp = PC.Distance(Pres);
+ if(tmp<dist) {
+ Pint = Pres;
+ dist = tmp;
+ }
+ }
+ }
+ }
+ }
+ return res;
+}
+
+
+//=======================================================================
+//function : CompareTrias
+//purpose : Auxilare for Compute()
+//=======================================================================
+static bool CompareTrias(const SMDS_MeshElement* F1,const SMDS_MeshElement* F2)
+{
+ SMDS_ElemIteratorPtr nIt = F1->nodesIterator();
+ const SMDS_MeshNode* Ns1[3];
+ int k = 0;
+ while( nIt->more() ) {
+ Ns1[k] = static_cast<const SMDS_MeshNode*>( nIt->next() );
+ k++;
+ }
+ nIt = F2->nodesIterator();
+ const SMDS_MeshNode* Ns2[3];
+ k = 0;
+ while( nIt->more() ) {
+ Ns2[k] = static_cast<const SMDS_MeshNode*>( nIt->next() );
+ k++;
+ }
+ if( ( Ns1[1]==Ns2[1] && Ns1[2]==Ns2[2] ) ||
+ ( Ns1[1]==Ns2[2] && Ns1[2]==Ns2[1] ) )
+ return true;
+ return false;
+}
+
+
+//=======================================================================
+//function : IsDegenarate
+//purpose : Auxilare for Preparation()
+//=======================================================================
+static int IsDegenarate(const Handle(TColgp_HArray1OfPnt)& PN)
+{
+ int i = 1;
+ for(; i<4; i++) {
+ int j = i+1;
+ for(; j<=4; j++) {
+ if( PN->Value(i).Distance(PN->Value(j)) < 1.e-6 )
+ return j;
+ }
+ }
+ return 0;
+}
+
+
+//=======================================================================
+//function : Preparation
+//purpose : Auxilare for Compute()
+// : Return 0 if given face is not quad,
+// 1 if given face is quad,
+// 2 if given face is degenerate quad (two nodes are coincided)
+//=======================================================================
+int StdMeshers_QuadToTriaAdaptor::Preparation(const SMDS_MeshElement* face,
+ Handle(TColgp_HArray1OfPnt) PN,
+ Handle(TColgp_HArray1OfVec) VN,
+ std::vector<const SMDS_MeshNode*>& FNodes,
+ gp_Pnt& PC, gp_Vec& VNorm)
+{
+ int i = 0;
+ double xc=0., yc=0., zc=0.;
+ SMDS_ElemIteratorPtr nodeIt = face->nodesIterator();
+ if( !face->IsQuadratic() ) {
+ if( face->NbNodes() != 4 )
+ return 0;
+ while ( nodeIt->more() ) {
+ i++;
+ const SMDS_MeshNode* node = static_cast<const SMDS_MeshNode*>( nodeIt->next() );
+ FNodes[i-1] = node;
+ PN->SetValue( i, gp_Pnt(node->X(), node->Y(), node->Z()) );
+ xc += node->X();
+ yc += node->Y();
+ zc += node->Z();
+ }
+ }
+ else {
+ if( face->NbNodes() != 8)
+ return 0;
+ while ( nodeIt->more() ) {
+ i++;
+ const SMDS_MeshNode* node = static_cast<const SMDS_MeshNode*>( nodeIt->next() );
+ FNodes[i-1] = node;
+ PN->SetValue( i, gp_Pnt(node->X(), node->Y(), node->Z()) );
+ xc += node->X();
+ yc += node->Y();
+ zc += node->Z();
+ if(i==4) break;
+ }
+ }
+
+ int nbp = 4;
+
+ int j = 0;
+ for(i=1; i<4; i++) {
+ j = i+1;
+ for(; j<=4; j++) {
+ if( PN->Value(i).Distance(PN->Value(j)) < 1.e-6 )
+ break;
+ }
+ if(j<=4) break;
+ }
+ //int deg_num = IsDegenarate(PN);
+ //if(deg_num>0) {
+ bool hasdeg = false;
+ if(i<4) {
+ //cout<<"find degeneration"<<endl;
+ hasdeg = true;
+ gp_Pnt Pdeg = PN->Value(i);
+
+ std::list< const SMDS_MeshNode* >::iterator itdg = myDegNodes.begin();
+ const SMDS_MeshNode* DegNode = 0;
+ for(; itdg!=myDegNodes.end(); itdg++) {
+ const SMDS_MeshNode* N = (*itdg);
+ gp_Pnt Ptmp(N->X(),N->Y(),N->Z());
+ if(Pdeg.Distance(Ptmp)<1.e-6) {
+ DegNode = N;
+ //DegNode = const_cast<SMDS_MeshNode*>(N);
+ break;
+ }
+ }
+ if(!DegNode) {
+ DegNode = FNodes[i-1];
+ myDegNodes.push_back(DegNode);
+ }
+ else {
+ FNodes[i-1] = DegNode;
+ }
+ for(i=j; i<4; i++) {
+ PN->SetValue(i,PN->Value(i+1));
+ FNodes[i-1] = FNodes[i];
+ }
+ nbp = 3;
+ //PC = gp_Pnt( PN->Value(1).X() + PN.Value
+ }
+
+ PC = gp_Pnt(xc/4., yc/4., zc/4.);
+ //cout<<" PC("<<PC.X()<<","<<PC.Y()<<","<<PC.Z()<<")"<<endl;
+
+ //PN->SetValue(5,PN->Value(1));
+ PN->SetValue(nbp+1,PN->Value(1));
+ //FNodes[4] = FNodes[0];
+ FNodes[nbp] = FNodes[0];
+ // find normal direction
+ //gp_Vec V1(PC,PN->Value(4));
+ gp_Vec V1(PC,PN->Value(nbp));
+ gp_Vec V2(PC,PN->Value(1));
+ VNorm = V1.Crossed(V2);
+ //VN->SetValue(4,VNorm);
+ VN->SetValue(nbp,VNorm);
+ //for(i=1; i<4; i++) {
+ for(i=1; i<nbp; i++) {
+ V1 = gp_Vec(PC,PN->Value(i));
+ V2 = gp_Vec(PC,PN->Value(i+1));
+ gp_Vec Vtmp = V1.Crossed(V2);
+ VN->SetValue(i,Vtmp);
+ VNorm += Vtmp;
+ }
+ //cout<<" VNorm("<<VNorm.X()<<","<<VNorm.Y()<<","<<VNorm.Z()<<")"<<endl;
+ if(hasdeg) return 2;
+ return 1;
+}
+
+
+//=======================================================================
+//function : Compute
+//purpose :
+//=======================================================================
+
+bool StdMeshers_QuadToTriaAdaptor::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape)
+{
+ myResMap.clear();
+ myMapFPyram.clear();
+
+ SMESHDS_Mesh * meshDS = aMesh.GetMeshDS();
+
+ for (TopExp_Explorer exp(aShape,TopAbs_FACE);exp.More();exp.Next()) {
+ const TopoDS_Shape& aShapeFace = exp.Current();
+ const SMESHDS_SubMesh * aSubMeshDSFace = meshDS->MeshElements( aShapeFace );
+ if ( aSubMeshDSFace ) {
+ bool isRev = SMESH_Algo::IsReversedSubMesh( TopoDS::Face(aShapeFace), meshDS );
+
+ SMDS_ElemIteratorPtr iteratorElem = aSubMeshDSFace->GetElements();
+ while ( iteratorElem->more() ) { // loop on elements on a face
+ const SMDS_MeshElement* face = iteratorElem->next();
+ //cout<<endl<<"================= face->GetID() = "<<face->GetID()<<endl;
+ // preparation step using face info
+ Handle(TColgp_HArray1OfPnt) PN = new TColgp_HArray1OfPnt(1,5);
+ Handle(TColgp_HArray1OfVec) VN = new TColgp_HArray1OfVec(1,4);
+ std::vector<const SMDS_MeshNode*> FNodes(5);
+ gp_Pnt PC;
+ gp_Vec VNorm;
+ int stat = Preparation(face, PN, VN, FNodes, PC, VNorm);
+ if(stat==0)
+ continue;
+
+ if(stat==2) {
+ // degenerate face
+ // add triangles to result map
+ std::list<const SMDS_FaceOfNodes*> aList;
+ SMDS_FaceOfNodes* NewFace;
+ if(!isRev)
+ NewFace = new SMDS_FaceOfNodes( FNodes[0], FNodes[1], FNodes[2] );
+ else
+ NewFace = new SMDS_FaceOfNodes( FNodes[0], FNodes[2], FNodes[1] );
+ aList.push_back(NewFace);
+ myResMap.insert(make_pair(face,aList));
+ continue;
+ }
+
+ if(!isRev) VNorm.Reverse();
+ double xc = 0., yc = 0., zc = 0.;
+ int i = 1;
+ for(; i<=4; i++) {
+ gp_Pnt Pbest;
+ if(!isRev)
+ Pbest = FindBestPoint(PN->Value(i), PN->Value(i+1), PC, VN->Value(i).Reversed());
+ else
+ Pbest = FindBestPoint(PN->Value(i), PN->Value(i+1), PC, VN->Value(i));
+ xc += Pbest.X();
+ yc += Pbest.Y();
+ zc += Pbest.Z();
+ }
+ gp_Pnt PCbest(xc/4., yc/4., zc/4.);
+
+ // check PCbest
+ double height = PCbest.Distance(PC);
+ if(height<1.e-6) {
+ // create new PCbest using a bit shift along VNorm
+ PCbest = gp_Pnt( PC.X() + VNorm.X()*0.001,
+ PC.Y() + VNorm.Y()*0.001,
+ PC.Z() + VNorm.Z()*0.001);
+ }
+ else {
+ // check possible intersection with other faces
+ gp_Pnt Pint;
+ bool check = CheckIntersection(PCbest, PC, Pint, aMesh, aShape, aShapeFace);
+ if(check) {
+ //cout<<"--PC("<<PC.X()<<","<<PC.Y()<<","<<PC.Z()<<")"<<endl;
+ //cout<<" PCbest("<<PCbest.X()<<","<<PCbest.Y()<<","<<PCbest.Z()<<")"<<endl;
+ double dist = PC.Distance(Pint)/3.;
+ gp_Dir aDir(gp_Vec(PC,PCbest));
+ PCbest = gp_Pnt( PC.X() + aDir.X()*dist,
+ PC.Y() + aDir.Y()*dist,
+ PC.Z() + aDir.Z()*dist );
+ }
+ else {
+ gp_Vec VB(PC,PCbest);
+ gp_Pnt PCbestTmp(PC.X()+VB.X()*3, PC.X()+VB.X()*3, PC.X()+VB.X()*3);
+ bool check = CheckIntersection(PCbestTmp, PC, Pint, aMesh, aShape, aShapeFace);
+ if(check) {
+ double dist = PC.Distance(Pint)/3.;
+ if(dist<height) {
+ gp_Dir aDir(gp_Vec(PC,PCbest));
+ PCbest = gp_Pnt( PC.X() + aDir.X()*dist,
+ PC.Y() + aDir.Y()*dist,
+ PC.Z() + aDir.Z()*dist );
+ }
+ }
+ }
+ }
+ // create node for PCbest
+ SMDS_MeshNode* NewNode = meshDS->AddNode( PCbest.X(), PCbest.Y(), PCbest.Z() );
+ // add triangles to result map
+ std::list<const SMDS_FaceOfNodes*> aList;
+ for(i=0; i<4; i++) {
+ SMDS_FaceOfNodes* NewFace = new SMDS_FaceOfNodes( NewNode, FNodes[i], FNodes[i+1] );
+ aList.push_back(NewFace);
+ }
+ myResMap.insert(make_pair(face,aList));
+ // create pyramid
+ SMDS_MeshVolume* aPyram =
+ meshDS->AddVolume( FNodes[0], FNodes[1], FNodes[2], FNodes[3], NewNode );
+ myMapFPyram.insert(make_pair(face,aPyram));
+ } // end loop on elements on a face
+ }
+ } // end for(TopExp_Explorer exp(aShape,TopAbs_FACE);exp.More();exp.Next()) {
+
+ return Compute2ndPart(aMesh);
+}
+
+
+//=======================================================================
+//function : Compute
+//purpose :
+//=======================================================================
+
+bool StdMeshers_QuadToTriaAdaptor::Compute(SMESH_Mesh& aMesh)
+{
+ myResMap.clear();
+ myMapFPyram.clear();
+
+ SMESHDS_Mesh * meshDS = aMesh.GetMeshDS();
+
+ SMDS_FaceIteratorPtr itFace = meshDS->facesIterator();
+
+ while(itFace->more()) {
+ const SMDS_MeshElement* face = itFace->next();
+ if ( !face ) continue;
+ //cout<<endl<<"================= face->GetID() = "<<face->GetID()<<endl;
+ // preparation step using face info
+ Handle(TColgp_HArray1OfPnt) PN = new TColgp_HArray1OfPnt(1,5);
+ Handle(TColgp_HArray1OfVec) VN = new TColgp_HArray1OfVec(1,4);
+ std::vector<const SMDS_MeshNode*> FNodes(5);
+ gp_Pnt PC;
+ gp_Vec VNorm;
+
+ int stat = Preparation(face, PN, VN, FNodes, PC, VNorm);
+ if(stat==0)
+ continue;
+
+ if(stat==2) {
+ // degenerate face
+ // add triangles to result map
+ std::list<const SMDS_FaceOfNodes*> aList;
+ SMDS_FaceOfNodes* NewFace;
+ // check orientation
+
+ double tmp = PN->Value(1).Distance(PN->Value(2)) +
+ PN->Value(2).Distance(PN->Value(3));
+ gp_Dir tmpDir(VNorm);
+ gp_Pnt Ptmp1( PC.X() + tmpDir.X()*tmp*1.e6,
+ PC.Y() + tmpDir.Y()*tmp*1.e6,
+ PC.Z() + tmpDir.Z()*tmp*1.e6 );
+ gp_Pnt Ptmp2( PC.X() + tmpDir.Reversed().X()*tmp*1.e6,
+ PC.Y() + tmpDir.Reversed().Y()*tmp*1.e6,
+ PC.Z() + tmpDir.Reversed().Z()*tmp*1.e6 );
+ // check intersection for Ptmp1 and Ptmp2
+ bool IsRev = false;
+ bool IsOK1 = false;
+ bool IsOK2 = false;
+ double dist1 = RealLast();
+ double dist2 = RealLast();
+ gp_Pnt Pres1,Pres2;
+ SMDS_FaceIteratorPtr itf = meshDS->facesIterator();
+ while(itf->more()) {
+ const SMDS_MeshElement* F = itf->next();
+ if(F==face) continue;
+ Handle(TColgp_HSequenceOfPnt) aContour = new TColgp_HSequenceOfPnt;
+ SMDS_ElemIteratorPtr nodeIt = F->nodesIterator();
+ if( !F->IsQuadratic() ) {
+ while ( nodeIt->more() ) {
+ const SMDS_MeshNode* node = static_cast<const SMDS_MeshNode*>( nodeIt->next() );
+ aContour->Append(gp_Pnt(node->X(), node->Y(), node->Z()));
+ }
+ }
+ else {
+ int nn = 0;
+ while ( nodeIt->more() ) {
+ nn++;
+ const SMDS_MeshNode* node = static_cast<const SMDS_MeshNode*>( nodeIt->next() );
+ aContour->Append(gp_Pnt(node->X(), node->Y(), node->Z()));
+ if(nn==face->NbNodes()/2) break;
+ }
+ }
+ gp_Pnt PPP;
+ if( HasIntersection(Ptmp1, PC, PPP, aContour) ) {
+ IsOK1 = true;
+ double tmp = PC.Distance(PPP);
+ if(tmp<dist1) {
+ Pres1 = PPP;
+ dist1 = tmp;
+ }
+ }
+ if( HasIntersection(Ptmp2, PC, PPP, aContour) ) {
+ IsOK2 = true;
+ double tmp = PC.Distance(PPP);
+ if(tmp<dist2) {
+ Pres2 = PPP;
+ dist2 = tmp;
+ }
+ }
+ }
+
+ if( IsOK1 && !IsOK2 ) {
+ // using existed direction
+ }
+ else if( !IsOK1 && IsOK2 ) {
+ // using opposite direction
+ IsRev = true;
+ }
+ else { // IsOK1 && IsOK2
+ double tmp1 = PC.Distance(Pres1)/3.;
+ double tmp2 = PC.Distance(Pres2)/3.;
+ if(tmp1<tmp2) {
+ // using existed direction
+ }
+ else {
+ // using opposite direction
+ IsRev = true;
+ }
+ }
+ if(!IsRev)
+ NewFace = new SMDS_FaceOfNodes( FNodes[0], FNodes[1], FNodes[2] );
+ else
+ NewFace = new SMDS_FaceOfNodes( FNodes[0], FNodes[2], FNodes[1] );
+ aList.push_back(NewFace);
+ myResMap.insert(make_pair(face,aList));
+ continue;
+ }
+
+ double xc = 0., yc = 0., zc = 0.;
+ int i = 1;
+ for(; i<=4; i++) {
+ gp_Pnt Pbest = FindBestPoint(PN->Value(i), PN->Value(i+1), PC, VN->Value(i));
+ xc += Pbest.X();
+ yc += Pbest.Y();
+ zc += Pbest.Z();
+ }
+ gp_Pnt PCbest(xc/4., yc/4., zc/4.);
+ double height = PCbest.Distance(PC);
+ if(height<1.e-6) {
+ // create new PCbest using a bit shift along VNorm
+ PCbest = gp_Pnt( PC.X() + VNorm.X()*0.001,
+ PC.Y() + VNorm.Y()*0.001,
+ PC.Z() + VNorm.Z()*0.001);
+ height = PCbest.Distance(PC);
+ }
+ //cout<<" PCbest("<<PCbest.X()<<","<<PCbest.Y()<<","<<PCbest.Z()<<")"<<endl;
+
+ gp_Vec V1(PC,PCbest);
+ double tmp = PN->Value(1).Distance(PN->Value(3)) +
+ PN->Value(2).Distance(PN->Value(4));
+ gp_Dir tmpDir(V1);
+ gp_Pnt Ptmp1( PC.X() + tmpDir.X()*tmp*1.e6,
+ PC.Y() + tmpDir.Y()*tmp*1.e6,
+ PC.Z() + tmpDir.Z()*tmp*1.e6 );
+ gp_Pnt Ptmp2( PC.X() + tmpDir.Reversed().X()*tmp*1.e6,
+ PC.Y() + tmpDir.Reversed().Y()*tmp*1.e6,
+ PC.Z() + tmpDir.Reversed().Z()*tmp*1.e6 );
+ // check intersection for Ptmp1 and Ptmp2
+ bool IsRev = false;
+ bool IsOK1 = false;
+ bool IsOK2 = false;
+ double dist1 = RealLast();
+ double dist2 = RealLast();
+ gp_Pnt Pres1,Pres2;
+ SMDS_FaceIteratorPtr itf = meshDS->facesIterator();
+ while(itf->more()) {
+ const SMDS_MeshElement* F = itf->next();
+ if(F==face) continue;
+ Handle(TColgp_HSequenceOfPnt) aContour = new TColgp_HSequenceOfPnt;
+ SMDS_ElemIteratorPtr nodeIt = F->nodesIterator();
+ if( !F->IsQuadratic() ) {
+ while ( nodeIt->more() ) {
+ const SMDS_MeshNode* node = static_cast<const SMDS_MeshNode*>( nodeIt->next() );
+ aContour->Append(gp_Pnt(node->X(), node->Y(), node->Z()));
+ }
+ }
+ else {
+ int nn = 0;
+ while ( nodeIt->more() ) {
+ nn++;
+ const SMDS_MeshNode* node = static_cast<const SMDS_MeshNode*>( nodeIt->next() );
+ aContour->Append(gp_Pnt(node->X(), node->Y(), node->Z()));
+ if(nn==face->NbNodes()/2) break;
+ }
+ }
+ gp_Pnt PPP;
+ if( HasIntersection(Ptmp1, PC, PPP, aContour) ) {
+ IsOK1 = true;
+ double tmp = PC.Distance(PPP);
+ if(tmp<dist1) {
+ Pres1 = PPP;
+ dist1 = tmp;
+ }
+ }
+ if( HasIntersection(Ptmp2, PC, PPP, aContour) ) {
+ IsOK2 = true;
+ double tmp = PC.Distance(PPP);
+ if(tmp<dist2) {
+ Pres2 = PPP;
+ dist2 = tmp;
+ }
+ }
+ }
+
+ if( IsOK1 && !IsOK2 ) {
+ // using existed direction
+ double tmp = PC.Distance(Pres1)/3.;
+ if( height > tmp ) {
+ height = tmp;
+ PCbest = gp_Pnt( PC.X() + tmpDir.X()*height,
+ PC.Y() + tmpDir.Y()*height,
+ PC.Z() + tmpDir.Z()*height );
+ }
+ }
+ else if( !IsOK1 && IsOK2 ) {
+ // using opposite direction
+ IsRev = true;
+ double tmp = PC.Distance(Pres2)/3.;
+ if( height > tmp ) height = tmp;
+ PCbest = gp_Pnt( PC.X() + tmpDir.Reversed().X()*height,
+ PC.Y() + tmpDir.Reversed().Y()*height,
+ PC.Z() + tmpDir.Reversed().Z()*height );
+ }
+ else { // IsOK1 && IsOK2
+ double tmp1 = PC.Distance(Pres1)/3.;
+ double tmp2 = PC.Distance(Pres2)/3.;
+ if(tmp1<tmp2) {
+ // using existed direction
+ if( height > tmp1 ) {
+ height = tmp1;
+ PCbest = gp_Pnt( PC.X() + tmpDir.X()*height,
+ PC.Y() + tmpDir.Y()*height,
+ PC.Z() + tmpDir.Z()*height );
+ }
+ }
+ else {
+ // using opposite direction
+ IsRev = true;
+ if( height > tmp2 ) height = tmp2;
+ PCbest = gp_Pnt( PC.X() + tmpDir.Reversed().X()*height,
+ PC.Y() + tmpDir.Reversed().Y()*height,
+ PC.Z() + tmpDir.Reversed().Z()*height );
+ }
+ }
+
+ // create node for PCbest
+ SMDS_MeshNode* NewNode = meshDS->AddNode( PCbest.X(), PCbest.Y(), PCbest.Z() );
+ // add triangles to result map
+ std::list<const SMDS_FaceOfNodes*> aList;
+ for(i=0; i<4; i++) {
+ SMDS_FaceOfNodes* NewFace;
+ if(IsRev)
+ NewFace = new SMDS_FaceOfNodes( NewNode, FNodes[i], FNodes[i+1] );
+ else
+ NewFace = new SMDS_FaceOfNodes( NewNode, FNodes[i+1], FNodes[i] );
+ aList.push_back(NewFace);
+ }
+ myResMap.insert(make_pair(face,aList));
+ // create pyramid
+ SMDS_MeshVolume* aPyram;
+ if(IsRev)
+ aPyram = meshDS->AddVolume( FNodes[0], FNodes[1], FNodes[2], FNodes[3], NewNode );
+ else
+ aPyram = meshDS->AddVolume( FNodes[0], FNodes[3], FNodes[2], FNodes[1], NewNode );
+ myMapFPyram.insert(make_pair(face,aPyram));
+ } // end loop on elements on a face
+
+ return Compute2ndPart(aMesh);
+}
+
+
+//=======================================================================
+//function : Compute2ndPart
+//purpose :
+//=======================================================================
+
+bool StdMeshers_QuadToTriaAdaptor::Compute2ndPart(SMESH_Mesh& aMesh)
+{
+ SMESHDS_Mesh * meshDS = aMesh.GetMeshDS();
+
+ // check intersections between created pyramids
+ int NbPyram = myMapFPyram.size();
+ //cout<<"NbPyram = "<<NbPyram<<endl;
+ if(NbPyram==0)
+ return true;
+
+ std::vector< const SMDS_MeshElement* > Pyrams(NbPyram);
+ std::vector< const SMDS_MeshElement* > Faces(NbPyram);
+ std::map< const SMDS_MeshElement*,
+ const SMDS_MeshElement* >::iterator itp = myMapFPyram.begin();
+ int i = 0;
+ for(; itp!=myMapFPyram.end(); itp++, i++) {
+ Faces[i] = (*itp).first;
+ Pyrams[i] = (*itp).second;
+ }
+ StdMeshers_Array1OfSequenceOfInteger MergesInfo(0,NbPyram-1);
+ for(i=0; i<NbPyram; i++) {
+ TColStd_SequenceOfInteger aMerges;
+ aMerges.Append(i);
+ MergesInfo.SetValue(i,aMerges);
+ }
+ for(i=0; i<NbPyram-1; i++) {
+ const SMDS_MeshElement* Prm1 = Pyrams[i];
+ SMDS_ElemIteratorPtr nIt = Prm1->nodesIterator();
+ std::vector<gp_Pnt> Ps1(5);
+ const SMDS_MeshNode* Ns1[5];
+ int k = 0;
+ while( nIt->more() ) {
+ const SMDS_MeshNode* node = static_cast<const SMDS_MeshNode*>( nIt->next() );
+ Ns1[k] = node;
+ Ps1[k] = gp_Pnt(node->X(), node->Y(), node->Z());
+ k++;
+ }
+ bool NeedMove = false;
+ for(int j=i+1; j<NbPyram; j++) {
+ //cout<<" i="<<i<<" j="<<j<<endl;
+ const TColStd_SequenceOfInteger& aMergesI = MergesInfo.Value(i);
+ int nbI = aMergesI.Length();
+ const TColStd_SequenceOfInteger& aMergesJ = MergesInfo.Value(j);
+ int nbJ = aMergesJ.Length();
+
+ int k = 2;
+ bool NeedCont = false;
+ for(; k<=nbI; k++) {
+ if(aMergesI.Value(k)==j) {
+ NeedCont = true;
+ break;
+ }
+ }
+ if(NeedCont) continue;
+
+ const SMDS_MeshElement* Prm2 = Pyrams[j];
+ nIt = Prm2->nodesIterator();
+ std::vector<gp_Pnt> Ps2(5);
+ const SMDS_MeshNode* Ns2[5];
+ k = 0;
+ while( nIt->more() ) {
+ const SMDS_MeshNode* node = static_cast<const SMDS_MeshNode*>( nIt->next() );
+ Ns2[k] = node;
+ Ps2[k] = gp_Pnt(node->X(), node->Y(), node->Z());
+ k++;
+ }
+
+ bool hasInt = false;
+ gp_Pnt Pint;
+ for(k=0; k<4; k++) {
+ gp_Vec Vtmp(Ps1[k],Ps1[4]);
+ gp_Pnt Pshift( Ps1[k].X() + Vtmp.X()*0.01,
+ Ps1[k].Y() + Vtmp.Y()*0.01,
+ Ps1[k].Z() + Vtmp.Z()*0.01 );
+ int m=0;
+ for(; m<3; m++) {
+ if( HasIntersection3( Pshift, Ps1[4], Pint, Ps2[m], Ps2[m+1], Ps2[4]) ) {
+ hasInt = true;
+ break;
+ }
+ }
+ if( HasIntersection3( Pshift, Ps1[4], Pint, Ps2[3], Ps2[0], Ps2[4]) ) {
+ hasInt = true;
+ }
+ if(hasInt) break;
+ }
+ if(!hasInt) {
+ for(k=0; k<4; k++) {
+ gp_Vec Vtmp(Ps2[k],Ps2[4]);
+ gp_Pnt Pshift( Ps2[k].X() + Vtmp.X()*0.01,
+ Ps2[k].Y() + Vtmp.Y()*0.01,
+ Ps2[k].Z() + Vtmp.Z()*0.01 );
+ int m=0;
+ for(; m<3; m++) {
+ if( HasIntersection3( Pshift, Ps2[4], Pint, Ps1[m], Ps1[m+1], Ps1[4]) ) {
+ hasInt = true;
+ break;
+ }
+ }
+ if( HasIntersection3( Pshift, Ps2[4], Pint, Ps1[3], Ps1[0], Ps1[4]) ) {
+ hasInt = true;
+ }
+ if(hasInt) break;
+ }
+ }
+
+ if(hasInt) {
+ //cout<<" has intersec for i="<<i<<" j="<<j<<endl;
+ // check if MeshFaces have 2 common node
+ int nbc = 0;
+ for(k=0; k<4; k++) {
+ for(int m=0; m<4; m++) {
+ if( Ns1[k]==Ns2[m] ) nbc++;
+ }
+ }
+ //cout<<" nbc = "<<nbc<<endl;
+ if(nbc>0) {
+ // create common node
+ SMDS_MeshNode* CommonNode = const_cast<SMDS_MeshNode*>(Ns1[4]);
+ CommonNode->setXYZ( ( nbI*Ps1[4].X() + nbJ*Ps2[4].X() ) / (nbI+nbJ),
+ ( nbI*Ps1[4].Y() + nbJ*Ps2[4].Y() ) / (nbI+nbJ),
+ ( nbI*Ps1[4].Z() + nbJ*Ps2[4].Z() ) / (nbI+nbJ) );
+ NeedMove = true;
+ //cout<<" CommonNode: "<<CommonNode;
+ const SMDS_MeshNode* Nrem = Ns2[4];
+ Ns2[4] = CommonNode;
+ meshDS->ChangeElementNodes(Prm2, Ns2, 5);
+ // update pyramids for J
+ for(k=2; k<=nbJ; k++) {
+ const SMDS_MeshElement* tmpPrm = Pyrams[aMergesJ.Value(k)];
+ SMDS_ElemIteratorPtr tmpIt = tmpPrm->nodesIterator();
+ const SMDS_MeshNode* Ns[5];
+ int m = 0;
+ while( tmpIt->more() ) {
+ Ns[m] = static_cast<const SMDS_MeshNode*>( tmpIt->next() );
+ m++;
+ }
+ Ns[4] = CommonNode;
+ meshDS->ChangeElementNodes(tmpPrm, Ns, 5);
+ }
+
+ // update MergesInfo
+ for(k=1; k<=nbI; k++) {
+ int num = aMergesI.Value(k);
+ const TColStd_SequenceOfInteger& aSeq = MergesInfo.Value(num);
+ TColStd_SequenceOfInteger tmpSeq;
+ int m = 1;
+ for(; m<=aSeq.Length(); m++) {
+ tmpSeq.Append(aSeq.Value(m));
+ }
+ for(m=1; m<=nbJ; m++) {
+ tmpSeq.Append(aMergesJ.Value(m));
+ }
+ MergesInfo.SetValue(num,tmpSeq);
+ }
+ for(k=1; k<=nbJ; k++) {
+ int num = aMergesJ.Value(k);
+ const TColStd_SequenceOfInteger& aSeq = MergesInfo.Value(num);
+ TColStd_SequenceOfInteger tmpSeq;
+ int m = 1;
+ for(; m<=aSeq.Length(); m++) {
+ tmpSeq.Append(aSeq.Value(m));
+ }
+ for(m=1; m<=nbI; m++) {
+ tmpSeq.Append(aMergesI.Value(m));
+ }
+ MergesInfo.SetValue(num,tmpSeq);
+ }
+
+ // update triangles for aMergesJ
+ for(k=1; k<=nbJ; k++) {
+ std::list< std::list< const SMDS_MeshNode* > > aFNodes;
+ std::list< const SMDS_MeshElement* > aFFaces;
+ int num = aMergesJ.Value(k);
+ std::map< const SMDS_MeshElement*,
+ std::list<const SMDS_FaceOfNodes*> >::iterator itrm = myResMap.find(Faces[num]);
+ std::list<const SMDS_FaceOfNodes*> trias = (*itrm).second;
+ std::list<const SMDS_FaceOfNodes*>::iterator itt = trias.begin();
+ for(; itt!=trias.end(); itt++) {
+ int nn = -1;
+ SMDS_ElemIteratorPtr nodeIt = (*itt)->nodesIterator();
+ const SMDS_MeshNode* NF[3];
+ while ( nodeIt->more() ) {
+ nn++;
+ NF[nn] = static_cast<const SMDS_MeshNode*>( nodeIt->next() );
+ }
+ NF[0] = CommonNode;
+ SMDS_FaceOfNodes* Ftria = const_cast< SMDS_FaceOfNodes*>( (*itt) );
+ Ftria->ChangeNodes(NF, 3);
+ }
+ }
+
+ // check and remove coincided faces
+ TColStd_SequenceOfInteger IdRemovedTrias;
+ int i1 = 1;
+ for(; i1<=nbI; i1++) {
+ int numI = aMergesI.Value(i1);
+ std::map< const SMDS_MeshElement*,
+ std::list<const SMDS_FaceOfNodes*> >::iterator itrmI = myResMap.find(Faces[numI]);
+ std::list<const SMDS_FaceOfNodes*> triasI = (*itrmI).second;
+ std::list<const SMDS_FaceOfNodes*>::iterator ittI = triasI.begin();
+ int nbfI = triasI.size();
+ const SMDS_FaceOfNodes* FsI[nbfI];
+ k = 0;
+ for(; ittI!=triasI.end(); ittI++) {
+ FsI[k] = (*ittI);
+ k++;
+ }
+ int i2 = 0;
+ for(; i2<nbfI; i2++) {
+ const SMDS_FaceOfNodes* FI = FsI[i2];
+ if(FI==0) continue;
+ int j1 = 1;
+ for(; j1<=nbJ; j1++) {
+ int numJ = aMergesJ.Value(j1);
+ std::map< const SMDS_MeshElement*,
+ std::list<const SMDS_FaceOfNodes*> >::iterator itrmJ = myResMap.find(Faces[numJ]);
+ std::list<const SMDS_FaceOfNodes*> triasJ = (*itrmJ).second;
+ std::list<const SMDS_FaceOfNodes*>::iterator ittJ = triasJ.begin();
+ int nbfJ = triasJ.size();
+ const SMDS_FaceOfNodes* FsJ[nbfJ];
+ k = 0;
+ for(; ittJ!=triasJ.end(); ittJ++) {
+ FsJ[k] = (*ittJ);
+ k++;
+ }
+ int j2 = 0;
+ for(; j2<nbfJ; j2++) {
+ const SMDS_FaceOfNodes* FJ = FsJ[j2];
+ // compare triangles
+ if( CompareTrias(FI,FJ) ) {
+ IdRemovedTrias.Append( FI->GetID() );
+ IdRemovedTrias.Append( FJ->GetID() );
+ FsI[i2] = 0;
+ FsJ[j2] = 0;
+ std::list<const SMDS_FaceOfNodes*> new_triasI;
+ for(k=0; k<nbfI; k++) {
+ if( FsI[k]==0 ) continue;
+ new_triasI.push_back( FsI[k] );
+ }
+ (*itrmI).second = new_triasI;
+ triasI = new_triasI;
+ std::list<const SMDS_FaceOfNodes*> new_triasJ;
+ for(k=0; k<nbfJ; k++) {
+ if( FsJ[k]==0 ) continue;
+ new_triasJ.push_back( FsJ[k] );
+ }
+ (*itrmJ).second = new_triasJ;
+ triasJ = new_triasJ;
+ // remove faces
+ delete FI;
+ delete FJ;
+ // close for j2 and j1
+ j1 = nbJ;
+ break;
+ }
+ } // j2
+ } // j1
+ } // i2
+ } // i1
+ // removing node
+ meshDS->RemoveNode(Nrem);
+ }
+ else { // nbc==0
+ //cout<<"decrease height of pyramids"<<endl;
+ // decrease height of pyramids
+ double xc1 = 0., yc1 = 0., zc1 = 0.;
+ double xc2 = 0., yc2 = 0., zc2 = 0.;
+ for(k=0; k<4; k++) {
+ xc1 += Ps1[k].X();
+ yc1 += Ps1[k].Y();
+ zc1 += Ps1[k].Z();
+ xc2 += Ps2[k].X();
+ yc2 += Ps2[k].Y();
+ zc2 += Ps2[k].Z();
+ }
+ gp_Pnt PC1(xc1/4.,yc1/4.,zc1/4.);
+ gp_Pnt PC2(xc2/4.,yc2/4.,zc2/4.);
+ gp_Vec VN1(PC1,Ps1[4]);
+ gp_Vec VI1(PC1,Pint);
+ gp_Vec VN2(PC2,Ps2[4]);
+ gp_Vec VI2(PC2,Pint);
+ double ang1 = fabs(VN1.Angle(VI1));
+ double ang2 = fabs(VN2.Angle(VI2));
+ double h1,h2;
+ if(ang1>PI/3.)
+ h1 = VI1.Magnitude()/2;
+ else
+ h1 = VI1.Magnitude()*cos(ang1);
+ if(ang2>PI/3.)
+ h2 = VI2.Magnitude()/2;
+ else
+ h2 = VI2.Magnitude()*cos(ang2);
+ double coef1 = 0.5;
+ if(ang1<PI/3)
+ coef1 -= cos(ang1)*0.25;
+ double coef2 = 0.5;
+ if(ang2<PI/3)
+ coef2 -= cos(ang1)*0.25;
+
+ SMDS_MeshNode* aNode1 = const_cast<SMDS_MeshNode*>(Ns1[4]);
+ VN1.Scale(coef1);
+ aNode1->setXYZ( PC1.X()+VN1.X(), PC1.Y()+VN1.Y(), PC1.Z()+VN1.Z() );
+ SMDS_MeshNode* aNode2 = const_cast<SMDS_MeshNode*>(Ns2[4]);
+ VN2.Scale(coef2);
+ aNode2->setXYZ( PC2.X()+VN2.X(), PC2.Y()+VN2.Y(), PC2.Z()+VN2.Z() );
+ NeedMove = true;
+ }
+ } // end if(hasInt)
+ else {
+ //cout<<" no intersec for i="<<i<<" j="<<j<<endl;
+ }
+
+ }
+ if( NeedMove && !meshDS->IsEmbeddedMode() ) {
+ meshDS->MoveNode( Ns1[4], Ns1[4]->X(), Ns1[4]->Y(), Ns1[4]->Z() );
+ }
+ }
+
+ return true;
+}
+
+
+//================================================================================
+/*!
+ * \brief Return list of created triangles for given face
+ */
+//================================================================================
+std::list<const SMDS_FaceOfNodes*> StdMeshers_QuadToTriaAdaptor::GetTriangles
+ (const SMDS_MeshElement* aFace)
+{
+ std::list<const SMDS_FaceOfNodes*> aRes;
+ std::map< const SMDS_MeshElement*,
+ std::list<const SMDS_FaceOfNodes*> >::iterator it = myResMap.find(aFace);
+ if( it != myResMap.end() ) {
+ aRes = (*it).second;
+ }
+ return aRes;
+}
+
+
+//================================================================================
+/*!
+ * \brief Remove all create auxilary faces
+ */
+//================================================================================
+//void StdMeshers_QuadToTriaAdaptor::RemoveFaces(SMESH_Mesh& aMesh)
+//{
+// SMESHDS_Mesh * meshDS = aMesh.GetMeshDS();
+// std::map< const SMDS_MeshElement*,
+// std::list<const SMDS_MeshElement*> >::iterator it = myResMap.begin();
+// for(; it != myResMap.end(); it++ ) {
+// std::list<const SMDS_MeshElement*> aFaces = (*it).second;
+// std::list<const SMDS_MeshElement*>::iterator itf = aFaces.begin();
+// for(; itf!=aFaces.end(); itf++ ) {
+// meshDS->RemoveElement( (*itf) );
+// }
+// }
+//}
--- /dev/null
+// SMESH SMESH : implementaion of SMESH idl descriptions
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//
+// File : StdMeshers_QuadToTriaAdaptor.hxx
+// Module : SMESH
+
+#ifndef _SMESH_QuadToTriaAdaptor_HXX_
+#define _SMESH_QuadToTriaAdaptor_HXX_
+
+#include <SMESH_Mesh.hxx>
+#include <SMESH_StdMeshers.hxx>
+#include <SMDS_FaceOfNodes.hxx>
+#include <TColgp_HArray1OfPnt.hxx>
+#include <TColgp_HArray1OfVec.hxx>
+
+#include <map>
+#include <list>
+#include <vector>
+
+class STDMESHERS_EXPORT StdMeshers_QuadToTriaAdaptor
+{
+public:
+
+ StdMeshers_QuadToTriaAdaptor();
+
+ ~StdMeshers_QuadToTriaAdaptor();
+
+ bool Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape);
+
+ bool Compute(SMESH_Mesh& aMesh);
+
+ std::list<const SMDS_FaceOfNodes*> GetTriangles(const SMDS_MeshElement* aFace);
+
+protected:
+
+ //bool CheckDegenerate(const SMDS_MeshElement* aFace);
+
+ int Preparation(const SMDS_MeshElement* face,
+ Handle(TColgp_HArray1OfPnt) PN,
+ Handle(TColgp_HArray1OfVec) VN,
+ std::vector<const SMDS_MeshNode*>& FNodes,
+ gp_Pnt& PC, gp_Vec& VNorm);
+
+ bool CheckIntersection(const gp_Pnt& P, const gp_Pnt& PC,
+ gp_Pnt& Pint, SMESH_Mesh& aMesh,
+ const TopoDS_Shape& aShape,
+ const TopoDS_Shape& NotCheckedFace);
+
+ bool Compute2ndPart(SMESH_Mesh& aMesh);
+
+ std::map< const SMDS_MeshElement*, std::list<const SMDS_FaceOfNodes*> > myResMap;
+ std::map< const SMDS_MeshElement*, const SMDS_MeshElement* > myMapFPyram;
+ std::list< const SMDS_MeshNode* > myDegNodes;
+
+};
+
+#endif
}
if (nbSides != 4) {
#ifdef _DEBUG_
- cout << endl << "StdMeshers_Quadrangle_2D. Edge IDs of " << nbSides << " sides:";
+ MESSAGE ( "StdMeshers_Quadrangle_2D. Edge IDs of " << nbSides << " sides:\n" );
for ( int i = 0; i < nbSides; ++i ) {
- cout << " ( ";
+ MESSAGE ( " ( " );
for ( int e = 0; e < quad->side[i]->NbEdges(); ++e )
- cout << myTool->GetMeshDS()->ShapeToIndex( quad->side[i]->Edge( e )) << " ";
- cout << ")";
+ MESSAGE ( myTool->GetMeshDS()->ShapeToIndex( quad->side[i]->Edge( e )) << " " );
+ MESSAGE ( ")\n" );
}
- cout << endl;
+ //cout << endl;
#endif
if ( !nbSides )
nbSides = nbEdgesInWire.front();
double scale = _value[ SCALE_FACTOR_IND ];
if (fabs(scale - 1.0) < Precision::Confusion()) {
- // special case to avoid division on zero
+ // special case to avoid division by zero
for (int i = 1; i < NbSegm; i++) {
double param = f + (l - f) * i / NbSegm;
theParams.push_back( param );
{
_name = "UseExisting_1D";
_shapeType = (1 << TopAbs_EDGE); // 1 bit per shape type
+ _requireShape = false;
}
//=======================================================================
{
_name = "UseExisting_2D";
_shapeType = (1 << TopAbs_FACE); // 1 bit per shape type
+ _requireShape = false;
}
//=======================================================================