Merge branch 'master' into pra/blocFissure

This commit is contained in:
Paul RASCLE 2014-12-02 11:01:36 +01:00
commit 0c5188fd2c
117 changed files with 4470 additions and 1616 deletions

View File

@ -29,10 +29,10 @@ STRING(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UC)
SET(${PROJECT_NAME_UC}_MAJOR_VERSION 7)
SET(${PROJECT_NAME_UC}_MINOR_VERSION 4)
SET(${PROJECT_NAME_UC}_PATCH_VERSION 0)
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
# ===========
@ -162,7 +162,7 @@ ENDIF(EXISTS ${GEOM_ROOT_DIR})
##
# VTK is obligatiry for the SMESH
FIND_PACKAGE(SalomeVTK 6.1 REQUIRED)
FIND_PACKAGE(SalomeVTK REQUIRED)
FIND_PACKAGE(SalomeCAS REQUIRED)

View File

@ -17,8 +17,10 @@
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
# examples that cant be used for testing because they use external mesher plug-ins
SET(BAD_TESTS
3dmesh.py
a3DmeshOnModified2Dmesh.py
creating_meshes_ex01.py
creating_meshes_ex03.py
creating_meshes_ex05.py
@ -39,14 +41,14 @@ SET(BAD_TESTS
quality_controls_ex20.py
quality_controls_ex21.py
quality_controls_ex22.py
viewing_meshes_ex01.py
)
viewing_meshes_ex01.py
)
SET(GOOD_TESTS
cartesian_algo.py
creating_meshes_ex02.py
creating_meshes_ex04.py
creating_meshes_ex06.py
cartesian_algo.py
creating_meshes_ex02.py
creating_meshes_ex04.py
creating_meshes_ex06.py
creating_meshes_ex07.py
creating_meshes_ex08.py
defining_hypotheses_ex01.py

View File

@ -0,0 +1,62 @@
import salome
salome.salome_init()
from salome.geom import geomBuilder
geompy = geomBuilder.New(salome.myStudy)
# This script demonstrates generation of 3D mesh basing on a modified 2D mesh
#
# Purpose is to get a tetrahedral mesh in a sphere cut by a cube.
# The requirement is to have a surface mesh on the cube comprised of
# triangles of exactly the same size arranged in a grid pattern.
#
# To fulfill this requirement we mesh the box using Quadrangle (Mapping)
# meshing algorithm, split quadrangles into triangles and then generate
# tetrahedrons.
# Make the geometry
Box_1 = geompy.MakeBox(-100,-100,-100, 100, 100, 100)
Sphere_1 = geompy.MakeSphereR( 300 )
Cut_1 = geompy.MakeCut(Sphere_1, Box_1, theName="Cut_1")
# get a spherical face
Sph_Face = geompy.ExtractShapes( Sphere_1, geompy.ShapeType["FACE"] )[0]
# get the shape Sph_Face turned into during MakeCut()
Sph_Face = geompy.GetInPlace(Cut_1, Sph_Face, isNewImplementation=True, theName="Sphere_1")
# 1) Define a mesh with 1D and 2D meshers
import SMESH
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New(salome.myStudy)
Mesh_1 = smesh.Mesh(Cut_1)
# "global" meshers (assigned to Cut_1) that will be used for the box
Regular_1D = Mesh_1.Segment()
Local_Length_1 = Regular_1D.LocalLength(20)
Quadrangle_2D = Mesh_1.Quadrangle()
# a "local" mesher (assigned to a sub-mesh on Sphere_1) to mesh the sphere
algo_2D = Mesh_1.Triangle( smeshBuilder.NETGEN_1D2D, Sph_Face )
algo_2D.SetMaxSize( 70. )
algo_2D.SetFineness( smeshBuilder.Moderate )
algo_2D.SetMinSize( 7. )
# 2) Compute 2D mesh
isDone = Mesh_1.Compute()
# 3) Split quadrangles into triangles
isDone = Mesh_1.SplitQuadObject( Mesh_1, Diag13=True )
# 4) Define a 3D mesher
Mesh_1.Tetrahedron()
# 5) Compute 3D mesh
Mesh_1.Compute()
if salome.sg.hasDesktop():
salome.sg.updateObjBrowser(1)

View File

@ -32,8 +32,8 @@ newMesh = smesh.CopyMesh( mesh, "whole mesh copy")
# 2. copy a group of 2D elements along with groups
newMesh = smesh.CopyMesh( fGroup, "face group copy with groups",toCopyGroups=True)
# 3. copy a group of nodes with preseving their ids
newMesh = smesh.CopyMesh( nGroup, "node group copy", toKeepIDs=True)
# 3. copy a group of nodes
newMesh = smesh.CopyMesh( nGroup, "node group copy")
# 4. copy some faces
faceIds = fGroup.GetIDs()[-10:]

View File

@ -1,9 +1,14 @@
# Use 3D extrusion meshing algorithm
import salome, smesh, SMESH, geompy
import salome
salome.salome_init()
smesh.SetCurrentStudy( salome.myStudy )
from salome.geom import geomBuilder
geompy = geomBuilder.New(salome.myStudy)
import SMESH
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New(salome.myStudy)
OX = geompy.MakeVectorDXDYDZ(1,0,0)
OY = geompy.MakeVectorDXDYDZ(0,1,0)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

BIN
doc/salome/gui/SMESH/images/extrusionalongaline1.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 39 KiB

BIN
doc/salome/gui/SMESH/images/extrusionalongaline2.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 35 KiB

View File

@ -257,15 +257,14 @@ hypothesis operation.
\anchor automatic_length_anchor
<h2>Automatic Length</h2>
This hypothesis is automatically applied when you select <b>Assign a
set of hypotheses</b> option in Create Mesh menu.
\image html automaticlength.png
The dialog box prompts you to define the quality of the future mesh by
only one parameter, which is \b Fineness, ranging from 0 (coarse mesh,
low number of elements) to 1 (extremely fine mesh, great number of
elements). Compare one and the same object (sphere) meshed with
elements).
\image html automaticlength.png
Compare one and the same object (sphere) meshed with
minimum and maximum value of this parameter.
\image html image147.gif "Example of a very rough mesh. Automatic Length works for 0."

View File

@ -113,10 +113,9 @@ of the enforced nodes.
projected to the meshed face and located close enough to the
meshed face will be used to create the enforced nodes.</li>
</ul>
\note <b>Enforced nodes</b> can't be created at \b Reduced transition type.
Let us see how the algorithm works:
<ul>
<li> Initially positions of nodes are computed without taking into
account the enforced vertex (yellow point).</li>

View File

@ -7,10 +7,12 @@ a set of entities with a simple topology.
It is possible to \subpage constructing_meshes_page "construct meshes"
on the basis of geometrical shapes produced in the GEOM module.
It is also possible to
\subpage constructing_submeshes_page "construct mesh on a part of the geometrical object",
for example, a face, with different meshing parameters or using
another meshing algorithm.
Construction of \subpage constructing_submeshes_page "sub-meshes"
allows to mesh parts of the geometrical object, for example a face,
with different meshing parameters or using another meshing algorithm
than other parts.
3D mesh can be generated basing on a 2D closed mesh.
Several created meshes can be \subpage building_compounds_page "combined into another mesh".
@ -62,44 +64,4 @@ described in the following way:
coordinates of the corresponding vertex.</li>
</ul>
<br><h2>Connections</h2>
Each mesh entity bounds 0 or more mesh entities of higher
dimension. In the same way each mesh entity is bounded by 0 or more
mesh entities of lower dimension:
<ul>
<li>A node bounds edges, faces and volumes</li>
<li>An edge bounds faces, and volumes</li>
<li>A face bounds volumes</li>
<li>A volume is bounded by faces, edges and nodes</li>
<li>A face is bounded by edges, and nodes</li>
<li>An edge is bounded by nodes</li>
</ul>
You can notice that there are two types of connections: \b inverse and
\b direct connections.
<br><h2>Inverse connections</h2>
This relationship has a particularity that the order of bounded
entities has not a direct meaning. Also the number of bounded entities
is not fixed.
\b Example: The edges surrounding a node. The 3rd edge has no more
sense that the 5th one.
<br><h2>Direct connections</h2>
This relationship has a particularity that the order of bounding
entities is meaningful. The number of bounding entities is fixed and
depends on the type of the entity (hexahedron, tetrahedron,?).
\b Example: An edge is composed of two nodes. A face is composed of 3
or 4 edges depending if we are dealing with triangles or quadrangles.
The connections are not only restricted to entities of one dimension
higher or lower. For example some algorithms may be interested to
retrieve all the faces surrounding a node.
*/

View File

@ -52,15 +52,15 @@ geometrical objects.
There is also a number of more specific algorithms:
<ul>
<li>\subpage prism_3d_algo_page "for meshing prismatic shapes"</li>
<li>\subpage projection_algos_page "for meshing by projection of another mesh"</li>
<li>\subpage import_algos_page "for meshing by importing elements from another mesh"</li>
<li>\subpage radial_prism_algo_page "for meshing geometrical objects with cavities"</li>
<li>\subpage segments_around_vertex_algo_page "for defining the local size of elements around a certain node"</li>
<li>\subpage prism_3d_algo_page "for meshing prismatic shapes"</li>
<li>\subpage radial_quadrangle_1D2D_algo_page "for meshing special 2d faces (circles and part of circles)"</li>
<li>\subpage use_existing_page "Use Edges to be Created Manually" and
\ref use_existing_page "Use Faces to be Created Manually" algorithms can be
used to create a 1D or a 2D mesh in a python script.</li>
<li>\subpage segments_around_vertex_algo_page "for defining the local size of elements around a certain node"</li>
</ul>
\ref constructing_meshes_page "Constructing meshes" page describes in

View File

@ -9,6 +9,7 @@
<li> \ref preview_anchor "Previewing the mesh" (optional)</li>
<li> \ref submesh_order_anchor "Changing sub-mesh priority" (optional)</li>
<li> \ref compute_anchor "Computing the mesh"</li>
<li> \ref edit_anchor "Editing the mesh" (optional)</li>
</ul>
\anchor create_mesh_anchor
@ -357,8 +358,29 @@ computation reporting. There are the following possibilities: always
show the information box, show only if an error occurs or never.
By default, the information box is always shown after mesh computation operation.
<br><br>
<p><p>
\anchor edit_anchor
<h2>Editing the mesh</h2>
It is possible to \ref modifying_meshes_page "edit the mesh" of
lower dimension before generation of mesh of higher dimension.
For example you can generate 2D mesh, modify it using e.g.
\ref pattern_mapping_page, and then generate 3D mesh basing on the
modified 2D mesh. The workflow is following:
- Define 1D and 2D meshing algorithms.
- Compute the mesh. 2D mesh is generated.
- Apply \ref pattern_mapping_page.
- Define 3D meshing algorithms without modifying 1D and 2D algorithms
and hypotheses.
- Compute the mesh. 3D mesh is generated.
\note Nodes and elements added \ref adding_nodes_and_elements_page
"manually" can't be used in this workflow because the manually created
entities are not attached to any geometry and thus (usually) can't be
found by a mesher paving some geometry.
<b>See Also</b> a sample TUI Script demonstrates the possibility of
\ref tui_editing_while_meshing "Intermediate edition while meshing"
*/

View File

@ -2,9 +2,21 @@
\page constructing_submeshes_page Constructing sub-meshes
Sub-mesh is a mesh on a geometrical sub-object created with meshing algorithms
and/or hypotheses other than the algorithms and hypotheses assigned to
the parent mesh on the parent geometrical object.
Sub-mesh is a mesh on a geometrical sub-object (sub-shape) used to assign
different meshing algorithms and/or hypotheses than the algorithms and
hypotheses assigned to the parent mesh on the parent geometrical
object, that allows getting a local mesh refinement.
A sub-shape to create a sub-mesh on should be retrieved from the shape
of the parent mesh one of the following ways: <ul>
<li> In Geometry module, via <em>New Entity > Explode</em> menu.</li>
<li> In Geometry module, by creation of a group (<em>New Entity >
Group > Create Group</em> menu).</li>
<li> In Mesh module, by
\ref subshape_by_mesh_elem "selecting a mesh element" generated on a
sub-shape of interest. This way is accessible if the mesh is
already computed.</li>
</ul>
If a geometrical sub-object belongs to several geometrical objects
having different meshes or sub-meshes, it will be meshed with the
@ -56,6 +68,7 @@ sub-mesh. You can select meshing algorithms and hypotheses in the same way as
in \ref constructing_meshes_page "Create mesh" menu.
\par
\anchor subshape_by_mesh_elem
If the parent mesh is already computed, then you can define the
\b Geometry by picking mesh elements computed on a sub-shape of interest
in the 3D Viewer, i.e. you do not have to extract this sub-shape
@ -77,12 +90,13 @@ Browser.
\image html find_geom_by_mesh_elem.png
\par
In this dialog, <b> Element Type </b> defines kind of element to pick in the
Viewer.
In this dialog, <b> Element Type </b> defines a kind of element to pick in the
Viewer.
Instead of picking an element in the Viewer, you can type its
ID in <b> Element ID</b> field.
<b> Geometry name </b> field allows defining a name of the sub-shape.
<b> Geometry name </b> field allows defining a name of the sub-shape
with which the sub-shape will appear in the Object Browser (if not yet
there).
\par
In the Object Browser the structure of the new sub-mesh will be

View File

@ -42,9 +42,6 @@ selection_filter_library_page "Selection filter library" page.</li>
<ul>
<li>activate <b>Generate groups</b> checkbox to copy the groups of
elements of the source mesh to the newly created mesh.</li>
<li>activate <b>Preserve IDs of elements</b> checkbox to keep
the IDs of new nodes and elements the same as the IDs of source nodes
and elements.</li>
</ul>
</li>

View File

@ -9,4 +9,13 @@ edges or combine them.
\image html image58.gif Only Edges
If the mesh contains a lot of elements, select <b>Choose...</b> item,
\image html display_entity_choose_item.png Item to call 'Display Entity' dialog box
and <b>Display Entity</b> dialog box will provide a way to display only some entities at first display instead of displaying all entities long time.
\image html display_entity_dlg.png 'Display Entity' dialog allows to select entities before displaying
\note This menu item is available from popup menu in both Object browser and 3D viewer.
*/

View File

@ -6,12 +6,12 @@
dimension than the input ones. Any node, segment or 2D element can be
extruded. Each type of elements has a corresponding type of extruded elements:
<table>
<tr><td><b>Extruded element</b></td><td><b> Result elements </b></td></tr>
<tr><td>Node </td><td> Segments </td></tr>
<tr><td>Segment </td><td> Quadrilaterals </td></tr>
<tr><td>Triangle </td><td> Pentahedrons </td></tr>
<tr><td>Quadrilateral </td><td> Hexahedrons </td></tr>
<tr><td>Polygon </td><td> Polyhedrons </td></tr>
<tr><td><b>Extruded element</b></td><td><b> Result element </b></td></tr>
<tr><td>Node </td><td> Segment </td></tr>
<tr><td>Segment </td><td> Quadrilateral </td></tr>
<tr><td>Triangle </td><td> Pentahedron </td></tr>
<tr><td>Quadrilateral </td><td> Hexahedron </td></tr>
<tr><td>Polygon </td><td> Polyhedron </td></tr>
<tr><td>Hexagonal polygon </td><td> Hexagonal prism </td></tr>
</table>
@ -35,7 +35,8 @@ The following dialog common for line and planar elements will appear:
<li>In this dialog:
<ul>
<li>Select the type of elements which will be extruded (0D, 1D or 2D).</li>
<li>Select the type of elements which will be extruded (nodes, 1D or
2D elements).</li>
<li>Specify the IDs of the elements which will be extruded by one
following means:
<ul>
@ -62,9 +63,15 @@ The following dialog common for line and planar elements will appear:
<li>specify the distance of extrusion along the vector.</li>
</ul>
<li>Specify the number of steps.</li>
<li>If you activate <b>Generate Groups</b> check-box, the created
elements contained in groups will be included into new groups named
by pattern "<old group name>_extruded" and "<old group name>_top".</li>
<li>If you activate <b>Generate Groups</b> check-box, the <em>result elements</em>
created from <em>extruded elements</em> contained in groups will be
included into new groups named by pattern "<old group
name>_extruded" and "<old group name>_top". For example if an
extruded quadrangle is included in \a Group_1 group then result
hexahedra will be included in \a Group_1_extruded group and a
quadrangle created at the "top" of extruded mesh will
be included in \a Group_1_top group. <br>This check-box is active
only if there are some groups in the mesh.</li>
</ul>
<li>Click \b Apply or <b> Apply and Close</b> button to confirm the operation.</li>

View File

@ -12,8 +12,6 @@ nodes to polyhedrons at an arbitrary place in the mesh.</li>
elements (used in quadratic meshes) from quadratic nodes to quadratic polyhedrons at an arbitrary place in the mesh.</li>
<li>\subpage removing_nodes_and_elements_page "Remove" any existing
mesh elements.</li>
<li>\subpage renumbering_nodes_and_elements_page "Renumber" nodes and
elements of the mesh.</li>
<li>\subpage translation_page "Translate" in the indicated direction the mesh or some of
its elements.</li>
<li>\subpage rotation_page "Rotate" by the indicated axis and angle
@ -53,6 +51,11 @@ or vice versa.</li>
<li>\subpage cut_mesh_by_plane_page "Cut a tetrahedron mesh by a plane".</li>
</ul>
It is possible to \ref edit_anchor "modify the mesh" of lower
dimension before generation of mesh of higher dimension.
<p><br></p>
\note It is possible to use the variables defined in the SALOME \b NoteBook
to specify the numerical parameters used for modification of any object.

View File

