SET(${PROJECT_NAME_UC}_PATCH_VERSION 1)
SET(${PROJECT_NAME_UC}_VERSION
${${PROJECT_NAME_UC}_MAJOR_VERSION}.${${PROJECT_NAME_UC}_MINOR_VERSION}.${${PROJECT_NAME_UC}_PATCH_VERSION})
-SET(${PROJECT_NAME_UC}_VERSION_DEV 0)
+SET(${PROJECT_NAME_UC}_VERSION_DEV 1)
# Find KERNEL
# ===========
# Various
# Python
-FIND_PACKAGE(SalomePython REQUIRED)
+FIND_PACKAGE(SalomePythonInterp REQUIRED)
+FIND_PACKAGE(SalomePythonLibs REQUIRED)
# PThread
FIND_PACKAGE(SalomePThread REQUIRED)
# SWIG
SET_AND_CHECK(TBB_ROOT_DIR_EXP "@PACKAGE_TBB_ROOT_DIR@")
ENDIF()
-# For all prerequisites, load the corresponding targets if the package was used
+# For all prerequisites, load the corresponding targets if the package was used
# in CONFIG mode. This ensures dependent projects link correctly
# without having to set LD_LIBRARY_PATH:
-SET(_PREREQ @_PREREQ_LIST@)
-SET(_PREREQ_CONFIG_DIR @_PREREQ_DIR_LIST@)
-SET(_PREREQ_COMPONENTS "@_PREREQ_COMPO_LIST@")
-LIST(LENGTH _PREREQ_CONFIG_DIR _list_len)
-IF(NOT _list_len EQUAL 0)
+SET(_PREREQ_@PROJECT_NAME@ @_PREREQ_LIST@)
+SET(_PREREQ_@PROJECT_NAME@_CONFIG_DIR @_PREREQ_DIR_LIST@)
+SET(_PREREQ_@PROJECT_NAME@_COMPONENTS "@_PREREQ_COMPO_LIST@")
+LIST(LENGTH _PREREQ_@PROJECT_NAME@_CONFIG_DIR _list_len_@PROJECT_NAME@)
+IF(NOT _list_len_@PROJECT_NAME@ EQUAL 0)
# Another CMake stupidity - FOREACH(... RANGE r) generates r+1 numbers ...
- MATH(EXPR _range "${_list_len}-1")
- FOREACH(_p RANGE ${_range})
- LIST(GET _PREREQ ${_p} _pkg )
- LIST(GET _PREREQ_CONFIG_DIR ${_p} _pkg_dir)
- LIST(GET _PREREQ_COMPONENTS ${_p} _pkg_compo)
- MESSAGE(STATUS "===> Reloading targets from ${_pkg} ...")
- IF(NOT _pkg_compo)
- FIND_PACKAGE(${_pkg} REQUIRED NO_MODULE
- PATHS "${_pkg_dir}"
- NO_DEFAULT_PATH)
- ELSE()
- STRING(REPLACE "," ";" _compo_lst "${_pkg_compo}")
- MESSAGE(STATUS "===> (components: ${_pkg_compo})")
- FIND_PACKAGE(${_pkg} REQUIRED NO_MODULE
- COMPONENTS ${_compo_lst}
- PATHS "${_pkg_dir}"
- NO_DEFAULT_PATH)
+ MATH(EXPR _range_@PROJECT_NAME@ "${_list_len_@PROJECT_NAME@}-1")
+ FOREACH(_p_@PROJECT_NAME@ RANGE ${_range_@PROJECT_NAME@})
+ LIST(GET _PREREQ_@PROJECT_NAME@ ${_p_@PROJECT_NAME@} _pkg_@PROJECT_NAME@ )
+ LIST(GET _PREREQ_@PROJECT_NAME@_CONFIG_DIR ${_p_@PROJECT_NAME@} _pkg_dir_@PROJECT_NAME@)
+ LIST(GET _PREREQ_@PROJECT_NAME@_COMPONENTS ${_p_@PROJECT_NAME@} _pkg_compo_@PROJECT_NAME@)
+ IF(NOT OMIT_DETECT_PACKAGE_${_pkg_@PROJECT_NAME@})
+ MESSAGE(STATUS "===> Reloading targets from ${_pkg_@PROJECT_NAME@} ...")
+ IF(NOT _pkg_compo_@PROJECT_NAME@)
+ FIND_PACKAGE(${_pkg_@PROJECT_NAME@} REQUIRED NO_MODULE
+ PATHS "${_pkg_dir_@PROJECT_NAME@}"
+ NO_DEFAULT_PATH)
+ ELSE()
+ STRING(REPLACE "," ";" _compo_lst_@PROJECT_NAME@ "${_pkg_compo_@PROJECT_NAME@}")
+ MESSAGE(STATUS "===> (components: ${_pkg_compo_@PROJECT_NAME@})")
+ FIND_PACKAGE(${_pkg_@PROJECT_NAME@} REQUIRED NO_MODULE
+ COMPONENTS ${_compo_lst_@PROJECT_NAME@}
+ PATHS "${_pkg_dir_@PROJECT_NAME@}"
+ NO_DEFAULT_PATH)
+ ENDIF()
ENDIF()
ENDFOREACH()
ENDIF()
triaGroup = mesh.MakeGroupByCriteria( "Tria AR < 1.5", crit )
print "Number of triangles with aspect ratio < 1.5:", triaGroup.Size()
+# get range of values of Aspect Ratio of all faces in the mesh
+aspects = mesh.GetMinMax( SMESH.FT_AspectRatio )
+print "MESH: Min aspect = %s, Max aspect = %s" % ( aspects[0], aspects[1] )
+
+# get max value of Aspect Ratio of faces in triaGroup
+grAspects = mesh.GetMinMax( SMESH.FT_AspectRatio, triaGroup )
+print "GROUP: Max aspect = %s" % grAspects[1]
-# Combine filters with Criterion structures using of "criteria".
+# Combine several criteria into a filter
# create mesh
from SMESH_mechanic import *
+
# get all the quadrangle faces ...
criterion1 = smesh.GetCriterion(SMESH.FACE, SMESH.FT_ElemGeomType, SMESH.Geom_QUADRANGLE, SMESH.FT_LogicalAND)
-# ... AND do NOT get those from sub_face3
+# ... but those from sub_face3
criterion2 = smesh.GetCriterion(SMESH.FACE, SMESH.FT_BelongToGeom, sub_face3, SMESH.FT_LogicalNOT)
-filter = smesh.CreateFilterManager().CreateFilter()
-filter.SetCriteria([criterion1,criterion2])
-ids = mesh.GetIdsFromFilter(filter)
-myGroup = mesh.MakeGroupByIds("Quads_on_cylindrical_faces",SMESH.FACE,ids)
+quadFilter = smesh.GetFilterFromCriteria([criterion1,criterion2])
+
+# get faces satisfying the criteria
+ids = mesh.GetIdsFromFilter(quadFilter)
+
+# create a group of faces satisfying the criteria
+myGroup = mesh.GroupOnFilter(SMESH.FACE,"Quads_on_cylindrical_faces",quadFilter)
class SalomeSession(object):
def __init__(self, script):
import runSalome
- sys.argv = ["runSalome.py"]
+ run_script = "runSalome.py"
+ if sys.platform == 'win32':
+ module_dir = os.getenv("KERNEL_ROOT_DIR")
+ if module_dir: run_script = os.path.join(module_dir, "bin", "salome", run_script)
+ pass
+ sys.argv = [run_script]
sys.argv += ["--terminal"]
sys.argv += ["--modules=GEOM,MED,SMESH"]
sys.argv += ["%s" % script]
+ if sys.platform == 'win32':
+ main_module_path = sys.modules['__main__'].__file__
+ sys.modules['__main__'].__file__ = ''
clt, d = runSalome.main()
+ if sys.platform == 'win32':
+ sys.modules['__main__'].__file__ = main_module_path
return
def __del__(self):
distribution as blue crosses. The node distribution is computed in the
same way as for
\ref analyticdensity_anchor "Distribution with Analytic Density". You
-can select the <b>Conversion mode</b> from\b Exponent and <b>Cut
+can select the <b>Conversion mode</b> from \b Exponent and <b>Cut
negative</b>.
\image html distributionwithtabledensity.png
\ref tui_deflection_1d "Defining Number of Segments" hypothesis
operation.
-\note The plot functionality is available only if GUI module is builded with Plot 2D Viewer (set option SALOME_USE_PLOT2DVIEWER to ON when building GUI module).
+\note The plot functionality is available only if GUI module is built with Plot 2D Viewer (option SALOME_USE_PLOT2DVIEWER is ON when building GUI module).
<br>
\anchor start_and_end_length_anchor
location of a set of edges within the model.
<b>Propagation chains</b> group allows defining <b>Reversed Edges</b>
-for splitting opposite edges of quadrilateral faces
-in a logically uniform direction. When this group is
-activated, the list is filled with propagation chains found within the
-model. When a chain is selected in the list its edges are
-shown in the Viewer with arrows, which enables choosing a common
-direction for all chain edges. \b Reverse button inverts the common
-direction of chain edges. If \b Add button is active, some
-edges of a chain have a different direction, so you can click \b Add
-button to add them to <b>Reversed Edges</b> list.
+for splitting opposite edges of quadrilateral faces in a logically
+uniform direction. When this group is activated, the list is filled
+with propagation chains found within the shape on which a hypothesis
+is assigned. When a chain is selected in the list its edges are shown
+in the Viewer with arrows, which enables choosing a common direction
+for all chain edges. \b Reverse button inverts the common direction of
+chain edges. \b Add button is active if some edges of a chain have a
+different direction, so you can click \b Add button to add them
+to <b>Reversed Edges</b> list.
\image html propagation_chain.png "The whole geometry and a propagation chain"
+\note Alternatively, uniform direction of edges of one propagation
+chain can be achieved by
+\ref constructing_submeshes_page "definition of a sub-mesh" on one
+edge of the chain and assigning a
+\ref propagation_anchor "Propagation" additional hypothesis.
+Orientation of this edge (and hence of all the rest edges of the chain) can be
+controlled by using <b>Reversed Edges</b> field.
+
*/
\page about_meshes_page About meshes
\n \b MESH represents a discrete approximation of a subset of the
-three-dimensional space by \ref mesh_entities "elementary geometrical elements".
+three-dimensional space by \ref mesh_entities "elementary geometrical
+elements".
+
+A SALOME study can contain multiple meshes, but they do not
+implicitly compose one super-mesh, and finally each of them
+can be used (e.g. exported) only individually.
Mesh module provides several ways to create the mesh:
<ul>
<li>The main way is to \subpage constructing_meshes_page "construct the mesh"
on the basis of the geometrical shape produced in the Geometry
module. This way implies selection of
- - a geometrical object (<em> main shape</em>) and
+ - a geometrical object (<em>main shape</em>) and
- <em>meshing parameters</em> (\ref
basic_meshing_algos_page "meshing algorithms" and
characteristics (e.g. element size) of a
Construction of \subpage constructing_submeshes_page "sub-meshes"
allows to discretize some sub-shapes of the main shape, for example a face,
- using the meshing parameters that differ from those for other sub-shapes.<br>
+ using the meshing parameters that differ from those used for other sub-shapes.<br>
Meshing parameters of meshes and sub-meshes can be
\subpage editing_meshes_page "edited". (Upon edition only mesh entities
generated using changed meshing parameters are removed and will be
(and exported to) the file in MED, UNV, STL, CGNS, DAT, GMF and
SAUVE formats.
</li>
- <li>The 3D mesh can be generated from the 2D mesh, \ref
+ <li>The 3D mesh can be generated from the 2D mesh, which was \ref
importing_exporting_meshes_page "imported" or manually created. To
setup the meshing parameters of a mesh not based on a geometry, just
invoke \ref editing_meshes_page "Edit mesh / sub-mesh" command on
associated geometrical entity.
Mesh entities are identified by integer IDs starting from 1.
-Nodes and elements are countered separately, i.e. there can be a node
+Nodes and elements are counted separately, i.e. there can be a node
and element with the same ID.
SALOME supports elements of second order, without a central node
(quadratic triangle, quadrangle, polygon, tetrahedron, hexahedron,
pentahedron and pyramid) and with central nodes (bi-quadratic triangle
and quadrangle and tri-quadratic hexahedron).<br>
-Quadratic mesh can be obtained in two ways:
+Quadratic mesh can be obtained in three ways:
- Using a global \ref quadratic_mesh_anchor "Quadratic Mesh"
hypothesis. (Elements with the central node are not generated in this way).
- Using \ref convert_to_from_quadratic_mesh_page operation.
-
+- Using an appropriate option of some meshing algorithms, which
+generate elements of several dimensions starting from mesh segments.
*/
</table>
When 2D elements are extruded, in addition to 3D elements segments are
-created on ribs of the result 3D mesh. Free edges of input 2D elements
+created on the ribs of the resulting 3D mesh. Free edges of input 2D elements
generate logically horizontal rib segments. Logically vertical rib
-segments are generated from nodes belonging to a sole input 2D element
-(a figure below illustrates this rule).
+segments are generated from the nodes belonging to a sole input 2D element
+(the figure below illustrates this rule).
\image html extru_rib_segs.png "Two triangles extruded: no vertical rib segments generated from nodes #2 and #3 as they are shared by both triangles"
the \ref filtering_elements "Selection filters" page.</li>
</ul>
</li>
+
<li>If the <b>Extrusion to Distance</b> radio button is selected
- - specify the translation vector by which the elements will be extruded.
+ <ul>
+ <li> specify the translation vector by which the elements will
+ be extruded.</li>
+ </ul>
</li>
- <p><br></p>
-
-\image html extrusionalongaline2.png
<li>If the <b>Extrusion Along Vector</b> radio button is selected
+\image html extrusionalongaline2.png
<ul>
- <li>specify the coordinates of the \b Vector along which the elements
+ <li>specify the components of the \b Vector along which the elements
will be extruded, either directly or by selecting the mesh face (the
normal to the face will define the vector),</li>
<li>specify the \b Distance of extrusion along the vector (it can
be negative).</li>
</ul>
</li>
- <p><br></p>
-\image html extrusionalongaline3.png
-
<li>If the <b>Extrusion By Normal</b> radio button is selected,
every node of the selected faces is extruded along the \a average
of the \a normal vectors to the faces sharing the node. (Nodes and
edges cannot be extruded in this mode.)
+\image html extrusionalongaline3.png
<ul>
<li>Specify the \b Distance of extrusion (it can be negative),</li>
<li>Use <b>Along average normal</b> check-box to specify along
<li>If the path of extrusion is curvilinear, at each iteration the
extruded elements are rotated to keep its initial angularity to the
curve. By default, the <b>Base Point</b> around which the elements
- are rotated is the mass center of the elements, however, you can
- specify any point as the <b>Base Point</b> and the elements will be
- rotated with respect to this point.<br>
+ are rotated is the mass center of the elements (note that it can
+ differ from the gravity center computed by \a Geometry module for the
+ underlying shape), however, you can specify any point as the <b>Base
+ Point</b> and the elements will be rotated with respect to this
+ point.<br>
Note that only the displacement of the <b>Base Point</b> exactly
equals to the path, and all other extruded elements simply keep
their position relatively to the <b>Base Point</b> at each
<b>Linear variation of the angles</b> option allows defining the angle
of gradual rotation for the whole path. At each step the elements will
-be rotated by <code>angle / nb. of steps</code>.
+be rotated by <code>( angle / nb. of steps )</code>.
</li>
</ul>
</li>
- Node ID;
- Coordinates (X, Y, Z);
- Connectivity information (connected elements); double click in
- this line makes the dialog show information of these elements;
+ this line reveals information about these elements;
- Position on a shape (for meshes built on a geometry);
- Groups information (names of groups the node belongs to).
- Type (triangle, quadrangle, etc.);
- Gravity center (X, Y, Z coordinates);
- Connectivity information (connected nodes); double click in
- a line of a node makes the dialog show information of this node;
+ a line of a node reveals the information about this node;
- Quality controls (area, aspect ration, volume, etc.);
- Position on a shape (for meshes built on a geometry);
- Groups information (names of groups the element belongs to).
nodes / elements does not exceed the "Automatic controls compute limit" set
via the "Mesh information" preferences (zero value means that there is no limit).
-\note The plot functionality is available only if GUI module is builded with Plot 2D Viewer (set option SALOME_USE_PLOT2DVIEWER to ON when building GUI module).
+\note The plot functionality is available only if the GUI module is built with Plot 2D Viewer (option SALOME_USE_PLOT2DVIEWER is ON when building GUI module).
The button \b "Dump" allows printing the information displayed in the
dialog box to a .txt file.
\page quad_from_ma_algo_page Medial Axis Projection Quadrangle meshing algorithm
Medial Axis Projection algorithm can be used for meshing faces with
-sinuous borders and having channel-like shape, for which is it
-difficult to define 1D hypotheses so that generated quadrangles to be
-of good shape. The algorithm can be also applied to faces with ring
+sinuous borders and a channel-like shape, for which it can be
+difficult to define 1D hypotheses such that to obtain a good shape of
+resulting quadrangles. The algorithm can be also applied to faces with ring
topology, which can be viewed as a closed 'channel'. In the latter
case radial discretization of a ring can be specified by
using <em>Number of Layers</em> or <em>Distribution of Layers</em>
\image html quad_from_ma_mesh.png "A mesh of a river model to the left and of a ring-face to the right"
-The algorithm assures good shape of quadrangles by constructing Medial
+The algorithm provides proper shape of quadrangles by constructing Medial
Axis between sinuous borders of the face and using it to
discretize the borders. (Shape of quadrangles can be not perfect at
locations where opposite sides of a 'channel' are far from being parallel.)
The Medial Axis is used in two ways:
<ol>
-<li>If there is a sub-mesh on either sinuous border, then the nodes of
+<li>If there is a sub-mesh on a sinuous border, then the nodes of
this border are mapped to the opposite border via the Medial
Axis.</li>
-<li> If there is no sub-meshes on the sinuous borders, then a part of
+<li> If there are no sub-meshes on sinuous borders, then the part of
the Medial Axis that can be mapped to both borders is discretized
using a 1D hypothesis assigned to the face or its ancestor shapes,
- and the division points are mapped from the Medial Axis to the both
+ and the division points are mapped from the Medial Axis to both
borders to find positions of nodes.</li>
</ol>
mesh of plus one dimension are additionally created. All created
elements can be automatically grouped. Revolution can be used to create
a \ref extrusion_struct "structured mesh from scratch".
-See \ref extrusion_page page for general information on Revolution
+See \ref extrusion_page page for general information on Revolution,
which can be viewed as extrusion along a circular path.
<em>To apply revolution:</em>
\page selection_filter_library_page Selection filter library
\n Selection filter library allows creating and storing in files
-filters that can be later loaded and used for operations on meshes. You can
-access to it from the Main Menu via <b>Tools / Selection filter library</b>.
-It is also possible to save any filter by invoking the filter library
-from \a Filter dialog launched from any mesh operation.
+the filters that can be later reused for operations on meshes. You can
+access it from the Main Menu via <b>Tools / Selection filter library</b>.
+It is also possible to save/load a filter by invoking the filter library
+from \ref filtering_elements "Filter dialog" launched from any mesh operation.
\image html selectionfilterlibrary.png
filter. By default it is prefixed with the corresponding entity type.
\anchor filtering_elements
+<h2>Filter Dialog</h2>
-When we use filters during a group creation or another operation (by
+When we use filters during group creation or another operation (by
clicking <b>Set Filter</b> button in the corresponding dialog), the
dialog for setting filters looks as shown below.
The \b Add button creates a new criterion at the end of the list of
criteria. The \b Insert button creates a new criterion before the
selected criterion. The \b Remove button deletes the selected
-criterion. The \b Clear button deletes all criteria.
+criterion. The \b Clear button deletes all criteria.\n
+If there is a choice of <b>Entity type</b> in the dialog, only
+criteria of currently selected type are used to create or change a
+filter, and criteria of hidden types (if were specified) are ignored.
\n Each <b>Entity type</b> has its specific list of criteria, however all
filters have common syntax. The <b>Threshold Value</b> should be specified
for most criteria. For numerical criteria it is necessary to indicate if
Some criteria are applicable to all <b>Entity types</b>:
<ul><li>
<b>Belong to Geom</b> selects entities whose all nodes lie on the
-shape defined by <b>Threshold Value</b>. If the threshold shape is a
-sub-shape of the main shape of the mesh the algorithm works faster, if
-this is any other shape the algorithm works slower.
+shape defined by <b>Threshold Value</b>.
+If the threshold shape is a sub-shape of the main shape of the mesh,
+the filtering algorithm works faster because node-to-shape association
+is used instead of measuring distance between nodes and the shape, and
+\b Tolerance is not used. If the threshold shape is any other shape,
+the algorithm works slower because distance between nodes and the
+shape is measured and is compared with \b Tolerance.
</li><li>
<b>Lying on Geom</b> selects entities whose at least one node
lies on the shape defined by the <b>Threshold Value</b>.
-If the threshold shape is a sub-shape of the main shape of the mesh the
-algorithm works faster, if this is any other
-shape, the algorithm works slower.
+If the threshold shape is a sub-shape of the main shape of the mesh,
+the filtering algorithm works faster because node-to-shape association
+is used instead of measuring distance between nodes and the shape, and
+\b Tolerance is not used. If the threshold shape is any other shape,
+the algorithm works slower because distance between nodes and the
+shape is measured and is compared with \b Tolerance.
</li><li>
<b>Belong to Mesh Group</b> selects entities included into the mesh group
defined by the <b>Threshold Value</b>.
</li>
</ul>
-Some criteria are applicable to all <b>Entity types</b> of dimension
+Some criteria are applicable to entities of dimension
more than zero, i.e. to \b Edges, \b Faces and \b Volumes:
<ul><li>
<b>Linear</b> allows selection of Linear or Quadratic elements (if Unary is set to "Not")
</li>
</ul>
-The following criteria are applicable to all <b>Entity types</b>
-except for <b>Volumes</b>:
+The following criteria are applicable to Entities of \b all types
+except for \a Volumes:
<ul><li>
<b>Belong to Plane</b> selects entities whose all nodes belong to a
specified plane within a given <b>Tolerance</b>.
\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 having at least one of its
-edges not shared with other faces. See also a
+<b>Free edges</b> selects 2D mesh elements having at least one
+edge, which is not shared with other faces. See also a
\ref free_edges_page "Free Edges quality control".
</li><li>
<b>Free faces</b> selects 2D mesh elements, which belong to less than two volumes.
</li>
</ul>
-The following criteria allow selecting mesh <b>Volumes</b>:
+The following criteria allow selecting mesh <b>Volumes</b>:
<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
This functionality allows you to unite free borders of a 2D mesh.
There are two working modes: \a Automatic and \a Manual. In the \b
-Automatic mode, the program finds free borders coincident within a
+Automatic mode, the program finds free borders coincident within the
specified tolerance and sews them. Optionally it is possible to
-visually check and correct is necessary the found free borders before
+visually check and correct if necessary the found free borders before
sewing. <br>
In the \b Manual mode you are to define borders to sew by picking
three nodes of each of two borders.
To use \b Automatic sewing:
<ul>
-<li>Specify a mesh you want to sew by selecting it or any its part
+<li>Specify the mesh you want to sew by selecting it or any its part
(group or sub-mesh) in the Object Browser or in the VTK Viewer.</li>
-<li>Specify the \b Tolerance within which free borders are considered
+<li>Specify the \b Tolerance, within which free borders are considered
coincident. At the default zero \b Tolerance, the tolerance used by
the search algorithm is defined as one tenth of an average size of
- elements adjacent to free borders being compared.</li>
+ elements adjacent to compared free borders.</li>
<li>To visually check the coincident free borders found by the
- algorithm, switch off <b>Auto Sewing</b> check-box. Then controls
+ algorithm, switch off <b>Auto Sewing</b> check-box. The controls
to adjust groups of coincident free borders will become available in
the dialog.</li>
<li>\b Detect button launches the algorithm of search of coincident
free borders.</li>
-<li>The found groups of <b>Coincident Free Borders</b> are shown in a
- list, a group per a line. Each group has its own color which is used
- to display the borders of the group in the VTK Viewer. A free border
- within a group is designated by IDs of its first, second and last
- nodes within parenthesis. All borders present in the list will be
- sewn upon \b Apply.</li>
-<li>\b Remove button removes selected groups from the list.</li>
+<li>The found groups of <b>Coincident Free Borders</b> are shown in the
+ list, one group per line. Each group has its own color, which is used
+ to display the group borders in the VTK Viewer. A free border
+ within a group is designated by the IDs of its first, second and
+ last nodes within parenthesis. All borders present in the list will
+ be sewn upon \b Apply. </li>
+<li>\b Remove button removes the selected groups from the list.</li>
<li><b>Select All</b> check-box selects all groups in the list.</li>
<li>When a group is selected, its borders appear in <b>Edit Selected
Group</b> list that allows you to change this group.</li>
to this border during sewing.
</li><li>
\image html remove.png
-<em>Remove Border</em> button removes selected borders from the
+<em>Remove Border</em> button removes the selected borders from the
group. It is active if there are more than two borders in the group.
</li>
-<li>Selection of a border in the list allows to change its first and
+<li>Selection of a border in the list allows changing its first and
last nodes whose IDs appear in two fields below the list. \a Arrow
- buttons near each field move the corresponding end node by
+ buttons near each field move the corresponding end node by the
number of nodes defined by \b Step field.</li>
<li>
\image html swap.png
</ul>
For sewing free borders manually you should switch the \b Mode to \b
-Manual and define three points on each border: first, second and the
+Manual and define three points on each border: the first, the second and the
last node:
\image html sewing_manual.png
border. To cope with this,
\ref merging_nodes_page "merge" coincident nodes into one
beforehand. Two figures below illustrate this approach.
-\image html sew_using_merge.png "Merge coincident nodes which are difficult to distinguish"
+\image html sew_using_merge.png "Merge coincident nodes, which are difficult to distinguish"
<br>
\image html sew_after_merge.png "After merging nodes it is easy to specify border nodes"
mesh quality by different parameters, etc.
Several filtering criteria can be combined together by using logical
-operators \a AND and \a OR. In addition, applied filter criterion can
+operators \a AND and \a OR. In addition, a filtering criterion can
be reverted using logical operator \a NOT.
-Mesh filters use the functionality of mesh quality controls to filter
+Mesh filters can use the functionality of mesh quality controls to filter
mesh nodes / elements by a specific characteristic (Area, Length, etc).
This page provides a short description of the existing mesh filters,
\tui_script{filters_ex35.py}
-\section combining_filters How to combine filters with Criterion structures?
+\section combining_filters How to combine several criteria into a filter?
-Filters can be combined by making use of "criteria".
+Several criteria can be combined into a filter.
Example :
* Verify whether hypothesis supports given entity type
*/
boolean IsDimSupported( in Dimension type );
+
+ /*!
+ * Return true if a hypothesis has parameters.
+ *
+ * This method is intended for GUI to know if "Edit" menu item sould be available
+ */
+ boolean HasParameters();
};
typedef sequence<string> ListOfHypothesisName;
SEW_DIFF_NB_OF_ELEMENTS,
SEW_TOPO_DIFF_SETS_OF_ELEMENTS,
SEW_BAD_SIDE1_NODES,
- SEW_BAD_SIDE2_NODES
- };
+ SEW_BAD_SIDE2_NODES,
+ SEW_INTERNAL_ERROR
+ };
Sew_Error SewFreeBorders (in long FirstNodeID1,
in long SecondNodeID1,
#include <Geom_CylindricalSurface.hxx>
#include <Geom_Plane.hxx>
#include <Geom_Surface.hxx>
+#include <NCollection_Map.hxx>
#include <Precision.hxx>
#include <TColStd_MapIteratorOfMapOfInteger.hxx>
#include <TColStd_MapOfInteger.hxx>
n += q2 ^ q3;
}
double len = n.Modulus();
- bool zeroLen = ( len <= numeric_limits<double>::min());
+ bool zeroLen = ( len <= std::numeric_limits<double>::min());
if ( !zeroLen )
n /= len;
*/
//================================================================================
-void NumericalFunctor::GetHistogram(int nbIntervals,
- std::vector<int>& nbEvents,
- std::vector<double>& funValues,
- const vector<int>& elements,
- const double* minmax,
- const bool isLogarithmic)
+void NumericalFunctor::GetHistogram(int nbIntervals,
+ std::vector<int>& nbEvents,
+ std::vector<double>& funValues,
+ const std::vector<int>& elements,
+ const double* minmax,
+ const bool isLogarithmic)
{
if ( nbIntervals < 1 ||
!myMesh ||
}
else
{
- vector<int>::const_iterator id = elements.begin();
+ std::vector<int>::const_iterator id = elements.begin();
for ( ; id != elements.end(); ++id )
values.insert( GetValue( *id ));
}
if( GetPoints( theElementId, P ) ) {
double aVal = 0;
const SMDS_MeshElement* aElem = myMesh->FindElement( theElementId );
- SMDSAbs_ElementType aType = aElem->GetType();
+ SMDSAbs_EntityType aType = aElem->GetEntityType();
int len = P.size();
- switch( aType ) {
- case SMDSAbs_Volume:
- if( len == 4 ) { // tetras
- double L1 = getDistance(P( 1 ),P( 2 ));
- double L2 = getDistance(P( 2 ),P( 3 ));
- double L3 = getDistance(P( 3 ),P( 1 ));
- double L4 = getDistance(P( 1 ),P( 4 ));
- double L5 = getDistance(P( 2 ),P( 4 ));
- double L6 = getDistance(P( 3 ),P( 4 ));
- aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
- break;
- }
- else if( len == 5 ) { // pyramids
- double L1 = getDistance(P( 1 ),P( 2 ));
- double L2 = getDistance(P( 2 ),P( 3 ));
- double L3 = getDistance(P( 3 ),P( 4 ));
- double L4 = getDistance(P( 4 ),P( 1 ));
- double L5 = getDistance(P( 1 ),P( 5 ));
- double L6 = getDistance(P( 2 ),P( 5 ));
- double L7 = getDistance(P( 3 ),P( 5 ));
- double L8 = getDistance(P( 4 ),P( 5 ));
- aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
- aVal = Max(aVal,Max(L7,L8));
- break;
- }
- else if( len == 6 ) { // pentas
- double L1 = getDistance(P( 1 ),P( 2 ));
- double L2 = getDistance(P( 2 ),P( 3 ));
- double L3 = getDistance(P( 3 ),P( 1 ));
- double L4 = getDistance(P( 4 ),P( 5 ));
- double L5 = getDistance(P( 5 ),P( 6 ));
- double L6 = getDistance(P( 6 ),P( 4 ));
- double L7 = getDistance(P( 1 ),P( 4 ));
- double L8 = getDistance(P( 2 ),P( 5 ));
- double L9 = getDistance(P( 3 ),P( 6 ));
- aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
- aVal = Max(aVal,Max(Max(L7,L8),L9));
- break;
- }
- else if( len == 8 ) { // hexas
- double L1 = getDistance(P( 1 ),P( 2 ));
- double L2 = getDistance(P( 2 ),P( 3 ));
- double L3 = getDistance(P( 3 ),P( 4 ));
- double L4 = getDistance(P( 4 ),P( 1 ));
- double L5 = getDistance(P( 5 ),P( 6 ));
- double L6 = getDistance(P( 6 ),P( 7 ));
- double L7 = getDistance(P( 7 ),P( 8 ));
- double L8 = getDistance(P( 8 ),P( 5 ));
- double L9 = getDistance(P( 1 ),P( 5 ));
- double L10= getDistance(P( 2 ),P( 6 ));
- double L11= getDistance(P( 3 ),P( 7 ));
- double L12= getDistance(P( 4 ),P( 8 ));
- double D1 = getDistance(P( 1 ),P( 7 ));
- double D2 = getDistance(P( 2 ),P( 8 ));
- double D3 = getDistance(P( 3 ),P( 5 ));
- double D4 = getDistance(P( 4 ),P( 6 ));
- aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
- aVal = Max(aVal,Max(Max(L7,L8),Max(L9,L10)));
- aVal = Max(aVal,Max(L11,L12));
- aVal = Max(aVal,Max(Max(D1,D2),Max(D3,D4)));
- break;
- }
- else if( len == 12 ) { // hexagonal prism
- for ( int i1 = 1; i1 < 12; ++i1 )
- for ( int i2 = i1+1; i1 <= 12; ++i1 )
- aVal = Max( aVal, getDistance(P( i1 ),P( i2 )));
- break;
- }
- else if( len == 10 ) { // quadratic tetras
- double L1 = getDistance(P( 1 ),P( 5 )) + getDistance(P( 5 ),P( 2 ));
- double L2 = getDistance(P( 2 ),P( 6 )) + getDistance(P( 6 ),P( 3 ));
- double L3 = getDistance(P( 3 ),P( 7 )) + getDistance(P( 7 ),P( 1 ));
- double L4 = getDistance(P( 1 ),P( 8 )) + getDistance(P( 8 ),P( 4 ));
- double L5 = getDistance(P( 2 ),P( 9 )) + getDistance(P( 9 ),P( 4 ));
- double L6 = getDistance(P( 3 ),P( 10 )) + getDistance(P( 10 ),P( 4 ));
- aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
- break;
- }
- else if( len == 13 ) { // quadratic pyramids
- double L1 = getDistance(P( 1 ),P( 6 )) + getDistance(P( 6 ),P( 2 ));
- double L2 = getDistance(P( 2 ),P( 7 )) + getDistance(P( 7 ),P( 3 ));
- double L3 = getDistance(P( 3 ),P( 8 )) + getDistance(P( 8 ),P( 4 ));
- double L4 = getDistance(P( 4 ),P( 9 )) + getDistance(P( 9 ),P( 1 ));
- double L5 = getDistance(P( 1 ),P( 10 )) + getDistance(P( 10 ),P( 5 ));
- double L6 = getDistance(P( 2 ),P( 11 )) + getDistance(P( 11 ),P( 5 ));
- double L7 = getDistance(P( 3 ),P( 12 )) + getDistance(P( 12 ),P( 5 ));
- double L8 = getDistance(P( 4 ),P( 13 )) + getDistance(P( 13 ),P( 5 ));
- aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
- aVal = Max(aVal,Max(L7,L8));
- break;
- }
- else if( len == 15 ) { // quadratic pentas
- double L1 = getDistance(P( 1 ),P( 7 )) + getDistance(P( 7 ),P( 2 ));
- double L2 = getDistance(P( 2 ),P( 8 )) + getDistance(P( 8 ),P( 3 ));
- double L3 = getDistance(P( 3 ),P( 9 )) + getDistance(P( 9 ),P( 1 ));
- double L4 = getDistance(P( 4 ),P( 10 )) + getDistance(P( 10 ),P( 5 ));
- double L5 = getDistance(P( 5 ),P( 11 )) + getDistance(P( 11 ),P( 6 ));
- double L6 = getDistance(P( 6 ),P( 12 )) + getDistance(P( 12 ),P( 4 ));
- double L7 = getDistance(P( 1 ),P( 13 )) + getDistance(P( 13 ),P( 4 ));
- double L8 = getDistance(P( 2 ),P( 14 )) + getDistance(P( 14 ),P( 5 ));
- double L9 = getDistance(P( 3 ),P( 15 )) + getDistance(P( 15 ),P( 6 ));
- aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
- aVal = Max(aVal,Max(Max(L7,L8),L9));
- break;
- }
- else if( len == 20 || len == 27 ) { // quadratic hexas
- double L1 = getDistance(P( 1 ),P( 9 )) + getDistance(P( 9 ),P( 2 ));
- double L2 = getDistance(P( 2 ),P( 10 )) + getDistance(P( 10 ),P( 3 ));
- double L3 = getDistance(P( 3 ),P( 11 )) + getDistance(P( 11 ),P( 4 ));
- double L4 = getDistance(P( 4 ),P( 12 )) + getDistance(P( 12 ),P( 1 ));
- double L5 = getDistance(P( 5 ),P( 13 )) + getDistance(P( 13 ),P( 6 ));
- double L6 = getDistance(P( 6 ),P( 14 )) + getDistance(P( 14 ),P( 7 ));
- double L7 = getDistance(P( 7 ),P( 15 )) + getDistance(P( 15 ),P( 8 ));
- double L8 = getDistance(P( 8 ),P( 16 )) + getDistance(P( 16 ),P( 5 ));
- double L9 = getDistance(P( 1 ),P( 17 )) + getDistance(P( 17 ),P( 5 ));
- double L10= getDistance(P( 2 ),P( 18 )) + getDistance(P( 18 ),P( 6 ));
- double L11= getDistance(P( 3 ),P( 19 )) + getDistance(P( 19 ),P( 7 ));
- double L12= getDistance(P( 4 ),P( 20 )) + getDistance(P( 20 ),P( 8 ));
- double D1 = getDistance(P( 1 ),P( 7 ));
- double D2 = getDistance(P( 2 ),P( 8 ));
- double D3 = getDistance(P( 3 ),P( 5 ));
- double D4 = getDistance(P( 4 ),P( 6 ));
- aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
- aVal = Max(aVal,Max(Max(L7,L8),Max(L9,L10)));
- aVal = Max(aVal,Max(L11,L12));
- aVal = Max(aVal,Max(Max(D1,D2),Max(D3,D4)));
- break;
- }
- else if( len > 1 && aElem->IsPoly() ) { // polys
- // get the maximum distance between all pairs of nodes
- for( int i = 1; i <= len; i++ ) {
- for( int j = 1; j <= len; j++ ) {
- if( j > i ) { // optimization of the loop
- double D = getDistance( P(i), P(j) );
- aVal = Max( aVal, D );
- }
+ switch ( aType ) {
+ case SMDSEntity_Tetra: { // tetras
+ double L1 = getDistance(P( 1 ),P( 2 ));
+ double L2 = getDistance(P( 2 ),P( 3 ));
+ double L3 = getDistance(P( 3 ),P( 1 ));
+ double L4 = getDistance(P( 1 ),P( 4 ));
+ double L5 = getDistance(P( 2 ),P( 4 ));
+ double L6 = getDistance(P( 3 ),P( 4 ));
+ aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
+ break;
+ }
+ case SMDSEntity_Pyramid: { // pyramids
+ double L1 = getDistance(P( 1 ),P( 2 ));
+ double L2 = getDistance(P( 2 ),P( 3 ));
+ double L3 = getDistance(P( 3 ),P( 4 ));
+ double L4 = getDistance(P( 4 ),P( 1 ));
+ double L5 = getDistance(P( 1 ),P( 5 ));
+ double L6 = getDistance(P( 2 ),P( 5 ));
+ double L7 = getDistance(P( 3 ),P( 5 ));
+ double L8 = getDistance(P( 4 ),P( 5 ));
+ aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
+ aVal = Max(aVal,Max(L7,L8));
+ break;
+ }
+ case SMDSEntity_Penta: { // pentas
+ double L1 = getDistance(P( 1 ),P( 2 ));
+ double L2 = getDistance(P( 2 ),P( 3 ));
+ double L3 = getDistance(P( 3 ),P( 1 ));
+ double L4 = getDistance(P( 4 ),P( 5 ));
+ double L5 = getDistance(P( 5 ),P( 6 ));
+ double L6 = getDistance(P( 6 ),P( 4 ));
+ double L7 = getDistance(P( 1 ),P( 4 ));
+ double L8 = getDistance(P( 2 ),P( 5 ));
+ double L9 = getDistance(P( 3 ),P( 6 ));
+ aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
+ aVal = Max(aVal,Max(Max(L7,L8),L9));
+ break;
+ }
+ case SMDSEntity_Hexa: { // hexas
+ double L1 = getDistance(P( 1 ),P( 2 ));
+ double L2 = getDistance(P( 2 ),P( 3 ));
+ double L3 = getDistance(P( 3 ),P( 4 ));
+ double L4 = getDistance(P( 4 ),P( 1 ));
+ double L5 = getDistance(P( 5 ),P( 6 ));
+ double L6 = getDistance(P( 6 ),P( 7 ));
+ double L7 = getDistance(P( 7 ),P( 8 ));
+ double L8 = getDistance(P( 8 ),P( 5 ));
+ double L9 = getDistance(P( 1 ),P( 5 ));
+ double L10= getDistance(P( 2 ),P( 6 ));
+ double L11= getDistance(P( 3 ),P( 7 ));
+ double L12= getDistance(P( 4 ),P( 8 ));
+ double D1 = getDistance(P( 1 ),P( 7 ));
+ double D2 = getDistance(P( 2 ),P( 8 ));
+ double D3 = getDistance(P( 3 ),P( 5 ));
+ double D4 = getDistance(P( 4 ),P( 6 ));
+ aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
+ aVal = Max(aVal,Max(Max(L7,L8),Max(L9,L10)));
+ aVal = Max(aVal,Max(L11,L12));
+ aVal = Max(aVal,Max(Max(D1,D2),Max(D3,D4)));
+ break;
+ }
+ case SMDSEntity_Hexagonal_Prism: { // hexagonal prism
+ for ( int i1 = 1; i1 < 12; ++i1 )
+ for ( int i2 = i1+1; i1 <= 12; ++i1 )
+ aVal = Max( aVal, getDistance(P( i1 ),P( i2 )));
+ break;
+ }
+ case SMDSEntity_Quad_Tetra: { // quadratic tetras
+ double L1 = getDistance(P( 1 ),P( 5 )) + getDistance(P( 5 ),P( 2 ));
+ double L2 = getDistance(P( 2 ),P( 6 )) + getDistance(P( 6 ),P( 3 ));
+ double L3 = getDistance(P( 3 ),P( 7 )) + getDistance(P( 7 ),P( 1 ));
+ double L4 = getDistance(P( 1 ),P( 8 )) + getDistance(P( 8 ),P( 4 ));
+ double L5 = getDistance(P( 2 ),P( 9 )) + getDistance(P( 9 ),P( 4 ));
+ double L6 = getDistance(P( 3 ),P( 10 )) + getDistance(P( 10 ),P( 4 ));
+ aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
+ break;
+ }
+ case SMDSEntity_Quad_Pyramid: { // quadratic pyramids
+ double L1 = getDistance(P( 1 ),P( 6 )) + getDistance(P( 6 ),P( 2 ));
+ double L2 = getDistance(P( 2 ),P( 7 )) + getDistance(P( 7 ),P( 3 ));
+ double L3 = getDistance(P( 3 ),P( 8 )) + getDistance(P( 8 ),P( 4 ));
+ double L4 = getDistance(P( 4 ),P( 9 )) + getDistance(P( 9 ),P( 1 ));
+ double L5 = getDistance(P( 1 ),P( 10 )) + getDistance(P( 10 ),P( 5 ));
+ double L6 = getDistance(P( 2 ),P( 11 )) + getDistance(P( 11 ),P( 5 ));
+ double L7 = getDistance(P( 3 ),P( 12 )) + getDistance(P( 12 ),P( 5 ));
+ double L8 = getDistance(P( 4 ),P( 13 )) + getDistance(P( 13 ),P( 5 ));
+ aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
+ aVal = Max(aVal,Max(L7,L8));
+ break;
+ }
+ case SMDSEntity_Quad_Penta: { // quadratic pentas
+ double L1 = getDistance(P( 1 ),P( 7 )) + getDistance(P( 7 ),P( 2 ));
+ double L2 = getDistance(P( 2 ),P( 8 )) + getDistance(P( 8 ),P( 3 ));
+ double L3 = getDistance(P( 3 ),P( 9 )) + getDistance(P( 9 ),P( 1 ));
+ double L4 = getDistance(P( 4 ),P( 10 )) + getDistance(P( 10 ),P( 5 ));
+ double L5 = getDistance(P( 5 ),P( 11 )) + getDistance(P( 11 ),P( 6 ));
+ double L6 = getDistance(P( 6 ),P( 12 )) + getDistance(P( 12 ),P( 4 ));
+ double L7 = getDistance(P( 1 ),P( 13 )) + getDistance(P( 13 ),P( 4 ));
+ double L8 = getDistance(P( 2 ),P( 14 )) + getDistance(P( 14 ),P( 5 ));
+ double L9 = getDistance(P( 3 ),P( 15 )) + getDistance(P( 15 ),P( 6 ));
+ aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
+ aVal = Max(aVal,Max(Max(L7,L8),L9));
+ break;
+ }
+ case SMDSEntity_Quad_Hexa:
+ case SMDSEntity_TriQuad_Hexa: { // quadratic hexas
+ double L1 = getDistance(P( 1 ),P( 9 )) + getDistance(P( 9 ),P( 2 ));
+ double L2 = getDistance(P( 2 ),P( 10 )) + getDistance(P( 10 ),P( 3 ));
+ double L3 = getDistance(P( 3 ),P( 11 )) + getDistance(P( 11 ),P( 4 ));
+ double L4 = getDistance(P( 4 ),P( 12 )) + getDistance(P( 12 ),P( 1 ));
+ double L5 = getDistance(P( 5 ),P( 13 )) + getDistance(P( 13 ),P( 6 ));
+ double L6 = getDistance(P( 6 ),P( 14 )) + getDistance(P( 14 ),P( 7 ));
+ double L7 = getDistance(P( 7 ),P( 15 )) + getDistance(P( 15 ),P( 8 ));
+ double L8 = getDistance(P( 8 ),P( 16 )) + getDistance(P( 16 ),P( 5 ));
+ double L9 = getDistance(P( 1 ),P( 17 )) + getDistance(P( 17 ),P( 5 ));
+ double L10= getDistance(P( 2 ),P( 18 )) + getDistance(P( 18 ),P( 6 ));
+ double L11= getDistance(P( 3 ),P( 19 )) + getDistance(P( 19 ),P( 7 ));
+ double L12= getDistance(P( 4 ),P( 20 )) + getDistance(P( 20 ),P( 8 ));
+ double D1 = getDistance(P( 1 ),P( 7 ));
+ double D2 = getDistance(P( 2 ),P( 8 ));
+ double D3 = getDistance(P( 3 ),P( 5 ));
+ double D4 = getDistance(P( 4 ),P( 6 ));
+ aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
+ aVal = Max(aVal,Max(Max(L7,L8),Max(L9,L10)));
+ aVal = Max(aVal,Max(L11,L12));
+ aVal = Max(aVal,Max(Max(D1,D2),Max(D3,D4)));
+ break;
+ }
+ case SMDSEntity_Quad_Polyhedra:
+ case SMDSEntity_Polyhedra: { // polys
+ // get the maximum distance between all pairs of nodes
+ for( int i = 1; i <= len; i++ ) {
+ for( int j = 1; j <= len; j++ ) {
+ if( j > i ) { // optimization of the loop
+ double D = getDistance( P(i), P(j) );
+ aVal = Max( aVal, D );
}
}
}
+ break;
}
+ case SMDSEntity_Node:
+ case SMDSEntity_0D:
+ case SMDSEntity_Edge:
+ case SMDSEntity_Quad_Edge:
+ case SMDSEntity_Triangle:
+ case SMDSEntity_Quad_Triangle:
+ case SMDSEntity_BiQuad_Triangle:
+ case SMDSEntity_Quadrangle:
+ case SMDSEntity_Quad_Quadrangle:
+ case SMDSEntity_BiQuad_Quadrangle:
+ case SMDSEntity_Polygon:
+ case SMDSEntity_Quad_Polygon:
+ case SMDSEntity_Ball:
+ case SMDSEntity_Last: return 0;
+ } // switch ( aType )
if( myPrecision >= 0 )
{
aMin = getAngle(P( P.size() ), P( 1 ), P( 2 ));
aMin = Min(aMin,getAngle(P( P.size()-1 ), P( P.size() ), P( 1 )));
- for ( int i = 2; i < P.size(); i++ )
+ for ( size_t i = 2; i < P.size(); i++ )
{
double A0 = getAngle( P( i-1 ), P( i ), P( i+1 ) );
aMin = Min(aMin,A0);
gp_Vec aVec2( P(3) - P(1) );
gp_Vec SumVec = aVec1 ^ aVec2;
- for (int i=4; i<=P.size(); i++)
+ for (size_t i=4; i<=P.size(); i++)
{
gp_Vec aVec1( P(i-1) - P(1) );
- gp_Vec aVec2( P(i) - P(1) );
+ gp_Vec aVec2( P(i ) - P(1) );
gp_Vec tmp = aVec1 ^ aVec2;
SumVec.Add(tmp);
}
if ( myTool.IsFreeFace( iF ))
{
const SMDS_MeshNode** n = myTool.GetFaceNodes(iF);
- vector< const SMDS_MeshNode*> nodes( n, n+myTool.NbFaceNodes(iF));
+ std::vector< const SMDS_MeshNode*> nodes( n, n+myTool.NbFaceNodes(iF));
if ( !myMesh->FindElement( nodes, SMDSAbs_Face, /*Nomedium=*/false))
return true;
}
while ( nIt->more() )
nodesToCheck.insert( nodesToCheck.end(), nIt->next() );
- list< list< const SMDS_MeshNode*> > nodeGroups;
+ std::list< std::list< const SMDS_MeshNode*> > nodeGroups;
SMESH_OctreeNode::FindCoincidentNodes ( nodesToCheck, &nodeGroups, myToler );
myCoincidentIDs.Clear();
- list< list< const SMDS_MeshNode*> >::iterator groupIt = nodeGroups.begin();
+ std::list< std::list< const SMDS_MeshNode*> >::iterator groupIt = nodeGroups.begin();
for ( ; groupIt != nodeGroups.end(); ++groupIt )
{
- list< const SMDS_MeshNode*>& coincNodes = *groupIt;
- list< const SMDS_MeshNode*>::iterator n = coincNodes.begin();
+ std::list< const SMDS_MeshNode*>& coincNodes = *groupIt;
+ std::list< const SMDS_MeshNode*>::iterator n = coincNodes.begin();
for ( ; n != coincNodes.end(); ++n )
myCoincidentIDs.Add( (*n)->GetID() );
}
if ( const SMDS_MeshElement* e = myMesh->FindElement( theElementId ))
{
if ( e->GetType() != GetType() ) return false;
- set< const SMDS_MeshNode* > elemNodes( e->begin_nodes(), e->end_nodes() );
+ std::set< const SMDS_MeshNode* > elemNodes( e->begin_nodes(), e->end_nodes() );
const int nbNodes = e->NbNodes();
SMDS_ElemIteratorPtr invIt = (*elemNodes.begin())->GetInverseElementIterator( GetType() );
while ( invIt->more() )
int nbNode = aFace->NbNodes();
// collect volumes to check that number of volumes with count equal nbNode not less than 2
- typedef map< SMDS_MeshElement*, int > TMapOfVolume; // map of volume counters
- typedef map< SMDS_MeshElement*, int >::iterator TItrMapOfVolume; // iterator
+ typedef std::map< SMDS_MeshElement*, int > TMapOfVolume; // map of volume counters
+ typedef std::map< SMDS_MeshElement*, int >::iterator TItrMapOfVolume; // iterator
TMapOfVolume mapOfVol;
SMDS_ElemIteratorPtr nodeItr = aFace->nodesIterator();
- while ( nodeItr->more() ) {
+ while ( nodeItr->more() )
+ {
const SMDS_MeshNode* aNode = static_cast<const SMDS_MeshNode*>(nodeItr->next());
if ( !aNode ) continue;
SMDS_ElemIteratorPtr volItr = aNode->GetInverseElementIterator(SMDSAbs_Volume);
- while ( volItr->more() ) {
+ while ( volItr->more() )
+ {
SMDS_MeshElement* aVol = (SMDS_MeshElement*)volItr->next();
- TItrMapOfVolume itr = mapOfVol.insert(make_pair(aVol, 0)).first;
+ TItrMapOfVolume itr = mapOfVol.insert( std::make_pair( aVol, 0 )).first;
(*itr).second++;
}
}
return;
// iterates on groups and find necessary elements ids
- const std::set<SMESHDS_GroupBase*>& aGroups = aMesh->GetGroups();
- set<SMESHDS_GroupBase*>::const_iterator GrIt = aGroups.begin();
+ const std::set<SMESHDS_GroupBase*>& aGroups = aMesh->GetGroups();
+ std::set<SMESHDS_GroupBase*>::const_iterator GrIt = aGroups.begin();
for (; GrIt != aGroups.end(); GrIt++)
{
SMESHDS_GroupBase* aGrp = (*GrIt);
// find myNodeID by myXYZ if possible
if ( myMeshModifTracer.GetMesh() )
{
- auto_ptr<SMESH_ElementSearcher> searcher
+ SMESHUtils::Deleter<SMESH_ElementSearcher> searcher
( SMESH_MeshAlgos::GetElementSearcher( (SMDS_Mesh&) *myMeshModifTracer.GetMesh() ));
- vector< const SMDS_MeshElement* > foundElems;
+ std::vector< const SMDS_MeshElement* > foundElems;
searcher->FindElementsByPoint( gp_Pnt(x,y,z), SMDSAbs_All, foundElems );
if ( !foundElems.empty() )
if ( !node0 )
return false;
- list< const SMDS_MeshNode* > nodeQueue( 1, node0 );
+ std::list< const SMDS_MeshNode* > nodeQueue( 1, node0 );
std::set< int > checkedNodeIDs;
// algo:
// foreach node in nodeQueue:
*/
//================================================================================
+namespace
+{
+ inline bool isLessAngle( const gp_Vec& v1, const gp_Vec& v2, const double cos )
+ {
+ double dot = v1 * v2; // cos * |v1| * |v2|
+ double l1 = v1.SquareMagnitude();
+ double l2 = v2.SquareMagnitude();
+ return (( dot * cos >= 0 ) &&
+ ( dot * dot ) / l1 / l2 >= ( cos * cos ));
+ }
+}
CoplanarFaces::CoplanarFaces()
: myFaceID(0), myToler(0)
{
{
// Build a set of coplanar face ids
- myCoplanarIDs.clear();
+ myCoplanarIDs.Clear();
if ( !myMeshModifTracer.GetMesh() || !myFaceID || !myToler )
return;
if (!normOK)
return;
- const double radianTol = myToler * M_PI / 180.;
- std::set< SMESH_TLink > checkedLinks;
+ const double cosTol = Cos( myToler * M_PI / 180. );
+ NCollection_Map< SMESH_TLink, SMESH_TLink > checkedLinks;
- std::list< pair< const SMDS_MeshElement*, gp_Vec > > faceQueue;
- faceQueue.push_back( make_pair( face, myNorm ));
+ std::list< std::pair< const SMDS_MeshElement*, gp_Vec > > faceQueue;
+ faceQueue.push_back( std::make_pair( face, myNorm ));
while ( !faceQueue.empty() )
{
face = faceQueue.front().first;
{
const SMDS_MeshNode* n1 = face->GetNode( i );
const SMDS_MeshNode* n2 = face->GetNode(( i+1 )%nbN);
- if ( !checkedLinks.insert( SMESH_TLink( n1, n2 )).second )
+ if ( !checkedLinks.Add( SMESH_TLink( n1, n2 )))
continue;
SMDS_ElemIteratorPtr fIt = n1->GetInverseElementIterator(SMDSAbs_Face);
while ( fIt->more() )
if ( f->GetNodeIndex( n2 ) > -1 )
{
gp_Vec norm = getNormale( static_cast<const SMDS_MeshFace*>(f), &normOK );
- if (!normOK || myNorm.Angle( norm ) <= radianTol)
+ if (!normOK || isLessAngle( myNorm, norm, cosTol))
{
- myCoplanarIDs.insert( f->GetID() );
- faceQueue.push_back( make_pair( f, norm ));
+ myCoplanarIDs.Add( f->GetID() );
+ faceQueue.push_back( std::make_pair( f, norm ));
}
}
}
}
bool CoplanarFaces::IsSatisfy( long theElementId )
{
- return myCoplanarIDs.count( theElementId );
+ return myCoplanarIDs.Contains( theElementId );
}
/*
myIds.Clear();
TCollection_AsciiString aStr = theStr;
- //aStr.RemoveAll( ' ' );
- //aStr.RemoveAll( '\t' );
for ( int i = 1; i <= aStr.Length(); ++i )
- if ( isspace( aStr.Value( i )))
- aStr.SetValue( i, ',');
-
- for ( int aPos = aStr.Search( ",," ); aPos != -1; aPos = aStr.Search( ",," ) )
- aStr.Remove( aPos, 1 );
+ {
+ char c = aStr.Value( i );
+ if ( !isdigit( c ) && c != ',' && c != '-' )
+ aStr.SetValue( i, ' ');
+ }
+ aStr.RemoveAll( ' ' );
TCollection_AsciiString tmpStr = aStr.Token( ",", 1 );
int i = 1;
myMapIds.Add( aFaceId );
}
- if ( fi == ( myAllFacePtr.size() - 1 ) )
+ if ( fi == int( myAllFacePtr.size() - 1 ))
fi = 0;
} // end run on vector of faces
return !myMapIds.IsEmpty();
case SMDS_TOP_FACE : return ( IsContains( myMeshDS,myShape,aNode,TopAbs_FACE ));
case SMDS_TOP_3DSPACE: return ( IsContains( myMeshDS,myShape,aNode,TopAbs_SOLID ) ||
IsContains( myMeshDS,myShape,aNode,TopAbs_SHELL ));
+ default:;
}
}
}
case SMDSAbs_Face : return ( IsContains( myMeshDS,myShape,anElem,TopAbs_FACE ));
case SMDSAbs_Volume: return ( IsContains( myMeshDS,myShape,anElem,TopAbs_SOLID )||
IsContains( myMeshDS,myShape,anElem,TopAbs_SHELL ));
+ default:;
}
}
}
TMeshModifTracer myMeshModifTracer;
long myFaceID;
double myToler;
- std::set< long > myCoplanarIDs;
+ TColStd_MapOfInteger myCoplanarIDs;
};
typedef boost::shared_ptr<CoplanarFaces> CoplanarFacesPtr;
dist2 = ( nn1[1] - nn2[1] ).Modulus();
tol = 1e-5 * ( nn1[0] - nn1[1] ).Modulus();
}
- return ( dist1 < tol & dist2 < tol );
+ return ( dist1 < tol && dist2 < tol );
}
return false;
}
if ( !_nodeReplacementMap.empty() )
{
map< int, int >::const_iterator it, end = _nodeReplacementMap.end();
- for ( size_t i = 0; i < nbIds; ++i )
+ for ( int i = 0; i < nbIds; ++i )
if (( it = _nodeReplacementMap.find( ids[i] + idShift)) != end )
ids[i] = it->second;
else
}
else if ( idShift )
{
- for ( size_t i = 0; i < nbIds; ++i )
+ for ( int i = 0; i < nbIds; ++i )
ids[i] += idShift;
}
}
if ( zone.IsStructured() )
{
int axis = 0; // axis perpendiculaire to which boundary elements are oriented
- if ( ids.size() >= meshDim * 2 )
+ if ( (int) ids.size() >= meshDim * 2 )
{
for ( ; axis < meshDim; ++axis )
if ( ids[axis] - ids[axis+meshDim] == 0 )
if ( psType == CGNS_ENUMV( PointRange ) && ids.size() == 2 )
{
- for ( size_t i = ids[0]; i <= ids[1]; ++i )
+ for ( cgsize_t i = ids[0]; i <= ids[1]; ++i )
if ( const SMDS_MeshElement* e = myMesh->FindElement( i ))
groupDS.Add( e );
}
{
// get ids of existing groups
std::set< int > groupIDs;
- const std::set<SMESHDS_GroupBase*>& groups = myMesh->GetGroups();
+ const std::set<SMESHDS_GroupBase*>& groups = myMesh->GetGroups();
std::set<SMESHDS_GroupBase*>::const_iterator grIter = groups.begin();
for ( ; grIter != groups.end(); ++grIter )
groupIDs.insert( (*grIter)->GetID() );
elem->getshapeId() ); \
}}
-#define END_ELEM_WRITE_ADD_TO_MAP( elem, e2id ) \
- elem->getshapeId() ); \
- e2id.insert( e2id.end(), make_pair( elem, gmfID )); \
+#define END_ELEM_WRITE_ADD_TO_MAP( elem, e2id ) \
+ elem->getshapeId() ); \
+ e2id.insert( e2id.end(), std::make_pair( elem, gmfID )); \
}}
#define END_EXTRA_VERTICES_WRITE() \
const SMDS_MeshNode* n = nodeIt->next();
n->GetXYZ( xyz );
GmfSetLin( meshID, GmfVertices, xyz[0], xyz[1], xyz[2], n->getshapeId() );
- node2IdMap.insert( node2IdMap.end(), make_pair( n, ++iN ));
+ node2IdMap.insert( node2IdMap.end(), std::make_pair( n, ++iN ));
}
if ( iN != nbNodes )
return addMessage("Wrong nb of nodes returned by nodesIterator", /*fatal=*/true);
SMDSAbs_EntityType smdsEntity;
std::string entity = groupName.substr( pos + strlen("_required_"));
if ( entity == "Vertices" ) {
- gmfKwd = GmfRequiredVertices;
+ gmfKwd = GmfRequiredVertices;
smdsEntity = SMDSEntity_Node;
}
else if ( entity == "Edges" ) {
- gmfKwd = GmfRequiredEdges;
+ gmfKwd = GmfRequiredEdges;
smdsEntity = SMDSEntity_Edge;
}
else if ( entity == "Triangles" ) {
- gmfKwd = GmfRequiredTriangles;
+ gmfKwd = GmfRequiredTriangles;
smdsEntity = SMDSEntity_Triangle;
}
else if ( entity == "Quadrilaterals" ) {
- gmfKwd = GmfRequiredQuadrilaterals;
+ gmfKwd = GmfRequiredQuadrilaterals;
smdsEntity = SMDSEntity_Quadrangle;
}
else {
// choose a TElem2IDMap
TElem2IDMap* elem2IDMap = 0;
- if ( smdsEntity == SMDSEntity_Quadrangle && nbOkElems != myMesh->NbFaces() )
+ if ( smdsEntity == SMDSEntity_Quadrangle && nbOkElems != myMesh->NbFaces() )
elem2IDMap = & quad2IDMap;
else if ( smdsEntity == SMDSEntity_Triangle && nbOkElems != myMesh->NbFaces() )
elem2IDMap = & tria2IDMap;
- else if ( smdsEntity == SMDSEntity_Edge && nbOkElems != myMesh->NbEdges() )
+ else if ( smdsEntity == SMDSEntity_Edge && nbOkElems != myMesh->NbEdges() )
elem2IDMap = & edge2IDMap;
// write the group
//------------------------------------------------------
PNodeInfo aNodeInfo = aMed->GetPNodeInfo(aMeshInfo);
if (!aNodeInfo) {
- aResult = DRS_FAIL;
+ aResult = addMessage("No nodes", /*isFatal=*/true );
continue;
}
aMeshInfo->myDim=aMeshInfo->mySpaceDim;// ignore meshdim in MEDFile because it can be false
}
#ifndef _DEXCEPT_
} catch(const std::exception& exc) {
- aResult = DRS_FAIL;
+ aResult = addMessage( exc.what(), /*isFatal=*/true );
} catch (...) {
- aResult = DRS_FAIL;
+ aResult = addMessage( "Unknown exception", /*isFatal=*/true );
}
#endif
if ( !anElement ) {
default:;
}
vector<TInt> aNodeIds(aNbNodes);
- for(int iElem = 0; iElem < aNbElems; iElem++){
+ for ( int iElem = 0; iElem < aNbElems; iElem++ )
+ {
bool anIsValidConnect = false;
TCConnSlice aConnSlice = aCellInfo->GetConnSlice(iElem);
#ifndef _DEXCEPT_
#ifndef _DEXCEPT_
}catch(const std::exception& exc){
INFOS("Following exception was caught:\n\t"<<exc.what());
- aResult = DRS_FAIL;
+ aResult = addMessage( exc.what(), /*isFatal=*/true );
}catch(...){
INFOS("Unknown exception was caught !!!");
- aResult = DRS_FAIL;
+ aResult = addMessage( "Unknown exception", /*isFatal=*/true );
}
#endif
if(!anIsValidConnect)
}
break;
+ default:;
+
} // switch(aGeom)
#ifndef _DEXCEPT_
- }catch(const std::exception& exc){
+ } catch(const std::exception& exc) {
INFOS("The following exception was caught:\n\t"<<exc.what());
- aResult = DRS_FAIL;
- }catch(...){
+ aResult = addMessage( exc.what(), /*isFatal=*/true );
+ } catch(...) {
INFOS("Unknown exception was caught !!!");
- aResult = DRS_FAIL;
+ aResult = addMessage( "Unknown exception", /*isFatal=*/true );
}
-#endif
+#endif
if (!anElement) {
aResult = DRS_WARN_SKIP_ELEM;
}
myFamilies[aFamNum]->SetType(anElement->GetType());
}
}
- }
- }}
- }
- }
+ } // loop on aNbElems
+ }} // switch(aGeom)
+ } // loop on aGeom2Size
+ } // loop on aEntityInfo
+
if (aDescendingEntitiesMap.Extent()) isDescConn = true; // Mantis issue 0020483
+
} // for(int iMesh = 0; iMesh < aNbMeshes; iMesh++)
#ifndef _DEXCEPT_
}
catch(const std::exception& exc)
{
INFOS("The following exception was caught:\n\t"<<exc.what());
- aResult = DRS_FAIL;
+ aResult = addMessage( exc.what(), /*isFatal=*/true );
}
catch(...)
{
INFOS("Unknown exception was caught !!!");
- aResult = DRS_FAIL;
+ aResult = addMessage( "Unknown exception", /*isFatal=*/true );
}
#endif
if (myMesh)
if ( _nbElemsByGeom.empty() || _elemType != type )
{
_elemType = type;
- _nbElemsByGeom.resize( 1, make_pair( SMDSEntity_Last, 0 ));
+ _nbElemsByGeom.resize( 1, std::make_pair( SMDSEntity_Last, 0 ));
// count nb of elems of each geometry
for ( int iG = 0; iG < SMDSEntity_Last; ++iG )
nbElems = mesh->GetMeshInfo().NbElements( geom );
if ( nbElems < 1 ) continue;
- _nbElemsByGeom.push_back( make_pair( geom, nbElems + _nbElemsByGeom.back().second ));
+ _nbElemsByGeom.push_back( std::make_pair( geom, nbElems + _nbElemsByGeom.back().second ));
}
// add nodes of missing 0D elements on VERTEXes
if ( _addODOnVertices && _elemType == SMDSAbs_0DElement )
if ( !nodes.empty() )
{
if ( _nbElemsByGeom.size() == 1 )
- _nbElemsByGeom.push_back( make_pair( SMDSEntity_0D, 0));
- _nbElemsByGeom.push_back( make_pair( SMDSEntity_Node,
+ _nbElemsByGeom.push_back( std::make_pair( SMDSEntity_0D, 0));
+ _nbElemsByGeom.push_back( std::make_pair( SMDSEntity_Node,
nodes.size() + _nbElemsByGeom.back().second ));
}
}
void DriverMED_W_Field::SetCompName(const int iComp, const char* name)
{
- if ( _compNames.size() <= iComp )
+ if ( (int)_compNames.size() <= iComp )
_compNames.resize( iComp + 1 );
_compNames[ iComp ] = name;
}
SMDSAbs_EntityType smdsType = _nbElemsByGeom[iG].first;
MED::EGeometrieElement medType = (MED::EGeometrieElement) DriverMED::GetMedGeoType( smdsType );
int nbElems = _nbElemsByGeom[iG].second - _nbElemsByGeom[iG-1].second;
- type2nb.insert( make_pair( medType, nbElems ));
+ type2nb.insert( std::make_pair( medType, nbElems ));
}
MED::EEntiteMaillage entity = ( _elemType == SMDSAbs_Node ? MED::eNOEUD : MED::eMAILLE );
MED::PIntTimeStampValue timeStampIntVal = timeStampVal;
// set values
- int iVal = 0, i, nbE;
+ int iVal = 0;
MED::TFloat* ptrDbl = 0;
MED::TInt* ptrInt = 0;
for ( size_t iG = 1; iG < _nbElemsByGeom.size(); ++iG )
_dblValues.clear();
_intValues.clear();
+
+ return DRS_OK;
}
namespace DriverMED // Implemetation of fuctions declared in DriverMED.hxx
const SMDS_MeshInfo& nbElemInfo = myMesh->GetMeshInfo();
// poly elements are not supported by med-2.1
- bool polyTypesSupported = myMed->CrPolygoneInfo(aMeshInfo,eMAILLE,ePOLYGONE,0,0);
+ bool polyTypesSupported = ( myMed->CrPolygoneInfo(aMeshInfo,eMAILLE,ePOLYGONE,0,0).get() != 0 );
TInt nbPolygonNodes = 0, nbPolyhedronNodes = 0, nbPolyhedronFaces = 0;
// nodes on VERTEXes where 0D elements are absent
const SMDS_MeshElement* aElement = myMesh->FindElement(aRec.ElementList[i]);
if (aElement) {
switch (aElement->GetType()) {
+
case SMDSAbs_Edge:
if (!aEdgesGroup) {
aEdgesGroup = (SMDS_MeshGroup*) myGroup->AddSubGroup(SMDSAbs_Edge);
}
aEdgesGroup->Add(aElement);
break;
+
case SMDSAbs_Face:
if (!aFacesGroup) {
aFacesGroup = (SMDS_MeshGroup*) myGroup->AddSubGroup(SMDSAbs_Face);
}
aFacesGroup->Add(aElement);
break;
+
case SMDSAbs_Volume:
if (!aVolumeGroup) {
aVolumeGroup = (SMDS_MeshGroup*) myGroup->AddSubGroup(SMDSAbs_Volume);
}
aVolumeGroup->Add(aElement);
break;
+
+ default:;
}
}
}
aRec.fe_descriptor_id = anId;
aRec.node_labels.reserve(aNbNodes);
SMDS_NodeIteratorPtr aNodesIter = anElem->nodesIteratorToUNV();
- while ( aNodesIter->more() && aRec.node_labels.size() < aNbNodes )
+ while ( aNodesIter->more() && (int)aRec.node_labels.size() < aNbNodes )
{
const SMDS_MeshElement* aNode = aNodesIter->next();
aRec.node_labels.push_back(aNode->GetID());
*/
inline double D_to_e(std::string& number)
{
- /* find "D" in string, start looking at
+ /* find "D" in string, start looking at
* 6th element, to improve speed.
* We dont expect a "D" earlier
*/
- const int position = number.find("D",6);
- if(position != std::string::npos){
- number.replace(position, 1, "e");
- }
+ const size_t position = number.find("D",6);
+ if ( position != std::string::npos )
+ number.replace(position, 1, "e");
+
return atof (number.c_str());
}
-
+
/**
* @returns \p false when file is incorrect, \p true otherwise.
* Check file with name \p theFileName for correct terminate
#include "MED_V2_2_Wrapper.hxx"
#include <stdio.h>
+#include <errno.h>
#include <sstream>
#include <med.h>
#ifndef WIN32
if (access(theFileName.c_str(),F_OK))
return aVersion;
- if(theDoPreCheckInSeparateProcess){
+ if ( theDoPreCheckInSeparateProcess ) {
// First check, is it possible to deal with the file
std::ostringstream aStr;
// File name is in quotes for the case of space(s) inside it (PAL13009)
std::string aCommand = aStr.str();
int aStatus = system(aCommand.c_str());
- BEGMSG(MYDEBUG,"aCommand = '"<<aCommand<<"'; aStatus = "<<aStatus<<std::endl);
- if(aStatus != 0)
+ BEGMSG( MYDEBUG,"aCommand = '" << aCommand << "'; aStatus = " << aStatus
+ << "; errno = " << errno << " = " << strerror( errno ) << std::endl );
+ if ( aStatus != 0 && errno != EAGAIN && errno != ENOMEM ) // "Cannot allocate memory" is OK
return aVersion;
}
#endif
my0DActor->SetRepresentation(aReperesent);
myBallActor->SetRepresentation(aReperesent);
- switch(myControlMode){
+ switch ( myControlMode ) {
case eLength:
case eMultiConnection:
aProp = aBackProp = my1DProp;
if(myRepresentation != ePoint)
aReperesent = SMESH_DeviceActor::eInsideframe;
break;
+ default:;
}
if(aQuadraticMode == SMESH_Actor::eLines)
SMESH_ActorDef::
GetClippingPlane(vtkIdType theID)
{
- if(theID >= myCippingPlaneCont.size())
+ if ( theID >= (vtkIdType)myCippingPlaneCont.size() )
return NULL;
return myCippingPlaneCont[theID].Get();
}
bool isLogarithmic = lookupTable->GetScale() == VTK_SCALE_LOG10;
fun->GetHistogram(nbIntervals, nbEvents, funValues, elemIds, range, isLogarithmic);
- for ( int i = 0; i < std::min( nbEvents.size(), funValues.size() -1 ); i++ )
+ for ( size_t i = 0; i < std::min( nbEvents.size(), funValues.size() -1 ); i++ )
my2dHistogram->addPoint(funValues[i] + (funValues[i+1] - funValues[i])/2.0, static_cast<double>(nbEvents[i]));
if(funValues.size() >= 2)
enum LabelFont {
FntArial, //!< arial font family
FntCourier, //!< courier font family
- FntTimes, //!< times font family
+ FntTimes //!< times font family
};
SMESHOBJECT_EXPORT
SMESH_ScalarBarActor* theScalarBarActor,
vtkLookupTable* theLookupTable)
{
- bool anIsInitialized = theFunctor;
+ bool anIsInitialized = theFunctor != NULL;
if(anIsInitialized){
vtkUnstructuredGrid* aDataSet = vtkUnstructuredGrid::New();
SMESH_ScalarBarActor* theScalarBarActor,
vtkLookupTable* theLookupTable)
{
- bool anIsInitialized = theFunctor;
+ bool anIsInitialized = theFunctor != NULL;
myExtractUnstructuredGrid->ClearRegisteredCells();
myExtractUnstructuredGrid->ClearRegisteredCellsWithType();
myExtractUnstructuredGrid->SetModeOfChanging(VTKViewer_ExtractUnstructuredGrid::ePassAll);
vtkIdType SMESH_ExtractGeometry::GetElemObjId(int theVtkID)
{
- if( theVtkID < 0 || theVtkID >= myElemVTK2ObjIds.size()) return -1;
+ if( theVtkID < 0 || theVtkID >= (int)myElemVTK2ObjIds.size()) return -1;
return myElemVTK2ObjIds[theVtkID];
}
vtkIdType SMESH_ExtractGeometry::GetNodeObjId(int theVtkID)
{
- if ( theVtkID < 0 || theVtkID >= myNodeVTK2ObjIds.size()) return -1;
+ if ( theVtkID < 0 || theVtkID >= (int)myNodeVTK2ObjIds.size()) return -1;
return myNodeVTK2ObjIds[theVtkID];
}
// rnv begin
// Customization of the vtkScalarBarActor to show distribution histogram.
- bool distrVisibility = (numColors == this->myNbValues.size());
+ bool distrVisibility = (numColors == (int)this->myNbValues.size());
vtkPoints *distrPts;
vtkCellArray *distrPolys;
vtkUnsignedCharArray *distColors = 0;
if(!distrVisibility)
vtkDebugMacro(<<" Distribution invisible, because numColors == this->myNbValues.size()");
- if (distrVisibility && GetDistributionVisibility()) {
- for( i=0 ;i<myNbValues.size();i++ ) {
- if(myNbValues[i]) {
+ if ( distrVisibility && GetDistributionVisibility() ) {
+ for ( i = 0 ; i < (int)myNbValues.size(); i++ ) {
+ if ( myNbValues[i] ) {
numPositiveVal++;
maxValue = std::max(maxValue,myNbValues[i]);
- }
+ }
}
numDistrPts = 4*(numPositiveVal);
distrPts = vtkPoints::New();
int targetWidth, targetHeight;
// rnv begin
// Customization of the vtkScalarBarActor to show distribution histogram.
- bool distrVisibility = this->MaximumNumberOfColors == this->myNbValues.size();
+ bool distrVisibility = ( this->MaximumNumberOfColors == (int) this->myNbValues.size() );
double coef;
if( GetDistributionVisibility() && distrVisibility )
if(this->Orientation == VTK_ORIENT_VERTICAL)
}
//----------------------------------------------------------------------------
-void SMESH_ScalarBarActor::SizeTitle(int *titleSize,
- int *size,
- vtkViewport *viewport)
+void SMESH_ScalarBarActor::SizeTitle(int *titleSize,
+ int *size,
+ vtkViewport *viewport)
{
titleSize[0] = titleSize[1] = 0;
if (this->Title == NULL || !strlen(this->Title))
- {
+ {
return;
- }
+ }
int targetWidth, targetHeight;
-
+
targetWidth = size[0];
// rnv begin
// Customization of the vtkScalarBarActor to show distribution histogram.
- bool distrVisibility = this->MaximumNumberOfColors == this->myNbValues.size();
+ bool distrVisibility = ( this->MaximumNumberOfColors == (int) this->myNbValues.size() );
double coef;
- if( GetDistributionVisibility() && distrVisibility )
+ if ( GetDistributionVisibility() && distrVisibility )
coef=0.18;
- else
+ else
coef=0.25;
if ( this->Orientation == VTK_ORIENT_VERTICAL )
- {
- targetHeight = (int)(0.1*size[1]);
- }
+ {
+ targetHeight = (int)(0.1*size[1]);
+ }
else
- {
- targetHeight = (int)(coef*size[1]);
- }
+ {
+ targetHeight = (int)(coef*size[1]);
+ }
- this->TitleMapper->SetConstrainedFontSize(
- viewport, targetWidth, targetHeight);
+ this->TitleMapper->SetConstrainedFontSize(viewport, targetWidth, targetHeight);
this->TitleMapper->GetSize(viewport, titleSize);
}
// Set/Get the maximum number of scalar bar segments to show. This may
// differ from the number of colors in the lookup table, in which case
// the colors are samples from the lookup table.
- vtkSetClampMacro(MaximumNumberOfColors, int, 2, VTK_LARGE_INTEGER);
+ vtkSetClampMacro(MaximumNumberOfColors, int, 2, VTK_INT_MAX);
vtkGetMacro(MaximumNumberOfColors, int);
// Description:
#include <SalomeApp_Application.h>
#include <SUIT_Session.h>
-#include <SALOME_ListIO.hxx>
-#include <GEOM_Client.hxx>
-#include <SMESHGUI_Utils.h>
-#include <boost/shared_ptr.hpp>
#include <GEOMImpl_Types.hxx>
+#include <GEOM_Client.hxx>
#include <GEOM_wrap.hxx>
+#include <SALOME_ListIO.hxx>
+#include <SMESHGUI_Utils.h>
-#include <TopoDS.hxx>
-#include <BRep_Tool.hxx>
-#include <Handle_Geom_Surface.hxx>
#include <BRepAdaptor_Surface.hxx>
+#include <TopoDS.hxx>
+#include <TopoDS_Iterator.hxx>
#include "utilities.h"
// MESSAGE("GEOM client is OK and GEOM engine is not null");
S = aClient->GetShape( _geomEngine, aShape );
ShapeType=S.ShapeType();
+ if ( ShapeType == TopAbs_COMPOUND )
+ {
+ TopoDS_Iterator it( S );
+ if ( it.More() )
+ ShapeType = it.Value().ShapeType();
+ }
}
}
}
GeomAbs_SurfaceType surf_type=GeomAbs_OtherSurface ;
if (!S.IsNull() && S.ShapeType()==TopAbs_FACE){
TopoDS_Face f=TopoDS::Face(S);
- Handle(Geom_Surface) surf = BRep_Tool::Surface(f);
BRepAdaptor_Surface surf_adap(f);
/* Global Information */
*/
void SMDS_Down1D::allocate(int nbElems)
{
- if (nbElems >= _vtkCellIds.size())
- {
- _vtkCellIds.resize(nbElems + SMDS_Mesh::chunkSize, -1);
- _cellIds.resize(_nbDownCells * (nbElems + SMDS_Mesh::chunkSize), -1);
- _upCellIdsVector.resize(nbElems + SMDS_Mesh::chunkSize);
- _upCellTypesVector.resize(nbElems + SMDS_Mesh::chunkSize);
- }
+ if (nbElems >= (int)_vtkCellIds.size())
+ {
+ _vtkCellIds.resize(nbElems + SMDS_Mesh::chunkSize, -1);
+ _cellIds.resize(_nbDownCells * (nbElems + SMDS_Mesh::chunkSize), -1);
+ _upCellIdsVector.resize(nbElems + SMDS_Mesh::chunkSize);
+ _upCellTypesVector.resize(nbElems + SMDS_Mesh::chunkSize);
+ }
}
void SMDS_Down1D::compactStorage()
_upCellIndex.resize(_maxId + 1, -1); // id and types of rank i correspond to [ _upCellIndex[i], _upCellIndex[i+1] [
int current = 0;
for (int i = 0; i < _maxId; i++)
+ {
+ _upCellIndex[i] = current;
+ for (size_t j = 0; j < _upCellIdsVector[i].size(); j++)
{
- _upCellIndex[i] = current;
- for (int j = 0; j < _upCellIdsVector[i].size(); j++)
- {
- _upCellIds[current] = _upCellIdsVector[i][j];
- _upCellTypes[current] = _upCellTypesVector[i][j];
- current++;
- }
+ _upCellIds[current] = _upCellIdsVector[i][j];
+ _upCellTypes[current] = _upCellTypesVector[i][j];
+ current++;
}
+ }
_upCellIndex[_maxId] = current;
_upCellIdsVector.clear();
*/
void SMDS_Down2D::allocate(int nbElems)
{
- if (nbElems >= _vtkCellIds.size())
- {
- _cellIds.resize(_nbDownCells * (nbElems + SMDS_Mesh::chunkSize), -1);
- _vtkCellIds.resize(nbElems + SMDS_Mesh::chunkSize, -1);
- _upCellIds.resize(2 * (nbElems + SMDS_Mesh::chunkSize), -1);
- _upCellTypes.resize(2 * (nbElems + SMDS_Mesh::chunkSize), -1);
- _tempNodes.resize(_nbNodes * (nbElems + SMDS_Mesh::chunkSize), -1);
- }
+ if (nbElems >= (int)_vtkCellIds.size())
+ {
+ _cellIds.resize (_nbDownCells * (nbElems + SMDS_Mesh::chunkSize), -1);
+ _vtkCellIds.resize (nbElems + SMDS_Mesh::chunkSize, -1);
+ _upCellIds.resize (2 * (nbElems + SMDS_Mesh::chunkSize), -1);
+ _upCellTypes.resize(2 * (nbElems + SMDS_Mesh::chunkSize), -1);
+ _tempNodes.resize (_nbNodes * (nbElems + SMDS_Mesh::chunkSize), -1);
+ }
}
void SMDS_Down2D::compactStorage()
void SMDS_Down3D::allocate(int nbElems)
{
- if (nbElems >= _vtkCellIds.size())
- {
- _cellIds.resize(_nbDownCells * (nbElems + SMDS_Mesh::chunkSize), -1);
- _vtkCellIds.resize(nbElems + SMDS_Mesh::chunkSize, -1);
- }
+ if (nbElems >= (int)_vtkCellIds.size())
+ {
+ _cellIds.resize(_nbDownCells * (nbElems + SMDS_Mesh::chunkSize), -1);
+ _vtkCellIds.resize(nbElems + SMDS_Mesh::chunkSize, -1);
+ }
}
void SMDS_Down3D::compactStorage()
{
set<int> setNodes;
setNodes.clear();
- for (int i = 0; i < orderedNodes.size(); i++)
+ for ( size_t i = 0; i < orderedNodes.size(); i++ )
setNodes.insert(orderedNodes[i]);
//MESSAGE("cellId = " << cellId);
set<int> tofind;
int ids[12] = { 0, 1, 2, 0, 3, 1, 2, 3, 0, 1, 3, 2 };
-//int ids[12] = { 2, 1, 0, 1, 3, 0, 0, 3, 2, 2, 3, 1 };
+ //int ids[12] = { 2, 1, 0, 1, 3, 0, 0, 3, 2, 2, 3, 1 };
for (int k = 0; k < 4; k++)
+ {
+ tofind.clear();
+ for (int i = 0; i < 3; i++)
+ tofind.insert(nodes[ids[3 * k + i]]);
+ if (setNodes == tofind)
{
- tofind.clear();
for (int i = 0; i < 3; i++)
- tofind.insert(nodes[ids[3 * k + i]]);
- if (setNodes == tofind)
- {
- for (int i = 0; i < 3; i++)
- orderedNodes[i] = nodes[ids[3 * k + i]];
- return;
- }
+ orderedNodes[i] = nodes[ids[3 * k + i]];
+ return;
}
+ }
MESSAGE("=== Problem volume " << _vtkCellIds[cellId] << " " << _grid->_mesh->fromVtkToSmds(_vtkCellIds[cellId]));
MESSAGE(orderedNodes[0] << " " << orderedNodes[1] << " " << orderedNodes[2]);
MESSAGE(nodes[0] << " " << nodes[1] << " " << nodes[2] << " " << nodes[3]);
{
set<int> setNodes;
setNodes.clear();
- for (int i = 0; i < orderedNodes.size(); i++)
+ for ( size_t i = 0; i < orderedNodes.size(); i++ )
setNodes.insert(orderedNodes[i]);
//MESSAGE("cellId = " << cellId);
set<int> tofind;
int ids[24] = { 0, 1, 2, 4, 5, 6, 0, 3, 1, 7, 8, 4, 2, 3, 0, 9, 7, 6, 1, 3, 2, 8, 9, 5 };
-//int ids[24] = { 2, 1, 0, 5, 4, 6, 1, 3, 0, 8, 7, 4, 0, 3, 2, 7, 9, 6, 2, 3, 1, 9, 8, 5 };
+ //int ids[24] = { 2, 1, 0, 5, 4, 6, 1, 3, 0, 8, 7, 4, 0, 3, 2, 7, 9, 6, 2, 3, 1, 9, 8, 5 };
for (int k = 0; k < 4; k++)
+ {
+ tofind.clear();
+ for (int i = 0; i < 6; i++)
+ tofind.insert(nodes[ids[6 * k + i]]);
+ if (setNodes == tofind)
{
- tofind.clear();
for (int i = 0; i < 6; i++)
- tofind.insert(nodes[ids[6 * k + i]]);
- if (setNodes == tofind)
- {
- for (int i = 0; i < 6; i++)
- orderedNodes[i] = nodes[ids[6 * k + i]];
- return;
- }
+ orderedNodes[i] = nodes[ids[6 * k + i]];
+ return;
}
+ }
MESSAGE("=== Problem volume " << _vtkCellIds[cellId] << " " << _grid->_mesh->fromVtkToSmds(_vtkCellIds[cellId]));
MESSAGE(orderedNodes[0] << " " << orderedNodes[1] << " " << orderedNodes[2]);
MESSAGE(nodes[0] << " " << nodes[1] << " " << nodes[2] << " " << nodes[3]);
{
set<int> setNodes;
setNodes.clear();
- for (int i = 0; i < orderedNodes.size(); i++)
+ for ( size_t i = 0; i < orderedNodes.size(); i++ )
setNodes.insert(orderedNodes[i]);
//MESSAGE("cellId = " << cellId);
for (int i = 0; i < 4; i++)
tofind.insert(nodes[ids[i]]);
if (setNodes == tofind)
- {
- for (int i = 0; i < 4; i++)
- orderedNodes[i] = nodes[ids[i]];
- return;
- }
+ {
+ for (int i = 0; i < 4; i++)
+ orderedNodes[i] = nodes[ids[i]];
+ return;
+ }
// Triangular faces
for (int k = 0; k < 4; k++)
+ {
+ tofind.clear();
+ for (int i = 0; i < 3; i++)
+ tofind.insert(nodes[ids[4 + 3 * k + i]]);
+ if (setNodes == tofind)
{
- tofind.clear();
for (int i = 0; i < 3; i++)
- tofind.insert(nodes[ids[4 + 3 * k + i]]);
- if (setNodes == tofind)
- {
- for (int i = 0; i < 3; i++)
- orderedNodes[i] = nodes[ids[4 + 3 * k + i]];
- return;
- }
+ orderedNodes[i] = nodes[ids[4 + 3 * k + i]];
+ return;
}
+ }
MESSAGE("=== Problem volume " << _vtkCellIds[cellId] << " " << _grid->_mesh->fromVtkToSmds(_vtkCellIds[cellId]));
MESSAGE(orderedNodes[0] << " " << orderedNodes[1] << " " << orderedNodes[2]);
MESSAGE(nodes[0] << " " << nodes[1] << " " << nodes[2] << " " << nodes[3]);
void SMDS_DownQuadPyramid::getOrderedNodesOfFace(int cellId, std::vector<vtkIdType>& orderedNodes)
{
-// MESSAGE("SMDS_DownQuadPyramid::getOrderedNodesOfFace cellId = " << cellId);
+ // MESSAGE("SMDS_DownQuadPyramid::getOrderedNodesOfFace cellId = " << cellId);
set<int> setNodes;
setNodes.clear();
- for (int i = 0; i < orderedNodes.size(); i++)
+ for ( size_t i = 0; i < orderedNodes.size(); i++)
setNodes.insert(orderedNodes[i]);
//MESSAGE("cellId = " << cellId);
for (int i = 0; i < 8; i++)
tofind.insert(nodes[ids[i]]);
if (setNodes == tofind)
- {
- for (int i = 0; i < 8; i++)
- orderedNodes[i] = nodes[ids[i]];
- return;
- }
+ {
+ for (int i = 0; i < 8; i++)
+ orderedNodes[i] = nodes[ids[i]];
+ return;
+ }
// Triangular faces
for (int k = 0; k < 4; k++)
+ {
+ tofind.clear();
+ for (int i = 0; i < 6; i++)
+ tofind.insert(nodes[ids[8 + 6 * k + i]]);
+ if (setNodes == tofind)
{
- tofind.clear();
for (int i = 0; i < 6; i++)
- tofind.insert(nodes[ids[8 + 6 * k + i]]);
- if (setNodes == tofind)
- {
- for (int i = 0; i < 6; i++)
- orderedNodes[i] = nodes[ids[8 + 6 * k + i]];
- return;
- }
+ orderedNodes[i] = nodes[ids[8 + 6 * k + i]];
+ return;
}
+ }
MESSAGE("=== Problem volume " << _vtkCellIds[cellId] << " " << _grid->_mesh->fromVtkToSmds(_vtkCellIds[cellId]));
MESSAGE(orderedNodes[0] << " " << orderedNodes[1] << " " << orderedNodes[2] << " " << orderedNodes[3]);
MESSAGE(nodes[0] << " " << nodes[1] << " " << nodes[2] << " " << nodes[3]);
{
set<int> setNodes;
setNodes.clear();
- for (int i = 0; i < orderedNodes.size(); i++)
+ for ( size_t i = 0; i < orderedNodes.size(); i++)
setNodes.insert(orderedNodes[i]);
//MESSAGE("cellId = " << cellId);
_grid->GetCellPoints(this->_vtkCellIds[cellId], npts, nodes);
set<int> tofind;
-//int ids[18] = { 0, 2, 1, 3, 4, 5, 0, 1, 4, 3, 1, 2, 5, 4, 2, 0, 3, 5 };
+ //int ids[18] = { 0, 2, 1, 3, 4, 5, 0, 1, 4, 3, 1, 2, 5, 4, 2, 0, 3, 5 };
int ids[18] = { 0, 1, 2, 3, 5, 4, 0, 3, 4, 1, 1, 4, 5, 2, 2, 5, 3, 0 };
// Triangular faces
for (int k = 0; k < 2; k++)
+ {
+ tofind.clear();
+ for (int i = 0; i < 3; i++)
+ tofind.insert(nodes[ids[3 * k + i]]);
+ if (setNodes == tofind)
{
- tofind.clear();
for (int i = 0; i < 3; i++)
- tofind.insert(nodes[ids[3 * k + i]]);
- if (setNodes == tofind)
- {
- for (int i = 0; i < 3; i++)
- orderedNodes[i] = nodes[ids[3 * k + i]];
- return;
- }
+ orderedNodes[i] = nodes[ids[3 * k + i]];
+ return;
}
+ }
// Quadrangular faces
for (int k = 0; k < 3; k++)
+ {
+ tofind.clear();
+ for (int i = 0; i < 4; i++)
+ tofind.insert(nodes[ids[6 + 4 * k + i]]);
+ if (setNodes == tofind)
{
- tofind.clear();
for (int i = 0; i < 4; i++)
- tofind.insert(nodes[ids[6 + 4 * k + i]]);
- if (setNodes == tofind)
- {
- for (int i = 0; i < 4; i++)
- orderedNodes[i] = nodes[ids[6 + 4 * k + i]];
- return;
- }
+ orderedNodes[i] = nodes[ids[6 + 4 * k + i]];
+ return;
}
+ }
MESSAGE("=== Problem volume " << _vtkCellIds[cellId] << " " << _grid->_mesh->fromVtkToSmds(_vtkCellIds[cellId]));
MESSAGE(orderedNodes[0] << " " << orderedNodes[1] << " " << orderedNodes[2]);
MESSAGE(nodes[0] << " " << nodes[1] << " " << nodes[2] << " " << nodes[3]);
int *faces = &_cellIds[_nbDownCells * cellId];
if (aType == VTK_QUAD)
for (int i = 0; i < 3; i++)
- {
+ {
if (faces[i] < 0)
{
faces[i] = lowCellId;
{
set<int> setNodes;
setNodes.clear();
- for (int i = 0; i < orderedNodes.size(); i++)
+ for ( size_t i = 0; i < orderedNodes.size(); i++ )
setNodes.insert(orderedNodes[i]);
//MESSAGE("cellId = " << cellId);
_grid->GetCellPoints(this->_vtkCellIds[cellId], npts, nodes);
set<int> tofind;
-//int ids[18] = { 0, 2, 1, 3, 4, 5, 0, 1, 4, 3, 1, 2, 5, 4, 2, 0, 3, 5 };
+ //int ids[18] = { 0, 2, 1, 3, 4, 5, 0, 1, 4, 3, 1, 2, 5, 4, 2, 0, 3, 5 };
int ids[36] = { 0, 1, 2, 6, 7, 8, 3, 5, 4, 11, 10, 9,
0, 3, 4, 1, 12, 9, 13, 6, 1, 4, 5, 2, 13, 10, 14, 7, 2, 5, 3, 0, 14, 11, 12, 8 };
// Triangular faces
for (int k = 0; k < 2; k++)
+ {
+ tofind.clear();
+ for (int i = 0; i < 6; i++)
+ tofind.insert(nodes[ids[6 * k + i]]);
+ if (setNodes == tofind)
{
- tofind.clear();
for (int i = 0; i < 6; i++)
- tofind.insert(nodes[ids[6 * k + i]]);
- if (setNodes == tofind)
- {
- for (int i = 0; i < 6; i++)
- orderedNodes[i] = nodes[ids[6 * k + i]];
- return;
- }
+ orderedNodes[i] = nodes[ids[6 * k + i]];
+ return;
}
+ }
// Quadrangular faces
for (int k = 0; k < 3; k++)
+ {
+ tofind.clear();
+ for (int i = 0; i < 8; i++)
+ tofind.insert(nodes[ids[12 + 8 * k + i]]);
+ if (setNodes == tofind)
{
- tofind.clear();
for (int i = 0; i < 8; i++)
- tofind.insert(nodes[ids[12 + 8 * k + i]]);
- if (setNodes == tofind)
- {
- for (int i = 0; i < 8; i++)
- orderedNodes[i] = nodes[ids[12 + 8 * k + i]];
- return;
- }
+ orderedNodes[i] = nodes[ids[12 + 8 * k + i]];
+ return;
}
+ }
MESSAGE("=== Problem volume " << _vtkCellIds[cellId] << " " << _grid->_mesh->fromVtkToSmds(_vtkCellIds[cellId]));
MESSAGE(orderedNodes[0] << " " << orderedNodes[1] << " " << orderedNodes[2]);
MESSAGE(nodes[0] << " " << nodes[1] << " " << nodes[2] << " " << nodes[3]);
{
set<int> setNodes;
setNodes.clear();
- for (int i = 0; i < orderedNodes.size(); i++)
+ for ( size_t i = 0; i < orderedNodes.size(); i++ )
setNodes.insert(orderedNodes[i]);
//MESSAGE("cellId = " << cellId);
_grid->GetCellPoints(this->_vtkCellIds[cellId], npts, nodes);
set<int> tofind;
-//int ids[24] = { 0, 1, 2, 3, 7, 6, 5, 4, 4, 0, 3, 7, 5, 1, 0, 4, 6, 2, 1, 5, 7, 3, 2, 6};
+ //int ids[24] = { 0, 1, 2, 3, 7, 6, 5, 4, 4, 0, 3, 7, 5, 1, 0, 4, 6, 2, 1, 5, 7, 3, 2, 6};
int ids[24] = { 3, 2, 1, 0, 4, 5, 6, 7, 7, 3, 0, 4, 4, 0, 1, 5, 5, 1, 2, 6, 6, 2, 3, 7};
for (int k = 0; k < 6; k++) // loop on the 6 faces
+ {
+ tofind.clear();
+ for (int i = 0; i < 4; i++)
+ tofind.insert(nodes[ids[4 * k + i]]); // node ids of the face i
+ if (setNodes == tofind)
{
- tofind.clear();
for (int i = 0; i < 4; i++)
- tofind.insert(nodes[ids[4 * k + i]]); // node ids of the face i
- if (setNodes == tofind)
- {
- for (int i = 0; i < 4; i++)
- orderedNodes[i] = nodes[ids[4 * k + i]];
- return;
- }
+ orderedNodes[i] = nodes[ids[4 * k + i]];
+ return;
}
+ }
MESSAGE("=== Problem volume " << _vtkCellIds[cellId] << " " << _grid->_mesh->fromVtkToSmds(_vtkCellIds[cellId]));
MESSAGE(orderedNodes[0] << " " << orderedNodes[1] << " " << orderedNodes[2] << " " << orderedNodes[3]);
MESSAGE(nodes[0] << " " << nodes[1] << " " << nodes[2] << " " << nodes[3]);
{
set<int> setNodes;
setNodes.clear();
- for (int i = 0; i < orderedNodes.size(); i++)
+ for ( size_t i = 0; i < orderedNodes.size(); i++ )
setNodes.insert(orderedNodes[i]);
//MESSAGE("cellId = " << cellId);
int ids[48] = { 3, 2, 1, 0,10, 9, 8,11, 4, 5, 6, 7,12,13,14,15, 7, 3, 0, 4,19,11,16,15,
4, 0, 1, 5,16, 8,17,12, 5, 1, 2, 6,17, 9,18,13, 6, 2, 3, 7,18,10,19,14};
for (int k = 0; k < 6; k++)
+ {
+ tofind.clear();
+ for (int i = 0; i < 8; i++)
+ tofind.insert(nodes[ids[8 * k + i]]);
+ if (setNodes == tofind)
{
- tofind.clear();
for (int i = 0; i < 8; i++)
- tofind.insert(nodes[ids[8 * k + i]]);
- if (setNodes == tofind)
- {
- for (int i = 0; i < 8; i++)
- orderedNodes[i] = nodes[ids[8 * k + i]];
- return;
- }
+ orderedNodes[i] = nodes[ids[8 * k + i]];
+ return;
}
+ }
MESSAGE("=== Problem volume " << _vtkCellIds[cellId] << " " << _grid->_mesh->fromVtkToSmds(_vtkCellIds[cellId]));
MESSAGE(orderedNodes[0] << " " << orderedNodes[1] << " " << orderedNodes[2] << " " << orderedNodes[3]);
MESSAGE(nodes[0] << " " << nodes[1] << " " << nodes[2] << " " << nodes[3]);
class _MyEdgeIterator : public SMDS_ElemIterator
{
vector< const SMDS_MeshElement* > myElems;
- int myIndex;
+ size_t myIndex;
public:
_MyEdgeIterator(const SMDS_FaceOfNodes* face):myIndex(0) {
myElems.reserve( face->NbNodes() );
virtual const SMDS_MeshElement* next() { return myElems[ myIndex++ ]; }
};
-SMDS_ElemIteratorPtr SMDS_FaceOfNodes::elementsIterator
- (SMDSAbs_ElementType type) const
+SMDS_ElemIteratorPtr SMDS_FaceOfNodes::elementsIterator( SMDSAbs_ElementType type ) const
{
switch(type)
{
/// Create an iterator which look for elements of type type which are linked
/// to the element element. it is the iterator to get connectivity of element
//////////////////////////////////////////////////////////////////////////////
-SMDS_IteratorOfElements::SMDS_IteratorOfElements(const SMDS_MeshElement * element,
- SMDSAbs_ElementType type,
+SMDS_IteratorOfElements::SMDS_IteratorOfElements(const SMDS_MeshElement * element,
+ SMDSAbs_ElementType type,
const SMDS_ElemIteratorPtr& it)
- : t1Iterator(it),
- t2Iterator(SMDS_ElemIteratorPtr((SMDS_ElemIterator*)NULL)),
- myType(type), myElement(element),
- myProxyElement(NULL)
+ : t1Iterator(it),
+ t2Iterator(SMDS_ElemIteratorPtr((SMDS_ElemIterator*)NULL)),
+ myType(type), myElement(element),
+ myProxyElement(NULL)
{
- while(subMore())
- alreadyReturnedElements.insert(subNext());
- itAlreadyReturned= alreadyReturnedElements.begin();
- switch(myElement->GetType())
- {
- case SMDSAbs_Node:
- case SMDSAbs_Edge: myReverseIteration=true; break;
- case SMDSAbs_Face: myReverseIteration=(type==SMDSAbs_Volume); break;
- default: myReverseIteration=false;
- }
+ while(subMore())
+ alreadyReturnedElements.insert(subNext());
+ itAlreadyReturned= alreadyReturnedElements.begin();
+ switch(myElement->GetType())
+ {
+ case SMDSAbs_Node:
+ case SMDSAbs_Edge: myReverseIteration=true; break;
+ case SMDSAbs_Face: myReverseIteration=(type==SMDSAbs_Volume); break;
+ default: myReverseIteration=false;
+ }
}
bool SMDS_IteratorOfElements::more()
const SMDS_MeshElement * next();
private:
- SMDS_ElemIteratorPtr t2Iterator;
SMDS_ElemIteratorPtr t1Iterator;
+ SMDS_ElemIteratorPtr t2Iterator;
SMDSAbs_ElementType myType;
- const SMDS_MeshElement * myProxyElement;
const SMDS_MeshElement * myElement;
+ const SMDS_MeshElement * myProxyElement;
bool myReverseIteration;
std::set<const SMDS_MeshElement*> alreadyReturnedElements;
///////////////////////////////////////////////////////////////////////////////
/// Create a new mesh object
///////////////////////////////////////////////////////////////////////////////
-SMDS_Mesh::SMDS_Mesh()
- :myParent(NULL),
- myNodeIDFactory(new SMDS_MeshNodeIDFactory()),
- myElementIDFactory(new SMDS_MeshElementIDFactory()),
- myHasConstructionEdges(false), myHasConstructionFaces(false),
- myHasInverseElements(true),
- myNodeMin(0), myNodeMax(0),
- myNodePool(0), myEdgePool(0), myFacePool(0), myVolumePool(0),myBallPool(0),
- myModified(false), myModifTime(0), myCompactTime(0),
- xmin(0), xmax(0), ymin(0), ymax(0), zmin(0), zmax(0)
+SMDS_Mesh::SMDS_Mesh():
+ myNodePool(0), myVolumePool(0), myFacePool(0), myEdgePool(0), myBallPool(0),
+ myParent(NULL),
+ myNodeIDFactory(new SMDS_MeshNodeIDFactory()),
+ myElementIDFactory(new SMDS_MeshElementIDFactory()),
+ myModified(false), myModifTime(0), myCompactTime(0),
+ myNodeMin(0), myNodeMax(0),
+ myHasConstructionEdges(false), myHasConstructionFaces(false),
+ myHasInverseElements(true),
+ xmin(0), xmax(0), ymin(0), ymax(0), zmin(0), zmax(0)
{
myMeshId = _meshList.size(); // --- index of the mesh to push back in the vector
myNodeIDFactory->SetMesh(this);
/// Note that the tree structure of SMDS_Mesh seems to be unused in this version
/// (2003-09-08) of SMESH
///////////////////////////////////////////////////////////////////////////////
-SMDS_Mesh::SMDS_Mesh(SMDS_Mesh * parent)
- :myParent(parent), myNodeIDFactory(parent->myNodeIDFactory),
- myElementIDFactory(parent->myElementIDFactory),
- myHasConstructionEdges(false), myHasConstructionFaces(false),
- myHasInverseElements(true),
- myNodePool(parent->myNodePool),
- myEdgePool(parent->myEdgePool),
- myFacePool(parent->myFacePool),
- myVolumePool(parent->myVolumePool),
- myBallPool(parent->myBallPool)
+SMDS_Mesh::SMDS_Mesh(SMDS_Mesh * parent):
+ myNodePool(parent->myNodePool),
+ myVolumePool(parent->myVolumePool),
+ myFacePool(parent->myFacePool),
+ myEdgePool(parent->myEdgePool),
+ myBallPool(parent->myBallPool),
+ myParent(parent), myNodeIDFactory(parent->myNodeIDFactory),
+ myElementIDFactory(parent->myElementIDFactory),
+ myHasConstructionEdges(false), myHasConstructionFaces(false),
+ myHasInverseElements(true)
{
}
SMDS_Mesh *SMDS_Mesh::AddSubMesh()
{
- SMDS_Mesh *submesh = new SMDS_Mesh(this);
- myChildren.insert(myChildren.end(), submesh);
- return submesh;
+ SMDS_Mesh *submesh = new SMDS_Mesh(this);
+ myChildren.insert(myChildren.end(), submesh);
+ return submesh;
}
///////////////////////////////////////////////////////////////////////////////
SMDS_MeshNode * node = myNodePool->getNew();
node->init(ID, myMeshId, 0, x, y, z);
- if (ID >= myNodes.size())
+ if (ID >= (int)myNodes.size())
{
myNodes.resize(ID+SMDS_Mesh::chunkSize, 0);
// MESSAGE(" ------------------ myNodes resize " << ID << " --> " << ID+SMDS_Mesh::chunkSize);
bool SMDS_Mesh::registerElement(int ID, SMDS_MeshElement* element)
{
//MESSAGE("registerElement " << ID);
- if ((ID >=0) && (ID < myCells.size()) && myCells[ID]) // --- already bound
+ if ((ID >=0) && (ID < (int)myCells.size()) && myCells[ID]) // --- already bound
{
MESSAGE(" ------------------ already bound "<< ID << " " << myCells[ID]->getVtkId());
return false;
if (vtkId == -1)
vtkId = myElementIDFactory->SetInVtkGrid(element);
- if (vtkId >= myCellIdVtkToSmds.size()) // --- resize local vector
+ if (vtkId >= (int)myCellIdVtkToSmds.size()) // --- resize local vector
{
// MESSAGE(" --------------------- resize myCellIdVtkToSmds " << vtkId << " --> " << vtkId + SMDS_Mesh::chunkSize);
myCellIdVtkToSmds.resize(vtkId + SMDS_Mesh::chunkSize, -1);
///////////////////////////////////////////////////////////////////////////////
const SMDS_MeshNode * SMDS_Mesh::FindNode(int ID) const
{
- if (ID < 1 || ID >= myNodes.size())
+ if (ID < 1 || ID >= (int)myNodes.size())
{
// MESSAGE("------------------------------------------------------------------------- ");
// MESSAGE("----------------------------------- bad ID " << ID << " " << myNodes.size());
const SMDS_MeshNode * SMDS_Mesh::FindNodeVtk(int vtkId) const
{
// TODO if needed use mesh->nodeIdFromVtkToSmds
- if (vtkId < 0 || vtkId >= (myNodes.size() -1))
+ if ( vtkId < 0 || vtkId+1 >= (int) myNodes.size() )
{
MESSAGE("------------------------------------------------------------------------- ");
MESSAGE("---------------------------- bad VTK ID " << vtkId << " " << myNodes.size());
const SMDS_MeshElement* SMDS_Mesh::FindElement(int IDelem) const
{
- if ((IDelem <= 0) || IDelem >= myCells.size())
+ if ( IDelem <= 0 || IDelem >= (int)myCells.size() )
{
MESSAGE("--------------------------------------------------------------------------------- ");
MESSAGE("----------------------------------- bad IDelem " << IDelem << " " << myCells.size());
{
const SMDS_MeshElement* e = itF->next();
int nbNodesToCheck = noMedium ? e->NbCornerNodes() : e->NbNodes();
- if ( nbNodesToCheck == nodes.size() )
+ if ( nbNodesToCheck == (int)nodes.size() )
{
for ( size_t i = 1; e && i < nodes.size(); ++i )
{
///////////////////////////////////////////////////////////////////////////////
/// Return the list of nodes used only by the given elements
///////////////////////////////////////////////////////////////////////////////
-static set<const SMDS_MeshElement*> * getExclusiveNodes(
- set<const SMDS_MeshElement*>& elements)
+static set<const SMDS_MeshElement*> * getExclusiveNodes(set<const SMDS_MeshElement*>& elements)
{
- set<const SMDS_MeshElement*> * toReturn=new set<const SMDS_MeshElement*>();
- set<const SMDS_MeshElement*>::iterator itElements=elements.begin();
+ set<const SMDS_MeshElement*> * toReturn=new set<const SMDS_MeshElement*>();
+ set<const SMDS_MeshElement*>::iterator itElements=elements.begin();
- while(itElements!=elements.end())
- {
- SMDS_ElemIteratorPtr itNodes = (*itElements)->nodesIterator();
- itElements++;
+ while(itElements!=elements.end())
+ {
+ SMDS_ElemIteratorPtr itNodes = (*itElements)->nodesIterator();
+ itElements++;
- while(itNodes->more())
- {
- const SMDS_MeshNode * n=static_cast<const SMDS_MeshNode*>(itNodes->next());
- SMDS_ElemIteratorPtr itFe = n->GetInverseElementIterator();
- set<const SMDS_MeshElement*> s;
- while(itFe->more())
- s.insert(itFe->next());
- if(s==elements) toReturn->insert(n);
- }
- }
- return toReturn;
+ while(itNodes->more())
+ {
+ const SMDS_MeshNode * n=static_cast<const SMDS_MeshNode*>(itNodes->next());
+ SMDS_ElemIteratorPtr itFe = n->GetInverseElementIterator();
+ set<const SMDS_MeshElement*> s;
+ while(itFe->more())
+ s.insert(itFe->next());
+ if(s==elements) toReturn->insert(n);
+ }
+ }
+ return toReturn;
}
///////////////////////////////////////////////////////////////////////////////
set<const SMDS_MeshElement*>& nodes)
{
switch(element->GetType())
+ {
+ case SMDSAbs_Node:
+ MESSAGE("Internal Error: This should not happen");
+ break;
+ case SMDSAbs_0DElement:
+ case SMDSAbs_Ball:
+ {
+ }
+ break;
+ case SMDSAbs_Edge:
+ {
+ SMDS_ElemIteratorPtr itn=element->nodesIterator();
+ while(itn->more())
{
- case SMDSAbs_Node:
- MESSAGE("Internal Error: This should not happen");
- break;
- case SMDSAbs_0DElement:
+ const SMDS_MeshElement * e=itn->next();
+ if(nodes.find(e)!=nodes.end())
{
+ setOfChildren.insert(element);
+ break;
+ }
+ }
+ } break;
+ case SMDSAbs_Face:
+ {
+ SMDS_ElemIteratorPtr itn=element->nodesIterator();
+ while(itn->more())
+ {
+ const SMDS_MeshElement * e=itn->next();
+ if(nodes.find(e)!=nodes.end())
+ {
+ setOfChildren.insert(element);
+ break;
}
- break;
- case SMDSAbs_Edge:
- {
- SMDS_ElemIteratorPtr itn=element->nodesIterator();
- while(itn->more())
- {
- const SMDS_MeshElement * e=itn->next();
- if(nodes.find(e)!=nodes.end())
- {
- setOfChildren.insert(element);
- break;
- }
- }
- } break;
- case SMDSAbs_Face:
- {
- SMDS_ElemIteratorPtr itn=element->nodesIterator();
- while(itn->more())
- {
- const SMDS_MeshElement * e=itn->next();
- if(nodes.find(e)!=nodes.end())
- {
- setOfChildren.insert(element);
- break;
- }
- }
- if(hasConstructionEdges())
- {
- SMDS_ElemIteratorPtr ite=element->edgesIterator();
- while(ite->more())
- addChildrenWithNodes(setOfChildren, ite->next(), nodes);
- }
- } break;
- case SMDSAbs_Volume:
- {
- if(hasConstructionFaces())
- {
- SMDS_ElemIteratorPtr ite=element->facesIterator();
- while(ite->more())
- addChildrenWithNodes(setOfChildren, ite->next(), nodes);
- }
- else if(hasConstructionEdges())
- {
- SMDS_ElemIteratorPtr ite=element->edgesIterator();
- while(ite->more())
- addChildrenWithNodes(setOfChildren, ite->next(), nodes);
- }
- }
}
+ if(hasConstructionEdges())
+ {
+ SMDS_ElemIteratorPtr ite=element->edgesIterator();
+ while(ite->more())
+ addChildrenWithNodes(setOfChildren, ite->next(), nodes);
+ }
+ } break;
+ case SMDSAbs_Volume:
+ {
+ if(hasConstructionFaces())
+ {
+ SMDS_ElemIteratorPtr ite=element->facesIterator();
+ while(ite->more())
+ addChildrenWithNodes(setOfChildren, ite->next(), nodes);
+ }
+ else if(hasConstructionEdges())
+ {
+ SMDS_ElemIteratorPtr ite=element->edgesIterator();
+ while(ite->more())
+ addChildrenWithNodes(setOfChildren, ite->next(), nodes);
+ }
+ }
+ case SMDSAbs_NbElementTypes:
+ case SMDSAbs_All: break;
+ }
}
///////////////////////////////////////////////////////////////////////////////
list<const SMDS_MeshElement *>& removedNodes,
bool removenodes)
{
- //MESSAGE("SMDS_Mesh::RemoveElement " << elem->getVtkId() << " " << removenodes);
// get finite elements built on elem
set<const SMDS_MeshElement*> * s1;
if ( (elem->GetType() == SMDSAbs_0DElement)
// Remove element from <InverseElements> of its nodes
SMDS_ElemIteratorPtr itn = (*it)->nodesIterator();
while (itn->more())
- {
- SMDS_MeshNode * n = static_cast<SMDS_MeshNode *> (const_cast<SMDS_MeshElement *> (itn->next()));
- n->RemoveInverseElement((*it));
- }
+ {
+ SMDS_MeshNode * n = static_cast<SMDS_MeshNode *> (const_cast<SMDS_MeshElement *> (itn->next()));
+ n->RemoveInverseElement((*it));
+ }
int IdToRemove = (*it)->GetID();
int vtkid = (*it)->getVtkId();
- //MESSAGE("elem Id to remove " << IdToRemove << " vtkid " << vtkid <<
- // " vtktype " << (*it)->GetVtkType() << " type " << (*it)->GetType());
switch ((*it)->GetType())
{
case SMDSAbs_Node:
- MYASSERT("Internal Error: This should not happen")
- ;
+ MYASSERT("Internal Error: This should not happen");
break;
case SMDSAbs_0DElement:
if (IdToRemove >= 0)
myElementIDFactory->ReleaseID(IdToRemove, vtkid);
if (const SMDS_VtkEdge* vtkElem = dynamic_cast<const SMDS_VtkEdge*>(*it))
myEdgePool->destroy((SMDS_VtkEdge*) vtkElem);
- else
+ else {
+ ((SMDS_MeshElement*) *it)->init( -1, -1, -1 ); // avoid reuse
delete (*it);
+ }
break;
case SMDSAbs_Face:
if (IdToRemove >= 0)
myElementIDFactory->ReleaseID(IdToRemove, vtkid);
if (const SMDS_VtkFace* vtkElem = dynamic_cast<const SMDS_VtkFace*>(*it))
myFacePool->destroy((SMDS_VtkFace*) vtkElem);
- else
+ else {
+ ((SMDS_MeshElement*) *it)->init( -1, -1, -1 ); // avoid reuse
delete (*it);
+ }
break;
case SMDSAbs_Volume:
if (IdToRemove >= 0)
myElementIDFactory->ReleaseID(IdToRemove, vtkid);
if (const SMDS_VtkVolume* vtkElem = dynamic_cast<const SMDS_VtkVolume*>(*it))
myVolumePool->destroy((SMDS_VtkVolume*) vtkElem);
- else
+ else {
+ ((SMDS_MeshElement*) *it)->init( -1, -1, -1 ); // avoid reuse
delete (*it);
+ }
break;
case SMDSAbs_Ball:
if (IdToRemove >= 0)
myElementIDFactory->ReleaseID(IdToRemove, vtkid);
if (const SMDS_BallElement* vtkElem = dynamic_cast<const SMDS_BallElement*>(*it))
myBallPool->destroy(const_cast<SMDS_BallElement*>( vtkElem ));
- else
+ else {
+ ((SMDS_MeshElement*) *it)->init( -1, -1, -1 ); // avoid reuse
delete (*it);
+ }
break;
+
+ case SMDSAbs_All: // avoid compilation warning
+ case SMDSAbs_NbElementTypes: break;
}
if (vtkid >= 0)
- {
- //MESSAGE("VTK_EMPTY_CELL in " << vtkid);
- this->myGrid->GetCellTypesArray()->SetValue(vtkid, VTK_EMPTY_CELL);
- }
+ {
+ this->myGrid->GetCellTypesArray()->SetValue(vtkid, VTK_EMPTY_CELL);
+ }
it++;
}
// remove exclusive (free) nodes
if (removenodes)
+ {
+ it = s2->begin();
+ while (it != s2->end())
{
- it = s2->begin();
- while (it != s2->end())
- {
- int IdToRemove = (*it)->GetID();
- //MESSAGE( "SMDS: RM node " << IdToRemove);
- if (IdToRemove >= 0)
- {
- myNodes[IdToRemove] = 0;
- myInfo.myNbNodes--;
- }
- myNodeIDFactory->ReleaseID((*it)->GetID(), (*it)->getVtkId());
- removedNodes.push_back((*it));
- if (const SMDS_MeshNode* vtkElem = dynamic_cast<const SMDS_MeshNode*>(*it))
- {
- ((SMDS_MeshNode*)vtkElem)->SetPosition(SMDS_SpacePosition::originSpacePosition());
- myNodePool->destroy((SMDS_MeshNode*) vtkElem);
- }
- else
- delete (*it);
- it++;
- }
+ int IdToRemove = (*it)->GetID();
+ if (IdToRemove >= 0)
+ {
+ myNodes[IdToRemove] = 0;
+ myInfo.myNbNodes--;
+ }
+ myNodeIDFactory->ReleaseID((*it)->GetID(), (*it)->getVtkId());
+ removedNodes.push_back((*it));
+ if (const SMDS_MeshNode* vtkElem = dynamic_cast<const SMDS_MeshNode*>(*it))
+ {
+ ((SMDS_MeshNode*)vtkElem)->SetPosition(SMDS_SpacePosition::originSpacePosition());
+ myNodePool->destroy((SMDS_MeshNode*) vtkElem);
+ }
+ else
+ delete (*it);
+ it++;
}
+ }
delete s2;
delete s1;
}
// in meshes without descendants elements are always free
- switch (aType) {
+ switch (aType) {
case SMDSAbs_0DElement:
myCells[elemId] = 0;
myInfo.remove(elem);
delete elem;
+ elem = 0;
break;
case SMDSAbs_Edge:
myCells[elemId] = 0;
this->myGrid->GetCellTypesArray()->SetValue(vtkId, VTK_EMPTY_CELL);
// --- to do: keep vtkid in a list of reusable cells
+
+ if ( elem )
+ ((SMDS_MeshElement*) elem)->init( -1, -1, -1 ); // avoid reuse
}
}
myNodeMax=0;
return;
}
- while (!myNodes[myNodeMin] && (myNodeMin<myNodes.size()))
+ while ( !myNodes[myNodeMin] && myNodeMin < (int)myNodes.size() )
myNodeMin++;
myNodeMax=myNodes.size()-1;
while (!myNodes[myNodeMax] && (myNodeMin>=0))
int SMDS_Mesh::fromVtkToSmds(int vtkid)
{
- if (vtkid >= 0 && vtkid < myCellIdVtkToSmds.size())
+ if (vtkid >= 0 && vtkid < (int)myCellIdVtkToSmds.size())
return myCellIdVtkToSmds[vtkid];
throw SALOME_Exception(LOCALIZED ("vtk id out of bounds"));
}
void incrementNodesCapacity(int nbNodes);
void incrementCellsCapacity(int nbCells);
void adjustStructure();
- void dumpGrid(string ficdump="dumpGrid");
+ void dumpGrid(std::string ficdump="dumpGrid");
static int chunkSize;
//! low level modification: add, change or remove node or element
{
assert(ID >= 0);
myElementIDFactory->adjustMaxId(ID);
- if (ID >= myCells.size())
+ if (ID >= (int)myCells.size())
myCells.resize(ID+SMDS_Mesh::chunkSize,0);
}
SMDS_MeshElementIDFactory *myElementIDFactory;
SMDS_MeshInfo myInfo;
+ //! any add, remove or change of node or cell
+ bool myModified;
//! use a counter to keep track of modifications
unsigned long myModifTime, myCompactTime;
bool myHasConstructionFaces;
bool myHasInverseElements;
- //! any add, remove or change of node or cell
- bool myModified;
-
double xmin;
double xmax;
double ymin;
reverseInterlaces[ smdsType ][pos++] = 0;
for ( int i = nbNodes / 2 - 1; i > 0 ; --i ) // 3,2,1
reverseInterlaces[ smdsType ][pos++] = i;
- for ( int i = nbNodes - 1; i >= nbNodes / 2; --i ) // 7,6,5,4
+ for ( int i = nbNodes - 1, nb = nbNodes / 2; i >= nb; --i ) // 7,6,5,4
reverseInterlaces[ smdsType ][pos++] = i;
}
}
//=======================================================================
SMDS_MeshElement* SMDS_MeshElementIDFactory::MeshElement(int ID)
{
- if ((ID<1) || (ID>=myMesh->myCells.size()))
+ if ( ID<1 || ID >= (int) myMesh->myCells.size() )
return NULL;
const SMDS_MeshElement* elem = GetMesh()->FindElement(ID);
return (SMDS_MeshElement*)(elem);
//MESSAGE("~~~~~~~~~~~~~~ SMDS_MeshElementIDFactory::ReleaseID smdsId vtkId " << ID << " " << vtkId);
if (vtkId >= 0)
{
- assert(vtkId < myMesh->myCellIdVtkToSmds.size());
+ assert(vtkId < (int)myMesh->myCellIdVtkToSmds.size());
myMesh->myCellIdVtkToSmds[vtkId] = -1;
myMesh->setMyModified();
}
{
myMin = INT_MAX;
myMax = 0;
- for (int i = 0; i < myMesh->myCells.size(); i++)
+ for (size_t i = 0; i < myMesh->myCells.size(); i++)
{
if (myMesh->myCells[i])
{
#define SMDS_MeshInfo_HeaderFile
#include <vector>
-using namespace std;
#include "SMESH_SMDS.hxx"
inline SMDS_MeshInfo& // operator=
SMDS_MeshInfo::operator=(const SMDS_MeshInfo& other)
-{ for ( int i=0; i<myNb.size(); ++i ) if ( myNb[i] ) (*myNb[i])=(*other.myNb[i]);
+{ for ( size_t i=0; i<myNb.size(); ++i ) if ( myNb[i] ) (*myNb[i])=(*other.myNb[i]);
myNbPolygons = other.myNbPolygons;
myNbQuadPolygons = other.myNbQuadPolygons;
myNbPolyhedrons = other.myNbPolyhedrons;
inline void // Clear
SMDS_MeshInfo::Clear()
-{ for ( int i=0; i<myNb.size(); ++i ) if ( myNb[i] ) (*myNb[i])=0;
+{ for ( size_t i=0; i<myNb.size(); ++i ) if ( myNb[i] ) (*myNb[i])=0;
myNbPolygons=myNbQuadPolygons=myNbPolyhedrons=0;
}
int nb = 0;
switch (type) {
case SMDSAbs_All:
- for ( int i=1+index( SMDSAbs_Node,1 ); i<myNb.size(); ++i ) if ( myNb[i] ) nb += *myNb[i];
+ for ( size_t i=1+index( SMDSAbs_Node,1 ); i<myNb.size(); ++i ) if ( myNb[i] ) nb += *myNb[i];
nb += myNbPolygons + myNbQuadPolygons + myNbPolyhedrons;
break;
case SMDSAbs_Volume:
case SMDSEntity_Ball: return myNbBalls;
case SMDSEntity_Quad_Polygon: return myNbQuadPolygons;
case SMDSEntity_Quad_Polyhedra:
+ case SMDSEntity_Last:
break;
}
return 0;
case SMDSEntity_Triangle: myNbTriangles = nb; break;
case SMDSEntity_Quad_Polygon: myNbQuadPolygons = nb; break;
case SMDSEntity_Quad_Polyhedra:
+ case SMDSEntity_Last:
break;
}
}
MESSAGE("SMDS_MeshNode_MyInvIterator problem Null element");
throw SALOME_Exception("SMDS_MeshNode_MyInvIterator problem Null element");
}
- //MESSAGE("vtkId " << vtkId << " smdsId " << smdsId << " " << elem->GetType());
iter++;
return elem;
}
};
-SMDS_ElemIteratorPtr SMDS_MeshNode::
-GetInverseElementIterator(SMDSAbs_ElementType type) const
+SMDS_ElemIteratorPtr SMDS_MeshNode::GetInverseElementIterator(SMDSAbs_ElementType type) const
{
vtkCellLinks::Link l = SMDS_Mesh::_meshList[myMeshId]->getGrid()->GetCellLinks()->GetLink(myVtkID);
- //MESSAGE("myID " << myID << " ncells " << l.ncells);
return SMDS_ElemIteratorPtr(new SMDS_MeshNode_MyInvIterator(SMDS_Mesh::_meshList[myMeshId], l.cells, l.ncells, type));
}
class _MyEdgeIterator : public SMDS_ElemIterator
{
vector< const SMDS_MeshElement* > myElems;
- int myIndex;
+ size_t myIndex;
public:
_MyEdgeIterator(const SMDS_MeshFace* face):myIndex(0) {
myElems.reserve( face->NbNodes() );
{
int nbEdges = 0;
- for (int ifa = 0; ifa < myQuantities.size(); ifa++) {
+ for ( size_t ifa = 0; ifa < myQuantities.size(); ifa++) {
nbEdges += myQuantities[ifa];
}
nbEdges /= 2;
//=======================================================================
int SMDS_PolyhedralVolumeOfNodes::NbFaceNodes (const int face_ind) const
{
- if (face_ind < 1 || myQuantities.size() < face_ind)
+ if (face_ind < 1 || (int)myQuantities.size() < face_ind)
return 0;
return myQuantities[face_ind - 1];
}
class _MySubIterator : public SMDS_ElemIterator
{
vector< const SMDS_MeshElement* > myElems;
- int myIndex;
+ size_t myIndex;
public:
_MySubIterator(const SMDS_MeshVolume* vol, SMDSAbs_ElementType type):myIndex(0) {
SMDS_VolumeTool vTool(vol);
//=======================================================================
//class : _MyInterlacedNodeIterator
- //purpose :
+ //purpose :
//=======================================================================
class _MyInterlacedNodeIterator:public SMDS_NodeIterator
{
const vector<const SMDS_MeshNode *>& mySet;
- int myIndex;
- const int * myInterlace;
+ size_t myIndex;
+ const int * myInterlace;
public:
_MyInterlacedNodeIterator(const vector<const SMDS_MeshNode *>& s,
const int * interlace):
class _MyEdgeIterator : public SMDS_ElemIterator
{
vector< const SMDS_MeshElement* > myElems;
- int myIndex;
+ size_t myIndex;
public:
_MyEdgeIterator(const SMDS_QuadraticFaceOfNodes* face):myIndex(0) {
myElems.reserve( face->NbNodes() );
case 15: nbCorners = 6; break;
default: nbCorners = 8;
}
- for ( int i = nbCorners; i<myNodes.size(); i++) {
+ for ( size_t i = nbCorners; i<myNodes.size(); i++) {
if(myNodes[i]==node) return true;
}
return false;
class _MySubIterator : public SMDS_ElemIterator
{
vector< const SMDS_MeshElement* > myElems;
- int myIndex;
+ size_t myIndex;
public:
_MySubIterator(const SMDS_MeshVolume* vol, SMDSAbs_ElementType type):myIndex(0) {
SMDS_VolumeTool vTool(vol);
int SMDS_UnstructuredGrid::CellIdToDownId(int vtkCellId)
{
- if((vtkCellId < 0) || (vtkCellId >= _cellIdToDownId.size()))
- {
- //MESSAGE("SMDS_UnstructuredGrid::CellIdToDownId structure not up to date: vtkCellId="
- // << vtkCellId << " max="<< _cellIdToDownId.size());
- return -1;
- }
+ if ((vtkCellId < 0) || (vtkCellId >= (int)_cellIdToDownId.size()))
+ {
+ //MESSAGE("SMDS_UnstructuredGrid::CellIdToDownId structure not up to date: vtkCellId="
+ // << vtkCellId << " max="<< _cellIdToDownId.size());
+ return -1;
+ }
return _cellIdToDownId[vtkCellId];
}
void SMDS_UnstructuredGrid::CleanDownwardConnectivity()
{
- for (int i = 0; i < _downArray.size(); i++)
- {
- if (_downArray[i])
- delete _downArray[i];
- _downArray[i] = 0;
- }
+ for (size_t i = 0; i < _downArray.size(); i++)
+ {
+ if (_downArray[i])
+ delete _downArray[i];
+ _downArray[i] = 0;
+ }
_cellIdToDownId.clear();
}
class _MySubIterator : public SMDS_ElemIterator
{
vector< const SMDS_MeshElement* > myElems;
- int myIndex;
+ size_t myIndex;
public:
_MySubIterator(const SMDS_VolumeOfNodes* vol, SMDSAbs_ElementType type):myIndex(0) {
SMDS_VolumeTool vTool(vol);
if ( !myVolume )
return false;
- for ( int i = 0; i < myVolumeNodes.size(); i++ ) {
+ for ( size_t i = 0; i < myVolumeNodes.size(); i++ ) {
X += myVolumeNodes[ i ]->X();
Y += myVolumeNodes[ i ]->Y();
Z += myVolumeNodes[ i ]->Z();
// find nodes indices
int i1 = -1, i2 = -1, nbFound = 0;
- for ( int i = 0; i < myVolumeNodes.size() && nbFound < 2; i++ )
+ for ( size_t i = 0; i < myVolumeNodes.size() && nbFound < 2; i++ )
{
if ( myVolumeNodes[ i ] == theNode1 )
i1 = i, ++nbFound;
int minInd = min( theNode1Index, theNode2Index );
int maxInd = max( theNode1Index, theNode2Index );
- if ( minInd < 0 || maxInd > myVolumeNodes.size() - 1 || maxInd == minInd )
+ if ( minInd < 0 || maxInd > (int)myVolumeNodes.size() - 1 || maxInd == minInd )
return false;
VolumeType type = GetVolumeType();
int SMDS_VolumeTool::GetNodeIndex(const SMDS_MeshNode* theNode) const
{
if ( myVolume ) {
- for ( int i = 0; i < myVolumeNodes.size(); i++ ) {
+ for ( size_t i = 0; i < myVolumeNodes.size(); i++ ) {
if ( myVolumeNodes[ i ] == theNode )
return i;
}
{
edges.clear();
edges.reserve( myVolumeNodes.size() * 2 );
- for ( int i = 0; i < myVolumeNodes.size()-1; ++i ) {
- for ( int j = i + 1; j < myVolumeNodes.size(); ++j ) {
+ for ( size_t i = 0; i < myVolumeNodes.size()-1; ++i ) {
+ for ( size_t j = i + 1; j < myVolumeNodes.size(); ++j ) {
if ( IsLinked( i, j )) {
const SMDS_MeshElement* edge =
SMDS_Mesh::FindEdge( myVolumeNodes[i], myVolumeNodes[j] );
SMDS_UnstructuredGrid* grid = mesh->getGrid();
//double center[3];
//this->gravityCenter(grid, &nodeIds[0], nodeIds.size(), ¢er[0]);
- vector<vtkIdType> ptIds;
+ std::vector<vtkIdType> ptIds;
vtkIdType nbFaces = nbNodesPerFace.size();
int k = 0;
for (int i = 0; i < nbFaces; i++)
const std::vector<int>& interlace = SMDS_MeshCell::toVtkOrder( VTKCellType( aVtkType ));
if ( !interlace.empty() )
{
- ASSERT( interlace.size() == nbNodes );
+ ASSERT( (int)interlace.size() == nbNodes );
std::vector<const SMDS_MeshNode*> initNodes( nodes, nodes+nbNodes );
for ( size_t i = 0; i < interlace.size(); ++i )
nodes[i] = initNodes[ interlace[i] ];
*/
std::vector<int> SMDS_VtkVolume::GetQuantities() const
{
- vector<int> quantities;
+ std::vector<int> quantities;
SMDS_Mesh *mesh = SMDS_Mesh::_meshList[myMeshId];
vtkUnstructuredGrid* grid = mesh->getGrid();
vtkIdType aVtkType = grid->GetCellType(this->myVtkID);
}
chrono::chrono(int i) :
- _ctr(i), _run(true)
+ _run(true), _ctr(i)
{
//MESSAGE("chrono::chrono " << _ctr << " " << _run);
_start = clock();
if ( n2 && ++nbNodes )
theNodes.insert( make_pair( l, n2 ));
- return theNodes.size() == nbNodes;
+ return (int)theNodes.size() == nbNodes;
}
//================================================================================
{
SMESH_HypoFilter* filter = new SMESH_HypoFilter();
filter->Init( filter->HasName( _compatibleHypothesis[0] ));
- for ( int i = 1; i < _compatibleHypothesis.size(); ++i )
+ for ( size_t i = 1; i < _compatibleHypothesis.size(); ++i )
filter->Or( filter->HasName( _compatibleHypothesis[ i ] ));
SMESH_HypoFilter* filterNoAux = new SMESH_HypoFilter( filter );
* have a name (type) listed in the algorithm. Hypothesis associated to
* father shape -are not- taken into account (see GetUsedHypothesis)
*/
- const list <const SMESHDS_Hypothesis *> &
+ const std::list <const SMESHDS_Hypothesis *> &
GetAppliedHypothesis(SMESH_Mesh & aMesh,
const TopoDS_Shape & aShape,
const bool ignoreAuxiliary=true) const;
int _algoDim;
bool _isGlobalAlgo;
- TAlgoStateError(): _algoDim(0),_algo(0),_name(SMESH_Hypothesis::HYP_OK) {}
+ TAlgoStateError(): _name(SMESH_Hypothesis::HYP_OK), _algo(0), _algoDim(0) {}
void Set(TAlgoStateErrorName name, const SMESH_Algo* algo, bool isGlobal)
{ _name = name; _algo = algo; _algoDim = algo->GetDim(); _isGlobalAlgo = isGlobal; }
void Set(TAlgoStateErrorName name, const int algoDim, bool isGlobal)
{
const int shapeID = _mesh.GetMeshDS()->ShapeToIndex( _shape );
const TListOfListOfInt& listOfShapeIDList = _mesh.GetMeshOrder();
- TListOfListOfInt::const_iterator listsIt = listOfShapeIDList.begin();
+ TListOfListOfInt::const_iterator listsIt = listOfShapeIDList.begin();
for ( ; listsIt != listOfShapeIDList.end(); ++listsIt )
{
- const TListOfInt& idList = *listsIt;
+ const TListOfInt& idList = *listsIt;
TListOfInt::const_iterator idIt =
std::find( idList.begin(), idList.end(), shapeID );
if ( idIt != idList.end() && *idIt != idList.front() )
{
- for ( ; idIt != idList.end(); --idIt )
+ for ( --idIt; true; --idIt )
{
const TopoDS_Shape& shape = _mesh.GetMeshDS()->IndexToShape( *idIt );
if ( !shape.IsNull())
_preferableShapes.Add( shape );
+
+ if ( idIt == idList.begin() )
+ break;
}
}
}
case ALGO_1D: dim = 1; break;
case ALGO_2D: dim = 2; break;
case ALGO_3D: dim = 3; break;
+ case ALGO_0D: dim = 0; break;
case PARAM_ALGO:
dim = ( _param_algo_dim < 0 ) ? -_param_algo_dim : _param_algo_dim; break;
}
SMESH_Mesh* SMESH_Hypothesis::GetMeshByPersistentID(int id)
{
StudyContextStruct* myStudyContext = _gen->GetStudyContext(_studyId);
- map<int, SMESH_Mesh*>::iterator itm = itm = myStudyContext->mapMesh.begin();
+ map<int, SMESH_Mesh*>::iterator itm = myStudyContext->mapMesh.begin();
for ( ; itm != myStudyContext->mapMesh.end(); itm++)
{
SMESH_Mesh* mesh = (*itm).second;
MESSAGE("MEDToMesh - _myMeshDS->NbFaces() = "<<_myMeshDS->NbFaces());
MESSAGE("MEDToMesh - _myMeshDS->NbVolumes() = "<<_myMeshDS->NbVolumes());
}
+#ifdef _DEBUG_
+ SMESH_ComputeErrorPtr er = myReader.GetError();
+ if ( er && !er->IsOK() ) cout << er->myComment << endl;
+#endif
// Reading groups (sub-meshes are out of scope of MED import functionality)
list<TNameAndType> aGroupNames = myReader.GetGroupNamesAndTypes();
hasNotComputed = true;
if ( hasComputed && hasNotComputed)
return true;
+
+ default:;
}
}
if ( NbNodes() < 1 )
bool SMESH_Mesh::SynchronizeGroups()
{
- int nbGroups = _mapGroup.size();
+ size_t nbGroups = _mapGroup.size();
const set<SMESHDS_GroupBase*>& groups = _myMeshDS->GetGroups();
set<SMESHDS_GroupBase*>::const_iterator gIt = groups.begin();
for ( ; gIt != groups.end(); ++gIt )
if ( face->GetType() != SMDSAbs_Face )
continue;
- const int nbCornersNodes = face->NbCornerNodes();
+ const size_t nbCornersNodes = face->NbCornerNodes();
faceNodes.assign( face->begin_nodes(), face->end_nodes() );
checkedVolumes.clear();
// is volume adjacent?
bool allNodesCommon = true;
- for ( int iN = 1; iN < nbCornersNodes && allNodesCommon; ++iN )
+ for ( size_t iN = 1; iN < nbCornersNodes && allNodesCommon; ++iN )
allNodesCommon = ( volume->GetNodeIndex( faceNodes[ iN ]) > -1 );
if ( !allNodesCommon )
continue;
for ( int i = 0; i < 2; ++i )
{
const SMDS_MeshNode* n = facetNodes[ i*iQ ];
- for ( int iN = 0; iN < nbCornersNodes; ++iN )
+ for ( size_t iN = 0; iN < nbCornersNodes; ++iN )
if ( faceNodes[ iN ] == n )
{
iNN[ i ] = iN;
// create 4 triangles
- GetMeshDS()->RemoveFreeElement( quad, subMeshDS, /*fromGroups=*/false );
-
helper.SetIsQuadratic ( nodes.size() > 4 );
helper.SetIsBiQuadratic( nodes.size() == 9 );
if ( helper.GetIsQuadratic() )
helper.AddTLinks( static_cast< const SMDS_MeshFace*>( quad ));
+ GetMeshDS()->RemoveFreeElement( quad, subMeshDS, /*fromGroups=*/false );
+
for ( int i = 0; i < 4; ++i )
{
SMDS_MeshElement* tria = helper.AddFace( nodes[ i ],
if ( hasAdjacentSplits && method._nbSplits > 0 )
{
bool facetCreated = true;
- for ( int iF = 0; facetCreated && iF < triaSplitsByFace.size(); ++iF )
+ for ( size_t iF = 0; facetCreated && iF < triaSplitsByFace.size(); ++iF )
{
list< TTriangleFacet >::const_iterator facet = triaSplitsByFace[iF].begin();
for ( ; facetCreated && facet != triaSplitsByFace[iF].end(); ++facet )
volNodes[ facet->_n3 ]));
}
}
- for ( int i = 0; i < triangles.size(); ++i )
+ for ( size_t i = 0; i < triangles.size(); ++i )
{
- if ( !triangles[i] ) continue;
+ if ( !triangles[ i ]) continue;
if ( fSubMesh )
- fSubMesh->AddElement( triangles[i]);
- newElems.Append( triangles[i] );
+ fSubMesh->AddElement( triangles[ i ]);
+ newElems.Append( triangles[ i ]);
}
ReplaceElemInGroups( face, triangles, GetMeshDS() );
GetMeshDS()->RemoveFreeElement( face, fSubMesh, /*fromGroups=*/false );
GetMeshDS()->RemoveNode( volNodes[i] );
}
} // loop on volumes to split
-
+
myLastCreatedNodes = newNodes;
myLastCreatedElems = newElems;
}
set<const SMDS_MeshNode*> facetNodes;
const SMDS_MeshElement* curHex;
- const bool allHex = ( theHexas.size() == myMesh->NbHexas() );
+ const bool allHex = ((int) theHexas.size() == myMesh->NbHexas() );
while ( startHex )
{
for ( ; grIt != groups.end(); grIt++ ) {
SMESHDS_Group* group = dynamic_cast<SMESHDS_Group*>( *grIt );
if ( group && group->SMDSGroup().Remove( elemToRm ) )
- for ( int i = 0; i < elemToAdd.size(); ++i )
+ for ( size_t i = 0; i < elemToAdd.size(); ++i )
group->SMDSGroup().Add( elemToAdd[ i ] );
}
}
SMESH_MesherHelper helper( *GetMesh() );
TIDSortedElemSet::iterator itElem;
- for ( itElem = theElems.begin(); itElem != theElems.end(); itElem++ ) {
+ for ( itElem = theElems.begin(); itElem != theElems.end(); itElem++ )
+ {
const SMDS_MeshElement* elem = *itElem;
- if ( !elem || elem->GetType() != SMDSAbs_Face )
+ if ( !elem || elem->GetGeomType() != SMDSGeom_QUADRANGLE )
continue;
- bool isquad = elem->NbNodes()==4 || elem->NbNodes()==8;
- if(!isquad) continue;
- if(elem->NbNodes()==4) {
+ if ( elem->NbNodes() == 4 ) {
// retrieve element nodes
const SMDS_MeshNode* aNodes [4];
SMDS_ElemIteratorPtr itN = elem->nodesIterator();
myLastCreatedElems.Append(newElem2);
// put a new triangle on the same shape and add to the same groups
if ( aShapeId )
- {
- aMesh->SetMeshElementOnShape( newElem1, aShapeId );
- aMesh->SetMeshElementOnShape( newElem2, aShapeId );
- }
+ {
+ aMesh->SetMeshElementOnShape( newElem1, aShapeId );
+ aMesh->SetMeshElementOnShape( newElem2, aShapeId );
+ }
AddToSameGroups( newElem1, elem, aMesh );
AddToSameGroups( newElem2, elem, aMesh );
aMesh->RemoveElement( elem );
// Quadratic quadrangle
- if( elem->NbNodes()==8 && elem->IsQuadratic() ) {
-
+ else if ( elem->NbNodes() >= 8 )
+ {
// get surface elem is on
int aShapeId = FindShape( elem );
if ( aShapeId != helper.GetSubShapeID() ) {
}
}
- const SMDS_MeshNode* aNodes [8];
- const SMDS_MeshNode* inFaceNode = 0;
+ const SMDS_MeshNode* aNodes [9]; aNodes[8] = 0;
SMDS_ElemIteratorPtr itN = elem->nodesIterator();
- int i = 0;
- while ( itN->more() ) {
- aNodes[ i++ ] = static_cast<const SMDS_MeshNode*>( itN->next() );
- if ( !inFaceNode && helper.GetNodeUVneedInFaceNode() &&
- aNodes[ i-1 ]->GetPosition()->GetTypeOfPosition() == SMDS_TOP_FACE )
- {
- inFaceNode = aNodes[ i-1 ];
- }
- }
+ for ( int i = 0; itN->more(); ++i )
+ aNodes[ i ] = static_cast<const SMDS_MeshNode*>( itN->next() );
- // find middle point for (0,1,2,3)
- // and create a node in this point;
- gp_XYZ p( 0,0,0 );
- if ( surface.IsNull() ) {
- for(i=0; i<4; i++)
- p += gp_XYZ(aNodes[i]->X(), aNodes[i]->Y(), aNodes[i]->Z() );
- p /= 4;
- }
- else {
- TopoDS_Face geomFace = TopoDS::Face( helper.GetSubShape() );
- gp_XY uv( 0,0 );
- for(i=0; i<4; i++)
- uv += helper.GetNodeUV( geomFace, aNodes[i], inFaceNode );
- uv /= 4.;
- p = surface->Value( uv.X(), uv.Y() ).XYZ();
+ const SMDS_MeshNode* centrNode = aNodes[8];
+ if ( centrNode == 0 )
+ {
+ centrNode = helper.GetCentralNode( aNodes[0], aNodes[1], aNodes[2], aNodes[3],
+ aNodes[4], aNodes[5], aNodes[6], aNodes[7],
+ surface.IsNull() );
+ myLastCreatedNodes.Append(centrNode);
}
- const SMDS_MeshNode* newN = aMesh->AddNode( p.X(), p.Y(), p.Z() );
- myLastCreatedNodes.Append(newN);
// create a new element
const SMDS_MeshElement* newElem1 = 0;
const SMDS_MeshElement* newElem2 = 0;
if ( the13Diag ) {
newElem1 = aMesh->AddFace(aNodes[2], aNodes[3], aNodes[0],
- aNodes[6], aNodes[7], newN );
+ aNodes[6], aNodes[7], centrNode );
newElem2 = aMesh->AddFace(aNodes[2], aNodes[0], aNodes[1],
- newN, aNodes[4], aNodes[5] );
+ centrNode, aNodes[4], aNodes[5] );
}
else {
newElem1 = aMesh->AddFace(aNodes[3], aNodes[0], aNodes[1],
- aNodes[7], aNodes[4], newN );
+ aNodes[7], aNodes[4], centrNode );
newElem2 = aMesh->AddFace(aNodes[3], aNodes[1], aNodes[2],
- newN, aNodes[5], aNodes[6] );
+ centrNode, aNodes[5], aNodes[6] );
}
myLastCreatedElems.Append(newElem1);
myLastCreatedElems.Append(newElem2);
// put a new triangle on the same shape and add to the same groups
if ( aShapeId )
- {
- aMesh->SetMeshElementOnShape( newElem1, aShapeId );
- aMesh->SetMeshElementOnShape( newElem2, aShapeId );
- }
+ {
+ aMesh->SetMeshElementOnShape( newElem1, aShapeId );
+ aMesh->SetMeshElementOnShape( newElem2, aShapeId );
+ }
AddToSameGroups( newElem1, elem, aMesh );
AddToSameGroups( newElem2, elem, aMesh );
aMesh->RemoveElement( elem );
Handle(Geom_Surface) surface;
SMESHDS_SubMesh* faceSubMesh = 0;
TopoDS_Face face;
- double fToler2 = 0, f,l;
+ double fToler2 = 0;
double u1 = 0, u2 = 0, v1 = 0, v2 = 0;
bool isUPeriodic = false, isVPeriodic = false;
if ( *fId )
void SMESH_MeshEditor::sweepElement(const SMDS_MeshElement* elem,
const vector<TNodeOfNodeListMapItr> & newNodesItVec,
list<const SMDS_MeshElement*>& newElems,
- const int nbSteps,
+ const size_t nbSteps,
SMESH_SequenceOfElemPtr& srcElements)
{
//MESSAGE("sweepElement " << nbSteps);
}
// make new elements
- for (int iStep = 0; iStep < nbSteps; iStep++ )
+ for ( size_t iStep = 0; iStep < nbSteps; iStep++ )
{
// get next nodes
for ( iNode = 0; iNode < nbNodes; iNode++ )
// source elements for each generated one
SMESH_SequenceOfElemPtr srcElems, srcNodes;
- SMESHDS_Mesh* aMesh = GetMeshDS();
+ //SMESHDS_Mesh* aMesh = GetMeshDS();
setElemsFirst( theElemSets );
const int nbSteps = theParams.NbSteps();
return EXTR_PATH_NOT_EDGE;
TopTools_SequenceOfShape Edges;
- double x1,x2,y1,y2,z1,z2;
list< list<SMESH_MeshEditor_PathPoint> > LLPPs;
int startNid = theN1->GetID();
- for(int i = 1; i < aNodesList.size(); i++) {
- x1 = aNodesList[i-1]->X();x2 = aNodesList[i]->X();
- y1 = aNodesList[i-1]->Y();y2 = aNodesList[i]->Y();
- z1 = aNodesList[i-1]->Z();z2 = aNodesList[i]->Z();
- TopoDS_Edge e = BRepBuilderAPI_MakeEdge(gp_Pnt(x1,y1,z1),gp_Pnt(x2,y2,z2));
+ for ( size_t i = 1; i < aNodesList.size(); i++ )
+ {
+ gp_Pnt p1 = SMESH_TNodeXYZ( aNodesList[i-1] );
+ gp_Pnt p2 = SMESH_TNodeXYZ( aNodesList[i] );
+ TopoDS_Edge e = BRepBuilderAPI_MakeEdge( p1, p2 );
list<SMESH_MeshEditor_PathPoint> LPP;
aPrms.clear();
MakeEdgePathPoints(aPrms, e, (aNodesList[i-1]->GetID()==startNid), LPP);
LLPPs.push_back(LPP);
- if( aNodesList[i-1]->GetID() == startNid ) startNid = aNodesList[i]->GetID();
- else startNid = aNodesList[i-1]->GetID();
-
+ if ( aNodesList[i-1]->GetID() == startNid ) startNid = aNodesList[i ]->GetID();
+ else startNid = aNodesList[i-1]->GetID();
}
list< list<SMESH_MeshEditor_PathPoint> >::iterator itLLPP = LLPPs.begin();
PP2 = currList.front();
gp_Dir D1 = PP1.Tangent();
gp_Dir D2 = PP2.Tangent();
- gp_Dir Dnew( gp_Vec( (D1.X()+D2.X())/2, (D1.Y()+D2.Y())/2,
- (D1.Z()+D2.Z())/2 ) );
+ gp_Dir Dnew( 0.5 * ( D1.XYZ() + D2.XYZ() ));
PP1.SetTangent(Dnew);
fullList.push_back(PP1);
itPP++;
fullList.push_back(PP1);
} // Sub-shape for the Pattern must be an Edge or Wire
- else if( aS.ShapeType() == TopAbs_EDGE ) {
+ else if ( aS.ShapeType() == TopAbs_EDGE )
+ {
aTrackEdge = TopoDS::Edge( aS );
// the Edge must not be degenerated
if ( SMESH_Algo::isDegenerated( aTrackEdge ) )
// if current elem is quadratic and current node is not medium
// we have to check - may be it is needed to insert additional nodes
list< const SMDS_MeshNode* > & listNewNodes = nIt->second;
- if ( listNewNodes.size() == aNbTP-1 )
+ if ((int) listNewNodes.size() == aNbTP-1 )
{
vector<const SMDS_MeshNode*> aNodes(2*(aNbTP-1));
gp_XYZ P(node->X(), node->Y(), node->Z());
if ( !elem ) continue;
SMDSAbs_GeometryType geomType = elem->GetGeomType();
- int nbNodes = elem->NbNodes();
+ size_t nbNodes = elem->NbNodes();
if ( geomType == SMDSGeom_NONE ) continue; // node
nodes.resize( nbNodes );
const vector<int>& i = needReverse ? iRev : iForw;
// find transformed nodes
- int iNode = 0;
+ size_t iNode = 0;
SMDS_ElemIteratorPtr itN = elem->nodesIterator();
while ( itN->more() ) {
const SMDS_MeshNode* node = static_cast<const SMDS_MeshNode*>( itN->next() );
// sew the border to the side 2
// ============================
- int nbNodes[] = { nSide[0].size(), nSide[1].size() };
+ int nbNodes[] = { (int)nSide[0].size(), (int)nSide[1].size() };
int maxNbNodes = Max( nbNodes[0], nbNodes[1] );
bool toMergeConformal = ( nbNodes[0] == nbNodes[1] );
// create new elements
i1 = 0; i2 = 1;
- for ( iSplit = 0; iSplit < nbSplits - 1; iSplit++ ) {
- SMDS_MeshElement* newElem = 0;
+ for ( iSplit = 0; iSplit < nbSplits - 1; iSplit++ )
+ {
if ( iSplit == iBestQuad )
newElems.push_back( aMesh->AddFace (linkNodes[ i1++ ],
linkNodes[ i2++ ],
return false;
const double aTol = Precision::Confusion();
- auto_ptr< BRepClass3d_SolidClassifier> bsc3d;
- auto_ptr<_FaceClassifier> aFaceClassifier;
+ SMESHUtils::Deleter< BRepClass3d_SolidClassifier> bsc3d;
+ SMESHUtils::Deleter<_FaceClassifier> aFaceClassifier;
if ( theShape.ShapeType() == TopAbs_SOLID )
{
- bsc3d.reset( new BRepClass3d_SolidClassifier(theShape));;
+ bsc3d._obj = new BRepClass3d_SolidClassifier( theShape );
bsc3d->PerformInfinitePoint(aTol);
}
else if (theShape.ShapeType() == TopAbs_FACE )
{
- aFaceClassifier.reset( new _FaceClassifier(TopoDS::Face(theShape)));
+ aFaceClassifier._obj = new _FaceClassifier( TopoDS::Face( theShape ));
}
// iterates on indicated elements and get elements by back references from their nodes
{
const SMDS_MeshElement* curElem = backElemItr->next();
if ( curElem && theElems.find(curElem) == theElems.end() &&
- ( bsc3d.get() ?
+ ( bsc3d ?
isInside( curElem, *bsc3d, aTol ) :
isInside( curElem, *aFaceClassifier, aTol )))
anAffected.insert( curElem );
// Check if the domains do not share an element
for (int idom = 0; idom < nbDomains-1; idom++)
- {
-// MESSAGE("... Check of domain #" << idom);
- const TIDSortedElemSet& domain = theElems[idom];
- TIDSortedElemSet::const_iterator elemItr = domain.begin();
- for (; elemItr != domain.end(); ++elemItr)
+ {
+ // MESSAGE("... Check of domain #" << idom);
+ const TIDSortedElemSet& domain = theElems[idom];
+ TIDSortedElemSet::const_iterator elemItr = domain.begin();
+ for (; elemItr != domain.end(); ++elemItr)
+ {
+ const SMDS_MeshElement* anElem = *elemItr;
+ int idombisdeb = idom + 1 ;
+ // check if the element belongs to a domain further in the list
+ for ( size_t idombis = idombisdeb; idombis < theElems.size(); idombis++ )
+ {
+ const TIDSortedElemSet& domainbis = theElems[idombis];
+ if ( domainbis.count( anElem ))
{
- const SMDS_MeshElement* anElem = *elemItr;
- int idombisdeb = idom + 1 ;
- for (int idombis = idombisdeb; idombis < theElems.size(); idombis++) // check if the element belongs to a domain further in the list
- {
- const TIDSortedElemSet& domainbis = theElems[idombis];
- if ( domainbis.count(anElem) )
- {
- MESSAGE(".... Domain #" << idom);
- MESSAGE(".... Domain #" << idombis);
- throw SALOME_Exception("The domains are not disjoint.");
- return false ;
- }
- }
+ MESSAGE(".... Domain #" << idom);
+ MESSAGE(".... Domain #" << idombis);
+ throw SALOME_Exception("The domains are not disjoint.");
+ return false ;
}
+ }
}
+ }
for (int idom = 0; idom < nbDomains; idom++)
- {
+ {
- // --- build a map (face to duplicate --> volume to modify)
- // with all the faces shared by 2 domains (group of elements)
- // and corresponding volume of this domain, for each shared face.
- // a volume has a face shared by 2 domains if it has a neighbor which is not in his domain.
+ // --- build a map (face to duplicate --> volume to modify)
+ // with all the faces shared by 2 domains (group of elements)
+ // and corresponding volume of this domain, for each shared face.
+ // a volume has a face shared by 2 domains if it has a neighbor which is not in his domain.
- MESSAGE("... Neighbors of domain #" << idom);
- const TIDSortedElemSet& domain = theElems[idom];
- TIDSortedElemSet::const_iterator elemItr = domain.begin();
- for (; elemItr != domain.end(); ++elemItr)
+ MESSAGE("... Neighbors of domain #" << idom);
+ const TIDSortedElemSet& domain = theElems[idom];
+ TIDSortedElemSet::const_iterator elemItr = domain.begin();
+ for (; elemItr != domain.end(); ++elemItr)
+ {
+ const SMDS_MeshElement* anElem = *elemItr;
+ if (!anElem)
+ continue;
+ int vtkId = anElem->getVtkId();
+ //MESSAGE(" vtkId " << vtkId << " smdsId " << anElem->GetID());
+ int neighborsVtkIds[NBMAXNEIGHBORS];
+ int downIds[NBMAXNEIGHBORS];
+ unsigned char downTypes[NBMAXNEIGHBORS];
+ int nbNeighbors = grid->GetNeighbors(neighborsVtkIds, downIds, downTypes, vtkId);
+ for (int n = 0; n < nbNeighbors; n++)
+ {
+ int smdsId = meshDS->fromVtkToSmds(neighborsVtkIds[n]);
+ const SMDS_MeshElement* elem = meshDS->FindElement(smdsId);
+ if (elem && ! domain.count(elem)) // neighbor is in another domain : face is shared
{
- const SMDS_MeshElement* anElem = *elemItr;
- if (!anElem)
- continue;
- int vtkId = anElem->getVtkId();
- //MESSAGE(" vtkId " << vtkId << " smdsId " << anElem->GetID());
- int neighborsVtkIds[NBMAXNEIGHBORS];
- int downIds[NBMAXNEIGHBORS];
- unsigned char downTypes[NBMAXNEIGHBORS];
- int nbNeighbors = grid->GetNeighbors(neighborsVtkIds, downIds, downTypes, vtkId);
- for (int n = 0; n < nbNeighbors; n++)
+ bool ok = false;
+ for ( size_t idombis = 0; idombis < theElems.size() && !ok; idombis++) // check if the neighbor belongs to another domain of the list
+ {
+ // MESSAGE("Domain " << idombis);
+ const TIDSortedElemSet& domainbis = theElems[idombis];
+ if ( domainbis.count(elem)) ok = true ; // neighbor is in a correct domain : face is kept
+ }
+ if ( ok || onAllBoundaries ) // the characteristics of the face is stored
+ {
+ DownIdType face(downIds[n], downTypes[n]);
+ if (!faceDomains[face].count(idom))
{
- int smdsId = meshDS->fromVtkToSmds(neighborsVtkIds[n]);
- const SMDS_MeshElement* elem = meshDS->FindElement(smdsId);
- if (elem && ! domain.count(elem)) // neighbor is in another domain : face is shared
- {
- bool ok = false ;
- for (int idombis = 0; idombis < theElems.size() && !ok; idombis++) // check if the neighbor belongs to another domain of the list
- {
- // MESSAGE("Domain " << idombis);
- const TIDSortedElemSet& domainbis = theElems[idombis];
- if ( domainbis.count(elem)) ok = true ; // neighbor is in a correct domain : face is kept
- }
- if ( ok || onAllBoundaries ) // the characteristics of the face is stored
- {
- DownIdType face(downIds[n], downTypes[n]);
- if (!faceDomains[face].count(idom))
- {
- faceDomains[face][idom] = vtkId; // volume associated to face in this domain
- celldom[vtkId] = idom;
- //MESSAGE(" cell with a border " << vtkId << " domain " << idom);
- }
- if ( !ok )
- {
- theRestDomElems.insert( elem );
- faceDomains[face][iRestDom] = neighborsVtkIds[n];
- celldom[neighborsVtkIds[n]] = iRestDom;
- }
- }
- }
+ faceDomains[face][idom] = vtkId; // volume associated to face in this domain
+ celldom[vtkId] = idom;
+ //MESSAGE(" cell with a border " << vtkId << " domain " << idom);
+ }
+ if ( !ok )
+ {
+ theRestDomElems.insert( elem );
+ faceDomains[face][iRestDom] = neighborsVtkIds[n];
+ celldom[neighborsVtkIds[n]] = iRestDom;
}
+ }
}
+ }
}
+ }
//MESSAGE("Number of shared faces " << faceDomains.size());
std::map<DownIdType, std::map<int, int>, DownIdCompare>::iterator itface;
// which has only a node or an edge on the border (not a shared face)
for (int idomain = idom0; idomain < nbDomains; idomain++)
+ {
+ //MESSAGE("Domain " << idomain);
+ const TIDSortedElemSet& domain = (idomain == iRestDom) ? theRestDomElems : theElems[idomain];
+ itface = faceDomains.begin();
+ for (; itface != faceDomains.end(); ++itface)
{
- //MESSAGE("Domain " << idomain);
- const TIDSortedElemSet& domain = (idomain == iRestDom) ? theRestDomElems : theElems[idomain];
- itface = faceDomains.begin();
- for (; itface != faceDomains.end(); ++itface)
+ const std::map<int, int>& domvol = itface->second;
+ if (!domvol.count(idomain))
+ continue;
+ DownIdType face = itface->first;
+ //MESSAGE(" --- face " << face.cellId);
+ std::set<int> oldNodes;
+ oldNodes.clear();
+ grid->GetNodeIds(oldNodes, face.cellId, face.cellType);
+ std::set<int>::iterator itn = oldNodes.begin();
+ for (; itn != oldNodes.end(); ++itn)
+ {
+ int oldId = *itn;
+ //MESSAGE(" node " << oldId);
+ vtkCellLinks::Link l = grid->GetCellLinks()->GetLink(oldId);
+ for (int i=0; i<l.ncells; i++)
{
- const std::map<int, int>& domvol = itface->second;
- if (!domvol.count(idomain))
+ int vtkId = l.cells[i];
+ const SMDS_MeshElement* anElem = GetMeshDS()->FindElement(GetMeshDS()->fromVtkToSmds(vtkId));
+ if (!domain.count(anElem))
continue;
- DownIdType face = itface->first;
- //MESSAGE(" --- face " << face.cellId);
- std::set<int> oldNodes;
- oldNodes.clear();
- grid->GetNodeIds(oldNodes, face.cellId, face.cellType);
- std::set<int>::iterator itn = oldNodes.begin();
- for (; itn != oldNodes.end(); ++itn)
- {
- int oldId = *itn;
- //MESSAGE(" node " << oldId);
- vtkCellLinks::Link l = grid->GetCellLinks()->GetLink(oldId);
- for (int i=0; i<l.ncells; i++)
- {
- int vtkId = l.cells[i];
- const SMDS_MeshElement* anElem = GetMeshDS()->FindElement(GetMeshDS()->fromVtkToSmds(vtkId));
- if (!domain.count(anElem))
- continue;
- int vtkType = grid->GetCellType(vtkId);
- int downId = grid->CellIdToDownId(vtkId);
- if (downId < 0)
- {
- MESSAGE("doubleNodesOnGroupBoundaries: internal algorithm problem");
- continue; // not OK at this stage of the algorithm:
- //no cells created after BuildDownWardConnectivity
- }
- DownIdType aCell(downId, vtkType);
- cellDomains[aCell][idomain] = vtkId;
- celldom[vtkId] = idomain;
- //MESSAGE(" cell " << vtkId << " domain " << idomain);
- }
- }
+ int vtkType = grid->GetCellType(vtkId);
+ int downId = grid->CellIdToDownId(vtkId);
+ if (downId < 0)
+ {
+ MESSAGE("doubleNodesOnGroupBoundaries: internal algorithm problem");
+ continue; // not OK at this stage of the algorithm:
+ //no cells created after BuildDownWardConnectivity
+ }
+ DownIdType aCell(downId, vtkType);
+ cellDomains[aCell][idomain] = vtkId;
+ celldom[vtkId] = idomain;
+ //MESSAGE(" cell " << vtkId << " domain " << idomain);
}
+ }
}
+ }
// --- explore the shared faces domain by domain, to duplicate the nodes in a coherent way
// for each shared face, get the nodes
MESSAGE(".. Duplication of the nodes");
for (int idomain = idom0; idomain < nbDomains; idomain++)
+ {
+ itface = faceDomains.begin();
+ for (; itface != faceDomains.end(); ++itface)
{
- itface = faceDomains.begin();
- for (; itface != faceDomains.end(); ++itface)
+ const std::map<int, int>& domvol = itface->second;
+ if (!domvol.count(idomain))
+ continue;
+ DownIdType face = itface->first;
+ //MESSAGE(" --- face " << face.cellId);
+ std::set<int> oldNodes;
+ oldNodes.clear();
+ grid->GetNodeIds(oldNodes, face.cellId, face.cellType);
+ std::set<int>::iterator itn = oldNodes.begin();
+ for (; itn != oldNodes.end(); ++itn)
+ {
+ int oldId = *itn;
+ if (nodeDomains[oldId].empty())
{
- const std::map<int, int>& domvol = itface->second;
- if (!domvol.count(idomain))
- continue;
- DownIdType face = itface->first;
- //MESSAGE(" --- face " << face.cellId);
- std::set<int> oldNodes;
- oldNodes.clear();
- grid->GetNodeIds(oldNodes, face.cellId, face.cellType);
- std::set<int>::iterator itn = oldNodes.begin();
- for (; itn != oldNodes.end(); ++itn)
+ nodeDomains[oldId][idomain] = oldId; // keep the old node in the first domain
+ //MESSAGE("-+-+-b oldNode " << oldId << " domain " << idomain);
+ }
+ std::map<int, int>::const_iterator itdom = domvol.begin();
+ for (; itdom != domvol.end(); ++itdom)
+ {
+ int idom = itdom->first;
+ //MESSAGE(" domain " << idom);
+ if (!nodeDomains[oldId].count(idom)) // --- node to clone
+ {
+ if (nodeDomains[oldId].size() >= 2) // a multiple node
{
- int oldId = *itn;
- if (nodeDomains[oldId].empty())
- {
- nodeDomains[oldId][idomain] = oldId; // keep the old node in the first domain
- //MESSAGE("-+-+-b oldNode " << oldId << " domain " << idomain);
- }
- std::map<int, int>::const_iterator itdom = domvol.begin();
- for (; itdom != domvol.end(); ++itdom)
- {
- int idom = itdom->first;
- //MESSAGE(" domain " << idom);
- if (!nodeDomains[oldId].count(idom)) // --- node to clone
- {
- if (nodeDomains[oldId].size() >= 2) // a multiple node
- {
- vector<int> orderedDoms;
- //MESSAGE("multiple node " << oldId);
- if (mutipleNodes.count(oldId))
- orderedDoms = mutipleNodes[oldId];
- else
- {
- map<int,int>::iterator it = nodeDomains[oldId].begin();
- for (; it != nodeDomains[oldId].end(); ++it)
- orderedDoms.push_back(it->first);
- }
- orderedDoms.push_back(idom); // TODO order ==> push_front or back
- //stringstream txt;
- //for (int i=0; i<orderedDoms.size(); i++)
- // txt << orderedDoms[i] << " ";
- //MESSAGE("orderedDoms " << txt.str());
- mutipleNodes[oldId] = orderedDoms;
- }
- double *coords = grid->GetPoint(oldId);
- SMDS_MeshNode *newNode = meshDS->AddNode(coords[0], coords[1], coords[2]);
- copyPosition( meshDS->FindNodeVtk( oldId ), newNode );
- int newId = newNode->getVtkId();
- nodeDomains[oldId][idom] = newId; // cloned node for other domains
- //MESSAGE("-+-+-c oldNode " << oldId << " domain " << idomain << " newNode " << newId << " domain " << idom << " size=" <<nodeDomains[oldId].size());
- }
- }
+ vector<int> orderedDoms;
+ //MESSAGE("multiple node " << oldId);
+ if (mutipleNodes.count(oldId))
+ orderedDoms = mutipleNodes[oldId];
+ else
+ {
+ map<int,int>::iterator it = nodeDomains[oldId].begin();
+ for (; it != nodeDomains[oldId].end(); ++it)
+ orderedDoms.push_back(it->first);
+ }
+ orderedDoms.push_back(idom); // TODO order ==> push_front or back
+ //stringstream txt;
+ //for (int i=0; i<orderedDoms.size(); i++)
+ // txt << orderedDoms[i] << " ";
+ //MESSAGE("orderedDoms " << txt.str());
+ mutipleNodes[oldId] = orderedDoms;
}
+ double *coords = grid->GetPoint(oldId);
+ SMDS_MeshNode *newNode = meshDS->AddNode(coords[0], coords[1], coords[2]);
+ copyPosition( meshDS->FindNodeVtk( oldId ), newNode );
+ int newId = newNode->getVtkId();
+ nodeDomains[oldId][idom] = newId; // cloned node for other domains
+ //MESSAGE("-+-+-c oldNode " << oldId << " domain " << idomain << " newNode " << newId << " domain " << idom << " size=" <<nodeDomains[oldId].size());
+ }
}
+ }
}
+ }
MESSAGE(".. Creation of elements");
for (int idomain = idom0; idomain < nbDomains; idomain++)
+ {
+ itface = faceDomains.begin();
+ for (; itface != faceDomains.end(); ++itface)
{
- itface = faceDomains.begin();
- for (; itface != faceDomains.end(); ++itface)
+ std::map<int, int> domvol = itface->second;
+ if (!domvol.count(idomain))
+ continue;
+ DownIdType face = itface->first;
+ //MESSAGE(" --- face " << face.cellId);
+ std::set<int> oldNodes;
+ oldNodes.clear();
+ grid->GetNodeIds(oldNodes, face.cellId, face.cellType);
+ int nbMultipleNodes = 0;
+ std::set<int>::iterator itn = oldNodes.begin();
+ for (; itn != oldNodes.end(); ++itn)
+ {
+ int oldId = *itn;
+ if (mutipleNodes.count(oldId))
+ nbMultipleNodes++;
+ }
+ if (nbMultipleNodes > 1) // check if an edge of the face is shared between 3 or more domains
+ {
+ //MESSAGE("multiple Nodes detected on a shared face");
+ int downId = itface->first.cellId;
+ unsigned char cellType = itface->first.cellType;
+ // --- shared edge or shared face ?
+ if ((cellType == VTK_LINE) || (cellType == VTK_QUADRATIC_EDGE)) // shared edge (between two faces)
{
- std::map<int, int> domvol = itface->second;
- if (!domvol.count(idomain))
- continue;
- DownIdType face = itface->first;
- //MESSAGE(" --- face " << face.cellId);
- std::set<int> oldNodes;
- oldNodes.clear();
- grid->GetNodeIds(oldNodes, face.cellId, face.cellType);
- int nbMultipleNodes = 0;
- std::set<int>::iterator itn = oldNodes.begin();
- for (; itn != oldNodes.end(); ++itn)
- {
- int oldId = *itn;
- if (mutipleNodes.count(oldId))
- nbMultipleNodes++;
- }
- if (nbMultipleNodes > 1) // check if an edge of the face is shared between 3 or more domains
+ int nodes[3];
+ int nbNodes = grid->getDownArray(cellType)->getNodes(downId, nodes);
+ for (int i=0; i< nbNodes; i=i+nbNodes-1) // i=0 , i=nbNodes-1
+ if (mutipleNodes.count(nodes[i]))
+ if (!mutipleNodesToFace.count(nodes[i]))
+ mutipleNodesToFace[nodes[i]] = mutipleNodes[nodes[i]];
+ }
+ else // shared face (between two volumes)
+ {
+ int nbEdges = grid->getDownArray(cellType)->getNumberOfDownCells(downId);
+ const int* downEdgeIds = grid->getDownArray(cellType)->getDownCells(downId);
+ const unsigned char* edgeType = grid->getDownArray(cellType)->getDownTypes(downId);
+ for (int ie =0; ie < nbEdges; ie++)
+ {
+ int nodes[3];
+ int nbNodes = grid->getDownArray(edgeType[ie])->getNodes(downEdgeIds[ie], nodes);
+ if ( mutipleNodes.count(nodes[0]) && mutipleNodes.count( nodes[ nbNodes-1 ]))
{
- //MESSAGE("multiple Nodes detected on a shared face");
- int downId = itface->first.cellId;
- unsigned char cellType = itface->first.cellType;
- // --- shared edge or shared face ?
- if ((cellType == VTK_LINE) || (cellType == VTK_QUADRATIC_EDGE)) // shared edge (between two faces)
- {
- int nodes[3];
- int nbNodes = grid->getDownArray(cellType)->getNodes(downId, nodes);
- for (int i=0; i< nbNodes; i=i+nbNodes-1) // i=0 , i=nbNodes-1
- if (mutipleNodes.count(nodes[i]))
- if (!mutipleNodesToFace.count(nodes[i]))
- mutipleNodesToFace[nodes[i]] = mutipleNodes[nodes[i]];
- }
- else // shared face (between two volumes)
+ vector<int> vn0 = mutipleNodes[nodes[0]];
+ vector<int> vn1 = mutipleNodes[nodes[nbNodes - 1]];
+ vector<int> doms;
+ for ( size_t i0 = 0; i0 < vn0.size(); i0++ )
+ for ( size_t i1 = 0; i1 < vn1.size(); i1++ )
+ if ( vn0[i0] == vn1[i1] )
+ doms.push_back( vn0[ i0 ]);
+ if ( doms.size() > 2 )
+ {
+ //MESSAGE(" detect edgesMultiDomains " << nodes[0] << " " << nodes[nbNodes - 1]);
+ double *coords = grid->GetPoint(nodes[0]);
+ gp_Pnt p0(coords[0], coords[1], coords[2]);
+ coords = grid->GetPoint(nodes[nbNodes - 1]);
+ gp_Pnt p1(coords[0], coords[1], coords[2]);
+ gp_Pnt gref;
+ int vtkVolIds[1000]; // an edge can belong to a lot of volumes
+ map<int, SMDS_VtkVolume*> domvol; // domain --> a volume with the edge
+ map<int, double> angleDom; // oriented angles between planes defined by edge and volume centers
+ int nbvol = grid->GetParentVolumes(vtkVolIds, downEdgeIds[ie], edgeType[ie]);
+ for ( size_t id = 0; id < doms.size(); id++ )
{
- int nbEdges = grid->getDownArray(cellType)->getNumberOfDownCells(downId);
- const int* downEdgeIds = grid->getDownArray(cellType)->getDownCells(downId);
- const unsigned char* edgeType = grid->getDownArray(cellType)->getDownTypes(downId);
- for (int ie =0; ie < nbEdges; ie++)
+ int idom = doms[id];
+ const TIDSortedElemSet& domain = (idom == iRestDom) ? theRestDomElems : theElems[idom];
+ for ( int ivol = 0; ivol < nbvol; ivol++ )
+ {
+ int smdsId = meshDS->fromVtkToSmds(vtkVolIds[ivol]);
+ SMDS_MeshElement* elem = (SMDS_MeshElement*)meshDS->FindElement(smdsId);
+ if (domain.count(elem))
{
- int nodes[3];
- int nbNodes = grid->getDownArray(edgeType[ie])->getNodes(downEdgeIds[ie], nodes);
- if (mutipleNodes.count(nodes[0]) && mutipleNodes.count(nodes[nbNodes-1]))
- {
- vector<int> vn0 = mutipleNodes[nodes[0]];
- vector<int> vn1 = mutipleNodes[nodes[nbNodes - 1]];
- vector<int> doms;
- for (int i0 = 0; i0 < vn0.size(); i0++)
- for (int i1 = 0; i1 < vn1.size(); i1++)
- if (vn0[i0] == vn1[i1])
- doms.push_back(vn0[i0]);
- if (doms.size() >2)
- {
- //MESSAGE(" detect edgesMultiDomains " << nodes[0] << " " << nodes[nbNodes - 1]);
- double *coords = grid->GetPoint(nodes[0]);
- gp_Pnt p0(coords[0], coords[1], coords[2]);
- coords = grid->GetPoint(nodes[nbNodes - 1]);
- gp_Pnt p1(coords[0], coords[1], coords[2]);
- gp_Pnt gref;
- int vtkVolIds[1000]; // an edge can belong to a lot of volumes
- map<int, SMDS_VtkVolume*> domvol; // domain --> a volume with the edge
- map<int, double> angleDom; // oriented angles between planes defined by edge and volume centers
- int nbvol = grid->GetParentVolumes(vtkVolIds, downEdgeIds[ie], edgeType[ie]);
- for (int id=0; id < doms.size(); id++)
- {
- int idom = doms[id];
- const TIDSortedElemSet& domain = (idom == iRestDom) ? theRestDomElems : theElems[idom];
- for (int ivol=0; ivol<nbvol; ivol++)
- {
- int smdsId = meshDS->fromVtkToSmds(vtkVolIds[ivol]);
- SMDS_MeshElement* elem = (SMDS_MeshElement*)meshDS->FindElement(smdsId);
- if (domain.count(elem))
- {
- SMDS_VtkVolume* svol = dynamic_cast<SMDS_VtkVolume*>(elem);
- domvol[idom] = svol;
- //MESSAGE(" domain " << idom << " volume " << elem->GetID());
- double values[3];
- vtkIdType npts = 0;
- vtkIdType* pts = 0;
- grid->GetCellPoints(vtkVolIds[ivol], npts, pts);
- SMDS_VtkVolume::gravityCenter(grid, pts, npts, values);
- if (id ==0)
- {
- gref.SetXYZ(gp_XYZ(values[0], values[1], values[2]));
- angleDom[idom] = 0;
- }
- else
- {
- gp_Pnt g(values[0], values[1], values[2]);
- angleDom[idom] = OrientedAngle(p0, p1, gref, g); // -pi<angle<+pi
- //MESSAGE(" angle=" << angleDom[idom]);
- }
- break;
- }
- }
- }
- map<double, int> sortedDom; // sort domains by angle
- for (map<int, double>::iterator ia = angleDom.begin(); ia != angleDom.end(); ++ia)
- sortedDom[ia->second] = ia->first;
- vector<int> vnodes;
- vector<int> vdom;
- for (map<double, int>::iterator ib = sortedDom.begin(); ib != sortedDom.end(); ++ib)
- {
- vdom.push_back(ib->second);
- //MESSAGE(" ordered domain " << ib->second << " angle " << ib->first);
- }
- for (int ino = 0; ino < nbNodes; ino++)
- vnodes.push_back(nodes[ino]);
- edgesMultiDomains[vnodes] = vdom; // nodes vector --> ordered domains
- }
- }
+ SMDS_VtkVolume* svol = dynamic_cast<SMDS_VtkVolume*>(elem);
+ domvol[idom] = svol;
+ //MESSAGE(" domain " << idom << " volume " << elem->GetID());
+ double values[3];
+ vtkIdType npts = 0;
+ vtkIdType* pts = 0;
+ grid->GetCellPoints(vtkVolIds[ivol], npts, pts);
+ SMDS_VtkVolume::gravityCenter(grid, pts, npts, values);
+ if (id ==0)
+ {
+ gref.SetXYZ(gp_XYZ(values[0], values[1], values[2]));
+ angleDom[idom] = 0;
+ }
+ else
+ {
+ gp_Pnt g(values[0], values[1], values[2]);
+ angleDom[idom] = OrientedAngle(p0, p1, gref, g); // -pi<angle<+pi
+ //MESSAGE(" angle=" << angleDom[idom]);
+ }
+ break;
}
+ }
}
+ map<double, int> sortedDom; // sort domains by angle
+ for (map<int, double>::iterator ia = angleDom.begin(); ia != angleDom.end(); ++ia)
+ sortedDom[ia->second] = ia->first;
+ vector<int> vnodes;
+ vector<int> vdom;
+ for (map<double, int>::iterator ib = sortedDom.begin(); ib != sortedDom.end(); ++ib)
+ {
+ vdom.push_back(ib->second);
+ //MESSAGE(" ordered domain " << ib->second << " angle " << ib->first);
+ }
+ for (int ino = 0; ino < nbNodes; ino++)
+ vnodes.push_back(nodes[ino]);
+ edgesMultiDomains[vnodes] = vdom; // nodes vector --> ordered domains
+ }
}
+ }
}
+ }
}
+ }
// --- iterate on shared faces (volumes to modify, face to extrude)
// get node id's of the face (id SMDS = id VTK)
MESSAGE(".. Creation of elements: simple junction");
if (createJointElems)
- {
- int idg;
- string joints2DName = "joints2D";
- mapOfJunctionGroups[joints2DName] = this->myMesh->AddGroup(SMDSAbs_Face, joints2DName.c_str(), idg);
- SMESHDS_Group *joints2DGrp = dynamic_cast<SMESHDS_Group*>(mapOfJunctionGroups[joints2DName]->GetGroupDS());
- string joints3DName = "joints3D";
- mapOfJunctionGroups[joints3DName] = this->myMesh->AddGroup(SMDSAbs_Volume, joints3DName.c_str(), idg);
- SMESHDS_Group *joints3DGrp = dynamic_cast<SMESHDS_Group*>(mapOfJunctionGroups[joints3DName]->GetGroupDS());
-
- itface = faceDomains.begin();
- for (; itface != faceDomains.end(); ++itface)
- {
- DownIdType face = itface->first;
- std::set<int> oldNodes;
- std::set<int>::iterator itn;
- oldNodes.clear();
- grid->GetNodeIds(oldNodes, face.cellId, face.cellType);
-
- std::map<int, int> domvol = itface->second;
- std::map<int, int>::iterator itdom = domvol.begin();
- int dom1 = itdom->first;
- int vtkVolId = itdom->second;
- itdom++;
- int dom2 = itdom->first;
- SMDS_MeshCell *vol = grid->extrudeVolumeFromFace(vtkVolId, dom1, dom2, oldNodes, nodeDomains,
- nodeQuadDomains);
- stringstream grpname;
- grpname << "j_";
- if (dom1 < dom2)
- grpname << dom1 << "_" << dom2;
- else
- grpname << dom2 << "_" << dom1;
- string namegrp = grpname.str();
- if (!mapOfJunctionGroups.count(namegrp))
- mapOfJunctionGroups[namegrp] = this->myMesh->AddGroup(vol->GetType(), namegrp.c_str(), idg);
- SMESHDS_Group *sgrp = dynamic_cast<SMESHDS_Group*>(mapOfJunctionGroups[namegrp]->GetGroupDS());
- if (sgrp)
- sgrp->Add(vol->GetID());
- if (vol->GetType() == SMDSAbs_Volume)
- joints3DGrp->Add(vol->GetID());
- else if (vol->GetType() == SMDSAbs_Face)
- joints2DGrp->Add(vol->GetID());
- }
+ {
+ int idg;
+ string joints2DName = "joints2D";
+ mapOfJunctionGroups[joints2DName] = this->myMesh->AddGroup(SMDSAbs_Face, joints2DName.c_str(), idg);
+ SMESHDS_Group *joints2DGrp = dynamic_cast<SMESHDS_Group*>(mapOfJunctionGroups[joints2DName]->GetGroupDS());
+ string joints3DName = "joints3D";
+ mapOfJunctionGroups[joints3DName] = this->myMesh->AddGroup(SMDSAbs_Volume, joints3DName.c_str(), idg);
+ SMESHDS_Group *joints3DGrp = dynamic_cast<SMESHDS_Group*>(mapOfJunctionGroups[joints3DName]->GetGroupDS());
+
+ itface = faceDomains.begin();
+ for (; itface != faceDomains.end(); ++itface)
+ {
+ DownIdType face = itface->first;
+ std::set<int> oldNodes;
+ std::set<int>::iterator itn;
+ oldNodes.clear();
+ grid->GetNodeIds(oldNodes, face.cellId, face.cellType);
+
+ std::map<int, int> domvol = itface->second;
+ std::map<int, int>::iterator itdom = domvol.begin();
+ int dom1 = itdom->first;
+ int vtkVolId = itdom->second;
+ itdom++;
+ int dom2 = itdom->first;
+ SMDS_MeshCell *vol = grid->extrudeVolumeFromFace(vtkVolId, dom1, dom2, oldNodes, nodeDomains,
+ nodeQuadDomains);
+ stringstream grpname;
+ grpname << "j_";
+ if (dom1 < dom2)
+ grpname << dom1 << "_" << dom2;
+ else
+ grpname << dom2 << "_" << dom1;
+ string namegrp = grpname.str();
+ if (!mapOfJunctionGroups.count(namegrp))
+ mapOfJunctionGroups[namegrp] = this->myMesh->AddGroup(vol->GetType(), namegrp.c_str(), idg);
+ SMESHDS_Group *sgrp = dynamic_cast<SMESHDS_Group*>(mapOfJunctionGroups[namegrp]->GetGroupDS());
+ if (sgrp)
+ sgrp->Add(vol->GetID());
+ if (vol->GetType() == SMDSAbs_Volume)
+ joints3DGrp->Add(vol->GetID());
+ else if (vol->GetType() == SMDSAbs_Face)
+ joints2DGrp->Add(vol->GetID());
}
+ }
// --- create volumes on multiple domain intersection if requested
// iterate on mutipleNodesToFace
MESSAGE(".. Creation of elements: multiple junction");
if (createJointElems)
+ {
+ // --- iterate on mutipleNodesToFace
+
+ std::map<int, std::vector<int> >::iterator itn = mutipleNodesToFace.begin();
+ for (; itn != mutipleNodesToFace.end(); ++itn)
{
- // --- iterate on mutipleNodesToFace
+ int node = itn->first;
+ vector<int> orderDom = itn->second;
+ vector<vtkIdType> orderedNodes;
+ for ( size_t idom = 0; idom < orderDom.size(); idom++ )
+ orderedNodes.push_back( nodeDomains[ node ][ orderDom[ idom ]]);
+ SMDS_MeshFace* face = this->GetMeshDS()->AddFaceFromVtkIds(orderedNodes);
- std::map<int, std::vector<int> >::iterator itn = mutipleNodesToFace.begin();
- for (; itn != mutipleNodesToFace.end(); ++itn)
- {
- int node = itn->first;
- vector<int> orderDom = itn->second;
- vector<vtkIdType> orderedNodes;
- for (int idom = 0; idom <orderDom.size(); idom++)
- orderedNodes.push_back( nodeDomains[node][orderDom[idom]] );
- SMDS_MeshFace* face = this->GetMeshDS()->AddFaceFromVtkIds(orderedNodes);
-
- stringstream grpname;
- grpname << "m2j_";
- grpname << 0 << "_" << 0;
- int idg;
- string namegrp = grpname.str();
- if (!mapOfJunctionGroups.count(namegrp))
- mapOfJunctionGroups[namegrp] = this->myMesh->AddGroup(SMDSAbs_Face, namegrp.c_str(), idg);
- SMESHDS_Group *sgrp = dynamic_cast<SMESHDS_Group*>(mapOfJunctionGroups[namegrp]->GetGroupDS());
- if (sgrp)
- sgrp->Add(face->GetID());
- }
-
- // --- iterate on edgesMultiDomains
-
- std::map<std::vector<int>, std::vector<int> >::iterator ite = edgesMultiDomains.begin();
- for (; ite != edgesMultiDomains.end(); ++ite)
- {
- vector<int> nodes = ite->first;
- vector<int> orderDom = ite->second;
- vector<vtkIdType> orderedNodes;
- if (nodes.size() == 2)
- {
- //MESSAGE(" use edgesMultiDomains " << nodes[0] << " " << nodes[1]);
- for (int ino=0; ino < nodes.size(); ino++)
- if (orderDom.size() == 3)
- for (int idom = 0; idom <orderDom.size(); idom++)
- orderedNodes.push_back( nodeDomains[nodes[ino]][orderDom[idom]] );
- else
- for (int idom = orderDom.size()-1; idom >=0; idom--)
- orderedNodes.push_back( nodeDomains[nodes[ino]][orderDom[idom]] );
- SMDS_MeshVolume* vol = this->GetMeshDS()->AddVolumeFromVtkIds(orderedNodes);
-
- int idg;
- string namegrp = "jointsMultiples";
- if (!mapOfJunctionGroups.count(namegrp))
- mapOfJunctionGroups[namegrp] = this->myMesh->AddGroup(SMDSAbs_Volume, namegrp.c_str(), idg);
- SMESHDS_Group *sgrp = dynamic_cast<SMESHDS_Group*>(mapOfJunctionGroups[namegrp]->GetGroupDS());
- if (sgrp)
- sgrp->Add(vol->GetID());
- }
+ stringstream grpname;
+ grpname << "m2j_";
+ grpname << 0 << "_" << 0;
+ int idg;
+ string namegrp = grpname.str();
+ if (!mapOfJunctionGroups.count(namegrp))
+ mapOfJunctionGroups[namegrp] = this->myMesh->AddGroup(SMDSAbs_Face, namegrp.c_str(), idg);
+ SMESHDS_Group *sgrp = dynamic_cast<SMESHDS_Group*>(mapOfJunctionGroups[namegrp]->GetGroupDS());
+ if (sgrp)
+ sgrp->Add(face->GetID());
+ }
+
+ // --- iterate on edgesMultiDomains
+
+ std::map<std::vector<int>, std::vector<int> >::iterator ite = edgesMultiDomains.begin();
+ for (; ite != edgesMultiDomains.end(); ++ite)
+ {
+ vector<int> nodes = ite->first;
+ vector<int> orderDom = ite->second;
+ vector<vtkIdType> orderedNodes;
+ if (nodes.size() == 2)
+ {
+ //MESSAGE(" use edgesMultiDomains " << nodes[0] << " " << nodes[1]);
+ for ( size_t ino = 0; ino < nodes.size(); ino++ )
+ if ( orderDom.size() == 3 )
+ for ( size_t idom = 0; idom < orderDom.size(); idom++ )
+ orderedNodes.push_back( nodeDomains[ nodes[ ino ]][ orderDom[ idom ]]);
else
- {
- //INFOS("Quadratic multiple joints not implemented");
- // TODO quadratic nodes
- }
- }
+ for (int idom = orderDom.size()-1; idom >=0; idom--)
+ orderedNodes.push_back( nodeDomains[ nodes[ ino ]][ orderDom[ idom ]]);
+ SMDS_MeshVolume* vol = this->GetMeshDS()->AddVolumeFromVtkIds(orderedNodes);
+
+ int idg;
+ string namegrp = "jointsMultiples";
+ if (!mapOfJunctionGroups.count(namegrp))
+ mapOfJunctionGroups[namegrp] = this->myMesh->AddGroup(SMDSAbs_Volume, namegrp.c_str(), idg);
+ SMESHDS_Group *sgrp = dynamic_cast<SMESHDS_Group*>(mapOfJunctionGroups[namegrp]->GetGroupDS());
+ if (sgrp)
+ sgrp->Add(vol->GetID());
+ }
+ else
+ {
+ //INFOS("Quadratic multiple joints not implemented");
+ // TODO quadratic nodes
+ }
}
+ }
// --- list the explicit faces and edges of the mesh that need to be modified,
// i.e. faces and edges built with one or more duplicated nodes.
MESSAGE(".. Modification of elements");
for (int idomain = idom0; idomain < nbDomains; idomain++)
+ {
+ std::map<int, std::map<int, int> >::const_iterator itnod = nodeDomains.begin();
+ for (; itnod != nodeDomains.end(); ++itnod)
{
- std::map<int, std::map<int, int> >::const_iterator itnod = nodeDomains.begin();
- for (; itnod != nodeDomains.end(); ++itnod)
- {
- int oldId = itnod->first;
- //MESSAGE(" node " << oldId);
- vtkCellLinks::Link l = grid->GetCellLinks()->GetLink(oldId);
- for (int i = 0; i < l.ncells; i++)
+ int oldId = itnod->first;
+ //MESSAGE(" node " << oldId);
+ vtkCellLinks::Link l = grid->GetCellLinks()->GetLink(oldId);
+ for (int i = 0; i < l.ncells; i++)
+ {
+ int vtkId = l.cells[i];
+ int vtkType = grid->GetCellType(vtkId);
+ int downId = grid->CellIdToDownId(vtkId);
+ if (downId < 0)
+ continue; // new cells: not to be modified
+ DownIdType aCell(downId, vtkType);
+ int volParents[1000];
+ int nbvol = grid->GetParentVolumes(volParents, vtkId);
+ for (int j = 0; j < nbvol; j++)
+ if (celldom.count(volParents[j]) && (celldom[volParents[j]] == idomain))
+ if (!feDom.count(vtkId))
{
- int vtkId = l.cells[i];
- int vtkType = grid->GetCellType(vtkId);
- int downId = grid->CellIdToDownId(vtkId);
- if (downId < 0)
- continue; // new cells: not to be modified
- DownIdType aCell(downId, vtkType);
- int volParents[1000];
- int nbvol = grid->GetParentVolumes(volParents, vtkId);
- for (int j = 0; j < nbvol; j++)
- if (celldom.count(volParents[j]) && (celldom[volParents[j]] == idomain))
- if (!feDom.count(vtkId))
- {
- feDom[vtkId] = idomain;
- faceOrEdgeDom[aCell] = emptyMap;
- faceOrEdgeDom[aCell][idomain] = vtkId; // affect face or edge to the first domain only
- //MESSAGE("affect cell " << this->GetMeshDS()->fromVtkToSmds(vtkId) << " domain " << idomain
- // << " type " << vtkType << " downId " << downId);
- }
+ feDom[vtkId] = idomain;
+ faceOrEdgeDom[aCell] = emptyMap;
+ faceOrEdgeDom[aCell][idomain] = vtkId; // affect face or edge to the first domain only
+ //MESSAGE("affect cell " << this->GetMeshDS()->fromVtkToSmds(vtkId) << " domain " << idomain
+ // << " type " << vtkType << " downId " << downId);
}
- }
+ }
}
+ }
// --- iterate on shared faces (volumes to modify, face to extrude)
// get node id's of the face
std::map<DownIdType, std::map<int,int>, DownIdCompare>* maps[3] = {&faceDomains, &cellDomains, &faceOrEdgeDom};
for (int m=0; m<3; m++)
- {
- std::map<DownIdType, std::map<int,int>, DownIdCompare>* amap = maps[m];
- itface = (*amap).begin();
- for (; itface != (*amap).end(); ++itface)
+ {
+ std::map<DownIdType, std::map<int,int>, DownIdCompare>* amap = maps[m];
+ itface = (*amap).begin();
+ for (; itface != (*amap).end(); ++itface)
+ {
+ DownIdType face = itface->first;
+ std::set<int> oldNodes;
+ std::set<int>::iterator itn;
+ oldNodes.clear();
+ grid->GetNodeIds(oldNodes, face.cellId, face.cellType);
+ //MESSAGE("examine cell, downId " << face.cellId << " type " << int(face.cellType));
+ std::map<int, int> localClonedNodeIds;
+
+ std::map<int, int> domvol = itface->second;
+ std::map<int, int>::iterator itdom = domvol.begin();
+ for (; itdom != domvol.end(); ++itdom)
+ {
+ int idom = itdom->first;
+ int vtkVolId = itdom->second;
+ //MESSAGE("modify nodes of cell " << this->GetMeshDS()->fromVtkToSmds(vtkVolId) << " domain " << idom);
+ localClonedNodeIds.clear();
+ for (itn = oldNodes.begin(); itn != oldNodes.end(); ++itn)
{
- DownIdType face = itface->first;
- std::set<int> oldNodes;
- std::set<int>::iterator itn;
- oldNodes.clear();
- grid->GetNodeIds(oldNodes, face.cellId, face.cellType);
- //MESSAGE("examine cell, downId " << face.cellId << " type " << int(face.cellType));
- std::map<int, int> localClonedNodeIds;
-
- std::map<int, int> domvol = itface->second;
- std::map<int, int>::iterator itdom = domvol.begin();
- for (; itdom != domvol.end(); ++itdom)
- {
- int idom = itdom->first;
- int vtkVolId = itdom->second;
- //MESSAGE("modify nodes of cell " << this->GetMeshDS()->fromVtkToSmds(vtkVolId) << " domain " << idom);
- localClonedNodeIds.clear();
- for (itn = oldNodes.begin(); itn != oldNodes.end(); ++itn)
- {
- int oldId = *itn;
- if (nodeDomains[oldId].count(idom))
- {
- localClonedNodeIds[oldId] = nodeDomains[oldId][idom];
- //MESSAGE(" node " << oldId << " --> " << localClonedNodeIds[oldId]);
- }
- }
- meshDS->ModifyCellNodes(vtkVolId, localClonedNodeIds);
- }
+ int oldId = *itn;
+ if (nodeDomains[oldId].count(idom))
+ {
+ localClonedNodeIds[oldId] = nodeDomains[oldId][idom];
+ //MESSAGE(" node " << oldId << " --> " << localClonedNodeIds[oldId]);
+ }
}
+ meshDS->ModifyCellNodes(vtkVolId, localClonedNodeIds);
+ }
}
+ }
// Remove empty groups (issue 0022812)
std::map<std::string, SMESH_Group*>::iterator name_group = mapOfJunctionGroups.begin();
std::map<std::string, SMESH_Group*> mapOfJunctionGroups;
mapOfJunctionGroups.clear();
- for (int idom = 0; idom < theElems.size(); idom++)
+ for ( size_t idom = 0; idom < theElems.size(); idom++ )
+ {
+ const TIDSortedElemSet& domain = theElems[idom];
+ TIDSortedElemSet::const_iterator elemItr = domain.begin();
+ for ( ; elemItr != domain.end(); ++elemItr )
{
- const TIDSortedElemSet& domain = theElems[idom];
- TIDSortedElemSet::const_iterator elemItr = domain.begin();
- for (; elemItr != domain.end(); ++elemItr)
- {
- SMDS_MeshElement* anElem = (SMDS_MeshElement*) *elemItr;
- SMDS_MeshFace* aFace = dynamic_cast<SMDS_MeshFace*> (anElem);
- if (!aFace)
- continue;
- // MESSAGE("aFace=" << aFace->GetID());
- bool isQuad = aFace->IsQuadratic();
- vector<const SMDS_MeshNode*> ln0, ln1, ln2, ln3, ln4;
-
- // --- clone the nodes, create intermediate nodes for non medium nodes of a quad face
-
- SMDS_ElemIteratorPtr nodeIt = aFace->nodesIterator();
- while (nodeIt->more())
- {
- const SMDS_MeshNode* node = static_cast<const SMDS_MeshNode*> (nodeIt->next());
- bool isMedium = isQuad && (aFace->IsMediumNode(node));
- if (isMedium)
- ln2.push_back(node);
- else
- ln0.push_back(node);
+ SMDS_MeshElement* anElem = (SMDS_MeshElement*) *elemItr;
+ SMDS_MeshFace* aFace = dynamic_cast<SMDS_MeshFace*> (anElem);
+ if (!aFace)
+ continue;
+ // MESSAGE("aFace=" << aFace->GetID());
+ bool isQuad = aFace->IsQuadratic();
+ vector<const SMDS_MeshNode*> ln0, ln1, ln2, ln3, ln4;
- const SMDS_MeshNode* clone = 0;
- if (!clonedNodes.count(node))
- {
- clone = meshDS->AddNode(node->X(), node->Y(), node->Z());
- copyPosition( node, clone );
- clonedNodes[node] = clone;
- }
- else
- clone = clonedNodes[node];
+ // --- clone the nodes, create intermediate nodes for non medium nodes of a quad face
- if (isMedium)
- ln3.push_back(clone);
- else
- ln1.push_back(clone);
+ SMDS_ElemIteratorPtr nodeIt = aFace->nodesIterator();
+ while (nodeIt->more())
+ {
+ const SMDS_MeshNode* node = static_cast<const SMDS_MeshNode*> (nodeIt->next());
+ bool isMedium = isQuad && (aFace->IsMediumNode(node));
+ if (isMedium)
+ ln2.push_back(node);
+ else
+ ln0.push_back(node);
- const SMDS_MeshNode* inter = 0;
- if (isQuad && (!isMedium))
- {
- if (!intermediateNodes.count(node))
- {
- inter = meshDS->AddNode(node->X(), node->Y(), node->Z());
- copyPosition( node, inter );
- intermediateNodes[node] = inter;
- }
- else
- inter = intermediateNodes[node];
- ln4.push_back(inter);
- }
- }
+ const SMDS_MeshNode* clone = 0;
+ if (!clonedNodes.count(node))
+ {
+ clone = meshDS->AddNode(node->X(), node->Y(), node->Z());
+ copyPosition( node, clone );
+ clonedNodes[node] = clone;
+ }
+ else
+ clone = clonedNodes[node];
- // --- extrude the face
+ if (isMedium)
+ ln3.push_back(clone);
+ else
+ ln1.push_back(clone);
- vector<const SMDS_MeshNode*> ln;
- SMDS_MeshVolume* vol = 0;
- vtkIdType aType = aFace->GetVtkType();
- switch (aType)
+ const SMDS_MeshNode* inter = 0;
+ if (isQuad && (!isMedium))
+ {
+ if (!intermediateNodes.count(node))
{
- case VTK_TRIANGLE:
- vol = meshDS->AddVolume(ln0[2], ln0[1], ln0[0], ln1[2], ln1[1], ln1[0]);
- // MESSAGE("vol prism " << vol->GetID());
- ln.push_back(ln1[0]);
- ln.push_back(ln1[1]);
- ln.push_back(ln1[2]);
- break;
- case VTK_QUAD:
- vol = meshDS->AddVolume(ln0[3], ln0[2], ln0[1], ln0[0], ln1[3], ln1[2], ln1[1], ln1[0]);
- // MESSAGE("vol hexa " << vol->GetID());
- ln.push_back(ln1[0]);
- ln.push_back(ln1[1]);
- ln.push_back(ln1[2]);
- ln.push_back(ln1[3]);
- break;
- case VTK_QUADRATIC_TRIANGLE:
- vol = meshDS->AddVolume(ln1[0], ln1[1], ln1[2], ln0[0], ln0[1], ln0[2], ln3[0], ln3[1], ln3[2],
- ln2[0], ln2[1], ln2[2], ln4[0], ln4[1], ln4[2]);
- // MESSAGE("vol quad prism " << vol->GetID());
- ln.push_back(ln1[0]);
- ln.push_back(ln1[1]);
- ln.push_back(ln1[2]);
- ln.push_back(ln3[0]);
- ln.push_back(ln3[1]);
- ln.push_back(ln3[2]);
- break;
- case VTK_QUADRATIC_QUAD:
-// vol = meshDS->AddVolume(ln0[0], ln0[1], ln0[2], ln0[3], ln1[0], ln1[1], ln1[2], ln1[3],
-// ln2[0], ln2[1], ln2[2], ln2[3], ln3[0], ln3[1], ln3[2], ln3[3],
-// ln4[0], ln4[1], ln4[2], ln4[3]);
- vol = meshDS->AddVolume(ln1[0], ln1[1], ln1[2], ln1[3], ln0[0], ln0[1], ln0[2], ln0[3],
- ln3[0], ln3[1], ln3[2], ln3[3], ln2[0], ln2[1], ln2[2], ln2[3],
- ln4[0], ln4[1], ln4[2], ln4[3]);
- // MESSAGE("vol quad hexa " << vol->GetID());
- ln.push_back(ln1[0]);
- ln.push_back(ln1[1]);
- ln.push_back(ln1[2]);
- ln.push_back(ln1[3]);
- ln.push_back(ln3[0]);
- ln.push_back(ln3[1]);
- ln.push_back(ln3[2]);
- ln.push_back(ln3[3]);
- break;
- case VTK_POLYGON:
- break;
- default:
- break;
+ inter = meshDS->AddNode(node->X(), node->Y(), node->Z());
+ copyPosition( node, inter );
+ intermediateNodes[node] = inter;
}
+ else
+ inter = intermediateNodes[node];
+ ln4.push_back(inter);
+ }
+ }
- if (vol)
- {
- stringstream grpname;
- grpname << "jf_";
- grpname << idom;
- int idg;
- string namegrp = grpname.str();
- if (!mapOfJunctionGroups.count(namegrp))
- mapOfJunctionGroups[namegrp] = this->myMesh->AddGroup(SMDSAbs_Volume, namegrp.c_str(), idg);
- SMESHDS_Group *sgrp = dynamic_cast<SMESHDS_Group*>(mapOfJunctionGroups[namegrp]->GetGroupDS());
- if (sgrp)
- sgrp->Add(vol->GetID());
- }
+ // --- extrude the face
+
+ vector<const SMDS_MeshNode*> ln;
+ SMDS_MeshVolume* vol = 0;
+ vtkIdType aType = aFace->GetVtkType();
+ switch (aType)
+ {
+ case VTK_TRIANGLE:
+ vol = meshDS->AddVolume(ln0[2], ln0[1], ln0[0], ln1[2], ln1[1], ln1[0]);
+ // MESSAGE("vol prism " << vol->GetID());
+ ln.push_back(ln1[0]);
+ ln.push_back(ln1[1]);
+ ln.push_back(ln1[2]);
+ break;
+ case VTK_QUAD:
+ vol = meshDS->AddVolume(ln0[3], ln0[2], ln0[1], ln0[0], ln1[3], ln1[2], ln1[1], ln1[0]);
+ // MESSAGE("vol hexa " << vol->GetID());
+ ln.push_back(ln1[0]);
+ ln.push_back(ln1[1]);
+ ln.push_back(ln1[2]);
+ ln.push_back(ln1[3]);
+ break;
+ case VTK_QUADRATIC_TRIANGLE:
+ vol = meshDS->AddVolume(ln1[0], ln1[1], ln1[2], ln0[0], ln0[1], ln0[2], ln3[0], ln3[1], ln3[2],
+ ln2[0], ln2[1], ln2[2], ln4[0], ln4[1], ln4[2]);
+ // MESSAGE("vol quad prism " << vol->GetID());
+ ln.push_back(ln1[0]);
+ ln.push_back(ln1[1]);
+ ln.push_back(ln1[2]);
+ ln.push_back(ln3[0]);
+ ln.push_back(ln3[1]);
+ ln.push_back(ln3[2]);
+ break;
+ case VTK_QUADRATIC_QUAD:
+ // vol = meshDS->AddVolume(ln0[0], ln0[1], ln0[2], ln0[3], ln1[0], ln1[1], ln1[2], ln1[3],
+ // ln2[0], ln2[1], ln2[2], ln2[3], ln3[0], ln3[1], ln3[2], ln3[3],
+ // ln4[0], ln4[1], ln4[2], ln4[3]);
+ vol = meshDS->AddVolume(ln1[0], ln1[1], ln1[2], ln1[3], ln0[0], ln0[1], ln0[2], ln0[3],
+ ln3[0], ln3[1], ln3[2], ln3[3], ln2[0], ln2[1], ln2[2], ln2[3],
+ ln4[0], ln4[1], ln4[2], ln4[3]);
+ // MESSAGE("vol quad hexa " << vol->GetID());
+ ln.push_back(ln1[0]);
+ ln.push_back(ln1[1]);
+ ln.push_back(ln1[2]);
+ ln.push_back(ln1[3]);
+ ln.push_back(ln3[0]);
+ ln.push_back(ln3[1]);
+ ln.push_back(ln3[2]);
+ ln.push_back(ln3[3]);
+ break;
+ case VTK_POLYGON:
+ break;
+ default:
+ break;
+ }
- // --- modify the face
+ if (vol)
+ {
+ stringstream grpname;
+ grpname << "jf_";
+ grpname << idom;
+ int idg;
+ string namegrp = grpname.str();
+ if (!mapOfJunctionGroups.count(namegrp))
+ mapOfJunctionGroups[namegrp] = this->myMesh->AddGroup(SMDSAbs_Volume, namegrp.c_str(), idg);
+ SMESHDS_Group *sgrp = dynamic_cast<SMESHDS_Group*>(mapOfJunctionGroups[namegrp]->GetGroupDS());
+ if (sgrp)
+ sgrp->Add(vol->GetID());
+ }
- aFace->ChangeNodes(&ln[0], ln.size());
- }
+ // --- modify the face
+
+ aFace->ChangeNodes(&ln[0], ln.size());
}
+ }
return true;
}
* groups of faces to remove inside the object, (idem edges).
* Build ordered list of nodes at the border of each group of faces to replace (to be used to build a geom subshape)
*/
-void SMESH_MeshEditor::CreateHoleSkin(double radius,
- const TopoDS_Shape& theShape,
- SMESH_NodeSearcher* theNodeSearcher,
- const char* groupName,
- std::vector<double>& nodesCoords,
+void SMESH_MeshEditor::CreateHoleSkin(double radius,
+ const TopoDS_Shape& theShape,
+ SMESH_NodeSearcher* theNodeSearcher,
+ const char* groupName,
+ std::vector<double>& nodesCoords,
std::vector<std::vector<int> >& listOfListOfNodes)
{
MESSAGE("--------------------------------");
SMESHDS_GroupBase* groupDS = 0;
SMESH_Mesh::GroupIteratorPtr groupIt = this->myMesh->GetGroups();
while ( groupIt->more() )
- {
+ {
+ groupDS = 0;
+ SMESH_Group * group = groupIt->next();
+ if ( !group ) continue;
+ groupDS = group->GetGroupDS();
+ if ( !groupDS || groupDS->IsEmpty() ) continue;
+ std::string grpName = group->GetName();
+ //MESSAGE("grpName=" << grpName);
+ if (grpName == groupName)
+ break;
+ else
groupDS = 0;
- SMESH_Group * group = groupIt->next();
- if ( !group ) continue;
- groupDS = group->GetGroupDS();
- if ( !groupDS || groupDS->IsEmpty() ) continue;
- std::string grpName = group->GetName();
- //MESSAGE("grpName=" << grpName);
- if (grpName == groupName)
- break;
- else
- groupDS = 0;
- }
+ }
bool isNodeGroup = false;
bool isNodeCoords = false;
if (groupDS)
- {
- if (groupDS->GetType() != SMDSAbs_Node)
- return;
- isNodeGroup = true; // a group of nodes exists and it is in this mesh
- }
+ {
+ if (groupDS->GetType() != SMDSAbs_Node)
+ return;
+ isNodeGroup = true; // a group of nodes exists and it is in this mesh
+ }
if (nodesCoords.size() > 0)
isNodeCoords = true; // a list o nodes given by their coordinates
grpvName += "_vol";
SMESH_Group *grp = this->myMesh->AddGroup(SMDSAbs_Volume, grpvName.c_str(), idg);
if (!grp)
- {
- MESSAGE("group not created " << grpvName);
- return;
- }
+ {
+ MESSAGE("group not created " << grpvName);
+ return;
+ }
SMESHDS_Group *sgrp = dynamic_cast<SMESHDS_Group*>(grp->GetGroupDS());
int idgs; // --- group of SMDS faces on the skin
grpsName += "_skin";
SMESH_Group *grps = this->myMesh->AddGroup(SMDSAbs_Face, grpsName.c_str(), idgs);
if (!grps)
- {
- MESSAGE("group not created " << grpsName);
- return;
- }
+ {
+ MESSAGE("group not created " << grpsName);
+ return;
+ }
SMESHDS_Group *sgrps = dynamic_cast<SMESHDS_Group*>(grps->GetGroupDS());
int idgi; // --- group of SMDS faces internal (several shapes)
grpiName += "_internalFaces";
SMESH_Group *grpi = this->myMesh->AddGroup(SMDSAbs_Face, grpiName.c_str(), idgi);
if (!grpi)
- {
- MESSAGE("group not created " << grpiName);
- return;
- }
+ {
+ MESSAGE("group not created " << grpiName);
+ return;
+ }
SMESHDS_Group *sgrpi = dynamic_cast<SMESHDS_Group*>(grpi->GetGroupDS());
int idgei; // --- group of SMDS faces internal (several shapes)
grpeiName += "_internalEdges";
SMESH_Group *grpei = this->myMesh->AddGroup(SMDSAbs_Edge, grpeiName.c_str(), idgei);
if (!grpei)
- {
- MESSAGE("group not created " << grpeiName);
- return;
- }
+ {
+ MESSAGE("group not created " << grpeiName);
+ return;
+ }
SMESHDS_Group *sgrpei = dynamic_cast<SMESHDS_Group*>(grpei->GetGroupDS());
// --- build downward connectivity
gpnts.clear();
if (isNodeGroup) // --- a group of nodes is provided : find all the volumes using one or more of this nodes
+ {
+ MESSAGE("group of nodes provided");
+ SMDS_ElemIteratorPtr elemIt = groupDS->GetElements();
+ while ( elemIt->more() )
{
- MESSAGE("group of nodes provided");
- SMDS_ElemIteratorPtr elemIt = groupDS->GetElements();
- while ( elemIt->more() )
- {
- const SMDS_MeshElement* elem = elemIt->next();
- if (!elem)
- continue;
- const SMDS_MeshNode* node = dynamic_cast<const SMDS_MeshNode*>(elem);
- if (!node)
- continue;
- SMDS_MeshElement* vol = 0;
- SMDS_ElemIteratorPtr volItr = node->GetInverseElementIterator(SMDSAbs_Volume);
- while (volItr->more())
- {
- vol = (SMDS_MeshElement*)volItr->next();
- setOfInsideVol.insert(vol->getVtkId());
- sgrp->Add(vol->GetID());
- }
- }
+ const SMDS_MeshElement* elem = elemIt->next();
+ if (!elem)
+ continue;
+ const SMDS_MeshNode* node = dynamic_cast<const SMDS_MeshNode*>(elem);
+ if (!node)
+ continue;
+ SMDS_MeshElement* vol = 0;
+ SMDS_ElemIteratorPtr volItr = node->GetInverseElementIterator(SMDSAbs_Volume);
+ while (volItr->more())
+ {
+ vol = (SMDS_MeshElement*)volItr->next();
+ setOfInsideVol.insert(vol->getVtkId());
+ sgrp->Add(vol->GetID());
+ }
}
+ }
else if (isNodeCoords)
+ {
+ MESSAGE("list of nodes coordinates provided");
+ size_t i = 0;
+ int k = 0;
+ while ( i < nodesCoords.size()-2 )
{
- MESSAGE("list of nodes coordinates provided");
- int i = 0;
- int k = 0;
- while (i < nodesCoords.size()-2)
- {
- double x = nodesCoords[i++];
- double y = nodesCoords[i++];
- double z = nodesCoords[i++];
- gp_Pnt p = gp_Pnt(x, y ,z);
- gpnts.push_back(p);
- MESSAGE("TopoDS_Vertex " << k << " " << p.X() << " " << p.Y() << " " << p.Z());
- k++;
- }
+ double x = nodesCoords[i++];
+ double y = nodesCoords[i++];
+ double z = nodesCoords[i++];
+ gp_Pnt p = gp_Pnt(x, y ,z);
+ gpnts.push_back(p);
+ MESSAGE("TopoDS_Vertex " << k << " " << p.X() << " " << p.Y() << " " << p.Z());
+ k++;
}
+ }
else // --- no group, no coordinates : use the vertices of the geom shape provided, and radius
- {
- MESSAGE("no group of nodes provided, using vertices from geom shape, and radius");
- TopTools_IndexedMapOfShape vertexMap;
- TopExp::MapShapes( theShape, TopAbs_VERTEX, vertexMap );
- gp_Pnt p = gp_Pnt(0,0,0);
- if (vertexMap.Extent() < 1)
- return;
+ {
+ MESSAGE("no group of nodes provided, using vertices from geom shape, and radius");
+ TopTools_IndexedMapOfShape vertexMap;
+ TopExp::MapShapes( theShape, TopAbs_VERTEX, vertexMap );
+ gp_Pnt p = gp_Pnt(0,0,0);
+ if (vertexMap.Extent() < 1)
+ return;
- for ( int i = 1; i <= vertexMap.Extent(); ++i )
- {
- const TopoDS_Vertex& vertex = TopoDS::Vertex( vertexMap( i ));
- p = BRep_Tool::Pnt(vertex);
- gpnts.push_back(p);
- MESSAGE("TopoDS_Vertex " << i << " " << p.X() << " " << p.Y() << " " << p.Z());
- }
+ for ( int i = 1; i <= vertexMap.Extent(); ++i )
+ {
+ const TopoDS_Vertex& vertex = TopoDS::Vertex( vertexMap( i ));
+ p = BRep_Tool::Pnt(vertex);
+ gpnts.push_back(p);
+ MESSAGE("TopoDS_Vertex " << i << " " << p.X() << " " << p.Y() << " " << p.Z());
}
+ }
if (gpnts.size() > 0)
- {
- int nodeId = 0;
- const SMDS_MeshNode* startNode = theNodeSearcher->FindClosestTo(gpnts[0]);
- if (startNode)
- nodeId = startNode->GetID();
- MESSAGE("nodeId " << nodeId);
+ {
+ int nodeId = 0;
+ const SMDS_MeshNode* startNode = theNodeSearcher->FindClosestTo(gpnts[0]);
+ if (startNode)
+ nodeId = startNode->GetID();
+ MESSAGE("nodeId " << nodeId);
- double radius2 = radius*radius;
- MESSAGE("radius2 " << radius2);
+ double radius2 = radius*radius;
+ MESSAGE("radius2 " << radius2);
- // --- volumes on start node
+ // --- volumes on start node
- setOfVolToCheck.clear();
- SMDS_MeshElement* startVol = 0;
- SMDS_ElemIteratorPtr volItr = startNode->GetInverseElementIterator(SMDSAbs_Volume);
- while (volItr->more())
- {
- startVol = (SMDS_MeshElement*)volItr->next();
- setOfVolToCheck.insert(startVol->getVtkId());
- }
- if (setOfVolToCheck.empty())
- {
- MESSAGE("No volumes found");
- return;
- }
+ setOfVolToCheck.clear();
+ SMDS_MeshElement* startVol = 0;
+ SMDS_ElemIteratorPtr volItr = startNode->GetInverseElementIterator(SMDSAbs_Volume);
+ while (volItr->more())
+ {
+ startVol = (SMDS_MeshElement*)volItr->next();
+ setOfVolToCheck.insert(startVol->getVtkId());
+ }
+ if (setOfVolToCheck.empty())
+ {
+ MESSAGE("No volumes found");
+ return;
+ }
- // --- starting with central volumes then their neighbors, check if they are inside
- // or outside the domain, until no more new neighbor volume is inside.
- // Fill the group of inside volumes
+ // --- starting with central volumes then their neighbors, check if they are inside
+ // or outside the domain, until no more new neighbor volume is inside.
+ // Fill the group of inside volumes
- std::map<int, double> mapOfNodeDistance2;
- mapOfNodeDistance2.clear();
- std::set<int> setOfOutsideVol;
- while (!setOfVolToCheck.empty())
+ std::map<int, double> mapOfNodeDistance2;
+ mapOfNodeDistance2.clear();
+ std::set<int> setOfOutsideVol;
+ while (!setOfVolToCheck.empty())
+ {
+ std::set<int>::iterator it = setOfVolToCheck.begin();
+ int vtkId = *it;
+ MESSAGE("volume to check, vtkId " << vtkId << " smdsId " << meshDS->fromVtkToSmds(vtkId));
+ bool volInside = false;
+ vtkIdType npts = 0;
+ vtkIdType* pts = 0;
+ grid->GetCellPoints(vtkId, npts, pts);
+ for (int i=0; i<npts; i++)
+ {
+ double distance2 = 0;
+ if (mapOfNodeDistance2.count(pts[i]))
{
- std::set<int>::iterator it = setOfVolToCheck.begin();
- int vtkId = *it;
- MESSAGE("volume to check, vtkId " << vtkId << " smdsId " << meshDS->fromVtkToSmds(vtkId));
- bool volInside = false;
- vtkIdType npts = 0;
- vtkIdType* pts = 0;
- grid->GetCellPoints(vtkId, npts, pts);
- for (int i=0; i<npts; i++)
+ distance2 = mapOfNodeDistance2[pts[i]];
+ MESSAGE("point " << pts[i] << " distance2 " << distance2);
+ }
+ else
+ {
+ double *coords = grid->GetPoint(pts[i]);
+ gp_Pnt aPoint = gp_Pnt(coords[0], coords[1], coords[2]);
+ distance2 = 1.E40;
+ for ( size_t j = 0; j < gpnts.size(); j++ )
+ {
+ double d2 = aPoint.SquareDistance( gpnts[ j ]);
+ if (d2 < distance2)
{
- double distance2 = 0;
- if (mapOfNodeDistance2.count(pts[i]))
- {
- distance2 = mapOfNodeDistance2[pts[i]];
- MESSAGE("point " << pts[i] << " distance2 " << distance2);
- }
- else
- {
- double *coords = grid->GetPoint(pts[i]);
- gp_Pnt aPoint = gp_Pnt(coords[0], coords[1], coords[2]);
- distance2 = 1.E40;
- for (int j=0; j<gpnts.size(); j++)
- {
- double d2 = aPoint.SquareDistance(gpnts[j]);
- if (d2 < distance2)
- {
- distance2 = d2;
- if (distance2 < radius2)
- break;
- }
- }
- mapOfNodeDistance2[pts[i]] = distance2;
- MESSAGE(" point " << pts[i] << " distance2 " << distance2 << " coords " << coords[0] << " " << coords[1] << " " << coords[2]);
- }
+ distance2 = d2;
if (distance2 < radius2)
- {
- volInside = true; // one or more nodes inside the domain
- sgrp->Add(meshDS->fromVtkToSmds(vtkId));
- break;
- }
- }
- if (volInside)
- {
- setOfInsideVol.insert(vtkId);
- MESSAGE(" volume inside, vtkId " << vtkId << " smdsId " << meshDS->fromVtkToSmds(vtkId));
- int neighborsVtkIds[NBMAXNEIGHBORS];
- int downIds[NBMAXNEIGHBORS];
- unsigned char downTypes[NBMAXNEIGHBORS];
- int nbNeighbors = grid->GetNeighbors(neighborsVtkIds, downIds, downTypes, vtkId);
- for (int n = 0; n < nbNeighbors; n++)
- if (!setOfInsideVol.count(neighborsVtkIds[n]) ||setOfOutsideVol.count(neighborsVtkIds[n]))
- setOfVolToCheck.insert(neighborsVtkIds[n]);
- }
- else
- {
- setOfOutsideVol.insert(vtkId);
- MESSAGE(" volume outside, vtkId " << vtkId << " smdsId " << meshDS->fromVtkToSmds(vtkId));
+ break;
}
- setOfVolToCheck.erase(vtkId);
+ }
+ mapOfNodeDistance2[pts[i]] = distance2;
+ MESSAGE(" point " << pts[i] << " distance2 " << distance2 << " coords " << coords[0] << " " << coords[1] << " " << coords[2]);
}
+ if (distance2 < radius2)
+ {
+ volInside = true; // one or more nodes inside the domain
+ sgrp->Add(meshDS->fromVtkToSmds(vtkId));
+ break;
+ }
+ }
+ if (volInside)
+ {
+ setOfInsideVol.insert(vtkId);
+ MESSAGE(" volume inside, vtkId " << vtkId << " smdsId " << meshDS->fromVtkToSmds(vtkId));
+ int neighborsVtkIds[NBMAXNEIGHBORS];
+ int downIds[NBMAXNEIGHBORS];
+ unsigned char downTypes[NBMAXNEIGHBORS];
+ int nbNeighbors = grid->GetNeighbors(neighborsVtkIds, downIds, downTypes, vtkId);
+ for (int n = 0; n < nbNeighbors; n++)
+ if (!setOfInsideVol.count(neighborsVtkIds[n]) ||setOfOutsideVol.count(neighborsVtkIds[n]))
+ setOfVolToCheck.insert(neighborsVtkIds[n]);
+ }
+ else
+ {
+ setOfOutsideVol.insert(vtkId);
+ MESSAGE(" volume outside, vtkId " << vtkId << " smdsId " << meshDS->fromVtkToSmds(vtkId));
+ }
+ setOfVolToCheck.erase(vtkId);
}
+ }
// --- for outside hexahedrons, check if they have more than one neighbor volume inside
// If yes, add the volume to the inside set
bool addedInside = true;
std::set<int> setOfVolToReCheck;
while (addedInside)
+ {
+ MESSAGE(" --------------------------- re check");
+ addedInside = false;
+ std::set<int>::iterator itv = setOfInsideVol.begin();
+ for (; itv != setOfInsideVol.end(); ++itv)
{
- MESSAGE(" --------------------------- re check");
- addedInside = false;
- std::set<int>::iterator itv = setOfInsideVol.begin();
- for (; itv != setOfInsideVol.end(); ++itv)
- {
- int vtkId = *itv;
- int neighborsVtkIds[NBMAXNEIGHBORS];
- int downIds[NBMAXNEIGHBORS];
- unsigned char downTypes[NBMAXNEIGHBORS];
- int nbNeighbors = grid->GetNeighbors(neighborsVtkIds, downIds, downTypes, vtkId);
- for (int n = 0; n < nbNeighbors; n++)
- if (!setOfInsideVol.count(neighborsVtkIds[n]))
- setOfVolToReCheck.insert(neighborsVtkIds[n]);
- }
- setOfVolToCheck = setOfVolToReCheck;
- setOfVolToReCheck.clear();
- while (!setOfVolToCheck.empty())
+ int vtkId = *itv;
+ int neighborsVtkIds[NBMAXNEIGHBORS];
+ int downIds[NBMAXNEIGHBORS];
+ unsigned char downTypes[NBMAXNEIGHBORS];
+ int nbNeighbors = grid->GetNeighbors(neighborsVtkIds, downIds, downTypes, vtkId);
+ for (int n = 0; n < nbNeighbors; n++)
+ if (!setOfInsideVol.count(neighborsVtkIds[n]))
+ setOfVolToReCheck.insert(neighborsVtkIds[n]);
+ }
+ setOfVolToCheck = setOfVolToReCheck;
+ setOfVolToReCheck.clear();
+ while (!setOfVolToCheck.empty())
+ {
+ std::set<int>::iterator it = setOfVolToCheck.begin();
+ int vtkId = *it;
+ if (grid->GetCellType(vtkId) == VTK_HEXAHEDRON)
+ {
+ MESSAGE("volume to recheck, vtkId " << vtkId << " smdsId " << meshDS->fromVtkToSmds(vtkId));
+ int countInside = 0;
+ int neighborsVtkIds[NBMAXNEIGHBORS];
+ int downIds[NBMAXNEIGHBORS];
+ unsigned char downTypes[NBMAXNEIGHBORS];
+ int nbNeighbors = grid->GetNeighbors(neighborsVtkIds, downIds, downTypes, vtkId);
+ for (int n = 0; n < nbNeighbors; n++)
+ if (setOfInsideVol.count(neighborsVtkIds[n]))
+ countInside++;
+ MESSAGE("countInside " << countInside);
+ if (countInside > 1)
{
- std::set<int>::iterator it = setOfVolToCheck.begin();
- int vtkId = *it;
- if (grid->GetCellType(vtkId) == VTK_HEXAHEDRON)
- {
- MESSAGE("volume to recheck, vtkId " << vtkId << " smdsId " << meshDS->fromVtkToSmds(vtkId));
- int countInside = 0;
- int neighborsVtkIds[NBMAXNEIGHBORS];
- int downIds[NBMAXNEIGHBORS];
- unsigned char downTypes[NBMAXNEIGHBORS];
- int nbNeighbors = grid->GetNeighbors(neighborsVtkIds, downIds, downTypes, vtkId);
- for (int n = 0; n < nbNeighbors; n++)
- if (setOfInsideVol.count(neighborsVtkIds[n]))
- countInside++;
- MESSAGE("countInside " << countInside);
- if (countInside > 1)
- {
- MESSAGE(" volume inside, vtkId " << vtkId << " smdsId " << meshDS->fromVtkToSmds(vtkId));
- setOfInsideVol.insert(vtkId);
- sgrp->Add(meshDS->fromVtkToSmds(vtkId));
- addedInside = true;
- }
- else
- setOfVolToReCheck.insert(vtkId);
- }
- setOfVolToCheck.erase(vtkId);
+ MESSAGE(" volume inside, vtkId " << vtkId << " smdsId " << meshDS->fromVtkToSmds(vtkId));
+ setOfInsideVol.insert(vtkId);
+ sgrp->Add(meshDS->fromVtkToSmds(vtkId));
+ addedInside = true;
}
+ else
+ setOfVolToReCheck.insert(vtkId);
+ }
+ setOfVolToCheck.erase(vtkId);
}
+ }
// --- map of Downward faces at the boundary, inside the global volume
// map of Downward faces on the skin of the global volume (equivalent to SMDS faces on the skin)
std::map<DownIdType, int, DownIdCompare> skinFaces; // faces on the skin of the global volume --> corresponding cell
std::set<int>::iterator it = setOfInsideVol.begin();
for (; it != setOfInsideVol.end(); ++it)
- {
- int vtkId = *it;
- //MESSAGE(" vtkId " << vtkId << " smdsId " << meshDS->fromVtkToSmds(vtkId));
- int neighborsVtkIds[NBMAXNEIGHBORS];
- int downIds[NBMAXNEIGHBORS];
- unsigned char downTypes[NBMAXNEIGHBORS];
- int nbNeighbors = grid->GetNeighbors(neighborsVtkIds, downIds, downTypes, vtkId, true);
- for (int n = 0; n < nbNeighbors; n++)
+ {
+ int vtkId = *it;
+ //MESSAGE(" vtkId " << vtkId << " smdsId " << meshDS->fromVtkToSmds(vtkId));
+ int neighborsVtkIds[NBMAXNEIGHBORS];
+ int downIds[NBMAXNEIGHBORS];
+ unsigned char downTypes[NBMAXNEIGHBORS];
+ int nbNeighbors = grid->GetNeighbors(neighborsVtkIds, downIds, downTypes, vtkId, true);
+ for (int n = 0; n < nbNeighbors; n++)
+ {
+ int neighborDim = SMDS_Downward::getCellDimension(grid->GetCellType(neighborsVtkIds[n]));
+ if (neighborDim == 3)
+ {
+ if (! setOfInsideVol.count(neighborsVtkIds[n])) // neighbor volume is not inside : face is boundary
{
- int neighborDim = SMDS_Downward::getCellDimension(grid->GetCellType(neighborsVtkIds[n]));
- if (neighborDim == 3)
- {
- if (! setOfInsideVol.count(neighborsVtkIds[n])) // neighbor volume is not inside : face is boundary
- {
- DownIdType face(downIds[n], downTypes[n]);
- boundaryFaces[face] = vtkId;
- }
- // if the face between to volumes is in the mesh, get it (internal face between shapes)
- int vtkFaceId = grid->getDownArray(downTypes[n])->getVtkCellId(downIds[n]);
- if (vtkFaceId >= 0)
- {
- sgrpi->Add(meshDS->fromVtkToSmds(vtkFaceId));
- // find also the smds edges on this face
- int nbEdges = grid->getDownArray(downTypes[n])->getNumberOfDownCells(downIds[n]);
- const int* dEdges = grid->getDownArray(downTypes[n])->getDownCells(downIds[n]);
- const unsigned char* dTypes = grid->getDownArray(downTypes[n])->getDownTypes(downIds[n]);
- for (int i = 0; i < nbEdges; i++)
- {
- int vtkEdgeId = grid->getDownArray(dTypes[i])->getVtkCellId(dEdges[i]);
- if (vtkEdgeId >= 0)
- sgrpei->Add(meshDS->fromVtkToSmds(vtkEdgeId));
- }
- }
- }
- else if (neighborDim == 2) // skin of the volume
- {
- DownIdType face(downIds[n], downTypes[n]);
- skinFaces[face] = vtkId;
- int vtkFaceId = grid->getDownArray(downTypes[n])->getVtkCellId(downIds[n]);
- if (vtkFaceId >= 0)
- sgrps->Add(meshDS->fromVtkToSmds(vtkFaceId));
- }
+ DownIdType face(downIds[n], downTypes[n]);
+ boundaryFaces[face] = vtkId;
}
+ // if the face between to volumes is in the mesh, get it (internal face between shapes)
+ int vtkFaceId = grid->getDownArray(downTypes[n])->getVtkCellId(downIds[n]);
+ if (vtkFaceId >= 0)
+ {
+ sgrpi->Add(meshDS->fromVtkToSmds(vtkFaceId));
+ // find also the smds edges on this face
+ int nbEdges = grid->getDownArray(downTypes[n])->getNumberOfDownCells(downIds[n]);
+ const int* dEdges = grid->getDownArray(downTypes[n])->getDownCells(downIds[n]);
+ const unsigned char* dTypes = grid->getDownArray(downTypes[n])->getDownTypes(downIds[n]);
+ for (int i = 0; i < nbEdges; i++)
+ {
+ int vtkEdgeId = grid->getDownArray(dTypes[i])->getVtkCellId(dEdges[i]);
+ if (vtkEdgeId >= 0)
+ sgrpei->Add(meshDS->fromVtkToSmds(vtkEdgeId));
+ }
+ }
+ }
+ else if (neighborDim == 2) // skin of the volume
+ {
+ DownIdType face(downIds[n], downTypes[n]);
+ skinFaces[face] = vtkId;
+ int vtkFaceId = grid->getDownArray(downTypes[n])->getVtkCellId(downIds[n]);
+ if (vtkFaceId >= 0)
+ sgrps->Add(meshDS->fromVtkToSmds(vtkFaceId));
+ }
}
+ }
// --- identify the edges constituting the wire of each subshape on the skin
// define polylines with the nodes of edges, equivalent to wires
SMDS_ElemIteratorPtr itelem = sgrps->GetElements();
while (itelem->more())
+ {
+ const SMDS_MeshElement *elem = itelem->next();
+ int shapeId = elem->getshapeId();
+ int vtkId = elem->getVtkId();
+ if (!shapeIdToVtkIdSet.count(shapeId))
{
- const SMDS_MeshElement *elem = itelem->next();
- int shapeId = elem->getshapeId();
- int vtkId = elem->getVtkId();
- if (!shapeIdToVtkIdSet.count(shapeId))
- {
- shapeIdToVtkIdSet[shapeId] = emptySet;
- shapeIds.insert(shapeId);
- }
- shapeIdToVtkIdSet[shapeId].insert(vtkId);
+ shapeIdToVtkIdSet[shapeId] = emptySet;
+ shapeIds.insert(shapeId);
}
+ shapeIdToVtkIdSet[shapeId].insert(vtkId);
+ }
std::map<int, std::set<DownIdType, DownIdCompare> > shapeIdToEdges; // shapeId --> set of downward edges
std::set<DownIdType, DownIdCompare> emptyEdges;
std::map<int, std::set<int> >::iterator itShape = shapeIdToVtkIdSet.begin();
for (; itShape != shapeIdToVtkIdSet.end(); ++itShape)
- {
- int shapeId = itShape->first;
- MESSAGE(" --- Shape ID --- "<< shapeId);
- shapeIdToEdges[shapeId] = emptyEdges;
+ {
+ int shapeId = itShape->first;
+ MESSAGE(" --- Shape ID --- "<< shapeId);
+ shapeIdToEdges[shapeId] = emptyEdges;
- std::vector<int> nodesEdges;
+ std::vector<int> nodesEdges;
- std::set<int>::iterator its = itShape->second.begin();
- for (; its != itShape->second.end(); ++its)
+ std::set<int>::iterator its = itShape->second.begin();
+ for (; its != itShape->second.end(); ++its)
+ {
+ int vtkId = *its;
+ MESSAGE(" " << vtkId);
+ int neighborsVtkIds[NBMAXNEIGHBORS];
+ int downIds[NBMAXNEIGHBORS];
+ unsigned char downTypes[NBMAXNEIGHBORS];
+ int nbNeighbors = grid->GetNeighbors(neighborsVtkIds, downIds, downTypes, vtkId);
+ for (int n = 0; n < nbNeighbors; n++)
+ {
+ if (neighborsVtkIds[n]<0) // only smds faces are considered as neighbors here
+ continue;
+ int smdsId = meshDS->fromVtkToSmds(neighborsVtkIds[n]);
+ const SMDS_MeshElement* elem = meshDS->FindElement(smdsId);
+ if ( shapeIds.count(elem->getshapeId()) && !sgrps->Contains(elem)) // edge : neighbor in the set of shape, not in the group
{
- int vtkId = *its;
- MESSAGE(" " << vtkId);
- int neighborsVtkIds[NBMAXNEIGHBORS];
- int downIds[NBMAXNEIGHBORS];
- unsigned char downTypes[NBMAXNEIGHBORS];
- int nbNeighbors = grid->GetNeighbors(neighborsVtkIds, downIds, downTypes, vtkId);
- for (int n = 0; n < nbNeighbors; n++)
- {
- if (neighborsVtkIds[n]<0) // only smds faces are considered as neighbors here
- continue;
- int smdsId = meshDS->fromVtkToSmds(neighborsVtkIds[n]);
- const SMDS_MeshElement* elem = meshDS->FindElement(smdsId);
- if ( shapeIds.count(elem->getshapeId()) && !sgrps->Contains(elem)) // edge : neighbor in the set of shape, not in the group
- {
- DownIdType edge(downIds[n], downTypes[n]);
- if (!shapeIdToEdges[shapeId].count(edge))
- {
- shapeIdToEdges[shapeId].insert(edge);
- int vtkNodeId[3];
- int nbNodes = grid->getDownArray(downTypes[n])->getNodes(downIds[n],vtkNodeId);
- nodesEdges.push_back(vtkNodeId[0]);
- nodesEdges.push_back(vtkNodeId[nbNodes-1]);
- MESSAGE(" --- nodes " << vtkNodeId[0]+1 << " " << vtkNodeId[nbNodes-1]+1);
- }
- }
- }
+ DownIdType edge(downIds[n], downTypes[n]);
+ if (!shapeIdToEdges[shapeId].count(edge))
+ {
+ shapeIdToEdges[shapeId].insert(edge);
+ int vtkNodeId[3];
+ int nbNodes = grid->getDownArray(downTypes[n])->getNodes(downIds[n],vtkNodeId);
+ nodesEdges.push_back(vtkNodeId[0]);
+ nodesEdges.push_back(vtkNodeId[nbNodes-1]);
+ MESSAGE(" --- nodes " << vtkNodeId[0]+1 << " " << vtkNodeId[nbNodes-1]+1);
+ }
}
+ }
+ }
- std::list<int> order;
- order.clear();
- if (nodesEdges.size() > 0)
+ std::list<int> order;
+ order.clear();
+ if (nodesEdges.size() > 0)
+ {
+ order.push_back(nodesEdges[0]); MESSAGE(" --- back " << order.back()+1); // SMDS id = VTK id + 1;
+ nodesEdges[0] = -1;
+ order.push_back(nodesEdges[1]); MESSAGE(" --- back " << order.back()+1);
+ nodesEdges[1] = -1; // do not reuse this edge
+ bool found = true;
+ while (found)
+ {
+ int nodeTofind = order.back(); // try first to push back
+ int i = 0;
+ for ( i = 0; i < (int)nodesEdges.size(); i++ )
+ if (nodesEdges[i] == nodeTofind)
+ break;
+ if ( i == (int) nodesEdges.size() )
+ found = false; // no follower found on back
+ else
{
- order.push_back(nodesEdges[0]); MESSAGE(" --- back " << order.back()+1); // SMDS id = VTK id + 1;
- nodesEdges[0] = -1;
- order.push_back(nodesEdges[1]); MESSAGE(" --- back " << order.back()+1);
- nodesEdges[1] = -1; // do not reuse this edge
- bool found = true;
- while (found)
+ if (i%2) // odd ==> use the previous one
+ if (nodesEdges[i-1] < 0)
+ found = false;
+ else
{
- int nodeTofind = order.back(); // try first to push back
- int i = 0;
- for (i = 0; i<nodesEdges.size(); i++)
- if (nodesEdges[i] == nodeTofind)
- break;
- if (i == nodesEdges.size())
- found = false; // no follower found on back
- else
- {
- if (i%2) // odd ==> use the previous one
- if (nodesEdges[i-1] < 0)
- found = false;
- else
- {
- order.push_back(nodesEdges[i-1]); MESSAGE(" --- back " << order.back()+1);
- nodesEdges[i-1] = -1;
- }
- else // even ==> use the next one
- if (nodesEdges[i+1] < 0)
- found = false;
- else
- {
- order.push_back(nodesEdges[i+1]); MESSAGE(" --- back " << order.back()+1);
- nodesEdges[i+1] = -1;
- }
- }
- if (found)
- continue;
- // try to push front
- found = true;
- nodeTofind = order.front(); // try to push front
- for (i = 0; i<nodesEdges.size(); i++)
- if (nodesEdges[i] == nodeTofind)
- break;
- if (i == nodesEdges.size())
- {
- found = false; // no predecessor found on front
- continue;
- }
- if (i%2) // odd ==> use the previous one
- if (nodesEdges[i-1] < 0)
- found = false;
- else
- {
- order.push_front(nodesEdges[i-1]); MESSAGE(" --- front " << order.front()+1);
- nodesEdges[i-1] = -1;
- }
- else // even ==> use the next one
- if (nodesEdges[i+1] < 0)
- found = false;
- else
- {
- order.push_front(nodesEdges[i+1]); MESSAGE(" --- front " << order.front()+1);
- nodesEdges[i+1] = -1;
- }
+ order.push_back(nodesEdges[i-1]); MESSAGE(" --- back " << order.back()+1);
+ nodesEdges[i-1] = -1;
+ }
+ else // even ==> use the next one
+ if (nodesEdges[i+1] < 0)
+ found = false;
+ else
+ {
+ order.push_back(nodesEdges[i+1]); MESSAGE(" --- back " << order.back()+1);
+ nodesEdges[i+1] = -1;
}
}
-
-
- std::vector<int> nodes;
- nodes.push_back(shapeId);
- std::list<int>::iterator itl = order.begin();
- for (; itl != order.end(); itl++)
+ if (found)
+ continue;
+ // try to push front
+ found = true;
+ nodeTofind = order.front(); // try to push front
+ for ( i = 0; i < (int)nodesEdges.size(); i++ )
+ if ( nodesEdges[i] == nodeTofind )
+ break;
+ if ( i == (int)nodesEdges.size() )
{
- nodes.push_back((*itl) + 1); // SMDS id = VTK id + 1;
- MESSAGE(" ordered node " << nodes[nodes.size()-1]);
+ found = false; // no predecessor found on front
+ continue;
}
- listOfListOfNodes.push_back(nodes);
+ if (i%2) // odd ==> use the previous one
+ if (nodesEdges[i-1] < 0)
+ found = false;
+ else
+ {
+ order.push_front(nodesEdges[i-1]); MESSAGE(" --- front " << order.front()+1);
+ nodesEdges[i-1] = -1;
+ }
+ else // even ==> use the next one
+ if (nodesEdges[i+1] < 0)
+ found = false;
+ else
+ {
+ order.push_front(nodesEdges[i+1]); MESSAGE(" --- front " << order.front()+1);
+ nodesEdges[i+1] = -1;
+ }
+ }
}
+
+ std::vector<int> nodes;
+ nodes.push_back(shapeId);
+ std::list<int>::iterator itl = order.begin();
+ for (; itl != order.end(); itl++)
+ {
+ nodes.push_back((*itl) + 1); // SMDS id = VTK id + 1;
+ MESSAGE(" ordered node " << nodes[nodes.size()-1]);
+ }
+ listOfListOfNodes.push_back(nodes);
+ }
+
// partition geom faces with blocFissure
// mesh blocFissure and geom faces of the skin (external wires given, triangle algo to choose)
// mesh volume around blocFissure (skin triangles and quadrangle given, tetra algo to choose)
if ( missType == SMDSAbs_Edge ) // boundary edges
{
nodes.resize( 2+iQuad );
- for ( int i = 0; i < nbFaceNodes; i += 1+iQuad)
+ for ( size_t i = 0; i < nbFaceNodes; i += 1+iQuad )
{
- for ( int j = 0; j < nodes.size(); ++j )
- nodes[j] = nn[ i+j ];
+ for ( size_t j = 0; j < nodes.size(); ++j )
+ nodes[ j ] = nn[ i+j ];
if ( const SMDS_MeshElement* edge =
aMesh->FindElement( nodes, SMDSAbs_Edge, /*noMedium=*/false ))
presentBndElems.push_back( edge );
++nbAddedBnd;
}
else
- for ( int i = 0; i < missingBndElems.size(); ++i )
+ for ( size_t i = 0; i < missingBndElems.size(); ++i )
{
- TConnectivity& nodes = missingBndElems[i];
+ TConnectivity& nodes = missingBndElems[ i ];
if ( aroundElements && tgtEditor.GetMeshDS()->FindElement( nodes,
missType,
/*noMedium=*/false))
continue;
- SMDS_MeshElement* newElem =
+ SMDS_MeshElement* newElem =
tgtEditor.AddElement( nodes, elemKind.SetPoly( nodes.size()/(iQuad+1) > 4 ));
nbAddedBnd += bool( newElem );
// 3. Copy present boundary elements
// ----------------------------------
if ( toCopyExistingBoundary )
- for ( int i = 0 ; i < presentBndElems.size(); ++i )
+ for ( size_t i = 0 ; i < presentBndElems.size(); ++i )
{
const SMDS_MeshElement* e = presentBndElems[i];
tgtNodes.resize( e->NbNodes() );
- for ( inode = 0; inode < nodes.size(); ++inode )
+ for ( inode = 0; inode < tgtNodes.size(); ++inode )
tgtNodes[inode] = getNodeWithSameID( tgtMeshDS, e->GetNode(inode) );
presentEditor->AddElement( tgtNodes, elemToCopy.Init( e ));
}
else // store present elements to add them to a group
- for ( int i = 0 ; i < presentBndElems.size(); ++i )
+ for ( size_t i = 0 ; i < presentBndElems.size(); ++i )
{
- presentEditor->myLastCreatedElems.Append( presentBndElems[i] );
+ presentEditor->myLastCreatedElems.Append( presentBndElems[ i ]);
}
} // loop on given elements
SMESH_EXPORT ElemFeatures& Init( double diameter )
{ myType = SMDSAbs_Ball; myBallDiameter = diameter; return *this; }
- SMESH_EXPORT ElemFeatures& Init( vector<int>& quanities, bool isQuad=false )
+ SMESH_EXPORT ElemFeatures& Init( std::vector<int>& quanities, bool isQuad=false )
{ myType = SMDSAbs_Volume; myIsPoly = 1; myIsQuad = isQuad;
myPolyhedQuantities.swap( quanities ); return *this; }
- SMESH_EXPORT ElemFeatures& Init( const vector<int>& quanities, bool isQuad=false )
+ SMESH_EXPORT ElemFeatures& Init( const std::vector<int>& quanities, bool isQuad=false )
{ myType = SMDSAbs_Volume; myIsPoly = 1; myIsQuad = isQuad;
myPolyhedQuantities = quanities; return *this; }
void sweepElement(const SMDS_MeshElement* elem,
const std::vector<TNodeOfNodeListMapItr> & newNodesItVec,
std::list<const SMDS_MeshElement*>& newElems,
- const int nbSteps,
+ const size_t nbSteps,
SMESH_SequenceOfElemPtr& srcElements);
/*!
const bool theHasRefPoint,
const gp_Pnt& theRefPoint,
const bool theMakeGroups);
- void LinearAngleVariation(const int NbSteps,
- list<double>& theAngles);
+ void LinearAngleVariation(const int NbSteps,
+ std::list<double>& theAngles);
bool doubleNodes( SMESHDS_Mesh* theMeshDS,
const TIDSortedElemSet& theElems,
SMDSAbs_ElementType elemType( subType==TopAbs_FACE ? SMDSAbs_Face : SMDSAbs_Edge );
- int nbOldLinks = myTLinkNodeMap.size();
+ //int nbOldLinks = myTLinkNodeMap.size();
if ( !myMesh->HasShapeToMesh() )
{
{
vector<const SMDS_MeshNode*> newNodes( nodes.size() * 2 );
newNodes = nodes;
- for ( int i = 0; i < nodes.size(); ++i )
+ for ( size_t i = 0; i < nodes.size(); ++i )
{
const SMDS_MeshNode* n1 = nodes[i];
const SMDS_MeshNode* n2 = nodes[(i+1)%nodes.size()];
{
vector<const SMDS_MeshNode*> newNodes;
vector<int> newQuantities;
- for ( int iFace=0, iN=0; iFace < quantities.size(); ++iFace)
+ for ( size_t iFace = 0, iN = 0; iFace < quantities.size(); ++iFace )
{
int nbNodesInFace = quantities[iFace];
newQuantities.push_back(0);
const SMDS_MeshNode* n1 = nodes[ iN + i ];
newNodes.push_back( n1 );
newQuantities.back()++;
-
+
const SMDS_MeshNode* n2 = nodes[ iN + ( i+1==nbNodesInFace ? 0 : i+1 )];
-// if ( n1->GetPosition()->GetTypeOfPosition() != SMDS_TOP_3DSPACE &&
-// n2->GetPosition()->GetTypeOfPosition() != SMDS_TOP_3DSPACE )
+ // if ( n1->GetPosition()->GetTypeOfPosition() != SMDS_TOP_3DSPACE &&
+ // n2->GetPosition()->GetTypeOfPosition() != SMDS_TOP_3DSPACE )
{
const SMDS_MeshNode* n12 = GetMediumNode( n1, n2, force3d, TopAbs_SOLID );
newNodes.push_back( n12 );
}
// nb rows of nodes
- int prevNbRows = theParam2ColumnMap.begin()->second.size(); // current, at least 1 here
- int expectedNbRows = faceSubMesh->NbElements() / ( theParam2ColumnMap.size()-1 ); // to be added
+ size_t prevNbRows = theParam2ColumnMap.begin()->second.size(); // current, at least 1 here
+ size_t expectNbRows = faceSubMesh->NbElements() / ( theParam2ColumnMap.size()-1 ); // to be added
// fill theParam2ColumnMap column by column by passing from nodes on
// theBaseEdge up via mesh faces on theFace
{
vector<const SMDS_MeshNode*>& nCol1 = par_nVec_1->second;
vector<const SMDS_MeshNode*>& nCol2 = par_nVec_2->second;
- nCol1.resize( prevNbRows + expectedNbRows );
- nCol2.resize( prevNbRows + expectedNbRows );
+ nCol1.resize( prevNbRows + expectNbRows );
+ nCol2.resize( prevNbRows + expectNbRows );
- int i1, i2, foundNbRows = 0;
+ int i1, i2; size_t foundNbRows = 0;
const SMDS_MeshNode *n1 = nCol1[ prevNbRows-1 ];
const SMDS_MeshNode *n2 = nCol2[ prevNbRows-1 ];
// find face sharing node n1 and n2 and belonging to faceSubMesh
int nbNodes = face->NbCornerNodes();
if ( nbNodes != 4 )
return false;
- if ( foundNbRows + 1 > expectedNbRows )
+ if ( foundNbRows + 1 > expectNbRows )
return false;
n1 = face->GetNode( (i2+2) % 4 ); // opposite corner of quadrangle face
n2 = face->GetNode( (i1+2) % 4 );
}
avoidSet.insert( face );
}
- if ( foundNbRows != expectedNbRows )
+ if ((size_t) foundNbRows != expectNbRows )
return false;
avoidSet.clear();
}
return ( theParam2ColumnMap.size() > 1 &&
- theParam2ColumnMap.begin()->second.size() == prevNbRows + expectedNbRows );
+ theParam2ColumnMap.begin()->second.size() == prevNbRows + expectNbRows );
}
namespace
int NbVolumes() const { return !_volumes[0] ? 0 : !_volumes[1] ? 1 : 2; }
void AddSelfToLinks() const {
- for ( int i = 0; i < _sides.size(); ++i )
+ for ( size_t i = 0; i < _sides.size(); ++i )
_sides[i]->_faces.push_back( this );
}
int LinkIndex( const QLink* side ) const {
- for (int i=0; i<_sides.size(); ++i ) if ( _sides[i] == side ) return i;
+ for (size_t i = 0; i<_sides.size(); ++i ) if ( _sides[i] == side ) return i;
return -1;
}
bool GetLinkChain( int iSide, TChain& chain, SMDS_TypeOfPosition pos, int& err) const;
const SMDS_MeshNode* nodeToContain) const;
const SMDS_MeshNode* GetNodeInFace() const {
- for ( int iL = 0; iL < _sides.size(); ++iL )
+ for ( size_t iL = 0; iL < _sides.size(); ++iL )
if ( _sides[iL]->MediumPos() == SMDS_TOP_FACE ) return _sides[iL]->_mediumNode;
return 0;
}
_sides = links;
_sideIsAdded[0]=_sideIsAdded[1]=_sideIsAdded[2]=_sideIsAdded[3]=false;
_normal.SetCoord(0,0,0);
- for ( int i = 1; i < _sides.size(); ++i ) {
+ for ( size_t i = 1; i < _sides.size(); ++i ) {
const QLink *l1 = _sides[i-1], *l2 = _sides[i];
insert( l1->node1() ); insert( l1->node2() );
// compute normal
bool QFace::GetLinkChain( int iSide, TChain& chain, SMDS_TypeOfPosition pos, int& error) const
{
- if ( iSide >= _sides.size() ) // wrong argument iSide
+ if ( iSide >= (int)_sides.size() ) // wrong argument iSide
return false;
if ( _sideIsAdded[ iSide ]) // already in chain
return true;
list< const QFace* > faces( 1, this );
while ( !faces.empty() ) {
const QFace* face = faces.front();
- for ( int i = 0; i < face->_sides.size(); ++i ) {
+ for ( size_t i = 0; i < face->_sides.size(); ++i ) {
if ( !face->_sideIsAdded[i] && face->_sides[i] ) {
face->_sideIsAdded[i] = true;
// find a face side in the chain
typedef list< pair< const QFace*, TLinkInSet > > TFaceLinkList;
TFaceLinkList adjacentFaces;
- for ( int iL = 0; iL < _sides.size(); ++iL )
+ for ( size_t iL = 0; iL < _sides.size(); ++iL )
{
if ( avoidLink._qlink == _sides[iL] )
continue;
const TChainLink& avoidLink,
const SMDS_MeshNode* nodeToContain) const
{
- for ( int i = 0; i < _sides.size(); ++i )
+ for ( size_t i = 0; i < _sides.size(); ++i )
if ( avoidLink._qlink != _sides[i] &&
(_sides[i]->node1() == nodeToContain || _sides[i]->node2() == nodeToContain ))
- return links.find( _sides[ i ]);
+ return links.find( _sides[i] );
return links.end();
}
if ( !theStep )
return thePrevLen; // propagation limit reached
- int iL; // index of theLink
+ size_t iL; // index of theLink
for ( iL = 0; iL < _sides.size(); ++iL )
if ( theLink._qlink == _sides[ iL ])
break;
int iFaceCont = -1, nbBoundary = 0, iBoundary[2]={-1,-1};
if ( _faces[0]->IsBoundary() )
iBoundary[ nbBoundary++ ] = 0;
- for ( int iF = 1; iFaceCont < 0 && iF < _faces.size(); ++iF )
+ for ( size_t iF = 1; iFaceCont < 0 && iF < _faces.size(); ++iF )
{
// look for a face bounding none of volumes bound by _faces[0]
bool sameVol = false;
const QFace* QLink::GetContinuesFace( const QFace* face ) const
{
- for ( int i = 0; i < _faces.size(); ++i ) {
- if ( _faces[i] == face ) {
- int iF = i < 2 ? 1-i : 5-i;
- return iF < _faces.size() ? _faces[iF] : 0;
+ if ( _faces.size() <= 4 )
+ for ( size_t i = 0; i < _faces.size(); ++i ) {
+ if ( _faces[i] == face ) {
+ int iF = i < 2 ? 1-i : 5-i;
+ return iF < (int)_faces.size() ? _faces[iF] : 0;
+ }
}
- }
return 0;
}
//================================================================================
bool QLink::OnBoundary() const
{
- for ( int i = 0; i < _faces.size(); ++i )
+ for ( size_t i = 0; i < _faces.size(); ++i )
if (_faces[i] && _faces[i]->IsBoundary()) return true;
return false;
}
for ( ; bnd != bndEnd; ++bnd )
{
const QLink* bndLink = *bnd;
- for ( int i = 0; i < bndLink->_faces.size(); ++i ) // loop on faces of bndLink
+ for ( size_t i = 0; i < bndLink->_faces.size(); ++i ) // loop on faces of bndLink
{
const QFace* face = bndLink->_faces[i]; // quadrange lateral face of a prism
if ( !face ) continue;
{
// put links in the set and evalute number of result chains by number of boundary links
TLinkSet linkSet;
- int nbBndLinks = 0;
+ size_t nbBndLinks = 0;
for ( TChain::iterator lnk = allLinks.begin(); lnk != allLinks.end(); ++lnk ) {
linkSet.insert( *lnk );
nbBndLinks += lnk->IsBoundary();
TLinkInSet botLink = startLink; // current horizontal link to go up from
corner = startCorner; // current corner the botLink ends at
- int iRow = 0;
+ size_t iRow = 0;
while ( botLink != linksEnd ) // loop on rows
{
// add botLink to the columnChain
// In the linkSet, there must remain the last links of rowChains; add them
if ( linkSet.size() != rowChains.size() )
return _BAD_SET_SIZE;
- for ( int iRow = 0; iRow < rowChains.size(); ++iRow ) {
+ for ( size_t iRow = 0; iRow < rowChains.size(); ++iRow ) {
// find the link (startLink) ending at startCorner
corner = 0;
for ( startLink = linkSet.begin(); startLink != linksEnd; ++startLink ) {
{
continue;
}
+ default:;
}
// get nodes shared by faces that may be distorted
SMDS_NodeIteratorPtr nodeIt;
{
concaveFaces.push_back( face );
}
+ default:;
}
}
if ( concaveFaces.empty() )
while ( volIt->more() )
{
const SMDS_MeshElement* vol = volIt->next();
- int nbN = vol->NbCornerNodes();
+ size_t nbN = vol->NbCornerNodes();
if ( ( nbN != 4 && nbN != 5 ) ||
!solidSM->Contains( vol ) ||
!checkedVols.insert( vol ).second )
else {
continue;
}
- for ( int iC = 0; iC < chains.size(); ++iC )
+ for ( size_t iC = 0; iC < chains.size(); ++iC )
{
TChain& chain = chains[iC];
if ( chain.empty() ) continue;
double u = epos->GetUParameter();
paramNodeMap.insert( make_pair( u, node ));
}
- if ( paramNodeMap.size() != eSubMesh->NbNodes() ) {
+ if ((int) paramNodeMap.size() != eSubMesh->NbNodes() ) {
// wrong U on edge, project
Extrema_ExtPC proj;
BRepAdaptor_Curve aCurve( edge );
}
//rnv : To fix the bug IPAL21999 Pattern Mapping - New - collapse of pattern mesh
- if ( paramNodeMap.size() != eSubMesh->NbNodes() - nbMeduimNodes )
+ if ((int) paramNodeMap.size() != eSubMesh->NbNodes() - nbMeduimNodes )
return setErrorCode(ERR_UNEXPECTED);
}
TIsoNode* myNext[4]; // order: (iDir=0,isForward=0), (1,0), (0,1), (1,1)
TIsoNode* myBndNodes[4]; // order: (iDir=0,i=0), (1,0), (0,1), (1,1)
TIsoNode(double initU, double initV):
- myInitUV( initU, initV ), myUV( 1e100, 1e100 ), myIsMovable(true)
+ myIsMovable(true), myInitUV( initU, initV ), myUV( 1e100, 1e100 )
{ myNext[0] = myNext[1] = myNext[2] = myNext[3] = 0; }
bool IsUVComputed() const
{ return myUV.X() != 1e100; }
int nbVertices = loadVE( eList, myShapeIDMap );
myShapeIDMap.Add( face );
- if ( myShapeIDToPointsMap.size() != myShapeIDMap.Extent() ) {
+ if ((int) myShapeIDToPointsMap.size() != myShapeIDMap.Extent() ) {
MESSAGE( myShapeIDToPointsMap.size() <<" != " << myShapeIDMap.Extent());
return setErrorCode( ERR_APPLF_INTERNAL_EEROR );
}
while ( wlIt != wireList.end() )
{
list< TopoDS_Edge >& wire = (*wlIt);
- int nbEdges = wire.size();
+ size_t nbEdges = wire.size();
wlIt++;
if ( wlIt != wireList.end() && (*wlIt).size() != nbEdges ) // a unique size wire
{
wlIt = wireList.begin();
while ( wlIt != wireList.end() )
{
- int nbSameSize = 0, nbEdges = (*wlIt).size();
+ size_t nbSameSize = 0, nbEdges = (*wlIt).size();
list< list< TopoDS_Edge > >::iterator wlIt2 = wlIt;
wlIt2++;
while ( wlIt2 != wireList.end() && (*wlIt2).size() == nbEdges ) { // a same size wire
// compute UV and XYZ of points on edges
- for ( int i = 0; i < myOrderedNodes.size(); ++i, ++iSub )
+ for ( size_t i = 0; i < myOrderedNodes.size(); ++i, ++iSub )
{
gp_XY& uv1 = keyUV[ i ];
gp_XY& uv2 = ( i+1 < keyUV.size() ) ? keyUV[ i+1 ] : keyUV[ 0 ];
// to find point index
map< TPoint*, int > pointIndex;
- for ( int i = 0; i < myPoints.size(); i++ )
+ for ( size_t i = 0; i < myPoints.size(); i++ )
pointIndex.insert( make_pair( & myPoints[ i ], i ));
int ind1 = 0; // lowest point index for an element
for ( ; i_node != myXYZIdToNodeMap.end(); i_node++ ) {
nodesVector[ i_node->first ] = i_node->second;
}
- for ( int i = 0; i < myXYZ.size(); ++i ) {
+ for ( size_t i = 0; i < myXYZ.size(); ++i ) {
if ( !nodesVector[ i ] && isDefined( myXYZ[ i ] ) )
nodesVector[ i ] = aMeshDS->AddNode (myXYZ[ i ].X(),
myXYZ[ i ].Y(),
groups.resize( theElements.size() );
const set<SMESHDS_GroupBase*>& allGroups = aMeshDS->GetGroups();
set<SMESHDS_GroupBase*>::const_iterator grIt;
- for ( int i = 0; i < theElements.size(); i++ )
+ for ( size_t i = 0; i < theElements.size(); i++ )
{
shapeIDs[ i ] = editor.FindShape( theElements[ i ] );
for ( grIt = allGroups.begin(); grIt != allGroups.end(); grIt++ ) {
TElemDef::const_iterator id = elemNodeInd.begin();
int nbNodes;
for ( nbNodes = 0; id != elemNodeInd.end(); id++ ) {
- if ( *id < theNodesVector.size() )
+ if ( *id < (int) theNodesVector.size() )
nodes[ nbNodes++ ] = theNodesVector[ *id ];
else
nodes[ nbNodes++ ] = myXYZIdToNodeMap[ *id ];
}
if ( onMeshElements ) {
list< int > elemIDs;
- for ( int i = 0; i < theElements.size(); i++ )
+ for ( size_t i = 0; i < theElements.size(); i++ )
{
subMesh = theMesh->GetSubMeshContaining( shapeIDs[ i ] );
if ( subMesh )
gp_Pnt P[2];
list<int>::const_iterator id = theIdsList.begin();
for ( int i = 0; i < 2; ++i, ++id ) {
- if ( *id < myXYZ.size() )
+ if ( *id < (int) myXYZ.size() )
P[ i ] = myXYZ[ *id ];
else {
map< int, const SMDS_MeshNode*>::const_iterator i_n;
// check nb of vertices
TopTools_IndexedMapOfShape vMap;
TopExp::MapShapes( theShape, TopAbs_VERTEX, vMap );
- if ( vMap.Extent() + nbNodeOnSeamEdge != myKeyPointIDs.size() ) {
+ if ( vMap.Extent() + nbNodeOnSeamEdge != (int)myKeyPointIDs.size() ) {
MESSAGE( myKeyPointIDs.size() + nbNodeOnSeamEdge << " != " << vMap.Extent() );
return setErrorCode( ERR_APPL_BAD_NB_VERTICES );
}
*/
//================================================================================
-SMESH_ProxyMesh::SMESH_ProxyMesh(vector<SMESH_ProxyMesh::Ptr>& components):
+SMESH_ProxyMesh::SMESH_ProxyMesh(std::vector<SMESH_ProxyMesh::Ptr>& components):
_mesh(0)
{
if ( components.empty() ) return;
if ( _subMeshes[j] )
{
// unite 2 sub-meshes
- set< const SMDS_MeshElement * > elems( _subMeshes[j]->_elements.begin(),
- _subMeshes[j]->_elements.end());
+ std::set< const SMDS_MeshElement * > elems( _subMeshes[j]->_elements.begin(),
+ _subMeshes[j]->_elements.end());
elems.insert( m->_subMeshes[j]->_elements.begin(),
m->_subMeshes[j]->_elements.end());
_subMeshes[j]->_elements.assign( elems.begin(), elems.end() );
delete _subMeshes[i];
_subMeshes.clear();
- set< const SMDS_MeshElement* >::iterator i = _elemsInMesh.begin();
+ std::set< const SMDS_MeshElement* >::iterator i = _elemsInMesh.begin();
for ( ; i != _elemsInMesh.end(); ++i )
GetMeshDS()->RemoveFreeElement( *i, 0 );
_elemsInMesh.clear();
{
const SMESHDS_SubMesh* sm = 0;
- int i = shapeIndex(shape);
+ size_t i = shapeIndex(shape);
if ( i < _subMeshes.size() )
sm = _subMeshes[i];
if ( !sm )
const SMESH_ProxyMesh::SubMesh*
SMESH_ProxyMesh::GetProxySubMesh(const TopoDS_Shape& shape) const
{
- int i = shapeIndex(shape);
+ size_t i = shapeIndex(shape);
return i < _subMeshes.size() ? _subMeshes[i] : 0;
}
class TFilteringIterator : public SMDS_ElemIterator
{
- SMDS_ElemIteratorPtr _iter;
- const SMDS_MeshElement * _curElem;
- vector< SMDSAbs_EntityType> _okTypes;
+ SMDS_ElemIteratorPtr _iter;
+ const SMDS_MeshElement * _curElem;
+ std::vector< SMDSAbs_EntityType> _okTypes;
public:
- TFilteringIterator( const vector< SMDSAbs_EntityType>& okTypes,
- const SMDS_ElemIteratorPtr& elemIterator)
+ TFilteringIterator( const std::vector< SMDSAbs_EntityType>& okTypes,
+ const SMDS_ElemIteratorPtr& elemIterator)
:_iter(elemIterator), _curElem(0), _okTypes(okTypes)
{
next();
// ... else elements filtered using allowedTypes are additionally returned
SMDS_ElemIteratorPtr facesIter = GetMeshDS()->elementsIterator(SMDSAbs_Face);
SMDS_ElemIteratorPtr filterIter( new TFilteringIterator( _allowedTypes, facesIter ));
- vector< SMDS_ElemIteratorPtr > iters(2);
+ std::vector< SMDS_ElemIteratorPtr > iters(2);
iters[0] = proxyIter;
iters[1] = filterIter;
- typedef vector< SMDS_ElemIteratorPtr > TElemIterVector;
+ typedef std::vector< SMDS_ElemIteratorPtr > TElemIterVector;
typedef SMDS_IteratorOnIterators<const SMDS_MeshElement *, TElemIterVector> TItersIter;
return SMDS_ElemIteratorPtr( new TItersIter( iters ));
}
{
if ( elem && elem->GetID() > 0 )
{
- set< const SMDS_MeshElement* >::iterator i = _elemsInMesh.find( elem );
+ std::set< const SMDS_MeshElement* >::iterator i = _elemsInMesh.find( elem );
if ( i != _elemsInMesh.end() )
{
GetMeshDS()->RemoveFreeElement( elem, 0 );
SubMesh* sm = const_cast<SubMesh*>( subMesh );
if ( !subMesh->_n2n )
sm->_n2n = new TN2NMap;
- sm->_n2n->insert( make_pair( srcNode, proxyNode ));
+ sm->_n2n->insert( std::make_pair( srcNode, proxyNode ));
}
//================================================================================
}
break;
case TopAbs_COMPSOLID: insertDependence( _subShape, TopAbs_SOLID ); break;
- case TopAbs_SOLID: insertDependence( _subShape, TopAbs_FACE ); break;
+ case TopAbs_SOLID: insertDependence( _subShape, TopAbs_FACE );
+ { /*internal EDGE*/ insertDependence( _subShape, TopAbs_EDGE, TopAbs_WIRE ); break; }
case TopAbs_SHELL: insertDependence( _subShape, TopAbs_FACE ); break;
case TopAbs_FACE: insertDependence( _subShape, TopAbs_EDGE ); break;
case TopAbs_WIRE: insertDependence( _subShape, TopAbs_EDGE ); break;
namespace
{
- int dependsOnMapKey( const SMESH_subMesh* sm )
+ int dependsOnMapKey( TopAbs_ShapeEnum type, int shapeID )
{
- int type = sm->GetSubShape().ShapeType();
- int ordType = 9 - type; // 2 = Vertex, 8 = CompSolid
- int cle = sm->GetId();
+ int ordType = 9 - int(type); // 2 = Vertex, 8 = CompSolid
+ int cle = shapeID;
cle += 10000000 * ordType; // sort map by ordType then index
return cle;
}
+ int dependsOnMapKey( const SMESH_subMesh* sm )
+ {
+ return dependsOnMapKey( sm->GetSubShape().ShapeType(), sm->GetId() );
+ }
}
//=============================================================================
//=============================================================================
void SMESH_subMesh::insertDependence(const TopoDS_Shape aShape,
- TopAbs_ShapeEnum aSubType)
+ TopAbs_ShapeEnum aSubType,
+ TopAbs_ShapeEnum avoidType)
{
- TopExp_Explorer sub( aShape, aSubType );
+ TopExp_Explorer sub( aShape, aSubType, avoidType );
for ( ; sub.More(); sub.Next() )
{
SMESH_subMesh *aSubMesh = _father->GetSubMesh( sub.Current() );
return other ? _mapDepend.count( dependsOnMapKey( other )) : false;
}
+//================================================================================
+/*!
+ * \brief Return \c true if \a this sub-mesh depends on a \a shape
+ */
+//================================================================================
+
+bool SMESH_subMesh::DependsOn( const int shapeID ) const
+{
+ return DependsOn( _father->GetSubMeshContaining( shapeID ));
+}
+
//=============================================================================
/*!
* Return a shape of \a this sub-mesh
!theAlgo->OnlyUnaryInput() ) // all adjacent shapes will be meshed by this algo?
return true;
- SMESH_Gen* gen =_father->GetGen();
-
// only local algo is to be checked
//if ( gen->IsGlobalHypothesis( theAlgo, *_father ))
if ( _subShape.ShapeType() == _father->GetMeshDS()->ShapeToMesh().ShapeType() )
{
_Iterator(SMDS_Iterator<SMESH_subMesh*>* subIt,
SMESH_subMesh* prepend,
- SMESH_subMesh* append): myIt(subIt),myAppend(append)
+ SMESH_subMesh* append): myAppend(append), myIt(subIt)
{
myCur = prepend ? prepend : myIt->more() ? myIt->next() : append;
if ( myCur == append ) append = 0;
bool SMESH_subMesh::FindIntersection(const SMESH_subMesh* theOther,
std::set<const SMESH_subMesh*>& theSetOfCommon ) const
{
- int oldNb = theSetOfCommon.size();
+ size_t oldNb = theSetOfCommon.size();
// check main submeshes
const map <int, SMESH_subMesh*>::const_iterator otherEnd = theOther->_mapDepend.end();
const std::map < int, SMESH_subMesh * >& DependsOn();
bool DependsOn( const SMESH_subMesh* other ) const;
+ bool DependsOn( const int shapeID ) const;
/*!
* \brief Return iterator on the sub-meshes this one depends on. By default
* most simple sub-meshes go first.
protected:
// ==================================================================
- void insertDependence(const TopoDS_Shape aShape, TopAbs_ShapeEnum aSubType );
+ void insertDependence(const TopoDS_Shape aShape,
+ TopAbs_ShapeEnum aSubType,
+ TopAbs_ShapeEnum avoidType=TopAbs_SHAPE);
void removeSubMeshElementsAndNodes();
void updateDependantsState(const compute_event theEvent);
namespace
{
+ using std::runtime_error;
//=======================================================================
//function : FindNode
const SMESH::double_array& aCoords = theSeq[theId].coords;
const SMESH::long_array& anIndexes = theSeq[theId].indexes;
CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number;
- if(3*aNbElems != aCoords.length())
+ if(3*aNbElems != (CORBA::Long) aCoords.length())
EXCEPTION(runtime_error,"AddNodesWithID - 3*aNbElems != aCoords.length()");
for(CORBA::Long aCoordId = 0; anElemId < aNbElems; anElemId++, aCoordId+=3){
SMDS_MeshElement* anElem = theMesh->AddNodeWithID(aCoords[aCoordId],
{
const SMESH::long_array& anIndexes = theSeq[theId].indexes;
CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number;
- if (2*aNbElems != anIndexes.length())
+ if (2*aNbElems != (CORBA::Long) anIndexes.length())
EXCEPTION(runtime_error,"AddEdgeWithID - 2*aNbElems != aCoords.length()");
CORBA::Long anIndexId = 0;
for (; anElemId < aNbElems; anElemId++, anIndexId+=2)
const SMESH::double_array& aDiameter = theSeq[theId].coords;
const SMESH::long_array& anIndexes = theSeq[theId].indexes;
CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number;
- if (2*aNbElems != anIndexes.length() )
+ if (2*aNbElems != (CORBA::Long) anIndexes.length() )
EXCEPTION(runtime_error,"AddEdgeWithID - 2*aNbElems != anIndexes.length()");
- if (aNbElems != aDiameter.length())
+ if (aNbElems != (CORBA::Long) aDiameter.length())
EXCEPTION(runtime_error,"AddEdgeWithID - aNbElems != aDiameter.length()");
CORBA::Long anIndexId = 0;
for (; anElemId < aNbElems; anElemId++, anIndexId+=2)
{
const SMESH::long_array& anIndexes = theSeq[theId].indexes;
CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number;
- if(3*aNbElems != anIndexes.length())
+ if(3*aNbElems != (CORBA::Long) anIndexes.length())
EXCEPTION(runtime_error,"AddEdgeWithID - 3*aNbElems != aCoords.length()");
for(CORBA::Long anIndexId = 0; anElemId < aNbElems; anElemId++, anIndexId+=3){
SMDS_MeshElement* anElem = theMesh->AddEdgeWithID(anIndexes[anIndexId+1],
{
const SMESH::long_array& anIndexes = theSeq[theId].indexes;
CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number;
- if(4*aNbElems != anIndexes.length())
+ if(4*aNbElems != (CORBA::Long) anIndexes.length())
EXCEPTION(runtime_error,"AddTriasWithID - 4*aNbElems != anIndexes.length()");
for(CORBA::Long anIndexId = 0; anElemId < aNbElems; anElemId++, anIndexId+=4){
SMDS_MeshElement* anElem = theMesh->AddFaceWithID(anIndexes[anIndexId+1],
{
const SMESH::long_array& anIndexes = theSeq[theId].indexes;
CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number;
- if(5*aNbElems != anIndexes.length())
+ if(5*aNbElems != (CORBA::Long) anIndexes.length())
EXCEPTION(runtime_error,"AddQuadsWithID - 4*aNbElems != anIndexes.length()");
for(CORBA::Long anIndexId = 0; anElemId < aNbElems; anElemId++, anIndexId+=5){
SMDS_MeshElement* anElem = theMesh->AddFaceWithID(anIndexes[anIndexId+1],
{
const SMESH::long_array& anIndexes = theSeq[theId].indexes;
CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number;
- if(5*aNbElems != anIndexes.length())
+ if(5*aNbElems != (CORBA::Long) anIndexes.length())
EXCEPTION(runtime_error,"AddTetrasWithID - 5*aNbElems != anIndexes.length()");
for(CORBA::Long anIndexId = 0; anElemId < aNbElems; anElemId++, anIndexId+=5){
SMDS_MeshElement* anElem = theMesh->AddVolumeWithID(anIndexes[anIndexId+1],
{
const SMESH::long_array& anIndexes = theSeq[theId].indexes;
CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number;
- if(6*aNbElems != anIndexes.length())
+ if(6*aNbElems != (CORBA::Long) anIndexes.length())
EXCEPTION(runtime_error,"AddPiramidsWithID - 6*aNbElems != anIndexes.length()");
for(CORBA::Long anIndexId = 0; anElemId < aNbElems; anElemId++, anIndexId+=6){
SMDS_MeshElement* anElem = theMesh->AddVolumeWithID(anIndexes[anIndexId+1],
{
const SMESH::long_array& anIndexes = theSeq[theId].indexes;
CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number;
- if(7*aNbElems != anIndexes.length())
+ if(7*aNbElems != (CORBA::Long) anIndexes.length())
EXCEPTION(runtime_error,"AddPrismsWithID - 7*aNbElems != anIndexes.length()");
for(CORBA::Long anIndexId = 0; anElemId < aNbElems; anElemId++, anIndexId+=7){
SMDS_MeshElement* anElem = theMesh->AddVolumeWithID(anIndexes[anIndexId+1],
{
const SMESH::long_array& anIndexes = theSeq[theId].indexes;
CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number;
- if(9*aNbElems != anIndexes.length())
+ if(9*aNbElems != (CORBA::Long) anIndexes.length())
EXCEPTION(runtime_error,"AddHexasWithID - 9*aNbElems != anIndexes.length()");
for(CORBA::Long anIndexId = 0; anElemId < aNbElems; anElemId++, anIndexId+=9){
SMDS_MeshElement* anElem = theMesh->AddVolumeWithID(anIndexes[anIndexId+1],
{
const SMESH::long_array& anIndexes = theSeq[theId].indexes;
CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number;
- if(13*aNbElems != anIndexes.length())
+ if(13*aNbElems != (CORBA::Long) anIndexes.length())
EXCEPTION(runtime_error,"AddHexPrismWithID - 13*aNbElems != anIndexes.length()");
for(CORBA::Long anIndexId = 0; anElemId < aNbElems; anElemId++, anIndexId+=13){
SMDS_MeshElement* anElem = theMesh->AddVolumeWithID(anIndexes[anIndexId+1],
{
const SMESH::long_array& anIndexes = theSeq[theId].indexes;
CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number;
- if(4*aNbElems != anIndexes.length())
+ if(4*aNbElems != (CORBA::Long) anIndexes.length())
EXCEPTION(runtime_error,"AddQuadEdgeWithID - 4*aNbElems != aCoords.length()");
for(CORBA::Long anIndexId = 0; anElemId < aNbElems; anElemId++, anIndexId+=4){
SMDS_MeshElement* anElem = theMesh->AddEdgeWithID(anIndexes[anIndexId+1],
{
const SMESH::long_array& anIndexes = theSeq[theId].indexes;
CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number;
- if(7*aNbElems != anIndexes.length())
+ if(7*aNbElems != (CORBA::Long) anIndexes.length())
EXCEPTION(runtime_error,"AddQuadTriasWithID - 7*aNbElems != anIndexes.length()");
for(CORBA::Long anIndexId = 0; anElemId < aNbElems; anElemId++, anIndexId+=7){
SMDS_MeshElement* anElem = theMesh->AddFaceWithID(anIndexes[anIndexId+1],
{
const SMESH::long_array& anIndexes = theSeq[theId].indexes;
CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number;
- if(9*aNbElems != anIndexes.length())
+ if(9*aNbElems != (CORBA::Long) anIndexes.length())
EXCEPTION(runtime_error,"AddQuadQuadsWithID - 9*aNbElems != anIndexes.length()");
for(CORBA::Long anIndexId = 0; anElemId < aNbElems; anElemId++, anIndexId+=9){
SMDS_MeshElement* anElem = theMesh->AddFaceWithID(anIndexes[anIndexId+1],
{
const SMESH::long_array& anIndexes = theSeq[theId].indexes;
CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number;
- if(10*aNbElems != anIndexes.length())
+ if(10*aNbElems != (CORBA::Long) anIndexes.length())
EXCEPTION(runtime_error,"AddBiQuadQuadsWithID - 10*aNbElems != anIndexes.length()");
for(CORBA::Long anIndexId = 0; anElemId < aNbElems; anElemId++, anIndexId+=10){
SMDS_MeshElement* anElem = theMesh->AddFaceWithID(anIndexes[anIndexId+1],
{
const SMESH::long_array& anIndexes = theSeq[theId].indexes;
CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number;
- if(8*aNbElems != anIndexes.length())
+ if(8*aNbElems != (CORBA::Long) anIndexes.length())
EXCEPTION(runtime_error,"AddBiQuadTriasWithID - 8*aNbElems != anIndexes.length()");
for(CORBA::Long anIndexId = 0; anElemId < aNbElems; anElemId++, anIndexId+=8){
SMDS_MeshElement* anElem = theMesh->AddFaceWithID(anIndexes[anIndexId+1],
{
const SMESH::long_array& anIndexes = theSeq[theId].indexes;
CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number;
- if(11*aNbElems != anIndexes.length())
+ if(11*aNbElems != (CORBA::Long) anIndexes.length())
EXCEPTION(runtime_error,"AddQuadTetrasWithID - 11*aNbElems != anIndexes.length()");
for(CORBA::Long anIndexId = 0; anElemId < aNbElems; anElemId++, anIndexId+=11){
SMDS_MeshElement* anElem = theMesh->AddVolumeWithID(anIndexes[anIndexId+1],
{
const SMESH::long_array& anIndexes = theSeq[theId].indexes;
CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number;
- if(14*aNbElems != anIndexes.length())
+ if(14*aNbElems != (CORBA::Long) anIndexes.length())
EXCEPTION(runtime_error,"AddQuadPiramidsWithID - 14*aNbElems != anIndexes.length()");
for(CORBA::Long anIndexId = 0; anElemId < aNbElems; anElemId++, anIndexId+=14){
SMDS_MeshElement* anElem = theMesh->AddVolumeWithID(anIndexes[anIndexId+1],
{
const SMESH::long_array& anIndexes = theSeq[theId].indexes;
CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number;
- if(16*aNbElems != anIndexes.length())
+ if(16*aNbElems != (CORBA::Long) anIndexes.length())
EXCEPTION(runtime_error,"AddQuadPentasWithID - 16*aNbElems != anIndexes.length()");
for(CORBA::Long anIndexId = 0; anElemId < aNbElems; anElemId++, anIndexId+=16){
SMDS_MeshElement* anElem = theMesh->AddVolumeWithID(anIndexes[anIndexId+1],
{
const SMESH::long_array& anIndexes = theSeq[theId].indexes;
CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number;
- if(21*aNbElems != anIndexes.length())
+ if(21*aNbElems != (CORBA::Long) anIndexes.length())
EXCEPTION(runtime_error,"AddQuadHexasWithID - 21*aNbElems != anIndexes.length()");
for(CORBA::Long anIndexId = 0; anElemId < aNbElems; anElemId++, anIndexId+=21){
SMDS_MeshElement* anElem = theMesh->AddVolumeWithID(anIndexes[anIndexId+1],
{
const SMESH::long_array& anIndexes = theSeq[theId].indexes;
CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number;
- if(28*aNbElems != anIndexes.length())
+ if(28*aNbElems != (CORBA::Long) anIndexes.length())
EXCEPTION(runtime_error,"AddTriQuadHexasWithID - 28*aNbElems != anIndexes.length()");
for(CORBA::Long anIndexId = 0; anElemId < aNbElems; anElemId++, anIndexId+=28){
SMDS_MeshElement* anElem = theMesh->AddVolumeWithID(anIndexes[anIndexId+1],
int nbNodes = anIndexes[i++];
// nodes
//ASSERT( nbNodes < 9 );
- vector<const SMDS_MeshNode*> aNodes( nbNodes );
+ std::vector<const SMDS_MeshNode*> aNodes( nbNodes );
for ( int iNode = 0; iNode < nbNodes; iNode++ )
aNodes[ iNode ] = FindNode( mySMDSMesh, anIndexes[i++] );
// change
using namespace std;
+Quantity_Color SMESHDS_GroupBase::myDefaultColor = Quantity_Color( 0.0, 0.0, 0.0, Quantity_TOC_RGB );
+
//=============================================================================
/*!
*
myID(theID), myMesh(theMesh), myType(theType), myStoreName(""),
myCurIndex(0), myCurID(-1)
{
- myColor = Quantity_Color( 0.0, 0.0, 0.0, Quantity_TOC_RGB );
+ myColor = myDefaultColor;
}
//=============================================================================
int GetColorGroup() const;
+ static void SetDefaultColor (const Quantity_Color& theColor)
+ { myDefaultColor = theColor;}
+
protected:
const SMDS_MeshElement* findInMesh (const int theID) const;
void resetIterator();
int myCurIndex;
int myCurID;
SMDS_ElemIteratorPtr myIterator;
+
+ static Quantity_Color myDefaultColor;
};
#endif
{
if ( n->NbInverseElements() == 0 && !(hasConstructionEdges() || hasConstructionFaces()))
{
- SMESHDS_SubMesh* subMesh = MeshElements( n->getshapeId() );
- SMESHDS_SubMeshIteratorPtr subIt;
- if ( !subMesh )
- subIt = SubMeshes();
- for ( ; !subMesh && subIt->more(); ) {
- subMesh = const_cast< SMESHDS_SubMesh* >( subIt->next() );
- if ( subMesh->IsComplexSubmesh() || !subMesh->Contains( n ))
- subMesh = 0;
- }
- RemoveFreeNode( n, subMesh, true);
+ RemoveFreeNode( n, 0, true );
return;
}
MESSAGE("add element in subshape already belonging to that subshape "
<< ME->GetID() << " " << oldShapeId << " " << idInSubShape);
// check if ok: do nothing if ok
- if (idInSubShape >= myElements.size())
+ if (idInSubShape >= (int)myElements.size())
{
throw SALOME_Exception(LOCALIZED("out of bounds"));
}
{
if (!ME)
{
- MESSAGE("-----------------> Remove Null Element " << isElemDeleted);
return false;
}
if (!IsComplexSubmesh())
{
- if ( ME->getshapeId() != myIndex )
+ if ( ME->getshapeId() != myIndex ) // elem not in a pool can loose it's data already
+ {
+ if ( isElemDeleted )
+ for ( size_t i = 0; i < myElements.size(); ++i )
+ if ( myElements[i] == ME )
+ {
+ myElements[i] = 0;
+ ++myUnusedIdElements;
+ return true;
+ }
return false;
+ }
int idInSubShape = ME->getIdInShape();
SMDS_MeshElement* elem = (SMDS_MeshElement*) (ME);
elem->setShapeId(0);
elem->setIdInShape(-1);
- if ((idInSubShape >= 0) && (idInSubShape < myElements.size()))
+ if ((idInSubShape >= 0) && (idInSubShape < (int) myElements.size()))
{
myElements[idInSubShape] = 0; // this vector entry is no more used
if ( ++myUnusedIdElements == (int) myElements.size() )
}
return false;
}
- MESSAGE("Try to remove an element from a complex submesh ");
return false;
}
if ( shapeId != myIndex )
throw SALOME_Exception
(LOCALIZED("a node being in sub-mesh is added to another sub-mesh"));
- if ( idInSubShape >= myNodes.size() || myNodes[ idInSubShape ] != N )
+ if ( idInSubShape >= (int)myNodes.size() || myNodes[ idInSubShape ] != N )
throw SALOME_Exception
(LOCALIZED("a node with wrong idInSubShape is re-added to the same sub-mesh"));
return; // already in
if (!IsComplexSubmesh())
{
if ( N->getshapeId() != myIndex )
+ {
+ if ( isNodeDeleted )
+ for ( size_t i = 0; i < myNodes.size(); ++i )
+ if ( myNodes[i] == N )
+ {
+ myNodes[i] = 0;
+ ++myUnusedIdNodes;
+ return true;
+ }
return false;
+ }
int idInSubShape = N->getIdInShape();
SMDS_MeshNode* node = (SMDS_MeshNode*) (N);
node->setShapeId(0);
node->setIdInShape(-1);
- if ((idInSubShape >= 0) && (idInSubShape < myNodes.size()))
+ if ((idInSubShape >= 0) && (idInSubShape < (int) myNodes.size()))
{
myNodes[idInSubShape] = 0; // this vector entry is no more used
if ( ++myUnusedIdNodes == (int) myNodes.size() )
}
return false;
}
- MESSAGE("Try to remove a node from a complex submesh");
return false;
}
//=======================================================================
//function : NbElements
-//purpose :
+//purpose :
//=======================================================================
int SMESHDS_SubMesh::NbElements() const
{
public:
MyIterator (const set<const SMESHDS_SubMesh*>& theSubMeshes)
- : mySubIt( theSubMeshes.begin() ), mySubEnd( theSubMeshes.end() ), myMore(false)
+ : myMore(false), mySubIt( theSubMeshes.begin() ), mySubEnd( theSubMeshes.end() )
{}
bool more()
{
if (ME->GetType() == SMDSAbs_Node)
{
int idInShape = ME->getIdInShape();
- if ((idInShape >= 0) && (idInShape < myNodes.size()))
+ if ((idInShape >= 0) && (idInShape < (int) myNodes.size()))
if (myNodes[idInShape] == ME)
return true;
}
else
{
int idInShape = ME->getIdInShape();
- if ((idInShape >= 0) && (idInShape < myElements.size()))
+ if ((idInShape >= 0) && (idInShape < (int) myElements.size()))
if (myElements[idInShape] == ME)
return true;
}
myUnusedIdNodes = 0;
}
}
+
+//=======================================================================
+//function : GetElement
+//purpose : Return an element by its IdInShape
+//=======================================================================
+
+const SMDS_MeshElement* SMESHDS_SubMesh::GetElement( size_t idInShape ) const
+{
+ return ( !IsComplexSubmesh() && idInShape < myElements.size() ) ? myElements[idInShape] : 0;
+}
+
+//=======================================================================
+//function : GetElement
+//purpose : Return a node by its IdInShape
+//=======================================================================
+
+const SMDS_MeshNode* SMESHDS_SubMesh::GetNode( size_t idInShape ) const
+{
+ return ( !IsComplexSubmesh() && idInShape < myNodes.size() ) ? myNodes[idInShape] : 0;
+}
virtual bool RemoveElement(const SMDS_MeshElement * ME, bool isElemDeleted); // ret true if ME was in
virtual void AddNode(const SMDS_MeshNode * ME);
virtual bool RemoveNode(const SMDS_MeshNode * ME, bool isNodeDeleted); // ret true if ME was in
+ virtual const SMDS_MeshElement* GetElement( size_t idInShape ) const;
+ virtual const SMDS_MeshNode* GetNode ( size_t idInShape ) const;
// if IsComplexSubmesh()
void AddSubMesh( const SMESHDS_SubMesh* theSubMesh );
}
else
{
- if ( myVec.size() <= id )
+ if ( (int)myVec.size() <= id )
myVec.resize( id+1, (SUBMESH*) NULL );
myVec[ id ] = sm;
}
}
else
{
- return (SUBMESH*) ( id >= myVec.size() ? NULL : myVec[ id ]);
+ return (SUBMESH*) ( id >= (int)myVec.size() ? NULL : myVec[ id ]);
}
}
void DeleteAll()
#define SMESHFILTERSSELECTION_EXPORT
#endif
-namespace SMESH{
+namespace SMESH {
enum MeshObjectType {
HYPOTHESIS,
ALGORITHM,
IDSOURCE_FACE,
IDSOURCE_VOLUME
};
-};
+}
#endif
Ok = isIDSourceOfType( obj, SMESH::VOLUME );
break;
}
+ default:;
}
}
return Ok;
out << "# Control: " << functorToString( aFunctor ) << endl;
out << "#" << endl;
out.setFieldWidth( 10 );
- for ( int i = 0; i < qMin( nbEvents.size(), funValues.size()-1 ); i++ )
+ for ( int i = 0; i < (int)qMin( nbEvents.size(), funValues.size()-1 ); i++ )
out << funValues[i] << "\t" << funValues[i+1] << "\t" << nbEvents[i] << endl;
f.close();
}
nbSeg = aResourceMgr->integerValue( "SMESH", "nb_segments_per_edge", 15 );
myComponentSMESH->SetDefaultNbSegments( nbSeg );
- const char* options[] = { "historical_python_dump", "forget_mesh_on_hyp_modif" };
+ const char* options[] = { "historical_python_dump", "forget_mesh_on_hyp_modif", "default_grp_color" };
for ( size_t i = 0; i < sizeof(options)/sizeof(char*); ++i )
if ( aResourceMgr->hasValue( "SMESH", options[i] ))
{
createPopupItem( SMESHOp::OpCreateGeometryGroup, OB, mesh, "&& hasGeomReference" );
createPopupItem( SMESHOp::OpConstructGroup, OB, subMesh );
popupMgr()->insert( separator(), -1, 0 );
- createPopupItem( SMESHOp::OpEditHypothesis, OB, hypo);
+ createPopupItem( SMESHOp::OpEditHypothesis, OB, hypo, "&& isEditableHyp");
createPopupItem( SMESHOp::OpUnassign, OB, hyp_alg ); // REMOVE HYPOTHESIS / ALGORITHMS
popupMgr()->insert( separator(), -1, 0 );
createPopupItem( SMESHOp::OpConvertMeshToQuadratic, OB, mesh + " " + subMesh ); // convert to quadratic
void* theCallData )
{
if( SMESHGUI* aSMESHGUI = reinterpret_cast<SMESHGUI*>( theClientData ) ) {
- if( theObject && theEvent == SMESH::DeleteActorEvent ) {
+ if( theObject && (int) theEvent == SMESH::DeleteActorEvent ) {
if( SMESH_Actor* anActor = SMESH_Actor::SafeDownCast( theObject ) ) {
SMESHGUI_ClippingPlaneInfoMap& aClippingPlaneInfoMap = aSMESHGUI->getClippingPlaneInfoMap();
SMESHGUI_ClippingPlaneInfoMap::iterator anIter1 = aClippingPlaneInfoMap.begin();
void SMESHGUI::preferencesChanged( const QString& sect, const QString& name )
{
- if( sect=="SMESH" ) {
- float sbX1,sbY1,sbW,sbH;
+ if ( sect=="SMESH" ) {
+ float sbX1 = 0.01, sbY1 = 0.01, sbW = 0.08, sbH = 0.08;
float aTol = 1.00000009999999;
std::string aWarning;
SUIT_ResourceMgr* aResourceMgr = SMESH::GetResourceMgr(this);
- if( name=="selection_object_color" || name=="selection_element_color" ||
- name=="highlight_color" ||
- name=="selection_precision_node" || name=="selection_precision_element" ||
- name=="selection_precision_object")
+
+ if ( name== "selection_object_color" ||
+ name=="selection_element_color" ||
+ name== "highlight_color" ||
+ name=="selection_precision_node" ||
+ name=="selection_precision_element" ||
+ name=="selection_precision_object" )
+ {
SMESH::UpdateSelectionProp( this );
- else if (name == QString("scalar_bar_vertical_x") || name == QString("scalar_bar_vertical_width")){
- sbX1 = aResourceMgr->doubleValue("SMESH", "scalar_bar_vertical_x", sbX1);
- sbW = aResourceMgr->doubleValue("SMESH", "scalar_bar_vertical_width", sbW);
- if(sbX1+sbW > aTol){
+ }
+ else if (name == "scalar_bar_vertical_x" || name == "scalar_bar_vertical_width")
+ {
+ sbX1 = aResourceMgr->doubleValue("SMESH", "scalar_bar_vertical_x", sbX1);
+ sbW = aResourceMgr->doubleValue("SMESH", "scalar_bar_vertical_width", sbW);
+ if ( sbX1+sbW > aTol ) {
aWarning = "Origin and Size Vertical: X+Width > 1\n";
- sbX1=0.01;
- sbW=0.08;
- aResourceMgr->setValue("SMESH", "scalar_bar_vertical_x", sbX1);
+ sbX1 = 0.01;
+ sbW = 0.08;
+ aResourceMgr->setValue("SMESH", "scalar_bar_vertical_x", sbX1);
aResourceMgr->setValue("SMESH", "scalar_bar_vertical_width", sbW);
}
}
- else if(name == QString("scalar_bar_vertical_y") || name == QString("scalar_bar_vertical_height")){
- sbY1 = aResourceMgr->doubleValue("SMESH", "scalar_bar_vertical_y", sbY1);
- sbH = aResourceMgr->doubleValue("SMESH", "scalar_bar_vertical_height",sbH);
- if(sbY1+sbH > aTol){
+ else if (name == "scalar_bar_vertical_y" || name == "scalar_bar_vertical_height" )
+ {
+ sbY1 = aResourceMgr->doubleValue("SMESH", "scalar_bar_vertical_y", sbY1);
+ sbH = aResourceMgr->doubleValue("SMESH", "scalar_bar_vertical_height",sbH);
+ if ( sbY1 + sbH > aTol ) {
aWarning = "Origin and Size Vertical: Y+Height > 1\n";
- aResourceMgr->setValue("SMESH", "scalar_bar_vertical_y", sbY1);
+ aResourceMgr->setValue("SMESH", "scalar_bar_vertical_y", sbY1);
aResourceMgr->setValue("SMESH", "scalar_bar_vertical_height",sbH);
}
}
- else if(name == QString("scalar_bar_horizontal_x") || name == QString("scalar_bar_horizontal_width")){
- sbX1 = aResourceMgr->doubleValue("SMESH", "scalar_bar_horizontal_x", sbX1);
- sbW = aResourceMgr->doubleValue("SMESH", "scalar_bar_horizontal_width", sbW);
- if(sbX1+sbW > aTol){
+ else if (name == "scalar_bar_horizontal_x" || name == "scalar_bar_horizontal_width")
+ {
+ sbX1 = aResourceMgr->doubleValue("SMESH", "scalar_bar_horizontal_x", sbX1);
+ sbW = aResourceMgr->doubleValue("SMESH", "scalar_bar_horizontal_width", sbW);
+ if ( sbX1 + sbW > aTol ) {
aWarning = "Origin and Size Horizontal: X+Width > 1\n";
sbX1=0.1;
- sbW=0.08;
+ sbW =0.08;
aResourceMgr->setValue("SMESH", "scalar_bar_horizontal_x", sbX1);
aResourceMgr->setValue("SMESH", "scalar_bar_horizontal_width", sbW);
}
}
- else if(name == QString("scalar_bar_horizontal_y") || name == QString("scalar_bar_horizontal_height")){
- sbY1 = aResourceMgr->doubleValue("SMESH", "scalar_bar_horizontal_y", sbY1);
- sbH = aResourceMgr->doubleValue("SMESH", "scalar_bar_horizontal_height",sbH);
- if(sbY1+sbH > aTol){
+ else if (name == "scalar_bar_horizontal_y" || name == "scalar_bar_horizontal_height")
+ {
+ sbY1 = aResourceMgr->doubleValue("SMESH", "scalar_bar_horizontal_y", sbY1);
+ sbH = aResourceMgr->doubleValue("SMESH", "scalar_bar_horizontal_height",sbH);
+ if ( sbY1 + sbH > aTol ) {
aWarning = "Origin and Size Horizontal: Y+Height > 1\n";
sbY1=0.01;
- sbH=0.08;
+ sbH =0.08;
aResourceMgr->setValue("SMESH", "scalar_bar_horizontal_y", sbY1);
aResourceMgr->setValue("SMESH", "scalar_bar_horizontal_height",sbH);
}
}
- else if ( name == "segmentation" ) {
+ else if ( name == "segmentation" )
+ {
int nbSeg = aResourceMgr->integerValue( "SMESH", "segmentation", 10 );
myComponentSMESH->SetBoundaryBoxSegmentation( nbSeg );
}
- else if ( name == "nb_segments_per_edge" ) {
+ else if ( name == "nb_segments_per_edge" )
+ {
int nbSeg = aResourceMgr->integerValue( "SMESH", "nb_segments_per_edge", 15 );
myComponentSMESH->SetDefaultNbSegments( nbSeg );
}
- else if ( name == "historical_python_dump" ||
- name == "forget_mesh_on_hyp_modif") {
+ else if ( name == "historical_python_dump" || name == "forget_mesh_on_hyp_modif" || name == "default_grp_color" )
+ {
QString val = aResourceMgr->stringValue( "SMESH", name );
myComponentSMESH->SetOption( name.toLatin1().constData(), val.toLatin1().constData() );
}
- else if ( name == QString( "numbering_node_color" ) || name == QString( "numbering_node_font" ) ) {
- SMESH::UpdateFontProp( this );
+ else if ( name == "numbering_node_color" || name == "numbering_node_font" )
+ {
+ SMESH::UpdateFontProp( this );
}
- else if ( name == QString( "numbering_elem_color" ) || name == QString( "numbering_elem_font" ) ) {
+ else if ( name == "numbering_elem_color" || name == "numbering_elem_font" )
+ {
SMESH::UpdateFontProp( this );
}
- if(aWarning.size() != 0){
+ if ( aWarning.size() != 0 ) {
aWarning += "The default values are applied instead.";
SUIT_MessageBox::warning(SMESHGUI::desktop(),
QObject::tr("SMESH_ERR_SCALARBAR_PARAMS"),
//=================================================================================
class SMESHGUI_EXPORT SMESHGUI : public SalomeApp_Module
{
- Q_OBJECT;
+ Q_OBJECT
public :
SMESHGUI();
disconnect( myDlg, SIGNAL( objectChanged( int, const QStringList& )),
this, SLOT ( onTextChanged( int, const QStringList& )));
+ connect( myDlg->myGroupListCmBox, SIGNAL( editTextChanged(const QString & )),
+ this, SLOT( updateButtons() ));
+
selectionDone();
}
static int FirstHexahedronIds[] = {0,1,2,3,4,5,6,7,0,1,2,3};
static int LastHexahedronIds[] = {1,2,3,0,5,6,7,4,4,5,6,7};
- static vector<int> FirstPolygonIds;
- static vector<int> LastPolygonIds;
+ static std::vector<int> FirstPolygonIds;
+ static std::vector<int> LastPolygonIds;
void ReverseConnectivity( std::vector<vtkIdType> & ids, SMDSAbs_EntityType type,
bool toReverse, // inverse element
: QDialog( SMESH::GetDesktop( theModule ) ),
mySMESHGUI( theModule ),
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
- myGeomType( theType ),
- myBusy( false )
+ myBusy( false ),
+ myGeomType( theType )
{
setModal( false );
setAttribute( Qt::WA_DeleteOnClose, true );
myNbCenterNodes = 1;
myHelpFileName = "adding_quadratic_elements_page.html#?"; //Adding_hexahedrons
break;
+ default:;
}
myMidFaceLabel ->setVisible( myNbMidFaceNodes );
anIds.push_back( aListId[ 0 ].toInt() );
}
break;
+ default:;
}
if ( myReverseCB->isChecked())
ReverseConnectivity( anIds, myGeomType, /*toReverse=*/true, /*toVtkOrder=*/false );
case SMESH::VOLUME:
myActor->SetRepresentation(SMESH_Actor::eSurface);
myActor->SetEntityMode( aMode |= SMESH_Actor::eVolumes ); break;
+ default:;
}
}
case SMDSEntity_Quad_Hexa:
case SMDSEntity_TriQuad_Hexa:
anElementType = SMESH::VOLUME; break;
+ default:;
}
myGroups.clear();
ComboBox_GroupName->clear();
okIDs.insert( anID );
}
- return okIDs.size() == myTable->rowCount() + myNbMidFaceNodes + myNbCenterNodes;
+ return (int) okIDs.size() == myTable->rowCount() + myNbMidFaceNodes + myNbCenterNodes;
}
//=================================================================================
aFirstColIds = FirstHexahedronIds;
aLastColIds = LastHexahedronIds;
break;
+ default:;
}
// fill the First and the Last columns
ComboBoxUnion->addItem(tr("RENAME"));
ComboBoxUnion->setCurrentIndex(0);
- CheckBoxMerge->setChecked(false);
+ CheckBoxMerge->setChecked(true);
TextLabelTol->setEnabled(CheckBoxMerge->isChecked());
SpinBoxTol->SetValue(1e-05);
//=================================================================================
class SMESHGUI_EXPORT SMESHGUI_BuildCompoundDlg : public QDialog
{
- Q_OBJECT;
+ Q_OBJECT
public:
if (myViewWindow)
SMESH::RenderViewWindow(myViewWindow);
- for( int i=0; i< myPlanes.size(); i++ ) {
+ for ( size_t i = 0; i < myPlanes.size(); i++ ) {
SMESH::TPlaneData aPlaneData = myPlanes[i];
aPlaneData.Plane->Delete();
}
- if (myPreviewWidget) {
+ if ( myPreviewWidget ) {
myPreviewWidget->Off();
myPreviewWidget->Delete();
}
anActorList.remove( anActor );
if( SMESH::ComputeBounds( anActorList, myBounds ) ) {
- myPreviewWidget->On();
myPreviewWidget->PlaceWidget( myBounds[0], myBounds[1], myBounds[2],
myBounds[3], myBounds[4], myBounds[5] );
+ if( PreviewCheckBox->isChecked() )
+ myPreviewWidget->On();
}
else
myPreviewWidget->Off();
bool anIsBlocked = ActorList->blockSignals( true );
if( SMESH::ComputeBounds( anActorList, myBounds ) ) {
- myPreviewWidget->On();
myPreviewWidget->PlaceWidget( myBounds[0], myBounds[1], myBounds[2],
myBounds[3], myBounds[4], myBounds[5] );
+ if( PreviewCheckBox->isChecked() )
+ myPreviewWidget->On();
}
else
myPreviewWidget->Off();
myIsSelectPlane = false;
if( SMESH::ComputeBounds( aPlaneData.ActorList, myBounds ) ) {
- myPreviewWidget->On();
myPreviewWidget->PlaceWidget( myBounds[0], myBounds[1], myBounds[2],
myBounds[3], myBounds[4], myBounds[5] );
+ if( PreviewCheckBox->isChecked() )
+ myPreviewWidget->On();
}
else
myPreviewWidget->Off();
#define MARGIN 11
#define COLONIZE(str) (QString(str).contains(":") > 0 ? QString(str) : QString(str) + " :" )
+#define __SHAPE_RGB__ 250, 0, 250
enum TCol {
COL_ALGO = 0, COL_SHAPE, COL_ERROR, COL_SHAPEID, COL_PUBLISHED, COL_BAD_MESH, NB_COLUMNS
{
myProperty = vtkProperty::New();
myProperty->SetRepresentationToWireframe();
- myProperty->SetColor( 250, 0, 250 );
- myProperty->SetAmbientColor( 250, 0, 250 );
- myProperty->SetDiffuseColor( 250, 0, 250 );
- //myProperty->SetSpecularColor( 250, 0, 250 );
+ myProperty->SetColor( __SHAPE_RGB__ );
+ myProperty->SetAmbientColor( __SHAPE_RGB__ );
+ myProperty->SetDiffuseColor( __SHAPE_RGB__ );
+ //myProperty->SetSpecularColor( __SHAPE_RGB__ );
myProperty->SetLineWidth( 5 );
}
// -----------------------------------------------------------------------
GEOM_Actor* getActor(const TopoDS_Shape& shape)
{
int index = myIndexToShape.FindIndex( shape ) - 1;
- if ( index < 0 || index >= myActors.size() )
+ if ( index < 0 || index >= (int) myActors.size() )
return 0;
GEOM_Actor* & actor = myActors[ index ];
if ( !actor ) {
actor = GEOM_Actor::New();
if ( actor ) {
actor->SetShape(shape,0,0);
- actor->SetProperty(myProperty);
- actor->SetShadingProperty(myProperty);
- actor->SetWireframeProperty(myProperty);
- actor->SetPreviewProperty(myProperty);
+ // actor->SetProperty(myProperty);
+ // actor->SetShadingProperty(myProperty);
+ // actor->SetWireframeProperty(myProperty);
+ // actor->SetPreviewProperty(myProperty);
actor->PickableOff();
- // if ( shape.ShapeType() == TopAbs_EDGE )
- // actor->SubShapeOn();
+ //
+ actor->SetWidth( myProperty->GetLineWidth() );
+ actor->SetIsosWidth( myProperty->GetLineWidth() );
+ actor->SetIsosColor( __SHAPE_RGB__ );
+ actor->SetColor( __SHAPE_RGB__ );
+ // if ( shape.ShapeType() == TopAbs_EDGE )
+ // actor->SubShapeOn();
myViewWindow->AddActor( actor );
}
}
//================================================================================
//================================================================================
-SMESHGUI_ComputeDlg_QThreadQDialog::SMESHGUI_ComputeDlg_QThreadQDialog(QWidget * parent,
- SMESH::SMESH_Gen_var gen,
- SMESH::SMESH_Mesh_var mesh,
- GEOM::GEOM_Object_var mainShape)
+SMESHGUI_ComputeDlg_QThreadQDialog::
+SMESHGUI_ComputeDlg_QThreadQDialog(QWidget * parent,
+ SMESH::SMESH_Gen_var gen,
+ SMESH::SMESH_Mesh_var mesh,
+ GEOM::GEOM_Object_var mainShape)
: QDialog(parent,
Qt::WindowSystemMenuHint |
Qt::WindowCloseButtonHint |
#endif
aCompErrors = gen->GetComputeErrors( myMesh, myMainShape );
// check if there are memory problems
- for ( int i = 0; (i < aCompErrors->length()) && !memoryLack; ++i )
+ for ( CORBA::ULong i = 0; (i < aCompErrors->length()) && !memoryLack; ++i )
memoryLack = ( aCompErrors[ i ].code == SMESH::COMPERR_MEMORY_PB );
}
catch(const SALOME::SALOME_Exception & S_ex) {
if ( !memoryLack )
{
// List of objects that will be updated automatically
- QList< QPair< SMESH::SMESH_IDSource_var, _PTR(SObject) > > aListToUpdate;
- SMESH::SMESH_IDSource_var aMeshObj = SMESH::SObjectToInterface<SMESH::SMESH_IDSource>( aMeshSObj );
+ typedef QList< QPair< SMESH::SMESH_IDSource_var, _PTR(SObject) > > TListOf_IDSrc_SObj;
+ TListOf_IDSrc_SObj aListToUpdate;
+ SMESH::SMESH_IDSource_var aMeshObj =
+ SMESH::SObjectToInterface<SMESH::SMESH_IDSource>( aMeshSObj );
// put Mesh into list
- aListToUpdate.append( QPair< SMESH::SMESH_IDSource_var, _PTR(SObject) >(aMeshObj, aMeshSObj) );
+ aListToUpdate.append( TListOf_IDSrc_SObj::value_type( aMeshObj, aMeshSObj ));
SMESH::submesh_array_var aSubMeshes = myMesh->GetSubMeshes();
// put SubMeshes into list
- for ( int i = 0; i < aSubMeshes->length(); i++ ) {
+ for ( CORBA::ULong i = 0; i < aSubMeshes->length(); i++ )
+ {
SMESH::SMESH_subMesh_var sm = aSubMeshes[i];
if ( CORBA::is_nil( sm ) ) continue;
_PTR(SObject) smSObj = SMESH::ObjectToSObject( sm );
if ( !smSObj ) continue;
- SMESH::SMESH_IDSource_var aSubMeshObj = SMESH::SObjectToInterface<SMESH::SMESH_IDSource>( smSObj );
- aListToUpdate.append( QPair< SMESH::SMESH_IDSource_var, _PTR(SObject) >(aSubMeshObj, smSObj) );
+ SMESH::SMESH_IDSource_var aSubMeshObj =
+ SMESH::SObjectToInterface<SMESH::SMESH_IDSource>( smSObj );
+ aListToUpdate.append( TListOf_IDSrc_SObj::value_type( aSubMeshObj, smSObj ));
}
// put Groups into list
- SMESH::ListOfGroups_var aGroups = myMesh->GetGroups();
- for ( size_t i = 0; i < aGroups->length(); ++i ) {
+ SMESH::ListOfGroups_var aGroups = myMesh->GetGroups();
+ for ( size_t i = 0; i < aGroups->length(); ++i )
+ {
SMESH::SMESH_GroupBase_var aGrp = aGroups[i];
if ( CORBA::is_nil( aGrp ) ) continue;
SMESH::SMESH_Group_var aStdGroup = SMESH::SMESH_Group::_narrow( aGrp );
if ( !aStdGroup->_is_nil() ) continue; // don't update the standalone groups
_PTR(SObject) aGroupSO = SMESH::FindSObject( aGrp );
if ( !aGroupSO ) continue;
- SMESH::SMESH_IDSource_var aGroupObj = SMESH::SObjectToInterface<SMESH::SMESH_IDSource>( aGroupSO );
- aListToUpdate.append( QPair< SMESH::SMESH_IDSource_var, _PTR(SObject) >(aGroupObj, aGroupSO) );
+ SMESH::SMESH_IDSource_var aGroupObj =
+ SMESH::SObjectToInterface<SMESH::SMESH_IDSource>( aGroupSO );
+ aListToUpdate.append( TListOf_IDSrc_SObj::value_type( aGroupObj, aGroupSO ));
}
// update mesh, sub-mesh and groups, if it's possible
- QList< QPair< SMESH::SMESH_IDSource_var, _PTR(SObject) > >::iterator anIter;
- for( anIter = aListToUpdate.begin(); anIter != aListToUpdate.end(); anIter++ ) {
- SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow( SMESH::SObjectToObject( (*anIter).second ));
- if ( getSMESHGUI()->automaticUpdate( (*anIter).first, &entities, &limitExceeded, &hidden, &nbElements ) )
+ TListOf_IDSrc_SObj::iterator anIter;
+ for ( anIter = aListToUpdate.begin(); anIter != aListToUpdate.end(); anIter++ )
+ {
+ SMESH::SMESH_Mesh_var aMesh =
+ SMESH::SMESH_Mesh::_narrow( SMESH::SObjectToObject( (*anIter).second ));
+
+ if ( getSMESHGUI()->automaticUpdate( (*anIter).first, &entities, &limitExceeded,
+ &hidden, &nbElements ) )
{
try {
-#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
OCC_CATCH_SIGNALS;
-#endif
bool toDisplay = false;
-
- if ( !aMesh->_is_nil() ) { // display a mesh only
+ if ( !aMesh->_is_nil() ) // display only a mesh
+ {
toDisplay = true;
SMESH_Actor *anActor = SMESH::FindActorByObject( aMesh );
- if ( !anActor ) anActor = SMESH::CreateActor( (*anIter).second->GetStudy(), (*anIter).second->GetID().c_str(), true );
+ if ( !anActor ) anActor = SMESH::CreateActor( (*anIter).second->GetStudy(),
+ (*anIter).second->GetID().c_str(),
+ /*clearLog =*/ true );
if ( anActor ) // actor is not created for an empty mesh
{
anActor->SetEntityMode( entities );
if ( hidden & SMESH_Actor::eBallElem ) hiddenMsg << tr( "SMESH_BALLS" );
SUIT_MessageBox::warning( desktop(),
tr( "SMESH_WRN_WARNING" ),
- tr( "SMESH_WRN_SIZE_INC_LIMIT_EXCEEDED" ).arg( nbElements ).arg( limitSize ).arg( hiddenMsg.join(", ") ) );
+ tr( "SMESH_WRN_SIZE_INC_LIMIT_EXCEEDED" ).
+ arg( nbElements ).
+ arg( limitSize ).
+ arg( hiddenMsg.join(", ")));
}
}
catch (...) {
{
SUIT_MessageBox::warning( desktop(),
tr( "SMESH_WRN_WARNING" ),
- tr( "SMESH_WRN_SIZE_LIMIT_EXCEEDED" ).arg( nbElements ).arg( limitSize ) );
+ tr( "SMESH_WRN_SIZE_LIMIT_EXCEEDED" ).
+ arg( nbElements ).arg( limitSize ) );
}
}
}
- LightApp_SelectionMgr *Sel = selectionMgr();
- if ( Sel )
+ if ( LightApp_SelectionMgr *Sel = selectionMgr() )
{
SALOME_ListIO selected;
selected.Append( myIObject );
if ( memoryLack )
aMemoryReserve.release();
- myCompDlg->setWindowTitle(tr( computeFailed ? "SMESH_WRN_COMPUTE_FAILED" : "SMESH_COMPUTE_SUCCEED"));
+ myCompDlg->setWindowTitle
+ ( tr( computeFailed ? "SMESH_WRN_COMPUTE_FAILED" : "SMESH_COMPUTE_SUCCEED" ));
// SHOW ERRORS
-
+
bool noCompError = ( !aCompErrors.operator->() || aCompErrors->length() == 0 );
bool noHypoError = ( aHypErrors.isEmpty() );
else
{
bool onlyWarnings = !theNoCompError; // == valid mesh computed but there are errors reported
- for ( int i = 0; i < theCompErrors->length() && onlyWarnings; ++i )
+ for ( CORBA::ULong i = 0; i < theCompErrors->length() && onlyWarnings; ++i )
onlyWarnings = ( theCompErrors[ i ].code == SMESH::COMPERR_WARNING ||
theCompErrors[ i ].code == SMESH::COMPERR_NO_MESH_ON_SHAPE );
tbl->setColumnWidth( COL_ERROR, 200 );
bool hasBadMesh = false;
- for ( int row = 0; row < theCompErrors->length(); ++row )
+ for ( int row = 0; row < (int) theCompErrors->length(); ++row )
{
SMESH::ComputeError & err = theCompErrors[ row ];
if ( !SMESH::getSubShapeSO( 1, myMainShape )) // the main shape not published
{
QString name = GEOMBase::GetDefaultName( SMESH::shapeTypeName( myMainShape, "MAIN_SHAPE" ));
- SALOMEDS::SObject_wrap so =
- geomGen->AddInStudy( study, myMainShape, name.toLatin1().data(), GEOM::GEOM_Object::_nil());
+ SALOMEDS::SObject_wrap so = geomGen->AddInStudy( study, myMainShape,
+ name.toLatin1().data(),
+ GEOM::GEOM_Object::_nil());
// look for myMainShape in the table
for ( int r = 0, nr = table()->rowCount(); r < nr; ++r ) {
if ( table()->item( r, COL_SHAPEID )->text() == "1" ) {
if ( curSub == 1 ) continue;
}
QString name = GEOMBase::GetDefaultName( SMESH::shapeTypeName( shape, "ERROR_SHAPE" ));
- SALOMEDS::SObject_wrap so = geomGen->AddInStudy( study, shape, name.toLatin1().data(), myMainShape);
+ SALOMEDS::SObject_wrap so = geomGen->AddInStudy( study, shape,
+ name.toLatin1().data(), myMainShape);
if ( !so->_is_nil() ) {
CORBA::String_var name = so->GetName();
CORBA::String_var entry = so->GetID();
//================================================================================
/*!
* \brief Constructor
-*/
+ */
//================================================================================
SMESHGUI_PrecomputeOp::SMESHGUI_PrecomputeOp()
: SMESHGUI_BaseComputeOp(),
- myDlg( 0 ),
- myOrderMgr( 0 ),
myActiveDlg( 0 ),
- myPreviewDisplayer( 0 )
+ myDlg( 0 ),
+ myPreviewDisplayer( 0 ),
+ myOrderMgr( 0 )
{
}
myOrderMgr = new SMESHGUI_MeshOrderMgr( myDlg->getMeshOrderBox() );
myOrderMgr->SetMesh( myMesh );
bool isOrder = myOrderMgr->GetMeshOrder(myPrevOrder);
- myDlg->getMeshOrderBox()->setShown(isOrder);
+ myDlg->getMeshOrderBox()->setVisible(isOrder);
if ( !isOrder ) {
delete myOrderMgr;
myOrderMgr = 0;
}
// check sub-meshes
- for ( aPart = SMESH::Tag_SubMeshOnEdge; aPart < SMESH::Tag_LastSubMesh; ++aPart )
+ for ( aPart = SMESH::Tag_SubMeshOnEdge; aPart <= SMESH::Tag_LastSubMesh; ++aPart )
{
if ( !theMesh->FindSubObject( aPart, aHypFolder ))
continue;
#endif
aCompErrors = gen->GetComputeErrors( myMesh, myMainShape );
// check if there are memory problems
- for ( int i = 0; (i < aCompErrors->length()) && !memoryLack; ++i )
+ for ( CORBA::ULong i = 0; (i < aCompErrors->length()) && !memoryLack; ++i )
memoryLack = ( aCompErrors[ i ].code == SMESH::COMPERR_MEMORY_PB );
}
catch(const SALOME::SALOME_Exception & S_ex){
if ( isShowError )
{
myDlg->hide();
- aCompDlg->setWindowTitle(tr( computeFailed ? "SMESH_WRN_COMPUTE_FAILED" : "SMESH_COMPUTE_SUCCEED"));
+ aCompDlg->setWindowTitle
+ ( tr( computeFailed ? "SMESH_WRN_COMPUTE_FAILED" : "SMESH_COMPUTE_SUCCEED" ));
showComputeResult( memoryLack, noCompError, aCompErrors, noHypoError, aHypErrors );
}
}
aMemoryReserve.release();
evaluateFailed = ( aCompErrors->length() > 0 );
- myCompDlg->setWindowTitle(tr( evaluateFailed ? "SMESH_WRN_EVALUATE_FAILED" : "SMESH_EVALUATE_SUCCEED"));
+ myCompDlg->setWindowTitle
+ ( tr( evaluateFailed ? "SMESH_WRN_EVALUATE_FAILED" : "SMESH_EVALUATE_SUCCEED" ));
// SHOW ERRORS
-
+
bool noCompError = ( !aCompErrors.operator->() || aCompErrors->length() == 0 );
bool noHypoError = ( aHypErrors.isEmpty() );
tbl->setColumnWidth( COL_ERROR, 200 );
bool hasBadMesh = false;
- for ( int row = 0; row < theCompErrors->length(); ++row )
+ for ( int row = 0; row < (int) theCompErrors->length(); ++row )
{
SMESH::ComputeError & err = theCompErrors[ row ];
: QDialog( SMESH::GetDesktop( theModule ) ),
mySMESHGUI( theModule ),
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
- myFilterDlg(0),
mySelectedObject(SMESH::SMESH_IDSource::_nil()),
+ myFilterDlg(0),
myIsApplyAndClose( false )
{
QPixmap image (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_COPY_MESH")));
void SMESHGUI_CopyMeshDlg::SelectionIntoArgument()
{
if (myBusy) return;
+ if (myFilterDlg && myFilterDlg->isVisible()) return; // filter dlg active
+ if (!GroupButtons->isEnabled()) return; // inactive
+
BusyLocker lock( myBusy );
// clear
if ( !myFilterDlg )
myFilterDlg = new SMESHGUI_FilterDlg( mySMESHGUI, SMESH::ALL );
+ QList<int> types;
+ if ( myMesh->NbEdges() ) types << SMESH::EDGE;
+ if ( myMesh->NbFaces() ) types << SMESH::FACE;
+ if ( myMesh->NbVolumes() ) types << SMESH::VOLUME;
+ if ( myMesh->NbBalls() ) types << SMESH::BALL;
+ if ( myMesh->Nb0DElements()) types << SMESH::ELEM0D;
+ if ( types.count() > 1 ) types << SMESH::ALL;
+
+ myFilterDlg->Init( types );
myFilterDlg->SetSelection();
myFilterDlg->SetMesh( myMesh );
myFilterDlg->SetSourceWg( myLineEditElements );
SUIT_FileDlg* aDlg = new SUIT_FileDlg( this, false );
aDlg->setWindowTitle( tr( "SAVE_PATTERN" ) );
aDlg->setFileMode( QFileDialog::AnyFile );
- aDlg->setFilter( tr( "PATTERN_FILT" ) );
+ aDlg->setNameFilter( tr( "PATTERN_FILT" ) );
if ( myName->text() != "" )
aDlg->selectFile( myName->text() );
if ( QFileInfo( fName ).suffix().isEmpty() )
fName = autoExtension( fName );
- fName = QDir::convertSeparators( fName );
+ fName = QDir::toNativeSeparators( fName );
QString aData( myPattern->GetString() );
long aLen = aData.length();
//=================================================================================
SMESHGUI_DeleteGroupDlg::SMESHGUI_DeleteGroupDlg (SMESHGUI* theModule):
QDialog(SMESH::GetDesktop(theModule)),
- mySelectionMgr(SMESH::GetSelectionMgr(theModule)),
- mySMESHGUI(theModule)
+ mySMESHGUI(theModule),
+ mySelectionMgr(SMESH::GetSelectionMgr(theModule))
{
setModal(false);
setWindowTitle(tr("CAPTION"));
SMESH::SMESH_IDSource_var idSrc =
aMeshEditor->MakeIDSource( ids, SMESH::ElementType( iType+1 ));
- if ( myIDSource[ iType ]->length() <= index )
+ if ( (int) myIDSource[ iType ]->length() <= index )
myIDSource[ iType ]->length( index + 1 );
myIDSource[ iType ][ index ] = idSrc;
{
int nbSelected = 0;
if ( myTree->isEnabled() )
- for ( size_t i = 0; i < myTree->topLevelItemCount(); ++i )
+ for ( int i = 0; i < myTree->topLevelItemCount(); ++i )
{
QTreeWidgetItem* meshItem = myTree->topLevelItem( i );
int iM = meshItem->data( 0, Qt::UserRole ).toInt();
}
else
{
- for ( size_t iF = 0; iF < myFields->count(); ++iF )
+ for ( int iF = 0; iF < myFields->count(); ++iF )
{
GEOM::ListOfFields& fields = (*myFields)[ iF ].first.inout();
fields.length( 0 );
QWidget* parent,
const int type )
: QWidget( parent ),
- myIsLocked( false ),
- mySMESHGUI( theModule )
+ mySMESHGUI( theModule ),
+ myIsLocked( false )
{
myEntityType = -1;
QWidget* parent,
const QList<int>& types )
: QWidget( parent ),
- myIsLocked( false ),
- mySMESHGUI( theModule )
+ mySMESHGUI( theModule ),
+ myIsLocked( false )
{
myEntityType = -1;
Init(types);
bool aRes = false;
bool isSignalsBlocked = aTable->signalsBlocked();
aTable->blockSignals(true);
- double aThreshold = (int)aTable->text(i, 2).toDouble(&aRes);
+ /*double aThreshold =*/ aTable->text(i, 2).toDouble( &aRes );
aTable->blockSignals(isSignalsBlocked);
if (!aRes && aTable->isEditable(i, 2))
if (!myFilter[ aCurrType ]->GetPredicate()->_is_nil()) {
//
- bool toFilter = (( SMESH::FindActorByObject( myMesh )) ||
+ bool toFilter = (( getActor() ) ||
( myInitSourceWgOnApply && mySourceWg ) ||
( mySourceGrp->checkedId() == Dialog && mySourceWg ));
if ( toFilter ) {
if ( mgr && mgr->booleanValue( "SMESH", "use_precision", false ) )
aPrecision = mgr->integerValue( "SMESH", "controls_precision", aPrecision );
- for (CORBA::ULong i = 0; i < n; i++) {
+ for ( int i = 0; i < n; i++) {
SMESH::Filter::Criterion aCriterion = createCriterion();
myTable->GetCriterion(i, aCriterion);
aCriterion.Precision = aPrecision;
theResIds.append(aResIter.Key());
}
+//=======================================================================
+//function : getActor
+//purpose : Returns an actor to show filtered entities
+//=======================================================================
+
+SMESH_Actor* SMESHGUI_FilterDlg::getActor()
+{
+ SMESH_Actor* meshActor = SMESH::FindActorByObject( myMesh );
+ if ( meshActor && meshActor->GetVisibility() )
+ return meshActor;
+
+ SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger anIter(myIObjects);
+ for ( ; anIter.More(); anIter.Next())
+ {
+ Handle(SALOME_InteractiveObject) io = anIter.Key();
+ if ( io->hasEntry() )
+ {
+ SMESH_Actor* actor = SMESH::FindActorByEntry( io->getEntry() );
+ if ( !actor )
+ continue;
+ if ( actor->GetVisibility() )
+ return actor;
+ if ( !meshActor )
+ meshActor = actor;
+ }
+ }
+ return meshActor;
+}
+
//=======================================================================
// name : SMESHGUI_FilterDlg::selectInViewer
// Purpose : Select given entities in viewer
}
// Clear selection
- SMESH_Actor* anActor = SMESH::FindActorByObject(myMesh);
- if (!anActor || !anActor->hasIO())
+ SMESH_Actor* anActor = getActor();
+ if ( !anActor || !anActor->hasIO() )
return;
Handle(SALOME_InteractiveObject) anIO = anActor->getIO();
#include CORBA_SERVER_HEADER(SMESH_Filter)
#include CORBA_SERVER_HEADER(SMESH_Mesh)
-class QFrame;
+class LightApp_SelectionMgr;
class QButtonGroup;
class QCheckBox;
+class QFrame;
class QGroupBox;
class QPushButton;
+class QStackedWidget;
class QTableWidget;
class QTableWidgetItem;
-class QStackedWidget;
-class LightApp_SelectionMgr;
class SMESHGUI;
class SMESHGUI_FilterLibraryDlg;
+class SMESH_Actor;
class SVTK_Selector;
/*!
void setIdsToWg( QWidget*, const QList<int>& );
Selection_Mode getSelMode( const int ) const;
void updateSelection();
+ SMESH_Actor* getActor();
private:
// widgets
//aDlg->setMode(myMode == COPY_FROM ? QFileDialogP::ExistingFile : QFileDialogP::AnyFile);
aDlg->setFileMode(myMode == COPY_FROM ? QFileDialog::ExistingFile : QFileDialog::AnyFile);
- aDlg->setFilters(prepareFilters());
+ aDlg->setNameFilters(prepareFilters());
aDlg->selectFile(getFileName());
QPushButton* anOkBtn = (QPushButton*)aDlg->findChild<QPushButton*>("OK");
if (QFileInfo(fName).suffix().isEmpty())
fName = autoExtension(fName);
- fName = QDir::convertSeparators(fName);
- QString prev = QDir::convertSeparators(getFileName());
+ fName = QDir::toNativeSeparators(fName);
+ QString prev = QDir::toNativeSeparators(getFileName());
if (prev == fName)
return;
if (QFileInfo(fName).suffix().isEmpty())
fName = autoExtension(fName);
- fName = QDir::convertSeparators(fName);
+ fName = QDir::toNativeSeparators(fName);
if (QFileInfo(fName).exists()) {
isWritable = QFileInfo(fName).isWritable();
myElemTypeCombo->blockSignals(true);
myElemTypeCombo->clear();
int nbTypes = 0, hasNodes = 0;
- for ( int i = 0; i < types->length(); ++i )
+ for ( int i = 0; i < (int) types->length(); ++i )
{
switch ( types[i] ) {
case SMESH::NODE:
myDlg->myZ->GetValue(),
SMESH::ElementType( myDlg->myElemTypeCombo->currentId()));
myDlg->myFoundList->clear();
- for ( int i = 0; i < foundIds->length(); ++i )
+ for ( int i = 0; i < (int) foundIds->length(); ++i )
myDlg->myFoundList->addItem( QString::number( foundIds[i] ));
if ( foundIds->length() > 0 )
mySelector( SMESH::GetViewWindow( theModule )->GetSelector() ),
myIsBusy( false ),
myNameChanged( false ),
- myIsApplyAndClose( false ),
- myNbChangesOfContents(0)
+ myNbChangesOfContents(0),
+ myIsApplyAndClose( false )
{
initDialog( true );
if ( !theMesh->_is_nil() )
case SMESH::EDGE: aType = grpEdgeSelection; break;
case SMESH::FACE: aType = grpFaceSelection; break;
case SMESH::VOLUME: aType = grpVolumeSelection; break;
+ case SMESH::ALL:
+ case SMESH::NB_ELEMENT_TYPES: break;
}
myTypeGroup->button(aType)->setChecked(true);
// check and add all selected GEOM objects: they must be
// a sub-shapes of the main GEOM and must be of one type
TopAbs_ShapeEnum aGroupType = TopAbs_SHAPE;
- for ( int i =0; i < myGeomObjects->length(); i++) {
+ for ( int i =0; i < (int)myGeomObjects->length(); i++) {
TopAbs_ShapeEnum aSubShapeType = (TopAbs_ShapeEnum)myGeomObjects[i]->GetShapeType();
if (i == 0)
aGroupType = aSubShapeType;
mesh = myGroupOnFilter->GetMesh();
}
myFilter->SetMesh( mesh );
+
+ // highlight ids if selection changed in the Viewer (IPAL52924)
+ myCurrentLineEdit = 0;
+ onObjectSelectionChanged();
}
updateButtons();
}
}
else if (myCurrentLineEdit == myGroupLine) {
- Standard_Boolean aRes;
- //SALOME_ListIteratorOfListIO anIt (mySelectionMgr->StoredIObjects());
SALOME_ListIO aList;
mySelectionMgr->selectedObjects( aList );
SALOME_ListIteratorOfListIO anIt (aList);
for ( ; anIt.More(); anIt.Next()) {
SMESH::SMESH_Group_var aGroup = SMESH::IObjectToInterface<SMESH::SMESH_Group>(anIt.Value());
- if (aRes && !aGroup->_is_nil()) {
+ if (!aGroup->_is_nil()) {
// check if mesh is the same
if (aGroup->GetType() == aType && aGroup->GetMesh()->GetId() == myMesh->GetId()) {
SMESH::long_array_var anElements = aGroup->GetListOfID();
{
LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
if (app)
- app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString( "" ), myHelpFileName);
- else {
- QString platform;
+ {
+ app->onHelpContextModule
+ ( mySMESHGUI ? app->moduleName( mySMESHGUI->moduleName() ) : QString(""), myHelpFileName );
+ }
+ else
+ {
#ifdef WIN32
- platform = "winapplication";
+ QString platform = "winapplication";
#else
- platform = "application";
+ QString platform = "application";
#endif
SUIT_MessageBox::warning(this, tr( "WRN_WARNING" ),
tr( "EXTERNAL_BROWSER_CANNOT_SHOW_PAGE" ).
- arg(app->resourceMgr()->stringValue( "ExternalBrowser",
- platform)).
+ arg(app->resourceMgr()->stringValue( "ExternalBrowser", platform)).
arg(myHelpFileName));
}
}
return;
if ( e->key() == Qt::Key_F1 )
- {
- e->accept();
- onHelp();
- }
+ {
+ e->accept();
+ onHelp();
+ }
}
//================================================================================
/*!
* \brief Enable showing of the popup when Geometry selection btn is clicked
- * \param enable - true to enable
+ * \param enable - true to enable
*/
//================================================================================
void SMESHGUI_GroupDlg::onGeomSelectionButton(bool isBtnOn)
{
if ( myGeomPopup && isBtnOn )
- {
- myCurrentLineEdit = myGeomGroupLine;
- QAction* a = myGeomPopup->exec( QCursor::pos() );
- if (!a || myActions[a] == DIRECT_GEOM_INDEX)
- setSelectionMode(grpGeomSelection);
- }
+ {
+ myCurrentLineEdit = myGeomGroupLine;
+ QAction* a = myGeomPopup->exec( QCursor::pos() );
+ if (!a || myActions[a] == DIRECT_GEOM_INDEX)
+ setSelectionMode(grpGeomSelection);
+ }
else if (!isBtnOn)
- {
- myCurrentLineEdit = 0;
- setSelectionMode(grpAllSelection);
- }
+ {
+ myCurrentLineEdit = 0;
+ setSelectionMode(grpAllSelection);
+ }
}
//=================================================================================
{
int index = myActions[a];
if ( index == GEOM_BY_MESH_INDEX )
- {
- mySelectionMode = grpNoSelection;
- if ( !myShapeByMeshOp ) {
- myShapeByMeshOp = new SMESHGUI_ShapeByMeshOp(true);
- connect(myShapeByMeshOp, SIGNAL(committed(SUIT_Operation*)),
- SLOT(onPublishShapeByMeshDlg(SUIT_Operation*)));
- connect(myShapeByMeshOp, SIGNAL(aborted(SUIT_Operation*)),
- SLOT(onCloseShapeByMeshDlg(SUIT_Operation*)));
- }
- // set mesh object to SMESHGUI_ShapeByMeshOp and start it
- if ( !myMesh->_is_nil() ) {
- myIsBusy = true;
- hide(); // stop processing selection
- myIsBusy = false;
- myShapeByMeshOp->setModule( mySMESHGUI );
- myShapeByMeshOp->setStudy( 0 ); // it's really necessary
- myShapeByMeshOp->SetMesh( myMesh );
- myShapeByMeshOp->start();
- }
+ {
+ mySelectionMode = grpNoSelection;
+ if ( !myShapeByMeshOp ) {
+ myShapeByMeshOp = new SMESHGUI_ShapeByMeshOp(true);
+ connect(myShapeByMeshOp, SIGNAL(committed(SUIT_Operation*)),
+ SLOT(onPublishShapeByMeshDlg(SUIT_Operation*)));
+ connect(myShapeByMeshOp, SIGNAL(aborted(SUIT_Operation*)),
+ SLOT(onCloseShapeByMeshDlg(SUIT_Operation*)));
+ }
+ // set mesh object to SMESHGUI_ShapeByMeshOp and start it
+ if ( !myMesh->_is_nil() ) {
+ myIsBusy = true;
+ hide(); // stop processing selection
+ myIsBusy = false;
+ myShapeByMeshOp->setModule( mySMESHGUI );
+ myShapeByMeshOp->setStudy( 0 ); // it's really necessary
+ myShapeByMeshOp->SetMesh( myMesh );
+ myShapeByMeshOp->start();
}
+ }
}
//================================================================================
void SMESHGUI_GroupDlg::onCloseShapeByMeshDlg(SUIT_Operation* op)
{
if ( myShapeByMeshOp == op )
- {
- show();
- setSelectionMode(grpGeomSelection);
- }
+ {
+ show();
+ setSelectionMode(grpGeomSelection);
+ }
}
//=================================================================================
#include "SMESHGUI_Utils.h"
#include "SMESHGUI_VTKUtils.h"
#include "SMESH_TypeFilter.hxx"
+#include <SMESH_ActorUtils.h>
#include <LightApp_Application.h>
#include <LightApp_SelectionMgr.h>
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->SetSelectionMode(ActorSelection);
mySelectionMgr->installFilter(new SMESH_TypeFilter (SMESH::GROUP));
+
+ setDefaultGroupColor();
}
/*!
return aColor;
}
+/*!
+ \brief Set default color for group
+*/
+void SMESHGUI_GroupOpDlg::setDefaultGroupColor()
+{
+ myColorBtn->setColor( SMESH::GetColor( "SMESH", "default_grp_color", QColor( 255, 170, 0 ) ) );
+}
+
/*!
\brief SLOT, called when selection is changed. Current implementation does
nothing. The method should be redefined in derived classes to update
{
myNameEdit->setText("");
myNameEdit->setFocus();
+ setDefaultGroupColor();
}
/*!
SMESH::ListOfGroups* convert( const QList<SMESH::SMESH_GroupBase_var>& );
SALOMEDS::Color getColor() const;
+ void setDefaultGroupColor();
void setIsApplyAndClose( const bool theFlag );
bool isApplyAndClose() const;
#include <SUIT_ResourceMgr.h>
#include <SUIT_Session.h>
#include <SalomeApp_IntSpinBox.h>
+#include <SalomeApp_Tools.h>
// Qt includes
#include <QFrame>
}
}
break;
- }
+
+ default:;
+ } // switch( (*anIt).myValue.type() )
if( w )
{
bool res = result==QDialog::Accepted;
if( res )
{
- SUIT_OverrideCursor wc;
- /*QString paramValues = */storeParams();
+ try
+ {
+ SUIT_OverrideCursor wc;
+ storeParams();
// No longer needed since NoteBook appears and "Value" OB field shows names of variable
-// if ( !paramValues.isEmpty() ) {
-// if ( _PTR(SObject) SHyp = SMESH::FindSObject( myHypo ))
-// SMESH::SetValue( SHyp, paramValues );
-// }
+ // QString paramValues = storeParams();
+ // if ( !paramValues.isEmpty() ) {
+ // if ( _PTR(SObject) SHyp = SMESH::FindSObject( myHypo ))
+ // SMESH::SetValue( SHyp, paramValues );
+ // }
+ }
+ catch ( const SALOME::SALOME_Exception& S_ex ) {
+ SalomeApp_Tools::QtCatchCorbaException( S_ex );
+ }
}
changeWidgets().clear();
{
SMESH::SObjectList listSOmesh = SMESH::GetMeshesUsingAlgoOrHypothesis( myHypo );
if( listSOmesh.size() > 0 )
- for( int i = 0; i < listSOmesh.size(); i++ )
+ for( size_t i = 0; i < listSOmesh.size(); i++ )
{
_PTR(SObject) submSO = listSOmesh[i];
SMESH::SMESH_Mesh_var aMesh = SMESH::SObjectToInterface<SMESH::SMESH_Mesh>( submSO );
{
QString valueStr = "";
ListOfStdParams::const_iterator param = params.begin(), aLast = params.end();
- uint len0 = 0;
- for( int i=0; param!=aLast; param++, i++ )
+ int len0 = 0;
+ for ( ; param != aLast; param++ )
{
if ( valueStr.length() > len0 ) {
valueStr += "; ";
Context( theContext ),
Dim( theDim ),
IsAuxOrNeedHyp( theIsAuxOrNeedHyp ),
+ IsNeedGeometry( theIsNeedGeometry ),
+ IsSupportSubmeshes( supportSub ),
BasicHypos( theBasicHypos ),
OptionalHypos( theOptionalHypos ),
InputTypes( theInputTypes ),
- OutputTypes( theOutputTypes ),
- IsNeedGeometry( theIsNeedGeometry ),
- IsSupportSubmeshes( supportSub )
+ OutputTypes( theOutputTypes )
{
}
{
SMESH_Hypothesis_var hypo = SMESH_Hypothesis::_narrow( SObjectToObject( aHypObj ) );
SObjectList meshList = GetMeshesUsingAlgoOrHypothesis( hypo );
- for( int i = 0; i < meshList.size(); i++ )
+ for( size_t i = 0; i < meshList.size(); i++ )
RemoveHypothesisOrAlgorithmOnMesh( meshList[ i ], hypo );
}
}
QString GetMessageOnAlgoStateErrors(const algo_error_array& errors)
{
QString resMsg; // PAL14861 = QObject::tr("SMESH_WRN_MISSING_PARAMETERS") + ":\n";
- for ( int i = 0; i < errors.length(); ++i ) {
+ for ( size_t i = 0; i < errors.length(); ++i ) {
const SMESH::AlgoStateError & error = errors[ i ];
const bool hasAlgo = ( strlen( error.algoName ) != 0 );
QString msg;
_PTR(SObject) sobj =
SMESHGUI::activeStudy()->studyDS()->FindObjectID( ids[i].toLatin1().constData() );
mySrcMesh = SMESH::SObjectToInterface<SMESH::SMESH_Mesh>( sobj );
- isMesh = !mySrcMesh->_is_nil();
+ //isMesh = !mySrcMesh->_is_nil(); // EAP - it's sometimes necessary to copy to a new mesh
}
myDlg->setNewMeshEnabled( isMesh );
}
idSource = SMESH::SObjectToInterface<SMESH::SMESH_IDSource>( sobj );
if ( !idSource->_is_nil() ) {
SMESH::array_of_ElementType_var types = idSource->GetTypes();
- for ( int j = 0; j < types->length(); ++j )
+ for ( int j = 0; j < (int) types->length(); ++j )
if ( types[j] == SMESH::VOLUME )
hasVolumes = true;
else if ( types[j] == SMESH::FACE )
#define SPACING 6
#define MARGIN 11
+namespace
+{
+ enum { MANUAL_MODE = 0, SEARCH_MODE }; // how a node to move is specified
+}
+
/*!
* \brief Dialog to publish a sub-shape of the mesh main shape
* by selecting mesh elements
myDlg->myDestDZ->setReadOnly(true);
myDlg->myRButNodeToMove->setChecked(true);
- myDlg->ConstructorsClicked(GetConstructorId());
+ myDlg->ConstructorsClicked( GetConstructorId() );
myDlg->show();
mySimulation = 0;
}
if ( myMeshActor ) {
- myMeshActor->SetPointRepresentation(false);
- SMESH::RepaintCurrentView();
myMeshActor = 0;
}
+ SMESH::SetPointRepresentation( false );
+ SMESH::RepaintCurrentView();
+
disconnect(mySMESHGUI, SIGNAL (SignalActivatedViewManager()), this, SLOT(onOpenView()));
- disconnect(mySMESHGUI, SIGNAL (SignalCloseView()), this, SLOT(onCloseView()));
+ disconnect(mySMESHGUI, SIGNAL (SignalCloseView()), this, SLOT(onCloseView()));
selectionMgr()->removeFilter( myFilter );
SMESHGUI_SelectionOp::stopOperation();
}
return;
myNoPreview = true;
+ if ( !myMeshActor && GetConstructorId() == SEARCH_MODE )
+ onSelectionDone();
+
SMESH::MeshPreviewStruct_var aMeshPreviewStruct;
bool moveShown = false;
}
}
}
- }catch (...) {
+ }
+ catch (...) {
}
}
}
clear();
//setTarget( FirstTgt );
+ selectionChanged();
}
/*!
setTarget( SecondTgt );
if ( sender() == mySecondTgt )
clear();
+ QString text = mySecondTgt->text();
+ if ( !mySecondActor )
+ {
+ selectionChanged();
+ mySecondTgt->setText( text );
+ }
SVTK_Selector* selector = SMESH::GetViewWindow()->GetSelector();
if ( mySecondActor && selector ) {
Handle(SALOME_InteractiveObject) IO = mySecondActor->getIO();
if ( mySecond->checkedId() == NodeTgt || mySecond->checkedId() == ElementTgt ) {
- TColStd_MapOfInteger ID;
- ID.Add( mySecondTgt->text().toLong() );
- selector->AddOrRemoveIndex( IO, ID, false );
+ if ( !text.isEmpty() ) {
+ TColStd_MapOfInteger ID;
+ ID.Add( text.toLong() );
+ selector->AddOrRemoveIndex( IO, ID, false );
+ }
}
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow() )
aViewWindow->highlight( IO, true, true );
" .. ... ... ",
" .. .. .. ",
" . . "};
- return iconFirst;
+ return QPixmap( iconFirst );
}
//=================================================================================
break;
}
- for (int i = 0; i < aGroupsArray->length(); i++) {
+ for (int i = 0; i < (int)aGroupsArray->length(); i++) {
SMESH::long_array& aGroup = aGroupsArray[i];
QStringList anIDs;
- for (int j = 0; j < aGroup.length(); j++)
+ for (int j = 0; j < (int)aGroup.length(); j++)
anIDs.append(QString::number(aGroup[j]));
ListCoincident->addItem(anIDs.join(" "));
vtkPoints* aPoints = vtkPoints::New();
aPoints->SetNumberOfPoints(aNodesXYZ.length());
- for ( int i = 0; i < aNodesXYZ.length(); i++ ) {
+ for ( size_t i = 0; i < aNodesXYZ.length(); i++ ) {
aPoints->SetPoint( i, aNodesXYZ[i].x, aNodesXYZ[i].y, aNodesXYZ[i].z );
}
myGrid->SetPoints(aPoints);
vtkIdList *anIdList = vtkIdList::New();
int aNodePos = 0;
- for ( int i = 0; i < anElemTypes.length(); i++ ) {
+ for ( size_t i = 0; i < anElemTypes.length(); i++ ) {
const SMESH::ElementSubType& anElementSubType = anElemTypes[i];
SMDSAbs_ElementType aType = SMDSAbs_ElementType(anElementSubType.SMDS_ElementType);
vtkIdType aNbNodes = anElementSubType.nbNodesInElement;
myLabelActors.resize( nbArrows, ( vtkTextActor*) NULL );
char label[] = "X";
if ( labels )
- for ( int iP = 0, iA = 0; iA < nbArrows; ++iA )
+ for ( int iA = 0; iA < nbArrows; ++iA )
{
label[0] = labels[iA];
vtkTextMapper* text = vtkTextMapper::New();
{
vtkPoints* aPoints = myGrid->GetPoints();
- for ( int iP = 0, iA = 0; iA < myLabelActors.size(); ++iA )
+ for ( int iP = 0, iA = 0; iA < (int) myLabelActors.size(); ++iA )
{
gp_Trsf trsf;
trsf.SetTransformation( gp_Ax3( axes[iA].Location(), axes[iA].Direction() ), gp::XOY() );
SMESH::ListOfGroups_var groups = aMesh->GetGroups();
myInfo->append( "" ); // separator
bool top_created = false;
- for ( int i = 0; i < groups->length(); i++ ) {
+ for ( CORBA::ULong i = 0; i < groups->length(); i++ ) {
SMESH::SMESH_GroupBase_var aGrp = groups[i];
if ( CORBA::is_nil( aGrp ) ) continue;
QString aName = aGrp->GetName();
SMESH::ListOfGroups_var groups = aMesh->GetGroups();
myInfo->append( "" ); // separator
bool top_created = false;
- for ( int i = 0; i < groups->length(); i++ ) {
+ for ( CORBA::ULong i = 0; i < groups->length(); i++ ) {
SMESH::SMESH_GroupBase_var aGrp = groups[i];
if ( CORBA::is_nil( aGrp ) ) continue;
QString aName = aGrp->GetName();
if ( !CORBA::is_nil( aMesh ) ) {
SMESH::ListOfGroups_var groups = aMesh->GetGroups();
QTreeWidgetItem* groupsItem = 0;
- for ( int i = 0; i < groups->length(); i++ ) {
+ for ( CORBA::ULong i = 0; i < groups->length(); i++ ) {
SMESH::SMESH_GroupBase_var aGrp = groups[i];
if ( CORBA::is_nil( aGrp ) ) continue;
QString aName = aGrp->GetName();
if ( !CORBA::is_nil( aMesh ) ) {
SMESH::ListOfGroups_var groups = aMesh->GetGroups();
QTreeWidgetItem* groupsItem = 0;
- for ( int i = 0; i < groups->length(); i++ ) {
+ for ( CORBA::ULong i = 0; i < groups->length(); i++ ) {
SMESH::SMESH_GroupBase_var aGrp = groups[i];
if ( CORBA::is_nil( aGrp ) ) continue;
QString aName = aGrp->GetName();
itemGroups->setData( 0, Qt::UserRole, GROUPS_ID );
// total number of groups > 10, show extra widgets for info browsing
- if ( myGroups->length() > MAXITEMS ) {
+ if ((int) myGroups->length() > MAXITEMS ) {
ExtraWidget* extra = new ExtraWidget( this, true );
connect( extra->prev, SIGNAL( clicked() ), this, SLOT( showPreviousGroups() ) );
connect( extra->next, SIGNAL( clicked() ), this, SLOT( showNextGroups() ) );
itemSubMeshes->setData( 0, Qt::UserRole, SUBMESHES_ID );
// total number of sub-meshes > 10, show extra widgets for info browsing
- if ( mySubMeshes->length() > MAXITEMS ) {
+ if ((int) mySubMeshes->length() > MAXITEMS ) {
ExtraWidget* extra = new ExtraWidget( this, true );
connect( extra->prev, SIGNAL( clicked() ), this, SLOT( showPreviousSubMeshes() ) );
connect( extra->next, SIGNAL( clicked() ), this, SLOT( showNextSubMeshes() ) );
myCtrlInfo->showInfo( obj );
myActor = SMESH::FindActorByEntry( IO->getEntry() );
- SVTK_Selector* selector = SMESH::GetViewWindow()->GetSelector();
+ SVTK_Selector* selector = SMESH::GetSelector();
QString ID;
int nb = 0;
if ( myActor && selector ) {
*/
void SMESHGUI_MeshInfoDlg::idChanged()
{
- SVTK_Selector* selector = SMESH::GetViewWindow()->GetSelector();
+ SVTK_Selector* selector = SMESH::GetSelector();
if ( myActor && selector ) {
Handle(SALOME_InteractiveObject) IO = myActor->getIO();
TColStd_MapOfInteger ID;
DumpFileDlg fd( this );
fd.setWindowTitle( tr( "SAVE_INFO" ) );
- fd.setFilters( aFilters );
+ fd.setNameFilters( aFilters );
fd.myBaseChk->setChecked( anIsBase );
fd.myElemChk->setChecked( anIsElem );
fd.myAddChk ->setChecked( anIsAdd );
DumpFileDlg fd( this );
fd.setWindowTitle( tr( "SAVE_INFO" ) );
- fd.setFilters( aFilters );
+ fd.setNameFilters( aFilters );
fd.myBaseChk->hide();
fd.myElemChk->hide();
fd.myAddChk ->hide();
//================================================================================
SMESHGUI_MeshOp::SMESHGUI_MeshOp( const bool theToCreate, const bool theIsMesh )
: SMESHGUI_SelectionOp(),
- myToCreate( theToCreate ),
- myIsMesh( theIsMesh ),
myDlg( 0 ),
myShapeByMeshOp( 0 ),
+ myToCreate( theToCreate ),
+ myIsMesh( theIsMesh ),
myHypoSet( 0 )
{
if ( GeometryGUI::GetGeomGen()->_is_nil() )// check that GEOM_Gen exists
}
}
SMESHGUI_SelectionOp::startOperation();
- // iterate through dimensions and get available algoritms, set them to the dialog
+ // iterate through dimensions and get available algorithms, set them to the dialog
_PTR(SComponent) aFather = SMESH::GetActiveStudyDocument()->FindComponent( "SMESH" );
for ( int i = SMESH::DIM_0D; i <= SMESH::DIM_3D; i++ )
{
if (aSeq->length() > 0) {
shapeDim = -1;
- for (int iss = 0; iss < aSeq->length() && shapeDim < 3; iss++) {
+ for ( CORBA::ULong iss = 0; iss < aSeq->length() && shapeDim < 3; iss++) {
GEOM::GEOM_Object_var aGeomVar = aSeq[iss];
switch ( aGeomVar->GetShapeType() ) {
case GEOM::SOLID: shapeDim = 3; break;
if (aDim == -1)
return;
- // find highest available dimension, all algos of this dimension are available for choice
- int aTopDim = -1;
- for (int i = SMESH::DIM_0D; i <= SMESH::DIM_3D; i++)
- if (isAccessibleDim( i ))
- aTopDim = i;
- if (aTopDim == -1)
- return;
-
const bool isSubmesh = ( myToCreate ? !myIsMesh : myDlg->isObjectShown( SMESHGUI_MeshDlg::Mesh ));
HypothesisData* algoData = hypData( aDim, Algo, theIndex );
QStringList anAvailable;
- // check that tab enabled of one less dimension
- if ( aDim > SMESH::DIM_0D )
- {
- if ( isAccessibleDim( aDim - 1 ) ) {
- if ( algoData && myIsOnGeometry ) {
- for (int i = aDim - 1; i >= SMESH::DIM_0D; i--) {
- if ( isAccessibleDim( i ) && ( currentHyp( i, Algo ) < 0 ||
- algoData->InputTypes.isEmpty() ) ) {
- myDlg->disableTab( i );
- setCurrentHyp(i, Algo, -1);
- }
- }
+ // enable / disable tabs
+ if ( myIsOnGeometry ) {
+ for (int i = SMESH::DIM_3D; i >= SMESH::DIM_0D; i--) {
+ if ( i > aDim ) {
+ if ( i > myMaxShapeDim ) myDlg->disableTab( i );
+ else myDlg->enableTab( i );
}
- }
- if ( algoData && myIsOnGeometry && !algoData->InputTypes.isEmpty() ) {
- myDlg->enableTab( aDim - 1 );
- }
- if ( !algoData ) {
- if ( aDim != SMESH::DIM_2D || ( aDim == SMESH::DIM_2D &&
- currentHyp( SMESH::DIM_2D, Algo ) < 0) ) {
- for (int i = aDim - 1; i >= SMESH::DIM_0D; i--)
- myDlg->enableTab( i );
+ else if ( i == aDim ) {
+ continue;
}
- else {
- for (int i = aDim - 1; i >= SMESH::DIM_0D; i--)
+ else {//( i < aDim )
+ if ( algoData && algoData->InputTypes.isEmpty() ) {
myDlg->disableTab( i );
+ for ( int type = Algo, nbTypes = nbDlgHypTypes(i); type < nbTypes; type++ )
+ setCurrentHyp(i, type, -1);
+ }
+ else {
+ myDlg->enableTab( i );
+ }
}
}
}
nextAlgo = 0;
}
- // set new available algoritms
+ // set new available algorithms
availableHyps( dim, Algo, anAvailable, myAvailableHypData[dim][Algo], prevAlgo, nextAlgo, anCurrentCompareType);
HypothesisData* soleCompatible = 0;
if ( anAvailable.count() == 1 )
algoIndex = myAvailableHypData[dim][Algo].indexOf( curAlgo );
if ( !isSubmesh && algoIndex < 0 && soleCompatible && !forward && dim != SMESH::DIM_0D) {
// select the sole compatible algo
- algoIndex = myAvailableHypData[dim][Algo].indexOf( soleCompatible );
+ algoIndex = 0;
}
- setCurrentHyp( dim, Algo, algoIndex);
+ setCurrentHyp( dim, Algo, algoIndex );
// remember current algo
prevAlgo = algoByDim[ dim ] = hypData( dim, Algo, algoIndex );
- }
+
+ } // loop on dims
+
if ( myMaxShapeDim == SMESH::DIM_3D && forward && algoDim == SMESH::DIM_1D )
{
algoDim = SMESH::DIM_3D;
a3DAlgo = prevAlgo;
continue;
}
- }
+ } // loops backward and forward
+
- // set hypotheses corresponding to the found algoritms
+ // set hypotheses corresponding to the found algorithms
_PTR(SObject) pObj = SMESH::GetActiveStudyDocument()->FindComponent("SMESH");
return anAlgoVar;
QString aHypName = dataList[ aHypIndex ]->TypeName;
- // get existing algoritms
+ // get existing algorithms
_PTR(SObject) pObj = SMESH::GetActiveStudyDocument()->FindComponent("SMESH");
QStringList tmp;
existingHyps( theDim, Algo, pObj, tmp, myExistingHyps[ theDim ][ Algo ]);
{
// get hypotheses
existingHyps( dim, hypType, pObj, anExisting, myObjHyps[ dim ][ hypType ] );
+ if ( myObjHyps[ dim ][ hypType ].count() == 0 ) {
+ setCurrentHyp( dim, hypType, -1 );
+ }
for ( int i = 0, nb = myObjHyps[ dim ][ hypType ].count(); i < nb; ++i )
{
// find index of required hypothesis among existing ones for this dimension and type
// Assign new algorithms and hypotheses
for ( int dim = aDim; dim <= SMESH::DIM_3D; dim++ )
{
- if ( !isAccessibleDim( dim )) continue;
+ //if ( !isAccessibleDim( dim )) continue;
// find or create algorithm
SMESH::SMESH_Hypothesis_var anAlgoVar = getAlgo( dim );
* \param theIndex - Index of current type of mesh
*/
//================================================================================
-void SMESHGUI_MeshOp::setFilteredAlgoData( const int theTabIndex, const int theIndex)
+void SMESHGUI_MeshOp::setFilteredAlgoData( const int theTabIndex, const int theIndex )
{
QStringList anAvailableAlgs;
QString anCompareType = currentMeshTypeName( theIndex );
anCurrentAvailableAlgo = -1;
isNone = currentHyp( dim, Algo ) < 0;
//return current algo in current tab and set new algorithm list
- HypothesisData* algoCur;
+ HypothesisData* algoCur = 0;
if ( !isNone && !myAvailableHypData[dim][Algo].empty() ) {
algoCur = myAvailableHypData[dim][Algo].at( currentHyp( dim, Algo ) );
}
setCurrentHyp( dim, Algo, anCurrentAvailableAlgo );
if ( anCurrentAvailableAlgo > -1 )
isReqDisBound = algoCur->InputTypes.isEmpty();
- else if ( dim != SMESH::DIM_3D && currentHyp( SMESH::DIM_3D, Algo ) >= 0 )
- isReqDisBound = true;
if ( isReqDisBound ) {
aReqDim = dim;
break;
}
else
for ( int i = SMESH::DIM_0D; i <= SMESH::DIM_3D; i++ ) {
- if ( i > myMaxShapeDim || ( isReqDisBound && i < aReqDim ) ) myDlg->disableTab( i );
- else myDlg->enableTab( i );
+ if ( i > myMaxShapeDim || ( isReqDisBound && i != aReqDim ) ) myDlg->disableTab( i );
+ else myDlg->enableTab( i );
}
myDlg->setCurrentTab( theTabIndex );
}
setCurrentHyp( dim, Algo, anCurrentAvailableAlgo );
}
- if ( isNone || isReqDisBound ) {
- for ( int i = SMESH::DIM_0D; i <= myMaxShapeDim; i++ ) {
- if ( aDim != i ) {
- myDlg->disableTab( i );
- }
- }
- }
- else if ( !isNone ) {
- if ( aDim == SMESH::DIM_2D) {
- myDlg->disableTab( SMESH::DIM_3D );
- setCurrentHyp( SMESH::DIM_3D, Algo, -1);
- }
- for ( int i = myMaxShapeDim; i > SMESH::DIM_0D; i-- ) {
- bool isNoneAlg = currentHyp( i, Algo ) < 0;
- if ( !isNoneAlg )
- isReqDisBound = myAvailableHypData[i][Algo].at( currentHyp( i, Algo ) )->InputTypes.isEmpty();
- else
- isReqDisBound = true;
- if ( isReqDisBound && isNoneAlg ) {
- for (int j = i - 1; j >= SMESH::DIM_0D; j--) {
- if ( j < aDim && currentHyp( j+1, Algo ) < 0 ) {
- myDlg->disableTab( j );
- setCurrentHyp( j , Algo, -1 );
- }
+ for ( int i = myMaxShapeDim; i >= SMESH::DIM_0D; i-- ) {
+ bool isNoneAlg = currentHyp( i, Algo ) < 0;
+ if ( !isNoneAlg )
+ isReqDisBound = myAvailableHypData[i][Algo].at( currentHyp( i, Algo ) )->InputTypes.isEmpty();
+ else
+ isReqDisBound = true;
+ if ( isReqDisBound && !isNoneAlg && i <= aDim) {
+ for (int j = myMaxShapeDim; j >= SMESH::DIM_0D; j--) {
+ if ( currentHyp( j, Algo ) < 0 ) {
+ myDlg->disableTab( j );
+ setCurrentHyp( j , Algo, -1 );
}
- break;
- }
- else if ( isNoneAlg ) {
- myDlg->disableTab( i );
}
+ break;
+ }
+ else {
+ myDlg->enableTab( i );
}
}
- myDlg->enableTab( aDim );
- myDlg->setCurrentTab( aDim );
+ if ( aDim == SMESH::DIM_2D) {
+ myDlg->disableTab( SMESH::DIM_3D );
+ setCurrentHyp( SMESH::DIM_3D, Algo, -1);
+ }
+
+ int currentTab = ( theTabIndex <= aDim ) ? theTabIndex : aDim;
+ myDlg->setCurrentTab( currentTab );
}
THypDataList anAvailableAlgsData;
QStringList aHypothesesSetsList = SMESH::GetHypothesesSets( aDim );
bool myHasConcurrentSubBefore;
TDim2Type2HypList myExistingHyps; //!< all hypothesis of SMESH module
- TDim2Type2HypList myObjHyps; //!< hypothesis assigned to the current
+ TDim2Type2HypList myObjHyps; //!< hypothesis assigned to the current
// edited mesh/sub-mesh
// hypdata corresponding to hypotheses present in myDlg
THypDataList myAvailableHypData[4][NbHypTypes];
QString myLastGeomToSelect;
THypLabelIsAppMap myHypMapIsApplicable;
bool myIgnoreAlgoSelection;
- HypothesesSet* myHypoSet;
- int myDim, myType, myMaxShapeDim;
+ HypothesesSet* myHypoSet;
+ int myDim, myType, myMaxShapeDim;
QString myObjectToSelect;
};
SUIT_FileDlg* aDlg = new SUIT_FileDlg (this, true);
aDlg->setWindowTitle(tr("LOAD_PATTERN"));
aDlg->setFileMode(QFileDialog::ExistingFile);
- aDlg->setFilters(prepareFilters());
+ aDlg->setNameFilters(prepareFilters());
if (!myName->text().isEmpty())
aDlg->selectFile(myName->text() + ".smp");
- QPushButton* anOkBtn = qFindChild<QPushButton*>( aDlg, "OK" );
+ QPushButton* anOkBtn = aDlg->findChild<QPushButton*>( "OK" );
if (anOkBtn != 0)
anOkBtn->setText(tr("SMESH_BUT_OK"));
if (QFileInfo(fName).suffix().isEmpty())
fName = autoExtension(fName);
- fName = QDir::convertSeparators(fName);
+ fName = QDir::toNativeSeparators(fName);
- QString prev = QDir::convertSeparators(myName->text());
+ QString prev = QDir::toNativeSeparators(myName->text());
if (prev == fName)
return;
const bool the3d2d,
bool theDoInit):
SMESHGUI_PreviewDlg(theModule),
- mySelector(SMESH::GetViewWindow(theModule)->GetSelector()),
mySelectionMgr(SMESH::GetSelectionMgr(theModule)),
+ mySelector(SMESH::GetViewWindow(theModule)->GetSelector()),
mySMESHGUI(theModule)
{
setModal(false);
QLabel* dXLbl = new QLabel( tr("SMESH_DX"), myFacetSelGrp);
QLabel* dYLbl = new QLabel( tr("SMESH_DY"), myFacetSelGrp);
QLabel* dZLbl = new QLabel( tr("SMESH_DZ"), myFacetSelGrp);
- QPushButton* axisBtn[3];
for ( int i = 0; i < 3; ++i )
{
myPointSpin[i] = new SMESHGUI_SpinBox( myFacetSelGrp );
gp_XYZ bc( 0,0,0 );
Bnd_B3d bbox;
SMDS_NodeIteratorPtr nIt = elem->nodeIterator();
- vector< const SMDS_MeshNode* > nodes;
+ std::vector< const SMDS_MeshNode* > nodes;
nodes.reserve( elem->NbNodes() );
while ( nIt->more() )
{
if ( sender() == myAxisBtn[i] )
break;
if ( i == 3 )
- i == 0;
+ i = 0;
myDirSpin[i]->SetValue(1.);
if ( myActor && !myMesh->_is_nil() && myMesh->NbNodes() > 0 )
//=================================================================================
SMESHGUI_NodesDlg::SMESHGUI_NodesDlg( SMESHGUI* theModule ):
QDialog( SMESH::GetDesktop( theModule ) ),
- mySelector( SMESH::GetViewWindow( theModule )->GetSelector() ),
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
+ mySelector( SMESH::GetViewWindow( theModule )->GetSelector() ),
mySMESHGUI( theModule )
{
setModal( false );
// purpose :
//=================================================================================
SMESHGUI_PreviewDlg::SMESHGUI_PreviewDlg(SMESHGUI* theModule) :
- mySMESHGUI(theModule),
QDialog(SMESH::GetDesktop( theModule )),
+ mySMESHGUI(theModule),
myIsApplyAndClose( false )
{
mySimulation = new SMESHGUI_MeshEditPreview(SMESH::GetViewWindow( mySMESHGUI ));
// purpose :
//=================================================================================
SMESHGUI_MultiPreviewDlg::SMESHGUI_MultiPreviewDlg( SMESHGUI* theModule ) :
- mySMESHGUI( theModule ),
QDialog( SMESH::GetDesktop( theModule ) ),
+ mySMESHGUI( theModule ),
myIsApplyAndClose( false )
{
mySimulationList.clear();
#include <SUIT_Desktop.h>
#include <SUIT_Session.h>
#include <SUIT_MessageBox.h>
+#include <SUIT_OverrideCursor.h>
#include <LightApp_Application.h>
#include <LightApp_SelectionMgr.h>
SMESHGUI_RemoveElementsDlg
::SMESHGUI_RemoveElementsDlg(SMESHGUI* theModule)
: QDialog(SMESH::GetDesktop(theModule)),
- mySelector(SMESH::GetViewWindow(theModule)->GetSelector()),
mySelectionMgr(SMESH::GetSelectionMgr(theModule)),
+ mySelector(SMESH::GetViewWindow(theModule)->GetSelector()),
mySMESHGUI(theModule),
myBusy(false),
myFilterDlg(0)
if (mySMESHGUI->isActiveStudyLocked())
return;
- if (myNbOkElements) {
+ if (myNbOkElements)
+ {
+ SUIT_OverrideCursor wc;
+
QStringList aListId = myEditCurrentArgument->text().split(" ", QString::SkipEmptyParts);
SMESH::long_array_var anArrayOfIdeces = new SMESH::long_array;
anArrayOfIdeces->length(aListId.count());
anArrayOfIdeces[i] = aListId[ i ].toInt();
bool aResult = false;
- try {
+ try
+ {
SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
aResult = aMeshEditor->RemoveElements(anArrayOfIdeces.in());
void SMESHGUI_RemoveElementsDlg::SelectionIntoArgument()
{
if (myBusy) return; // busy
- if (myFilterDlg && myFilterDlg->isVisible()) return; // filter digl active
+ if (myFilterDlg && myFilterDlg->isVisible()) return; // filter dlg active
if (!GroupButtons->isEnabled()) return; // inactive
// clear
SMESHGUI_RemoveNodesDlg
::SMESHGUI_RemoveNodesDlg(SMESHGUI* theModule)
: QDialog(SMESH::GetDesktop(theModule)),
- mySelector(SMESH::GetViewWindow(theModule)->GetSelector()),
mySelectionMgr(SMESH::GetSelectionMgr(theModule)),
+ mySelector(SMESH::GetViewWindow(theModule)->GetSelector()),
mySMESHGUI(theModule),
myBusy(false),
myFilterDlg(0)
if ( !aMesh )
return;
- int aNbUnits = 0;
-
- bool isNodeSelected = (myEditCurrentArgument == (QWidget*)SpinBox_X ||
+ bool isNodeSelected = ((myEditCurrentArgument == (QWidget*)SpinBox_X ) ||
(myEditCurrentArgument == (QWidget*)SpinBox_DX &&
myVectorDefinition==POINT_SELECT));
void SMESHGUI_RotationDlg::SelectionIntoArgument()
{
if (myBusy) return;
+ if (myFilterDlg && myFilterDlg->isVisible()) return; // filter dlg active
// clear
myActor = 0;
int aNbUnits = 0;
- if (myEditCurrentArgument == (QWidget*)LineEditElements) {
+ if (myEditCurrentArgument == (QWidget*)LineEditElements)
+ {
myElementsId = "";
myObjects.clear();
myObjectsNames.clear();
myMeshes.clear();
- for ( SALOME_ListIteratorOfListIO it( aList ); it.More(); it.Next() ) {
+ for ( SALOME_ListIteratorOfListIO it( aList ); it.More(); it.Next() )
+ {
Handle(SALOME_InteractiveObject) IO = it.Value();
SMESH::SMESH_Mesh_var aMesh = SMESH::GetMeshByIO( IO );
if ( aMesh->_is_nil() )
return;
-
+
myActor = SMESH::FindActorByObject( aMesh );
if ( !myActor )
myActor = SMESH::FindActorByEntry( IO->getEntry() );
- if ( !myActor && !CheckBoxMesh->isChecked() )
- return;
-
- if ( !SMESH::IObjectToInterface<SMESH::SMESH_IDSource>( IO )->_is_nil() ) {
- if ( _PTR(Study) aStudy = SMESH::GetActiveStudyDocument() ) {
- _PTR(SObject) obj = aStudy->FindObjectID( qPrintable( QString( IO->getEntry() ) ) );
- _PTR(GenericAttribute) anAttr;
- if ( obj && obj->FindAttribute( anAttr, "AttributeName" ) ) {
- _PTR(AttributeName) aNameAttr( anAttr );
- myObjects << SMESH::IObjectToInterface<SMESH::SMESH_IDSource>( IO );
- myObjectsNames << aNameAttr->Value().c_str();
- myMeshes << aMesh;
- }
+ // if ( !myActor && !CheckBoxMesh->isChecked() ) -- elems can be selected by Filter
+ // return;
+
+ SMESH::SMESH_IDSource_var idSrc = SMESH::IObjectToInterface<SMESH::SMESH_IDSource>( IO );
+ if ( _PTR(SObject) obj = SMESH::FindSObject( idSrc ))
+ {
+ std::string name = obj->GetName();
+ if ( !name.empty() )
+ {
+ myObjects << idSrc;
+ myObjectsNames << name.c_str();
+ myMeshes << aMesh;
}
}
}
else if ( ActionGroup->checkedId() != MOVE_ELEMS_BUTTON ) {
MakeGroupsCheck->setEnabled(true);
}
- if (CheckBoxMesh->isChecked()) {
- SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
+ if (CheckBoxMesh->isChecked()) {
if ( myMeshes.isEmpty() )
return;
+ SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
}
else {
aNbUnits = SMESH::GetNameOfSelectedElements(mySelector, aList.First(), aString);
myNbOkElements = true;
- } else {
+ }
+ else // set coordinates by picked nodes
+ {
Handle(SALOME_InteractiveObject) IO = aList.First();
- if ((SMESH::GetMeshByIO(IO))->_is_nil())
- return;
- SMESH_Actor* anActor = SMESH::FindActorByObject(SMESH::GetMeshByIO(IO));
+ SMESH_Actor* anActor = SMESH::FindActorByEntry( IO->getEntry() );
if (!anActor)
- anActor = SMESH::FindActorByEntry(IO->getEntry());
- if (!anActor && !CheckBoxMesh->isChecked())
return;
aNbUnits = SMESH::GetNameOfSelectedNodes(mySelector, IO, aString);
tr("NO_MESH_SELECTED"));
return;
}
- if ( !myFilterDlg )
+ if ( !myFilterDlg ) {
myFilterDlg = new SMESHGUI_FilterDlg( mySMESHGUI, SMESH::ALL );
+ connect(myFilterDlg, SIGNAL(Accepted()), SLOT(onFilterAccepted()));
+ }
+ QList<int> types;
+ if ( myMeshes[0]->NbEdges() ) types << SMESH::EDGE;
+ if ( myMeshes[0]->NbFaces() ) types << SMESH::FACE;
+ if ( myMeshes[0]->NbVolumes() ) types << SMESH::VOLUME;
+ if ( myMeshes[0]->NbBalls() ) types << SMESH::BALL;
+ if ( myMeshes[0]->Nb0DElements()) types << SMESH::ELEM0D;
+ if ( types.count() > 1 ) types << SMESH::ALL;
+
+ myFilterDlg->Init( types );
myFilterDlg->SetSelection();
myFilterDlg->SetMesh( myMeshes[0] );
myFilterDlg->SetSourceWg( LineEditElements );
myFilterDlg->show();
}
+//=======================================================================
+// name : onFilterAccepted()
+// Purpose : SLOT. Called when Filter dlg closed with OK button.
+// Activate [Apply] if no Actor is available
+//=======================================================================
+void SMESHGUI_RotationDlg::onFilterAccepted()
+{
+ if ( myMeshes.length() > 0 && !buttonOk->isEnabled() )
+ {
+ myElementsId = LineEditElements->text();
+ QStringList aListElementsId = myElementsId.split(" ", QString::SkipEmptyParts);
+ myNbOkElements = aListElementsId.count();
+ buttonOk->setEnabled( myNbOkElements );
+ buttonApply->setEnabled( myNbOkElements );
+ }
+}
+
//=================================================================================
// function : isValid
// purpose :
protected slots:
virtual void onDisplaySimulation( bool );
virtual void reject();
+ void onFilterAccepted();
private slots:
void ClickOnOk();
void SMESHGUI_ScaleDlg::SelectionIntoArgument()
{
if (myBusy) return;
+ if (myFilterDlg && myFilterDlg->isVisible()) return; // filter dlg active
+
BusyLocker lock( myBusy );
// clear
myActor = 0;
int aNbUnits = 0;
- if (myEditCurrentArgument == (QWidget*)LineEditElements) {
+ if (myEditCurrentArgument == (QWidget*)LineEditElements)
+ {
myElementsId = "";
myObjects.clear();
myObjectsNames.clear();
myMeshes.clear();
- for ( SALOME_ListIteratorOfListIO it( aList ); it.More(); it.Next() ) {
+ for ( SALOME_ListIteratorOfListIO it( aList ); it.More(); it.Next() )
+ {
Handle(SALOME_InteractiveObject) IO = it.Value();
SMESH::SMESH_Mesh_var aMesh = SMESH::GetMeshByIO( IO );
if ( aMesh->_is_nil() )
return;
-
+
myActor = SMESH::FindActorByObject( aMesh );
if ( !myActor )
myActor = SMESH::FindActorByEntry( IO->getEntry() );
- if ( !myActor && !CheckBoxMesh->isChecked() )
- return;
-
- if ( !SMESH::IObjectToInterface<SMESH::SMESH_IDSource>( IO )->_is_nil() ) {
- if ( _PTR(Study) aStudy = SMESH::GetActiveStudyDocument() ) {
- _PTR(SObject) obj = aStudy->FindObjectID( qPrintable( QString( IO->getEntry() ) ) );
- _PTR(GenericAttribute) anAttr;
- if ( obj && obj->FindAttribute( anAttr, "AttributeName" ) ) {
- _PTR(AttributeName) aNameAttr( anAttr );
- myObjects << SMESH::IObjectToInterface<SMESH::SMESH_IDSource>( IO );
- myObjectsNames << aNameAttr->Value().c_str();
- myMeshes << aMesh;
- }
+ // if ( !myActor && !CheckBoxMesh->isChecked() ) -- elems can be selected by Filter
+ // return;
+
+ SMESH::SMESH_IDSource_var idSrc = SMESH::IObjectToInterface<SMESH::SMESH_IDSource>( IO );
+ if ( _PTR(SObject) obj = SMESH::FindSObject( idSrc ))
+ {
+ std::string name = obj->GetName();
+ if ( !name.empty() )
+ {
+ myObjects << idSrc;
+ myObjectsNames << name.c_str();
+ myMeshes << aMesh;
}
}
}
-
+
// MakeGroups is available if there are groups and "Copy"
int aNbGroups = 0;
for ( int i = 0; i < myMeshes.count(); i++ )
}
if (CheckBoxMesh->isChecked()) {
- SMESH::GetNameOfSelectedIObjects( mySelectionMgr, aString );
if (myMeshes.isEmpty())
return;
- // get IDs from mesh
- /*
- SMDS_Mesh* aSMDSMesh = myActor->GetObject()->GetMesh();
- if (!aSMDSMesh)
- return;
-
- for (int i = aSMDSMesh->MinElementID(); i <= aSMDSMesh->MaxElementID(); i++) {
- const SMDS_MeshElement * e = aSMDSMesh->FindElement(i);
- if (e) {
- myElementsId += QString(" %1").arg(i);
- aNbUnits++;
- }
- }
- } else if (!SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO)->_is_nil()) { //SUBMESH
- // get submesh
- SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO);
-
- // get IDs from submesh
- SMESH::long_array_var anElementsIds = new SMESH::long_array;
- anElementsIds = aSubMesh->GetElementsId();
- for (int i = 0; i < anElementsIds->length(); i++) {
- myElementsId += QString(" %1").arg(anElementsIds[i]);
- }
- aNbUnits = anElementsIds->length();
- } else { // GROUP
- // get smesh group
- SMESH::SMESH_GroupBase_var aGroup =
- SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IO);
- if (aGroup->_is_nil())
- return;
-
- // get IDs from smesh group
- SMESH::long_array_var anElementsIds = new SMESH::long_array;
- anElementsIds = aGroup->GetListOfID();
- for (int i = 0; i < anElementsIds->length(); i++) {
- myElementsId += QString(" %1").arg(anElementsIds[i]);
- }
- aNbUnits = anElementsIds->length();
- }
- */
- } else {
+ SMESH::GetNameOfSelectedIObjects( mySelectionMgr, aString );
+ }
+ else {
aNbUnits = SMESH::GetNameOfSelectedElements(mySelector, aList.First(), aString);
myElementsId = aString;
if (aNbUnits < 1)
}
myNbOkElements = true;
- } else {
+
+ }
+ else // set coordinates by a picked node
+ {
Handle(SALOME_InteractiveObject) IO = aList.First();
- if ((SMESH::GetMeshByIO(IO))->_is_nil())
- return;
- SMESH_Actor* anActor = SMESH::FindActorByObject(SMESH::GetMeshByIO(IO));
+ SMESH_Actor* anActor = SMESH::FindActorByEntry( IO->getEntry() );
if (!anActor)
- anActor = SMESH::FindActorByEntry(IO->getEntry());
- if (!anActor && !CheckBoxMesh->isChecked())
return;
aNbUnits = SMESH::GetNameOfSelectedNodes(mySelector, IO, aString);
//=================================================================================
void SMESHGUI_ScaleDlg::setFilters()
{
- if(myMeshes.isEmpty()) {
- SUIT_MessageBox::critical(this,
- tr("SMESH_ERROR"),
- tr("NO_MESH_SELECTED"));
- return;
+ if ( myMeshes.isEmpty() ) {
+ SUIT_MessageBox::critical(this, tr("SMESH_ERROR"), tr("NO_MESH_SELECTED"));
+ return;
}
- if ( !myFilterDlg )
+ if ( !myFilterDlg ) {
myFilterDlg = new SMESHGUI_FilterDlg( mySMESHGUI, SMESH::ALL );
+ connect(myFilterDlg, SIGNAL(Accepted()), SLOT(onFilterAccepted()));
+ }
+ QList<int> types;
+ if ( myMeshes[0]->NbEdges() ) types << SMESH::EDGE;
+ if ( myMeshes[0]->NbFaces() ) types << SMESH::FACE;
+ if ( myMeshes[0]->NbVolumes() ) types << SMESH::VOLUME;
+ if ( myMeshes[0]->NbBalls() ) types << SMESH::BALL;
+ if ( myMeshes[0]->Nb0DElements()) types << SMESH::ELEM0D;
+ if ( types.count() > 1 ) types << SMESH::ALL;
+
+ myFilterDlg->Init( types );
myFilterDlg->SetSelection();
myFilterDlg->SetMesh( myMeshes[0] );
myFilterDlg->SetSourceWg( LineEditElements );
myFilterDlg->show();
}
+//=======================================================================
+// name : onFilterAccepted()
+// Purpose : SLOT. Called when Filter dlg closed with OK button.
+// Activate [Apply] if no Actor is available
+//=======================================================================
+void SMESHGUI_ScaleDlg::onFilterAccepted()
+{
+ if ( myMeshes.length() > 0 && !buttonOk->isEnabled() )
+ {
+ myElementsId = LineEditElements->text();
+ QStringList aListElementsId = myElementsId.split(" ", QString::SkipEmptyParts);
+ myNbOkElements = aListElementsId.count();
+ buttonOk->setEnabled ( myNbOkElements );
+ buttonApply->setEnabled( myNbOkElements );
+ }
+}
+
//=================================================================================
// function : isValid
// purpose :
protected slots:
virtual void onDisplaySimulation( bool );
virtual void reject();
+ void onFilterAccepted();
private slots:
void ConstructorsClicked( int );
else if ( p=="isComputable" ) val = QVariant( isComputable( ind ) );
else if ( p=="isPreComputable" ) val = QVariant( isPreComputable( ind ) );
else if ( p=="hasGeomReference" ) val = QVariant( hasGeomReference( ind ) );
+ else if ( p=="isEditableHyp" ) val = QVariant( isEditableHyp( ind ) );
else if ( p=="isImported" ) val = QVariant( isImported( ind ) );
else if ( p=="facesOrientationMode" ) val = QVariant( facesOrientationMode( ind ) );
else if ( p=="groupType" ) val = QVariant( groupType( ind ) );
if ( !CORBA::is_nil( idSrc ) )
{
SMESH::array_of_ElementType_var types = idSrc->GetTypes();
- for ( int i = 0; i < types->length(); ++ i) {
+ for ( size_t i = 0; i < types->length(); ++ i) {
switch ( types[i] ) {
case SMESH::EDGE : dim = std::max( dim, 1 ); break;
case SMESH::FACE : dim = std::max( dim, 2 ); break;
//purpose : return true for a ready-to-compute mesh
//=======================================================================
-QVariant SMESHGUI_Selection::isComputable( int ind ) const
+bool SMESHGUI_Selection::isComputable( int ind ) const
{
if ( ind >= 0 && ind < myTypes.count() && myTypes[ind] == "Mesh" )
{
QMap<int,int> modeMap;
_PTR(SObject) so = SMESH::GetActiveStudyDocument()->FindObjectID( entry( ind ).toLatin1().data() );
SMESHGUI_PrecomputeOp::getAssignedAlgos( so, modeMap );
- return QVariant( modeMap.size() > 0 );
+ return modeMap.size() > 0;
}
- return QVariant( false );
+ return false;
}
//=======================================================================
//purpose : returns true for a mesh with algorithms
//=======================================================================
-QVariant SMESHGUI_Selection::isPreComputable( int ind ) const
+bool SMESHGUI_Selection::isPreComputable( int ind ) const
{
if ( ind >= 0 && ind < myTypes.count() && myTypes[ind] == "Mesh" )
{
_PTR(SObject) pMesh = SMESH::GetActiveStudyDocument()->FindObjectID( entry( ind ).toLatin1().data() );
SMESHGUI_PrecomputeOp::getAssignedAlgos( pMesh, modeMap );
if ( modeMap.size() > 1 )
- return QVariant( ( modeMap.contains( SMESH::DIM_3D )) ||
- ( modeMap.contains( SMESH::DIM_2D ) && maxDim < 1 ));
+ return (( modeMap.contains( SMESH::DIM_3D )) ||
+ ( modeMap.contains( SMESH::DIM_2D ) && maxDim < 1 ));
}
}
- return QVariant( false );
+ return false;
}
//=======================================================================
//purpose : returns true for a mesh or sub-mesh on geometry
//=======================================================================
-QVariant SMESHGUI_Selection::hasGeomReference( int ind ) const
+bool SMESHGUI_Selection::hasGeomReference( int ind ) const
{
if ( ind >= 0 && ind < myTypes.count() && myTypes[ind] != "Unknown" )
{
_PTR(SObject) so = SMESH::GetActiveStudyDocument()->FindObjectID( entry( ind ).toLatin1().data() );
GEOM::GEOM_Object_var shape = SMESH::GetShapeOnMeshOrSubMesh( so );
- return QVariant( !shape->_is_nil() );
+ return !shape->_is_nil();
+ }
+ return false;
+}
+
+//=======================================================================
+//function : isEditableHyp
+//purpose :
+//=======================================================================
+
+bool SMESHGUI_Selection::isEditableHyp( int ind ) const
+{
+ bool isEditable = true;
+ if ( ind >= 0 && ind < myTypes.count() && myTypes[ind] == "Hypothesis" )
+ {
+ _PTR(SObject) so = SMESH::GetActiveStudyDocument()->FindObjectID( entry( ind ).toLatin1().data() );
+ SMESH::SMESH_Hypothesis_var hyp = SMESH::SObjectToInterface<SMESH::SMESH_Hypothesis>( so );
+ if ( !hyp->_is_nil() )
+ {
+ isEditable = hyp->HasParameters();
+ }
}
- return QVariant( false );
+ return isEditable;
}
//=======================================================================
//purpose :
//=======================================================================
-QVariant SMESHGUI_Selection::isVisible( int ind ) const
+bool SMESHGUI_Selection::isVisible( int ind ) const
{
if ( ind >= 0 && ind < myTypes.count() && myTypes[ind] != "Unknown" )
{
SMESH_Actor* actor = SMESH::FindActorByEntry( entry( ind ).toLatin1().data() );
if ( actor && actor->hasIO() ) {
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetCurrentVtkView() )
- return QVariant( aViewWindow->isVisible( actor->getIO() ) );
+ return aViewWindow->isVisible( actor->getIO() );
}
}
- return QVariant( false );
+ return false;
}
//=======================================================================
virtual bool isAutoColor( int ) const;
virtual int numberOfNodes( int ) const;
virtual int dim( int ) const;
- virtual QVariant isComputable( int ) const;
- virtual QVariant isPreComputable( int ) const;
- virtual QVariant hasGeomReference( int ) const;
- virtual QVariant isVisible( int ) const;
+ virtual bool isComputable( int ) const;
+ virtual bool isPreComputable( int ) const;
+ virtual bool hasGeomReference( int ) const;
+ virtual bool isEditableHyp( int ) const;
+ virtual bool isVisible( int ) const;
virtual QString quadratic2DMode( int ) const;
QString SMESHGUI_SewingDlg::getPartText(const SMESH::FreeBorderPart& aPART)
{
+ typedef CORBA::Long TInt;
QString text;
- if ( 0 <= aPART.border && aPART.border < myBorders->borders.length() )
+ if ( 0 <= aPART.border && aPART.border < (TInt)myBorders->borders.length() )
{
const SMESH::FreeBorder& aBRD = myBorders->borders[ aPART.border ];
- if ( 0 <= aPART.node1 && aPART.node1 < aBRD.nodeIDs.length() &&
- 0 <= aPART.nodeLast && aPART.nodeLast < aBRD.nodeIDs.length() )
+ if ( 0 <= aPART.node1 && aPART.node1 < (TInt)aBRD.nodeIDs.length() &&
+ 0 <= aPART.nodeLast && aPART.nodeLast < (TInt)aBRD.nodeIDs.length() )
{
text += QString("( %1 %2 %3 ) ")
.arg( aBRD.nodeIDs[ aPART.node1 ] )
if ( haveBorders() &&
groupIndex >= 0 &&
- groupIndex < myBorders->coincidentGroups.length() )
+ groupIndex < (int)myBorders->coincidentGroups.length() )
{
const SMESH::FreeBordersGroup& aGRP = myBorders->coincidentGroups[ groupIndex ];
delete item;
if ( myBorderDisplayers[ groupIndex ])
myBorderDisplayers[ groupIndex ]->Hide();
- SMESH::FreeBordersGroup& aGRP = myBorders->coincidentGroups[ myCurGroupIndex ];
+ SMESH::FreeBordersGroup& aGRP = myBorders->coincidentGroups[ groupIndex ];
aGRP.length( 0 );
}
myBusy = false;
int groupIndex = item->data( GROUP_INDEX ).toInt();
QColor groupColor = item->data( GROUP_COLOR ).value<QColor>();
if ( groupIndex >= 0 &&
- groupIndex < myBorders->coincidentGroups.length() )
+ groupIndex < (int)myBorders->coincidentGroups.length() )
{
if ( !myBorderDisplayers[ groupIndex ] && SMESH::GetCurrentVtkView())
myBorderDisplayers[ groupIndex ] = new BorderGroupDisplayer( myBorders, groupIndex, groupColor, myMesh );
myCurGroupIndex = selItems[0]->data( GROUP_INDEX ).toInt();
- return ( myCurGroupIndex >= 0 && myCurGroupIndex < myBorders->coincidentGroups.length() );
+ return ( myCurGroupIndex >= 0 && myCurGroupIndex < (int)myBorders->coincidentGroups.length() );
}
//=======================================================================
myCurPartIndex = ListEdit->currentRow();
const SMESH::FreeBordersGroup& aGRP = myBorders->coincidentGroups[ myCurGroupIndex ];
- return ( myCurPartIndex >= 0 && myCurPartIndex < aGRP.length() );
+ return ( myCurPartIndex >= 0 && myCurPartIndex < (int)aGRP.length() );
}
//=======================================================================
SMESH::FreeBordersGroup& aGRP = myBorders->coincidentGroups[ myCurGroupIndex ];
+ myBusy = true;
QList<QListWidgetItem*> selItems = ListEdit->selectedItems();
for ( int i = 0; i < selItems.count(); ++i )
{
int part = ListEdit->row( selItems[i] );
- for ( ; part + 1 < aGRP.length(); ++part )
+ for ( ; part + 1 < (int)aGRP.length(); ++part )
aGRP[ part ] = aGRP[ part + 1 ];
- aGRP.length( aGRP.length() - 1 );
+ if ( aGRP.length() > 0 )
+ aGRP.length( aGRP.length() - 1 );
delete selItems[i];
}
+ myBusy = false;
if ( aGRP.length() == 0 )
onRemoveGroupClicked();
std::vector<int> & ids,
std::list<gp_XYZ>& coords)
{
+ if ( partIndex >= (int)myGroup.length() ) return;
const SMESH::FreeBorderPart& aPART = myGroup [ partIndex ];
const SMESH::FreeBorder& aBRD = myBorders[ aPART.border ];
SMESHGUI_SingleEditDlg
::SMESHGUI_SingleEditDlg(SMESHGUI* theModule)
: QDialog(SMESH::GetDesktop(theModule)),
- mySelector(SMESH::GetViewWindow(theModule)->GetSelector()),
mySelectionMgr(SMESH::GetSelectionMgr(theModule)),
+ mySelector(SMESH::GetViewWindow(theModule)->GetSelector()),
mySMESHGUI(theModule)
{
setModal(false);
: QDialog( SMESH::GetDesktop( theModule ) ),
mySMESHGUI( theModule ),
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
- myFilterDlg(0),
- mySelectedObject(SMESH::SMESH_IDSource::_nil())
+ mySelectedObject(SMESH::SMESH_IDSource::_nil()),
+ myFilterDlg(0)
{
QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_SMOOTHING")));
QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
void SMESHGUI_SmoothingDlg::SelectionIntoArgument()
{
if (myBusy) return;
+ if (myFilterDlg && myFilterDlg->isVisible()) return; // filter dlg active
// clear
QString aString = "";
BusyLocker lock( myBusy );
if (myEditCurrentArgument == LineEditElements ||
- myEditCurrentArgument == LineEditNodes) {
+ myEditCurrentArgument == LineEditNodes)
+ {
myEditCurrentArgument->setText(aString);
if (myEditCurrentArgument == LineEditElements) {
myNbOkElements = 0;
void SMESHGUI_SymmetryDlg::SelectionIntoArgument()
{
if (myBusy) return;
+ if (myFilterDlg && myFilterDlg->isVisible()) return; // filter dlg active
// clear
myActor = 0;
int aNbUnits = 0;
- if (myEditCurrentArgument == (QWidget*)LineEditElements) {
+ if (myEditCurrentArgument == (QWidget*)LineEditElements)
+ {
myElementsId = "";
myObjects.clear();
myObjectsNames.clear();
myMeshes.clear();
- for ( SALOME_ListIteratorOfListIO it( aList ); it.More(); it.Next() ) {
+ for ( SALOME_ListIteratorOfListIO it( aList ); it.More(); it.Next() )
+ {
Handle(SALOME_InteractiveObject) IO = it.Value();
-
SMESH::SMESH_Mesh_var aMesh = SMESH::GetMeshByIO( IO );
- if( aMesh->_is_nil() )
- return;
+ if ( aMesh->_is_nil() )
+ continue;
myActor = SMESH::FindActorByObject( aMesh );
if ( !myActor )
myActor = SMESH::FindActorByEntry( IO->getEntry() );
- if ( !myActor && !CheckBoxMesh->isChecked() )
- return;
+ // if ( !myActor && !CheckBoxMesh->isChecked() ) -- elems can be selected by Filter
+ // return;
- if ( !SMESH::IObjectToInterface<SMESH::SMESH_IDSource>( IO )->_is_nil() ) {
- if ( _PTR(Study) aStudy = SMESH::GetActiveStudyDocument() ) {
- _PTR(SObject) obj = aStudy->FindObjectID( qPrintable( QString( IO->getEntry() ) ) );
- _PTR(GenericAttribute) anAttr;
- if ( obj && obj->FindAttribute( anAttr, "AttributeName" ) ) {
- _PTR(AttributeName) aNameAttr( anAttr );
- myObjects << SMESH::IObjectToInterface<SMESH::SMESH_IDSource>( IO );
- myObjectsNames << aNameAttr->Value().c_str();
- myMeshes << aMesh;
- }
+ SMESH::SMESH_IDSource_var idSrc = SMESH::IObjectToInterface<SMESH::SMESH_IDSource>( IO );
+ if ( _PTR(SObject) obj = SMESH::FindSObject( idSrc ))
+ {
+ std::string name = obj->GetName();
+ if ( !name.empty() )
+ {
+ myObjects << idSrc;
+ myObjectsNames << name.c_str();
+ myMeshes << aMesh;
}
}
}
// MakeGroups is available if there are groups and "Copy"
- int aNbGroups = 0;
- for ( int i = 0; i < myMeshes.count(); i++ )
- aNbGroups += myMeshes[i]->NbGroups();
-
+ int aNbGroups = 0;
+ for ( int i = 0; i < myMeshes.count(); i++ )
+ aNbGroups += myMeshes[i]->NbGroups();
+
if ( aNbGroups == 0 ) {
MakeGroupsCheck->setChecked(false);
MakeGroupsCheck->setEnabled(false);
else if ( ActionGroup->checkedId() != MOVE_ELEMS_BUTTON ) {
MakeGroupsCheck->setEnabled(true);
}
- if (CheckBoxMesh->isChecked()) {
- SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
+ if (CheckBoxMesh->isChecked()) {
if ( myObjects.isEmpty() )
return;
- // get IDs from mesh
- /*
- SMDS_Mesh* aSMDSMesh = myActor->GetObject()->GetMesh();
- if (!aSMDSMesh)
- return;
-
- for (int i = aSMDSMesh->MinElementID(); i <= aSMDSMesh->MaxElementID(); i++) {
- const SMDS_MeshElement * e = aSMDSMesh->FindElement(i);
- if (e) {
- myElementsId += QString(" %1").arg(i);
- aNbUnits++;
- }
- }
- } else if (!SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO)->_is_nil()) { //SUBMESH
- // get submesh
- SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO);
-
- // get IDs from submesh
- /*
- SMESH::long_array_var anElementsIds = new SMESH::long_array;
- anElementsIds = aSubMesh->GetElementsId();
- for (int i = 0; i < anElementsIds->length(); i++) {
- myElementsId += QString(" %1").arg(anElementsIds[i]);
- }
- aNbUnits = anElementsIds->length();
- } else { // GROUP
- // get smesh group
- SMESH::SMESH_GroupBase_var aGroup =
- SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IO);
- if (aGroup->_is_nil())
- return;
-
- // get IDs from smesh group
- SMESH::long_array_var anElementsIds = new SMESH::long_array;
- anElementsIds = aGroup->GetListOfID();
- for (int i = 0; i < anElementsIds->length(); i++) {
- myElementsId += QString(" %1").arg(anElementsIds[i]);
- }
- aNbUnits = anElementsIds->length();
- }
- */
- } else {
+ SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aString);
+ }
+ else {
aNbUnits = SMESH::GetNameOfSelectedElements( mySelector, aList.First(), aString);
myElementsId = aString;
if (aNbUnits < 1)
return;
}
-
myNbOkElements = true;
- } else {
+ }
+ else // set coordinates by a picked node
+ {
Handle(SALOME_InteractiveObject) IO = aList.First();
- if ((SMESH::GetMeshByIO(IO))->_is_nil())
- return;
- SMESH_Actor* anActor = SMESH::FindActorByObject(SMESH::GetMeshByIO(IO));
+ SMESH_Actor* anActor = SMESH::FindActorByEntry( IO->getEntry() );
if (!anActor)
- anActor = SMESH::FindActorByEntry(IO->getEntry());
- if (!anActor && !CheckBoxMesh->isChecked())
return;
aNbUnits = SMESH::GetNameOfSelectedNodes(mySelector, IO, aString);
//=================================================================================
void SMESHGUI_SymmetryDlg::setFilters()
{
- if(myMeshes.isEmpty()) {
- SUIT_MessageBox::critical(this,
- tr("SMESH_ERROR"),
- tr("NO_MESH_SELECTED"));
- return;
+ if ( myMeshes.isEmpty() ) {
+ SUIT_MessageBox::critical(this, tr("SMESH_ERROR"), tr("NO_MESH_SELECTED"));
+ return;
}
- if ( !myFilterDlg )
+ if ( !myFilterDlg ) {
myFilterDlg = new SMESHGUI_FilterDlg( mySMESHGUI, SMESH::ALL );
+ connect(myFilterDlg, SIGNAL(Accepted()), SLOT(onFilterAccepted()));
+ }
+ QList<int> types;
+ if ( myMeshes[0]->NbEdges() ) types << SMESH::EDGE;
+ if ( myMeshes[0]->NbFaces() ) types << SMESH::FACE;
+ if ( myMeshes[0]->NbVolumes() ) types << SMESH::VOLUME;
+ if ( myMeshes[0]->NbBalls() ) types << SMESH::BALL;
+ if ( myMeshes[0]->Nb0DElements()) types << SMESH::ELEM0D;
+ if ( types.count() > 1 ) types << SMESH::ALL;
+
+ myFilterDlg->Init( types );
myFilterDlg->SetSelection();
myFilterDlg->SetMesh( myMeshes[0] );
myFilterDlg->SetSourceWg( LineEditElements );
myFilterDlg->show();
}
+//=======================================================================
+// name : onFilterAccepted()
+// Purpose : SLOT. Called when Filter dlg closed with OK button.
+// Activate [Apply] if no Actor is available
+//=======================================================================
+void SMESHGUI_SymmetryDlg::onFilterAccepted()
+{
+ if ( myMeshes.length() > 0 && !buttonOk->isEnabled() )
+ {
+ myElementsId = LineEditElements->text();
+ QStringList aListElementsId = myElementsId.split(" ", QString::SkipEmptyParts);
+ myNbOkElements = aListElementsId.count();
+ buttonOk->setEnabled( myNbOkElements );
+ buttonApply->setEnabled( myNbOkElements );
+ }
+}
+
//=================================================================================
// function : isValid
// purpose :
// function : onDisplaySimulation
// purpose : Show/Hide preview
//=================================================================================
-void SMESHGUI_SymmetryDlg::onDisplaySimulation( bool toDisplayPreview ) {
- if (myPreviewCheckBox->isChecked() && toDisplayPreview) {
- if ( myNbOkElements && isValid() && IsMirrorOk() ) {
- QStringList aListElementsId = myElementsId.split(" ", QString::SkipEmptyParts);
+void SMESHGUI_SymmetryDlg::onDisplaySimulation( bool toDisplayPreview )
+{
+ if (myPreviewCheckBox->isChecked() && toDisplayPreview)
+ {
+ if ( myNbOkElements && isValid() && IsMirrorOk() )
+ {
+ QStringList aListElementsId = myElementsId.split(" ", QString::SkipEmptyParts);
SMESH::long_array_var anElementsId = new SMESH::long_array;
anElementsId->length(aListElementsId.count());
SMESH::AxisStruct aMirror;
SMESH::SMESH_MeshEditor::MirrorType aMirrorType;
-
+
getMirror(aMirror,aMirrorType);
try {
}
else {
SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[0]->GetMeshEditPreviewer();
- aMeshEditor->Mirror(anElementsId, aMirror, aMirrorType, copy );
+ aMeshEditor->Mirror(anElementsId, aMirror, aMirrorType, copy );
aMeshPreviewStruct << aMeshEditor->GetPreviewData();
}
setSimulationPreview(aMeshPreviewStruct);
}
} else {
hidePreview();
- }
+ }
} else {
hidePreview();
}
// function : getMirror
// purpose : return mirror parameters
//=================================================================================
-void SMESHGUI_SymmetryDlg::getMirror(SMESH::AxisStruct& theMirror, SMESH::SMESH_MeshEditor::MirrorType& theMirrorType) {
+void SMESHGUI_SymmetryDlg::getMirror(SMESH::AxisStruct& theMirror,
+ SMESH::SMESH_MeshEditor::MirrorType& theMirrorType)
+{
theMirror.x = SpinBox_X->GetValue();
theMirror.y = SpinBox_Y->GetValue();
theMirror.z = SpinBox_Z->GetValue();
protected slots:
virtual void onDisplaySimulation( bool );
virtual void reject();
+ void onFilterAccepted();
private slots:
void ConstructorsClicked( int );
void SMESHGUI_TranslationDlg::SelectionIntoArgument()
{
if (myBusy) return;
+ if (myFilterDlg && myFilterDlg->isVisible()) return; // filter dlg active
+
BusyLocker lock( myBusy );
// clear
myActor = 0;
return;
int aNbUnits = 0;
- if (myEditCurrentArgument == (QWidget*)LineEditElements) {
+ if (myEditCurrentArgument == (QWidget*)LineEditElements)
+ {
myElementsId = "";
myObjects.clear();
myObjectsNames.clear();
myMeshes.clear();
- for ( SALOME_ListIteratorOfListIO it( aList ); it.More(); it.Next() ) {
+ for ( SALOME_ListIteratorOfListIO it( aList ); it.More(); it.Next() )
+ {
Handle(SALOME_InteractiveObject) IO = it.Value();
SMESH::SMESH_Mesh_var aMesh = SMESH::GetMeshByIO( IO );
if ( aMesh->_is_nil() )
if ( !anActor )
anActor = SMESH::FindActorByEntry( IO->getEntry() );
- if ( !anActor && !CheckBoxMesh->isChecked() )
- return;
-
- if ( !SMESH::IObjectToInterface<SMESH::SMESH_IDSource>( IO )->_is_nil() ) {
- if ( _PTR(Study) aStudy = SMESH::GetActiveStudyDocument() ) {
- _PTR(SObject) obj = aStudy->FindObjectID( qPrintable( QString( IO->getEntry() ) ) );
- _PTR(GenericAttribute) anAttr;
- if ( obj && obj->FindAttribute( anAttr, "AttributeName" ) ) {
- _PTR(AttributeName) aNameAttr( anAttr );
- myObjects << SMESH::IObjectToInterface<SMESH::SMESH_IDSource>( IO );
- myObjectsNames << aNameAttr->Value().c_str();
- myMeshes << aMesh;
- }
+ // if ( !anActor && !CheckBoxMesh->isChecked() ) -- elems can be selected by Filter
+ // return;
+
+ SMESH::SMESH_IDSource_var idSrc = SMESH::IObjectToInterface<SMESH::SMESH_IDSource>( IO );
+ if ( _PTR(SObject) obj = SMESH::FindSObject( idSrc ))
+ {
+ std::string name = obj->GetName();
+ if ( !name.empty() )
+ {
+ myObjects << idSrc;
+ myObjectsNames << name.c_str();
+ myMeshes << aMesh;
}
}
-
- myActor = anActor;
+ if ( anActor )
+ myActor = anActor;
}
-
+
// MakeGroups is available if there are groups and "Copy"
int aNbGroups = 0;
for ( int i = 0; i < myMeshes.count(); i++ )
}
if (CheckBoxMesh->isChecked()) {
- SMESH::GetNameOfSelectedIObjects( mySelectionMgr, aString );
if (myMeshes.isEmpty())
return;
- } else {
+ SMESH::GetNameOfSelectedIObjects( mySelectionMgr, aString );
+ }
+ else {
aNbUnits = SMESH::GetNameOfSelectedElements(mySelector, aList.First(), aString);
myElementsId = aString;
if (aNbUnits < 1)
}
myNbOkElements = true;
- } else {
+ }
+ else // set coordinates by a picked node
+ {
Handle(SALOME_InteractiveObject) IO = aList.First();
- if ((SMESH::GetMeshByIO(IO))->_is_nil())
- return;
- SMESH_Actor* anActor = SMESH::FindActorByObject(SMESH::GetMeshByIO(IO));
+ SMESH_Actor* anActor = SMESH::FindActorByEntry( IO->getEntry() );
if (!anActor)
- anActor = SMESH::FindActorByEntry(IO->getEntry());
- if (!anActor && !CheckBoxMesh->isChecked())
return;
+
aNbUnits = SMESH::GetNameOfSelectedNodes(mySelector, IO, aString);
if (aNbUnits != 1)
return;
//=================================================================================
void SMESHGUI_TranslationDlg::setFilters()
{
- if(myMeshes.isEmpty()) {
- SUIT_MessageBox::critical(this,
- tr("SMESH_ERROR"),
- tr("NO_MESH_SELECTED"));
- return;
+ if ( myMeshes.isEmpty() ) {
+ SUIT_MessageBox::critical(this, tr("SMESH_ERROR"), tr("NO_MESH_SELECTED"));
+ return;
}
- if ( !myFilterDlg )
+ if ( !myFilterDlg ) {
myFilterDlg = new SMESHGUI_FilterDlg( mySMESHGUI, SMESH::ALL );
+ connect(myFilterDlg, SIGNAL(Accepted()), SLOT(onFilterAccepted()));
+ }
+ QList<int> types;
+ if ( myMeshes[0]->NbEdges() ) types << SMESH::EDGE;
+ if ( myMeshes[0]->NbFaces() ) types << SMESH::FACE;
+ if ( myMeshes[0]->NbVolumes() ) types << SMESH::VOLUME;
+ if ( myMeshes[0]->NbBalls() ) types << SMESH::BALL;
+ if ( myMeshes[0]->Nb0DElements()) types << SMESH::ELEM0D;
+ if ( types.count() > 1 ) types << SMESH::ALL;
+
+ myFilterDlg->Init( types );
myFilterDlg->SetSelection();
myFilterDlg->SetMesh( myMeshes[0] );
myFilterDlg->SetSourceWg( LineEditElements );
myFilterDlg->show();
}
+//=======================================================================
+// name : onFilterAccepted()
+// Purpose : SLOT. Called when Filter dlg closed with OK button.
+// Activate [Apply] if no Actor is available
+//=======================================================================
+void SMESHGUI_TranslationDlg::onFilterAccepted()
+{
+ if ( myMeshes.length() > 0 && !buttonOk->isEnabled() )
+ {
+ myElementsId = LineEditElements->text();
+ QStringList aListElementsId = myElementsId.split(" ", QString::SkipEmptyParts);
+ myNbOkElements = aListElementsId.count();
+ buttonOk->setEnabled( myNbOkElements );
+ buttonApply->setEnabled( myNbOkElements );
+ }
+}
+
//=================================================================================
// function : isValid
// purpose :
//=================================================================================
void SMESHGUI_TranslationDlg::onDisplaySimulation( bool toDisplayPreview )
{
- if (myPreviewCheckBox->isChecked() && toDisplayPreview) {
-
- if (isValid() && myNbOkElements) {
+ if (myPreviewCheckBox->isChecked() && toDisplayPreview)
+ {
+ if (isValid() && myNbOkElements)
+ {
QStringList aListElementsId = myElementsId.split(" ", QString::SkipEmptyParts);
SMESH::long_array_var anElementsId = new SMESH::long_array;
protected slots:
virtual void onDisplaySimulation( bool );
virtual void reject();
+ void onFilterAccepted();
private slots:
void ConstructorsClicked( int );
aPixmap->SetPixMap( pmName );
_PTR(ChildIterator) anIter = aStudy->NewChildIterator(theSObject);
- for (int i = 1; anIter->More(); anIter->Next(), i++) {
+ for ( ; anIter->More(); anIter->Next() ) {
_PTR(SObject) aSObj = anIter->Value();
- /*if (i >= 1)*/ {
+ if ( aSObj->Tag() >= SMESH::Tag_FirstSubMesh )
+ {
_PTR(ChildIterator) anIter1 = aStudy->NewChildIterator(aSObj);
for ( ; anIter1->More(); anIter1->Next())
{
else
aPixmap->SetPixMap( "ICON_SMESH_TREE_GROUP" );
}
- else
+ else // is it necessary?
{
if ( !theIsNotModif )
aPixmap->SetPixMap( pmName );
class toStrT : public _STRING {
CORBA::String_var myStr;
public:
- toStrT( char* s ): myStr(s), _STRING( s )
+ toStrT( char* s ): _STRING( s ), myStr(s)
{}
operator const char*() const
{ return myStr.in(); }
anActor->SetVisibility(false);
aStudy->setVisibilityState(theEntry, Qtx::HiddenState);
break;
+ default:;
}
} else {
switch (theAction) {
}
break;
}
+ default:;
}
}
}
}
- bool UpdateView(EDisplaing theAction, const char* theEntry){
+ bool UpdateView(EDisplaing theAction, const char* theEntry) {
//MESSAGE("UpdateView");
SalomeApp_Study* aStudy = dynamic_cast< SalomeApp_Study* >( GetActiveStudy() );
SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( aStudy->application() );
- SUIT_ViewWindow *aWnd = app->activeViewManager()->getActiveView();
- return UpdateView(aWnd,theAction,theEntry);
+ if ( SUIT_ViewManager* vm = app->activeViewManager() )
+ {
+ SUIT_ViewWindow *aWnd = vm->getActiveView();
+ return UpdateView(aWnd,theAction,theEntry);
+ }
+ return false;
}
void UpdateView(){
- if(SVTK_ViewWindow* aWnd = SMESH::GetCurrentVtkView()){
+ if ( SVTK_ViewWindow* aWnd = SMESH::GetCurrentVtkView()) {
LightApp_SelectionMgr* mgr = SMESHGUI::selectionMgr();
SALOME_ListIO selected; mgr->selectedObjects( selected );
bool Update(const Handle(SALOME_InteractiveObject)& theIO, bool theDisplay)
{
- MESSAGE("Update");
+ MESSAGE("Update");
_PTR(Study) aStudy = GetActiveStudyDocument();
CORBA::Long anId = aStudy->StudyId();
if ( TVisualObjPtr aVisualObj = SMESH::GetVisualObj(anId,theIO->getEntry())) {
bool UpdateNulData(const Handle(SALOME_InteractiveObject)& theIO, bool theDisplay)
{
- MESSAGE("UpdateNulData");
+ MESSAGE("UpdateNulData");
_PTR(Study) aStudy = GetActiveStudyDocument();
CORBA::Long anId = aStudy->StudyId();
if ( TVisualObjPtr aVisualObj = SMESH::GetVisualObj(anId,theIO->getEntry(), true)) {
// pcurves
vector< int > edgeIdVec;
GetFaceEdgesIDs( faceID, edgeIdVec );
- for ( int iE = 0; iE < edgeIdVec.size(); iE++ ) // loop on 4 edges
+ for ( size_t iE = 0; iE < edgeIdVec.size(); iE++ ) // loop on 4 edges
{
myCoordInd[ iE ] = GetCoordIndOnEdge( edgeIdVec[ iE ] );
if ( myC2d[ iE ]) delete myC2d[ iE ];
bool isForward[4];
vector< int > edgeIdVec;
GetFaceEdgesIDs( theFaceID, edgeIdVec );
- for ( int iE = 0; iE < edgeIdVec.size(); iE++ ) // loop on 4 edges
+ for ( size_t iE = 0; iE < edgeIdVec.size(); iE++ ) // loop on 4 edges
{
if ( edgeIdVec[ iE ] > theShapeIDMap.Extent() )
return false;
# include <string>
# include <sstream>
-using namespace std;
-
/*!
* \brief Class to generate string from any type
*/
-class SMESH_Comment : public string
+class SMESH_Comment : public std::string
{
- ostringstream _s ;
+ std::ostringstream _s ;
public :
- SMESH_Comment():string("") {}
+ SMESH_Comment():std::string("") {}
- SMESH_Comment(const SMESH_Comment& c):string() {
+ SMESH_Comment(const SMESH_Comment& c):std::string() {
_s << c.c_str() ;
- this->string::operator=( _s.str() );
+ this->std::string::operator=( _s.str() );
}
SMESH_Comment & operator=(const SMESH_Comment& c) {
_s << c.c_str() ;
- this->string::operator=( _s.str() );
+ this->std::string::operator=( _s.str() );
return *this;
}
template <class T>
SMESH_Comment( const T &anything ) {
_s << anything ;
- this->string::operator=( _s.str() );
+ this->std::string::operator=( _s.str() );
}
template <class T>
SMESH_Comment & operator<<( const T &anything ) {
_s << anything ;
- this->string::operator=( _s.str() );
+ this->std::string::operator=( _s.str() );
return *this ;
}
bool SMESH_File::getInts(std::vector<int>& ints)
{
- int i = 0;
+ size_t i = 0;
while ( i < ints.size() )
{
while ( !isdigit( *_pos ) && !eof()) ++_pos;
#else
ssize_t nbWritten = ::write( _file, data, size );
- return ( nbWritten == size );
+ return ( nbWritten == (ssize_t) size );
#endif
}
void BNode::AddClose ( const BEdge* e, double u ) const
{
if ( ! e->Contains( this ))
- myCloseEdges.push_back( make_pair( const_cast< BEdge* >( e ), u ));
+ myCloseEdges.push_back( std::make_pair( const_cast< BEdge* >( e ), u ));
}
BEdge* BNode::GetCloseEdgeOfBorder( int borderID, double * uPtr ) const
{
} // namespace
-// struct needed for NCollection_Map
-struct TLinkHasher
-{
- static int HashCode(const SMESH_TLink& link, int aLimit)
- {
- return ::HashCode( link.node1()->GetID() + link.node2()->GetID(), aLimit );
- }
- static Standard_Boolean IsEqual(const SMESH_TLink& l1, const SMESH_TLink& l2)
- {
- return ( l1.node1() == l2.node1() && l1.node2() == l2.node2() );
- }
-};
-
//================================================================================
/*
* Returns groups of TFreeBorder's coincident within the given tolerance.
CoincidentFreeBorders & foundFreeBordes)
{
// find free links
- typedef NCollection_DataMap<SMESH_TLink, const SMDS_MeshElement*, TLinkHasher > TLink2FaceMap;
+ typedef NCollection_DataMap<SMESH_TLink, const SMDS_MeshElement*, SMESH_TLink > TLink2FaceMap;
TLink2FaceMap linkMap;
int nbSharedLinks = 0;
SMDS_FaceIteratorPtr faceIt = mesh.facesIterator();
// form groups of coincident parts of free borders
- TFreeBorderPart part;
- TCoincidentGroup group;
- vector< BEdge* > ranges; // couples of edges delimiting parts
+ TFreeBorderPart part;
+ TCoincidentGroup group;
+ std::vector< BEdge* > ranges; // couples of edges delimiting parts
BEdge* be = 0; // a current edge
int skipGroup = bEdges.size(); // a group ID used to avoid repeating treatment of edges
addedEdges.insert( bndSegs[i]._edge->twin() ).second )
{
v2n = v2Node.insert( make_pair( bndSegs[i]._edge->vertex0(), v2Node.size() + 1 )).first;
- int n0 = v2n->second;
+ size_t n0 = v2n->second;
if ( n0 == v2Node.size() )
text << "n" << n0 << " = m.AddNode( "
<< bndSegs[i]._edge->vertex0()->x() / theScale[0] << ", "
<< bndSegs[i]._edge->vertex0()->y() / theScale[1] << ", 0 )\n";
v2n = v2Node.insert( make_pair( bndSegs[i]._edge->vertex1(), v2Node.size() + 1 )).first;
- int n1 = v2n->second;
+ size_t n1 = v2n->second;
if ( n1 == v2Node.size() )
text << "n" << n1 << " = m.AddNode( "
<< bndSegs[i]._edge->vertex1()->x() / theScale[0] << ", "
else // bndSegs[ i ]._branchID > 0
{
dInd = +1;
- for ( edgeInd = 0; edgeInd < branchEdges[ brID ].size(); ++edgeInd )
+ for ( edgeInd = 0; edgeInd < (int)branchEdges[ brID ].size(); ++edgeInd )
if ( branchEdges[ brID ][ edgeInd ] == bndSegs[ i ]._edge )
break;
}
int di = ( points._params[0] == points._params[i] ) ? +1 : -1;
while ( points._params[i] == points._params[i+1] )
i += di;
- if ( i < 0 || i+1 >= points._params.size() )
+ if ( i < 0 || i+1 >= (int)points._params.size() )
i = 0;
}
if ( !points._maEdges[ i ].second ) // no branch at the EDGE end, look for a closest branch
{
- if ( i < points._maEdges.size() / 2 ) // near 1st point
+ if ( i < (int)points._maEdges.size() / 2 ) // near 1st point
{
- while ( i < points._maEdges.size()-1 && !points._maEdges[ i ].second )
+ while ( i < (int)points._maEdges.size()-1 && !points._maEdges[ i ].second )
++i;
edgeParam = edgeReverse;
}
if ( p._iEdge > _params.size()-1 )
return false;
if ( p._iEdge == _params.size()-1 )
- return u = 1.;
+ return ( u = 1. );
u = ( _params[ p._iEdge ] * ( 1 - p._edgeParam ) +
_params[ p._iEdge+1 ] * p._edgeParam );
{
// look for a VERTEX of the opposite EDGE
// iNext - next after all null-length segments
- while ( maE = ++iNext )
+ while (( maE = ++iNext ))
{
iSeg2 = getBndSegment( maE );
if ( !_boundary->isConcaveSegment( ie1, iSeg2 ))
else if ( isConcaPrev )
{
// all null-length segments passed, find their beginning
- while ( maE = iPrev.edgePrev() )
+ while (( maE = iPrev.edgePrev() ))
{
iSeg1 = getBndSegment( maE );
if ( _boundary->isConcaveSegment( edgeIDs1.back(), iSeg1 ))
BranchPoint divisionPnt;
divisionPnt._branch = this;
- for ( ++maIter, ++twIter; maIter.index() < _maEdges.size(); ++maIter, ++twIter )
+ for ( ++maIter, ++twIter; maIter.index() < (int)_maEdges.size(); ++maIter, ++twIter )
{
size_t ie1 = getGeomEdge( maIter.edge() );
size_t ie2 = getGeomEdge( twIter.edge() );
ElementBndBoxTree::~ElementBndBoxTree()
{
- for ( int i = 0; i < _elements.size(); ++i )
+ for ( size_t i = 0; i < _elements.size(); ++i )
if ( --_elements[i]->_refCount <= 0 )
delete _elements[i];
}
Bnd_B3d* ElementBndBoxTree::buildRootBox()
{
Bnd_B3d* box = new Bnd_B3d;
- for ( int i = 0; i < _elements.size(); ++i )
+ for ( size_t i = 0; i < _elements.size(); ++i )
box->Add( *_elements[i] );
return box;
}
void ElementBndBoxTree::buildChildrenData()
{
- for ( int i = 0; i < _elements.size(); ++i )
+ for ( size_t i = 0; i < _elements.size(); ++i )
{
for (int j = 0; j < 8; j++)
{
for (int j = 0; j < 8; j++)
{
ElementBndBoxTree* child = static_cast<ElementBndBoxTree*>( myChildren[j]);
- if ( child->_elements.size() <= MaxNbElemsInLeaf )
+ if ((int) child->_elements.size() <= MaxNbElemsInLeaf )
child->myIsLeaf = true;
if ( child->_elements.capacity() - child->_elements.size() > 1000 )
if ( isLeaf() )
{
- for ( int i = 0; i < _elements.size(); ++i )
+ for ( size_t i = 0; i < _elements.size(); ++i )
if ( !_elements[i]->IsOut( point.XYZ() ))
foundElems.insert( _elements[i]->_element );
}
if ( isLeaf() )
{
- for ( int i = 0; i < _elements.size(); ++i )
+ for ( size_t i = 0; i < _elements.size(); ++i )
if ( !_elements[i]->IsOut( line ))
foundElems.insert( _elements[i]->_element );
}
if ( isLeaf() )
{
- for ( int i = 0; i < _elements.size(); ++i )
+ for ( size_t i = 0; i < _elements.size(); ++i )
if ( !_elements[i]->IsOut( center, radius ))
foundElems.insert( _elements[i]->_element );
}
void GetElementsNearLine( const gp_Ax1& line,
SMDSAbs_ElementType type,
vector< const SMDS_MeshElement* >& foundElems);
+ void GetElementsInSphere( const gp_XYZ& center,
+ const double radius,
+ SMDSAbs_ElementType type,
+ vector< const SMDS_MeshElement* >& foundElems);
double getTolerance();
bool getIntersParamOnLine(const gp_Lin& line, const SMDS_MeshElement* face,
const double tolerance, double & param);
{
return _outerFaces.empty() || _outerFaces.count(face);
}
+
struct TInters //!< data of intersection of the line and the mesh face (used in GetPointState())
{
const SMDS_MeshElement* _face;
set< const SMDS_MeshElement*, TIDCompare >::const_iterator face = faces.begin();
for ( ; face != faces.end(); ++face )
{
+ if ( *face == outerFace ) continue;
if ( !SMESH_MeshAlgos::FaceNormal( *face, fNorm, /*normalized=*/false ))
continue;
gp_Vec dirInF = gp_Vec( fNorm ) ^ n1n2;
// store the found outer face and add its links to continue seaching from
if ( outerFace2 )
{
- _outerFaces.insert( outerFace );
- int nbNodes = outerFace2->NbNodes()/( outerFace2->IsQuadratic() ? 2 : 1 );
+ _outerFaces.insert( outerFace2 );
+ int nbNodes = outerFace2->NbCornerNodes();
for ( int i = 0; i < nbNodes; ++i )
{
SMESH_TLink link2( outerFace2->GetNode(i), outerFace2->GetNode((i+1)%nbNodes));
foundElems.assign( suspectFaces.begin(), suspectFaces.end());
}
+//=======================================================================
+/*
+ * Return elements whose bounding box intersects a sphere
+ */
+//=======================================================================
+
+void SMESH_ElementSearcherImpl::GetElementsInSphere( const gp_XYZ& center,
+ const double radius,
+ SMDSAbs_ElementType type,
+ vector< const SMDS_MeshElement* >& foundElems)
+{
+ if ( !_ebbTree || _elementType != type )
+ {
+ if ( _ebbTree ) delete _ebbTree;
+ _ebbTree = new ElementBndBoxTree( *_mesh, _elementType = type, _meshPartIt );
+ }
+ TIDSortedElemSet suspectFaces; // elements possibly intersecting the line
+ _ebbTree->getElementsInSphere( center, radius, suspectFaces );
+ foundElems.assign( suspectFaces.begin(), suspectFaces.end() );
+}
+
//=======================================================================
/*!
* \brief Return true if the point is IN or ON of the element
return GetDistance( dynamic_cast<const SMDS_MeshEdge*>( elem ), point);
case SMDSAbs_Node:
return point.Distance( SMESH_TNodeXYZ( elem ));
+ default:;
}
return -1;
}
// cout << distVec.Magnitude() << " VERTEX " << face->GetNode(pos._index)->GetID() << endl;
return distVec.Magnitude();
}
+ default:;
}
return badDistance;
}
*/
//=======================================================================
-double SMESH_MeshAlgos::GetDistance( const SMDS_MeshEdge* edge, const gp_Pnt& point )
+double SMESH_MeshAlgos::GetDistance( const SMDS_MeshEdge* seg, const gp_Pnt& point )
{
- throw SALOME_Exception(LOCALIZED("not implemented so far"));
+ double dist = Precision::Infinite();
+ if ( !seg ) return dist;
+
+ int i = 0, nbNodes = seg->NbNodes();
+
+ vector< SMESH_TNodeXYZ > xyz( nbNodes );
+ SMDS_ElemIteratorPtr nodeIt = seg->interlacedNodesElemIterator();
+ while ( nodeIt->more() )
+ xyz[ i++ ].Set( nodeIt->next() );
+
+ for ( i = 1; i < nbNodes; ++i )
+ {
+ gp_Vec edge( xyz[i-1], xyz[i] );
+ gp_Vec n1p ( xyz[i-1], point );
+ double u = ( edge * n1p ) / edge.SquareMagnitude(); // param [0,1] on the edge
+ if ( u <= 0. ) {
+ dist = Min( dist, n1p.SquareMagnitude() );
+ }
+ else if ( u >= 1. ) {
+ dist = Min( dist, point.SquareDistance( xyz[i] ));
+ }
+ else {
+ gp_XYZ proj = ( 1. - u ) * xyz[i-1] + u * xyz[i]; // projection of the point on the edge
+ dist = Min( dist, point.SquareDistance( proj ));
+ }
+ }
+ return Sqrt( dist );
}
//=======================================================================
int* n2ind)
{
- int i1, i2;
+ int i1 = 0, i2 = 0;
const SMDS_MeshElement* face = 0;
SMDS_ElemIteratorPtr invElemIt = n1->GetInverseElementIterator(SMDSAbs_Face);
virtual void GetElementsNearLine( const gp_Ax1& line,
SMDSAbs_ElementType type,
std::vector< const SMDS_MeshElement* >& foundElems) = 0;
+ /*!
+ * \brief Return elements whose bounding box intersects a sphere
+ */
+ virtual void GetElementsInSphere( const gp_XYZ& center,
+ const double radius,
+ SMDSAbs_ElementType type,
+ std::vector< const SMDS_MeshElement* >& foundElems) = 0;
/*!
* \brief Find out if the given point is out of closed 2D mesh.
*/
gp_XYZ p1( n1->X(), n1->Y(), n1->Z() );
box->Add(p1);
}
- if ( myNodes.size() <= getMaxNbNodes() )
+ if ((int) myNodes.size() <= getMaxNbNodes() )
myIsLeaf = true;
return box;
for (int i = 0; i < 8; i++)
{
SMESH_OctreeNode* myChild = dynamic_cast<SMESH_OctreeNode*> (myChildren[i]);
- if ( myChild->myNodes.size() <= getMaxNbNodes() )
+ if ((int) myChild->myNodes.size() <= getMaxNbNodes() )
myChild->myIsLeaf = true;
}
}
myFather(0),
myIsLeaf( false ),
myLimit( limit ),
- myLevel(0),
- myBox(0)
+ myBox(0),
+ myLevel(0)
{
//if ( !myLimit ) myLimit = new SMESH_TreeLimit();
}
struct Deleter
{
TOBJ* _obj;
- Deleter( TOBJ* obj = (TOBJ*)NULL ): _obj( obj ) {}
+ explicit Deleter( TOBJ* obj = (TOBJ*)NULL ): _obj( obj ) {}
~Deleter() { delete _obj; _obj = 0; }
+ TOBJ& operator*() const { return *_obj; }
+ TOBJ* operator->() const { return _obj; }
+ operator bool() const { return _obj; }
private:
Deleter( const Deleter& );
};
{ if ( first->GetID() < second->GetID() ) std::swap( first, second ); }
const SMDS_MeshNode* node1() const { return first; }
const SMDS_MeshNode* node2() const { return second; }
+
+ // methods for usage of SMESH_TLink as a hasher in NCollection maps
+ static int HashCode(const SMESH_TLink& link, int aLimit)
+ {
+ return ::HashCode( link.node1()->GetID() + link.node2()->GetID(), aLimit );
+ }
+ static Standard_Boolean IsEqual(const SMESH_TLink& l1, const SMESH_TLink& l2)
+ {
+ return ( l1.node1() == l2.node1() && l1.node2() == l2.node2() );
+ }
};
//=======================================================================
Threshold = SMESH + types[ iGeom ];
#ifdef _DEBUG_
// is types complete? (compilation failure mains that enum GeometryType changed)
- int _assert[( sizeof(types) / sizeof(const char*) == nbTypes ) ? 1 : -1 ];
+ int _assert[( sizeof(types) / sizeof(const char*) == nbTypes ) ? 1 : -1 ]; _assert[0]=1;
#endif
}
if (Type == "SMESH.FT_EntityType")
Threshold = SMESH + types[ iGeom ];
#ifdef _DEBUG_
// is types complete? (compilation failure mains that enum EntityType changed)
- int _assert[( sizeof(types) / sizeof(const char*) == nbTypes ) ? 1 : -1 ];
+ int _assert[( sizeof(types) / sizeof(const char*) == nbTypes ) ? 1 : -1 ]; _assert[0]=1;
#endif
}
}
TCollection_AsciiString grIDs = theCommand->GetResultValue();
list< _pyID > idList = theCommand->GetStudyEntries( grIDs );
list< _pyID >::iterator grID = idList.begin();
- const int nbGroupsBefore = myGroups.size();
+ const size_t nbGroupsBefore = myGroups.size();
Handle(_pyObject) obj;
for ( ; grID != idList.end(); ++grID )
{
{
if ( myCurCrMethod )
{
- while ( myCurCrMethod->myArgs.size() < argNb )
+ while ( (int) myCurCrMethod->myArgs.size() < argNb )
myCurCrMethod->myArgs.push_back( "None" );
if ( arg.IsEmpty() )
myCurCrMethod->myArgs[ argNb-1 ] = "None";
for ( ; type2meth != myAlgoType2CreationMethod.end(); ++type2meth )
{
CreationMethod& crMethod = type2meth->second;
- while ( crMethod.myArgs.size() < i+1 )
+ while ( (int) crMethod.myArgs.size() < i+1 )
crMethod.myArgs.push_back( "[]" );
crMethod.myArgs[ i ] = theCommand->GetArg( 1 ); // arg value
}
public:
_pyCommand() {};
_pyCommand( const _AString& theString, int theNb=-1 )
- : myString( theString ), myOrderNb( theNb ) {};
+ : myOrderNb( theNb ), myString( theString ) {};
_AString & GetString() { return myString; }
int GetOrderNb() const { return myOrderNb; }
void SetOrderNb( int theNb ) { myOrderNb = theNb; }
myStream << "[ ";
for ( size_t i = 1; i <= theVarValue.myVals.size(); ++i )
{
- if ( myVarsCounter < varIDs.size() && varIDs[ myVarsCounter ] >= 0 )
+ if ( myVarsCounter < (int)varIDs.size() && varIDs[ myVarsCounter ] >= 0 )
myStream << TVar::Quote() << varIDs[ myVarsCounter ] << TVar::Quote();
else
myStream << theVarValue.myVals[i-1];
}
else
{
- if ( myVarsCounter < varIDs.size() && varIDs[ myVarsCounter ] >= 0 )
+ if ( myVarsCounter < (int)varIDs.size() && varIDs[ myVarsCounter ] >= 0 )
myStream << TVar::Quote() << varIDs[ myVarsCounter ] << TVar::Quote();
else
myStream << theVarValue.myVals[0];
else
{
theStream << "[ ";
- for (int i = 1; i <= theArray.length(); i++) {
+ for (CORBA::ULong i = 1; i <= theArray.length(); i++) {
theStream << theArray[i-1];
if ( i < theArray.length() )
theStream << ", ";
TPythonDump::operator<<(const SMESH::string_array& theArray)
{
myStream << "[ ";
- for (int i = 1; i <= theArray.length(); i++) {
+ for ( CORBA::ULong i = 1; i <= theArray.length(); i++ ) {
myStream << "'" << theArray[i-1] << "'";
if ( i < theArray.length() )
myStream << ", ";
for ( CORBA::ULong iP = 0; iP < aGRP.length(); ++iP )
{
const SMESH::FreeBorderPart& aPART = aGRP[ iP ];
- if ( 0 <= aPART.border && aPART.border < theCFB.borders.length() )
+ if ( 0 <= aPART.border && aPART.border < (CORBA::Long)theCFB.borders.length() )
{
if ( iP ) myStream << ", ";
const SMESH::FreeBorder& aBRD = theCFB.borders[ aPART.border ];
if ( importGeom && isMultiFile )
{
initPart += ("\n## import GEOM dump file ## \n"
- "import string, os, sys, re\n"
- "sys.path.insert( 0, os.path.dirname(__file__) )\n"
- "exec(\"from \"+re.sub(\"SMESH$\",\"GEOM\",__name__)+\" import *\")\n");
+ "import string, os, sys, re, inspect\n"
+ "thisFile = inspect.getfile( inspect.currentframe() )\n"
+ "thisModule = os.path.splitext( os.path.basename( thisFile ))[0]\n"
+ "sys.path.insert( 0, os.path.dirname( thisFile ))\n"
+ "exec(\"from \"+re.sub(\"SMESH$\",\"GEOM\",thisModule)+\" import *\")\n\n");
}
// import python files corresponding to plugins if they are used in anUpdatedScript
{
initPart += importStr + "\n";
}
- if( isMultiFile )
+ if ( isMultiFile )
initPart += "def RebuildData(theStudy):";
initPart += "\n";
anUpdatedScript += removeObjPart + '\n' + setNamePart + '\n' + visualPropertiesPart;
- if( isMultiFile )
- anUpdatedScript += "\n\tpass";
+ if ( isMultiFile )
+ {
+ anUpdatedScript +=
+ "\n\tpass"
+ "\n"
+ "\nif __name__ == '__main__':"
+ "\n\tSMESH_RebuildData = RebuildData"
+ "\n\texec('import '+re.sub('SMESH$','GEOM',thisModule)+' as GEOM_dump')"
+ "\n\tGEOM_dump.RebuildData( salome.myStudy )"
+ "\n\texec('from '+re.sub('SMESH$','GEOM',thisModule)+' import * ')"
+ "\n\tSMESH_RebuildData( salome.myStudy )";
+ }
anUpdatedScript += "\n";
// no need now as we use 'tab' and 'nt' variables depending on isMultiFile
TCollection_AsciiString aLongString, aFunctionType;
int where = 1;
- set< string > functionNameSet;
+ std::set< std::string > functionNameSet;
while ( SMESH::TPythonDump::CutoutLongString( anUpdatedScript, where, aLongString, aFunctionType ))
{
// make a python string literal
return TopoDS_Shape();
}
-static std::string getShapeNameByID (const char* theID)
-{
- if ( theID && strlen( theID ) > 0 ) {
- SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
- SALOMEDS::Study_var aStudy = aSMESHGen->GetCurrentStudy();
- if ( !aStudy->_is_nil() ) {
- SALOMEDS::SObject_wrap aSObj = aStudy->FindObjectID(theID);
- if ( !aSObj->_is_nil() ) {
- CORBA::String_var name = aSObj->GetName();
- return name.in();
- }
- }
- }
- return "";
-}
+// static std::string getShapeNameByID (const char* theID)
+// {
+// if ( theID && strlen( theID ) > 0 ) {
+// SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
+// SALOMEDS::Study_var aStudy = aSMESHGen->GetCurrentStudy();
+// if ( !aStudy->_is_nil() ) {
+// SALOMEDS::SObject_wrap aSObj = aStudy->FindObjectID(theID);
+// if ( !aSObj->_is_nil() ) {
+// CORBA::String_var name = aSObj->GetName();
+// return name.in();
+// }
+// }
+// }
+// return "";
+// }
/*
FUNCTORS
{
case SMESH::ConnectedElements::POINT: // read 3 node coordinates ///////////////////
{
- vector< double > xyz;
+ std::vector< double > xyz;
char* endptr;
do
{
Class : LogicalNOT_i
Description : Logical NOT predicate
*/
-LogicalNOT_i::LogicalNOT_i()
-: myPredicate( NULL ),
- myLogicalNOTPtr( new Controls::LogicalNOT() )
+LogicalNOT_i::LogicalNOT_i():
+ myLogicalNOTPtr( new Controls::LogicalNOT() ),
+ myPredicate( NULL )
{
myFunctorPtr = myPredicatePtr = myLogicalNOTPtr;
}
#ifdef _DEBUG_
// check if functName is complete, compilation failure means that enum FunctorType changed
const int nbFunctors = sizeof(functName) / sizeof(const char*);
- int _assert[( nbFunctors == SMESH::FT_Undefined + 1 ) ? 1 : -1 ];
+ int _assert[( nbFunctors == SMESH::FT_Undefined + 1 ) ? 1 : -1 ]; _assert[0]=1;
#endif
return functName;
msgToGUI = "preferences/SMESH/forget_mesh_on_hyp_modif/";
msgToGUI += myToForgetMeshDataOnHypModif ? "true" : "false";
}
+ else if ( strcmp(name, "default_grp_color") == 0 )
+ {
+ vector<int> color;
+ string str = value;
+ // color must be presented as a string of next form:
+ if ( str.at(0) == '#' && str.length() == 7 ) { // hexadecimal color ("#ffaa00", for example)
+ str = str.substr(1);
+ for ( size_t i = 0; i < str.length()/2; i++ )
+ if ( str.at(i*2) >= '0' && str.at(i*2) <= 'f' && str.at(i*2+1) >= '0' && str.at(i*2+1) <= 'f' )
+ color.push_back( strtol( str.substr( i*2, 2 ).c_str(), NULL, 16 ) );
+ }
+ else { // rgb color ("255,170,0", for example)
+ char* tempValue = strdup( value );
+ char* colorValue = strtok( tempValue, "," );
+ while ( colorValue != NULL ) {
+ int c_value = atoi( colorValue );
+ if ( c_value >= 0 && c_value <= 255 )
+ color.push_back( c_value );
+ colorValue = strtok( NULL, "," );
+ }
+ }
+ if ( color.size() == 3 ) { // color must have three valid component
+ SMESHDS_GroupBase::SetDefaultColor( Quantity_Color( color[0]/255., color[1]/255., color[2]/255., Quantity_TOC_RGB ) );
+ myDefaultGroupColor = value;
+ msgToGUI = "preferences/SMESH/default_grp_color/";
+ msgToGUI += value;
+ }
+ }
// update preferences in case if SetOption() is invoked from python console
if ( !msgToGUI.empty() )
{
return CORBA::string_dup( myToForgetMeshDataOnHypModif ? "true" : "false" );
}
+ if ( strcmp(name, "default_grp_color") == 0 )
+ {
+ return CORBA::string_dup( myDefaultGroupColor.c_str() );
+ }
}
return CORBA::string_dup( "" );
}
aPythonDump << "], status) = " << this << "." << theCommandNameForPython << "(r'" << theFileNameForPython << "')";
}
// Dump creation of groups
- for ( int i = 0; i < aResult->length(); ++i )
+ for ( CORBA::ULong i = 0; i < aResult->length(); ++i )
SMESH::ListOfGroups_var groups = aResult[ i ]->GetGroups();
return aResult._retn();
aPythonDump << "], status) = " << this << ".CreateMeshesFromCGNS(r'" << theFileName << "')";
}
// Dump creation of groups
- for ( int i = 0; i < aResult->length(); ++i )
+ for ( CORBA::ULong i = 0; i < aResult->length(); ++i )
SMESH::ListOfGroups_var groups = aResult[ i ]->GetGroups();
#else
THROW_SALOME_CORBA_EXCEPTION("CGNS library is unavailable", SALOME::INTERNAL_ERROR);
*/
//=============================================================================
-SMESH::long_array* SMESH_Gen_i::GetSubShapesId( GEOM::GEOM_Object_ptr theMainShapeObject,
- const SMESH::object_array& theListOfSubShapeObject )
- throw ( SALOME::SALOME_Exception )
+SMESH::long_array*
+SMESH_Gen_i::GetSubShapesId( GEOM::GEOM_Object_ptr theMainShapeObject,
+ const SMESH::object_array& theListOfSubShapeObject )
+ throw ( SALOME::SALOME_Exception )
{
Unexpect aCatch(SALOME_SalomeException);
if(MYDEBUG) MESSAGE( "SMESH_Gen_i::GetSubShapesId" );
set<int> setId;
if ( CORBA::is_nil( theMainShapeObject ) )
- THROW_SALOME_CORBA_EXCEPTION( "bad shape object reference",
- SALOME::BAD_PARAM );
+ THROW_SALOME_CORBA_EXCEPTION( "bad shape object reference", SALOME::BAD_PARAM );
try
- {
- TopoDS_Shape myMainShape = GeomObjectToShape(theMainShapeObject);
- TopTools_IndexedMapOfShape myIndexToShape;
- TopExp::MapShapes(myMainShape,myIndexToShape);
+ {
+ TopoDS_Shape myMainShape = GeomObjectToShape(theMainShapeObject);
+ TopTools_IndexedMapOfShape myIndexToShape;
+ TopExp::MapShapes(myMainShape,myIndexToShape);
- for ( int i = 0; i < theListOfSubShapeObject.length(); i++ )
- {
- GEOM::GEOM_Object_var aShapeObject
- = GEOM::GEOM_Object::_narrow(theListOfSubShapeObject[i]);
- if ( CORBA::is_nil( aShapeObject ) )
- THROW_SALOME_CORBA_EXCEPTION ("bad shape object reference", \
- SALOME::BAD_PARAM );
-
- TopoDS_Shape locShape = GeomObjectToShape(aShapeObject);
- for (TopExp_Explorer exp(locShape,TopAbs_FACE); exp.More(); exp.Next())
- {
- const TopoDS_Face& F = TopoDS::Face(exp.Current());
- setId.insert(myIndexToShape.FindIndex(F));
- if(MYDEBUG) SCRUTE(myIndexToShape.FindIndex(F));
- }
- for (TopExp_Explorer exp(locShape,TopAbs_EDGE); exp.More(); exp.Next())
- {
- const TopoDS_Edge& E = TopoDS::Edge(exp.Current());
- setId.insert(myIndexToShape.FindIndex(E));
- if(MYDEBUG) SCRUTE(myIndexToShape.FindIndex(E));
- }
- for (TopExp_Explorer exp(locShape,TopAbs_VERTEX); exp.More(); exp.Next())
- {
- const TopoDS_Vertex& V = TopoDS::Vertex(exp.Current());
- setId.insert(myIndexToShape.FindIndex(V));
- if(MYDEBUG) SCRUTE(myIndexToShape.FindIndex(V));
- }
- }
- shapesId->length(setId.size());
- set<int>::iterator iind;
- int i=0;
- for (iind = setId.begin(); iind != setId.end(); iind++)
- {
- if(MYDEBUG) SCRUTE((*iind));
- shapesId[i] = (*iind);
- if(MYDEBUG) SCRUTE(shapesId[i]);
- i++;
- }
+ for ( CORBA::ULong i = 0; i < theListOfSubShapeObject.length(); i++ )
+ {
+ GEOM::GEOM_Object_var aShapeObject
+ = GEOM::GEOM_Object::_narrow(theListOfSubShapeObject[i]);
+ if ( CORBA::is_nil( aShapeObject ) )
+ THROW_SALOME_CORBA_EXCEPTION ("bad shape object reference", \
+ SALOME::BAD_PARAM );
+
+ TopoDS_Shape locShape = GeomObjectToShape(aShapeObject);
+ for (TopExp_Explorer exp(locShape,TopAbs_FACE); exp.More(); exp.Next())
+ {
+ const TopoDS_Face& F = TopoDS::Face(exp.Current());
+ setId.insert(myIndexToShape.FindIndex(F));
+ if(MYDEBUG) SCRUTE(myIndexToShape.FindIndex(F));
+ }
+ for (TopExp_Explorer exp(locShape,TopAbs_EDGE); exp.More(); exp.Next())
+ {
+ const TopoDS_Edge& E = TopoDS::Edge(exp.Current());
+ setId.insert(myIndexToShape.FindIndex(E));
+ if(MYDEBUG) SCRUTE(myIndexToShape.FindIndex(E));
+ }
+ for (TopExp_Explorer exp(locShape,TopAbs_VERTEX); exp.More(); exp.Next())
+ {
+ const TopoDS_Vertex& V = TopoDS::Vertex(exp.Current());
+ setId.insert(myIndexToShape.FindIndex(V));
+ if(MYDEBUG) SCRUTE(myIndexToShape.FindIndex(V));
+ }
}
- catch (SALOME_Exception& S_ex)
+ shapesId->length(setId.size());
+ set<int>::iterator iind;
+ int i=0;
+ for (iind = setId.begin(); iind != setId.end(); iind++)
{
- THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), SALOME::BAD_PARAM);
+ if(MYDEBUG) SCRUTE((*iind));
+ shapesId[i] = (*iind);
+ if(MYDEBUG) SCRUTE(shapesId[i]);
+ i++;
}
+ }
+ catch (SALOME_Exception& S_ex)
+ {
+ THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), SALOME::BAD_PARAM);
+ }
return shapesId._retn();
}
MapShapeNbElemsItr anIt = aResMap.begin();
for(; anIt!=aResMap.end(); anIt++) {
const vector<int>& aVec = (*anIt).second;
- for(i = SMESH::Entity_Node; i < aVec.size(); i++) {
+ for ( i = SMESH::Entity_Node; i < (int)aVec.size(); i++ ) {
int nbElem = aVec[i];
if ( nbElem < 0 ) // algo failed, check that it has reported a message
{
- SMESH_subMesh* sm = anIt->first;
+ SMESH_subMesh* sm = anIt->first;
SMESH_ComputeErrorPtr& error = sm->GetComputeError();
- const SMESH_Algo* algo = sm->GetAlgo();
+ const SMESH_Algo* algo = sm->GetAlgo();
if ( (algo && !error.get()) || error->IsOK() )
error.reset( new SMESH_ComputeError( COMPERR_ALGO_FAILED,"Failed to evaluate",algo));
}
std::vector<const SMDS_MeshNode*> aNodesArray;
// loop on sub-meshes
- for ( int i = 0; i < theMeshesArray.length(); i++)
+ for ( CORBA::ULong i = 0; i < theMeshesArray.length(); i++)
{
if ( CORBA::is_nil( theMeshesArray[i] )) continue;
SMESH::SMESH_Mesh_var anInitMesh = theMeshesArray[i]->GetMesh();
if ( !anInitImpl ) continue;
anInitImpl->Load();
- ::SMESH_Mesh& aInitLocMesh = anInitImpl->GetImpl();
- SMESHDS_Mesh* anInitMeshDS = aInitLocMesh.GetMeshDS();
+ //::SMESH_Mesh& aInitLocMesh = anInitImpl->GetImpl();
+ //SMESHDS_Mesh* anInitMeshDS = aInitLocMesh.GetMeshDS();
// remember nb of elements before filling in
SMESH::long_array_var prevState = aNewMesh->GetNbElementsByType();
const char* typeNames[] = { "All","Nodes","Edges","Faces","Volumes","0DElems","Balls" };
{ // check of typeNames, compilation failure mains that NB_ELEMENT_TYPES changed:
const int nbNames = sizeof(typeNames) / sizeof(const char*);
- int _assert[( nbNames == SMESH::NB_ELEMENT_TYPES ) ? 1 : -1 ];
+ int _assert[( nbNames == SMESH::NB_ELEMENT_TYPES ) ? 1 : -1 ]; _assert[0]=0;
}
string groupName = "Gr";
SALOMEDS::SObject_wrap aMeshSObj = ObjectToSObject( myCurrentStudy, theMeshesArray[i] );
if ( SMESH_Mesh_i* anSrcImpl = SMESH::DownCast<SMESH_Mesh_i*>( theMeshesArray[i] ))
{
// copy orphan nodes
- if ( anSrcImpl->NbNodes() > nodesMap.size() )
+ if ( anSrcImpl->NbNodes() > (int)nodesMap.size() )
{
SMDS_ElemIteratorPtr itNodes = anInitImpl->GetElements( theMeshesArray[i], SMESH::NODE );
while ( itNodes->more() )
// loop on groups of a source mesh
aListOfGroups = anSrcImpl->GetGroups();
- for (int iG = 0; iG < aListOfGroups->length(); iG++)
+ for ( CORBA::ULong iG = 0; iG < aListOfGroups->length(); iG++ )
{
aGroup = aListOfGroups[iG];
aGroupType = aGroup->GetType();
aGroupName = aGroup->GetName();
+ string aName = aGroupName.in();
// convert a list of IDs
anNewIDs->length( aGroup->Size() );
// check a current group name and type don't have identical ones in final mesh
aListOfNewGroups.clear();
- TGroupsMap::iterator anIter = aGroupsMap.find( make_pair( aGroupName, aGroupType ));
+ TGroupsMap::iterator anIter = aGroupsMap.find( make_pair( aName, aGroupType ));
if ( anIter == aGroupsMap.end() ) {
// add a new group in the mesh
- aNewGroup = aNewImpl->CreateGroup( aGroupType, aGroupName );
+ aNewGroup = aNewImpl->CreateGroup( aGroupType, aGroupName.in() );
// add elements into new group
aNewGroup->Add( anNewIDs );
aListOfNewGroups.push_back(aNewGroup);
- aGroupsMap.insert(make_pair( make_pair(aGroupName, aGroupType), aListOfNewGroups ));
+ aGroupsMap.insert(make_pair( make_pair(aName, aGroupType), aListOfNewGroups ));
}
else if ( theUniteIdenticalGroups ) {
else {
// rename identical groups
- aNewGroup = aNewImpl->CreateGroup(aGroupType, aGroupName);
+ aNewGroup = aNewImpl->CreateGroup(aGroupType, aGroupName.in());
aNewGroup->Add( anNewIDs );
TListOfNewGroups& aNewGroups = anIter->second;
string aNewGroupName;
if (aNewGroups.size() == 1) {
- aNewGroupName = string(aGroupName) + "_1";
+ aNewGroupName = aName + "_1";
aNewGroups.front()->SetName(aNewGroupName.c_str());
}
char aGroupNum[128];
- sprintf(aGroupNum, "%u", aNewGroups.size()+1);
- aNewGroupName = string(aGroupName) + "_" + string(aGroupNum);
+ sprintf(aGroupNum, "%u", (unsigned int)aNewGroups.size()+1);
+ aNewGroupName = aName + "_" + string(aGroupNum);
aNewGroup->SetName(aNewGroupName.c_str());
aNewGroups.push_back(aNewGroup);
}
aPythonDump << aNewMesh << " = " << this << "."
<< ( theCommonGroups ? "ConcatenateWithGroups" : "Concatenate" )
<< "([";
- for ( int i = 0; i < theMeshesArray.length(); i++) {
+ for ( CORBA::ULong i = 0; i < theMeshesArray.length(); i++) {
if (i > 0) aPythonDump << ", ";
aPythonDump << theMeshesArray[i];
}
SMESH::long_array_var ids = meshPart->GetIDs();
if ( srcElemTypes->length() == 1 && srcElemTypes[0] == SMESH::NODE ) // group of nodes
{
- for (int i=0; i < ids->length(); i++)
+ for ( CORBA::ULong i=0; i < ids->length(); i++ )
if ( const SMDS_MeshElement * elem = srcMeshDS->FindNode( ids[i] ))
srcElems.insert( elem );
}
else
{
- for (int i=0; i < ids->length(); i++)
+ for ( CORBA::ULong i = 0; i < ids->length(); i++ )
if ( const SMDS_MeshElement * elem = srcMeshDS->FindElement( ids[i] ))
srcElems.insert( elem );
}
TPythonDump pd; // not to dump GetGroups()
SMESH::ListOfGroups_var groups = myMesh->GetGroups();
pd << ""; // to avoid optimizing pd out
- for ( int i = 0; i < groups->length(); ++i )
+ for ( CORBA::ULong i = 0; i < groups->length(); ++i )
{
SMESH_GroupBase_i* grImpl = SMESH::DownCast<SMESH_GroupBase_i*>( groups[i]);
if ( grImpl )
_CORBA_Octet* buffer = new _CORBA_Octet[real_size];
char tmp[3];
tmp[2]='\0';
- int c = -1;
+ uint c = -1;
for ( int i = 0; i < real_size; i++ )
{
memcpy( &(tmp[0]), &(theStream[i*3+1]), 2 );
// Is used in the drag-n-drop functionality.
//=================================================================================
void SMESH_Gen_i::Move( const SMESH::sobject_list& what,
- SALOMEDS::SObject_ptr where,
- CORBA::Long row )
+ SALOMEDS::SObject_ptr where,
+ CORBA::Long row )
{
if ( CORBA::is_nil( where ) ) return;
}
}
- for ( int i = 0; i < what.length(); i++ ) {
+ for ( CORBA::ULong i = 0; i < what.length(); i++ ) {
SALOMEDS::SObject_var sobj = what[i];
if ( CORBA::is_nil( sobj ) ) continue; // skip bad object
// insert the object to the use case tree
CORBA::Double theX,
CORBA::Double theY,
CORBA::Double theZ,
- CORBA::Double theR) {
+ CORBA::Double theR)
+{
SMESH::long_array_var aResult = new SMESH::long_array();
- if(meshPart->_is_nil())
+ if ( meshPart->_is_nil() )
return aResult._retn();
// 1. Create geometrical object
std::vector<long> lst =_GetInside(meshPart, theElemType, aShape);
- if( lst.size() > 0 ) {
+ if ( lst.size() > 0 ) {
aResult->length( lst.size() );
- for ( long i = 0; i < lst.size(); i++ ) {
+ for ( size_t i = 0; i < lst.size(); i++ ) {
aResult[i] = lst[i];
}
}
if( lst.size() > 0 ) {
aResult->length( lst.size() );
- for ( long i = 0; i < lst.size(); i++ ) {
+ for ( size_t i = 0; i < lst.size(); i++ ) {
aResult[i] = lst[i];
}
}
if( lst.size() > 0 ) {
aResult->length( lst.size() );
- for ( long i = 0; i < lst.size(); i++ ) {
+ for ( size_t i = 0; i < lst.size(); i++ ) {
aResult[i] = lst[i];
}
}
if( lst.size() > 0 ) {
aResult->length( lst.size() );
- for ( long i = 0; i < lst.size(); i++ ) {
+ for ( size_t i = 0; i < lst.size(); i++ ) {
aResult[i] = lst[i];
}
}
if ( !gsource->_is_nil() ) {
if(theElemType == SMESH::NODE) {
SMESH::long_array_var nodes = gsource->GetNodeIDs();
- for ( int i = 0; i < nodes->length(); ++i ) {
- if ( const SMDS_MeshNode* node = meshDS->FindNode( nodes[i] ) ) {
+ for ( CORBA::ULong i = 0; i < nodes->length(); ++i ) {
+ if ( const SMDS_MeshNode* node = meshDS->FindNode( nodes[i] )) {
long anId = node->GetID();
if ( anElementsOnShape->IsSatisfy( anId ) )
res.push_back( anId );
}
} else if (gsource->GetType() == theElemType || theElemType == SMESH::ALL ) {
SMESH::long_array_var elems = gsource->GetListOfID();
- for ( int i = 0; i < elems->length(); ++i ) {
- if ( const SMDS_MeshElement* elem = meshDS->FindElement( elems[i] ) ) {
+ for ( CORBA::ULong i = 0; i < elems->length(); ++i ) {
+ if ( const SMDS_MeshElement* elem = meshDS->FindElement( elems[i] )) {
long anId = elem->GetID();
if ( anElementsOnShape->IsSatisfy( anId ) )
res.push_back( anId );
SMESH::SMESH_subMesh_var smsource = SMESH::SMESH_subMesh::_narrow(meshPart);
if ( !smsource->_is_nil() ) {
SMESH::long_array_var elems = smsource->GetElementsByType( theElemType );
- for ( int i = 0; i < elems->length(); ++i ) {
+ for ( CORBA::ULong i = 0; i < elems->length(); ++i ) {
const SMDS_MeshElement* elem = ( theElemType == SMESH::NODE ) ? meshDS->FindNode( elems[i] ) : meshDS->FindElement( elems[i] );
if (elem) {
long anId = elem->GetID();
mapIdToId.clear();
}
// register object in the internal map and return its id
- int addObject( string theIOR )
+ int addObject( std::string theIOR )
{
int nextId = getNextId();
mapIdToIOR[ nextId ] = theIOR;
return nextId;
}
// find the object id in the internal map by the IOR
- int findId( string theIOR )
+ int findId( std::string theIOR )
{
- map<int, string>::iterator imap;
+ std::map<int, std::string>::iterator imap;
for ( imap = mapIdToIOR.begin(); imap != mapIdToIOR.end(); ++imap ) {
if ( imap->second == theIOR )
return imap->first;
return 0;
}
// get object's IOR by id
- string getIORbyId( const int theId )
+ std::string getIORbyId( const int theId )
{
if ( mapIdToIOR.find( theId ) != mapIdToIOR.end() )
return mapIdToIOR[ theId ];
- return string( "" );
+ return std::string( "" );
}
// get object's IOR by old id
- string getIORbyOldId( const int theOldId )
+ std::string getIORbyOldId( const int theOldId )
{
if ( mapIdToId.find( theOldId ) != mapIdToId.end() )
return getIORbyId( mapIdToId[ theOldId ] );
- return string( "" );
+ return std::string( "" );
}
// maps old object id to the new one (used when restoring data)
void mapOldToNew( const int oldId, const int newId ) {
}
// get old id by a new one
int getOldId( const int newId ) {
- map<int, int>::iterator imap;
+ std::map<int, int>::iterator imap;
for ( imap = mapIdToId.begin(); imap != mapIdToId.end(); ++imap ) {
if ( imap->second == newId )
return imap->first;
return id;
}
- map<int, string> mapIdToIOR; // persistent-to-transient map
- map<int, int> mapIdToId; // used to translate object from persistent to transient form
+ std::map<int, std::string> mapIdToIOR; // persistent-to-transient map
+ std::map<int, int> mapIdToId; // to translate object from persistent to transient form
};
// ===========================================================
typename TInterface::_var_type GetObjectByOldId( const int oldID )
{
if ( StudyContext* myStudyContext = GetCurrentStudyContext() ) {
- string ior = myStudyContext->getIORbyOldId( oldID );
+ std::string ior = myStudyContext->getIORbyOldId( oldID );
if ( !ior.empty() )
return TInterface::_narrow(GetORB()->string_to_object( ior.c_str() ));
}
::SMESH_Gen myGen; // SMESH_Gen local implementation
// hypotheses managing
- map<string, GenericHypothesisCreator_i*> myHypCreatorMap;
+ std::map<std::string, GenericHypothesisCreator_i*> myHypCreatorMap;
- map<int, StudyContext*> myStudyContextMap; // Map of study context objects
+ std::map<int, StudyContext*> myStudyContextMap; // Map of study context objects
- GEOM_Client* myShapeReader; // Shape reader
- SALOMEDS::Study_var myCurrentStudy; // Current study
- CORBA::Boolean myIsEmbeddedMode; // Current mode
+ GEOM_Client* myShapeReader; // Shape reader
+ SALOMEDS::Study_var myCurrentStudy; // Current study
+ CORBA::Boolean myIsEmbeddedMode; // Current mode
+
+ // Default color of groups
+ std::string myDefaultGroupColor;
// To load full mesh data from study at hyp modification or not
bool myToForgetMeshDataOnHypModif;
#ifdef _DEBUG_
static int MYDEBUG = 0;
-//static int VARIABLE_DEBUG = 0;
#else
static int MYDEBUG = 0;
-//static int VARIABLE_DEBUG = 0;
#endif
+using namespace std;
+
//=============================================================================
/*!
* Get...Tag [ static ]
SALOMEDS::SObject_wrap curObj;
if ( theFatherObject->GetLastChildTag() > theTag )
{
- SALOMEDS::UseCaseIterator_wrap anUseCaseIter = useCaseBuilder->GetUseCaseIterator(theFatherObject);
+ SALOMEDS::UseCaseIterator_wrap
+ anUseCaseIter = useCaseBuilder->GetUseCaseIterator(theFatherObject);
for ( ; anUseCaseIter->More(); anUseCaseIter->Next() ) {
curObj = anUseCaseIter->Value();
if ( curObj->Tag() > theTag ) {
}
SALOMEDS::GenericAttribute_wrap anAttr;
- if ( !CORBA::is_nil( theIOR )) {
+ if ( !CORBA::is_nil( theIOR ))
+ {
anAttr = aStudyBuilder->FindOrCreateAttribute( SO, "AttributeIOR" );
CORBA::String_var objStr = SMESH_Gen_i::GetORB()->object_to_string( theIOR );
SALOMEDS::AttributeIOR_wrap iorAttr = anAttr;
- iorAttr->SetValue( objStr.in() );
- // UnRegister() !!!
- SALOME::GenericObj_var genObj = SALOME::GenericObj::_narrow( theIOR );
- if ( !genObj->_is_nil() )
- genObj->UnRegister();
+ CORBA::String_var objStrCur = iorAttr->Value();
+ bool sameIOR = ( objStrCur.in() && strcmp( objStr.in(), objStrCur.in() ) == 0 );
+ if ( !sameIOR )
+ {
+ iorAttr->SetValue( objStr.in() );
+ // UnRegister() !!!
+ SALOME::GenericObj_var genObj = SALOME::GenericObj::_narrow( theIOR );
+ if ( !genObj->_is_nil() )
+ genObj->UnRegister();
+ }
}
+
if ( thePixMap ) {
anAttr = aStudyBuilder->FindOrCreateAttribute( SO, "AttributePixMap" );
SALOMEDS::AttributePixMap_wrap pm = anAttr;
pm->SetPixMap( thePixMap );
}
+
if ( !theSelectable ) {
anAttr = aStudyBuilder->FindOrCreateAttribute( SO, "AttributeSelectable" );
SALOMEDS::AttributeSelectable_wrap selAttr = anAttr;
// Publish global hypotheses
SMESH::ListOfHypothesis_var hypList = theMesh->GetHypothesisList( aShapeObject );
- for ( int i = 0; i < hypList->length(); i++ )
+ for ( CORBA::ULong i = 0; i < hypList->length(); i++ )
{
SMESH::SMESH_Hypothesis_var aHyp = SMESH::SMESH_Hypothesis::_narrow( hypList[ i ]);
SALOMEDS::SObject_wrap so = PublishHypothesis( theStudy, aHyp );
// Publish hypothesis
SMESH::ListOfHypothesis_var hypList = theMesh->GetHypothesisList( theShapeObject );
- for ( int i = 0; i < hypList->length(); i++ ) {
+ for ( CORBA::ULong i = 0; i < hypList->length(); i++ ) {
SMESH::SMESH_Hypothesis_var aHyp = SMESH::SMESH_Hypothesis::_narrow( hypList[ i ]);
SALOMEDS::SObject_wrap so = PublishHypothesis( theStudy, aHyp );
AddHypothesisToShape( theStudy, theMesh, theShapeObject, aHyp );
if ( aMeshSO->_is_nil())
return SALOMEDS::SObject::_nil();
}
- int aType = (int)theGroup->GetType();
+ size_t aType = (int)theGroup->GetType();
const char* aRootNames[] = {
"Compound Groups", "Groups of Nodes", "Groups of Edges",
"Groups of Faces", "Groups of Volumes", "Groups of 0D Elements",
SMESH_Mesh_i* theMeshServant,
const int theLocalID )
: SALOME::GenericObj_i( thePOA ),
- myMeshServant( theMeshServant ),
- myLocalID( theLocalID ),
+ myPreMeshInfo(NULL),
myNbNodes(-1),
myGroupDSTic(0),
- myPreMeshInfo(NULL)
+ myMeshServant( theMeshServant ),
+ myLocalID( theLocalID )
{
// PAL7962: san -- To ensure correct mapping of servant and correct reference counting in GenericObj_i,
// servant activation is performed by SMESH_Mesh_i::createGroup()
SMESH_Group_i::SMESH_Group_i( PortableServer::POA_ptr thePOA,
SMESH_Mesh_i* theMeshServant,
const int theLocalID )
- : SALOME::GenericObj_i( thePOA ),
- SMESH_GroupBase_i( thePOA, theMeshServant, theLocalID )
+ : SALOME::GenericObj_i( thePOA ),
+ SMESH_GroupBase_i( thePOA, theMeshServant, theLocalID )
{
//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 )
+ : SALOME::GenericObj_i( thePOA ),
+ SMESH_GroupBase_i( thePOA, theMeshServant, theLocalID )
{
//MESSAGE("SMESH_GroupOnGeom_i; this = "<<this );
}
SMESHDS_Group* aGroupDS = dynamic_cast<SMESHDS_Group*>( GetGroupDS() );
if (aGroupDS) {
int nbAdd = 0;
- for (int i = 0; i < theIDs.length(); i++) {
+ for ( CORBA::ULong i = 0; i < theIDs.length(); i++) {
int anID = (int) theIDs[i];
- if (aGroupDS->Add(anID))
+ if ( aGroupDS->Add( anID ))
nbAdd++;
}
if ( nbAdd )
//=============================================================================
/*!
- *
+ *
*/
//=============================================================================
SMESHDS_Group* aGroupDS = dynamic_cast<SMESHDS_Group*>( GetGroupDS() );
if (aGroupDS) {
int nbDel = 0;
- for (int i = 0; i < theIDs.length(); i++) {
+ for ( CORBA::ULong i = 0; i < theIDs.length(); i++ ) {
int anID = (int) theIDs[i];
- if (aGroupDS->Remove(anID))
+ if ( aGroupDS->Remove( anID ))
nbDel++;
}
if ( nbDel )
//=============================================================================
/*!
- *
+ *
*/
//=============================================================================
*/
//================================================================================
- void getNodesOfElements(SMDS_ElemIteratorPtr elemIt,
- set<const SMDS_MeshNode* >& nodes)
+ void getNodesOfElements(SMDS_ElemIteratorPtr elemIt,
+ std::set<const SMDS_MeshNode* >& nodes)
{
while ( elemIt->more() )
{
{
if ( myNbNodes < 0 || g->GetTic() != myGroupDSTic )
{
- set<const SMDS_MeshNode* > nodes;
+ std::set<const SMDS_MeshNode* > nodes;
getNodesOfElements( g->GetElements(), nodes );
myNbNodes = nodes.size();
myGroupDSTic = g->GetTic();
SMESH::long_array_var aRes = new SMESH::long_array();
if ( SMESHDS_GroupBase* g = GetGroupDS())
{
- set<const SMDS_MeshNode* > nodes;
+ std::set<const SMDS_MeshNode* > nodes;
getNodesOfElements( g->GetElements(), nodes );
aRes->length( nodes.size() );
- set<const SMDS_MeshNode*>::iterator nIt = nodes.begin(), nEnd = nodes.end();
+ std::set<const SMDS_MeshNode*>::iterator nIt = nodes.begin(), nEnd = nodes.end();
for ( int i = 0; nIt != nEnd; ++nIt, ++i )
aRes[i] = (*nIt)->GetID();
}
if ( SMESHDS_GroupBase* g = GetGroupDS())
{
- if ( g->GetType() == SMDSAbs_Node || ( myNbNodes > -1 && g->GetTic() == myGroupDSTic))
+ if ( g->GetType() == SMDSAbs_Node /*|| ( myNbNodes > -1 && g->GetTic() == myGroupDSTic)*/)
aRes[ SMDSEntity_Node ] = GetNumberOfNodes();
if ( g->GetType() != SMDSAbs_Node )
if ( SMESHDS_GroupBase* g = GetGroupDS())
{
- if ( g->GetType() == SMDSAbs_Node || ( myNbNodes > -1 && g->GetTic() == myGroupDSTic))
+ if ( g->GetType() == SMDSAbs_Node /*|| ( myNbNodes > -1 && g->GetTic() == myGroupDSTic)*/)
aRes[ SMDSEntity_Node ] = GetNumberOfNodes();
if ( g->GetType() != SMDSAbs_Node )
{
- vector< int > nbElems = static_cast< SMESHDS_GroupOnFilter* >( g )->GetMeshInfo();
+ std::vector< int > nbElems = static_cast< SMESHDS_GroupOnFilter* >( g )->GetMeshInfo();
for ( size_t i = SMESH::Entity_Node; i < SMESH::Entity_Last; i++)
if ( i < nbElems.size() )
aRes[i] = nbElems[ i ];
return myBaseImpl;
}
+//================================================================================
+/*!
+ * \brief Return true if a hypothesis has parameters
+ */
+//================================================================================
+
+CORBA::Boolean SMESH_Hypothesis_i::HasParameters()
+{
+ std::ostringstream os;
+ myBaseImpl->SaveTo( os );
+ return ( !os.str().empty() );
+}
+
//=============================================================================
/*!
* SMESH_Hypothesis_i::SaveTo
virtual ~SMESH_Hypothesis_i();
// Get type name of hypothesis
- char* GetName();
+ virtual char* GetName();
// Get plugin library name of hypothesis
- char* GetLibName();
+ virtual char* GetLibName();
// Set plugin library name of hypothesis
void SetLibName( const char* theLibName );
// Get unique id of hypothesis
- CORBA::Long GetId();
-
+ virtual CORBA::Long GetId();
+
+ // Return true if a hypothesis has parameters
+ virtual CORBA::Boolean HasParameters();
+
// Set the variable parameter (a variable name or a parameter value); \a method is a name
// of method setting this parameter.
// This method must be called by the hypothesis creator just before calling hyp->method()
- void SetVarParameter (const char* parameter, const char* method);
+ virtual void SetVarParameter (const char* parameter, const char* method);
// Return the variable parameter used at Hypothesis Creation by the name of method
// setting this parameter. The returned variable name is used at Hypothesis Edition.
- char* GetVarParameter (const char* methodName);
+ virtual char* GetVarParameter (const char* methodName);
// Store a hypothesis wrapping this not published one. This hyp, which has
// no own parameters but is published, is used to store variables defining parameters
// of this hypothesis. This method is to be called before setting parameters
// of this hypothesis.
- void SetHolderHypothesis(const SMESH::SMESH_Hypothesis_ptr hyp);
+ virtual void SetHolderHypothesis(const SMESH::SMESH_Hypothesis_ptr hyp);
//Return true if hypothesis was published in study
bool IsPublished();
return theTypes->length() > 0 && theTypes[0] == SMESH::NODE;
}
-static double getNumericalValue(SMESH::SMESH_IDSource_ptr theSource, SMESH::Controls::NumericalFunctorPtr theFunctor)
+static double getNumericalValue(SMESH::SMESH_IDSource_ptr theSource,
+ SMESH::Controls::NumericalFunctorPtr theFunctor)
{
double value = 0;
theFunctor->SetMesh( aMesh );
SMESH::long_array_var anElementsId = theSource->GetIDs();
- for (int i = 0; i < anElementsId->length(); i++) {
+ for ( CORBA::ULong i = 0; i < anElementsId->length(); i++) {
value += theFunctor->GetValue( anElementsId[i] );
}
}
theMeasure.node1 = theNode->GetID();
}
else {
- theMeasure.minX = min( theMeasure.minX, theNode->X() );
- theMeasure.maxX = max( theMeasure.maxX, theNode->X() );
- theMeasure.minY = min( theMeasure.minY, theNode->Y() );
- theMeasure.maxY = max( theMeasure.maxY, theNode->Y() );
- theMeasure.minZ = min( theMeasure.minZ, theNode->Z() );
- theMeasure.maxZ = max( theMeasure.maxZ, theNode->Z() );
+ theMeasure.minX = std::min( theMeasure.minX, theNode->X() );
+ theMeasure.maxX = std::max( theMeasure.maxX, theNode->X() );
+ theMeasure.minY = std::min( theMeasure.minY, theNode->Y() );
+ theMeasure.maxY = std::max( theMeasure.maxY, theNode->Y() );
+ theMeasure.minZ = std::min( theMeasure.minZ, theNode->Z() );
+ theMeasure.maxZ = std::max( theMeasure.maxZ, theNode->Z() );
}
}
SMDS_MeshElement::Filter & filter = *aFilter;
if ( aType == SMDSAbs_Node )
- for (int i=0; i<IDs.length(); i++) {
+ for ( CORBA::ULong i = 0; i < IDs.length(); i++ ) {
const SMDS_MeshElement * elem = aMesh->FindNode( IDs[i] );
if ( filter( elem ))
aMap.insert( aMap.end(), elem );
}
else
- for (int i=0; i<IDs.length(); i++) {
+ for ( CORBA::ULong i = 0; i<IDs.length(); i++) {
const SMDS_MeshElement * elem = aMesh->FindElement( IDs[i] );
if ( filter( elem ))
aMap.insert( aMap.end(), elem );
SMESH::long_array_var aElementsId = theObject->GetIDs();
if ( types->length() == 1 && types[0] == SMESH::NODE)
{
- for(int i = 0; i < aElementsId->length(); i++)
+ for ( CORBA::ULong i = 0; i < aElementsId->length(); i++ )
if ( const SMDS_MeshNode * n = theMeshDS->FindNode( aElementsId[i] ))
theNodeSet.insert( theNodeSet.end(), n);
}
{
SMDS_NodeIteratorPtr nIt = theMeshDS->nodesIterator();
while ( nIt->more( ))
- if( const SMDS_MeshElement * elem = nIt->next() )
+ if ( const SMDS_MeshElement * elem = nIt->next() )
theNodeSet.insert( elem->begin_nodes(), elem->end_nodes());
}
else
{
- for(int i = 0; i < aElementsId->length(); i++)
- if( const SMDS_MeshElement * elem = theMeshDS->FindElement( aElementsId[i] ))
+ for ( CORBA::ULong i = 0; i < aElementsId->length(); i++ )
+ if ( const SMDS_MeshElement * elem = theMeshDS->FindElement( aElementsId[i] ))
theNodeSet.insert( elem->begin_nodes(), elem->end_nodes());
}
}
SMDSAbs_ElementType elemType = (*theElements.begin())->GetType();
bool sameElemType = ( elemType == (*theElements.rbegin())->GetType() );
if ( sameElemType &&
- theMeshDS->GetMeshInfo().NbElements( elemType ) == theElements.size() )
+ theMeshDS->GetMeshInfo().NbElements( elemType ) == (int) theElements.size() )
return; // all the elements are in theElements
if ( !sameElemType )
list< int > IdList;
- for (int i = 0; i < IDsOfElements.length(); i++)
+ for ( CORBA::ULong i = 0; i < IDsOfElements.length(); i++ )
IdList.push_back( IDsOfElements[i] );
// Update Python script
initData();
list< int > IdList;
- for (int i = 0; i < IDsOfNodes.length(); i++)
+ for ( CORBA::ULong i = 0; i < IDsOfNodes.length(); i++)
IdList.push_back( IDsOfNodes[i] );
// Update Python script
SMESH::Controls::Filter::GetElementsId( getMeshDS(), predicate, seq );
// remove orphan nodes (if there are any)
- list< int > IdList;
- for ( int i = 0; i < seq.size(); i++ )
- IdList.push_back( seq[i] );
+ list< int > IdList( seq.begin(), seq.end() );
int nbNodesBefore = myMesh->NbNodes();
getEditor().Remove( IdList, true );
SMESH_TRY;
initData();
- for (int i = 0; i < IDsOfElements.length(); i++)
+ for ( CORBA::ULong i = 0; i < IDsOfElements.length(); i++ )
{
CORBA::Long index = IDsOfElements[i];
const SMDS_MeshElement * elem = getMeshDS()->FindElement(index);
arrayToSet(IDsOfElements, aMesh, elements, SMDSAbs_Face);
set<const SMDS_MeshNode*> fixedNodes;
- for (int i = 0; i < IDsOfFixedNodes.length(); i++) {
+ for ( CORBA::ULong i = 0; i < IDsOfFixedNodes.length(); i++) {
CORBA::Long index = IDsOfFixedNodes[i];
const SMDS_MeshNode * node = aMesh->FindNode(index);
if ( node )
idSourceToSet( theFaces[i], getMeshDS(), elemsNodes[0], SMDSAbs_Face );
list<double> angles;
- for (int i = 0; i < theAngles.length(); i++) {
+ for ( CORBA::ULong i = 0; i < theAngles.length(); i++ ) {
angles.push_back( theAngles[i] );
}
TIDSortedNodeSet nodes;
idSourceToNodeSet( theObject, getMeshDS(), nodes );
- for ( int i = 0; i < theExceptSubMeshOrGroups.length(); ++i )
+ for ( CORBA::ULong i = 0; i < theExceptSubMeshOrGroups.length(); ++i )
{
SMDS_ElemIteratorPtr nodeIt = myMesh_i->GetElements( theExceptSubMeshOrGroups[i],
SMESH::NODE );
aTPythonDump << this << ".MergeNodes([";
TIDSortedNodeSet setOfNodesToKeep;
- for ( int i = 0; i < NodesToKeep.length(); ++i )
+ for ( CORBA::ULong i = 0; i < NodesToKeep.length(); ++i )
{
prepareIdSource( NodesToKeep[i] );
SMDS_ElemIteratorPtr nodeIt = myMesh_i->GetElements( NodesToKeep[i], SMESH::NODE );
}
::SMESH_MeshEditor::TListOfListOfNodes aListOfListOfNodes;
- for (int i = 0; i < GroupsOfNodes.length(); i++)
+ for ( CORBA::ULong i = 0; i < GroupsOfNodes.length(); i++ )
{
const SMESH::long_array& aNodeGroup = GroupsOfNodes[ i ];
aListOfListOfNodes.push_back( list< const SMDS_MeshNode* >() );
list< const SMDS_MeshNode* >& aListOfNodes = aListOfListOfNodes.back();
- for ( int j = 0; j < aNodeGroup.length(); j++ )
+ for ( CORBA::ULong j = 0; j < aNodeGroup.length(); j++ )
{
CORBA::Long index = aNodeGroup[ j ];
if ( const SMDS_MeshNode * node = aMesh->FindNode( index ))
::SMESH_MeshEditor::TListOfListOfElementsID aListOfListOfElementsID;
- for (int i = 0; i < GroupsOfElementsID.length(); i++) {
+ for ( CORBA::ULong i = 0; i < GroupsOfElementsID.length(); i++ ) {
const SMESH::long_array& anElemsIDGroup = GroupsOfElementsID[ i ];
aListOfListOfElementsID.push_back( list< int >() );
list< int >& aListOfElemsID = aListOfListOfElementsID.back();
- for ( int j = 0; j < anElemsIDGroup.length(); j++ ) {
+ for ( CORBA::ULong j = 0; j < anElemsIDGroup.length(); j++ ) {
CORBA::Long id = anElemsIDGroup[ j ];
aListOfElemsID.push_back( id );
}
SMDSAbs_ElementType( type ),
foundElems);
res->length( foundElems.size() );
- for ( int i = 0; i < foundElems.size(); ++i )
+ for ( size_t i = 0; i < foundElems.size(); ++i )
res[i] = foundElems[i]->GetID();
return res._retn();
SMDSAbs_ElementType( type ),
foundElems);
res->length( foundElems.size() );
- for ( int i = 0; i < foundElems.size(); ++i )
+ for ( size_t i = 0; i < foundElems.size(); ++i )
res[i] = foundElems[i]->GetID();
return res._retn();
RETCASE( SEW_TOPO_DIFF_SETS_OF_ELEMENTS );
RETCASE( SEW_BAD_SIDE1_NODES );
RETCASE( SEW_BAD_SIDE2_NODES );
+ RETCASE( SEW_INTERNAL_ERROR );
}
return SMESH::SMESH_MeshEditor::SEW_OK;
}
for ( CORBA::ULong iP = 0; iP < aGRP.length(); ++iP )
{
const SMESH::FreeBorderPart& aPART = aGRP[ iP ];
- if ( aPART.border < 0 || aPART.border >= freeBorders.borders.length() )
+ if ( aPART.border < 0 || aPART.border >= (int) freeBorders.borders.length() )
THROW_SALOME_CORBA_EXCEPTION("Invalid FreeBorderPart::border index", SALOME::BAD_PARAM);
const SMESH::FreeBorder& aBRD = freeBorders.borders[ aPART.border ];
- if ( aPART.node1 < 0 || aPART.node1 > aBRD.nodeIDs.length() )
+ if ( aPART.node1 < 0 || aPART.node1 > (int) aBRD.nodeIDs.length() )
THROW_SALOME_CORBA_EXCEPTION("Invalid FreeBorderPart::node1", SALOME::BAD_PARAM);
- if ( aPART.node2 < 0 || aPART.node2 > aBRD.nodeIDs.length() )
+ if ( aPART.node2 < 0 || aPART.node2 > (int) aBRD.nodeIDs.length() )
THROW_SALOME_CORBA_EXCEPTION("Invalid FreeBorderPart::node2", SALOME::BAD_PARAM);
- if ( aPART.nodeLast < 0 || aPART.nodeLast > aBRD.nodeIDs.length() )
+ if ( aPART.nodeLast < 0 || aPART.nodeLast > (int) aBRD.nodeIDs.length() )
THROW_SALOME_CORBA_EXCEPTION("Invalid FreeBorderPart::nodeLast", SALOME::BAD_PARAM);
// do not keep these nodes for further sewing as nodes can be removed by the sewing
*/
//================================================================================
-string SMESH_MeshEditor_i::generateGroupName(const string& thePrefix)
+std::string SMESH_MeshEditor_i::generateGroupName(const std::string& thePrefix)
{
SMESH::ListOfGroups_var groups = myMesh_i->GetGroups();
- set<string> groupNames;
+ set<std::string> groupNames;
// Get existing group names
for (int i = 0, nbGroups = groups->length(); i < nbGroups; i++ ) {
}
// Find new name
- string name = thePrefix;
+ std::string name = thePrefix;
int index = 0;
while (!groupNames.insert(name).second)
{
if ( error ) *error = IDSource_OK;
- if ( CORBA::is_nil( theIDSource ) )
+ if ( CORBA::is_nil( theIDSource ))
{
if ( error ) *error = IDSource_INVALID;
return false;
// Create group with newly created nodes
SMESH::long_array_var anIds = GetLastCreatedNodes();
if (anIds->length() > 0) {
- string anUnindexedName (theNodes->GetName());
- string aNewName = generateGroupName(anUnindexedName + "_double");
+ std::string anUnindexedName (theNodes->GetName());
+ std::string aNewName = generateGroupName(anUnindexedName + "_double");
aNewGroup = myMesh_i->CreateGroup(SMESH::NODE, aNewName.c_str());
aNewGroup->Add(anIds);
pyDump << aNewGroup << " = ";
// Create group with newly created nodes
SMESH::long_array_var anIds = GetLastCreatedNodes();
if (anIds->length() > 0) {
- string anUnindexedName (theNodes[0]->GetName());
- string aNewName = generateGroupName(anUnindexedName + "_double");
+ std::string anUnindexedName (theNodes[0]->GetName());
+ std::string aNewName = generateGroupName(anUnindexedName + "_double");
aNewGroup = myMesh_i->CreateGroup(SMESH::NODE, aNewName.c_str());
aNewGroup->Add(anIds);
pyDump << aNewGroup << " = ";
{
// Create group with newly created elements
CORBA::String_var elemGroupName = theElems->GetName();
- string aNewName = generateGroupName( string(elemGroupName.in()) + "_double");
+ std::string aNewName = generateGroupName( std::string(elemGroupName.in()) + "_double");
if ( !getEditor().GetLastCreatedElems().IsEmpty() && theElemGroupNeeded )
{
SMESH::long_array_var anIds = GetLastCreatedElems();
{
// Create group with newly created elements
CORBA::String_var elemGroupName = theElems[0]->GetName();
- string aNewName = generateGroupName( string(elemGroupName.in()) + "_double");
+ std::string aNewName = generateGroupName( std::string(elemGroupName.in()) + "_double");
if ( !getEditor().GetLastCreatedElems().IsEmpty() && theElemGroupNeeded )
{
SMESH::long_array_var anIds = GetLastCreatedElems();
theNodeSearcher = SMESH_MeshAlgos::GetNodeSearcher( *getMeshDS() );
vector<double> nodesCoords;
- for (int i = 0; i < theNodesCoords.length(); i++)
+ for ( CORBA::ULong i = 0; i < theNodesCoords.length(); i++)
{
nodesCoords.push_back( theNodesCoords[i] );
}
groupsOfThisMesh ->length( groups.length() );
groupsOfOtherMesh->length( groups.length() );
int nbGroups = 0, nbGroupsOfOtherMesh = 0;
- for ( int i = 0; i < groups.length(); ++i )
+ for ( CORBA::ULong i = 0; i < groups.length(); ++i )
{
SMESH::SMESH_Mesh_var m = groups[i]->GetMesh();
if ( myMesh_i != SMESH::DownCast<SMESH_Mesh_i*>( m ))
#include "SMESH_PythonDump.hxx"
#include "SMESH_MeshEditor.hxx"
#include <list>
+#include <string>
class SMESH_Mesh_i;
void dumpGroupsList(SMESH::TPythonDump & theDumpPython,
const SMESH::ListOfGroups * theGroupList);
- string generateGroupName(const string& thePrefix);
+ std::string generateGroupName(const std::string& thePrefix);
void prepareIdSource(SMESH::SMESH_IDSource_ptr theObject);
{
Unexpect aCatch(SALOME_SalomeException);
if ( _preMeshInfo )
- _preMeshInfo->ForgetAllData();
+ _preMeshInfo->ForgetOrLoad(); // load in case if !HasShapeToMesh()
try {
_impl->Clear();
while ( nIt->more() )
{
const SMDS_MeshNode* n = nIt->next();
- if ( n->GetID() >= isNodeInGroups.size() )
+ if ( n->GetID() >= (int) isNodeInGroups.size() )
isNodeInGroups.resize( n->GetID() + 1, false );
isNodeInGroups[ n->GetID() ] = true;
}
CORBA::String_var entry = groupSO->GetID();
groupData._groupEntry = entry.in();
// indices
- for ( int i = 0; i < ids->length(); ++i )
+ for ( CORBA::ULong i = 0; i < ids->length(); ++i )
groupData._indices.insert( ids[i] );
// SMESH object
groupData._smeshObject = CORBA::Object::_duplicate( theSmeshObj );
GEOM::GEOM_IGroupOperations_wrap groupOp =
geomGen->GetIGroupOperations( _gen_i->GetCurrentStudyID() );
GEOM::ListOfLong_var ids = groupOp->GetObjects( geomGroup );
- for ( int i = 0; i < ids->length(); ++i )
+ for ( CORBA::ULong i = 0; i < ids->length(); ++i )
curIndices.insert( ids[i] );
if ( groupData._indices == curIndices )
{
const SMDS_MeshElement* e = elemIt->next();
const int shapeID = e->getshapeId();
- if ( shapeID < 1 || shapeID >= dblVals.size() )
+ if ( shapeID < 1 || shapeID >= (int) dblVals.size() )
fieldWriter.AddValue( noneDblValue );
else
fieldWriter.AddValue( dblVals[ shapeID ]);
{
const SMDS_MeshElement* e = elemIt->next();
const int shapeID = e->getshapeId();
- if ( shapeID < 1 || shapeID >= intVals.size() )
+ if ( shapeID < 1 || shapeID >= (int) intVals.size() )
fieldWriter.AddValue( (double) noneIntValue );
else
fieldWriter.AddValue( (double) intVals[ shapeID ]);
{
aResult->length( vtool.NbFaceNodes( faceIndex ));
const SMDS_MeshNode** nn = vtool.GetFaceNodes( faceIndex );
- for ( int i = 0; i < aResult->length(); ++i )
+ for ( CORBA::ULong i = 0; i < aResult->length(); ++i )
aResult[ i ] = nn[ i ]->GetID();
}
}
if ( SMESHDS_Mesh* mesh = _impl->GetMeshDS() )
{
vector< const SMDS_MeshNode * > nn( nodes.length() );
- for ( int i = 0; i < nodes.length(); ++i )
+ for ( CORBA::ULong i = 0; i < nodes.length(); ++i )
if ( !( nn[i] = mesh->FindNode( nodes[i] )))
return elemID;
SALOMEDS::Study_var aStudy = gen->GetCurrentStudy();
if ( !aStudy->_is_nil()) {
SALOMEDS::ListOfListOfStrings_var aSections = aStudy->ParseVariables(aParameters);
- if(aSections->length() > 0) {
- SALOMEDS::ListOfStrings aVars = aSections[aSections->length()-1];
- aResult->length(aVars.length());
- for(int i = 0;i < aVars.length();i++)
- aResult[i] = CORBA::string_dup( aVars[i]);
+ if ( aSections->length() > 0 ) {
+ SALOMEDS::ListOfStrings aVars = aSections[ aSections->length() - 1 ];
+ aResult->length( aVars.length() );
+ for ( CORBA::ULong i = 0;i < aVars.length(); i++ )
+ aResult[i] = CORBA::string_dup( aVars[i] );
}
}
}
SMESH::ElementType theType)
{
SMDS_ElemIteratorPtr elemIt;
- bool typeOK = false;
+ bool typeOK = ( theType == SMESH::ALL );
SMDSAbs_ElementType elemType = SMDSAbs_ElementType( theType );
SMESH::SMESH_Mesh_var meshVar = theObject->GetMesh();
if ( find( theOther->_hypotheses.begin(), otheEndIt, *hypIt ) != otheEndIt )
nbSame++;
// the submeshes are concurrent if their algorithms has different parameters
- return nbSame != theOther->_hypotheses.size() - 1;
+ return nbSame != (int)theOther->_hypotheses.size() - 1;
}
// Return true if algorithm of this SMESH_DimHyp is used if no
SMESH::array_of_ElementType_var types = meshPart->GetTypes();
if ( types->length() == 1 && types[0] == SMESH::NODE ) // group of nodes
{
- for (int i=0; i < anIDs->length(); i++)
- if ( const SMDS_MeshNode * n = _meshDS->FindNode(anIDs[i]))
+ for ( CORBA::ULong i=0; i < anIDs->length(); i++ )
+ if ( const SMDS_MeshNode * n = _meshDS->FindNode( anIDs[i] ))
if ( _elements[ SMDSAbs_Node ].insert( n ).second )
tmpInfo.Add( n );
}
else
{
- for (int i=0; i < anIDs->length(); i++)
+ for ( CORBA::ULong i=0; i < anIDs->length(); i++ )
if ( const SMDS_MeshElement * e = _meshDS->FindElement(anIDs[i]))
if ( _elements[ e->GetType() ].insert( e ).second )
{
*/
void SetVariable(Handle(_pyCommand) theCommand,
const SMESH_ObjectStates* theStates,
- int position, int theArgNb)
+ size_t position, int theArgNb)
{
if(theStates->GetCurrectState().size() > position)
if(!theStates->GetCurrectState().at(position).IsEmpty())
//================================================================================
TState SMESH_ObjectStates::GetCurrectState() const
{
- if(_states.size() > _dumpstate)
+ if ( (int) _states.size() > _dumpstate)
return _states[_dumpstate];
TState empty;
return empty;
//================================================================================
void SMESH_NoteBook::ReplaceVariables()
{
- for(int i=0;i<_commands.size();i++)
+ for ( size_t i = 0 ; i < _commands.size(); i++ )
{
Handle(_pyCommand) aCmd = _commands[i];
TCollection_AsciiString aMethod = aCmd->GetMethod();
{
TState aCurrentState = aStates->GetCurrectState();
int argIndex = h->getParamIndex( aMethod, aCurrentState.size() );
- if ( 0 <= argIndex && argIndex < aCurrentState.size() &&
+ if ( 0 <= argIndex && argIndex < (int)aCurrentState.size() &&
!aCurrentState[argIndex].IsEmpty() )
aCmd->SetArg( 1, aCurrentState[argIndex] );
else
aState = new SMESH_ObjectStates(anObjType);
- for(int i = 0; i < aSections->length(); i++) {
+ for ( size_t i = 0; i < aSections->length(); i++ ) {
TState aVars;
SALOMEDS::ListOfStrings aListOfVars = aSections[i];
- for ( int j = 0; j<aListOfVars.length(); j++)
+ for ( size_t j = 0; j < aListOfVars.length(); j++)
{
TCollection_AsciiString aVar(aListOfVars[j].in());
if(!aVar.IsEmpty() && aStudy->IsVariable(aVar.ToCString())) {
return;
// 2) Initialize all type of 1D Distribution hypothesis
- for(int i=0;i<_commands.size();i++){
- for(int j =0;j < aLDS.size();j++){
+ for ( size_t i = 0; i < _commands.size(); i++ ) {
+ for ( size_t j = 0; j < aLDS.size(); j++ ) {
TCollection_AsciiString aResultValue = _commands[i]->GetResultValue();
if(_commands[i]->GetMethod() == "CreateHypothesis" &&
aLDS[j]->HasDistribution(aResultValue)){
}
// 3) ... and replase variables ...
- for(int i=0;i<_commands.size();i++){
- for(int j =0;j < aLDS.size();j++){
+ for ( size_t i = 0; i < _commands.size(); i++ ) {
+ for ( size_t j = 0; j < aLDS.size(); j++ ) {
TCollection_AsciiString anObject = _commands[i]->GetObject();
if(aLDS[j]->HasDistribution(anObject)) {
TCollection_AsciiString SMESH_NoteBook::GetResultScript() const
{
TCollection_AsciiString aResult;
- for(int i=0;i<_commands.size();i++)
- aResult+=_commands[i]->GetString()+"\n";
+ for ( size_t i = 0; i < _commands.size(); i++ )
+ aResult += _commands[i]->GetString() + "\n";
return aResult;
}
//================================================================================
void SMESH_NoteBook::GetResultLines(std::list< TCollection_AsciiString >& lines) const
{
- for(int i=0;i<_commands.size();i++)
+ for ( size_t i = 0; i < _commands.size(); i++ )
lines.push_back( _commands[i]->GetString() );
}
#include <sstream>
#include <set>
+using namespace std;
+
using SMESH::TPythonDump;
using SMESH::TVar;
list<const gp_XYZ *> xyzList;
set<const SMDS_MeshFace*> fset;
- for (int i = 0; i < theFacesIDs.length(); i++)
+ for ( CORBA::ULong i = 0; i < theFacesIDs.length(); i++)
{
CORBA::Long index = theFacesIDs[i];
const SMDS_MeshElement * elem = aMesh->GetMeshDS()->FindElement(index);
list<const gp_XYZ *> xyzList;
set<const SMDS_MeshVolume*> vset;
- for (int i = 0; i < theVolumesIDs.length(); i++)
+ for ( CORBA::ULong i = 0; i < theVolumesIDs.length(); i++)
{
CORBA::Long index = theVolumesIDs[i];
const SMDS_MeshElement * elem = aMesh->GetMeshDS()->FindElement(index);
#include CORBA_SERVER_HEADER(SALOME_Session)
+using namespace std;
#define MYDEBUGOUT(msg) //std::cout << msg << std::endl;
enum { GroupOnFilter_OutOfDate = -1 };
// a map to count not yet loaded meshes
- static map< int, int > theStudyIDToMeshCounter;
+ static std::map< int, int > theStudyIDToMeshCounter;
//================================================================================
/*!
void meshInfoLoaded( SMESH_Mesh_i* mesh )
{
- map< int, int >::iterator id2counter =
- theStudyIDToMeshCounter.insert( make_pair( (int) mesh->GetStudyId(), 0 )).first;
+ std::map< int, int >::iterator id2counter =
+ theStudyIDToMeshCounter.insert( std::make_pair( (int) mesh->GetStudyId(), 0 )).first;
id2counter->second++;
}
//================================================================================
{
if ( --theStudyIDToMeshCounter[ (int) mesh->GetStudyId() ] == 0 )
{
- string tmpDir = SALOMEDS_Tool::GetDirFromPath( hdfFile );
+ std::string tmpDir = SALOMEDS_Tool::GetDirFromPath( hdfFile );
SALOMEDS::ListOfFileNames_var aFiles = new SALOMEDS::ListOfFileNames;
aFiles->length(2);
class SignalToGUI
{
- string _messagePrefix;
+ std::string _messagePrefix;
SALOME::Session_var _session;
public:
SignalToGUI( SMESH_Mesh_i* mesh )
_messagePrefix = "SMESH/mesh_loading/";
_messagePrefix += meshEntry.in();
- string msgToGUI = _messagePrefix + "/";
+ std::string msgToGUI = _messagePrefix + "/";
msgToGUI += SMESH_Comment( mesh->NbNodes() );
msgToGUI += "/";
msgToGUI += SMESH_Comment( mesh->NbElements() );
{
if ( !_messagePrefix.empty() )
{
- string msgToGUI = _messagePrefix + "/stop";
+ std::string msgToGUI = _messagePrefix + "/stop";
_session->emitMessageOneWay( msgToGUI.c_str());
_messagePrefix.clear();
}
SMDS_PositionPtr vertexPosition() const { return SMDS_PositionPtr( new SMDS_VertexPosition); }
SMDS_PositionPtr defaultPosition() const { return SMDS_SpacePosition::originSpacePosition(); }
typedef SMDS_PositionPtr (PositionCreator:: * FmakePos)() const;
- vector<FmakePos> myFuncTable;
+ std::vector<FmakePos> myFuncTable;
};
//================================================================================
*/
//================================================================================
- vector<int> getSimpleSubMeshIds( SMESHDS_Mesh* meshDS, int shapeId )
+ std::vector<int> getSimpleSubMeshIds( SMESHDS_Mesh* meshDS, int shapeId )
{
- vector<int> ids;
+ std::vector<int> ids;
- list<TopoDS_Shape> shapeQueue( 1, meshDS->IndexToShape( shapeId ));
- list<TopoDS_Shape>::iterator shape = shapeQueue.begin();
+ std::list<TopoDS_Shape> shapeQueue( 1, meshDS->IndexToShape( shapeId ));
+ std::list<TopoDS_Shape>::iterator shape = shapeQueue.begin();
for ( ; shape != shapeQueue.end(); ++shape )
{
if ( shape->IsNull() ) continue;
*/
//================================================================================
- typedef map< MED::EGeometrieElement, SMDSAbs_EntityType > Tmed2smeshElemTypeMap;
+ typedef std::map< MED::EGeometrieElement, SMDSAbs_EntityType > Tmed2smeshElemTypeMap;
const Tmed2smeshElemTypeMap& med2smeshElemTypeMap()
{
- static map< MED::EGeometrieElement, SMDSAbs_EntityType> med2smeshTypes;
+ static Tmed2smeshElemTypeMap med2smeshTypes;
if ( med2smeshTypes.empty() )
{
for ( int iG = 0; iG < SMDSEntity_Last; ++iG )
SMDSAbs_EntityType smdsType = (SMDSAbs_EntityType) iG;
MED::EGeometrieElement medType =
(MED::EGeometrieElement) DriverMED::GetMedGeoType( smdsType );
- med2smeshTypes.insert( make_pair( medType, smdsType ));
+ med2smeshTypes.insert( std::make_pair( medType, smdsType ));
}
}
return med2smeshTypes;
// change at insertion of new items in the middle.
//const vector<MED::EGeometrieElement>& medTypes = mesh2medElemType();
- vector<int> data;
+ std::vector<int> data;
for ( size_t i = 0; i < meshInfo->length(); ++i )
if ( meshInfo[i] > 0 )
// // array->GetDim( datasetSize );
// int size = dataset->GetSize();
- vector<int> info( SMDSEntity_Last * 2, 0 );
+ std::vector<int> info( SMDSEntity_Last * 2, 0 );
dataset->ReadFromDisk( &info[0] );
dataset->CloseOnDisk();
group_i->changePreMeshInfo() = newInstance();
if ( SMESHDS_GroupBase* group = group_i->GetGroupDS() )
{
- const string name = group->GetStoreName();
+ const std::string name = group->GetStoreName();
group_i->changePreMeshInfo()->hdf2meshInfo( name, infoHdfGroup );
}
}
if ( _mesh->_mapGroups.empty() ) return;
// make SMESH_PreMeshInfo of groups
- map< string, SMESH_PreMeshInfo* > name2GroupInfo;
+ map< std::string, SMESH_PreMeshInfo* > name2GroupInfo;
map<int, SMESH::SMESH_GroupBase_ptr>::const_iterator i2group = _mesh->_mapGroups.begin();
for ( ; i2group != _mesh->_mapGroups.end(); ++i2group )
{
group_i->changePreMeshInfo() = info;
if ( SMESHDS_Group* group = dynamic_cast< SMESHDS_Group* >( group_i->GetGroupDS() ))
{
- string name = group->GetStoreName();
- name2GroupInfo.insert( make_pair( name, info ));
+ std::string name = group->GetStoreName();
+ name2GroupInfo.insert( std::make_pair( name, info ));
info->_isInfoOk = true;
}
}
vector< SMESH_PreMeshInfo* >& grInfoVec = famId2grInfo[ medFamInfo->GetId() ];
for ( int iG = 0; iG < nbGroups; ++iG )
{
- const string grName = medFamInfo->GetGroupName( iG );
- map< string, SMESH_PreMeshInfo* >::iterator n2i = name2GroupInfo.find( grName );
+ const std::string grName = medFamInfo->GetGroupName( iG );
+ map< std::string, SMESH_PreMeshInfo* >::iterator n2i = name2GroupInfo.find( grName );
if ( n2i != name2GroupInfo.end() )
grInfoVec.push_back( n2i->second );
}
f2infos = famId2grInfo.find( famNums[i] );
if ( f2infos == famId2grInfo.end() )
f2infos = famId2grInfo.insert
- ( make_pair( famNums[i], vector< SMESH_PreMeshInfo*>())).first;
+ ( std::make_pair( famNums[i], vector< SMESH_PreMeshInfo*>())).first;
}
vector< SMESH_PreMeshInfo* >& infoVec = f2infos->second ;
for ( size_t j = 0; j < infoVec.size(); ++j )
infoVec[j]->_elemCounter++;
}
// pass _elemCounter to a real elem type
- map< string, SMESH_PreMeshInfo* >::iterator n2i = name2GroupInfo.begin();
+ map< std::string, SMESH_PreMeshInfo* >::iterator n2i = name2GroupInfo.begin();
for ( ; n2i != name2GroupInfo.end(); ++n2i )
{
SMESH_PreMeshInfo* info = n2i->second;
for ( int isNode = 0; isNode < 2; ++isNode )
{
- string aDSName( isNode ? "Node Submeshes" : "Element Submeshes");
+ std::string aDSName( isNode ? "Node Submeshes" : "Element Submeshes");
if ( aGroup->ExistInternalObject( (char*) aDSName.c_str() ))
{
// read sub-mesh id of all nodes or elems
SMDS_ElemIteratorPtr eIt = meshDS->elementsIterator();
for ( int isNode = 0; isNode < 2; ++isNode )
{
- string aDSName( isNode ? "Node Submeshes" : "Element Submeshes");
+ std::string aDSName( isNode ? "Node Submeshes" : "Element Submeshes");
if ( aGroup->ExistInternalObject( (char*) aDSName.c_str() ))
{
HDFdataset* aDataset = new HDFdataset( (char*) aDSName.c_str(), aGroup );
aDataset->OpenOnDisk();
// read submesh IDs for all elements sorted by ID
- int nbElems = aDataset->GetSize();
+ size_t nbElems = aDataset->GetSize();
int* smIDs = new int [ nbElems ];
aDataset->ReadFromDisk( smIDs );
aDataset->CloseOnDisk();
}
// add elements to submeshes
TIDSortedElemSet::iterator iE = elemSet.begin();
- for ( int i = 0; i < nbElems; ++i, ++iE )
+ for ( size_t i = 0; i < nbElems; ++i, ++iE )
{
int smID = smIDs[ i ];
if ( smID == 0 ) continue;
bool getSubMeshes(::SMESH_subMesh* theSubMesh,
TListOfSubMeshes& theSubMeshList)
{
- int size = theSubMeshList.size();
+ size_t size = theSubMeshList.size();
SMESH_Mesh* aMesh = theSubMesh->GetFather();
SMESHDS_Mesh* aMeshDS = aMesh->GetMeshDS();
# @param UseExisting if ==true - searches for the existing hypothesis created with
# the same parameters, else (default) - creates a new one
def SourceFaces(self, groups, toCopyMesh=False, toCopyGroups=False, UseExisting=False):
+ import SMESH
compFun = lambda hyp, args: ( hyp.GetSourceFaces() == args[0] and \
hyp.GetCopySourceMesh() == args[1], args[2] )
hyp = self.Hypothesis("ImportSource2D", [groups, toCopyMesh, toCopyGroups],
UseExisting=UseExisting, CompareMethod=compFun, toAdd=False)
+ if groups and isinstance( groups, SMESH._objref_SMESH_GroupBase ):
+ groups = [groups]
hyp.SetSourceFaces(groups)
hyp.SetCopySourceMesh(toCopyMesh, toCopyGroups)
self.mesh.AddHypothesis(hyp, self.geom)
# Treat compute errors
computeErrors = self.smeshpyD.GetComputeErrors( self.mesh, geom )
+ shapeText = ""
for err in computeErrors:
- shapeText = " on %s" % self.GetSubShapeName( err.subShapeID )
+ if self.mesh.HasShapeToMesh():
+ shapeText = " on %s" % self.GetSubShapeName( err.subShapeID )
errText = ""
stdErrors = ["OK", #COMPERR_OK
"Invalid input mesh", #COMPERR_BAD_INPUT_MESH
if self.mesh.HasShapeToMesh():
hyp_type = hyp.GetName()
lib_name = hyp.GetLibName()
- checkAll = ( not geom.IsSame( self.mesh.GetShapeToMesh() ))
- if checkAll and geom:
- checkAll = geom.GetType() == 37
+ # checkAll = ( not geom.IsSame( self.mesh.GetShapeToMesh() ))
+ # if checkAll and geom:
+ # checkAll = geom.GetType() == 37
+ checkAll = False
isApplicable = self.smeshpyD.IsApplicable(hyp_type, lib_name, geom, checkAll)
if isApplicable:
AssureGeomPublished( self, geom, "shape for %s" % hyp.GetName())
${CAS_TKAdvTools}
${CAS_TKTopAlgo}
${CAS_TKG3d}
+ ${CAS_TKOffset}
${GEOM_GEOMUtils}
SMESHimpl
SMESHDS
for ( int i = 0; i < 3; ++i )
{
const gp_Pnt& pn = myNodes->Value(n[i]);
- if ( avoidTria = ( pn.SquareDistance( *avoidPnt ) <= tol2 ))
+ if (( avoidTria = ( pn.SquareDistance( *avoidPnt ) <= tol2 )))
break;
if ( !projectedOnly )
minD2 = Min( minD2, pn.SquareDistance( p ));
void ElementBndBoxTree::buildChildrenData()
{
ElemTreeData* data = GetElemData();
- for ( int i = 0; i < _elementIDs.size(); ++i )
+ for ( size_t i = 0; i < _elementIDs.size(); ++i )
{
const Bnd_B3d* elemBox = data->GetBox( _elementIDs[i] );
for (int j = 0; j < 8; j++)
{
ElementBndBoxTree* child = static_cast<ElementBndBoxTree*>( myChildren[j] );
child->_elementIDs = data->myWorkIDs[ j ];
- if ( child->_elementIDs.size() <= theMaxNbElemsInLeaf )
+ if ((int) child->_elementIDs.size() <= theMaxNbElemsInLeaf )
child->myIsLeaf = true;
data->myWorkIDs[ j ].clear();
}
if ( isLeaf() )
{
ElemTreeData* data = GetElemData();
- for ( int i = 0; i < _elementIDs.size(); ++i )
+ for ( size_t i = 0; i < _elementIDs.size(); ++i )
if ( !data->GetBox( _elementIDs[i] )->IsOut( center, radius ))
foundElemIDs.push_back( _elementIDs[i] );
}
istream & StdMeshers_Adaptive1D::LoadFrom(istream & load)
{
int dummyParam;
- bool isOK = (load >> myMinSize >> myMaxSize >> myDeflection >> dummyParam >> dummyParam);
+ bool isOK = static_cast<bool>(load >> myMinSize >> myMaxSize >> myDeflection >> dummyParam >> dummyParam);
if (!isOK)
load.clear(ios::badbit | load.rdstate());
return load;
StdMeshers_Regular_1D::_value[ DEFLECTION_IND ] = myHyp->GetDeflection();
list< double > params;
- for ( int iE = 0; iE < myEdges.size(); ++iE )
+ for ( size_t iE = 0; iE < myEdges.size(); ++iE )
{
EdgeData& eData = myEdges[ iE ];
//cout << "E " << theMesh.GetMeshDS()->ShapeToIndex( eData.Edge() ) << endl;
triaSearcher->SetSizeByTrias( sizeTree, myHyp->GetDeflection() );
- for ( int iE = 0; iE < myEdges.size(); ++iE )
+ for ( size_t iE = 0; iE < myEdges.size(); ++iE )
{
EdgeData& eData = myEdges[ iE ];
double maxSegSize = 0;
// get points to check distance to the face
- EdgeData::TPntIter pIt2 = eData.myPoints.begin(), pIt1 = pIt2++, pItLast;
+ EdgeData::TPntIter pIt2 = eData.myPoints.begin(), pIt1 = pIt2++;
maxSegSize = pIt1->mySegSize = Min( pIt1->mySegSize, sizeTree.GetSize( pIt1->myP ));
for ( ; pIt2 != eData.myPoints.end(); )
{
//cout << "E " << theMesh.GetMeshDS()->ShapeToIndex( eData.Edge() ) << endl;
sizeDecreased = false;
const gp_Pnt* avoidPnt = & eData.First().myP;
- pItLast = --eData.myPoints.end();
+ EdgeData::TPntIter pItLast = --eData.myPoints.end(), pItFirst = eData.myPoints.begin();
for ( pIt1 = eData.myPoints.begin(); pIt1 != eData.myPoints.end(); )
{
double distToFace =
// << "\t SetSize " << allowedSize << " at "
// << pIt1->myP.X() <<", "<< pIt1->myP.Y()<<", "<<pIt1->myP.Z() << endl;
pIt2 = pIt1;
- if ( --pIt2 != eData.myPoints.end() && pIt2->mySegSize > allowedSize )
+ if ( pIt1 != pItFirst && ( --pIt2 )->mySegSize > allowedSize )
sizeTree.SetSize( eData.myC3d.Value( 0.6*pIt2->myU + 0.4*pIt1->myU ), allowedSize );
pIt2 = pIt1;
- if ( ++pIt2 != eData.myPoints.end() && pIt2->mySegSize > allowedSize )
+ if ( pIt1 != pItLast && ( ++pIt2 )->mySegSize > allowedSize )
sizeTree.SetSize( eData.myC3d.Value( 0.6*pIt2->myU + 0.4*pIt1->myU ), allowedSize );
}
pIt1->mySegSize = allowedSize;
}
++pIt1;
- if ( pIt1 == pItLast )
- avoidPnt = & eData.Last().myP;
- else
- avoidPnt = NULL;
+ avoidPnt = ( pIt1 == pItLast ) ? & eData.Last().myP : NULL;
if ( iLoop > 20 )
{
vector< double > nbSegs, params;
- for ( int iE = 0; iE < myEdges.size(); ++iE )
+ for ( size_t iE = 0; iE < myEdges.size(); ++iE )
{
EdgeData& eData = myEdges[ iE ];
edgeMinSize = Min( edgeMinSize,
Min( pIt1->mySegSize, mySizeTree->GetSize( pIt1->myP )));
- const double f = eData.myC3d.FirstParameter(), l = eData.myC3d.LastParameter();
+ const double f = eData.myC3d.FirstParameter(), l = eData.myC3d.LastParameter();
const double parLen = l - f;
const int nbDivSeg = 5;
- int nbDiv = Max( 1, int ( eData.myLength / edgeMinSize * nbDivSeg ));
+ size_t nbDiv = Max( 1, int ( eData.myLength / edgeMinSize * nbDivSeg ));
// compute nb of segments
- bool toRecompute = true;
+ bool toRecompute = true;
double maxSegSize = 0;
size_t i = 1, segCount;
//cout << "E " << theMesh.GetMeshDS()->ShapeToIndex( eData.Edge() ) << endl;
}
// compute parameters of nodes
- int nbSegFinal = Max( 1, int(floor( nbSegs.back() + 0.5 )));
+ size_t nbSegFinal = Max( 1, int(floor( nbSegs.back() + 0.5 )));
double fact = nbSegFinal / nbSegs.back();
if ( maxSegSize / fact > myHyp->GetMaxSize() )
fact = ++nbSegFinal / nbSegs.back();
for ( ; edExp.More(); edExp.Next() )
{
- const TopoDS_Edge & edge = TopoDS::Edge( edExp.Current() );
+ //const TopoDS_Edge & edge = TopoDS::Edge( edExp.Current() );
StdMeshers_Regular_1D::Evaluate( theMesh, theShape, theResMap );
}
return true;
{
bool isOK = true;
int intVal;
- isOK = (load >> _begLength);
+ isOK = static_cast<bool>(load >> _begLength);
if (!isOK)
load.clear(ios::badbit | load.rdstate());
- isOK = (load >> _endLength);
+ isOK = static_cast<bool>(load >> _endLength);
if (!isOK)
load.clear(ios::badbit | load.rdstate());
- isOK = (load >> intVal);
+ isOK = static_cast<bool>(load >> intVal);
if (isOK && intVal > 0) {
_edgeIDs.reserve( intVal );
- for (int i = 0; i < _edgeIDs.capacity() && isOK; i++) {
- isOK = (load >> intVal);
+ for ( size_t i = 0; i < _edgeIDs.capacity() && isOK; i++) {
+ isOK = static_cast<bool>(load >> intVal);
if ( isOK ) _edgeIDs.push_back( intVal );
}
- isOK = (load >> _objEntry);
+ isOK = static_cast<bool>(load >> _objEntry);
}
return load;
//=============================================================================
/*!
- *
+ *
*/
//=============================================================================
if ( Precision::IsInfinite( _fixedPoint[0] ))
return false;
std::copy( &_fixedPoint[0], &_fixedPoint[0]+3, &p[0] );
+ return true;
}
// correct coords if a forced point is too close to a neighbor node
if ( forced )
{
- int iF = 0;
+ size_t iF = 0;
double minLen = ( x1 - x0 );
for ( size_t i = 1; i < coords.size(); ++i )
{
const TCooTriple* norm1 = 0;
double sumArea = 0;
vector< const TCooTriple* > norms;
- for ( int iF = 1; norm2a != areasByNormal.end(); ++norm2a, ++iF )
+ for ( size_t iF = 1; norm2a != areasByNormal.end(); ++norm2a, ++iF )
{
-
if ( !norm1 || !sameDir( *norm1, norm2a->first ))
{
if ( !norms.empty() )
{
bool ok;
- ok = ( load >> _sizeThreshold );
+ ok = static_cast<bool>( load >> _sizeThreshold );
for ( int ax = 0; ax < 3; ++ax )
{
if (ok)
{
size_t i = 0;
- ok = (load >> i );
+ ok = static_cast<bool>(load >> i );
if ( i > 0 && ok )
{
_coords[ax].resize( i );
for ( i = 0; i < _coords[ax].size() && ok; ++i )
- ok = (load >> _coords[ax][i] );
+ ok = static_cast<bool>(load >> _coords[ax][i] );
}
}
if (ok)
{
size_t i = 0;
- ok = (load >> i );
+ ok = static_cast<bool>(load >> i );
if ( i > 0 && ok )
{
_internalPoints[ax].resize( i );
for ( i = 0; i < _internalPoints[ax].size() && ok; ++i )
- ok = (load >> _internalPoints[ax][i] );
+ ok = static_cast<bool>(load >> _internalPoints[ax][i] );
}
}
if (ok)
{
size_t i = 0;
- ok = (load >> i );
+ ok = static_cast<bool>(load >> i );
if ( i > 0 && ok )
{
_spaceFunctions[ax].resize( i );
for ( i = 0; i < _spaceFunctions[ax].size() && ok; ++i )
- ok = (load >> _spaceFunctions[ax][i] );
+ ok = static_cast<bool>(load >> _spaceFunctions[ax][i] );
}
}
}
- ok = ( load >> _toAddEdges );
+ ok = static_cast<bool>( load >> _toAddEdges );
for ( int i = 0; i < 9 && ok; ++i )
- ok = ( load >> _axisDirs[i]);
+ ok = static_cast<bool>( load >> _axisDirs[i]);
for ( int i = 0; i < 3 && ok ; ++i )
- ok = ( load >> _fixedPoint[i]);
+ ok = static_cast<bool>( load >> _fixedPoint[i]);
return load;
}
int& di, double tol )
{
//val += values[0]; // input \a val is measured from 0.
- if ( i > values.size()-2 )
+ if ( i > (int) values.size()-2 )
i = values.size()-2;
else
- while ( i+2 < values.size() && val > values[ i+1 ])
+ while ( i+2 < (int) values.size() && val > values[ i+1 ])
++i;
while ( i > 0 && val < values[ i ])
--i;
if ( i > 0 && val - values[ i ] < tol )
di = -1;
- else if ( i+2 < values.size() && values[ i+1 ] - val < tol )
+ else if ( i+2 < (int) values.size() && values[ i+1 ] - val < tol )
di = 1;
else
di = 0;
if ( quad._eIntNodes[ iP ]->IsUsedInFace( polygon ))
quad._eIntNodes[ iP ]->_usedInFace = 0;
#endif
- int nbUsedEdgeNodes = 0;
+ size_t nbUsedEdgeNodes = 0;
_Face* prevPolyg = 0; // polygon previously created from this quad
while ( nbSplits > 0 )
else
{
_OrientedLink foundSplit;
- for ( int i = iS; i < splits.size() && !foundSplit; ++i )
+ for ( size_t i = iS; i < splits.size() && !foundSplit; ++i )
if (( foundSplit = splits[ i ]) &&
( n2->IsLinked( foundSplit.FirstNode()->_intPoint )))
{
{
sortVertexNodes( chainNodes, curNode, curFace );
}
- for ( int i = 0; i < chainNodes.size(); ++i )
+ for ( size_t i = 0; i < chainNodes.size(); ++i )
{
polygon.AddPolyLink( chainNodes[ i ], curNode );
curNode = chainNodes[ i ];
i = int(lineInd.I()) + dInd[iL][0];
j = int(lineInd.J()) + dInd[iL][1];
k = int(lineInd.K()) + dInd[iL][2];
- if ( i < 0 || i >= nbCells[0] ||
- j < 0 || j >= nbCells[1] ||
- k < 0 || k >= nbCells[2] ) continue;
+ if ( i < 0 || i >= (int) nbCells[0] ||
+ j < 0 || j >= (int) nbCells[1] ||
+ k < 0 || k >= (int) nbCells[2] ) continue;
const size_t hexIndex = _grid->CellIndex( i,j,k );
Hexahedron *& hex = allHexa[ hexIndex ];
planes._zProjs [0] = 0;
const double zFactor = _grid->_axes[ iDirZ ] * planes._zNorm;
const vector< double > & u = _grid->_coords[ iDirZ ];
- for ( int i = 1; i < planes._zProjs.size(); ++i )
+ for ( size_t i = 1; i < planes._zProjs.size(); ++i )
{
planes._zProjs [i] = zFactor * ( u[i] - u[0] );
}
chn.back()->IsLinked( quad._eIntNodes[ iP ]->_intPoint ))
{
chn.push_back( quad._eIntNodes[ iP ]);
- found = quad._eIntNodes[ iP ]->_usedInFace = &quad;
+ found = ( quad._eIntNodes[ iP ]->_usedInFace = &quad );
break;
}
} while ( found && ! chn.back()->IsLinked( n2->_intPoint ) );
( !avoidFace || quad._eIntNodes[ iP ]->IsOnFace( avoidFace )))
{
chn.push_back( quad._eIntNodes[ iP ]);
- found = quad._eIntNodes[ iP ]->_usedInFace = &quad;
+ found = ( quad._eIntNodes[ iP ]->_usedInFace = &quad );
break;
}
} while ( found );
{
bool isOut = false;
- const bool moreIntPoints = ( iP+1 < link._fIntPoints.size() );
+ const bool moreIntPoints = ( iP+1 < (int) link._fIntPoints.size() );
// get 2 _Node's
_Node* n1 = link._fIntNodes[ iP ];
// sort nodes accoring to the order of edges
_Node* orderNodes [20];
TGeomID orderShapeIDs[20];
- int nbN = 0;
+ size_t nbN = 0;
TGeomID id, *pID;
for ( e = edges.begin(); e != edges.end(); ++e )
{
if ( !_vIntNodes.empty() )
return false;
- const int ijk[3] = { _i, _j, _k };
+ const size_t ijk[3] = { _i, _j, _k };
F_IntersectPoint curIntPnt;
// consider a cell to be in a hole if all links in any direction
map< TGeomID, vector< TGeomID > > edge2faceIDsMap;
TopExp_Explorer eExp;
Bnd_Box shapeBox;
- for ( int i = 0; i < faceVec.size(); ++i )
+ for ( size_t i = 0; i < faceVec.size(); ++i )
{
facesItersectors[i]._face = TopoDS::Face ( faceVec[i] );
facesItersectors[i]._faceID = grid._shapes.Add( faceVec[i] );
#include <set>
#include <vector>
+using namespace std;
#ifdef _DEBUG_
// #define DEB_FACES
// #define DEB_GRID
-// #define DUMP_VERT(msg,V) \
-// { TopoDS_Vertex v = V; gp_Pnt p = BRep_Tool::Pnt(v); \
-// cout << msg << "( "<< p.X()<<", "<<p.Y()<<", "<<p.Z()<<" )"<<endl;}
+// #define DUMP_VERT(msg,V) { TopoDS_Vertex v = V; gp_Pnt p = BRep_Tool::Pnt(v); cout << msg << "( "<< p.X()<<", "<<p.Y()<<", "<<p.Z()<<" )"<<endl; }
#endif
#ifndef DUMP_VERT
enum EBoxSides{ B_BOTTOM=0, B_RIGHT, B_TOP, B_LEFT, B_FRONT, B_BACK, B_UNDEFINED };
+enum EAxes{ COO_X=1, COO_Y, COO_Z };
+
//================================================================================
/*!
* \brief Convertor of a pair of integers to a sole index
_QuadFaceGrid* FindAdjacentForSide(int i, list<_QuadFaceGrid>& faces, EBoxSides id) const;
//!< Reverse edges in order to have the bottom edge going along axes of the unit box
- void ReverseEdges(/*int e1, int e2*/);
+ void ReverseEdges();
bool IsComplex() const { return !myChildren.empty(); }
//!< Load nodes of a mesh
bool LoadGrid( SMESH_Mesh& mesh );
+ //!< Computes normalized parameters of nodes of myGrid
+ void ComputeIJK( int i1, int i2, double v3 );
+
//!< Return number of segments on the hirizontal sides
int GetNbHoriSegments(SMESH_Mesh& mesh, bool withBrothers=false) const;
//!< Return node coordinates by its position
gp_XYZ GetXYZ(int iHori, int iVert) const;
+ //!< Return normalized parameters of nodes within the unitary cube
+ gp_XYZ& GetIJK(int iCol, int iRow) { return myIJK[ myIndexer( iCol, iRow )]; }
+
public: //** Access to member fields **//
//!< Return i-th face side (0<i<4)
_QuadFaceGrid* myRightBrother;
_QuadFaceGrid* myUpBrother;
- _Indexer myIndexer;
+ _Indexer myIndexer;
vector<const SMDS_MeshNode*> myGrid;
+ vector<gp_XYZ> myIJK; // normalized parameters of nodes
SMESH_ComputeErrorPtr myError;
if ( !fRight ->LoadGrid( theMesh )) return error( fRight ->GetError() );
if ( !fTop ->LoadGrid( theMesh )) return error( fTop ->GetError() );
+ // compute normalized parameters of nodes on sides (PAL23189)
+ fBottom->ComputeIJK( COO_X, COO_Y, /*z=*/0. );
+ fBack ->ComputeIJK( COO_X, COO_Z, /*y=*/1. );
+ fLeft ->ComputeIJK( COO_Y, COO_Z, /*x=*/0. );
+ fFront ->ComputeIJK( COO_X, COO_Z, /*y=*/0. );
+ fRight ->ComputeIJK( COO_Y, COO_Z, /*x=*/1. );
+ fTop ->ComputeIJK( COO_X, COO_Y, /*z=*/1. );
+
int x, xSize = fBottom->GetNbHoriSegments(theMesh) + 1, X = xSize - 1;
int y, ySize = fBottom->GetNbVertSegments(theMesh) + 1, Y = ySize - 1;
int z, zSize = fFront ->GetNbVertSegments(theMesh) + 1, Z = zSize - 1;
pointsOnShapes[ SMESH_Block::ID_V011 ] = fTop->GetXYZ( 0, Y );
pointsOnShapes[ SMESH_Block::ID_V111 ] = fTop->GetXYZ( X, Y );
+ gp_XYZ params; // normalized parameters of an internal node within the unit box
+
for ( x = 1; x < xSize-1; ++x )
{
- gp_XYZ params; // normalized parameters of internal node within a unit box
- params.SetCoord( 1, x / double(X) );
+ const double rX = x / double(X);
for ( y = 1; y < ySize-1; ++y )
{
- params.SetCoord( 2, y / double(Y) );
+ const double rY = y / double(Y);
// column to fill during z loop
vector< const SMDS_MeshNode* >& column = columns[ colIndex( x, y )];
// points projections on horizontal edges
pointsOnShapes[ SMESH_Block::ID_Fxy1 ] = fTop ->GetXYZ( x, y );
for ( z = 1; z < zSize-1; ++z ) // z loop
{
- params.SetCoord( 3, z / double(Z) );
+ // compute normalized parameters of an internal node within the unit box
+ const double rZ = z / double(Z);
+ const gp_XYZ& pBo = fBottom->GetIJK( x, y );
+ const gp_XYZ& pTo = fTop ->GetIJK( x, y );
+ const gp_XYZ& pFr = fFront ->GetIJK( x, z );
+ const gp_XYZ& pBa = fBack ->GetIJK( x, z );
+ const gp_XYZ& pLe = fLeft ->GetIJK( y, z );
+ const gp_XYZ& pRi = fRight ->GetIJK( y, z );
+ params.SetCoord( 1, 0.5 * ( pBo.X() * ( 1. - rZ ) + pTo.X() * rZ +
+ pFr.X() * ( 1. - rY ) + pBa.X() * rY ));
+ params.SetCoord( 2, 0.5 * ( pBo.Y() * ( 1. - rZ ) + pTo.Y() * rZ +
+ pLe.Y() * ( 1. - rX ) + pRi.Y() * rX ));
+ params.SetCoord( 3, 0.5 * ( pFr.Z() * ( 1. - rY ) + pBa.Z() * rY +
+ pLe.Z() * ( 1. - rX ) + pRi.Z() * rX ));
+
// point projections on vertical edges
- pointsOnShapes[ SMESH_Block::ID_E00z ] = fFront->GetXYZ( 0, z );
- pointsOnShapes[ SMESH_Block::ID_E10z ] = fFront->GetXYZ( X, z );
- pointsOnShapes[ SMESH_Block::ID_E01z ] = fBack->GetXYZ( 0, z );
+ pointsOnShapes[ SMESH_Block::ID_E00z ] = fFront->GetXYZ( 0, z );
+ pointsOnShapes[ SMESH_Block::ID_E10z ] = fFront->GetXYZ( X, z );
+ pointsOnShapes[ SMESH_Block::ID_E01z ] = fBack->GetXYZ( 0, z );
pointsOnShapes[ SMESH_Block::ID_E11z ] = fBack->GetXYZ( X, z );
// point projections on vertical faces
- pointsOnShapes[ SMESH_Block::ID_Fx0z ] = fFront->GetXYZ( x, z );
+ pointsOnShapes[ SMESH_Block::ID_Fx0z ] = fFront->GetXYZ( x, z );
pointsOnShapes[ SMESH_Block::ID_Fx1z ] = fBack ->GetXYZ( x, z );
pointsOnShapes[ SMESH_Block::ID_F0yz ] = fLeft ->GetXYZ( y, z );
pointsOnShapes[ SMESH_Block::ID_F1yz ] = fRight->GetXYZ( y, z );
{
const _FaceSide& otherSide = other.GetSide( i );
int iMyCommon;
- if ( mySides.Contain( otherSide, &iMyCommon ) )
+ if ( mySides.Contain( otherSide, &iMyCommon ))
{
if ( internalEdges.Contains( otherSide.Edge( 0 )))
{
DUMP_VERT("Cont 2", mySides.GetSide(iMyCommon)->LastVertex());
DUMP_VERT("Cont 3", otherSide.FirstVertex());
DUMP_VERT("Cont 4", otherSide.LastVertex());
- if ( myChildren.empty() ) {
+
+ if ( myChildren.empty() )
+ {
myChildren.push_back( *this );
myFace.Nullify();
}
+ else // find iMyCommon in myChildren
+ {
+ for ( TChildIterator children = GetChildren(); children.more(); ) {
+ const _QuadFaceGrid& child = children.next();
+ if ( child.mySides.Contain( otherSide, &iMyCommon ))
+ break;
+ }
+ }
// orient new children equally
- int otherBottomIndex = ( 4 + i - iMyCommon + 2 ) % 4;
+ int otherBottomIndex = SMESH_MesherHelper::WrapIndex( i - iMyCommon + 2, 4 );
if ( other.IsComplex() )
for ( TChildIterator children = other.GetChildren(); children.more(); ) {
myChildren.push_back( children.next() );
if ( other.IsComplex() )
for ( TChildIterator children = other.GetChildren(); children.more(); )
{
- const _QuadFaceGrid& child = children.next();
+ const _QuadFaceGrid& child = children.next();
for ( int i = 0; i < 4; ++i )
mySides.AppendSide( child.GetSide(i) );
}
{
if ( childFace->SetBottomSide( bottom, &myBottomIndex ))
{
- TChildren::iterator orientedCild = childFace;
+ TChildren::iterator orientedChild = childFace;
for ( childFace = myChildren.begin(); childFace != childEnd; ++childFace ) {
- if ( childFace != orientedCild )
+ if ( childFace != orientedChild )
childFace->SetBottomSide( childFace->GetSide( myBottomIndex ));
}
if ( sideIndex )
*/
//================================================================================
-void _QuadFaceGrid::ReverseEdges(/*int e1, int e2*/)
+void _QuadFaceGrid::ReverseEdges()
{
myReverse = !myReverse;
if ( myChildren.empty() )
{
-// mySides.GetSide( e1 )->Reverse();
-// mySides.GetSide( e2 )->Reverse();
DumpVertices();
}
else
DumpVertices();
TChildren::iterator child = myChildren.begin(), childEnd = myChildren.end();
for ( ; child != childEnd; ++child )
- child->ReverseEdges( /*e1, e2*/ );
+ child->ReverseEdges();
}
}
TIDSortedElemSet emptySet, avoidSet;
const SMDS_MeshElement* firstQuad = 0; // most left face above the last row of found nodes
- int nbFoundNodes = myIndexer._xSize;
+ size_t nbFoundNodes = myIndexer._xSize;
while ( nbFoundNodes != myGrid.size() )
{
// first and last nodes of the last filled row of nodes
return true;
}
+//================================================================================
+/*!
+ * \brief Fill myIJK with normalized parameters of nodes in myGrid
+ * \param [in] i1 - coordinate index along rows of myGrid
+ * \param [in] i2 - coordinate index along columns of myGrid
+ * \param [in] v3 - value of the constant parameter
+ */
+//================================================================================
+
+void _QuadFaceGrid::ComputeIJK( int i1, int i2, double v3 )
+{
+ gp_XYZ ijk( v3, v3, v3 );
+ myIJK.resize( myIndexer.size(), ijk );
+
+ const size_t nbCol = myIndexer._xSize;
+ const size_t nbRow = myIndexer._ySize;
+
+ vector< double > len( nbRow );
+ len[0] = 0;
+ for ( size_t i = 0; i < nbCol; ++i )
+ {
+ gp_Pnt pPrev = GetXYZ( i, 0 );
+ for ( size_t j = 1; j < nbRow; ++j )
+ {
+ gp_Pnt p = GetXYZ( i, j );
+ len[ j ] = len[ j-1 ] + p.Distance( pPrev );
+ pPrev = p;
+ }
+ for ( size_t j = 0; j < nbRow; ++j )
+ GetIJK( i, j ).SetCoord( i2, len[ j ]/len.back() );
+ }
+
+ len.resize( nbCol );
+ for ( size_t j = 0; j < nbRow; ++j )
+ {
+ gp_Pnt pPrev = GetXYZ( 0, j );
+ for ( size_t i = 1; i < nbCol; ++i )
+ {
+ gp_Pnt p = GetXYZ( i, j );
+ len[ i ] = len[ i-1 ] + p.Distance( pPrev );
+ pPrev = p;
+ }
+ for ( size_t i = 0; i < nbCol; ++i )
+ GetIJK( i, j ).SetCoord( i1, len[ i ]/len.back() );
+ }
+}
+
//================================================================================
/*!
* \brief Find out mutual location of children: find their right and up brothers
gp_XYZ _QuadFaceGrid::GetXYZ(int iHori, int iVert) const
{
- const SMDS_MeshNode* n = myGrid[ myIndexer( iHori, iVert )];
- return gp_XYZ( n->X(), n->Y(), n->Z() );
+ SMESH_TNodeXYZ xyz = myGrid[ myIndexer( iHori, iVert )];
+ return xyz;
}
//================================================================================
for ( ; edge != eEnd; ++edge ) {
myChildren.push_back( _FaceSide( *edge ));
myNbChildren++;
-// myVertices.insert( myChildren.back().myVertices.begin(),
-// myChildren.back().myVertices.end() );
myVertices.Add( myChildren.back().FirstVertex() );
myVertices.Add( myChildren.back().LastVertex() );
myChildren.back().SetID( Q_CHILD ); // not to splice them
//=======================================================================
//function : GetSide
-//purpose :
+//purpose :
//=======================================================================
_FaceSide* _FaceSide::GetSide(const int i)
private:
- bool findBoxFaces( const TopoDS_Shape& shape,
- list< _QuadFaceGrid >& boxFaceContainer,
- SMESH_Mesh& mesh,
- _QuadFaceGrid * & fBottom,
- _QuadFaceGrid * & fTop,
- _QuadFaceGrid * & fFront,
- _QuadFaceGrid * & fBack,
- _QuadFaceGrid * & fLeft,
- _QuadFaceGrid * & fRight);
+ bool findBoxFaces( const TopoDS_Shape& shape,
+ std::list< _QuadFaceGrid >& boxFaceContainer,
+ SMESH_Mesh& mesh,
+ _QuadFaceGrid * & fBottom,
+ _QuadFaceGrid * & fTop,
+ _QuadFaceGrid * & fFront,
+ _QuadFaceGrid * & fBack,
+ _QuadFaceGrid * & fLeft,
+ _QuadFaceGrid * & fRight);
};
#endif
// Module : SMESH
//
#include "StdMeshers_CompositeSegment_1D.hxx"
-#include "StdMeshers_FaceSide.hxx"
-#include "StdMeshers_AutomaticLength.hxx"
+#include "SMDS_MeshElement.hxx"
+#include "SMDS_MeshNode.hxx"
+#include "SMESH_Comment.hxx"
#include "SMESH_Gen.hxx"
-#include "SMESH_Mesh.hxx"
#include "SMESH_HypoFilter.hxx"
+#include "SMESH_Mesh.hxx"
+#include "SMESH_TypeDefs.hxx"
#include "SMESH_subMesh.hxx"
#include "SMESH_subMeshEventListener.hxx"
-#include "SMESH_Comment.hxx"
-
-#include "SMDS_MeshElement.hxx"
-#include "SMDS_MeshNode.hxx"
+#include "StdMeshers_AutomaticLength.hxx"
+#include "StdMeshers_FaceSide.hxx"
#include "utilities.h"
// check if an edge is a part of a complex side
TopoDS_Face face;
TopoDS_Edge edge = TopoDS::Edge( subMesh->GetSubShape() );
- auto_ptr< StdMeshers_FaceSide > side
+ SMESHUtils::Deleter< StdMeshers_FaceSide > side
( StdMeshers_CompositeSegment_1D::GetFaceSide(*subMesh->GetFather(),
edge, face, false ));
if ( side->NbEdges() > 1 && side->NbSegments() )
// check if an edge is a part of a complex side
TopoDS_Face face;
TopoDS_Edge edge = TopoDS::Edge( subMesh->GetSubShape() );
- auto_ptr< StdMeshers_FaceSide > side
- ( StdMeshers_CompositeSegment_1D::GetFaceSide(*subMesh->GetFather(),edge, face, false ));
+ SMESHUtils::Deleter< StdMeshers_FaceSide > side
+ ( StdMeshers_CompositeSegment_1D::GetFaceSide( *subMesh->GetFather(), edge, face, false ));
if ( side->NbEdges() > 1 ) { // complex
// set _alwaysComputed to vertices
for ( int iE = 1; iE < side->NbEdges(); ++iE )
{
- TopoDS_Vertex V = side->FirstVertex( iE );
+ TopoDS_Vertex V = side->FirstVertex( iE );
SMESH_subMesh* sm = side->GetMesh()->GetSubMesh( V );
sm->SetIsAlwaysComputed( true );
}
}
}
// set listener that will remove _alwaysComputed from submeshes at algorithm change
- subMesh->SetEventListener( new VertexNodesRestoringListener(), 0, subMesh);
+ subMesh->SetEventListener( new VertexNodesRestoringListener(), 0, subMesh );
StdMeshers_Regular_1D::SetEventListener( subMesh );
}
// Get edges to be discretized as a whole
TopoDS_Face nullFace;
- auto_ptr< StdMeshers_FaceSide > side( GetFaceSide(aMesh, edge, nullFace, true ));
+ SMESHUtils::Deleter< StdMeshers_FaceSide > side( GetFaceSide(aMesh, edge, nullFace, true ));
//side->dump("IN COMPOSITE SEG");
if ( side->NbEdges() < 2 )
}
// Compute node parameters
- auto_ptr< BRepAdaptor_CompCurve > C3d ( side->GetCurve3d() );
+ SMESHUtils::Deleter< BRepAdaptor_CompCurve > C3d ( side->GetCurve3d() );
double f = C3d->FirstParameter(), l = C3d->LastParameter();
list< double > params;
if ( !computeInternalParameters ( aMesh, *C3d, side->Length(), f, l, params, false ))
istream & StdMeshers_Deflection1D::LoadFrom(istream & load)
{
- bool isOK = (load >> _value);
+ bool isOK = static_cast<bool>(load >> _value);
if (!isOK)
load.clear(ios::badbit | load.rdstate());
return load;
if ( SMESH_Algo::GetNodeParamOnEdge( aMeshDS, edge, params ))
{
nbEdges++;
- for ( int i = 1; i < params.size(); ++i )
+ for ( size_t i = 1; i < params.size(); ++i )
_value = Max( _value, deflection( AdaptCurve, params[ i-1 ], params[ i ]));
}
}
double FunctionTable::integral( const int i ) const
{
- if( i>=0 && i<myData.size()-1 )
- return integral( i, myData[2*(i+1)]-myData[2*i] );
+ if ( i >= 0 && i < (int)myData.size()-1 )
+ return integral( i, myData[2*(i+1)] - myData[2*i] );
else
return 0;
}
#include "utilities.h"
+using namespace std;
+
//================================================================================
/*!
* \brief Constructor of a side of one edge
const bool theIgnoreMediumNodes,
SMESH_ProxyMesh::Ptr theProxyMesh)
{
- list<TopoDS_Edge> edges(1,theEdge);
+ std::list<TopoDS_Edge> edges(1,theEdge);
*this = StdMeshers_FaceSide( theFace, edges, theMesh, theIsForward,
theIgnoreMediumNodes, theProxyMesh );
}
*/
//================================================================================
-StdMeshers_FaceSide::StdMeshers_FaceSide(const TopoDS_Face& theFace,
- list<TopoDS_Edge>& theEdges,
- SMESH_Mesh* theMesh,
- const bool theIsForward,
- const bool theIgnoreMediumNodes,
- SMESH_ProxyMesh::Ptr theProxyMesh)
+StdMeshers_FaceSide::StdMeshers_FaceSide(const TopoDS_Face& theFace,
+ std::list<TopoDS_Edge>& theEdges,
+ SMESH_Mesh* theMesh,
+ const bool theIsForward,
+ const bool theIgnoreMediumNodes,
+ SMESH_ProxyMesh::Ptr theProxyMesh)
{
int nbEdges = theEdges.size();
myEdge.resize ( nbEdges );
SMESHDS_Mesh* meshDS = myProxyMesh->GetMeshDS();
int nbDegen = 0;
- list<TopoDS_Edge>::iterator edge = theEdges.begin();
+ std::list<TopoDS_Edge>::iterator edge = theEdges.begin();
for ( int index = 0; edge != theEdges.end(); ++index, ++edge )
{
int i = theIsForward ? index : nbEdges-index-1;
*/
//================================================================================
-const vector<UVPtStruct>& StdMeshers_FaceSide::GetUVPtStruct(bool isXConst,
- double constValue) const
+const std::vector<UVPtStruct>& StdMeshers_FaceSide::GetUVPtStruct(bool isXConst,
+ double constValue) const
{
if ( myPoints.empty() )
{
if ( NbEdges() == 0 ) return myPoints;
StdMeshers_FaceSide* me = const_cast< StdMeshers_FaceSide* >( this );
- SMESHDS_Mesh* meshDS = myProxyMesh->GetMeshDS();
+ //SMESHDS_Mesh* meshDS = myProxyMesh->GetMeshDS();
SMESH_MesherHelper eHelper( *myProxyMesh->GetMesh() );
SMESH_MesherHelper fHelper( *myProxyMesh->GetMesh() );
fHelper.SetSubShape( myFace );
bool paramOK;
double eps = 1e-100;
- // sort nodes of all edges putting them into a map
+ // sort nodes of all edges by putting them into a map
map< double, const SMDS_MeshNode*> u2node;
vector< pair< double, const SMDS_MeshNode*> > u2nodeVec;
u2node.insert( u2node.end(), make_pair( 1., node ));
}
- if ( u2node.size() + nbProxyNodes != myNbPonits &&
- u2node.size() + nbProxyNodes != NbPoints( /*update=*/true ))
+ if ((int) u2node.size() + nbProxyNodes != myNbPonits &&
+ (int) u2node.size() + nbProxyNodes != NbPoints( /*update=*/true ))
{
MESSAGE("Wrong node parameters on edges, u2node.size():"
<<u2node.size()<<" != myNbPonits:"<<myNbPonits);
// set <constValue>
if ( isXConst )
- for ( iPt = 0; iPt < points.size(); ++iPt ) points[ iPt ].x = constValue;
+ for ( iPt = 0; iPt < (int)points.size(); ++iPt ) points[ iPt ].x = constValue;
else
- for ( iPt = 0; iPt < points.size(); ++iPt ) points[ iPt ].y = constValue;
+ for ( iPt = 0; iPt < (int)points.size(); ++iPt ) points[ iPt ].y = constValue;
} // if ( myPoints.empty())
int EdgeIndex = 0;
double prevNormPar = 0, paramSize = myNormPar[ EdgeIndex ];
- for (int i = 0 ; i < myFalsePoints.size(); ++i ) {
+ for ( size_t i = 0 ; i < myFalsePoints.size(); ++i ) {
double normPar = double(i) / double(nbSeg);
UVPtStruct & uvPt = (*points)[i];
uvPt.node = 0;
{
if ( NbEdges() == 0 ) return resultNodes;
- SMESHDS_Mesh* meshDS = myProxyMesh->GetMeshDS();
+ //SMESHDS_Mesh* meshDS = myProxyMesh->GetMeshDS();
SMESH_MesherHelper eHelper( *myProxyMesh->GetMesh() );
SMESH_MesherHelper fHelper( *myProxyMesh->GetMesh() );
fHelper.SetSubShape( myFace );
// Fill the result vector
if ( theEdgeInd < 0 &&
- u2node.size() != myNbPonits &&
- u2node.size() != NbPoints( /*update=*/true ))
+ (int) u2node.size() != myNbPonits &&
+ (int) u2node.size() != NbPoints( /*update=*/true ))
{
u2node.clear();
}
n = SMESH_Algo::VertexNode( V, sm, myProxyMesh->GetMesh(), /*checkV=*/false );
if (( !n ) &&
- (( i > 0 && i < NbEdges() ) || IsClosed() ))
+ (( i > 0 && (int) i < NbEdges() ) || IsClosed() ))
{
iE = SMESH_MesherHelper::WrapIndex( int(i)-1, NbEdges() );
sm = myProxyMesh->GetMeshDS()->MeshElements( myEdgeID[ iE ]);
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)
+ for ( size_t i = 0; i < myEdge.size(); ++i )
{
MESSAGE_ADD ( "\t"<<i+1 );
MESSAGE_ADD ( "\tEDGE: " );
else {
TopAbs::Print(myEdge[i].Orientation(),cout)<<" "<<myEdge[i].TShape().operator->()<<endl;
MESSAGE_ADD ( "\tV1: " << TopExp::FirstVertex( myEdge[i], 1).TShape().operator->()
- << " V2: " << TopExp::LastVertex( 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->() );
}
-
+
MESSAGE_ADD ( "\tF: "<<myFirst[i]<< " L: "<< myLast[i] );
MESSAGE_END ( "\tnormPar: "<<myNormPar[i]<<endl );
}
TopoDS_Wire aWire;
BRep_Builder aBuilder;
aBuilder.MakeWire(aWire);
- for ( int i=0; i<myEdge.size(); ++i )
+ for ( size_t i = 0; i < myEdge.size(); ++i )
aBuilder.Add( aWire, myEdge[i] );
if ( myEdge.size() == 2 && IsClosed() )
int i = U * double( myPoints.size()-1 );
while ( i > 0 && myPoints[ i ].normParam > U )
--i;
- while ( i+1 < myPoints.size() && myPoints[ i+1 ].normParam < U )
+ while ( i+1 < (int)myPoints.size() && myPoints[ i+1 ].normParam < U )
++i;
double r = (( U - myPoints[ i ].normParam ) /
( myPoints[ i+1 ].normParam - myPoints[ i ].normParam ));
int intVal;
double dblVal;
- isOK = (load >> intVal);
+ isOK = static_cast<bool>(load >> intVal);
if (isOK && intVal > 0) {
_params.clear();
_params.reserve( intVal );
- for (int i = 0; i < _params.capacity() && isOK; i++) {
- isOK = (load >> dblVal);
+ for ( size_t i = 0; i < _params.capacity() && isOK; i++) {
+ isOK = static_cast<bool>(load >> dblVal);
if ( isOK ) _params.push_back( dblVal );
}
}
- isOK = (load >> intVal);
+ isOK = static_cast<bool>(load >> intVal);
if (isOK && intVal > 0) {
_nbsegs.clear();
_nbsegs.reserve( intVal );
- for (int i = 0; i < _nbsegs.capacity() && isOK; i++) {
- isOK = (load >> intVal);
+ for ( size_t i = 0; i < _nbsegs.capacity() && isOK; i++) {
+ isOK = static_cast<bool>(load >> intVal);
if ( isOK ) _nbsegs.push_back( intVal );
}
}
- isOK = (load >> intVal);
+ isOK = static_cast<bool>(load >> intVal);
if (isOK && intVal > 0) {
_edgeIDs.clear();
_edgeIDs.reserve( intVal );
- for (int i = 0; i < _edgeIDs.capacity() && isOK; i++) {
- isOK = (load >> intVal);
+ for ( size_t i = 0; i < _edgeIDs.capacity() && isOK; i++) {
+ isOK = static_cast<bool>(load >> intVal);
if ( isOK ) _edgeIDs.push_back( intVal );
}
}
- isOK = (load >> _objEntry);
+ isOK = static_cast<bool>(load >> _objEntry);
return load;
}
istream & StdMeshers_Geometric1D::LoadFrom(istream & load)
{
bool isOK = true;
- isOK = (load >> _begLength);
- isOK = (load >> _ratio);
+ isOK = static_cast<bool>(load >> _begLength);
+ isOK = static_cast<bool>(load >> _ratio);
if (isOK)
StdMeshers_Reversible1D::LoadFrom( load );
const TopoDS_Edge& edge = TopoDS::Edge( edgeMap( i ));
BRepAdaptor_Curve C( edge );
- vector< double > params;
+ std::vector< double > params;
if ( SMESH_Algo::GetNodeParamOnEdge( theMesh->GetMeshDS(), edge, params ))
{
nbEdges++;
#include <limits>
+using namespace std;
+
// Define error message and _MYDEBUG_ if needed
#ifdef _DEBUG_
#define BAD_MESH_ERR \
return true;
set<const SMDS_MeshNode*> nodesInInverseFaces;
- SMDS_ElemIteratorPtr fIt = n->GetInverseElementIterator(SMDSAbs_Face );
+ SMDS_ElemIteratorPtr fIt = n->GetInverseElementIterator( SMDSAbs_Face );
while ( fIt->more() )
{
const SMDS_MeshElement* face = fIt->next();
nodesInInverseFaces.insert( face->begin_nodes(), face->end_nodes() );
}
- return nodesInInverseFaces.size() != ( 6 + (nbF/2-1)*3 );
+ return (int)nodesInInverseFaces.size() != ( 6 + (nbF/2-1)*3 );
}
//================================================================================
int _nbBlocksFound;
#ifdef _DEBUG_ // want to get SIGSEGV in case of invalid index
-#define _grid_access_(pobj, i) pobj->_grid[ ((i) < pobj->_grid.size()) ? i : int(1e100)]
+#define _grid_access_(pobj, i) pobj->_grid[ ((i) < (int)pobj->_grid.size()) ? i : int(1e100)]
#else
#define _grid_access_(pobj, i) pobj->_grid[ i ]
#endif
//!< safely return a node by XY
const SMDS_MeshNode* node(int x, int y) const
{
- int i = _index( x, y );
- return ( i < 0 || i >= _side->_grid.size()) ? 0 : _side->_grid[i];
+ size_t i = _index( x, y );
+ return ( i >= _side->_grid.size() ) ? 0 : _side->_grid[i];
}
//!< Return an edge
SMESH_OrientedLink edge(EQuadEdge edge) const
//================================================================================
/*!
- * \brief Find and return number of submeshes corresponding to blocks
+ * \brief Find blocks and return their number
*/
//================================================================================
_allSides.push_back( _BlockSide() );
_BlockSide& side = _allSides.back();
- if ( !fillSide( side, face, *corner ) )
+ if ( !fillSide( side, face, *corner ))
{
if ( !_error.empty() )
return false;
ok = block.setSide( i, findBlockSide( B_FRONT, edgeOfFront[i], edgeOfAdj[i],
advAnalys, sidesAround));
// try to find a BACK side by a TOP one
- if ( ok || !advAnalys)
+ if ( ok || !advAnalys )
if ( !block._side[B_BACK] && block._side[B_TOP] )
ok = block.setSide( B_BACK, findBlockSide( B_TOP, Q_TOP, Q_TOP,
advAnalys, sidesAround ));
{
// check if just found block is same as one of previously found blocks
bool isSame = false;
- for ( int i = 1; i < _blocks.size() && !isSame; ++i )
+ for ( size_t i = 1; i < _blocks.size() && !isSame; ++i )
isSame = ( block._corners == _blocks[i-1]._corners );
ok = !isSame;
}
side._index._ySize = verRow1.size();
side._grid.resize( side._index.size(), NULL );
- for ( x = 0; x < horRow1.size(); ++x )
+ for ( x = 0; x < nbX; ++x )
{
side.setNode( x, 0, horRow1[x] );
side.setNode( x, 1, horRow2[x] );
}
- for ( y = 0; y < verRow1.size(); ++y )
+ for ( y = 0; y < nbY; ++y )
{
side.setNode( 0, y, verRow1[y] );
side.setNode( 1, y, verRow2[y] );
if ( !n ) return false;
prevSide = nextSide;
- nbChainLinks++;
+
+ if ( ++nbChainLinks > NB_QUAD_SIDES )
+ return false;
}
return ( n == n2 && nbChainLinks == NB_QUAD_SIDES );
SMESH_OrientedLink eAdja = _side[ adjacent[i] ].edge( edgeAdj[i] );
ok = ( eBack == eAdja );
}
+ ok = ok && ( _side[ B_BOTTOM ]._index.size() == _side[ B_TOP ]._index.size() &&
+ _side[ B_RIGHT ]._index.size() == _side[ B_LEFT ]._index.size() &&
+ _side[ B_FRONT ]._index.size() == _side[ B_BACK ]._index.size() );
return ok;
}
int entity = secondOrder ? SMDSEntity_Quad_Hexa : SMDSEntity_Hexa;
vector<int>& nbByType = aResMap[ aMesh.GetSubMesh( aShape )];
- if ( entity >= nbByType.size() )
+ if ( entity >= (int) nbByType.size() )
nbByType.resize( SMDSEntity_Last, 0 );
for ( int i = 0; i < nbBlocks; ++i )
//=============================================================================
typedef boost::shared_ptr< FaceQuadStruct > FaceQuadStructPtr;
+ typedef std::vector<gp_XYZ> TXYZColumn;
// symbolic names of box sides
enum EBoxSides{ B_BOTTOM=0, B_RIGHT, B_TOP, B_LEFT, B_FRONT, B_BACK, B_NB_SIDES };
// symbolic names of sides of quadrangle
enum EQuadSides{ Q_BOTTOM=0, Q_RIGHT, Q_TOP, Q_LEFT, Q_NB_SIDES };
+ enum EAxes{ COO_X=1, COO_Y, COO_Z };
+
//=============================================================================
/*!
* \brief Container of nodes of structured mesh on a qudrangular geom FACE
// node column's taken form _u2nodesMap taking into account sub-shape orientation
vector<TNodeColumn> _columns;
+ // columns of normalized parameters of nodes within the unitary cube
+ vector<TXYZColumn> _ijkColumns;
+
// geometry of a cube side
TopoDS_Face _sideF;
{
return SMESH_TNodeXYZ( GetNode( iCol, iRow ));
}
+ gp_XYZ& GetIJK(int iCol, int iRow)
+ {
+ return _ijkColumns[iCol][iRow];
+ }
};
//================================================================================
}
return ( n == n00 || n == n01 || n == n10 || n == n11 );
}
+
+ //================================================================================
+ /*!
+ * \brief Fill in _FaceGrid::_ijkColumns
+ * \param [in,out] fg - a _FaceGrid
+ * \param [in] i1 - coordinate index along _columns
+ * \param [in] i2 - coordinate index along _columns[i]
+ * \param [in] v3 - value of the constant parameter
+ */
+ //================================================================================
+
+ void computeIJK( _FaceGrid& fg, int i1, int i2, double v3 )
+ {
+ gp_XYZ ijk( v3, v3, v3 );
+ const size_t nbCol = fg._columns.size();
+ const size_t nbRow = fg._columns[0].size();
+
+ fg._ijkColumns.resize( nbCol );
+ for ( size_t i = 0; i < nbCol; ++i )
+ fg._ijkColumns[ i ].resize( nbRow, ijk );
+
+ vector< double > len( nbRow );
+ len[0] = 0;
+ for ( size_t i = 0; i < nbCol; ++i )
+ {
+ gp_Pnt pPrev = fg.GetXYZ( i, 0 );
+ for ( size_t j = 1; j < nbRow; ++j )
+ {
+ gp_Pnt p = fg.GetXYZ( i, j );
+ len[ j ] = len[ j-1 ] + p.Distance( pPrev );
+ pPrev = p;
+ }
+ for ( size_t j = 0; j < nbRow; ++j )
+ fg.GetIJK( i, j ).SetCoord( i2, len[ j ]/len.back() );
+ }
+
+ len.resize( nbCol );
+ for ( size_t j = 0; j < nbRow; ++j )
+ {
+ gp_Pnt pPrev = fg.GetXYZ( 0, j );
+ for ( size_t i = 1; i < nbCol; ++i )
+ {
+ gp_Pnt p = fg.GetXYZ( i, j );
+ len[ i ] = len[ i-1 ] + p.Distance( pPrev );
+ pPrev = p;
+ }
+ for ( size_t i = 0; i < nbCol; ++i )
+ fg.GetIJK( i, j ).SetCoord( i1, len[ i ]/len.back() );
+ }
+ }
}
//=============================================================================
{
aCubeSide[i]._columns.resize( aCubeSide[i]._u2nodesMap.size() );
- int iFwd = 0, iRev = aCubeSide[i]._columns.size()-1;
- int* pi = isReverse[i] ? &iRev : &iFwd;
+ size_t iFwd = 0, iRev = aCubeSide[i]._columns.size()-1;
+ size_t* pi = isReverse[i] ? &iRev : &iFwd;
TParam2ColumnMap::iterator u2nn = aCubeSide[i]._u2nodesMap.begin();
for ( ; iFwd < aCubeSide[i]._columns.size(); --iRev, ++iFwd, ++u2nn )
aCubeSide[i]._columns[ *pi ].swap( u2nn->second );
aCubeSide[i]._u2nodesMap.clear();
}
-
+
if ( proxymesh )
for ( int i = 0; i < 6; ++i )
for ( unsigned j = 0; j < aCubeSide[i]._columns.size(); ++j)
_FaceGrid* fFront = & aCubeSide[ B_FRONT ];
_FaceGrid* fBack = & aCubeSide[ B_BACK ];
+ // compute normalized parameters of nodes on sides (PAL23189)
+ computeIJK( *fBottom, COO_X, COO_Y, /*z=*/0. );
+ computeIJK( *fRight, COO_Y, COO_Z, /*x=*/1. );
+ computeIJK( *fTop, COO_X, COO_Y, /*z=*/1. );
+ computeIJK( *fLeft, COO_Y, COO_Z, /*x=*/0. );
+ computeIJK( *fFront, COO_X, COO_Z, /*y=*/0. );
+ computeIJK( *fBack, COO_X, COO_Z, /*y=*/1. );
+
// cube size measured in nb of nodes
int x, xSize = fBottom->_columns.size() , X = xSize - 1;
int y, ySize = fLeft->_columns.size() , Y = ySize - 1;
pointsOnShapes[ SMESH_Block::ID_V011 ] = fTop->GetXYZ( 0, Y );
pointsOnShapes[ SMESH_Block::ID_V111 ] = fTop->GetXYZ( X, Y );
+ gp_XYZ params; // normalized parameters of an internal node within the unit box
for ( x = 1; x < xSize-1; ++x )
{
- gp_XYZ params; // normalized parameters of internal node within a unit box
- params.SetCoord( 1, x / double(X) );
+ const double rX = x / double(X);
for ( y = 1; y < ySize-1; ++y )
{
- params.SetCoord( 2, y / double(Y) );
+ const double rY = y / double(Y);
+
// a column to fill in during z loop
vector< const SMDS_MeshNode* >& column = columns[ colIndex( x, y )];
// projection points on horizontal edges
pointsOnShapes[ SMESH_Block::ID_Fxy1 ] = fTop ->GetXYZ( x, y );
for ( z = 1; z < zSize-1; ++z ) // z loop
{
- params.SetCoord( 3, z / double(Z) );
+ const double rZ = z / double(Z);
+
+ const gp_XYZ& pBo = fBottom->GetIJK( x, y );
+ const gp_XYZ& pTo = fTop ->GetIJK( x, y );
+ const gp_XYZ& pFr = fFront ->GetIJK( x, z );
+ const gp_XYZ& pBa = fBack ->GetIJK( x, z );
+ const gp_XYZ& pLe = fLeft ->GetIJK( y, z );
+ const gp_XYZ& pRi = fRight ->GetIJK( y, z );
+ params.SetCoord( 1, 0.5 * ( pBo.X() * ( 1. - rZ ) + pTo.X() * rZ +
+ pFr.X() * ( 1. - rY ) + pBa.X() * rY ));
+ params.SetCoord( 2, 0.5 * ( pBo.Y() * ( 1. - rZ ) + pTo.Y() * rZ +
+ pLe.Y() * ( 1. - rX ) + pRi.Y() * rX ));
+ params.SetCoord( 3, 0.5 * ( pFr.Z() * ( 1. - rY ) + pBa.Z() * rY +
+ pLe.Z() * ( 1. - rX ) + pRi.Z() * rX ));
+
// projection points on vertical edges
- pointsOnShapes[ SMESH_Block::ID_E00z ] = fFront->GetXYZ( 0, z );
- pointsOnShapes[ SMESH_Block::ID_E10z ] = fFront->GetXYZ( X, z );
- pointsOnShapes[ SMESH_Block::ID_E01z ] = fBack->GetXYZ( 0, z );
+ pointsOnShapes[ SMESH_Block::ID_E00z ] = fFront->GetXYZ( 0, z );
+ pointsOnShapes[ SMESH_Block::ID_E10z ] = fFront->GetXYZ( X, z );
+ pointsOnShapes[ SMESH_Block::ID_E01z ] = fBack->GetXYZ( 0, z );
pointsOnShapes[ SMESH_Block::ID_E11z ] = fBack->GetXYZ( X, z );
// projection points on vertical faces
- pointsOnShapes[ SMESH_Block::ID_Fx0z ] = fFront->GetXYZ( x, z );
- pointsOnShapes[ SMESH_Block::ID_Fx1z ] = fBack ->GetXYZ( x, z );
- pointsOnShapes[ SMESH_Block::ID_F0yz ] = fLeft ->GetXYZ( y, z );
+ pointsOnShapes[ SMESH_Block::ID_Fx0z ] = fFront->GetXYZ( x, z );
+ pointsOnShapes[ SMESH_Block::ID_Fx1z ] = fBack ->GetXYZ( x, z );
+ pointsOnShapes[ SMESH_Block::ID_F0yz ] = fLeft ->GetXYZ( y, z );
pointsOnShapes[ SMESH_Block::ID_F1yz ] = fRight->GetXYZ( y, z );
// compute internal node coordinates
gp_XYZ coords;
SMESH_Block::ShellPoint( params, pointsOnShapes, coords );
column[ z ] = helper.AddNode( coords.X(), coords.Y(), coords.Z() );
-
}
}
}
bool loaded=false)
{
vector<SMESH_Group*> okGroups;
- for ( int i = 0; i < groups.size(); ++i )
+ for ( size_t i = 0; i < groups.size(); ++i )
{
try
{
// we expect SIGSEGV on a dead group
OCC_CATCH_SIGNALS;
SMESH_Group* okGroup = 0;
- map<int, SMESH_Mesh*>::iterator itm = itm = studyContext->mapMesh.begin();
+ map<int, SMESH_Mesh*>::iterator itm = studyContext->mapMesh.begin();
for ( ; !okGroup && itm != studyContext->mapMesh.end(); itm++)
{
SMESH_Mesh::GroupIteratorPtr gIt = itm->second->GetGroups();
{
int tgtID = resMapKey.second;
SMESH_Mesh* tgtMesh = 0;
- map<int, SMESH_Mesh*>::iterator itm = itm = studyContext->mapMesh.begin();
+ map<int, SMESH_Mesh*>::iterator itm = studyContext->mapMesh.begin();
for ( ; !tgtMesh && itm != studyContext->mapMesh.end(); itm++)
{
tgtMesh = (*itm).second;
StudyContextStruct* studyContext = _gen->GetStudyContext(_studyId);
for ( set<int>::iterator id = meshIDs.begin(); id != meshIDs.end(); ++id )
{
- map<int, SMESH_Mesh*>::iterator itm = itm = studyContext->mapMesh.begin();
+ map<int, SMESH_Mesh*>::iterator itm = studyContext->mapMesh.begin();
for ( ; itm != studyContext->mapMesh.end(); itm++)
{
SMESH_Mesh* mesh = (*itm).second;
_groups = groups;
_resultGroups.clear();
- int i = 0;
+ size_t i = 0;
while ( i < _resultGroupsStorage.size() )
{
int key1 = _resultGroupsStorage[i++];
// import edges from groups
TNodeNodeMap* n2n;
TElemElemMap* e2e;
- for ( int iG = 0; iG < srcGroups.size(); ++iG )
+ for ( size_t iG = 0; iG < srcGroups.size(); ++iG )
{
const SMESHDS_GroupBase* srcGroup = srcGroups[iG]->GetGroupDS();
double mytol = a.Distance(edge->GetNode(edge->NbNodes()-1))/25;
//mytol = max(1.E-5, 10*edgeTol); // too strict and not necessary
//MESSAGE("mytol = " << mytol);
- for ( unsigned i = 0; i < newNodes.size(); ++i, ++node )
+ for ( size_t i = 0; i < newNodes.size(); ++i, ++node )
{
TNodeNodeMap::iterator n2nIt = n2n->insert( make_pair( *node, (SMDS_MeshNode*)0 )).first;
if ( n2nIt->second )
// copy meshes
vector<SMESH_Mesh*> srcMeshes = _sourceHyp->GetSourceMeshes();
- for ( unsigned i = 0; i < srcMeshes.size(); ++i )
+ for ( size_t i = 0; i < srcMeshes.size(); ++i )
importMesh( srcMeshes[i], theMesh, _sourceHyp, theShape );
return true;
(*e2eIt).second = newElem;
}
// copy free nodes
- if ( srcMeshDS->NbNodes() > n2n->size() )
+ if ( srcMeshDS->NbNodes() > (int) n2n->size() )
{
SMDS_NodeIteratorPtr nIt = srcMeshDS->nodesIterator();
while( nIt->more() )
// count edges imported from groups
int nbEdges = 0, nbQuadEdges = 0;
- for ( int iG = 0; iG < srcGroups.size(); ++iG )
+ for ( size_t iG = 0; iG < srcGroups.size(); ++iG )
{
const SMESHDS_GroupBase* srcGroup = srcGroups[iG]->GetGroupDS();
SMDS_ElemIteratorPtr srcElems = srcGroup->GetElements();
}
SMESH_subMesh * sm = theMesh.GetSubMesh(theShape);
- aResMap.insert(make_pair(sm,aVec));
+ aResMap.insert( make_pair( sm, aVec ));
return true;
}
set<const SMDS_MeshNode* > allNodes;
gp_XY uv;
double minGroupTol = 1e100;
- for ( int iG = 0; iG < srcGroups.size(); ++iG )
+ for ( size_t iG = 0; iG < srcGroups.size(); ++iG )
{
const SMESHDS_GroupBase* srcGroup = srcGroups[iG]->GetGroupDS();
const double groupTol = 0.5 * sqrt( getMinElemSize2( srcGroup ));
{
bool isOK = true;
int a;
- isOK = (load >> a);
+ isOK = static_cast<bool>(load >> a);
if (isOK)
this->_mode = a;
else
bool isOK = true;
double a;
- isOK = (load >> a);
+ isOK = static_cast<bool>(load >> a);
if (isOK)
this->_length = a;
else
load.clear(ios::badbit | load.rdstate());
- isOK = (load >> a);
+ isOK = static_cast<bool>(load >> a);
if (isOK)
this->_precision = a;
else
SMESHDS_Mesh* aMeshDS = const_cast< SMESH_Mesh* >( theMesh )->GetMeshDS();
if ( SMESH_Algo::GetNodeParamOnEdge( aMeshDS, edge, params ))
{
- for ( int i = 1; i < params.size(); ++i )
+ for ( size_t i = 1; i < params.size(); ++i )
_length += GCPnts_AbscissaPoint::Length( AdaptCurve, params[ i-1 ], params[ i ]);
nbEdges += params.size() - 1;
}
F = TopoDS::Face( _helper->GetSubShape() );
TopExp::MapShapesAndAncestors( F, TopAbs_VERTEX, TopAbs_WIRE, VWMap );
int nbVertices = 0;
- for ( int iW = 0; iW < wires.size(); ++iW )
+ for ( size_t iW = 0; iW < wires.size(); ++iW )
nbVertices += wires[ iW ]->NbEdges();
if ( nbVertices == VWMap.Extent() )
VWMap.Clear(); // wires have no common vertices
int m = 0;
- for ( int iW = 0; iW < wires.size(); ++iW )
+ for ( size_t iW = 0; iW < wires.size(); ++iW )
{
const vector<UVPtStruct>& uvPtVec = wires[ iW ]->GetUVPtStruct();
- if ( uvPtVec.size() != wires[ iW ]->NbPoints() ) {
+ if ((int) 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()
<< ", probably because of invalid node parameters on geom edges");
{
bool isOK = true;
double a;
- isOK = (load >> a);
+ isOK = static_cast<bool>(load >> a);
if (isOK)
this->_maxArea = a;
else
{
bool isOK = true;
double a;
- isOK = (load >> a);
+ isOK = static_cast<bool>(load >> a);
if (isOK)
this->_maxVolume = a;
else
bool isOK = true;
double a;
- isOK = (load >> a);
+ isOK = static_cast<bool>(load >> a);
if (isOK)
_length = a;
else
load.clear(ios::badbit | load.rdstate());
- isOK = (load >> a);
+ isOK = static_cast<bool>(load >> a);
if (isOK)
_preestimated = a;
else
load.clear(ios::badbit | load.rdstate());
bool pre;
- isOK = (load >> pre);
+ isOK = static_cast<bool>(load >> pre);
if ( isOK )
_preestimation = pre;
else
SMESHDS_Mesh* aMeshDS = const_cast< SMESH_Mesh* >( theMesh )->GetMeshDS();
if ( SMESH_Algo::GetNodeParamOnEdge( aMeshDS, edge, params ))
{
- for ( int i = 1; i < params.size(); ++i )
+ for ( size_t i = 1; i < params.size(); ++i )
_length += GCPnts_AbscissaPoint::Length( AdaptCurve, params[ i-1 ], params[ i ]);
nbEdges += params.size() - 1;
}
{
if ( _nbLayers != numberOfLayers ) {
if ( numberOfLayers <= 0 )
- throw SALOME_Exception(LOCALIZED("numberOfLayers must be positive"));
+ throw SALOME_Exception(LOCALIZED("numberOfLayers must be more than zero"));
_nbLayers = numberOfLayers;
NotifySubMeshesHypothesisModification();
istream & StdMeshers_NumberOfLayers::LoadFrom(istream & load)
{
bool isOK = true;
- isOK = (load >> _nbLayers);
+ isOK = static_cast<bool>(load >> _nbLayers);
if (!isOK)
load.clear(ios::badbit | load.rdstate());
return load;
void StdMeshers_NumberOfSegments::SetScaleFactor(double scaleFactor)
throw(SALOME_Exception)
{
- if (_distrType != DT_Scale)
- _distrType = DT_Scale;
- //throw SALOME_Exception(LOCALIZED("not a scale distribution"));
if (scaleFactor < PRECISION)
throw SALOME_Exception(LOCALIZED("scale factor must be positive"));
- if (fabs(scaleFactor - 1.0) < PRECISION)
- _distrType = DT_Regular;
- if (fabs(_scaleFactor - scaleFactor) > PRECISION)
+ if (_distrType != DT_Scale)
+ _distrType = DT_Scale;
+
+// commented by mpa for IPAL 52986
+// if ( fabs(scaleFactor - 1.0) < PRECISION )
+// _distrType = DT_Regular;
+
+ if ( fabs(_scaleFactor - scaleFactor) > PRECISION )
{
_scaleFactor = scaleFactor;
NotifySubMeshesHypothesisModification();
//================================================================================
/*!
- *
+ *
*/
//================================================================================
//================================================================================
/*!
- *
+ *
*/
//================================================================================
if ( (table.size() % 2) != 0 )
throw SALOME_Exception(LOCALIZED("odd size of vector of table function"));
- int i;
double prev = -PRECISION;
bool isSame = table.size() == _table.size();
bool pos = false;
- for (i=0; i < table.size()/2; i++) {
+ for ( size_t i = 0; i < table.size() / 2; i++ )
+ {
double par = table[i*2];
double val = table[i*2+1];
if( _convMode==0 )
OCC_CATCH_SIGNALS;
#endif
val = pow( 10.0, val );
- } catch(Standard_Failure) {
+ }
+ catch(Standard_Failure) {
Handle(Standard_Failure) aFail = Standard_Failure::Caught();
throw SALOME_Exception( LOCALIZED( "invalid value"));
return;
else if( _convMode==1 && val<0.0 )
val = 0.0;
- if ( par<0 || par > 1)
+ if ( par < 0 || par > 1)
throw SALOME_Exception(LOCALIZED("parameter of table function is out of range [0,1]"));
- if ( fabs(par-prev)<PRECISION )
+ if ( fabs(par-prev) < PRECISION )
throw SALOME_Exception(LOCALIZED("two parameters are the same"));
if ( val < 0 )
throw SALOME_Exception(LOCALIZED("value of table function is not positive"));
- if( val>PRECISION )
+ if( val > PRECISION )
pos = true;
if (isSame)
{
double oldpar = _table[i*2];
double oldval = _table[i*2+1];
- if (fabs(par - oldpar) > PRECISION || fabs(val - oldval) > PRECISION)
+ if ( fabs(par - oldpar) > PRECISION || fabs(val - oldval) > PRECISION )
isSame = false;
}
prev = par;
if( !pos )
throw SALOME_Exception(LOCALIZED("value of table function is not positive"));
- if( pos && !isSame )
+ if ( pos && !isSame )
{
_table = table;
NotifySubMeshesHypothesisModification();
//================================================================================
/*!
- *
+ *
*/
//================================================================================
{
if (_distrType != DT_ExprFunc)
_distrType = DT_ExprFunc;
- //throw SALOME_Exception(LOCALIZED("not an expression function distribution"));
string func = CheckExpressionFunction( expr, _convMode );
if( _func != func )
save << " " << _scaleFactor;
break;
case DT_TabFunc:
- int i;
save << " " << _table.size();
- for (i=0; i < _table.size(); i++)
+ for ( size_t i = 0; i < _table.size(); i++ )
save << " " << _table[i];
break;
case DT_ExprFunc:
int a;
// read number of segments
- isOK = (load >> a);
+ isOK = static_cast<bool>(load >> a);
if (isOK)
_numberOfSegments = a;
else
// (nb.segments, distr.type, some other params.),
// we wait here the ditribution type, which is integer
double scale_factor;
- isOK = (load >> scale_factor);
+ isOK = static_cast<bool>(load >> scale_factor);
a = (int)scale_factor;
// try to interprete ditribution type,
{
case DT_Scale:
{
- isOK = (load >> b);
+ isOK = static_cast<bool>(load >> b);
if (isOK)
_scaleFactor = b;
else
break;
case DT_TabFunc:
{
- isOK = (load >> a);
+ isOK = static_cast<bool>(load >> a);
if (isOK)
{
_table.resize(a, 0.);
- int i;
- for (i=0; i < _table.size(); i++)
+ for ( size_t i=0; i < _table.size(); i++ )
{
- isOK = (load >> b);
+ isOK = static_cast<bool>(load >> b);
if (isOK)
_table[i] = b;
else
case DT_ExprFunc:
{
string str;
- isOK = (load >> str);
+ isOK = static_cast<bool>(load >> str);
if (isOK)
_func = str;
else
if (_distrType == DT_TabFunc || _distrType == DT_ExprFunc)
{
- isOK = (load >> a);
+ isOK = static_cast<bool>(load >> a);
if (isOK)
_convMode = a;
else
// load reversed edges IDs
int intVal;
- isOK = (load >> intVal);
+ isOK = static_cast<bool>(load >> intVal);
if ( isOK && _distrType != DT_Regular && intVal > 0 ) {
_edgeIDs.reserve( intVal );
- for (int i = 0; i < _edgeIDs.capacity() && isOK; i++) {
- isOK = (load >> intVal);
+ for ( size_t i = 0; i < _edgeIDs.capacity() && isOK; i++) {
+ isOK = static_cast<bool>(load >> intVal);
if ( isOK ) _edgeIDs.push_back( intVal );
}
- isOK = (load >> _objEntry);
+ isOK = static_cast<bool>(load >> _objEntry);
}
return load;
//=============================================================================
/*!
- *
+ *
*/
//=============================================================================
int nbFaceNodes = pE0->NbNodes();
if(myCreateQuadratic)
nbFaceNodes = nbFaceNodes/2;
- if ( aN.size() < nbFaceNodes * 2 )
+ if ( (int) aN.size() < nbFaceNodes * 2 )
aN.resize( nbFaceNodes * 2 );
//
for ( k=0; k<nbFaceNodes; ++k ) {
aNbNodes = pE0->NbNodes();
if(myCreateQuadratic)
aNbNodes = aNbNodes/2;
- if ( aNodes1.size() < aNbNodes )
+ if ( (int) aNodes1.size() < aNbNodes )
aNodes1.resize( aNbNodes );
//
k = aNbNodes-1; // reverse a face
nVec.resize( vsize, nullNode );
loadedNodes.insert( nVec[ 0 ] = node );
}
- if ( theIJNodes.size() != hsize ) {
+ if ( (int) theIJNodes.size() != hsize ) {
MESSAGE( "Wrong node positions on theBaseEdge" );
return false;
}
#include <gp_Ax3.hxx>
#include <limits>
+#include <numeric>
using namespace std;
#ifdef _DEBUG_
#define DBGOUT(msg) //cout << msg << endl;
#define SHOWYXZ(msg, xyz) \
- // { gp_Pnt p (xyz); \
- // cout << msg << " ("<< p.X() << "; " <<p.Y() << "; " <<p.Z() << ") " <<endl; }
+ //{ gp_Pnt p (xyz); cout << msg << " ("<< p.X() << "; " <<p.Y() << "; " <<p.Z() << ") " <<endl; }
#else
#define DBGOUT(msg)
#define SHOWYXZ(msg, xyz)
// gravity center of a layer
gp_XYZ O(0,0,0);
int vertexCol = -1;
- for ( int i = 0; i < columns.size(); ++i )
+ for ( size_t i = 0; i < columns.size(); ++i )
{
O += gpXYZ( (*columns[ i ])[ z ]);
if ( vertexCol < 0 &&
// Z axis
gp_Vec Z(0,0,0);
int iPrev = columns.size()-1;
- for ( int i = 0; i < columns.size(); ++i )
+ for ( size_t i = 0; i < columns.size(); ++i )
{
gp_Vec v1( O, gpXYZ( (*columns[ iPrev ])[ z ]));
gp_Vec v2( O, gpXYZ( (*columns[ i ] )[ z ]));
{
O = gpXYZ( (*columns[ vertexCol ])[ z ]);
}
- if ( xColumn < 0 || xColumn >= columns.size() )
+ if ( xColumn < 0 || xColumn >= (int) columns.size() )
{
// select a column for X dir
double maxDist = 0;
- for ( int i = 0; i < columns.size(); ++i )
+ for ( size_t i = 0; i < columns.size(); ++i )
{
double dist = ( O - gpXYZ((*columns[ i ])[ z ])).SquareModulus();
if ( dist > maxDist )
if ( nbQuads > 0 )
toRemove = helper->IsStructured( faceSm );
else
- toRemove = quadAlgo->CheckNbEdges( *helper->GetMesh(),
- faceSm->GetSubShape() );
+ toRemove = ( quadAlgo->CheckNbEdges( *helper->GetMesh(),
+ faceSm->GetSubShape() ) != NULL );
nbRemoved += toRemove;
if ( toRemove )
smIt = notQuadSubMesh.erase( smIt );
std::advance( edgeIt, nbEdges-1 );
TopoDS_Edge prevE = *edgeIt;
// bool isPrevStraight = SMESH_Algo::IsStraight( prevE );
- int iPrev = nbEdges - 1;
+ // int iPrev = nbEdges - 1;
- int iUnite = -1; // the first of united EDGEs
+ // int iUnite = -1; // the first of united EDGEs
// analyse angles between EDGEs
int nbCorners = 0;
void pointsToPython(const std::vector<gp_XYZ>& p)
{
#ifdef _DEBUG_
- for ( int i = SMESH_Block::ID_V000; i < p.size(); ++i )
+ for ( size_t i = SMESH_Block::ID_V000; i < p.size(); ++i )
{
cout << "mesh.AddNode( " << p[i].X() << ", "<< p[i].Y() << ", "<< p[i].Z() << ") # " << i <<" " ;
SMESH_Block::DumpShapeID( i, cout ) << endl;
list< TopoDS_Edge >::iterator edge = thePrism.myBottomEdges.begin();
std::list< int >::iterator nbE = thePrism.myNbEdgesInWires.begin();
+ std::list< int > nbQuadsPerWire;
int iE = 0;
double f,l;
while ( edge != thePrism.myBottomEdges.end() )
{
iE = 0;
++nbE;
+ int nbQuadPrev = std::accumulate( nbQuadsPerWire.begin(), nbQuadsPerWire.end(), 0 );
+ nbQuadsPerWire.push_back( thePrism.myWallQuads.size() - nbQuadPrev );
}
}
// that is not so evident in case of several WIREs in the bottom FACE
thePrism.myRightQuadIndex.clear();
for ( size_t i = 0; i < thePrism.myWallQuads.size(); ++i )
- thePrism.myRightQuadIndex.push_back( i+1 );
- list< int >::iterator nbEinW = thePrism.myNbEdgesInWires.begin();
- for ( int iLeft = 0; nbEinW != thePrism.myNbEdgesInWires.end(); ++nbEinW )
{
- thePrism.myRightQuadIndex[ iLeft + *nbEinW - 1 ] = iLeft; // 1st EDGE index of a current WIRE
- iLeft += *nbEinW;
+ thePrism.myRightQuadIndex.push_back( i+1 ); // OK for all but the last EDGE of a WIRE
+ }
+ list< int >::iterator nbQinW = nbQuadsPerWire.begin();
+ for ( int iLeft = 0; nbQinW != nbQuadsPerWire.end(); ++nbQinW )
+ {
+ thePrism.myRightQuadIndex[ iLeft + *nbQinW - 1 ] = iLeft; // for the last EDGE of a WIRE
+ iLeft += *nbQinW;
}
while ( totalNbFaces - faceMap.Extent() > 2 )
{
// now only top and bottom FACEs are not in the faceMap
faceMap.Add( thePrism.myBottom );
- for ( TopExp_Explorer f( thePrism.myShape3D, TopAbs_FACE );f.More(); f.Next() )
+ for ( TopExp_Explorer f( thePrism.myShape3D, TopAbs_FACE ); f.More(); f.Next() )
if ( !faceMap.Contains( f.Current() )) {
thePrism.myTop = TopoDS::Face( f.Current() );
break;
if ( !smDS ) return toSM( error(COMPERR_BAD_INPUT_MESH, "Null submesh"));
// loop on bottom mesh faces
+ vector< const TNodeColumn* > columns;
SMDS_ElemIteratorPtr faceIt = smDS->GetElements();
while ( faceIt->more() )
{
// find node columns for each node
int nbNodes = face->NbCornerNodes();
- vector< const TNodeColumn* > columns( nbNodes );
+ columns.resize( nbNodes );
for ( int i = 0; i < nbNodes; ++i )
{
const SMDS_MeshNode* n = face->GetNode( i );
}
}
// create prisms
- AddPrisms( columns, myHelper );
+ if ( !AddPrisms( columns, myHelper ))
+ return toSM( error("Different 'vertical' discretization"));
} // loop on bottom mesh faces
*/
//================================================================================
-void StdMeshers_Prism_3D::AddPrisms( vector<const TNodeColumn*> & columns,
+bool StdMeshers_Prism_3D::AddPrisms( vector<const TNodeColumn*> & columns,
SMESH_MesherHelper* helper)
{
- int nbNodes = columns.size();
- int nbZ = columns[0]->size();
- if ( nbZ < 2 ) return;
+ size_t nbNodes = columns.size();
+ size_t nbZ = columns[0]->size();
+ if ( nbZ < 2 ) return false;
+ for ( size_t i = 1; i < nbNodes; ++i )
+ if ( columns[i]->size() != nbZ )
+ return false;
// find out orientation
bool isForward = true;
SMDS_VolumeTool vTool;
- int z = 1;
+ size_t z = 1;
switch ( nbNodes ) {
case 3: {
SMDS_VolumeOfNodes tmpPenta ( (*columns[0])[z-1], // bottom
vector<const SMDS_MeshNode*> nodes( 2*nbNodes + 4*nbNodes);
for ( z = 1; z < nbZ; ++z )
{
- for ( int i = 0; i < nbNodes; ++i ) {
+ for ( size_t i = 0; i < nbNodes; ++i ) {
nodes[ i ] = (*columns[ i ])[z+iBase1]; // bottom or top
nodes[ 2*nbNodes-i-1 ] = (*columns[ i ])[z+iBase2]; // top or bottom
// side
}
} // switch ( nbNodes )
+
+ return true;
}
//================================================================================
n2nMapPtr = & TProjction2dAlgo::instance( this )->GetNodesMap();
}
- if ( !n2nMapPtr || n2nMapPtr->size() < botSMDS->NbNodes() )
+ if ( !n2nMapPtr || (int) n2nMapPtr->size() < botSMDS->NbNodes() )
{
// associate top and bottom faces
NSProjUtils::TShapeShapeMap shape2ShapeMap;
int _nbCheckedEdges; // nb of EDGEs whose location is defined
PrismSide *_leftSide;
PrismSide *_rightSide;
+ void SetExcluded() { _leftSide = _rightSide = NULL; }
+ bool IsExcluded() const { return !_leftSide; }
const TopoDS_Edge& Edge( int i ) const
{
return (*_edges)[ i ]._edge;
/*!
* \brief Return another faces sharing an edge
*/
- const TopoDS_Shape & getAnotherFace( const TopoDS_Face& face,
- const TopoDS_Edge& edge,
- TopTools_IndexedDataMapOfShapeListOfShape& facesOfEdge)
+ const TopoDS_Face & getAnotherFace( const TopoDS_Face& face,
+ const TopoDS_Edge& edge,
+ TopTools_IndexedDataMapOfShapeListOfShape& facesOfEdge)
{
TopTools_ListIteratorOfListOfShape faceIt( facesOfEdge.FindFromKey( edge ));
for ( ; faceIt.More(); faceIt.Next() )
if ( !face.IsSame( faceIt.Value() ))
- return faceIt.Value();
+ return TopoDS::Face( faceIt.Value() );
return face;
}
+
+ //--------------------------------------------------------------------------------
+ /*!
+ * \brief Return number of faces sharing given edges
+ */
+ int nbAdjacentFaces( const std::vector< EdgeWithNeighbors >& edges,
+ const TopTools_IndexedDataMapOfShapeListOfShape& facesOfEdge )
+ {
+ TopTools_MapOfShape adjFaces;
+
+ for ( size_t i = 0; i < edges.size(); ++i )
+ {
+ TopTools_ListIteratorOfListOfShape faceIt( facesOfEdge.FindFromKey( edges[i]._edge ));
+ for ( ; faceIt.More(); faceIt.Next() )
+ adjFaces.Add( faceIt.Value() );
+ }
+ return adjFaces.Extent();
+ }
}
//================================================================================
typedef vector< EdgeWithNeighbors > TEdgeWithNeighborsVec;
vector< TEdgeWithNeighborsVec > faceEdgesVec( allFaces.Extent() + 1 );
- TopTools_IndexedMapOfShape* facesOfSide = new TopTools_IndexedMapOfShape[ faceEdgesVec.size() ];
+ const size_t nbEdgesMax = facesOfEdge.Extent() * 2; // there can be seam EDGES
+ TopTools_IndexedMapOfShape* facesOfSide = new TopTools_IndexedMapOfShape[ nbEdgesMax ];
SMESHUtils::ArrayDeleter<TopTools_IndexedMapOfShape> delFacesOfSide( facesOfSide );
// try to use each face as a bottom one
bool prismDetected = false;
+ vector< PrismSide > sides;
for ( int iF = 1; iF < allFaces.Extent() && !prismDetected; ++iF )
{
const TopoDS_Face& botF = TopoDS::Face( allFaces( iF ));
continue; // all faces are adjacent to botF - no top FACE
// init data of side FACEs
- vector< PrismSide > sides( botEdges.size() );
- for ( int iS = 0; iS < botEdges.size(); ++iS )
+ sides.clear();
+ sides.resize( botEdges.size() );
+ for ( size_t iS = 0; iS < botEdges.size(); ++iS )
{
- sides[ iS ]._topEdge = botEdges[ iS ]._edge;
- sides[ iS ]._face = botF;
+ sides[ iS ]._topEdge = botEdges[ iS ]._edge;
+ sides[ iS ]._face = botF;
sides[ iS ]._leftSide = & sides[ botEdges[ iS ]._iR ];
sides[ iS ]._rightSide = & sides[ botEdges[ iS ]._iL ];
sides[ iS ]._faces = & facesOfSide[ iS ];
if ( side._isCheckedEdge[ iE ] ) continue;
const TopoDS_Edge& vertE = side.Edge( iE );
const TopoDS_Shape& neighborF = getAnotherFace( side._face, vertE, facesOfEdge );
- bool isEdgeShared = adjSide->IsSideFace( neighborF );
- if ( isEdgeShared )
+ bool isEdgeShared = adjSide->IsSideFace( neighborF );
+ if ( isEdgeShared ) // vertE is shared with adjSide
{
isAdvanced = true;
side._isCheckedEdge[ iE ] = true;
const TopoDS_Shape& topFace = sides[0]._faces->FindKey( nbFaces );
size_t iS;
for ( iS = 1; iS < sides.size(); ++iS )
- if ( !sides[ iS ]._faces->Contains( topFace ))
+ if ( ! sides[ iS ]._faces->Contains( topFace ))
break;
prismDetected = ( iS == sides.size() );
}
if ( nbUnitePerEdge[ iE ] < 0 )
continue;
// look for already united faces
- for ( int i = iE; i < iE + nbExraFaces; ++i )
+ for ( size_t i = iE; i < iE + nbExraFaces; ++i )
{
if ( nbUnitePerEdge[ i ] > 0 ) // a side including nbUnitePerEdge[i]+1 edge
nbExraFaces += nbUnitePerEdge[ i ];
else if ( nbExraFaces > 1 ) // unite
{
double u0 = 0, sumLen = 0;
- for ( int i = iE; i < iE + nbExraFaces; ++i )
+ for ( size_t i = iE; i < iE + nbExraFaces; ++i )
sumLen += edgeLength[ i ];
vector< TSideFace* > components( nbExraFaces );
}
}
-// #define SHOWYXZ(msg, xyz) { \
-// gp_Pnt p (xyz); \
-// cout << msg << " ("<< p.X() << "; " <<p.Y() << "; " <<p.Z() << ") " <<endl; \
-// }
+// #define SHOWYXZ(msg, xyz) { gp_Pnt p(xyz); cout << msg << " ("<< p.X() << "; " <<p.Y() << "; " <<p.Z() << ") " <<endl; }
+
// double _u[]={ 0.1, 0.1, 0.9, 0.9 };
// double _v[]={ 0.1, 0.9, 0.1, 0.9 };
// for ( int z = 0; z < 2; ++z )
double tol2;
{
Bnd_B3d bndBox;
- for ( int i = 0; i < columns.size(); ++i )
+ for ( size_t i = 0; i < columns.size(); ++i )
bndBox.Add( gpXYZ( columns[i]->front() ));
tol2 = bndBox.SquareExtent() * 1e-5;
}
//t.SetScaleFactor( distZ/dist0 ); - it does not work properly, wrong base point
// check a transformation
- for ( int i = 0; i < columns.size(); ++i )
+ for ( size_t i = 0; i < columns.size(); ++i )
{
gp_Pnt p0 = gpXYZ( (*columns[i])[0] );
gp_Pnt pz = gpXYZ( (*columns[i])[z] );
myComponents ( other.myComponents.size() ),
myHelper ( *other.myHelper.GetMesh() )
{
- for (int i = 0 ; i < myComponents.size(); ++i )
+ for ( size_t i = 0 ; i < myComponents.size(); ++i )
myComponents[ i ] = new TSideFace( *other.myComponents[ i ]);
}
StdMeshers_PrismAsBlock::TSideFace::~TSideFace()
{
- for (int i = 0 ; i < myComponents.size(); ++i )
+ for ( size_t i = 0 ; i < myComponents.size(); ++i )
if ( myComponents[ i ] )
delete myComponents[ i ];
}
if ( myComponents.empty() )
return const_cast<TSideFace*>( this );
- int i;
+ size_t i;
for ( i = 0; i < myComponents.size(); ++i )
if ( U < myParams[ i ].second )
break;
void StdMeshers_PrismAsBlock::TVerticalEdgeAdaptor::dumpNodes(int nbNodes) const
{
#ifdef _DEBUG_
- for ( int i = 0; i < nbNodes && i < myNodeColumn->size(); ++i )
+ for ( int i = 0; i < nbNodes && i < (int)myNodeColumn->size(); ++i )
cout << (*myNodeColumn)[i]->GetID() << " ";
- if ( nbNodes < myNodeColumn->size() )
+ if ( nbNodes < (int) myNodeColumn->size() )
cout << myNodeColumn->back()->GetID();
#endif
}
TParam2ColumnMap* myParamToColumnMap;
PSurface mySurface;
TopoDS_Edge myBaseEdge;
- map< int, PSurface > myShapeID2Surf;
+ std::map< int, PSurface > myShapeID2Surf;
// first and last normalized params and orientaion for each component or it-self
std::vector< std::pair< double, double> > myParams; // select my columns in myParamToColumnMap
bool myIsForward;
* \param nodeColumns - columns of nodes generated from nodes of a mesh face
* \param helper - helper initialized by mesh and shape to add prisms to
*/
- static void AddPrisms( std::vector<const TNodeColumn*> & nodeColumns,
+ static bool AddPrisms( std::vector<const TNodeColumn*> & nodeColumns,
SMESH_MesherHelper* helper);
static bool IsApplicable(const TopoDS_Shape & aShape, bool toCheckAll);
#define RETURN_BAD_RESULT(msg) { MESSAGE(")-: Error: " << msg); return false; }
#define CONT_BAD_RESULT(msg) { MESSAGE(")-: Error: " << msg); continue; }
#define SHOW_SHAPE(v,msg) \
-// { \
-// if ( (v).IsNull() ) cout << msg << " NULL SHAPE" << endl; \
-// else if ((v).ShapeType() == TopAbs_VERTEX) {\
-// gp_Pnt p = BRep_Tool::Pnt( TopoDS::Vertex( (v) ));\
-// cout<<msg<<" "<<shapeIndex((v))<<" ( "<<p.X()<<", "<<p.Y()<<", "<<p.Z()<<" )"<<endl;} \
-// else {\
-// cout << msg << " "; TopAbs::Print((v).ShapeType(),cout) <<" "<<shapeIndex((v))<<endl;}\
-// }
+ // { show_shape((v),(msg)); }
#define SHOW_LIST(msg,l) \
-// { \
-// cout << msg << " ";\
-// list< TopoDS_Edge >::const_iterator e = l.begin();\
-// for ( int i = 0; e != l.end(); ++e, ++i ) {\
-// cout << i << "V (" << TopExp::FirstVertex( *e, true ).TShape().operator->() << ") "\
-// << i << "E (" << e->TShape().operator->() << "); "; }\
-// cout << endl;\
-// }
+ // { show_list((msg),(l)); }
namespace HERE = StdMeshers_ProjectionUtils;
return max(theMeshDS[0]->ShapeToIndex(S), theMeshDS[1]->ShapeToIndex(S) );
return long(S.TShape().operator->());
}
-
+ void show_shape( TopoDS_Shape v, const char* msg ) // debug
+ {
+ if ( v.IsNull() ) cout << msg << " NULL SHAPE" << endl;
+ else if (v.ShapeType() == TopAbs_VERTEX) {
+ gp_Pnt p = BRep_Tool::Pnt( TopoDS::Vertex( v ));
+ cout<<msg<<" "<<shapeIndex((v))<<" ( "<<p.X()<<", "<<p.Y()<<", "<<p.Z()<<" )"<<endl;}
+ else {
+ cout << msg << " "; TopAbs::Print((v).ShapeType(),cout) <<" "<<shapeIndex((v))<<endl;}
+ }
+ void show_list( const char* msg, const list< TopoDS_Edge >& l ) // debug
+ {
+ cout << msg << " ";
+ list< TopoDS_Edge >::const_iterator e = l.begin();
+ for ( int i = 0; e != l.end(); ++e, ++i ) {
+ cout << i << "V (" << TopExp::FirstVertex( *e, true ).TShape().operator->() << ") "
+ << i << "E (" << e->TShape().operator->() << "); "; }
+ cout << endl;
+ }
//================================================================================
/*!
* \brief Write shape for debug purposes
static_cast<const SMDS_EdgePosition*>(node->GetPosition());
pos2nodes.insert( make_pair( pos->GetUParameter(), node ));
}
- if ( pos2nodes.size() != edgeSM->NbNodes() )
+ if ((int) pos2nodes.size() != edgeSM->NbNodes() )
RETURN_BAD_RESULT("Equal params of nodes on edge "
<< smDS->ShapeToIndex( edge ) << " of face " << is2 );
}
TAssocTool::TNodeNodeMap& src2tgtNodes,
bool& is1DComputed)
{
- SMESHDS_Mesh* tgtMeshDS = tgtMesh->GetMeshDS();
- SMESHDS_Mesh* srcMeshDS = srcMesh->GetMeshDS();
-
src2tgtNodes.clear();
// get ordered src EDGEs
TError err;
srcWires = StdMeshers_FaceSide::GetFaceWires( srcFace, *srcMesh,/*skipMediumNodes=*/0, err);
- if ( err && !err->IsOK() || srcWires.empty() )
+ if (( err && !err->IsOK() ) ||
+ ( srcWires.empty() ))
return err;
SMESH_MesherHelper srcHelper( *srcMesh );
const double minSegLen = srcWires[iW]->Length() / totNbSeg;
for ( int iE = 0; iE < srcWires[iW]->NbEdges(); ++iE )
{
- int nbSeg = Max( 1, int( srcWires[iW]->EdgeLength( iE ) / minSegLen ));
+ size_t nbSeg = Max( 1, int( srcWires[iW]->EdgeLength( iE ) / minSegLen ));
double srcU = srcWires[iW]->FirstParameter( iE );
double tgtU = tgtWires[iW]->FirstParameter( iE );
double srcDu = ( srcWires[iW]->LastParameter( iE )- srcU ) / nbSeg;
const double minSegLen = srcWires[iW]->Length() / totNbSeg;
for ( int iE = 0; iE < srcWires[iW]->NbEdges(); ++iE )
{
- int nbSeg = Max( 1, int( srcWires[iW]->EdgeLength( iE ) / minSegLen ));
+ size_t nbSeg = Max( 1, int( srcWires[iW]->EdgeLength( iE ) / minSegLen ));
double srcU = srcWires[iW]->FirstParameter( iE );
double tgtU = tgtWires[iW]->FirstParameter( iE );
double srcDu = ( srcWires[iW]->LastParameter( iE )- srcU ) / nbSeg;
tgtMeshDS->SetNodeOnVertex( n, TopoDS::Vertex( tgtV ));
break;
}
+ default:;
}
srcN_tgtN->second = n;
}
{
SMESH_Mesh * tgtMesh = tgtWires[0]->GetMesh();
SMESH_Mesh * srcMesh = srcWires[0]->GetMesh();
- SMESHDS_Mesh * tgtMeshDS = tgtMesh->GetMeshDS();
+ //SMESHDS_Mesh * tgtMeshDS = tgtMesh->GetMeshDS();
SMESHDS_Mesh * srcMeshDS = srcMesh->GetMeshDS();
if ( srcWires[0]->NbEdges() != 4 )
#define RETURN_BAD_RESULT(msg) { MESSAGE(")-: Error: " << msg); return false; }
#define gpXYZ(n) gp_XYZ(n->X(),n->Y(),n->Z())
-#define SHOWYXZ(msg, xyz) // {\
-// gp_Pnt p (xyz); \
-// cout << msg << " ("<< p.X() << "; " <<p.Y() << "; " <<p.Z() << ") " <<endl;\
-// }
+#define SHOWYXZ(msg, xyz) \
+ //{gp_Pnt p(xyz); cout<<msg<< " ("<< p.X() << "; " <<p.Y() << "; " <<p.Z() << ") " <<endl; }
namespace TAssocTool = StdMeshers_ProjectionUtils;
+using namespace std;
//=======================================================================
//function : StdMeshers_Projection_3D
shape2ShapeMap.Clear();
vector< int > edgeIdVec;
SMESH_Block::GetFaceEdgesIDs( fId, edgeIdVec );
- for ( int i = 0; i < edgeIdVec.size(); ++i ) {
+ for ( size_t i = 0; i < edgeIdVec.size(); ++i ) {
int eID = edgeIdVec[ i ];
shape2ShapeMap.Bind( scrShapes( eID ), tgtShapes( eID ));
if ( i < 2 ) {
// Get ordered edges and find index of anE in a sequence
edges.clear();
BRepTools_WireExplorer aWE (TopoDS::Wire(itA.Value()));
- int edgeIndex = 0;
+ size_t edgeIndex = 0;
for (; aWE.More(); aWE.Next()) {
TopoDS_Edge edge = aWE.Current();
edge.Orientation( aWE.Orientation() );
else {
// count nb sides
TopoDS_Edge prevEdge = anE;
- int nbSide = 0, eIndex = edgeIndex + 1;
- for ( int i = 0; i < edges.size(); ++i, ++eIndex )
+ size_t nbSide = 0, eIndex = edgeIndex + 1;
+ for ( size_t i = 0; i < edges.size(); ++i, ++eIndex )
{
if ( eIndex == edges.size() )
eIndex = 0;
}
return;
}
+ case MEANINGLESS_LAST: {
+ break;
+ }
} // switch by SubMeshState
- }
+
+ } // ProcessEvent()
} // namespace
#include <list>
#include <vector>
+using namespace std;
+
//================================================================================
/*!
* \brief 1D algo
allEdges, theShortEdges[ nbBranchPoints > 0 ] ))
return false;
- for ( size_t iS = 0; iS < theShortEdges[ nbBranchPoints ].size(); ++iS )
+ for ( size_t iS = 0; iS < theShortEdges[ nbBranchPoints > 0 ].size(); ++iS )
shortMap.Add( theShortEdges[ nbBranchPoints ][ iS ]);
++nbBranchPoints;
{
const SMDS_MeshNode* _node;
double _u;
- int _edgeInd; // index in theSinuEdges vector
+ size_t _edgeInd; // index in theSinuEdges vector
NodePoint(): _node(0), _u(0), _edgeInd(-1) {}
NodePoint(const SMDS_MeshNode* n, double u, size_t iEdge ): _node(n), _u(u), _edgeInd(iEdge) {}
const vector<TopoDS_Edge>& theSinuEdges = theSinuFace._sinuEdges;
const vector< Handle(Geom_Curve) >& curves = theSinuFace._sinuCurves;
- SMESH_MAT2d::BoundaryPoint bp[2];
- const SMESH_MAT2d::Branch& branch = *theMA.getBranch(0);
+ //SMESH_MAT2d::BoundaryPoint bp[2];
+ //const SMESH_MAT2d::Branch& branch = *theMA.getBranch(0);
typedef TMAPar2NPoints::iterator TIterator;
{
// find an existing node on VERTEX among sameU2NP and get underlying EDGEs
const SMDS_MeshNode* existingNode = 0;
- set< int > edgeInds;
+ set< size_t > edgeInds;
NodePoint* np;
for ( size_t i = 0; i < sameU2NP.size(); ++i )
{
if ( u2NPprev->first < 0. ) ++u2NPprev;
if ( u2NPnext->first > 1. ) --u2NPnext;
- set< int >::iterator edgeID = edgeInds.begin();
+ set< size_t >::iterator edgeID = edgeInds.begin();
for ( ; edgeID != edgeInds.end(); ++edgeID )
{
// get U range on iEdge within which the equal points will be distributed
const double dksi = 0.5, deta = 0.5;
const double dksi2 = dksi*dksi, deta2 = deta*deta;
double err = 0., g11, g22, g12;
- int nbErr = 0;
+ //int nbErr = 0;
FaceQuadStruct& q = *quad;
UVPtStruct pNew;
- double refArea = area( q.UVPt(0,0), q.UVPt(1,0), q.UVPt(1,1) );
+ //double refArea = area( q.UVPt(0,0), q.UVPt(1,0), q.UVPt(1,1) );
for ( int iLoop = 0; iLoop < nbLoops; ++iLoop )
{
#include "StdMeshers_QuadToTriaAdaptor.hxx"
+#include "SMDS_IteratorOnIterators.hxx"
#include "SMDS_SetIterator.hxx"
#include "SMESHDS_GroupBase.hxx"
#include "SMESH_Algo.hxx"
#include <IntAna_IntConicQuad.hxx>
#include <IntAna_Quadric.hxx>
-#include <TColgp_HArray1OfPnt.hxx>
-#include <TColgp_HArray1OfVec.hxx>
-#include <TColgp_HSequenceOfPnt.hxx>
+#include <TColgp_Array1OfPnt.hxx>
+#include <TColgp_Array1OfVec.hxx>
+#include <TColgp_SequenceOfPnt.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
#include <gp_Lin.hxx>
gp_Vec nJ = baseVec.Crossed( baJ );
// Check angle between normals
- double angle = nI.Angle( nJ );
+ double angle = nI.Angle( nJ );
bool tooClose = ( angle < 15. * M_PI / 180. );
// Check if pyramids collide
if ( !tooClose && ( baI * baJ > 0 ) && ( nI * nJ > 0 ))
{
// find out if nI points outside of PrmI or inside
- int dInd = baseNodesIndI[1] - baseNodesIndI[0];
+ int dInd = baseNodesIndI[1] - baseNodesIndI[0];
bool isOutI = ( abs(dInd)==1 ) ? dInd < 0 : dInd > 0;
- // find out sign of projection of nJ to baI
+ // find out sign of projection of baI to nJ
double proj = baI * nJ;
- tooClose = isOutI ? proj > 0 : proj < 0;
+ tooClose = ( isOutI ? proj > 0 : proj < 0 );
}
// Check if PrmI and PrmJ are in same domain
continue; // f is a base quadrangle
// check projections of face direction (baOFN) to triange normals (nI and nJ)
- gp_Vec baOFN( base1, SMESH_TNodeXYZ( otherFaceNode ));
- if ( nI * baOFN > 0 && nJ * baOFN > 0 )
+ gp_Vec baOFN( base2, SMESH_TNodeXYZ( otherFaceNode ));
+ if ( nI * baOFN > 0 && nJ * baOFN > 0 &&
+ baI* baOFN > 0 && baJ* baOFN > 0 ) // issue 0023212
{
tooClose = false; // f is between pyramids
break;
}
}
}
-
}
//================================================================================
const SMDS_MeshElement* PrmJ,
set<const SMDS_MeshNode*> & nodesToMove)
{
+ // cout << endl << "Merge " << PrmI->GetID() << " " << PrmJ->GetID() << " "
+ // << PrmI->GetNode(4) << PrmJ->GetNode(4) << endl;
const SMDS_MeshNode* Nrem = PrmJ->GetNode(4); // node to remove
//int nbJ = Nrem->NbInverseElements( SMDSAbs_Volume );
SMESH_TNodeXYZ Pj( Nrem );
vector< const SMDS_MeshElement* > inverseElems
// copy inverse elements to avoid iteration on changing container
( TStdElemIterator( CommonNode->GetInverseElementIterator(SMDSAbs_Face)), itEnd);
- for ( unsigned i = 0; i < inverseElems.size(); ++i )
+ for ( size_t i = 0; i < inverseElems.size(); ++i )
{
const SMDS_MeshElement* FI = inverseElems[i];
const SMDS_MeshElement* FJEqual = 0;
}
// set the common apex node to pyramids and triangles merged with J
+ vector< const SMDS_MeshNode* > nodes;
inverseElems.assign( TStdElemIterator( Nrem->GetInverseElementIterator()), itEnd );
- for ( unsigned i = 0; i < inverseElems.size(); ++i )
+ for ( size_t i = 0; i < inverseElems.size(); ++i )
{
const SMDS_MeshElement* elem = inverseElems[i];
- vector< const SMDS_MeshNode* > nodes( elem->begin_nodes(), elem->end_nodes() );
+ nodes.assign( elem->begin_nodes(), elem->end_nodes() );
nodes[ elem->GetType() == SMDSAbs_Volume ? PYRAM_APEX : TRIA_APEX ] = CommonNode;
GetMeshDS()->ChangeElementNodes( elem, &nodes[0], nodes.size());
}
//================================================================================
void StdMeshers_QuadToTriaAdaptor::MergeAdjacent(const SMDS_MeshElement* PrmI,
- set<const SMDS_MeshNode*>& nodesToMove)
+ set<const SMDS_MeshNode*>& nodesToMove,
+ const bool isRecursion)
{
TIDSortedElemSet adjacentPyrams;
bool mergedPyrams = false;
- for(int k=0; k<4; k++) // loop on 4 base nodes of PrmI
+ for ( int k=0; k<4; k++ ) // loop on 4 base nodes of PrmI
{
- const SMDS_MeshNode* n = PrmI->GetNode(k);
+ const SMDS_MeshNode* n = PrmI->GetNode(k);
SMDS_ElemIteratorPtr vIt = n->GetInverseElementIterator( SMDSAbs_Volume );
while ( vIt->more() )
{
const SMDS_MeshElement* PrmJ = vIt->next();
- if ( PrmJ->NbCornerNodes() != 5 || !adjacentPyrams.insert( PrmJ ).second )
+ if ( PrmJ == PrmI || PrmJ->NbCornerNodes() != 5 || !adjacentPyrams.insert( PrmJ ).second )
continue;
- if ( PrmI != PrmJ && TooCloseAdjacent( PrmI, PrmJ, GetMesh()->HasShapeToMesh() ))
+ if ( TooCloseAdjacent( PrmI, PrmJ, GetMesh()->HasShapeToMesh() ))
{
MergePiramids( PrmI, PrmJ, nodesToMove );
mergedPyrams = true;
// container of inverse elements can change
- vIt = n->GetInverseElementIterator( SMDSAbs_Volume );
+ // vIt = n->GetInverseElementIterator( SMDSAbs_Volume ); -- iterator re-implemented
}
}
}
- if ( mergedPyrams )
+ if ( mergedPyrams && !isRecursion )
{
TIDSortedElemSet::iterator prm;
for (prm = adjacentPyrams.begin(); prm != adjacentPyrams.end(); ++prm)
- MergeAdjacent( *prm, nodesToMove );
+ MergeAdjacent( *prm, nodesToMove, true );
}
}
//=======================================================================
//function : HasIntersection3
-//purpose : Auxilare for HasIntersection()
-// find intersection point between triangle (P1,P2,P3)
-// and segment [PC,P]
+//purpose : Find intersection point between a triangle (P1,P2,P3)
+// and a 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);
- const double preci = 1.e-10 * P.Distance(PC);
- // 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;
- }
- const double angularTol = 1e-6;
- gp_Vec VC1 = V1.Crossed(V2);
- gp_Vec VC2 = V2.Crossed(V3);
- gp_Vec VC3 = V3.Crossed(V1);
- if(VC1.Magnitude()<gp::Resolution()) {
- if(VC2.IsOpposite(VC3,angularTol)) {
- return false;
- }
- }
- else if(VC2.Magnitude()<gp::Resolution()) {
- if(VC1.IsOpposite(VC3,angularTol)) {
- return false;
- }
- }
- else if(VC3.Magnitude()<gp::Resolution()) {
- if(VC1.IsOpposite(VC2,angularTol)) {
- return false;
- }
- }
- else {
- if( VC1.IsOpposite(VC2,angularTol) || VC1.IsOpposite(VC3,angularTol) ||
- VC2.IsOpposite(VC3,angularTol) ) {
- return false;
- }
- }
- Pint = PIn;
- return true;
- }
- }
+ const double EPSILON = 1e-6;
+ double segLen = P.Distance( PC );
- return false;
+ gp_XYZ orig = PC.XYZ();
+ gp_XYZ dir = ( P.XYZ() - PC.XYZ() ) / segLen;
+ gp_XYZ vert0 = P1.XYZ();
+ gp_XYZ vert1 = P2.XYZ();
+ gp_XYZ vert2 = P3.XYZ();
+
+ /* calculate distance from vert0 to ray origin */
+ gp_XYZ tvec = orig - vert0;
+
+ gp_XYZ edge1 = vert1 - vert0;
+ gp_XYZ edge2 = vert2 - vert0;
+
+ /* begin calculating determinant - also used to calculate U parameter */
+ gp_XYZ pvec = dir ^ edge2;
+
+ /* if determinant is near zero, ray lies in plane of triangle */
+ double det = edge1 * pvec;
+
+ if (det > -EPSILON && det < EPSILON)
+ return false;
+
+ /* calculate U parameter and test bounds */
+ double u = ( tvec * pvec ) / det;
+ //if (u < 0.0 || u > 1.0)
+ if (u < -EPSILON || u > 1.0 + EPSILON)
+ return false;
+
+ /* prepare to test V parameter */
+ gp_XYZ qvec = tvec ^ edge1;
+
+ /* calculate V parameter and test bounds */
+ double v = (dir * qvec) / det;
+ //if ( v < 0.0 || u + v > 1.0 )
+ if ( v < -EPSILON || u + v > 1.0 + EPSILON)
+ return false;
+
+ /* calculate t, ray intersects triangle */
+ double t = (edge2 * qvec) / det;
+
+ Pint = orig + dir * t;
+
+ return ( t > 0. && t < segLen );
}
//=======================================================================
//=======================================================================
static bool HasIntersection(const gp_Pnt& P, const gp_Pnt& PC, gp_Pnt& Pint,
- Handle(TColgp_HSequenceOfPnt)& aContour)
+ TColgp_SequenceOfPnt& aContour)
{
- if(aContour->Length()==3) {
- return HasIntersection3( P, PC, Pint, aContour->Value(1),
- aContour->Value(2), aContour->Value(3) );
+ if ( aContour.Length() == 3 ) {
+ return HasIntersection3( P, PC, Pint, aContour(1), aContour(2), aContour(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( (aContour(1).Distance(aContour(2)) > 1.e-6) &&
+ (aContour(1).Distance(aContour(3)) > 1.e-6) &&
+ (aContour(2).Distance(aContour(3)) > 1.e-6) ) {
+ check = HasIntersection3( P, PC, Pint, aContour(1), aContour(2), aContour(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( (aContour(1).Distance(aContour(4)) > 1.e-6) &&
+ (aContour(1).Distance(aContour(3)) > 1.e-6) &&
+ (aContour(4).Distance(aContour(3)) > 1.e-6) ) {
+ check = HasIntersection3( P, PC, Pint, aContour(1), aContour(3), aContour(4) );
}
if(check) return true;
}
//================================================================================
/*!
- * \brief Checks if a line segment (P,PC) intersects any mesh face.
- * \param P - first segment end
- * \param PC - second segment end (it is a gravity center of quadrangle)
- * \param Pint - (out) intersection point
+ * \brief Return allowed height of a pyramid
+ * \param Papex - optimal pyramid apex
+ * \param PC - gravity center of a quadrangle
+ * \param PN - four nodes of the quadrangle
* \param aMesh - mesh
- * \param aShape - shape to check faces on
- * \param NotCheckedFace - mesh face not to check
- * \retval bool - true if there is an intersection
+ * \param NotCheckedFace - the quadrangle face
+ * \retval double - pyramid height
*/
//================================================================================
-bool StdMeshers_QuadToTriaAdaptor::CheckIntersection (const gp_Pnt& P,
- const gp_Pnt& PC,
- gp_Pnt& Pint,
- SMESH_Mesh& aMesh,
- const TopoDS_Shape& aShape,
- const SMDS_MeshElement* NotCheckedFace)
+void StdMeshers_QuadToTriaAdaptor::LimitHeight (gp_Pnt& Papex,
+ const gp_Pnt& PC,
+ const TColgp_Array1OfPnt& PN,
+ const vector<const SMDS_MeshNode*>& FNodes,
+ SMESH_Mesh& aMesh,
+ const SMDS_MeshElement* NotCheckedFace,
+ const bool UseApexRay)
{
if ( !myElemSearcher )
myElemSearcher = SMESH_MeshAlgos::GetElementSearcher( *aMesh.GetMeshDS() );
SMESH_ElementSearcher* searcher = const_cast<SMESH_ElementSearcher*>(myElemSearcher);
- //SMESHDS_Mesh * meshDS = aMesh.GetMeshDS();
- //cout<<" CheckIntersection: meshDS->NbFaces() = "<<meshDS->NbFaces()<<endl;
- bool res = false;
- double dist = RealLast(); // find intersection closest to the segment
- gp_Pnt Pres;
+ // Find intersection of faces with (P,PC) segment elongated 3 times
- gp_Ax1 line( P, gp_Vec(P,PC));
- vector< const SMDS_MeshElement* > suspectElems;
- searcher->GetElementsNearLine( line, SMDSAbs_Face, suspectElems);
+ double height = Papex.Distance( PC );
+ gp_Ax1 line( PC, gp_Vec( PC, Papex ));
+ gp_Pnt Pint, Ptest;
+ vector< const SMDS_MeshElement* > suspectFaces;
+ TColgp_SequenceOfPnt aContour;
- for ( int i = 0; i < suspectElems.size(); ++i )
+ if ( UseApexRay )
{
- const SMDS_MeshElement* face = suspectElems[i];
+ // find intersection closest to PC
+ Ptest = PC.XYZ() + line.Direction().XYZ() * height * 3;
+
+ searcher->GetElementsNearLine( line, SMDSAbs_Face, suspectFaces );
+ for ( size_t iF = 0; iF < suspectFaces.size(); ++iF )
+ {
+ const SMDS_MeshElement* face = suspectFaces[iF];
+ if ( face == NotCheckedFace ) continue;
+
+ aContour.Clear();
+ for ( int i = 0, nb = face->NbCornerNodes(); i < nb; ++i )
+ aContour.Append( SMESH_TNodeXYZ( face->GetNode(i) ));
+
+ if ( HasIntersection( Ptest, PC, Pint, aContour ))
+ {
+ double dInt = PC.Distance( Pint );
+ height = Min( height, dInt / 3. );
+ }
+ }
+ }
+
+ // Find faces intersecting triangular facets of the pyramid (issue 23212)
+
+ gp_XYZ center = PC.XYZ() + line.Direction().XYZ() * height * 0.5;
+ double diameter = Max( PN(1).Distance(PN(3)), PN(2).Distance(PN(4)));
+ suspectFaces.clear();
+ searcher->GetElementsInSphere( center, diameter * 0.6, SMDSAbs_Face, suspectFaces);
+
+ const double upShift = 1.5;
+ Ptest = PC.XYZ() + line.Direction().XYZ() * height * upShift; // tmp apex
+
+ for ( size_t iF = 0; iF < suspectFaces.size(); ++iF )
+ {
+ const SMDS_MeshElement* face = suspectFaces[iF];
if ( face == NotCheckedFace ) continue;
- Handle(TColgp_HSequenceOfPnt) aContour = new TColgp_HSequenceOfPnt;
- for ( int i = 0; i < face->NbCornerNodes(); ++i )
- aContour->Append( SMESH_TNodeXYZ( face->GetNode(i) ));
- if( HasIntersection(P, PC, Pres, aContour) ) {
- res = true;
- double tmp = PC.Distance(Pres);
- if(tmp<dist) {
- Pint = Pres;
- dist = tmp;
+ if ( face->GetNodeIndex( FNodes[0] ) >= 0 ||
+ face->GetNodeIndex( FNodes[1] ) >= 0 ||
+ face->GetNodeIndex( FNodes[2] ) >= 0 ||
+ face->GetNodeIndex( FNodes[3] ) >= 0 )
+ continue; // neighbor face of the quadrangle
+
+ // limit height using points of intersection of face links with pyramid facets
+ int nbN = face->NbCornerNodes();
+ gp_Pnt P1 = SMESH_TNodeXYZ( face->GetNode( nbN-1 )); // 1st link end
+ for ( int i = 0; i < nbN; ++i )
+ {
+ gp_Pnt P2 = SMESH_TNodeXYZ( face->GetNode(i) ); // 2nd link end
+
+ for ( int iN = 1; iN <= 4; ++iN ) // loop on pyramid facets
+ {
+ if ( HasIntersection3( P1, P2, Pint, PN(iN), PN(iN+1), Ptest ))
+ {
+ height = Min( height, gp_Vec( PC, Pint ) * line.Direction() );
+ //Ptest = PC.XYZ() + line.Direction().XYZ() * height * upShift; // new tmp apex
+ }
}
+ P1 = P2;
}
}
- return res;
+
+ Papex = PC.XYZ() + line.Direction().XYZ() * height;
}
//================================================================================
//================================================================================
int StdMeshers_QuadToTriaAdaptor::Preparation(const SMDS_MeshElement* face,
- Handle(TColgp_HArray1OfPnt)& PN,
- Handle(TColgp_HArray1OfVec)& VN,
+ TColgp_Array1OfPnt& PN,
+ TColgp_Array1OfVec& VN,
vector<const SMDS_MeshNode*>& FNodes,
gp_Pnt& PC,
gp_Vec& VNorm,
for ( i = 0; i < 4; ++i )
{
gp_XYZ p = SMESH_TNodeXYZ( FNodes[i] = face->GetNode(i) );
- PN->SetValue( i+1, p );
+ PN.SetValue( i+1, p );
xyzC += p;
}
PC = xyzC/4;
for(i=1; i<4; i++) {
j = i+1;
for(; j<=4; j++) {
- if( PN->Value(i).Distance(PN->Value(j)) < 1.e-6 )
+ if( PN(i).Distance(PN(j)) < 1.e-6 )
break;
}
if(j<=4) break;
if(i<4) {
//cout<<"find degeneration"<<endl;
hasdeg = true;
- gp_Pnt Pdeg = PN->Value(i);
+ gp_Pnt Pdeg = PN(i);
list< const SMDS_MeshNode* >::iterator itdg = myDegNodes.begin();
const SMDS_MeshNode* DegNode = 0;
FNodes[i-1] = DegNode;
}
for(i=j; i<4; i++) {
- PN->SetValue(i,PN->Value(i+1));
+ PN.SetValue(i,PN.Value(i+1));
FNodes[i-1] = FNodes[i];
}
nbp = 3;
}
- PN->SetValue(nbp+1,PN->Value(1));
+ PN.SetValue(nbp+1,PN(1));
FNodes[nbp] = FNodes[0];
// find normal direction
- gp_Vec V1(PC,PN->Value(nbp));
- gp_Vec V2(PC,PN->Value(1));
+ gp_Vec V1(PC,PN(nbp));
+ gp_Vec V2(PC,PN(1));
VNorm = V1.Crossed(V2);
- VN->SetValue(nbp,VNorm);
+ VN.SetValue(nbp,VNorm);
for(i=1; i<nbp; i++) {
- V1 = gp_Vec(PC,PN->Value(i));
- V2 = gp_Vec(PC,PN->Value(i+1));
+ V1 = gp_Vec(PC,PN(i));
+ V2 = gp_Vec(PC,PN(i+1));
gp_Vec Vtmp = V1.Crossed(V2);
- VN->SetValue(i,Vtmp);
+ VN.SetValue(i,Vtmp);
VNorm += Vtmp;
}
vector<const SMDS_MeshElement*> myPyramids;
+ const SMESHDS_SubMesh * aSubMeshDSFace;
SMESHDS_Mesh * meshDS = aMesh.GetMeshDS();
SMESH_MesherHelper helper(aMesh);
helper.IsQuadraticSubMesh(aShape);
helper.SetElementsOnShape( true );
if ( myElemSearcher ) delete myElemSearcher;
+ vector< SMDS_ElemIteratorPtr > itVec;
if ( aProxyMesh )
- myElemSearcher = SMESH_MeshAlgos::GetElementSearcher( *meshDS, aProxyMesh->GetFaces(aShape));
+ {
+ itVec.push_back( aProxyMesh->GetFaces( aShape ));
+ }
else
- myElemSearcher = SMESH_MeshAlgos::GetElementSearcher( *meshDS );
+ {
+ for ( TopExp_Explorer exp(aShape,TopAbs_FACE); exp.More(); exp.Next() )
+ if (( aSubMeshDSFace = meshDS->MeshElements( exp.Current() )))
+ itVec.push_back( aSubMeshDSFace->GetElements() );
+ }
+ typedef
+ SMDS_IteratorOnIterators< const SMDS_MeshElement*, vector< SMDS_ElemIteratorPtr > > TIter;
+ SMDS_ElemIteratorPtr faceIt( new TIter( itVec ));
+ myElemSearcher = SMESH_MeshAlgos::GetElementSearcher( *meshDS, faceIt );
- const SMESHDS_SubMesh * aSubMeshDSFace;
- Handle(TColgp_HArray1OfPnt) PN = new TColgp_HArray1OfPnt(1,5);
- Handle(TColgp_HArray1OfVec) VN = new TColgp_HArray1OfVec(1,4);
+ TColgp_Array1OfPnt PN(1,5);
+ TColgp_Array1OfVec VN(1,4);
vector<const SMDS_MeshNode*> FNodes(5);
gp_Pnt PC;
gp_Vec VNorm;
- for (TopExp_Explorer exp(aShape,TopAbs_FACE);exp.More();exp.Next())
+ for ( TopExp_Explorer exp(aShape,TopAbs_FACE); exp.More(); exp.Next() )
{
const TopoDS_Shape& aShapeFace = exp.Current();
if ( aProxyMesh )
for(; i<=4; i++) {
gp_Pnt Pbest;
if(!isRev)
- Pbest = FindBestPoint(PN->Value(i), PN->Value(i+1), PC, VN->Value(i).Reversed());
+ Pbest = FindBestPoint(PN(i), PN(i+1), PC, VN(i).Reversed());
else
- Pbest = FindBestPoint(PN->Value(i), PN->Value(i+1), PC, VN->Value(i));
+ Pbest = FindBestPoint(PN(i), PN(i+1), PC, VN(i));
xc += Pbest.X();
yc += Pbest.Y();
zc += Pbest.Z();
// check PCbest
double height = PCbest.Distance(PC);
- if(height<1.e-6) {
+ if ( height < 1.e-6 ) {
// create new PCbest using a bit shift along VNorm
PCbest = PC.XYZ() + VNorm.XYZ() * 0.001;
}
else {
// check possible intersection with other faces
- gp_Pnt Pint;
- bool check = CheckIntersection(PCbest, PC, Pint, aMesh, aShape, face);
- 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 = PC.XYZ() + aDir.XYZ() * dist;
- }
- else {
- gp_Vec VB(PC,PCbest);
- gp_Pnt PCbestTmp = PC.XYZ() + VB.XYZ() * 3.0;
- check = CheckIntersection(PCbestTmp, PC, Pint, aMesh, aShape, face);
- if(check) {
- double dist = PC.Distance(Pint)/3.;
- if(dist<height) {
- gp_Dir aDir(gp_Vec(PC,PCbest));
- PCbest = PC.XYZ() + aDir.XYZ() * dist;
- }
- }
- }
+ LimitHeight( PCbest, PC, PN, FNodes, aMesh, face, /*UseApexRay=*/true );
}
// create node for PCbest
SMDS_MeshNode* NewNode = helper.AddNode( PCbest.X(), PCbest.Y(), PCbest.Z() );
myElemSearcher = SMESH_MeshAlgos::GetElementSearcher( *meshDS );
SMESH_ElementSearcher* searcher = const_cast<SMESH_ElementSearcher*>(myElemSearcher);
+ TColgp_Array1OfPnt PN(1,5);
+ TColgp_Array1OfVec VN(1,4);
+ vector<const SMDS_MeshNode*> FNodes(5);
+ TColgp_SequenceOfPnt aContour;
+
SMDS_FaceIteratorPtr fIt = meshDS->facesIterator(/*idInceasingOrder=*/true);
while( fIt->more())
{
const SMDS_MeshElement* face = fIt->next();
if ( !face ) continue;
// retrieve needed information about a face
- Handle(TColgp_HArray1OfPnt) PN = new TColgp_HArray1OfPnt(1,5);
- Handle(TColgp_HArray1OfVec) VN = new TColgp_HArray1OfVec(1,4);
- vector<const SMDS_MeshNode*> FNodes(5);
gp_Pnt PC;
gp_Vec VNorm;
const SMDS_MeshElement* volumes[2];
SMDS_MeshFace* NewFace;
// check orientation
- double tmp = PN->Value(1).Distance(PN->Value(2)) + PN->Value(2).Distance(PN->Value(3));
+ double tmp = PN(1).Distance(PN(2)) + PN(2).Distance(PN(3));
// far points in VNorm direction
gp_Pnt Ptmp1 = PC.XYZ() + VNorm.XYZ() * tmp * 1.e6;
gp_Pnt Ptmp2 = PC.XYZ() - VNorm.XYZ() * tmp * 1.e6;
gp_Pnt Pres1,Pres2;
gp_Ax1 line( PC, VNorm );
- vector< const SMDS_MeshElement* > suspectElems;
- searcher->GetElementsNearLine( line, SMDSAbs_Face, suspectElems);
+ vector< const SMDS_MeshElement* > suspectFaces;
+ searcher->GetElementsNearLine( line, SMDSAbs_Face, suspectFaces);
- for ( int iF = 0; iF < suspectElems.size(); ++iF ) {
- const SMDS_MeshElement* F = suspectElems[iF];
- if(F==face) continue;
- Handle(TColgp_HSequenceOfPnt) aContour = new TColgp_HSequenceOfPnt;
+ for ( size_t iF = 0; iF < suspectFaces.size(); ++iF ) {
+ const SMDS_MeshElement* F = suspectFaces[iF];
+ if ( F == face ) continue;
+ aContour.Clear();
for ( int i = 0; i < 4; ++i )
- aContour->Append( SMESH_TNodeXYZ( F->GetNode(i) ));
+ aContour.Append( SMESH_TNodeXYZ( F->GetNode(i) ));
gp_Pnt PPP;
- if( !volumes[0] && HasIntersection(Ptmp1, PC, PPP, aContour) ) {
+ if ( !volumes[0] && HasIntersection( Ptmp1, PC, PPP, aContour )) {
IsOK1 = true;
double tmp = PC.Distance(PPP);
- if(tmp<dist1) {
+ if ( tmp < dist1 ) {
Pres1 = PPP;
dist1 = tmp;
}
}
- if( !volumes[1] && HasIntersection(Ptmp2, PC, PPP, aContour) ) {
+ if ( !volumes[1] && HasIntersection( Ptmp2, PC, PPP, aContour )) {
IsOK2 = true;
double tmp = PC.Distance(PPP);
- if(tmp<dist2) {
+ if ( tmp < dist2 ) {
Pres2 = PPP;
dist2 = tmp;
}
continue;
}
+ // -----------------------------------
// Case of non-degenerated quadrangle
+ // -----------------------------------
// Find pyramid peak
gp_XYZ PCbest(0., 0., 0.); // pyramid peak
int i = 1;
- for(; i<=4; i++) {
- gp_Pnt Pbest = FindBestPoint(PN->Value(i), PN->Value(i+1), PC, VN->Value(i));
+ for ( ; i <= 4; i++ ) {
+ gp_Pnt Pbest = FindBestPoint(PN(i), PN(i+1), PC, VN(i));
PCbest += Pbest.XYZ();
}
PCbest /= 4;
// Restrict pyramid height by intersection with other faces
gp_Vec tmpDir(PC,PCbest); tmpDir.Normalize();
- double tmp = PN->Value(1).Distance(PN->Value(3)) + PN->Value(2).Distance(PN->Value(4));
+ double tmp = PN(1).Distance(PN(3)) + PN(2).Distance(PN(4));
// far points: in (PC, PCbest) direction and vice-versa
gp_Pnt farPnt[2] = { PC.XYZ() + tmpDir.XYZ() * tmp * 1.e6,
PC.XYZ() - tmpDir.XYZ() * tmp * 1.e6 };
gp_Pnt intPnt[2];
gp_Ax1 line( PC, tmpDir );
- vector< const SMDS_MeshElement* > suspectElems;
- searcher->GetElementsNearLine( line, SMDSAbs_Face, suspectElems);
+ vector< const SMDS_MeshElement* > suspectFaces;
+ searcher->GetElementsNearLine( line, SMDSAbs_Face, suspectFaces);
- for ( int iF = 0; iF < suspectElems.size(); ++iF )
+ for ( size_t iF = 0; iF < suspectFaces.size(); ++iF )
{
- const SMDS_MeshElement* F = suspectElems[iF];
- if(F==face) continue;
- Handle(TColgp_HSequenceOfPnt) aContour = new TColgp_HSequenceOfPnt;
- int nbN = F->NbNodes() / ( F->IsQuadratic() ? 2 : 1 );
+ const SMDS_MeshElement* F = suspectFaces[iF];
+ if ( F == face ) continue;
+ aContour.Clear();
+ int nbN = F->NbCornerNodes();
for ( i = 0; i < nbN; ++i )
- aContour->Append( SMESH_TNodeXYZ( F->GetNode(i) ));
+ aContour.Append( SMESH_TNodeXYZ( F->GetNode(i) ));
gp_Pnt intP;
for ( int isRev = 0; isRev < 2; ++isRev )
{
{
if( !intersected[isRev] ) continue;
double pyramidH = Min( height, PC.Distance(intPnt[isRev])/3.);
- PCbest = PC.XYZ() + tmpDir.XYZ() * (isRev ? -pyramidH : pyramidH);
+ gp_Pnt Papex = PC.XYZ() + tmpDir.XYZ() * (isRev ? -pyramidH : pyramidH);
+
+ LimitHeight( Papex, PC, PN, FNodes, aMesh, face, /*UseApexRay=*/false );
- // create node for PCbest
- SMDS_MeshNode* NewNode = helper.AddNode( PCbest.X(), PCbest.Y(), PCbest.Z() );
+ // create node for Papex
+ SMDS_MeshNode* NewNode = helper.AddNode( Papex.X(), Papex.Y(), Papex.Z() );
// add triangles to result map
- for(i=0; i<4; i++) {
+ for ( i = 0; i < 4; i++) {
SMDS_MeshFace* NewFace;
if(isRev)
NewFace = meshDS->AddFace( NewNode, FNodes[i], FNodes[i+1] );
bool StdMeshers_QuadToTriaAdaptor::Compute2ndPart(SMESH_Mesh& aMesh,
const vector<const SMDS_MeshElement*>& myPyramids)
{
- if(myPyramids.empty())
+ if ( myPyramids.empty() )
return true;
SMESHDS_Mesh * meshDS = aMesh.GetMeshDS();
- int i, j, k, myShapeID = myPyramids[0]->GetNode(4)->getshapeId();
-
- if ( myElemSearcher ) delete myElemSearcher;
- myElemSearcher = SMESH_MeshAlgos::GetElementSearcher( *meshDS );
- SMESH_ElementSearcher* searcher = const_cast<SMESH_ElementSearcher*>(myElemSearcher);
+ size_t i, j, k;
+ //int myShapeID = myPyramids[0]->GetNode(4)->getshapeId();
+ {
+ SMDS_ElemIteratorPtr
+ pyramIt( new SMDS_ElementVectorIterator( myPyramids.begin(), myPyramids.end() ));
+ if ( myElemSearcher ) delete myElemSearcher;
+ myElemSearcher = SMESH_MeshAlgos::GetElementSearcher( *meshDS, pyramIt );
+ }
+ SMESH_ElementSearcher* searcher = const_cast<SMESH_ElementSearcher*>( myElemSearcher );
set<const SMDS_MeshNode*> nodesToMove;
MergeAdjacent( PrmI, nodesToMove );
}
- // iterate on all pyramids
+ // iterate on all new pyramids
+ vector< const SMDS_MeshElement* > suspectPyrams;
for ( i = 0; i < myPyramids.size(); ++i )
{
- const SMDS_MeshElement* PrmI = myPyramids[i];
+ const SMDS_MeshElement* PrmI = myPyramids[i];
+ const SMDS_MeshNode* apexI = PrmI->GetNode( PYRAM_APEX );
// compare PrmI with all the rest pyramids
// collect adjacent pyramids and nodes coordinates of PrmI
set<const SMDS_MeshElement*> checkedPyrams;
- vector<gp_Pnt> PsI(5);
- for(k=0; k<5; k++) // loop on 4 base nodes of PrmI
+ gp_Pnt PsI[5];
+ for ( k = 0; k < 5; k++ )
{
const SMDS_MeshNode* n = PrmI->GetNode(k);
PsI[k] = SMESH_TNodeXYZ( n );
}
}
+ // get pyramids to check
+ gp_XYZ PC = ( PsI[0].XYZ() + PsI[1].XYZ() + PsI[2].XYZ() + PsI[3].XYZ() ) / 4.;
+ gp_XYZ ray = PsI[4].XYZ() - PC;
+ gp_XYZ center = PC + 0.5 * ray;
+ double diameter = Max( PsI[0].Distance(PsI[2]), PsI[1].Distance(PsI[3]));
+ suspectPyrams.clear();
+ searcher->GetElementsInSphere( center, diameter * 0.6, SMDSAbs_Volume, suspectPyrams);
+
// check intersection with distant pyramids
- for(k=0; k<4; k++) // loop on 4 base nodes of PrmI
+ for ( j = 0; j < suspectPyrams.size(); ++j )
{
- gp_Vec Vtmp(PsI[k],PsI[4]);
- gp_Ax1 line( PsI[k], Vtmp );
- vector< const SMDS_MeshElement* > suspectPyrams;
- searcher->GetElementsNearLine( line, SMDSAbs_Volume, suspectPyrams);
+ const SMDS_MeshElement* PrmJ = suspectPyrams[j];
+ if ( PrmJ == PrmI )
+ continue;
+ if ( apexI == PrmJ->GetNode( PYRAM_APEX ))
+ continue; // pyramids PrmI and PrmJ already merged
+ if ( !checkedPyrams.insert( PrmJ ).second )
+ continue; // already checked
- for ( j = 0; j < suspectPyrams.size(); ++j )
- {
- const SMDS_MeshElement* PrmJ = suspectPyrams[j];
- if ( PrmJ == PrmI || PrmJ->NbCornerNodes() != 5 )
- continue;
- if ( myShapeID != PrmJ->GetNode(4)->getshapeId())
- continue; // pyramid from other SOLID
- if ( PrmI->GetNode(4) == PrmJ->GetNode(4) )
- continue; // pyramids PrmI and PrmJ already merged
- if ( !checkedPyrams.insert( PrmJ ).second )
- continue; // already checked
-
- TXyzIterator xyzIt( PrmJ->nodesIterator() );
- vector<gp_Pnt> PsJ( xyzIt, TXyzIterator() );
+ gp_Pnt PsJ[5];
+ for ( k = 0; k < 5; k++ )
+ PsJ[k] = SMESH_TNodeXYZ( PrmJ->GetNode(k) );
+ if ( ray * ( PsJ[4].XYZ() - PC ) < 0. )
+ continue; // PrmJ is below PrmI
+
+ for ( k = 0; k < 4; k++ ) // loop on 4 base nodes of PrmI
+ {
gp_Pnt Pint;
bool hasInt=false;
- for(k=0; k<4 && !hasInt; k++) {
- gp_Vec Vtmp(PsI[k],PsI[4]);
+ for ( k = 0; k < 4 && !hasInt; k++ )
+ {
+ gp_Vec Vtmp( PsI[k], PsI[ PYRAM_APEX ]);
gp_Pnt Pshift = PsI[k].XYZ() + Vtmp.XYZ() * 0.01; // base node moved a bit to apex
hasInt =
- ( HasIntersection3( Pshift, PsI[4], Pint, PsJ[0], PsJ[1], PsJ[4]) ||
- HasIntersection3( Pshift, PsI[4], Pint, PsJ[1], PsJ[2], PsJ[4]) ||
- HasIntersection3( Pshift, PsI[4], Pint, PsJ[2], PsJ[3], PsJ[4]) ||
- HasIntersection3( Pshift, PsI[4], Pint, PsJ[3], PsJ[0], PsJ[4]) );
+ ( HasIntersection3( Pshift, PsI[4], Pint, PsJ[0], PsJ[1], PsJ[PYRAM_APEX]) ||
+ HasIntersection3( Pshift, PsI[4], Pint, PsJ[1], PsJ[2], PsJ[PYRAM_APEX]) ||
+ HasIntersection3( Pshift, PsI[4], Pint, PsJ[2], PsJ[3], PsJ[PYRAM_APEX]) ||
+ HasIntersection3( Pshift, PsI[4], Pint, PsJ[3], PsJ[0], PsJ[PYRAM_APEX]) );
}
- for(k=0; k<4 && !hasInt; k++) {
- gp_Vec Vtmp(PsJ[k],PsJ[4]);
+ for ( k = 0; k < 4 && !hasInt; k++ )
+ {
+ gp_Vec Vtmp( PsJ[k], PsJ[ PYRAM_APEX ]);
gp_Pnt Pshift = PsJ[k].XYZ() + Vtmp.XYZ() * 0.01;
hasInt =
- ( HasIntersection3( Pshift, PsJ[4], Pint, PsI[0], PsI[1], PsI[4]) ||
- HasIntersection3( Pshift, PsJ[4], Pint, PsI[1], PsI[2], PsI[4]) ||
- HasIntersection3( Pshift, PsJ[4], Pint, PsI[2], PsI[3], PsI[4]) ||
- HasIntersection3( Pshift, PsJ[4], Pint, PsI[3], PsI[0], PsI[4]) );
+ ( HasIntersection3( Pshift, PsJ[4], Pint, PsI[0], PsI[1], PsI[PYRAM_APEX]) ||
+ HasIntersection3( Pshift, PsJ[4], Pint, PsI[1], PsI[2], PsI[PYRAM_APEX]) ||
+ HasIntersection3( Pshift, PsJ[4], Pint, PsI[2], PsI[3], PsI[PYRAM_APEX]) ||
+ HasIntersection3( Pshift, PsJ[4], Pint, PsI[3], PsI[0], PsI[PYRAM_APEX]) );
}
if ( hasInt )
{
// count common nodes of base faces of two pyramids
int nbc = 0;
- for (k=0; k<4; k++)
+ for ( k = 0; k < 4; k++ )
nbc += int ( PrmI->GetNodeIndex( PrmJ->GetNode(k) ) >= 0 );
if ( nbc == 4 )
continue; // pyrams have a common base face
- if(nbc>0)
+ if ( nbc > 0 )
{
// Merge the two pyramids and others already merged with them
MergePiramids( PrmI, PrmJ, nodesToMove );
}
- else { // nbc==0
-
+ else // nbc==0
+ {
// decrease height of pyramids
gp_XYZ PCi(0,0,0), PCj(0,0,0);
- for(k=0; k<4; k++) {
+ for ( k = 0; k < 4; k++ ) {
PCi += PsI[k].XYZ();
PCj += PsJ[k].XYZ();
}
VN1.Scale(coef1);
VN2.Scale(coef2);
- SMDS_MeshNode* aNode1 = const_cast<SMDS_MeshNode*>(PrmI->GetNode(4));
+ SMDS_MeshNode* aNode1 = const_cast<SMDS_MeshNode*>( apexI );
aNode1->setXYZ( PCi.X()+VN1.X(), PCi.Y()+VN1.Y(), PCi.Z()+VN1.Z() );
- SMDS_MeshNode* aNode2 = const_cast<SMDS_MeshNode*>(PrmJ->GetNode(4));
+ SMDS_MeshNode* aNode2 = const_cast<SMDS_MeshNode*>(PrmJ->GetNode( PYRAM_APEX ));
aNode2->setXYZ( PCj.X()+VN2.X(), PCj.Y()+VN2.Y(), PCj.Z()+VN2.Z() );
nodesToMove.insert( aNode1 );
nodesToMove.insert( aNode2 );
class SMDS_MeshElement;
class SMDS_MeshNode;
class SMDS_MeshFace;
-class Handle_TColgp_HArray1OfPnt;
-class Handle_TColgp_HArray1OfVec;
+class TColgp_Array1OfPnt;
+class TColgp_Array1OfVec;
class gp_Pnt;
class gp_Vec;
protected:
int Preparation(const SMDS_MeshElement* face,
- Handle_TColgp_HArray1OfPnt& PN,
- Handle_TColgp_HArray1OfVec& VN,
+ TColgp_Array1OfPnt& PN,
+ TColgp_Array1OfVec& VN,
std::vector<const SMDS_MeshNode*>& FNodes,
gp_Pnt& PC, gp_Vec& VNorm,
const SMDS_MeshElement** volumes=0);
- bool CheckIntersection(const gp_Pnt& P, const gp_Pnt& PC,
- gp_Pnt& Pint, SMESH_Mesh& aMesh,
- const TopoDS_Shape& aShape,
- const SMDS_MeshElement* NotCheckedFace);
+ void LimitHeight (gp_Pnt& Papex,
+ const gp_Pnt& PC,
+ const TColgp_Array1OfPnt& PN,
+ const std::vector<const SMDS_MeshNode*>& FNodes,
+ SMESH_Mesh& aMesh,
+ const SMDS_MeshElement* NotCheckedFace,
+ const bool UseApexRay);
bool Compute2ndPart(SMESH_Mesh& aMesh,
const std::vector<const SMDS_MeshElement*>& pyramids);
std::set<const SMDS_MeshNode*> & nodesToMove);
void MergeAdjacent(const SMDS_MeshElement* PrmI,
- std::set<const SMDS_MeshNode*>& nodesToMove);
+ std::set<const SMDS_MeshNode*>& nodesToMove,
+ const bool isRecursion = false);
TopoDS_Shape myShape;
istream & StdMeshers_QuadrangleParams::LoadFrom(istream & load)
{
bool isOK = true;
- isOK = (load >> _triaVertexID);
+ isOK = static_cast<bool>(load >> _triaVertexID);
if (!isOK)
load.clear(ios::badbit | load.rdstate());
- isOK = (load >> _objEntry);
+ isOK = static_cast<bool>(load >> _objEntry);
if (!isOK)
load.clear(ios::badbit | load.rdstate());
int type;
- isOK = (load >> type);
+ isOK = static_cast<bool>(load >> type);
if (isOK)
_quadType = StdMeshers_QuadType(type);
myParams = NULL;
myQuadList.clear();
- bool isOk = true;
- aStatus = SMESH_Hypothesis::HYP_OK;
+ aStatus = SMESH_Hypothesis::HYP_OK;
const list <const SMESHDS_Hypothesis * >& hyps =
GetUsedHypothesis(aMesh, aShape, false);
// 0 bottom 1
- const int bfrom = quad->side[0].from;
- const int rfrom = quad->side[1].from;
+ //const int bfrom = quad->side[0].from;
+ //const int rfrom = quad->side[1].from;
const int tfrom = quad->side[2].from;
- const int lfrom = quad->side[3].from;
+ //const int lfrom = quad->side[3].from;
{
const vector<UVPtStruct>& uv_eb_vec = quad->side[0].GetUVPtStruct(true,0);
const vector<UVPtStruct>& uv_er_vec = quad->side[1].GetUVPtStruct(false,1);
} // if ( dv != 0 && dh != 0 )
- const int db = quad->side[0].IsReversed() ? -1 : +1;
- const int dr = quad->side[1].IsReversed() ? -1 : +1;
+ //const int db = quad->side[0].IsReversed() ? -1 : +1;
+ //const int dr = quad->side[1].IsReversed() ? -1 : +1;
const int dt = quad->side[2].IsReversed() ? -1 : +1;
- const int dl = quad->side[3].IsReversed() ? -1 : +1;
+ //const int dl = quad->side[3].IsReversed() ? -1 : +1;
// Case dv == 0, here possibly myQuadList.size() > 1
//
const vector<UVPtStruct>& uv_et = quad->side[2].GetUVPtStruct(true,1);
const vector<UVPtStruct>& uv_el = quad->side[3].GetUVPtStruct(false,0);
- if (uv_eb.size() != nb || uv_er.size() != nr || uv_et.size() != nt || uv_el.size() != nl)
+ if ((int) uv_eb.size() != nb || (int) uv_er.size() != nr ||
+ (int) uv_et.size() != nt || (int) uv_el.size() != nl)
return error(COMPERR_BAD_INPUT_MESH);
// arrays for normalized params
const vector<UVPtStruct>& uv_et = quad->side[2].GetUVPtStruct(true,1);
const vector<UVPtStruct>& uv_el = quad->side[3].GetUVPtStruct(false,0);
- if (uv_eb.size() != nb || uv_er.size() != nr || uv_et.size() != nt || uv_el.size() != nl)
+ if ((int) uv_eb.size() != nb || (int) uv_er.size() != nr ||
+ (int) uv_et.size() != nt || (int) uv_el.size() != nl)
return error(COMPERR_BAD_INPUT_MESH);
gp_UV uv[ UV_SIZE ];
return isOK;
}
-/*//================================================================================
+//================================================================================
/*!
* \brief Finds vertices at the most sharp face corners
* \param [in] theFace - the FACE
// check if there are possible variations in choosing corners
bool haveVariants = false;
- if ( vertexByAngle.size() > nbCorners )
+ if ((int) vertexByAngle.size() > nbCorners )
{
double lostAngle = a2v->first;
double lastAngle = ( --a2v, a2v->first );
}
const double angleTol = 5.* M_PI/180;
- myCheckOri = ( vertexByAngle.size() > nbCorners ||
+ myCheckOri = ( (int)vertexByAngle.size() > nbCorners ||
vertexByAngle.begin()->first < angleTol );
// make theWire begin from a corner vertex or triaVertex
{
// select two halfDivider's as corners
TGeoIndex hd1, hd2 = -1;
- int iC2;
+ size_t iC2;
for ( iC2 = 0; iC2 < cornerInd.size() && hd2 < 0; ++iC2 )
{
hd1 = cornerInd[ iC2 ];
vector< double > accuLength;
double totalLen = 0;
vector< TGeoIndex > evVec( equVerts.begin(), equVerts.end() );
- int iEV = 0;
+ size_t iEV = 0;
TGeoIndex iE = cornerInd[ helper.WrapIndex( iC - nbC[0] - 1, cornerInd.size() )];
TGeoIndex iEEnd = cornerInd[ helper.WrapIndex( iC + nbC[1] + 1, cornerInd.size() )];
- while ( accuLength.size() < nbEqualV + int( !allCornersSame ) )
+ while ((int) accuLength.size() < nbEqualV + int( !allCornersSame ) )
{
// accumulate length of edges before iEV-th equal vertex
accuLength.push_back( totalLen );
//================================================================================
FaceQuadStruct::Side::Side(StdMeshers_FaceSidePtr theGrid)
- : grid(theGrid), nbNodeOut(0), from(0), to(theGrid ? theGrid->NbPoints() : 0 ), di(1)
+ : grid(theGrid), from(0), to(theGrid ? theGrid->NbPoints() : 0 ), di(1), nbNodeOut(0)
{
}
quadsBySide[ (*quadIt)->side[iSide] ].push_back( *quadIt );
}
- SMESH_Mesh* mesh = myHelper->GetMesh();
- SMESHDS_Mesh* meshDS = myHelper->GetMeshDS();
const TopoDS_Face& face = TopoDS::Face( myHelper->GetSubShape() );
Handle(Geom_Surface) surf = BRep_Tool::Surface( face );
continue;
const vector<UVPtStruct>& oGrid = side.contacts[iC].other_side->grid->GetUVPtStruct();
const UVPtStruct& uvPt = points[ side.contacts[iC].point ];
- if ( side.contacts[iC].other_point >= oGrid .size() ||
- side.contacts[iC].point >= points.size() )
+ if ( side.contacts[iC].other_point >= (int) oGrid .size() ||
+ side.contacts[iC].point >= (int) points.size() )
throw SALOME_Exception( "StdMeshers_Quadrangle_2D::addEnforcedNodes(): wrong contact" );
if ( oGrid[ side.contacts[iC].other_point ].node )
(( UVPtStruct& ) uvPt).node = oGrid[ side.contacts[iC].other_point ].node;
return;
}
- const int iFrom = Min ( iForced, *iNext );
- const int iTo = Max ( iForced, *iNext ) + 1;
- const int sideSize = iTo - iFrom;
+ const int iFrom = Min ( iForced, *iNext );
+ const int iTo = Max ( iForced, *iNext ) + 1;
+ const size_t sideSize = iTo - iFrom;
vector<UVPtStruct> points[4]; // side points of a temporary quad
for ( int is2nd = 0; is2nd < 2; ++is2nd )
{
points[ is2nd ].reserve( sideSize );
- int nbLoops = 0;
+ size_t nbLoops = 0;
while ( points[is2nd].size() < sideSize )
{
int iCur = iFrom + points[is2nd].size() - int( !points[is2nd].empty() );
void FaceQuadStruct::Side::AddContact( int ip, Side* side, int iop )
{
- if ( ip >= GetUVPtStruct().size() ||
- iop >= side->GetUVPtStruct().size() )
+ if ( ip >= (int) GetUVPtStruct().size() ||
+ iop >= (int) side->GetUVPtStruct().size() )
throw SALOME_Exception( "FaceQuadStruct::Side::AddContact(): wrong point" );
if ( ip < from || ip >= to )
return;
return GetUVPtStruct()[ to-nbNodeOut-(IsReversed() ? -1 : +1)];
}
// some sortcuts
- const vector<UVPtStruct>& GetUVPtStruct(bool isXConst=0, double constValue=0) const
+ const std::vector<UVPtStruct>& GetUVPtStruct(bool isXConst=0, double constValue=0) const
{ return nbNodeOut ?
grid->SimulateUVPtStruct( NbPoints()-nbNodeOut-1, isXConst, constValue ) :
grid->GetUVPtStruct( isXConst, constValue );
bool StdMeshers_RadialPrism_3D::IsApplicable( const TopoDS_Shape & aShape, bool toCheckAll )
{
- bool isCurShellApp;
int nbFoundSolids = 0;
for (TopExp_Explorer exp( aShape, TopAbs_SOLID ); exp.More(); exp.Next(), ++nbFoundSolids )
{
gp_Vec2d aVec2d(PC,p2dV);
Nodes1.resize( myLayerPositions.size()+1 );
Nodes2.resize( myLayerPositions.size()+1 );
- int i = 0;
- for(; i<myLayerPositions.size(); i++) {
+ size_t i = 0;
+ for ( ; i < myLayerPositions.size(); i++ ) {
gp_Pnt P( P0.X() + aVec.X()*myLayerPositions[i],
P0.Y() + aVec.Y()*myLayerPositions[i],
P0.Z() + aVec.Z()*myLayerPositions[i] );
meshDS->SetNodeOnEdge(NC, edgeID, cp);
Nodes1.resize( myLayerPositions.size()+1 );
Nodes2.resize( myLayerPositions.size()+1 );
- int i = 0;
+ size_t i = 0;
for(; i<myLayerPositions.size(); i++) {
gp_Pnt P( P0.X() + aVec.X()*myLayerPositions[i],
P0.Y() + aVec.Y()*myLayerPositions[i],
bool nodesFromP0ToP1 = ( theNodes.rbegin()->second == NF );
NC = const_cast<SMDS_MeshNode*>
( nodesFromP0ToP1 ? theNodes.begin()->second : theNodes.rbegin()->second );
- int i = 0, ir = Nodes1.size()-1;
- int * pi = nodesFromP0ToP1 ? &i : &ir;
+ size_t i = 0, ir = Nodes1.size()-1;
+ size_t * pi = nodesFromP0ToP1 ? &i : &ir;
itn = theNodes.begin();
if ( nodesFromP0ToP1 ) ++itn;
for ( ; i < Nodes1.size(); ++i, --ir, ++itn )
meshDS->SetNodeOnVertex(NC, vertID);
}
double dp = lp-fp;
- int i = 0;
- for(; i<myLayerPositions.size(); i++) {
+ size_t i = 0;
+ for ( ; i < myLayerPositions.size(); i++ ) {
gp_Pnt P( P0.X() + aVec.X()*myLayerPositions[i],
P0.Y() + aVec.Y()*myLayerPositions[i],
P0.Z() + aVec.Z()*myLayerPositions[i] );
SMDS_MeshNode * node = meshDS->AddNode(P.X(), P.Y(), P.Z());
Nodes1[i] = node;
double param;
- if(!ori)
+ if ( !ori )
param = fp + dp*(1-myLayerPositions[i]);
else
param = fp + dp*myLayerPositions[i];
// create 1D elements on edge
SMDS_MeshEdge* ME = myHelper->AddEdge( NC, Nodes1[0] );
if(ME) meshDS->SetMeshElementOnShape(ME, edgeID);
- for(i=1; i<Nodes1.size(); i++) {
+ for ( i = 1; i < Nodes1.size(); i++ ) {
ME = myHelper->AddEdge( Nodes1[i-1], Nodes1[i] );
if(ME) meshDS->SetMeshElementOnShape(ME, edgeID);
}
- if (nbe==2 && LinEdge1.Orientation() == TopAbs_INTERNAL )
+ if ( nbe == 2 && LinEdge1.Orientation() == TopAbs_INTERNAL )
Nodes2 = Nodes1;
}
markEdgeAsComputedByMe( LinEdge1, aMesh.GetSubMesh( F ));
return error("Invalid mesh on a straight edge");
bool nodesFromP0ToP2 = ( theNodes.rbegin()->second == NL );
- int i = 0, ir = Nodes1.size()-1;
- int * pi = nodesFromP0ToP2 ? &i : &ir;
+ size_t i = 0, ir = Nodes1.size()-1;
+ size_t * pi = nodesFromP0ToP2 ? &i : &ir;
itn = theNodes.begin();
if ( nodesFromP0ToP2 ) ++itn;
for ( ; i < Nodes2.size(); ++i, --ir, ++itn )
PC = PL;
}
double dp = lp-fp;
- for(int i=0; i<myLayerPositions.size(); i++) {
+ for ( size_t i = 0; i < myLayerPositions.size(); i++ ) {
gp_Pnt P( P0.X() + aVec.X()*myLayerPositions[i],
P0.Y() + aVec.Y()*myLayerPositions[i],
P0.Z() + aVec.Z()*myLayerPositions[i] );
Nodes2[ myLayerPositions.size() ] = NL;
// create 1D elements on edge
SMDS_MeshEdge* ME = myHelper->AddEdge( NC, Nodes2[0] );
- if(ME) meshDS->SetMeshElementOnShape(ME, edgeID);
- for(int i=1; i<Nodes2.size(); i++) {
+ if ( ME ) meshDS->SetMeshElementOnShape(ME, edgeID);
+ for ( size_t i = 1; i < Nodes2.size(); i++ ) {
ME = myHelper->AddEdge( Nodes2[i-1], Nodes2[i] );
if(ME) meshDS->SetMeshElementOnShape(ME, edgeID);
}
//cout<<"Angles.Length() = "<<Angles.Length()<<" Points.Length() = "<<Points.Length()<<endl;
//cout<<"Nodes1.size() = "<<Nodes1.size()<<" Pnts2d1.Length() = "<<Pnts2d1.Length()<<endl;
for(; i<Angles.Length(); i++) {
- vector< const SMDS_MeshNode* > tmpNodes(Nodes1.size());
+ vector< const SMDS_MeshNode* > tmpNodes;
gp_Trsf aTrsf;
gp_Ax1 theAxis(P0,gp_Dir(Axis));
aTrsf.SetRotation( theAxis, Angles.Value(i) );
aTrsf2d.Transforms( cx, cy );
// set node on face
meshDS->SetNodeOnFace( node, faceID, cx, cy );
- tmpNodes[j-1] = node;
+ tmpNodes.push_back(node);
}
// create faces
- tmpNodes[Points.Length()] = CNodes[i];
+ tmpNodes.push_back( CNodes[i] );
// quad
- for(j=0; j<Nodes1.size()-1; j++) {
+ for ( j = 0; j < (int)Nodes1.size() - 1; j++ ) {
SMDS_MeshFace* MF;
if(IsForward)
MF = myHelper->AddFace( tmpNodes[j], Nodes1[j],
MF = myHelper->AddFace( NC, Nodes1[0], tmpNodes[0] );
else
MF = myHelper->AddFace( NC, tmpNodes[0], Nodes1[0] );
- if(MF) meshDS->SetMeshElementOnShape(MF, faceID);
- for(j=0; j<Nodes1.size(); j++) {
+ if ( MF ) meshDS->SetMeshElementOnShape(MF, faceID);
+ for ( j = 0; j < (int) Nodes1.size(); j++ ) {
Nodes1[j] = tmpNodes[j];
}
}
// create last faces
// quad
- for(i=0; i<Nodes1.size()-1; i++) {
+ for ( i = 0; i < (int)Nodes1.size()-1; i++ ) {
SMDS_MeshFace* MF;
if(IsForward)
MF = myHelper->AddFace( Nodes2[i], Nodes1[i],
}
else {
- if ( myLayerPositions.size() != nbNodes )
+ if ((int) myLayerPositions.size() != nbNodes )
return error("Radial edge is meshed by other algorithm");
}
}
ok = !aResMap.count( aMesh.GetSubMesh(LinEdge1) );
if ( !ok ) {
const vector<int>& aVec = aResMap[ aMesh.GetSubMesh(LinEdge1) ];
- ok = ( aVec[SMDSEntity_Node] == myLayerPositions.size() );
+ ok = ( aVec[SMDSEntity_Node] == (int) myLayerPositions.size() );
}
if(ok) {
ok = algo1d->EvaluateCircularEdge( aMesh, CircEdge, aResMap );
// other curve not line
return error(COMPERR_BAD_SHAPE);
}
- int nbLayers = myLayerPositions.size();
+ size_t nbLayers = myLayerPositions.size();
computeLayerPositions( P0, P1, LinEdge2 );
if ( nbLayers != myLayerPositions.size() )
return error("Different hypotheses apply to radial edges");
ok = true; // override other 1d hyps
else {
const vector<int>& aVec = aResMap[ aMesh.GetSubMesh(LinEdge1) ];
- ok = ( aVec[SMDSEntity_Node] == myLayerPositions.size() );
+ ok = ( aVec[SMDSEntity_Node] == (int) myLayerPositions.size() );
}
}
if( ok && aResMap.count( aMesh.GetSubMesh(LinEdge2) )) {
ok = true; // override other 1d hyps
else {
const vector<int>& aVec = aResMap[ aMesh.GetSubMesh(LinEdge2) ];
- ok = ( aVec[SMDSEntity_Node] == myLayerPositions.size() );
+ ok = ( aVec[SMDSEntity_Node] == (int) myLayerPositions.size() );
}
}
if(ok) {
return ( aStatus == SMESH_Hypothesis::HYP_OK );
}
-static bool computeParamByFunc(Adaptor3d_Curve& C3d, double first, double last,
- double length, bool theReverse,
- int nbSeg, Function& func,
+static bool computeParamByFunc(Adaptor3d_Curve& C3d,
+ double first, double last, double length,
+ bool theReverse, int nbSeg, Function& func,
list<double>& theParams)
{
// never do this way
int nbPnt = 1 + nbSeg;
vector<double> x(nbPnt, 0.);
- if (!buildDistribution(func, 0.0, 1.0, nbSeg, x, 1E-4))
+ if ( !buildDistribution( func, 0.0, 1.0, nbSeg, x, 1E-4 ))
return false;
- MESSAGE( "Points:\n" );
- char buf[1024];
- for ( int i=0; i<=nbSeg; i++ )
- {
- sprintf( buf, "%f\n", float(x[i] ) );
- MESSAGE( buf );
- }
-
-
-
// apply parameters in range [0,1] to the space of the curve
double prevU = first;
- double sign = 1.;
- if (theReverse)
+ double sign = 1.;
+ if ( theReverse )
{
prevU = last;
- sign = -1.;
+ sign = -1.;
}
- for( int i = 1; i < nbSeg; i++ )
+
+ for ( int i = 1; i < nbSeg; i++ )
{
double curvLength = length * (x[i] - x[i-1]) * sign;
- GCPnts_AbscissaPoint Discret( C3d, curvLength, prevU );
+ double tol = Min( Precision::Confusion(), curvLength / 100. );
+ GCPnts_AbscissaPoint Discret( tol, C3d, curvLength, prevU );
if ( !Discret.IsDone() )
return false;
double U = Discret.Parameter();
size_t iSeg = theReverse ? segLen.size()-1 : 0;
size_t dSeg = theReverse ? -1 : +1;
double param = theFirstU;
- int nbParams = 0;
+ size_t nbParams = 0;
for ( int i = 0, nb = segLen.size()-1; i < nb; ++i, iSeg += dSeg )
{
GCPnts_AbscissaPoint Discret( theC3d, segLen[ iSeg ], param );
case FIXED_POINTS_1D: {
const std::vector<double>& aPnts = _fpHyp->GetPoints();
const std::vector<int>& nbsegs = _fpHyp->GetNbSegments();
- int i = 0;
TColStd_SequenceOfReal Params;
- for(; i<aPnts.size(); i++) {
+ for ( size_t i = 0; i < aPnts.size(); i++ )
+ {
if( aPnts[i]<0.0001 || aPnts[i]>0.9999 ) continue;
int j=1;
bool IsExist = false;
}
double eltSize, segmentSize = 0.;
double currAbscissa = 0;
- for(i=0; i<Params.Length(); i++) {
- int nbseg = ( i > nbsegs.size()-1 ) ? nbsegs[0] : nbsegs[i];
+ for ( int i = 0; i < Params.Length(); i++ )
+ {
+ int nbseg = ( i > (int)nbsegs.size()-1 ) ? nbsegs[0] : nbsegs[i];
segmentSize = Params.Value(i+1)*theLength - currAbscissa;
currAbscissa += segmentSize;
GCPnts_AbscissaPoint APnt(theC3d, sign*segmentSize, par1);
par1 = par2;
}
// add for last
- int nbseg = ( nbsegs.size() > Params.Length() ) ? nbsegs[Params.Length()] : nbsegs[0];
+ int nbseg = ( (int)nbsegs.size() > Params.Length() ) ? nbsegs[Params.Length()] : nbsegs[0];
segmentSize = theLength - currAbscissa;
eltSize = segmentSize/nbseg;
GCPnts_UniformAbscissa Discret;
if ( !_edgeIDs.empty() )
{
- for ( size_t i = 0; i < _edgeIDs.size(); i++)
+ for ( size_t i = 0; i < _edgeIDs.size(); i++ )
save << " " << _edgeIDs[i];
save << " " << _objEntry << " ";
}
//=============================================================================
/*!
- *
+ *
*/
//=============================================================================
bool isOK;
int intVal;
- isOK = (load >> intVal);
+ isOK = static_cast<bool>(load >> intVal);
if (isOK && intVal > 0) {
_edgeIDs.reserve( intVal );
- for (int i = 0; i < _edgeIDs.capacity() && isOK; i++) {
- isOK = (load >> intVal);
+ for ( size_t i = 0; i < _edgeIDs.capacity() && isOK; i++ ) {
+ isOK = static_cast<bool>(load >> intVal);
if ( isOK ) _edgeIDs.push_back( intVal );
}
- isOK = (load >> _objEntry);
+ isOK = static_cast<bool>(load >> _objEntry);
}
return load;
:SMESH_0D_Algo(hypId, studyId, gen)
{
_name = "SegmentAroundVertex_0D";
- // it is assigned to vertices but influence a state of EDGE submeshes
+ // it is assigned to vertices but influence a state of EDGE submeshes
_shapeType = (1 << TopAbs_VERTEX); // 1 bit per shape type
_compatibleHypothesis.push_back("SegmentLengthAroundVertex");
//=======================================================================
//function : CheckHypothesis
-//purpose :
+//purpose :
//=======================================================================
-bool StdMeshers_SegmentAroundVertex_0D::CheckHypothesis(SMESH_Mesh& aMesh,
- const TopoDS_Shape& aShape,
- SMESH_Hypothesis::Hypothesis_Status& aStatus)
+bool StdMeshers_SegmentAroundVertex_0D::
+CheckHypothesis(SMESH_Mesh& aMesh,
+ const TopoDS_Shape& aShape,
+ SMESH_Hypothesis::Hypothesis_Status& aStatus)
{
- list <const SMESHDS_Hypothesis * >::const_iterator itl;
+ std::list <const SMESHDS_Hypothesis * >::const_iterator itl;
- const list <const SMESHDS_Hypothesis * >&hyps = GetUsedHypothesis(aMesh, aShape);
+ const std::list <const SMESHDS_Hypothesis * >&hyps = GetUsedHypothesis(aMesh, aShape);
if ( hyps.size() == 0 )
{
aStatus = SMESH_Hypothesis::HYP_MISSING;
//=======================================================================
//function : Compute
-//purpose :
+//purpose :
//=======================================================================
bool StdMeshers_SegmentAroundVertex_0D::Compute(SMESH_Mesh&, const TopoDS_Shape&)
{
bool isOK = true;
double a;
- isOK = (load >> a);
+ isOK = static_cast<bool>(load >> a);
if (isOK)
this->_length = a;
else
{
bool isOK = true;
int intVal;
- isOK = (load >> _begLength);
+ isOK = static_cast<bool>(load >> _begLength);
if (!isOK)
load.clear(ios::badbit | load.rdstate());
- isOK = (load >> _endLength);
+ isOK = static_cast<bool>(load >> _endLength);
if (!isOK)
load.clear(ios::badbit | load.rdstate());
-
- isOK = (load >> intVal);
+
+ isOK = static_cast<bool>(load >> intVal);
if (isOK && intVal > 0) {
_edgeIDs.reserve( intVal );
- for (int i = 0; i < _edgeIDs.capacity() && isOK; i++) {
- isOK = (load >> intVal);
+ for ( size_t i = 0; i < _edgeIDs.capacity() && isOK; i++) {
+ isOK = static_cast<bool>(load >> intVal);
if ( isOK ) _edgeIDs.push_back( intVal );
}
- isOK = (load >> _objEntry);
+ isOK = static_cast<bool>(load >> _objEntry);
}
return load;
//=============================================================================
/*!
- *
+ *
*/
//=============================================================================
{
hasVL = false;
for ( hyp = allHyps.begin(); hyp != allHyps.end() && !hasVL; ++hyp )
- if ( viscHyp = dynamic_cast<const THypVL*>( *hyp ))
+ if (( viscHyp = dynamic_cast<const THypVL*>( *hyp )))
hasVL = viscHyp->IsShapeWithLayers( neighbourID );
}
if ( !hasVL )
_PolyLine::TEdgeIterator eIt = isR ? L._lEdges.end()-1 : L._lEdges.begin();
if ( eIt->_length2D == 0 ) continue;
_Segment seg1( eIt->_uvOut, eIt->_uvIn );
- for ( eIt += deltaIt; nbRemove < L._lEdges.size()-1; eIt += deltaIt )
+ for ( eIt += deltaIt; nbRemove < (int)L._lEdges.size()-1; eIt += deltaIt )
{
_Segment seg2( eIt->_uvOut, eIt->_uvIn );
if ( !intersection.Compute( seg1, seg2 ))
++nbRemove;
}
if ( nbRemove > 0 ) {
- if ( nbRemove == L._lEdges.size()-1 ) // 1st and last _LayerEdge's intersect
+ if ( nbRemove == (int)L._lEdges.size()-1 ) // 1st and last _LayerEdge's intersect
{
--nbRemove;
_LayerEdge& L0 = L._lEdges.front();
// store a proxyMesh in a sub-mesh
// make faces on each _PolyLine
vector< double > layersHeight;
- double prevLen2D = -1;
+ //double prevLen2D = -1;
for ( size_t iL = 0; iL < _polyLineVec.size(); ++iL )
{
_PolyLine& L = _polyLineVec[ iL ];
void _SegmentTree::buildChildrenData()
{
- for ( int i = 0; i < _segments.size(); ++i )
+ for ( size_t i = 0; i < _segments.size(); ++i )
for (int j = 0; j < nbChildren(); j++)
if ( !myChildren[j]->getBox()->IsOut( *_segments[i]._seg->_uv[0],
*_segments[i]._seg->_uv[1] ))
for (int j = 0; j < nbChildren(); j++)
{
_SegmentTree* child = static_cast<_SegmentTree*>( myChildren[j]);
- child->myIsLeaf = ( child->_segments.size() <= maxNbSegInLeaf() );
+ child->myIsLeaf = ((int) child->_segments.size() <= maxNbSegInLeaf() );
}
}
if ( isLeaf() )
{
- for ( int i = 0; i < _segments.size(); ++i )
+ for ( size_t i = 0; i < _segments.size(); ++i )
if ( !_segments[i].IsOut( seg ))
found.push_back( _segments[i]._seg );
}
if ( isLeaf() )
{
- for ( int i = 0; i < _segments.size(); ++i )
+ for ( size_t i = 0; i < _segments.size(); ++i )
if ( !_segments[i].IsOut( ray ))
found.push_back( _segments[i]._seg );
}
void GridAxisTab::onMode(int isSpacing)
{
- mySpacingTreeWdg->setShown( isSpacing );
- myCoordList->setShown( !isSpacing );
- myStepSpin->setShown( !isSpacing );
- myStepLabel->setShown( !isSpacing );
+ mySpacingTreeWdg->setVisible( isSpacing );
+ myCoordList->setVisible( !isSpacing );
+ myStepSpin->setVisible( !isSpacing );
+ myStepLabel->setVisible( !isSpacing );
if ( isSpacing )
{
if ( mySpacingTreeWdg->topLevelItemCount() == 0 )
QwtLegend* legend = dynamic_cast<QwtLegend*>( plotCurve->plot()->legend() );
QWidget* widget = legend->legendWidget( itemInfo );
QwtLegendLabel* label = dynamic_cast<QwtLegendLabel*>( widget );
- if( Plot2d_QwtLegendLabel* anItem = (Plot2d_QwtLegendLabel*)label )
- return anItem;
+ Plot2d_QwtLegendLabel* anItem = (Plot2d_QwtLegendLabel*)label;
+ return anItem;
}
StdMeshersGUI_DistrPreview::StdMeshersGUI_DistrPreview( QWidget* p, StdMeshers::StdMeshers_NumberOfSegments_ptr h )
-: QwtPlot( p ),
- myPoints( 50 ),
- myIsTable( false ),
- myVars( 1, 1 ),
- myValues( 1, 1 ),
- myConv( CUT_NEGATIVE ),
- myIsDone( true ),
- myNbSeg( 1 )
+ : QwtPlot( p ),
+ myPoints( 50 ),
+ myNbSeg( 1 ),
+ myIsTable( false ),
+ myConv( CUT_NEGATIVE ),
+ myVars( 1, 1 ),
+ myValues( 1, 1 ),
+ myIsDone( true )
{
Kernel_Utils::Localizer loc;
myHypo = StdMeshers::StdMeshers_NumberOfSegments::_duplicate( h );
{
QList<int> selRows = selectedRows();
for ( int r = selRows.count()-1; r >= 0; r-- )
- removeRow( r );
+ removeRow( selRows.at(r) );
}
void
setData( const DataArray& array )
{
QList<double> d;
- for ( int i = 0; i < array.length(); i++ )
+ for ( CORBA::ULong i = 0; i < array.length(); i++ )
d.append( array[i] );
sortData( d );
void StdMeshersGUI_FixedPointsParamWdg::SetListOfPoints( SMESH::double_array_var thePoints)
{
clear();
- for ( int i = 0; i < thePoints->length(); i++ ) {
+ for ( CORBA::ULong i = 0; i < thePoints->length(); i++ ) {
addPoint( thePoints[ i ] );
}
}
{
if ( myListWidget->count() > 0 && theSegments->length() == 1)
mySameValues->setChecked(true);
- for ( int i = 0; i < theSegments->length(); i++ ) {
+ for ( CORBA::ULong i = 0; i < theSegments->length(); i++ ) {
setNbSegments( i, theSegments[i] );
}
}
//================================================================================
/*!
* \brief Constructor initialized by filter
- * \param f - object filter
+ * \param f - object filter
*/
//================================================================================
::StdMeshersGUI_LayerDistributionParamWdg(SMESH::SMESH_Hypothesis_ptr holderHyp,
SMESH::SMESH_Hypothesis_ptr distribHyp,
const QString& name,
- QDialog* dlg):
- QWidget(), myName(name), myDlg( dlg )
+ QDialog* dlg):
+ QWidget(), myDlg( dlg ), myName(name)
{
myHolderHyp = SMESH::SMESH_Hypothesis::_duplicate( holderHyp );
init();
readParamsFromHypo( data_old );
readParamsFromWidgets( data_new );
bool res = storeParamsToHypo( data_new );
- storeParamsToHypo( data_old );
res = myNbSeg->isValid( msg, true ) && res;
res = myScale->isValid( msg, true ) && res;
+ if ( !res )
+ storeParamsToHypo( data_old );
return res;
}
case Regular :
valStr += tr("SMESH_DISTR_REGULAR");
break;
- case Scale :
- valStr += tr("SMESH_NB_SEGMENTS_SCALE_PARAM") + " = " + QString::number( data.myScale );\
+ case Scale :
+ valStr += tr("SMESH_NB_SEGMENTS_SCALE_PARAM") + " = " + QString::number( data.myScale );
break;
case TabFunc : {
//valStr += tr("SMESH_TAB_FUNC");
bool param = true;
- for( int i=0; i < data.myTable.length(); i++, param = !param ) {
+ for( CORBA::ULong i = 0; i < data.myTable.length(); i++, param = !param ) {
if ( param )
valStr += "[";
valStr += QString::number( data.myTable[ i ]);
h->SetVarParameter( h_data.myNbSegVarName.toLatin1().constData(), "SetNumberOfSegments" );
h->SetNumberOfSegments( h_data.myNbSeg );
- int distr = h_data.myDistrType;
- h->SetDistrType( distr );
+ int distr = h_data.myDistrType;
+ if ( distr == 0 )
+ h->SetDistrType( distr ); // this is actually needed at non-uniform -> uniform switch
if( distr==1 ) {
h->SetVarParameter( h_data.myScaleVarName.toLatin1().constData(), "SetScaleFactor" );
h->SetScaleFactor( h_data.myScale );
myTable->setData( arr ); //update data in table
}
- myScale->setShown( distr==1 );
- myLScale->setShown( distr==1 );
- myReversedEdgesBox->setShown( distr!=0 );
+ myScale->setVisible( distr==1 );
+ myLScale->setVisible( distr==1 );
+ myReversedEdgesBox->setVisible( distr!=0 );
if ( myReversedEdgesHelper ) {
myReversedEdgesHelper->Clear();
- myReversedEdgesHelper->setShown( distr!=0 );
+ myReversedEdgesHelper->setVisible( distr!=0 );
}
myDirectionWidget->ShowPreview( distr!=0 );
bool isFunc = distr==2 || distr==3;
#ifndef DISABLE_PLOT2DVIEWER
- myPreview->setShown( isFunc );
+ myPreview->setVisible( isFunc );
#endif
- myConvBox->setShown( isFunc );
+ myConvBox->setVisible( isFunc );
- myTable->setShown( distr==2 );
- myExpr->setShown( distr==3 );
- myLExpr->setShown( distr==3 );
- myInfo->setShown( distr==3);
+ myTable->setVisible( distr==2 );
+ myExpr->setVisible( distr==3 );
+ myLExpr->setVisible( distr==3 );
+ myInfo->setVisible( distr==3);
#ifndef DISABLE_PLOT2DVIEWER
//change of preview
std::vector< int > * chain = 0;
if ( QListWidgetItem * item = myListWidget->currentItem() )
{
- int i = item->data( Qt::UserRole ).toInt();
+ size_t i = (size_t) item->data( Qt::UserRole ).toInt();
if ( 0 <= i && i < myChains.size() )
chain = & myChains[i];
}
GEOM::ListOfGO_var shapes;
SMESH::nodes_array_var points;
h->GetEnforcedNodes( shapes, points );
- for ( int i = 0; i < shapes->length(); ++i )
+ for ( size_t i = 0; i < shapes->length(); ++i )
{
CORBA::String_var name = shapes[i]->GetName();
CORBA::String_var entry = shapes[i]->GetStudyEntry();
item->setData( Qt::UserRole, entry.in() );
myShapesList->addItem( item );
}
- for ( int i = 0; i < points->length(); ++i )
+ for ( size_t i = 0; i < points->length(); ++i )
{
QTreeWidgetItem* item = new QTreeWidgetItem
( QStringList()
#include <SMESHGUI_HypothesesUtils.h>
#include <SMESHGUI_Utils.h>
#include <SMESHGUI_GEOMGenUtils.h>
-
#include <SMESH_TypeFilter.hxx>
#include <SMESH_NumberFilter.hxx>
#include <GEOM_wrap.hxx>
// SALOME GUI includes
-#include <SUIT_ResourceMgr.h>
#include <SUIT_MessageBox.h>
+#include <SUIT_ResourceMgr.h>
+#include <SalomeApp_IntSpinBox.h>
// IDL includes
#include <SALOMEconfig.h>
sb->RangeStepAndValidator( VALUE_SMALL, VALUE_MAX, 1.0, "length_precision" );
}
}
+ else if ( SalomeApp_IntSpinBox* sb = qobject_cast< SalomeApp_IntSpinBox* >( w ))
+ {
+ if ( hypType().startsWith( "NumberOfLayers" ) ||
+ hypType().startsWith( "ViscousLayers" ))
+ {
+ sb->setMinimum( 1 );
+ }
+ }
}
//================================================================================
StdMeshersGUI_SubShapeSelectorWdg
::StdMeshersGUI_SubShapeSelectorWdg( QWidget * parent, TopAbs_ShapeEnum aSubShType ):
QWidget( parent ),
- myPreviewActor( 0 ),
- myMaxSize( -1 )
+ myMaxSize( -1 ),
+ myPreviewActor( 0 )
{
QPixmap image0( SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap( "SMESH", tr( "ICON_SELECT" ) ) );
SMESH::long_array_var anArray = new SMESH::long_array;
std::vector<int> ids = this->GetImpl()->GetReversedEdges();
anArray->length( ids.size() );
- for ( CORBA::Long i = 0; i < ids.size(); i++)
+ for ( CORBA::ULong i = 0; i < ids.size(); i++)
anArray [ i ] = ids [ i ];
return anArray._retn();
CORBA::Short axis)
throw (SALOME::SALOME_Exception)
{
- vector<string> funVec;
- vector<double> pointVec;
+ std::vector<std::string> funVec;
+ std::vector<double> pointVec;
_array2vec( spaceFunctions, funVec, (const char*) );
_array2vec( internalPoints, pointVec, );
{
ASSERT( myBaseImpl );
try {
- vector<string> funVec;
- vector<double> pointVec;
+ std::vector<std::string> funVec;
+ std::vector<double> pointVec;
this->GetImpl()->GetGridSpacing( funVec, pointVec, axis );
xSpaceFunctions = new SMESH::string_array();
const char* axisName )
throw (SALOME::SALOME_Exception)
{
- vector<string> xFuns;
- vector<double> xPoints, coords;
+ std::vector<std::string> xFuns;
+ std::vector<double> xPoints, coords;
_array2vec( spaceFuns, xFuns, (const char*) );
_array2vec( points, xPoints, );
SMESH::double_array_var anArray = new SMESH::double_array;
std::vector<double> params = this->GetImpl()->GetPoints();
anArray->length( params.size() );
- for ( CORBA::Long i = 0; i < params.size(); i++)
+ for ( CORBA::ULong i = 0; i < params.size(); i++)
anArray [ i ] = params [ i ];
return anArray._retn();
SMESH::long_array_var anArray = new SMESH::long_array;
std::vector<int> nbsegs = this->GetImpl()->GetNbSegments();
anArray->length( nbsegs.size() );
- for ( CORBA::Long i = 0; i < nbsegs.size(); i++)
+ for ( CORBA::ULong i = 0; i < nbsegs.size(); i++)
anArray [ i ] = nbsegs [ i ];
return anArray._retn();
SMESH::long_array_var anArray = new SMESH::long_array;
std::vector<int> ids = this->GetImpl()->GetReversedEdges();
anArray->length( ids.size() );
- for ( CORBA::Long i = 0; i < ids.size(); i++)
+ for ( CORBA::ULong i = 0; i < ids.size(); i++)
anArray [ i ] = ids [ i ];
return anArray._retn();
std::vector<SMESH_Group*> smesh_groups;
std::vector<string> entries;
SALOMEDS::Study_var study = SMESH_Gen_i::GetSMESHGen()->GetCurrentStudy();
- for ( int i = 0; i < groups.length(); ++i )
+ for ( CORBA::ULong i = 0; i < groups.length(); ++i )
if ( SMESH_GroupBase_i* gp_i = SMESH::DownCast<SMESH_GroupBase_i*>( groups[i] ))
{
if ( gp_i->GetType() != SMESH::EDGE )
_groupEntries = new SMESH::string_array;
_groupEntries->length( entries.size ());
- for ( int i = 0; i < entries.size(); ++i )
+ for ( size_t i = 0; i < entries.size(); ++i )
_groupEntries[i] = entries[i].c_str();
}
catch ( SALOME_Exception& S_ex )
os << " " << _groupEntries->length();
SALOMEDS::Study_var study = SMESH_Gen_i::GetSMESHGen()->GetCurrentStudy();
- for ( int i = 0; i < _groupEntries->length(); ++i )
+ for ( size_t i = 0; i < _groupEntries->length(); ++i )
{
// entry
os << " " << _groupEntries[i];
_groupEntries = new SMESH::string_array;
_groupEntries->length( nbGroups );
std::string id, entry;
- for ( int i = 0; i < _groupEntries->length(); ++i )
+ for ( size_t i = 0; i < _groupEntries->length(); ++i )
{
if ( is >> entry )
_groupEntries[i] = entry.c_str();
std::vector<SMESH_Group*> smesh_groups;
std::vector<string> entries;
SALOMEDS::Study_var study = SMESH_Gen_i::GetSMESHGen()->GetCurrentStudy();
- for ( int i = 0; i < groups.length(); ++i )
+ for ( CORBA::ULong i = 0; i < groups.length(); ++i )
if ( SMESH_GroupBase_i* gp_i = SMESH::DownCast<SMESH_GroupBase_i*>( groups[i] ))
{
if ( gp_i->GetType() != SMESH::FACE )
_groupEntries = new SMESH::string_array;
_groupEntries->length( entries.size ());
- for ( int i = 0; i < entries.size(); ++i )
+ for ( size_t i = 0; i < entries.size(); ++i )
_groupEntries[i] = entries[i].c_str();
}
catch ( SALOME_Exception& S_ex )
os << " " << _groupEntries->length();
SALOMEDS::Study_var study = SMESH_Gen_i::GetSMESHGen()->GetCurrentStudy();
- for ( int i = 0; i < _groupEntries->length(); ++i )
+ for ( CORBA::ULong i = 0; i < _groupEntries->length(); ++i )
{
// entry
os << " " << _groupEntries[i];
_groupEntries = new SMESH::string_array;
_groupEntries->length( nbGroups );
std::string id, entry;
- for ( int i = 0; i < _groupEntries->length(); ++i )
+ for ( CORBA::ULong i = 0; i < _groupEntries->length(); ++i )
{
if ( is >> entry )
_groupEntries[i] = entry.c_str();
(PortableServer::POA_ptr thePOA,
int theStudyId,
::SMESH_Gen* theGenImpl )
-: StdMeshers_LayerDistribution_i(thePOA,theStudyId,theGenImpl),
- SMESH_Hypothesis_i( thePOA )
+:SMESH_Hypothesis_i( thePOA ),
+ StdMeshers_LayerDistribution_i(thePOA,theStudyId,theGenImpl)
{
MESSAGE( "StdMeshers_LayerDistribution2D_i::StdMeshers_LayerDistribution2D_i" );
myBaseImpl = new ::StdMeshers_LayerDistribution2D(theGenImpl->GetANewId(),
return this->GetImpl()->GetMode();
}
+//================================================================================
+/*!
+ * \brief Return false as in SALOME the mode is not used
+ */
+//================================================================================
+
+CORBA::Boolean StdMeshers_LengthFromEdges_i::HasParameters()
+{
+ return false;
+}
//=============================================================================
/*!
// Get mode
CORBA::Long GetMode();
+ // Return false as in SALOME the mode is not used
+ CORBA::Boolean HasParameters();
+
// Get implementation
::StdMeshers_LengthFromEdges* GetImpl();
(PortableServer::POA_ptr thePOA,
int theStudyId,
::SMESH_Gen* theGenImpl)
-: StdMeshers_NumberOfLayers_i(thePOA,theStudyId,theGenImpl),
- SMESH_Hypothesis_i( thePOA )
+ :SMESH_Hypothesis_i( thePOA ),
+ StdMeshers_NumberOfLayers_i(thePOA,theStudyId,theGenImpl)
{
MESSAGE("StdMeshers_NumberOfLayers2D_i::StdMeshers_NumberOfLayers2D_i");
myBaseImpl = new ::StdMeshers_NumberOfLayers2D(theGenImpl->GetANewId(),
SMESH::double_array_var aRes = new SMESH::double_array();
const std::vector<double>& res = this->GetImpl()->BuildDistributionExpr( func, nbSeg, conv );
aRes->length( res.size() );
- for (int i = 0; i < res.size(); i++)
+ for (size_t i = 0; i < res.size(); i++)
aRes[i] = res[i];
return aRes._retn();
}
}
}
-SMESH::double_array* StdMeshers_NumberOfSegments_i::BuildDistributionTab( const SMESH::double_array& func,
- CORBA::Long nbSeg,
- CORBA::Long conv )
+SMESH::double_array*
+StdMeshers_NumberOfSegments_i::BuildDistributionTab( const SMESH::double_array& func,
+ CORBA::Long nbSeg,
+ CORBA::Long conv )
throw ( SALOME::SALOME_Exception )
{
ASSERT( myBaseImpl );
std::vector<double> tbl( func.length() );
- for (int i = 0; i < func.length(); i++)
+ for ( size_t i = 0; i < tbl.size(); i++ )
tbl[i] = func[i];
try
{
- SMESH::double_array_var aRes = new SMESH::double_array();
+ SMESH::double_array_var aRes = new SMESH::double_array();
const std::vector<double>& res = this->GetImpl()->BuildDistributionTab( tbl, nbSeg, conv );
aRes->length( res.size() );
- for (int i = 0; i < res.size(); i++)
+ for (size_t i = 0; i < res.size(); i++)
aRes[i] = res[i];
return aRes._retn();
}
SMESH::long_array_var anArray = new SMESH::long_array;
std::vector<int> ids = this->GetImpl()->GetReversedEdges();
anArray->length( ids.size() );
- for ( CORBA::Long i = 0; i < ids.size(); i++)
+ for ( size_t i = 0; i < ids.size(); i++)
anArray [ i ] = ids [ i ];
return anArray._retn();
{
ASSERT( myBaseImpl );
try {
+ CORBA::Long oldType = (CORBA::Long) this->GetImpl()->GetDistrType();
+
this->GetImpl()->SetDistrType( (::StdMeshers_NumberOfSegments::DistrType) typ );
// Update Python script
- SMESH::TPythonDump() << _this() << ".SetDistrType( " << typ << " )";
+ if ( oldType != typ )
+ SMESH::TPythonDump() << _this() << ".SetDistrType( " << typ << " )";
}
catch ( SALOME_Exception& S_ex ) {
THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
{
ASSERT( myBaseImpl );
std::vector<double> tbl( table.length() );
- for (int i = 0; i < table.length(); i++)
+ for ( CORBA::ULong i = 0; i < table.length(); i++)
tbl[i] = table[i];
try {
this->GetImpl()->SetTableFunction( tbl );
tbl = &this->GetImpl()->GetTableFunction();
}
catch ( SALOME_Exception& S_ex ) {
- THROW_SALOME_CORBA_EXCEPTION( S_ex.what(),
- SALOME::BAD_PARAM );
+ THROW_SALOME_CORBA_EXCEPTION( S_ex.what(), SALOME::BAD_PARAM );
}
SMESH::double_array_var aRes = new SMESH::double_array();
aRes->length(tbl->size());
- for (int i = 0; i < tbl->size(); i++)
+ for ( size_t i = 0; i < tbl->size(); i++ )
aRes[i] = (*tbl)[i];
return aRes._retn();
}
std::string str;
if (stream >> str) {
if ( StudyContext* myStudyContext = gen->GetCurrentStudyContext() ) {
- string ior = myStudyContext->getIORbyOldId( atoi( str.c_str() ));
+ std::string ior = myStudyContext->getIORbyOldId( atoi( str.c_str() ));
if ( !ior.empty() )
return TInterface::_narrow(gen->GetORB()->string_to_object( ior.c_str() ));
}
void StdMeshers_Reversible1D_i::SetObjectEntry( const char* theEntry )
{
- string entry(theEntry); // actually needed as theEntry is spoiled by moment of dumping
+ std::string entry(theEntry); // actually needed as theEntry is spoiled by moment of dumping
try {
this->GetImpl()->SetObjectEntry( entry.c_str() );
// Update Python script
SMESH::long_array_var anArray = new SMESH::long_array;
std::vector<int> ids = this->GetImpl()->GetReversedEdges();
anArray->length( ids.size() );
- for ( CORBA::Long i = 0; i < ids.size(); i++)
+ for ( CORBA::ULong i = 0; i < ids.size(); i++)
anArray [ i ] = ids [ i ];
return anArray._retn();
SMESH::long_array_var anArray = new SMESH::long_array;
std::vector<int> ids = this->GetImpl()->GetReversedEdges();
anArray->length( ids.size() );
- for ( CORBA::Long i = 0; i < ids.size(); i++)
+ for ( CORBA::ULong i = 0; i < ids.size(); i++)
anArray [ i ] = ids [ i ];
return anArray._retn();
# Je n arrive pas a utiliser le setEnvironment du QProcess
# fonctionne hors Salome mais pas dans Salome ???
cmds=''
- try :
- LICENCE_FILE=os.environ["DISTENE_LICENCE_FILE_FOR_MGCLEANER"]
- except:
- LICENCE_FILE=''
- try :
- PATH=os.environ["DISTENE_PATH_FOR_MGCLEANER"]
- except:
- PATH=''
- if LICENCE_FILE != '':
- cmds+='source '+LICENCE_FILE+'\n'
- else:
- cmds+="# $DISTENE_LICENCE_FILE_FOR_MGCLEANER NOT SET\n"
- if PATH != '':
- cmds+='export PATH='+PATH+':$PATH\n'
- else:
- cmds+="# $DISTENE_PATH_FOR_MGCLEANER NOT SET\n"
- #cmds+='env\n'
cmds+='rm -f '+self.parent().fichierOut+'\n'
cmds+=txt+'\n'
cmds+='echo END_OF_MGCleaner\n'
# Je n arrive pas a utiliser le setEnvironment du QProcess
# fonctionne hors Salome mais pas dans Salome ???
cmds=''
- try :
- LICENCE_FILE=os.environ["DISTENE_LICENCE_FILE_FOR_YAMS"]
- except:
- LICENCE_FILE=''
- try :
- PATH=os.environ["DISTENE_PATH_FOR_YAMS"]
- except:
- PATH=''
- if LICENCE_FILE != '':
- cmds+='source '+LICENCE_FILE+'\n'
- else:
- cmds+="# $DISTENE_LICENCE_FILE_FOR_YAMS NOT SET\n"
- if PATH != '':
- cmds+='export PATH='+PATH+':$PATH\n'
- else:
- cmds+="# $DISTENE_PATH_FOR_YAMS NOT SET\n"
- #cmds+='env\n'
cmds+='rm -f '+self.parent().fichierOut+'\n'
cmds+=txt+'\n'
cmds+='echo END_OF_Yams\n'
--- /dev/null
+# -*- coding: utf-8 -*-
+
+""" FissureLauncher:
+ Permet de lancer le script 'casStandard'
+ en fonction des paramètres contenus dans 'dicoParams'. """
+
+#import sys
+import salome
+
+#import os
+#from blocFissure import gmu
+from blocFissure.gmu import initLog
+initLog.setDebug()
+#initLog.setVerbose()
+
+from blocFissure.casStandard import casStandard
+
+mesh = 'ARE_sain_lin_rotated.med'
+crack = 'fissureExtrados.brep'
+
+dicoParams = dict(nomCas = 'fissTuyau',
+ maillageSain = '/local00/home/I48174/Documents/soudure/essaiFissure/{0}'.format(mesh),
+ brepFaceFissure = '/local00/home/I48174/Documents/soudure/essaiFissure/{0}'.format(crack),
+ edgeFissIds = [4],
+ lgInfluence = 12,
+ meshBrep = (0.05, 2.0),
+ rayonPipe = 1.0,
+ lenSegPipe = 1, #9,
+ nbSegRad = 8,
+ nbSegCercle = 20,
+ areteFaceFissure = 1.0)
+
+execInstance = casStandard(dicoParams)
+
+if salome.sg.hasDesktop():
+ salome.sg.updateObjBrowser(1)
--- /dev/null
+# -*- coding: utf-8 -*-
+
+""" FissureLauncher:
+ Permet de lancer le script 'casStandard'
+ en fonction des paramètres contenus dans 'dicoParams'. """
+
+#import sys
+import salome
+
+#import os
+#from blocFissure import gmu
+from blocFissure.gmu import initLog
+initLog.setDebug()
+#initLog.setVerbose()
+
+from blocFissure.casStandard import casStandard
+
+mesh = 'ARE_sain_lin_rotated.med'
+crack = 'fissureIntrados.brep'
+
+dicoParams = dict(nomCas = 'fissTuyau',
+ maillageSain = '/local00/home/I48174/Documents/soudure/essaiFissure/{0}'.format(mesh),
+ brepFaceFissure = '/local00/home/I48174/Documents/soudure/essaiFissure/{0}'.format(crack),
+ edgeFissIds = [4],
+ lgInfluence = 14,
+ meshBrep = (0.05, 2.0),
+ rayonPipe = 1.0,
+ lenSegPipe = 1, #9,
+ nbSegRad = 5,
+ nbSegCercle = 16,
+ areteFaceFissure = 1.0)
+
+execInstance = casStandard(dicoParams)
+
+if salome.sg.hasDesktop():
+ salome.sg.updateObjBrowser(1)
# scripts / static
SET(plugin_SCRIPTS
__init__.py
- casStandard.py
exemple.py
exemple2.py
)
# --- rules ---
-SALOME_INSTALL_SCRIPTS("${plugin_SCRIPTS}" ${SALOME_SMESH_INSTALL_PLUGINS}/blocFissure)
+SALOME_INSTALL_SCRIPTS("${plugin_SCRIPTS}" ${SALOME_INSTALL_PYTHON}/blocFissure)
__init__.py
cubeAngle2.py
cubeAngle.py
+ cubeCoin.py
+ cubeMilieu.py
+ cubeTransverse.py
cylindre_2.py
cylindre.py
disquePerce.py
# --- rules ---
-SALOME_INSTALL_SCRIPTS("${plugin_SCRIPTS}" ${SALOME_SMESH_INSTALL_PLUGINS}/blocFissure/CasTests)
+SALOME_INSTALL_SCRIPTS("${plugin_SCRIPTS}" ${SALOME_INSTALL_PYTHON}/blocFissure/CasTests)
from blocFissure.gmu.triedreBase import triedreBase
from blocFissure.gmu.genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut
from blocFissure.gmu.creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain
-from blocFissure.gmu.insereFissureGenerale import insereFissureGenerale
+from blocFissure.gmu.construitFissureGenerale import construitFissureGenerale
O, OX, OY, OZ = triedreBase()
# ---------------------------------------------------------------------------
def setParamShapeFissure(self):
"""
- paramètres de la fissure pour méthode insereFissureGenerale
+ paramètres de la fissure pour méthode construitFissureGenerale
lgInfluence : distance autour de la shape de fissure a remailler (A ajuster selon le maillage)
rayonPipe : le rayon du pile maillé en hexa autour du fond de fissure
"""
def genereMaillageFissure(self, geometriesSaines, maillagesSains,
shapesFissure, shapeFissureParams,
maillageFissureParams, elementsDefaut, step):
- maillageFissure = insereFissureGenerale(maillagesSains,
- shapesFissure, shapeFissureParams,
- maillageFissureParams, elementsDefaut, step)
+ maillageFissure = construitFissureGenerale(maillagesSains,
+ shapesFissure, shapeFissureParams,
+ maillageFissureParams, elementsDefaut, step)
return maillageFissure
# ---------------------------------------------------------------------------
# ---------------------------------------------------------------------------
def setParamShapeFissure(self):
"""
- paramètres de la fissure pour méthode insereFissureGenerale
+ paramètres de la fissure pour méthode construitFissureGenerale
lgInfluence : distance autour de la shape de fissure a remailler (A ajuster selon le maillage)
rayonPipe : le rayon du pile maillé en hexa autour du fond de fissure
"""
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import os
+from blocFissure import gmu
+
+dicoParams = dict(nomCas = 'cubeCoin',
+ maillageSain = os.path.join(gmu.pathBloc, 'materielCasTests/cubeFin.med'),
+ brepFaceFissure = os.path.join(gmu.pathBloc, "materielCasTests/cubeFin_Coin.brep"),
+ edgeFissIds = [7],
+ lgInfluence = 50,
+ meshBrep = (5,10),
+ rayonPipe = 10,
+ lenSegPipe = 7,
+ nbSegRad = 5,
+ nbSegCercle = 10,
+ areteFaceFissure = 20)
+
+ # ---------------------------------------------------------------------------
+
+referencesMaillageFissure = dict(Entity_Quad_Pyramid = 0,
+ Entity_Quad_Triangle = 0,
+ Entity_Quad_Edge = 0,
+ Entity_Quad_Penta = 0,
+ Entity_Quad_Hexa = 0,
+ Entity_Node = 0,
+ Entity_Quad_Tetra = 0,
+ Entity_Quad_Quadrangle = 0)
+
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import os
+from blocFissure import gmu
+
+dicoParams = dict(nomCas = 'cubeMilieu',
+ maillageSain = os.path.join(gmu.pathBloc, 'materielCasTests/cubeFin.med'),
+ brepFaceFissure = os.path.join(gmu.pathBloc, "materielCasTests/cubeFin_Milieu.brep"),
+ edgeFissIds = [7],
+ lgInfluence = 50,
+ meshBrep = (5,10),
+ rayonPipe = 10,
+ lenSegPipe = 7,
+ nbSegRad = 5,
+ nbSegCercle = 10,
+ areteFaceFissure = 10)
+
+# ---------------------------------------------------------------------------
+
+referencesMaillageFissure = dict(Entity_Quad_Pyramid = 0,
+ Entity_Quad_Triangle = 0,
+ Entity_Quad_Edge = 0,
+ Entity_Quad_Penta = 0,
+ Entity_Quad_Hexa = 0,
+ Entity_Node = 0,
+ Entity_Quad_Tetra = 0,
+ Entity_Quad_Quadrangle = 0)
+
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import os
+from blocFissure import gmu
+
+dicoParams = dict(nomCas = 'cubeTransverse',
+ maillageSain = os.path.join(gmu.pathBloc, 'materielCasTests/cubeFin.med'),
+ brepFaceFissure = os.path.join(gmu.pathBloc, "materielCasTests/cubeFin_Transverse.brep"),
+ edgeFissIds = [6],
+ lgInfluence = 50,
+ meshBrep = (5,10),
+ rayonPipe = 10,
+ lenSegPipe = 7,
+ nbSegRad = 5,
+ nbSegCercle = 10,
+ areteFaceFissure = 10)
+
+# ---------------------------------------------------------------------------
+
+referencesMaillageFissure = dict(Entity_Quad_Pyramid = 0,
+ Entity_Quad_Triangle = 0,
+ Entity_Quad_Edge = 0,
+ Entity_Quad_Penta = 0,
+ Entity_Quad_Hexa = 0,
+ Entity_Node = 0,
+ Entity_Quad_Tetra = 0,
+ Entity_Quad_Quadrangle = 0)
+
from blocFissure.gmu.triedreBase import triedreBase
from blocFissure.gmu.genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut
from blocFissure.gmu.creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain
-from blocFissure.gmu.insereFissureGenerale import insereFissureGenerale
+from blocFissure.gmu.construitFissureGenerale import construitFissureGenerale
O, OX, OY, OZ = triedreBase()
# ---------------------------------------------------------------------------
def setParamShapeFissure(self):
"""
- paramètres de la fissure pour méthode insereFissureGenerale
+ paramètres de la fissure pour méthode construitFissureGenerale
lgInfluence : distance autour de la shape de fissure a remailler (A ajuster selon le maillage)
rayonPipe : le rayon du pile maillé en hexa autour du fond de fissure
"""
def genereMaillageFissure(self, geometriesSaines, maillagesSains,
shapesFissure, shapeFissureParams,
maillageFissureParams, elementsDefaut, step):
- maillageFissure = insereFissureGenerale(maillagesSains,
- shapesFissure, shapeFissureParams,
- maillageFissureParams, elementsDefaut, step)
+ maillageFissure = construitFissureGenerale(maillagesSains,
+ shapesFissure, shapeFissureParams,
+ maillageFissureParams, elementsDefaut, step)
return maillageFissure
# ---------------------------------------------------------------------------
from blocFissure.gmu.triedreBase import triedreBase
from blocFissure.gmu.genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut
from blocFissure.gmu.creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain
-from blocFissure.gmu.insereFissureGenerale import insereFissureGenerale
+from blocFissure.gmu.construitFissureGenerale import construitFissureGenerale
O, OX, OY, OZ = triedreBase()
from blocFissure.gmu.triedreBase import triedreBase
from blocFissure.gmu.genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut
from blocFissure.gmu.creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain
-from blocFissure.gmu.insereFissureGenerale import insereFissureGenerale
+from blocFissure.gmu.construitFissureGenerale import construitFissureGenerale
O, OX, OY, OZ = triedreBase()
# ---------------------------------------------------------------------------
def setParamShapeFissure(self):
"""
- paramètres de la fissure pour méthode insereFissureGenerale
+ paramètres de la fissure pour méthode construitFissureGenerale
lgInfluence : distance autour de la shape de fissure a remailler (A ajuster selon le maillage)
rayonPipe : le rayon du pile maillé en hexa autour du fond de fissure
convexe : optionnel, True : la face est convexe (vue de l'exterieur) sert si on ne donne pas de point interne
def genereMaillageFissure(self, geometriesSaines, maillagesSains,
shapesFissure, shapeFissureParams,
maillageFissureParams, elementsDefaut, step):
- maillageFissure = insereFissureGenerale(maillagesSains,
- shapesFissure, shapeFissureParams,
- maillageFissureParams, elementsDefaut, step)
+ maillageFissure = construitFissureGenerale(maillagesSains,
+ shapesFissure, shapeFissureParams,
+ maillageFissureParams, elementsDefaut, step)
return maillageFissure
# ---------------------------------------------------------------------------
from blocFissure.gmu.triedreBase import triedreBase
from blocFissure.gmu.genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut
from blocFissure.gmu.creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain
-from blocFissure.gmu.insereFissureGenerale import insereFissureGenerale
+from blocFissure.gmu.construitFissureGenerale import construitFissureGenerale
O, OX, OY, OZ = triedreBase()
from blocFissure.gmu.triedreBase import triedreBase
from blocFissure.gmu.genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut
from blocFissure.gmu.creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain
-from blocFissure.gmu.insereFissureGenerale import insereFissureGenerale
+from blocFissure.gmu.construitFissureGenerale import construitFissureGenerale
O, OX, OY, OZ = triedreBase()
# ---------------------------------------------------------------------------
def setParamShapeFissure(self):
"""
- paramètres de la fissure pour méthode insereFissureGenerale
+ paramètres de la fissure pour méthode construitFissureGenerale
lgInfluence : distance autour de la shape de fissure a remailler (A ajuster selon le maillage)
rayonPipe : le rayon du pile maillé en hexa autour du fond de fissure
convexe : optionnel True : la face est convexe (vue de l'exterieur) sert si on ne donne pas de point interne
def genereMaillageFissure(self, geometriesSaines, maillagesSains,
shapesFissure, shapeFissureParams,
maillageFissureParams, elementsDefaut, step):
- maillageFissure = insereFissureGenerale(maillagesSains,
- shapesFissure, shapeFissureParams,
- maillageFissureParams, elementsDefaut, step)
+ maillageFissure = construitFissureGenerale(maillagesSains,
+ shapesFissure, shapeFissureParams,
+ maillageFissureParams, elementsDefaut, step)
return maillageFissure
# ---------------------------------------------------------------------------
from blocFissure.gmu.triedreBase import triedreBase
from blocFissure.gmu.genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut
from blocFissure.gmu.creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain
-from blocFissure.gmu.insereFissureGenerale import insereFissureGenerale
+from blocFissure.gmu.construitFissureGenerale import construitFissureGenerale
O, OX, OY, OZ = triedreBase()
# ---------------------------------------------------------------------------
def setParamShapeFissure(self):
"""
- paramètres de la fissure pour méthode insereFissureGenerale
+ paramètres de la fissure pour méthode construitFissureGenerale
lgInfluence : distance autour de la shape de fissure a remailler (A ajuster selon le maillage)
rayonPipe : le rayon du pile maillé en hexa autour du fond de fissure
convexe : optionnel True : la face est convexe (vue de l'exterieur) sert si on ne donne pas de point interne
def genereMaillageFissure(self, geometriesSaines, maillagesSains,
shapesFissure, shapeFissureParams,
maillageFissureParams, elementsDefaut, step):
- maillageFissure = insereFissureGenerale(maillagesSains,
- shapesFissure, shapeFissureParams,
- maillageFissureParams, elementsDefaut, step)
+ maillageFissure = construitFissureGenerale(maillagesSains,
+ shapesFissure, shapeFissureParams,
+ maillageFissureParams, elementsDefaut, step)
return maillageFissure
# ---------------------------------------------------------------------------
from blocFissure.gmu.triedreBase import triedreBase
from blocFissure.gmu.genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut
from blocFissure.gmu.creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain
-from blocFissure.gmu.insereFissureGenerale import insereFissureGenerale
+from blocFissure.gmu.construitFissureGenerale import construitFissureGenerale
O, OX, OY, OZ = triedreBase()
# -*- coding: utf-8 -*-
import sys, traceback
+import logging
from blocFissure import gmu
from blocFissure.gmu import initLog
+
+# -----------------------------------------------------------------------------------------------
#initLog.setDebug()
initLog.setVerbose()
+#initLog.setRelease()
+#initLog.setPerfTests()
+
+# ---tous les cas en sequence, ou les cas selectionnés ...
+runall = True
+if runall:
+ torun = [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,]
+else: #prob 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27
+ torun = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,]
+# -----------------------------------------------------------------------------------------------
from blocFissure.gmu import geomsmesh
-from blocFissure.casStandard import casStandard
+from blocFissure.gmu.casStandard import casStandard
problemes = []
from blocFissure.CasTests.vis_1 import vis_1
problemes.append(vis_1(cas))
-# ---tous les cas en sequence, ou les cas selectionnés ...
-runall = True
-if runall:
- torun = [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,]
-else: #prob 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24
- torun = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,]
+cas=25
+from blocFissure.CasTests import cubeCoin
+problemes.append(casStandard(cubeCoin.dicoParams, cubeCoin.referencesMaillageFissure, cas))
+
+cas=26
+from blocFissure.CasTests import cubeMilieu
+problemes.append(casStandard(cubeMilieu.dicoParams, cubeMilieu.referencesMaillageFissure, cas))
+
+cas=27
+from blocFissure.CasTests import cubeTransverse
+problemes.append(casStandard(cubeTransverse.dicoParams, cubeTransverse.referencesMaillageFissure, cas))
+
for i in range(len(problemes)):
if torun[i]:
+ logging.critical("=== Execution cas %s", i)
try:
problemes[i].executeProbleme()
except:
from blocFissure.gmu.triedreBase import triedreBase
from blocFissure.gmu.genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut
from blocFissure.gmu.creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain
-from blocFissure.gmu.insereFissureGenerale import insereFissureGenerale
+from blocFissure.gmu.construitFissureGenerale import construitFissureGenerale
O, OX, OY, OZ = triedreBase()
# ---------------------------------------------------------------------------
def setParamShapeFissure(self):
"""
- paramètres de la fissure pour méthode insereFissureGenerale
+ paramètres de la fissure pour méthode construitFissureGenerale
lgInfluence : distance autour de la shape de fissure a remailler (A ajuster selon le maillage)
rayonPipe : le rayon du pile maillé en hexa autour du fond de fissure
convexe : optionnel True : la face est convexe (vue de l'exterieur) sert si on ne donne pas de point interne
def genereMaillageFissure(self, geometriesSaines, maillagesSains,
shapesFissure, shapeFissureParams,
maillageFissureParams, elementsDefaut, step):
- maillageFissure = insereFissureGenerale(maillagesSains,
- shapesFissure, shapeFissureParams,
- maillageFissureParams, elementsDefaut, step)
+ maillageFissure = construitFissureGenerale(maillagesSains,
+ shapesFissure, shapeFissureParams,
+ maillageFissureParams, elementsDefaut, step)
return maillageFissure
# ---------------------------------------------------------------------------
from blocFissure.gmu.triedreBase import triedreBase
from blocFissure.gmu.genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut
from blocFissure.gmu.creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain
-from blocFissure.gmu.insereFissureGenerale import insereFissureGenerale
+from blocFissure.gmu.construitFissureGenerale import construitFissureGenerale
O, OX, OY, OZ = triedreBase()
# ---------------------------------------------------------------------------
def setParamShapeFissure(self):
"""
- paramètres de la fissure pour méthode insereFissureGenerale
+ paramètres de la fissure pour méthode construitFissureGenerale
lgInfluence : distance autour de la shape de fissure a remailler (A ajuster selon le maillage)
rayonPipe : le rayon du pile maillé en hexa autour du fond de fissure
convexe : optionnel True : la face est convexe (vue de l'exterieur) sert si on ne donne pas de point interne
shellFiss = geompy.ImportFile(os.path.join(gmu.pathBloc, "materielCasTests/faceGauche2FissCoupe.brep"), "BREP")
fondFiss = geompy.CreateGroup(shellFiss, geompy.ShapeType["EDGE"])
- geompy.UnionIDs(fondFiss, [12, 4])
+ geompy.UnionIDs(fondFiss, [14, 9])
geompy.addToStudy( shellFiss, 'shellFiss' )
geompy.addToStudyInFather( shellFiss, fondFiss, 'fondFiss' )
def genereMaillageFissure(self, geometriesSaines, maillagesSains,
shapesFissure, shapeFissureParams,
maillageFissureParams, elementsDefaut, step):
- maillageFissure = insereFissureGenerale(maillagesSains,
- shapesFissure, shapeFissureParams,
- maillageFissureParams, elementsDefaut, step)
+ maillageFissure = construitFissureGenerale(maillagesSains,
+ shapesFissure, shapeFissureParams,
+ maillageFissureParams, elementsDefaut, step)
return maillageFissure
# ---------------------------------------------------------------------------
pointIn_x : optionnel coordonnées x d'un point dans le solide, pas trop loin du centre du fond de fissure (idem y,z)
externe : True : fissure face externe, False : fissure face interne
"""
- print "setParamShapeFissure", self.nomCas
self.shapeFissureParams = dict(profondeur = 10,
rayonPipe = 2.5,
lenSegPipe = 2.5,
pointIn_x : optionnel coordonnées x d'un point dans le solide, pas trop loin du centre du fond de fissure (idem y,z)
externe : True : fissure face externe, False : fissure face interne
"""
-# logging.info("setParamShapeFissure %s", self.nomCas)
self.shapeFissureParams = dict(profondeur = 2.5,
rayonPipe = 1.5,
lenSegPipe = 6,
pointIn_x : optionnel coordonnées x d'un point dans le solide, pas trop loin du centre du fond de fissure (idem y,z)
externe : True : fissure face externe, False : fissure face interne
"""
- print "setParamShapeFissure", self.nomCas
self.shapeFissureParams = dict(profondeur = 10,
rayonPipe = 2.5,
lenSegPipe = 2.5,
pointIn_x : optionnel coordonnées x d'un point dans le solide, pas trop loin du centre du fond de fissure (idem y,z)
externe : True : fissure face externe, False : fissure face interne
"""
- print "setParamShapeFissure", self.nomCas
self.shapeFissureParams = dict(profondeur = 10,
rayonPipe = 2.5,
lenSegPipe = 2.5,
pointIn_x : optionnel coordonnées x d'un point dans le solide, pas trop loin du centre du fond de fissure (idem y,z)
externe : True : fissure face externe, False : fissure face interne
"""
- print "setParamShapeFissure", self.nomCas
self.shapeFissureParams = dict(profondeur = 10,
rayonPipe = 2.5,
lenSegPipe =2.5,
pointIn_x : optionnel coordonnées x d'un point dans le solide, pas trop loin du centre du fond de fissure (idem y,z)
externe : True : fissure face externe, False : fissure face interne
"""
- print "setParamShapeFissure", self.nomCas
self.shapeFissureParams = dict(profondeur = 10,
rayonPipe = 2.5,
lenSegPipe = 2.5,
nomFicSain = self.nomCas,
nomFicFissure = 'fissure_' + self.nomCas,
nbsegRad = 5,
- nbsegCercle = 6,
+ nbsegCercle = 8,
areteFaceFissure = 5)
# ---------------------------------------------------------------------------
pointIn_x : optionnel coordonnées x d'un point dans le solide, pas trop loin du centre du fond de fissure (idem y,z)
externe : True : fissure face externe, False : fissure face interne
"""
- print "setParamShapeFissure", self.nomCas
self.shapeFissureParams = dict(profondeur = 10,
rayonPipe = 4,
lenSegPipe = 4,
pointIn_x : optionnel coordonnées x d'un point dans le solide, pas trop loin du centre du fond de fissure (idem y,z)
externe : True : fissure face externe, False : fissure face interne
"""
-# logging.info("setParamShapeFissure %s", self.nomCas)
self.shapeFissureParams = dict(profondeur = 10,
rayonPipe = 4,
lenSegPipe = 4,
pointIn_x : optionnel coordonnées x d'un point dans le solide, pas trop loin du centre du fond de fissure (idem y,z)
externe : True : fissure face externe, False : fissure face interne
"""
-# logging.info("setParamShapeFissure %s", self.nomCas)
self.shapeFissureParams = dict(profondeur = 8,
rayonPipe = 1,
lenSegPipe = 1.5,
pointIn_x : optionnel coordonnées x d'un point dans le solide, pas trop loin du centre du fond de fissure (idem y,z)
externe : True : fissure face externe, False : fissure face interne
"""
- print "setParamShapeFissure", self.nomCas
self.shapeFissureParams = dict(profondeur = 10,
rayonPipe = 2,
lenSegPipe = 6,
from blocFissure.gmu.triedreBase import triedreBase
from blocFissure.gmu.genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut
from blocFissure.gmu.creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain
-from blocFissure.gmu.insereFissureGenerale import insereFissureGenerale
+from blocFissure.gmu.construitFissureGenerale import construitFissureGenerale
O, OX, OY, OZ = triedreBase()
# ---------------------------------------------------------------------------
def setParamShapeFissure(self):
"""
- paramètres de la fissure pour méthode insereFissureGenerale
+ paramètres de la fissure pour méthode construitFissureGenerale
lgInfluence : distance autour de la shape de fissure a remailler (A ajuster selon le maillage)
rayonPipe : le rayon du pile maillé en hexa autour du fond de fissure
convexe : optionnel True : la face est convexe (vue de l'exterieur) sert si on ne donne pas de point interne
shellFiss = geompy.ImportFile(os.path.join(gmu.pathBloc, "materielCasTests/visFiss.brep"), "BREP")
fondFiss = geompy.CreateGroup(shellFiss, geompy.ShapeType["EDGE"])
- geompy.UnionIDs(fondFiss, [4, 7, 9])
+ geompy.UnionIDs(fondFiss, [7, 9])
geompy.addToStudy( shellFiss, 'shellFiss' )
geompy.addToStudyInFather( shellFiss, fondFiss, 'fondFiss' )
def genereMaillageFissure(self, geometriesSaines, maillagesSains,
shapesFissure, shapeFissureParams,
maillageFissureParams, elementsDefaut, step):
- maillageFissure = insereFissureGenerale(maillagesSains,
- shapesFissure, shapeFissureParams,
- maillageFissureParams, elementsDefaut, step)
+ maillageFissure = construitFissureGenerale(maillagesSains,
+ shapesFissure, shapeFissureParams,
+ maillageFissureParams, elementsDefaut, step)
return maillageFissure
# ---------------------------------------------------------------------------
Exécution des exemples et cas tests :
-------------------------------------
+=====================================
- lancer salome
-- exécuter les instructions suivantes dans la console Python embarquée, ou dans une console Python avec l'environnement SALOME
- # les shapes et fichiers med nécessaires aux tests sont créés dans ${SMESH_ROOT_DIR}/share/salome/plugins/smesh/blocFissure/CasTests
+- exécuter les instructions suivantes dans la console Python embarquée,
+ ou dans une console Python avec l'environnement SALOME (salome shell)
+
+ # les shapes et fichiers med nécessaires aux tests sont créés dans
+ ${SMESH_ROOT_DIR}/lib/python2.7/site-packages/salome/blocFissure/CasTests
+
# les maillages fissurés sont écrits dans le répertoire d'exécution.
-# preparation des shapes et fichiers MED
+# préparation des shapes et fichiers MED
+----------------------------------------
-import sys, os
-sys.path.append(os.path.join(os.environ["SMESH_ROOT_DIR"], "share", "salome", "plugins", "smesh"))
from blocFissure.materielCasTests import genereMateriel
-# execution exemples
+# exécution exemple
+-------------------
-from blocFissure import exemple
from blocFissure import exemple
-# execution des cas tests
+# exécution des cas tests (long: 1/2 heure)
+-------------------------------------------
from blocFissure.CasTests import execution_Cas
+# bug et problèmes des cas tests
+--------------------------------
+
+Mauvaise détection d'arête vive avec GetInPlace : cas 7, 24
+
+Le maillage longitudinal du pipe peut creer des mailles de faible épaisseur
+à une des extrémités : le maillage en triangles des faces de fissure et de peau
+peut être moche au voisinage, de même que les tétraèdres qui s'appuient dessus.
+(2,3,16,26 ?)
+++ /dev/null
-# -*- coding: utf-8 -*-
-
-import os
-from blocFissure import gmu
-from blocFissure.gmu.geomsmesh import geompy, smesh
-
-import math
-import GEOM
-import SALOMEDS
-import SMESH
-#import StdMeshers
-#import GHS3DPlugin
-#import NETGENPlugin
-import logging
-
-from blocFissure.gmu.fissureGenerique import fissureGenerique
-
-from blocFissure.gmu.initEtude import initEtude
-from blocFissure.gmu.triedreBase import triedreBase
-from blocFissure.gmu.genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut
-from blocFissure.gmu.creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain
-from blocFissure.gmu.insereFissureGenerale import insereFissureGenerale
-
-O, OX, OY, OZ = triedreBase()
-
-class casStandard(fissureGenerique):
- """
- problème de fissure standard, défini par :
- - un maillage sain (hexaèdres),
- - une face géométrique de fissure, qui doit légèrement dépasser hors du volume maillé
- - les numéros d'arêtes (edges géométriques) correspondant au fond de fissure
- - les paramètres de maillage de la fissure
- """
-
- # ---------------------------------------------------------------------------
- def __init__ (self, dicoParams, references = None, numeroCas = 0):
- initEtude()
- self.references = references
- self.dicoParams = dicoParams
- if self.dicoParams.has_key('nomCas'):
- self.nomCas = self.dicoParams['nomCas']
- else:
- self.nomCas = 'casStandard'
- self.numeroCas = numeroCas
- if self.numeroCas != 0:
- self.nomCas = self.nomProbleme +"_%d"%(self.numeroCas)
- else:
- self.nomProbleme = self.nomCas
- if self.dicoParams.has_key('lenSegPipe'):
- self.lenSegPipe = self.dicoParams['lenSegPipe']
- else:
- self.lenSegPipe =self.dicoParams['rayonPipe']
- if self.dicoParams.has_key('step'):
- step = self.dicoParams['step']
- else:
- step = -1 # exécuter toutes les étapes
- if self.numeroCas == 0: # valeur par défaut : exécution immédiate, sinon execution différée dans le cas d'une liste de problèmes
- self.executeProbleme(step)
-
- # ---------------------------------------------------------------------------
- def genereMaillageSain(self, geometriesSaines, meshParams):
- logging.info("genereMaillageSain %s", self.nomCas)
-
- ([objetSain], status) = smesh.CreateMeshesFromMED(self.dicoParams['maillageSain'])
- smesh.SetName(objetSain.GetMesh(), 'objetSain')
-
- return [objetSain, True] # True : maillage hexa
-
- # ---------------------------------------------------------------------------
- def setParamShapeFissure(self):
- """
- paramètres de la fissure pour méthode insereFissureGenerale
- lgInfluence : distance autour de la shape de fissure a remailler (A ajuster selon le maillage)
- rayonPipe : le rayon du pile maillé en hexa autour du fond de fissure
- convexe : True : la face est convexe (vue de l'exterieur) sert si on ne donne pas de point interne
- pointIn_x : optionnel : coordonnée x d'un point dans le solide sain (pour orienter la face - idem avec y,z)
- """
- logging.info("setParamShapeFissure %s", self.nomCas)
- if self.dicoParams.has_key('pointInterieur'):
- self.shapeFissureParams = dict(lgInfluence = self.dicoParams['lgInfluence'],
- rayonPipe = self.dicoParams['rayonPipe'],
- lenSegPipe = self.lenSegPipe,
- pointIn_x = self.dicoParams['pointInterieur'][0],
- pointIn_y = self.dicoParams['pointInterieur'][1],
- pointIn_z = self.dicoParams['pointInterieur'][2])
- else:
- self.shapeFissureParams = dict(lgInfluence = self.dicoParams['lgInfluence'],
- rayonPipe = self.dicoParams['rayonPipe'],
- lenSegPipe = self.lenSegPipe)
-
- # ---------------------------------------------------------------------------
- def genereShapeFissure( self, geometriesSaines, geomParams, shapeFissureParams):
- logging.info("genereShapeFissure %s", self.nomCas)
-
- lgInfluence = shapeFissureParams['lgInfluence']
-
- shellFiss = geompy.ImportFile( self.dicoParams['brepFaceFissure'], "BREP")
- fondFiss = geompy.CreateGroup(shellFiss, geompy.ShapeType["EDGE"])
- geompy.UnionIDs(fondFiss, self.dicoParams['edgeFissIds'] )
- geompy.addToStudy( shellFiss, 'shellFiss' )
- geompy.addToStudyInFather( shellFiss, fondFiss, 'fondFiss' )
-
-
- coordsNoeudsFissure = genereMeshCalculZoneDefaut(shellFiss, self.dicoParams['meshBrep'][0] ,self.dicoParams['meshBrep'][1])
-
- centre = None
- return [shellFiss, centre, lgInfluence, coordsNoeudsFissure, fondFiss]
-
- # ---------------------------------------------------------------------------
- def setParamMaillageFissure(self):
- self.maillageFissureParams = dict(nomRep = '.',
- nomFicSain = self.nomCas,
- nomFicFissure = 'fissure_' + self.nomCas,
- nbsegRad = self.dicoParams['nbSegRad'],
- nbsegCercle = self.dicoParams['nbSegCercle'],
- areteFaceFissure = self.dicoParams['areteFaceFissure'])
-
- # ---------------------------------------------------------------------------
- def genereZoneDefaut(self, geometriesSaines, maillagesSains, shapesFissure, shapeFissureParams, maillageFissureParams):
- elementsDefaut = creeZoneDefautDansObjetSain(geometriesSaines, maillagesSains, shapesFissure, shapeFissureParams, maillageFissureParams)
- return elementsDefaut
-
- # ---------------------------------------------------------------------------
- def genereMaillageFissure(self, geometriesSaines, maillagesSains,
- shapesFissure, shapeFissureParams,
- maillageFissureParams, elementsDefaut, step):
- maillageFissure = insereFissureGenerale(maillagesSains,
- shapesFissure, shapeFissureParams,
- maillageFissureParams, elementsDefaut, step)
- return maillageFissure
-
- # ---------------------------------------------------------------------------
- def setReferencesMaillageFissure(self):
- if self.references is not None:
- self.referencesMaillageFissure = self.references
- else:
- self.referencesMaillageFissure = dict(Entity_Quad_Pyramid = 0,
- Entity_Quad_Triangle = 0,
- Entity_Quad_Edge = 0,
- Entity_Quad_Penta = 0,
- Entity_Quad_Hexa = 0,
- Entity_Node = 0,
- Entity_Quad_Tetra = 0,
- Entity_Quad_Quadrangle = 0)
-
initLog.setDebug()
#initLog.setVerbose()
-from blocFissure.casStandard import casStandard
+from blocFissure.gmu.casStandard import casStandard
dicoParams = dict(nomCas = 'angleCube',
maillageSain = os.path.join(gmu.pathBloc, 'materielCasTests/CubeAngle.med'),
#initLog.setDebug()
initLog.setVerbose()
-from blocFissure.casStandard import casStandard
+from blocFissure.gmu.casStandard import casStandard
dicoParams = dict(nomCas = 'angleCube2',
maillageSain = 'boite.med',
brepFaceFissure = "disk.brep",
edgeFissIds = [4],
- lgInfluence = 20,
+ lgInfluence = 50,
meshBrep = (5,10),
- rayonPipe = 10,
+ rayonPipe = 15,
+ lenSegPipe = 20,
nbSegRad = 5,
- nbSegCercle = 8,
- areteFaceFissure = 10)
+ nbSegCercle = 12,
+ areteFaceFissure = 2)
execInstance = casStandard(dicoParams)
--- /dev/null
+# -*- coding: utf-8 -*-
+
+""" FissureLauncher:
+ Permet de lancer le script 'casStandard'
+ en fonction des paramètres contenus dans 'dicoParams'. """
+
+#import sys
+import salome
+
+#import os
+#from blocFissure import gmu
+from blocFissure.gmu import initLog
+initLog.setDebug()
+#initLog.setVerbose()
+
+from blocFissure.casStandard import casStandard
+
+mesh = 'maillageSainTuyauFEM.med'
+crack = 'fissureQuartEllipse.brep'
+
+dicoParams = dict(nomCas = 'fissTuyau',
+ maillageSain = '/local00/home/I48174/Bureau/supportMaillage/{0}'.format(mesh),
+ brepFaceFissure = '/local00/home/I48174/Bureau/supportMaillage/{0}'.format(crack),
+ edgeFissIds = [9],
+ lgInfluence = 250,
+ meshBrep = (10, 50),
+ rayonPipe = 35,
+ lenSegPipe = 7, #9,
+ nbSegRad = 6,
+ nbSegCercle = 30,
+ areteFaceFissure = 20)
+
+execInstance = casStandard(dicoParams)
+
+if salome.sg.hasDesktop():
+ salome.sg.updateObjBrowser(1)
\ No newline at end of file
# scripts / static
SET(plugin_SCRIPTS
__init__.py
+ ajustePointsEdgePipeFissure.py
blocDefaut.py
+ calculePointsAxiauxPipe.py
+ casStandard.py
checkDecoupePartition.py
commonSubShapes.py
+ compoundFromList.py
+ construitEdgesRadialesDebouchantes.py
+ construitFissureGenerale.py
+ construitMaillagePipe.py
+ construitPartitionsPeauFissure.py
+ creePointsPipePeau.py
creeZoneDefautDansObjetSain.py
creeZoneDefautFilling.py
creeZoneDefautGeom.py
creeZoneDefautMaillage.py
distance2.py
eliminateDoubles.py
+ elimineExtremitesPipe.py
ellipsoideDefaut.py
enleveDefaut.py
extractionOrienteeMulti.py
findWireIntermediateVertices.py
fissureCoude.py
fissureGenerique.py
+ fusionMaillageAttributionDefaut.py
genereElemsFissureElliptique.py
genereMeshCalculZoneDefaut.py
geomsmesh.py
getCentreFondFiss.py
getStatsMaillageFissure.py
getSubshapeIds.py
+ identifieEdgesPeau.py
+ identifieElementsDebouchants.py
+ identifieElementsFissure.py
+ identifieElementsGeometriquesPeau.py
+ identifieFacesEdgesFissureExterne.py
+ identifieFacesPeau.py
initEtude.py
initLog.py
insereFissureElliptique.py
insereFissureGenerale.py
insereFissureLongue.py
+ listOfExtraFunctions.py
+ mailleAretesEtJonction.py
+ mailleFacesFissure.py
+ mailleFacesPeau.py
meshBlocPart.py
orderEdgesFromWire.py
partitionBlocDefaut.py
+ partitionneFissureParPipe.py
partitionVolumeSain.py
peauInterne.py
produitMixte.py
prolongeWire.py
propagateTore.py
putName.py
+ quadranglesToShapeNoCorner.py
quadranglesToShape.py
+ quadranglesToShapeWithCorner.py
regroupeSainEtDefaut.py
+ restreintFaceFissure.py
rotTrans.py
shapesSurFissure.py
shapeSurFissure.py
testgmu.py
toreFissure.py
triedreBase.py
+ trouveEdgesFissPeau.py
whichSideMulti.py
whichSide.py
whichSideVertex.py
# --- rules ---
-SALOME_INSTALL_SCRIPTS("${plugin_SCRIPTS}" ${SALOME_SMESH_INSTALL_PLUGINS}/blocFissure/gmu)
+SALOME_INSTALL_SCRIPTS("${plugin_SCRIPTS}" ${SALOME_INSTALL_PYTHON}/blocFissure/gmu)
import os
import initLog
-#initLog.setDebug()
-#initLog.setVerbose()
-#initLog.setRelease()
# --- calcul path blocFissure
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import logging
+
+from geomsmesh import geompy
+from findWireIntermediateVertices import findWireIntermediateVertices
+from projettePointSurCourbe import projettePointSurCourbe
+
+def ajustePointsEdgePipeFissure(edgesPipeFissureExterneC, wirePipeFissureExterne, gptsdisks, idisklim):
+ """
+ ajustement precis des points sur edgesPipeFissureExterneC
+ """
+ logging.info('start')
+
+ edgesPFE = geompy.ExtractShapes(edgesPipeFissureExterneC, geompy.ShapeType["EDGE"], False)
+ verticesPFE = findWireIntermediateVertices(wirePipeFissureExterne) # vertices intermédiaires (des points en trop dans ptsInWireFissExtPipe)
+ idiskmin = idisklim[0] + 1 # on ne prend pas le disque sur la peau, déjà ajusté
+ idiskmax = idisklim[1] # on ne prend pas le disque sur la peau, déjà ajusté
+ idiskint = []
+ for vtx in verticesPFE:
+ distPtVt = []
+ for idisk in range(idiskmin, idiskmax):
+ gptdsk = gptsdisks[idisk]
+ pt = gptdsk[0][-1] # le point sur l'edge de la fissure externe au pipe
+ distPtVt.append((geompy.MinDistance(pt, vtx), idisk))
+ distPtVt.sort()
+ idiskint.append(distPtVt[0][1])
+ gptsdisks[idiskint[-1]][0][-1] = vtx
+ logging.debug("ajustement point sur edgePipeFissureExterne, vertex: %s %s", idiskint[-1], distPtVt[0][0])
+ for idisk in range(idiskmin, idiskmax):
+ if idisk in idiskint:
+ break
+ logging.debug("ajustement point sur edgePipeFissureExterne: %s", idisk)
+ gptdsk = gptsdisks[idisk]
+ pt = gptdsk[0][-1] # le point sur l'edge de la fissure externe au pipe
+ distPtEd = [(geompy.MinDistance(pt, edgePFE), k, edgePFE) for k, edgePFE in enumerate(edgesPFE)]
+ distPtEd.sort()
+ edgePFE = distPtEd[0][2]
+ u = projettePointSurCourbe(pt, edgePFE)
+ ptproj = geompy.MakeVertexOnCurve(edgePFE, u)
+ gptsdisks[idisk][0][-1] = ptproj
+
+ return gptsdisks
\ No newline at end of file
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import logging
+import math
+
+from geomsmesh import geompy
+from geomsmesh import smesh
+
+def calculePointsAxiauxPipe(edgesFondFiss, edgesIdByOrientation, facesDefaut,
+ centreFondFiss, wireFondFiss, wirePipeFiss,
+ lenSegPipe, rayonPipe, nbsegCercle, nbsegRad):
+ """
+ preparation maillage du pipe :
+ - détections des points a respecter : jonction des edges/faces constituant
+ la face de fissure externe au pipe
+ - points sur les edges de fond de fissure et edges pipe/face fissure,
+ - vecteurs tangents au fond de fissure (normal au disque maillé)
+ """
+
+ logging.info('start')
+
+ # --- option de maillage selon le rayon de courbure du fond de fissure
+ lenEdgeFondExt = 0
+ for edff in edgesFondFiss:
+ lenEdgeFondExt += geompy.BasicProperties(edff)[0]
+
+ disfond = []
+ for filling in facesDefaut:
+ disfond.append(geompy.MinDistance(centreFondFiss, filling))
+ disfond.sort()
+ rcourb = disfond[0]
+ nbSegQuart = 5 # on veut 5 segments min sur un quart de cercle
+ alpha = math.pi/(4*nbSegQuart)
+ deflexion = rcourb*(1.0 -math.cos(alpha))
+ lgmin = lenSegPipe*0.25
+ lgmax = lenSegPipe*1.5
+ logging.debug("rcourb: %s, lenFond:%s, deflexion: %s, lgmin: %s, lgmax: %s", rcourb, lenEdgeFondExt, deflexion, lgmin, lgmax)
+
+ meshFondExt = smesh.Mesh(wireFondFiss)
+ algo1d = meshFondExt.Segment()
+ hypo1d = algo1d.Adaptive(lgmin, lgmax, deflexion) # a ajuster selon la profondeur de la fissure
+ isDone = meshFondExt.Compute()
+
+ ptGSdic = {} # dictionnaire [paramètre sur la courbe] --> point géométrique
+ allNodeIds = meshFondExt.GetNodesId()
+ for nodeId in allNodeIds:
+ xyz = meshFondExt.GetNodeXYZ(nodeId)
+ #logging.debug("nodeId %s, coords %s", nodeId, str(xyz))
+ pt = geompy.MakeVertex(xyz[0], xyz[1], xyz[2])
+ u, PointOnEdge, EdgeInWireIndex = geompy.MakeProjectionOnWire(pt, wireFondFiss) # u compris entre 0 et 1
+ edgeOrder = edgesIdByOrientation[EdgeInWireIndex]
+ ptGSdic[(edgeOrder, EdgeInWireIndex, u)] = pt
+ #logging.debug("nodeId %s, u %s", nodeId, str(u))
+ usort = sorted(ptGSdic)
+ logging.debug("nombre de points obtenus par deflexion %s",len(usort))
+
+ centres = []
+ origins = []
+ normals = []
+ for edu in usort:
+ ied = edu[1]
+ u = edu[2]
+ vertcx = ptGSdic[edu]
+ norm = geompy.MakeTangentOnCurve(edgesFondFiss[ied], u)
+ plan = geompy.MakePlane(vertcx, norm, 3*rayonPipe)
+ part = geompy.MakePartition([plan], [wirePipeFiss], [], [], geompy.ShapeType["VERTEX"], 0, [], 0)
+ liste = geompy.ExtractShapes(part, geompy.ShapeType["VERTEX"], True)
+ if len(liste) == 5: # 4 coins du plan plus intersection recherchée
+ for point in liste:
+ if geompy.MinDistance(point, vertcx) < 1.1*rayonPipe: # les quatre coins sont plus loin
+ vertpx = point
+ break
+ centres.append(vertcx)
+ origins.append(vertpx)
+ normals.append(norm)
+# name = "vertcx%d"%i
+# geompy.addToStudyInFather(wireFondFiss, vertcx, name)
+# name = "vertpx%d"%i
+# geompy.addToStudyInFather(wireFondFiss, vertpx, name)
+# name = "plan%d"%i
+# geompy.addToStudyInFather(wireFondFiss, plan, name)
+
+ # --- maillage du pipe étendu, sans tenir compte de l'intersection avec la face de peau
+
+ logging.debug("nbsegCercle %s", nbsegCercle)
+
+ # -----------------------------------------------------------------------
+ # --- points géométriques
+
+ gptsdisks = [] # vertices géométrie de tous les disques
+ raydisks = [[] for i in range(nbsegCercle)]
+ for i in range(len(centres)): # boucle sur les disques
+ gptdsk = [] # vertices géométrie d'un disque
+ vertcx = centres[i]
+ vertpx = origins[i]
+ normal = normals[i]
+ vec1 = geompy.MakeVector(vertcx, vertpx)
+
+ points = [vertcx] # les points du rayon de référence
+ for j in range(nbsegRad):
+ pt = geompy.MakeTranslationVectorDistance(vertcx, vec1, (j+1)*float(rayonPipe)/nbsegRad)
+ points.append(pt)
+ gptdsk.append(points)
+ pt = geompy.MakeTranslationVectorDistance(vertcx, vec1, 1.5*rayonPipe)
+ rayon = geompy.MakeLineTwoPnt(vertcx, pt)
+ raydisks[0].append(rayon)
+
+ for k in range(nbsegCercle-1):
+ angle = (k+1)*2*math.pi/nbsegCercle
+ pts = [vertcx] # les points d'un rayon obtenu par rotation
+ for j in range(nbsegRad):
+ pt = geompy.MakeRotation(points[j+1], normal, angle)
+ pts.append(pt)
+ gptdsk.append(pts)
+ ray = geompy.MakeRotation(rayon, normal, angle)
+ raydisks[k+1].append(ray)
+
+ gptsdisks.append(gptdsk)
+
+ return (centres, gptsdisks, raydisks)
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import os
+from geomsmesh import geompy, smesh
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
+
+import math
+import GEOM
+import SALOMEDS
+import SMESH
+#import StdMeshers
+#import GHS3DPlugin
+#import NETGENPlugin
+import logging
+
+from fissureGenerique import fissureGenerique
+
+from initEtude import initEtude
+from triedreBase import triedreBase
+from genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut
+from creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain
+from construitFissureGenerale import construitFissureGenerale
+
+O, OX, OY, OZ = triedreBase()
+
+class casStandard(fissureGenerique):
+ """
+ problème de fissure standard, défini par :
+ - un maillage sain (hexaèdres),
+ - une face géométrique de fissure, qui doit légèrement dépasser hors du volume maillé
+ - les numéros d'arêtes (edges géométriques) correspondant au fond de fissure
+ - les paramètres de maillage de la fissure
+ """
+
+ # ---------------------------------------------------------------------------
+ def __init__ (self, dicoParams, references = None, numeroCas = 0):
+ initEtude()
+ self.references = references
+ self.dicoParams = dicoParams
+ if self.dicoParams.has_key('nomCas'):
+ self.nomCas = self.dicoParams['nomCas']
+ else:
+ self.nomCas = 'casStandard'
+ self.numeroCas = numeroCas
+ if self.numeroCas != 0:
+ self.nomCas = self.nomProbleme +"_%d"%(self.numeroCas)
+ else:
+ self.nomProbleme = self.nomCas
+ if self.dicoParams.has_key('lenSegPipe'):
+ self.lenSegPipe = self.dicoParams['lenSegPipe']
+ else:
+ self.lenSegPipe =self.dicoParams['rayonPipe']
+ if self.dicoParams.has_key('step'):
+ step = self.dicoParams['step']
+ else:
+ step = -1 # exécuter toutes les étapes
+ if self.numeroCas == 0: # valeur par défaut : exécution immédiate, sinon execution différée dans le cas d'une liste de problèmes
+ self.executeProbleme(step)
+
+ # ---------------------------------------------------------------------------
+ def genereMaillageSain(self, geometriesSaines, meshParams):
+ logging.info("genereMaillageSain %s", self.nomCas)
+
+ ([objetSain], status) = smesh.CreateMeshesFromMED(self.dicoParams['maillageSain'])
+ smesh.SetName(objetSain.GetMesh(), 'objetSain')
+
+ return [objetSain, True] # True : maillage hexa
+
+ # ---------------------------------------------------------------------------
+ def setParamShapeFissure(self):
+ """
+ paramètres de la fissure pour méthode insereFissureGenerale
+ lgInfluence : distance autour de la shape de fissure a remailler (A ajuster selon le maillage)
+ rayonPipe : le rayon du pile maillé en hexa autour du fond de fissure
+ convexe : True : la face est convexe (vue de l'exterieur) sert si on ne donne pas de point interne
+ pointIn_x : optionnel : coordonnée x d'un point dans le solide sain (pour orienter la face - idem avec y,z)
+ """
+ logging.info("setParamShapeFissure %s", self.nomCas)
+ if self.dicoParams.has_key('pointInterieur'):
+ self.shapeFissureParams = dict(lgInfluence = self.dicoParams['lgInfluence'],
+ rayonPipe = self.dicoParams['rayonPipe'],
+ lenSegPipe = self.lenSegPipe,
+ pointIn_x = self.dicoParams['pointInterieur'][0],
+ pointIn_y = self.dicoParams['pointInterieur'][1],
+ pointIn_z = self.dicoParams['pointInterieur'][2])
+ else:
+ self.shapeFissureParams = dict(lgInfluence = self.dicoParams['lgInfluence'],
+ rayonPipe = self.dicoParams['rayonPipe'],
+ lenSegPipe = self.lenSegPipe)
+
+ # ---------------------------------------------------------------------------
+ def genereShapeFissure( self, geometriesSaines, geomParams, shapeFissureParams):
+ logging.info("genereShapeFissure %s", self.nomCas)
+
+ lgInfluence = shapeFissureParams['lgInfluence']
+
+ shellFiss = geompy.ImportFile( self.dicoParams['brepFaceFissure'], "BREP")
+ fondFiss = geompy.CreateGroup(shellFiss, geompy.ShapeType["EDGE"])
+ geompy.UnionIDs(fondFiss, self.dicoParams['edgeFissIds'] )
+ geomPublish(initLog.debug, shellFiss, 'shellFiss' )
+ geomPublishInFather(initLog.debug, shellFiss, fondFiss, 'fondFiss' )
+
+
+ coordsNoeudsFissure = genereMeshCalculZoneDefaut(shellFiss, self.dicoParams['meshBrep'][0] ,self.dicoParams['meshBrep'][1])
+
+ centre = None
+ return [shellFiss, centre, lgInfluence, coordsNoeudsFissure, fondFiss]
+
+ # ---------------------------------------------------------------------------
+ def setParamMaillageFissure(self):
+ self.maillageFissureParams = dict(nomRep = '.',
+ nomFicSain = self.nomCas,
+ nomFicFissure = 'fissure_' + self.nomCas,
+ nbsegRad = self.dicoParams['nbSegRad'],
+ nbsegCercle = self.dicoParams['nbSegCercle'],
+ areteFaceFissure = self.dicoParams['areteFaceFissure'])
+
+ # ---------------------------------------------------------------------------
+ def genereZoneDefaut(self, geometriesSaines, maillagesSains, shapesFissure, shapeFissureParams, maillageFissureParams):
+ elementsDefaut = creeZoneDefautDansObjetSain(geometriesSaines, maillagesSains, shapesFissure, shapeFissureParams, maillageFissureParams)
+ return elementsDefaut
+
+ # ---------------------------------------------------------------------------
+ def genereMaillageFissure(self, geometriesSaines, maillagesSains,
+ shapesFissure, shapeFissureParams,
+ maillageFissureParams, elementsDefaut, step):
+ maillageFissure = construitFissureGenerale(maillagesSains,
+ shapesFissure, shapeFissureParams,
+ maillageFissureParams, elementsDefaut, step)
+ return maillageFissure
+
+ # ---------------------------------------------------------------------------
+ def setReferencesMaillageFissure(self):
+ if self.references is not None:
+ self.referencesMaillageFissure = self.references
+ else:
+ self.referencesMaillageFissure = dict(Entity_Quad_Pyramid = 0,
+ Entity_Quad_Triangle = 0,
+ Entity_Quad_Edge = 0,
+ Entity_Quad_Penta = 0,
+ Entity_Quad_Hexa = 0,
+ Entity_Node = 0,
+ Entity_Quad_Tetra = 0,
+ Entity_Quad_Quadrangle = 0)
+
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import logging
+from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
+
+def compoundFromList(elements, nom=None):
+ """
+
+ """
+ logging.debug('start')
+
+ shapeList = []
+ for a in elements:
+ if not isinstance(a, list):
+ shapeList.append(a)
+ else:
+ if a[0] is not None:
+ shapeList.append(a[0])
+
+ if nom is not None:
+ for i,a in enumerate(shapeList):
+ nomi = nom +"%d"%i
+ logging.debug('nom: %s',nomi)
+ geomPublish(initLog.debug, a, nomi)
+
+ shapeCompound = None
+ if len(shapeList) > 0:
+ shapeCompound =geompy.MakeCompound(shapeList)
+ nomc = "compound_%s"%nom
+ geomPublish(initLog.debug, shapeCompound, nomc)
+ return shapeCompound
+
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import logging
+
+from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
+import GEOM
+from sortEdges import sortEdges
+
+def construitEdgesRadialesDebouchantes(idisklim, idiskout, gptsdisks, raydisks,
+ facesPipePeau, edgeRadFacePipePeau, nbsegCercle):
+ """
+ construction des listes d'edges radiales sur chaque extrémité débouchante
+ """
+ logging.info('start')
+
+ # --- listes de nappes radiales en filling à chaque extrémité débouchante
+
+ facesDebouchantes = [False, False]
+ idFacesDebouchantes = [-1, -1] # contiendra les indices des faces disque débouchantes (facesPipePeau)
+ listNappes =[]
+ for i, idisk in enumerate(idisklim):
+ numout = idiskout[i]
+ logging.debug("extremité %s, indices disques interne %s, externe %s",i, idisk, numout)
+ nappes = []
+ if (idisk != 0) and (idisk != len(gptsdisks)-1): # si extrémité débouchante
+ for k in range(nbsegCercle):
+ if i == 0:
+ iddeb = max(0, numout)
+ idfin = max(iddeb+3,idisk+1) # il faut 3 rayons pour faire un filling qui suive le fond de fissure
+ #logging.debug("extremité %s, indices retenus interne %s, externe %s",i, idfin, iddeb)
+ comp = geompy.MakeCompound(raydisks[k][iddeb:idfin])
+ name='compoundRay%d'%k
+ geomPublish(initLog.debug, comp, name)
+ else:
+ idfin = min(len(gptsdisks), numout+1)
+ iddeb = min(idfin-3, idisk) # il faut 3 rayons pour faire un filling qui suive le fond de fissure
+ #logging.debug("extremité %s, indices retenus interne %s, externe %s",i, idfin, iddeb)
+ comp = geompy.MakeCompound(raydisks[k][iddeb:idfin])
+ name='compoundRay%d'%k
+ geomPublish(initLog.debug, comp, name)
+ nappe = geompy.MakeFilling(comp, 2, 5, 0.0001, 0.0001, 0, GEOM.FOM_Default)
+ nappes.append(nappe)
+ name='nappe%d'%k
+ geomPublish(initLog.debug, nappe, name)
+ facesDebouchantes[i] = True
+ listNappes.append(nappes)
+
+ # --- mise en correspondance avec les indices des faces disque débouchantes (facesPipePeau)
+ for i, nappes in enumerate(listNappes):
+ if facesDebouchantes[i]:
+ for k, face in enumerate(facesPipePeau):
+ #logging.debug('i, k, face, nappes[0] %s %s %s %s', i, k, face, nappes[0])
+ #geomPublish(initLog.debug, nappes[0], 'lanappe')
+ #geomPublish(initLog.debug, face, 'laface')
+ edge = geompy.MakeSection(face, nappes[0])
+ if geompy.NbShapes(edge, geompy.ShapeType["EDGE"]) > 0:
+ idFacesDebouchantes[i] = k
+ break
+ logging.debug("idFacesDebouchantes: %s", idFacesDebouchantes)
+
+ # --- construction des listes d'edges radiales sur chaque extrémité débouchante
+ listEdges = []
+ for i, nappes in enumerate(listNappes):
+ ifd = idFacesDebouchantes[i] # indice de face débouchante (facesPipePeau)
+ if ifd < 0:
+ listEdges.append([])
+ else:
+ face = facesPipePeau[ifd]
+ edges = [edgeRadFacePipePeau[ifd]]
+ for k, nappe in enumerate(nappes):
+ if k > 0:
+ obj = geompy.MakeSection(face, nappes[k]) # normalement une edge, parfois un compound d'edges dont un tout petit
+ edge = obj
+ vs = geompy.ExtractShapes(obj, geompy.ShapeType["VERTEX"], False)
+ if len(vs) > 2:
+ eds = geompy.ExtractShapes(obj, geompy.ShapeType["EDGE"], False)
+ [edsorted, minl,maxl] = sortEdges(eds)
+ edge = edsorted[-1]
+ else:
+ maxl = geompy.BasicProperties(edge)[0]
+ if maxl < 0.01: # problème MakeSection
+ logging.debug("problème MakeSection recherche edge radiale %s, longueur trop faible: %s, utilisation partition", k, maxl)
+ partNappeFace = geompy.MakePartition([face, nappes[k]], [] , [], [], geompy.ShapeType["FACE"], 0, [], 0)
+ edps= geompy.ExtractShapes(partNappeFace, geompy.ShapeType["EDGE"], False)
+ ednouv = []
+ for ii, ed in enumerate(edps):
+ vxs = geompy.ExtractShapes(ed, geompy.ShapeType["VERTEX"], False)
+ distx = [geompy.MinDistance(vx, face) for vx in vxs]
+ distx += [geompy.MinDistance(vx, nappes[k]) for vx in vxs]
+ dmax = max(distx)
+ logging.debug(" dmax %s",dmax)
+ if dmax < 0.01:
+ ednouv.append(ed)
+ logging.debug(" edges issues de la partition: %s", ednouv)
+ for ii, ed in enumerate(ednouv):
+ geomPublish(initLog.debug, ed, "ednouv%d"%ii)
+ [edsorted, minl,maxl] = sortEdges(ednouv)
+ logging.debug(" longueur edge trouvée: %s", maxl)
+ edge = edsorted[-1]
+ edges.append(edge)
+ name = 'edgeEndPipe%d'%k
+ geomPublish(initLog.debug, edge, name)
+ listEdges.append(edges)
+
+ return (listEdges, idFacesDebouchantes)
\ No newline at end of file
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import logging
+import salome
+from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
+import GEOM
+from geomsmesh import smesh
+from salome.smesh import smeshBuilder
+import SMESH
+import math
+import bisect
+
+# from extractionOrientee import extractionOrientee
+# from extractionOrienteeMulti import extractionOrienteeMulti
+# from sortFaces import sortFaces
+#from sortEdges import sortEdges
+# from eliminateDoubles import eliminateDoubles
+# from substractSubShapes import substractSubShapes
+# from produitMixte import produitMixte
+# from findWireEndVertices import findWireEndVertices
+#from findWireIntermediateVertices import findWireIntermediateVertices
+from orderEdgesFromWire import orderEdgesFromWire
+# from getSubshapeIds import getSubshapeIds
+from putName import putName
+# from distance2 import distance2
+from enleveDefaut import enleveDefaut
+from shapeSurFissure import shapeSurFissure
+from regroupeSainEtDefaut import RegroupeSainEtDefaut
+from triedreBase import triedreBase
+# from checkDecoupePartition import checkDecoupePartition
+# from whichSide import whichSide
+# from whichSideMulti import whichSideMulti
+#from whichSideVertex import whichSideVertex
+#from projettePointSurCourbe import projettePointSurCourbe
+# from prolongeWire import prolongeWire
+from restreintFaceFissure import restreintFaceFissure
+from partitionneFissureParPipe import partitionneFissureParPipe
+from construitPartitionsPeauFissure import construitPartitionsPeauFissure
+from compoundFromList import compoundFromList
+from identifieElementsGeometriquesPeau import identifieElementsGeometriquesPeau
+from identifieFacesEdgesFissureExterne import identifieFacesEdgesFissureExterne
+from calculePointsAxiauxPipe import calculePointsAxiauxPipe
+from elimineExtremitesPipe import elimineExtremitesPipe
+from construitEdgesRadialesDebouchantes import construitEdgesRadialesDebouchantes
+from creePointsPipePeau import creePointsPipePeau
+from ajustePointsEdgePipeFissure import ajustePointsEdgePipeFissure
+from construitMaillagePipe import construitMaillagePipe
+from mailleAretesEtJonction import mailleAretesEtJonction
+from mailleFacesFissure import mailleFacesFissure
+from mailleFacesPeau import mailleFacesPeau
+
+# -----------------------------------------------------------------------------
+# --- procédure complète fissure générale
+
+def construitFissureGenerale(maillagesSains,
+ shapesFissure, shapeFissureParams,
+ maillageFissureParams, elementsDefaut, step=-1):
+ """
+ TODO: a completer
+ """
+ logging.info('start')
+
+ shapeDefaut = shapesFissure[0] # faces de fissure, débordant
+ fondFiss = shapesFissure[4] # groupe d'edges de fond de fissure
+
+ rayonPipe = shapeFissureParams['rayonPipe']
+ if shapeFissureParams.has_key('lenSegPipe'):
+ lenSegPipe = shapeFissureParams['lenSegPipe']
+ else:
+ lenSegPipe = rayonPipe
+
+ nomRep = maillageFissureParams['nomRep']
+ nomFicSain = maillageFissureParams['nomFicSain']
+ nomFicFissure = maillageFissureParams['nomFicFissure']
+
+ nbsegRad = maillageFissureParams['nbsegRad'] # nombre de couches selon un rayon du pipe
+ nbsegCercle = maillageFissureParams['nbsegCercle'] # nombre de secteur dans un cercle du pipe
+ areteFaceFissure = maillageFissureParams['areteFaceFissure']
+
+ pointIn_x = 0.0
+ pointIn_y = 0.0
+ pointIn_z = 0.0
+ isPointInterne = False
+ if shapeFissureParams.has_key('pointIn_x'):
+ pointIn_x = shapeFissureParams['pointIn_x']
+ isPointInterne = True
+ if shapeFissureParams.has_key('pointIn_y'):
+ pointIn_y = shapeFissureParams['pointIn_y']
+ isPointInterne = True
+ if shapeFissureParams.has_key('pointIn_z'):
+ pointIn_z = shapeFissureParams['pointIn_z']
+ isPointInterne = True
+ if isPointInterne:
+ pointInterne = geompy.MakeVertex(pointIn_x, pointIn_y, pointIn_z)
+ else:
+ pointInterne = None
+
+ #fichierMaillageSain = nomRep + '/' + nomFicSain + '.med'
+ fichierMaillageFissure = nomRep + '/' + nomFicFissure + '.med'
+
+ # fillings des faces en peau
+ facesDefaut = elementsDefaut[0]
+ #centresDefaut = elementsDefaut[1]
+ #normalsDefaut = elementsDefaut[2]
+ #extrusionsDefaut = elementsDefaut[3]
+ dmoyen = elementsDefaut[4]
+ bordsPartages = elementsDefaut[5]
+ #fillconts = elementsDefaut[6]
+ #idFilToCont = elementsDefaut[7]
+ maillageSain = elementsDefaut[8]
+ internalBoundary = elementsDefaut[9]
+ zoneDefaut = elementsDefaut[10]
+ zoneDefaut_skin = elementsDefaut[11]
+ zoneDefaut_internalFaces = elementsDefaut[12]
+ zoneDefaut_internalEdges = elementsDefaut[13]
+ #edgeFondExt = elementsDefaut[14]
+ centreFondFiss = elementsDefaut[15]
+ #tgtCentre = elementsDefaut[16]
+
+ O, OX, OY, OZ = triedreBase()
+
+ # --- restriction de la face de fissure au domaine solide :
+ # partition face fissure étendue par fillings, on garde la face interne
+
+ facesPortFissure = restreintFaceFissure(shapeDefaut, facesDefaut, pointInterne)
+
+ # --- pipe de fond de fissure, prolongé, partition face fissure par pipe
+ # identification des edges communes pipe et face fissure
+
+ (fissPipe, edgesPipeFiss, edgesFondFiss, wirePipeFiss, wireFondFiss) = partitionneFissureParPipe(shapesFissure, elementsDefaut, rayonPipe)
+ edgesFondFiss, edgesIdByOrientation = orderEdgesFromWire(wireFondFiss)
+ for i,edge in enumerate(edgesFondFiss):
+ geomPublishInFather(initLog.debug, wireFondFiss, edge, "edgeFondFiss%d"%i)
+
+ # --- peau et face de fissure
+ #
+ # --- partition peau défaut - face de fissure prolongée - wire de fond de fissure prolongée
+ # il peut y avoir plusieurs faces externes, dont certaines sont découpées par la fissure
+ # liste de faces externes : facesDefaut
+ # liste de partitions face externe - fissure : partitionPeauFissFond (None quand pas d'intersection)
+
+ partitionsPeauFissFond = construitPartitionsPeauFissure(facesDefaut, fissPipe)
+
+ # --- arêtes vives détectées (dans quadranglesToShapeNoCorner
+ # et quadranglesToShapeWithCorner)
+
+ aretesVivesC = compoundFromList(bordsPartages, "areteVive")
+ aretesVivesCoupees = [] # ensembles des arêtes vives identifiées sur les faces de peau dans l'itération sur partitionsPeauFissFond
+
+ # --- inventaire des faces de peau coupées par la fissure
+ # pour chaque face de peau : 0, 1 ou 2 faces débouchante du fond de fissure
+ # 0, 1 ou plus edges de la face de fissure externe au pipe
+
+ nbFacesFilling = len(partitionsPeauFissFond)
+
+ ptEdgeFond = [ [] for i in range(nbFacesFilling)] # pour chaque face [points edge fond de fissure aux débouchés du pipe]
+ fsPipePeau = [ [] for i in range(nbFacesFilling)] # pour chaque face [faces du pipe débouchantes]
+ edRadFPiPo = [ [] for i in range(nbFacesFilling)] # pour chaque face [edge radiale des faces du pipe débouchantes ]
+ fsFissuExt = [ [] for i in range(nbFacesFilling)] # pour chaque face [faces de fissure externes au pipe]
+ edFisExtPe = [ [] for i in range(nbFacesFilling)] # pour chaque face [edge en peau des faces de fissure externes (pas subshape facePeau)]
+ edFisExtPi = [ [] for i in range(nbFacesFilling)] # pour chaque face [edge commun au pipe des faces de fissure externes]
+ facesPeaux = [None for i in range(nbFacesFilling)] # pour chaque face : la face de peau finale a mailler (percée des faces débouchantes)
+ edCircPeau = [ [] for i in range(nbFacesFilling)] # pour chaque face de peau : [subshape edge circulaire aux débouchés du pipe]
+ ptCircPeau = [ [] for i in range(nbFacesFilling)] # pour chaque face de peau : [subshape point sur edge circulaire aux débouchés du pipe]
+ gpedgeBord = [None for i in range(nbFacesFilling)] # pour chaque face de peau : groupe subshape des edges aux bords liés à la partie saine
+ gpedgeVifs = [None for i in range(nbFacesFilling)] # pour chaque face de peau : groupes subshape des edges aux arêtes vives entre fillings
+ edFissPeau = [ [] for i in range(nbFacesFilling)] # pour chaque face de peau : [subshape edge en peau des faces de fissure externes]
+ ptFisExtPi = [ [] for i in range(nbFacesFilling)] # pour chaque face de peau : [point commun edFissPeau edCircPeau]
+
+ for ifil, partitionPeauFissFond in enumerate(partitionsPeauFissFond):
+ if partitionPeauFissFond is not None:
+ dataPPFF,aretesVivesCoupees = identifieElementsGeometriquesPeau(ifil, partitionPeauFissFond, edgesPipeFiss,
+ edgesFondFiss, wireFondFiss, aretesVivesC,
+ facesDefaut, centreFondFiss, rayonPipe,
+ aretesVivesCoupees)
+ ptEdgeFond[ifil] = dataPPFF['endsEdgeFond']
+ fsPipePeau[ifil] = dataPPFF['facesPipePeau']
+ edRadFPiPo[ifil] = dataPPFF['edgeRadFacePipePeau']
+ fsFissuExt[ifil] = dataPPFF['facesFissExt']
+ edFisExtPe[ifil] = dataPPFF['edgesFissExtPeau']
+ edFisExtPi[ifil] = dataPPFF['edgesFissExtPipe']
+ facesPeaux[ifil] = dataPPFF['facePeau']
+ edCircPeau[ifil] = dataPPFF['edgesCircPeau']
+ ptCircPeau[ifil] = dataPPFF['verticesCircPeau']
+ gpedgeBord[ifil] = dataPPFF['groupEdgesBordPeau']
+ gpedgeVifs[ifil] = dataPPFF['bordsVifs']
+ edFissPeau[ifil] = dataPPFF['edgesFissurePeau']
+ ptFisExtPi[ifil] = dataPPFF['verticesPipePeau']
+
+ facesPipePeau = []
+ edgeRadFacePipePeau = []
+ for ifil in range(nbFacesFilling):
+ facesPipePeau += fsPipePeau[ifil]
+ edgeRadFacePipePeau += edRadFPiPo[ifil]
+
+ for i, avc in enumerate(aretesVivesCoupees):
+ name = "areteViveCoupee%d"%i
+ geomPublish(initLog.debug, avc, name)
+
+ # --- identification des faces et edges de fissure externe pour maillage
+
+ (faceFissureExterne, edgesPipeFissureExterneC,
+ wirePipeFissureExterne, edgesPeauFissureExterneC) = identifieFacesEdgesFissureExterne(fsFissuExt, edFisExtPe,
+ edFisExtPi, edgesPipeFiss)
+
+ # --- preparation maillage du pipe :
+ # - détections des points a respecter : jonction des edges/faces constituant la face de fissure externe au pipe
+ # - points sur les edges de fond de fissure et edges pipe/face fissure,
+ # - vecteurs tangents au fond de fissure (normal au disque maillé)
+
+ (centres, gptsdisks, raydisks) = calculePointsAxiauxPipe(edgesFondFiss, edgesIdByOrientation, facesDefaut,
+ centreFondFiss, wireFondFiss, wirePipeFiss,
+ lenSegPipe, rayonPipe, nbsegCercle, nbsegRad)
+
+ # --- recherche des points en trop (externes au volume à remailler)
+ # - on associe chaque extrémité du pipe à une face filling
+ # - on part des disques aux extrémités du pipe
+ # - pour chaque disque, on prend les vertices de géométrie,
+ # on marque leur position relative à la face.
+ # - on s'arrete quand tous les noeuds sont dedans
+
+ (idFillingFromBout, idisklim, idiskout) = elimineExtremitesPipe(ptEdgeFond, facesDefaut, centres, gptsdisks, nbsegCercle)
+
+ # --- construction des listes d'edges radiales sur chaque extrémité débouchante
+
+ (listEdges, idFacesDebouchantes) = construitEdgesRadialesDebouchantes(idisklim, idiskout, gptsdisks, raydisks,
+ facesPipePeau, edgeRadFacePipePeau, nbsegCercle)
+
+ # --- création des points du maillage du pipe sur la face de peau
+
+ (gptsdisks, idisklim) = creePointsPipePeau(listEdges, idFacesDebouchantes, idFillingFromBout,
+ ptEdgeFond, ptFisExtPi, edCircPeau, gptsdisks, idisklim, nbsegRad)
+
+ # --- ajustement precis des points sur edgesPipeFissureExterneC
+
+ gptsdisks = ajustePointsEdgePipeFissure(edgesPipeFissureExterneC, wirePipeFissureExterne, gptsdisks, idisklim)
+
+ # --- maillage effectif du pipe
+
+ (meshPipe, meshPipeGroups, edgesCircPipeGroup) = construitMaillagePipe(gptsdisks, idisklim, nbsegCercle, nbsegRad)
+
+ # --- edges de bord, faces défaut à respecter
+
+ (internalBoundary, bordsLibres, grpAretesVives) = mailleAretesEtJonction(internalBoundary, aretesVivesCoupees, dmoyen)
+
+ # --- maillage faces de fissure
+
+ (meshFaceFiss, grpFaceFissureExterne,
+ grpEdgesPeauFissureExterne, grpEdgesPipeFissureExterne) = mailleFacesFissure(faceFissureExterne, edgesPipeFissureExterneC, edgesPeauFissureExterneC,
+ meshPipeGroups, areteFaceFissure, rayonPipe, nbsegRad)
+
+ # --- maillage faces de peau
+
+ meshesFacesPeau = mailleFacesPeau(partitionsPeauFissFond, idFillingFromBout, facesDefaut,
+ facesPeaux, edCircPeau, ptCircPeau, gpedgeBord, gpedgeVifs, edFissPeau,
+ bordsLibres, grpEdgesPeauFissureExterne, grpAretesVives,
+ edgesCircPipeGroup, dmoyen, rayonPipe, nbsegRad)
+
+ # --- regroupement des maillages du défaut
+
+ listMeshes = [internalBoundary.GetMesh(),
+ meshPipe.GetMesh(),
+ meshFaceFiss.GetMesh()]
+ for mp in meshesFacesPeau:
+ listMeshes.append(mp.GetMesh())
+
+ meshBoiteDefaut = smesh.Concatenate(listMeshes, 1, 1, 1e-05,False)
+ # pour aider l'algo hexa-tetra à ne pas mettre de pyramides à l'exterieur des volumes repliés sur eux-mêmes
+ # on désigne les faces de peau en quadrangles par le groupe "skinFaces"
+ group_faceFissOutPipe = None
+ group_faceFissInPipe = None
+ groups = meshBoiteDefaut.GetGroups()
+ for grp in groups:
+ if grp.GetType() == SMESH.FACE:
+ if grp.GetName() == "fisOutPi":
+ group_faceFissOutPipe = grp
+ elif grp.GetName() == "fisInPi":
+ group_faceFissInPipe = grp
+
+ # le maillage NETGEN ne passe pas toujours ==> utiliser GHS3D
+ distene=True
+ if distene:
+ algo3d = meshBoiteDefaut.Tetrahedron(algo=smeshBuilder.GHS3D)
+ else:
+ algo3d = meshBoiteDefaut.Tetrahedron(algo=smeshBuilder.NETGEN)
+ hypo3d = algo3d.MaxElementVolume(1000.0)
+ putName(algo3d.GetSubMesh(), "boiteDefaut")
+ putName(algo3d, "algo3d_boiteDefaut")
+ isDone = meshBoiteDefaut.Compute()
+ putName(meshBoiteDefaut, "boiteDefaut")
+ logging.info("meshBoiteDefaut fini")
+
+ faceFissure = meshBoiteDefaut.GetMesh().UnionListOfGroups( [ group_faceFissOutPipe, group_faceFissInPipe ], 'FACE1' )
+ maillageSain = enleveDefaut(maillageSain, zoneDefaut, zoneDefaut_skin,
+ zoneDefaut_internalFaces, zoneDefaut_internalEdges)
+ putName(maillageSain, nomFicSain+"_coupe")
+ extrusionFaceFissure, normfiss = shapeSurFissure(facesPortFissure)
+ maillageComplet = RegroupeSainEtDefaut(maillageSain, meshBoiteDefaut,
+ None, None, 'COMPLET', normfiss)
+
+ logging.info("conversion quadratique")
+ maillageComplet.ConvertToQuadratic( 1 )
+ logging.info("groupes")
+ groups = maillageComplet.GetGroups()
+ grps = [ grp for grp in groups if grp.GetName() == 'FONDFISS']
+ fond = maillageComplet.GetMesh().CreateDimGroup( grps, SMESH.NODE, 'FONDFISS' )
+
+ logging.info("réorientation face de fissure FACE1")
+ grps = [ grp for grp in groups if grp.GetName() == 'FACE1']
+ nb = maillageComplet.Reorient2D( grps[0], normfiss, grps[0].GetID(1))
+
+ logging.info("réorientation face de fissure FACE2")
+ plansim = geompy.MakePlane(O, normfiss, 10000)
+ fissnorm = geompy.MakeMirrorByPlane(normfiss, plansim)
+ grps = [ grp for grp in groups if grp.GetName() == 'FACE2']
+ nb = maillageComplet.Reorient2D( grps[0], fissnorm, grps[0].GetID(1))
+ fond = maillageComplet.GetMesh().CreateDimGroup( grps, SMESH.NODE, 'FACE2' )
+
+ logging.info("export maillage fini")
+ maillageComplet.ExportMED( fichierMaillageFissure, 0, SMESH.MED_V2_2, 1 )
+ putName(maillageComplet, nomFicFissure)
+ logging.info("fichier maillage fissure %s", fichierMaillageFissure)
+
+ if salome.sg.hasDesktop():
+ salome.sg.updateObjBrowser(1)
+
+ logging.info("maillage fissure fini")
+
+ return maillageComplet
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import logging
+
+from geomsmesh import geompy
+from geomsmesh import smesh
+import SMESH
+
+def construitMaillagePipe(gptsdisks, idisklim, nbsegCercle, nbsegRad):
+ """
+ maillage effectif du pipe
+ """
+ logging.info('start')
+ meshPipe = smesh.Mesh(None, "meshPipe")
+ fondFissGroup = meshPipe.CreateEmptyGroup(SMESH.EDGE, "FONDFISS")
+ nodesFondFissGroup = meshPipe.CreateEmptyGroup(SMESH.NODE, "nfondfis")
+ faceFissGroup = meshPipe.CreateEmptyGroup(SMESH.FACE, "fisInPi")
+ edgeFaceFissGroup = meshPipe.CreateEmptyGroup(SMESH.EDGE, "edgeFaceFiss")
+ edgeCircPipe0Group = meshPipe.CreateEmptyGroup(SMESH.EDGE, "edgeCircPipe0")
+ edgeCircPipe1Group = meshPipe.CreateEmptyGroup(SMESH.EDGE, "edgeCircPipe1")
+ faceCircPipe0Group = meshPipe.CreateEmptyGroup(SMESH.FACE, "faceCircPipe0")
+ faceCircPipe1Group = meshPipe.CreateEmptyGroup(SMESH.FACE, "faceCircPipe1")
+
+ mptsdisks = [] # vertices maillage de tous les disques
+ mEdges = [] # identifiants edges maillage fond de fissure
+ mEdgeFaces = [] # identifiants edges maillage edge face de fissure externe
+ mFaces = [] # identifiants faces maillage fissure
+ mVols = [] # identifiants volumes maillage pipe
+
+ mptdsk = None
+ for idisk in range(idisklim[0], idisklim[1]+1): # boucle sur les disques internes
+
+ # -----------------------------------------------------------------------
+ # --- points
+
+ gptdsk = gptsdisks[idisk]
+ if idisk > idisklim[0]:
+ oldmpts = mptdsk
+ mptdsk = [] # vertices maillage d'un disque
+ for k in range(nbsegCercle):
+ points = gptdsk[k]
+ mptids = []
+ for j, pt in enumerate(points):
+ if j == 0 and k > 0:
+ id = mptdsk[0][0]
+ else:
+ coords = geompy.PointCoordinates(pt)
+ id = meshPipe.AddNode(coords[0], coords[1], coords[2])
+ mptids.append(id)
+ mptdsk.append(mptids)
+ mptsdisks.append(mptdsk)
+
+ # -----------------------------------------------------------------------
+ # --- groupes edges cercles debouchants
+
+ if idisk == idisklim[0]:
+ pts = []
+ for k in range(nbsegCercle):
+ pts.append(mptdsk[k][-1])
+ edges = []
+ for k in range(len(pts)):
+ k1 = (k+1)%len(pts)
+ idEdge = meshPipe.AddEdge([pts[k], pts[k1]])
+ edges.append(idEdge)
+ edgeCircPipe0Group.Add(edges)
+
+ if idisk == idisklim[1]:
+ pts = []
+ for k in range(nbsegCercle):
+ pts.append(mptdsk[k][-1])
+ edges = []
+ for k in range(len(pts)):
+ k1 = (k+1)%len(pts)
+ idEdge = meshPipe.AddEdge([pts[k], pts[k1]])
+ edges.append(idEdge)
+ edgeCircPipe1Group.Add(edges)
+
+ # -----------------------------------------------------------------------
+ # --- groupes faces debouchantes
+
+ if idisk == idisklim[0]:
+ faces = []
+ for j in range(nbsegRad):
+ for k in range(nbsegCercle):
+ k1 = k+1
+ if k == nbsegCercle-1:
+ k1 = 0
+ if j == 0:
+ idf = meshPipe.AddFace([mptdsk[k][0], mptdsk[k][1], mptdsk[k1][1]]) # triangle
+ else:
+ idf = meshPipe.AddFace([mptdsk[k][j], mptdsk[k][j+1], mptdsk[k1][j+1], mptdsk[k1][j]]) # quadrangle
+ faces.append(idf)
+ faceCircPipe0Group.Add(faces)
+
+ if idisk == idisklim[1]:
+ faces = []
+ for j in range(nbsegRad):
+ for k in range(nbsegCercle):
+ k1 = k+1
+ if k == nbsegCercle-1:
+ k1 = 0
+ if j == 0:
+ idf = meshPipe.AddFace([mptdsk[k][0], mptdsk[k][1], mptdsk[k1][1]]) # triangle
+ else:
+ idf = meshPipe.AddFace([mptdsk[k][j], mptdsk[k][j+1], mptdsk[k1][j+1], mptdsk[k1][j]]) # quadrangle
+ faces.append(idf)
+ faceCircPipe1Group.Add(faces)
+
+ # -----------------------------------------------------------------------
+ # --- mailles volumiques, groupes noeuds et edges de fond de fissure, groupe de face de fissure
+
+ if idisk == idisklim[0]:
+ mEdges.append(0)
+ mEdgeFaces.append(0)
+ mFaces.append([0])
+ mVols.append([[0]])
+ nodesFondFissGroup.Add([mptdsk[0][0]])
+ else:
+ ide = meshPipe.AddEdge([oldmpts[0][0], mptdsk[0][0]])
+ mEdges.append(ide)
+ fondFissGroup.Add([ide])
+ nodesFondFissGroup.Add([mptdsk[0][0]])
+ ide2 = meshPipe.AddEdge([oldmpts[0][-1], mptdsk[0][-1]])
+ mEdgeFaces.append(ide2)
+ edgeFaceFissGroup.Add([ide2])
+ idFaces = []
+ idVols = []
+
+ for j in range(nbsegRad):
+ idf = meshPipe.AddFace([oldmpts[0][j], mptdsk[0][j], mptdsk[0][j+1], oldmpts[0][j+1]])
+ faceFissGroup.Add([idf])
+ idFaces.append(idf)
+
+ idVolCercle = []
+ for k in range(nbsegCercle):
+ k1 = k+1
+ if k == nbsegCercle-1:
+ k1 = 0
+ if j == 0:
+ idv = meshPipe.AddVolume([mptdsk[k][j], mptdsk[k][j+1], mptdsk[k1][j+1],
+ oldmpts[k][j], oldmpts[k][j+1], oldmpts[k1][j+1]])
+ else:
+ idv = meshPipe.AddVolume([mptdsk[k][j], mptdsk[k][j+1], mptdsk[k1][j+1], mptdsk[k1][j],
+ oldmpts[k][j], oldmpts[k][j+1], oldmpts[k1][j+1], oldmpts[k1][j]])
+ idVolCercle.append(idv)
+ idVols.append(idVolCercle)
+
+ mFaces.append(idFaces)
+ mVols.append(idVols)
+
+ pipeFissGroup = meshPipe.CreateEmptyGroup( SMESH.VOLUME, 'PIPEFISS' )
+ nbAdd = pipeFissGroup.AddFrom( meshPipe.GetMesh() )
+
+ nb, new_mesh, new_group = meshPipe.MakeBoundaryElements(SMESH.BND_2DFROM3D, "pipeBoundaries")
+ edgesCircPipeGroup = [edgeCircPipe0Group, edgeCircPipe1Group]
+
+ meshPipeGroups = dict(fondFissGroup = fondFissGroup,
+ nodesFondFissGroup = nodesFondFissGroup,
+ faceFissGroup = faceFissGroup,
+ edgeFaceFissGroup = edgeFaceFissGroup,
+ edgeCircPipe0Group = edgeCircPipe0Group,
+ edgeCircPipe1Group = edgeCircPipe1Group,
+ faceCircPipe0Group = faceCircPipe0Group,
+ faceCircPipe1Group = faceCircPipe1Group,
+ pipeFissGroup = pipeFissGroup,
+ edgesCircPipeGroup = edgesCircPipeGroup
+ )
+
+ return (meshPipe, meshPipeGroups, edgesCircPipeGroup)
\ No newline at end of file
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import logging
+from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
+from checkDecoupePartition import checkDecoupePartition
+
+ # -----------------------------------------------------------------------------
+ # --- peau et face de fissure
+ #
+ # --- partition peau défaut - face de fissure prolongée - wire de fond de fissure prolongée
+ # il peut y avoir plusieurs faces externes, dont certaines sont découpées par la fissure
+ # liste de faces externes : facesDefaut
+ # liste de partitions face externe - fissure : partitionPeauFissFond (None quand pas d'intersection)
+
+def construitPartitionsPeauFissure(facesDefaut, fissPipe):
+ """
+ partition peau défaut - face de fissure prolongée - wire de fond de fissure prolongée.
+ Il peut y avoir plusieurs faces externes, dont certaines sont découpées par la fissure.
+ @param facesDefaut liste de faces externes
+ @param fissPipe partition face de fissure etendue par pipe prolongé
+ @return partitionsPeauFissFond : liste de partitions face externe - fissure (None quand pas d'intersection)
+ """
+
+ logging.info('start')
+ partitionsPeauFissFond = []
+ ipart = 0
+ for filling in facesDefaut:
+ part = geompy.MakePartition([fissPipe, filling], [], [], [], geompy.ShapeType["FACE"], 0, [], 0)
+ isPart = checkDecoupePartition([fissPipe, filling], part)
+ if isPart: # on recrée la partition avec toutes les faces filling en outil pour avoir une face de fissure correcte
+ otherFD = [fd for fd in facesDefaut if fd != filling]
+ if len(otherFD) > 0:
+ fissPipePart = geompy.MakePartition([fissPipe], otherFD, [], [], geompy.ShapeType["FACE"], 0, [], 0)
+ else:
+ fissPipePart = fissPipe
+ part = geompy.MakePartition([fissPipePart, filling], [], [], [], geompy.ShapeType["FACE"], 0, [], 0)
+ partitionsPeauFissFond.append(part)
+ geomPublish(initLog.debug, part, 'partitionPeauFissFond%d'%ipart )
+ else:
+ partitionsPeauFissFond.append(None)
+ ipart = ipart +1
+
+ return partitionsPeauFissFond
\ No newline at end of file
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import logging
+
+from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
+from projettePointSurCourbe import projettePointSurCourbe
+
+def creePointsPipePeau(listEdges, idFacesDebouchantes, idFillingFromBout,
+ ptEdgeFond, ptFisExtPi, edCircPeau, gptsdisks, idisklim, nbsegRad):
+ """
+ création des points du maillage du pipe sur la face de peau
+ """
+ logging.info('start')
+
+ for i, edges in enumerate(listEdges):
+ idf = idFacesDebouchantes[i] # indice de face débouchante (facesPipePeau)
+ if idf >= 0:
+ gptdsk = []
+ if idf > 0: # idf vaut 0 ou 1
+ idf = -1 # si idf vaut 1, on prend le dernier élément de la liste (1 ou 2 extrémités débouchent sur la face)
+ centre = ptEdgeFond[idFillingFromBout[i]][idf]
+ name = "centre%d"%idf
+ geomPublish(initLog.debug, centre, name)
+ vertPipePeau = ptFisExtPi[idFillingFromBout[i]][idf]
+ geomPublishInFather(initLog.debug, centre, vertPipePeau, "vertPipePeau")
+ grpsEdgesCirc = edCircPeau[idFillingFromBout[i]] # liste de groupes
+ edgesCirc = []
+ for grpEdgesCirc in grpsEdgesCirc:
+ edgesCirc += geompy.ExtractShapes(grpEdgesCirc, geompy.ShapeType["EDGE"], False)
+ for k, edge in enumerate(edges):
+ extrems = geompy.ExtractShapes(edge, geompy.ShapeType["VERTEX"], True)
+ if geompy.MinDistance(centre, extrems[0]) < geompy.MinDistance(centre, extrems[1]):
+ bout = extrems[1]
+ else:
+ bout = extrems[0]
+ # ajustement du point extrémité (bout) sur l'edge circulaire en face de peau
+ logging.debug("edgesCirc: %s", edgesCirc)
+ distEdgeCirc = [(geompy.MinDistance(bout, edgeCirc), k2, edgeCirc) for k2, edgeCirc in enumerate(edgesCirc)]
+ distEdgeCirc.sort()
+ logging.debug("distEdgeCirc: %s", distEdgeCirc)
+ u = projettePointSurCourbe(bout, distEdgeCirc[0][2])
+ if (abs(u) < 0.02) or (abs(1-u) < 0.02): # les points très proches d'une extrémité doivent y être mis précisément.
+ extrCircs = geompy.ExtractShapes(distEdgeCirc[0][2], geompy.ShapeType["VERTEX"], True)
+ if geompy.MinDistance(bout, extrCircs[0]) < geompy.MinDistance(bout, extrCircs[1]):
+ bout = extrCircs[0]
+ else:
+ bout = extrCircs[1]
+ else:
+ bout = geompy.MakeVertexOnCurve(distEdgeCirc[0][2], u)
+ name ="bout%d"%k
+ geomPublishInFather(initLog.debug, centre, bout, name)
+ # enregistrement des points dans la structure
+ points = []
+ for j in range(nbsegRad +1):
+ u = j/float(nbsegRad)
+ points.append(geompy.MakeVertexOnCurve(edge, u))
+ if geompy.MinDistance(bout, points[0]) < geompy.MinDistance(centre, points[0]):
+ points.reverse()
+ points[0] = centre
+ points[-1] = bout
+ gptdsk.append(points)
+ if i == 0:
+ gptsdisks[idisklim[0] -1] = gptdsk
+ idisklim[0] = idisklim[0] -1
+ else:
+ gptsdisks[idisklim[1] +1] = gptdsk
+ idisklim[1] = idisklim[1] +1
+
+ return (gptsdisks, idisklim)
\ No newline at end of file
from creeZoneDefautMaillage import creeZoneDefautMaillage
from peauInterne import peauInterne
-from quadranglesToShape import quadranglesToShape
+from quadranglesToShapeNoCorner import quadranglesToShapeNoCorner
from creeZoneDefautFilling import creeZoneDefautFilling
from creeZoneDefautGeom import creeZoneDefautGeom
from getCentreFondFiss import getCentreFondFiss
def creeZoneDefautDansObjetSain(geometriesSaines, maillagesSains, shapesFissure,
shapeFissureParams, maillageFissureParams):
"""
- TODO: a compléter
+ #TODO: a compléter
"""
logging.info('start')
maillageSain.ExportMED( fichierMaillageSain, 0, SMESH.MED_V2_2, 1 )
logging.debug("fichier maillage sain %s", fichierMaillageSain)
[maillageSain, internalBoundary, zoneDefaut, zoneDefaut_skin, zoneDefaut_internalFaces, zoneDefaut_internalEdges] = \
- peauInterne(fichierMaillageSain, nomZones)
+ peauInterne(fichierMaillageSain, shapeDefaut, nomZones)
facesDefaut = []
centresDefaut = []
isPlane = False
if isHexa and not isPlane:
meshQuad = smesh.CopyMesh( zoneDefaut_skin, 'meshQuad', 0, 0)
- fillings, noeuds_bords, bordsPartages, fillconts, idFilToCont = quadranglesToShape(meshQuad, shapeFissureParams, centreFondFiss)
+
+ fillings, noeuds_bords, bordsPartages, fillconts, idFilToCont = quadranglesToShapeNoCorner(meshQuad, shapeFissureParams, centreFondFiss)
+
for filling in fillings:
[faceDefaut, centreDefaut, normalDefaut, extrusionDefaut] = \
creeZoneDefautFilling(filling, shapeDefaut, lgExtrusion)
else:
[facesDefaut, centreDefaut, normalDefaut, extrusionDefaut] = \
creeZoneDefautGeom( geometrieSaine, shapeDefaut, origShapes, verticesShapes, dmoyen, lgExtrusion)
- bordsPartages =[]
+ bordsPartages = []
for face in facesDefaut:
bordsPartages.append([None,None]) # TODO : traitement des arêtes vives ?
fillconts = facesDefaut
import logging
from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
# -----------------------------------------------------------------------------
# --- crée zone géométrique défaut a partir d'un filling
def creeZoneDefautFilling(filling, shapeDefaut, lgExtrusion=50):
"""
Construction CAO de la zone à remailler, quand on utilise un filling,
- après appel creeZoneDefautMaillage et quadranglesToShape
+ après appel creeZoneDefautMaillage et quadranglesToShapeNoCorner
@param filling : la CAO de la peau du défaut reconstituée
@param shapeDefaut : objet géométrique représentant la fissure
(selon les cas, un point central, ou une shape plus complexe,
trace = True
facesDefaut = filling
centreSphere = geompy.MakeCDG(shapeDefaut)
- geompy.addToStudy(centreSphere, "cdg_defaut")
+ geomPublish(initLog.debug, centreSphere, "cdg_defaut")
centreDefaut = geompy.MakeProjection(centreSphere, filling)
if trace:
- geompy.addToStudy(centreDefaut, "centreDefaut")
+ geomPublish(initLog.debug, centreDefaut, "centreDefaut")
normalDefaut = geompy.GetNormal(filling, centreDefaut)
if trace:
- geompy.addToStudy(normalDefaut, "normalDefaut")
+ geomPublish(initLog.debug, normalDefaut, "normalDefaut")
extrusionDefaut = geompy.MakePrismVecH(filling, normalDefaut, -lgExtrusion)
if trace:
- geompy.addToStudy(extrusionDefaut, "extrusionDefaut")
+ geomPublish(initLog.debug, extrusionDefaut, "extrusionDefaut")
return facesDefaut, centreDefaut, normalDefaut, extrusionDefaut
import logging
from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
from prolongeVertices import prolongeVertices
# -----------------------------------------------------------------------------
curves.append(curve)
if trace:
name="poly_%d"%aShape
- geompy.addToStudy(curve, name)
+ geomPublish(initLog.debug, curve, name)
#
cdg = geompy.MakeCDG(curve)
cdgs.append(cdg)
if trace:
name="cdgpoly_%d"%aShape
- geompy.addToStudy(cdg, name)
+ geomPublish(initLog.debug, cdg, name)
#
projCdg = geompy.MakeProjection(cdg, face)
projs.append(projCdg)
if trace:
name="projCdg_%d"%aShape
- geompy.addToStudy(projCdg, name)
+ geomPublish(initLog.debug, projCdg, name)
#
normal = geompy.GetNormal(face, projCdg)
normals.append(normal)
if trace:
name="normal_%d"%aShape
- geompy.addToStudy(normal, name)
+ geomPublish(initLog.debug, normal, name)
#
extrusion = geompy.MakePrismVecH2Ways(curve, normal, 10)
extrusions.append(extrusion)
if trace:
name="extrusion_%d"%aShape
- geompy.addToStudy(extrusion, name)
+ geomPublish(initLog.debug, extrusion, name)
#
verticesProlongees = prolongeVertices(vertices)
#
curveprol = geompy.MakePolyline(verticesProlongees, False)
if trace:
name="polyProl_%d"%aShape
- geompy.addToStudy(curveprol, name)
+ geomPublish(initLog.debug, curveprol, name)
#
extruprol = geompy.MakePrismVecH2Ways(curveprol, normal, 10)
if trace:
name="extruProl_%d"%aShape
- geompy.addToStudy(extruprol, name)
+ geomPublish(initLog.debug, extruprol, name)
#
partition = geompy.MakePartition([face], [extruprol], [], [], geompy.ShapeType["FACE"], 0, [], 0)
partitions.append(partition)
if trace:
name="partition_%d"%aShape
- geompy.addToStudy(partition, name)
+ geomPublish(initLog.debug, partition, name)
pass
#
centreSphere = geompy.MakeCDG(shapeDefaut)
- geompy.addToStudy(centreSphere, "cdg_defaut")
+ geomPublish(initLog.debug, centreSphere, "cdg_defaut")
ccurves = geompy.MakeCompound(curves)
gravCenter = geompy.MakeCDG(ccurves)
- geompy.addToStudy(gravCenter, "cdg_curves")
+ geomPublish(initLog.debug, gravCenter, "cdg_curves")
for i in range(len(partitions)):
if trace:
logging.debug(" --- original shape %s", origShapes[i])
if d == minDist:
aFace = facesToSort[j]
name="decoupe_%d"%origShapes[i]
- geompy.addToStudy(aFace, name)
+ geomPublish(initLog.debug, aFace, name)
decoupes.append(aFace)
break
pass
facesDefaut = decoupes[0]
if len(decoupes) > 1:
facesDefaut = geompy.MakePartition(decoupes, [], [], [], geompy.ShapeType["FACE"], 0, [], 0)
- geompy.addToStudy(facesDefaut, "facesDefaut")
+ geomPublish(initLog.debug, facesDefaut, "facesDefaut")
shells=[]
if len(decoupes) > 1: # plusieurs faces de defaut
theFaces[k:k+1] = []
theShell = geompy.MakeShell(aShell)
name = "theShell%d"%len(shells)
- geompy.addToStudy(theShell,name)
+ geomPublish(initLog.debug, theShell,name)
shells.append(theShell)
#
distances = []
subFaces = [facesDefaut]
theShellDefaut = geompy.MakeShell(subFaces)
if trace:
- geompy.addToStudy(theShellDefaut,"theShellDefaut")
+ geomPublish(initLog.debug, theShellDefaut,"theShellDefaut")
theFaces = geompy.ExtractShapes(theShellDefaut, geompy.ShapeType["FACE"], True)
distances = []
centreDefaut = geompy.MakeProjection(centreSphere, theFaces[index])
if trace:
- geompy.addToStudy(centreDefaut, "centreDefaut")
+ geomPublish(initLog.debug, centreDefaut, "centreDefaut")
normalDefaut = geompy.GetNormal(subFaces[index], centreDefaut)
if trace:
- geompy.addToStudy(normalDefaut, "normalDefaut")
+ geomPublish(initLog.debug, normalDefaut, "normalDefaut")
extrusionDefaut = geompy.MakePrismVecH(theShellDefaut, normalDefaut, -lgExtrusion)
info = geompy.ShapeInfo(extrusionDefaut)
logging.debug("shape info %s", info)
solid0 = geompy.MakeFuse(solid0, solids[i])
extrusionDefaut = solid0
if trace:
- geompy.addToStudy(extrusionDefaut, "extrusionDefaut")
+ geomPublish(initLog.debug, extrusionDefaut, "extrusionDefaut")
return facesDefaut, centreDefaut, normalDefaut, extrusionDefaut
nomZones, coordsNoeudsFissure):
"""
Identification de la zone à remailler, opérations sur le maillage
- de l'objet sain
+ de l'objet sain.
La zone à remailler est définie à partir d'un objet géométrique
ou à partir d'un jeu de points et d'une distance d'influence.
@param maillagesSains : (le maillage de l'objet initial, booleen isHexa)
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import logging
+
+from geomsmesh import geompy
+from whichSideVertex import whichSideVertex
+
+def elimineExtremitesPipe(ptEdgeFond, facesDefaut, centres, gptsdisks, nbsegCercle):
+ """
+ recherche des points en trop (externes au volume à remailler)
+ - on associe chaque extrémité du pipe à une face filling
+ - on part des disques aux extrémités du pipe
+ - pour chaque disque, on prend les vertices de géométrie,
+ on marque leur position relative à la face.
+ - on s'arrete quand tous les noeuds sont dedans
+ """
+
+ logging.info('start')
+
+ pt0 = centres[0]
+ pt1 = centres[-1]
+ idFillingFromBout = [None, None] # contiendra l'index du filling pour les extrémités 0 et 1
+ nbFacesFilling = len(ptEdgeFond)
+ for ifil in range(nbFacesFilling):
+ for ipt, pt in enumerate(ptEdgeFond[ifil]): # il y a un ou deux points débouchant sur cette face
+ if geompy.MinDistance(pt,pt0) < geompy.MinDistance(pt,pt1): # TODO: trouver plus fiable pour les cas tordus...
+ idFillingFromBout[0] = ifil
+ else:
+ idFillingFromBout[1] = ifil
+ logging.debug("association bouts du pipe - faces de filling: %s", idFillingFromBout)
+
+ logging.debug("recherche des disques de noeuds complètement internes")
+ idisklim = [] # indices des premier et dernier disques internes
+ idiskout = [] # indices des premier et dernier disques externes
+ for bout in range(2):
+ if bout == 0:
+ idisk = -1
+ inc = 1
+ numout = -1
+ else:
+ idisk = len(gptsdisks)
+ inc = -1
+ numout = len(gptsdisks)
+ inside = False
+ outside = True
+ while not inside:
+ idisk = idisk + inc
+ logging.debug("examen disque %s", idisk)
+ gptdsk = gptsdisks[idisk]
+ inside = True
+ for k in range(nbsegCercle):
+ points = gptdsk[k]
+ for j, pt in enumerate(points):
+ side = whichSideVertex(facesDefaut[idFillingFromBout[bout]], pt)
+ if side < 0:
+ if outside: # premier point detecté dedans
+ outside = False
+ numout = idisk -inc # le disque précédent était dehors
+ else:
+ inside = False # ce point est dehors
+ if not inside and not outside:
+ break
+ idisklim.append(idisk) # premier et dernier disques internes
+ idiskout.append(numout) # premier et dernier disques externes
+
+ return (idFillingFromBout, idisklim, idiskout)
\ No newline at end of file
import logging
from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
from whichSide import whichSide
shapesInside.append(shape)
if trace:
name = prefix + "_Inside%d"%i
- geompy.addToStudyInFather(obj, shape, name)
+ geomPublishInFather(initLog.debug, obj, shape, name)
i+=1
elif side == -sideRef:
shapesOutside.append(shape)
if trace:
name = prefix + "_Outside%d"%j
- geompy.addToStudyInFather(obj, shape, name)
+ geomPublishInFather(initLog.debug, obj, shape, name)
j+=1
elif side == 0:
shapesOnside.append(shape)
if trace:
name = prefix + "_Onside%d"%k
- geompy.addToStudyInFather(obj, shape, name)
+ geomPublishInFather(initLog.debug, obj, shape, name)
k+=1
logging.debug("--- shape was %s", name)
return [shapesInside, shapesOutside, shapesOnside]
import logging
from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
from whichSideMulti import whichSideMulti
shapesInside.append(shape)
if trace:
name = prefix + "_Inside%d"%i
- geompy.addToStudyInFather(obj, shape, name)
+ geomPublishInFather(initLog.debug, obj, shape, name)
i+=1
elif side == -1:
shapesOutside.append(shape)
if trace:
name = prefix + "_Outside%d"%j
- geompy.addToStudyInFather(obj, shape, name)
+ geomPublishInFather(initLog.debug, obj, shape, name)
j+=1
elif side == 0:
shapesOnside.append(shape)
if trace:
name = prefix + "_Onside%d"%k
- geompy.addToStudyInFather(obj, shape, name)
+ geomPublishInFather(initLog.debug, obj, shape, name)
k+=1
logging.debug("--- shape was %s", name)
return [shapesInside, shapesOutside, shapesOnside]
import logging
from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
# -----------------------------------------------------------------------------
# --- TORE
faces = geompy.GetShapesOnShape(bloc, tore, geompy.ShapeType["FACE"], GEOM.ST_ON)
- geompy.addToStudyInFather( tore, faces[0], 'face0' )
- geompy.addToStudyInFather( tore, faces[1], 'face1' )
- geompy.addToStudyInFather( tore, faces[2], 'face2' )
- geompy.addToStudyInFather( tore, faces[3], 'face3' )
+ geomPublishInFather(initLog.debug, tore, faces[0], 'face0' )
+ geomPublishInFather(initLog.debug, tore, faces[1], 'face1' )
+ geomPublishInFather(initLog.debug, tore, faces[2], 'face2' )
+ geomPublishInFather(initLog.debug, tore, faces[3], 'face3' )
centres = [None, None, None, None]
[v1,centres[0],v3] = geompy.ExtractShapes(faces[0], geompy.ShapeType["VERTEX"], True)
[v1,centres[2],v3] = geompy.ExtractShapes(faces[2], geompy.ShapeType["VERTEX"], True)
[v1,centres[3],v3] = geompy.ExtractShapes(faces[3], geompy.ShapeType["VERTEX"], True)
- geompy.addToStudyInFather( faces[0], centres[0], 'centre0' )
- geompy.addToStudyInFather( faces[1], centres[1], 'centre1' )
- geompy.addToStudyInFather( faces[2], centres[2], 'centre2' )
- geompy.addToStudyInFather( faces[3], centres[3], 'centre3' )
+ geomPublishInFather(initLog.debug, faces[0], centres[0], 'centre0' )
+ geomPublishInFather(initLog.debug, faces[1], centres[1], 'centre1' )
+ geomPublishInFather(initLog.debug, faces[2], centres[2], 'centre2' )
+ geomPublishInFather(initLog.debug, faces[3], centres[3], 'centre3' )
alledges = [None, None, None, None]
alledges[0] = geompy.ExtractShapes(faces[0], geompy.ShapeType["EDGE"], True)
dicoedge[edgid] = edgesface[j]
edges.append(edgesface[j])
named = 'edge_' + str(i) + '_' +str(j)
- geompy.addToStudyInFather( faces[i], edgesface[j], named)
+ geomPublishInFather(initLog.debug, faces[i], edgesface[j], named)
vertices = geompy.ExtractShapes(edgesface[j], geompy.ShapeType["VERTEX"], False)
#firstVertex = geompy.GetFirstVertex(edgesface[j])
if geompy.GetSubShapeID(tore, vertices[0]) != geompy.GetSubShapeID(tore, centres[i]):
import logging
from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
# -----------------------------------------------------------------------------
# --- faces fissure dans et hors tore, et edges face hors tore
facefissintore = f1
facefissoutore = f0
- geompy.addToStudyInFather(faceFissure, facefissintore,'facefissintore')
- geompy.addToStudyInFather(faceFissure, facefissoutore,'facefissoutore')
+ geomPublishInFather(initLog.debug, faceFissure, facefissintore,'facefissintore')
+ geomPublishInFather(initLog.debug, faceFissure, facefissoutore,'facefissoutore')
edgeint = geompy.GetShapesOnShape(extrusionDefaut, facefissoutore, geompy.ShapeType["EDGE"], GEOM.ST_IN)
edgeext = geompy.GetShapesOnShape(extrusionDefaut, facefissoutore, geompy.ShapeType["EDGE"], GEOM.ST_ON)
for i in range(len(edgeint)):
name = "edgeint_%d"%i
- geompy.addToStudyInFather(facefissoutore, edgeint[i],name)
+ geomPublishInFather(initLog.debug, facefissoutore, edgeint[i],name)
for i in range(len(edgeext)):
name = "edgeext_%d"%i
- geompy.addToStudyInFather(facefissoutore, edgeext[i],name)
+ geomPublishInFather(initLog.debug, facefissoutore, edgeext[i],name)
reverext = []
if len(edgeext) > 1:
import logging
from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
# -----------------------------------------------------------------------------
# --- identification des faces tore et fissure dans le solide hors tore du bloc partitionné
blocFaceTore1 = geompy.GetInPlaceByHistory(blocp, facetore1)
blocFaceTore2 = geompy.GetInPlaceByHistory(blocp, facetore2)
- geompy.addToStudyInFather(blocp, blocFaceFiss,'blocFaceFiss')
- geompy.addToStudyInFather(blocp, blocFaceTore1,'blocFaceTore1')
- geompy.addToStudyInFather(blocp, blocFaceTore2,'blocFaceTore2')
+ geomPublishInFather(initLog.debug, blocp, blocFaceFiss,'blocFaceFiss')
+ geomPublishInFather(initLog.debug, blocp, blocFaceTore1,'blocFaceTore1')
+ geomPublishInFather(initLog.debug, blocp, blocFaceTore2,'blocFaceTore2')
return blocFaceFiss, blocFaceTore1, blocFaceTore2
import logging
from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
from extractionOrientee import extractionOrientee
from getSubshapeIds import getSubshapeIds
#[facetore1,facetore2] = geompy.GetShapesOnShape(pipe0, tore, geompy.ShapeType["FACE"], GEOM.ST_ON)
- geompy.addToStudyInFather( tore, facetore1, 'facetore1' )
- geompy.addToStudyInFather( tore, facetore2, 'facetore2' )
+ geomPublishInFather(initLog.debug, tore, facetore1, 'facetore1' )
+ geomPublishInFather(initLog.debug, tore, facetore2, 'facetore2' )
[volumeTore1, volumeTore2] = geompy.ExtractShapes(tore, geompy.ShapeType["SOLID"], True)
- geompy.addToStudyInFather( tore, volumeTore1, 'volumeTore1' )
- geompy.addToStudyInFather( tore, volumeTore2, 'volumeTore2' )
+ geomPublishInFather(initLog.debug, tore, volumeTore1, 'volumeTore1' )
+ geomPublishInFather(initLog.debug, tore, volumeTore2, 'volumeTore2' )
return facetore1, facetore2, volumeTore1, volumeTore2
import logging
from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
# -----------------------------------------------------------------------------
# --- trouver les vertices extremites d'un wire
else:
idsubs[subid] = [sub]
name='vertex%d'%i
- geompy.addToStudyInFather(aWire, sub, name)
+ geomPublishInFather(initLog.debug, aWire, sub, name)
if getNormals:
idnorm[subid] = normals[i]
name='norm%d'%i
- geompy.addToStudyInFather(aWire, normals[i], name)
+ geomPublishInFather(initLog.debug, aWire, normals[i], name)
logging.debug("idsubs: %s", idsubs)
for k, v in idsubs.iteritems():
if len(v) == 1:
import logging
from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
# -----------------------------------------------------------------------------
# --- trouver les vertices intermediaires d'un wire
else:
idsubs[subid] = [sub]
name='vertex%d'%i
- geompy.addToStudyInFather(aWire, sub, name)
+ geomPublishInFather(initLog.debug, aWire, sub, name)
if getNormals:
idnorm[subid] = normals[i]
name='norm%d'%i
- geompy.addToStudyInFather(aWire, normals[i], name)
+ geomPublishInFather(initLog.debug, aWire, normals[i], name)
for k, v in idsubs.iteritems():
if len(v) > 1:
shortList.append(v[0])
# -*- coding: utf-8 -*-
from geomsmesh import geompy, smesh
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
import math
import GEOM
from triedreBase import triedreBase
from genereMeshCalculZoneDefaut import genereMeshCalculZoneDefaut
from creeZoneDefautDansObjetSain import creeZoneDefautDansObjetSain
-from insereFissureGenerale import insereFissureGenerale
+from construitFissureGenerale import construitFissureGenerale
from sortEdges import sortEdges
O, OX, OY, OZ = triedreBase()
Rotation_2 = geompy.MakeRotation(OZ, OY, angleCoude*math.pi/180.0)
tube_2 = geompy.MakePrismVecH(Rotation_1, Rotation_2, -l_tube_p2)
plan_y = geompy.MakePlaneLCS(None, 100000, 3)
- geompy.addToStudy( plan_y, "plan_y" )
- geompy.addToStudy( tube_1, "tube_1" )
- geompy.addToStudy( coude, "coude" )
- geompy.addToStudy( tube_2, "tube_2" )
+ geomPublish(initLog.debug, plan_y, "plan_y" )
+ geomPublish(initLog.debug, tube_1, "tube_1" )
+ geomPublish(initLog.debug, coude, "coude" )
+ geomPublish(initLog.debug, tube_2, "tube_2" )
P1 = O
- geompy.addToStudy( P1, "P1" )
+ geompy.addToStudy(P1, "P1" )
op2 = geompy.MakeVertex(0, 0, -l_tube_p1)
P2 = geompy.MakeRotation(op2, axe, angleCoude*math.pi/180.0)
P2 = geompy.MakeTranslationVectorDistance(P2, Rotation_2, -l_tube_p2)
- geompy.addToStudy( P2, "P2" )
+ geompy.addToStudy(P2, "P2" )
# --- tube coude sain
geometrieSaine = geompy.MakePartition([tube_1, coude, tube_2, P1, P2], [plan_y], [], [], geompy.ShapeType["SOLID"], 0, [], 1)
- geompy.addToStudy( geometrieSaine, self.nomCas )
+ geomPublish(initLog.debug, geometrieSaine, self.nomCas )
[P1, P2] = geompy.RestoreGivenSubShapes(geometrieSaine, [P1, P2], GEOM.FSM_GetInPlaceByHistory, False, True)
xmin = -de -r_cintr -l_tube_p2
grped = geompy.CutGroups(grpedy0, long_p1)
grped = geompy.CutGroups(grped, long_p2)
ep = geompy.CutGroups(grped, long_coude)
- geompy.addToStudyInFather( geometrieSaine, long_p1, 'long_p1' )
- geompy.addToStudyInFather( geometrieSaine, ep, 'ep' )
- geompy.addToStudyInFather( geometrieSaine, long_coude, 'long_coude' )
- geompy.addToStudyInFather( geometrieSaine, circ_g, 'circ_g' )
- geompy.addToStudyInFather( geometrieSaine, circ_d, 'circ_d' )
- geompy.addToStudyInFather( geometrieSaine, long_p2, 'long_p2' )
+ geomPublishInFather(initLog.debug, geometrieSaine, long_p1, 'long_p1' )
+ geomPublishInFather(initLog.debug, geometrieSaine, ep, 'ep' )
+ geomPublishInFather(initLog.debug, geometrieSaine, long_coude, 'long_coude' )
+ geomPublishInFather(initLog.debug, geometrieSaine, circ_g, 'circ_g' )
+ geomPublishInFather(initLog.debug, geometrieSaine, circ_d, 'circ_d' )
+ geomPublishInFather(initLog.debug, geometrieSaine, long_p2, 'long_p2' )
# --- face extremite tube (EXTUBE)
facesIds = geompy.GetShapesOnPlaneIDs(geometrieSaine, geompy.ShapeType["FACE"], OZ, GEOM.ST_ON)
EXTUBE = geompy.CreateGroup(geometrieSaine, geompy.ShapeType["FACE"])
geompy.UnionIDs(EXTUBE, facesIds)
- geompy.addToStudyInFather( geometrieSaine, EXTUBE, 'EXTUBE' )
+ geomPublishInFather(initLog.debug, geometrieSaine, EXTUBE, 'EXTUBE' )
# --- edge bord extremite tube (BORDTU)
edgesIds.append(edge)
BORDTU = geompy.CreateGroup(geometrieSaine, geompy.ShapeType["EDGE"])
geompy.UnionIDs(BORDTU, edgesIds)
- geompy.addToStudyInFather( geometrieSaine, BORDTU, 'BORDTU' )
+ geomPublishInFather(initLog.debug, geometrieSaine, BORDTU, 'BORDTU' )
# --- face origine tube (CLGV)
pp2 = geompy.MakeTranslationVectorDistance(P2, Rotation_2, 10)
vec2 = geompy.MakeVector(P2, pp2)
- #geompy.addToStudy(vec2, 'vec2')
+ #geomPublish(initLog.debug, vec2, 'vec2')
facesIds = geompy.GetShapesOnPlaneIDs(geometrieSaine, geompy.ShapeType["FACE"], vec2, GEOM.ST_ON)
CLGV = geompy.CreateGroup(geometrieSaine, geompy.ShapeType["FACE"])
geompy.UnionIDs(CLGV, facesIds)
- geompy.addToStudyInFather( geometrieSaine, CLGV, 'CLGV' )
+ geomPublishInFather(initLog.debug, geometrieSaine, CLGV, 'CLGV' )
# --- peau tube interieur (PEAUINT)
extru2 = geompy.MakePrismVecH(rot1, Rotation_2, -l_tube_p2)
interne = geompy.MakeFuse(extru1, revol1)
interne = geompy.MakeFuse(extru2, interne)
- geompy.addToStudy(interne, 'interne')
+ geomPublish(initLog.debug, interne, 'interne')
facesIds = geompy.GetShapesOnShapeIDs(interne, geometrieSaine, geompy.ShapeType["FACE"], GEOM.ST_ONIN)
PEAUINT = geompy.CreateGroup(geometrieSaine, geompy.ShapeType["FACE"])
geompy.UnionIDs(PEAUINT, facesIds)
- geompy.addToStudyInFather( geometrieSaine, PEAUINT, 'PEAUINT' )
+ geomPublishInFather(initLog.debug, geometrieSaine, PEAUINT, 'PEAUINT' )
# --- peau tube exterieur (PEAUEXT)
extru2 = geompy.MakePrismVecH(rot1, Rotation_2, -l_tube_p2)
externe = geompy.MakeFuse(extru1, revol1)
externe = geompy.MakeFuse(extru2, externe)
- geompy.addToStudy(externe, 'externe')
+ geomPublish(initLog.debug, externe, 'externe')
facesIds = geompy.GetShapesOnShapeIDs(externe, geometrieSaine, geompy.ShapeType["FACE"], GEOM.ST_ON)
PEAUEXT = geompy.CreateGroup(geometrieSaine, geompy.ShapeType["FACE"])
geompy.UnionIDs(PEAUEXT, facesIds)
- geompy.addToStudyInFather( geometrieSaine, PEAUEXT, 'PEAUEXT' )
+ geomPublishInFather(initLog.debug, geometrieSaine, PEAUEXT, 'PEAUEXT' )
# --- solide sain
volIds = geompy.SubShapeAllIDs(geometrieSaine, geompy.ShapeType["SOLID"])
COUDE = geompy.CreateGroup(geometrieSaine, geompy.ShapeType["SOLID"])
geompy.UnionIDs(COUDE, volIds)
- geompy.addToStudyInFather( geometrieSaine, COUDE, 'COUDSAIN' )
+ geomPublishInFather(initLog.debug, geometrieSaine, COUDE, 'COUDSAIN' )
geometriesSaines = [geometrieSaine, long_p1, ep, long_coude, circ_g, circ_d, long_p2, P1, P2, EXTUBE, BORDTU, CLGV, PEAUINT, PEAUEXT, COUDE]
azimut = -azimut # axe inverse / ASCOUF
axe = geompy.MakeTranslation(OY, -r_cintr, 0, -l_tube_p1)
- geompy.addToStudy(axe,"axe")
+ geomPublish(initLog.debug, axe,"axe")
if not lgInfluence:
lgInfluence = profondeur
pi = geompy.MakeVertex(rayint, 0, 0)
pbl = geompy.MakeRotation(pb, OZ, angle)
pbr = geompy.MakeRotation(pb, OZ, -angle)
- geompy.addToStudy(pbl,"pbl")
- geompy.addToStudy(pbr,"pbr")
+ geomPublish(initLog.debug, pbl,"pbl")
+ geomPublish(initLog.debug, pbr,"pbr")
pal = geompy.MakeTranslationVector(pbl, OZ)
par = geompy.MakeTranslationVector(pbr, OZ)
axl = geompy.MakeVector(pbl,pal)
wire2 = geompy.MakeInterpol(points[2*nbp:3*nbp+1])
#wiretube = geompy.MakeInterpol(points)
wiretube=geompy.MakeWire([wire0,wire1,wire2])
- geompy.addToStudy(wiretube,"wiretube")
+ geomPublish(initLog.debug, wiretube,"wiretube")
pe = geompy.MakeVertex(rayext, 0, 0)
pe = geompy.MakeRotation(pe, OZ, azimut*math.pi/180.)
pe = geompy.MakeRotation(pe, axe, alpha*math.pi/180.)
arce = geompy.MakeArc(points[0], pe, points[-1])
- geompy.addToStudy(arce,"arce")
+ geomPublish(initLog.debug, arce,"arce")
facefiss = geompy.MakeFaceWires([arce, wiretube], 1)
- geompy.addToStudy( facefiss, 'facefissPlace' )
+ geomPublish(initLog.debug, facefiss, 'facefissPlace' )
pc = geompy.MakeVertex((raybor + rayint)/2.0, 0, 0)
centre = geompy.MakeRotation(pc, OZ, azimut*math.pi/180.)
centre = geompy.MakeTranslation(centre, 0, 0, -l_tube_p1)
centre = geompy.MakeRotation(centre, axe, alpha*math.pi/180.)
- geompy.addToStudy( centre, 'centrefissPlace' )
+ geomPublish(initLog.debug, centre, 'centrefissPlace' )
wiretube = geompy.GetInPlace(facefiss, wiretube)
- geompy.addToStudy(wiretube, 'wiretubePlace' )
+ geomPublish(initLog.debug, wiretube, 'wiretubePlace' )
try:
edgetube = geompy.MakeEdgeWire(wiretube)
- geompy.addToStudy(edgetube,"edgetube")
+ geomPublish(initLog.debug, edgetube,"edgetube")
except:
logging.debug("erreur MakeEdgeWire sur fond de fissure, on fait sans")
edgetube = None
points.append(pt)
curves.append(geompy.MakeInterpol(points))
point0 = points[0]
- geompy.addToStudy(curves[-1],"curve0")
+ geomPublish(initLog.debug, curves[-1],"curve0")
# for i, pt in enumerate(points):
# name = "point%d"%i
-# geompy.addToStudyInFather(curves[-1], pt, name)
+# geomPublishInFather(initLog.debug,curves[-1], pt, name)
points = []
nbp = 3*nbp1
pt = geompy.MakeRotation(pi, axe, angi)
points.append(pt)
curves.append(geompy.MakeInterpol(points))
- geompy.addToStudy(curves[-1],"curve1")
+ geomPublish(initLog.debug, curves[-1],"curve1")
# for i, pt in enumerate(points):
# name = "point%d"%i
-# geompy.addToStudyInFather(curves[-1], pt, name)
+# geomPublishInFather(initLog.debug,curves[-1], pt, name)
points = []
nbp = 3*nbp1
points.append(pt)
curves.append(geompy.MakeInterpol(points))
point1 = points[-1]
- geompy.addToStudy(curves[-1],"curve2")
+ geomPublish(initLog.debug, curves[-1],"curve2")
# for i, pt in enumerate(points):
# name = "point%d"%i
-# geompy.addToStudyInFather(curves[-1], pt, name)
+# geomPublishInFather(initLog.debug,curves[-1], pt, name)
wiretube = geompy.MakeWire(curves)
- geompy.addToStudy(wiretube,"wiretube")
+ geomPublish(initLog.debug, wiretube,"wiretube")
try:
edgetube = geompy.MakeEdgeWire(wiretube)
- geompy.addToStudy(edgetube,"edgetube")
+ geomPublish(initLog.debug, edgetube,"edgetube")
except:
logging.debug("erreur MakeEdgeWire sur fond de fissure, on fait sans")
edgetube = None
pts.append(pt)
pts.append(point1)
arce = geompy.MakeInterpol(pts)
- geompy.addToStudy(arce,"arce")
+ geomPublish(initLog.debug, arce,"arce")
facefiss = geompy.MakeFaceWires([arce, wiretube], 0)
- geompy.addToStudy( facefiss, 'facefissPlace' )
+ geomPublish(initLog.debug, facefiss, 'facefissPlace' )
pc = geompy.MakeTranslation(pb, 0.5*prof*cosaz, 0.5*prof*sinaz, 0.)
centre = geompy.MakeRotation(pc, axe, alfrd)
- geompy.addToStudy( centre, 'centrefissPlace' )
+ geomPublish(initLog.debug, centre, 'centrefissPlace' )
edges = geompy.ExtractShapes(facefiss, geompy.ShapeType["EDGE"], True)
edgesTriees, minl, maxl = sortEdges(edges)
edges = edgesTriees[:-1] # la plus grande correspond à arce, on l'elimine
wiretube = geompy.MakeWire(edges)
#wiretube = edgesTriees[-1]
- geompy.addToStudy(wiretube, 'wiretubePlace' )
+ geomPublish(initLog.debug, wiretube, 'wiretubePlace' )
# ---------------------------------------------------------
arci = geompy.MakePosition(arco, originLCS, localLCS, "arci")
arce = geompy.MakePosition(lino, originLCS, localLCS, "arce")
facefiss = geompy.MakeFaceWires([arce, arci], 0)
- geompy.addToStudy( facefiss, 'facefissPlace' )
+ geomPublish(initLog.debug, facefiss, 'facefissPlace' )
edges = geompy.ExtractShapes(facefiss, geompy.ShapeType["EDGE"], True)
edgesTriees, minl, maxl = sortEdges(edges)
edgetube = edgesTriees[-1] # la plus grande correspond à arci
pc = geompy.MakeTranslation(pb, 0.5*prof*cosaz, 0.5*prof*sinaz, 0.)
centre = geompy.MakeRotation(pc, axe, alfrd)
- geompy.addToStudy( centre, 'centrefissPlace' )
+ geomPublish(initLog.debug, centre, 'centrefissPlace' )
coordsNoeudsFissure = genereMeshCalculZoneDefaut(facefiss, profondeur/2. ,profondeur)
def genereMaillageFissure(self, geometriesSaines, maillagesSains,
shapesFissure, shapeFissureParams,
maillageFissureParams, elementsDefaut, step):
- maillageFissure = insereFissureGenerale(maillagesSains,
- shapesFissure, shapeFissureParams,
- maillageFissureParams, elementsDefaut, step)
+ maillageFissure = construitFissureGenerale(maillagesSains,
+ shapesFissure, shapeFissureParams,
+ maillageFissureParams, elementsDefaut, step)
return maillageFissure
# ---------------------------------------------------------------------------
# -*- coding: utf-8 -*-
+import logging
+
from blocFissure import gmu
from blocFissure.gmu.initEtude import initEtude
from blocFissure.gmu.getStatsMaillageFissure import getStatsMaillageFissure
# ---------------------------------------------------------------------------
def executeProbleme(self, step=-1):
- print "executeProbleme", self.nomCas
+ logging.info(" --- executeProbleme %s", self.nomCas)
if step == 0:
return
--- /dev/null
+# -*- coding: utf-8 -*-
+"""
+Created on Tue Jun 24 09:14:13 2014
+
+@author: I48174 (Olivier HOAREAU)
+"""
+
+import logging
+from geomsmesh import geompy
+from geomsmesh import smesh
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
+import GEOM
+import SMESH
+
+from listOfExtraFunctions import createNewMeshesFromCorner
+from listOfExtraFunctions import createLinesFromMesh
+
+# -----------------------------------------------------------------------------
+# --- groupe de quadrangles de face transformé en face géométrique par filling
+
+def fusionMaillageDefaut(maillageSain, maillageDefautCible, maillageInterneCible, zoneDefaut_skin, shapeDefaut, listOfCorners):
+ """ """
+ # TODO: rédiger la docstring
+
+ logging.info("start")
+
+ facesNonCoupees = []
+ facesCoupees = []
+ maillagesNonCoupes = []
+ maillagesCoupes = []
+
+ # On crée une liste contenant le maillage de chaque face.
+ listOfNewMeshes = createNewMeshesFromCorner(maillageDefautCible, listOfCorners)
+
+ i = 0
+ while i < len(listOfNewMeshes):
+ lines = createLinesFromMesh(listOfNewMeshes[i])
+ setOfLines = []
+ for line in lines:
+ # On possède l'information 'ID' de chaque noeud composant chaque
+ # ligne de la face. A partir de l'ID, on crée un vertex. Un
+ # ensemble de vertices constitue une ligne. Un ensemble de lignes
+ # constitue la face.
+ tmpCoords = [maillageDefautCible.GetNodeXYZ(node) for node in line]
+ tmpPoints = [geompy.MakeVertex(val[0], val[1], val[2]) for val in tmpCoords]
+ line = geompy.MakeInterpol(tmpPoints, False, False)
+ setOfLines.append(line)
+
+ # A partir des lignes de la face,
+ # on recrée un objet GEOM temporaire par filling.
+ filling = geompy.MakeFilling(geompy.MakeCompound(setOfLines), 2, 5, 0.0001, 0.0001, 0, GEOM.FOM_Default, True)
+ #logging.debug("face de filling")
+ #geomPublish(initLog.debug, filling, 'filling_{0}'.format(i + 1))
+
+ tmpPartition = geompy.MakePartition([filling], [shapeDefaut], [], [], geompy.ShapeType["FACE"], 0, [], 0)
+ tmpExplodeRef = geompy.ExtractShapes(filling, geompy.ShapeType["EDGE"], True)
+ tmpExplodeNum = geompy.ExtractShapes(tmpPartition, geompy.ShapeType["EDGE"], True)
+ if len(tmpExplodeRef) == len(tmpExplodeNum):
+ logging.debug("face de filling non coupee")
+ geompy.addToStudy( filling, "faceNonCoupee_{0}".format(i + 1)) # doit etre publie pour critere OK plus bas
+ facesNonCoupees.append(filling)
+ maillagesNonCoupes.append(listOfNewMeshes[i])
+ else:
+ logging.debug("face de filling coupee")
+ geompy.addToStudy( filling, "faceCoupee_{0}".format(i + 1))
+ facesCoupees.append(filling)
+ maillagesCoupes.append(listOfNewMeshes[i])
+
+ i += 1
+
+ listOfInternMeshes = [maillageInterneCible] + [msh.GetMesh() for msh in maillagesNonCoupes]
+
+ newMaillageInterne = smesh.Concatenate(listOfInternMeshes, 1, 1, 1e-05, False)
+
+ facesEnTrop = []
+
+ criteres = [smesh.GetCriterion(SMESH.FACE, SMESH.FT_BelongToGenSurface, SMESH.FT_Undefined, face) for face in facesNonCoupees]
+ filtres = [smesh.GetFilterFromCriteria([critere]) for critere in criteres]
+ for i, filtre in enumerate(filtres):
+ filtre.SetMesh(maillageSain.GetMesh())
+ faceEnTrop = maillageSain.GroupOnFilter(SMESH.FACE, 'faceEnTrop_{0}'.format(i + 1), filtre)
+ facesEnTrop.append(faceEnTrop)
+
+ newZoneDefaut_skin = maillageSain.GetMesh().CutListOfGroups([zoneDefaut_skin], facesEnTrop, 'newZoneDefaut_skin')
+
+ smesh.SetName(newMaillageInterne, 'newInternalBoundary')
+
+ return newZoneDefaut_skin, newMaillageInterne
+
\ No newline at end of file
import logging
from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
from toreFissure import toreFissure
from ellipsoideDefaut import ellipsoideDefaut
plane1 = rotTrans(Plane_1, orientation, centreDefaut, vecteurDefaut)
ellipsoide1 = rotTrans(ellipsoide, orientation, centreDefaut, vecteurDefaut)
- geompy.addToStudy( pipe0, 'pipe0' )
- geompy.addToStudy( gener1, 'gener1' )
- geompy.addToStudy( pipe1, 'pipe1' )
- geompy.addToStudy( facefis1, 'facefis1' )
- geompy.addToStudy( plane1, 'plane1' )
- geompy.addToStudy( ellipsoide1, 'ellipsoide1' )
+ geomPublish(initLog.debug, pipe0, 'pipe0' )
+ geomPublish(initLog.debug, gener1, 'gener1' )
+ geomPublish(initLog.debug, pipe1, 'pipe1' )
+ geomPublish(initLog.debug, facefis1, 'facefis1' )
+ geomPublish(initLog.debug, plane1, 'plane1' )
+ geomPublish(initLog.debug, ellipsoide1, 'ellipsoide1' )
shapeDefaut = facefis1
xyz_defaut = geompy.PointCoordinates(centreDefaut)
def genereMeshCalculZoneDefaut(facefiss, minSize, maxSize):
"""
- TODO: a completer
- """
+ -Permet de générer un maillage sur l'objet géométrique 'facefiss' via
+ l'algorithme NETGEN_1D2D :
+ -SetMaxSize = dimension max d'un élément (maxSize)
+ -SetSecondOrder = élément quadratique (Y=1, N=0)
+ -SetOptimize = élément régulier (Y=1, N=0)
+ -SetFineness = finesse du maillage
+ [very_coarse, coarse, moderate, fine, very_fine, custom]
+ [0, 1, 2, 3, 4, 5 ]
+ -SetMinSize = dimension min d'un élément (minSize)
+ -SetQuadAllowed = permission quadrangle dans maillage triangle
+ -On récupère les coordonnées de chaque noeud de la fissure qu'on stocke
+ dans une liste sous la forme : [X0, Y0, Z0, ..., Xn, Yn, Zn]"""
+
logging.info('start')
meshFissure = smesh.Mesh(facefiss)
import logging
logging.info('start')
+import initLog
import salome
salome.salome_init()
smesh = smeshBuilder.New(salome.myStudy)
logging.debug("initialisation de geompy et smesh OK")
+
+def geomPublish(level,aShape, aName):
+ if initLog.getLogLevel() <= level:
+ geompy.addToStudy(aShape, aName)
+
+def geomPublishInFather(level, aFather, aShape, aName):
+ if initLog.getLogLevel() <= level:
+ geompy.addToStudyInFather(aFather, aShape, aName)
+
\ No newline at end of file
import logging
from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
import bisect
publie = False
def getCentreFondFiss(shapesFissure):
"""
identification du centre de fond de fissure,
- transformation fond de fissure en edge unique (seulement pour la procédure insereFissureGenerale).
+ transformation fond de fissure en edge unique (seulement pour la procédure construitFissureGenerale).
On distingue le cas d'utilisation de la procédure insereFissureLongue par le nombre d'éléments de shapesFissure.
"""
global publie
logging.debug("start")
fondFiss = shapesFissure[4] # groupe d'edges de fond de fissure
- if len(shapesFissure) == 6: # procédure insereFissureGenerale, et edge fond de fissure fournie explicitement
+ if len(shapesFissure) == 6: # procédure construitFissureGenerale, et edge fond de fissure fournie explicitement
edgeFondExt = shapesFissure[5]
else:
edgeFondExt = None
if len(shapesFissure) > 6: # procédure insereFissureLongue (fissure plane, plusieurs edges sur le fond de fissure)
centreFondFiss = shapesFissure[1]
tgtCentre = None
- else: # procédure insereFissureGenerale, détermination edge unique et milieu de l'edge
+ else: # procédure construitFissureGenerale, détermination edge unique et milieu de l'edge
if geompy.NumberOfEdges(fondFiss) > 1:
if geompy.NbShapes(fondFiss, geompy.ShapeType["WIRE"]) > 0: # wire
aWire = fondFiss
edgeFondExt = fondFiss
aWire = geompy.MakeWire([fondFiss], 1e-07)
if not publie:
- geompy.addToStudy(aWire, "wireFondFissExt")
+ geomPublish(initLog.debug, aWire, "wireFondFissExt")
lgWire = geompy.BasicProperties(aWire)[0]
edges = geompy.ExtractShapes(aWire, geompy.ShapeType["EDGE"], True)
centreFondFiss = geompy.MakeVertexOnCurve(edges[iedr], 1.0 - lgOnEdge/lgEdges[iedr])
else: # on ne sait pas comment est orientée l'edge unique, mais ça n'a pas d'importance
centreFondFiss = geompy.MakeVertexOnCurve(edges[iedr], lgOnEdge/lgEdges[iedr])
- geompy.addToStudyInFather(aWire, centreFondFiss, "centreFondFiss")
+ geomPublishInFather(initLog.debug,aWire, centreFondFiss, "centreFondFiss")
tgtCentre = geompy.MakeTangentOnCurve(edges[iedr], lgOnEdge/ lgEdges[iedr])
if edgeFondExt is None: # fond de fissure non fourni explicitement sous forme d'edge
logging.debug("erreur MakeEdgeWire sur fond de fissure, on fait sans")
edgeFondExt = None
if not publie and edgeFondExt is not None:
- geompy.addToStudy(edgeFondExt, "edgeFondExt")
+ geomPublish(initLog.debug, edgeFondExt, "edgeFondExt")
publie = True
return edgeFondExt, centreFondFiss, tgtCentre
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import logging
+
+from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
+
+from substractSubShapes import substractSubShapes
+
+def identifieEdgesPeau(edgesFissExtPipe,verticesPipePeau, facePeau, facesPeauSorted,
+ edgesPeauFondIn, fillingFaceExterne, aretesVivesC, aretesVivesCoupees):
+ """
+ identification précise des edges et disques des faces de peau selon index extremité fissure
+ """
+ logging.info('start')
+
+ facesPipePeau = [None for i in range(len(edgesFissExtPipe))]
+ endsEdgeFond = [None for i in range(len(edgesFissExtPipe))]
+ edgeRadFacePipePeau = [None for i in range(len(edgesFissExtPipe))]
+
+ edgesListees = []
+ edgesCircPeau = []
+ verticesCircPeau = []
+ if len(verticesPipePeau) > 0: # --- au moins une extrémité du pipe sur cette face de peau
+
+ for face in facesPeauSorted[:-1]: # la ou les faces débouchantes, pas la grande face de peau
+ logging.debug("examen face debouchante circulaire")
+ for i,efep in enumerate(edgesFissExtPipe):
+ dist = geompy.MinDistance(face, efep)
+ logging.debug(" distance face circulaire edge %s", dist)
+ if dist < 1e-3:
+ for ik, edpfi in enumerate(edgesPeauFondIn):
+ if geompy.MinDistance(face, edpfi) < 1e-3:
+ break
+ sharedVertices = geompy.GetSharedShapesMulti([face, edgesPeauFondIn[ik]], geompy.ShapeType["VERTEX"])
+ nameFace = "facePipePeau%d"%i
+ nameVert = "endEdgeFond%d"%i
+ nameEdge = "edgeRadFacePipePeau%d"%i
+ facesPipePeau[i] = face
+ endsEdgeFond[i] = sharedVertices[0]
+ geomPublish(initLog.debug, face, nameFace)
+ geomPublish(initLog.debug, sharedVertices[0], nameVert)
+ edgesFace = geompy.ExtractShapes(face, geompy.ShapeType["EDGE"], True)
+ for edge in edgesFace:
+ if geompy.MinDistance(edge, sharedVertices[0]) < 1e-3:
+ edgeRadFacePipePeau[i] = edge
+ geomPublish(initLog.debug, edge, nameEdge)
+ break
+ pass
+ pass
+ pass
+ pass
+
+ # --- edges circulaires de la face de peau et points de jonction de la face externe de fissure
+ logging.debug("facesPipePeau: %s", facesPipePeau)
+ edgesCircPeau = [None for i in range(len(facesPipePeau))]
+ verticesCircPeau = [None for i in range(len(facesPipePeau))]
+ for i,fcirc in enumerate(facesPipePeau):
+ edges = geompy.GetSharedShapesMulti([facePeau, fcirc], geompy.ShapeType["EDGE"])
+ grpEdgesCirc = geompy.CreateGroup(facePeau, geompy.ShapeType["EDGE"])
+ geompy.UnionList(grpEdgesCirc, edges)
+ edgesCircPeau[i] = grpEdgesCirc
+ name = "edgeCirc%d"%i
+ geomPublishInFather(initLog.debug, facePeau, grpEdgesCirc, name)
+ edgesListees = edgesListees + edges
+ vertices = geompy.GetSharedShapesMulti([facePeau, fcirc], geompy.ShapeType["VERTEX"])
+ grpVertCircPeau = geompy.CreateGroup(facePeau, geompy.ShapeType["VERTEX"])
+ geompy.UnionList(grpVertCircPeau, vertices)
+ verticesCircPeau[i] = grpVertCircPeau
+ name = "pointEdgeCirc%d"%i
+ geomPublishInFather(initLog.debug, facePeau, grpVertCircPeau, name)
+ pass
+ pass # --- au moins une extrémité du pipe sur cette face de peau
+
+ # --- edges de bord de la face de peau
+
+ edgesFilling = geompy.ExtractShapes(fillingFaceExterne, geompy.ShapeType["EDGE"], False)
+ edgesBords = []
+ for i, edge in enumerate(edgesFilling):
+ edgepeau = geompy.GetInPlace(facePeau, edge)
+ name = "edgepeau%d"%i
+ geomPublishInFather(initLog.debug, facePeau,edgepeau, name)
+ logging.debug("edgepeau %s", geompy.ShapeInfo(edgepeau))
+ if geompy.ShapeInfo(edgepeau)['EDGE'] > 1:
+ logging.debug(" EDGES multiples")
+ edgs = geompy.ExtractShapes(edgepeau, geompy.ShapeType["EDGE"], False)
+ edgesBords += edgs
+ edgesListees += edgs
+ else:
+ logging.debug(" EDGE")
+ edgesBords.append(edgepeau)
+ edgesListees.append(edgepeau)
+ groupEdgesBordPeau = geompy.CreateGroup(facePeau, geompy.ShapeType["EDGE"])
+ geompy.UnionList(groupEdgesBordPeau, edgesBords)
+ bordsVifs = None
+ if aretesVivesC is not None:
+ logging.debug("identification des bords vifs par GetInPlace (old)")
+ bordsVifs = geompy.GetInPlace(facePeau, aretesVivesC)
+ if bordsVifs is not None:
+ geomPublishInFather(initLog.debug, facePeau, bordsVifs, "bordsVifs")
+ groupEdgesBordPeau = geompy.CutGroups(groupEdgesBordPeau, bordsVifs)
+ grptmp = None
+ if len(aretesVivesCoupees) > 0:
+ grpC = geompy.MakeCompound(aretesVivesCoupees)
+ grptmp = geompy.GetInPlace(facePeau, grpC)
+ if grptmp is not None:
+ grpnew = geompy.CutGroups(bordsVifs, grptmp) # ce qui est nouveau dans bordsVifs
+ else:
+ grpnew = bordsVifs
+ if grpnew is not None:
+ edv = geompy.ExtractShapes(grpnew, geompy.ShapeType["EDGE"], False)
+ aretesVivesCoupees += edv
+ logging.debug("aretesVivesCoupees %s",aretesVivesCoupees)
+ geomPublishInFather(initLog.debug, facePeau, groupEdgesBordPeau , "EdgesBords")
+
+ # --- edges de la face de peau partagées avec la face de fissure
+
+ edgesPeau = geompy.ExtractShapes(facePeau, geompy.ShapeType["EDGE"], False)
+ edges = substractSubShapes(facePeau, edgesPeau, edgesListees)
+ edgesFissurePeau = []
+ if len(verticesPipePeau) > 0: # --- au moins une extrémité du pipe sur cette face de peau
+ edgesFissurePeau = [None for i in range(len(verticesCircPeau))] # edges associés aux extrémités du pipe, en premier
+ for edge in edges:
+ for i, grpVert in enumerate(verticesCircPeau):
+ if (geompy.MinDistance(grpVert, edge) < 1.e-3) and (edge not in edgesFissurePeau):
+ edgesFissurePeau[i] = edge
+ name = "edgeFissurePeau%d"%i
+ geomPublishInFather(initLog.debug, facePeau, edge, name)
+ for edge in edges: # on ajoute après les edges manquantes
+ if edge not in edgesFissurePeau:
+ edgesFissurePeau.append(edge)
+ else:
+ for i, edge in enumerate(edges):
+ edgesFissurePeau.append(edge)
+ name = "edgeFissurePeau%d"%i
+ geomPublishInFather(initLog.debug, facePeau, edge, name)
+
+ return (endsEdgeFond, facesPipePeau, edgeRadFacePipePeau,
+ edgesCircPeau, verticesCircPeau, groupEdgesBordPeau,
+ bordsVifs, edgesFissurePeau, aretesVivesCoupees)
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import logging
+import math
+
+from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
+
+from produitMixte import produitMixte
+from whichSide import whichSide
+
+def identifieElementsDebouchants(ifil, facesDefaut, partitionPeauFissFond,
+ edgesFondIn, edgesFondFiss, wireFondFiss,
+ aretesVivesC, fillingFaceExterne,
+ edgesPipeIn, verticesPipePeau, rayonPipe,
+ facesInside, facesOnside):
+ """
+ elements débouchants (intersection pipe et peau), indexés selon les edges du fond de fissure (edgesFondIn)
+ """
+
+ logging.info('start')
+
+ verticesEdgesFondIn = [] # les points du fond de fissure au débouché du pipe sur la peau (indice de edgesFondIn)
+ pipexts = [] # les segments de pipe associés au points de fond de fissure débouchants (même indice)
+ cercles = [] # les cercles de generation des pipes débouchant (même indice)
+ facesFissExt = [] # les faces de la fissure externe associés au points de fond de fissure débouchants (même indice)
+ edgesFissExtPeau = [] # edges des faces de fissure externe sur la peau (même indice)
+ edgesFissExtPipe = [] # edges des faces de fissure externe sur le pipe (même indice)
+
+ #logging.debug("edgesFondIn %s", edgesFondIn)
+ for iedf, edge in enumerate(edgesFondIn):
+ name = "edgeFondIn%d"%iedf
+ geomPublishInFather(initLog.debug, partitionPeauFissFond, edge, name)
+ dist = [ geompy.MinDistance(pt, edge) for pt in verticesPipePeau]
+ ptPeau = verticesPipePeau[dist.index(min(dist))] # le point de verticesPipePeau a distance minimale de l'edge
+ [u, PointOnEdge, EdgeInWireIndex] = geompy.MakeProjectionOnWire(ptPeau, wireFondFiss)
+ logging.debug("u:%s, EdgeInWireIndex: %s, len(edgesFondFiss): %s", u, EdgeInWireIndex, len(edgesFondFiss))
+ localEdgeInFondFiss = edgesFondFiss[EdgeInWireIndex]
+ centre = PointOnEdge
+ centre2 = geompy.MakeVertexOnCurve(localEdgeInFondFiss, u)
+ geomPublishInFather(initLog.debug, partitionPeauFissFond, centre2, "centre2_%d"%iedf)
+ verticesEdgesFondIn.append(centre)
+ name = "verticeEdgesFondIn%d"%iedf
+ geomPublishInFather(initLog.debug, partitionPeauFissFond, centre, name)
+ norm = geompy.MakeTangentOnCurve(localEdgeInFondFiss, u)
+ geomPublishInFather(initLog.debug, partitionPeauFissFond, centre, "norm%d"%iedf)
+ cercle = geompy.MakeCircle(centre, norm, rayonPipe)
+ geomPublishInFather(initLog.debug, partitionPeauFissFond, cercle, "cerclorig%d"%iedf)
+ [vertex] = geompy.ExtractShapes(cercle, geompy.ShapeType["VERTEX"], False)
+ vec1 = geompy.MakeVector(centre, vertex)
+ vec2 = geompy.MakeVector(centre, ptPeau)
+ angle = geompy.GetAngleRadians(vec1, vec2)
+ # cas général : on reconstitue une portion de pipe, avec l'arête de couture qui coincide
+ # avec la face de fissure, au niveau du débouché sur la face externe
+ # cas dégénéré : le pipe débouche perpendiculairement à une surface plane à l'origine.
+ # La partition filling / pipe reconstruit échoue.
+ # - Si on partitionne le filling avec un simple pipe obtenu par extrusion droite du cercle,
+ # cela donne un point en trop sur le cercle.
+ # - Si on prend une vraie surface plane (pas un filling), on peut faire la partition avec
+ # les pipes reconstruits
+ logging.debug("angle=%s", angle)
+ #if abs(angle) > 1.e-7:
+ sommetAxe = geompy.MakeTranslationVector(centre, norm)
+ pm = produitMixte(centre, vertex, ptPeau, sommetAxe)
+ if pm > 0: # ajout de pi a (-)angle pour éviter des points confondus (partition échoue) dans les cas dégénérés
+ cercle = geompy.MakeRotation(cercle, norm, angle + math.pi)
+ else:
+ cercle = geompy.MakeRotation(cercle, norm, -angle + math.pi)
+ name = "cercle%d"%iedf
+ geomPublishInFather(initLog.debug,partitionPeauFissFond, cercle, name)
+ cercles.append(cercle)
+
+ # --- estimation de la longueur du pipe necessaire de part et d'autre du point de sortie
+ if aretesVivesC is None:
+ faceTestPeau = fillingFaceExterne
+ else:
+ faceTestPeau = facesDefaut[ifil]
+ sideCentre = whichSide(faceTestPeau, centre)
+ locPt0 = geompy.MakeVertexOnCurve(localEdgeInFondFiss, 0.0)
+ locPt1 = geompy.MakeVertexOnCurve(localEdgeInFondFiss, 1.0)
+ sidePt0 = whichSide(faceTestPeau, locPt0)
+ sidePt1 = whichSide(faceTestPeau, locPt1)
+ logging.debug("position centre cercle: %s, extremité edge u0: %s, u1: %s", sideCentre, sidePt0, sidePt1)
+ normFace = geompy.GetNormal(faceTestPeau, ptPeau)
+ inclPipe = abs(geompy.GetAngleRadians(norm, normFace))
+ lgp = max(rayonPipe/2., abs(3*rayonPipe*math.tan(inclPipe)))
+ logging.debug("angle inclinaison Pipe en sortie: %s degres, lgp: %s", inclPipe*180/math.pi, lgp)
+
+ # --- position des points extremite du pipe sur l'edge debouchante
+ # il faut la distance curviligne ofp du point central par rapport à une extrémité de l'edge débouchante
+ locEdgePart = geompy.MakePartition([localEdgeInFondFiss],[centre], [], [], geompy.ShapeType["EDGE"], 0, [], 0)
+ edgesLoc = geompy.ExtractShapes(locEdgePart, geompy.ShapeType["EDGE"], False)
+ edgesLocSorted =[(geompy.MinDistance(edge, locPt0), kk, edge) for kk, edge in enumerate(edgesLoc)]
+ edgesLocSorted.sort()
+ ofp = geompy.BasicProperties(edgesLocSorted[0][2])[0] # distance curviligne centre locPt0
+ logging.debug("distance curviligne centre extremite0: %s", ofp)
+ p1 = geompy.MakeVertexOnCurveByLength(localEdgeInFondFiss, ofp +lgp, locPt0)
+ p2 = geompy.MakeVertexOnCurveByLength(localEdgeInFondFiss, ofp -lgp, locPt0)
+ geomPublishInFather(initLog.debug, wireFondFiss, p1, "p1_%d"%iedf)
+ geomPublishInFather(initLog.debug, wireFondFiss, p2, "p2_%d"%iedf)
+
+ edgePart = geompy.MakePartition([localEdgeInFondFiss], [p1,p2], [], [], geompy.ShapeType["EDGE"], 0, [], 0)
+ edps = geompy.ExtractShapes(edgePart, geompy.ShapeType["EDGE"], True)
+ for edp in edps:
+ if geompy.MinDistance(centre, edp) < 1.e-3:
+ pipext = geompy.MakePipe(cercle, edp)
+ name = "pipeExt%d"%iedf
+ geomPublishInFather(initLog.debug, partitionPeauFissFond, pipext, name)
+ pipexts.append(pipext)
+
+ for ifa, face in enumerate(facesInside):
+ logging.debug("recherche edges communes entre une face inside et (faces onside, edges pipe et fond débouchante)")
+ edgesPeauFis = []
+ edgesPipeFis = []
+ edgesPipeFnd = []
+ try:
+ edgesPeauFis = geompy.GetSharedShapesMulti([geompy.MakeCompound(facesOnside), face], geompy.ShapeType["EDGE"])
+ logging.debug(" faces onside %s",edgesPeauFis)
+ edgesPipeFis = geompy.GetSharedShapesMulti([geompy.MakeCompound(edgesPipeIn), face], geompy.ShapeType["EDGE"])
+ logging.debug(" edgesPipeIn %s", edgesPipeFis)
+ edgesPipeFnd = geompy.GetSharedShapesMulti([geompy.MakeCompound(edgesFondIn), face], geompy.ShapeType["EDGE"])
+ logging.debug(" edgesFondIn %s ", edgesPipeFnd)
+ except:
+ logging.debug(" pb edges communes %s %s %s",edgesPeauFis, edgesPipeFis, edgesPipeFnd)
+ pass
+ if (len(edgesPeauFis) > 0) and (len(edgesPipeFis) > 0) and (len(edgesPipeFnd) == 0):
+ dist = geompy.MinDistance(geompy.MakeCompound(edgesPeauFis), ptPeau)
+ logging.debug(" test distance extrémité reference %s", dist)
+ if dist < 1.e-3: # c'est la face de fissure externe associée
+ logging.debug(" face %s inside ajoutée", ifa)
+ facesFissExt.append(face)
+ name="faceFissExt%d"%iedf
+ geomPublishInFather(initLog.debug, partitionPeauFissFond, face, name)
+ dist = 1.
+ for ipe, edpe in enumerate(edgesPeauFis):
+ for ipi, edpi in enumerate(edgesPipeFis):
+ dist = geompy.MinDistance(edpe, edpi)
+ if dist < 1.e-3:
+ edgesFissExtPeau.append(edpe)
+ name="edgesFissExtPeau%d"%iedf
+ geomPublishInFather(initLog.debug, partitionPeauFissFond, edpe, name)
+ edgesFissExtPipe.append(edpi)
+ name="edgesFissExtPipe%d"%iedf
+ geomPublishInFather(initLog.debug, partitionPeauFissFond, edpi, name)
+ break
+ if dist < 1.e-3:
+ break
+
+ return (verticesEdgesFondIn, pipexts, cercles, facesFissExt, edgesFissExtPeau, edgesFissExtPipe)
\ No newline at end of file
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import logging
+
+from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
+
+from extractionOrientee import extractionOrientee
+from extractionOrienteeMulti import extractionOrienteeMulti
+
+def identifieElementsFissure(ifil, facesDefaut, partitionPeauFissFond,
+ edgesPipeFiss, edgesFondFiss, aretesVivesC,
+ fillingFaceExterne, centreFondFiss):
+ """
+ # -----------------------------------------------------------------------
+ # --- identification edges fond de fissure, edges pipe sur la face de fissure,
+ # edges prolongées
+ # edges internes communes pipe et fissure, points communs edges fissure peau et edges circulaires
+ """
+
+ logging.info('start')
+
+ edgesPipeC = geompy.GetInPlace(partitionPeauFissFond, geompy.MakeCompound(edgesPipeFiss))
+ geomPublishInFather(initLog.debug, partitionPeauFissFond, edgesPipeC, "edgesPipeFiss")
+ edgesFondC = geompy.GetInPlace(partitionPeauFissFond, geompy.MakeCompound(edgesFondFiss))
+ geomPublishInFather(initLog.debug, partitionPeauFissFond, edgesFondC, "edgesFondFiss")
+
+ if aretesVivesC is None:
+ [edgesInside, edgesOutside, edgesOnside] = extractionOrientee(fillingFaceExterne, partitionPeauFissFond, centreFondFiss, "EDGE", 1.e-3)
+ [facesInside, facesOutside, facesOnside] = extractionOrientee(fillingFaceExterne, partitionPeauFissFond, centreFondFiss, "FACE", 1.e-3)
+ else:
+ [edgesInside, edgesOutside, edgesOnside] = extractionOrienteeMulti(facesDefaut, ifil, partitionPeauFissFond, centreFondFiss, "EDGE", 1.e-3)
+ [facesInside, facesOutside, facesOnside] = extractionOrienteeMulti(facesDefaut, ifil, partitionPeauFissFond, centreFondFiss, "FACE", 1.e-3)
+
+ edgesPipeIn = geompy.GetSharedShapesMulti([edgesPipeC, geompy.MakeCompound(edgesInside)], geompy.ShapeType["EDGE"])
+ verticesPipePeau = []
+
+ for i, edge in enumerate(edgesPipeIn):
+ try:
+ vertices = geompy.GetSharedShapesMulti([edge, geompy.MakeCompound(facesOnside)], geompy.ShapeType["VERTEX"])
+ verticesPipePeau.append(vertices[0])
+ name = "edgePipeIn%d"%i
+ geomPublishInFather(initLog.debug, partitionPeauFissFond, edge, name)
+ name = "verticePipePeau%d"%i
+ geomPublishInFather(initLog.debug, partitionPeauFissFond, vertices[0], name)
+ logging.debug("edgePipeIn%s coupe les faces OnSide", i)
+ except:
+ logging.debug("edgePipeIn%s ne coupe pas les faces OnSide", i)
+
+ edgesFondIn =[]
+ if len(verticesPipePeau) > 0: # au moins une extrémité du pipe sur cette face de peau
+ #tmp = geompy.GetSharedShapesMulti([edgesFondC, geompy.MakeCompound(edgesOutside)], geompy.ShapeType["EDGE"])
+ #edgesFondOut = [ ed for ed in tmp if geompy.MinDistance(ed, geompy.MakeCompound(facesOnside)) < 1.e-3]
+ tmp = geompy.GetSharedShapesMulti([edgesFondC, geompy.MakeCompound(edgesInside)], geompy.ShapeType["EDGE"])
+ edgesFondIn = [ ed for ed in tmp if geompy.MinDistance(ed, geompy.MakeCompound(facesOnside)) < 1.e-3]
+
+ return (edgesPipeIn, verticesPipePeau, edgesFondIn, facesInside, facesOnside)
\ No newline at end of file
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import logging
+
+from identifieElementsFissure import identifieElementsFissure
+from identifieElementsDebouchants import identifieElementsDebouchants
+from trouveEdgesFissPeau import trouveEdgesFissPeau
+from identifieFacesPeau import identifieFacesPeau
+from identifieEdgesPeau import identifieEdgesPeau
+
+def identifieElementsGeometriquesPeau(ifil, partitionPeauFissFond, edgesPipeFiss,
+ edgesFondFiss, wireFondFiss, aretesVivesC,
+ facesDefaut, centreFondFiss, rayonPipe,
+ aretesVivesCoupees):
+ """
+ """
+ logging.info('start')
+ fillingFaceExterne = facesDefaut[ifil]
+
+ logging.debug("traitement partitionPeauFissFond %s", ifil)
+
+ # --- identification edges fond de fissure, edges pipe sur la face de fissure, edges prolongées
+ # edges internes communes pipe et fissure, points communs edges fissure peau et edges circulaires
+
+ (edgesPipeIn, verticesPipePeau, edgesFondIn, facesInside, facesOnside) = identifieElementsFissure(ifil, facesDefaut, partitionPeauFissFond,
+ edgesPipeFiss, edgesFondFiss, aretesVivesC,
+ fillingFaceExterne, centreFondFiss)
+
+ # --- elements débouchants (intersection pipe et peau), indexés selon les edges du fond de fissure (edgesFondIn)
+
+ (verticesEdgesFondIn, pipexts, cercles,
+ facesFissExt, edgesFissExtPeau, edgesFissExtPipe) = identifieElementsDebouchants(ifil, facesDefaut, partitionPeauFissFond,
+ edgesFondIn, edgesFondFiss, wireFondFiss,
+ aretesVivesC, fillingFaceExterne,
+ edgesPipeIn, verticesPipePeau, rayonPipe,
+ facesInside, facesOnside)
+
+ # --- pour les faces de peau sans extremité débouchante de fissure, il faut recenser les edges de fissure sur la face de peau
+
+ if len(verticesPipePeau) == 0: # aucune extrémité du pipe sur cette face de peau
+ edgesFissExtPeau = trouveEdgesFissPeau(facesInside, facesOnside, edgesPipeIn, edgesFondIn, partitionPeauFissFond, edgesFissExtPeau)
+
+ # --- inventaire des faces de peau : face de peau percée du pipe, extrémités du pipe
+
+ (facePeau, facesPeauSorted, edgesPeauFondIn) = identifieFacesPeau(ifil, verticesPipePeau, facesOnside, wireFondFiss,
+ verticesEdgesFondIn, pipexts, cercles,
+ fillingFaceExterne, centreFondFiss)
+
+ # --- identification précise des edges et disques des faces de peau selon index extremité fissure
+
+ (endsEdgeFond, facesPipePeau, edgeRadFacePipePeau,
+ edgesCircPeau, verticesCircPeau, groupEdgesBordPeau,
+ bordsVifs, edgesFissurePeau, aretesVivesCoupees) = identifieEdgesPeau(edgesFissExtPipe, verticesPipePeau, facePeau, facesPeauSorted,
+ edgesPeauFondIn, fillingFaceExterne, aretesVivesC, aretesVivesCoupees)
+
+ dataPPFF = dict(endsEdgeFond = endsEdgeFond, # pour chaque face [points edge fond de fissure aux débouchés du pipe]
+ facesPipePeau = facesPipePeau, # pour chaque face [faces du pipe débouchantes]
+ edgeRadFacePipePeau = edgeRadFacePipePeau, # pour chaque face [edge radiale des faces du pipe débouchantes ]
+ facesFissExt = facesFissExt, # pour chaque face [faces de fissure externes au pipe]
+ edgesFissExtPeau = edgesFissExtPeau, # pour chaque face [edge en peau des faces de fissure externes (pas subshape facePeau)]
+ edgesFissExtPipe = edgesFissExtPipe, # pour chaque face [edge commun au pipe des faces de fissure externes]
+ facePeau = facePeau, # pour chaque face : la face de peau finale a mailler (percee des faces débouchantes)
+ edgesCircPeau = edgesCircPeau, # pour chaque face de peau : [groupe subshapes edges circulaires aux débouchés du pipe]
+ verticesCircPeau = verticesCircPeau, # pour chaque face de peau : [groupe subshapes points sur edges circulaires aux débouchés du pipe]
+ groupEdgesBordPeau = groupEdgesBordPeau, # pour chaque face de peau : groupe subshape des edges aux bords liés à la partie saine
+ bordsVifs = bordsVifs, # pour chaque face de peau : groupe subshape des edges aux bords correspondant à des arêtes vives
+ edgesFissurePeau = edgesFissurePeau, # pour chaque face de peau : [subshape edge en peau des faces de fissure externes]
+ verticesPipePeau = verticesPipePeau # pour chaque face de peau : [point commun edFissPeau edCircPeau]
+ )
+
+ return dataPPFF, aretesVivesCoupees
+
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import logging
+
+from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
+
+def identifieFacesEdgesFissureExterne(fsFissuExt, edFisExtPe, edFisExtPi, edgesPipeFiss):
+ """
+ identification des faces et edges de fissure externe pour maillage
+ """
+ logging.info('start')
+
+ facesFissExt = []
+ edgesFissExtPeau = []
+ edgesFissExtPipe = []
+ for ifil in range(len(fsFissuExt)): # TODO: éliminer les doublons (comparer tous les vertices triés, avec mesure de distance ?)
+ facesFissExt += fsFissuExt[ifil]
+ edgesFissExtPeau += edFisExtPe[ifil]
+ edgesFissExtPipe += edFisExtPi[ifil]
+ logging.debug("---------------------------- identification faces de fissure externes au pipe :%s ", len(facesFissExt))
+ # regroupement des faces de fissure externes au pipe.
+
+ if len(facesFissExt) > 1:
+ faceFissureExterne = geompy.MakePartition(facesFissExt, [], [], [], geompy.ShapeType["FACE"], 0, [], 0)
+ edgesPipeFissureExterneC = geompy.GetInPlace(faceFissureExterne, geompy.MakeCompound(edgesPipeFiss)) # edgesFissExtPipe peut ne pas couvrir toute la longueur
+ # edgesPeauFissureExterneC = geompy.GetInPlace(faceFissureExterne, geompy.MakeCompound(edgesFissExtPeau))
+ # il peut manquer des edges de faceFissureExterne en contact avec la peau dans edgesFissExtPeau
+ (isDone, closedFreeBoundaries, openFreeBoundaries) = geompy.GetFreeBoundary(faceFissureExterne)
+ edgesBordFFE = []
+ for bound in closedFreeBoundaries:
+ edgesBordFFE += geompy.ExtractShapes(bound, geompy.ShapeType["EDGE"], False)
+ edgesBordFFEid = [ (ed,geompy.GetSubShapeID(faceFissureExterne, ed)) for ed in edgesBordFFE]
+ logging.debug("edgesBordFFEid %s", edgesBordFFEid)
+ edgesPPE = geompy.ExtractShapes(edgesPipeFissureExterneC, geompy.ShapeType["EDGE"], False)
+ edgesPPEid = [ geompy.GetSubShapeID(faceFissureExterne, ed) for ed in edgesPPE]
+ logging.debug("edgesPPEid %s", edgesPPEid)
+ edgesPFE = [ edid[0] for edid in edgesBordFFEid if edid[1] not in edgesPPEid] # on garde toutes les edges de bord non en contact avec le pipe
+ logging.debug("edgesPFE %s", edgesPFE)
+ edgesPeauFissureExterneC = geompy.MakeCompound(edgesPFE)
+ else:
+ faceFissureExterne = facesFissExt[0]
+ edgesPeauFissureExterneC = geompy.MakeCompound(edgesFissExtPeau)
+ edgesPipeFissureExterneC = geompy.MakeCompound(edgesFissExtPipe)
+ wirePipeFissureExterne = geompy.MakeWire(geompy.ExtractShapes(edgesPipeFissureExterneC, geompy.ShapeType["EDGE"], False))
+ geomPublish(initLog.debug, faceFissureExterne, "faceFissureExterne")
+ geomPublishInFather(initLog.debug, faceFissureExterne, edgesPeauFissureExterneC, "edgesPeauFissureExterne")
+ geomPublishInFather(initLog.debug, faceFissureExterne, edgesPipeFissureExterneC, "edgesPipeFissureExterne")
+
+ return (faceFissureExterne, edgesPipeFissureExterneC, wirePipeFissureExterne, edgesPeauFissureExterneC)
\ No newline at end of file
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import logging
+
+from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
+
+from sortFaces import sortFaces
+from extractionOrientee import extractionOrientee
+
+def identifieFacesPeau(ifil, verticesPipePeau, facesOnside, wireFondFiss,
+ verticesEdgesFondIn, pipexts, cercles,
+ fillingFaceExterne, centreFondFiss):
+ """
+ inventaire des faces de peau : face de peau percée du pipe, extrémités du pipe
+ La partition avec le pipe peut créer un vertex (et un edge) de trop sur le cercle projeté,
+ quand le cercle est très proche de la face.
+ dans ce cas, la projection du cercle sur la face suivie d'une partition permet
+ d'éviter le point en trop
+ """
+ logging.info('start')
+
+ facesAndFond = facesOnside
+ facesAndFond.append(wireFondFiss)
+ try:
+ partitionPeauByPipe = geompy.MakePartition(facesAndFond, pipexts, [], [], geompy.ShapeType["FACE"], 0, [], 1)
+ except:
+ logging.debug("probleme partition face pipe, contournement avec MakeSection")
+ sections = []
+ for pipext in pipexts:
+ sections.append(geompy.MakeSection(facesOnside[0], pipext))
+ partitionPeauByPipe = geompy.MakePartition(facesAndFond, sections, [], [], geompy.ShapeType["FACE"], 0, [], 1)
+
+ # contrôle edge en trop sur edges circulaires
+ if len(verticesPipePeau) > 0: # --- au moins une extrémité du pipe sur cette face de peau
+ edgeEnTrop = []
+ outilPart = pipexts
+ facesPeau = geompy.ExtractShapes(partitionPeauByPipe, geompy.ShapeType["FACE"], False)
+ facesPeauSorted, minsur, maxsurf = sortFaces(facesPeau)
+ for i, face in enumerate(facesPeauSorted[:-1]): # on ne teste que la ou les petites faces "circulaires"
+ nbv = geompy.NumberOfEdges(face)
+ logging.debug("nombre d'edges sur face circulaire: %s", nbv)
+ if nbv > 3:
+ edgeEnTrop.append(True) # TODO : distinguer les cas avec deux faces circulaires dont l'une est correcte
+ else:
+ edgeEnTrop.append(False)
+ refaire = sum(edgeEnTrop)
+ if refaire > 0:
+ dc = [(geompy.MinDistance(verticesEdgesFondIn[0], fac), i) for i, fac in enumerate(facesPeauSorted[:-1])]
+ dc.sort()
+ logging.debug("dc sorted: %s", dc)
+ i0 = dc[0][1] # indice de facesPeauSorted qui correspond à verticesEdgesFondIn[0], donc 0 pour cercles
+ direct = (i0 == 0)
+ for i, bad in enumerate(edgeEnTrop):
+ if direct:
+ j = i
+ else:
+ j = 1-i
+ if bad:
+ outilPart[j] = geompy.MakeProjection(cercles[j],facesOnside[0])
+ pass
+ partitionPeauByPipe = geompy.MakePartition(facesAndFond, outilPart, [], [], geompy.ShapeType["FACE"], 0, [], 1)
+ pass
+
+ name="partitionPeauByPipe%d"%ifil
+ geomPublish(initLog.debug, partitionPeauByPipe, name)
+ [edgesPeauFondIn, edgesPeauFondOut, edgesPeauFondOn] = extractionOrientee(fillingFaceExterne, partitionPeauByPipe, centreFondFiss, "EDGE", 1.e-3)
+ [facesPeauFondIn, facesPeauFondOut, facesPeauFondOn] = extractionOrientee(fillingFaceExterne, partitionPeauByPipe, centreFondFiss, "FACE", 1.e-3)
+
+ if len(verticesPipePeau) > 0: # --- au moins une extrémité du pipe sur cette face de peau
+ facesPeauSorted, minsur, maxsurf = sortFaces(facesPeauFondOn)
+ facePeau = facesPeauSorted[-1] # la plus grande face
+ else:
+ facePeau =geompy.MakePartition(facesPeauFondOn, [], [], [], geompy.ShapeType["FACE"], 0, [], 1)
+ facesPeauSorted = [facePeau]
+ name="facePeau%d"%ifil
+ geomPublish(initLog.debug, facePeau, name)
+
+ return (facePeau, facesPeauSorted, edgesPeauFondIn)
\ No newline at end of file
import logging
+debug = 10
+info = 20
+warning = 30
+error = 40
+critical = 50
+
+loglevel = warning
+
def setDebug():
+ global loglevel
logging.basicConfig(format='%(relativeCreated)d %(funcName)s[%(lineno)d] %(message)s',
level=logging.DEBUG)
- logging.info('start Debug')
+ loglevel = debug
+ logging.info('start Debug %s', loglevel)
def setVerbose():
+ global loglevel
logging.basicConfig(format='%(relativeCreated)d %(funcName)s[%(lineno)d] %(message)s',
level=logging.INFO)
- logging.info('start Verbose')
+ loglevel = info
+ logging.info('start Verbose %s', loglevel)
def setRelease():
+ global loglevel
logging.basicConfig(format='%(funcName)s[%(lineno)d] %(message)s',
level=logging.WARNING)
- logging.warning('start Release')
+ loglevel = warning
+ logging.warning('start Release %s', loglevel)
def setUnitTests():
+ global loglevel
logging.basicConfig(format='%(funcName)s[%(lineno)d] %(message)s',
level=logging.CRITICAL)
- logging.critical('start UnitTests')
+ loglevel = critical
+ logging.critical('start UnitTests %s', loglevel)
+
+def setPerfTests():
+ global loglevel
+ logging.basicConfig(format='%(relativeCreated)d %(funcName)s[%(lineno)d] %(message)s',
+ level=logging.CRITICAL)
+ loglevel = critical
+ logging.info('start PerfTests %s', loglevel)
+
+def getLogLevel():
+ return loglevel
#logging.basicConfig(filename='myapp.log',
# format='%(asctime)s %(message)s',
import logging
import salome
from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
from geomsmesh import smesh
import SMESH
import math
#plane1 = self.rotTrans(Plane_1, orientation, centreDefaut, normalDefaut)
#ellipsoide1 = self.rotTrans(ellipsoide, orientation, centreDefaut, normalDefaut)
- #geompy.addToStudy( pipe0, 'pipe0' )
- #geompy.addToStudy( gener1, 'gener1' )
- #geompy.addToStudy( pipe1, 'pipe1' )
- #geompy.addToStudy( facefis1, 'facefis1' )
- #geompy.addToStudy( plane1, 'plane1' )
- #geompy.addToStudy( ellipsoide1, 'ellipsoide1' )
+ #geomPublish(initLog.debug, pipe0, 'pipe0' )
+ #geomPublish(initLog.debug, gener1, 'gener1' )
+ #geomPublish(initLog.debug, pipe1, 'pipe1' )
+ #geomPublish(initLog.debug, facefis1, 'facefis1' )
+ #geomPublish(initLog.debug, plane1, 'plane1' )
+ #geomPublish(initLog.debug, ellipsoide1, 'ellipsoide1' )
# --- partition du bloc défaut par génératrice, tore et plan fissure
if step == 7:
import logging
import salome
from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
import GEOM
from geomsmesh import smesh
from salome.smesh import smeshBuilder
#fichierMaillageSain = nomRep + '/' + nomFicSain + '.med'
fichierMaillageFissure = nomRep + '/' + nomFicFissure + '.med'
- facesDefaut = elementsDefaut[0] # fillings des faces en peau
+ # fillings des faces en peau
+ facesDefaut = elementsDefaut[0]
#centresDefaut = elementsDefaut[1]
#normalsDefaut = elementsDefaut[2]
#extrusionsDefaut = elementsDefaut[3]
dmoyen = elementsDefaut[4]
- bordsPartages = elementsDefaut[5]
+ bordsPartages = elementsDefaut[5]
fillconts = elementsDefaut[6]
idFilToCont = elementsDefaut[7]
maillageSain = elementsDefaut[8]
# partition face fissure étendue par fillings, on garde la plus grande face
partShapeDefaut = geompy.MakePartition([shapeDefaut], facesDefaut, [], [], geompy.ShapeType["FACE"], 0, [], 0)
- geompy.addToStudy(partShapeDefaut, 'partShapeDefaut')
+ geomPublish(initLog.debug, partShapeDefaut, 'partShapeDefaut')
facesPartShapeDefaut = geompy.ExtractShapes(partShapeDefaut, geompy.ShapeType["FACE"], False)
if isPointInterne:
distfaces = [(geompy.MinDistance(face,pointInterne), i, face) for i, face in enumerate(facesPartShapeDefaut)]
else:
facesPartShapeDefautSorted, minSurf, maxSurf = sortFaces(facesPartShapeDefaut) # la face de fissure dans le volume doit être la plus grande
logging.debug("surfaces faces fissure étendue, min %s, max %s", minSurf, maxSurf)
- facesPortFissure = facesPartShapeDefautSorted[-1]
+ facesPortFissure = facesPartShapeDefautSorted[-1] #= global
- geompy.addToStudy(facesPortFissure, "facesPortFissure")
+ geomPublish(initLog.debug, facesPortFissure, "facesPortFissure")
O, OX, OY, OZ = triedreBase()
if geompy.NumberOfFaces(shapeDefaut) == 1:
plan = geompy.MakePlane(centreFondFiss, tgtCentre, 10000)
- shapeDefaut = geompy.MakePartition([shapeDefaut], [plan], [], [], geompy.ShapeType["FACE"], 0, [], 0)
- fondFissCoupe = geompy.GetInPlaceByHistory(shapeDefaut, fondFiss)
- geompy.addToStudy(shapeDefaut, 'shapeDefaut_coupe')
- geompy.addToStudyInFather(shapeDefaut, fondFissCoupe, 'fondFiss_coupe')
+ shapeDefaut = geompy.MakePartition([shapeDefaut], [plan], [], [], geompy.ShapeType["FACE"], 0, [], 0) #= local
+ #fondFissCoupe = geompy.GetInPlaceByHistory(shapeDefaut, fondFiss) #= inutile
+ geomPublish(initLog.debug, shapeDefaut, 'shapeDefaut_coupe')
+ #geomPublishInFather(initLog.debug,shapeDefaut, fondFissCoupe, 'fondFiss_coupe')
extrem, norms = findWireEndVertices(fondFiss, True)
logging.debug("extrem: %s, norm: %s",extrem, norms)
cercle = geompy.MakeCircle(extrem[0], norms[0], rayonPipe)
cercle = geompy.MakeRotation(cercle, norms[0], math.pi/3.0 ) # éviter d'avoir l'arête de couture du pipe presque confondue avec la face fissure
- geompy.addToStudy(cercle, 'cercle')
+ geomPublish(initLog.debug, cercle, 'cercle')
fondFissProlonge = prolongeWire(fondFiss, extrem, norms, 2*rayonPipe)
pipeFiss = geompy.MakePipe(cercle, fondFissProlonge)
- geompy.addToStudy(pipeFiss, 'pipeFiss')
+ geomPublish(initLog.debug, pipeFiss, 'pipeFiss')
partFissPipe = geompy.MakePartition([shapeDefaut, pipeFiss], [], [], [], geompy.ShapeType["FACE"], 0, [], 1)
- geompy.addToStudy(partFissPipe, 'partFissPipe')
- fissPipe = geompy.GetInPlaceByHistory(partFissPipe, shapeDefaut)
- geompy.addToStudy(fissPipe, 'fissPipe')
- partPipe = geompy.GetInPlaceByHistory(partFissPipe, pipeFiss)
- geompy.addToStudy(partPipe, 'partPipe')
+ geomPublish(initLog.debug, partFissPipe, 'partFissPipe')
+ fissPipe = geompy.GetInPlaceByHistory(partFissPipe, shapeDefaut) #= global
+ geomPublish(initLog.debug, fissPipe, 'fissPipe')
+ partPipe = geompy.GetInPlaceByHistory(partFissPipe, pipeFiss) #= local
+ geomPublish(initLog.debug, partPipe, 'partPipe')
- edgesPipeFiss = geompy.GetSharedShapesMulti([fissPipe, partPipe], geompy.ShapeType["EDGE"])
+ edgesPipeFiss = geompy.GetSharedShapesMulti([fissPipe, partPipe], geompy.ShapeType["EDGE"]) #= global
for i, edge in enumerate(edgesPipeFiss):
name = "edgePipe%d"%i
- geompy.addToStudyInFather(fissPipe, edge, name)
+ geomPublishInFather(initLog.debug,fissPipe, edge, name)
try:
- wirePipeFiss = geompy.MakeWire(edgesPipeFiss)
+ wirePipeFiss = geompy.MakeWire(edgesPipeFiss) #= global
except:
wirePipeFiss = geompy.MakeCompound(edgesPipeFiss)
logging.debug("wirePipeFiss construit sous forme de compound")
- geompy.addToStudy(wirePipeFiss, "wirePipeFiss")
+ geomPublish(initLog.debug, wirePipeFiss, "wirePipeFiss")
wireFondFiss = geompy.GetInPlace(partFissPipe,fondFiss)
edgesFondFiss = geompy.GetSharedShapesMulti([fissPipe, wireFondFiss], geompy.ShapeType["EDGE"])
for i, edge in enumerate(edgesFondFiss):
name = "edgeFondFiss%d"%i
- geompy.addToStudyInFather(fissPipe, edge, name)
- wireFondFiss = geompy.MakeWire(edgesFondFiss)
- geompy.addToStudy(wireFondFiss,"wireFondFiss")
+ geomPublishInFather(initLog.debug,fissPipe, edge, name)
+ wireFondFiss = geompy.MakeWire(edgesFondFiss) #= global
+ geomPublish(initLog.debug, wireFondFiss,"wireFondFiss")
# -----------------------------------------------------------------------------
# --- peau et face de fissure
# il peut y avoir plusieurs faces externes, dont certaines sont découpées par la fissure
# liste de faces externes : facesDefaut
# liste de partitions face externe - fissure : partitionPeauFissFond (None quand pas d'intersection)
-
- partitionsPeauFissFond = []
+
+ partitionsPeauFissFond = [] #= global
ipart = 0
for filling in facesDefaut:
part = geompy.MakePartition([fissPipe, filling], [], [], [], geompy.ShapeType["FACE"], 0, [], 0)
fissPipePart = fissPipe
part = geompy.MakePartition([fissPipePart, filling], [], [], [], geompy.ShapeType["FACE"], 0, [], 0)
partitionsPeauFissFond.append(part)
- geompy.addToStudy( part, 'partitionPeauFissFond%d'%ipart )
+ geomPublish(initLog.debug, part, 'partitionPeauFissFond%d'%ipart )
else:
partitionsPeauFissFond.append(None)
ipart = ipart +1
+
+
+ # --- arêtes vives détectées (dans quadranglesToShapeNoCorner
+ # et quadranglesToShapeWithCorner)
- # --- arêtes vives détectées (dans quadranglesToShape)
-
aretesVives = []
- aretesVivesCoupees = []
+ aretesVivesCoupees = [] #= global
ia = 0
for a in bordsPartages:
- if a[0] is not None:
- aretesVives.append(a[0])
- name = "areteVive%d"%ia
- geompy.addToStudy(a[0], name)
- ia += 1
- aretesVivesC = None
+ if not isinstance(a, list):
+ aretesVives.append(a)
+ name = "areteVive%d"%ia
+ geomPublish(initLog.debug, a, name)
+ ia += 1
+ else:
+ if a[0] is not None:
+ aretesVives.append(a[0])
+ name = "areteVive%d"%ia
+ geomPublish(initLog.debug, a[0], name)
+ ia += 1
+
+ aretesVivesC = None #= global
if len(aretesVives) > 0:
aretesVivesC =geompy.MakeCompound(aretesVives)
ptFisExtPi = [ [] for i in range(nbFacesFilling)] # pour chaque face de peau : [point commun edFissPeau edCircPeau]
for ifil, partitionPeauFissFond in enumerate(partitionsPeauFissFond):
- fillingFaceExterne = facesDefaut[ifil]
- fillingSansDecoupe = fillconts[idFilToCont[ifil]]
if partitionPeauFissFond is not None:
+ fillingFaceExterne = facesDefaut[ifil]
+ #fillingSansDecoupe = fillconts[idFilToCont[ifil]]
logging.debug("traitement partitionPeauFissFond %s", ifil)
# -----------------------------------------------------------------------
# --- identification edges fond de fissure, edges pipe sur la face de fissure,
# edges prolongées
- edgesPipeC = geompy.GetInPlace(partitionPeauFissFond, geompy.MakeCompound(edgesPipeFiss))
- geompy.addToStudyInFather(partitionPeauFissFond, edgesPipeC, "edgesPipeFiss")
- edgesFondC = geompy.GetInPlace(partitionPeauFissFond, geompy.MakeCompound(edgesFondFiss))
- geompy.addToStudyInFather(partitionPeauFissFond, edgesFondC, "edgesFondFiss")
+ edgesPipeC = geompy.GetInPlace(partitionPeauFissFond, geompy.MakeCompound(edgesPipeFiss)) #= local
+ geomPublishInFather(initLog.debug,partitionPeauFissFond, edgesPipeC, "edgesPipeFiss")
+ edgesFondC = geompy.GetInPlace(partitionPeauFissFond, geompy.MakeCompound(edgesFondFiss)) #= local
+ geomPublishInFather(initLog.debug,partitionPeauFissFond, edgesFondC, "edgesFondFiss")
- if aretesVivesC is None:
+ if aretesVivesC is None: #= global facesInside facesOnside
[edgesInside, edgesOutside, edgesOnside] = extractionOrientee(fillingFaceExterne, partitionPeauFissFond, centreFondFiss, "EDGE", 1.e-3)
[facesInside, facesOutside, facesOnside] = extractionOrientee(fillingFaceExterne, partitionPeauFissFond, centreFondFiss, "FACE", 1.e-3)
else:
[edgesInside, edgesOutside, edgesOnside] = extractionOrienteeMulti(facesDefaut, ifil, partitionPeauFissFond, centreFondFiss, "EDGE", 1.e-3)
[facesInside, facesOutside, facesOnside] = extractionOrienteeMulti(facesDefaut, ifil, partitionPeauFissFond, centreFondFiss, "FACE", 1.e-3)
- edgesPipeIn = geompy.GetSharedShapesMulti([edgesPipeC, geompy.MakeCompound(edgesInside)], geompy.ShapeType["EDGE"])
- verticesPipePeau = []
+ edgesPipeIn = geompy.GetSharedShapesMulti([edgesPipeC, geompy.MakeCompound(edgesInside)], geompy.ShapeType["EDGE"]) #= global
+ verticesPipePeau = [] #= global
for i, edge in enumerate(edgesPipeIn):
try:
vertices = geompy.GetSharedShapesMulti([edge, geompy.MakeCompound(facesOnside)], geompy.ShapeType["VERTEX"])
verticesPipePeau.append(vertices[0])
name = "edgePipeIn%d"%i
- geompy.addToStudyInFather(partitionPeauFissFond, edge, name)
+ geomPublishInFather(initLog.debug,partitionPeauFissFond, edge, name)
name = "verticePipePeau%d"%i
- geompy.addToStudyInFather(partitionPeauFissFond, vertices[0], name)
+ geomPublishInFather(initLog.debug,partitionPeauFissFond, vertices[0], name)
logging.debug("edgePipeIn%s coupe les faces OnSide", i)
except:
logging.debug("edgePipeIn%s ne coupe pas les faces OnSide", i)
- edgesFondOut = []
- edgesFondIn =[]
+ #edgesFondOut = [] #= inutile
+ edgesFondIn =[] #= global
if len(verticesPipePeau) > 0: # au moins une extrémité du pipe sur cette face de peau
- tmp = geompy.GetSharedShapesMulti([edgesFondC, geompy.MakeCompound(edgesOutside)], geompy.ShapeType["EDGE"])
- edgesFondOut = [ ed for ed in tmp if geompy.MinDistance(ed, geompy.MakeCompound(facesOnside)) < 1.e-3]
+ #tmp = geompy.GetSharedShapesMulti([edgesFondC, geompy.MakeCompound(edgesOutside)], geompy.ShapeType["EDGE"])
+ #edgesFondOut = [ ed for ed in tmp if geompy.MinDistance(ed, geompy.MakeCompound(facesOnside)) < 1.e-3]
tmp = geompy.GetSharedShapesMulti([edgesFondC, geompy.MakeCompound(edgesInside)], geompy.ShapeType["EDGE"])
edgesFondIn = [ ed for ed in tmp if geompy.MinDistance(ed, geompy.MakeCompound(facesOnside)) < 1.e-3]
+
verticesEdgesFondIn = [] # les points du fond de fissure au débouché du pipe sur la peau (indice de edgesFondIn)
pipexts = [] # les segments de pipe associés au points de fond de fissure débouchants (même indice)
cercles = [] # les cercles de generation des pipes débouchant (même indice)
edgesFondFiss, edgesIdByOrientation = orderEdgesFromWire(wireFondFiss)
for i,edge in enumerate(edgesFondFiss):
- geompy.addToStudyInFather(wireFondFiss, edge, "edgeFondFiss%d"%i)
+ geomPublishInFather(initLog.debug,wireFondFiss, edge, "edgeFondFiss%d"%i)
for iedf, edge in enumerate(edgesFondIn):
name = "edgeFondIn%d"%iedf
- geompy.addToStudyInFather(partitionPeauFissFond, edge, name)
+ geomPublishInFather(initLog.debug,partitionPeauFissFond, edge, name)
dist = [ geompy.MinDistance(pt, edge) for pt in verticesPipePeau]
ptPeau = verticesPipePeau[dist.index(min(dist))] # le point de verticesPipePeau a distance minimale de l'edge
[u, PointOnEdge, EdgeInWireIndex] = geompy.MakeProjectionOnWire(ptPeau, wireFondFiss)
localEdgeInFondFiss = edgesFondFiss[EdgeInWireIndex]
centre = PointOnEdge
centre2 = geompy.MakeVertexOnCurve(localEdgeInFondFiss, u)
- geompy.addToStudyInFather(partitionPeauFissFond, centre2, "centre2_%d"%iedf)
+ geomPublishInFather(initLog.debug,partitionPeauFissFond, centre2, "centre2_%d"%iedf)
verticesEdgesFondIn.append(centre)
name = "verticeEdgesFondIn%d"%iedf
- geompy.addToStudyInFather(partitionPeauFissFond, centre, name)
+ geomPublishInFather(initLog.debug,partitionPeauFissFond, centre, name)
norm = geompy.MakeTangentOnCurve(localEdgeInFondFiss, u)
- geompy.addToStudyInFather(partitionPeauFissFond, centre, "norm%d"%iedf)
+ geomPublishInFather(initLog.debug,partitionPeauFissFond, centre, "norm%d"%iedf)
cercle = geompy.MakeCircle(centre, norm, rayonPipe)
- geompy.addToStudyInFather(partitionPeauFissFond, cercle, "cerclorig%d"%iedf)
+ geomPublishInFather(initLog.debug,partitionPeauFissFond, cercle, "cerclorig%d"%iedf)
[vertex] = geompy.ExtractShapes(cercle, geompy.ShapeType["VERTEX"], False)
vec1 = geompy.MakeVector(centre, vertex)
vec2 = geompy.MakeVector(centre, ptPeau)
else:
cercle = geompy.MakeRotation(cercle, norm, -angle + math.pi)
name = "cercle%d"%iedf
- geompy.addToStudyInFather(partitionPeauFissFond, cercle, name)
+ geomPublishInFather(initLog.debug,partitionPeauFissFond, cercle, name)
cercles.append(cercle)
# --- estimation de la longueur du pipe necessaire de part et d'autre du point de sortie
logging.debug("distance curviligne centre extremite0: %s", ofp)
p1 = geompy.MakeVertexOnCurveByLength(localEdgeInFondFiss, ofp +lgp, locPt0)
p2 = geompy.MakeVertexOnCurveByLength(localEdgeInFondFiss, ofp -lgp, locPt0)
- geompy.addToStudyInFather(wireFondFiss, p1, "p1_%d"%iedf)
- geompy.addToStudyInFather(wireFondFiss, p2, "p2_%d"%iedf)
+ geomPublishInFather(initLog.debug,wireFondFiss, p1, "p1_%d"%iedf)
+ geomPublishInFather(initLog.debug,wireFondFiss, p2, "p2_%d"%iedf)
edgePart = geompy.MakePartition([localEdgeInFondFiss], [p1,p2], [], [], geompy.ShapeType["EDGE"], 0, [], 0)
edps = geompy.ExtractShapes(edgePart, geompy.ShapeType["EDGE"], True)
if geompy.MinDistance(centre, edp) < 1.e-3:
pipext = geompy.MakePipe(cercle, edp)
name = "pipeExt%d"%iedf
- geompy.addToStudyInFather(partitionPeauFissFond, pipext, name)
+ geomPublishInFather(initLog.debug,partitionPeauFissFond, pipext, name)
pipexts.append(pipext)
for face in facesInside:
logging.debug(" face %s inside ajoutée", i)
facesFissExt.append(face)
name="faceFissExt%d"%iedf
- geompy.addToStudyInFather(partitionPeauFissFond, face, name)
+ geomPublishInFather(initLog.debug,partitionPeauFissFond, face, name)
dist = 1.
for ipe, edpe in enumerate(edgesPeauFis):
for ipi, edpi in enumerate(edgesPipeFis):
if dist < 1.e-3:
edgesFissExtPeau.append(edpe)
name="edgesFissExtPeau%d"%iedf
- geompy.addToStudyInFather(partitionPeauFissFond, edpe, name)
+ geomPublishInFather(initLog.debug,partitionPeauFissFond, edpe, name)
edgesFissExtPipe.append(edpi)
name="edgesFissExtPipe%d"%iedf
- geompy.addToStudyInFather(partitionPeauFissFond, edpi, name)
+ geomPublishInFather(initLog.debug,partitionPeauFissFond, edpi, name)
break
if dist < 1.e-3:
break
if (len(edgesPeauFis) > 0) and (len(edgesPipeFis) > 0) and (len(edgesPipeFnd) == 0):
edgesFissExtPeau.append(edgesPeauFis[0])
name="edgesFissExtPeau%d"%j
- geompy.addToStudyInFather(partitionPeauFissFond, edgesPeauFis[0], name)
+ geomPublishInFather(initLog.debug,partitionPeauFissFond, edgesPeauFis[0], name)
j += 1
# -----------------------------------------------------------------------
pass
name="partitionPeauByPipe%d"%ifil
- geompy.addToStudy(partitionPeauByPipe, name)
+ geomPublish(initLog.debug, partitionPeauByPipe, name)
[edgesPeauFondIn, edgesPeauFondOut, edgesPeauFondOn] = extractionOrientee(fillingFaceExterne, partitionPeauByPipe, centreFondFiss, "EDGE", 1.e-3)
[facesPeauFondIn, facesPeauFondOut, facesPeauFondOn] = extractionOrientee(fillingFaceExterne, partitionPeauByPipe, centreFondFiss, "FACE", 1.e-3)
else:
facePeau =geompy.MakePartition(facesPeauFondOn, [], [], [], geompy.ShapeType["FACE"], 0, [], 1)
name="facePeau%d"%ifil
- geompy.addToStudy(facePeau, name)
+ geomPublish(initLog.debug, facePeau, name)
facesPipePeau = [None for i in range(len(edgesFissExtPipe))]
endsEdgeFond = [None for i in range(len(edgesFissExtPipe))]
nameEdge = "edgeRadFacePipePeau%d"%i
facesPipePeau[i] = face
endsEdgeFond[i] = sharedVertices[0]
- geompy.addToStudy(face, nameFace)
- geompy.addToStudy(sharedVertices[0], nameVert)
+ geomPublish(initLog.debug, face, nameFace)
+ geomPublish(initLog.debug, sharedVertices[0], nameVert)
edgesFace = geompy.ExtractShapes(face, geompy.ShapeType["EDGE"], True)
for edge in edgesFace:
if geompy.MinDistance(edge, sharedVertices[0]) < 1e-3:
edgeRadFacePipePeau[i] = edge
- geompy.addToStudy(edge, nameEdge)
+ geomPublish(initLog.debug, edge, nameEdge)
break
pass
pass
geompy.UnionList(grpEdgesCirc, edges)
edgesCircPeau[i] = grpEdgesCirc
name = "edgeCirc%d"%i
- geompy.addToStudyInFather(facePeau, grpEdgesCirc, name)
+ geomPublishInFather(initLog.debug,facePeau, grpEdgesCirc, name)
edgesListees = edgesListees + edges
vertices = geompy.GetSharedShapesMulti([facePeau, fcirc], geompy.ShapeType["VERTEX"])
grpVertCircPeau = geompy.CreateGroup(facePeau, geompy.ShapeType["VERTEX"])
geompy.UnionList(grpVertCircPeau, vertices)
verticesCircPeau[i] = grpVertCircPeau
name = "pointEdgeCirc%d"%i
- geompy.addToStudyInFather(facePeau, grpVertCircPeau, name)
+ geomPublishInFather(initLog.debug,facePeau, grpVertCircPeau, name)
pass
pass # --- au moins une extrémité du pipe sur cette face de peau
for i, edge in enumerate(edgesFilling):
edgepeau = geompy.GetInPlace(facePeau, edge)
name = "edgepeau%d"%i
- geompy.addToStudyInFather(facePeau,edgepeau, name)
+ geomPublishInFather(initLog.debug,facePeau,edgepeau, name)
logging.debug("edgepeau %s", geompy.ShapeInfo(edgepeau))
if geompy.ShapeInfo(edgepeau)['EDGE'] > 1:
logging.debug(" EDGES multiples")
if aretesVivesC is not None:
bordsVifs = geompy.GetInPlace(facePeau, aretesVivesC)
if bordsVifs is not None:
- geompy.addToStudyInFather(facePeau, bordsVifs, "bordsVifs")
+ geomPublishInFather(initLog.debug,facePeau, bordsVifs, "bordsVifs")
groupEdgesBordPeau = geompy.CutGroups(groupEdgesBordPeau, bordsVifs)
grptmp = None
if len(aretesVivesCoupees) > 0:
edv = geompy.ExtractShapes(grpnew, geompy.ShapeType["EDGE"], False)
aretesVivesCoupees += edv
logging.debug("aretesVivesCoupees %s",aretesVivesCoupees)
- geompy.addToStudyInFather(facePeau, groupEdgesBordPeau , "EdgesBords")
+ geomPublishInFather(initLog.debug,facePeau, groupEdgesBordPeau , "EdgesBords")
# --- edges de la face de peau partagées avec la face de fissure
if (geompy.MinDistance(grpVert, edge) < 1.e-3) and (edge not in edgesFissurePeau):
edgesFissurePeau[i] = edge
name = "edgeFissurePeau%d"%i
- geompy.addToStudyInFather(facePeau, edge, name)
+ geomPublishInFather(initLog.debug,facePeau, edge, name)
for edge in edges: # on ajoute après les edges manquantes
if edge not in edgesFissurePeau:
edgesFissurePeau.append(edge)
for i, edge in enumerate(edges):
edgesFissurePeau.append(edge)
name = "edgeFissurePeau%d"%i
- geompy.addToStudyInFather(facePeau, edge, name)
+ geomPublishInFather(initLog.debug,facePeau, edge, name)
ptEdgeFond[ifil] = endsEdgeFond # pour chaque face [points edge fond de fissure aux débouchés du pipe]
for i, avc in enumerate(aretesVivesCoupees):
name = "areteViveCoupee%d"%i
- geompy.addToStudy(avc, name)
+ geomPublish(initLog.debug, avc, name)
# --- identification des faces et edges de fissure externe pour maillage
edgesPeauFissureExterneC = geompy.MakeCompound(edgesFissExtPeau)
edgesPipeFissureExterneC = geompy.MakeCompound(edgesFissExtPipe)
wirePipeFissureExterne = geompy.MakeWire(geompy.ExtractShapes(edgesPipeFissureExterneC, geompy.ShapeType["EDGE"], False))
- geompy.addToStudy(faceFissureExterne, "faceFissureExterne")
- geompy.addToStudyInFather(faceFissureExterne, edgesPeauFissureExterneC, "edgesPeauFissureExterne")
- geompy.addToStudyInFather(faceFissureExterne, edgesPipeFissureExterneC, "edgesPipeFissureExterne")
+ geomPublish(initLog.debug, faceFissureExterne, "faceFissureExterne")
+ geomPublishInFather(initLog.debug,faceFissureExterne, edgesPeauFissureExterneC, "edgesPeauFissureExterne")
+ geomPublishInFather(initLog.debug,faceFissureExterne, edgesPipeFissureExterneC, "edgesPipeFissureExterne")
logging.debug("---------------------------- Preparation Maillage du Pipe --------------")
# -----------------------------------------------------------------------
origins.append(vertpx)
normals.append(norm)
# name = "vertcx%d"%i
-# geompy.addToStudyInFather(wireFondFiss, vertcx, name)
+# geomPublishInFather(initLog.debug,wireFondFiss, vertcx, name)
# name = "vertpx%d"%i
-# geompy.addToStudyInFather(wireFondFiss, vertpx, name)
+# geomPublishInFather(initLog.debug,wireFondFiss, vertpx, name)
# name = "plan%d"%i
-# geompy.addToStudyInFather(wireFondFiss, plan, name)
+# geomPublishInFather(initLog.debug,wireFondFiss, plan, name)
# --- maillage du pipe étendu, sans tenir compte de l'intersection avec la face de peau
#logging.debug("extremité %s, indices retenus interne %s, externe %s",i, idfin, iddeb)
comp = geompy.MakeCompound(raydisks[k][iddeb:idfin])
name='compoundRay%d'%k
- geompy.addToStudy(comp, name)
+ geomPublish(initLog.debug, comp, name)
else:
idfin = min(len(gptsdisks), numout+1)
iddeb = min(idfin-3, idisk) # il faut 3 rayons pour faire un filling qui suive le fond de fissure
#logging.debug("extremité %s, indices retenus interne %s, externe %s",i, idfin, iddeb)
comp = geompy.MakeCompound(raydisks[k][iddeb:idfin])
name='compoundRay%d'%k
- geompy.addToStudy(comp, name)
+ geomPublish(initLog.debug, comp, name)
nappe = geompy.MakeFilling(comp, 2, 5, 0.0001, 0.0001, 0, GEOM.FOM_Default)
nappes.append(nappe)
name='nappe%d'%k
- geompy.addToStudy(nappe, name)
+ geomPublish(initLog.debug, nappe, name)
facesDebouchantes[i] = True
listNappes.append(nappes)
ednouv.append(ed)
logging.debug(" edges issues de la partition: %s", ednouv)
for ii, ed in enumerate(ednouv):
- geompy.addToStudy(ed, "ednouv%d"%ii)
+ geomPublish(initLog.debug, ed, "ednouv%d"%ii)
[edsorted, minl,maxl] = sortEdges(ednouv)
logging.debug(" longueur edge trouvée: %s", maxl)
edge = edsorted[-1]
edges.append(edge)
name = 'edgeEndPipe%d'%k
- geompy.addToStudy(edge, name)
+ geomPublish(initLog.debug, edge, name)
listEdges.append(edges)
# --- création des points du maillage du pipe sur la face de peau
id = -1 # si id vaut 1, on prend le dernier élément de la liste (1 ou 2 extrémités débouchent sur la face)
centre = ptEdgeFond[idFillingFromBout[i]][id]
name = "centre%d"%id
- geompy.addToStudy(centre, name)
+ geomPublish(initLog.debug, centre, name)
vertPipePeau = ptFisExtPi[idFillingFromBout[i]][id]
- geompy.addToStudyInFather(centre, vertPipePeau, "vertPipePeau")
+ geomPublishInFather(initLog.debug,centre, vertPipePeau, "vertPipePeau")
grpsEdgesCirc = edCircPeau[idFillingFromBout[i]] # liste de groupes
edgesCirc = []
for grpEdgesCirc in grpsEdgesCirc:
else:
bout = geompy.MakeVertexOnCurve(distEdgeCirc[0][2], u)
name ="bout%d"%k
- geompy.addToStudyInFather(centre, bout, name)
+ geomPublishInFather(initLog.debug,centre, bout, name)
# enregistrement des points dans la structure
points = []
for j in range(nbsegRad +1):
aretesVivesC = geompy.MakeCompound(aretesVivesCoupees)
meshAretesVives = smesh.Mesh(aretesVivesC)
algo1d = meshAretesVives.Segment()
- hypo1d = algo1d.LocalLength(dmoyen/3.0,[],1e-07)
+ hypo1d = algo1d.LocalLength(dmoyen,[],1e-07)
putName(algo1d.GetSubMesh(), "aretesVives")
putName(algo1d, "algo1d_aretesVives")
putName(hypo1d, "hypo1d_aretesVives")
grpEdgesPipeFissureExterne = meshFaceFiss.GroupOnGeom(edgesPipeFissureExterneC,'edgesPipeFissureExterne',SMESH.EDGE)
# --- maillage faces de peau
-
+
boutFromIfil = [None for i in range(nbFacesFilling)]
if idFillingFromBout[0] != idFillingFromBout[1]: # repérage des extremites du pipe quand elles débouchent sur des faces différentes
boutFromIfil[idFillingFromBout[0]] = 0
edgesFilling = geompy.ExtractShapes(filling, geompy.ShapeType["EDGE"], False)
groupEdgesBordPeau = geompy.CreateGroup(filling, geompy.ShapeType["EDGE"])
geompy.UnionList(groupEdgesBordPeau, edgesFilling)
- geompy.addToStudyInFather(filling, groupEdgesBordPeau , "EdgesBords")
+ geomPublishInFather(initLog.debug,filling, groupEdgesBordPeau , "EdgesBords")
meshFacePeau = smesh.Mesh(facesDefaut[ifil])
import logging
import salome
from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
from geomsmesh import smesh
from salome.smesh import smeshBuilder
import SMESH
facePorteFissure = shapeDefaut
WirePorteFondFissure = wiretube
fillingFaceExterne = facesDefaut[0]
- print fillingFaceExterne
- geompy.addToStudy(fillingFaceExterne, "fillingFaceExterne")
+ logging.debug("fillingFaceExterne %s", fillingFaceExterne)
+ geomPublish(initLog.debug, fillingFaceExterne, "fillingFaceExterne")
edgesFilling = geompy.ExtractShapes(fillingFaceExterne, geompy.ShapeType["EDGE"], False)
O, OX, OY, OZ = triedreBase()
# --- partition peau defaut - face de fissure prolongee - wire de fond de fissure prolongée
partitionPeauFissFond = geompy.MakePartition([facePorteFissure, WirePorteFondFissure, fillingFaceExterne], [], [], [], geompy.ShapeType["FACE"], 0, [], 0)
- geompy.addToStudy( partitionPeauFissFond, 'partitionPeauFissFond' )
+ geomPublish(initLog.debug, partitionPeauFissFond, 'partitionPeauFissFond' )
edges = geompy.ExtractShapes(WirePorteFondFissure, geompy.ShapeType["EDGE"], False)
lgmax = lg
imax = i
edgemax = edges[imax]
- geompy.addToStudy(edgemax, 'edgemax')
+ geomPublish(initLog.debug, edgemax, 'edgemax')
centreFondFiss = geompy.MakeVertexOnCurve(edgemax, 0.5)
- geompy.addToStudy(centreFondFiss, 'centreFondFiss')
+ geomPublish(initLog.debug, centreFondFiss, 'centreFondFiss')
tangentFondFiss = geompy.MakeTangentOnCurve(edgemax, 0.5)
- geompy.addToStudy(tangentFondFiss, 'tangentFondFiss')
+ geomPublish(initLog.debug, tangentFondFiss, 'tangentFondFiss')
bord1FondFiss = geompy.MakeVertexOnCurve(edgemax, 0.0)
- geompy.addToStudy(bord1FondFiss, 'bord1FondFiss')
+ geomPublish(initLog.debug, bord1FondFiss, 'bord1FondFiss')
tangentBord1FondFiss = geompy.MakeTangentOnCurve(edgemax, 0.0)
- geompy.addToStudy(tangentBord1FondFiss, 'tangentBord1FondFiss')
+ geomPublish(initLog.debug, tangentBord1FondFiss, 'tangentBord1FondFiss')
bord2FondFiss = geompy.MakeVertexOnCurve(edgemax, 1.0)
- geompy.addToStudy(bord2FondFiss, 'bord2FondFiss')
+ geomPublish(initLog.debug, bord2FondFiss, 'bord2FondFiss')
tangentBord2FondFiss = geompy.MakeTangentOnCurve(edgemax, 1.0)
- geompy.addToStudy(tangentBord2FondFiss, 'tangentBord2FondFiss')
+ geomPublish(initLog.debug, tangentBord2FondFiss, 'tangentBord2FondFiss')
planBord1 = geompy.MakePlane(bord1FondFiss, tangentBord1FondFiss, 3*rayonPipe)
planBord2 = geompy.MakePlane(bord2FondFiss, tangentBord2FondFiss, 3*rayonPipe)
- geompy.addToStudy(planBord1, 'planBord1')
- geompy.addToStudy(planBord2, 'planBord2')
+ geomPublish(initLog.debug, planBord1, 'planBord1')
+ geomPublish(initLog.debug, planBord2, 'planBord2')
[edgesInside, edgesOutside, edgesOnside] = extractionOrientee(fillingFaceExterne, partitionPeauFissFond, centreFondFiss, "EDGE", 1.e-3)
[facesInside, facesOutside, facesOnside] = extractionOrientee(fillingFaceExterne, partitionPeauFissFond, centreFondFiss, "FACE", 1.e-3)
# --- partition peau -face fissure - pipe fond de fissure prolongé
partitionPeauFissByPipe = geompy.MakePartition([facesInside[0], facesOnside[0]], [pipefiss], [], [], geompy.ShapeType["FACE"], 0, [], 0)
- geompy.addToStudy( partitionPeauFissByPipe, 'partitionPeauFissByPipe' )
+ geomPublish(initLog.debug, partitionPeauFissByPipe, 'partitionPeauFissByPipe' )
# --- identification face de peau
[facesPeauFissInside, facesPeauFissOutside, facesPeauFissOnside] = extractionOrientee(fillingFaceExterne, partitionPeauFissByPipe, centreFondFiss, "FACE", 0.1, "peauFiss_bord_")
facesPeauSorted, minsur, maxsurf = sortFaces(facesPeauFissOnside) # 4 demi disques, une grande face
facePeau = facesPeauSorted[-1] # la plus grande face
- geompy.addToStudyInFather(partitionPeauFissByPipe, facePeau, "facePeau")
+ geomPublishInFather(initLog.debug,partitionPeauFissByPipe, facePeau, "facePeau")
# --- identification edges de bord face peau
edgesBords = []
edgesBords.append(edgepeau)
groupEdgesBordPeau = geompy.CreateGroup(facePeau, geompy.ShapeType["EDGE"])
geompy.UnionList(groupEdgesBordPeau, edgesBords)
- geompy.addToStudyInFather(facePeau, groupEdgesBordPeau , "EdgesBords")
+ geomPublishInFather(initLog.debug,facePeau, groupEdgesBordPeau , "EdgesBords")
# --- identification face fissure externe au pipe et edge commune peau fissure
for face in facesPeauFissInside:
if sharedEdges is not None:
faceFiss = face
edgePeauFiss = sharedEdges[0]
- geompy.addToStudyInFather(partitionPeauFissByPipe, faceFiss, "faceFiss")
- geompy.addToStudyInFather(faceFiss, edgePeauFiss, "edgePeauFiss")
- geompy.addToStudyInFather(facePeau, edgePeauFiss, "edgePeauFiss")
+ geomPublishInFather(initLog.debug,partitionPeauFissByPipe, faceFiss, "faceFiss")
+ geomPublishInFather(initLog.debug,faceFiss, edgePeauFiss, "edgePeauFiss")
+ geomPublishInFather(initLog.debug,facePeau, edgePeauFiss, "edgePeauFiss")
break
except:
pass
verticesDemiCerclesPeau = []
for i, edge in enumerate(demiCerclesPeau):
name = "demiCerclePeau_%d"%i
- geompy.addToStudyInFather(facePeau, edge, name)
+ geomPublishInFather(initLog.debug,facePeau, edge, name)
verticesDemiCerclesPeau += geompy.ExtractShapes(edge, geompy.ShapeType["VERTEX"], False)
verticesDemiCerclesPeau = eliminateDoubles(facePeau, verticesDemiCerclesPeau)
for i, vertex in enumerate(verticesDemiCerclesPeau):
name = "verticesDemiCerclesPeau_%d"%i
- geompy.addToStudyInFather(facePeau, vertex, name)
+ geomPublishInFather(initLog.debug,facePeau, vertex, name)
verticesOutCercles = substractSubShapes(facePeau, verticesDemiCerclesPeau, verticesEdgePeauFiss)
for i, vertex in enumerate(verticesOutCercles):
name = "verticesOutCercles_%d"%i
- geompy.addToStudyInFather(facePeau, vertex, name)
+ geomPublishInFather(initLog.debug,facePeau, vertex, name)
# --- demi cercles regroupés
groupsDemiCerclesPeau = []
group = geompy.CreateGroup(facePeau, geompy.ShapeType["EDGE"])
geompy.UnionList(group, demis)
name = "Cercle%d"%i
- geompy.addToStudyInFather(facePeau, group , name)
+ geomPublishInFather(initLog.debug,facePeau, group , name)
groupsDemiCerclesPeau.append(group)
# --- identification edges commune pipe face fissure externe au pipe
if geompy.GetSubShapeID(partitionPeauFissByPipe, edge) != edgePeauFissId:
edgesFaceFissPipe.append(edge)
name = "edgeFaceFissPipe_%d"%len(edgesFaceFissPipe)
- geompy.addToStudyInFather(faceFiss, edge, name)
+ geomPublishInFather(initLog.debug,faceFiss, edge, name)
groupEdgesFaceFissPipe = geompy.CreateGroup(faceFiss, geompy.ShapeType["EDGE"])
geompy.UnionList(groupEdgesFaceFissPipe, edgesFaceFissPipe)
- geompy.addToStudyInFather(faceFiss, groupEdgesFaceFissPipe, "edgesFaceFissPipe")
+ geomPublishInFather(initLog.debug,faceFiss, groupEdgesFaceFissPipe, "edgesFaceFissPipe")
# -----------------------------------------------------------------------------
# --- pipe de fond de fissure
#pipeFondFiss = pipesSorted[-1]
#pipeFondFiss = geompy.MakePartition([pipeFondFiss], [planfiss, wireFondFiss, planBord1, planBord2], [], [], geompy.ShapeType["SOLID"], 0, [], 0)
- geompy.addToStudy( disque, 'disque')
- geompy.addToStudy( wireFondFiss, 'wireFondFiss')
- geompy.addToStudy( pipeFondFiss, 'pipeFondFiss')
+ geomPublish(initLog.debug, disque, 'disque')
+ geomPublish(initLog.debug, wireFondFiss, 'wireFondFiss')
+ geomPublish(initLog.debug, pipeFondFiss, 'pipeFondFiss')
VerticesEndFondFiss = findWireEndVertices(wireFondFiss)
for i, v in enumerate(VerticesEndFondFiss):
name = "vertexEndFondFiss_%d"%i
- geompy.addToStudyInFather(wireFondFiss, v, name)
+ geomPublishInFather(initLog.debug,wireFondFiss, v, name)
VerticesEndPipeFiss = []
for v in VerticesEndFondFiss:
VerticesEndPipeFiss.append(geompy.GetInPlace(pipeFondFiss, v))
for i, v in enumerate(VerticesEndPipeFiss):
name = "vertexEndPipeFiss_%d"%i
- geompy.addToStudyInFather(pipeFondFiss, v, name)
+ geomPublishInFather(initLog.debug,pipeFondFiss, v, name)
- geompy.addToStudyInFather(pipeFondFiss, VerticesEndPipeFiss[0], "PFOR")
- geompy.addToStudyInFather(pipeFondFiss, VerticesEndPipeFiss[1], "PFEX")
+ geomPublishInFather(initLog.debug,pipeFondFiss, VerticesEndPipeFiss[0], "PFOR")
+ geomPublishInFather(initLog.debug,pipeFondFiss, VerticesEndPipeFiss[1], "PFEX")
if geompy.MinDistance(VerticesEndPipeFiss[0], verticesOutCercles[0]) > geompy.MinDistance(VerticesEndPipeFiss[0], verticesOutCercles[1]):
a = verticesOutCercles[0]
verticesOutCercles[0] = verticesOutCercles[1]
verticesOutCercles[1] = a
- geompy.addToStudyInFather(facePeau, verticesOutCercles[0], "THOR")
- geompy.addToStudyInFather(facePeau, verticesOutCercles[1], "THEX")
+ geomPublishInFather(initLog.debug,facePeau, verticesOutCercles[0], "THOR")
+ geomPublishInFather(initLog.debug,facePeau, verticesOutCercles[1], "THEX")
[facesPipeInside, facesPipeOutside, facesPipeOnside] = extractionOrientee(fillingFaceExterne, pipeFondFiss, centreFondFiss, "FACE", 0.1, "pipe_bord_")
[edgesPipeInside, edgesPipeOutside, edgesPipeOnside] = extractionOrientee(fillingFaceExterne, pipeFondFiss, centreFondFiss, "EDGE", 0.1, "pipe_bord_")
centre = geompy.MakeVertexOnSurface(planfiss, 0.5, 0.5)
refpoint = geompy.MakeTranslationVector(centre, geompy.GetNormal(planfiss,centre))
- geompy.addToStudy(refpoint, 'refpoint')
+ geomPublish(initLog.debug, refpoint, 'refpoint')
[facesPipeInplan, facesPipeOutplan, facesPipeOnplan] = extractionOrientee(planfiss, pipeFondFiss, refpoint, "FACE", 0.1, "pipe_plan_")
[edgesPipeInplan, edgesPipeOutplan, edgesPipeOnplan] = extractionOrientee(planfiss, pipeFondFiss, refpoint, "EDGE", 0.1, "pipe_plan_")
generFiss.append(edge)
groupGenerFiss = geompy.CreateGroup(pipeFondFiss, geompy.ShapeType["EDGE"])
geompy.UnionList(groupGenerFiss, generFiss)
- geompy.addToStudyInFather(pipeFondFiss, groupGenerFiss, "GenFiss")
+ geomPublishInFather(initLog.debug,pipeFondFiss, groupGenerFiss, "GenFiss")
# --- demi cercles externes regroupés
groupsDemiCerclesPipe = []
group = geompy.CreateGroup(pipeFondFiss, geompy.ShapeType["EDGE"])
geompy.UnionList(group, demis)
name = "Cercle%d"%i
- geompy.addToStudyInFather(pipeFondFiss, group , name)
+ geomPublishInFather(initLog.debug,pipeFondFiss, group , name)
groupsDemiCerclesPipe.append(group)
# --- faces fissure dans le pipe
logging.debug("face found")
facesFissinPipe.append(face)
name = "faceFissInPipe_%d"%i
- geompy.addToStudyInFather(pipeFondFiss, face, name)
+ geomPublishInFather(initLog.debug,pipeFondFiss, face, name)
break
groupFaceFissInPipe = geompy.CreateGroup(pipeFondFiss, geompy.ShapeType["FACE"])
geompy.UnionList(groupFaceFissInPipe, facesFissinPipe)
name = "FaceFissInPipe"
- geompy.addToStudyInFather(pipeFondFiss, groupFaceFissInPipe , name)
+ geomPublishInFather(initLog.debug,pipeFondFiss, groupFaceFissInPipe , name)
# --- edges de fond de fissure
logging.debug(" edge %s ", anEdge)
edgesFondFiss.append(anEdge)
name ="edgeFondFissure_%d"%i
- geompy.addToStudyInFather(pipeFondFiss, anEdge, name)
+ geomPublishInFather(initLog.debug,pipeFondFiss, anEdge, name)
groupEdgeFondFiss = geompy.CreateGroup(pipeFondFiss, geompy.ShapeType["EDGE"])
geompy.UnionList(groupEdgeFondFiss, edgesFondFiss)
name = "FONDFISS"
- geompy.addToStudyInFather(pipeFondFiss, groupEdgeFondFiss , name)
+ geomPublishInFather(initLog.debug,pipeFondFiss, groupEdgeFondFiss , name)
# -------------------------------------------------------------------------
# --- maillage
--- /dev/null
+# -*- coding: utf-8 -*-
+"""
+Created on Mon Jun 23 14:49:36 2014
+
+@author: I48174 (Olivier HOAREAU)
+"""
+
+import logging
+import SMESH
+from geomsmesh import smesh
+
+def lookForCorner(maillageAScanner):
+
+ """ Cette fonction permet de scanner la liste de noeuds qui composent le
+ maillage passé en paramètre. On recherche un ou plusieurs coins, ce
+ qui implique les caractéristiques suivantes:
+ - le noeud doit appartenir au moins à trois éléments distincts
+ - chaque élément doit appartenir à un ensemble distinct
+ La fonction renvoie une liste de coins par l'intermédiaire de l'IDs
+ chaque noeud. La liste contient en général au maximum deux coins.
+ """
+
+ logging.info("start")
+
+ allNodeIds = maillageAScanner.GetNodesId() # On stocke tout les noeuds
+ listOfCorners = []
+ for ND in allNodeIds:
+ # On parcours la liste de noeuds
+ listOfElements = maillageAScanner.GetNodeInverseElements(ND)
+ if len(listOfElements) >=3:
+ # On teste le nombre d'éléments qui partagent le même noeud
+ # --- Filtre selon le critère 'coplanar' --- #
+ listOfCriterion = [smesh.GetCriterion(SMESH.FACE, SMESH.FT_CoplanarFaces, \
+ SMESH.FT_Undefined, elem, SMESH.FT_Undefined, SMESH.FT_Undefined, 30) \
+ for elem in listOfElements]
+ listOfFilters = [smesh.GetFilterFromCriteria([criteria]) for criteria in listOfCriterion]
+ listOfSets = [maillageAScanner.GetIdsFromFilter(filter) for filter in listOfFilters]
+ if listOfSets.count(listOfSets[0]) == len(listOfSets):
+ # Si toutes les listes d'éléments sont similaires, on retourne
+ # au début pour éviter de travailler sur des éléments inutiles.
+ # Exemple : un noeud appartenant à 4 éléments sur la même face.
+ continue
+ for s in listOfSets:
+ while listOfSets.count(s) > 1:
+ # On supprime tant que la liste d'éléments n'est pas unique.
+ listOfSets.remove(s)
+ if len(listOfSets) >= 3:
+ # Si on a au moins 3 listes d'élements différentes, on considère
+ # qu'il y a présence d'un coin.
+ listOfCorners.append(ND)
+ return listOfCorners
+
+def createLinesFromMesh(maillageSupport):
+
+ """ Cette fonction permet de générer une liste de lignes à partir du
+ maillage support passé en paramètre. On démarre à partir d'un coin
+ simple et on parcourt tout les noeuds pour former une ligne. Soit la
+ figure ci-dessous :
+
+ 1_____4_____7 On part du coin N1, et on cherche les noeuds
+ | | | successifs tels que [1, 2, 3]. Lorsqu'on arrive
+ | 1 | 3 | arrive sur le noeud de fin de ligne N3, on repart
+ | | | du noeud précédent du premier élément (E1), Ã
+ 2_____5_____8 savoir le noeud N4. On suit les noeuds succesifs
+ | | | [4, 5, 6] comme précédemment et ainsi de suite.
+ | 2 | 4 | Lorsqu'on arrive sur le dernier noeud de la
+ | | | dernière ligne, à savoir le noeud N9, on considère
+ 3_____6_____9 que toutes les lignes sont créées.
+
+ La fonction retourne une liste de lignes utilisées par la suite.
+ """
+
+ logging.info("start")
+
+ allNodeIds = maillageSupport.GetNodesId()
+ while len(allNodeIds):
+ nodeIds = allNodeIds
+ for idNode in nodeIds: # rechercher un coin
+ elems = maillageSupport.GetNodeInverseElements(idNode)
+ if len(elems) == 1:
+ # un coin: un noeud, un element quadrangle
+ elem = elems[0]
+ break;
+ idStart = idNode # le noeud de coin
+ elemStart = elem # l'élément quadrangle au coin
+ xyz = maillageSupport.GetNodeXYZ(idStart)
+ logging.debug("idStart %s, coords %s", idStart, str(xyz))
+
+ nodelines =[] # on va constituer une liste de lignes de points
+ nextLine = True
+ ligneFinale = False
+ while nextLine:
+ logging.debug("--- une ligne")
+ idNode = idStart
+ elem = elemStart
+ if ligneFinale:
+ agauche = False # sens de parcours des 4 noeuds d'un quadrangle
+ nextLine = False
+ else:
+ agauche = True
+ ligneIncomplete = True # on commence une ligne de points
+ debutLigne = True
+ nodeline = []
+ elemline = []
+ while ligneIncomplete: # compléter la ligne de points
+ nodeline.append(idNode)
+ allNodeIds.remove(idNode)
+ elemline.append(elem)
+ nodes = maillageSupport.GetElemNodes(elem)
+ i = nodes.index(idNode) # repérer l'index du noeud courant (i) dans l'élément quadrangle (0 a 3)
+ if agauche: # déterminer le noeud suivant (j) et celui opposé (k) dans le quadrangle
+ if i < 3:
+ j = i+1
+ else:
+ j = 0
+ if j < 3:
+ k = j+1
+ else:
+ k = 0
+ else:
+ if i > 0:
+ j = i -1
+ else:
+ j = 3
+ if j > 0:
+ k = j -1
+ else:
+ k = 3
+ isuiv = nodes[j] # noeud suivant
+ iapres = nodes[k] # noeud opposé
+ if debutLigne:
+ debutLigne = False
+ # précédent a trouver, dernière ligne : précédent au lieu de suivant
+ if agauche:
+ if i > 0:
+ iprec = nodes[i -1]
+ else:
+ iprec = nodes[3]
+ idStart = iprec
+ elems3 = maillageSupport.GetNodeInverseElements(iprec)
+ if len(elems3) == 1: # autre coin
+ ligneFinale = True
+ else:
+ for elem3 in elems3:
+ if elem3 != elem:
+ elemStart = elem3
+ break
+ #print nodes, idNode, isuiv, iapres
+ elems1 = maillageSupport.GetNodeInverseElements(isuiv)
+ elems2 = maillageSupport.GetNodeInverseElements(iapres)
+ ligneIncomplete = False
+ for elem2 in elems2:
+ if elems1.count(elem2) and elem2 != elem:
+ ligneIncomplete = True
+ idNode = isuiv
+ elem = elem2
+ break
+ if not ligneIncomplete:
+ nodeline.append(isuiv)
+ allNodeIds.remove(isuiv)
+ logging.debug("nodeline %s", nodeline)
+ logging.debug("elemline %s", elemline)
+ nodelines.append(nodeline)
+
+ # on a constitué une liste de lignes de points connexes
+ logging.debug("dimensions [%s, %s]", len(nodelines), len(nodeline))
+
+ return nodelines
+
+def createNewMeshesFromCorner(maillageSupport, listOfCorners):
+
+ """ Cette fonction permet de générer un nouveau maillage plus facile Ã
+ utiliser. On démarre d'un coin et on récupère les trois éléments
+ auquel le noeud appartient. Grâce à un filtre 'coplanar' sur les trois
+ éléments, on peut générer des faces distinctes.
+ """
+
+ logging.info("start")
+
+ tmp = []
+ listOfNewMeshes = []
+ for corner in listOfCorners:
+ elems = maillageSupport.GetNodeInverseElements(corner)
+ for i, elem in enumerate(elems):
+ # --- Filtre selon le critère 'coplanar' --- #
+ critere = smesh.GetCriterion(SMESH.FACE, SMESH.FT_CoplanarFaces, \
+ SMESH.FT_Undefined, elem, SMESH.FT_Undefined, SMESH.FT_Undefined, 30)
+ filtre = smesh.GetFilterFromCriteria([critere])
+ grp = maillageSupport.GroupOnFilter(SMESH.FACE, 'grp', filtre)
+ # On copie le maillage en fonction du filtre
+ msh = smesh.CopyMesh(grp, 'new_{0}'.format(i + 1), False, True)
+ # On stocke l'ensemble des noeuds du maillage dans tmp
+ # On ajoute le maillage à la liste des nouveaux maillages
+ # seulement s'il n'y est pas déjÃ
+ tmp.append(msh.GetNodesId())
+ if tmp.count(msh.GetNodesId()) <= 1:
+ listOfNewMeshes.append(msh)
+ return listOfNewMeshes
\ No newline at end of file
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import logging
+
+from geomsmesh import geompy
+from geomsmesh import smesh
+import SMESH
+
+from putName import putName
+
+def mailleAretesEtJonction(internalBoundary, aretesVivesCoupees, dmoyen):
+ """
+ edges de bord, faces défaut à respecter
+ """
+ logging.info('start')
+
+ aFilterManager = smesh.CreateFilterManager()
+ nbAdded, internalBoundary, _NoneGroup = internalBoundary.MakeBoundaryElements( SMESH.BND_1DFROM2D, '', '', 0, [ ])
+ criteres = []
+ unCritere = smesh.GetCriterion(SMESH.EDGE,SMESH.FT_FreeBorders,SMESH.FT_Undefined,0)
+ criteres.append(unCritere)
+ filtre = smesh.GetFilterFromCriteria(criteres)
+ bordsLibres = internalBoundary.MakeGroupByFilter( 'bords', filtre )
+ smesh.SetName(bordsLibres, 'bordsLibres')
+
+ # --- pour aider l'algo hexa-tetra à ne pas mettre de pyramides à l'exterieur des volumes repliés sur eux-mêmes
+ # on désigne les faces de peau en quadrangles par le groupe "skinFaces"
+
+ skinFaces = internalBoundary.CreateEmptyGroup( SMESH.FACE, 'skinFaces' )
+ nbAdd = skinFaces.AddFrom( internalBoundary.GetMesh() )
+
+ # --- maillage des éventuelles arêtes vives entre faces reconstruites
+
+ grpAretesVives = None
+ if len(aretesVivesCoupees) > 0:
+ aretesVivesC = geompy.MakeCompound(aretesVivesCoupees)
+ meshAretesVives = smesh.Mesh(aretesVivesC)
+ algo1d = meshAretesVives.Segment()
+ hypo1d = algo1d.LocalLength(dmoyen,[],1e-07)
+ putName(algo1d.GetSubMesh(), "aretesVives")
+ putName(algo1d, "algo1d_aretesVives")
+ putName(hypo1d, "hypo1d_aretesVives")
+ isDone = meshAretesVives.Compute()
+ logging.info("aretesVives fini")
+ grpAretesVives = meshAretesVives.CreateEmptyGroup( SMESH.EDGE, 'grpAretesVives' )
+ nbAdd = grpAretesVives.AddFrom( meshAretesVives.GetMesh() )
+
+ return (internalBoundary, bordsLibres, grpAretesVives)
\ No newline at end of file
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import logging
+
+from geomsmesh import geompy
+from geomsmesh import smesh
+from salome.smesh import smeshBuilder
+import SMESH
+
+from putName import putName
+
+def mailleFacesFissure(faceFissureExterne, edgesPipeFissureExterneC, edgesPeauFissureExterneC,
+ meshPipeGroups, areteFaceFissure, rayonPipe, nbsegRad):
+ """
+ maillage faces de fissure
+ """
+ logging.info('start')
+
+ meshFaceFiss = smesh.Mesh(faceFissureExterne)
+ algo2d = meshFaceFiss.Triangle(algo=smeshBuilder.NETGEN_1D2D)
+ hypo2d = algo2d.Parameters()
+ hypo2d.SetMaxSize( areteFaceFissure )
+ hypo2d.SetSecondOrder( 0 )
+ hypo2d.SetOptimize( 1 )
+ hypo2d.SetFineness( 2 )
+ hypo2d.SetMinSize( rayonPipe/float(nbsegRad) )
+ hypo2d.SetQuadAllowed( 0 )
+ putName(algo2d.GetSubMesh(), "faceFiss")
+ putName(algo2d, "algo2d_faceFiss")
+ putName(hypo2d, "hypo2d_faceFiss")
+
+ algo1d = meshFaceFiss.UseExisting1DElements(geom=edgesPipeFissureExterneC)
+ hypo1d = algo1d.SourceEdges([ meshPipeGroups['edgeFaceFissGroup'] ],0,0)
+ putName(algo1d.GetSubMesh(), "edgeFissPeau")
+ putName(algo1d, "algo1d_edgeFissPeau")
+ putName(hypo1d, "hypo1d_edgeFissPeau")
+
+ isDone = meshFaceFiss.Compute()
+ logging.info("meshFaceFiss fini")
+
+ grpFaceFissureExterne = meshFaceFiss.GroupOnGeom(faceFissureExterne, "fisOutPi", SMESH.FACE)
+ grpEdgesPeauFissureExterne = meshFaceFiss.GroupOnGeom(edgesPeauFissureExterneC,'edgesPeauFissureExterne',SMESH.EDGE)
+ grpEdgesPipeFissureExterne = meshFaceFiss.GroupOnGeom(edgesPipeFissureExterneC,'edgesPipeFissureExterne',SMESH.EDGE)
+
+ return (meshFaceFiss, grpFaceFissureExterne, grpEdgesPeauFissureExterne, grpEdgesPipeFissureExterne)
\ No newline at end of file
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import logging
+
+from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
+from geomsmesh import smesh
+from salome.smesh import smeshBuilder
+import SMESH
+
+from putName import putName
+
+def mailleFacesPeau(partitionsPeauFissFond, idFillingFromBout, facesDefaut,
+ facesPeaux, edCircPeau, ptCircPeau, gpedgeBord, gpedgeVifs, edFissPeau,
+ bordsLibres, grpEdgesPeauFissureExterne, grpAretesVives,
+ edgesCircPipeGroup, dmoyen, rayonPipe, nbsegRad):
+ """
+ maillage faces de peau
+ """
+ logging.info('start')
+ nbFacesFilling = len(partitionsPeauFissFond)
+ boutFromIfil = [None for i in range(nbFacesFilling)]
+ if idFillingFromBout[0] != idFillingFromBout[1]: # repérage des extremites du pipe quand elles débouchent sur des faces différentes
+ boutFromIfil[idFillingFromBout[0]] = 0
+ boutFromIfil[idFillingFromBout[1]] = 1
+
+ logging.debug("---------------------------- maillage faces de peau --------------")
+ meshesFacesPeau = []
+ for ifil in range(nbFacesFilling):
+ meshFacePeau = None
+ if partitionsPeauFissFond[ifil] is None: # face de peau maillage sain intacte
+
+ logging.debug("meshFacePeau %d intacte", ifil)
+ # --- edges de bord de la face de filling
+ filling = facesDefaut[ifil]
+ edgesFilling = geompy.ExtractShapes(filling, geompy.ShapeType["EDGE"], False)
+ groupEdgesBordPeau = geompy.CreateGroup(filling, geompy.ShapeType["EDGE"])
+ geompy.UnionList(groupEdgesBordPeau, edgesFilling)
+ geomPublishInFather(initLog.debug,filling, groupEdgesBordPeau , "EdgesBords")
+
+ meshFacePeau = smesh.Mesh(facesDefaut[ifil])
+
+ algo1d = meshFacePeau.UseExisting1DElements(geom=groupEdgesBordPeau)
+ hypo1d = algo1d.SourceEdges([ bordsLibres ],0,0)
+ putName(algo1d.GetSubMesh(), "bordsLibres", ifil)
+ putName(algo1d, "algo1d_bordsLibres", ifil)
+ putName(hypo1d, "hypo1d_bordsLibres", ifil)
+
+ else:
+
+ logging.debug("meshFacePeau %d coupée par la fissure", ifil)
+ facePeau = facesPeaux[ifil] # pour chaque face : la face de peau finale a mailler (percée des faces débouchantes)
+ edgesCircPeau = edCircPeau[ifil] # pour chaque face de peau : [subshape edge circulaire aux débouchés du pipe]
+ verticesCircPeau = ptCircPeau[ifil] # pour chaque face de peau : [subshape point sur edge circulaire aux débouchés du pipe]
+ groupEdgesBordPeau = gpedgeBord[ifil] # pour chaque face de peau : groupe subshape des edges aux bords liés à la partie saine
+ bordsVifs = gpedgeVifs[ifil] # pour chaque face de peau : groupe subshape des edges aux bords correspondant à des arêtes vives
+ edgesFissurePeau = edFissPeau[ifil] # pour chaque face de peau : [subshape edge en peau des faces de fissure externes]
+
+ meshFacePeau = smesh.Mesh(facePeau)
+
+ algo1d = meshFacePeau.UseExisting1DElements(geom=groupEdgesBordPeau)
+ hypo1d = algo1d.SourceEdges([ bordsLibres ],0,0)
+ putName(algo1d.GetSubMesh(), "bordsLibres", ifil)
+ putName(algo1d, "algo1d_bordsLibres", ifil)
+ putName(hypo1d, "hypo1d_bordsLibres", ifil)
+
+ algo1d = meshFacePeau.UseExisting1DElements(geom=geompy.MakeCompound(edgesFissurePeau))
+ hypo1d = algo1d.SourceEdges([ grpEdgesPeauFissureExterne ],0,0)
+ putName(algo1d.GetSubMesh(), "edgePeauFiss", ifil)
+ putName(algo1d, "algo1d_edgePeauFiss", ifil)
+ putName(hypo1d, "hypo1d_edgePeauFiss", ifil)
+
+ if bordsVifs is not None:
+ algo1d = meshFacePeau.UseExisting1DElements(geom=bordsVifs)
+ hypo1d = algo1d.SourceEdges([ grpAretesVives ],0,0)
+ putName(algo1d.GetSubMesh(), "bordsVifs", ifil)
+ putName(algo1d, "algo1d_bordsVifs", ifil)
+ putName(hypo1d, "hypo1d_bordsVifs", ifil)
+
+ for i, edgeCirc in enumerate(edgesCircPeau):
+ if edgeCirc is not None:
+ algo1d = meshFacePeau.UseExisting1DElements(geom=edgeCirc)
+ if boutFromIfil[ifil] is None:
+ hypo1d = algo1d.SourceEdges([ edgesCircPipeGroup[i] ],0,0)
+ else:
+ hypo1d = algo1d.SourceEdges([ edgesCircPipeGroup[boutFromIfil[ifil]] ],0,0)
+ name = "cercle%d"%i
+ putName(algo1d.GetSubMesh(), name, ifil)
+ putName(algo1d, "algo1d_" + name, ifil)
+ putName(hypo1d, "hypo1d_" + name, ifil)
+
+ algo2d = meshFacePeau.Triangle(algo=smeshBuilder.NETGEN_1D2D)
+ hypo2d = algo2d.Parameters()
+ hypo2d.SetMaxSize( dmoyen )
+ hypo2d.SetOptimize( 1 )
+ hypo2d.SetFineness( 2 )
+ hypo2d.SetMinSize( rayonPipe/float(nbsegRad) )
+ hypo2d.SetQuadAllowed( 0 )
+ putName(algo2d.GetSubMesh(), "facePeau", ifil)
+ putName(algo2d, "algo2d_facePeau", ifil)
+ putName(hypo2d, "hypo2d_facePeau", ifil)
+
+ isDone = meshFacePeau.Compute()
+ logging.info("meshFacePeau %d fini", ifil)
+ GroupFaces = meshFacePeau.CreateEmptyGroup( SMESH.FACE, "facePeau%d"%ifil )
+ nbAdd = GroupFaces.AddFrom( meshFacePeau.GetMesh() )
+ meshesFacesPeau.append(meshFacePeau)
+
+ return meshesFacesPeau
\ No newline at end of file
import logging
from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
# -----------------------------------------------------------------------------
# --- partition du bloc defaut par generatrice, tore et plan fissure
faceFissure = geompy.GetInPlaceByHistory(volDefautPart, facefis)
#ellipsoidep =geompy.GetInPlaceByHistory(volDefautPart, ellipsoide)
- geompy.addToStudy( volDefautPart, 'volDefautPart' )
- geompy.addToStudyInFather( volDefautPart, tore, 'tore' )
- geompy.addToStudyInFather( volDefautPart, faceFissure, 'FACE1' )
- #geompy.addToStudyInFather( volDefautPart, gencnt, 'generatrice' )
+ geomPublish(initLog.debug, volDefautPart, 'volDefautPart' )
+ geomPublishInFather(initLog.debug, volDefautPart, tore, 'tore' )
+ geomPublishInFather(initLog.debug, volDefautPart, faceFissure, 'FACE1' )
+ #geomPublishInFather(initLog.debug, volDefautPart, gencnt, 'generatrice' )
solids = geompy.ExtractShapes(blocp, geompy.ShapeType["SOLID"], True)
vols = []
imaxvol = vols.index(maxvol)
ellipsoidep = solids[imaxvol]
- geompy.addToStudyInFather( volDefautPart, blocp, 'bloc' )
- geompy.addToStudyInFather( volDefautPart, ellipsoidep, 'ellipsoide' )
+ geomPublishInFather(initLog.debug, volDefautPart, blocp, 'bloc' )
+ geomPublishInFather(initLog.debug, volDefautPart, ellipsoidep, 'ellipsoide' )
sharedFaces = geompy.GetSharedShapesMulti([blocp, ellipsoidep], geompy.ShapeType["FACE"])
for i in range(len(sharedFaces)):
name = "faceCommuneEllipsoideBloc_%d"%i
- geompy.addToStudyInFather(blocp, sharedFaces[i], name)
+ geomPublishInFather(initLog.debug,blocp, sharedFaces[i], name)
#sharedEdges = geompy.GetSharedShapesMulti([blocp, ellipsoidep], geompy.ShapeType["EDGE"])
allSharedEdges = geompy.GetSharedShapesMulti([blocp, ellipsoidep], geompy.ShapeType["EDGE"])
sharedEdges.append(allSharedEdges[i])
for i in range(len(sharedEdges)):
name = "edgeCommuneEllipsoideBloc_%d"%i
- geompy.addToStudyInFather(blocp, sharedEdges[i], name)
+ geomPublishInFather(initLog.debug,blocp, sharedEdges[i], name)
facesExternes = []
facesExtBloc = []
faceExt = geompy.GetInPlace(ellipsoidep, faces[i])
if faceExt is not None:
name = "faceExterne_e%d"%i
- geompy.addToStudyInFather(ellipsoidep, faceExt, name)
+ geomPublishInFather(initLog.debug,ellipsoidep, faceExt, name)
facesExternes.append(faceExt)
facesExtElli.append(faceExt)
faceExt = geompy.GetInPlace(blocp, faces[i])
if faceExt is not None:
name = "faceExterne_b%d"%i
- geompy.addToStudyInFather(blocp, faceExt, name)
+ geomPublishInFather(initLog.debug,blocp, faceExt, name)
facesExternes.append(faceExt)
facesExtBloc.append(faceExt)
else:
#extrusionFace = geompy.MakePrismVecH2Ways(faces[i], normal, 0.1)
#extrusionFace = geompy.MakeScaleTransform(extrusionFace, vertex, 1.01)
name = "extrusionFace_b%d"%i
- geompy.addToStudyInFather(blocp, extrusionFace, name)
+ geomPublishInFather(initLog.debug,blocp, extrusionFace, name)
#facesExt = geompy.GetShapesOnShape(extrusionFace, blocp, geompy.ShapeType["FACE"], GEOM.ST_ONIN)
facesExt = geompy.GetShapesOnShape(extrusionFace, blocp, geompy.ShapeType["FACE"], GEOM.ST_ON)
for j in range(len(facesExt)):
name = "faceExterne_b%d_%d"%(i,j)
- geompy.addToStudyInFather(blocp, facesExt[j], name)
+ geomPublishInFather(initLog.debug,blocp, facesExt[j], name)
facesExternes.append(facesExt[j])
facesExtBloc.append(facesExt[j])
pass
if len(allSharedEdges) > 0:
name = "faceExterne_b%d_%d"%(i,j)
- geompy.addToStudyInFather(blocp, facesBloc[i], name)
+ geomPublishInFather(initLog.debug,blocp, facesBloc[i], name)
facesExternes.append(facesBloc[i])
facesExtBloc.append(facesBloc[i])
aretesInternes += shared
for i in range(len(aretesInternes)):
name = "aretesInternes_%d"%i
- geompy.addToStudyInFather(blocp, aretesInternes[i], name)
+ geomPublishInFather(initLog.debug,blocp, aretesInternes[i], name)
edgesBords = []
for faceExtB in facesExtBloc:
if not isInterne:
edgesBords.append(edges[i])
name = "edgeBord%d"%i
- geompy.addToStudyInFather(blocp,edges[i] , name)
+ geomPublishInFather(initLog.debug,blocp,edges[i] , name)
group = None
if len(edgesBords) > 0:
group = geompy.CreateGroup(blocp, geompy.ShapeType["EDGE"])
import logging
from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
# -----------------------------------------------------------------------------
# --- partition volume sain et bloc, face du bloc recevant la fissure
partieSaine = b
faceBloc = geompy.GetShapesOnShapeAsCompound(volumeSain, volDefaut, geompy.ShapeType["FACE"], GEOM.ST_ON)
- geompy.addToStudy( volumeSainPart, 'volumeSainPart' )
- geompy.addToStudyInFather( volumeSainPart, partieSaine, 'partieSaine' )
- geompy.addToStudyInFather( volumeSainPart, volDefaut, 'volDefaut' )
- geompy.addToStudyInFather( volDefaut, faceBloc, 'faceBloc' )
+ geomPublish(initLog.debug, volumeSainPart, 'volumeSainPart' )
+ geomPublishInFather(initLog.debug, volumeSainPart, partieSaine, 'partieSaine' )
+ geomPublishInFather(initLog.debug, volumeSainPart, volDefaut, 'volDefaut' )
+ geomPublishInFather(initLog.debug, volDefaut, faceBloc, 'faceBloc' )
return volumeSainPart, partieSaine, volDefaut, faceBloc
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import math
+import logging
+from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
+from findWireEndVertices import findWireEndVertices
+from prolongeWire import prolongeWire
+
+def partitionneFissureParPipe(shapesFissure, elementsDefaut, rayonPipe):
+ """
+ pipe de fond de fissure, prolongé, partition face fissure par pipe
+ identification des edges communes pipe et face fissure
+ """
+ logging.info('start')
+ shapeDefaut = shapesFissure[0] # faces de fissure, débordant
+ fondFiss = shapesFissure[4] # groupe d'edges de fond de fissure
+ centreFondFiss = elementsDefaut[15]
+ tgtCentre = elementsDefaut[16]
+
+ if geompy.NumberOfFaces(shapeDefaut) == 1:
+ plan = geompy.MakePlane(centreFondFiss, tgtCentre, 10000)
+ shapeDefaut = geompy.MakePartition([shapeDefaut], [plan], [], [], geompy.ShapeType["FACE"], 0, [], 0)
+ #fondFissCoupe = geompy.GetInPlaceByHistory(shapeDefaut, fondFiss) #= inutile
+ geomPublish(initLog.debug, shapeDefaut, 'shapeDefaut_coupe')
+ #geomPublishInFather(initLog.debug,shapeDefaut, fondFissCoupe, 'fondFiss_coupe')
+
+ extrem, norms = findWireEndVertices(fondFiss, True)
+ logging.debug("extrem: %s, norm: %s",extrem, norms)
+ cercle = geompy.MakeCircle(extrem[0], norms[0], rayonPipe)
+ cercle = geompy.MakeRotation(cercle, norms[0], math.pi/3.0 ) # éviter d'avoir l'arête de couture du pipe presque confondue avec la face fissure
+ geomPublish(initLog.debug, cercle, 'cercle')
+ fondFissProlonge = prolongeWire(fondFiss, extrem, norms, 2*rayonPipe)
+ pipeFiss = geompy.MakePipe(cercle, fondFissProlonge)
+ geomPublish(initLog.debug, pipeFiss, 'pipeFiss')
+ partFissPipe = geompy.MakePartition([shapeDefaut, pipeFiss], [], [], [], geompy.ShapeType["FACE"], 0, [], 1)
+ geomPublish(initLog.debug, partFissPipe, 'partFissPipe')
+ fissPipe = geompy.GetInPlaceByHistory(partFissPipe, shapeDefaut)
+ geomPublish(initLog.debug, fissPipe, 'fissPipe')
+ partPipe = geompy.GetInPlaceByHistory(partFissPipe, pipeFiss)
+ geomPublish(initLog.debug, partPipe, 'partPipe')
+
+ edgesPipeFiss = geompy.GetSharedShapesMulti([fissPipe, partPipe], geompy.ShapeType["EDGE"])
+ for i, edge in enumerate(edgesPipeFiss):
+ name = "edgePipe%d"%i
+ geomPublishInFather(initLog.debug,fissPipe, edge, name)
+ try:
+ wirePipeFiss = geompy.MakeWire(edgesPipeFiss)
+ except:
+ wirePipeFiss = geompy.MakeCompound(edgesPipeFiss)
+ logging.debug("wirePipeFiss construit sous forme de compound")
+ geomPublish(initLog.debug, wirePipeFiss, "wirePipeFiss")
+
+ wireFondFiss = geompy.GetInPlace(partFissPipe,fondFiss)
+ edgesFondFiss = geompy.GetSharedShapesMulti([fissPipe, wireFondFiss], geompy.ShapeType["EDGE"])
+ for i, edge in enumerate(edgesFondFiss):
+ name = "edgeFondFiss%d"%i
+ geomPublishInFather(initLog.debug,fissPipe, edge, name)
+ wireFondFiss = geompy.MakeWire(edgesFondFiss)
+ geomPublish(initLog.debug, wireFondFiss,"wireFondFiss")
+
+ return (fissPipe, edgesPipeFiss, edgesFondFiss, wirePipeFiss, wireFondFiss)
\ No newline at end of file
from geomsmesh import smesh
import SMESH
+from listOfExtraFunctions import lookForCorner
+from fusionMaillageAttributionDefaut import fusionMaillageDefaut
+
# -----------------------------------------------------------------------------
# --- peau interne du defaut dans le maillage sain
-def peauInterne(fichierMaillage, nomZones):
+def peauInterne(fichierMaillage, shapeDefaut, nomZones):
"""
Retrouve les groupes de défaut dans le maillage sain modifié par CreateHoleSkin (CreeZoneDefautMaillage)
On récupère le volume et la peau de la zone de défaut, les éventuelles faces et arêtes internes de cette zone.
groups = maillageSain.GetGroups()
zoneDefaut = None
for grp in groups:
- #print " ",grp.GetName()
+ logging.debug("groupe %s",grp.GetName())
if grp.GetName() == nomZones + "_vol":
zoneDefaut = grp
break
nbAdded, maillageSain, DefautBoundary = maillageSain.MakeBoundaryElements( SMESH.BND_2DFROM3D, 'DefBound', '', 0, [ zoneDefaut ])
internal = maillageSain.GetMesh().CutListOfGroups( [ DefautBoundary ], [ zoneDefaut_skin ], 'internal' )
internalBoundary = smesh.CopyMesh( internal, 'internalBoundary', 0, 0)
+
+ maillageDefautCible = smesh.CopyMesh(zoneDefaut_skin, 'maillageCible', 0, 0)
+ listOfCorner = lookForCorner(maillageDefautCible)
+ logging.debug("listOfCorner = %s", listOfCorner)
+ if len(listOfCorner) > 0:
+ logging.info("présence de coins à la surface externe de la zone à reconstruire")
+ zoneDefaut_skin, internalBoundary = fusionMaillageDefaut(maillageSain, maillageDefautCible, internalBoundary, zoneDefaut_skin, shapeDefaut, listOfCorner)
return maillageSain, internalBoundary, zoneDefaut, zoneDefaut_skin, zoneDefaut_internalFaces, zoneDefaut_internalEdges
import logging
from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
+from orderEdgesFromWire import orderEdgesFromWire
# -----------------------------------------------------------------------------
# --- prolongation d'un wire par deux segments tangents
logging.info("start")
if geompy.NumberOfEdges(aWire) > 1:
edges = geompy.ExtractShapes(aWire, geompy.ShapeType["EDGE"])
+ uneSeuleEdge = False
else:
edges = [aWire]
+ uneSeuleEdge = True
+ edgesBout = []
for i, v1 in enumerate(extrem):
exts = [geompy.MakeTranslationVectorDistance(v1, norms[i], l) for l in (-long, long)]
dists = [(geompy.MinDistance(v, aWire), i , v) for i, v in enumerate(exts)]
dists.sort()
v2 = dists[-1][-1]
- #v2 = geompy.MakeTranslationVectorDistance(v1, norms[i], long)
edge = geompy.MakeEdge(v1, v2)
edges.append(edge)
+ edgesBout.append(edge)
name = "extrem%d"%i
- #geompy.addToStudy(edge,name)
- wireProlonge = geompy.MakeWire(edges)
- geompy.addToStudy(wireProlonge, "wireProlonge")
+ geomPublish(initLog.debug, edge, name)
+ try:
+ wireProlonge = geompy.MakeWire(edges)
+ geomPublish(initLog.debug, wireProlonge, "wireProlonge")
+ except:
+ logging.warning("probleme MakeWire, approche pas a pas")
+ if uneSeuleEdge:
+ edgelist = [aWire]
+ accessList = [0]
+ else:
+ edgelist, accessList = orderEdgesFromWire(aWire)
+ edge1 = edgelist[accessList[0]]
+ if geompy.MinDistance(edgesBout[0], edge1) < 1.e-4 :
+ i0 = 0
+ i1 = 1
+ else:
+ i0 = 1
+ i1 = 0
+ wireProlonge = edgesBout[i0]
+ for i in range(len(edgelist)):
+ wireProlonge = geompy.MakeWire([wireProlonge, edgelist[accessList[i]]])
+ geomPublish(initLog.debug, wireProlonge, "wireProlonge_%d"%i)
+ wireProlonge = geompy.MakeWire([wireProlonge,edgesBout[i1]])
+ geomPublish(initLog.debug, wireProlonge, "wireProlonge")
+ logging.warning("prolongation wire pas a pas OK")
return wireProlonge
import logging
from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
# -----------------------------------------------------------------------------
# --- recherche et classement des edges du tore par propagate
lencomp = []
compounds = geompy.Propagate(tore)
for i in range(len(compounds)):
- #geompy.addToStudyInFather( tore, compounds[i], 'edges' )
+ #geomPublishInFather(initLog.debug, tore, compounds[i], 'edges' )
props = geompy.BasicProperties(compounds[i])
lencomp.append(props[0])
pass
else:
circles.append(compounds[i])
- geompy.addToStudyInFather( tore, diams[0], 'diams0' )
- geompy.addToStudyInFather( tore, diams[1], 'diams1' )
- geompy.addToStudyInFather( tore, circles[0], 'circles0' )
- geompy.addToStudyInFather( tore, circles[1], 'circles1' )
- geompy.addToStudyInFather( tore, geners[0], 'geners' )
+ geomPublishInFather(initLog.debug, tore, diams[0], 'diams0' )
+ geomPublishInFather(initLog.debug, tore, diams[1], 'diams1' )
+ geomPublishInFather(initLog.debug, tore, circles[0], 'circles0' )
+ geomPublishInFather(initLog.debug, tore, circles[1], 'circles1' )
+ geomPublishInFather(initLog.debug, tore, geners[0], 'geners' )
return diams, circles, geners
import logging
from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
import GEOM
import math
import numpy as np
if i == 0:
noeudsBords[0].append(node)
#name = "bord0_%d"%k
- #geompy.addToStudy( node, name )
+ #geomPublish(initLog.debug, node, name )
if i == (nbLignes -1):
noeudsBords[2].append(node)
#name = "bord2_%d"%k
- #geompy.addToStudy( node, name )
+ #geomPublish(initLog.debug, node, name )
if j == 0:
noeudsBords[1].append(node)
#name = "bord1_%d"%k
- #geompy.addToStudy( node, name )
+ #geomPublish(initLog.debug, node, name )
if j == (nbCols -1):
noeudsBords[3].append(node)
#name = "bord3_%d"%k
- #geompy.addToStudy( node, name )
+ #geomPublish(initLog.debug, node, name )
k += 1
curve = geompy.MakeInterpol(nodeList, False, False)
#name = "curve_%d"%i
- #geompy.addToStudy( curve, name )
+ #geomPublish(initLog.debug, curve, name )
if len(curvconts) == 0 or len(curves) > 0: # éliminer les doublons de la surface sans découpe
curvconts.append(nodeList)
curves.append(curve)
vecteurDefaut = geompy.MakeVector(vertex, cdg)
if vecteurDefaut is not None:
- geompy.addToStudy(normal, "normFillOrig%d"%iface)
- geompy.addToStudy(vecteurDefaut, "fromInterieur%d"%iface)
+ geomPublish(initLog.debug, normal, "normFillOrig%d"%iface)
+ geomPublish(initLog.debug, vecteurDefaut, "fromInterieur%d"%iface)
if geompy.GetAngleRadians(vecteurDefaut, normal) > math.pi/2.0:
filling = geompy.ChangeOrientation(filling)
- geompy.addToStudy( filling, "filling%d"%iface )
+ geomPublish(initLog.debug, filling, "filling%d"%iface )
#geompy.ExportBREP(filling, "filling.brep")
iface = iface+1
fillings.append(filling)
curve = geompy.MakeInterpol(nodes, False, False)
curves.append(curve)
fillcont = geompy.MakeFilling(geompy.MakeCompound(curves), 2, 5, 0.0001, 0.0001, 0, GEOM.FOM_Default, True)
- geompy.addToStudy( fillcont, "filcont%d"%icont )
+ geomPublish(initLog.debug, fillcont, "filcont%d"%icont )
fillconts.append(fillcont)
icont = icont+1
pass # --- loop while there are remaining nodes
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import logging
+from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
+import GEOM
+import math
+import numpy as np
+
+def mydot(a):
+ return np.dot(a,a)
+
+# -----------------------------------------------------------------------------
+# --- groupe de quadrangles de face transformé en face géométrique par filling
+
+def quadranglesToShapeNoCorner(meshQuad, shapeFissureParams, centreFondFiss):
+ """
+ groupe de quadrangles de face transformée en faces géométriques par filling
+ on part de quadrangles définissant une zone a 4 cotés (convexe), et on reconstitue n lignes de p points.
+ Ces n lignes de p points sont transformées en n courbes géométriques,
+ à partir desquelles on reconstitue une surface géométrique.
+ Il peut y avoir plusieurs faces géométriques reconstituées, si on fournit des groupes de quadrangles non connexes.
+ On détecte les angles vifs, pour conserver des arêtes vives délimitant des faces connexes.
+ @param meshQuad : maillages constitué de quadrangles constituant une ou plusieurs zones convexes
+ @return (fillings, noeuds_Bords) : liste de geomObject, listes des bords (bord = liste ordonnée de noeuds (geomObject))
+ """
+ logging.info("start")
+
+ isVecteurDefaut = False
+ if shapeFissureParams.has_key('vecteurDefaut'):
+ isVecteurDefaut = True
+ vecteurDefaut = shapeFissureParams['vecteurDefaut']
+
+ fillings = [] # les faces reconstituées, découpées selon les arêtes vives
+ noeuds_bords = [] #
+ bords_Partages = [] # contient a la fin les courbes correspondant aux arêtes vives
+ fillconts = [] # les faces reconstituées, sans découpage selon les arêtes vives
+ idFilToCont = [] # index face découpée vers face sans découpe
+ iface = 0 # index face découpée
+ icont = 0 # index face continue
+
+ allNodeIds = meshQuad.GetNodesId()
+ while len(allNodeIds):
+ logging.debug("len(allNodeIds): %s ", len(allNodeIds))
+ nodeIds = allNodeIds
+ for idNode in nodeIds: # rechercher un coin
+ elems = meshQuad.GetNodeInverseElements(idNode)
+ if len(elems) == 1:
+ # un coin: un noeud, un element quadrangle
+ elem = elems[0]
+ break;
+ idStart = idNode # le noeud de coin
+ elemStart = elem # l'élément quadrangle au coin
+ xyz = meshQuad.GetNodeXYZ(idStart)
+ logging.debug("idStart %s, coords %s", idStart, str(xyz))
+
+ nodelines =[] # on va constituer une liste de lignes de points
+ nextLine = True
+ ligneFinale = False
+ while nextLine:
+ logging.debug("--- une ligne")
+ idNode = idStart
+ elem = elemStart
+ if ligneFinale:
+ agauche = False # sens de parcours des 4 noeuds d'un quadrangle
+ nextLine = False
+ else:
+ agauche = True
+ ligneIncomplete = True # on commence une ligne de points
+ debutLigne = True
+ nodeline = []
+ elemline = []
+ while ligneIncomplete: # compléter la ligne de points
+ nodeline.append(idNode)
+ allNodeIds.remove(idNode)
+ elemline.append(elem)
+ nodes = meshQuad.GetElemNodes(elem)
+ i = nodes.index(idNode) # repérer l'index du noeud courant (i) dans l'élément quadrangle (0 a 3)
+ if agauche: # déterminer le noeud suivant (j) et celui opposé (k) dans le quadrangle
+ if i < 3:
+ j = i+1
+ else:
+ j = 0
+ if j < 3:
+ k = j+1
+ else:
+ k = 0
+ else:
+ if i > 0:
+ j = i -1
+ else:
+ j = 3
+ if j > 0:
+ k = j -1
+ else:
+ k = 3
+ isuiv = nodes[j] #noeud suivant
+ iapres = nodes[k] #noeud opposé
+ if debutLigne:
+ debutLigne = False
+ # précédent a trouver, dernière ligne : précédent au lieu de suivant
+ if agauche:
+ if i > 0:
+ iprec = nodes[i -1]
+ else:
+ iprec = nodes[3]
+ idStart = iprec
+ elems3 = meshQuad.GetNodeInverseElements(iprec)
+ if len(elems3) == 1: # autre coin
+ ligneFinale = True
+ else:
+ for elem3 in elems3:
+ if elem3 != elem:
+ elemStart = elem3
+ break
+ #print nodes, idNode, isuiv, iapres
+ elems1 = meshQuad.GetNodeInverseElements(isuiv)
+ elems2 = meshQuad.GetNodeInverseElements(iapres)
+ ligneIncomplete = False
+ for elem2 in elems2:
+ if elems1.count(elem2) and elem2 != elem:
+ ligneIncomplete = True
+ idNode = isuiv
+ elem = elem2
+ break
+ if not ligneIncomplete:
+ nodeline.append(isuiv)
+ allNodeIds.remove(isuiv)
+ logging.debug("nodeline %s", nodeline)
+ logging.debug("elemline %s", elemline)
+ nodelines.append(nodeline)
+ logging.debug("nodelines = %s", nodelines)
+ longueur = [len(val) for val in nodelines]
+ logging.debug("longueur = %s", longueur)
+ # on a constitué une liste de lignes de points connexes
+ logging.debug("dimensions [%s, %s]", len(nodelines), len(nodeline))
+
+ # stockage des coordonnées dans un tableau numpy
+ mat = np.zeros((len(nodelines), len(nodeline), 3))
+ for i, ligne in enumerate(nodelines):
+ for j, nodeId in enumerate(ligne):
+ mat[i,j] = meshQuad.GetNodeXYZ(nodeId)
+ logging.debug("matrice de coordonnées: \n%s",mat)
+ logging.debug("dimensions %s", mat.shape)
+
+ # recherche d'angles supérieurs a un seuil sur une ligne : angle entre deux vecteurs successifs
+ cosmin = math.cos(math.pi/4.) # TODO: angle reference en paramètre
+ vecx = mat[:, 1:, :] - mat[:, :-1, :] # vecteurs selon direction "x"
+ vx0 = vecx[:, :-1, :] # vecteurs amont
+ vx1 = vecx[:, 1:, :] # vecteurs aval
+ e = np.einsum('ijk,ijk->ij', vx0, vx1) # produit scalaire des vecteurs
+ f = np.apply_along_axis(mydot, 2, vx0) # normes carrées vecteurs amont
+ g = np.apply_along_axis(mydot, 2, vx1) # normes carrées vecteurs aval
+ h = e/(np.sqrt(f*g)) # cosinus
+ ruptureX = h < cosmin # True si angle > reference
+ logging.debug("matrice de rupture X: \n%s",ruptureX)
+ rupX = filter(lambda x: np.prod(ruptureX[:,x]), range(len(nodeline)-2))
+ logging.debug("colonnes de rupture: %s",rupX)
+ # recherche d'angles supérieurs a un seuil sur une colonne : angle entre deux vecteurs successifs
+ vecy = mat[ 1:, :, :] - mat[:-1, :, :] # vecteurs selon direction "y"
+ vy0 = vecy[:-1, :, :] # vecteurs amont
+ vy1 = vecy[ 1:, :, :] # vecteurs aval
+ e = np.einsum('ijk,ijk->ij', vy0, vy1) # produit scalaire des vecteurs
+ f = np.apply_along_axis(mydot, 2, vy0) # normes carrées vecteurs amont
+ g = np.apply_along_axis(mydot, 2, vy1) # normes carrées vecteurs aval
+ h = e/(np.sqrt(f*g)) # cosinus
+ ruptureY = h < cosmin # True si angle > reference
+ logging.debug("matrice de rupture Y: \n%s",ruptureY)
+ rupY = filter(lambda x: np.prod(ruptureY[x, :]), range(len(nodelines)-2))
+ logging.debug("lignes de rupture: %s",rupY)
+ if (len(rupX)*len(rupY)) > 0:
+ logging.critical("""Cas non traité: présence d'angles vifs dans 2 directions,
+ lors de la reconstitution des faces géométriques dans la zone remaillée""")
+
+ mats = []
+ bordsPartages = []
+ if (len(rupX)> 0):
+ rupX.append(mat.shape[1]-1)
+ for i, index in enumerate(rupX):
+ imax = index+2
+ imin = 0
+ if i > 0:
+ imin = rupX[i-1] + 1
+ mats.append(mat[:, imin:imax, :])
+ if imax == mat.shape[1] + 1:
+ ifin = 0
+ else:
+ ifin = imax
+ bordsPartages.append([imin,ifin]) # les indices différents de 0 correspondent à des bords partagés
+ elif (len(rupY)> 0):
+ rupY.append(mat.shape[0]-1)
+ for i, index in enumerate(rupY):
+ imax = index+2
+ imin = 0
+ if i > 0:
+ imin = rupY[i-1] + 1
+ mats.append(mat[imin:imax, :, :])
+ if imax == mat.shape[0] + 1:
+ ifin = 0
+ else:
+ ifin = imax
+ bordsPartages.append([imin,ifin]) # les indices différents de 0 correspondent à des bords partagés
+ else:
+ mats.append(mat)
+ bordsPartages.append([0,0]) # les indices différents de 0 correspondent à des bords partagés
+
+ curvconts = []
+ for nmat, amat in enumerate(mats):
+ logging.debug("dimensions matrice %s: %s", nmat, amat.shape)
+ nbLignes = amat.shape[1] # pas de rupture, ou rupture selon des colonnes: on transpose
+ nbCols = amat.shape[0]
+ if len(rupY) > 0 : # rupture selon des lignes: pas de transposition
+ nbLignes = amat.shape[0]
+ nbCols = amat.shape[1]
+ curves = []
+ noeudsBords = []
+ for i in range(4):
+ noeudsBords.append([])
+ k = 0
+ for i in range(nbLignes):
+ nodeList = []
+ for j in range(nbCols):
+ #logging.debug("point[%s,%s] = (%s, %s, %s)",i,j,amat[i,j,0], amat[i,j,1], amat[i,j,2])
+ if len(rupY) > 0 : # pas de transposition
+ node = geompy.MakeVertex(amat[i,j,0], amat[i,j,1], amat[i,j,2])
+ else: # transposition
+ node = geompy.MakeVertex(amat[j,i,0], amat[j,i,1], amat[j,i,2])
+ nodeList.append(node)
+ if i == 0:
+ noeudsBords[0].append(node)
+ #name = "bord0_%d"%k
+ #geomPublish(initLog.debug, node, name )
+ if i == (nbLignes -1):
+ noeudsBords[2].append(node)
+ #name = "bord2_%d"%k
+ #geomPublish(initLog.debug, node, name )
+ if j == 0:
+ noeudsBords[1].append(node)
+ #name = "bord1_%d"%k
+ #geomPublish(initLog.debug, node, name )
+ if j == (nbCols -1):
+ noeudsBords[3].append(node)
+ #name = "bord3_%d"%k
+ #geomPublish(initLog.debug, node, name )
+ k += 1
+ curve = geompy.MakeInterpol(nodeList, False, False)
+ #name = "curve_%d"%i
+ #geomPublish(initLog.debug, curve, name )
+ if len(curvconts) == 0 or len(curves) > 0: # éliminer les doublons de la surface sans découpe
+ curvconts.append(nodeList)
+ curves.append(curve)
+ if bordsPartages[nmat][0] :
+ bordsPartages[nmat][0] = curves[0] # la première ligne est un bord partagé
+ else:
+ bordsPartages[nmat][0] = None
+ if bordsPartages[nmat][1] :
+ bordsPartages[nmat][1] = curves[-1] # la dernière ligne est un bord partagé
+ else:
+ bordsPartages[nmat][1] = None
+ filling = geompy.MakeFilling(geompy.MakeCompound(curves), 2, 5, 0.0001, 0.0001, 0, GEOM.FOM_Default, True)
+ # --- test orientation filling
+ vertex = geompy.MakeVertexOnSurface(filling, 0.5, 0.5)
+ normal = geompy.GetNormal(filling, vertex)
+
+ if centreFondFiss is not None:
+ logging.debug("orientation filling a l'aide du centre de fond de fissure")
+ vecteurDefaut = geompy.MakeVector(centreFondFiss, vertex)
+
+ if not isVecteurDefaut:
+ pointIn_x = 0.0
+ pointIn_y = 0.0
+ pointIn_z = 0.0
+ pointExplicite = False
+ if shapeFissureParams.has_key('pointIn_x'):
+ pointExplicite = True
+ pointIn_x = shapeFissureParams['pointIn_x']
+ if shapeFissureParams.has_key('pointIn_y'):
+ pointExplicite = True
+ pointIn_y = shapeFissureParams['pointIn_y']
+ if shapeFissureParams.has_key('pointIn_z'):
+ pointExplicite = True
+ pointIn_z = shapeFissureParams['pointIn_z']
+ if pointExplicite:
+ cdg = geompy.MakeVertex(pointIn_x, pointIn_y, pointIn_z)
+ logging.debug("orientation filling par point intérieur %s", (pointIn_x, pointIn_y, pointIn_z))
+ vecteurDefaut = geompy.MakeVector(cdg, vertex)
+
+ if shapeFissureParams.has_key('convexe'):
+ isConvexe = shapeFissureParams['convexe']
+ logging.debug("orientation filling par indication de convexité %s", isConvexe)
+ cdg = geompy.MakeCDG(filling)
+ if isConvexe:
+ vecteurDefaut = geompy.MakeVector(cdg, vertex)
+ else:
+ vecteurDefaut = geompy.MakeVector(vertex, cdg)
+
+ if vecteurDefaut is not None:
+ geomPublish(initLog.debug, normal, "normFillOrig%d"%iface)
+ geomPublish(initLog.debug, vecteurDefaut, "fromInterieur%d"%iface)
+ if geompy.GetAngleRadians(vecteurDefaut, normal) > math.pi/2.0:
+ filling = geompy.ChangeOrientation(filling)
+ geomPublish(initLog.debug, filling, "filling%d"%iface )
+ #geompy.ExportBREP(filling, "filling.brep")
+ iface = iface+1
+ fillings.append(filling)
+ noeuds_bords.append(noeudsBords)
+ idFilToCont.append(icont)
+ bords_Partages += bordsPartages
+ logging.debug("bords_Partages = %s", bords_Partages)
+ pass # --- loop on mats
+ # --- reconstruction des faces continues à partir des listes de noeuds
+ # les courbes doivent suivre la courbure pour éviter les oscillations
+ if icont == iface - 1: # pas de découpe, on garde la même face
+ fillcont = fillings[-1]
+ else:
+ nbLignes = len(curvconts[0])
+ curves = []
+ for i in range(nbLignes):
+ nodes = [curvconts[j][i] for j in range(len(curvconts))]
+ curve = geompy.MakeInterpol(nodes, False, False)
+ curves.append(curve)
+ fillcont = geompy.MakeFilling(geompy.MakeCompound(curves), 2, 5, 0.0001, 0.0001, 0, GEOM.FOM_Default, True)
+ geomPublish(initLog.debug, fillcont, "filcont%d"%icont )
+ fillconts.append(fillcont)
+ icont = icont+1
+ pass # --- loop while there are remaining nodes
+
+ return fillings, noeuds_bords, bords_Partages, fillconts, idFilToCont
--- /dev/null
+# -*- coding: utf-8 -*-
+"""
+Created on Tue Jun 24 09:14:13 2014
+
+@author: I48174
+"""
+
+import logging
+from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
+import GEOM
+
+from listOfExtraFunctions import createNewMeshesFromCorner
+from listOfExtraFunctions import createLinesFromMesh
+
+# -----------------------------------------------------------------------------
+# --- groupe de quadrangles de face transformé en face géométrique par filling
+
+def quadranglesToShapeWithCorner(meshQuad, shapeDefaut, shapeFissureParams, centreFondFiss, listOfCorners):
+ """ """
+ # TODO: rédiger la docstring
+
+ logging.info("start")
+
+ #fillings = [[], []]
+ tmpFillings = []
+ noeuds_bords = []
+ #bords_Partages = [[], []]
+ tmpBords = []
+ fillconts = []
+ idFilToCont = []
+
+ facesNonCoupees = []
+ facesCoupees = []
+ aretesNonCoupees = []
+ aretesCoupees = []
+
+ setOfNodes = []
+ setOfLines = []
+ listOfEdges = []
+ # On crée une liste contenant le maillage de chaque face.
+ listOfNewMeshes = createNewMeshesFromCorner(meshQuad, listOfCorners)
+ for msh in listOfNewMeshes:
+ # On crée une liste de noeuds correspondant aux faces suivant
+ # le modèle liste[face][ligne][noeud].
+ lines = createLinesFromMesh(msh, listOfCorners[0])
+ setOfNodes.append(lines)
+
+ for face in setOfNodes:
+ tmpFace = []
+ for line in face:
+ # On possède l'information 'ID' de chaque noeud composant chaque
+ # ligne de chaque face. A partir de l'ID, on crée un vertex. Un
+ # ensemble de vertices constitue une ligne. Un ensemble de lignes
+ # constitue une face.
+ tmpCoords = [meshQuad.GetNodeXYZ(node) for node in line]
+ tmpPoints = [geompy.MakeVertex(val[0], val[1], val[2]) for val in tmpCoords]
+ line = geompy.MakeInterpol(tmpPoints, False, False)
+ tmpFace.append(line)
+ setOfLines.append(tmpFace)
+
+ for i, face in enumerate(setOfLines):
+ # A partir des lignes de chaque face,
+ # on recrée un objet GEOM temporaire par filling.
+ filling = geompy.MakeFilling(geompy.MakeCompound(face), 2, 5, 0.0001, 0.0001, 0, GEOM.FOM_Default, True)
+ geomPublish(initLog.debug, filling, 'filling_{0}'.format(i + 1))
+ tmpFillings.append(filling)
+
+ for face in setOfNodes:
+ # On prend la première ligne qui correspond aux bords partagés
+ listOfEdges.append(face[0])
+
+ for edge in listOfEdges:
+ # On utilise les points de bords pour créer des aretes vives
+ tmpCoords = [meshQuad.GetNodeXYZ(node) for node in list(edge)]
+ tmpPoints = [geompy.MakeVertex(val[0], val[1], val[2]) for val in tmpCoords]
+ line = geompy.MakeInterpol(tmpPoints, False, False)
+ tmpBords.append(line)
+
+ for i, filling in enumerate(tmpFillings):
+ tmpPartition = geompy.MakePartition([filling], [shapeDefaut], [], [], geompy.ShapeType["FACE"], 0, [], 0, True)
+ tmpExplodeRef = geompy.ExtractShapes(filling, geompy.ShapeType["EDGE"], True)
+ tmpExplodeNum = geompy.ExtractShapes(tmpPartition, geompy.ShapeType["EDGE"], True)
+ if len(tmpExplodeRef) == len(tmpExplodeNum):
+ geomPublish(initLog.debug, filling, "faceNonCoupee_{0}".format(i + 1))
+ facesNonCoupees.append(filling)
+ else:
+ geomPublish(initLog.debug, filling, "faceCoupee_{0}".format(i + 1))
+ facesCoupees.append(filling)
+ fillings = facesCoupees, facesNonCoupees
+
+ for i, filling in enumerate(tmpBords):
+ tmpPartition = geompy.MakePartition([shapeDefaut], [filling], [], [], geompy.ShapeType["SHELL"], 0, [], 0, True)
+ tmpExplodeRef = geompy.ExtractShapes(shapeDefaut, geompy.ShapeType["EDGE"], True) + geompy.ExtractShapes(shapeDefaut, geompy.ShapeType["VERTEX"], True)
+ tmpExplodeNum = geompy.ExtractShapes(tmpPartition, geompy.ShapeType["EDGE"], True) + geompy.ExtractShapes(tmpPartition, geompy.ShapeType["VERTEX"], True)
+ if len(tmpExplodeRef) == len(tmpExplodeNum):
+ geomPublish(initLog.debug, filling, "areteNonCoupee_{0}".format(i + 1))
+ aretesNonCoupees.append(filling)
+ else:
+ geomPublish(initLog.debug, filling, "areteCoupee_{0}".format(i + 1))
+ aretesCoupees.append(filling)
+ bords_Partages = aretesCoupees, aretesNonCoupees
+
+# TODO: A enlever
+# for i, face in enumerate(setOfLines):
+# for j, line in enumerate(face):
+# geomPublish(initLog.debug, line, 'face{0}_ligne{1}'.format(i + 1, j + 1))
+
+ #TODO: A enlever
+# for i, filling in enumerate(fillings[0]):
+# geomPublish(initLog.debug, filling, 'filling_{0}'.format(i + 1))
+# for j, line in enumerate(setOfLines[i]):
+# geompy.addToStudyInFather(filling, line, 'line_{0}'.format(j + 1))
+
+ return fillings, noeuds_bords, bords_Partages, fillconts, idFilToCont
+
\ No newline at end of file
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import logging
+from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
+from sortFaces import sortFaces
+
+def restreintFaceFissure(shapeDefaut, facesDefaut, pointInterne):
+ """
+ restriction de la face de fissure au domaine solide
+ partition face fissure étendue par fillings
+ """
+ logging.info('start')
+ partShapeDefaut = geompy.MakePartition([shapeDefaut], facesDefaut, [], [], geompy.ShapeType["FACE"], 0, [], 0)
+ geomPublish(initLog.debug, partShapeDefaut, 'partShapeDefaut')
+ facesPartShapeDefaut = geompy.ExtractShapes(partShapeDefaut, geompy.ShapeType["FACE"], False)
+ if pointInterne is not None:
+ distfaces = [(geompy.MinDistance(face,pointInterne), i, face) for i, face in enumerate(facesPartShapeDefaut)]
+ distfaces.sort()
+ logging.debug("selection de la face la plus proche du point interne, distance=%s",distfaces[0][0])
+ facesPortFissure = distfaces[0][2]
+ else:
+ facesPartShapeDefautSorted, minSurf, maxSurf = sortFaces(facesPartShapeDefaut) # la face de fissure dans le volume doit être la plus grande
+ logging.debug("surfaces faces fissure étendue, min %s, max %s", minSurf, maxSurf)
+ facesPortFissure = facesPartShapeDefautSorted[-1]
+
+ geomPublish(initLog.debug, facesPortFissure, "facesPortFissure")
+ return facesPortFissure
import logging
from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
import math
from triedreBase import triedreBase
O, OX, OY, OZ = triedreBase()
logging.debug("alpha",alpha)
logging.debug("beta",beta)
if trace:
- geompy.addToStudy( rot1, 'rot1' )
- geompy.addToStudy( axe2, 'axe2' )
- geompy.addToStudy( rot2, 'rot2' )
+ geomPublish(initLog.debug, rot1, 'rot1' )
+ geomPublish(initLog.debug, axe2, 'axe2' )
+ geomPublish(initLog.debug, rot2, 'rot2' )
xyz = geompy.PointCoordinates(point)
trans = geompy.MakeTranslation(rot2, xyz[0], xyz[1], xyz[2])
import logging
from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
# -----------------------------------------------------------------------------
# --- construction d'une shape de dectection des éléments à modifier suite à la la duplication des noeuds de la face fissure (d'un coté de la face)
normal = geompy.GetNormal(face, vertex)
extrusionFaceFissure = geompy.MakePrismVecH(facesFissure, normal, 100)
- geompy.addToStudy(extrusionFaceFissure, "extrusionFaceFissure")
+ geomPublish(initLog.debug, extrusionFaceFissure, "extrusionFaceFissure")
return extrusionFaceFissure, normal
import logging
from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
# -----------------------------------------------------------------------------
# --- tri par longueur des 3 generatrices
gencnt= genx[i]
pass
- geompy.addToStudyInFather( tore, genext, 'genext' )
- geompy.addToStudyInFather( tore, genint, 'genint' )
- geompy.addToStudyInFather( tore, gencnt, 'gencnt' )
+ geomPublishInFather(initLog.debug, tore, genext, 'genext' )
+ geomPublishInFather(initLog.debug, tore, genint, 'genint' )
+ geomPublishInFather(initLog.debug, tore, gencnt, 'gencnt' )
return genext, genint, gencnt
import logging
from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
import math
from triedreBase import triedreBase
Arc_1 = geompy.MakeArc(Vertex_1, Vertex_2, Vertex_3)
generatrice = geompy.MakeScaleAlongAxes(Arc_1, O, 1, allonge, 1)
- #geompy.addToStudy( Vertex_1, 'Vertex_1' )
- #geompy.addToStudy( Vertex_2, 'Vertex_2' )
- #geompy.addToStudy( Vertex_3, 'Vertex_3' )
- #geompy.addToStudy( Arc_1, 'Arc_1' )
- #geompy.addToStudy( generatrice, 'generatrice' )
+ #geomPublish(initLog.debug, Vertex_1, 'Vertex_1' )
+ #geomPublish(initLog.debug, Vertex_2, 'Vertex_2' )
+ #geomPublish(initLog.debug, Vertex_3, 'Vertex_3' )
+ #geomPublish(initLog.debug, Arc_1, 'Arc_1' )
+ #geomPublish(initLog.debug, generatrice, 'generatrice' )
# --- face circulaire sur la generatrice, pour extrusion
Translation_1 = geompy.MakeTranslation(Rotation_1, minRad, 0, 0)
FaceGenFiss = geompy.MakeFaceWires([Translation_1], 1)
- #geompy.addToStudy( Circle_1, 'Circle_1' )
- #geompy.addToStudy( Rotation_1, 'Rotation_1' )
- #geompy.addToStudy( Translation_1, 'Translation_1' )
- #geompy.addToStudy( FaceGenFiss, 'FaceGenFiss' )
+ #geomPublish(initLog.debug, Circle_1, 'Circle_1' )
+ #geomPublish(initLog.debug, Rotation_1, 'Rotation_1' )
+ #geomPublish(initLog.debug, Translation_1, 'Translation_1' )
+ #geomPublish(initLog.debug, FaceGenFiss, 'FaceGenFiss' )
# --- tore extrude
Line_1 = geompy.MakeLineTwoPnt(Vertex_1, Scale_1_vertex_3)
FaceFissure = geompy.MakeFaceWires([generatrice, Line_1], 1)
- #geompy.addToStudyInFather( generatrice, Scale_1_vertex_3, 'Scale_1:vertex_3' )
- #geompy.addToStudy( Line_1, 'Line_1' )
- #geompy.addToStudy( FaceFissure, 'FaceFissure' )
+ #geomPublishInFather(initLog.debug, generatrice, Scale_1_vertex_3, 'Scale_1:vertex_3' )
+ #geomPublish(initLog.debug, Line_1, 'Line_1' )
+ #geomPublish(initLog.debug, FaceFissure, 'FaceFissure' )
# --- tore coupe en 2 demi tore de section 1/2 disque
Plane_1 = geompy.MakePlane(O, OZ, 2000)
Pipe1Part = geompy.MakePartition([Pipe_1], [Plane_1], [], [], geompy.ShapeType["SOLID"], 0, [], 1)
- geompy.addToStudy(Pipe1Part , 'Pipe1Part' )
+ geomPublish(initLog.debug, Pipe1Part , 'Pipe1Part' )
return generatrice, FaceGenFiss, Pipe_1, FaceFissure, Plane_1, Pipe1Part
import logging
from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
# --- origine et vecteurs de base
OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
-
+
if not geompy.myStudy.FindObjectByName( 'OX', geompy.ComponentDataType() ):
- geompy.addToStudy( O, 'O' )
- geompy.addToStudy( OX, 'OX' )
- geompy.addToStudy( OY, 'OY' )
- geompy.addToStudy( OZ, 'OZ' )
+ geomPublish(initLog.debug, O, 'O' )
+ geomPublish(initLog.debug, OX, 'OX' )
+ geomPublish(initLog.debug, OY, 'OY' )
+ geomPublish(initLog.debug, OZ, 'OZ' )
return O, OX, OY, OZ
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import logging
+
+from geomsmesh import geompy
+from geomsmesh import geomPublish
+from geomsmesh import geomPublishInFather
+import initLog
+
+def trouveEdgesFissPeau(facesInside, facesOnside, edgesPipeIn, edgesFondIn, partitionPeauFissFond, edgesFissExtPeau):
+ """
+ pour les faces de peau sans extremité débouchante de fissure, il faut recenser les edges de fissure sur la face de peau
+ """
+ logging.info('start')
+
+ j = 0
+ for face in facesInside:
+ edgesPeauFis = []
+ edgesPipeFis = []
+ edgesPipeFnd = []
+ try:
+ edgesPeauFis = geompy.GetSharedShapesMulti([geompy.MakeCompound(facesOnside), face], geompy.ShapeType["EDGE"])
+ edgesPipeFis = geompy.GetSharedShapesMulti([geompy.MakeCompound(edgesPipeIn), face], geompy.ShapeType["EDGE"])
+ edgesPipeFnd = geompy.GetSharedShapesMulti([geompy.MakeCompound(edgesFondIn), face], geompy.ShapeType["EDGE"])
+ except:
+ pass
+ if (len(edgesPeauFis) > 0) and (len(edgesPipeFis) > 0) and (len(edgesPipeFnd) == 0):
+ edgesFissExtPeau.append(edgesPeauFis[0])
+ name="edgesFissExtPeau%d"%j
+ geomPublishInFather(initLog.debug,partitionPeauFissFond, edgesPeauFis[0], name)
+ j += 1
+ return edgesFissExtPeau
\ No newline at end of file
__init__.py
fissureCoude_ihm.py
fissureCoude_plugin.py
+ fissureGenerale_plugin.py
+ dialogFissureCoude.dic
)
# --- resources ---
# --- rules ---
-SALOME_INSTALL_SCRIPTS("${plugin_SCRIPTS}" ${SALOME_SMESH_INSTALL_PLUGINS}/blocFissure/ihm)
+SALOME_INSTALL_SCRIPTS("${plugin_SCRIPTS}" ${SALOME_INSTALL_PYTHON}/blocFissure/ihm)
-SALOME_INSTALL_SCRIPTS("${_pyuic_SCRIPTS}" ${SALOME_SMESH_INSTALL_PLUGINS}/blocFissure/ihm)
\ No newline at end of file
+SALOME_INSTALL_SCRIPTS("${_pyuic_SCRIPTS}" ${SALOME_INSTALL_PYTHON}/blocFissure/ihm)
\ No newline at end of file
<rect>
<x>0</x>
<y>0</y>
- <width>826</width>
- <height>540</height>
+ <width>959</width>
+ <height>618</height>
</rect>
</property>
<property name="windowTitle">
- <string>Dialog</string>
+ <string>Génération de coude avec fissure</string>
</property>
<layout class="QGridLayout" name="gridLayout_8">
<item row="0" column="0">
</item>
</layout>
<zorder>verticalSpacer_2</zorder>
- <zorder>horizontalSpacer</zorder>
- <zorder>lb_calcul</zorder>
- <zorder>horizontalSpacer_9</zorder>
</widget>
<resources/>
<connections>
# 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, or (at your option) any later version.
+# 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
initLog.setVerbose()
from blocFissure.gmu import geomsmesh
-from blocFissure.casStandard import casStandard
+from blocFissure.gmu.casStandard import casStandard
from blocFissure.ihm.fissureCoude_ihm import fissureCoude_ihm
<x>0</x>
<y>0</y>
<width>631</width>
- <height>490</height>
+ <height>560</height>
</rect>
</property>
<property name="windowTitle">
- <string>Dialog</string>
+ <string>Insertion de fissure dans un maillage sain</string>
</property>
<property name="toolTip">
<string><html><head/><body><p>Insertion d'un maillage de fissure dans un maillage hexaédrique sain.</p><p>Le maillage sain est fourni sous forme de fichier Med.</p><p>La face de fissure est décrite par une géométrie dans un fichier brep.</p><p>La ou les arêtes de fond de fissure sont données par leurs index dans la face de fissure.</p><p>La procédure identfie des mailles saines à enlever et remailler, construit un maillage régulier rayonnant autour de la ligne de fond de fissure, reconstitue les faces externes en triangles, complète la zone à remailler en tétraèdres.</p></body></html></string>
</property>
- <layout class="QGridLayout" name="gridLayout_11">
- <item row="0" column="0" colspan="2">
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>maillage sain et géometries de fissure</string>
</property>
<layout class="QGridLayout" name="gridLayout_4">
- <item row="0" column="0">
- <layout class="QGridLayout" name="gridLayout">
- <item row="0" column="0">
- <widget class="QPushButton" name="pb_maillage">
- <property name="toolTip">
- <string><html><head/><body><p>sélection du fichier med du maillage sain (hexaèdres)</p></body></html></string>
- </property>
+ <item row="1" column="0">
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QLabel" name="label">
<property name="text">
- <string>maillage sain</string>
+ <string>index edges fond fissure</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="le_fondfiss">
+ <property name="toolTip">
+ <string><html><head/><body><p>Index des edges décrivant le fond de fissure, dans la face de fissure.</p><p>Sous forme d'une liste Python.</p><p>Exemples :<span style=" color:#00ffff;"/><span style=" font-style:italic; color:#00ffff;">[5,9]</span> ou <span style=" font-style:italic; color:#00ffff;">[3]</span></p><p>(on peut récupérer ces valeurs à l'aide du dialogue de création de groupes d'edges, dans GEOM)</p></body></html></string>
</property>
</widget>
</item>
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ <item row="0" column="0">
+ <layout class="QGridLayout" name="gridLayout">
<item row="0" column="1">
<widget class="QLineEdit" name="le_maillage">
<property name="toolTip">
</property>
</widget>
</item>
- </layout>
- </item>
- <item row="1" column="0">
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <widget class="QLabel" name="label">
- <property name="text">
- <string>index edges fond fissure</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLineEdit" name="le_fondfiss">
+ <item row="0" column="0">
+ <widget class="QPushButton" name="pb_maillage">
<property name="toolTip">
- <string><html><head/><body><p>Index des edges décrivant le fond de fissure, dans la face de fissure.</p><p>Sous forme d'une liste Python.</p><p>Exemples :<span style=" color:#00ffff;"/><span style=" font-style:italic; color:#00ffff;">[5,9]</span> ou <span style=" font-style:italic; color:#00ffff;">[3]</span></p><p>(on peut récupérer ces valeurs à l'aide du dialogue de création de groupes d'edges, dans GEOM)</p></body></html></string>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="horizontalSpacer">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
+ <string><html><head/><body><p>sélection du fichier med du maillage sain (hexaèdres)</p></body></html></string>
</property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
+ <property name="text">
+ <string>maillage sain</string>
</property>
- </spacer>
+ </widget>
</item>
</layout>
</item>
<zorder></zorder>
</widget>
</item>
- <item row="1" column="0" colspan="2">
+ <item>
<layout class="QGridLayout" name="gridLayout_10">
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox_2">
<property name="toolTip">
<string><html><head/><body><p>La zone remaillée contiendra toutes les mailles du maillage sain à une distance de la face de fissure inférieure à cette valeur.</p></body></html></string>
</property>
+ <property name="decimals">
+ <number>5</number>
+ </property>
</widget>
</item>
</layout>
<property name="toolTip">
<string><html><head/><body><p>Pour faciliter la détermination de la zone à remailler, il faut des points sur la face de fissure, suffisament resserrés, en relation avec la taille des mailles du maillage sain.</p><p>Ces points sont obtenus par pré maillage de la face de fissure, en triangles. On donne la taille min et max des triangles.</p></body></html></string>
</property>
+ <property name="decimals">
+ <number>5</number>
+ </property>
<property name="maximum">
<double>1000000.000000000000000</double>
</property>
<property name="toolTip">
<string><html><head/><body><p>Pour faciliter la détermination de la zone à remailler, il faut des points sur la face de fissure, suffisament resserrés, en relation avec la taille des mailles du maillage sain.</p><p>Ces points sont obtenus par pré maillage de la face de fissure, en triangles. On donne la taille min et max des triangles.</p></body></html></string>
</property>
+ <property name="decimals">
+ <number>5</number>
+ </property>
<property name="maximum">
<double>1000000.000000000000000</double>
</property>
<property name="toolTip">
<string><html><head/><body><p>Pipe rayonnant construit sur le fond de fissure :</p><p>Rayon du pipe.</p></body></html></string>
</property>
+ <property name="decimals">
+ <number>5</number>
+ </property>
<property name="maximum">
<double>1000000.000000000000000</double>
</property>
<property name="toolTip">
<string><html><head/><body><p>Pipe rayonnant construit sur le fond de fissure :</p><p>Longueur des mailles le long de la ligne de fond de fissure.</p></body></html></string>
</property>
+ <property name="decimals">
+ <number>5</number>
+ </property>
<property name="maximum">
<double>1000000.000000000000000</double>
</property>
<property name="toolTip">
<string><html><head/><body><p>Faces externes de la zone à remailler.</p><p>Mailage en triangles : valeur cible des arêtes.</p></body></html></string>
</property>
+ <property name="decimals">
+ <number>5</number>
+ </property>
<property name="maximum">
<double>1000000.000000000000000</double>
</property>
</item>
</layout>
</item>
- <item row="2" column="1">
+ <item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</spacer>
</item>
- <item row="3" column="0">
- <layout class="QHBoxLayout" name="horizontalLayout_5">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <spacer name="horizontalSpacer_7">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QLabel" name="lb_calcul">
+ <property name="font">
+ <font>
+ <pointsize>24</pointsize>
+ </font>
+ </property>
+ <property name="text">
+ <string>--- Calcul en cours ---</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer_8">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <item>
+ <widget class="QPushButton" name="pb_reset">
+ <property name="toolTip">
+ <string>réinitialisation de tous les paramètres à leur valeur par défaut</string>
+ </property>
+ <property name="text">
+ <string>Reset</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="pb_valPrec">
+ <property name="toolTip">
+ <string>réinitialisation de tous les paramètres à leur valeur de la précédente éxécution</string>
+ </property>
+ <property name="text">
+ <string>Précédent</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="pb_recharger">
+ <property name="toolTip">
+ <string>réinitialisation des paramètres à partir d'un fichier préalablement sauvegardé</string>
+ </property>
+ <property name="text">
+ <string>Recharger</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="pb_sauver">
+ <property name="toolTip">
+ <string>sauvegarde des paramètres dans un fichier à choisir</string>
+ </property>
+ <property name="text">
+ <string>Sauver</string>
+ </property>
+ </widget>
+ </item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
--- /dev/null
+# -*- coding: utf-8 -*-
+
+# Copyright (C) 2006-2015 EDF R&D
+#
+# 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
+#
+
+# if you already have plugins defined in a salome_plugins.py file, add this file at the end.
+# if not, copy this file as ${HOME}/Plugins/smesh_plugins.py or ${APPLI}/Plugins/smesh_plugins.py
+
+import sys, traceback
+import math
+from blocFissure import gmu
+from blocFissure.gmu import initLog
+#initLog.setDebug()
+initLog.setVerbose()
+
+from blocFissure.gmu import geomsmesh
+from blocFissure.gmu.casStandard import casStandard
+
+def fissureGeneraleDlg(context):
+ # get context study, studyId, salomeGui
+ study = context.study
+ studyId = context.studyId
+ sg = context.sg
+
+ import os
+ #import subprocess
+ #import tempfile
+ from PyQt4 import QtCore
+ from PyQt4 import QtGui
+ from PyQt4.QtGui import QFileDialog
+ from PyQt4.QtGui import QMessageBox
+ from PyQt4.QtGui import QPalette
+ from PyQt4.QtGui import QColor
+ from fissureGenerale_ui import Ui_Dialog
+
+ class fissureGeneraleDialog(QtGui.QDialog):
+
+ def __init__(self):
+ QtGui.QDialog.__init__(self)
+ # Set up the user interface from Designer.
+ self.ui = Ui_Dialog()
+ self.ui.setupUi(self)
+
+ self.blackPalette = self.ui.dsb_influence.palette()
+ self.redPalette = QPalette()
+ self.redPalette.setColor(QPalette.Text, QColor(255,0,0))
+ self.NOK = False
+
+ self.initDefaut()
+ self.initDialog(self.defaut)
+ self.ui.lb_calcul.hide()
+
+ # Connect up the buttons.
+ self.connect(self.ui.pb_valPrec, QtCore.SIGNAL("clicked()"),
+ self.readValPrec)
+ self.connect(self.ui.pb_reset, QtCore.SIGNAL("clicked()"),
+ self.resetVal)
+ self.connect(self.ui.pb_recharger, QtCore.SIGNAL("clicked()"),
+ self.recharger)
+ self.connect(self.ui.pb_sauver, QtCore.SIGNAL("clicked()"),
+ self.sauver)
+ self.connect(self.ui.pb_maillage, QtCore.SIGNAL("clicked()"),
+ self.selectMaillage)
+ self.connect(self.ui.pb_facefiss, QtCore.SIGNAL("clicked()"),
+ self.selectFacefiss)
+ self.disconnect(self.ui.bb_OkCancel, QtCore.SIGNAL("accepted()"), self.accept)
+ self.connect(self.ui.bb_OkCancel, QtCore.SIGNAL("accepted()"),
+ self.execute)
+
+ def initDefaut(self):
+ self.defaut = dict(
+ nomCas = 'angleCube',
+ maillageSain = os.path.join(gmu.pathBloc, 'materielCasTests/CubeAngle.med'),
+ brepFaceFissure = os.path.join(gmu.pathBloc, "materielCasTests/CubeAngleFiss.brep"),
+ edgeFissIds = [4],
+ lgInfluence = 20,
+ meshBrep = (5,10),
+ rayonPipe = 5,
+ lenSegPipe = 2.5,
+ nbSegRad = 5,
+ nbSegCercle = 32,
+ areteFaceFissure = 10)
+
+
+ def initDialog(self, dico):
+ self.ui.le_maillage.setText(dico['maillageSain'])
+ self.ui.le_facefiss.setText(dico['brepFaceFissure'])
+ self.ui.le_fondfiss.setText(str(dico['edgeFissIds']))
+ self.ui.dsb_influence.setValue(dico['lgInfluence'])
+ self.ui.dsb_meshBrepMin.setValue(dico['meshBrep'][0])
+ self.ui.dsb_meshBrepMax.setValue(dico['meshBrep'][1])
+ self.ui.dsb_rayonPipe.setValue(dico['rayonPipe'])
+ self.ui.dsb_lenSegPipe.setValue(dico['lenSegPipe'])
+ self.ui.sb_couronnes.setValue(dico['nbSegRad'])
+ self.ui.sb_secteurs.setValue(dico['nbSegCercle'])
+ self.ui.dsb_areteFaceFissure.setValue(dico['areteFaceFissure'])
+ incomplet = self.testval(dico)
+ pass
+
+ def testval(self, dico):
+ incomplet = False
+ if not os.path.lexists(dico['maillageSain']):
+ self.ui.le_maillage.setPalette(self.redPalette)
+ incomplet = True
+ else:
+ self.ui.le_maillage.setPalette(self.blackPalette)
+ if not os.path.lexists(dico['brepFaceFissure']):
+ self.ui.le_facefiss.setPalette(self.redPalette)
+ incomplet = True
+ else:
+ self.ui.le_facefiss.setPalette(self.blackPalette)
+ edgeFissIdsOK=True
+ try:
+ l = dico['edgeFissIds']
+ for i in l:
+ if not isinstance(i, int):
+ print"not isinstance(i, int)"
+ incomplet = True
+ edgeFissIdsOK=False
+ break
+ except:
+ print "except eval"
+ incomplet = True
+ edgeFissIdsOK=False
+ if edgeFissIdsOK:
+ self.ui.le_fondfiss.setPalette(self.blackPalette)
+ else:
+ self.ui.le_fondfiss.setPalette(self.redPalette)
+ if dico['meshBrep'][0] == 0:
+ self.ui.dsb_meshBrepMin.setPalette(self.redPalette)
+ incomplet = True
+ else:
+ self.ui.dsb_meshBrepMin.setPalette(self.blackPalette)
+ if dico['meshBrep'][1] == 0:
+ self.ui.dsb_meshBrepMax.setPalette(self.redPalette)
+ incomplet = True
+ else:
+ self.ui.dsb_meshBrepMax.setPalette(self.blackPalette)
+ if dico['rayonPipe'] == 0:
+ self.ui.dsb_rayonPipe.setPalette(self.redPalette)
+ incomplet = True
+ else:
+ self.ui.dsb_rayonPipe.setPalette(self.blackPalette)
+ if dico['lenSegPipe'] == 0:
+ self.ui.dsb_lenSegPipe.setPalette(self.redPalette)
+ incomplet = True
+ else:
+ self.ui.dsb_lenSegPipe.setPalette(self.blackPalette)
+ if dico['areteFaceFissure'] == 0:
+ self.ui.dsb_areteFaceFissure.setPalette(self.redPalette)
+ incomplet = True
+ else:
+ self.ui.dsb_areteFaceFissure.setPalette(self.blackPalette)
+
+ print "incomplet: ", incomplet
+ return incomplet
+
+ def fileDefault(self):
+ filedef = os.path.expanduser("~/.config/salome/dialogFissureGenerale.dic")
+ print filedef
+ return filedef
+
+ def writeDefault(self, dico):
+ filedef = self.fileDefault()
+ f = open(filedef, 'w')
+ f.write(str(dico))
+ f.close()
+
+ def readValPrec(self):
+ filedef = self.fileDefault()
+ if os.path.exists(filedef):
+ f = open(filedef, 'r')
+ txt = f.read()
+ dico = eval(txt)
+ print dico
+ self.initDialog(dico)
+
+ def resetVal(self):
+ #self.initDefaut()
+ self.initDialog(self.defaut)
+
+ def sauver(self):
+ print "sauver"
+ fileDiag = QFileDialog(self)
+ fileDiag.setFileMode(QFileDialog.AnyFile)
+ fileDiag.setNameFilter("Parametres *.dic (*.dic)")
+ fileDiag.setViewMode(QFileDialog.List)
+ if fileDiag.exec_() :
+ fileNames = fileDiag.selectedFiles()
+ filedef = fileNames[0]
+ dico = self.creeDico()
+ f = open(filedef, 'w')
+ f.write(str(dico))
+ f.close()
+
+ def recharger(self):
+ print "recharger"
+ fileDiag = QFileDialog(self)
+ fileDiag.setFileMode(QFileDialog.ExistingFile)
+ fileDiag.setNameFilter("Parametres *.dic (*.dic)")
+ fileDiag.setViewMode(QFileDialog.Detail)
+ if fileDiag.exec_() :
+ fileNames = fileDiag.selectedFiles()
+ filedef = fileNames[0]
+ print filedef
+ if os.path.exists(filedef):
+ f = open(filedef, 'r')
+ txt = f.read()
+ dico = eval(txt)
+ print dico
+ self.initDialog(dico)
+
+ def selectMaillage(self):
+ fileDiag = QFileDialog(self)
+ fileDiag.setFileMode(QFileDialog.ExistingFile)
+ fileDiag.setNameFilter("Maillage *.med (*.med)")
+ fileDiag.setViewMode(QFileDialog.Detail)
+ if fileDiag.exec_() :
+ fileNames = fileDiag.selectedFiles()
+ filedef = fileNames[0]
+ print filedef
+ self.ui.le_maillage.setText(filedef)
+
+ def selectFacefiss(self):
+ fileDiag = QFileDialog(self)
+ fileDiag.setFileMode(QFileDialog.ExistingFile)
+ fileDiag.setNameFilter("Face fissure *.brep (*.brep)")
+ fileDiag.setViewMode(QFileDialog.Detail)
+ if fileDiag.exec_() :
+ fileNames = fileDiag.selectedFiles()
+ filedef = fileNames[0]
+ print filedef
+ self.ui.le_facefiss.setText(filedef)
+
+ def creeDico(self):
+ dico = dict(
+ maillageSain = str(self.ui.le_maillage.text()),
+ brepFaceFissure = str(self.ui.le_facefiss.text()),
+ edgeFissIds = eval(str(self.ui.le_fondfiss.text())),
+ lgInfluence = self.ui.dsb_influence.value(),
+ meshBrep = [self.ui.dsb_meshBrepMin.value(),self.ui.dsb_meshBrepMax.value()],
+ rayonPipe = self.ui.dsb_rayonPipe.value(),
+ lenSegPipe = self.ui.dsb_lenSegPipe.value(),
+ nbSegRad = self.ui.sb_couronnes.value(),
+ nbSegCercle = self.ui.sb_secteurs.value(),
+ areteFaceFissure = self.ui.dsb_areteFaceFissure.value()
+ )
+ print dico
+ return dico
+
+ def checkValues(self):
+ return self.NOK
+
+ def execute(self):
+ dico = self.creeDico()
+ NOK = self.testval(dico)
+ if not(NOK):
+ self.writeDefault(dico)
+ self.ui.lb_calcul.show()
+ execInstance = casStandard(dico)
+ self.NOK = NOK
+ self.accept()
+
+ pass
+
+# ----------------------------------------------------------------------------
+
+ window = fissureGeneraleDialog()
+ retry = True
+ while(retry):
+ retry = False
+ window.exec_()
+ result = window.result()
+ if result:
+ # dialog accepted
+ print "dialog accepted, check"
+ retry = window.checkValues()
+ else:
+ print "dialog rejected, exit"
+ pass
+
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+
+import sys
+import salome
+
+import os
+from blocFissure import gmu
+from blocFissure.gmu import initLog
+#initLog.setDebug()
+initLog.setVerbose()
+
+from blocFissure.casStandard import casStandard
+
+mesh = 'areteArrondieSoudure.med'
+crack = 'fissureSoudureTest.brep'
+
+dicoParams = dict(nomCas = 'casTestCoinTriple',
+ maillageSain = '/local00/home/I48174/Documents/soudure/essaiFissure/{0}'.format(mesh),
+ brepFaceFissure = '/local00/home/I48174/Documents/soudure/essaiFissure/{0}'.format(crack),
+ edgeFissIds = [4],
+ lgInfluence = 30,
+ meshBrep = (5,10),
+ rayonPipe = 5,
+ lenSegPipe = 7,
+ nbSegRad = 8,
+ nbSegCercle = 20,
+ areteFaceFissure = 8)
+
+execInstance = casStandard(dicoParams)
+
+if salome.sg.hasDesktop():
+ salome.sg.updateObjBrowser(1)
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+
+import sys
+import salome
+
+import os
+from blocFissure import gmu
+from blocFissure.gmu import initLog
+#initLog.setDebug()
+initLog.setVerbose()
+
+from blocFissure.casStandard import casStandard
+
+mesh = 'areteViveSoudure.med'
+crack = 'fissureSoudureTest.brep'
+
+dicoParams = dict(nomCas = 'casTestCoinTriple',
+ maillageSain = '/local00/home/I48174/Documents/soudure/essaiFissure/{0}'.format(mesh),
+ brepFaceFissure = '/local00/home/I48174/Documents/soudure/essaiFissure/{0}'.format(crack),
+ edgeFissIds = [4],
+ lgInfluence = 30,
+ meshBrep = (5,10),
+ rayonPipe = 10,
+ lenSegPipe = 7,
+ nbSegRad = 5,
+ nbSegCercle = 10,
+ areteFaceFissure = 10)
+
+execInstance = casStandard(dicoParams)
+
+if salome.sg.hasDesktop():
+ salome.sg.updateObjBrowser(1)
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+
+import sys
+import salome
+
+import os
+from blocFissure import gmu
+from blocFissure.gmu import initLog
+#initLog.setDebug()
+initLog.setVerbose()
+
+from blocFissure.casStandard import casStandard
+
+mesh = 'huehue.med'
+crack = 'hue.brep'
+
+dicoParams = dict(nomCas = 'testAubry',
+ maillageSain = '/local00/home/I48174/Bureau/{0}'.format(mesh),
+ brepFaceFissure = '/local00/home/I48174/Bureau/{0}'.format(crack),
+ edgeFissIds = [8],
+ lgInfluence = 0.01,
+ meshBrep = (0.0002,0.003),
+ rayonPipe = 0.005,
+ lenSegPipe = 0.0015,
+ nbSegRad = 8,
+ nbSegCercle = 18,
+ areteFaceFissure = 0.0015)
+
+execInstance = casStandard(dicoParams)
+
+if salome.sg.hasDesktop():
+ salome.sg.updateObjBrowser(1)
SET(plugin_SCRIPTS
__init__.py
cubeAngle.py
+ cubeFin.py
decoupeCylindre.py
disque_perce.py
ellipse_disque.py
# --- rules ---
-SALOME_INSTALL_SCRIPTS("${plugin_SCRIPTS}" ${SALOME_SMESH_INSTALL_PLUGINS}/blocFissure/materielCasTests)
+SALOME_INSTALL_SCRIPTS("${plugin_SCRIPTS}" ${SALOME_INSTALL_PYTHON}/blocFissure/materielCasTests)
-# -*- coding: iso-8859-1 -*-
+# -*- coding: utf-8 -*-
import sys
import salome
Vertex_3 = geompy.MakeVertex(65, 65, 110)
Box_2 = geompy.MakeBoxTwoPnt(Vertex_3, Vertex_2)
Common_1 = geompy.MakeCommon(Disk_1, Box_2)
-geompy.Export(Common_1, os.path.join(gmu.pathBloc, "materielCasTests/CubeAngleFiss.brep"), "BREP")
+geompy.ExportBREP(Common_1, os.path.join(gmu.pathBloc, "materielCasTests/CubeAngleFiss.brep"))
geompy.addToStudy( O, 'O' )
geompy.addToStudy( OX, 'OX' )
geompy.addToStudy( OY, 'OY' )
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import sys
+import salome
+
+salome.salome_init()
+theStudy = salome.myStudy
+
+import salome_notebook
+notebook = salome_notebook.NoteBook(theStudy)
+
+import os
+from blocFissure import gmu
+
+###
+### GEOM component
+###
+
+import GEOM
+from salome.geom import geomBuilder
+import math
+import SALOMEDS
+
+
+geompy = geomBuilder.New(theStudy)
+
+O = geompy.MakeVertex(0, 0, 0)
+OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
+OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
+OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
+cubeFin = geompy.MakeBoxDXDYDZ(200, 200, 200)
+[DEPL,ENCASTR] = geompy.SubShapes(cubeFin, [27, 23])
+origCoin = geompy.MakeVertex(0, 160, 200)
+Disk_1 = geompy.MakeDiskPntVecR(origCoin, OY, 50)
+Translation_1 = geompy.MakeTranslation(origCoin, 0, 10, 0)
+Vector_1 = geompy.MakeVector(origCoin, Translation_1)
+Rotation_1 = geompy.MakeRotation(Disk_1, Vector_1, 90*math.pi/180.0)
+origMilieu = geompy.MakeVertex(0, 160, 100)
+Translation_2 = geompy.MakeTranslationTwoPoints(Rotation_1, origCoin, origMilieu)
+Scale_1 = geompy.MakeScaleAlongAxes(Translation_2, origMilieu, 0.984, 1, 1.2)
+Vertex_1 = geompy.MakeVertex(-10, 160, 210)
+Vertex_2 = geompy.MakeVertex(50, 160, 210)
+Vertex_3 = geompy.MakeVertex(50, 160, -10)
+Vertex_4 = geompy.MakeVertex(-10, 160, -10)
+Line_1 = geompy.MakeLineTwoPnt(Vertex_1, Vertex_2)
+Line_2 = geompy.MakeLineTwoPnt(Vertex_2, Vertex_3)
+Line_3 = geompy.MakeLineTwoPnt(Vertex_3, Vertex_4)
+Line_4 = geompy.MakeLineTwoPnt(Vertex_4, Vertex_1)
+cubeFin_Transverse = geompy.MakeFaceWires([Line_1, Line_2, Line_3, Line_4], 1)
+Vertex_5 = geompy.MakeVertex(55, 160, 100)
+Line_1_vertex_3 = geompy.GetSubShape(Line_1, [3])
+Line_3_vertex_2 = geompy.GetSubShape(Line_3, [2])
+Arc_1 = geompy.MakeArc(Line_1_vertex_3, Vertex_5, Line_3_vertex_2)
+Face_1 = geompy.MakeFaceWires([Line_1, Line_3, Line_4, Arc_1], 1)
+cubeFin_Coin = geompy.MakeCommonList([Rotation_1, Face_1], True)
+cubeFin_Milieu = geompy.MakeCommonList([Scale_1, cubeFin_Transverse], True)
+O_1 = geompy.MakeVertex(0, 0, 0)
+OX_1 = geompy.MakeVectorDXDYDZ(1, 0, 0)
+OY_1 = geompy.MakeVectorDXDYDZ(0, 1, 0)
+OZ_1 = geompy.MakeVectorDXDYDZ(0, 0, 1)
+geompy.addToStudy( O, 'O' )
+geompy.addToStudy( OX, 'OX' )
+geompy.addToStudy( OY, 'OY' )
+geompy.addToStudy( OZ, 'OZ' )
+geompy.addToStudy( cubeFin, 'cubeFin' )
+geompy.addToStudyInFather( cubeFin, DEPL, 'DEPL' )
+geompy.addToStudyInFather( cubeFin, ENCASTR, 'ENCASTR' )
+geompy.addToStudy( origCoin, 'origCoin' )
+geompy.addToStudy( Disk_1, 'Disk_1' )
+geompy.addToStudy( Translation_1, 'Translation_1' )
+geompy.addToStudy( Vector_1, 'Vector_1' )
+geompy.addToStudy( Rotation_1, 'Rotation_1' )
+geompy.addToStudy( origMilieu, 'origMilieu' )
+geompy.addToStudy( Translation_2, 'Translation_2' )
+geompy.addToStudy( Scale_1, 'Scale_1' )
+geompy.addToStudy( Vertex_1, 'Vertex_1' )
+geompy.addToStudy( Vertex_2, 'Vertex_2' )
+geompy.addToStudy( Vertex_3, 'Vertex_3' )
+geompy.addToStudy( Vertex_4, 'Vertex_4' )
+geompy.addToStudy( Line_1, 'Line_1' )
+geompy.addToStudy( Line_2, 'Line_2' )
+geompy.addToStudy( Line_3, 'Line_3' )
+geompy.addToStudy( Line_4, 'Line_4' )
+geompy.addToStudy( cubeFin_Transverse, 'cubeFin_Transverse' )
+geompy.addToStudyInFather( Line_1, Line_1_vertex_3, 'Line_1:vertex_3' )
+geompy.addToStudy( Vertex_5, 'Vertex_5' )
+geompy.addToStudyInFather( Line_3, Line_3_vertex_2, 'Line_3:vertex_2' )
+geompy.addToStudy( Arc_1, 'Arc_1' )
+geompy.addToStudy( Face_1, 'Face_1' )
+geompy.addToStudy( cubeFin_Coin, 'cubeFin_Coin' )
+geompy.addToStudy( cubeFin_Milieu, 'cubeFin_Milieu' )
+geompy.addToStudy( O_1, 'O' )
+geompy.addToStudy( OX_1, 'OX' )
+geompy.addToStudy( OY_1, 'OY' )
+geompy.addToStudy( OZ_1, 'OZ' )
+geompy.ExportBREP(cubeFin_Transverse, os.path.join(gmu.pathBloc, "materielCasTests/cubeFin_Transverse.brep"))
+geompy.ExportBREP(cubeFin_Coin, os.path.join(gmu.pathBloc, "materielCasTests/cubeFin_Coin.brep"))
+geompy.ExportBREP(cubeFin_Milieu, os.path.join(gmu.pathBloc, "materielCasTests/cubeFin_Milieu.brep"))
+
+###
+### SMESH component
+###
+
+import SMESH, SALOMEDS
+from salome.smesh import smeshBuilder
+
+smesh = smeshBuilder.New(theStudy)
+cubeFin_1 = smesh.Mesh(cubeFin)
+Regular_1D = cubeFin_1.Segment()
+Nb_Segments_1 = Regular_1D.NumberOfSegments(20)
+Nb_Segments_1.SetDistrType( 0 )
+Quadrangle_2D = cubeFin_1.Quadrangle(algo=smeshBuilder.QUADRANGLE)
+Hexa_3D = cubeFin_1.Hexahedron(algo=smeshBuilder.Hexa)
+isDone = cubeFin_1.Compute()
+DEPL_1 = cubeFin_1.GroupOnGeom(DEPL,'DEPL',SMESH.FACE)
+ENCASTR_1 = cubeFin_1.GroupOnGeom(ENCASTR,'ENCASTR',SMESH.FACE)
+
+## Set names of Mesh objects
+smesh.SetName(Regular_1D.GetAlgorithm(), 'Regular_1D')
+smesh.SetName(Quadrangle_2D.GetAlgorithm(), 'Quadrangle_2D')
+smesh.SetName(Hexa_3D.GetAlgorithm(), 'Hexa_3D')
+smesh.SetName(DEPL_1, 'DEPL')
+smesh.SetName(ENCASTR_1, 'ENCASTR')
+smesh.SetName(cubeFin_1.GetMesh(), 'cubeFin')
+smesh.SetName(Nb_Segments_1, 'Nb. Segments_1')
+
+cubeFin_1.ExportMED( os.path.join(gmu.pathBloc, "materielCasTests/cubeFin.med"), 0, SMESH.MED_V2_2, 1 )
+
+if salome.sg.hasDesktop():
+ salome.sg.updateObjBrowser(1)
-# -*- coding: iso-8859-1 -*-
+# -*- coding: utf-8 -*-
import sys
import salome
Divided_Cylinder_1 = geompy.MakeDividedCylinder(145, 800, GEOM.SQUARE)
CylindreSain = geompy.MakeRotation(Divided_Cylinder_1, OZ, 45*math.pi/180.0)
[Compound_1, vertical, radial, Compound_4] = geompy.Propagate(CylindreSain)
-geompy.Export(FissInCylindre, os.path.join(gmu.pathBloc, "materielCasTests/FissInCylindre.brep"), "BREP")
+geompy.ExportBREP(FissInCylindre, os.path.join(gmu.pathBloc, "materielCasTests/FissInCylindre.brep"))
Vertex_12 = geompy.MakeVertex(0, -145, 500)
Circle_2 = geompy.MakeCircle(Vertex_12, None, 145)
Face_1 = geompy.MakeFaceWires([Circle_2], 1)
Vertex_13 = geompy.MakeVertex(0, 0, 500)
Disk_1 = geompy.MakeDiskPntVecR(Vertex_13, OZ_1, 170)
FissInCylindre2 = geompy.MakeCommon(Face_1, Disk_1)
-geompy.Export(FissInCylindre2, os.path.join(gmu.pathBloc, "materielCasTests/FissInCylindre2.brep"), "BREP")
+geompy.ExportBREP(FissInCylindre2, os.path.join(gmu.pathBloc, "materielCasTests/FissInCylindre2.brep"))
geompy.addToStudy( O, 'O' )
geompy.addToStudy( OX, 'OX' )
geompy.addToStudy( OY, 'OY' )
-# -*- coding: iso-8859-1 -*-
+# -*- coding: utf-8 -*-
import sys
import salome
geompy.addToStudy( Box_1, 'Box_1' )
geompy.addToStudy( ellipse1, 'ellipse1' )
geompy.addToStudyInFather( ellipse1, fondFiss, 'fondFiss' )
-geompy.Export(ellipse1, os.path.join(gmu.pathBloc, "materielCasTests/ellipse1.brep"), "BREP")
+geompy.ExportBREP(ellipse1, os.path.join(gmu.pathBloc, "materielCasTests/ellipse1.brep"))
if salome.sg.hasDesktop():
-# -*- coding: iso-8859-1 -*-
+# -*- coding: utf-8 -*-
import sys
import salome
Vertex_3 = geompy.MakeVertex(120, 2, 60)
Box_1 = geompy.MakeBoxTwoPnt(Vertex_3, Vertex_2)
Ellipse_disque = geompy.MakeCommon(Box_1, Scale_1)
-geompy.Export(Ellipse_disque, os.path.join(gmu.pathBloc, "materielCasTests/ellipse_disque.brep"), "BREP")
+geompy.ExportBREP(Ellipse_disque, os.path.join(gmu.pathBloc, "materielCasTests/ellipse_disque.brep"))
geompy.addToStudy( O, 'O' )
geompy.addToStudy( OX, 'OX' )
geompy.addToStudy( OY, 'OY' )
-# -*- coding: iso-8859-1 -*-
+# -*- coding: utf-8 -*-
import sys
import salome
geompy.addToStudy( Vertex_4, 'Vertex_4' )
geompy.addToStudy( Cut_1, 'Cut_1' )
geompy.addToStudy( ellipse1, 'ellipse1_pb' )
-geompy.Export(ellipse1, os.path.join(gmu.pathBloc, "materielCasTests/ellipse1_pb.brep"), "BREP")
+geompy.ExportBREP(ellipse1, os.path.join(gmu.pathBloc, "materielCasTests/ellipse1_pb.brep"))
if salome.sg.hasDesktop():
-# -*- coding: iso-8859-1 -*-
+# -*- coding: utf-8 -*-
import sys
import salome
geomObj_1 = geompy.MakeMarker(0, 0, 0, 1, 0, 0, 0, 1, 0)
Sketch_1 = geompy.MakeSketcherOnPlane("Sketcher:F -110.000000 85.000000:T 220.000000 0.000000:T 0.000000 75.000000:T -220.000000 0.000000:WW", geomObj_1 )
SectionDroite = geompy.MakeFaceWires([Sketch_1], 1)
-geompy.Export(SectionDroite, os.path.join(gmu.pathBloc, "materielCasTests/EprouvetteCourbeFiss.brep"), "BREP")
+geompy.ExportBREP(SectionDroite, os.path.join(gmu.pathBloc, "materielCasTests/EprouvetteCourbeFiss.brep"))
geompy.addToStudy( O, 'O' )
geompy.addToStudy( OX, 'OX' )
geompy.addToStudy( OY, 'OY' )
-# -*- coding: iso-8859-1 -*-
+# -*- coding: utf-8 -*-
import sys
import salome
geomObj_4 = geompy.MakeMarker(0, 0, 0, 1, 0, 0, 0, 1, 0)
Sketch_2 = geompy.MakeSketcherOnPlane("Sketcher:F 0.000000 0.000000:T 120.000000 0.000000:T 0.000000 100.000000:T -120.000000 20.000000:WW", Plane_2 )
SectionInclinee = geompy.MakeFaceWires([Sketch_2], 1)
-geompy.Export(sectionDroite, os.path.join(gmu.pathBloc, "materielCasTests/EprouvetteDroiteFissPb1.brep"), "BREP")
-geompy.Export(SectionInclinee, os.path.join(gmu.pathBloc, "materielCasTests/EprouvetteDroiteFiss2.brep"), "BREP")
+geompy.ExportBREP(sectionDroite, os.path.join(gmu.pathBloc, "materielCasTests/EprouvetteDroiteFissPb1.brep"))
+geompy.ExportBREP(SectionInclinee, os.path.join(gmu.pathBloc, "materielCasTests/EprouvetteDroiteFiss2.brep"))
Vertex_2 = geompy.MakeVertex(110, -10, 200)
Vertex_3 = geompy.MakeVertex(110, 80, 200)
Vertex_4 = geompy.MakeVertex(-10, 80, 200)
Face_1_vertex_9 = geompy.GetSubShape(Face_1, [9])
Line_8 = geompy.MakeLineTwoPnt(Vertex_6, Face_1_vertex_9)
Face_2 = geompy.MakeFaceWires([Line_5, Line_6, Line_7, Line_8], 1)
-geompy.Export(Face_1, os.path.join(gmu.pathBloc, "materielCasTests/EprouvetteDroiteFiss_1.brep"), "BREP")
-geompy.Export(Face_2, os.path.join(gmu.pathBloc, "materielCasTests/EprouvetteDroiteFiss_2.brep"), "BREP")
+geompy.ExportBREP(Face_1, os.path.join(gmu.pathBloc, "materielCasTests/EprouvetteDroiteFiss_1.brep"))
+geompy.ExportBREP(Face_2, os.path.join(gmu.pathBloc, "materielCasTests/EprouvetteDroiteFiss_2.brep"))
geompy.addToStudy( O, 'O' )
geompy.addToStudy( OX, 'OX' )
geompy.addToStudy( OY, 'OY' )
-# -*- coding: iso-8859-1 -*-
+# -*- coding: utf-8 -*-
import sys
import salome
geomObj_3 = geompy.MakeCylinderRH(1450, 8000)
Cylinder_3 = geompy.MakeRotation(geomObj_3, OZ, 180*math.pi/180.0)
Cut_1 = geompy.MakeCut(Partition_1, Cylinder_3)
+geompy.addToStudy( Cut_1, 'Cut_1' )
[faceFiss1] = geompy.SubShapes(Cut_1, [61])
+geompy.addToStudyInFather( Cut_1, faceFiss1, 'faceFiss1' )
[Vertex_3,geomObj_4] = geompy.SubShapes(faceFiss1, [4, 5])
Cylinder_4 = geompy.MakeCylinderRH(2000, 4000)
Cylinder_5 = geompy.MakeCylinderRH(1500, 4000)
Common_1 = geompy.MakeCommon(Box_2, Cut_2)
objetSain = geompy.MakePartition([Common_1], [Plane_1, Plane_2, Plane_3], [], [], geompy.ShapeType["SOLID"], 0, [], 0)
[hauteurs, epaisseurs, Compound_3, Compound_4, Compound_5, Compound_6] = geompy.Propagate(objetSain)
-geompy.Export(faceFiss1, os.path.join(gmu.pathBloc, "materielCasTests/faceGaucheFiss.brep"), "BREP")
+geompy.ExportBREP(faceFiss1, os.path.join(gmu.pathBloc, "materielCasTests/faceGaucheFiss.brep"))
geompy.addToStudy( O, 'O' )
geompy.addToStudy( OX, 'OX' )
geompy.addToStudy( OY, 'OY' )
geompy.addToStudy( Box_1, 'Box_1' )
geompy.addToStudy( Partition_1, 'Partition_1' )
geompy.addToStudy( Cylinder_3, 'Cylinder_3' )
-geompy.addToStudy( Cut_1, 'Cut_1' )
-geompy.addToStudyInFather( Cut_1, faceFiss1, 'faceFiss1' )
geompy.addToStudyInFather( faceFiss1, Vertex_3, 'Vertex_3' )
geompy.addToStudy( Cylinder_4, 'Cylinder_4' )
geompy.addToStudy( Cylinder_5, 'Cylinder_5' )
-# -*- coding: iso-8859-1 -*-
+# -*- coding: utf-8 -*-
import sys
import salome
Partition_1 = geompy.MakePartition([Extrusion_1], [Extrusion_2], [], [], geompy.ShapeType["FACE"], 0, [], 0)
[Face_1,Face_2] = geompy.SubShapes(Partition_1, [18, 13])
FaceFissExt = geompy.MakeFuse(Face_2, Face_1)
-geompy.Export(FaceFissExt, os.path.join(gmu.pathBloc, "materielCasTests/faceGauche2Fiss.brep"), "BREP")
+geompy.ExportBREP(FaceFissExt, os.path.join(gmu.pathBloc, "materielCasTests/faceGauche2Fiss.brep"))
Vertex_2 = geompy.MakeVertex(0, -500, 0)
Vertex_3 = geompy.MakeVertex(400, 500, 800)
objetSain = geompy.MakeBoxTwoPnt(Vertex_3, Vertex_2)
Rotation_1 = geompy.MakeRotation(Extrusion_1, OX, 180*math.pi/180.0)
Partition_2 = geompy.MakePartition([Rotation_1], [Extrusion_2], [], [], geompy.ShapeType["FACE"], 0, [], 0)
+geompy.addToStudy( Partition_2, 'Partition_2' )
[FaceFissExtSimple] = geompy.SubShapes(Partition_2, [13])
+geompy.addToStudyInFather( Partition_2, FaceFissExtSimple, 'FaceFissExtSimple' )
Plane_1 = geompy.MakePlaneLCS(None, 2000, 3)
FaceFissExtCoupe = geompy.MakePartition([FaceFissExtSimple], [Plane_1], [], [], geompy.ShapeType["FACE"], 0, [], 0)
-geompy.Export(FaceFissExtCoupe, os.path.join(gmu.pathBloc, "materielCasTests/faceGauche2FissCoupe.brep"), "BREP")
+geompy.ExportBREP(FaceFissExtCoupe, os.path.join(gmu.pathBloc, "materielCasTests/faceGauche2FissCoupe.brep"))
geompy.addToStudy( O, 'O' )
geompy.addToStudy( OX, 'OX' )
geompy.addToStudy( OY, 'OY' )
geompy.addToStudy( Vertex_3, 'Vertex_3' )
geompy.addToStudy( objetSain, 'objetSain' )
geompy.addToStudy( Rotation_1, 'Rotation_1' )
-geompy.addToStudy( Partition_2, 'Partition_2' )
-geompy.addToStudyInFather( Partition_2, FaceFissExtSimple, 'FaceFissExtSimple' )
geompy.addToStudy( Plane_1, 'Plane_1' )
geompy.addToStudy( FaceFissExtCoupe, 'FaceFissExtCoupe' )
from blocFissure.materielCasTests import disque_perce
from blocFissure.materielCasTests import ellipse_disque
from blocFissure.materielCasTests import vis
+from blocFissure.materielCasTests import cubeFin
-# -*- coding: iso-8859-1 -*-
+# -*- coding: utf-8 -*-
import sys
import salome
coupe_vis = geompy.MakePartition([Face_1], [Line_1, Line_2, Line_3, Line_4], [], [], geompy.ShapeType["FACE"], 0, [], 0)
[tige, section, tige_haute, rond, tete, section_tete] = geompy.Propagate(coupe_vis)
conge = geompy.CreateGroup(coupe_vis, geompy.ShapeType["EDGE"])
-geompy.UnionIDs(conge, [21])
+geompy.UnionIDs(conge, [25])
appui = geompy.CreateGroup(coupe_vis, geompy.ShapeType["EDGE"])
-geompy.UnionIDs(appui, [37])
+geompy.UnionIDs(appui, [39])
p_imp = geompy.CreateGroup(coupe_vis, geompy.ShapeType["EDGE"])
-geompy.UnionIDs(p_imp, [4])
+geompy.UnionIDs(p_imp, [11])
Vertex_4 = geompy.MakeVertex(11.25, 98.75, 0)
Vertex_5 = geompy.MakeVertexWithRef(Vertex_4, -0.5, 0.5, 0)
Partition_2_vertex_11 = geompy.GetSubShape(Partition_2, [11])
Plane_1 = geompy.MakePlane(Partition_2_vertex_11, OY, 2000)
Partition_3 = geompy.MakePartition([Revolution_1], [Plane_1], [], [], geompy.ShapeType["FACE"], 0, [], 0)
-Vertex_9 = geompy.MakeVertex(0, 99.633883, 8.977320000000001)
+Vertex_9 = geompy.MakeVertex(0, 99.633883, 1.977320000000001)
Vertex_10 = geompy.MakeVertex(0, 99.633883, -8.977320000000001)
Vertex_11 = geompy.MakeVertexWithRef(Vertex_9, 0, 0, -1)
Vertex11x = geompy.MakeVertexWithRef(Vertex_11, 1, 0, 0)
Fissure = geompy.MakeCommonList([Extrusion_1, Revolution_2], True)
fondFiss = geompy.CreateGroup(Fissure, geompy.ShapeType["EDGE"])
geompy.UnionIDs(fondFiss, [9, 7, 4])
-geompy.Export(Fissure, os.path.join(gmu.pathBloc, "materielCasTests/visFiss.brep"), "BREP")
+geompy.ExportBREP(Fissure, os.path.join(gmu.pathBloc, "materielCasTests/visFiss.brep"))
geompy.addToStudy( O, 'O' )
geompy.addToStudy( OX, 'OX' )
coupe_vis_1 = smesh.Mesh(coupe_vis)
Regular_1D = coupe_vis_1.Segment()
Nb_Segments_1 = Regular_1D.NumberOfSegments(10)
-Nb_Segments_1.SetDistrType( 0 )
Quadrangle_2D = coupe_vis_1.Quadrangle(algo=smeshBuilder.QUADRANGLE)
+Regular_1D_1 = coupe_vis_1.Segment(geom=tige)
+Nb_Segments_2 = Regular_1D_1.NumberOfSegments(30)
+Regular_1D_2 = coupe_vis_1.Segment(geom=section)
+Nb_Segments_3 = Regular_1D_2.NumberOfSegments(10,1,[ 7, 11, 16, 23 ])
isDone = coupe_vis_1.Compute()
-Nb_Segments_2 = smesh.CreateHypothesis('NumberOfSegments')
-Nb_Segments_2.SetNumberOfSegments( 30 )
-Nb_Segments_2.SetDistrType( 0 )
-status = coupe_vis_1.AddHypothesis(Regular_1D,tige)
-status = coupe_vis_1.AddHypothesis(Nb_Segments_2,tige)
-isDone = coupe_vis_1.Compute()
-Nb_Segments_3 = smesh.CreateHypothesis('NumberOfSegments')
-Nb_Segments_3.SetNumberOfSegments( 10 )
-Nb_Segments_3.SetScaleFactor( 3 )
-Nb_Segments_3.SetReversedEdges( [ ] )
-Nb_Segments_3.SetObjectEntry( "0:1:1:14" )
-status = coupe_vis_1.AddHypothesis(Regular_1D,section)
-status = coupe_vis_1.AddHypothesis(Nb_Segments_3,section)
-coupe_vis_1.Clear()
-isDone = coupe_vis_1.Compute()
-coupe_vis_1.Clear()
-Nb_Segments_3.SetNumberOfSegments( 10 )
-Nb_Segments_3.SetDistrType( 1 )
-Nb_Segments_3.SetScaleFactor( 3 )
-Nb_Segments_3.SetReversedEdges( [ 23, 4, 9, 16 ] )
-Nb_Segments_3.SetObjectEntry( "0:1:1:14" )
-isDone = coupe_vis_1.Compute()
+isDone = coupe_vis_1.SplitQuad( [ 691 ], 1 )
tige_1 = coupe_vis_1.GroupOnGeom(tige,'tige',SMESH.EDGE)
section_1 = coupe_vis_1.GroupOnGeom(section,'section',SMESH.EDGE)
tige_haute_1 = coupe_vis_1.GroupOnGeom(tige_haute,'tige_haute',SMESH.EDGE)
conge_1 = coupe_vis_1.GroupOnGeom(conge,'conge',SMESH.EDGE)
appui_1 = coupe_vis_1.GroupOnGeom(appui,'appui',SMESH.EDGE)
p_imp_1 = coupe_vis_1.GroupOnGeom(p_imp,'p_imp',SMESH.EDGE)
-isDone = coupe_vis_1.SplitQuad( [ 691 ], 1 )
visHex80 = smesh.CopyMesh( coupe_vis_1, 'visHex80', 1, 0)
[ tige_2, section_2, tige_haute_2, rond_2, tete_2, section_tete_2, conge_2, appui_2, p_imp_2 ] = visHex80.GetGroups()
-[ tige_rotated, section_rotated, tige_haute_rotated, rond_rotated, tete_rotated, section_tete_rotated, conge_rotated, appui_rotated, p_imp_rotated, tige_top, section_top, tige_haute_top, rond_top, tete_top, section_tete_top, conge_top, appui_top, p_imp_top ] = visHex80.RotationSweepObject2D( visHex80, SMESH.AxisStruct( 0, 0, 0, 0, 10, 0 ), math.pi/40, 40, 1e-05 ,True)
+[ tige_rotated, section_rotated, tige_haute_rotated, rond_rotated, tete_rotated, section_tete_rotated, conge_rotated, appui_rotated, p_imp_rotated, tige_top, section_top, tige_haute_top, rond_top, tete_top, section_tete_top, conge_top, appui_top, p_imp_top ] = visHex80.RotationSweepObjects( [ visHex80 ], [ visHex80 ], [ visHex80 ], SMESH.AxisStruct( 0, 0, 0, 0, 10, 0 ), 0.0785398, 40, 1e-05, 1 )
[ tige_2, section_2, tige_haute_2, rond_2, tete_2, section_tete_2, conge_2, appui_2, p_imp_2, tige_rotated, tige_top, section_rotated, section_top, tige_haute_rotated, tige_haute_top, rond_rotated, rond_top, tete_rotated, tete_top, section_tete_rotated, section_tete_top, conge_rotated, conge_top, appui_rotated, appui_top, p_imp_rotated, p_imp_top ] = visHex80.GetGroups()
-[ tige_mirrored, section_mirrored, tige_haute_mirrored, rond_mirrored, tete_mirrored, section_tete_mirrored, conge_mirrored, appui_mirrored, p_imp_mirrored, tige_rotated_mirrored, tige_top_mirrored, section_rotated_mirrored, section_top_mirrored, tige_haute_rotated_mirrored, tige_haute_top_mirrored, rond_rotated_mirrored, rond_top_mirrored, tete_rotated_mirrored, tete_top_mirrored, section_tete_rotated_mirrored, section_tete_top_mirrored, conge_rotated_mirrored, conge_top_mirrored, appui_rotated_mirrored, appui_top_mirrored, p_imp_rotated_mirrored, p_imp_top_mirrored ] = visHex80.MirrorObject( visHex80, SMESH.AxisStruct( 0, 0, 0, 0, 0, 10 ), SMESH.SMESH_MeshEditor.PLANE ,True,True)
-[ tige_2, section_2, tige_haute_2, rond_2, tete_2, section_tete_2, conge_2, appui_2, p_imp_2, tige_rotated, tige_top, section_rotated, section_top, tige_haute_rotated, tige_haute_top, rond_rotated, rond_top, tete_rotated, tete_top, section_tete_rotated, section_tete_top, conge_rotated, conge_top, appui_rotated, appui_top, p_imp_rotated, p_imp_top, tige_mirrored, section_mirrored, tige_haute_mirrored, rond_mirrored, tete_mirrored, section_tete_mirrored, conge_mirrored, appui_mirrored, p_imp_mirrored, tige_rotated_mirrored, tige_top_mirrored, section_rotated_mirrored, section_top_mirrored, tige_haute_rotated_mirrored, tige_haute_top_mirrored, rond_rotated_mirrored, rond_top_mirrored, tete_rotated_mirrored, tete_top_mirrored, section_tete_rotated_mirrored, section_tete_top_mirrored, conge_rotated_mirrored, conge_top_mirrored, appui_rotated_mirrored, appui_top_mirrored, p_imp_rotated_mirrored, p_imp_top_mirrored ] = visHex80.GetGroups()
-coincident_nodes_on_part = visHex80.FindCoincidentNodesOnPart( visHex80, 1e-05, [ ] )
-visHex80.MergeNodes(coincident_nodes_on_part)
-equal_elements = visHex80.FindEqualElements( visHex80 )
-visHex80.MergeElements(equal_elements)
-[ tige_2, section_2, tige_haute_2, rond_2, tete_2, section_tete_2, conge_2, appui_2, p_imp_2, tige_rotated, tige_top, section_rotated, section_top, tige_haute_rotated, tige_haute_top, rond_rotated, rond_top, tete_rotated, tete_top, section_tete_rotated, section_tete_top, conge_rotated, conge_top, appui_rotated, appui_top, p_imp_rotated, p_imp_top, tige_mirrored, section_mirrored, tige_haute_mirrored, rond_mirrored, tete_mirrored, section_tete_mirrored, conge_mirrored, appui_mirrored, p_imp_mirrored, tige_rotated_mirrored, tige_top_mirrored, section_rotated_mirrored, section_top_mirrored, tige_haute_rotated_mirrored, tige_haute_top_mirrored, rond_rotated_mirrored, rond_top_mirrored, tete_rotated_mirrored, tete_top_mirrored, section_tete_rotated_mirrored, section_tete_top_mirrored, conge_rotated_mirrored, conge_top_mirrored, appui_rotated_mirrored, appui_top_mirrored, p_imp_rotated_mirrored, p_imp_top_mirrored ] = visHex80.GetGroups()
-SubMesh_1 = coupe_vis_1.GetSubMesh( tige, 'SubMesh_1' )
-SubMesh_2 = coupe_vis_1.GetSubMesh( section, 'SubMesh_2' )
+Sub_mesh_1 = Regular_1D_1.GetSubMesh()
+Sub_mesh_2 = Regular_1D_2.GetSubMesh()
visHex80.ExportMED( os.path.join(gmu.pathBloc, "materielCasTests/visSain.med"), 0, SMESH.MED_V2_2, 1 )
-
+
## Set names of Mesh objects
-smesh.SetName(appui_rotated, 'appui_rotated')
-smesh.SetName(p_imp_rotated, 'p_imp_rotated')
-smesh.SetName(section_tete_rotated, 'section_tete_rotated')
-smesh.SetName(conge_rotated, 'conge_rotated')
-smesh.SetName(rond_rotated, 'rond_rotated')
-smesh.SetName(tete_rotated, 'tete_rotated')
-smesh.SetName(section_rotated, 'section_rotated')
-smesh.SetName(tige_haute_rotated, 'tige_haute_rotated')
-smesh.SetName(tige_rotated, 'tige_rotated')
-smesh.SetName(SubMesh_2, 'SubMesh_2')
-smesh.SetName(SubMesh_1, 'SubMesh_1')
+smesh.SetName(tige_2, 'tige')
smesh.SetName(Regular_1D.GetAlgorithm(), 'Regular_1D')
smesh.SetName(Quadrangle_2D.GetAlgorithm(), 'Quadrangle_2D')
-smesh.SetName(appui_1, 'appui')
-smesh.SetName(p_imp_1, 'p_imp')
+smesh.SetName(Nb_Segments_2, 'Nb. Segments_2')
+smesh.SetName(Nb_Segments_1, 'Nb. Segments_1')
+smesh.SetName(Nb_Segments_3, 'Nb. Segments_3')
smesh.SetName(coupe_vis_1.GetMesh(), 'coupe_vis')
smesh.SetName(visHex80.GetMesh(), 'visHex80')
+smesh.SetName(p_imp_top, 'p_imp_top')
+smesh.SetName(appui_top, 'appui_top')
+smesh.SetName(conge_top, 'conge_top')
+smesh.SetName(section_tete_top, 'section_tete_top')
+smesh.SetName(tete_top, 'tete_top')
+smesh.SetName(rond_top, 'rond_top')
+smesh.SetName(tige_haute_top, 'tige_haute_top')
+smesh.SetName(section_top, 'section_top')
+smesh.SetName(tige_top, 'tige_top')
+smesh.SetName(Sub_mesh_2, 'Sub-mesh_2')
+smesh.SetName(Sub_mesh_1, 'Sub-mesh_1')
+smesh.SetName(p_imp_1, 'p_imp')
+smesh.SetName(p_imp_rotated, 'p_imp_rotated')
+smesh.SetName(appui_1, 'appui')
+smesh.SetName(appui_rotated, 'appui_rotated')
+smesh.SetName(conge_rotated, 'conge_rotated')
+smesh.SetName(section_tete_rotated, 'section_tete_rotated')
+smesh.SetName(tete_rotated, 'tete_rotated')
+smesh.SetName(rond_rotated, 'rond_rotated')
+smesh.SetName(tige_haute_rotated, 'tige_haute_rotated')
+smesh.SetName(section_rotated, 'section_rotated')
smesh.SetName(tige_1, 'tige')
-smesh.SetName(p_imp_2, 'p_imp')
-smesh.SetName(section_1, 'section')
-smesh.SetName(appui_2, 'appui')
+smesh.SetName(tige_rotated, 'tige_rotated')
smesh.SetName(tige_haute_1, 'tige_haute')
-smesh.SetName(conge_2, 'conge')
-smesh.SetName(rond_1, 'rond')
-smesh.SetName(section_tete_2, 'section_tete')
+smesh.SetName(section_1, 'section')
smesh.SetName(tete_1, 'tete')
-smesh.SetName(tete_2, 'tete')
+smesh.SetName(rond_1, 'rond')
+smesh.SetName(conge_1, 'conge')
+smesh.SetName(appui_2, 'appui')
smesh.SetName(section_tete_1, 'section_tete')
+smesh.SetName(p_imp_2, 'p_imp')
+smesh.SetName(section_tete_2, 'section_tete')
+smesh.SetName(conge_2, 'conge')
smesh.SetName(rond_2, 'rond')
-smesh.SetName(conge_1, 'conge')
-smesh.SetName(tige_haute_2, 'tige_haute')
+smesh.SetName(tete_2, 'tete')
smesh.SetName(section_2, 'section')
-smesh.SetName(tige_2, 'tige')
-smesh.SetName(p_imp_top, 'p_imp_top')
-smesh.SetName(Nb_Segments_3, 'Nb. Segments_3')
-smesh.SetName(conge_top, 'conge_top')
-smesh.SetName(Nb_Segments_2, 'Nb. Segments_2')
-smesh.SetName(appui_top, 'appui_top')
-smesh.SetName(Nb_Segments_1, 'Nb. Segments_1')
-smesh.SetName(tete_top, 'tete_top')
-smesh.SetName(section_tete_top, 'section_tete_top')
-smesh.SetName(tige_haute_top, 'tige_haute_top')
-smesh.SetName(rond_top, 'rond_top')
-smesh.SetName(tige_top, 'tige_top')
-smesh.SetName(section_top, 'section_top')
+smesh.SetName(tige_haute_2, 'tige_haute')
+
if salome.sg.hasDesktop():
salome.sg.updateObjBrowser(1)
LOG("### resource list:");
std::vector<std::string>* resourceNames = new std::vector<std::string>();
if (resourceList) {
- for (int i = 0; i < resourceList->length(); i++) {
+ for ( size_t i = 0; i < resourceList->length(); i++) {
const char* aResourceName = (*resourceList)[i];
resourceNames->push_back(std::string(aResourceName));
LOG("resource["<<i<<"] = "<<aResourceName);
-# -*- coding: iso-8859-1 -*-
+# -*- coding: utf-8 -*-
# Copyright (C) 2011-2015 EDF R&D
#
# This library is free software; you can redistribute it and/or
#
import salome_pluginsmanager
-from spadderPlugin import runSpadderPlugin
-from meshcut_plugin import MeshCut
-from yamsplug_plugin import YamsLct
-from MGCleanerplug_plugin import MGCleanerLct
-from blocFissure.ihm.fissureCoude_plugin import fissureCoudeDlg
+try:
+ from spadderPlugin import runSpadderPlugin
+ salome_pluginsmanager.AddFunction('PADDER mesher',
+ 'Create a mesh with PADDER',
+ runSpadderPlugin)
+except:
+ salome_pluginsmanager.logger.info('ERROR: PADDER mesher plug-in is unavailable')
+ pass
-salome_pluginsmanager.AddFunction('PADDER mesher',
- 'Create a mesh with PADDER',
- runSpadderPlugin)
+try:
+ from meshcut_plugin import MeshCut
+ salome_pluginsmanager.AddFunction('MeshCut',
+ 'Cut a tetrahedron mesh by a plane',
+ MeshCut)
-salome_pluginsmanager.AddFunction('MeshCut',
- 'Cut a tetrahedron mesh by a plane',
- MeshCut)
+except:
+ salome_pluginsmanager.logger.info('ERROR: MeshCut plug-in is unavailable')
+ pass
-salome_pluginsmanager.AddFunction('ReMesh with MGSurfOpt ( formerly Yams )',
- 'Run Yams',
- YamsLct)
+try:
+ from yamsplug_plugin import YamsLct
+ salome_pluginsmanager.AddFunction('ReMesh with MGSurfOpt ( formerly Yams )',
+ 'Run Yams',
+ YamsLct)
+except:
+ salome_pluginsmanager.logger.info('ERROR: MGSurfOpt (Yams) plug-in is unavailable')
+ pass
-salome_pluginsmanager.AddFunction('ReMesh with MGCleaner',
- 'Run MGCleaner',
- MGCleanerLct)
+try:
+ from MGCleanerplug_plugin import MGCleanerLct
+ salome_pluginsmanager.AddFunction('ReMesh with MGCleaner',
+ 'Run MGCleaner',
+ MGCleanerLct)
+except:
+ salome_pluginsmanager.logger.info('ERROR: MGCleaner plug-in is unavailable')
+ pass
-salome_pluginsmanager.AddFunction('Meshed Pipe with a crack',
- 'Create a mesh with blocFissure tool',
- fissureCoudeDlg)
+try:
+ from blocFissure.ihm.fissureCoude_plugin import fissureCoudeDlg
+ salome_pluginsmanager.AddFunction('Meshed Pipe with a crack',
+ 'Create a mesh with blocFissure tool',
+ fissureCoudeDlg)
+except:
+ salome_pluginsmanager.logger.info('ERROR: Meshed Pipe with a crack plug-in is unavailable')
+ pass
+try:
+ from blocFissure.ihm.fissureGenerale_plugin import fissureGeneraleDlg
+ salome_pluginsmanager.AddFunction('Add a crack in a mesh',
+ 'Insert a crack in an hexahedral mesh with blocFissure tool',
+ fissureGeneraleDlg)
+except:
+ salome_pluginsmanager.logger.info('ERROR: Meshed Pipe with a crack plug-in is unavailable')
+ pass
# ZCracks plugin requires the module EFICAS to be installed
# thus it is first tested if this module is available before
# adding the plugin to salome_pluginsmanager
-enable_zcracks = True
try:
import eficasSalome
-except:
- enable_zcracks = False
-
-if enable_zcracks:
from zcracks_plugin import ZcracksLct
salome_pluginsmanager.AddFunction('Run Zcrack',
'Run Zcrack',
ZcracksLct)
+except:
+ salome_pluginsmanager.logger.info('ERROR: Zcrack plug-in is unavailable')
+ pass