@ -14,7 +14,7 @@ The smp file contains 4 sections:
-# The first line indicates the total number of pattern nodes (N).
-# The next N lines describe nodes coordinates. Each line contains 2
node coordinates for a 2D pattern or 3 node cordinates for a 3D pattern.
node coordinates for a 2D pattern or 3 node coordinates for a 3D pattern.
Note, that node coordinates of a 3D pattern can be defined only by relative values in range [0;1].
-# The key-points line contains the indices of the nodes to be mapped on geometrical
vertices (for a 2D pattern only). Index n refers to the node described
@ -89,7 +89,7 @@ An example of a simple 3D pattern smp file:
<br><h2>Application of pattern mapping</h2>
<em>To apply pattern mapping to a geometrical object:</em>
<em>To apply pattern mapping to a geometrical object or mesh elements:</em>
From the \b Modification menu choose the <b>Pattern Mapping</b> item or click
<em>"Pattern mapping"</em> button in the toolbar.
@ -113,16 +113,17 @@ created manually or generated automatically from an existing mesh or submesh.</l
boundaries of the pattern must also be equal to the number of vertices
on internal boundaries of the face;</li>
<li> \b Vertex to which the first key-point should be mapped;</li>
</ul>
Alternatively, it is possible to select <b>Refine selected mesh elements</b>
checkbox and apply the pattern to
check-box and apply the pattern to <ul>
<li> <b>Mesh Face</b> instead of a geometric Face</li>
<li> and select \b Node instead of vertex.</li>
Additionally it is possible to:
<li> <b>Reverse the order of key-points</b> By default, the vertices of
a face are ordered counterclockwise.<li>
</ul>
Additionally it is possible to: <ul>
<li> <b>Reverse the order of key-points</b>. By default, the vertices of
a face are ordered counterclockwise.</li>
<li> Enable to <b> Create polygons near boundary</b> </li>
<li> and <b>Create polyhedrons near boundary</b><li>
<li> and <b>Create polyhedrons near boundary</b></li>
</ul>
\n For a <b>3D pattern</b>
@ -133,21 +134,27 @@ In this dialog you should specify:
<ul>
<li> \b Pattern, which can be loaded from .smp pattern file previously
created manually or generated automatically from an existing mesh or submesh.</li>
<li> A 3D block (Solid) object;</li>
<li> Two vertices that specify the order of nodes in the resulting mesh.</li>
<li> A 3D block (Solid) object.</li>
<li> Two vertices that specify the order of nodes in the resulting
mesh.</li>
</ul>
Alternatively, it is possible to select <b>Refine selected mesh elements</b>
checkbox and apply the pattern to
<ul>
<li> One or several <b>Mesh volumes</b> instead of a geometric 3D
object</li>
<li> and select two /b Nodes instead of vertices.</li>
</ul>
Additionally it is possible to:
<ul>
<li> Enable to <b> Create polygons near boundary</b> </li>
<li> and <b>Create polyhedrons near boundary</b><li>
<li> and <b>Create polyhedrons near boundary</b></li>
</ul>
\n Automatic Generation
<br>
<h3> Automatic Generation </h3>
To generate a pattern automatically from an existing mesh or submesh,
To generate a pattern automatically from an existing mesh or sub-mesh,
click \b New button.
The following dialog box will appear:

View File

@ -237,7 +237,7 @@ See also \ref filter_double_elements "Double Elements quality control".
<b>Bad oriented volume</b> selects mesh volumes, which are incorrectly oriented from
the point of view of MED convention.
</li><li>
<b>Over-constrained volumes</b> selects mesh volumes having only one border shared
<b>Over-constrained volumes</b> selects mesh volumes having only one facet shared
with other volumes.
See also \ref over_constrained_volumes_page "Over-constrained volumes quality control".
</li><li>

View File

@ -18,6 +18,11 @@
<h2>Change priority of submeshes in Mesh</h2>
\tui_script{creating_meshes_ex03.py}
<br>
\anchor tui_editing_while_meshing
<h2>Intermediate edition while meshing</h2>
\tui_script{a3DmeshOnModified2Dmesh.py}
<br>
\anchor tui_editing_mesh
<h2>Editing a mesh</h2>

View File

@ -33,7 +33,7 @@ viewer.</li>
<li>\subpage display_mode_page "Display Mode" - allows to select between
Wireframe, Shading and Nodes presentation.</li>
<li>\subpage display_entity_page "Display Entity" - allows to display
Faces, Edges or both.</li>
entities by types (Faces, Edges, Volumes etc.).</li>
<li><b>2D Quadratic</b> - allows to select between the representation
of quadratic edges as broken <b>lines</b> or as <b>arcs</b></li>
<li><b>Orientation of faces</b> - shows vectors of orientation of

View File

@ -34,6 +34,8 @@ SET(SMESH_RESOURCES_FILES
mesh_aspect_3d.png
mesh_biquad_quadrangle.png
mesh_biquad_triangle.png
mesh_choose.png
mesh_choose_all.png
mesh_clear.png
mesh_compute.png
mesh_diagonal.png

File diff suppressed because one or more lines are too long

BIN
resources/mesh_choose.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 469 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 472 B

View File

@ -1954,6 +1954,7 @@ bool MultiConnection2D::Value::operator<(const MultiConnection2D::Value& x) cons
}
void MultiConnection2D::GetValues(MValues& theValues){
if ( !myMesh ) return;
SMDS_FaceIteratorPtr anIter = myMesh->facesIterator();
for(; anIter->more(); ){
const SMDS_MeshFace* anElem = anIter->next();
@ -3134,11 +3135,14 @@ bool RangeOfIds::SetRangeStr( const TCollection_AsciiString& theStr )
myIds.Clear();
TCollection_AsciiString aStr = theStr;
aStr.RemoveAll( ' ' );
aStr.RemoveAll( '\t' );
//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, 2 );
aStr.Remove( aPos, 1 );
TCollection_AsciiString tmpStr = aStr.Token( ",", 1 );
int i = 1;
@ -4247,11 +4251,11 @@ void BelongToGeom::init()
myIsSubshape = IsSubShape(aMap, myShape);
}
if (!myIsSubshape)
//if (!myIsSubshape) // to be always ready to check an element not bound to geometry
{
myElementsOnShapePtr.reset(new ElementsOnShape());
myElementsOnShapePtr->SetTolerance(myTolerance);
myElementsOnShapePtr->SetAllNodes(true); // belong, while false means "lays on"
myElementsOnShapePtr->SetAllNodes(true); // "belong", while false means "lays on"
myElementsOnShapePtr->SetMesh(myMeshDS);
myElementsOnShapePtr->SetShape(myShape, myType);
}
@ -4292,36 +4296,43 @@ bool BelongToGeom::IsSatisfy (long theId)
{
if( const SMDS_MeshNode* aNode = myMeshDS->FindNode( theId ) )
{
if ( aNode->getshapeId() < 1 )
return myElementsOnShapePtr->IsSatisfy(theId);
const SMDS_PositionPtr& aPosition = aNode->GetPosition();
SMDS_TypeOfPosition aTypeOfPosition = aPosition->GetTypeOfPosition();
switch( aTypeOfPosition )
{
case SMDS_TOP_VERTEX : return IsContains( myMeshDS,myShape,aNode,TopAbs_VERTEX );
case SMDS_TOP_EDGE : return IsContains( myMeshDS,myShape,aNode,TopAbs_EDGE );
case SMDS_TOP_FACE : return IsContains( myMeshDS,myShape,aNode,TopAbs_FACE );
case SMDS_TOP_3DSPACE: return IsContains( myMeshDS,myShape,aNode,TopAbs_SHELL );
case SMDS_TOP_VERTEX : return ( IsContains( myMeshDS,myShape,aNode,TopAbs_VERTEX ));
case SMDS_TOP_EDGE : return ( IsContains( myMeshDS,myShape,aNode,TopAbs_EDGE ));
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 ));
}
}
}
else
{
if( const SMDS_MeshElement* anElem = myMeshDS->FindElement( theId ) )
if ( const SMDS_MeshElement* anElem = myMeshDS->FindElement( theId ))
{
if ( anElem->getshapeId() < 1 )
return myElementsOnShapePtr->IsSatisfy(theId);
if( myType == SMDSAbs_All )
{
return IsContains( myMeshDS,myShape,anElem,TopAbs_EDGE ) ||
IsContains( myMeshDS,myShape,anElem,TopAbs_FACE ) ||
IsContains( myMeshDS,myShape,anElem,TopAbs_SHELL )||
IsContains( myMeshDS,myShape,anElem,TopAbs_SOLID );
return ( IsContains( myMeshDS,myShape,anElem,TopAbs_EDGE ) ||
IsContains( myMeshDS,myShape,anElem,TopAbs_FACE ) ||
IsContains( myMeshDS,myShape,anElem,TopAbs_SOLID )||
IsContains( myMeshDS,myShape,anElem,TopAbs_SHELL ));
}
else if( myType == anElem->GetType() )
{
switch( myType )
{
case SMDSAbs_Edge : return IsContains( myMeshDS,myShape,anElem,TopAbs_EDGE );
case SMDSAbs_Face : return IsContains( myMeshDS,myShape,anElem,TopAbs_FACE );
case SMDSAbs_Volume: return IsContains( myMeshDS,myShape,anElem,TopAbs_SHELL )||
IsContains( myMeshDS,myShape,anElem,TopAbs_SOLID );
case SMDSAbs_Edge : return ( IsContains( myMeshDS,myShape,anElem,TopAbs_EDGE ));
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 ));
}
}
}

View File

@ -28,7 +28,7 @@
#include <SalomeApp_Application.h>
#include <SUIT_Session.h>
#include <SALOME_ListIteratorOfListIO.hxx>
#include <SALOME_ListIO.hxx>
#include <GEOM_Client.hxx>
#include <SMESHGUI_Utils.h>
#include <boost/shared_ptr.hpp>
@ -96,7 +96,7 @@ LightApp_SelectionMgr* GeomSelectionTools::selectionMgr()
*/
SALOME_ListIO* GeomSelectionTools::getSelectedSalomeObjects()
{
SALOME_ListIO* selected;
SALOME_ListIO* selected = new SALOME_ListIO;
LightApp_SelectionMgr* aSel = selectionMgr();
aSel->selectedObjects( *selected, NULL, false );
return selected;

View File

@ -58,6 +58,7 @@ SET(_link_LIBRARIES
${CAS_TKG2d}
${CAS_TKCDF}
${GEOM_NMTTools}
${GEOM_GEOMUtils}
${Boost_LIBRARIES}
SMESHDS
SMESHControls

View File

@ -522,9 +522,7 @@ GeomAbs_Shape SMESH_Algo::Continuity(TopoDS_Edge E1,
Standard_Real tol = BRep_Tool::Tolerance( V );
Standard_Real angTol = 2e-3;
try {
#if OCC_VERSION_LARGE > 0x06010000
OCC_CATCH_SIGNALS;
#endif
return BRepLProp::Continuity(C1, C2, u1, u2, tol, angTol);
}
catch (Standard_Failure) {

View File

@ -157,8 +157,9 @@ void SMESH_HypoFilter::IsMoreLocalThanPredicate::findPreferable()
bool SMESH_HypoFilter::IsMoreLocalThanPredicate::IsOk(const SMESH_Hypothesis* aHyp,
const TopoDS_Shape& aShape) const
{
if ( aShape.IsSame( _mesh.GetShapeToMesh() ))
return false; // aHyp is global
if ( aShape.IsSame( _mesh.GetShapeToMesh() ) || // aHyp is global
aShape.IsSame( _shape ))
return false;
if ( SMESH_MesherHelper::IsSubShape( aShape, /*mainShape=*/_shape ))
return true;

View File

@ -55,8 +55,10 @@
#include "DriverCGNS_Write.hxx"
#endif
#include <GEOMUtils.hxx>
#undef _Precision_HeaderFile
#include <BRepBndLib.hxx>
//#include <BRepBndLib.hxx>
#include <BRepPrimAPI_MakeBox.hxx>
#include <Bnd_Box.hxx>
#include <TColStd_MapOfInteger.hxx>
@ -226,7 +228,7 @@ SMESH_Mesh::~SMESH_Mesh()
bool SMESH_Mesh::MeshExists( int meshId ) const
{
return _myDocument ? _myDocument->GetMesh( meshId ) : false;
return _myDocument ? bool( _myDocument->GetMesh( meshId )) : false;
}
//=============================================================================
@ -327,8 +329,9 @@ double SMESH_Mesh::GetShapeDiagonalSize(const TopoDS_Shape & aShape)
{
if ( !aShape.IsNull() ) {
Bnd_Box Box;
BRepBndLib::Add(aShape, Box);
return sqrt( Box.SquareExtent() );
GEOMUtils::PreciseBoundingBox(aShape, Box);
if ( !Box.IsVoid() )
return sqrt( Box.SquareExtent() );
}
return 0;
}

View File

@ -63,15 +63,15 @@ typedef std::list<TListOfInt> TListOfListOfInt;
class SMESH_EXPORT SMESH_Mesh
{
public:
SMESH_Mesh(int theLocalId,
int theStudyId,
public:
SMESH_Mesh(int theLocalId,
int theStudyId,
SMESH_Gen* theGen,
bool theIsEmbeddedMode,
SMESHDS_Document* theDocument);
virtual ~SMESH_Mesh();
/*!
* \brief Set geometry to be meshed
*/

View File

@ -3701,13 +3701,8 @@ static bool getClosestUV (Extrema_GenExtPS& projector,
if ( projector.IsDone() ) {
double u, v, minVal = DBL_MAX;
for ( int i = projector.NbExt(); i > 0; i-- )
#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1
if ( projector.SquareDistance( i ) < minVal ) {
minVal = projector.SquareDistance( i );
#else
if ( projector.Value( i ) < minVal ) {
minVal = projector.Value( i );
#endif
projector.Point( i ).Parameter( u, v );
}
result.SetCoord( u, v );
@ -10397,15 +10392,12 @@ namespace {
}
void Perform(const gp_Pnt& aPnt, double theTol)
{
theTol *= theTol;
_state = TopAbs_OUT;
_extremum.Perform(aPnt);
if ( _extremum.IsDone() )
for ( int iSol = 1; iSol <= _extremum.NbExt() && _state == TopAbs_OUT; ++iSol)
#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1
_state = ( _extremum.SquareDistance(iSol) <= theTol ? TopAbs_IN : TopAbs_OUT );
#else
_state = ( _extremum.Value(iSol) <= theTol ? TopAbs_IN : TopAbs_OUT );
#endif
}
TopAbs_State State() const
{

View File

@ -242,40 +242,68 @@ void SMESH_MesherHelper::SetSubShape(const TopoDS_Shape& aSh)
for ( TopExp_Explorer eF( aSh, TopAbs_FACE ); eF.More(); eF.Next() )
{
const TopoDS_Face& face = TopoDS::Face( eF.Current() );
BRepAdaptor_Surface surf( face, false );
if ( surf.IsUPeriodic() || surf.IsUClosed() ) {
myParIndex |= U_periodic;
myPar1[0] = surf.FirstUParameter();
myPar2[0] = surf.LastUParameter();
}
if ( surf.IsVPeriodic() || surf.IsVClosed() ) {
myParIndex |= V_periodic;
myPar1[1] = surf.FirstVParameter();
myPar2[1] = surf.LastVParameter();
}
// if ( surface->IsUPeriodic() || surface->IsVPeriodic() ||
// surface->IsUClosed() || surface->IsVClosed() )
gp_Pnt2d uv1, uv2;
for (TopExp_Explorer exp( face, TopAbs_EDGE ); exp.More(); exp.Next())
{
//while ( surface->IsKind(STANDARD_TYPE(Geom_RectangularTrimmedSurface )))
//surface = Handle(Geom_RectangularTrimmedSurface)::DownCast( surface )->BasisSurface();
for (TopExp_Explorer exp( face, TopAbs_EDGE ); exp.More(); exp.Next())
// look for a "seam" edge, a real seam or an edge on period boundary
TopoDS_Edge edge = TopoDS::Edge( exp.Current() );
if ( myParIndex )
{
// look for a seam edge
TopoDS_Edge edge = TopoDS::Edge( exp.Current() );
if ( BRep_Tool::IsClosed( edge, face )) {
// initialize myPar1, myPar2 and myParIndex
gp_Pnt2d uv1, uv2;
BRep_Tool::UVPoints( edge, face, uv1, uv2 );
if ( Abs( uv1.Coord(1) - uv2.Coord(1) ) < Abs( uv1.Coord(2) - uv2.Coord(2) ))
BRep_Tool::UVPoints( edge, face, uv1, uv2 );
const double du = Abs( uv1.Coord(1) - uv2.Coord(1) );
const double dv = Abs( uv1.Coord(2) - uv2.Coord(2) );
bool isSeam = BRep_Tool::IsClosed( edge, face );
if ( isSeam ) // real seam - having two pcurves on face
{
// pcurve can lie not on pediod boundary (22582, mesh_Quadratic_01/C9)
if ( du < dv )
{
double u1 = uv1.Coord(1);
edge.Reverse();
BRep_Tool::UVPoints( edge, face, uv1, uv2 );
double u2 = uv1.Coord(1);
myParIndex |= U_periodic;
myPar1[0] = Min( u1, u2 );
myPar2[0] = Max( u1, u2 );
}
else {
else
{
double v1 = uv1.Coord(2);
edge.Reverse();
BRep_Tool::UVPoints( edge, face, uv1, uv2 );
double v2 = uv1.Coord(2);
myParIndex |= V_periodic;
myPar1[1] = Min( v1, v2 );
myPar2[1] = Max( v1, v2 );
}
}
else //if ( !isSeam )
{
// one pcurve but on period boundary (22772, mesh_Quadratic_01/D1)
if (( myParIndex & U_periodic ) && du < Precision::PConfusion() )
{
isSeam = ( Abs( uv1.Coord(1) - myPar1[0] ) < Precision::PConfusion() ||
Abs( uv1.Coord(1) - myPar2[0] ) < Precision::PConfusion() );
}
else if (( myParIndex & V_periodic ) && dv < Precision::PConfusion() )
{
isSeam = ( Abs( uv1.Coord(2) - myPar1[1] ) < Precision::PConfusion() ||
Abs( uv1.Coord(2) - myPar2[1] ) < Precision::PConfusion() );
}
}
if ( isSeam )
{
// store seam shape indices, negative if shape encounters twice
int edgeID = meshDS->ShapeToIndex( edge );
mySeamShapeIds.insert( IsSeamShape( edgeID ) ? -edgeID : edgeID );
@ -284,27 +312,12 @@ void SMESH_MesherHelper::SetSubShape(const TopoDS_Shape& aSh)
mySeamShapeIds.insert( IsSeamShape( vertexID ) ? -vertexID : vertexID );
}
}
// look for a degenerated edge
if ( SMESH_Algo::isDegenerated( edge )) {
myDegenShapeIds.insert( meshDS->ShapeToIndex( edge ));
for ( TopExp_Explorer v( edge, TopAbs_VERTEX ); v.More(); v.Next() )
myDegenShapeIds.insert( meshDS->ShapeToIndex( v.Current() ));
}
}
if ( !myDegenShapeIds.empty() && !myParIndex )
{
BRepAdaptor_Surface surf( face, false );
if ( surf.IsUPeriodic() || surf.IsUClosed() ) {
myParIndex |= U_periodic;
myPar1[0] = surf.FirstUParameter();
myPar2[0] = surf.LastUParameter();
}
else if ( surf.IsVPeriodic() || surf.IsVClosed() ) {
myParIndex |= V_periodic;
myPar1[1] = surf.FirstVParameter();
myPar2[1] = surf.LastVParameter();
}
// look for a degenerated edge
if ( SMESH_Algo::isDegenerated( edge )) {
myDegenShapeIds.insert( meshDS->ShapeToIndex( edge ));
for ( TopExp_Explorer v( edge, TopAbs_VERTEX ); v.More(); v.Next() )
myDegenShapeIds.insert( meshDS->ShapeToIndex( v.Current() ));
}
}
}
@ -380,10 +393,13 @@ void SMESH_MesherHelper::AddTLinkNode(const SMDS_MeshNode* n1,
*/
//================================================================================
void SMESH_MesherHelper::AddTLinks(const SMDS_MeshEdge* edge)
bool SMESH_MesherHelper::AddTLinks(const SMDS_MeshEdge* edge)
{
if ( edge->IsQuadratic() )
if ( edge && edge->IsQuadratic() )
AddTLinkNode(edge->GetNode(0), edge->GetNode(1), edge->GetNode(2));
else
return false;
return true;
}
//================================================================================
@ -392,8 +408,9 @@ void SMESH_MesherHelper::AddTLinks(const SMDS_MeshEdge* edge)
*/
//================================================================================
void SMESH_MesherHelper::AddTLinks(const SMDS_MeshFace* f)
bool SMESH_MesherHelper::AddTLinks(const SMDS_MeshFace* f)
{
bool isQuad = true;
if ( !f->IsPoly() )
switch ( f->NbNodes() ) {
case 7:
@ -417,7 +434,9 @@ void SMESH_MesherHelper::AddTLinks(const SMDS_MeshFace* f)
AddTLinkNode(f->GetNode(2),f->GetNode(3),f->GetNode(6));
AddTLinkNode(f->GetNode(3),f->GetNode(0),f->GetNode(7)); break;
default:;
isQuad = false;
}
return isQuad;
}
//================================================================================
@ -426,7 +445,7 @@ void SMESH_MesherHelper::AddTLinks(const SMDS_MeshFace* f)
*/
//================================================================================
void SMESH_MesherHelper::AddTLinks(const SMDS_MeshVolume* volume)
bool SMESH_MesherHelper::AddTLinks(const SMDS_MeshVolume* volume)
{
if ( volume->IsQuadratic() )
{
@ -460,7 +479,9 @@ void SMESH_MesherHelper::AddTLinks(const SMDS_MeshVolume* volume)
nFCenter ));
}
}
return true;
}
return false;
}
//================================================================================
@ -586,14 +607,24 @@ gp_XY SMESH_MesherHelper::GetNodeUV(const TopoDS_Face& F,
Handle(Geom_Surface) S = BRep_Tool::Surface(F,loc);
Standard_Boolean isUPeriodic = S->IsUPeriodic();
Standard_Boolean isVPeriodic = S->IsVPeriodic();
gp_Pnt2d newUV = uv;
if ( isUPeriodic || isVPeriodic ) {
Standard_Real UF,UL,VF,VL;
S->Bounds(UF,UL,VF,VL);
if(isUPeriodic)
uv.SetX( uv.X() + ShapeAnalysis::AdjustToPeriod(uv.X(),UF,UL));
if(isVPeriodic)
uv.SetY( uv.Y() + ShapeAnalysis::AdjustToPeriod(uv.Y(),VF,VL));
if ( isUPeriodic )
newUV.SetX( uv.X() + ShapeAnalysis::AdjustToPeriod(uv.X(),UF,UL));
if ( isVPeriodic )
newUV.SetY( uv.Y() + ShapeAnalysis::AdjustToPeriod(uv.Y(),VF,VL));
}
if ( n2 )
{
gp_Pnt2d uv2 = GetNodeUV( F, n2, 0, check );
if ( isUPeriodic && Abs( uv.X()-uv2.X() ) < Abs( newUV.X()-uv2.X() ))
newUV.SetX( uv.X() );
if ( isVPeriodic && Abs( uv.Y()-uv2.Y() ) < Abs( newUV.Y()-uv2.Y() ))
newUV.SetY( uv.Y() );
}
uv = newUV;
}
}
else if(Pos->GetTypeOfPosition()==SMDS_TOP_VERTEX)
@ -910,7 +941,7 @@ bool SMESH_MesherHelper::CheckNodeU(const TopoDS_Edge& E,
int shapeID = n->getshapeId();
bool infinit = Precision::IsInfinite( u );
bool zero = ( u == 0. );
if ( force || toCheckPosOnShape( shapeID ) || infinit || zero )
if ( force || infinit || zero || toCheckPosOnShape( shapeID ))
{
TopLoc_Location loc; double f,l;
Handle(Geom_Curve) curve = BRep_Tool::Curve( E,loc,f,l );
@ -927,7 +958,7 @@ bool SMESH_MesherHelper::CheckNodeU(const TopoDS_Edge& E,
gp_Pnt nodePnt = SMESH_TNodeXYZ( n );
if ( !loc.IsIdentity() ) nodePnt.Transform( loc.Transformation().Inverted() );
gp_Pnt curvPnt;
double dist = u;
double dist = 2*tol;
if ( !infinit )
{
curvPnt = curve->Value( u );
@ -2433,7 +2464,7 @@ namespace
//=======================================================================
//function : IsStructured
//purpose : Return true if 2D mesh on FACE is structured
//purpose : Return true if 2D mesh on FACE is a structured rectangle
//=======================================================================
bool SMESH_MesherHelper::IsStructured( SMESH_subMesh* faceSM )
@ -2523,6 +2554,79 @@ bool SMESH_MesherHelper::IsStructured( SMESH_subMesh* faceSM )
return true;
}
//=======================================================================
//function : IsDistorted2D
//purpose : Return true if 2D mesh on FACE is ditorted
//=======================================================================
bool SMESH_MesherHelper::IsDistorted2D( SMESH_subMesh* faceSM,
bool checkUV)
{
if ( !faceSM || faceSM->GetSubShape().ShapeType() != TopAbs_FACE )
return false;
bool haveBadFaces = false;
SMESH_MesherHelper helper( *faceSM->GetFather() );
helper.SetSubShape( faceSM->GetSubShape() );
const TopoDS_Face& F = TopoDS::Face( faceSM->GetSubShape() );
SMESHDS_SubMesh* smDS = helper.GetMeshDS()->MeshElements( F );
if ( !smDS || smDS->NbElements() == 0 ) return false;
SMDS_ElemIteratorPtr faceIt = smDS->GetElements();
double prevArea = 0;
vector< const SMDS_MeshNode* > nodes;
vector< gp_XY > uv;
bool* toCheckUV = checkUV ? & checkUV : 0;
while ( faceIt->more() && !haveBadFaces )
{
const SMDS_MeshElement* face = faceIt->next();
// get nodes
nodes.resize( face->NbCornerNodes() );
SMDS_MeshElement::iterator n = face->begin_nodes();
for ( size_t i = 0; i < nodes.size(); ++n, ++i )
nodes[ i ] = *n;
// avoid elems on degenarate shapes as UV on them can be wrong
if ( helper.HasDegeneratedEdges() )
{
bool isOnDegen = false;
for ( size_t i = 0; ( i < nodes.size() && !isOnDegen ); ++i )
isOnDegen = helper.IsDegenShape( nodes[ i ]->getshapeId() );
if ( isOnDegen )
continue;
}
// prepare to getting UVs
const SMDS_MeshNode* inFaceNode = 0;
if ( helper.HasSeam() ) {
for ( size_t i = 0; ( i < nodes.size() && !inFaceNode ); ++i )
if ( !helper.IsSeamShape( nodes[ i ]->getshapeId() ))
inFaceNode = nodes[ i ];
if ( !inFaceNode )
continue;
}
// get UVs
uv.resize( nodes.size() );
for ( size_t i = 0; i < nodes.size(); ++i )
uv[ i ] = helper.GetNodeUV( F, nodes[ i ], inFaceNode, toCheckUV );
// compare orientation of triangles
double faceArea = 0;
for ( int iT = 0, nbT = nodes.size()-2; iT < nbT; ++iT )
{
gp_XY v1 = uv[ iT+1 ] - uv[ 0 ];
gp_XY v2 = uv[ iT+2 ] - uv[ 0 ];
faceArea += v2 ^ v1;
}
haveBadFaces = ( faceArea * prevArea < 0 );
prevArea = faceArea;
}
return haveBadFaces;
}
//================================================================================
/*!
* \brief Find out elements orientation on a geometrical face
@ -2702,6 +2806,28 @@ bool SMESH_MesherHelper::IsSubShape( const TopoDS_Shape& shape, SMESH_Mesh* aMes
(shape.ShapeType() == TopAbs_COMPOUND && aMesh->GetMeshDS()->IsGroupOfSubShapes( shape ));
}
//=======================================================================
//function : IsBlock
//purpose :
//=======================================================================
bool SMESH_MesherHelper::IsBlock( const TopoDS_Shape& shape )
{
if ( shape.IsNull() )
return false;
TopoDS_Shell shell;
TopExp_Explorer exp( shape, TopAbs_SHELL );
if ( !exp.More() ) return false;
shell = TopoDS::Shell( exp.Current() );
if ( exp.Next(), exp.More() ) return false;
TopoDS_Vertex v;
TopTools_IndexedMapOfOrientedShape map;
return SMESH_Block::FindBlockShapes( shell, v, v, map );
}
//================================================================================
/*!
* \brief Return maximal tolerance of shape

View File

@ -117,6 +117,11 @@ class SMESH_EXPORT SMESH_MesherHelper
*/
static bool IsStructured( SMESH_subMesh* faceSM );
/*!
* \brief Return true if 2D mesh on FACE is distored
*/
static bool IsDistorted2D( SMESH_subMesh* faceSM, bool checkUV=false );
/*!
* \brief Returns true if given node is medium
* \param n - node to check
@ -167,15 +172,15 @@ class SMESH_EXPORT SMESH_MesherHelper
* a0 p0 a1
*/
inline static gp_XY calcTFI(double x, double y,
const gp_XY a0,const gp_XY a1,const gp_XY a2,const gp_XY a3,
const gp_XY p0,const gp_XY p1,const gp_XY p2,const gp_XY p3);
const gp_XY& a0,const gp_XY& a1,const gp_XY& a2,const gp_XY& a3,
const gp_XY& p0,const gp_XY& p1,const gp_XY& p2,const gp_XY& p3);
/*!
* \brief Same as "gp_XY calcTFI(...)" but in 3D
*/
inline static gp_XYZ calcTFI(double x, double y,
const gp_XYZ a0,const gp_XYZ a1,const gp_XYZ a2,const gp_XYZ a3,
const gp_XYZ p0,const gp_XYZ p1,const gp_XYZ p2,const gp_XYZ p3);
const gp_XYZ& a0,const gp_XYZ& a1,const gp_XYZ& a2,const gp_XYZ& a3,
const gp_XYZ& p0,const gp_XYZ& p1,const gp_XYZ& p2,const gp_XYZ& p3);
/*!
* \brief Count nb of sub-shapes
* \param shape - the shape
@ -216,6 +221,8 @@ class SMESH_EXPORT SMESH_MesherHelper
static bool IsSubShape( const TopoDS_Shape& shape, SMESH_Mesh* aMesh );
static bool IsBlock( const TopoDS_Shape& shape );
static double MaxTolerance( const TopoDS_Shape& shape );
static double GetAngle( const TopoDS_Edge & E1, const TopoDS_Edge & E2,
@ -637,9 +644,9 @@ public:
void AddTLinkNodeMap(const TLinkNodeMap& aMap)
{ myTLinkNodeMap.insert(aMap.begin(), aMap.end()); }
void AddTLinks(const SMDS_MeshEdge* edge);
void AddTLinks(const SMDS_MeshFace* face);
void AddTLinks(const SMDS_MeshVolume* vol);
bool AddTLinks(const SMDS_MeshEdge* edge);
bool AddTLinks(const SMDS_MeshFace* face);
bool AddTLinks(const SMDS_MeshVolume* vol);
/**
* Returns myTLinkNodeMap
@ -725,8 +732,8 @@ public:
//=======================================================================
inline gp_XY
SMESH_MesherHelper::calcTFI(double x, double y,
const gp_XY a0,const gp_XY a1,const gp_XY a2,const gp_XY a3,
const gp_XY p0,const gp_XY p1,const gp_XY p2,const gp_XY p3)
const gp_XY& a0,const gp_XY& a1,const gp_XY& a2,const gp_XY& a3,
const gp_XY& p0,const gp_XY& p1,const gp_XY& p2,const gp_XY& p3)
{
return
((1 - y) * p0 + x * p1 + y * p2 + (1 - x) * p3 ) -
@ -735,8 +742,8 @@ SMESH_MesherHelper::calcTFI(double x, double y,
//=======================================================================
inline gp_XYZ
SMESH_MesherHelper::calcTFI(double x, double y,
const gp_XYZ a0,const gp_XYZ a1,const gp_XYZ a2,const gp_XYZ a3,
const gp_XYZ p0,const gp_XYZ p1,const gp_XYZ p2,const gp_XYZ p3)
const gp_XYZ& a0,const gp_XYZ& a1,const gp_XYZ& a2,const gp_XYZ& a3,
const gp_XYZ& p0,const gp_XYZ& p1,const gp_XYZ& p2,const gp_XYZ& p3)
{
return
((1 - y) * p0 + x * p1 + y * p2 + (1 - x) * p3 ) -

View File

@ -501,13 +501,8 @@ static gp_XY project (const SMDS_MeshNode* theNode,
}
double u, v, minVal = DBL_MAX;
for ( int i = theProjectorPS.NbExt(); i > 0; i-- )
#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1
if ( theProjectorPS.SquareDistance( i ) < minVal ) {
minVal = theProjectorPS.SquareDistance( i );
#else
if ( theProjectorPS.Value( i ) < minVal ) {
minVal = theProjectorPS.Value( i );
#endif
theProjectorPS.Point( i ).Parameter( u, v );
}
return gp_XY( u, v );

View File

@ -2148,9 +2148,9 @@ TopoDS_Shape SMESH_subMesh::getCollection(SMESH_Gen * theGen,
if ( mainShape.IsSame( _subShape ))
return _subShape;
const bool ignoreAuxiliaryHyps = false;
const bool skipAuxHyps = false;
list<const SMESHDS_Hypothesis*> aUsedHyp =
theAlgo->GetUsedHypothesis( *_father, _subShape, ignoreAuxiliaryHyps ); // copy
theAlgo->GetUsedHypothesis( *_father, _subShape, skipAuxHyps ); // copy
// put in a compound all shapes with the same hypothesis assigned
// and a good ComputeState
@ -2161,11 +2161,13 @@ TopoDS_Shape SMESH_subMesh::getCollection(SMESH_Gen * theGen,
theSubs.clear();
TopExp_Explorer anExplorer( mainShape, _subShape.ShapeType() );
for ( ; anExplorer.More(); anExplorer.Next() )
SMESH_subMeshIteratorPtr smIt = _father->GetSubMesh( mainShape )->getDependsOnIterator(false);
while ( smIt->more() )
{
const TopoDS_Shape& S = anExplorer.Current();
SMESH_subMesh* subMesh = _father->GetSubMesh( S );
SMESH_subMesh* subMesh = smIt->next();
const TopoDS_Shape& S = subMesh->_subShape;
if ( S.ShapeType() != this->_subShape.ShapeType() )
continue;
theSubs.push_back( subMesh );
if ( subMesh == this )
{
@ -2173,12 +2175,14 @@ TopoDS_Shape SMESH_subMesh::getCollection(SMESH_Gen * theGen,
}
else if ( subMesh->GetComputeState() == READY_TO_COMPUTE )
{
SMESH_Algo* anAlgo = theGen->GetAlgo( subMesh );
if (strcmp( anAlgo->GetName(), theAlgo->GetName()) == 0 && // same algo
anAlgo->GetUsedHypothesis( *_father, S, ignoreAuxiliaryHyps ) == aUsedHyp) // same hyps
SMESH_Algo* anAlgo = subMesh->GetAlgo();
if (( anAlgo->IsSameName( *theAlgo )) && // same algo
( anAlgo->GetUsedHypothesis( *_father, S, skipAuxHyps ) == aUsedHyp )) // same hyps
{
aBuilder.Add( aCompound, S );
if ( !subMesh->SubMeshesComputed() )
theSubComputed = false;
if ( !subMesh->SubMeshesComputed() )
theSubComputed = false;
}
}
}

View File

@ -142,6 +142,7 @@ SET(_moc_HEADERS
SMESHGUI_PropertiesDlg.h
SMESHGUI_Add0DElemsOnAllNodesDlg.h
SMESHGUI_FieldSelectorWdg.h
SMESHGUI_DisplayEntitiesDlg.h
)
# header files / no moc processing
@ -249,6 +250,7 @@ SET(_other_SOURCES
SMESHGUI_MeshEditPreview.cxx
SMESHGUI_FileValidator.cxx
SMESHGUI_FieldSelectorWdg.cxx
SMESHGUI_DisplayEntitiesDlg.cxx
)
# sources / to compile

View File

@ -81,6 +81,7 @@
#include "SMESHGUI_SymmetryDlg.h"
#include "SMESHGUI_TranslationDlg.h"
#include "SMESHGUI_TransparencyDlg.h"
#include "SMESHGUI_DisplayEntitiesDlg.h"
#include "SMESHGUI_FilterUtils.h"
#include "SMESHGUI_GEOMGenUtils.h"
@ -91,14 +92,14 @@
#include "SMESHGUI_Utils.h"
#include "SMESHGUI_VTKUtils.h"
#include <SMESH_version.h>
#include "SMESH_version.h"
#include "SMESH_ControlsDef.hxx"
#include <SMESH_Actor.h>
#include <SMESH_ActorUtils.h>
#include <SMESH_Client.hxx>
#include <SMESH_ScalarBarActor.h>
#include <SMESH_TypeFilter.hxx>
#include "SMESH_Actor.h"
#include "SMESH_ActorUtils.h"
#include "SMESH_Client.hxx"
#include "SMESH_ScalarBarActor.h"
#include "SMESH_TypeFilter.hxx"
// SALOME GUI includes
#include <SalomeApp_Application.h>
@ -132,7 +133,6 @@
#include <QtxFontEdit.h>
#include <SALOME_ListIO.hxx>
#include <SALOME_ListIteratorOfListIO.hxx>
#ifndef DISABLE_PLOT2DVIEWER
#include <SPlot2d_ViewModel.h>
@ -1566,111 +1566,124 @@ namespace
void Control( int theCommandID )
{
SMESH_Actor::eControl aControl = SMESH_Actor::eNone;
switch ( theCommandID ){
case SMESHOp::OpFreeNode:
aControl = SMESH_Actor::eFreeNodes;
break;
case SMESHOp::OpEqualNode:
aControl = SMESH_Actor::eCoincidentNodes;
break;
case SMESHOp::OpFreeEdge:
aControl = SMESH_Actor::eFreeEdges;
break;
case SMESHOp::OpFreeBorder:
aControl = SMESH_Actor::eFreeBorders;
break;
case SMESHOp::OpLength:
aControl = SMESH_Actor::eLength;
break;
case SMESHOp::OpConnection:
aControl = SMESH_Actor::eMultiConnection;
break;
case SMESHOp::OpEqualEdge:
aControl = SMESH_Actor::eCoincidentElems1D;
break;
case SMESHOp::OpFreeFace:
aControl = SMESH_Actor::eFreeFaces;
break;
case SMESHOp::OpBareBorderFace:
aControl = SMESH_Actor::eBareBorderFace;
break;
case SMESHOp::OpOverConstrainedFace:
aControl = SMESH_Actor::eOverConstrainedFace;
break;
case SMESHOp::OpLength2D:
aControl = SMESH_Actor::eLength2D;
break;
case SMESHOp::OpConnection2D:
aControl = SMESH_Actor::eMultiConnection2D;
break;
case SMESHOp::OpArea:
aControl = SMESH_Actor::eArea;
break;
case SMESHOp::OpTaper:
aControl = SMESH_Actor::eTaper;
break;
case SMESHOp::OpAspectRatio:
aControl = SMESH_Actor::eAspectRatio;
break;
case SMESHOp::OpMinimumAngle:
aControl = SMESH_Actor::eMinimumAngle;
break;
case SMESHOp::OpWarpingAngle:
aControl = SMESH_Actor::eWarping;
break;
case SMESHOp::OpSkew:
aControl = SMESH_Actor::eSkew;
break;
case SMESHOp::OpMaxElementLength2D:
aControl = SMESH_Actor::eMaxElementLength2D;
break;
case SMESHOp::OpEqualFace:
aControl = SMESH_Actor:: eCoincidentElems2D;
break;
case SMESHOp::OpAspectRatio3D:
aControl = SMESH_Actor::eAspectRatio3D;
break;
case SMESHOp::OpVolume:
aControl = SMESH_Actor::eVolume3D;
break;
case SMESHOp::OpMaxElementLength3D:
aControl = SMESH_Actor::eMaxElementLength3D;
break;
case SMESHOp::OpBareBorderVolume:
aControl = SMESH_Actor::eBareBorderVolume;
break;
case SMESHOp::OpOverConstrainedVolume:
aControl = SMESH_Actor::eOverConstrainedVolume;
break;
case SMESHOp::OpEqualVolume:
aControl = SMESH_Actor::eCoincidentElems3D;
break;
}
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
SALOME_ListIO selected;
if( aSel )
aSel->selectedObjects( selected );
if( !selected.IsEmpty() ){
Handle(SALOME_InteractiveObject) anIO = selected.First();
if(!anIO.IsNull()){
SMESH_Actor::eControl aControl = SMESH_Actor::eNone;
if(SMESH_Actor *anActor = SMESH::FindActorByEntry(anIO->getEntry())) {
switch ( theCommandID ){
case SMESHOp::OpFreeNode:
aControl = SMESH_Actor::eFreeNodes;
break;
case SMESHOp::OpEqualNode:
aControl = SMESH_Actor::eCoincidentNodes;
break;
case SMESHOp::OpFreeEdge:
aControl = SMESH_Actor::eFreeEdges;
break;
case SMESHOp::OpFreeBorder:
aControl = SMESH_Actor::eFreeBorders;
break;
case SMESHOp::OpLength:
aControl = SMESH_Actor::eLength;
break;
case SMESHOp::OpConnection:
aControl = SMESH_Actor::eMultiConnection;
break;
case SMESHOp::OpEqualEdge:
aControl = SMESH_Actor::eCoincidentElems1D;
break;
case SMESHOp::OpFreeFace:
aControl = SMESH_Actor::eFreeFaces;
break;
case SMESHOp::OpBareBorderFace:
aControl = SMESH_Actor::eBareBorderFace;
break;
case SMESHOp::OpOverConstrainedFace:
aControl = SMESH_Actor::eOverConstrainedFace;
break;
case SMESHOp::OpLength2D:
aControl = SMESH_Actor::eLength2D;
break;
case SMESHOp::OpConnection2D:
aControl = SMESH_Actor::eMultiConnection2D;
break;
case SMESHOp::OpArea:
aControl = SMESH_Actor::eArea;
break;
case SMESHOp::OpTaper:
aControl = SMESH_Actor::eTaper;
break;
case SMESHOp::OpAspectRatio:
aControl = SMESH_Actor::eAspectRatio;
break;
case SMESHOp::OpMinimumAngle:
aControl = SMESH_Actor::eMinimumAngle;
break;
case SMESHOp::OpWarpingAngle:
aControl = SMESH_Actor::eWarping;
break;
case SMESHOp::OpSkew:
aControl = SMESH_Actor::eSkew;
break;
case SMESHOp::OpMaxElementLength2D:
aControl = SMESH_Actor::eMaxElementLength2D;
break;
case SMESHOp::OpEqualFace:
aControl = SMESH_Actor:: eCoincidentElems2D;
break;
case SMESHOp::OpAspectRatio3D:
aControl = SMESH_Actor::eAspectRatio3D;
break;
case SMESHOp::OpVolume:
aControl = SMESH_Actor::eVolume3D;
break;
case SMESHOp::OpMaxElementLength3D:
aControl = SMESH_Actor::eMaxElementLength3D;
break;
case SMESHOp::OpBareBorderVolume:
aControl = SMESH_Actor::eBareBorderVolume;
break;
case SMESHOp::OpOverConstrainedVolume:
aControl = SMESH_Actor::eOverConstrainedVolume;
break;
case SMESHOp::OpEqualVolume:
aControl = SMESH_Actor::eCoincidentElems3D;
break;
}
anActor->SetControlMode(aControl);
anActor->GetScalarBarActor()->SetTitle( functorToString( anActor->GetFunctor() ).toLatin1().constData() );
SMESH::RepaintCurrentView();
SALOME_ListIteratorOfListIO It(selected);
for ( ; It.More(); It.Next())
{
Handle(SALOME_InteractiveObject) anIO = It.Value();
if(!anIO.IsNull()){
_PTR(SObject) SO = aStudy->FindObjectID( It.Value()->getEntry() );
if ( SO ) {
CORBA::Object_var aObject = SMESH::SObjectToObject( SO );
SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow( aObject );
SMESH::SMESH_subMesh_var aSubMesh = SMESH::SMESH_subMesh::_narrow( aObject );
SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow( aObject );
if ( !aMesh->_is_nil() || !aSubMesh->_is_nil() || !aGroup->_is_nil() ) {
if(SMESH_Actor *anActor = SMESH::FindActorByEntry(anIO->getEntry())) {
anActor->SetControlMode(aControl);
anActor->GetScalarBarActor()->SetTitle( functorToString( anActor->GetFunctor() ).toLatin1().constData() );
SMESH::RepaintCurrentView();
#ifndef DISABLE_PLOT2DVIEWER
if(anActor->GetPlot2Histogram()) {
SPlot2d_Histogram* aHistogram = anActor->UpdatePlot2Histogram();
QString functorName = functorToString( anActor->GetFunctor());
QString aHistogramName("%1 : %2");
aHistogramName = aHistogramName.arg(anIO->getName()).arg(functorName);
aHistogram->setName(aHistogramName);
aHistogram->setHorTitle(functorName);
SMESH::ProcessIn2DViewers(anActor);
}
if(anActor->GetPlot2Histogram()) {
SPlot2d_Histogram* aHistogram = anActor->UpdatePlot2Histogram();
QString functorName = functorToString( anActor->GetFunctor());
QString aHistogramName("%1 : %2");
aHistogramName = aHistogramName.arg(anIO->getName()).arg(functorName);
aHistogram->setName(aHistogramName);
aHistogram->setHorTitle(functorName);
SMESH::ProcessIn2DViewers(anActor);
}
#endif
}
}
}
}
}
}
@ -1743,6 +1756,19 @@ namespace
return RefType;
}
uint randomize( uint size )
{
static bool initialized = false;
if ( !initialized ) {
qsrand( QDateTime::currentDateTime().toTime_t() );
initialized = true;
}
uint v = qrand();
v = uint( (double)( v ) / RAND_MAX * size );
v = qMax( uint(0), qMin ( v, size-1 ) );
return v;
}
} //namespace
void SMESHGUI::OnEditDelete()
@ -2503,6 +2529,13 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
::SetDisplayEntity(theCommandID);
break;
// Choose entities to be displayed
case SMESHOp::OpDEChoose:
{
( new SMESHGUI_DisplayEntitiesDlg( SMESHGUI::desktop() ) )->exec();
break;
}
case SMESHOp::OpOrientationOnFaces:
{
LightApp_SelectionMgr* mgr = selectionMgr();
@ -3530,19 +3563,10 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
LightApp_SelectionMgr* mgr = selectionMgr();
SALOME_ListIO selected; mgr->selectedObjects( selected );
if ( selected.Extent() == 1 && selected.First()->hasEntry() ) {
_PTR(SObject) SO = aStudy->FindObjectID( selected.First()->getEntry() );
if ( SO ) {
CORBA::Object_var aObject = SMESH::SObjectToObject( SO );
SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow( aObject );
SMESH::SMESH_subMesh_var aSubMesh = SMESH::SMESH_subMesh::_narrow( aObject );
SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow( aObject );
if ( !aMesh->_is_nil() || !aSubMesh->_is_nil() || !aGroup->_is_nil() ) {
SUIT_OverrideCursor wc;
::Control( theCommandID );
break;
}
}
if( !selected.IsEmpty() ) {
SUIT_OverrideCursor wc;
::Control( theCommandID );
break;
}
SUIT_MessageBox::warning(desktop(),
tr( "SMESH_WRN_WARNING" ),
@ -3855,8 +3879,8 @@ void SMESHGUI::initialize( CAM_Application* app )
createSMESHAction( SMESHOp::OpRemoveOrphanNodes, "REMOVE_ORPHAN_NODES", "ICON_DLG_REM_ORPHAN_NODES" );
createSMESHAction( SMESHOp::OpClearMesh, "CLEAR_MESH", "ICON_CLEAR_MESH" );
createSMESHAction( SMESHOp::OpRenumberingNodes, "RENUM_NODES", "ICON_DLG_RENUMBERING_NODES" );
createSMESHAction( SMESHOp::OpRenumberingElements, "RENUM_ELEMENTS", "ICON_DLG_RENUMBERING_ELEMENTS" );
//createSMESHAction( SMESHOp::OpRenumberingNodes, "RENUM_NODES", "ICON_DLG_RENUMBERING_NODES" );
//createSMESHAction( SMESHOp::OpRenumberingElements, "RENUM_ELEMENTS", "ICON_DLG_RENUMBERING_ELEMENTS" );
createSMESHAction( SMESHOp::OpTranslation, "TRANS", "ICON_SMESH_TRANSLATION_VECTOR" );
createSMESHAction( SMESHOp::OpRotation, "ROT", "ICON_DLG_MESH_ROTATION" );
@ -3899,7 +3923,8 @@ void SMESHGUI::initialize( CAM_Application* app )
createSMESHAction( SMESHOp::OpDEFaces, "FACES", "ICON_DLG_TRIANGLE", 0, true );
createSMESHAction( SMESHOp::OpDEVolumes, "VOLUMES", "ICON_DLG_TETRAS", 0, true );
createSMESHAction( SMESHOp::OpDEBalls, "BALLS", "ICON_DLG_BALL", 0, true );
createSMESHAction( SMESHOp::OpDEAllEntity, "ALL" );
createSMESHAction( SMESHOp::OpDEChoose, "CHOOSE", "ICON_DLG_CHOOSE", 0, false );
createSMESHAction( SMESHOp::OpDEAllEntity, "ALL", "ICON_DLG_CHOOSE_ALL", 0, false );
createSMESHAction( SMESHOp::OpOrientationOnFaces, "FACE_ORIENTATION", "", 0, true );
createSMESHAction( SMESHOp::OpRepresentationLines, "LINE_REPRESENTATION", "", 0, true );
@ -3927,6 +3952,23 @@ void SMESHGUI::initialize( CAM_Application* app )
createSMESHAction( SMESHOp::OpSortChild, "SORT_CHILD_ITEMS" );
QList<int> aCtrlActions;
aCtrlActions << SMESHOp::OpFreeNode << SMESHOp::OpEqualNode // node controls
<< SMESHOp::OpFreeEdge << SMESHOp::OpFreeBorder
<< SMESHOp::OpLength << SMESHOp::OpConnection << SMESHOp::OpEqualEdge // edge controls
<< SMESHOp::OpFreeFace << SMESHOp::OpLength2D << SMESHOp::OpConnection2D
<< SMESHOp::OpArea << SMESHOp::OpTaper << SMESHOp::OpAspectRatio
<< SMESHOp::OpMinimumAngle << SMESHOp::OpWarpingAngle << SMESHOp::OpSkew
<< SMESHOp::OpMaxElementLength2D << SMESHOp::OpBareBorderFace
<< SMESHOp::OpOverConstrainedFace << SMESHOp::OpEqualFace // face controls
<< SMESHOp::OpAspectRatio3D << SMESHOp::OpVolume
<< SMESHOp::OpMaxElementLength3D << SMESHOp::OpBareBorderVolume
<< SMESHOp::OpOverConstrainedVolume << SMESHOp::OpEqualVolume; // volume controls
QActionGroup* aCtrlGroup = new QActionGroup( application()->desktop() );
aCtrlGroup->setExclusive( true );
for( int i = 0; i < aCtrlActions.size(); i++ )
aCtrlGroup->addAction( action( aCtrlActions[i] ) );
// ----- create menu --------------
int fileId = createMenu( tr( "MEN_FILE" ), -1, 1 ),
editId = createMenu( tr( "MEN_EDIT" ), -1, 3 ),
@ -3947,7 +3989,7 @@ void SMESHGUI::initialize( CAM_Application* app )
volumeId = createMenu( tr( "MEN_VOLUME_CTRL" ), ctrlId, -1, 10 ),
addId = createMenu( tr( "MEN_ADD" ), modifyId, 402 ),
removeId = createMenu( tr( "MEN_REMOVE" ), modifyId, 403 ),
renumId = createMenu( tr( "MEN_RENUM" ), modifyId, 404 ),
//renumId = createMenu( tr( "MEN_RENUM" ), modifyId, 404 ),
transfId = createMenu( tr( "MEN_TRANSF" ), modifyId, 405 ),
basicPropId = createMenu( tr( "MEN_BASIC_PROPERTIES" ), measureId, -1, 10 );
@ -4031,6 +4073,8 @@ void SMESHGUI::initialize( CAM_Application* app )
createMenu( SMESHOp::OpOverConstrainedVolume, volumeId, -1 );
createMenu( SMESHOp::OpEqualVolume, volumeId, -1 );
createMenu( separator(), ctrlId, -1 );
createMenu( SMESHOp::OpReset, ctrlId, -1 );
createMenu( separator(), ctrlId, -1 );
createMenu( SMESHOp::OpOverallMeshQuality, ctrlId, -1 );
createMenu( SMESHOp::OpNode, addId, -1 );
@ -4067,8 +4111,8 @@ void SMESHGUI::initialize( CAM_Application* app )
createMenu( separator(), removeId, -1 );
createMenu( SMESHOp::OpClearMesh, removeId, -1 );
createMenu( SMESHOp::OpRenumberingNodes, renumId, -1 );
createMenu( SMESHOp::OpRenumberingElements, renumId, -1 );
//createMenu( SMESHOp::OpRenumberingNodes, renumId, -1 );
//createMenu( SMESHOp::OpRenumberingElements, renumId, -1 );
createMenu( SMESHOp::OpTranslation, transfId, -1 );
createMenu( SMESHOp::OpRotation, transfId, -1 );
@ -4103,21 +4147,21 @@ void SMESHGUI::initialize( CAM_Application* app )
createMenu( SMESHOp::OpUpdate, viewId, -1 );
// ----- create toolbars --------------
int meshTb = createTool( tr( "TB_MESH" ) ),
info = createTool( tr( "TB_INFO" ) ),
groupTb = createTool( tr( "TB_GROUP" ) ),
ctrl0dTb = createTool( tr( "TB_CTRL0D" ) ),
ctrl1dTb = createTool( tr( "TB_CTRL1D" ) ),
ctrl2dTb = createTool( tr( "TB_CTRL2D" ) ),
ctrl3dTb = createTool( tr( "TB_CTRL3D" ) ),
addElemTb = createTool( tr( "TB_ADD" ) ),
addNonElemTb = createTool( tr( "TB_ADDNON" ) ),
remTb = createTool( tr( "TB_REM" ) ),
renumbTb = createTool( tr( "TB_RENUMBER" ) ),
transformTb = createTool( tr( "TB_TRANSFORM" ) ),
modifyTb = createTool( tr( "TB_MODIFY" ) ),
measuremTb = createTool( tr( "TB_MEASUREM" ) ),
dispModeTb = createTool( tr( "TB_DISP_MODE" ) );
int meshTb = createTool( tr( "TB_MESH" ), QString( "SMESHMeshToolbar" ) ),
info = createTool( tr( "TB_INFO" ), QString( "SMESHInformationToolbar" ) ),
groupTb = createTool( tr( "TB_GROUP" ), QString( "SMESHGroupToolbar" ) ),
ctrl0dTb = createTool( tr( "TB_CTRL0D" ), QString( "SMESHNodeControlsToolbar" ) ),
ctrl1dTb = createTool( tr( "TB_CTRL1D" ), QString( "SMESHEdgeControlsToolbar" ) ),
ctrl2dTb = createTool( tr( "TB_CTRL2D" ), QString( "SMESHFaceControlsToolbar" ) ),
ctrl3dTb = createTool( tr( "TB_CTRL3D" ), QString( "SMESHVolumeControlsToolbar" ) ),
addElemTb = createTool( tr( "TB_ADD" ), QString( "SMESHAddElementToolbar" ) ),
addNonElemTb = createTool( tr( "TB_ADDNON" ), QString( "SMESHAddElementToolbar" ) ),
remTb = createTool( tr( "TB_REM" ), QString( "SMESHRemoveToolbar" ) ),
//renumbTb = createTool( tr( "TB_RENUMBER" ), QString( "SMESHRenumberingToolbar" ) ),
transformTb = createTool( tr( "TB_TRANSFORM" ), QString( "SMESHTransformationToolbar" ) ),
modifyTb = createTool( tr( "TB_MODIFY" ), QString( "SMESHModificationToolbar" ) ),
measuremTb = createTool( tr( "TB_MEASUREM" ), QString( "SMESHMeasurementsToolbar" ) ),
dispModeTb = createTool( tr( "TB_DISP_MODE" ), QString( "SMESHDisplayModeToolbar" ) );
createTool( SMESHOp::OpCreateMesh, meshTb );
createTool( SMESHOp::OpCreateSubMesh, meshTb );
@ -4201,8 +4245,8 @@ void SMESHGUI::initialize( CAM_Application* app )
createTool( SMESHOp::OpRemoveOrphanNodes, remTb );
createTool( SMESHOp::OpClearMesh, remTb );
createTool( SMESHOp::OpRenumberingNodes, renumbTb );
createTool( SMESHOp::OpRenumberingElements, renumbTb );
//createTool( SMESHOp::OpRenumberingNodes, renumbTb );
//createTool( SMESHOp::OpRenumberingElements, renumbTb );
createTool( SMESHOp::OpTranslation, transformTb );
createTool( SMESHOp::OpRotation, transformTb );
@ -4413,6 +4457,11 @@ void SMESHGUI::initialize( CAM_Application* app )
popupMgr()->insert( separator(), anId, -1 );
popupMgr()->insert( action( SMESHOp::OpDEChoose ), anId, -1 );
popupMgr()->setRule( action( SMESHOp::OpDEChoose ), aClient + "&&" + aType + "&&" + isNotEmpty, QtxPopupMgr::VisibleRule );
popupMgr()->insert( separator(), anId, -1 );
popupMgr()->insert( action( SMESHOp::OpDEAllEntity ), anId, -1 );
popupMgr()->setRule( action( SMESHOp::OpDEAllEntity ), aDiffElemsInVTK + "&& isVisible && not( elemTypes in entityMode )", QtxPopupMgr::VisibleRule );
@ -4731,6 +4780,8 @@ bool SMESHGUI::deactivateModule( SUIT_Study* study )
void SMESHGUI::studyClosed( SUIT_Study* s )
{
if( !s )
return;
SMESH::RemoveVisuData( s->id() );
SalomeApp_Module::studyClosed( s );
}
@ -4879,7 +4930,7 @@ void SMESHGUI::createPreferences()
addPreference( tr( "PREF_PRECISION_USE" ), qaGroup, LightApp_Preferences::Bool, "SMESH", "use_precision" );
int prec = addPreference( tr( "PREF_PRECISION_VALUE" ), qaGroup, LightApp_Preferences::IntSpin, "SMESH", "controls_precision" );
setPreferenceProperty( prec, "min", 0 );
setPreferenceProperty( prec, "max", 16 );
setPreferenceProperty( prec, "max", 100 );
int doubleNodesTol = addPreference( tr( "PREF_EQUAL_NODES_TOL" ), qaGroup, LightApp_Preferences::DblSpin, "SMESH", "equal_nodes_tolerance" );
setPreferenceProperty( doubleNodesTol, "precision", 10 );
setPreferenceProperty( doubleNodesTol, "min", 0.0000000001 );
@ -6901,7 +6952,7 @@ SALOMEDS::Color SMESHGUI::getPredefinedUniqueColor()
}
}
}
static int currentColor = 0;
static int currentColor = randomize( colors.size() );
SALOMEDS::Color color;
color.R = (double)colors[currentColor].red() / 255.0;

View File

@ -463,9 +463,7 @@ void SMESHGUI_Add0DElemsOnAllNodesOp::onSelTypeChange(int selType)
//================================================================================
/*!
* \brief Install
*
*
* \brief Install filters
*/
//================================================================================

View File

@ -586,6 +586,7 @@ void SMESHGUI_AddMeshElementDlg::ClickOnApply()
SMESH::long_array_var anIdList = new SMESH::long_array;
anIdList->length( 1 );
anIdList[0] = -1;
const bool onlyNodesInMesh = ( myMesh->NbElements() == 0 );
switch (myElementType) {
case SMDSAbs_0DElement:
@ -645,8 +646,10 @@ void SMESHGUI_AddMeshElementDlg::ClickOnApply()
mySelectionMgr->setSelectedObjects( aList, false );
mySimulation->SetVisibility(false);
if ( onlyNodesInMesh )
myActor->SetRepresentation( SMESH_Actor::eEdge ); // wireframe
SMESH::UpdateView();
buttonOk->setEnabled(false);
buttonApply->setEnabled(false);

View File

@ -166,9 +166,10 @@ SMESHGUI_CopyMeshDlg::SMESHGUI_CopyMeshDlg( SMESHGUI* theModule )
myCopyGroupsCheck = new QCheckBox(tr("SMESH_MAKE_GROUPS"), GroupArguments);
myCopyGroupsCheck->setChecked(false);
// CheckBox for keeping ids
// CheckBox for keeping ids ( OBSOLETE )
myKeepIdsCheck = new QCheckBox(tr("SMESH_KEEP_IDS"), GroupArguments);
myKeepIdsCheck->setChecked(true);
myKeepIdsCheck->hide();
// layout
GroupArgumentsLayout->addWidget(myTextLabelElements, 0, 0);
@ -178,7 +179,7 @@ SMESHGUI_CopyMeshDlg::SMESHGUI_CopyMeshDlg( SMESHGUI* theModule )
GroupArgumentsLayout->addWidget(meshNameLabel, 2, 0);
GroupArgumentsLayout->addWidget(myMeshNameEdit, 2, 1, 1, 5);
GroupArgumentsLayout->addWidget(myCopyGroupsCheck, 3, 0, 1, 6);
GroupArgumentsLayout->addWidget(myKeepIdsCheck, 4, 0, 1, 6);
// GroupArgumentsLayout->addWidget(myKeepIdsCheck, 4, 0, 1, 6);
/***************************************************************/
GroupButtons = new QGroupBox(this);

View File

@ -43,7 +43,6 @@
#include <LightApp_SelectionMgr.h>
#include <SALOME_ListIO.hxx>
#include <SALOME_ListIteratorOfListIO.hxx>
#include <SVTK_Selection.h>
#include <SVTK_ViewWindow.h>

View File

@ -0,0 +1,247 @@
// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
//
// 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.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : SMESHGUI_DisplayEntitiesDlg.cxx
// Author : Alexander KOVALEV, Open CASCADE S.A.S. (alexander.kovalev@opencascade.com)
#include "SMESHGUI_DisplayEntitiesDlg.h"
#include "SMESHGUI.h"
#include "SMESHGUI_Utils.h"
#include "SMESHGUI_VTKUtils.h"
#include "SMESHGUI_MeshUtils.h"
#include <QLabel>
#include <QGroupBox>
#include <QGridLayout>
#include <QVBoxLayout>
#include <QCheckBox>
#include <SUIT_Session.h>
#include <SUIT_MessageBox.h>
#include <SUIT_ResourceMgr.h>
#include <LightApp_Application.h>
#include <LightApp_SelectionMgr.h>
#include <SALOME_ListIO.hxx>
const int MARGIN = 9;
const int SPACING = 6;
/*!
\class SMESHGUI_DisplayEntitiesDlg
\brief Dialog box to select entities to be displayed in viewer
*/
/*
\brief Constructor
\param parent parent widget
*/
SMESHGUI_DisplayEntitiesDlg::SMESHGUI_DisplayEntitiesDlg( QWidget* parent )
: SMESHGUI_Dialog( parent, true, false, Standard )
{
SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
LightApp_SelectionMgr* mgr = SMESHGUI::selectionMgr();
SALOME_ListIO selected;
mgr->selectedObjects( selected );
SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_nil();
myActor = 0;
myNbCheckedButtons = 0;
SALOME_ListIteratorOfListIO it( selected );
myIObject = selected.First();
if ( myIObject->hasEntry() ) {
myActor = SMESH::FindActorByEntry( myIObject->getEntry() );
}
myEntityMode = myActor ? myActor->GetEntityMode() : 0;
aMesh = SMESH::GetMeshByIO( myIObject );
// set title
setWindowTitle( tr( "MEN_DISP_ENT" ) );
// create widgets
QGroupBox* anEntitiesGrp = new QGroupBox( tr( "SMESH_MESHINFO_ENTITIES" ), mainFrame() );
QGridLayout* hl = new QGridLayout( anEntitiesGrp );
hl->setMargin( MARGIN );
hl->setSpacing( SPACING );
int nbElements;
// 0DElements
nbElements = myActor ? myActor->GetObject()->GetNbEntities( SMDSAbs_0DElement ) : aMesh->Nb0DElements();
my0DElemsTB = new QCheckBox( tr("SMESH_ELEMS0D"), anEntitiesGrp );
my0DElemsTB->setIcon( QIcon( aResMgr->loadPixmap( "SMESH", tr( "ICON_DLG_ELEM0D" ) ) ) );
bool has0DElems = myEntityMode & SMESH_Actor::e0DElements;
my0DElemsTB->setChecked( has0DElems );
if ( has0DElems )
myNbCheckedButtons++;
connect( my0DElemsTB, SIGNAL(toggled(bool)), this, SLOT(onChangeEntityMode(bool)) );
QLabel* nb0DElemsLab = new QLabel( QString("%1").arg(nbElements).toLatin1().data(), anEntitiesGrp );
hl->addWidget( my0DElemsTB, 0, 0 );
hl->addWidget( nb0DElemsLab, 0, 1 );
my0DElemsTB->setEnabled( nbElements );
nb0DElemsLab->setEnabled( nbElements );
// Edges
nbElements = myActor ? myActor->GetObject()->GetNbEntities( SMDSAbs_Edge ) : aMesh->NbEdges();
myEdgesTB = new QCheckBox( tr("SMESH_EDGES"), anEntitiesGrp );
myEdgesTB->setIcon( QIcon( aResMgr->loadPixmap( "SMESH", tr( "ICON_DLG_EDGE" ) ) ) );
bool hasEdges = myEntityMode & SMESH_Actor::eEdges;
myEdgesTB->setChecked( hasEdges );
if ( hasEdges )
myNbCheckedButtons++;
connect( myEdgesTB, SIGNAL(toggled(bool)), this, SLOT(onChangeEntityMode(bool)) );
QLabel* nbEdgesLab = new QLabel( QString("%1").arg(nbElements).toLatin1().data(), anEntitiesGrp );
hl->addWidget( myEdgesTB, 1, 0 );
hl->addWidget( nbEdgesLab, 1, 1 );
myEdgesTB->setEnabled( nbElements );
nbEdgesLab->setEnabled( nbElements );
// Faces
nbElements = myActor ? myActor->GetObject()->GetNbEntities( SMDSAbs_Face ) : aMesh->NbFaces();
myFacesTB = new QCheckBox( tr("SMESH_FACES"), anEntitiesGrp );
myFacesTB->setIcon( QIcon( aResMgr->loadPixmap( "SMESH", tr( "ICON_DLG_TRIANGLE" ) ) ) );
bool hasFaces = myEntityMode & SMESH_Actor::eFaces;
myFacesTB->setChecked( hasFaces );
if ( hasFaces )
myNbCheckedButtons++;
connect( myFacesTB, SIGNAL(toggled(bool)), this, SLOT(onChangeEntityMode(bool)) );
QLabel* nbFacesLab = new QLabel( QString("%1").arg(nbElements).toLatin1().data(), anEntitiesGrp );
hl->addWidget( myFacesTB, 2, 0 );
hl->addWidget( nbFacesLab, 2, 1 );
myFacesTB->setEnabled( nbElements );
nbFacesLab->setEnabled( nbElements );
// Volumes
nbElements = myActor ? myActor->GetObject()->GetNbEntities( SMDSAbs_Volume ) : aMesh->NbVolumes();
myVolumesTB = new QCheckBox( tr("SMESH_VOLUMES"), anEntitiesGrp );
myVolumesTB->setIcon( QIcon( aResMgr->loadPixmap( "SMESH", tr( "ICON_DLG_TETRAS" ) ) ) );
bool hasVolumes = myEntityMode & SMESH_Actor::eVolumes;
myVolumesTB->setChecked( hasVolumes );
if ( hasVolumes )
myNbCheckedButtons++;
connect( myVolumesTB, SIGNAL(toggled(bool)), this, SLOT(onChangeEntityMode(bool) ) );
QLabel* nbVolumesLab = new QLabel( QString("%1").arg(nbElements).toLatin1().data(), anEntitiesGrp );
hl->addWidget( myVolumesTB, 3, 0 );
hl->addWidget( nbVolumesLab, 3, 1 );
myVolumesTB->setEnabled( nbElements );
nbVolumesLab->setEnabled( nbElements );
// Balls
nbElements = myActor ? myActor->GetObject()->GetNbEntities( SMDSAbs_Ball ) : aMesh->NbBalls();
myBallsTB = new QCheckBox( tr("SMESH_BALLS"), anEntitiesGrp );
myBallsTB->setIcon( QIcon( aResMgr->loadPixmap( "SMESH", tr( "ICON_DLG_BALL" ) ) ) );
bool hasBalls = myEntityMode & SMESH_Actor::eBallElem;
myBallsTB->setChecked( hasBalls );
if ( hasBalls )
myNbCheckedButtons++;
connect( myBallsTB, SIGNAL(toggled(bool)), this, SLOT(onChangeEntityMode(bool)) );
QLabel* nbBallsLab = new QLabel( QString("%1").arg(nbElements).toLatin1().data(), anEntitiesGrp );
hl->addWidget( myBallsTB, 4, 0 );
hl->addWidget( nbBallsLab, 4, 1 );
myBallsTB->setEnabled( nbElements );
nbBallsLab->setEnabled( nbElements );
QVBoxLayout* aDlgLay = new QVBoxLayout( mainFrame() );
aDlgLay->setMargin( 0 );
aDlgLay->setSpacing( SPACING );
aDlgLay->addWidget( anEntitiesGrp );
button( OK )->setText( tr( "SMESH_BUT_OK" ) );
connect( this, SIGNAL( dlgHelp() ), this, SLOT( onHelp() ) );
connect( this, SIGNAL( dlgOk() ), this, SLOT( onOk() ) );
}
/*
\brief Destructor: clean-up resources if necessary
*/
SMESHGUI_DisplayEntitiesDlg::~SMESHGUI_DisplayEntitiesDlg()
{
}
void SMESHGUI_DisplayEntitiesDlg::InverseEntityMode(unsigned int& theOutputMode,
unsigned int theMode)
{
bool anIsNotPresent = ~theOutputMode & theMode;
if(anIsNotPresent)
theOutputMode |= theMode;
else
theOutputMode &= ~theMode;
}
/*!
\brief Slot for changing entities state
*/
void SMESHGUI_DisplayEntitiesDlg::onChangeEntityMode( bool isChecked )
{
QCheckBox* aSender = (QCheckBox*)sender();
if ( myNbCheckedButtons == 1 && !isChecked ) {
SUIT_MessageBox::warning(this, tr("SMESH_WRN_WARNING"),
tr("WRN_AT_LEAST_ONE"));
disconnect( aSender, SIGNAL(toggled(bool)), this, SLOT(onChangeEntityMode(bool)) );
aSender->setChecked( true );
connect( aSender, SIGNAL(toggled(bool)), this, SLOT(onChangeEntityMode(bool)) );
return;
}
if ( my0DElemsTB == aSender )
InverseEntityMode( myEntityMode, SMESH_Actor::e0DElements );
else if ( myEdgesTB == aSender )
InverseEntityMode( myEntityMode, SMESH_Actor::eEdges );
else if ( myFacesTB == aSender )
InverseEntityMode( myEntityMode, SMESH_Actor::eFaces );
else if ( myVolumesTB == aSender )
InverseEntityMode( myEntityMode, SMESH_Actor::eVolumes );
else if ( myBallsTB == aSender )
InverseEntityMode( myEntityMode, SMESH_Actor::eBallElem );
isChecked ? myNbCheckedButtons++ : myNbCheckedButtons--;
}
/*!
\brief Show online help on dialog box
*/
void SMESHGUI_DisplayEntitiesDlg::onHelp()
{
LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
app->onHelpContextModule( "SMESH", "display_entity_page.html" );
}
/*!
\brief Display or update the mesh in the 3D view with selected entity mode
*/
void SMESHGUI_DisplayEntitiesDlg::onOk()
{
const char* entry = myIObject->getEntry();
if ( !myActor ) {
myActor = SMESH::CreateActor(SMESH::GetActiveStudyDocument(),
entry, true);
}
if( myEntityMode != myActor->GetEntityMode() ) {
myActor->SetEntityMode(myEntityMode);
SUIT_ViewWindow* wnd = SMESH::GetActiveWindow();
SMESH::DisplayActor( wnd, myActor );
SUIT_DataOwnerPtrList aList;
aList.append( new LightApp_DataOwner( entry ) );
SMESHGUI::selectionMgr()->setSelected( aList, false );
SMESH::UpdateView( wnd, SMESH::eDisplay, entry );
}
}

View File

@ -0,0 +1,61 @@
// Copyright (C) 2014 CEA/DEN, EDF R&D, OPEN CASCADE
//
// 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.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
// File : SMESHGUI_DisplayEntitiesDlg.h
// Author : Alexander KOVALEV, Open CASCADE S.A.S. (alexander.kovalev@opencascade.com)
#ifndef SMESHGUI_DISPLAYENTITIES_H
#define SMESHGUI_DISPLAYENTITIES_H
#include "SMESHGUI_Dialog.h"
#include "SMESH_SMESHGUI.hxx"
#include <SMESH_Actor.h>
class QCheckBox;
class SMESHGUI_EXPORT SMESHGUI_DisplayEntitiesDlg : public SMESHGUI_Dialog
{
Q_OBJECT
public:
SMESHGUI_DisplayEntitiesDlg( QWidget* parent );
~SMESHGUI_DisplayEntitiesDlg();
private:
void InverseEntityMode( unsigned int& theOutputMode,
unsigned int theMode );
private slots:
void onOk();
void onHelp();
void onChangeEntityMode( bool isChecked );
private:
Handle(SALOME_InteractiveObject) myIObject;
unsigned int myEntityMode;
SMESH_Actor *myActor;
int myNbCheckedButtons;
QCheckBox* my0DElemsTB;
QCheckBox* myEdgesTB;
QCheckBox* myFacesTB;
QCheckBox* myVolumesTB;
QCheckBox* myBallsTB;
};
#endif // SMESHGUI_DISPLAYENTITIES_H

View File

@ -48,7 +48,6 @@
#include <SVTK_ViewWindow.h>
#include <SALOME_ListIO.hxx>
#include <SALOME_ListIteratorOfListIO.hxx>
// Qt includes
#include <QApplication>

View File

@ -860,7 +860,7 @@ void SMESHGUI_ExtrusionDlg::SelectionIntoArgument()
else
return;
} else {
// get indices of selcted elements
// get indices of selected elements
TColStd_IndexedMapOfInteger aMapIndex;
mySelector->GetIndex(IO,aMapIndex);
aNbElements = aMapIndex.Extent();

View File

@ -62,8 +62,6 @@
#include <SalomeApp_DoubleSpinBox.h>
#include <SALOME_ListIO.hxx>
#include <SALOME_ListIteratorOfListIO.hxx>
#include <SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger.hxx>
#include <SVTK_ViewWindow.h>
@ -1956,7 +1954,10 @@ void SMESHGUI_FilterTable::onCriterionChanged (const int row, const int col, con
break;
}
case 3: {
int oldValue = aCompareItem->value();
aCompareItem->setItems(getCompare());
if ( oldValue >= 0 )
aCompareItem->setValue( oldValue );
break;
}
}

View File

@ -82,20 +82,25 @@ namespace SMESH
return GEOM::GEOM_Object::_nil();
}
GEOM::GEOM_Object_ptr GetGeom (_PTR(SObject) theSO)
GEOM::GEOM_Object_var GetGeom (_PTR(SObject) theSO)
{
GEOM::GEOM_Object_var aMeshShape;
if (!theSO)
return GEOM::GEOM_Object::_nil();
return aMeshShape;
CORBA::Object_var obj = _CAST( SObject,theSO )->GetObject();
aMeshShape = GEOM::GEOM_Object::_narrow( obj );
if ( !aMeshShape->_is_nil() )
return aMeshShape;
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
if (!aStudy)
return GEOM::GEOM_Object::_nil();
return aMeshShape;
_PTR(ChildIterator) anIter (aStudy->NewChildIterator(theSO));
for ( ; anIter->More(); anIter->Next()) {
_PTR(SObject) aSObject = anIter->Value();
_PTR(SObject) aRefSOClient;
GEOM::GEOM_Object_var aMeshShape;
if (aSObject->ReferencedObject(aRefSOClient)) {
SALOMEDS_SObject* aRefSO = _CAST(SObject,aRefSOClient);
@ -104,11 +109,10 @@ namespace SMESH
SALOMEDS_SObject* aSO = _CAST(SObject,aSObject);
aMeshShape = GEOM::GEOM_Object::_narrow(aSO->GetObject());
}
if (!aMeshShape->_is_nil())
return aMeshShape._retn();
if ( !aMeshShape->_is_nil() )
return aMeshShape;
}
return GEOM::GEOM_Object::_nil();
return aMeshShape;
}
SMESHGUI_EXPORT char* GetGeomName( _PTR(SObject) smeshSO )

View File

@ -47,7 +47,7 @@ namespace SMESH
SMESHGUI_EXPORT GEOM::GEOM_Object_var GetShapeOnMeshOrSubMesh( _PTR(SObject), bool* isMesh=0 );
SMESHGUI_EXPORT GEOM::GEOM_Object_ptr GetGeom( _PTR(SObject) );
SMESHGUI_EXPORT GEOM::GEOM_Object_var GetGeom( _PTR(SObject) );
SMESHGUI_EXPORT char* GetGeomName( _PTR(SObject) smeshSO );

View File

@ -61,7 +61,6 @@
#include <LightApp_SelectionMgr.h>
#include <SALOME_ListIO.hxx>
#include <SALOME_ListIteratorOfListIO.hxx>
#include <SVTK_ViewWindow.h>

View File

@ -59,7 +59,6 @@
#include <QKeyEvent>
#include <QListWidget>
#include <QButtonGroup>
#include <SALOME_ListIteratorOfListIO.hxx>
#include <QComboBox>
#include <QtxColorButton.h>

View File

@ -670,7 +670,7 @@ void SMESHGUI_HypothesisDlg::onHelp()
if (app) {
QString name = "SMESH";
if(myCreator) {
QVariant pluginName = myCreator->property( PLUGIN_NAME );
QVariant pluginName = myCreator->property( SMESH::Plugin_Name() );
if( pluginName.isValid() ) {
QString rootDir = pluginName.toString() + "PLUGIN_ROOT_DIR";
QString varValue = QString( getenv(rootDir.toLatin1().constData()));

View File

@ -128,7 +128,7 @@ namespace SMESH
}
else
{
QObject::tr(QString("SMESH_HYP_%1").arg(theHypStatus).toLatin1().data());
aMsg += QObject::tr(QString("SMESH_HYP_%1").arg(theHypStatus).toLatin1().data());
if ( theHypStatus == SMESH::HYP_HIDDEN_ALGO ) { // PAL18501
CORBA::String_var hypType = theHyp->GetName();
@ -469,7 +469,7 @@ namespace SMESH
// It is used to obtain plugin root dir environment variable
// in the SMESHGUI_HypothesisDlg class. Plugin root dir environment
// variable is used to display documentation.
aCreator->setProperty(PLUGIN_NAME,aHypData->PluginName);
aCreator->setProperty(SMESH::Plugin_Name(),aHypData->PluginName);
}
}
}
@ -511,10 +511,14 @@ namespace SMESH
return SMESH::SMESH_Hypothesis::_nil();
}
bool IsApplicable(const QString& aHypType,
GEOM::GEOM_Object_ptr theGeomObject,
const bool toCheckAll)
{
if ( getenv("NO_LIMIT_ALGO_BY_SHAPE")) // allow a workaround for a case if
return true; // IsApplicable() returns false due to a bug
HypothesisData* aHypData = GetHypothesisData(aHypType);
QString aServLib = aHypData->ServerLibName;
return SMESHGUI::GetSMESHGen()->IsApplicable( aHypType.toLatin1().data(),

View File

@ -58,8 +58,6 @@ class SALOMEDSClient_SObject;
class algo_error_array;
#define PLUGIN_NAME "PLUGIN_NAME"
namespace SMESH
{
SMESHGUI_EXPORT
@ -119,6 +117,10 @@ namespace SMESH
SMESHGUI_EXPORT
QString GetMessageOnAlgoStateErrors( const algo_error_array& );
SMESHGUI_EXPORT
// name of proprty saving plug-in of a hypothesis
inline const char* Plugin_Name() { return "PLUGIN_NAME"; }
}
#endif // SMESHGUI_HYPOTHESESUTILS_H

View File

@ -716,17 +716,17 @@ void SMESHGUI_MakeNodeAtPointOp::redisplayPreview()
myDlg->myDestinationZ->SetValue(z);
}
if ( myDestCoordChanged ) {
dx = myDlg->myDestinationX->GetValue() - myDlg->myCurrentX->GetValue();
dy = myDlg->myDestinationY->GetValue() - myDlg->myCurrentY->GetValue();
dz = myDlg->myDestinationZ->GetValue() - myDlg->myCurrentZ->GetValue();
dx = myDlg->myDestinationX->GetValue() - x;
dy = myDlg->myDestinationY->GetValue() - y;
dz = myDlg->myDestinationZ->GetValue() - z;
myDlg->myDestDX->SetValue(dx);
myDlg->myDestDY->SetValue(dy);
myDlg->myDestDZ->SetValue(dz);
}
else {
dx = myDlg->myDestDX->GetValue() + myDlg->myCurrentX->GetValue();;
dy = myDlg->myDestDY->GetValue() + myDlg->myCurrentY->GetValue();;
dz = myDlg->myDestDZ->GetValue() + myDlg->myCurrentZ->GetValue();;
dx = myDlg->myDestDX->GetValue() + x;
dy = myDlg->myDestDY->GetValue() + y;
dz = myDlg->myDestDZ->GetValue() + z;
myDlg->myDestinationX->SetValue(dx);
myDlg->myDestinationY->SetValue(dy);
myDlg->myDestinationZ->SetValue(dz);

View File

@ -36,7 +36,7 @@
#include <SUIT_OverrideCursor.h>
#include <SUIT_ResourceMgr.h>
#include <SVTK_ViewWindow.h>
#include <SALOME_ListIteratorOfListIO.hxx>
#include <SALOME_ListIO.hxx>
#include <QButtonGroup>
#include <QGridLayout>

View File

@ -171,6 +171,7 @@ void SMESHGUI_MeshTab::addItem( const QString& txt, const int type, const int in
if ( type <= AddHyp )
{
myHypCombo[ type ]->addItem( txt, QVariant( index ));
myHypCombo[ type ]->setMaxVisibleItems( qMax( 10, myHypCombo[ type ]->count() ) );
}
else
{

View File

@ -126,8 +126,9 @@ vtkIdType getCellType( const SMDSAbs_ElementType theType,
{
switch( theType )
{
case SMDSAbs_Ball: return VTK_VERTEX;
case SMDSAbs_Node: return VTK_VERTEX;
case SMDSAbs_Edge:
case SMDSAbs_Edge:
if( theNbNodes == 2 ) return VTK_LINE;
else if ( theNbNodes == 3 ) return VTK_QUADRATIC_EDGE;
else return VTK_EMPTY_CELL;

View File

@ -506,8 +506,9 @@ void SMESHGUI_MeshInfo::showInfo( SMESH::SMESH_IDSource_ptr obj )
long nb2DLinear = info[SMDSEntity_Triangle] + info[SMDSEntity_Quadrangle] + info[SMDSEntity_Polygon];
long nb2DQuadratic = info[SMDSEntity_Quad_Triangle] + info[SMDSEntity_Quad_Quadrangle];
long nb2DBiQuadratic = info[SMDSEntity_BiQuad_Triangle] + info[SMDSEntity_BiQuad_Quadrangle];
long nb2DTotal = nb2DLinear + nb2DQuadratic + nb2DBiQuadratic;
myWidgets[i2D][iTotal] ->setProperty( "text", QString::number( nb2DLinear + nb2DQuadratic ));
myWidgets[i2D][iTotal] ->setProperty( "text", QString::number( nb2DTotal ));
myWidgets[i2D][iLinear] ->setProperty( "text", QString::number( nb2DLinear ) );
myWidgets[i2D][iQuadratic] ->setProperty( "text", QString::number( nb2DQuadratic ) );
myWidgets[i2D][iBiQuadratic] ->setProperty( "text", QString::number( nb2DBiQuadratic ) );
@ -524,10 +525,11 @@ void SMESHGUI_MeshInfo::showInfo( SMESH::SMESH_IDSource_ptr obj )
long nbHexahedrons = info[SMDSEntity_Hexa] + info[SMDSEntity_Quad_Hexa] + info[SMDSEntity_TriQuad_Hexa];
long nbPyramids = info[SMDSEntity_Pyramid] + info[SMDSEntity_Quad_Pyramid];
long nbPrisms = info[SMDSEntity_Penta] + info[SMDSEntity_Quad_Penta];
long nb3DLinear = info[SMDSEntity_Tetra] + info[SMDSEntity_Hexa] + info[SMDSEntity_Pyramid] + info[SMDSEntity_Penta] + info[SMDSEntity_Polyhedra] + info[SMDSEntity_Hexagonal_Prism];
long nb3DLinear = info[SMDSEntity_Tetra] + info[SMDSEntity_Hexa] + info[SMDSEntity_Pyramid] + info[SMDSEntity_Penta] + info[SMDSEntity_Polyhedra] + info[SMDSEntity_Hexagonal_Prism];
long nb3DQuadratic = info[SMDSEntity_Quad_Tetra] + info[SMDSEntity_Quad_Hexa] + info[SMDSEntity_Quad_Pyramid] + info[SMDSEntity_Quad_Penta];
long nb3DBiQuadratic = info[SMDSEntity_TriQuad_Hexa];
myWidgets[i3D][iTotal] ->setProperty( "text", QString::number( nb3DLinear + nb3DQuadratic ) );
long nb3DTotal = nb3DLinear + nb3DQuadratic + nb3DBiQuadratic;
myWidgets[i3D][iTotal] ->setProperty( "text", QString::number( nb3DTotal ) );
myWidgets[i3D][iLinear] ->setProperty( "text", QString::number( nb3DLinear ) );
myWidgets[i3D][iQuadratic] ->setProperty( "text", QString::number( nb3DQuadratic ) );
myWidgets[i3D][iBiQuadratic] ->setProperty( "text", QString::number( nb3DBiQuadratic ) );
@ -546,7 +548,7 @@ void SMESHGUI_MeshInfo::showInfo( SMESH::SMESH_IDSource_ptr obj )
myWidgets[i3DPrisms][iQuadratic] ->setProperty( "text", QString::number( info[SMDSEntity_Quad_Penta] ) );
myWidgets[i3DHexaPrisms][iTotal] ->setProperty( "text", QString::number( info[SMDSEntity_Hexagonal_Prism] ) );
myWidgets[i3DPolyhedrons][iTotal] ->setProperty( "text", QString::number( info[SMDSEntity_Polyhedra] ) );
long nbElemTotal = info[SMDSEntity_0D] + info[SMDSEntity_Ball] + nbEdges + nb2DLinear + nb2DQuadratic + nb2DBiQuadratic + nb3DLinear + nb3DQuadratic + nb3DBiQuadratic;
long nbElemTotal = info[SMDSEntity_0D] + info[SMDSEntity_Ball] + nbEdges + nb2DTotal + nb3DTotal;
long nbElemLinerial = info[SMDSEntity_Edge] + nb2DLinear + nb3DLinear;
long nbElemQuadratic = info[SMDSEntity_Quad_Edge] + nb2DQuadratic + nb3DQuadratic;
long nbElemBiQuadratic = nb2DBiQuadratic + nb3DBiQuadratic;

View File

@ -26,15 +26,15 @@
#include "SMESHGUI_MeshOp.h"
#include "SMESHGUI.h"
#include "SMESHGUI_MeshDlg.h"
#include "SMESHGUI_ShapeByMeshDlg.h"
#include "SMESHGUI_HypothesesUtils.h"
#include "SMESHGUI_Hypotheses.h"
#include "SMESHGUI_Utils.h"
#include "SMESHGUI_GEOMGenUtils.h"
#include <SMESH_TypeFilter.hxx>
#include <SMESH_NumberFilter.hxx>
#include "SMESHGUI_Hypotheses.h"
#include "SMESHGUI_HypothesesUtils.h"
#include "SMESHGUI_MeshDlg.h"
#include "SMESHGUI_Operations.h"
#include "SMESHGUI_ShapeByMeshDlg.h"
#include "SMESHGUI_Utils.h"
#include "SMESH_NumberFilter.hxx"
#include "SMESH_TypeFilter.hxx"
// SALOME GEOM includes
#include <GEOM_SelectionFilter.h>
@ -247,8 +247,9 @@ void SMESHGUI_MeshOp::startOperation()
myDlg->activateObject( myIsMesh ? SMESHGUI_MeshDlg::Geom : SMESHGUI_MeshDlg::Mesh );
}
else
{
myDlg->activateObject( SMESHGUI_MeshDlg::Obj );
}
myDlg->setCurrentTab( SMESH::DIM_3D );
QStringList TypeMeshList;
@ -363,15 +364,39 @@ bool SMESHGUI_MeshOp::isSubshapeOk() const
// skl for NPAL14695 - implementation of searching of mainObj
GEOM::GEOM_Object_var mainObj = op->GetMainShape(aSubGeomVar); /* _var not _wrap as
mainObj already exists! */
while(1) {
if (mainObj->_is_nil())
return false;
while( !mainObj->_is_nil()) {
CORBA::String_var entry1 = mainObj->GetEntry();
CORBA::String_var entry2 = mainGeom->GetEntry();
if (std::string( entry1.in() ) == entry2.in() )
return true;
mainObj = op->GetMainShape(mainObj);
}
if ( aSubGeomVar->GetShapeType() == GEOM::COMPOUND )
{
// is aSubGeomVar a compound of sub-shapes?
GEOM::GEOM_IShapesOperations_wrap sop = geomGen->GetIShapesOperations(aStudy->StudyId());
if (sop->_is_nil()) return false;
GEOM::ListOfLong_var ids = sop->GetAllSubShapesIDs( aSubGeomVar,
GEOM::SHAPE,/*sorted=*/false);
if ( ids->length() > 0 )
{
ids->length( 1 );
GEOM::GEOM_Object_var compSub = geomGen->AddSubShape( aSubGeomVar, ids );
if ( !compSub->_is_nil() )
{
GEOM::ListOfGO_var shared = sop->GetSharedShapes( mainGeom,
compSub,
compSub->GetShapeType() );
geomGen->RemoveObject( compSub );
compSub->UnRegister();
if ( shared->length() > 0 ) {
geomGen->RemoveObject( shared[0] );
shared[0]->UnRegister();
}
return ( shared->length() > 0 );
}
}
}
}
}
@ -380,8 +405,8 @@ bool SMESHGUI_MeshOp::isSubshapeOk() const
//================================================================================
/*!
* \brief Return name of the algorithm that does not support submeshes and makes
* submesh creation useless
* \brief Return name of the algorithm that does not support sub-meshes and makes
* sub-mesh creation useless
* \retval char* - string is to be deleted!!!
*/
//================================================================================
@ -847,7 +872,7 @@ void SMESHGUI_MeshOp::availableHyps( const int theDim,
theDataList.clear();
theHyps.clear();
bool isAlgo = ( theHypType == Algo );
bool isAux = ( theHypType == AddHyp );
bool isAux = ( theHypType >= AddHyp );
QStringList aHypTypeNameList = SMESH::GetAvailableHypotheses( isAlgo, theDim, isAux, myIsOnGeometry, !myIsMesh );
QStringList::const_iterator anIter;
@ -906,7 +931,7 @@ void SMESHGUI_MeshOp::existingHyps( const int theDim,
else
aPart = theHypType == Algo ? SMESH::Tag_AlgorithmsRoot : SMESH::Tag_HypothesisRoot;
const bool isAux = ( theHypType == AddHyp );
const bool isAux = ( theHypType >= AddHyp );
const bool allHyps = ( !isMesh && theHypType != Algo && theDim > -1);
if ( theFather->FindSubObject( aPart, aHypRoot ) )
@ -1489,14 +1514,24 @@ void SMESHGUI_MeshOp::onAlgoSelected( const int theIndex,
{
if ( !isAccessibleDim( dim ))
continue;
for ( int dlgType = MainHyp; dlgType < nbDlgHypTypes(dim); dlgType++ )
// get indices of selected hyps
const int nbTypes = nbDlgHypTypes(dim);
std::vector<int> hypIndexByType( nbTypes, -1 );
for ( int dlgType = MainHyp; dlgType < nbTypes; dlgType++ )
{
hypIndexByType[ dlgType ] = currentHyp( dim, dlgType );
}
// update hyps
for ( int dlgType = MainHyp; dlgType < nbTypes; dlgType++ )
{
const int type = Min( dlgType, AddHyp );
myAvailableHypData[ dim ][ type ].clear();
QStringList anAvailable, anExisting;
HypothesisData* curAlgo = algoByDim[ dim ];
int hypIndex = currentHyp( dim, dlgType );
int hypIndex = hypIndexByType[ dlgType ];
SMESH::SMESH_Hypothesis_var curHyp;
if ( hypIndex >= 0 && hypIndex < myExistingHyps[ dim ][ type ].count() )
@ -1535,24 +1570,26 @@ void SMESHGUI_MeshOp::onAlgoSelected( const int theIndex,
defaulHypAvlbl = (type == MainHyp && !curAlgo->IsAuxOrNeedHyp );
}
// set list of hypotheses
myDlg->tab( dim )->setAvailableHyps( type, anAvailable );
myDlg->tab( dim )->setExistingHyps( type, anExisting, defaulHypAvlbl );
if ( dlgType <= AddHyp )
{
myDlg->tab( dim )->setAvailableHyps( type, anAvailable );
myDlg->tab( dim )->setExistingHyps( type, anExisting, defaulHypAvlbl );
}
// set current existing hypothesis
if ( !curHyp->_is_nil() && !anExisting.isEmpty() )
hypIndex = this->find( curHyp, myExistingHyps[ dim ][ type ]);
else
hypIndex = -1;
if ( !isSubmesh && hypIndex < 0 && anExisting.count() == 1 ) {
if ( !isSubmesh && myToCreate && hypIndex < 0 && anExisting.count() == 1 ) {
// none is yet selected => select the sole existing if it is not optional
CORBA::String_var hypTypeName = myExistingHyps[ dim ][ type ].first().first->GetName();
bool isOptional = true;
if ( algoByDim[ dim ] &&
SMESH::IsAvailableHypothesis( algoByDim[ dim ], hypTypeName.in(), isOptional ) &&
!isOptional )
SMESH::IsAvailableHypothesis( algoByDim[ dim ], hypTypeName.in(), isOptional ) &&
!isOptional )
hypIndex = 0;
}
setCurrentHyp( dim, type, hypIndex );
setCurrentHyp( dim, dlgType, hypIndex );
}
}
}
@ -2371,7 +2408,7 @@ bool SMESHGUI_MeshOp::checkSubMeshConcurrency(SMESH::SMESH_Mesh_ptr mesh,
myDlg->setEnabled( false ); // disactivate selection
selectionMgr()->clearFilters();
selectObject( meshSO );
SMESHGUI::GetSMESHGUI()->OnGUIEvent( 713 ); // MESH_ORDER
SMESHGUI::GetSMESHGUI()->OnGUIEvent( SMESHOp::OpMeshOrder ); // MESH_ORDER
qApp->processEvents();
myDlg->setEnabled( true );
@ -2578,11 +2615,11 @@ void SMESHGUI_MeshOp::setFilteredAlgoData( const int theTabIndex, const int theI
bool toCheckIsApplicableToAll = !myIsMesh;
GEOM::GEOM_Object_var aGeomVar;
QString anEntry = myDlg->selectedObject( SMESHGUI_MeshDlg::Geom );
QString anEntry =
myDlg->selectedObject( myToCreate ? SMESHGUI_MeshDlg::Geom : SMESHGUI_MeshDlg::Obj );
if ( _PTR(SObject) so = studyDS()->FindObjectID( anEntry.toLatin1().data() ))
{
CORBA::Object_var obj = _CAST( SObject,so )->GetObject();
aGeomVar = GEOM::GEOM_Object::_narrow( obj );
aGeomVar = SMESH::GetGeom( so );
if ( !aGeomVar->_is_nil() && toCheckIsApplicableToAll )
toCheckIsApplicableToAll = ( aGeomVar->GetType() == GEOM_GROUP );
}

View File

@ -53,7 +53,6 @@
#include <LightApp_SelectionMgr.h>
#include <LightApp_Application.h>
#include <SALOME_ListIO.hxx>
#include <SALOME_ListIteratorOfListIO.hxx>
#include <SalomeApp_Tools.h>
#include <SVTK_Selector.h>

View File

@ -200,7 +200,8 @@ namespace SMESHOp {
OpDEFaces = 6042, // POPUP MENU - DISPLAY ENTITY - FACES
OpDEVolumes = 6043, // POPUP MENU - DISPLAY ENTITY - VOLUMES
OpDEBalls = 6044, // POPUP MENU - DISPLAY ENTITY - BALLS
OpDEAllEntity = 6045, // POPUP MENU - DISPLAY ENTITY - ALL ENTITY
OpDEAllEntity = 6045, // POPUP MENU - DISPLAY ENTITY - ALL ENTITIES
OpDEChoose = 6046, // POPUP MENU - DISPLAY ENTITY - CHOOSE ENTITIES
// Representation -----------------//--------------------------------
OpRepresentationLines = 6050, // POPUP MENU - 2D QUADRATIC - LINES
OpRepresentationArcs = 6051, // POPUP MENU - 2D QUADRATIC - ARCS

View File

@ -46,7 +46,6 @@
// SALOME GUI includes
#include <LightApp_SelectionMgr.h>
#include <SALOME_ListIO.hxx>
#include <SALOME_ListIteratorOfListIO.hxx>
#include <SUIT_Desktop.h>
#include <SUIT_MessageBox.h>
#include <SUIT_OverrideCursor.h>

View File

@ -52,7 +52,6 @@
#include <SVTK_ViewModel.h>
#include <SVTK_ViewWindow.h>
#include <SALOME_ListIO.hxx>
#include <SALOME_ListIteratorOfListIO.hxx>
// SALOME KERNEL includes
#include <SALOMEDSClient.hxx>

View File

@ -49,7 +49,6 @@
#include <SVTK_ViewModel.h>
#include <SVTK_ViewWindow.h>
#include <SALOME_ListIO.hxx>
#include <SALOME_ListIteratorOfListIO.hxx>
// SALOME KERNEL includes
#include <SALOMEDSClient.hxx>

View File

@ -80,8 +80,10 @@ void SMESHGUI_Selection::init( const QString& client, LightApp_SelectionMgr* mgr
return;
_PTR(Study) aStudy = aSStudy->studyDS();
for( int i=0, n=count(); i<n; i++ )
for( int i=0, n=count(); i<n; i++ ) {
myTypes.append( typeName( type( entry( i ), aStudy ) ) );
myControls.append( controlMode( i ) );
}
}
}
@ -122,7 +124,6 @@ QVariant SMESHGUI_Selection::parameter( const int ind, const QString& p ) const
else if ( p=="labeledTypes" ) val = QVariant( labeledTypes( ind ) );
else if ( p=="shrinkMode" ) val = QVariant( shrinkMode( ind ) );
else if ( p=="entityMode" ) val = QVariant( entityMode( ind ) );
else if ( p=="controlMode" ) val = QVariant( controlMode( ind ) );
else if ( p=="isNumFunctor" ) val = QVariant( isNumFunctor( ind ) );
else if ( p=="displayMode" ) val = QVariant( displayMode( ind ) );
else if ( p=="isComputable" ) val = QVariant( isComputable( ind ) );
@ -143,6 +144,21 @@ QVariant SMESHGUI_Selection::parameter( const int ind, const QString& p ) const
return LightApp_Selection::parameter( ind, p );
}
//=======================================================================
//function : parameter
//purpose :
//=======================================================================
QVariant SMESHGUI_Selection::parameter( const QString& p ) const
{
QVariant val;
if ( p=="controlMode" ) val = QVariant( controlMode() );
if ( val.isValid() )
return val;
else
return LightApp_Selection::parameter( p );
}
//=======================================================================
//function : getVtkOwner
//purpose :
@ -318,6 +334,23 @@ QString SMESHGUI_Selection::controlMode( int ind ) const
return mode;
}
//=======================================================================
//function : controlMode
//purpose : gets global control mode; return SMESH_Actor::eControl
//=======================================================================
QString SMESHGUI_Selection::controlMode() const
{
if( myControls.count() > 0 ) {
QString mode = myControls[0];
for( int ind = 1; ind < myControls.count(); ind++ ) {
if( mode != myControls[ind] )
return "eNone";
}
return mode;
}
return "eNone";
}
bool SMESHGUI_Selection::isNumFunctor( int ind ) const
{
bool result = false;

View File

@ -49,6 +49,7 @@ public:
virtual void init( const QString&, LightApp_SelectionMgr* );
virtual QVariant parameter( const int, const QString& ) const;
virtual QVariant parameter( const QString& ) const;
virtual bool processOwner( const LightApp_DataOwner* );
// got from object, not from actor
@ -74,6 +75,7 @@ public:
virtual QString shrinkMode( int ) const;
virtual QList<QVariant> entityMode( int ) const;
virtual QString controlMode( int ) const;
virtual QString controlMode() const;
virtual bool isNumFunctor( int ) const;
virtual QString facesOrientationMode( int ) const;
virtual QString groupType( int ) const;
@ -87,6 +89,7 @@ public:
private:
QStringList myTypes;
QStringList myControls;
QList<SMESH_Actor*> myActors;
};

View File

@ -43,7 +43,6 @@
#include <SVTK_ViewModel.h>
#include <SALOME_ListIO.hxx>
#include <SALOME_ListIteratorOfListIO.hxx>
// SALOME KERNEL includes
#include <SALOMEDS_SObject.hxx>
@ -428,7 +427,7 @@ void SMESHGUI_SelectionOp::selected( QStringList& names,
{
_PTR(SObject) obj = _study->studyDS()->FindObjectID( anIt.Value()->getEntry() );
if( obj )
names.append( obj->GetName().c_str() );
names.append( QString( obj->GetName().c_str() ).trimmed() );
}
}
}

View File

@ -596,20 +596,21 @@ void SMESHGUI_SmoothingDlg::SelectionIntoArgument()
if (myNbOkElements < 1)
return;
QStringList elements;
for ( int i = 0; i < myNbOkElements; ++i )
elements << QString::number( aMapIndex( i+1 ) );
aString = elements.join(" ");
}
} else if (myEditCurrentArgument == LineEditNodes && !myMesh->_is_nil() && myIO == IO ) {
} else if (myEditCurrentArgument == LineEditNodes && !myMesh->_is_nil() && myIO->isSame(IO) )
{
myNbOkNodes = SMESH::GetNameOfSelectedNodes(mySelector, IO, aString);
}
myEditCurrentArgument->setText(aString);
myEditCurrentArgument->repaint();
myEditCurrentArgument->setEnabled(false); // to update lineedit IPAL 19809
myEditCurrentArgument->setEnabled(true);
myEditCurrentArgument->setEnabled(true);
if (myNbOkElements && (myNbOkNodes || LineEditNodes->text().trimmed().isEmpty())) {
buttonOk->setEnabled(true);

View File

@ -52,7 +52,6 @@
#include <SVTK_ViewModel.h>
#include <SVTK_ViewWindow.h>
#include <SALOME_ListIO.hxx>
#include <SALOME_ListIteratorOfListIO.hxx>
// SALOME KERNEL includes
#include <SALOMEDSClient.hxx>

View File

@ -52,7 +52,6 @@
#include <SVTK_ViewModel.h>
#include <SVTK_ViewWindow.h>
#include <SALOME_ListIO.hxx>
#include <SALOME_ListIteratorOfListIO.hxx>
// SALOME KERNEL includes
#include <SALOMEDSClient.hxx>

View File

@ -40,7 +40,6 @@
#include <SUIT_ResourceMgr.h>
#include <SALOME_ListIO.hxx>
#include <SALOME_ListIteratorOfListIO.hxx>
#include <LightApp_Application.h>
#include <LightApp_SelectionMgr.h>

View File

@ -204,7 +204,7 @@ SMESHGUI_EXPORT
struct toQStr : public toStrT< QString > {
toQStr( char* s ): toStrT< QString >(s) {}
};
class toStdStr : public toStrT< std::string > {
struct toStdStr : public toStrT< std::string > {
toStdStr( char* s ): toStrT< std::string >(s) {}
};

View File

@ -47,7 +47,6 @@
#include <SUIT_ResourceMgr.h>
#include <SALOME_ListIO.hxx>
#include <SALOME_ListIteratorOfListIO.hxx>
#include <SVTK_Selector.h>
#include <SVTK_ViewModel.h>

View File

@ -161,8 +161,9 @@ bool SMESHGUI_XmlHandler::startElement (const QString&, const QString&,
for ( int i = 0; i < NB_ATTRIBUTES; ++i ) {
QString aStr = atts.value( name[i] );
if ( !aStr.isEmpty() ) {
aStr.remove( ' ' );
attr[ i ] = aStr.split( ',', QString::SkipEmptyParts );
attr[i] = aStr.split( ',', QString::SkipEmptyParts );
for ( int j = 0; j < attr[i].count(); ++j )
attr[i][j] = attr[i][j].trimmed();
}
}

View File

@ -255,6 +255,14 @@
<source>ICON_DLG_TRIANGLE</source>
<translation>mesh_triangle.png</translation>
</message>
<message>
<source>ICON_DLG_CHOOSE</source>
<translation>mesh_choose.png</translation>
</message>
<message>
<source>ICON_DLG_CHOOSE_ALL</source>
<translation>mesh_choose_all.png</translation>
</message>
<message>
<source>ICON_EDIT_GROUP</source>
<translation>mesh_edit_group.png</translation>

View File

@ -396,6 +396,10 @@
<source>MEN_EDGES</source>
<translation>Edges</translation>
</message>
<message>
<source>MEN_CHOOSE</source>
<translation>Choose...</translation>
</message>
<message>
<source>MEN_EDIT</source>
<translation>Edit</translation>
@ -7805,4 +7809,11 @@ as they are of improper type:
<translation>Shrink coef:</translation>
</message>
</context>
<context>
<name>SMESHGUI_DisplayEntitiesDlg</name>
<message>
<source>WRN_AT_LEAST_ONE</source>
<translation>At least one entity type should be chosen!</translation>
</message>
</context>
</TS>

View File

@ -396,6 +396,10 @@
<source>MEN_EDGES</source>
<translation>Arêtes</translation>
</message>
<message>
<source>MEN_CHOOSE</source>
<translation type="unfinished">Choose...</translation>
</message>
<message>
<source>MEN_EDIT</source>
<translation>Edition</translation>
@ -7753,4 +7757,11 @@ en raison de leurs types incompatibles:
<translation>Coef de réduction:</translation>
</message>
</context>
<context>
<name>SMESHGUI_DisplayEntitiesDlg</name>
<message>
<source>WRN_AT_LEAST_ONE</source>
<translation type="unfinished">At least one entity type should be chosen!</translation>
</message>
</context>
</TS>

View File

@ -395,6 +395,10 @@
<source>MEN_EDGES</source>
<translation></translation>
</message>
<message>
<source>MEN_CHOOSE</source>
<translation type="unfinished">Choose...</translation>
</message>
<message>
<source>MEN_EDIT</source>
<translation>(&amp;E)</translation>
@ -7687,4 +7691,11 @@
<translation>:</translation>
</message>
</context>
<context>
<name>SMESHGUI_DisplayEntitiesDlg</name>
<message>
<source>WRN_AT_LEAST_ONE</source>
<translation type="unfinished">At least one entity type should be chosen!</translation>
</message>
</context>
</TS>

View File

@ -43,7 +43,8 @@ typedef std::map<const SMDS_MeshElement*,
std::list<const SMDS_MeshElement*>, TIDCompare > TElemOfElemListMap;
typedef std::map<const SMDS_MeshElement*,
std::list<const SMDS_MeshNode*>, TIDCompare > TElemOfNodeListMap;
typedef std::map<const SMDS_MeshNode*, const SMDS_MeshNode*> TNodeNodeMap;
typedef std::map<const SMDS_MeshNode*,
const SMDS_MeshNode*, TIDCompare> TNodeNodeMap;
//!< Set of elements sorted by ID, to be used to assure predictability of edition
typedef std::set< const SMDS_MeshElement*, TIDCompare > TIDSortedElemSet;

View File

@ -1793,10 +1793,29 @@ void _pyMesh::Process( const Handle(_pyCommand)& theCommand )
list< Handle(_pyHypothesis) >::iterator hyp;
if ( !myLastComputeCmd.IsNull() )
{
for ( hyp = myHypos.begin(); hyp != myHypos.end(); ++hyp )
(*hyp)->ComputeDiscarded( myLastComputeCmd );
// check if the previously computed mesh has been edited,
// if so then we do not clear the previous Compute()
bool toClear = true;
if ( myLastComputeCmd->GetMethod() == "Compute" )
{
list< Handle(_pyMeshEditor)>::iterator e = myEditors.begin();
for ( ; e != myEditors.end() && toClear; ++e )
{
list< Handle(_pyCommand)>& cmds = (*e)->GetProcessedCmds();
list< Handle(_pyCommand) >::reverse_iterator cmd = cmds.rbegin();
if ( cmd != cmds.rend() &&
(*cmd)->GetOrderNb() > myLastComputeCmd->GetOrderNb() )
toClear = false;
}
}
if ( toClear )
{
// clear hyp commands called before myLastComputeCmd
for ( hyp = myHypos.begin(); hyp != myHypos.end(); ++hyp )
(*hyp)->ComputeDiscarded( myLastComputeCmd );
myLastComputeCmd->Clear();
myLastComputeCmd->Clear();
}
}
myLastComputeCmd = theCommand;
@ -1961,7 +1980,7 @@ void _pyMesh::Process( const Handle(_pyCommand)& theCommand )
//
// remove "PartTo" from the method
TCollection_AsciiString newMethod = method;
newMethod.Remove( 7, 6 );
newMethod.Remove( /*where=*/7, /*howmany=*/6 );
theCommand->SetMethod( newMethod );
// make the 1st arg be the last one (or last but three for ExportMED())
_pyID partID = theCommand->GetArg( 1 );

View File

@ -117,17 +117,17 @@ public:
_pyCommand( const _AString& theString, int theNb=-1 )
: myString( theString ), myOrderNb( theNb ) {};
_AString & GetString() { return myString; }
int GetOrderNb() const { return myOrderNb; }
int GetOrderNb() const { return myOrderNb; }
void SetOrderNb( int theNb ) { myOrderNb = theNb; }
typedef void* TAddr;
TAddr GetAddress() const { return (void*) this; }
int Length() const { return myString.Length(); }
int Length() const { return myString.Length(); }
void Clear() { myString.Clear(); myBegPos.Clear(); myArgs.Clear(); }
bool IsEmpty() const { return myString.IsEmpty(); }
_AString GetIndentation();
const _AString & GetResultValue();
int GetNbResultValues();
const _AString& GetResultValue(int res);
const _AString & GetResultValue(int res);
const _AString & GetObject();
const _AString & GetMethod();
const _AString & GetArg( int index );
@ -183,11 +183,11 @@ public:
const _pyID& GetID() { return myID.IsEmpty() ? myCreationCmd->GetResultValue() : myID; }
static _pyID FatherID(const _pyID & childID);
const Handle(_pyCommand)& GetCreationCmd() { return myCreationCmd; }
int GetNbCalls() const { return myProcessedCmds.size(); }
int GetNbCalls() const { return myProcessedCmds.size(); }
bool IsInStudy() const { return myIsPublished; }
virtual void SetRemovedFromStudy(const bool isRemoved) { myIsPublished = !isRemoved; }
void SetCreationCmd( Handle(_pyCommand) cmd ) { myCreationCmd = cmd; }
int GetCommandNb() { return myCreationCmd->GetOrderNb(); }
int GetCommandNb() { return myCreationCmd->GetOrderNb(); }
void AddProcessedCmd( const Handle(_pyCommand) & cmd )
{ if (myProcessedCmds.empty() || myProcessedCmds.back()!=cmd) myProcessedCmds.push_back( cmd );}
std::list< Handle(_pyCommand) >& GetProcessedCmds() { return myProcessedCmds; }

View File

@ -1550,8 +1550,8 @@ void ConnectedElements_i::SetThreshold ( const char*
if ( sobj->_is_nil() )
THROW_SALOME_CORBA_EXCEPTION
( "ConnectedElements_i::SetThreshold(): invalid vertex study entry", SALOME::BAD_PARAM );
CORBA::Object_var obj = sobj->GetObject();
GEOM::GEOM_Object_wrap vertex = GEOM::GEOM_Object::_narrow( obj );
CORBA::Object_var obj = sobj->GetObject();
GEOM::GEOM_Object_var vertex = GEOM::GEOM_Object::_narrow( obj );
if ( vertex->_is_nil() )
THROW_SALOME_CORBA_EXCEPTION
( "ConnectedElements_i::SetThreshold(): no GEOM_Object in SObject", SALOME::BAD_PARAM );
@ -3020,7 +3020,8 @@ CORBA::Boolean Filter_i::SetCriteria( const SMESH::Filter::Criteria& theCriteria
SMESH::Predicate_ptr aPrevPredicate = SMESH::Predicate::_nil();
int aPrevBinary = SMESH::FT_Undefined;
aBinaries.back() = SMESH::FT_Undefined;
if ( !aBinaries.empty() )
aBinaries.back() = SMESH::FT_Undefined;
for ( aPredIter = aPredicates.begin(), aBinaryIter = aBinaries.begin();
aPredIter != aPredicates.end() && aBinaryIter != aBinaries.end();

View File

@ -467,23 +467,22 @@ SMESH::SMESH_Hypothesis_ptr SMESH_Gen_i::createHypothesis(const char* theHypName
SMESH_Hypothesis_i* myHypothesis_i = 0;
SMESH::SMESH_Hypothesis_var hypothesis_i;
std::string aPlatformLibName;
typedef GenericHypothesisCreator_i* (*GetHypothesisCreator)(const char* );
GenericHypothesisCreator_i* aCreator = getHypothesisCreator(theHypName, theLibName, aPlatformLibName);
GenericHypothesisCreator_i* aCreator =
getHypothesisCreator(theHypName, theLibName, aPlatformLibName);
// create a new hypothesis object, store its ref. in studyContext
if(MYDEBUG) MESSAGE("Create Hypothesis " << theHypName);
myHypothesis_i =
myHypCreatorMap[string(theHypName)]->Create(myPoa, GetCurrentStudyID(), &myGen);
myHypothesis_i->SetLibName(aPlatformLibName.c_str()); // for persistency assurance
if (!myHypothesis_i)
return hypothesis_i._retn();
// activate the CORBA servant of hypothesis
hypothesis_i = myHypothesis_i->_this();
int nextId = RegisterObject( hypothesis_i );
if(MYDEBUG) { MESSAGE( "Add hypo to map with id = "<< nextId ); }
else { nextId = 0; } // avoid "unused variable" warning in release mode
myHypothesis_i = aCreator->Create(myPoa, GetCurrentStudyID(), &myGen);
if (myHypothesis_i)
{
myHypothesis_i->SetLibName(aPlatformLibName.c_str()); // for persistency assurance
myHypCreatorMap[ myHypothesis_i->GetName() ] = aCreator;
// activate the CORBA servant of hypothesis
hypothesis_i = myHypothesis_i->_this();
int nextId = RegisterObject( hypothesis_i );
if(MYDEBUG) { MESSAGE( "Add hypo to map with id = "<< nextId ); }
else { nextId = 0; } // avoid "unused variable" warning in release mode
}
return hypothesis_i._retn();
}

View File

@ -43,6 +43,8 @@
#include <TCollection_AsciiString.hxx>
#include <TopoDS_Solid.hxx>
#include <cctype>
#ifdef _DEBUG_
static int MYDEBUG = 0;
//static int VARIABLE_DEBUG = 0;
@ -341,9 +343,15 @@ void SMESH_Gen_i::SetName(SALOMEDS::SObject_ptr theSObject,
SALOMEDS::GenericAttribute_wrap anAttr =
aStudyBuilder->FindOrCreateAttribute( theSObject, "AttributeName" );
SALOMEDS::AttributeName_wrap aNameAttr = anAttr;
if ( theName && strlen( theName ) != 0 )
aNameAttr->SetValue( theName );
else {
if ( theName && theName[0] ) {
std::string name( theName ); // trim trailing white spaces
for ( size_t i = name.size()-1; i > 0; --i )
if ( isspace( name[i] )) name[i] = '\0';
else break;
aNameAttr->SetValue( name.c_str() );
}
else
{
CORBA::String_var curName = aNameAttr->Value();
if ( strlen( curName.in() ) == 0 ) {
SMESH_Comment aName(theDefaultName);
@ -355,7 +363,7 @@ void SMESH_Gen_i::SetName(SALOMEDS::SObject_ptr theSObject,
//=======================================================================
//function : SetPixMap
//purpose :
//purpose :
//=======================================================================
void SMESH_Gen_i::SetPixMap(SALOMEDS::SObject_ptr theSObject,

View File

@ -64,6 +64,7 @@
#include <Utils_CorbaException.hxx>
#include <SALOMEDS_wrap.hxx>
#include <SALOME_GenericObj_i.hh>
#include <Basics_OCCTVersion.hxx>
#include <BRepAdaptor_Surface.hxx>
#include <BRep_Tool.hxx>
@ -4746,9 +4747,16 @@ SMESH_MeshEditor_i::scale(SMESH::SMESH_IDSource_ptr theObject,
};
double tol = std::numeric_limits<double>::max();
gp_Trsf aTrsf;
#if OCC_VERSION_LARGE > 0x06070100
aTrsf.SetValues( S[0], 0, 0, thePoint.x * (1-S[0]),
0, S[1], 0, thePoint.y * (1-S[1]),
0, 0, S[2], thePoint.z * (1-S[2]) );
#else
aTrsf.SetValues( S[0], 0, 0, thePoint.x * (1-S[0]),
0, S[1], 0, thePoint.y * (1-S[1]),
0, 0, S[2], thePoint.z * (1-S[2]), tol, tol);
#endif
TIDSortedElemSet copyElements;
TIDSortedElemSet* workElements = &elements;

View File

@ -385,7 +385,7 @@ class StdMeshersBuilder_Segment(Mesh_Algorithm):
algo = self.mesh.smeshpyD.CreateHypothesis("SegmentAroundVertex_0D", "libStdMeshersEngine.so")
pass
status = self.mesh.mesh.AddHypothesis(self.geom, algo)
TreatHypoStatus(status, "SegmentAroundVertex_0D", name, True)
TreatHypoStatus(status, "SegmentAroundVertex_0D", name, True, self.mesh)
#
from salome.smesh.smeshBuilder import IsEqual
comFun = lambda hyp, args: IsEqual(hyp.GetLength(), args[0])
@ -830,12 +830,13 @@ class StdMeshersBuilder_Projection2D(Mesh_Algorithm):
from salome.smesh.smeshBuilder import AssureGeomPublished
AssureGeomPublished( self.mesh, geom )
hyp = self.Hypothesis("ProjectionSource2D", [face,mesh,srcV1,tgtV1,srcV2,tgtV2],
UseExisting=0)
UseExisting=0, toAdd=False)
# it does not seem to be useful to reuse the existing "SourceFace" hypothesis
#UseExisting=UseExisting, CompareMethod=self.CompareSourceFace)
hyp.SetSourceFace( face )
hyp.SetSourceMesh( mesh )
hyp.SetVertexAssociation( srcV1, srcV2, tgtV1, tgtV2 )
self.mesh.AddHypothesis(hyp, self.geom)
return hyp
pass # end of StdMeshersBuilder_Projection2D class

View File

@ -627,7 +627,7 @@ class smeshBuilder(object, SMESH._objref_SMESH_Gen):
# pass result of Mesh.GetIDSource( list_of_ids, type ) as meshPart
# @param meshName a name of the new mesh
# @param toCopyGroups to create in the new mesh groups the copied elements belongs to
# @param toKeepIDs to preserve IDs of the copied elements or not
# @param toKeepIDs to preserve order of the copied elements or not
# @return an instance of Mesh class
def CopyMesh( self, meshPart, meshName, toCopyGroups=False, toKeepIDs=False):
if (isinstance( meshPart, Mesh )):
@ -1596,7 +1596,7 @@ class Mesh:
AssureGeomPublished( self, geom, "shape for %s" % hyp.GetName())
status = self.mesh.AddHypothesis(geom, hyp)
else:
status = HYP_BAD_GEOMETRY
status = HYP_BAD_GEOMETRY,""
hyp_name = GetName( hyp )
geom_name = ""
if geom:
@ -1876,7 +1876,12 @@ class Mesh:
# @ingroup l2_grps_create
def MakeGroupByIds(self, groupName, elementType, elemIDs):
group = self.mesh.CreateGroup(elementType, groupName)
group.Add(elemIDs)
if hasattr( elemIDs, "GetIDs" ):
if hasattr( elemIDs, "SetMesh" ):
elemIDs.SetMesh( self.GetMesh() )
group.AddFrom( elemIDs )
else:
group.Add(elemIDs)
return group
## Creates a mesh group by the given conditions
@ -3451,7 +3456,7 @@ class Mesh:
##
# @brief Creates missing boundary elements around either the whole mesh or
# groups of 2D elements
# groups of elements
# @param dimension - defines type of boundary elements to create
# @param groupName - a name of group to store all boundary elements in,
# "" means not to create the group
@ -3459,7 +3464,7 @@ class Mesh:
# mesh + created boundary elements; "" means not to create the new mesh
# @param toCopyAll - if true, the whole initial mesh will be copied into
# the new mesh else only boundary elements will be copied into the new mesh
# @param groups - groups of 2D elements to make boundary around
# @param groups - groups of elements to make boundary around
# @retval tuple( long, mesh, groups )
# long - number of added boundary elements
# mesh - the mesh where elements were added to
@ -3472,12 +3477,12 @@ class Mesh:
if mesh: mesh = self.smeshpyD.Mesh(mesh)
return nb, mesh, group
## Renumber mesh nodes
## Renumber mesh nodes (Obsolete, does nothing)
# @ingroup l2_modif_renumber
def RenumberNodes(self):
self.editor.RenumberNodes()
## Renumber mesh elements
## Renumber mesh elements (Obsole, does nothing)
# @ingroup l2_modif_renumber
def RenumberElements(self):
self.editor.RenumberElements()

View File

@ -40,7 +40,7 @@ import SMESH
# @code
# meshMethod = "MyAlgorithm"
# @endcode
# then an instance of @c MyPlugin_Algorithm can be created by the direct invokation of the function
# then an instance of @c MyPlugin_Algorithm can be created by the direct invocation of the function
# of smesh.Mesh class:
# @code
# my_algo = mesh.MyAlgorithm()
@ -257,7 +257,7 @@ class Mesh_Algorithm:
## Defines "ViscousLayers" hypothesis to give parameters of layers of prisms to build
# near mesh boundary. This hypothesis can be used by several 3D algorithms:
# NETGEN 3D, GHS3D, Hexahedron(i,j,k)
# NETGEN 3D, MG-Tetra, Hexahedron(i,j,k)
# @param thickness total thickness of layers of prisms
# @param numberOfLayers number of layers of prisms
# @param stretchFactor factor (>1.0) of growth of layer thickness towards inside of mesh
@ -274,7 +274,14 @@ class Mesh_Algorithm:
if not "ViscousLayers" in self.GetCompatibleHypothesis():
raise TypeError, "ViscousLayers are not supported by %s"%self.algo.GetName()
if faces and isinstance( faces[0], geomBuilder.GEOM._objref_GEOM_Object ):
faces = [ self.mesh.geompyD.GetSubShapeID(self.mesh.geom, f) for f in faces ]
import GEOM
faceIDs = []
for f in faces:
if self.mesh.geompyD.ShapeIdToType( f.GetType() ) == "GROUP":
faceIDs += f.GetSubShapeIndices()
else:
faceIDs += [self.mesh.geompyD.GetSubShapeID(self.mesh.geom, f)]
faces = faceIDs
hyp = self.Hypothesis("ViscousLayers",
[thickness, numberOfLayers, stretchFactor, faces, isFacesToIgnore],
toAdd=False)
@ -287,7 +294,7 @@ class Mesh_Algorithm:
## Defines "ViscousLayers2D" hypothesis to give parameters of layers of quadrilateral
# elements to build near mesh boundary. This hypothesis can be used by several 2D algorithms:
# NETGEN 2D, NETGEN 1D-2D, Quadrangle (mapping), MEFISTO, BLSURF
# NETGEN 2D, NETGEN 1D-2D, Quadrangle (mapping), MEFISTO, MG-CADSurf
# @param thickness total thickness of layers of quadrilaterals
# @param numberOfLayers number of layers
# @param stretchFactor factor (>1.0) of growth of layer thickness towards inside of mesh

View File

@ -1179,6 +1179,7 @@ bool AdaptiveAlgo::Compute(SMESH_Mesh & theMesh,
eData.AddPoint( eData.myPoints.end(), eData.myC3d.LastParameter() );
}
}
if ( myEdges.empty() ) return true;
if ( _computeCanceled ) return false;
// Take into account size of already existing segments

View File

@ -329,7 +329,7 @@ void StdMeshers_CartesianParameters3D::ComputeCoordinates(const double x0,
coords.clear();
for ( size_t i = 0; i < spaceFuns.size(); ++i )
{
FunctionExpr fun( spaceFuns[i].c_str(), /*convMode=*/-1 );
StdMeshers::FunctionExpr fun( spaceFuns[i].c_str(), /*convMode=*/-1 );
const double p0 = x0 * ( 1. - points[i]) + x1 * points[i];
const double p1 = x0 * ( 1. - points[i+1]) + x1 * points[i+1];

View File

@ -100,17 +100,6 @@ using namespace std;
//#define _MY_DEBUG_
#endif
#if OCC_VERSION_LARGE <= 0x06050300
// workaround is required only for OCCT6.5.3 and older (see OCC22809)
#define ELLIPSOLID_WORKAROUND
#endif
#ifdef ELLIPSOLID_WORKAROUND
#include <BRepIntCurveSurface_Inter.hxx>
#include <BRepTopAdaptor_TopolTool.hxx>
#include <BRepAdaptor_HSurface.hxx>
#endif
//=============================================================================
/*!
* Constructor
@ -317,41 +306,6 @@ namespace
void ComputeUVW(const gp_XYZ& p, double uvw[3]);
void ComputeNodes(SMESH_MesherHelper& helper);
};
#ifdef ELLIPSOLID_WORKAROUND
// --------------------------------------------------------------------------
/*!
* \brief struct temporary replacing IntCurvesFace_Intersector until
* OCCT bug 0022809 is fixed
* http://tracker.dev.opencascade.org/view.php?id=22809
*/
struct TMP_IntCurvesFace_Intersector
{
BRepAdaptor_Surface _surf;
double _tol;
BRepIntCurveSurface_Inter _intcs;
vector<IntCurveSurface_IntersectionPoint> _points;
BRepTopAdaptor_TopolTool _clsf;
TMP_IntCurvesFace_Intersector(const TopoDS_Face& face, const double tol)
:_surf( face ), _tol( tol ), _clsf( new BRepAdaptor_HSurface(_surf) ) {}
Bnd_Box Bounding() const { Bnd_Box b; BRepBndLib::Add (_surf.Face(), b); return b; }
void Perform( const gp_Lin& line, const double w0, const double w1 )
{
_points.clear();
for ( _intcs.Init( _surf.Face(), line, _tol ); _intcs.More(); _intcs.Next() )
if ( w0 <= _intcs.W() && _intcs.W() <= w1 )
_points.push_back( _intcs.Point() );
}
bool IsDone() const { return true; }
int NbPnt() const { return _points.size(); }
IntCurveSurface_TransitionOnCurve Transition( const int i ) const { return _points[ i-1 ].Transition(); }
double WParameter( const int i ) const { return _points[ i-1 ].W(); }
TopAbs_State ClassifyUVPoint(const gp_Pnt2d& p) { return _clsf.Classify( p, _tol ); }
};
#define __IntCurvesFace_Intersector TMP_IntCurvesFace_Intersector
#else
#define __IntCurvesFace_Intersector IntCurvesFace_Intersector
#endif
// --------------------------------------------------------------------------
/*!
* \brief Intersector of TopoDS_Face with all GridLine's
@ -362,7 +316,7 @@ namespace
TGeomID _faceID;
Grid* _grid;
Bnd_Box _bndBox;
__IntCurvesFace_Intersector* _surfaceInt;
IntCurvesFace_Intersector* _surfaceInt;
vector< std::pair< GridLine*, F_IntersectPoint > > _intersections;
FaceGridIntersector(): _grid(0), _surfaceInt(0) {}
@ -383,11 +337,11 @@ namespace
GetCurveFaceIntersector();
return _bndBox;
}
__IntCurvesFace_Intersector* GetCurveFaceIntersector()
IntCurvesFace_Intersector* GetCurveFaceIntersector()
{
if ( !_surfaceInt )
{
_surfaceInt = new __IntCurvesFace_Intersector( _face, Precision::PConfusion() );
_surfaceInt = new IntCurvesFace_Intersector( _face, Precision::PConfusion() );
_bndBox = _surfaceInt->Bounding();
if ( _bndBox.IsVoid() )
BRepBndLib::Add (_face, _bndBox);
@ -412,7 +366,7 @@ namespace
gp_Cone _cone;
gp_Sphere _sphere;
gp_Torus _torus;
__IntCurvesFace_Intersector* _surfaceInt;
IntCurvesFace_Intersector* _surfaceInt;
vector< F_IntersectPoint > _intPoints;

View File

@ -43,6 +43,8 @@
using namespace std;
namespace StdMeshers {
Function::Function( const int conv )
: myConv( conv )
{
@ -345,3 +347,4 @@ bool buildDistribution( const Function& func, const double start, const double e
data[nbSeg] = end;
return true;
}
}

View File

@ -37,7 +37,8 @@
#include <Expr_Array1OfNamedUnknown.hxx>
#include <TColStd_Array1OfReal.hxx>
namespace StdMeshers
{
class STDMESHERS_EXPORT Function
{
public:
@ -114,5 +115,5 @@ bool buildDistribution( const TCollection_AsciiString& f, const int conv, const
STDMESHERS_EXPORT
bool buildDistribution( const std::vector<double>& f, const int conv, const double start, const double end,
const int nbSeg, std::vector<double>& data, const double eps );
}
#endif

View File

@ -43,6 +43,7 @@
#include <BRep_Tool.hxx>
#include <GCPnts_AbscissaPoint.hxx>
#include <Geom2dAdaptor_Curve.hxx>
#include <Geom_Line.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
@ -151,21 +152,26 @@ StdMeshers_FaceSide::StdMeshers_FaceSide(const TopoDS_Face& theFace,
myMissingVertexNodes = true;
// check if the edge has a non-uniform parametrization (issue 0020705)
if ( !myC2d[i].IsNull() && myEdgeLength[i] > DBL_MIN)
if ( !myC2d[i].IsNull() )
{
Geom2dAdaptor_Curve A2dC( myC2d[i],
std::min( myFirst[i], myLast[i] ),
std::max( myFirst[i], myLast[i] ));
double p2 = myFirst[i]+(myLast[i]-myFirst[i])/2., p4 = myFirst[i]+(myLast[i]-myFirst[i])/4.;
double d2 = GCPnts_AbscissaPoint::Length( A2dC, myFirst[i], p2 );
double d4 = GCPnts_AbscissaPoint::Length( A2dC, myFirst[i], p4 );
//cout<<"len = "<<len<<" d2 = "<<d2<<" fabs(2*d2/len-1.0) = "<<fabs(2*d2/len-1.0)<<endl;
myIsUniform[i] = !( fabs(2*d2/myEdgeLength[i]-1.0) > 0.01 || fabs(2*d4/d2-1.0) > 0.01 );
//if ( !myIsUniform[i] ) to implement Value3d(u)
if ( myEdgeLength[i] > DBL_MIN)
{
double fp,lp;
Handle(Geom_Curve) C3d = BRep_Tool::Curve(myEdge[i],fp,lp);
myC3dAdaptor[i].Load( C3d, fp,lp );
Geom2dAdaptor_Curve A2dC( myC2d[i],
std::min( myFirst[i], myLast[i] ),
std::max( myFirst[i], myLast[i] ));
double p2 = myFirst[i]+(myLast[i]-myFirst[i])/2., p4 = myFirst[i]+(myLast[i]-myFirst[i])/4.;
double d2 = GCPnts_AbscissaPoint::Length( A2dC, myFirst[i], p2 );
double d4 = GCPnts_AbscissaPoint::Length( A2dC, myFirst[i], p4 );
//cout<<"len = "<<len<<" d2 = "<<d2<<" fabs(2*d2/len-1.0) = "<<fabs(2*d2/len-1.0)<<endl;
myIsUniform[i] = !( fabs(2*d2/myEdgeLength[i]-1.0) > 0.01 || fabs(2*d4/d2-1.0) > 0.01 );
Handle(Geom_Curve) C3d = BRep_Tool::Curve(myEdge[i],d2,d4);
myC3dAdaptor[i].Load( C3d, d2,d4 );
}
else
{
const TopoDS_Vertex& V = TopoDS::Vertex( vExp.Value() );
Handle(Geom_Curve) C3d = new Geom_Line( BRep_Tool::Pnt( V ), gp::DX() );
myC3dAdaptor[i].Load( C3d, 0, 0.5 * BRep_Tool::Tolerance( V ));
}
}
// reverse a proxy submesh
@ -988,7 +994,7 @@ gp_Pnt StdMeshers_FaceSide::Value3d(double U) const
double r = ( U - prevU )/ ( myNormPar[ i ] - prevU );
double par = myFirst[i] * ( 1 - r ) + myLast[i] * r;
// check parametrization of curve
if( !myIsUniform[i] )
{

View File

@ -53,6 +53,7 @@
#include <Basics_Utils.hxx>
using namespace StdMeshers;
using namespace std;
const double PRECISION = 1e-7;

Some files were not shown because too many files have changed in this diff Show More