Merge branch 'master' into for_med_410

This commit is contained in:
esy 2020-03-10 17:14:45 +01:00
commit 1584aa1f2f
97 changed files with 5498 additions and 899 deletions
bin
doc/salome
idl
resources
src
Controls
DriverGMF
OBJECT
SMDS
SMESH
SMESHDS
SMESHGUI
SMESHUtils
SMESH_I
SMESH_SWIG
StdMeshers
StdMeshersGUI
StdMeshers_I

@ -51,7 +51,7 @@ def set_env(args):
for resource_file in [i for i in os.listdir(resource_dir) \ for resource_file in [i for i in os.listdir(resource_dir) \
if osp.isfile(os.path.join(resource_dir, i))]: if osp.isfile(os.path.join(resource_dir, i))]:
# look for resource file (XML) to extract valid plugin name # look for resource file (XML) to extract valid plugin name
if resource_file.lower() == f'{plugin_lname}.xml': if resource_file.lower() == '{plugin_lname}.xml'.format(plugin_lname=plugin_lname):
try: try:
# get plugin name from 'resources' attribute of 'meshers-group' xml node # get plugin name from 'resources' attribute of 'meshers-group' xml node
# as name extracted from environment variable can be in wrong case # as name extracted from environment variable can be in wrong case

@ -14,10 +14,13 @@ smesh = smeshBuilder.New()
# create a sphere # create a sphere
sphere = geompy.MakeSphereR( 50 ) sphere = geompy.MakeSphereR( 50 )
geompy.addToStudy( sphere, "sphere" )
# cut the sphere by a box
box = geompy.MakeBoxDXDYDZ( 100, 100, 100 )
partition = geompy.MakePartition([ sphere ], [ box ], theName="partition")
# create a mesh and assign a "Body Fitting" algo # create a mesh and assign a "Body Fitting" algo
mesh = smesh.Mesh( sphere ) mesh = smesh.Mesh( partition )
cartAlgo = mesh.BodyFitted() cartAlgo = mesh.BodyFitted()
# define a cartesian grid using Coordinates # define a cartesian grid using Coordinates
@ -38,7 +41,27 @@ mesh.Compute()
print("nb hexahedra",mesh.NbHexas()) print("nb hexahedra",mesh.NbHexas())
print("nb tetrahedra",mesh.NbTetras()) print("nb tetrahedra",mesh.NbTetras())
print("nb polyhedra",mesh.NbPolyhedrons()) print("nb polyhedra",mesh.NbPolyhedrons())
print("nb faces",mesh.NbFaces())
print()
# activate creation of faces
cartHyp.SetToCreateFaces( True )
mesh.Compute()
print("nb hexahedra",mesh.NbHexas())
print("nb tetrahedra",mesh.NbTetras())
print("nb polyhedra",mesh.NbPolyhedrons())
print("nb faces",mesh.NbFaces())
print()
# enable consideration of shared faces
cartHyp.SetToConsiderInternalFaces( True )
mesh.Compute()
print("nb hexahedra",mesh.NbHexas())
print("nb tetrahedra",mesh.NbTetras())
print("nb polyhedra",mesh.NbPolyhedrons())
print("nb faces",mesh.NbFaces())
print()
# define the grid by setting different spacing in 2 sub-ranges of geometry # define the grid by setting different spacing in 2 sub-ranges of geometry
spaceFuns = ["5","10+10*t"] spaceFuns = ["5","10+10*t"]

@ -33,16 +33,22 @@ mesh.Segment().NumberOfSegments( 4 )
mesh.Triangle() mesh.Triangle()
mesh.Quadrangle(face1) mesh.Quadrangle(face1)
mesh.Compute()
algo3D = mesh.Tetrahedron() algo3D = mesh.Tetrahedron()
thickness = 20 thickness = 20
numberOfLayers = 10 numberOfLayers = 10
stretchFactor = 1.5 stretchFactor = 1.5
layersHyp = algo3D.ViscousLayers(thickness,numberOfLayers,stretchFactor,ignoreFaces) groupName = "Boundary layers"
layersHyp = algo3D.ViscousLayers(thickness,numberOfLayers,stretchFactor,
ignoreFaces, # optional
groupName = groupName) # optional
mesh.Compute() mesh.Compute()
# retrieve boundary prisms created by mesh.Compute()
boundaryGroup = mesh.GetGroupByName( layersHyp.GetGroupName() )[0]
print( "Nb boundary prisms", boundaryGroup.Size() )
mesh.MakeGroup("Tetras",SMESH.VOLUME,SMESH.FT_ElemGeomType,"=",SMESH.Geom_TETRA) mesh.MakeGroup("Tetras",SMESH.VOLUME,SMESH.FT_ElemGeomType,"=",SMESH.Geom_TETRA)
mesh.MakeGroup("Pyras",SMESH.VOLUME,SMESH.FT_ElemGeomType,"=",SMESH.Geom_PYRAMID) mesh.MakeGroup("Pyras",SMESH.VOLUME,SMESH.FT_ElemGeomType,"=",SMESH.Geom_PYRAMID)
mesh.MakeGroup("Prims",SMESH.VOLUME,SMESH.FT_ElemGeomType,"=",SMESH.Geom_PENTA) mesh.MakeGroup("Prims",SMESH.VOLUME,SMESH.FT_ElemGeomType,"=",SMESH.Geom_PENTA)
@ -55,12 +61,17 @@ edgeIds = geompy.SubShapeAllIDs( face1, geompy.ShapeType["EDGE"])[:-1]
mesh = smesh.Mesh(face1,"VicsousLayers2D") mesh = smesh.Mesh(face1,"VicsousLayers2D")
mesh.Segment().NumberOfSegments( 5 ) mesh.Segment().NumberOfSegments( 5 )
# viscous layers should be created on 1 edge, as we set 3 edges to ignore # viscous layers will be created on 1 edge, as we set 3 edges to ignore
vlHyp = mesh.Triangle().ViscousLayers2D( 2, 3, 1.5, edgeIds, isEdgesToIgnore=True ) vlHyp = mesh.Triangle().ViscousLayers2D( 2, 3, 1.5,
edgeIds, isEdgesToIgnore=True, # optional
groupName=groupName) # optional
mesh.Compute() mesh.Compute()
# viscous layers should be created on 3 edges, as we pass isEdgesToIgnore=False # retrieve boundary elements created by mesh.Compute()
quadrangles = mesh.GetGroupByName( vlHyp.GetGroupName() )[0]
print( "Nb boundary quadrangles", quadrangles.Size() )
# viscous layers will be created on 3 edges, as we pass isEdgesToIgnore=False
vlHyp.SetEdges( edgeIds, False ) vlHyp.SetEdges( edgeIds, False )
mesh.Compute() mesh.Compute()

Binary file not shown.

Before

(image error) Size: 59 KiB

After

(image error) Size: 58 KiB

Binary file not shown.

Before

(image error) Size: 26 KiB

After

(image error) Size: 32 KiB

Binary file not shown.

Before

(image error) Size: 31 KiB

After

(image error) Size: 38 KiB

@ -108,6 +108,8 @@ computations.
boundary faces/edges of the shape of this sub-mesh, at same time boundary faces/edges of the shape of this sub-mesh, at same time
possibly being internal faces/edges within the whole model. possibly being internal faces/edges within the whole model.
* **Create groups from layers** - activates creation of a group containing elements of the layers.
.. image:: ../images/viscous_layers_on_submesh.png .. image:: ../images/viscous_layers_on_submesh.png
:align: center :align: center

@ -53,6 +53,7 @@ An algorithm represents either an implementation of a certain meshing technique
* :ref:`Extrusion 3D <prism_3d_algo_page>` - for meshing prismatic 3D shapes with hexahedra and prisms. * :ref:`Extrusion 3D <prism_3d_algo_page>` - for meshing prismatic 3D shapes with hexahedra and prisms.
* :ref:`Quadrangle: Medial Axis Projection <quad_from_ma_algo_page>` - for quadrangle meshing of faces with sinuous borders and rings. * :ref:`Quadrangle: Medial Axis Projection <quad_from_ma_algo_page>` - for quadrangle meshing of faces with sinuous borders and rings.
* **Polygon per Face** meshing algorithm - generates one mesh face (either a triangle, a quadrangle or a polygon) per a geometrical face using all nodes from the face boundary. * **Polygon per Face** meshing algorithm - generates one mesh face (either a triangle, a quadrangle or a polygon) per a geometrical face using all nodes from the face boundary.
* **Polyhedron per Solid** meshing algorithm - generates one mesh volume (of a classical type or a polyhedron) per a geometrical solid using all faces of the solid boundary. It does not require that 2D mesh is generated on geometrical faces. It creates one mesh edge per geometrical edges and applies **Polygon per Face** to faces if they are not meshed by optional algorithms of lower dimensions.
* :ref:`Projection algorithms <projection_algos_page>` - for meshing by projection of another mesh. * :ref:`Projection algorithms <projection_algos_page>` - for meshing by projection of another mesh.
* :ref:`Import algorithms <import_algos_page>` - for meshing by importing elements from another mesh. * :ref:`Import algorithms <import_algos_page>` - for meshing by importing elements from another mesh.
* :ref:`Radial Prism <radial_prism_algo_page>` - for meshing 3D geometrical objects with cavities with hexahedra and prisms. * :ref:`Radial Prism <radial_prism_algo_page>` - for meshing 3D geometrical objects with cavities with hexahedra and prisms.

@ -52,6 +52,9 @@ This dialog allows to define
.. centered:: .. centered::
Implement Edges switched off to the left and on to the right Implement Edges switched off to the left and on to the right
* **Create Faces** check-box activates creation on mesh faces.
* **Consider Shared and Internal Faces** check-box activates treatment of faces shared by solids and internal. By default the algorithm considers only outer boundaries of the geometry.
* **Apply Threshold to Shared / Internal Faces** check-box activates application of **Threshold** to cells cut by shared and internal faces, that can cause appearance of holes inside the mesh.
* **Definition mode** allows choosing how Cartesian structured grid is defined. Location of nodes along each grid axis is defined individually: * **Definition mode** allows choosing how Cartesian structured grid is defined. Location of nodes along each grid axis is defined individually:
* You can specify the **Coordinates** of grid nodes. **Insert** button inserts a node at **Step** distance (negative or positive) from the selected node. **Delete** button removes the selected node. Double click on a coordinate in the list enables its edition. **Note** that node coordinates are measured along directions of axes that can differ from the directions of the Global Coordinate System. * You can specify the **Coordinates** of grid nodes. **Insert** button inserts a node at **Step** distance (negative or positive) from the selected node. **Delete** button removes the selected node. Double click on a coordinate in the list enables its edition. **Note** that node coordinates are measured along directions of axes that can differ from the directions of the Global Coordinate System.

@ -31,7 +31,7 @@ right-clicking on the selected mesh.
* **Rename** - allows to rename the object in the Object browser. * **Rename** - allows to rename the object in the Object browser.
* **Hide all** - allows to hide all objects in the viewer. * **Hide all** - allows to hide all objects in the viewer.
* **Update** - refreshes the presentation of your mesh in the Object Browser, applying all recent changes. * **Update** - refreshes the presentation of your mesh in the 3D Viewer, applying all recent changes.
* :ref:`Mesh Information <mesh_infos_page>` - provides information about the mesh. * :ref:`Mesh Information <mesh_infos_page>` - provides information about the mesh.
* :ref:`Find Element by Point <find_element_by_point_page>` - allows to find all mesh elements, to which belongs a point with the given coordinates. * :ref:`Find Element by Point <find_element_by_point_page>` - allows to find all mesh elements, to which belongs a point with the given coordinates.
* **Auto Color** - switch on / off auto-assigning colors for the groups. If switched on, a default color of a new group in :ref:`Create Group <creating_groups_page>` dialog is chosen randomly. * **Auto Color** - switch on / off auto-assigning colors for the groups. If switched on, a default color of a new group in :ref:`Create Group <creating_groups_page>` dialog is chosen randomly.

@ -924,6 +924,9 @@ module StdMeshers
void SetMethod( in VLExtrusionMethod how ); void SetMethod( in VLExtrusionMethod how );
VLExtrusionMethod GetMethod(); VLExtrusionMethod GetMethod();
void SetGroupName(in string name);
string GetGroupName();
}; };
/*! /*!
@ -965,6 +968,9 @@ module StdMeshers
*/ */
void SetStretchFactor(in double factor) raises (SALOME::SALOME_Exception); void SetStretchFactor(in double factor) raises (SALOME::SALOME_Exception);
double GetStretchFactor(); double GetStretchFactor();
void SetGroupName(in string name);
string GetGroupName();
}; };
/*! /*!
@ -1031,7 +1037,7 @@ module StdMeshers
boolean GetFixedPoint(out SMESH::PointStruct p); boolean GetFixedPoint(out SMESH::PointStruct p);
/*! /*!
* Enables implementation of geometrical edges into the mesh. If this feature * Enable implementation of geometrical edges into the mesh. If this feature
* is disabled, sharp edges of the shape are lost ("smoothed") in the mesh if * is disabled, sharp edges of the shape are lost ("smoothed") in the mesh if
* they don't coincide with the grid lines * they don't coincide with the grid lines
*/ */
@ -1039,17 +1045,35 @@ module StdMeshers
boolean GetToAddEdges(); boolean GetToAddEdges();
/*! /*!
* Returns axes at which a number of generated hexahedra is maximal * Enable treatment of geom faces, either shared by solids or internal.
*/
void SetToConsiderInternalFaces(in boolean toTreat);
boolean GetToConsiderInternalFaces();
/*!
* Enable applying size threshold to grid cells cut by internal geom faces.
*/
void SetToUseThresholdForInternalFaces(in boolean toUse);
boolean GetToUseThresholdForInternalFaces();
/*!
* Enable creation of mesh faces.
*/
void SetToCreateFaces(in boolean toCreate);
boolean GetToCreateFaces();
/*!
* Return axes at which a number of generated hexahedra is maximal
*/ */
void ComputeOptimalAxesDirs(in GEOM::GEOM_Object shape, void ComputeOptimalAxesDirs(in GEOM::GEOM_Object shape,
in boolean isOrthogonal, in boolean isOrthogonal,
out SMESH::DirStruct x, out SMESH::DirStruct x,
out SMESH::DirStruct y, out SMESH::DirStruct y,
out SMESH::DirStruct z ) out SMESH::DirStruct z )
raises (SALOME::SALOME_Exception); raises (SALOME::SALOME_Exception);
/*! /*!
* \brief Computes node coordinates by spacing functions * \brief Compute node coordinates by spacing functions
* \param x0 - lower coordinate * \param x0 - lower coordinate
* \param x1 - upper coordinate * \param x1 - upper coordinate
* \param spaceFuns - space functions * \param spaceFuns - space functions
@ -1114,6 +1138,13 @@ module StdMeshers
{ {
}; };
/*!
* StdMeshers_PolyhedronPerSolid_3D: interface of "Polyhedron Per Solid" 3D algorithm
*/
interface StdMeshers_PolyhedronPerSolid_3D : SMESH::SMESH_3D_Algo
{
};
/*! /*!
* StdMeshers_Hexa_3D: interface of "Hexahedron (i,j,k)" algorithm * StdMeshers_Hexa_3D: interface of "Hexahedron (i,j,k)" algorithm
*/ */

@ -347,6 +347,12 @@ module SMESH
GEOM::GEOM_Object GetShapeToMesh() GEOM::GEOM_Object GetShapeToMesh()
raises (SALOME::SALOME_Exception); raises (SALOME::SALOME_Exception);
/*!
* Replaces a shape in the mesh
*/
void ReplaceShape(in GEOM::GEOM_Object theNewGeom)
raises (SALOME::SALOME_Exception);
/*! /*!
* Return false if the mesh is not yet fully loaded from the study file * Return false if the mesh is not yet fully loaded from the study file
*/ */

@ -208,6 +208,7 @@ SET(SMESH_RESOURCES_FILES
mesh_tree_hypo_volume.png mesh_tree_hypo_volume.png
mesh_tree_importedmesh.png mesh_tree_importedmesh.png
mesh_tree_mesh.png mesh_tree_mesh.png
mesh_tree_mesh_geom_modif.png
mesh_tree_mesh_partial.png mesh_tree_mesh_partial.png
mesh_tree_mesh_warn.png mesh_tree_mesh_warn.png
mesh_triangle.png mesh_triangle.png

@ -224,7 +224,6 @@
<hypothesis type ="CartesianParameters3D" <hypothesis type ="CartesianParameters3D"
label-id ="Body Fitting Parameters" label-id ="Body Fitting Parameters"
icon-id ="mesh_hypo_length.png" icon-id ="mesh_hypo_length.png"
context ="GLOBAL"
dim ="3"/> dim ="3"/>
</hypotheses> </hypotheses>
@ -318,7 +317,7 @@
<algo>MEFISTO_2D=Triangle(algo=smeshBuilder.MEFISTO)</algo> <algo>MEFISTO_2D=Triangle(algo=smeshBuilder.MEFISTO)</algo>
<hypo>LengthFromEdges=LengthFromEdges()</hypo> <hypo>LengthFromEdges=LengthFromEdges()</hypo>
<hypo>MaxElementArea=MaxElementArea(SetMaxElementArea())</hypo> <hypo>MaxElementArea=MaxElementArea(SetMaxElementArea())</hypo>
<hypo>ViscousLayers2D=ViscousLayers2D(SetTotalThickness(),SetNumberLayers(),SetStretchFactor(),SetEdges(1),SetEdges(2))</hypo> <hypo>ViscousLayers2D=ViscousLayers2D(SetTotalThickness(),SetNumberLayers(),SetStretchFactor(),SetEdges(1),SetEdges(2),SetGroupName())</hypo>
</python-wrap> </python-wrap>
</algorithm> </algorithm>
@ -335,7 +334,7 @@
<python-wrap> <python-wrap>
<algo>Quadrangle_2D=Quadrangle(algo=smeshBuilder.QUADRANGLE)</algo> <algo>Quadrangle_2D=Quadrangle(algo=smeshBuilder.QUADRANGLE)</algo>
<hypo>QuadrangleParams=QuadrangleParameters(SetQuadType(),SetTriaVertex(),SetEnforcedNodes(1),SetEnforcedNodes(2),SetCorners())</hypo> <hypo>QuadrangleParams=QuadrangleParameters(SetQuadType(),SetTriaVertex(),SetEnforcedNodes(1),SetEnforcedNodes(2),SetCorners())</hypo>
<hypo>ViscousLayers2D=ViscousLayers2D(SetTotalThickness(),SetNumberLayers(),SetStretchFactor(),SetIgnoreEdges())</hypo> <hypo>ViscousLayers2D=ViscousLayers2D(SetTotalThickness(),SetNumberLayers(),SetStretchFactor(),SetEdges(1),SetEdges(2),SetGroupName())</hypo>
</python-wrap> </python-wrap>
</algorithm> </algorithm>
@ -351,7 +350,7 @@
dim ="2"> dim ="2">
<python-wrap> <python-wrap>
<algo>QuadFromMedialAxis_1D2D=Quadrangle(algo=smeshBuilder.QUAD_MA_PROJ)</algo> <algo>QuadFromMedialAxis_1D2D=Quadrangle(algo=smeshBuilder.QUAD_MA_PROJ)</algo>
<hypo>ViscousLayers2D=ViscousLayers2D(SetTotalThickness(),SetNumberLayers(),SetStretchFactor(),SetIgnoreEdges())</hypo> <hypo>ViscousLayers2D=ViscousLayers2D(SetTotalThickness(),SetNumberLayers(),SetStretchFactor(),SetEdges(1),SetEdges(2),SetGroupName())</hypo>
<hypo>NumberOfLayers2D=NumberOfLayers(SetNumberOfLayers())</hypo> <hypo>NumberOfLayers2D=NumberOfLayers(SetNumberOfLayers())</hypo>
</python-wrap> </python-wrap>
</algorithm> </algorithm>
@ -367,7 +366,19 @@
dim ="2"> dim ="2">
<python-wrap> <python-wrap>
<algo>PolygonPerFace_2D=Polygon()</algo> <algo>PolygonPerFace_2D=Polygon()</algo>
<hypo>ViscousLayers2D=ViscousLayers2D(SetTotalThickness(),SetNumberLayers(),SetStretchFactor(),SetIgnoreEdges())</hypo> <hypo>ViscousLayers2D=ViscousLayers2D(SetTotalThickness(),SetNumberLayers(),SetStretchFactor(),SetEdges(1),SetEdges(2),SetGroupName())</hypo>
</python-wrap>
</algorithm>
<algorithm type ="PolyhedronPerSolid_3D"
label-id ="Polyhedron per Solid"
icon-id ="mesh_algo_polygon.png"
opt-hypos="ViscousLayers"
input ="POLYGON,QUAD,TRIA,EDGE"
dim ="3">
<python-wrap>
<algo>PolyhedronPerSolid_3D=Polyhedron()</algo>
<hypo>ViscousLayers=ViscousLayers(SetTotalThickness(),SetNumberLayers(),SetStretchFactor(),SetIgnoreEdges())</hypo>
</python-wrap> </python-wrap>
</algorithm> </algorithm>
@ -383,7 +394,7 @@
dim ="3"> dim ="3">
<python-wrap> <python-wrap>
<algo>Hexa_3D=Hexahedron(algo=smeshBuilder.Hexa)</algo> <algo>Hexa_3D=Hexahedron(algo=smeshBuilder.Hexa)</algo>
<hypo>ViscousLayers=ViscousLayers(SetTotalThickness(),SetNumberLayers(),SetStretchFactor(),SetFaces(1),SetFaces(2),SetMethod())</hypo> <hypo>ViscousLayers=ViscousLayers(SetTotalThickness(),SetNumberLayers(),SetStretchFactor(),SetFaces(1),SetFaces(2),SetMethod(),SetGroupName())</hypo>
</python-wrap> </python-wrap>
</algorithm> </algorithm>
@ -558,7 +569,6 @@
support-submeshes="false" support-submeshes="false"
output ="HEXA" output ="HEXA"
need-hyp ="true" need-hyp ="true"
context ="GLOBAL"
dim ="3"> dim ="3">
<python-wrap> <python-wrap>
<algo>Cartesian_3D=BodyFitted()</algo> <algo>Cartesian_3D=BodyFitted()</algo>

Binary file not shown.

After

(image error) Size: 3.2 KiB

@ -1081,7 +1081,7 @@ double AspectRatio3D::GetValue( const TSequenceOfXYZ& P )
case 5:{ case 5:{
{ {
gp_XYZ aXYZ[4] = {P( 1 ),P( 2 ),P( 3 ),P( 5 )}; gp_XYZ aXYZ[4] = {P( 1 ),P( 2 ),P( 3 ),P( 5 )};
aQuality = std::max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality); aQuality = GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4]));
} }
{ {
gp_XYZ aXYZ[4] = {P( 1 ),P( 3 ),P( 4 ),P( 5 )}; gp_XYZ aXYZ[4] = {P( 1 ),P( 3 ),P( 4 ),P( 5 )};
@ -1100,7 +1100,7 @@ double AspectRatio3D::GetValue( const TSequenceOfXYZ& P )
case 6:{ case 6:{
{ {
gp_XYZ aXYZ[4] = {P( 1 ),P( 2 ),P( 4 ),P( 6 )}; gp_XYZ aXYZ[4] = {P( 1 ),P( 2 ),P( 4 ),P( 6 )};
aQuality = std::max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality); aQuality = GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4]));
} }
{ {
gp_XYZ aXYZ[4] = {P( 1 ),P( 2 ),P( 4 ),P( 3 )}; gp_XYZ aXYZ[4] = {P( 1 ),P( 2 ),P( 4 ),P( 3 )};
@ -1127,7 +1127,7 @@ double AspectRatio3D::GetValue( const TSequenceOfXYZ& P )
case 8:{ case 8:{
{ {
gp_XYZ aXYZ[4] = {P( 1 ),P( 2 ),P( 5 ),P( 3 )}; gp_XYZ aXYZ[4] = {P( 1 ),P( 2 ),P( 5 ),P( 3 )};
aQuality = std::max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality); aQuality = GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4]));
} }
{ {
gp_XYZ aXYZ[4] = {P( 1 ),P( 2 ),P( 5 ),P( 4 )}; gp_XYZ aXYZ[4] = {P( 1 ),P( 2 ),P( 5 ),P( 4 )};
@ -1262,7 +1262,7 @@ double AspectRatio3D::GetValue( const TSequenceOfXYZ& P )
case 12: case 12:
{ {
gp_XYZ aXYZ[8] = {P( 1 ),P( 2 ),P( 4 ),P( 5 ),P( 7 ),P( 8 ),P( 10 ),P( 11 )}; gp_XYZ aXYZ[8] = {P( 1 ),P( 2 ),P( 4 ),P( 5 ),P( 7 ),P( 8 ),P( 10 ),P( 11 )};
aQuality = std::max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[8])),aQuality); aQuality = GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[8]));
} }
{ {
gp_XYZ aXYZ[8] = {P( 2 ),P( 3 ),P( 5 ),P( 6 ),P( 8 ),P( 9 ),P( 11 ),P( 12 )}; gp_XYZ aXYZ[8] = {P( 2 ),P( 3 ),P( 5 ),P( 6 ),P( 8 ),P( 9 ),P( 11 ),P( 12 )};
@ -4262,6 +4262,7 @@ private:
bool isOutOfFace (const gp_Pnt& p); bool isOutOfFace (const gp_Pnt& p);
bool isOutOfEdge (const gp_Pnt& p); bool isOutOfEdge (const gp_Pnt& p);
bool isOutOfVertex(const gp_Pnt& p); bool isOutOfVertex(const gp_Pnt& p);
bool isOutOfNone (const gp_Pnt& p) { return true; }
bool isBox (const TopoDS_Shape& s); bool isBox (const TopoDS_Shape& s);
bool (Classifier::* myIsOutFun)(const gp_Pnt& p); bool (Classifier::* myIsOutFun)(const gp_Pnt& p);
@ -4583,7 +4584,7 @@ bool ElementsOnShape::IsSatisfy (const SMDS_MeshNode* node,
{ {
isNodeOut = false; isNodeOut = false;
if ( okShape ) if ( okShape )
*okShape = myWorkClassifiers[i]->Shape(); *okShape = myClassifiers[i].Shape();
break; break;
} }
} }
@ -4621,17 +4622,27 @@ void ElementsOnShape::Classifier::Init( const TopoDS_Shape& theShape,
{ {
Standard_Real u1,u2,v1,v2; Standard_Real u1,u2,v1,v2;
Handle(Geom_Surface) surf = BRep_Tool::Surface( TopoDS::Face( theShape )); Handle(Geom_Surface) surf = BRep_Tool::Surface( TopoDS::Face( theShape ));
surf->Bounds( u1,u2,v1,v2 ); if ( surf.IsNull() )
myProjFace.Init(surf, u1,u2, v1,v2, myTol ); myIsOutFun = & ElementsOnShape::Classifier::isOutOfNone;
myIsOutFun = & ElementsOnShape::Classifier::isOutOfFace; else
{
surf->Bounds( u1,u2,v1,v2 );
myProjFace.Init(surf, u1,u2, v1,v2, myTol );
myIsOutFun = & ElementsOnShape::Classifier::isOutOfFace;
}
break; break;
} }
case TopAbs_EDGE: case TopAbs_EDGE:
{ {
Standard_Real u1, u2; Standard_Real u1, u2;
Handle(Geom_Curve) curve = BRep_Tool::Curve( TopoDS::Edge( theShape ), u1, u2); Handle(Geom_Curve) curve = BRep_Tool::Curve( TopoDS::Edge( theShape ), u1, u2);
myProjEdge.Init(curve, u1, u2); if ( curve.IsNull() )
myIsOutFun = & ElementsOnShape::Classifier::isOutOfEdge; myIsOutFun = & ElementsOnShape::Classifier::isOutOfNone;
else
{
myProjEdge.Init(curve, u1, u2);
myIsOutFun = & ElementsOnShape::Classifier::isOutOfEdge;
}
break; break;
} }
case TopAbs_VERTEX: case TopAbs_VERTEX:

@ -43,7 +43,8 @@ extern "C"
// -------------------------------------------------------------------------------- // --------------------------------------------------------------------------------
DriverGMF_Read::DriverGMF_Read(): DriverGMF_Read::DriverGMF_Read():
Driver_SMESHDS_Mesh(), Driver_SMESHDS_Mesh(),
_makeRequiredGroups( true ) _makeRequiredGroups( true ),
_makeFaultGroups( true )
{ {
} }
// -------------------------------------------------------------------------------- // --------------------------------------------------------------------------------
@ -401,10 +402,9 @@ Driver_Mesh::Status DriverGMF_Read::Perform()
} }
} }
// Read required entities into groups // Read some entities into groups
// see MeshGems/Docs/meshgems_formats_description.pdf
if ( _makeRequiredGroups )
{
// get ids of existing groups // get ids of existing groups
std::set< int > groupIDs; std::set< int > groupIDs;
const std::set<SMESHDS_GroupBase*>& groups = myMesh->GetGroups(); const std::set<SMESHDS_GroupBase*>& groups = myMesh->GetGroups();
@ -413,14 +413,20 @@ Driver_Mesh::Status DriverGMF_Read::Perform()
groupIDs.insert( (*grIter)->GetID() ); groupIDs.insert( (*grIter)->GetID() );
if ( groupIDs.empty() ) groupIDs.insert( 0 ); if ( groupIDs.empty() ) groupIDs.insert( 0 );
// Read required entities into groups
if ( _makeRequiredGroups )
{
const int kes[4][3] = { { GmfRequiredVertices, SMDSAbs_Node, nodeIDShift }, const int kes[4][3] = { { GmfRequiredVertices, SMDSAbs_Node, nodeIDShift },
{ GmfRequiredEdges, SMDSAbs_Edge, edgeIDShift }, { GmfRequiredEdges, SMDSAbs_Edge, edgeIDShift },
{ GmfRequiredTriangles, SMDSAbs_Face, triaIDShift }, { GmfRequiredTriangles, SMDSAbs_Face, triaIDShift },
{ GmfRequiredQuadrilaterals,SMDSAbs_Face, quadIDShift }}; { GmfRequiredQuadrilaterals,SMDSAbs_Face, quadIDShift }
};
const char* names[4] = { "_required_Vertices" , const char* names[4] = { "_required_Vertices" ,
"_required_Edges" , "_required_Edges" ,
"_required_Triangles" , "_required_Triangles" ,
"_required_Quadrilaterals" }; "_required_Quadrilaterals"
};
for ( int i = 0; i < 4; ++i ) for ( int i = 0; i < 4; ++i )
{ {
int gmfKwd = kes[i][0]; int gmfKwd = kes[i][0];
@ -444,6 +450,50 @@ Driver_Mesh::Status DriverGMF_Read::Perform()
} }
} }
// Read fault entities into groups
if ( _makeFaultGroups )
{
const int kes[7][3] = { { GmfFault_SmallTri, SMDSAbs_Face, triaIDShift },
{ GmfFault_BadShape, SMDSAbs_Face, triaIDShift },
{ GmfFault_Overlap, SMDSAbs_Face, triaIDShift },
{ GmfFault_Inter, SMDSAbs_Face, triaIDShift },
{ GmfFault_NearTri, SMDSAbs_Face, triaIDShift },
{ GmfFault_FreeEdge, SMDSAbs_Face, triaIDShift },
{ GmfFault_MultipleEdge, SMDSAbs_Face, triaIDShift }
};
const char* names[7] = { "Fault_SmallTri",
"Fault_BadShape",
"Fault_Overlap",
"Fault_Inter",
"Fault_NearTri",
"Fault_FreeEdge",
"Fault_MultipleEdge"
};
for ( int i = 0; i < 7; ++i )
{
int gmfKwd = kes[i][0];
SMDSAbs_ElementType entity = (SMDSAbs_ElementType) kes[i][1];
int shift = kes[i][2];
if ( int nb = GmfStatKwd(meshID, gmfKwd))
{
const int newID = *groupIDs.rbegin() + 1;
groupIDs.insert( newID );
SMESHDS_Group* group = new SMESHDS_Group( newID, myMesh, entity );
group->SetStoreName( names[i] );
myMesh->AddGroup( group );
GmfGotoKwd(meshID, gmfKwd);
for ( int i = 0; i < nb; ++i )
{
GmfGetLin(meshID, gmfKwd, &iN[0] );
group->Add( shift + iN[0] );
}
}
}
}
myMesh->Modified(); myMesh->Modified();
myMesh->CompactMesh(); myMesh->CompactMesh();

@ -50,6 +50,11 @@ public:
_makeRequiredGroups = theMakeRequiredGroups; _makeRequiredGroups = theMakeRequiredGroups;
} }
void SetMakeFaultGroups( bool theMakeFaultGroups )
{
_makeFaultGroups = theMakeFaultGroups;
}
virtual Status Perform(); virtual Status Perform();
private: private:
@ -57,6 +62,7 @@ public:
Status storeBadNodeIds(const char* gmfKwd, int elemNb, int nb, ...); Status storeBadNodeIds(const char* gmfKwd, int elemNb, int nb, ...);
bool _makeRequiredGroups; bool _makeRequiredGroups;
bool _makeFaultGroups;
}; };

@ -78,6 +78,7 @@ typedef struct
static int GmfIniFlg=0; static int GmfIniFlg=0;
static GmfMshSct *GmfMshTab[ MaxMsh + 1 ]; static GmfMshSct *GmfMshTab[ MaxMsh + 1 ];
// see MeshGems/Docs/meshgems_formats_description.pdf
static const char *GmfKwdFmt[ GmfMaxKwd + 1 ][4] = static const char *GmfKwdFmt[ GmfMaxKwd + 1 ][4] =
{ {"Reserved", "", "", ""}, { {"Reserved", "", "", ""},
{"MeshVersionFormatted", "", "", "i"}, {"MeshVersionFormatted", "", "", "i"},
@ -159,7 +160,8 @@ static const char *GmfKwdFmt[ GmfMaxKwd + 1 ][4] =
{"Iterations", "","","i"}, {"Iterations", "","","i"},
{"Time", "","","r"}, {"Time", "","","r"},
{"Fault_SmallTri", "Fault_SmallTri","i","i"}, {"Fault_SmallTri", "Fault_SmallTri","i","i"},
{"CoarseHexahedra", "CoarseHexahedron", "i", "i"} {"CoarseHexahedra", "CoarseHexahedron", "i", "i"},
{"Fault_MultipleEdge", "Fault_MultipleEdge", "i", "i"}
}; };
@ -1062,7 +1064,7 @@ static int ScaKwdTab(GmfMshSct *msh)
{ {
/* Search which kwd code this string is associated with, /* Search which kwd code this string is associated with,
then get its header and save the current position in file (just before the data) */ then get its header and save the current position in file (just before the data) */
// printf("libmesh ScaKwdTab %s\n", str);
for(KwdCod=1; KwdCod<= GmfMaxKwd; KwdCod++) for(KwdCod=1; KwdCod<= GmfMaxKwd; KwdCod++)
if(!strcmp(str, GmfKwdFmt[ KwdCod ][0])) if(!strcmp(str, GmfKwdFmt[ KwdCod ][0]))
{ {

@ -22,7 +22,7 @@
#define GmfStrSiz 1024 #define GmfStrSiz 1024
#define GmfMaxTyp 1000 #define GmfMaxTyp 1000
#define GmfMaxKwd 80 #define GmfMaxKwd 81
#define GmfMshVer 1 #define GmfMshVer 1
#define GmfRead 1 #define GmfRead 1
#define GmfWrite 2 #define GmfWrite 2
@ -33,6 +33,7 @@
#define GmfFloat 1 #define GmfFloat 1
#define GmfDouble 2 #define GmfDouble 2
// see MeshGems/Docs/meshgems_formats_description.pdf
enum GmfKwdCod enum GmfKwdCod
{ {
GmfReserved1, \ GmfReserved1, \
@ -115,7 +116,8 @@ enum GmfKwdCod
GmfIterations, \ GmfIterations, \
GmfTime, \ GmfTime, \
GmfFault_SmallTri, \ GmfFault_SmallTri, \
GmfCoarseHexahedra GmfCoarseHexahedra, \
GmfFault_MultipleEdge
}; };

@ -25,18 +25,18 @@
#include <VTKViewer_CellCenters.h> #include <VTKViewer_CellCenters.h>
#include <vtkCellArray.h>
#include <vtkCellData.h> #include <vtkCellData.h>
#include <vtkDataSet.h> #include <vtkDataSet.h>
#include <vtkPolyData.h>
#include <vtkObjectFactory.h>
#include <vtkInformation.h>
#include <vtkInformationVector.h>
#include <vtkFloatArray.h> #include <vtkFloatArray.h>
#include <vtkCellArray.h>
#include <vtkMaskPoints.h>
#include <vtkGlyph3D.h> #include <vtkGlyph3D.h>
#include <vtkGlyphSource2D.h> #include <vtkGlyphSource2D.h>
#include <vtkInformation.h>
#include <vtkInformationVector.h>
#include <vtkMaskPoints.h>
#include <vtkObjectFactory.h>
#include <vtkPolyData.h>
#include <vtkPolygon.h>
#include <QColor> #include <QColor>
@ -216,13 +216,16 @@ void GetFaceParams( vtkCell* theFace, double theNormal[3], double& theSize )
vtkPoints* aPoints = theFace->GetPoints(); vtkPoints* aPoints = theFace->GetPoints();
// here we get first 3 points from the face and calculate the normal as a cross-product of vectors // here we get first 3 points from the face and calculate the normal as a cross-product of vectors
double x0 = aPoints->GetPoint(0)[0], y0 = aPoints->GetPoint(0)[1], z0 = aPoints->GetPoint(0)[2]; // double x0 = aPoints->GetPoint(0)[0], y0 = aPoints->GetPoint(0)[1], z0 = aPoints->GetPoint(0)[2];
double x1 = aPoints->GetPoint(1)[0], y1 = aPoints->GetPoint(1)[1], z1 = aPoints->GetPoint(1)[2]; // double x1 = aPoints->GetPoint(1)[0], y1 = aPoints->GetPoint(1)[1], z1 = aPoints->GetPoint(1)[2];
double x2 = aPoints->GetPoint(2)[0], y2 = aPoints->GetPoint(2)[1], z2 = aPoints->GetPoint(2)[2]; // double x2 = aPoints->GetPoint(2)[0], y2 = aPoints->GetPoint(2)[1], z2 = aPoints->GetPoint(2)[2];
theNormal[0] = ( y1 - y0 ) * ( z2 - z0 ) - ( z1 - z0 ) * ( y2 - y0 ); // theNormal[0] = ( y1 - y0 ) * ( z2 - z0 ) - ( z1 - z0 ) * ( y2 - y0 );
theNormal[1] = ( z1 - z0 ) * ( x2 - x0 ) - ( x1 - x0 ) * ( z2 - z0 ); // theNormal[1] = ( z1 - z0 ) * ( x2 - x0 ) - ( x1 - x0 ) * ( z2 - z0 );
theNormal[2] = ( x1 - x0 ) * ( y2 - y0 ) - ( y1 - y0 ) * ( x2 - x0 ); // theNormal[2] = ( x1 - x0 ) * ( y2 - y0 ) - ( y1 - y0 ) * ( x2 - x0 );
// issue #18665: Polyhedron volume calculation
vtkPolygon::ComputeNormal( aPoints, theNormal );
double* aBounds = theFace->GetBounds(); double* aBounds = theFace->GetBounds();
theSize = pow( pow( aBounds[1] - aBounds[0], 2 ) + theSize = pow( pow( aBounds[1] - aBounds[0], 2 ) +

@ -29,7 +29,7 @@
void SMDS_BallElement::init(const SMDS_MeshNode * node, double diameter ) void SMDS_BallElement::init(const SMDS_MeshNode * node, double diameter )
{ {
int nodeVtkID = node->GetVtkID(); vtkIdType nodeVtkID = node->GetVtkID();
int vtkID = getGrid()->InsertNextLinkedCell( toVtkType( SMDSEntity_Ball ), 1, &nodeVtkID ); int vtkID = getGrid()->InsertNextLinkedCell( toVtkType( SMDSEntity_Ball ), 1, &nodeVtkID );
setVtkID( vtkID ); setVtkID( vtkID );
getGrid()->SetBallDiameter( GetVtkID(), diameter ); getGrid()->SetBallDiameter( GetVtkID(), diameter );

@ -706,11 +706,12 @@ double SMDS_VolumeTool::GetSize() const
if ( !myPolyedre ) if ( !myPolyedre )
return 0.; return 0.;
SaveFacet savedFacet( myCurFace );
// split a polyhedron into tetrahedrons // split a polyhedron into tetrahedrons
SaveFacet savedFacet( myCurFace ); bool oriOk = true;
SMDS_VolumeTool* me = const_cast< SMDS_VolumeTool* > ( this ); SMDS_VolumeTool* me = const_cast< SMDS_VolumeTool* > ( this );
XYZ origin( 1 + 1e-6, 22 + 2e-6, 333 + 3e-6 ); // for invalid poly: avoid lying on a facet plane
for ( int f = 0; f < NbFaces(); ++f ) for ( int f = 0; f < NbFaces(); ++f )
{ {
me->setFace( f ); me->setFace( f );
@ -721,9 +722,12 @@ double SMDS_VolumeTool::GetSize() const
area = area + p1.Crossed( p2 ); area = area + p1.Crossed( p2 );
p1 = p2; p1 = p2;
} }
V += ( p1 - origin ).Dot( area ); V += p1.Dot( area );
oriOk = oriOk && IsFaceExternal( f );
} }
V /= 6; V /= 6;
if ( !oriOk && V > 0 )
V *= -1;
} }
else else
{ {
@ -1203,11 +1207,13 @@ bool SMDS_VolumeTool::GetFaceNormal (int faceIndex, double & X, double & Y, doub
XYZ aVec13( p3 - p1 ); XYZ aVec13( p3 - p1 );
XYZ cross = aVec12.Crossed( aVec13 ); XYZ cross = aVec12.Crossed( aVec13 );
if ( myCurFace.myNbNodes >3*iQuad ) { for ( int i = 3*iQuad; i < myCurFace.myNbNodes; i += iQuad )
XYZ p4 ( myCurFace.myNodes[3*iQuad] ); {
XYZ p4 ( myCurFace.myNodes[i] );
XYZ aVec14( p4 - p1 ); XYZ aVec14( p4 - p1 );
XYZ cross2 = aVec13.Crossed( aVec14 ); XYZ cross2 = aVec13.Crossed( aVec14 );
cross = cross + cross2; cross = cross + cross2;
aVec13 = aVec14;
} }
double size = cross.Magnitude(); double size = cross.Magnitude();

@ -176,10 +176,18 @@ SMESH_Mesh::~SMESH_Mesh()
{ {
if(MYDEBUG) MESSAGE("SMESH_Mesh::~SMESH_Mesh"); if(MYDEBUG) MESSAGE("SMESH_Mesh::~SMESH_Mesh");
// avoid usual removal of elements while processing RemoveHypothesis( algo ) event if ( _myDocument ) // avoid destructing _myMeshDS from ~SMESH_Gen()
SMESHDS_SubMeshIteratorPtr smIt = _myMeshDS->SubMeshes(); _myDocument->RemoveMesh( _id );
while ( smIt->more() ) _myDocument = 0;
const_cast<SMESHDS_SubMesh*>( smIt->next() )->Clear();
// remove self from studyContext
if ( _gen )
{
StudyContextStruct * studyContext = _gen->GetStudyContext();
studyContext->mapMesh.erase( _id );
}
_myMeshDS->ClearMesh();
// issue 0020340: EDF 1022 SMESH : Crash with FindNodeClosestTo in a second new study // issue 0020340: EDF 1022 SMESH : Crash with FindNodeClosestTo in a second new study
// Notify event listeners at least that something happens // Notify event listeners at least that something happens
@ -200,16 +208,6 @@ SMESH_Mesh::~SMESH_Mesh()
if ( _callUp) delete _callUp; if ( _callUp) delete _callUp;
_callUp = 0; _callUp = 0;
// remove self from studyContext
if ( _gen )
{
StudyContextStruct * studyContext = _gen->GetStudyContext();
studyContext->mapMesh.erase( _id );
}
if ( _myDocument )
_myDocument->RemoveMesh( _id );
_myDocument = 0;
if ( _myMeshDS ) { if ( _myMeshDS ) {
// delete _myMeshDS, in a thread in order not to block closing a study with large meshes // delete _myMeshDS, in a thread in order not to block closing a study with large meshes
#ifndef WIN32 #ifndef WIN32

@ -87,6 +87,9 @@ class SMESH_EXPORT SMESH_Mesh
* \brief Return true if there is a geometry to be meshed, not PseudoShape() * \brief Return true if there is a geometry to be meshed, not PseudoShape()
*/ */
bool HasShapeToMesh() const { return _isShapeToMesh; } bool HasShapeToMesh() const { return _isShapeToMesh; }
void UndefShapeToMesh() { _isShapeToMesh = false; }
/*! /*!
* \brief Return diagonal size of bounding box of shape to mesh. * \brief Return diagonal size of bounding box of shape to mesh.
*/ */

@ -161,8 +161,7 @@ SMESH_MeshEditor::ElemFeatures::Init( const SMDS_MeshElement* elem, bool basicOn
myIsQuad = elem->IsQuadratic(); myIsQuad = elem->IsQuadratic();
if ( myType == SMDSAbs_Volume && !basicOnly ) if ( myType == SMDSAbs_Volume && !basicOnly )
{ {
vector<int> quant = static_cast<const SMDS_MeshVolume* >( elem )->GetQuantities(); myPolyhedQuantities = static_cast<const SMDS_MeshVolume* >( elem )->GetQuantities();
myPolyhedQuantities.swap( quant );
} }
} }
} }
@ -297,6 +296,18 @@ SMESH_MeshEditor::AddElement(const vector<const SMDS_MeshNode*> & node,
node[8], node[9], node[10],node[11], node[8], node[9], node[10],node[11],
node[12],node[13],node[14] ); node[12],node[13],node[14] );
} }
else if (nbnode == 18) {
if ( ID >= 1 ) e = mesh->AddVolumeWithID(node[0], node[1], node[2], node[3],
node[4], node[5], node[6], node[7],
node[8], node[9], node[10],node[11],
node[12],node[13],node[14],
node[15],node[16],node[17],ID );
else e = mesh->AddVolume (node[0], node[1], node[2], node[3],
node[4], node[5], node[6], node[7],
node[8], node[9], node[10],node[11],
node[12],node[13],node[14],
node[15],node[16],node[17] );
}
else if (nbnode == 20) { else if (nbnode == 20) {
if ( ID >= 1 ) e = mesh->AddVolumeWithID(node[0], node[1], node[2], node[3], if ( ID >= 1 ) e = mesh->AddVolumeWithID(node[0], node[1], node[2], node[3],
node[4], node[5], node[6], node[7], node[4], node[5], node[6], node[7],
@ -9880,10 +9891,10 @@ SMESH_MeshEditor::FindMatchingNodes(set<const SMDS_MeshElement*>& theSide1,
set<const SMDS_MeshElement*> * faceSetPtr[] = { &theSide1, &theSide2 }; set<const SMDS_MeshElement*> * faceSetPtr[] = { &theSide1, &theSide2 };
nReplaceMap.clear(); nReplaceMap.clear();
if ( theFirstNode1 != theFirstNode2 ) //if ( theFirstNode1 != theFirstNode2 )
nReplaceMap.insert( make_pair( theFirstNode1, theFirstNode2 )); nReplaceMap.insert( make_pair( theFirstNode1, theFirstNode2 ));
if ( theSecondNode1 != theSecondNode2 ) //if ( theSecondNode1 != theSecondNode2 )
nReplaceMap.insert( make_pair( theSecondNode1, theSecondNode2 )); nReplaceMap.insert( make_pair( theSecondNode1, theSecondNode2 ));
set< SMESH_TLink > linkSet; // set of nodes where order of nodes is ignored set< SMESH_TLink > linkSet; // set of nodes where order of nodes is ignored
linkSet.insert( SMESH_TLink( theFirstNode1, theSecondNode1 )); linkSet.insert( SMESH_TLink( theFirstNode1, theSecondNode1 ));

@ -115,9 +115,12 @@ void SMESHDS_SubMesh::AddElement(const SMDS_MeshElement * elem)
(LOCALIZED("add element in subshape already belonging to a subshape")); (LOCALIZED("add element in subshape already belonging to a subshape"));
} }
} }
else
{
++myNbElements;
}
elem->setShapeID( myIndex ); elem->setShapeID( myIndex );
myNbElements++;
// remember element with smallest ID to optimize iteration on them // remember element with smallest ID to optimize iteration on them
add( elem ); add( elem );
@ -178,8 +181,11 @@ void SMESHDS_SubMesh::AddNode(const SMDS_MeshNode * N)
(LOCALIZED("a node being in sub-mesh is added to another sub-mesh")); (LOCALIZED("a node being in sub-mesh is added to another sub-mesh"));
return; // already in return; // already in
} }
else
{
++myNbNodes;
}
N->setShapeID( myIndex ); N->setShapeID( myIndex );
myNbNodes++;
// remember node with smallest ID to optimize iteration on them // remember node with smallest ID to optimize iteration on them
add( N ); add( N );

@ -172,6 +172,7 @@
#include <SALOMEDS_Study.hxx> #include <SALOMEDS_Study.hxx>
#include <SALOMEDS_SObject.hxx> #include <SALOMEDS_SObject.hxx>
#include "utilities.h" #include "utilities.h"
#include <SALOME_LifeCycleCORBA.hxx>
// OCCT includes // OCCT includes
#include <Standard_ErrorHandler.hxx> #include <Standard_ErrorHandler.hxx>
@ -1382,6 +1383,108 @@ namespace
} }
} }
// Break link with Shaper model
void breakShaperLink()
{
LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
SALOME_ListIO selected;
if (aSel) {
aSel->selectedObjects(selected);
if (selected.Extent()) {
Handle(SALOME_InteractiveObject) anIObject = selected.First();
_PTR(Study) aStudy = SMESH::getStudy();
std::string aEntry = anIObject->getEntry();
_PTR(SObject) aSObj = aStudy->FindObjectID(aEntry);
if (aSObj) {
std::string aName = aSObj->GetName();
QMessageBox::StandardButton aRes = SUIT_MessageBox::warning(SMESHGUI::desktop(),
QObject::tr("SMESH_WRN_WARNING"),
QObject::tr("MSG_BREAK_SHAPER_LINK").arg(aName.c_str()),
SUIT_MessageBox::Yes | SUIT_MessageBox::No, SUIT_MessageBox::No);
if (aRes == SUIT_MessageBox::Yes) {
SUIT_DataOwnerPtrList aList;
aSel->selected(aList, "ObjectBrowser", true);
SUIT_DataOwner* aOwn = aList.first();
LightApp_DataOwner* sowner = dynamic_cast<LightApp_DataOwner*>(aOwn);
QString aREntry = sowner->entry();
static GEOM::GEOM_Gen_var geomGen;
if (CORBA::is_nil(geomGen)) {
SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>
(SUIT_Session::session()->activeApplication());
if (app) {
SALOME_LifeCycleCORBA* ls = new SALOME_LifeCycleCORBA(app->namingService());
Engines::EngineComponent_var comp =
ls->FindOrLoad_Component("FactoryServer", "SHAPERSTUDY");
geomGen = GEOM::GEOM_Gen::_narrow(comp);
}
}
if (!CORBA::is_nil(geomGen))
{
geomGen->BreakLink(aREntry.toStdString().c_str());
SMESHGUI::GetSMESHGUI()->updateObjBrowser();
// remove actors whose objects are removed by BreakLink()
QList<SUIT_ViewWindow*> wndList = SMESHGUI::desktop()->windows();
SUIT_ViewWindow* wnd;
foreach(wnd, wndList)
SMESH::UpdateActorsAfterUpdateStudy(wnd);
}
}
}
}
}
}
//================================================================================
/*!
* \brief Return true if a mesh icon == ICON_SMESH_TREE_GEOM_MODIF
* which means that the mesh can't be modified. It should be either re-computed
* or breakShaperLink()'ed. Warn the user about it.
*/
//================================================================================
bool warnOnGeomModif()
{
SALOME_ListIO selected;
if ( LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr() )
aSel->selectedObjects(selected,"",/*convertReferences=*/false);
SALOME_ListIteratorOfListIO It( selected );
for ( ; It.More(); It.Next() )
{
Handle(SALOME_InteractiveObject) io = It.Value();
if ( !io->hasEntry() ) continue;
_PTR(SObject) so = SMESH::getStudy()->FindObjectID( io->getEntry() );
SMESH::SMESH_Mesh_var mesh;
while ( mesh->_is_nil() && so )
{
CORBA::Object_var obj = SMESH::SObjectToObject( so );
SMESH::SMESH_IDSource_var isrc = SMESH::SMESH_IDSource::_narrow( obj );
if ( isrc->_is_nil() )
so = so->GetFather();
else
mesh = isrc->GetMesh();
}
if ( mesh->_is_nil() ) continue;
so = SMESH::FindSObject( mesh );
if ( !so ) continue;
_PTR(GenericAttribute) attr;
so->FindAttribute( attr, "AttributePixMap" );
_PTR(AttributePixMap) pixmap = attr;
if ( !pixmap ) continue;
if ( pixmap->GetPixMap() == "ICON_SMESH_TREE_GEOM_MODIF" )
{
SUIT_MessageBox::warning(SMESHGUI::desktop(),
QObject::tr("SMESH_WRN_WARNING"),
QObject::tr("MSG_WARN_ON_GEOM_MODIF"));
return true;
}
}
return false;
}
void SetDisplayMode(int theCommandID, VTK::MarkerMap& theMarkerMap) void SetDisplayMode(int theCommandID, VTK::MarkerMap& theMarkerMap)
{ {
SALOME_ListIO selected; SALOME_ListIO selected;
@ -2754,16 +2857,19 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
break; break;
} }
case SMESHOp::OpCreateMesh:
case SMESHOp::OpCreateSubMesh:
case SMESHOp::OpEditMeshOrSubMesh: case SMESHOp::OpEditMeshOrSubMesh:
case SMESHOp::OpEditMesh: case SMESHOp::OpEditMesh:
case SMESHOp::OpEditSubMesh: case SMESHOp::OpEditSubMesh:
case SMESHOp::OpMeshOrder:
case SMESHOp::OpCreateSubMesh:
if ( warnOnGeomModif() )
break; // action forbiden as geometry modified
case SMESHOp::OpCreateMesh:
case SMESHOp::OpCompute: case SMESHOp::OpCompute:
case SMESHOp::OpComputeSubMesh: case SMESHOp::OpComputeSubMesh:
case SMESHOp::OpPreCompute: case SMESHOp::OpPreCompute:
case SMESHOp::OpEvaluate: case SMESHOp::OpEvaluate:
case SMESHOp::OpMeshOrder:
startOperation( theCommandID ); startOperation( theCommandID );
break; break;
case SMESHOp::OpCopyMesh: case SMESHOp::OpCopyMesh:
@ -2792,6 +2898,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
if ( isStudyLocked() ) if ( isStudyLocked() )
break; break;
if ( warnOnGeomModif() )
break; // action forbiden as geometry modified
/*Standard_Boolean aRes; /*Standard_Boolean aRes;
SMESH::SMESH_Mesh_var aMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IObject); SMESH::SMESH_Mesh_var aMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IObject);
@ -2822,6 +2930,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
if ( isStudyLocked() ) if ( isStudyLocked() )
break; break;
if ( warnOnGeomModif() )
break; // action forbiden as geometry modified
EmitSignalDeactivateDialog(); EmitSignalDeactivateDialog();
SMESHGUI_MultiEditDlg* aDlg = NULL; SMESHGUI_MultiEditDlg* aDlg = NULL;
@ -2840,6 +2950,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
case SMESHOp::OpSmoothing: case SMESHOp::OpSmoothing:
{ {
if(isStudyLocked()) break; if(isStudyLocked()) break;
if ( warnOnGeomModif() )
break; // action forbiden as geometry modified
if( vtkwnd ) { if( vtkwnd ) {
EmitSignalDeactivateDialog(); EmitSignalDeactivateDialog();
( new SMESHGUI_SmoothingDlg( this ) )->show(); ( new SMESHGUI_SmoothingDlg( this ) )->show();
@ -2852,6 +2964,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
case SMESHOp::OpExtrusion: case SMESHOp::OpExtrusion:
{ {
if (isStudyLocked()) break; if (isStudyLocked()) break;
if ( warnOnGeomModif() )
break; // action forbiden as geometry modified
if (vtkwnd) { if (vtkwnd) {
EmitSignalDeactivateDialog(); EmitSignalDeactivateDialog();
( new SMESHGUI_ExtrusionDlg ( this ) )->show(); ( new SMESHGUI_ExtrusionDlg ( this ) )->show();
@ -2863,6 +2977,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
case SMESHOp::OpExtrusionAlongAPath: case SMESHOp::OpExtrusionAlongAPath:
{ {
if (isStudyLocked()) break; if (isStudyLocked()) break;
if ( warnOnGeomModif() )
break; // action forbiden as geometry modified
if (vtkwnd) { if (vtkwnd) {
EmitSignalDeactivateDialog(); EmitSignalDeactivateDialog();
( new SMESHGUI_ExtrusionAlongPathDlg( this ) )->show(); ( new SMESHGUI_ExtrusionAlongPathDlg( this ) )->show();
@ -2874,6 +2990,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
case SMESHOp::OpRevolution: case SMESHOp::OpRevolution:
{ {
if(isStudyLocked()) break; if(isStudyLocked()) break;
if ( warnOnGeomModif() )
break; // action forbiden as geometry modified
if( vtkwnd ) { if( vtkwnd ) {
EmitSignalDeactivateDialog(); EmitSignalDeactivateDialog();
( new SMESHGUI_RevolutionDlg( this ) )->show(); ( new SMESHGUI_RevolutionDlg( this ) )->show();
@ -2887,6 +3005,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
{ {
if ( isStudyLocked() ) if ( isStudyLocked() )
break; break;
if ( warnOnGeomModif() )
break; // action forbiden as geometry modified
if ( vtkwnd ) if ( vtkwnd )
{ {
EmitSignalDeactivateDialog(); EmitSignalDeactivateDialog();
@ -2903,6 +3023,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
case SMESHOp::OpReorientFaces: case SMESHOp::OpReorientFaces:
case SMESHOp::OpCreateGeometryGroup: case SMESHOp::OpCreateGeometryGroup:
{ {
if ( warnOnGeomModif() )
break; // action forbiden as geometry modified
startOperation( theCommandID ); startOperation( theCommandID );
break; break;
} }
@ -2915,6 +3037,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
} }
if(isStudyLocked()) break; if(isStudyLocked()) break;
if ( warnOnGeomModif() )
break; // action forbiden as geometry modified
EmitSignalDeactivateDialog(); EmitSignalDeactivateDialog();
SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_nil(); SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_nil();
@ -2942,6 +3066,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
} }
if(isStudyLocked()) break; if(isStudyLocked()) break;
if ( warnOnGeomModif() )
break; // action forbiden as geometry modified
EmitSignalDeactivateDialog(); EmitSignalDeactivateDialog();
LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr(); LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
@ -3019,6 +3145,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
} }
if(isStudyLocked()) break; if(isStudyLocked()) break;
if ( warnOnGeomModif() )
break; // action forbiden as geometry modified
EmitSignalDeactivateDialog(); EmitSignalDeactivateDialog();
LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr(); LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
@ -3116,6 +3244,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
if ( isStudyLocked() ) if ( isStudyLocked() )
break; break;
if ( warnOnGeomModif() )
break; // action forbiden as geometry modified
EmitSignalDeactivateDialog(); EmitSignalDeactivateDialog();
@ -3136,6 +3266,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
{ {
if ( isStudyLocked() ) if ( isStudyLocked() )
break; break;
if ( warnOnGeomModif() )
break; // action forbiden as geometry modified
EmitSignalDeactivateDialog(); EmitSignalDeactivateDialog();
SMESHGUI_GroupOpDlg* aDlg = new SMESHGUI_DimGroupDlg( this ); SMESHGUI_GroupOpDlg* aDlg = new SMESHGUI_DimGroupDlg( this );
@ -3148,6 +3280,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
{ {
if ( isStudyLocked() ) if ( isStudyLocked() )
break; break;
if ( warnOnGeomModif() )
break; // action forbiden as geometry modified
EmitSignalDeactivateDialog(); EmitSignalDeactivateDialog();
SMESHGUI_FaceGroupsSeparatedByEdgesDlg* aDlg = new SMESHGUI_FaceGroupsSeparatedByEdgesDlg( this ); SMESHGUI_FaceGroupsSeparatedByEdgesDlg* aDlg = new SMESHGUI_FaceGroupsSeparatedByEdgesDlg( this );
@ -3207,6 +3341,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
case SMESHOp::OpEditHypothesis: case SMESHOp::OpEditHypothesis:
{ {
if(isStudyLocked()) break; if(isStudyLocked()) break;
if ( warnOnGeomModif() )
break; // action forbiden as geometry modified
LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr(); LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
SALOME_ListIO selected; SALOME_ListIO selected;
@ -3252,6 +3388,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
case SMESHOp::OpUnassign: // REMOVE HYPOTHESIS / ALGORITHMS case SMESHOp::OpUnassign: // REMOVE HYPOTHESIS / ALGORITHMS
{ {
if(isStudyLocked()) break; if(isStudyLocked()) break;
if ( warnOnGeomModif() )
break; // action forbiden as geometry modified
SUIT_OverrideCursor wc; SUIT_OverrideCursor wc;
LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr(); LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
@ -3283,6 +3421,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
case SMESHOp::OpHexagonalPrism: case SMESHOp::OpHexagonalPrism:
{ {
if(isStudyLocked()) break; if(isStudyLocked()) break;
if ( warnOnGeomModif() )
break; // action forbiden as geometry modified
if ( vtkwnd ) { if ( vtkwnd ) {
EmitSignalDeactivateDialog(); EmitSignalDeactivateDialog();
SMDSAbs_EntityType type = SMDSEntity_Edge; SMDSAbs_EntityType type = SMDSEntity_Edge;
@ -3309,6 +3449,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
case SMESHOp::OpPolyhedron: case SMESHOp::OpPolyhedron:
{ {
if(isStudyLocked()) break; if(isStudyLocked()) break;
if ( warnOnGeomModif() )
break; // action forbiden as geometry modified
if ( vtkwnd ) { if ( vtkwnd ) {
EmitSignalDeactivateDialog(); EmitSignalDeactivateDialog();
( new SMESHGUI_CreatePolyhedralVolumeDlg( this ) )->show(); ( new SMESHGUI_CreatePolyhedralVolumeDlg( this ) )->show();
@ -3332,6 +3474,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
case SMESHOp::OpTriQuadraticHexahedron: case SMESHOp::OpTriQuadraticHexahedron:
{ {
if(isStudyLocked()) break; if(isStudyLocked()) break;
if ( warnOnGeomModif() )
break; // action forbiden as geometry modified
if ( vtkwnd ) { if ( vtkwnd ) {
EmitSignalDeactivateDialog(); EmitSignalDeactivateDialog();
SMDSAbs_EntityType type = SMDSEntity_Last; SMDSAbs_EntityType type = SMDSEntity_Last;
@ -3363,6 +3507,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
case SMESHOp::OpRemoveNodes: case SMESHOp::OpRemoveNodes:
{ {
if(isStudyLocked()) break; if(isStudyLocked()) break;
if ( warnOnGeomModif() )
break; // action forbiden as geometry modified
if ( vtkwnd ) { if ( vtkwnd ) {
EmitSignalDeactivateDialog(); EmitSignalDeactivateDialog();
( new SMESHGUI_RemoveNodesDlg( this ) )->show(); ( new SMESHGUI_RemoveNodesDlg( this ) )->show();
@ -3376,6 +3522,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
case SMESHOp::OpRemoveElements: // REMOVES ELEMENTS case SMESHOp::OpRemoveElements: // REMOVES ELEMENTS
{ {
if(isStudyLocked()) break; if(isStudyLocked()) break;
if ( warnOnGeomModif() )
break; // action forbiden as geometry modified
if( vtkwnd ) { if( vtkwnd ) {
EmitSignalDeactivateDialog(); EmitSignalDeactivateDialog();
( new SMESHGUI_RemoveElementsDlg( this ) )->show(); ( new SMESHGUI_RemoveElementsDlg( this ) )->show();
@ -3390,6 +3538,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
case SMESHOp::OpClearMesh: { case SMESHOp::OpClearMesh: {
if(isStudyLocked()) break; if(isStudyLocked()) break;
if ( warnOnGeomModif() )
break; // action forbiden as geometry modified
SALOME_ListIO selected; SALOME_ListIO selected;
if( LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr() ) if( LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr() )
@ -3429,6 +3579,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
case SMESHOp::OpRemoveOrphanNodes: case SMESHOp::OpRemoveOrphanNodes:
{ {
if(isStudyLocked()) break; if(isStudyLocked()) break;
if ( warnOnGeomModif() )
break; // action forbiden as geometry modified
SALOME_ListIO selected; SALOME_ListIO selected;
if( LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr() ) if( LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr() )
aSel->selectedObjects( selected ); aSel->selectedObjects( selected );
@ -3468,6 +3620,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
case SMESHOp::OpRenumberingNodes: case SMESHOp::OpRenumberingNodes:
{ {
if(isStudyLocked()) break; if(isStudyLocked()) break;
if ( warnOnGeomModif() )
break; // action forbiden as geometry modified
if( vtkwnd ) { if( vtkwnd ) {
EmitSignalDeactivateDialog(); EmitSignalDeactivateDialog();
( new SMESHGUI_RenumberingDlg( this, 0 ) )->show(); ( new SMESHGUI_RenumberingDlg( this, 0 ) )->show();
@ -3482,6 +3636,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
case SMESHOp::OpRenumberingElements: case SMESHOp::OpRenumberingElements:
{ {
if(isStudyLocked()) break; if(isStudyLocked()) break;
if ( warnOnGeomModif() )
break; // action forbiden as geometry modified
if ( vtkwnd ) { if ( vtkwnd ) {
EmitSignalDeactivateDialog(); EmitSignalDeactivateDialog();
( new SMESHGUI_RenumberingDlg( this, 1 ) )->show(); ( new SMESHGUI_RenumberingDlg( this, 1 ) )->show();
@ -3496,6 +3652,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
case SMESHOp::OpTranslation: case SMESHOp::OpTranslation:
{ {
if(isStudyLocked()) break; if(isStudyLocked()) break;
if ( warnOnGeomModif() )
break; // action forbiden as geometry modified
if ( vtkwnd ) { if ( vtkwnd ) {
EmitSignalDeactivateDialog(); EmitSignalDeactivateDialog();
( new SMESHGUI_TranslationDlg( this ) )->show(); ( new SMESHGUI_TranslationDlg( this ) )->show();
@ -3509,6 +3667,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
case SMESHOp::OpRotation: case SMESHOp::OpRotation:
{ {
if(isStudyLocked()) break; if(isStudyLocked()) break;
if ( warnOnGeomModif() )
break; // action forbiden as geometry modified
if( vtkwnd ) { if( vtkwnd ) {
EmitSignalDeactivateDialog(); EmitSignalDeactivateDialog();
( new SMESHGUI_RotationDlg( this ) )->show(); ( new SMESHGUI_RotationDlg( this ) )->show();
@ -3522,6 +3682,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
case SMESHOp::OpSymmetry: case SMESHOp::OpSymmetry:
{ {
if(isStudyLocked()) break; if(isStudyLocked()) break;
if ( warnOnGeomModif() )
break; // action forbiden as geometry modified
if(vtkwnd) { if(vtkwnd) {
EmitSignalDeactivateDialog(); EmitSignalDeactivateDialog();
( new SMESHGUI_SymmetryDlg( this ) )->show(); ( new SMESHGUI_SymmetryDlg( this ) )->show();
@ -3535,6 +3697,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
case SMESHOp::OpScale: case SMESHOp::OpScale:
{ {
if(isStudyLocked()) break; if(isStudyLocked()) break;
if ( warnOnGeomModif() )
break; // action forbiden as geometry modified
if ( vtkwnd ) { if ( vtkwnd ) {
EmitSignalDeactivateDialog(); EmitSignalDeactivateDialog();
( new SMESHGUI_ScaleDlg( this ) )->show(); ( new SMESHGUI_ScaleDlg( this ) )->show();
@ -3549,6 +3713,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
case SMESHOp::OpOffset: case SMESHOp::OpOffset:
{ {
if(isStudyLocked()) break; if(isStudyLocked()) break;
if ( warnOnGeomModif() )
break; // action forbiden as geometry modified
if ( vtkwnd ) { if ( vtkwnd ) {
EmitSignalDeactivateDialog(); EmitSignalDeactivateDialog();
( new SMESHGUI_OffsetDlg( this ) )->show(); ( new SMESHGUI_OffsetDlg( this ) )->show();
@ -3563,6 +3729,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
case SMESHOp::OpSewing: case SMESHOp::OpSewing:
{ {
if(isStudyLocked()) break; if(isStudyLocked()) break;
if ( warnOnGeomModif() )
break; // action forbiden as geometry modified
if(vtkwnd) { if(vtkwnd) {
EmitSignalDeactivateDialog(); EmitSignalDeactivateDialog();
( new SMESHGUI_SewingDlg( this ) )->show(); ( new SMESHGUI_SewingDlg( this ) )->show();
@ -3576,6 +3744,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
case SMESHOp::OpMergeNodes: case SMESHOp::OpMergeNodes:
{ {
if(isStudyLocked()) break; if(isStudyLocked()) break;
if ( warnOnGeomModif() )
break; // action forbiden as geometry modified
if(vtkwnd) { if(vtkwnd) {
EmitSignalDeactivateDialog(); EmitSignalDeactivateDialog();
( new SMESHGUI_MergeDlg( this, 0 ) )->show(); ( new SMESHGUI_MergeDlg( this, 0 ) )->show();
@ -3589,6 +3759,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
case SMESHOp::OpMergeElements: case SMESHOp::OpMergeElements:
{ {
if (isStudyLocked()) break; if (isStudyLocked()) break;
if ( warnOnGeomModif() )
break; // action forbiden as geometry modified
if (vtkwnd) { if (vtkwnd) {
EmitSignalDeactivateDialog(); EmitSignalDeactivateDialog();
( new SMESHGUI_MergeDlg( this, 1 ) )->show(); ( new SMESHGUI_MergeDlg( this, 1 ) )->show();
@ -3600,12 +3772,16 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
} }
case SMESHOp::OpMoveNode: // MAKE MESH PASS THROUGH POINT case SMESHOp::OpMoveNode: // MAKE MESH PASS THROUGH POINT
if ( warnOnGeomModif() )
break; // action forbiden as geometry modified
startOperation( SMESHOp::OpMoveNode ); startOperation( SMESHOp::OpMoveNode );
break; break;
case SMESHOp::OpDuplicateNodes: case SMESHOp::OpDuplicateNodes:
{ {
if(isStudyLocked()) break; if(isStudyLocked()) break;
if ( warnOnGeomModif() )
break; // action forbiden as geometry modified
if ( vtkwnd ) { if ( vtkwnd ) {
EmitSignalDeactivateDialog(); EmitSignalDeactivateDialog();
( new SMESHGUI_DuplicateNodesDlg( this ) )->show(); ( new SMESHGUI_DuplicateNodesDlg( this ) )->show();
@ -3618,6 +3794,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
} }
case SMESHOp::OpElem0DOnElemNodes: // 0D_ON_ALL_NODES case SMESHOp::OpElem0DOnElemNodes: // 0D_ON_ALL_NODES
if ( warnOnGeomModif() )
break; // action forbiden as geometry modified
startOperation( SMESHOp::OpElem0DOnElemNodes ); startOperation( SMESHOp::OpElem0DOnElemNodes );
break; break;
@ -3751,6 +3929,9 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
case SMESHOp::OpSortChild: case SMESHOp::OpSortChild:
::sortChildren(); ::sortChildren();
break; break;
case SMESHOp::OpBreakLink:
::breakShaperLink();
break;
} }
@ -4084,6 +4265,8 @@ void SMESHGUI::initialize( CAM_Application* app )
createSMESHAction( SMESHOp::OpSortChild, "SORT_CHILD_ITEMS" ); createSMESHAction( SMESHOp::OpSortChild, "SORT_CHILD_ITEMS" );
createSMESHAction( SMESHOp::OpBreakLink, "BREAK_SHAPER_LINK" );
QList<int> aCtrlActions; QList<int> aCtrlActions;
aCtrlActions << SMESHOp::OpFreeNode << SMESHOp::OpEqualNode aCtrlActions << SMESHOp::OpFreeNode << SMESHOp::OpEqualNode
<< SMESHOp::OpNodeConnectivityNb // node controls << SMESHOp::OpNodeConnectivityNb // node controls
@ -4857,6 +5040,9 @@ void SMESHGUI::initialize( CAM_Application* app )
popupMgr()->setRule( action( SMESHOp::OpSortChild ), "$component={'SMESH'} and client='ObjectBrowser' and isContainer and nbChildren>1", QtxPopupMgr::VisibleRule ); popupMgr()->setRule( action( SMESHOp::OpSortChild ), "$component={'SMESH'} and client='ObjectBrowser' and isContainer and nbChildren>1", QtxPopupMgr::VisibleRule );
popupMgr()->insert( separator(), -1, -1 ); popupMgr()->insert( separator(), -1, -1 );
popupMgr()->insert( action( SMESHOp::OpBreakLink), -1, -1 );
popupMgr()->setRule( action( SMESHOp::OpBreakLink), "$component={'SHAPERSTUDY'} and client='ObjectBrowser' and canBreakLink", QtxPopupMgr::VisibleRule );
connect( application(), SIGNAL( viewManagerActivated( SUIT_ViewManager* ) ), connect( application(), SIGNAL( viewManagerActivated( SUIT_ViewManager* ) ),
this, SLOT( onViewManagerActivated( SUIT_ViewManager* ) ) ); this, SLOT( onViewManagerActivated( SUIT_ViewManager* ) ) );
@ -4930,7 +5116,14 @@ bool SMESHGUI::activateModule( SUIT_Study* study )
QList<SUIT_ViewWindow*> wndList = aDesk->windows(); QList<SUIT_ViewWindow*> wndList = aDesk->windows();
SUIT_ViewWindow* wnd; SUIT_ViewWindow* wnd;
foreach ( wnd, wndList ) foreach ( wnd, wndList )
{
connectView( wnd ); connectView( wnd );
// remove actors whose objects are removed in GetSMESHGen()->UpdateStudy()
SMESH::UpdateActorsAfterUpdateStudy(wnd);
wnd->update();
}
} }
Py_XDECREF(pluginsmanager); Py_XDECREF(pluginsmanager);

@ -951,7 +951,7 @@ void SMESHGUI_BaseComputeOp::computeMesh()
SMESH::SMESH_IDSource_var aSubMeshObj = SMESH::SMESH_IDSource_var aSubMeshObj =
SMESH::SObjectToInterface<SMESH::SMESH_IDSource>( smSObj ); SMESH::SObjectToInterface<SMESH::SMESH_IDSource>( smSObj );
SMESH_Actor *anActor = SMESH::FindActorByObject( aSubMeshObj ); SMESH_Actor *anActor = SMESH::FindActorByObject( aSubMeshObj );
if ( anActor && anActor->GetVisibility() ) if ( anActor /*&& anActor->GetVisibility()*/ )
aListToUpdate.append( TListOf_IDSrc_SObj::value_type( aSubMeshObj, smSObj )); aListToUpdate.append( TListOf_IDSrc_SObj::value_type( aSubMeshObj, smSObj ));
} }
// put Groups into list // put Groups into list
@ -967,7 +967,7 @@ void SMESHGUI_BaseComputeOp::computeMesh()
SMESH::SMESH_IDSource_var aGroupObj = SMESH::SMESH_IDSource_var aGroupObj =
SMESH::SObjectToInterface<SMESH::SMESH_IDSource>( aGroupSO ); SMESH::SObjectToInterface<SMESH::SMESH_IDSource>( aGroupSO );
SMESH_Actor *anActor = SMESH::FindActorByObject( aGroupObj ); SMESH_Actor *anActor = SMESH::FindActorByObject( aGroupObj );
if ( anActor && anActor->GetVisibility() ) if ( anActor /*&& anActor->GetVisibility()*/ )
aListToUpdate.append( TListOf_IDSrc_SObj::value_type( aGroupObj, aGroupSO )); aListToUpdate.append( TListOf_IDSrc_SObj::value_type( aGroupObj, aGroupSO ));
} }
@ -994,6 +994,13 @@ void SMESHGUI_BaseComputeOp::computeMesh()
//SMESH::DisplayActor( SMESH::GetActiveWindow(), anActor ); -- 23615 //SMESH::DisplayActor( SMESH::GetActiveWindow(), anActor ); -- 23615
} }
} }
else
{
SMESH_Actor *anActor = SMESH::FindActorByEntry( entry.c_str() );
anActor->Update();
if ( !anActor->GetVisibility() )
continue;
}
SMESH::UpdateView( SMESH::eDisplay, entry.c_str() ); SMESH::UpdateView( SMESH::eDisplay, entry.c_str() );
if ( SVTK_ViewWindow* vtkWnd = SMESH::GetVtkViewWindow(SMESH::GetActiveWindow() )) if ( SVTK_ViewWindow* vtkWnd = SMESH::GetVtkViewWindow(SMESH::GetActiveWindow() ))
@ -1251,8 +1258,8 @@ void SMESHGUI_BaseComputeOp::stopOperation()
void SMESHGUI_BaseComputeOp::onPublishShape() void SMESHGUI_BaseComputeOp::onPublishShape()
{ {
GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen();
GEOM::GEOM_Object_var meshShape = myMesh->GetShapeToMesh(); GEOM::GEOM_Object_var meshShape = myMesh->GetShapeToMesh();
GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen( meshShape );
QStringList entryList; QStringList entryList;
QList<int> rows; QList<int> rows;
@ -1273,7 +1280,7 @@ void SMESHGUI_BaseComputeOp::onPublishShape()
// look for myMainShape in the table // look for myMainShape in the table
for ( int r = 0, nr = table()->rowCount(); r < nr; ++r ) { for ( int r = 0, nr = table()->rowCount(); r < nr; ++r ) {
if ( table()->item( r, COL_SHAPEID )->text() == "1" ) { if ( table()->item( r, COL_SHAPEID )->text() == "1" ) {
if ( so->_is_nil() ) { if ( !so->_is_nil() ) {
CORBA::String_var name = so->GetName(); CORBA::String_var name = so->GetName();
CORBA::String_var entry = so->GetID(); CORBA::String_var entry = so->GetID();
QString shapeText = QString("%1 (%2)").arg( name.in() ).arg( entry.in() ); QString shapeText = QString("%1 (%2)").arg( name.in() ).arg( entry.in() );

@ -91,9 +91,6 @@ GetAllFields(const QList< QPair< SMESH::SMESH_IDSource_var, QString > >& meshes,
{ {
myFields = & fields; myFields = & fields;
myTree->clear(); myTree->clear();
GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen();
GEOM::GEOM_IFieldOperations_wrap fieldOp = geomGen->GetIFieldOperations();
for ( int iM = 0; iM < meshes.count(); ++iM ) for ( int iM = 0; iM < meshes.count(); ++iM )
{ {
@ -109,6 +106,9 @@ GetAllFields(const QList< QPair< SMESH::SMESH_IDSource_var, QString > >& meshes,
QTreeWidgetItem* meshItem = createItem( myTree, meshes[iM].second, iM ); QTreeWidgetItem* meshItem = createItem( myTree, meshes[iM].second, iM );
GEOM::GEOM_Object_var shape = mesh->GetShapeToMesh(); GEOM::GEOM_Object_var shape = mesh->GetShapeToMesh();
GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen( shape );
GEOM::GEOM_IFieldOperations_wrap fieldOp = geomGen->GetIFieldOperations();
fields = fieldOp->GetFields( shape ); fields = fieldOp->GetFields( shape );
for ( size_t iF = 0; iF < fields->length(); ++iF ) for ( size_t iF = 0; iF < fields->length(); ++iF )
{ {

@ -44,16 +44,12 @@
namespace SMESH namespace SMESH
{ {
GEOM::GEOM_Gen_var GetGEOMGen() GEOM::GEOM_Gen_var GetGEOMGen( GEOM::GEOM_Object_ptr go )
{ {
static GEOM::GEOM_Gen_var aGEOMGen; GEOM::GEOM_Gen_ptr gen;
if ( !CORBA::is_nil( go ))
if(CORBA::is_nil(aGEOMGen)) { gen = go->GetGen();
if ( GeometryGUI::GetGeomGen()->_is_nil() ) return gen;
GeometryGUI::InitGeomGen();
aGEOMGen = GeometryGUI::GetGeomGen();
}
return aGEOMGen;
} }
GEOM::GEOM_Object_var GetShapeOnMeshOrSubMesh(_PTR(SObject) theMeshOrSubmesh, GEOM::GEOM_Object_var GetShapeOnMeshOrSubMesh(_PTR(SObject) theMeshOrSubmesh,
@ -155,14 +151,18 @@ namespace SMESH
GEOM::GEOM_Object_ptr GetSubShape (GEOM::GEOM_Object_ptr theMainShape, GEOM::GEOM_Object_ptr GetSubShape (GEOM::GEOM_Object_ptr theMainShape,
long theID) long theID)
{ {
GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen(); if ( CORBA::is_nil( theMainShape ))
return GEOM::GEOM_Object::_nil();
GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen( theMainShape );
if (geomGen->_is_nil()) if (geomGen->_is_nil())
return GEOM::GEOM_Object::_nil(); return GEOM::GEOM_Object::_nil();
GEOM::GEOM_IShapesOperations_wrap aShapesOp =
geomGen->GetIShapesOperations(); GEOM::GEOM_IShapesOperations_wrap aShapesOp = geomGen->GetIShapesOperations();
if (aShapesOp->_is_nil()) if (aShapesOp->_is_nil())
return GEOM::GEOM_Object::_nil(); return GEOM::GEOM_Object::_nil();
GEOM::GEOM_Object_wrap subShape = aShapesOp->GetSubShape (theMainShape,theID);
GEOM::GEOM_Object_wrap subShape = aShapesOp->GetSubShape( theMainShape, theID );
return subShape._retn(); return subShape._retn();
} }

@ -45,7 +45,7 @@ class QString;
namespace SMESH namespace SMESH
{ {
SMESHGUI_EXPORT GEOM::GEOM_Gen_var GetGEOMGen(); SMESHGUI_EXPORT GEOM::GEOM_Gen_var GetGEOMGen( GEOM::GEOM_Object_ptr go );
SMESHGUI_EXPORT GEOM::GEOM_Object_var GetShapeOnMeshOrSubMesh( _PTR(SObject), bool* isMesh=0 ); SMESHGUI_EXPORT GEOM::GEOM_Object_var GetShapeOnMeshOrSubMesh( _PTR(SObject), bool* isMesh=0 );
@ -53,7 +53,7 @@ namespace SMESH
SMESHGUI_EXPORT GEOM::GEOM_Object_var GetGeom( Handle(SALOME_InteractiveObject) io ); SMESHGUI_EXPORT GEOM::GEOM_Object_var GetGeom( Handle(SALOME_InteractiveObject) io );
SMESHGUI_EXPORT char* GetGeomName( _PTR(SObject) smeshSO ); SMESHGUI_EXPORT char* GetGeomName( _PTR(SObject) smeshSO );
SMESHGUI_EXPORT GEOM::GEOM_Object_ptr GetSubShape( GEOM::GEOM_Object_ptr, long ); SMESHGUI_EXPORT GEOM::GEOM_Object_ptr GetSubShape( GEOM::GEOM_Object_ptr, long );

@ -1055,12 +1055,11 @@ bool SMESHGUI_GroupDlg::onApply()
} }
else { else {
SMESH::SMESH_Gen_var aSMESHGen = SMESHGUI::GetSMESHGen(); SMESH::SMESH_Gen_var aSMESHGen = SMESHGUI::GetSMESHGen();
if ( aSMESHGen->_is_nil() ) if ( aSMESHGen->_is_nil() || myGeomObjects->length() == 0 )
return false; return false;
// create a geometry group // create a geometry group
GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen(); GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen( myGeomObjects[0] );
if (geomGen->_is_nil()) if (geomGen->_is_nil())
return false; return false;
@ -1071,11 +1070,12 @@ bool SMESHGUI_GroupDlg::onApply()
// check and add all selected GEOM objects: they must be // check and add all selected GEOM objects: they must be
// a sub-shapes of the main GEOM and must be of one type // a sub-shapes of the main GEOM and must be of one type
TopAbs_ShapeEnum aGroupType = TopAbs_SHAPE; TopAbs_ShapeEnum aGroupType = TopAbs_SHAPE;
for ( int i =0; i < (int)myGeomObjects->length(); i++) { for ( CORBA::ULong i =0; i < myGeomObjects->length(); i++)
{
TopAbs_ShapeEnum aSubShapeType = (TopAbs_ShapeEnum)myGeomObjects[i]->GetShapeType(); TopAbs_ShapeEnum aSubShapeType = (TopAbs_ShapeEnum)myGeomObjects[i]->GetShapeType();
if (i == 0) if ( i == 0 )
aGroupType = aSubShapeType; aGroupType = aSubShapeType;
else if (aSubShapeType != aGroupType) { else if ( aSubShapeType != aGroupType ) {
aGroupType = TopAbs_SHAPE; aGroupType = TopAbs_SHAPE;
break; break;
} }
@ -1083,6 +1083,8 @@ bool SMESHGUI_GroupDlg::onApply()
GEOM::GEOM_Object_var aMeshShape = myMesh->GetShapeToMesh(); GEOM::GEOM_Object_var aMeshShape = myMesh->GetShapeToMesh();
GEOM::GEOM_Object_wrap aGroupVar = op->CreateGroup(aMeshShape, aGroupType); GEOM::GEOM_Object_wrap aGroupVar = op->CreateGroup(aMeshShape, aGroupType);
if ( aGroupVar->_is_nil() )
return false;
op->UnionList(aGroupVar, myGeomObjects); op->UnionList(aGroupVar, myGeomObjects);
if (op->IsDone()) { if (op->IsDone()) {
@ -1106,7 +1108,7 @@ bool SMESHGUI_GroupDlg::onApply()
resultGroup = SMESH::SMESH_GroupBase::_narrow( myGroupOnGeom ); resultGroup = SMESH::SMESH_GroupBase::_narrow( myGroupOnGeom );
isCreation = false; isCreation = false;
} }
anIsOk = true; anIsOk = true;
} }
if (myGrpTypeId == 2) // group on filter if (myGrpTypeId == 2) // group on filter
@ -1410,13 +1412,15 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged()
// The main shape of the group // The main shape of the group
GEOM::GEOM_Object_var aGroupMainShape; GEOM::GEOM_Object_var aGroupMainShape;
if (aGeomGroup->GetType() == 37) { if (aGeomGroup->GetType() == 37)
{
GEOM::GEOM_IGroupOperations_wrap anOp = GEOM::GEOM_IGroupOperations_wrap anOp =
SMESH::GetGEOMGen()->GetIGroupOperations(); SMESH::GetGEOMGen( aGeomGroup )->GetIGroupOperations();
aGroupMainShape = anOp->GetMainShape(aGeomGroup); aGroupMainShape = anOp->GetMainShape( aGeomGroup );
// aGroupMainShape is an existing servant => GEOM_Object_var not GEOM_Object_wrap // aGroupMainShape is an existing servant => GEOM_Object_var not GEOM_Object_wrap
} }
else { else
{
aGroupMainShape = aGeomGroup; aGroupMainShape = aGeomGroup;
aGroupMainShape->Register(); aGroupMainShape->Register();
} }
@ -1867,7 +1871,8 @@ void SMESHGUI_GroupDlg::onAdd()
QListWidgetItem* anItem = 0; QListWidgetItem* anItem = 0;
QList<QListWidgetItem*> listItemsToSel; QList<QListWidgetItem*> listItemsToSel;
if (myCurrentLineEdit == 0) { if ( myCurrentLineEdit == 0 )
{
//if (aNbSel != 1) { myIsBusy = false; return; } //if (aNbSel != 1) { myIsBusy = false; return; }
QString aListStr = ""; QString aListStr = "";
int aNbItems = 0; int aNbItems = 0;
@ -1910,7 +1915,9 @@ void SMESHGUI_GroupDlg::onAdd()
onListSelectionChanged(); onListSelectionChanged();
listItemsToSel.clear(); listItemsToSel.clear();
} }
} else if (myCurrentLineEdit == mySubMeshLine) { }
else if ( myCurrentLineEdit == mySubMeshLine )
{
//SALOME_ListIteratorOfListIO anIt (mySelectionMgr->StoredIObjects()); //SALOME_ListIteratorOfListIO anIt (mySelectionMgr->StoredIObjects());
SALOME_ListIO aList; SALOME_ListIO aList;
@ -1958,7 +1965,9 @@ void SMESHGUI_GroupDlg::onAdd()
myIsBusy = false; myIsBusy = false;
onListSelectionChanged(); onListSelectionChanged();
} else if (myCurrentLineEdit == myGroupLine) { }
else if ( myCurrentLineEdit == myGroupLine )
{
//SALOME_ListIteratorOfListIO anIt (mySelectionMgr->StoredIObjects()); //SALOME_ListIteratorOfListIO anIt (mySelectionMgr->StoredIObjects());
SALOME_ListIO aList; SALOME_ListIO aList;
mySelectionMgr->selectedObjects( aList ); mySelectionMgr->selectedObjects( aList );
@ -2000,9 +2009,11 @@ void SMESHGUI_GroupDlg::onAdd()
myIsBusy = false; myIsBusy = false;
onListSelectionChanged(); onListSelectionChanged();
} else if (myCurrentLineEdit == myGeomGroupLine && myGeomObjects->length() == 1) { }
else if ( myCurrentLineEdit == myGeomGroupLine && myGeomObjects->length() == 1 )
{
GEOM::GEOM_IGroupOperations_wrap aGroupOp = GEOM::GEOM_IGroupOperations_wrap aGroupOp =
SMESH::GetGEOMGen()->GetIGroupOperations(); SMESH::GetGEOMGen( myGeomObjects[0] )->GetIGroupOperations();
SMESH::ElementType aGroupType = SMESH::ALL; SMESH::ElementType aGroupType = SMESH::ALL;
switch(aGroupOp->GetType(myGeomObjects[0])) { switch(aGroupOp->GetType(myGeomObjects[0])) {

@ -220,12 +220,12 @@ SMESH::ElementType SMESHGUI_GroupOnShapeOp::ElementType(GEOM::GEOM_Object_var ge
case GEOM::COMPOUND: break; case GEOM::COMPOUND: break;
default: return SMESH::ALL; default: return SMESH::ALL;
} }
GEOM::GEOM_IShapesOperations_wrap aShapeOp = GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen( geom );
SMESH::GetGEOMGen()->GetIShapesOperations(); GEOM::GEOM_IShapesOperations_wrap aShapeOp = geomGen->GetIShapesOperations();
if ( geom->GetType() == 37 ) { // geom group if ( geom->GetType() == 37 ) // geom group
GEOM::GEOM_IGroupOperations_wrap aGroupOp = {
SMESH::GetGEOMGen()->GetIGroupOperations(); GEOM::GEOM_IGroupOperations_wrap aGroupOp = geomGen->GetIGroupOperations();
if ( !aGroupOp->_is_nil() ) { if ( !aGroupOp->_is_nil() ) {
// mainShape is an existing servant => GEOM_Object_var not GEOM_Object_wrap // mainShape is an existing servant => GEOM_Object_var not GEOM_Object_wrap
GEOM::GEOM_Object_var mainShape = aGroupOp->GetMainShape( geom ); GEOM::GEOM_Object_var mainShape = aGroupOp->GetMainShape( geom );
@ -236,7 +236,8 @@ SMESH::ElementType SMESHGUI_GroupOnShapeOp::ElementType(GEOM::GEOM_Object_var ge
} }
} }
} }
else if ( !aShapeOp->_is_nil() ) { // just a compoud shape else if ( !aShapeOp->_is_nil() ) // just a compoud shape
{
GEOM::ListOfLong_var ids = aShapeOp->SubShapeAllIDs( geom, GEOM::SHAPE, false ); GEOM::ListOfLong_var ids = aShapeOp->SubShapeAllIDs( geom, GEOM::SHAPE, false );
if ( ids->length() ) { if ( ids->length() ) {
GEOM::GEOM_Object_wrap member = aShapeOp->GetSubShape( geom, ids[0] ); GEOM::GEOM_Object_wrap member = aShapeOp->GetSubShape( geom, ids[0] );

@ -185,10 +185,11 @@ QFrame* SMESHGUI_GenericHypothesisCreator::buildStdFrame()
GroupC1Layout->setMargin( MARGIN ); GroupC1Layout->setMargin( MARGIN );
ListOfStdParams::const_iterator anIt = params.begin(), aLast = params.end(); ListOfStdParams::const_iterator anIt = params.begin(), aLast = params.end();
for( int i=0; anIt!=aLast; anIt++, i++ ) for( int i = 0; anIt != aLast; anIt++, i++ )
{ {
QLabel* lab = new QLabel( (*anIt).myName, GroupC1 ); QLabel* lab = anIt->hasName() ? new QLabel( anIt->myName, GroupC1 ) : NULL;
GroupC1Layout->addWidget( lab, i, 0 ); if ( lab )
GroupC1Layout->addWidget( lab, i, 0 );
myParamLabels << lab; myParamLabels << lab;
QWidget* w = getCustomWidget( *anIt, GroupC1, i ); QWidget* w = getCustomWidget( *anIt, GroupC1, i );
@ -251,9 +252,12 @@ QFrame* SMESHGUI_GenericHypothesisCreator::buildStdFrame()
default:; default:;
} // switch( (*anIt).myValue.type() ) } // switch( (*anIt).myValue.type() )
if( w ) if ( w )
{ {
GroupC1Layout->addWidget( w, i, 1 ); if ( lab )
GroupC1Layout->addWidget( w, i, 1 );
else
GroupC1Layout->addWidget( w, i, 0, 1, 2 );
changeWidgets().append( w ); changeWidgets().append( w );
} }
} }
@ -336,6 +340,8 @@ void SMESHGUI_GenericHypothesisCreator::onDialogFinished( int result )
myDlg->close(); myDlg->close();
//delete myDlg; since WA_DeleteOnClose==true //delete myDlg; since WA_DeleteOnClose==true
myDlg = 0; myDlg = 0;
SMESH::UpdateActorsAfterUpdateStudy();// remove actors of removed groups (#16522)
if (SVTK_ViewWindow* vf = SMESH::GetCurrentVtkView()) { if (SVTK_ViewWindow* vf = SMESH::GetCurrentVtkView()) {
vf->Repaint(); vf->Repaint();
} }
@ -807,8 +813,8 @@ HypothesesSet::HypothesesSet( const QString& theSetName,
: myUseCommonSize( useCommonSize ), : myUseCommonSize( useCommonSize ),
myQuadDominated( isQuadDominated ), myQuadDominated( isQuadDominated ),
myHypoSetName( theSetName ), myHypoSetName( theSetName ),
myHypoList { mainHypos, altHypos, intHypos }, myHypoList { mainHypos, altHypos, intHypos },
myAlgoList { mainAlgos, altAlgos, intAlgos }, myAlgoList { mainAlgos, altAlgos, intAlgos },
myIsAlgo( false ), myIsAlgo( false ),
myIsCustom( false ), myIsCustom( false ),
myIndex( 0 ) myIndex( 0 )

@ -92,6 +92,8 @@ protected:
const char* text() const { const char* text() const {
((QByteArray&) myTextAsBytes) = myText.toUtf8(); return myTextAsBytes.constData(); ((QByteArray&) myTextAsBytes) = myText.toUtf8(); return myTextAsBytes.constData();
} }
void setNoName() { myName.clear(); } // ==> widget occupies both columns
bool hasName() const { return !myName.isEmpty(); }
}; };
typedef QList<StdParam> ListOfStdParams; typedef QList<StdParam> ListOfStdParams;

@ -116,6 +116,7 @@ namespace SMESH
SMESH::SMESH_Hypothesis_ptr ); SMESH::SMESH_Hypothesis_ptr );
typedef std::vector<_PTR(SObject)> SObjectList; typedef std::vector<_PTR(SObject)> SObjectList;
SMESHGUI_EXPORT
SObjectList GetMeshesUsingAlgoOrHypothesis( SMESH::SMESH_Hypothesis_ptr ); SObjectList GetMeshesUsingAlgoOrHypothesis( SMESH::SMESH_Hypothesis_ptr );
SMESHGUI_EXPORT SMESHGUI_EXPORT

@ -346,7 +346,7 @@ bool SMESHGUI_MeshOp::isSubshapeOk() const
myDlg->selectedObject(SMESHGUI_MeshDlg::Geom, aGEOMs); myDlg->selectedObject(SMESHGUI_MeshDlg::Geom, aGEOMs);
if (aGEOMs.count() > 0) { if (aGEOMs.count() > 0) {
GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen(); GEOM::GEOM_Gen_var geomGen = mainGeom->GetGen();
if (geomGen->_is_nil()) return false; if (geomGen->_is_nil()) return false;
GEOM::GEOM_IGroupOperations_wrap op = geomGen->GetIGroupOperations(); GEOM::GEOM_IGroupOperations_wrap op = geomGen->GetIGroupOperations();
@ -1756,7 +1756,7 @@ void SMESHGUI_MeshOp::createSubMeshOnInternalEdges( SMESH::SMESH_Mesh_ptr theMes
for ( size_t i = 0; i < internalEdges.size(); ++i ) for ( size_t i = 0; i < internalEdges.size(); ++i )
intIDSet.insert( shapeIDs.FindIndex( internalEdges[ i ])); intIDSet.insert( shapeIDs.FindIndex( internalEdges[ i ]));
GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen(); GEOM::GEOM_Gen_var geomGen = theMainShape->GetGen();
if (geomGen->_is_nil()) return; if (geomGen->_is_nil()) return;
GEOM::GEOM_Object_var edgeGroup; GEOM::GEOM_Object_var edgeGroup;
@ -2062,7 +2062,7 @@ bool SMESHGUI_MeshOp::createMesh( QString& theMess, QStringList& theEntryList )
{ {
// Create groups on all geom groups // Create groups on all geom groups
GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen(); GEOM::GEOM_Gen_var geomGen = aGeomVar->GetGen();
GEOM::GEOM_IShapesOperations_wrap op = geomGen->GetIShapesOperations(); GEOM::GEOM_IShapesOperations_wrap op = geomGen->GetIShapesOperations();
GEOM::ListOfGO_var geomGroups = op->GetExistingSubObjects( aGeomVar, GEOM::ListOfGO_var geomGroups = op->GetExistingSubObjects( aGeomVar,
/*groupsOnly=*/false ); /*groupsOnly=*/false );
@ -2138,11 +2138,11 @@ bool SMESHGUI_MeshOp::createSubMesh( QString& theMess, QStringList& theEntryList
else if (aGEOMs.count() > 1) else if (aGEOMs.count() > 1)
{ {
// create a GEOM group // create a GEOM group
GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen(); GEOM::GEOM_Gen_var geomGen = mainGeom->GetGen();
if (!geomGen->_is_nil()) { if ( !geomGen->_is_nil() ) {
GEOM::GEOM_IGroupOperations_wrap op = GEOM::GEOM_IGroupOperations_wrap op = geomGen->GetIGroupOperations();
geomGen->GetIGroupOperations(); if ( !op->_is_nil() )
if (!op->_is_nil()) { {
// check and add all selected GEOM objects: they must be // check and add all selected GEOM objects: they must be
// a sub-shapes of the main GEOM and must be of one type // a sub-shapes of the main GEOM and must be of one type
int iSubSh = 0; int iSubSh = 0;

@ -230,6 +230,8 @@ namespace SMESHOp {
OpClipping = 6100, // POPUP MENU - CLIPPING OpClipping = 6100, // POPUP MENU - CLIPPING
// SortChild ----------------------//-------------------------------- // SortChild ----------------------//--------------------------------
OpSortChild = 6110, // POPUP MENU - SORT CHILDREN OpSortChild = 6110, // POPUP MENU - SORT CHILDREN
// Break link with Shaper object --//--------------------------------
OpBreakLink = 6120, // POPUP MENU - Break link with Shaper
// Advanced -----------------------//-------------------------------- // Advanced -----------------------//--------------------------------
OpAdvancedNoOp = 10000, // NO OPERATION (advanced operations base) OpAdvancedNoOp = 10000, // NO OPERATION (advanced operations base)
//@@ insert new functions before this line @@ do not remove this line @@// //@@ insert new functions before this line @@ do not remove this line @@//

@ -43,6 +43,8 @@
#include <SalomeApp_Application.h> #include <SalomeApp_Application.h>
#include <LightApp_VTKSelector.h> #include <LightApp_VTKSelector.h>
#include <SVTK_ViewWindow.h> #include <SVTK_ViewWindow.h>
#include <LightApp_SelectionMgr.h>
#include <LightApp_DataOwner.h>
// IDL includes // IDL includes
#include <SALOMEconfig.h> #include <SALOMEconfig.h>
@ -77,6 +79,8 @@ void SMESHGUI_Selection::init( const QString& client, LightApp_SelectionMgr* mgr
if( mgr ) if( mgr )
{ {
myOwners.clear();
mgr->selected(myOwners, client);
for( int i=0, n=count(); i<n; i++ ) { for( int i=0, n=count(); i<n; i++ ) {
myTypes.append( typeName( type( entry( i ) ) ) ); myTypes.append( typeName( type( entry( i ) ) ) );
myControls.append( controlMode( i ) ); myControls.append( controlMode( i ) );
@ -140,6 +144,7 @@ QVariant SMESHGUI_Selection::parameter( const int ind, const QString& p ) const
else if ( p=="nbChildren") val = QVariant( nbChildren( ind ) ); else if ( p=="nbChildren") val = QVariant( nbChildren( ind ) );
else if ( p=="isContainer") val = QVariant( isContainer( ind ) ); else if ( p=="isContainer") val = QVariant( isContainer( ind ) );
else if ( p=="guiState") val = QVariant( guiState() ); else if ( p=="guiState") val = QVariant( guiState() );
else if ( p=="canBreakLink") val = QVariant( canBreakLink(ind) );
if ( val.isValid() ) if ( val.isValid() )
return val; return val;
@ -605,6 +610,33 @@ bool SMESHGUI_Selection::hasGeomReference( int ind ) const
return false; return false;
} }
//=======================================================================
//function : canBreakLink
//purpose : returns true if selected object is a Shaper object and it can break link
//=======================================================================
bool SMESHGUI_Selection::canBreakLink( int ind ) const
{
if ( ind >= 0 && ind < myTypes.count()) {
if (isReference(ind)) {
SUIT_DataOwner* aOwn = myOwners.at(ind);
LightApp_DataOwner* sowner = dynamic_cast<LightApp_DataOwner*>(aOwn);
QString aEntry = sowner->entry();
_PTR(SObject) aSObject = SMESH::getStudy()->FindObjectID(aEntry.toStdString());
_PTR(SObject) aFatherObj = aSObject->GetFather();
_PTR(SComponent) aComponent = aFatherObj->GetFatherComponent();
if (aComponent->ComponentDataType() == "SMESH") {
QString aObjEntry = entry(ind);
_PTR(SObject) aGeomSObject = SMESH::getStudy()->FindObjectID(aObjEntry.toStdString());
GEOM::GEOM_Object_var aObject = SMESH::SObjectToInterface<GEOM::GEOM_Object>(aGeomSObject);
if (!aObject->_is_nil())
return aObject->IsParametrical();
}
}
}
return false;
}
//======================================================================= //=======================================================================
//function : isEditableHyp //function : isEditableHyp
//purpose : //purpose :

@ -32,6 +32,7 @@
// SALOME GUI includes // SALOME GUI includes
#include <LightApp_Selection.h> #include <LightApp_Selection.h>
#include <SUIT_DataOwner.h>
// SALOME KERNEL includes // SALOME KERNEL includes
#include <SALOMEDSClient_definitions.hxx> #include <SALOMEDSClient_definitions.hxx>
@ -61,6 +62,7 @@ public:
virtual bool hasGeomReference( int ) const; virtual bool hasGeomReference( int ) const;
virtual bool isEditableHyp( int ) const; virtual bool isEditableHyp( int ) const;
virtual bool isVisible( int ) const; virtual bool isVisible( int ) const;
virtual bool canBreakLink(int) const;
virtual bool isQuadratic( int ) const; virtual bool isQuadratic( int ) const;
virtual QString quadratic2DMode( int ) const; virtual QString quadratic2DMode( int ) const;
@ -95,6 +97,7 @@ private:
QStringList myTypes; QStringList myTypes;
QStringList myControls; QStringList myControls;
QList<SMESH_Actor*> myActors; QList<SMESH_Actor*> myActors;
SUIT_DataOwnerPtrList myOwners;
}; };
#endif // SMESHGUI_SELECTION_H #endif // SMESHGUI_SELECTION_H

@ -318,14 +318,14 @@ void SMESHGUI_ShapeByMeshOp::commitOperation()
} }
else else
{ {
GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen(); GEOM::GEOM_Object_var aMeshShape = myMesh->GetShapeToMesh();
if (geomGen->_is_nil()) GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen( aMeshShape );
if ( geomGen->_is_nil() )
return; return;
GEOM::GEOM_IShapesOperations_wrap aShapesOp = GEOM::GEOM_IShapesOperations_wrap aShapesOp = geomGen->GetIShapesOperations();
geomGen->GetIShapesOperations(); if ( aShapesOp->_is_nil() )
if (aShapesOp->_is_nil() )
return; return;
TopAbs_ShapeEnum aGroupType = TopAbs_SHAPE; TopAbs_ShapeEnum aGroupType = TopAbs_SHAPE;
@ -333,8 +333,6 @@ void SMESHGUI_ShapeByMeshOp::commitOperation()
std::map<int, GEOM::GEOM_Object_wrap> aGeomObjectsMap; std::map<int, GEOM::GEOM_Object_wrap> aGeomObjectsMap;
GEOM::GEOM_Object_wrap aGeomObject; GEOM::GEOM_Object_wrap aGeomObject;
GEOM::GEOM_Object_var aMeshShape = myMesh->GetShapeToMesh();
for ( int i = 0; i < aListId.count(); i++ ) for ( int i = 0; i < aListId.count(); i++ )
{ {
aGeomObject = // received object need UnRegister()! aGeomObject = // received object need UnRegister()!
@ -362,9 +360,8 @@ void SMESHGUI_ShapeByMeshOp::commitOperation()
} }
else if (aNumberOfGO > 1) else if (aNumberOfGO > 1)
{ {
GEOM::GEOM_IGroupOperations_wrap aGroupOp = GEOM::GEOM_IGroupOperations_wrap aGroupOp = geomGen->GetIGroupOperations();
geomGen->GetIGroupOperations(); if ( aGroupOp->_is_nil() )
if(aGroupOp->_is_nil())
return; return;
GEOM::ListOfGO_var aGeomObjects = new GEOM::ListOfGO(); GEOM::ListOfGO_var aGeomObjects = new GEOM::ListOfGO();
@ -379,7 +376,7 @@ void SMESHGUI_ShapeByMeshOp::commitOperation()
aGeomObject = aGroupOp->CreateGroup(aMeshShape, aGroupType); aGeomObject = aGroupOp->CreateGroup(aMeshShape, aGroupType);
aGroupOp->UnionList(aGeomObject, aGeomObjects); aGroupOp->UnionList(aGeomObject, aGeomObjects);
if (!aGroupOp->IsDone()) if ( !aGroupOp->IsDone() )
return; return;
} }
@ -419,7 +416,7 @@ void SMESHGUI_ShapeByMeshOp::onSelectionDone()
try { try {
SALOME_ListIO aList; SALOME_ListIO aList;
selectionMgr()->selectedObjects(aList); selectionMgr()->selectedObjects(aList);
if (!myIsMultipleAllowed && aList.Extent() != 1) if ( aList.IsEmpty() || ( !myIsMultipleAllowed && aList.Extent() != 1) )
return; return;
SMESH::SMESH_Mesh_var aMesh = SMESH::GetMeshByIO(aList.First()); SMESH::SMESH_Mesh_var aMesh = SMESH::GetMeshByIO(aList.First());

@ -232,6 +232,86 @@ namespace SMESH
} }
} }
//================================================================================
/*!
* \brief Remove/update actors while module activation
* \param [in] wnd - window
*
* At module activation, groups and sub-meshes can be removed on engine side due
* to modification of meshed geometry, while their actors can remain.
* Here we remove/update SMESH_Actor's of changed objects. State (emptiness) of objects
* is defined by their icons in the Object Browser
*/
//================================================================================
void UpdateActorsAfterUpdateStudy( SUIT_ViewWindow* theWindow )
{
const char* emptyIcon = "ICON_SMESH_TREE_MESH_WARN";
_PTR(Study) aStudy = SMESH::getStudy();
if ( SVTK_ViewWindow* aViewWindow = GetVtkViewWindow( theWindow ))
{
vtkRenderer *aRenderer = aViewWindow->getRenderer();
VTK::ActorCollectionCopy aCopy(aRenderer->GetActors());
vtkActorCollection *aCollection = aCopy.GetActors();
aCollection->InitTraversal();
while ( vtkActor *actor = aCollection->GetNextActor() ) {
if ( SMESH_Actor *smeshActor = dynamic_cast<SMESH_Actor*>( actor ))
{
if ( !smeshActor->hasIO() )
continue;
Handle(SALOME_InteractiveObject) io = smeshActor->getIO();
if ( !io->hasEntry() )
continue;
_PTR(SObject) so = aStudy->FindObjectID( io->getEntry() );
if ( !so )
continue; // seems impossible
CORBA::Object_var obj = SMESH::SObjectToObject( so );
if ( CORBA::is_nil( obj )) // removed object
{
RemoveActor( theWindow, smeshActor );
continue;
}
bool toShow = smeshActor->GetVisibility();
_PTR(GenericAttribute) attr;
if ( toShow && so->FindAttribute( attr, "AttributePixMap" )) // check emptiness
{
_PTR(AttributePixMap) pixMap = attr;
toShow = ( pixMap->GetPixMap() != emptyIcon );
}
//smeshActor->Update();
UpdateView( theWindow, toShow ? eDisplay : eErase, io->getEntry() );
}
}
}
return;
}
//================================================================================
/*!
* \brief Remove/update actors while module activation
*
* At module activation, groups and sub-meshes can be removed on engine side due
* to modification of meshed geometry, while their actors can remain.
* Here we remove/update SMESH_Actor's of changed objects. State (emptiness) of objects
* is defined by their icons in the Object Browser
*/
//================================================================================
void UpdateActorsAfterUpdateStudy()
{
SUIT_Study* study = SMESH::GetActiveStudy();
if ( SUIT_Desktop* desk = study->application()->desktop() )
{
QList<SUIT_ViewWindow*> wndList = desk->windows();
SUIT_ViewWindow* wnd;
foreach ( wnd, wndList )
SMESH::UpdateActorsAfterUpdateStudy(wnd);
}
}
//================================================================================ //================================================================================
/*! /*!
* \brief Notify the user on problems during visualization * \brief Notify the user on problems during visualization

@ -216,6 +216,12 @@ SMESHGUI_EXPORT
double& theDist ); double& theDist );
SMESHGUI_EXPORT SMESHGUI_EXPORT
void RemoveVisualObjectWithActors( const char* theEntry, bool fromAllViews = false ); void RemoveVisualObjectWithActors( const char* theEntry, bool fromAllViews = false );
SMESHGUI_EXPORT
void UpdateActorsAfterUpdateStudy( SUIT_ViewWindow* wnd );
SMESHGUI_EXPORT
void UpdateActorsAfterUpdateStudy();
}; };
#endif // SMESHGUI_VTKUTILS_H #endif // SMESHGUI_VTKUTILS_H

@ -531,6 +531,10 @@
<source>ICON_SMESH_TREE_MESH_WARN</source> <source>ICON_SMESH_TREE_MESH_WARN</source>
<translation>mesh_tree_mesh_warn.png</translation> <translation>mesh_tree_mesh_warn.png</translation>
</message> </message>
<message>
<source>ICON_SMESH_TREE_GEOM_MODIF</source>
<translation>mesh_tree_mesh_geom_modif.png</translation>
</message>
<message> <message>
<source>ICON_STD_INFO</source> <source>ICON_STD_INFO</source>
<translation>standard_mesh_info.png</translation> <translation>standard_mesh_info.png</translation>

@ -4503,6 +4503,24 @@ It can&apos;t be deleted </translation>
<source>STB_SORT_CHILD_ITEMS</source> <source>STB_SORT_CHILD_ITEMS</source>
<translation>Sort child items</translation> <translation>Sort child items</translation>
</message> </message>
<message>
<source>MEN_BREAK_SHAPER_LINK</source>
<translation>Break link</translation>
</message>
<message>
<source>STB_BREAK_SHAPER_LINK</source>
<translation>Break link with Shaper model</translation>
</message>
<message>
<source>MSG_BREAK_SHAPER_LINK</source>
<translation>A link with Shaper model for object %1 will be broken.
Continue?</translation>
</message>
<message>
<source>MSG_WARN_ON_GEOM_MODIF</source>
<translation>This action is prohibited since the geometry
was changed and the mesh needs to be recomputed.</translation>
</message>
<message> <message>
<source>SMESH_ADVANCED</source> <source>SMESH_ADVANCED</source>
<translation>Advanced</translation> <translation>Advanced</translation>

@ -4470,6 +4470,21 @@ Il ne peut pas être supprimé.</translation>
<source>STB_SORT_CHILD_ITEMS</source> <source>STB_SORT_CHILD_ITEMS</source>
<translation>Trier les items enfants</translation> <translation>Trier les items enfants</translation>
</message> </message>
<message>
<source>MEN_BREAK_SHAPER_LINK</source>
<translation>Rompre le lien</translation>
</message>
<message>
<source>STB_BREAK_SHAPER_LINK</source>
<translation>Rupture du lien avec le modèle Shaper</translation>
</message>
<message>
<source>MSG_BREAK_SHAPER_LINK</source>
<translation>
Un lien avec le modèle Shaper pour l'objet %1 sera rompu.
Continuer?
</translation>
</message>
<message> <message>
<source>SMESH_ADVANCED</source> <source>SMESH_ADVANCED</source>
<translation>Avancé</translation> <translation>Avancé</translation>

@ -225,11 +225,8 @@ const BRepMesh_Triangle* SMESH_Delaunay::FindTriangle( const gp_XY&
gp_XY seg = uv - gc; gp_XY seg = uv - gc;
tria->Edges( linkIDs, ori ); tria->Edges( linkIDs, ori );
#if OCC_VERSION_LARGE <= 0x07030000
int triaID = _triaDS->IndexOf( *tria ); const BRepMesh_Triangle* prevTria = tria;
#else
int triaID = tria - & ( _triaDS->GetElement( 0 ));
#endif
tria = 0; tria = 0;
for ( int i = 0; i < 3; ++i ) for ( int i = 0; i < 3; ++i )
@ -252,7 +249,9 @@ const BRepMesh_Triangle* SMESH_Delaunay::FindTriangle( const gp_XY&
double uSeg = ( uv1 - gc ) ^ lin / crossSegLin; double uSeg = ( uv1 - gc ) ^ lin / crossSegLin;
if ( 0. <= uSeg && uSeg <= 1. ) if ( 0. <= uSeg && uSeg <= 1. )
{ {
tria = & _triaDS->GetElement( triIDs.Index( 1 + ( triIDs.Index(1) == triaID ))); tria = & _triaDS->GetElement( triIDs.Index( 1 ));
if ( tria == prevTria )
tria = & _triaDS->GetElement( triIDs.Index( 2 ));
if ( tria->Movability() != BRepMesh_Deleted ) if ( tria->Movability() != BRepMesh_Deleted )
break; break;
} }

@ -48,7 +48,7 @@ namespace
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------
/*! /*!
* \brief Intersected face side storing a node created at this intersection * \brief Intersected face side storing a node created at this intersection
* and a intersected face * and an intersected face
*/ */
struct CutLink struct CutLink
{ {
@ -105,7 +105,7 @@ namespace
int myIndex; // positive -> side index, negative -> State int myIndex; // positive -> side index, negative -> State
const SMDS_MeshElement* myFace; const SMDS_MeshElement* myFace;
enum State { _INTERNAL = -1, _COPLANAR = -2 }; enum State { _INTERNAL = -1, _COPLANAR = -2, _PENDING = -3 };
void Set( const SMDS_MeshNode* Node1, void Set( const SMDS_MeshNode* Node1,
const SMDS_MeshNode* Node2, const SMDS_MeshNode* Node2,
@ -1524,7 +1524,8 @@ namespace SMESH_MeshAlgos
SMESH_MeshAlgos::GetBarycentricCoords( p2D( p ), SMESH_MeshAlgos::GetBarycentricCoords( p2D( p ),
p2D( nodes[0] ), p2D( nodes[1] ), p2D( nodes[2] ), p2D( nodes[0] ), p2D( nodes[1] ), p2D( nodes[2] ),
bc1, bc2 ); bc1, bc2 );
return ( 0. < bc1 && 0. < bc2 && bc1 + bc2 < 1. ); //return ( 0. < bc1 && 0. < bc2 && bc1 + bc2 < 1. );
return ( myTol < bc1 && myTol < bc2 && bc1 + bc2 + myTol < 1. );
} }
//================================================================================ //================================================================================
@ -1676,7 +1677,11 @@ namespace SMESH_MeshAlgos
size_t limit = cf.myLinks.size() * cf.myLinks.size() * 2; size_t limit = cf.myLinks.size() * cf.myLinks.size() * 2;
for ( size_t i1 = 3; i1 < cf.myLinks.size(); ++i1 ) size_t i1 = 3;
while ( cf.myLinks[i1-1].IsInternal() && i1 > 0 )
--i1;
for ( ; i1 < cf.myLinks.size(); ++i1 )
{ {
if ( !cf.myLinks[i1].IsInternal() ) if ( !cf.myLinks[i1].IsInternal() )
continue; continue;
@ -1998,6 +2003,28 @@ namespace SMESH_MeshAlgos
myMesh->RemoveFreeElement( f ); myMesh->RemoveFreeElement( f );
} }
// remove faces that are merged off
for ( cutFacesIt = myCutFaces.cbegin(); cutFacesIt != myCutFaces.cend(); ++cutFacesIt )
{
const CutFace& cf = *cutFacesIt;
if ( !cf.myLinks.empty() || cf.myInitFace->IsNull() )
continue;
nodes.assign( cf.myInitFace->begin_nodes(), cf.myInitFace->end_nodes() );
for ( size_t i = 0; i < nodes.size(); ++i )
{
const SMDS_MeshNode* n = nodes[ i ];
while ( myRemove2KeepNodes.IsBound( n ))
n = myRemove2KeepNodes( n );
if ( n != nodes[ i ] && cf.myInitFace->GetNodeIndex( n ) >= 0 )
{
theNew2OldFaces[ cf.myInitFace->GetID() ].first = 0;
myMesh->RemoveFreeElement( cf.myInitFace );
break;
}
}
}
// remove faces connected to cut off parts of cf.myInitFace // remove faces connected to cut off parts of cf.myInitFace
nodes.resize(2); nodes.resize(2);
@ -2010,9 +2037,9 @@ namespace SMESH_MeshAlgos
if ( nodes[0] != nodes[1] && if ( nodes[0] != nodes[1] &&
myMesh->GetElementsByNodes( nodes, faces )) myMesh->GetElementsByNodes( nodes, faces ))
{ {
if ( cutOffLinks[i].myFace && if ( // cutOffLinks[i].myFace &&
cutOffLinks[i].myIndex != EdgePart::_COPLANAR && cutOffLinks[i].myIndex != EdgePart::_COPLANAR &&
faces.size() == 2 ) faces.size() != 1 )
continue; continue;
for ( size_t iF = 0; iF < faces.size(); ++iF ) for ( size_t iF = 0; iF < faces.size(); ++iF )
{ {
@ -2045,13 +2072,22 @@ namespace SMESH_MeshAlgos
for ( size_t i = 0; i < touchedFaces.size(); ++i ) for ( size_t i = 0; i < touchedFaces.size(); ++i )
{ {
const CutFace& cf = *touchedFaces[i]; const CutFace& cf = *touchedFaces[i];
if ( cf.myInitFace->IsNull() )
continue;
int index = cf.myInitFace->GetID(); // index in theNew2OldFaces int index = cf.myInitFace->GetID(); // index in theNew2OldFaces
if ( !theNew2OldFaces[ index ].first ) if ( !theNew2OldFaces[ index ].first )
continue; // already cut off continue; // already cut off
cf.InitLinks();
if ( !cf.ReplaceNodes( myRemove2KeepNodes )) if ( !cf.ReplaceNodes( myRemove2KeepNodes ))
continue; // just keep as is {
if ( cf.myLinks.size() == 3 &&
cf.myInitFace->GetNodeIndex( cf.myLinks[0].myNode1 ) >= 0 &&
cf.myInitFace->GetNodeIndex( cf.myLinks[1].myNode1 ) >= 0 &&
cf.myInitFace->GetNodeIndex( cf.myLinks[2].myNode1 ) >= 0 )
continue; // just keep as is
}
if ( cf.myLinks.size() == 3 ) if ( cf.myLinks.size() == 3 )
{ {
@ -2737,8 +2773,16 @@ namespace
{ {
theLoops.AddNewLoop(); theLoops.AddNewLoop();
theLoops.AddEdge( myLinks[0] ); theLoops.AddEdge( myLinks[0] );
theLoops.AddEdge( myLinks[1] ); if ( myLinks[0].myNode2 == myLinks[1].myNode1 )
theLoops.AddEdge( myLinks[2] ); {
theLoops.AddEdge( myLinks[1] );
theLoops.AddEdge( myLinks[2] );
}
else
{
theLoops.AddEdge( myLinks[2] );
theLoops.AddEdge( myLinks[1] );
}
return; return;
} }
@ -2828,6 +2872,8 @@ namespace
TLinkMap& theCutOffCoplanarLinks) const TLinkMap& theCutOffCoplanarLinks) const
{ {
EdgePart sideEdge; EdgePart sideEdge;
boost::container::flat_set< const SMDS_MeshElement* > checkedCoplanar;
for ( size_t i = 0; i < myLinks.size(); ++i ) for ( size_t i = 0; i < myLinks.size(); ++i )
{ {
if ( !myLinks[i].myFace ) if ( !myLinks[i].myFace )
@ -2875,6 +2921,21 @@ namespace
loop = theLoops.GetLoopOf( twin ); loop = theLoops.GetLoopOf( twin );
toErase = ( loop && !loop->myLinks.empty() ); toErase = ( loop && !loop->myLinks.empty() );
} }
if ( toErase ) // do not erase if cutFace is connected to a co-planar cutFace
{
checkedCoplanar.clear();
for ( size_t iE = 0; iE < myLinks.size() && toErase; ++iE )
{
if ( !myLinks[iE].myFace || myLinks[iE].myIndex != EdgePart::_COPLANAR )
continue;
bool isAdded = checkedCoplanar.insert( myLinks[iE].myFace ).second;
if ( !isAdded )
continue;
toErase = SMESH_MeshAlgos::GetCommonNodes( myLinks[i ].myFace,
myLinks[iE].myFace ).size() < 1;
}
}
} }
if ( toErase ) if ( toErase )
@ -2886,8 +2947,8 @@ namespace
{ {
if ( !loop->myLinks[ iE ]->myFace && if ( !loop->myLinks[ iE ]->myFace &&
!loop->myLinks[ iE ]->IsInternal() )// && !loop->myLinks[ iE ]->IsInternal() )// &&
// !loop->myLinks[ iE ]->myNode1->isMarked() && // cut nodes are marked // !loop->myLinks[ iE ]->myNode1->isMarked() && // cut nodes are marked
// !loop->myLinks[ iE ]->myNode2->isMarked() ) // !loop->myLinks[ iE ]->myNode2->isMarked() )
{ {
int i = loop->myLinks[ iE ]->myIndex; int i = loop->myLinks[ iE ]->myIndex;
sideEdge.Set( myInitFace->GetNode ( i ), sideEdge.Set( myInitFace->GetNode ( i ),
@ -2963,7 +3024,9 @@ namespace
if ( myIndex + e.myIndex == _COPLANAR + _INTERNAL ) if ( myIndex + e.myIndex == _COPLANAR + _INTERNAL )
{ {
//check if the faces are connected //check if the faces are connected
int nbCommonNodes = SMESH_MeshAlgos::GetCommonNodes( e.myFace, myFace ).size(); int nbCommonNodes = 0;
if ( e.myFace && myFace )
nbCommonNodes = SMESH_MeshAlgos::GetCommonNodes( e.myFace, myFace ).size();
bool toReplace = (( myIndex == _INTERNAL && nbCommonNodes > 1 ) || bool toReplace = (( myIndex == _INTERNAL && nbCommonNodes > 1 ) ||
( myIndex == _COPLANAR && nbCommonNodes < 2 )); ( myIndex == _COPLANAR && nbCommonNodes < 2 ));
if ( toReplace ) if ( toReplace )
@ -3070,7 +3133,7 @@ SMDS_Mesh* SMESH_MeshAlgos::MakeOffset( SMDS_ElemIteratorPtr theFaceIt,
{ {
p.Set( nodes[i] ); p.Set( nodes[i] );
double dist = ( pPrev - p ).SquareModulus(); double dist = ( pPrev - p ).SquareModulus();
if ( dist > std::numeric_limits<double>::min() ) if ( dist < minNodeDist && dist > std::numeric_limits<double>::min() )
minNodeDist = dist; minNodeDist = dist;
pPrev = p; pPrev = p;
} }
@ -3240,7 +3303,10 @@ SMDS_Mesh* SMESH_MeshAlgos::MakeOffset( SMDS_ElemIteratorPtr theFaceIt,
break; break;
if ( !isConcaveNode2 && nbCommonNodes > 0 ) if ( !isConcaveNode2 && nbCommonNodes > 0 )
continue; {
if ( normals[ newFace->GetID() ] * normals[ closeFace->GetID() ] < 1.0 )
continue; // not co-planar
}
} }
intersector.Cut( newFace, closeFace, nbCommonNodes ); intersector.Cut( newFace, closeFace, nbCommonNodes );

@ -836,20 +836,22 @@ SMESH_MeshAlgos::MakeSlot( SMDS_ElemIteratorPtr theSegmentIt,
// 2) // 2)
double minCutDist = theWidth; double minCutDist = theWidth;
gp_XYZ projection, closestProj; gp_XYZ projection, closestProj;
int iCut; int iCut = -1;
for ( size_t iC = 0; iC < closeSeg[iP]->myCuts.size(); ++iC ) for ( size_t iC2 = 0; iC2 < closeSeg[iP]->myCuts.size(); ++iC2 )
{ {
double cutDist = closeSeg[iP]->myCuts[iC].SquareDistance( intPnt[iP].myNode, double cutDist = closeSeg[iP]->myCuts[iC2].SquareDistance( intPnt[iP].myNode,
projection ); projection );
if ( cutDist < minCutDist ) if ( cutDist < minCutDist )
{ {
closestProj = projection; closestProj = projection;
minCutDist = cutDist; minCutDist = cutDist;
iCut = iC; iCut = iC2;
if ( minCutDist < tol * tol )
break;
} }
if ( minCutDist < tol * tol )
break;
} }
if ( iCut < 0 )
continue; // ???
double d1 = SMESH_MeshAlgos::GetDistance( neighborSeg->myEdge, double d1 = SMESH_MeshAlgos::GetDistance( neighborSeg->myEdge,
closeSeg[iP]->myCuts[iCut][0].myNode ); closeSeg[iP]->myCuts[iCut][0].myNode );
double d2 = SMESH_MeshAlgos::GetDistance( neighborSeg->myEdge, double d2 = SMESH_MeshAlgos::GetDistance( neighborSeg->myEdge,

@ -567,7 +567,8 @@ _pyGen::_pyGen(Resource_DataMapOfAsciiStringAsciiString& theEntry2AccessorMethod
myRemovedObjIDs( theRemovedObjIDs ), myRemovedObjIDs( theRemovedObjIDs ),
myNbFilters( 0 ), myNbFilters( 0 ),
myToKeepAllCommands( theToKeepAllCommands ), myToKeepAllCommands( theToKeepAllCommands ),
myGeomIDNb(0), myGeomIDIndex(-1) myGeomIDNb(0), myGeomIDIndex(-1),
myShaperIDNb(0), myShaperIDIndex(-1)
{ {
// make that GetID() to return TPythonDump::SMESHGenName() // make that GetID() to return TPythonDump::SMESHGenName()
GetCreationCmd()->Clear(); GetCreationCmd()->Clear();
@ -575,30 +576,38 @@ _pyGen::_pyGen(Resource_DataMapOfAsciiStringAsciiString& theEntry2AccessorMethod
GetCreationCmd()->GetString() += "="; GetCreationCmd()->GetString() += "=";
// Find 1st digit of study entry by which a GEOM object differs from a SMESH object // Find 1st digit of study entry by which a GEOM object differs from a SMESH object
if ( !theObjectNames.IsEmpty() ) if (!theObjectNames.IsEmpty())
{ {
// find a GEOM entry // find a GEOM (aPass == 0) and SHAPERSTUDY (aPass == 1) entries
_pyID geomID; for(int aPass = 0; aPass < 2; aPass++) {
SALOMEDS::SComponent_wrap geomComp = SMESH_Gen_i::getStudyServant()->FindComponent("GEOM"); _pyID geomID;
if ( geomComp->_is_nil() ) return; SALOMEDS::SComponent_wrap geomComp = SMESH_Gen_i::getStudyServant()->
CORBA::String_var entry = geomComp->GetID(); FindComponent(aPass == 0 ? "GEOM" : "SHAPERSTUDY");
geomID = entry.in(); if (geomComp->_is_nil()) continue;
CORBA::String_var entry = geomComp->GetID();
geomID = entry.in();
// find a SMESH entry // find a SMESH entry
_pyID smeshID; _pyID smeshID;
Resource_DataMapIteratorOfDataMapOfAsciiStringAsciiString e2n( theObjectNames ); Resource_DataMapIteratorOfDataMapOfAsciiStringAsciiString e2n(theObjectNames);
for ( ; e2n.More() && smeshID.IsEmpty(); e2n.Next() ) for (; e2n.More() && smeshID.IsEmpty(); e2n.Next())
if ( _pyCommand::IsStudyEntry( e2n.Key() )) if (_pyCommand::IsStudyEntry(e2n.Key()))
smeshID = e2n.Key(); smeshID = e2n.Key();
// find 1st difference between smeshID and geomID // find 1st difference between smeshID and geomID
if ( !geomID.IsEmpty() && !smeshID.IsEmpty() ) if (!geomID.IsEmpty() && !smeshID.IsEmpty())
for ( int i = 1; i <= geomID.Length() && i <= smeshID.Length(); ++i ) for (int i = 1; i <= geomID.Length() && i <= smeshID.Length(); ++i)
if ( geomID.Value( i ) != smeshID.Value( i )) if (geomID.Value(i) != smeshID.Value(i))
{ {
myGeomIDNb = geomID.Value( i ); if (aPass == 0) {
myGeomIDIndex = i; myGeomIDNb = geomID.Value(i);
} myGeomIDIndex = i;
} else {
myShaperIDNb = geomID.Value(i);
myShaperIDIndex = i;
}
}
}
} }
} }
@ -1680,13 +1689,11 @@ Handle(_pyObject) _pyGen::FindObject( const _pyID& theObjID ) const
bool _pyGen::IsGeomObject(const _pyID& theObjID) const bool _pyGen::IsGeomObject(const _pyID& theObjID) const
{ {
if ( myGeomIDNb ) bool isGeom = myGeomIDNb && myGeomIDIndex <= theObjID.Length() &&
{ int( theObjID.Value( myGeomIDIndex )) == myGeomIDNb;
return ( myGeomIDIndex <= theObjID.Length() && bool isShaper = myShaperIDNb && myShaperIDIndex <= theObjID.Length() &&
int( theObjID.Value( myGeomIDIndex )) == myGeomIDNb && int( theObjID.Value( myShaperIDIndex )) == myShaperIDNb;
_pyCommand::IsStudyEntry( theObjID )); return ((isGeom || isShaper) && _pyCommand::IsStudyEntry( theObjID ));
}
return false;
} }
//================================================================================ //================================================================================
@ -1827,7 +1834,7 @@ _pyMesh::_pyMesh(const Handle(_pyCommand) theCreationCmd, const _pyID& meshId):
void _pyMesh::Process( const Handle(_pyCommand)& theCommand ) void _pyMesh::Process( const Handle(_pyCommand)& theCommand )
{ {
// some methods of SMESH_Mesh interface needs special conversion // some methods of SMESH_Mesh interface need special conversion
// to methods of Mesh python class // to methods of Mesh python class
// //
// 1. GetSubMesh(geom, name) + AddHypothesis(geom, algo) // 1. GetSubMesh(geom, name) + AddHypothesis(geom, algo)
@ -1980,7 +1987,7 @@ void _pyMesh::Process( const Handle(_pyCommand)& theCommand )
// if GetGroups() is just after Compute(), this can mean that the groups // if GetGroups() is just after Compute(), this can mean that the groups
// were created by some algorithm and hence Compute() should not be discarded // were created by some algorithm and hence Compute() should not be discarded
std::list< Handle(_pyCommand) >& cmdList = theGen->GetCommands(); std::list< Handle(_pyCommand) >& cmdList = theGen->GetCommands();
std::list< Handle(_pyCommand) >::iterator cmd = cmdList.begin(); std::list< Handle(_pyCommand) >::reverse_iterator cmd = cmdList.rbegin();
while ( (*cmd)->GetMethod() == "GetGroups" ) while ( (*cmd)->GetMethod() == "GetGroups" )
++cmd; ++cmd;
if ( myLastComputeCmd == (*cmd)) if ( myLastComputeCmd == (*cmd))
@ -2488,7 +2495,7 @@ void _pyMeshEditor::Process( const Handle(_pyCommand)& theCommand)
"ExtrusionByNormal", "ExtrusionSweepObject2D","ExtrusionAlongPath","ExtrusionAlongPathObject", "ExtrusionByNormal", "ExtrusionSweepObject2D","ExtrusionAlongPath","ExtrusionAlongPathObject",
"ExtrusionAlongPathX","ExtrusionAlongPathObject1D","ExtrusionAlongPathObject2D", "ExtrusionAlongPathX","ExtrusionAlongPathObject1D","ExtrusionAlongPathObject2D",
"ExtrusionSweepObjects","RotationSweepObjects","ExtrusionAlongPathObjects", "ExtrusionSweepObjects","RotationSweepObjects","ExtrusionAlongPathObjects",
"Mirror","MirrorObject","Translate","TranslateObject","Rotate","RotateObject", "Mirror","MirrorObject","Translate","TranslateObject","Rotate","RotateObject","Offset",
"FindCoincidentNodes","MergeNodes","FindEqualElements","FillHole", "FindCoincidentNodes","MergeNodes","FindEqualElements","FillHole",
"MergeElements","MergeEqualElements","SewFreeBorders","SewConformFreeBorders", "MergeElements","MergeEqualElements","SewFreeBorders","SewConformFreeBorders",
"FindCoincidentFreeBorders", "SewCoincidentFreeBorders", "FindCoincidentFreeBorders", "SewCoincidentFreeBorders",
@ -3158,8 +3165,7 @@ void _pyHypothesis::ComputeDiscarded( const Handle(_pyCommand)& theComputeCmd )
continue; continue;
// check if a cmd is a sole command setting its parameter; // check if a cmd is a sole command setting its parameter;
// don't use method name for search as it can change // don't use method name for search as it can change
map<TCollection_AsciiString, list<Handle(_pyCommand)> >::iterator map<_AString, list<Handle(_pyCommand)> >::iterator m2cmds = myMeth2Commands.begin();
m2cmds = myMeth2Commands.begin();
for ( ; m2cmds != myMeth2Commands.end(); ++m2cmds ) for ( ; m2cmds != myMeth2Commands.end(); ++m2cmds )
{ {
list< Handle(_pyCommand)>& cmds = m2cmds->second; list< Handle(_pyCommand)>& cmds = m2cmds->second;
@ -3832,6 +3838,8 @@ bool _pyCommand::IsMethodCall()
return false; return false;
if ( myString.StartsWith("#") ) if ( myString.StartsWith("#") )
return false; return false;
if ( myString.StartsWith("SHAPERSTUDY") ) // skip shaperstudy specific dump string analysis
return false;
const char* s = myString.ToCString() + GetBegPos( METHOD_IND ) + myMeth.Length() - 1; const char* s = myString.ToCString() + GetBegPos( METHOD_IND ) + myMeth.Length() - 1;
return ( s[0] == '(' || s[1] == '(' ); return ( s[0] == '(' || s[1] == '(' );
} }

@ -323,7 +323,10 @@ private:
Handle(_pyCommand) myLastCommand; Handle(_pyCommand) myLastCommand;
int myNbFilters; int myNbFilters;
bool myToKeepAllCommands; bool myToKeepAllCommands;
// difference of entry and index of this difference
int myGeomIDNb, myGeomIDIndex; int myGeomIDNb, myGeomIDIndex;
// difference of entry and index of this difference, specific for the SHAPER study
int myShaperIDNb, myShaperIDIndex;
std::map< _AString, ExportedMeshData > myFile2ExportedMesh; std::map< _AString, ExportedMeshData > myFile2ExportedMesh;
Handle( _pyHypothesisReader ) myHypReader; Handle( _pyHypothesisReader ) myHypReader;

@ -903,9 +903,7 @@ void BelongToGeom_i::SetGeom( GEOM::GEOM_Object_ptr theGeom )
{ {
if ( theGeom->_is_nil() ) if ( theGeom->_is_nil() )
return; return;
SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen(); TopoDS_Shape aLocShape = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theGeom );
GEOM::GEOM_Gen_ptr aGEOMGen = SMESH_Gen_i::GetGeomEngine();
TopoDS_Shape aLocShape = aSMESHGen->GetShapeReader()->GetShape( aGEOMGen, theGeom );
myBelongToGeomPtr->SetGeom( aLocShape ); myBelongToGeomPtr->SetGeom( aLocShape );
TPythonDump()<<this<<".SetGeom("<<theGeom<<")"; TPythonDump()<<this<<".SetGeom("<<theGeom<<")";
} }
@ -1001,9 +999,7 @@ void BelongToSurface_i::SetSurface( GEOM::GEOM_Object_ptr theGeom, ElementType t
{ {
if ( theGeom->_is_nil() ) if ( theGeom->_is_nil() )
return; return;
SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen(); TopoDS_Shape aLocShape = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theGeom );
GEOM::GEOM_Gen_ptr aGEOMGen = SMESH_Gen_i::GetGeomEngine();
TopoDS_Shape aLocShape = aSMESHGen->GetShapeReader()->GetShape( aGEOMGen, theGeom );
if ( aLocShape.ShapeType() == TopAbs_FACE ) if ( aLocShape.ShapeType() == TopAbs_FACE )
{ {
@ -1173,9 +1169,7 @@ void LyingOnGeom_i::SetGeom( GEOM::GEOM_Object_ptr theGeom )
{ {
if ( theGeom->_is_nil() ) if ( theGeom->_is_nil() )
return; return;
SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen(); TopoDS_Shape aLocShape = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theGeom );
GEOM::GEOM_Gen_ptr aGEOMGen = SMESH_Gen_i::GetGeomEngine();
TopoDS_Shape aLocShape = aSMESHGen->GetShapeReader()->GetShape( aGEOMGen, theGeom );
myLyingOnGeomPtr->SetGeom( aLocShape ); myLyingOnGeomPtr->SetGeom( aLocShape );
TPythonDump()<<this<<".SetGeom("<<theGeom<<")"; TPythonDump()<<this<<".SetGeom("<<theGeom<<")";
} }

@ -157,7 +157,7 @@ static int MYDEBUG = 0;
#endif #endif
// Static variables definition // Static variables definition
GEOM::GEOM_Gen_var SMESH_Gen_i::myGeomGen = GEOM::GEOM_Gen::_nil(); GEOM::GEOM_Gen_var SMESH_Gen_i::myGeomGen;
CORBA::ORB_var SMESH_Gen_i::myOrb; CORBA::ORB_var SMESH_Gen_i::myOrb;
PortableServer::POA_var SMESH_Gen_i::myPoa; PortableServer::POA_var SMESH_Gen_i::myPoa;
SALOME_NamingService* SMESH_Gen_i::myNS = NULL; SALOME_NamingService* SMESH_Gen_i::myNS = NULL;
@ -258,14 +258,15 @@ SALOME_NamingService* SMESH_Gen_i::GetNS()
* Get SALOME_LifeCycleCORBA object * Get SALOME_LifeCycleCORBA object
*/ */
//============================================================================= //=============================================================================
SALOME_LifeCycleCORBA* SMESH_Gen_i::GetLCC() {
SALOME_LifeCycleCORBA* SMESH_Gen_i::GetLCC()
{
if ( myLCC == NULL ) { if ( myLCC == NULL ) {
myLCC = new SALOME_LifeCycleCORBA( GetNS() ); myLCC = new SALOME_LifeCycleCORBA( GetNS() );
} }
return myLCC; return myLCC;
} }
//============================================================================= //=============================================================================
/*! /*!
* GetGeomEngine [ static ] * GetGeomEngine [ static ]
@ -273,18 +274,33 @@ SALOME_LifeCycleCORBA* SMESH_Gen_i::GetLCC() {
* Get GEOM::GEOM_Gen reference * Get GEOM::GEOM_Gen reference
*/ */
//============================================================================= //=============================================================================
GEOM::GEOM_Gen_var SMESH_Gen_i::GetGeomEngine() {
//CCRT GEOM::GEOM_Gen_var aGeomEngine = GEOM::GEOM_Gen_var SMESH_Gen_i::GetGeomEngine( bool isShaper )
//CCRT GEOM::GEOM_Gen::_narrow( GetLCC()->FindOrLoad_Component("FactoryServer","GEOM") ); {
//CCRT return aGeomEngine._retn(); Engines::EngineComponent_ptr temp =
if(CORBA::is_nil(myGeomGen)) GetLCC()->FindOrLoad_Component( isShaper ? "FactoryServer" : "FactoryServer",
{ isShaper ? "SHAPERSTUDY" : "GEOM" );
Engines::EngineComponent_ptr temp=GetLCC()->FindOrLoad_Component("FactoryServer","GEOM"); myGeomGen = GEOM::GEOM_Gen::_narrow( temp );
myGeomGen=GEOM::GEOM_Gen::_narrow(temp);
}
return myGeomGen; return myGeomGen;
} }
//=============================================================================
/*!
* GetGeomEngine [ static ]
*
* Get GEOM::GEOM_Gen reference
*/
//=============================================================================
GEOM::GEOM_Gen_var SMESH_Gen_i::GetGeomEngine( GEOM::GEOM_Object_ptr go )
{
GEOM::GEOM_Gen_ptr gen;
if ( !CORBA::is_nil( go ))
gen = go->GetGen();
return gen;
}
//============================================================================= //=============================================================================
/*! /*!
* SMESH_Gen_i::SMESH_Gen_i * SMESH_Gen_i::SMESH_Gen_i
@ -687,11 +703,18 @@ void SMESH_Gen_i::UpdateStudy()
myStudyContext = new StudyContext; myStudyContext = new StudyContext;
SALOMEDS::Study_var aStudy = getStudyServant(); SALOMEDS::Study_var aStudy = getStudyServant();
if ( !CORBA::is_nil( aStudy ) ) { if ( !CORBA::is_nil( aStudy ) )
{
SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
SALOMEDS::SComponent_wrap GEOM_var = aStudy->FindComponent( "GEOM" ); SALOMEDS::SComponent_wrap GEOM_var = aStudy->FindComponent( "GEOM" );
if( !GEOM_var->_is_nil() ) if( !GEOM_var->_is_nil() )
aStudyBuilder->LoadWith( GEOM_var, GetGeomEngine() ); aStudyBuilder->LoadWith( GEOM_var, GetGeomEngine( /*isShaper=*/false ) );
GEOM_var = aStudy->FindComponent( "SHAPERSTUDY" );
if( !GEOM_var->_is_nil() )
aStudyBuilder->LoadWith( GEOM_var, GetGeomEngine( /*isShaper=*/true ) );
// NPAL16168, issue 0020210 // NPAL16168, issue 0020210
// Let meshes update their data depending on GEOM groups that could change // Let meshes update their data depending on GEOM groups that could change
CORBA::String_var compDataType = ComponentDataType(); CORBA::String_var compDataType = ComponentDataType();
@ -708,6 +731,63 @@ void SMESH_Gen_i::UpdateStudy()
} }
} }
//================================================================================
/*!
* \brief Return true if mesh has ICON_SMESH_TREE_GEOM_MODIF icon
*/
//================================================================================
bool SMESH_Gen_i::isGeomModifIcon( SMESH::SMESH_Mesh_ptr mesh )
{
SALOMEDS::SObject_wrap so = ObjectToSObject( mesh );
SALOMEDS::GenericAttribute_wrap attr;
if ( ! so->_is_nil() && so->FindAttribute( attr.inout(), "AttributePixMap" ))
{
SALOMEDS::AttributePixMap_wrap pm = attr;
CORBA::String_var ico = pm->GetPixMap();
return ( strcmp( ico.in(), "ICON_SMESH_TREE_GEOM_MODIF" ) == 0 );
}
return false;
}
//=================================================================================
// function : hasObjectInfo()
// purpose : shows if module provides information for its objects
//=================================================================================
bool SMESH_Gen_i::hasObjectInfo()
{
return true;
}
//=================================================================================
// function : getObjectInfo()
// purpose : returns an information for a given object by its entry
//=================================================================================
char* SMESH_Gen_i::getObjectInfo( const char* entry )
{
// for a mesh with icon == ICON_SMESH_TREE_GEOM_MODIF show a warning;
// for the rest, "module 'SMESH', ID=0:1:2:*"
SMESH_Comment txt;
SALOMEDS::SObject_wrap so = getStudyServant()->FindObjectID( entry );
CORBA::Object_var obj = SObjectToObject( so );
SMESH::SMESH_Mesh_var mesh = SMESH::SMESH_Mesh::_narrow( obj );
if ( isGeomModifIcon( mesh ))
{
txt << "The geometry was changed and the mesh needs to be recomputed";
}
if ( txt.empty() )
{
CORBA::String_var compType = ComponentDataType();
txt << "module '" << compType << "', ID=" << entry;
}
return CORBA::string_dup( txt );
}
//============================================================================= //=============================================================================
/*! /*!
* SMESH_Gen_i::GetStudyContext * SMESH_Gen_i::GetStudyContext
@ -1995,7 +2075,10 @@ CORBA::Boolean SMESH_Gen_i::Compute( SMESH::SMESH_Mesh_ptr theMesh,
SMESH_Mesh_i* meshServant = SMESH::DownCast<SMESH_Mesh_i*>( theMesh ); SMESH_Mesh_i* meshServant = SMESH::DownCast<SMESH_Mesh_i*>( theMesh );
ASSERT( meshServant ); ASSERT( meshServant );
if ( meshServant ) { if ( meshServant ) {
meshServant->Load(); if ( isGeomModifIcon( theMesh ))
meshServant->Clear();
else
meshServant->Load();
// NPAL16168: "geometrical group edition from a submesh don't modify mesh computation" // NPAL16168: "geometrical group edition from a submesh don't modify mesh computation"
meshServant->CheckGeomModif(); meshServant->CheckGeomModif();
// get local TopoDS_Shape // get local TopoDS_Shape
@ -2351,7 +2434,7 @@ SMESH_Gen_i::GetGeometryByMeshElement( SMESH::SMESH_Mesh_ptr theMesh,
GEOM::GEOM_Object_wrap geom = FindGeometryByMeshElement(theMesh, theElementID); GEOM::GEOM_Object_wrap geom = FindGeometryByMeshElement(theMesh, theElementID);
if ( !geom->_is_nil() ) { if ( !geom->_is_nil() ) {
GEOM::GEOM_Object_var mainShape = theMesh->GetShapeToMesh(); GEOM::GEOM_Object_var mainShape = theMesh->GetShapeToMesh();
GEOM::GEOM_Gen_ptr geomGen = GetGeomEngine(); GEOM::GEOM_Gen_var geomGen = GetGeomEngine( geom );
// try to find the corresponding SObject // try to find the corresponding SObject
SALOMEDS::SObject_wrap SObj = ObjectToSObject( geom.in() ); SALOMEDS::SObject_wrap SObj = ObjectToSObject( geom.in() );
@ -2382,7 +2465,7 @@ SMESH_Gen_i::GetGeometryByMeshElement( SMESH::SMESH_Mesh_ptr theMesh,
} }
} }
} }
if ( SObj->_is_nil() ) // publish a new subshape if ( SObj->_is_nil() && !geomGen->_is_nil() ) // publish a new subshape
SObj = geomGen->AddInStudy( geom, theGeomName, mainShape ); SObj = geomGen->AddInStudy( geom, theGeomName, mainShape );
// return only published geometry // return only published geometry
@ -2415,7 +2498,7 @@ SMESH_Gen_i::FindGeometryByMeshElement( SMESH::SMESH_Mesh_ptr theMesh,
THROW_SALOME_CORBA_EXCEPTION( "bad Mesh reference", SALOME::BAD_PARAM ); THROW_SALOME_CORBA_EXCEPTION( "bad Mesh reference", SALOME::BAD_PARAM );
GEOM::GEOM_Object_var mainShape = theMesh->GetShapeToMesh(); GEOM::GEOM_Object_var mainShape = theMesh->GetShapeToMesh();
GEOM::GEOM_Gen_ptr geomGen = GetGeomEngine(); GEOM::GEOM_Gen_var geomGen = GetGeomEngine( mainShape );
// get a core mesh DS // get a core mesh DS
SMESH_Mesh_i* meshServant = SMESH::DownCast<SMESH_Mesh_i*>( theMesh ); SMESH_Mesh_i* meshServant = SMESH::DownCast<SMESH_Mesh_i*>( theMesh );
@ -2438,7 +2521,7 @@ SMESH_Gen_i::FindGeometryByMeshElement( SMESH::SMESH_Mesh_ptr theMesh,
} }
if ( !it->_is_nil() ) { if ( !it->_is_nil() ) {
for ( it->InitEx(true); it->More(); it->Next() ) { for ( it->InitEx(true); it->More(); it->Next() ) {
SALOMEDS::SObject_wrap so = it->Value(); SALOMEDS::SObject_wrap so = it->Value();
CORBA::Object_var obj = SObjectToObject( so ); CORBA::Object_var obj = SObjectToObject( so );
GEOM::GEOM_Object_var subGeom = GEOM::GEOM_Object::_narrow( obj ); GEOM::GEOM_Object_var subGeom = GEOM::GEOM_Object::_narrow( obj );
if ( !subGeom->_is_nil() ) { if ( !subGeom->_is_nil() ) {
@ -3098,7 +3181,7 @@ namespace // utils for CopyMeshWithGeom()
std::string newMainEntry = newEntry.in(); std::string newMainEntry = newEntry.in();
SALOMEDS::Study_var study = myGen_i->getStudyServant(); SALOMEDS::Study_var study = myGen_i->getStudyServant();
GEOM::GEOM_Gen_var geomGen = myGen_i->GetGeomEngine(); GEOM::GEOM_Gen_var geomGen = myGen_i->GetGeomEngine( mainShapeNew );
GEOM::GEOM_IShapesOperations_wrap op = geomGen->GetIShapesOperations(); GEOM::GEOM_IShapesOperations_wrap op = geomGen->GetIShapesOperations();
mySubshapes = op->GetExistingSubObjects( mainShapeNew, mySubshapes = op->GetExistingSubObjects( mainShapeNew,
/*groupsOnly=*/false ); /*groupsOnly=*/false );
@ -3153,7 +3236,7 @@ namespace // utils for CopyMeshWithGeom()
return GEOM::GEOM_Object::_duplicate( oldShape ); // shape independent of the old shape return GEOM::GEOM_Object::_duplicate( oldShape ); // shape independent of the old shape
GEOM::GEOM_Object_var mainShapeNew = myNewMesh_i->GetShapeToMesh(); GEOM::GEOM_Object_var mainShapeNew = myNewMesh_i->GetShapeToMesh();
GEOM::GEOM_Gen_var geomGen = myGen_i->GetGeomEngine(); GEOM::GEOM_Gen_var geomGen = myGen_i->GetGeomEngine( mainShapeNew );
// try to find by entry or name // try to find by entry or name
if ( myToPublish ) if ( myToPublish )
@ -3375,7 +3458,7 @@ namespace // utils for CopyMeshWithGeom()
GEOM::GEOM_Object_var mainShapeNew = myNewMesh_i->GetShapeToMesh(); GEOM::GEOM_Object_var mainShapeNew = myNewMesh_i->GetShapeToMesh();
GEOM::GEOM_Object_var mainShapeOld = mySrcMesh_i->GetShapeToMesh(); GEOM::GEOM_Object_var mainShapeOld = mySrcMesh_i->GetShapeToMesh();
GEOM::GEOM_Gen_var geomGen = myGen_i->GetGeomEngine(); GEOM::GEOM_Gen_var geomGen = myGen_i->GetGeomEngine( mainShapeNew );
GEOM::GEOM_IShapesOperations_wrap op = geomGen->GetIShapesOperations(); GEOM::GEOM_IShapesOperations_wrap op = geomGen->GetIShapesOperations();
try try
{ {
@ -3397,7 +3480,7 @@ namespace // utils for CopyMeshWithGeom()
GEOM::GEOM_Object_var newShape; GEOM::GEOM_Object_var newShape;
GEOM::GEOM_Object_var mainShapeNew = myNewMesh_i->GetShapeToMesh(); GEOM::GEOM_Object_var mainShapeNew = myNewMesh_i->GetShapeToMesh();
GEOM::GEOM_Gen_var geomGen = myGen_i->GetGeomEngine(); GEOM::GEOM_Gen_var geomGen = myGen_i->GetGeomEngine( mainShapeNew );
GEOM::GEOM_IShapesOperations_wrap op = geomGen->GetIShapesOperations(); GEOM::GEOM_IShapesOperations_wrap op = geomGen->GetIShapesOperations();
try try
{ {
@ -4392,6 +4475,14 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save( SALOMEDS::SComponent_ptr theComponent,
aDataset->WriteOnDisk( &meshPersistentId ); aDataset->WriteOnDisk( &meshPersistentId );
aDataset->CloseOnDisk(); aDataset->CloseOnDisk();
// Store SMESH_Mesh_i::_mainShapeTick
int shapeTick = myImpl->MainShapeTick();
aSize[ 0 ] = 1;
aDataset = new HDFdataset( "shapeTick", aTopGroup, HDF_INT32, aSize, 1 );
aDataset->CreateOnDisk();
aDataset->WriteOnDisk( &shapeTick );
aDataset->CloseOnDisk();
// write reference on a shape if exists // write reference on a shape if exists
SALOMEDS::SObject_wrap myRef; SALOMEDS::SObject_wrap myRef;
bool shapeRefFound = false; bool shapeRefFound = false;
@ -5067,23 +5158,6 @@ SALOMEDS::TMPFile* SMESH_Gen_i::SaveASCII( SALOMEDS::SComponent_ptr theComponent
return anAsciiStreamFile._retn(); return anAsciiStreamFile._retn();
} }
//=============================================================================
/*!
* SMESH_Gen_i::loadGeomData
*
* Load GEOM module data
*/
//=============================================================================
void SMESH_Gen_i::loadGeomData( SALOMEDS::SComponent_ptr theCompRoot )
{
if ( theCompRoot->_is_nil() )
return;
SALOMEDS::StudyBuilder_var aStudyBuilder = getStudyServant()->NewBuilder();
aStudyBuilder->LoadWith( theCompRoot, GetGeomEngine() );
}
//============================================================================= //=============================================================================
/*! /*!
* SMESH_Gen_i::Load * SMESH_Gen_i::Load
@ -5097,17 +5171,10 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
const char* theURL, const char* theURL,
bool isMultiFile ) bool isMultiFile )
{ {
// localizing UpdateStudy(); // load geom data
Kernel_Utils::Localizer loc; Kernel_Utils::Localizer loc;
//if (!myStudyContext)
UpdateStudy();
SALOMEDS::Study_var aStudy = getStudyServant(); SALOMEDS::Study_var aStudy = getStudyServant();
/* if( !theComponent->_is_nil() )
{
if( !aStudy->FindComponent( "GEOM" )->_is_nil() )
loadGeomData( aStudy->FindComponent( "GEOM" ) );
}*/
// Get temporary files location // Get temporary files location
TCollection_AsciiString tmpDir = TCollection_AsciiString tmpDir =
@ -5429,11 +5496,7 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
aDataset->CloseOnDisk(); aDataset->CloseOnDisk();
if ( strlen( refFromFile ) > 0 ) { if ( strlen( refFromFile ) > 0 ) {
SALOMEDS::SObject_wrap shapeSO = aStudy->FindObjectID( refFromFile ); SALOMEDS::SObject_wrap shapeSO = aStudy->FindObjectID( refFromFile );
CORBA::Object_var shapeObject = SObjectToObject( shapeSO );
// Make sure GEOM data are loaded first
//loadGeomData( shapeSO->GetFatherComponent() );
CORBA::Object_var shapeObject = SObjectToObject( shapeSO );
if ( !CORBA::is_nil( shapeObject ) ) { if ( !CORBA::is_nil( shapeObject ) ) {
aShapeObject = GEOM::GEOM_Object::_narrow( shapeObject ); aShapeObject = GEOM::GEOM_Object::_narrow( shapeObject );
if ( !aShapeObject->_is_nil() ) if ( !aShapeObject->_is_nil() )
@ -5444,7 +5507,7 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
} }
// issue 20918. Restore Persistent Id of SMESHDS_Mesh // issue 20918. Restore Persistent Id of SMESHDS_Mesh
if( aTopGroup->ExistInternalObject( "meshPersistentId" ) ) if ( aTopGroup->ExistInternalObject( "meshPersistentId" ) )
{ {
aDataset = new HDFdataset( "meshPersistentId", aTopGroup ); aDataset = new HDFdataset( "meshPersistentId", aTopGroup );
aDataset->OpenOnDisk(); aDataset->OpenOnDisk();
@ -5456,6 +5519,16 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
delete [] meshPersistentId; delete [] meshPersistentId;
} }
// Restore SMESH_Mesh_i::_mainShapeTick
if ( aTopGroup->ExistInternalObject( "shapeTick" ))
{
aDataset = new HDFdataset( "shapeTick", aTopGroup );
aDataset->OpenOnDisk();
int* shapeTick = & myNewMeshImpl->MainShapeTick();
aDataset->ReadFromDisk( shapeTick );
aDataset->CloseOnDisk();
}
// Restore file info // Restore file info
if ( aTopGroup->ExistInternalObject( "file info" )) if ( aTopGroup->ExistInternalObject( "file info" ))
{ {

@ -109,7 +109,8 @@ public:
// Get SALOME_LifeCycleCORBA object // Get SALOME_LifeCycleCORBA object
static SALOME_LifeCycleCORBA* GetLCC(); static SALOME_LifeCycleCORBA* GetLCC();
// Retrieve and get GEOM engine reference // Retrieve and get GEOM engine reference
static GEOM::GEOM_Gen_var GetGeomEngine(); static GEOM::GEOM_Gen_var GetGeomEngine( bool isShaper );
static GEOM::GEOM_Gen_var GetGeomEngine( GEOM::GEOM_Object_ptr );
// Get object of the CORBA reference // Get object of the CORBA reference
static PortableServer::ServantBase_var GetServant( CORBA::Object_ptr theObject ); static PortableServer::ServantBase_var GetServant( CORBA::Object_ptr theObject );
// Get CORBA object corresponding to the SALOMEDS::SObject // Get CORBA object corresponding to the SALOMEDS::SObject
@ -158,6 +159,12 @@ public:
// Update study // Update study
void UpdateStudy(); void UpdateStudy();
// Do provide info on objects
bool hasObjectInfo();
// Return an information for a given object
char* getObjectInfo(const char* entry);
// Create hypothesis/algorithm of given type // Create hypothesis/algorithm of given type
SMESH::SMESH_Hypothesis_ptr CreateHypothesis (const char* theHypType, SMESH::SMESH_Hypothesis_ptr CreateHypothesis (const char* theHypType,
const char* theLibName) const char* theLibName)
@ -635,6 +642,9 @@ private:
SMESH::SMESH_Mesh_ptr createMesh() SMESH::SMESH_Mesh_ptr createMesh()
throw ( SALOME::SALOME_Exception ); throw ( SALOME::SALOME_Exception );
// Check mesh icon
bool isGeomModifIcon( SMESH::SMESH_Mesh_ptr mesh );
// Create a sub-mesh on a geometry that is not a sub-shape of the main shape // Create a sub-mesh on a geometry that is not a sub-shape of the main shape
// for the case where a valid sub-shape not found by CopyMeshWithGeom() // for the case where a valid sub-shape not found by CopyMeshWithGeom()
SMESH::SMESH_subMesh_ptr createInvalidSubMesh( SMESH::SMESH_Mesh_ptr mesh, SMESH::SMESH_subMesh_ptr createInvalidSubMesh( SMESH::SMESH_Mesh_ptr mesh,
@ -643,8 +653,6 @@ private:
void highLightInvalid( SALOMEDS::SObject_ptr theSObject, bool isInvalid ); void highLightInvalid( SALOMEDS::SObject_ptr theSObject, bool isInvalid );
static void loadGeomData( SALOMEDS::SComponent_ptr theCompRoot );
SMESH::mesh_array* CreateMeshesFromMEDorSAUV( const char* theFileName, SMESH::mesh_array* CreateMeshesFromMEDorSAUV( const char* theFileName,
SMESH::DriverMED_ReadStatus& theStatus, SMESH::DriverMED_ReadStatus& theStatus,
const char* theCommandNameForPython, const char* theCommandNameForPython,

@ -252,9 +252,10 @@ GEOM::GEOM_Object_ptr SMESH_Gen_i::ShapeToGeomObject (const TopoDS_Shape& theSha
TopoDS_Shape SMESH_Gen_i::GeomObjectToShape(GEOM::GEOM_Object_ptr theGeomObject) TopoDS_Shape SMESH_Gen_i::GeomObjectToShape(GEOM::GEOM_Object_ptr theGeomObject)
{ {
TopoDS_Shape S; TopoDS_Shape S;
if ( !theGeomObject->_is_nil() && !theGeomObject->_non_existent() ) { if ( !theGeomObject->_is_nil() && !theGeomObject->_non_existent() )
GEOM_Client* aClient = GetShapeReader(); {
GEOM::GEOM_Gen_ptr aGeomEngine = GetGeomEngine(); GEOM_Client* aClient = GetShapeReader();
GEOM::GEOM_Gen_var aGeomEngine = GetGeomEngine( theGeomObject );
if ( aClient && !aGeomEngine->_is_nil () ) if ( aClient && !aGeomEngine->_is_nil () )
S = aClient->GetShape( aGeomEngine, theGeomObject ); S = aClient->GetShape( aGeomEngine, theGeomObject );
} }
@ -263,7 +264,7 @@ TopoDS_Shape SMESH_Gen_i::GeomObjectToShape(GEOM::GEOM_Object_ptr theGeomObject)
//======================================================================= //=======================================================================
//function : publish //function : publish
//purpose : //purpose :
//======================================================================= //=======================================================================
static SALOMEDS::SObject_ptr publish(CORBA::Object_ptr theIOR, static SALOMEDS::SObject_ptr publish(CORBA::Object_ptr theIOR,

@ -171,13 +171,13 @@ char* SMESH_GroupBase_i::GetName()
{ {
::SMESH_Group* aGroup = GetSmeshGroup(); ::SMESH_Group* aGroup = GetSmeshGroup();
if (aGroup) if (aGroup)
return CORBA::string_dup (aGroup->GetName()); return CORBA::string_dup( aGroup->GetName() );
return CORBA::string_dup( "NO_NAME" ); return CORBA::string_dup( "NO_NAME" );
} }
//============================================================================= //=============================================================================
/*! /*!
* *
*/ */
//============================================================================= //=============================================================================

@ -1390,8 +1390,11 @@ void SMESH_MeshEditor_i::SetNodeOnEdge(CORBA::Long NodeID, CORBA::Long EdgeID,
Standard_Real f,l; Standard_Real f,l;
BRep_Tool::Range( TopoDS::Edge( shape ), f,l); BRep_Tool::Range( TopoDS::Edge( shape ), f,l);
if ( paramOnEdge < f || paramOnEdge > l ) if ( paramOnEdge < f || paramOnEdge > l )
THROW_SALOME_CORBA_EXCEPTION("Invalid paramOnEdge", SALOME::BAD_PARAM); {
SMESH_Comment txt("Invalid paramOnEdge. It must vary in range [ ");
txt << f << ", " << l << " ]";
THROW_SALOME_CORBA_EXCEPTION(txt.c_str(), SALOME::BAD_PARAM);
}
mesh->SetNodeOnEdge( node, EdgeID, paramOnEdge ); mesh->SetNodeOnEdge( node, EdgeID, paramOnEdge );
myMesh->SetIsModified( true ); myMesh->SetIsModified( true );
@ -1434,14 +1437,11 @@ void SMESH_MeshEditor_i::SetNodeOnFace(CORBA::Long NodeID, CORBA::Long FaceID,
v > surf.LastVParameter() ); v > surf.LastVParameter() );
if ( isOut ) { if ( isOut ) {
#ifdef _DEBUG_ SMESH_Comment txt("Invalid UV. U must vary in range [ ");
MESSAGE ( "FACE " << FaceID << " (" << u << "," << v << ") out of " txt << surf.FirstUParameter() << ", " << surf.LastUParameter() << " ], ";
<< " u( " << surf.FirstUParameter() txt << "V must vary in range [ ";
<< "," << surf.LastUParameter() txt << surf.FirstVParameter() << ", " << surf.LastVParameter() << " ]";
<< ") v( " << surf.FirstVParameter() THROW_SALOME_CORBA_EXCEPTION(txt.c_str(), SALOME::BAD_PARAM);
<< "," << surf.LastVParameter() << ")" );
#endif
THROW_SALOME_CORBA_EXCEPTION("Invalid UV", SALOME::BAD_PARAM);
} }
mesh->SetNodeOnFace( node, FaceID, u, v ); mesh->SetNodeOnFace( node, FaceID, u, v );

@ -72,6 +72,7 @@
#include <TColStd_MapOfInteger.hxx> #include <TColStd_MapOfInteger.hxx>
#include <TopExp.hxx> #include <TopExp.hxx>
#include <TopExp_Explorer.hxx> #include <TopExp_Explorer.hxx>
#include <TopTools_DataMapOfShapeShape.hxx>
#include <TopTools_MapIteratorOfMapOfShape.hxx> #include <TopTools_MapIteratorOfMapOfShape.hxx>
#include <TopTools_MapOfShape.hxx> #include <TopTools_MapOfShape.hxx>
#include <TopoDS_Compound.hxx> #include <TopoDS_Compound.hxx>
@ -255,6 +256,47 @@ GEOM::GEOM_Object_ptr SMESH_Mesh_i::GetShapeToMesh()
return aShapeObj._retn(); return aShapeObj._retn();
} }
//================================================================================
/*!
* \brief Replaces a shape in the mesh
*/
//================================================================================
void SMESH_Mesh_i::ReplaceShape(GEOM::GEOM_Object_ptr theNewGeom)
throw (SALOME::SALOME_Exception)
{
TopoDS_Shape S = _impl->GetShapeToMesh();
GEOM_Client* geomClient = _gen_i->GetShapeReader();
TCollection_AsciiString aIOR;
if (geomClient->Find(S, aIOR)) {
geomClient->RemoveShapeFromBuffer(aIOR);
}
// update the reference to theNewGeom (needed for correct execution of a dumped python script)
SMESH::SMESH_Mesh_var me = _this();
SALOMEDS::SObject_wrap aSO = _gen_i->ObjectToSObject( me );
CORBA::String_var entry = theNewGeom->GetStudyEntry();
if ( !aSO->_is_nil() )
{
SALOMEDS::SObject_wrap aShapeRefSO;
if ( aSO->FindSubObject( _gen_i->GetRefOnShapeTag(), aShapeRefSO.inout() ))
{
SALOMEDS::SObject_wrap aShapeSO = _gen_i->getStudyServant()->FindObjectID( entry );
SALOMEDS::StudyBuilder_var builder = _gen_i->getStudyServant()->NewBuilder();
builder->Addreference( aShapeRefSO, aShapeSO );
}
}
// re-assign global hypotheses to the new shape
_mainShapeTick = -1;
CheckGeomModif( true );
TPythonDump() << "SHAPERSTUDY.breakLinkForSubElements(salome.ObjectToSObject("
<< me <<".GetMesh()), " << entry.in() << ")";
TPythonDump() << me << ".ReplaceShape( " << entry.in() << " )";
}
//================================================================================ //================================================================================
/*! /*!
* \brief Return false if the mesh is not yet fully loaded from the study file * \brief Return false if the mesh is not yet fully loaded from the study file
@ -1986,10 +2028,9 @@ void SMESH_Mesh_i::addGeomGroupData(GEOM::GEOM_Object_ptr theGeomObj,
if ( groupSO->_is_nil() ) if ( groupSO->_is_nil() )
return; return;
// group indices // group indices
GEOM::GEOM_Gen_var geomGen = _gen_i->GetGeomEngine(); GEOM::GEOM_Gen_var geomGen = _gen_i->GetGeomEngine( theGeomObj );
GEOM::GEOM_IGroupOperations_wrap groupOp = GEOM::GEOM_IGroupOperations_wrap groupOp = geomGen->GetIGroupOperations();
geomGen->GetIGroupOperations(); GEOM::ListOfLong_var ids = groupOp->GetObjects( theGeomObj );
GEOM::ListOfLong_var ids = groupOp->GetObjects( theGeomObj );
// store data // store data
_geomGroupData.push_back( TGeomGroupData() ); _geomGroupData.push_back( TGeomGroupData() );
@ -2030,41 +2071,58 @@ void SMESH_Mesh_i::removeGeomGroupData(CORBA::Object_ptr theSmeshObj)
* \brief Return new group contents if it has been changed and update group data * \brief Return new group contents if it has been changed and update group data
*/ */
//================================================================================ //================================================================================
enum { ONLY_IF_CHANGED, IS_BREAK_LINK, MAIN_TRANSFORMED };
TopoDS_Shape SMESH_Mesh_i::newGroupShape( TGeomGroupData & groupData) TopoDS_Shape SMESH_Mesh_i::newGroupShape( TGeomGroupData & groupData, int how )
{ {
TopoDS_Shape newShape; TopoDS_Shape newShape;
// get geom group if ( how == IS_BREAK_LINK )
SALOMEDS::SObject_wrap groupSO = SMESH_Gen_i::getStudyServant()->FindObjectID( groupData._groupEntry.c_str() );
if ( !groupSO->_is_nil() )
{ {
CORBA::Object_var groupObj = _gen_i->SObjectToObject( groupSO ); SALOMEDS::SObject_wrap meshSO = _gen_i->ObjectToSObject( groupData._smeshObject );
if ( CORBA::is_nil( groupObj )) return newShape; SALOMEDS::SObject_wrap geomRefSO, geomSO;
GEOM::GEOM_Object_var geomGroup = GEOM::GEOM_Object::_narrow( groupObj ); if ( !meshSO->_is_nil() &&
meshSO->FindSubObject( SMESH::Tag_RefOnShape, geomRefSO.inout() ) &&
// get indices of group items geomRefSO->ReferencedObject( geomSO.inout() ))
set<int> curIndices; {
GEOM::GEOM_Gen_var geomGen = _gen_i->GetGeomEngine(); CORBA::Object_var geomObj = _gen_i->SObjectToObject( geomSO );
GEOM::GEOM_IGroupOperations_wrap groupOp = GEOM::GEOM_Object_var geom = GEOM::GEOM_Object::_narrow( geomObj );
geomGen->GetIGroupOperations(); newShape = _gen_i->GeomObjectToShape( geom );
GEOM::ListOfLong_var ids = groupOp->GetObjects( geomGroup ); CORBA::String_var entry = geom->GetStudyEntry();
for ( CORBA::ULong i = 0; i < ids->length(); ++i ) groupData._groupEntry = entry.in();
curIndices.insert( ids[i] ); }
if ( groupData._indices == curIndices )
return newShape; // group not changed
// update data
groupData._indices = curIndices;
GEOM_Client* geomClient = _gen_i->GetShapeReader();
if ( !geomClient ) return newShape;
CORBA::String_var groupIOR = geomGen->GetStringFromIOR( geomGroup );
geomClient->RemoveShapeFromBuffer( groupIOR.in() );
newShape = _gen_i->GeomObjectToShape( geomGroup );
} }
else
{
// get geom group
SALOMEDS::SObject_wrap groupSO = SMESH_Gen_i::getStudyServant()->FindObjectID( groupData._groupEntry.c_str() );
if ( !groupSO->_is_nil() )
{
CORBA::Object_var groupObj = _gen_i->SObjectToObject( groupSO );
if ( CORBA::is_nil( groupObj )) return newShape;
GEOM::GEOM_Object_var geomGroup = GEOM::GEOM_Object::_narrow( groupObj );
// get indices of group items
set<int> curIndices;
GEOM::GEOM_Gen_var geomGen = _gen_i->GetGeomEngine( geomGroup );
GEOM::GEOM_IGroupOperations_wrap groupOp = geomGen->GetIGroupOperations();
GEOM::ListOfLong_var ids = groupOp->GetObjects( geomGroup );
for ( CORBA::ULong i = 0; i < ids->length(); ++i )
curIndices.insert( ids[i] );
if ( how == ONLY_IF_CHANGED && groupData._indices == curIndices )
return newShape; // group not changed
// update data
groupData._indices = curIndices;
GEOM_Client* geomClient = _gen_i->GetShapeReader();
if ( !geomClient ) return newShape;
CORBA::String_var groupIOR = geomGen->GetStringFromIOR( geomGroup );
geomClient->RemoveShapeFromBuffer( groupIOR.in() );
newShape = _gen_i->GeomObjectToShape( geomGroup );
}
}
if ( newShape.IsNull() ) { if ( newShape.IsNull() ) {
// geom group becomes empty - return empty compound // geom group becomes empty - return empty compound
TopoDS_Compound compound; TopoDS_Compound compound;
@ -2163,11 +2221,13 @@ namespace
*/ */
//============================================================================= //=============================================================================
void SMESH_Mesh_i::CheckGeomModif() void SMESH_Mesh_i::CheckGeomModif( bool isBreakLink )
{ {
SMESH::SMESH_Mesh_var me = _this(); SMESH::SMESH_Mesh_var me = _this();
GEOM::GEOM_Object_var mainGO = GetShapeToMesh(); GEOM::GEOM_Object_var mainGO = GetShapeToMesh();
TPythonDump dumpNothing; // prevent any dump
//bool removedFromClient = false; //bool removedFromClient = false;
if ( mainGO->_is_nil() ) // GEOM_Client cleared or geometry removed? (IPAL52735, PAL23636) if ( mainGO->_is_nil() ) // GEOM_Client cleared or geometry removed? (IPAL52735, PAL23636)
@ -2229,20 +2289,27 @@ void SMESH_Mesh_i::CheckGeomModif()
return; return;
} }
// Update after shape transformation like Translate // Update after shape modification
GEOM_Client* geomClient = _gen_i->GetShapeReader(); GEOM_Client* geomClient = _gen_i->GetShapeReader();
if ( !geomClient ) return; if ( !geomClient ) return;
GEOM::GEOM_Gen_var geomGen = _gen_i->GetGeomEngine(); GEOM::GEOM_Gen_var geomGen = _gen_i->GetGeomEngine( mainGO );
if ( geomGen->_is_nil() ) return; if ( geomGen->_is_nil() ) return;
CORBA::String_var geomComponentType = geomGen->ComponentDataType();
bool isShaper = ( strcmp( geomComponentType.in(), "SHAPERSTUDY" ) == 0 );
CORBA::String_var ior = geomGen->GetStringFromIOR( mainGO ); CORBA::String_var ior = geomGen->GetStringFromIOR( mainGO );
geomClient->RemoveShapeFromBuffer( ior.in() ); geomClient->RemoveShapeFromBuffer( ior.in() );
// Update data taking into account that // Update data taking into account that if topology doesn't change
// all sub-shapes change but IDs of sub-shapes remain (except for geom groups) // all sub-shapes change but IDs of sub-shapes remain (except for geom groups)
_impl->Clear(); if ( _preMeshInfo )
_preMeshInfo->ForgetAllData();
if ( isBreakLink || !isShaper )
_impl->Clear();
TopoDS_Shape newShape = _gen_i->GeomObjectToShape( mainGO ); TopoDS_Shape newShape = _gen_i->GeomObjectToShape( mainGO );
if ( newShape.IsNull() ) if ( newShape.IsNull() )
return; return;
@ -2255,6 +2322,7 @@ void SMESH_Mesh_i::CheckGeomModif()
std::vector< TGroupOnGeomData > groupsData; std::vector< TGroupOnGeomData > groupsData;
const std::set<SMESHDS_GroupBase*>& groups = meshDS->GetGroups(); const std::set<SMESHDS_GroupBase*>& groups = meshDS->GetGroups();
groupsData.reserve( groups.size() ); groupsData.reserve( groups.size() );
TopTools_DataMapOfShapeShape old2newShapeMap;
std::set<SMESHDS_GroupBase*>::const_iterator g = groups.begin(); std::set<SMESHDS_GroupBase*>::const_iterator g = groups.begin();
for ( ; g != groups.end(); ++g ) for ( ; g != groups.end(); ++g )
{ {
@ -2270,12 +2338,34 @@ void SMESH_Mesh_i::CheckGeomModif()
GEOM::GEOM_Object_var geom; GEOM::GEOM_Object_var geom;
if ( !gog->_is_nil() ) if ( !gog->_is_nil() )
geom = gog->GetShape(); {
if ( isBreakLink )
{
SALOMEDS::SObject_wrap grpSO = _gen_i->ObjectToSObject( gog );
SALOMEDS::SObject_wrap geomRefSO, geomSO;
if ( !grpSO->_is_nil() &&
grpSO->FindSubObject( SMESH::Tag_RefOnShape, geomRefSO.inout() ) &&
geomRefSO->ReferencedObject( geomSO.inout() ))
{
CORBA::Object_var geomObj = _gen_i->SObjectToObject( geomSO );
geom = GEOM::GEOM_Object::_narrow( geomObj );
}
}
else
{
geom = gog->GetShape();
}
}
if ( !geom->_is_nil() ) if ( !geom->_is_nil() )
{ {
CORBA::String_var ior = geomGen->GetStringFromIOR( geom ); CORBA::String_var ior = geomGen->GetStringFromIOR( geom );
geomClient->RemoveShapeFromBuffer( ior.in() ); geomClient->RemoveShapeFromBuffer( ior.in() );
groupsData.back()._shape = _gen_i->GeomObjectToShape( geom ); groupsData.back()._shape = _gen_i->GeomObjectToShape( geom );
old2newShapeMap.Bind( group->GetShape(), groupsData.back()._shape );
}
else if ( old2newShapeMap.IsBound( group->GetShape() ))
{
groupsData.back()._shape = old2newShapeMap( group->GetShape() );
} }
} }
} }
@ -2289,16 +2379,50 @@ void SMESH_Mesh_i::CheckGeomModif()
ids2Hyps.push_back( make_pair( meshDS->ShapeToIndex( s ), hyps )); ids2Hyps.push_back( make_pair( meshDS->ShapeToIndex( s ), hyps ));
} }
// change shape to mesh std::map< std::set<int>, int > ii2iMap; // group sub-ids to group id in SMESHDS
// count shapes excluding compounds corresponding to geom groups
int oldNbSubShapes = meshDS->MaxShapeIndex(); int oldNbSubShapes = meshDS->MaxShapeIndex();
for ( ; oldNbSubShapes > 0; --oldNbSubShapes )
{
const TopoDS_Shape& s = meshDS->IndexToShape( oldNbSubShapes );
if ( s.IsNull() || s.ShapeType() != TopAbs_COMPOUND )
break;
// fill ii2iMap
std::set<int> subIds;
for ( TopoDS_Iterator it( s ); it.More(); it.Next() )
subIds.insert( meshDS->ShapeToIndex( it.Value() ));
ii2iMap.insert( std::make_pair( subIds, oldNbSubShapes ));
}
// check if shape topology changes - save shape type per shape ID
std::vector< TopAbs_ShapeEnum > shapeTypes( Max( oldNbSubShapes + 1, 1 ));
for ( int shapeID = oldNbSubShapes; shapeID > 0; --shapeID )
shapeTypes[ shapeID ] = meshDS->IndexToShape( shapeID ).ShapeType();
// change shape to mesh
_impl->ShapeToMesh( TopoDS_Shape() ); _impl->ShapeToMesh( TopoDS_Shape() );
_impl->ShapeToMesh( newShape ); _impl->ShapeToMesh( newShape );
// re-add shapes of geom groups // check if shape topology changes - check new shape types
bool sameTopology = ( oldNbSubShapes == meshDS->MaxShapeIndex() );
for ( int shapeID = oldNbSubShapes; shapeID > 0 && sameTopology; --shapeID )
{
const TopoDS_Shape& s = meshDS->IndexToShape( shapeID );
sameTopology = ( !s.IsNull() && s.ShapeType() == shapeTypes[ shapeID ]);
}
// re-add shapes (compounds) of geom groups
std::map< int, int > old2newIDs; // group IDs
std::list<TGeomGroupData>::iterator data = _geomGroupData.begin(); std::list<TGeomGroupData>::iterator data = _geomGroupData.begin();
for ( ; data != _geomGroupData.end(); ++data ) for ( ; data != _geomGroupData.end(); ++data )
{ {
TopoDS_Shape newShape = newGroupShape( *data ); int oldID = 0;
std::map< std::set<int>, int >::iterator ii2i = ii2iMap.find( data->_indices );
if ( ii2i != ii2iMap.end() )
oldID = ii2i->second;
TopoDS_Shape newShape = newGroupShape( *data, isBreakLink ? IS_BREAK_LINK : MAIN_TRANSFORMED );
if ( !newShape.IsNull() ) if ( !newShape.IsNull() )
{ {
if ( meshDS->ShapeToIndex( newShape ) > 0 ) // a group reduced to one sub-shape if ( meshDS->ShapeToIndex( newShape ) > 0 ) // a group reduced to one sub-shape
@ -2308,48 +2432,88 @@ void SMESH_Mesh_i::CheckGeomModif()
BRep_Builder().Add( compound, newShape ); BRep_Builder().Add( compound, newShape );
newShape = compound; newShape = compound;
} }
_impl->GetSubMesh( newShape ); int newID = _impl->GetSubMesh( newShape )->GetId();
if ( oldID && oldID != newID )
old2newIDs.insert( std::make_pair( oldID, newID ));
} }
} }
if ( oldNbSubShapes != meshDS->MaxShapeIndex() )
THROW_SALOME_CORBA_EXCEPTION( "SMESH_Mesh_i::CheckGeomModif() bug",
SALOME::INTERNAL_ERROR );
// re-assign hypotheses // re-assign hypotheses
for ( size_t i = 0; i < ids2Hyps.size(); ++i ) for ( size_t i = 0; i < ids2Hyps.size(); ++i )
{ {
const TopoDS_Shape& s = meshDS->IndexToShape( ids2Hyps[i].first ); if ( !sameTopology && ids2Hyps[i].first != 1 )
continue; // assign only global hypos
int sID = ids2Hyps[i].first;
std::map< int, int >::iterator o2n = old2newIDs.find( sID );
if ( o2n != old2newIDs.end() )
sID = o2n->second;
const TopoDS_Shape& s = meshDS->IndexToShape( sID );
const THypList& hyps = ids2Hyps[i].second; const THypList& hyps = ids2Hyps[i].second;
THypList::const_iterator h = hyps.begin(); THypList::const_iterator h = hyps.begin();
for ( ; h != hyps.end(); ++h ) for ( ; h != hyps.end(); ++h )
_impl->AddHypothesis( s, (*h)->GetID() ); _impl->AddHypothesis( s, (*h)->GetID() );
} }
// restore groups on geometry if ( !sameTopology )
for ( size_t i = 0; i < groupsData.size(); ++i )
{ {
const TGroupOnGeomData& data = groupsData[i]; // remove invalid study sub-objects
if ( data._shape.IsNull() ) CheckGeomGroupModif();
continue; }
else
{
// restore groups on geometry
for ( size_t i = 0; i < groupsData.size(); ++i )
{
const TGroupOnGeomData& data = groupsData[i];
if ( data._shape.IsNull() )
continue;
std::map<int, SMESH::SMESH_GroupBase_ptr>::iterator i2g = _mapGroups.find( data._oldID ); std::map<int, SMESH::SMESH_GroupBase_ptr>::iterator i2g = _mapGroups.find( data._oldID );
if ( i2g == _mapGroups.end() ) continue; if ( i2g == _mapGroups.end() ) continue;
SMESH_GroupBase_i* gr_i = SMESH::DownCast<SMESH_GroupBase_i*>( i2g->second ); SMESH_GroupBase_i* gr_i = SMESH::DownCast<SMESH_GroupBase_i*>( i2g->second );
if ( !gr_i ) continue; if ( !gr_i ) continue;
SMESH_Group* g = _impl->AddGroup( data._type, data._name.c_str(), data._oldID, data._shape ); SMESH_Group* g = _impl->AddGroup( data._type, data._name.c_str(), data._oldID, data._shape );
if ( !g ) if ( !g )
_mapGroups.erase( i2g ); _mapGroups.erase( i2g );
else else
g->GetGroupDS()->SetColor( data._color ); g->GetGroupDS()->SetColor( data._color );
}
std::map< int, int >::iterator o2n = old2newIDs.begin();
for ( ; o2n != old2newIDs.end(); ++o2n )
{
int newID = o2n->second, oldID = o2n->first;
if ( !_mapSubMesh.count( oldID ))
continue;
if ( newID > 0 )
{
_mapSubMesh [ newID ] = _impl->GetSubMeshContaining( newID );
_mapSubMesh_i [ newID ] = _mapSubMesh_i [ oldID ];
_mapSubMeshIor[ newID ] = _mapSubMeshIor[ oldID ];
}
_mapSubMesh. erase(oldID);
_mapSubMesh_i. erase(oldID);
_mapSubMeshIor.erase(oldID);
if ( newID > 0 )
_mapSubMesh_i [ newID ]->changeLocalId( newID );
}
// update _mapSubMesh
std::map<int, ::SMESH_subMesh*>::iterator i_sm = _mapSubMesh.begin();
for ( ; i_sm != _mapSubMesh.end(); ++i_sm )
i_sm->second = _impl->GetSubMesh( meshDS->IndexToShape( i_sm->first ));
} }
// update _mapSubMesh _gen_i->UpdateIcons( me );
std::map<int, ::SMESH_subMesh*>::iterator i_sm = _mapSubMesh.begin();
for ( ; i_sm != _mapSubMesh.end(); ++i_sm )
i_sm->second = _impl->GetSubMesh( meshDS->IndexToShape( i_sm->first ));
if ( !isBreakLink && isShaper )
{
SALOMEDS::SObject_wrap meshSO = _gen_i->ObjectToSObject( me );
if ( !meshSO->_is_nil() )
_gen_i->SetPixMap(meshSO, "ICON_SMESH_TREE_GEOM_MODIF");
}
} }
//============================================================================= //=============================================================================
@ -2473,7 +2637,7 @@ void SMESH_Mesh_i::CheckGeomGroupModif()
bool processedGroup = !it_new.second; bool processedGroup = !it_new.second;
TopoDS_Shape& newShape = it_new.first->second; TopoDS_Shape& newShape = it_new.first->second;
if ( !processedGroup ) if ( !processedGroup )
newShape = newGroupShape( *data ); newShape = newGroupShape( *data, ONLY_IF_CHANGED );
if ( newShape.IsNull() ) if ( newShape.IsNull() )
continue; // no changes continue; // no changes

@ -74,6 +74,9 @@ public:
GEOM::GEOM_Object_ptr GetShapeToMesh() GEOM::GEOM_Object_ptr GetShapeToMesh()
throw (SALOME::SALOME_Exception); throw (SALOME::SALOME_Exception);
virtual void ReplaceShape(GEOM::GEOM_Object_ptr theNewGeom)
throw (SALOME::SALOME_Exception);
CORBA::Boolean IsLoaded() CORBA::Boolean IsLoaded()
throw (SALOME::SALOME_Exception); throw (SALOME::SALOME_Exception);
@ -460,7 +463,7 @@ public:
* *
* Issue 0022501 * Issue 0022501
*/ */
void CheckGeomModif(); void CheckGeomModif( bool isBreakLink = false );
/*! /*!
* \brief Update hypotheses assigned to geom groups if the latter change * \brief Update hypotheses assigned to geom groups if the latter change
* *
@ -618,6 +621,12 @@ public:
std::string FileInfoToString(); std::string FileInfoToString();
void FileInfoFromString(const std::string& info); void FileInfoFromString(const std::string& info);
/*!
* Persistence of geometry tick
*/
int& MainShapeTick() { return _mainShapeTick; }
/*! /*!
* Sets list of notebook variables used for Mesh operations separated by ":" symbol * Sets list of notebook variables used for Mesh operations separated by ":" symbol
*/ */
@ -765,7 +774,7 @@ private:
/*! /*!
* Return new group contents if it has been changed and update group data * Return new group contents if it has been changed and update group data
*/ */
TopoDS_Shape newGroupShape( TGeomGroupData & groupData); TopoDS_Shape newGroupShape( TGeomGroupData & groupData, int how );
}; };

@ -696,7 +696,7 @@ namespace SMESH
//function : DumpPython //function : DumpPython
//purpose : //purpose :
//======================================================================= //=======================================================================
Engines::TMPFile* SMESH_Gen_i::DumpPython (CORBA::Boolean isPublished, Engines::TMPFile* SMESH_Gen_i::DumpPython( CORBA::Boolean isPublished,
CORBA::Boolean isMultiFile, CORBA::Boolean isMultiFile,
CORBA::Boolean& isValidScript) CORBA::Boolean& isValidScript)
{ {
@ -1061,12 +1061,15 @@ TCollection_AsciiString SMESH_Gen_i::DumpPython_impl
isHistoricalDump ); isHistoricalDump );
bool importGeom = false; bool importGeom = false;
GEOM::GEOM_Gen_ptr geom = GetGeomEngine(); GEOM::GEOM_Gen_ptr geom[2];
for ( int isShaper = 0; isShaper < 2; ++isShaper )
{ {
geom[ isShaper ] = GetGeomEngine( isShaper );
if ( CORBA::is_nil( geom[ isShaper ]))
continue;
// Add names of GEOM objects to theObjectNames to exclude same names of SMESH objects // Add names of GEOM objects to theObjectNames to exclude same names of SMESH objects
GEOM::string_array_var aGeomNames = geom->GetAllDumpNames(); GEOM::string_array_var aGeomNames = geom[ isShaper ]->GetAllDumpNames();
int ign = 0, nbgn = aGeomNames->length(); for ( CORBA::ULong ign = 0; ign < aGeomNames->length(); ign++) {
for (; ign < nbgn; ign++) {
TCollection_AsciiString aName = aGeomNames[ign].in(); TCollection_AsciiString aName = aGeomNames[ign].in();
theObjectNames.Bind(aName, "1"); theObjectNames.Bind(aName, "1");
} }
@ -1100,7 +1103,11 @@ TCollection_AsciiString SMESH_Gen_i::DumpPython_impl
anUpdatedScript += aLine.SubString( aStart, aSeq->Value(i) - 1 ); // line part before i-th entry anUpdatedScript += aLine.SubString( aStart, aSeq->Value(i) - 1 ); // line part before i-th entry
anEntry = aLine.SubString( aSeq->Value(i), aSeq->Value(i + 1) ); anEntry = aLine.SubString( aSeq->Value(i), aSeq->Value(i + 1) );
// is a GEOM object? // is a GEOM object?
CORBA::String_var geomName = geom->GetDumpName( anEntry.ToCString() ); CORBA::String_var geomName;
if ( !CORBA::is_nil( geom[0] ))
geomName = geom[0]->GetDumpName( anEntry.ToCString() );
if (( !geomName.in() || !geomName.in()[0] ) && !CORBA::is_nil( geom[1] ))
geomName = geom[1]->GetDumpName( anEntry.ToCString() );
if ( !geomName.in() || !geomName.in()[0] ) { if ( !geomName.in() || !geomName.in()[0] ) {
// is a SMESH object // is a SMESH object
if ( theObjectNames.IsBound( anEntry )) { if ( theObjectNames.IsBound( anEntry )) {

@ -123,6 +123,7 @@ protected:
void changeLocalId(int localId) { _localId = localId; } void changeLocalId(int localId) { _localId = localId; }
friend void SMESH_Mesh_i::CheckGeomGroupModif(); friend void SMESH_Mesh_i::CheckGeomGroupModif();
friend void SMESH_Mesh_i::CheckGeomModif(bool);
SMESH_PreMeshInfo* _preMeshInfo; // mesh info before full loading from study file SMESH_PreMeshInfo* _preMeshInfo; // mesh info before full loading from study file

@ -75,6 +75,11 @@ POLYGON = "PolygonPerFace_2D"
Algorithm type: Polygon Per Face 2D algorithm, see :class:`~StdMeshersBuilder.StdMeshersBuilder_PolygonPerFace` Algorithm type: Polygon Per Face 2D algorithm, see :class:`~StdMeshersBuilder.StdMeshersBuilder_PolygonPerFace`
""" """
POLYHEDRON = "PolyhedronPerSolid_3D"
"""
Algorithm type: Polyhedron Per Solid 3D algorithm, see :class:`~StdMeshersBuilder.StdMeshersBuilder_PolyhedronPerSolid`
"""
# import items of enums # import items of enums
for e in StdMeshers.QuadType._items: exec('%s = StdMeshers.%s'%(e,e)) for e in StdMeshers.QuadType._items: exec('%s = StdMeshers.%s'%(e,e))
for e in StdMeshers.VLExtrusionMethod._items: exec('%s = StdMeshers.%s'%(e,e)) for e in StdMeshers.VLExtrusionMethod._items: exec('%s = StdMeshers.%s'%(e,e))
@ -1671,6 +1676,44 @@ class StdMeshersBuilder_PolygonPerFace(Mesh_Algorithm):
pass pass
class StdMeshersBuilder_PolyhedronPerSolid(Mesh_Algorithm):
""" Defines a Polyhedron Per Solid 3D algorithm.
It is created by calling smeshBuilder.Mesh.Polyhedron(geom=0)
"""
meshMethod = "Polyhedron"
"""
name of the dynamic method in smeshBuilder.Mesh class
"""
algoType = POLYHEDRON
"""
type of algorithm used with helper function in smeshBuilder.Mesh class
"""
isDefault = True
"""
flag pointing whether this algorithm should be used by default in dynamic method
of smeshBuilder.Mesh class
"""
docHelper = "Create polyhedron 3D algorithm for solids"
"""
doc string of the method
"""
def __init__(self, mesh, geom=0):
"""
Private constructor.
Parameters:
mesh: parent mesh object algorithm is assigned to
geom: geometry (shape/sub-shape) algorithm is assigned to;
if it is :code:`0` (default), the algorithm is assigned to the main shape
"""
Mesh_Algorithm.__init__(self)
self.Create(mesh, geom, self.algoType)
pass
pass
class StdMeshersBuilder_UseExistingElements_1D(Mesh_Algorithm): class StdMeshersBuilder_UseExistingElements_1D(Mesh_Algorithm):
""" Defines a Use Existing Elements 1D algorithm. """ Defines a Use Existing Elements 1D algorithm.

@ -305,7 +305,7 @@ def AssureGeomPublished(mesh, geom, name=''):
""" """
if not mesh.smeshpyD.IsEnablePublish(): if not mesh.smeshpyD.IsEnablePublish():
return return
if not isinstance( geom, geomBuilder.GEOM._objref_GEOM_Object ): if not hasattr( geom, "GetShapeType" ):
return return
if not geom.GetStudyEntry(): if not geom.GetStudyEntry():
## get a name ## get a name
@ -318,27 +318,13 @@ def AssureGeomPublished(mesh, geom, name=''):
mesh.geompyD.addToStudyInFather( mesh.geom, geom, name ) mesh.geompyD.addToStudyInFather( mesh.geom, geom, name )
return return
def FirstVertexOnCurve(mesh, edge): # def FirstVertexOnCurve(mesh, edge):
""" # """
Returns: # Returns:
the first vertex of a geometrical edge by ignoring orientation # the first vertex of a geometrical edge by ignoring orientation
""" # """
vv = mesh.geompyD.SubShapeAll( edge, geomBuilder.geomBuilder.ShapeType["VERTEX"]) # return mesh.geompyD.GetVertexByIndex( edge, 0, False )
if not vv:
raise TypeError("Given object has no vertices")
if len( vv ) == 1: return vv[0]
v0 = mesh.geompyD.MakeVertexOnCurve(edge,0.)
xyz = mesh.geompyD.PointCoordinates( v0 ) # coords of the first vertex
xyz1 = mesh.geompyD.PointCoordinates( vv[0] )
xyz2 = mesh.geompyD.PointCoordinates( vv[1] )
dist1, dist2 = 0,0
for i in range(3):
dist1 += abs( xyz[i] - xyz1[i] )
dist2 += abs( xyz[i] - xyz2[i] )
if dist1 < dist2:
return vv[0]
else:
return vv[1]
smeshInst = None smeshInst = None
""" """
@ -531,8 +517,8 @@ class smeshBuilder( SMESH._objref_SMESH_Gen, object ):
Returns: Returns:
:class:`SMESH.PointStruct` :class:`SMESH.PointStruct`
""" """
geompyD = theVertex.GetGen()
[x, y, z] = self.geompyD.PointCoordinates(theVertex) [x, y, z] = geompyD.PointCoordinates(theVertex)
return PointStruct(x,y,z) return PointStruct(x,y,z)
def GetDirStruct(self,theVector): def GetDirStruct(self,theVector):
@ -545,13 +531,13 @@ class smeshBuilder( SMESH._objref_SMESH_Gen, object ):
Returns: Returns:
:class:`SMESH.DirStruct` :class:`SMESH.DirStruct`
""" """
geompyD = theVector.GetGen()
vertices = self.geompyD.SubShapeAll( theVector, geomBuilder.geomBuilder.ShapeType["VERTEX"] ) vertices = geompyD.SubShapeAll( theVector, geomBuilder.geomBuilder.ShapeType["VERTEX"] )
if(len(vertices) != 2): if(len(vertices) != 2):
print("Error: vector object is incorrect.") print("Error: vector object is incorrect.")
return None return None
p1 = self.geompyD.PointCoordinates(vertices[0]) p1 = geompyD.PointCoordinates(vertices[0])
p2 = self.geompyD.PointCoordinates(vertices[1]) p2 = geompyD.PointCoordinates(vertices[1])
pnt = PointStruct(p2[0]-p1[0], p2[1]-p1[1], p2[2]-p1[2]) pnt = PointStruct(p2[0]-p1[0], p2[1]-p1[1], p2[2]-p1[2])
dirst = DirStruct(pnt) dirst = DirStruct(pnt)
return dirst return dirst
@ -581,28 +567,29 @@ class smeshBuilder( SMESH._objref_SMESH_Gen, object ):
:class:`SMESH.AxisStruct` :class:`SMESH.AxisStruct`
""" """
import GEOM import GEOM
edges = self.geompyD.SubShapeAll( theObj, geomBuilder.geomBuilder.ShapeType["EDGE"] ) geompyD = theObj.GetGen()
edges = geompyD.SubShapeAll( theObj, geomBuilder.geomBuilder.ShapeType["EDGE"] )
axis = None axis = None
if len(edges) > 1: if len(edges) > 1:
vertex1, vertex2 = self.geompyD.SubShapeAll( edges[0], geomBuilder.geomBuilder.ShapeType["VERTEX"] ) vertex1, vertex2 = geompyD.SubShapeAll( edges[0], geomBuilder.geomBuilder.ShapeType["VERTEX"] )
vertex3, vertex4 = self.geompyD.SubShapeAll( edges[1], geomBuilder.geomBuilder.ShapeType["VERTEX"] ) vertex3, vertex4 = geompyD.SubShapeAll( edges[1], geomBuilder.geomBuilder.ShapeType["VERTEX"] )
vertex1 = self.geompyD.PointCoordinates(vertex1) vertex1 = geompyD.PointCoordinates(vertex1)
vertex2 = self.geompyD.PointCoordinates(vertex2) vertex2 = geompyD.PointCoordinates(vertex2)
vertex3 = self.geompyD.PointCoordinates(vertex3) vertex3 = geompyD.PointCoordinates(vertex3)
vertex4 = self.geompyD.PointCoordinates(vertex4) vertex4 = geompyD.PointCoordinates(vertex4)
v1 = [vertex2[0]-vertex1[0], vertex2[1]-vertex1[1], vertex2[2]-vertex1[2]] v1 = [vertex2[0]-vertex1[0], vertex2[1]-vertex1[1], vertex2[2]-vertex1[2]]
v2 = [vertex4[0]-vertex3[0], vertex4[1]-vertex3[1], vertex4[2]-vertex3[2]] v2 = [vertex4[0]-vertex3[0], vertex4[1]-vertex3[1], vertex4[2]-vertex3[2]]
normal = [ v1[1]*v2[2]-v2[1]*v1[2], v1[2]*v2[0]-v2[2]*v1[0], v1[0]*v2[1]-v2[0]*v1[1] ] normal = [ v1[1]*v2[2]-v2[1]*v1[2], v1[2]*v2[0]-v2[2]*v1[0], v1[0]*v2[1]-v2[0]*v1[1] ]
axis = AxisStruct(vertex1[0], vertex1[1], vertex1[2], normal[0], normal[1], normal[2]) axis = AxisStruct(vertex1[0], vertex1[1], vertex1[2], normal[0], normal[1], normal[2])
axis._mirrorType = SMESH.SMESH_MeshEditor.PLANE axis._mirrorType = SMESH.SMESH_MeshEditor.PLANE
elif len(edges) == 1: elif len(edges) == 1:
vertex1, vertex2 = self.geompyD.SubShapeAll( edges[0], geomBuilder.geomBuilder.ShapeType["VERTEX"] ) vertex1, vertex2 = geompyD.SubShapeAll( edges[0], geomBuilder.geomBuilder.ShapeType["VERTEX"] )
p1 = self.geompyD.PointCoordinates( vertex1 ) p1 = geompyD.PointCoordinates( vertex1 )
p2 = self.geompyD.PointCoordinates( vertex2 ) p2 = geompyD.PointCoordinates( vertex2 )
axis = AxisStruct(p1[0], p1[1], p1[2], p2[0]-p1[0], p2[1]-p1[1], p2[2]-p1[2]) axis = AxisStruct(p1[0], p1[1], p1[2], p2[0]-p1[0], p2[1]-p1[1], p2[2]-p1[2])
axis._mirrorType = SMESH.SMESH_MeshEditor.AXIS axis._mirrorType = SMESH.SMESH_MeshEditor.AXIS
elif theObj.GetShapeType() == GEOM.VERTEX: elif theObj.GetShapeType() == GEOM.VERTEX:
x,y,z = self.geompyD.PointCoordinates( theObj ) x,y,z = geompyD.PointCoordinates( theObj )
axis = AxisStruct( x,y,z, 1,0,0,) axis = AxisStruct( x,y,z, 1,0,0,)
axis._mirrorType = SMESH.SMESH_MeshEditor.POINT axis._mirrorType = SMESH.SMESH_MeshEditor.POINT
return axis return axis
@ -972,7 +959,8 @@ class smeshBuilder( SMESH._objref_SMESH_Gen, object ):
name = aCriterion.ThresholdStr name = aCriterion.ThresholdStr
if not name: if not name:
name = "%s_%s"%(aThreshold.GetShapeType(), id(aThreshold)%10000) name = "%s_%s"%(aThreshold.GetShapeType(), id(aThreshold)%10000)
aCriterion.ThresholdID = self.geompyD.addToStudy( aThreshold, name ) geompyD = aThreshold.GetGen()
aCriterion.ThresholdID = geompyD.addToStudy( aThreshold, name )
# or a name of GEOM object # or a name of GEOM object
elif isinstance( aThreshold, str ): elif isinstance( aThreshold, str ):
aCriterion.ThresholdStr = aThreshold aCriterion.ThresholdStr = aThreshold
@ -1023,7 +1011,8 @@ class smeshBuilder( SMESH._objref_SMESH_Gen, object ):
name = aThreshold.GetName() name = aThreshold.GetName()
if not name: if not name:
name = "%s_%s"%(aThreshold.GetShapeType(), id(aThreshold)%10000) name = "%s_%s"%(aThreshold.GetShapeType(), id(aThreshold)%10000)
aCriterion.ThresholdID = self.geompyD.addToStudy( aThreshold, name ) geompyD = aThreshold.GetGen()
aCriterion.ThresholdID = geompyD.addToStudy( aThreshold, name )
elif isinstance(aThreshold, int): # node id elif isinstance(aThreshold, int): # node id
aCriterion.Threshold = aThreshold aCriterion.Threshold = aThreshold
elif isinstance(aThreshold, list): # 3 point coordinates elif isinstance(aThreshold, list): # 3 point coordinates
@ -1654,14 +1643,15 @@ class Mesh(metaclass = MeshMeta):
Parameters: Parameters:
theMesh: a :class:`SMESH.SMESH_Mesh` object theMesh: a :class:`SMESH.SMESH_Mesh` object
""" """
# do not call Register() as this prevents mesh servant deletion at closing study # do not call Register() as this prevents mesh servant deletion at closing study
#if self.mesh: self.mesh.UnRegister() #if self.mesh: self.mesh.UnRegister()
self.mesh = theMesh self.mesh = theMesh
if self.mesh: if self.mesh:
#self.mesh.Register() #self.mesh.Register()
self.geom = self.mesh.GetShapeToMesh() self.geom = self.mesh.GetShapeToMesh()
if self.geom:
self.geompyD = self.geom.GetGen()
pass
pass pass
def GetMesh(self): def GetMesh(self):
@ -2639,7 +2629,7 @@ class Mesh(metaclass = MeshMeta):
tgeo = str(shape.GetShapeType()) tgeo = str(shape.GetShapeType())
if tgeo == "VERTEX": if tgeo == "VERTEX":
typ = NODE typ = NODE
elif tgeo == "EDGE": elif tgeo == "EDGE" or tgeo == "WIRE":
typ = EDGE typ = EDGE
elif tgeo == "FACE" or tgeo == "SHELL": elif tgeo == "FACE" or tgeo == "SHELL":
typ = FACE typ = FACE

@ -290,7 +290,8 @@ class Mesh_Algorithm:
return shape.GetStudyEntry() return shape.GetStudyEntry()
def ViscousLayers(self, thickness, numberOfLayers, stretchFactor, def ViscousLayers(self, thickness, numberOfLayers, stretchFactor,
faces=[], isFacesToIgnore=True, extrMethod=StdMeshers.SURF_OFFSET_SMOOTH ): faces=[], isFacesToIgnore=True,
extrMethod=StdMeshers.SURF_OFFSET_SMOOTH, groupName=""):
""" """
Defines "ViscousLayers" hypothesis to give parameters of layers of prisms to build Defines "ViscousLayers" hypothesis to give parameters of layers of prisms to build
near mesh boundary. This hypothesis can be used by several 3D algorithms: near mesh boundary. This hypothesis can be used by several 3D algorithms:
@ -319,8 +320,17 @@ class Mesh_Algorithm:
- StdMeshers.NODE_OFFSET method extrudes nodes along average normal of - StdMeshers.NODE_OFFSET method extrudes nodes along average normal of
surrounding mesh faces by the layers thickness. Thickness of surrounding mesh faces by the layers thickness. Thickness of
layers can be limited to avoid creation of invalid prisms. layers can be limited to avoid creation of invalid prisms.
groupName: name of a group to contain elements of layers. If not provided,
no group is created. The group is created upon mesh generation.
It can be retrieved by calling
::
group = mesh.GetGroupByName( groupName, SMESH.VOLUME )[0]
Returns:
StdMeshers.StdMeshers_ViscousLayers hypothesis
""" """
if not isinstance(self.algo, SMESH._objref_SMESH_3D_Algo): if not isinstance(self.algo, SMESH._objref_SMESH_3D_Algo):
raise TypeError("ViscousLayers are supported by 3D algorithms only") raise TypeError("ViscousLayers are supported by 3D algorithms only")
if not "ViscousLayers" in self.GetCompatibleHypothesis(): if not "ViscousLayers" in self.GetCompatibleHypothesis():
@ -342,11 +352,12 @@ class Mesh_Algorithm:
hyp.SetStretchFactor( stretchFactor ) hyp.SetStretchFactor( stretchFactor )
hyp.SetFaces( faces, isFacesToIgnore ) hyp.SetFaces( faces, isFacesToIgnore )
hyp.SetMethod( extrMethod ) hyp.SetMethod( extrMethod )
hyp.SetGroupName( groupName )
self.mesh.AddHypothesis( hyp, self.geom ) self.mesh.AddHypothesis( hyp, self.geom )
return hyp return hyp
def ViscousLayers2D(self, thickness, numberOfLayers, stretchFactor, def ViscousLayers2D(self, thickness, numberOfLayers, stretchFactor,
edges=[], isEdgesToIgnore=True ): edges=[], isEdgesToIgnore=True, groupName="" ):
""" """
Defines "ViscousLayers2D" hypothesis to give parameters of layers of quadrilateral 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: elements to build near mesh boundary. This hypothesis can be used by several 2D algorithms:
@ -361,6 +372,15 @@ class Mesh_Algorithm:
the value of **isEdgesToIgnore** parameter. the value of **isEdgesToIgnore** parameter.
isEdgesToIgnore: if *True*, the Viscous layers are not generated on the isEdgesToIgnore: if *True*, the Viscous layers are not generated on the
edges specified by the previous parameter (**edges**). edges specified by the previous parameter (**edges**).
groupName: name of a group to contain elements of layers. If not provided,
no group is created. The group is created upon mesh generation.
It can be retrieved by calling
::
group = mesh.GetGroupByName( groupName, SMESH.FACE )[0]
Returns:
StdMeshers.StdMeshers_ViscousLayers2D hypothesis
""" """
if not isinstance(self.algo, SMESH._objref_SMESH_2D_Algo): if not isinstance(self.algo, SMESH._objref_SMESH_2D_Algo):
@ -383,6 +403,7 @@ class Mesh_Algorithm:
hyp.SetNumberLayers(numberOfLayers) hyp.SetNumberLayers(numberOfLayers)
hyp.SetStretchFactor(stretchFactor) hyp.SetStretchFactor(stretchFactor)
hyp.SetEdges(edges, isEdgesToIgnore) hyp.SetEdges(edges, isEdgesToIgnore)
hyp.SetGroupName( groupName )
self.mesh.AddHypothesis( hyp, self.geom ) self.mesh.AddHypothesis( hyp, self.geom )
return hyp return hyp
@ -392,12 +413,11 @@ class Mesh_Algorithm:
into a list acceptable to SetReversedEdges() of some 1D hypotheses into a list acceptable to SetReversedEdges() of some 1D hypotheses
""" """
from salome.smesh.smeshBuilder import FirstVertexOnCurve
resList = [] resList = []
geompy = self.mesh.geompyD geompy = self.mesh.geompyD
for i in reverseList: for i in reverseList:
if isinstance( i, int ): if isinstance( i, int ):
s = geompy.SubShapes(self.mesh.geom, [i])[0] s = geompy.GetSubShape(self.mesh.geom, [i])
if s.GetShapeType() != geomBuilder.GEOM.EDGE: if s.GetShapeType() != geomBuilder.GEOM.EDGE:
raise TypeError("Not EDGE index given") raise TypeError("Not EDGE index given")
resList.append( i ) resList.append( i )
@ -417,7 +437,7 @@ class Mesh_Algorithm:
if e.GetShapeType() != geomBuilder.GEOM.EDGE or \ if e.GetShapeType() != geomBuilder.GEOM.EDGE or \
v.GetShapeType() != geomBuilder.GEOM.VERTEX: v.GetShapeType() != geomBuilder.GEOM.VERTEX:
raise TypeError("A list item must be a tuple (edge, 1st_vertex_of_edge)") raise TypeError("A list item must be a tuple (edge, 1st_vertex_of_edge)")
vFirst = FirstVertexOnCurve( self.mesh, e ) vFirst = geompy.GetVertexByIndex( e, 0, False )
tol = geompy.Tolerance( vFirst )[-1] tol = geompy.Tolerance( vFirst )[-1]
if geompy.MinDistance( v, vFirst ) > 1.5*tol: if geompy.MinDistance( v, vFirst ) > 1.5*tol:
resList.append( geompy.GetSubShapeID(self.mesh.geom, e )) resList.append( geompy.GetSubShapeID(self.mesh.geom, e ))

@ -130,6 +130,7 @@ SET(StdMeshers_HEADERS
StdMeshers_Cartesian_3D.hxx StdMeshers_Cartesian_3D.hxx
StdMeshers_QuadFromMedialAxis_1D2D.hxx StdMeshers_QuadFromMedialAxis_1D2D.hxx
StdMeshers_PolygonPerFace_2D.hxx StdMeshers_PolygonPerFace_2D.hxx
StdMeshers_PolyhedronPerSolid_3D.hxx
) )
IF(SALOME_SMESH_ENABLE_MEFISTO) IF(SALOME_SMESH_ENABLE_MEFISTO)
@ -195,6 +196,7 @@ SET(StdMeshers_SOURCES
StdMeshers_Adaptive1D.cxx StdMeshers_Adaptive1D.cxx
StdMeshers_QuadFromMedialAxis_1D2D.cxx StdMeshers_QuadFromMedialAxis_1D2D.cxx
StdMeshers_PolygonPerFace_2D.cxx StdMeshers_PolygonPerFace_2D.cxx
StdMeshers_PolyhedronPerSolid_3D.cxx
) )
IF(SALOME_SMESH_ENABLE_MEFISTO) IF(SALOME_SMESH_ENABLE_MEFISTO)

@ -64,7 +64,10 @@ StdMeshers_CartesianParameters3D::StdMeshers_CartesianParameters3D(int h
SMESH_Gen * gen) SMESH_Gen * gen)
: SMESH_Hypothesis(hypId, gen), : SMESH_Hypothesis(hypId, gen),
_sizeThreshold( 4.0 ), // default according to the customer specification _sizeThreshold( 4.0 ), // default according to the customer specification
_toAddEdges( false ) _toAddEdges( false ),
_toConsiderInternalFaces( false ),
_toUseThresholdForInternalFaces( false ),
_toCreateFaces( false )
{ {
_name = "CartesianParameters3D"; // used by "Cartesian_3D" _name = "CartesianParameters3D"; // used by "Cartesian_3D"
_param_algo_dim = 3; // 3D _param_algo_dim = 3; // 3D
@ -739,6 +742,48 @@ bool StdMeshers_CartesianParameters3D::GetToAddEdges() const
return _toAddEdges; return _toAddEdges;
} }
//=======================================================================
//function : SetToConsiderInternalFaces
//purpose : Enables treatment of geom faces either shared by solids or internal
//=======================================================================
void StdMeshers_CartesianParameters3D::SetToConsiderInternalFaces(bool toTreat)
{
if ( _toConsiderInternalFaces != toTreat )
{
_toConsiderInternalFaces = toTreat;
NotifySubMeshesHypothesisModification();
}
}
//=======================================================================
//function : SetToUseThresholdForInternalFaces
//purpose : Enables applying size threshold to grid cells cut by internal geom faces.
//=======================================================================
void StdMeshers_CartesianParameters3D::SetToUseThresholdForInternalFaces(bool toUse)
{
if ( _toUseThresholdForInternalFaces != toUse )
{
_toUseThresholdForInternalFaces = toUse;
NotifySubMeshesHypothesisModification();
}
}
//=======================================================================
//function : SetToCreateFaces
//purpose : Enables creation of mesh faces.
//=======================================================================
void StdMeshers_CartesianParameters3D::SetToCreateFaces(bool toCreate)
{
if ( _toCreateFaces != toCreate )
{
_toCreateFaces = toCreate;
NotifySubMeshesHypothesisModification();
}
}
//======================================================================= //=======================================================================
//function : IsDefined //function : IsDefined
//purpose : Return true if parameters are well defined //purpose : Return true if parameters are well defined
@ -786,6 +831,10 @@ std::ostream & StdMeshers_CartesianParameters3D::SaveTo(std::ostream & save)
for ( int i = 0; i < 3; ++i ) for ( int i = 0; i < 3; ++i )
save << _fixedPoint[i] << " "; save << _fixedPoint[i] << " ";
save << " " << _toConsiderInternalFaces
<< " " << _toUseThresholdForInternalFaces
<< " " << _toCreateFaces;
return save; return save;
} }
@ -844,6 +893,12 @@ std::istream & StdMeshers_CartesianParameters3D::LoadFrom(std::istream & load)
for ( int i = 0; i < 3 && ok ; ++i ) for ( int i = 0; i < 3 && ok ; ++i )
ok = static_cast<bool>( load >> _fixedPoint[i]); ok = static_cast<bool>( load >> _fixedPoint[i]);
if ( load >> _toConsiderInternalFaces )
{
load >> _toUseThresholdForInternalFaces;
load >> _toCreateFaces;
}
return load; return load;
} }

@ -139,6 +139,25 @@ public:
void SetToAddEdges(bool toAdd); void SetToAddEdges(bool toAdd);
bool GetToAddEdges() const; bool GetToAddEdges() const;
/*!
* \brief Enables treatment of geom faces either shared by solids or internal.
*/
void SetToConsiderInternalFaces(bool toTreat);
bool GetToConsiderInternalFaces() const { return _toConsiderInternalFaces; }
/*!
* \brief Enables applying size threshold to grid cells cut by internal geom faces.
*/
void SetToUseThresholdForInternalFaces(bool toUse);
bool GetToUseThresholdForInternalFaces() const { return _toUseThresholdForInternalFaces; }
/*!
* \brief Enables creation of mesh faces.
*/
void SetToCreateFaces(bool toCreate);
bool GetToCreateFaces() const { return _toCreateFaces; }
/*! /*!
* \brief Return true if parameters are well defined * \brief Return true if parameters are well defined
*/ */
@ -171,6 +190,9 @@ public:
double _sizeThreshold; double _sizeThreshold;
bool _toAddEdges; bool _toAddEdges;
bool _toConsiderInternalFaces;
bool _toUseThresholdForInternalFaces;
bool _toCreateFaces;
}; };
#endif #endif

File diff suppressed because it is too large Load Diff

@ -420,9 +420,9 @@ namespace
const TopTools_MapOfShape& cornerVV, const TopTools_MapOfShape& cornerVV,
TopTools_MapOfShape& internEE) TopTools_MapOfShape& internEE)
{ {
TopTools_IndexedMapOfShape subEE; TopTools_IndexedMapOfShape subEE, subFF;
TopExp::MapShapes( shape, TopAbs_EDGE, subEE ); TopExp::MapShapes( shape, TopAbs_EDGE, subEE );
//TopExp::MapShapes( shape, TopAbs_FACE, subFF ); TopExp::MapShapes( shape, TopAbs_FACE, subFF );
TopoDS_Vertex VV[2]; TopoDS_Vertex VV[2];
TopTools_MapOfShape subChecked, ridgeEE; TopTools_MapOfShape subChecked, ridgeEE;
@ -460,6 +460,8 @@ namespace
{ {
if ( !SMESH_MesherHelper::IsSubShape( ridgeE, *F )) if ( !SMESH_MesherHelper::IsSubShape( ridgeE, *F ))
continue; continue;
if ( !subFF.Contains( *F ))
continue;
if ( isContinuousMesh( ridgeE, TopoDS::Edge( *E ), TopoDS::Face( *F ), mesh )) if ( isContinuousMesh( ridgeE, TopoDS::Edge( *E ), TopoDS::Face( *F ), mesh ))
{ {
nextRidgeE = *E; nextRidgeE = *E;

@ -665,7 +665,7 @@ std::vector<const SMDS_MeshNode*> StdMeshers_FaceSide::GetOrderedNodes(int theEd
iE = theEdgeInd % NbEdges(); iE = theEdgeInd % NbEdges();
iEnd = iE + 1; iEnd = iE + 1;
} }
for ( iE = 0; iE < iEnd; ++iE ) for ( ; iE < iEnd; ++iE )
{ {
double prevNormPar = ( iE == 0 ? 0 : myNormPar[ iE-1 ]); // normalized param double prevNormPar = ( iE == 0 ? 0 : myNormPar[ iE-1 ]); // normalized param

@ -37,15 +37,15 @@
#include <TopExp_Explorer.hxx> #include <TopExp_Explorer.hxx>
#include <TopoDS_Face.hxx> #include <TopoDS_Face.hxx>
#include <TopoDS.hxx>
#include <vector> #include <vector>
#include <TopoDS.hxx>
using namespace std; using namespace std;
//======================================================================= //=======================================================================
//function : StdMeshers_PolygonPerFace_2D //function : StdMeshers_PolygonPerFace_2D
//purpose : //purpose :
//======================================================================= //=======================================================================
StdMeshers_PolygonPerFace_2D::StdMeshers_PolygonPerFace_2D(int hypId, StdMeshers_PolygonPerFace_2D::StdMeshers_PolygonPerFace_2D(int hypId,

@ -0,0 +1,618 @@
// Copyright (C) 2007-2019 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, 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 : StdMeshers_PolyhedronPerSolid_3D.cxx
// Module : SMESH
// Created : Fri Oct 20 11:37:07 2006
// Author : Edward AGAPOV (eap)
//
#include "StdMeshers_PolyhedronPerSolid_3D.hxx"
#include "SMESHDS_Mesh.hxx"
#include "SMESH_ControlsDef.hxx"
#include "SMESH_Gen.hxx"
#include "SMESH_Mesh.hxx"
#include "SMESH_MeshAlgos.hxx"
#include "SMESH_MeshEditor.hxx"
#include "SMESH_MesherHelper.hxx"
#include "SMESH_ProxyMesh.hxx"
#include "SMESH_subMesh.hxx"
#include "StdMeshers_PolygonPerFace_2D.hxx"
#include "StdMeshers_Regular_1D.hxx"
#include "StdMeshers_ViscousLayers.hxx"
#include <TopExp_Explorer.hxx>
#include <vector>
#include <set>
namespace
{
struct _EdgeMesher : public StdMeshers_Regular_1D
{
_EdgeMesher( int hypId, SMESH_Gen* gen )
: StdMeshers_Regular_1D( hypId, gen )
{
_hypType = NB_SEGMENTS;
_ivalue[ NB_SEGMENTS_IND ] = 1;
}
};
//=======================================================================
//function : addHexa
//purpose :
//=======================================================================
const SMDS_MeshElement* addHexa( std::vector< const SMDS_MeshElement* >& faces,
const std::vector< int > & quantities,
SMESH_MesherHelper & helper )
{
const SMDS_MeshElement* newHexa = 0;
// check nb of nodes in faces
for ( size_t i = 0; i < quantities.size(); ++i )
if ( quantities[ i ] != 4 )
return newHexa;
// look for a top face
const SMDS_MeshElement* topFace = 0;
const SMDS_MeshElement* botFace = faces[0];
std::vector< const SMDS_MeshNode* > nodes( 16 ); // last 8 is a working buffer
nodes.assign( botFace->begin_nodes(), botFace->end_nodes() );
for ( size_t iF = 1; iF < faces.size() && !topFace; ++iF )
{
bool hasCommonNode = false;
for ( int iN = 0; iN < quantities[ 0 ] && !hasCommonNode; ++iN )
hasCommonNode = ( faces[ iF ]->GetNodeIndex( nodes[ iN ]) >= 0 );
if ( !hasCommonNode )
topFace = faces[ iF ];
}
nodes.resize( 8 ); // set top nodes after hexa nodes - [8-11]
nodes.insert( nodes.end(), topFace->begin_nodes(), topFace->end_nodes() );
nodes.resize( 12 );
nodes.insert( nodes.end(), nodes.begin() + 8, nodes.begin() + 12 );
// find corresponding nodes of top and bottom by finding a side face including 2 node of each
SMESHDS_Mesh* mesh = helper.GetMeshDS();
const SMDS_MeshElement* sideFace = 0;
size_t i;
for ( i = 8; i < nodes.size()-1 && !sideFace; ++i )
{
sideFace = mesh->FindFace( nodes[0], nodes[1], nodes[ i ], nodes[ i + 1 ]);
}
if ( !sideFace )
return newHexa;
--i; // restore after ++i in the loop
bool botOriRight = SMESH_MeshAlgos::IsRightOrder( sideFace, nodes[ 0 ], nodes[ 1 ] );
bool topOriRight = SMESH_MeshAlgos::IsRightOrder( sideFace, nodes[ i ], nodes[ i + 1 ] );
if ( botOriRight == topOriRight )
{
nodes[ 4 ] = nodes[ i + 1 ];
nodes[ 5 ] = nodes[ i + 0 ];
nodes[ 6 ] = nodes[ i + 3 ];
nodes[ 7 ] = nodes[ i + 2 ];
}
else
{
nodes[ 4 ] = nodes[ i + 0 ];
nodes[ 5 ] = nodes[ i + 1 ];
nodes[ 6 ] = nodes[ i + 2 ];
nodes[ 7 ] = nodes[ i + 3 ];
}
newHexa = helper.AddVolume( nodes[ 0 ], nodes[ 1 ], nodes[ 2 ], nodes[ 3 ],
nodes[ 4 ], nodes[ 5 ], nodes[ 6 ], nodes[ 7 ]);
return newHexa;
}
//=======================================================================
//function : addTetra
//purpose :
//=======================================================================
const SMDS_MeshElement* addTetra( std::vector< const SMDS_MeshElement* >& faces,
const std::vector< int > & quantities,
SMESH_MesherHelper & helper )
{
const SMDS_MeshElement* newTetra = 0;
// check nb of nodes in faces
for ( size_t i = 0; i < quantities.size(); ++i )
if ( quantities[ i ] != 3 )
return newTetra;
const SMDS_MeshElement* botFace = faces[0];
std::vector< const SMDS_MeshNode* > nodes( 6 );
nodes.assign( botFace->begin_nodes(), botFace->end_nodes() );
nodes.resize( 3 );
const SMDS_MeshNode* topNode = 0;
for ( size_t i = 0; i < 3 && !topNode; ++i )
{
topNode = faces[ 1 ]->GetNode( i );
if ( botFace->GetNodeIndex( topNode ) >= 0 )
topNode = 0;
}
if ( !topNode )
return newTetra;
nodes.push_back( topNode );
newTetra = helper.AddVolume( nodes[ 0 ], nodes[ 1 ], nodes[ 2 ], nodes[ 3 ]);
return newTetra;
}
//=======================================================================
//function : addPenta
//purpose :
//=======================================================================
const SMDS_MeshElement* addPenta( std::vector< const SMDS_MeshElement* >& faces,
const std::vector< int > & quantities,
SMESH_MesherHelper & helper )
{
const SMDS_MeshElement* newPenta = 0;
// check nb of nodes in faces and find triangle faces
int trias[2] = { -1, -1 };
for ( size_t i = 0; i < quantities.size(); ++i )
if ( quantities[ i ] != 4 )
{
if ( quantities[ i ] != 3 )
return newPenta;
int iTria = ( trias[0] != -1 );
if ( trias[ iTria ] != -1 )
return newPenta;
trias[ iTria ] = i;
}
if ( trias[1] == -1 )
return newPenta;
int iSide = trias[0] + 1;
if ( iSide == trias[1] )
++iSide;
const SMDS_MeshElement* botFace = faces[ trias[0]];
const SMDS_MeshElement* topFace = faces[ trias[1]];
const SMDS_MeshElement* sideFace = faces[ iSide ];
const SMDS_MeshNode* nodes[ 6 ] = { 0,0,0,0,0,0 };
for ( int i = 0 ; i < 3; ++i )
{
const SMDS_MeshNode* botNode = botFace->GetNode( i );
if ( sideFace->GetNodeIndex( botNode ) < 0 )
nodes[2] = botNode;
else
nodes[ bool( nodes[0] )] = botNode;
const SMDS_MeshNode* topNode = topFace->GetNode( i );
if ( sideFace->GetNodeIndex( topNode ) < 0 )
nodes[5] = topNode;
else
nodes[ 3 + bool( nodes[3]) ] = topNode;
}
bool botOriRight = SMESH_MeshAlgos::IsRightOrder( sideFace, nodes[ 0 ], nodes[ 1 ]);
bool topOriRight = SMESH_MeshAlgos::IsRightOrder( sideFace, nodes[ 3 ], nodes[ 4 ]);
if ( botOriRight == topOriRight )
std::swap( nodes[ 3 ], nodes[ 4 ]);
newPenta = helper.AddVolume( nodes[ 0 ], nodes[ 1 ], nodes[ 2 ],
nodes[ 3 ], nodes[ 4 ], nodes[ 5 ]);
return newPenta;
}
//=======================================================================
//function : addPyra
//purpose :
//=======================================================================
const SMDS_MeshElement* addPyra( std::vector< const SMDS_MeshElement* >& faces,
const std::vector< int > & quantities,
SMESH_MesherHelper & helper )
{
const SMDS_MeshElement* newPyra = 0;
// check nb of nodes in faces
int iBot = -1;
for ( size_t i = 0; i < quantities.size(); ++i )
if ( quantities[ i ] != 3 )
{
if ( quantities[ i ] != 4 || iBot != -1 )
return newPyra;
iBot = i;
}
const SMDS_MeshElement* botFace = faces[ iBot ];
std::vector< const SMDS_MeshNode* > nodes( 8 );
nodes.assign( botFace->begin_nodes(), botFace->end_nodes() );
nodes.resize( 4 );
const SMDS_MeshNode* topNode = 0;
for ( size_t i = 0; i < 4 && !topNode; ++i )
{
topNode = faces[ 1 ]->GetNode( i );
if ( botFace->GetNodeIndex( topNode ) >= 0 )
topNode = 0;
}
if ( !topNode )
return newPyra;
nodes.push_back( topNode );
newPyra = helper.AddVolume( nodes[ 0 ], nodes[ 1 ], nodes[ 2 ], nodes[ 3 ], nodes[4] );
return newPyra;
}
//=======================================================================
//function : addHPrism
//purpose : add hexagonal prism
//=======================================================================
const SMDS_MeshElement* addHPrism( std::vector< const SMDS_MeshElement* >& faces,
const std::vector< int > & quantities,
SMESH_MesherHelper & helper )
{
const SMDS_MeshElement* newHexPrism = 0;
// check nb of nodes in faces and find hexagons
int hexa[2] = { -1, -1 };
for ( size_t i = 0; i < quantities.size(); ++i )
if ( quantities[ i ] != 4 )
{
if ( quantities[ i ] != 6 )
return newHexPrism;
int iHex = ( hexa[0] != -1 );
if ( hexa[ iHex ] != -1 )
return newHexPrism;
hexa[ iHex ] = i;
}
if ( hexa[1] == -1 )
return newHexPrism;
int iSide = hexa[0] + 1;
if ( iSide == hexa[1] )
++iSide;
const SMDS_MeshElement* botFace = faces[ hexa[ 0 ]];
const SMDS_MeshElement* topFace = faces[ hexa[ 1 ]];
std::vector< const SMDS_MeshNode* > nodes( 24 ); // last 12 is a working buffer
nodes.assign( botFace->begin_nodes(), botFace->end_nodes() );
nodes.resize( 12 ); // set top nodes after hexa nodes - [12-17]
nodes.insert( nodes.end(), topFace->begin_nodes(), topFace->end_nodes() );
nodes.resize( 18 );
nodes.insert( nodes.end(), nodes.begin() + 12, nodes.begin() + 18 );
// find corresponding nodes of top and bottom by finding a side face including 2 node of each
SMESHDS_Mesh* mesh = helper.GetMeshDS();
const SMDS_MeshElement* sideFace = 0;
size_t i;
for ( i = 12; i < nodes.size()-1 && !sideFace; ++i )
{
sideFace = mesh->FindFace( nodes[0], nodes[1], nodes[ i ], nodes[ i + 1 ]);
}
if ( !sideFace )
return newHexPrism;
--i; // restore after ++i in the loop
bool botOriRight = SMESH_MeshAlgos::IsRightOrder( sideFace, nodes[ 0 ], nodes[ 1 ] );
bool topOriRight = SMESH_MeshAlgos::IsRightOrder( sideFace, nodes[ i ], nodes[ i + 1 ] );
if ( botOriRight == topOriRight )
{
nodes[ 6 ] = nodes[ i + 1 ];
nodes[ 7 ] = nodes[ i + 0 ];
nodes[ 8 ] = nodes[ i + 5 ];
nodes[ 9 ] = nodes[ i + 4 ];
nodes[ 10 ] = nodes[ i + 3 ];
nodes[ 11 ] = nodes[ i + 2 ];
}
else
{
nodes[ 6 ] = nodes[ i + 0 ];
nodes[ 7 ] = nodes[ i + 1 ];
nodes[ 8 ] = nodes[ i + 2 ];
nodes[ 9 ] = nodes[ i + 3 ];
nodes[ 10 ] = nodes[ i + 4 ];
nodes[ 11 ] = nodes[ i + 5 ];
}
newHexPrism = helper.AddVolume( nodes[ 0 ], nodes[ 1 ], nodes[ 2 ],
nodes[ 3 ], nodes[ 4 ], nodes[ 5 ],
nodes[ 6 ], nodes[ 7 ], nodes[ 8 ],
nodes[ 9 ], nodes[10 ], nodes[11 ]);
return newHexPrism;
}
//=======================================================================
//function : addPoly
//purpose :
//=======================================================================
const SMDS_MeshElement* addPoly( std::vector< const SMDS_MeshElement* >& faces,
const std::vector< int > & quantities,
SMESH_MesherHelper & helper )
{
const SMDS_MeshElement* newPoly = 0;
std::vector< const SMDS_MeshNode* > nodes;
for ( size_t iF = 0; iF < faces.size(); ++iF )
nodes.insert( nodes.end(), faces[iF]->begin_nodes(), faces[iF]->end_nodes() );
newPoly = helper.AddPolyhedralVolume( nodes, quantities );
return newPoly;
}
} // namespace
//=======================================================================
//function : StdMeshers_PolyhedronPerSolid_3D
//purpose :
//=======================================================================
StdMeshers_PolyhedronPerSolid_3D::StdMeshers_PolyhedronPerSolid_3D(int hypId,
SMESH_Gen* gen)
:SMESH_3D_Algo(hypId, gen),
myEdgeMesher( new _EdgeMesher( gen->GetANewId(), gen )),
myFaceMesher( new StdMeshers_PolygonPerFace_2D( gen->GetANewId(), gen ))
{
_name = "PolyhedronPerSolid_3D";
_requireDiscreteBoundary = false;
_supportSubmeshes = true;
_compatibleHypothesis.push_back("ViscousLayers");
_neededLowerHyps[0] = _neededLowerHyps[1] = _neededLowerHyps[2] = true;
}
//=======================================================================
//function : ~StdMeshers_PolyhedronPerSolid_3D
//purpose :
//=======================================================================
StdMeshers_PolyhedronPerSolid_3D::~StdMeshers_PolyhedronPerSolid_3D()
{
delete myEdgeMesher;
delete myFaceMesher;
}
//=======================================================================
//function : CheckHypothesis
//purpose :
//=======================================================================
bool StdMeshers_PolyhedronPerSolid_3D::CheckHypothesis(SMESH_Mesh& theMesh,
const TopoDS_Shape& theShape,
Hypothesis_Status& theStatus)
{
myViscousLayersHyp = NULL;
const std::list<const SMESHDS_Hypothesis*>& hyps =
GetUsedHypothesis( theMesh, theShape, /*ignoreAuxiliary=*/false);
std::list <const SMESHDS_Hypothesis* >::const_iterator h = hyps.begin();
if ( h == hyps.end())
{
theStatus = SMESH_Hypothesis::HYP_OK;
return true;
}
// only StdMeshers_ViscousLayers can be used
theStatus = HYP_OK;
for ( ; h != hyps.end(); ++h )
{
if ( !(myViscousLayersHyp = dynamic_cast< const StdMeshers_ViscousLayers*> ( *h )))
break;
}
if ( !myViscousLayersHyp )
theStatus = HYP_INCOMPATIBLE;
else
error( myViscousLayersHyp->CheckHypothesis( theMesh, theShape, theStatus ));
return theStatus == HYP_OK;
}
//=======================================================================
//function : Compute
//purpose :
//=======================================================================
bool StdMeshers_PolyhedronPerSolid_3D::Compute(SMESH_Mesh& theMesh,
const TopoDS_Shape& theShape)
{
const SMDS_MeshElement* newVolume = 0;
SMESH_subMesh* sm = theMesh.GetSubMesh( theShape );
SMESH_subMeshIteratorPtr smIt = sm->getDependsOnIterator( /*includeSelf=*/true,
/*complexFirst=*/false);
while ( smIt->more() )
{
sm = smIt->next();
if ( !sm->IsEmpty() )
continue;
const TopoDS_Shape & shape = sm->GetSubShape();
switch ( shape.ShapeType() )
{
case TopAbs_VERTEX:
sm->ComputeStateEngine( SMESH_subMesh::COMPUTE );
break;
case TopAbs_EDGE:
sm->ComputeStateEngine( SMESH_subMesh::COMPUTE );
if ( sm->IsEmpty() )
myEdgeMesher->Compute( theMesh, shape );
break;
case TopAbs_FACE:
sm->ComputeStateEngine( SMESH_subMesh::COMPUTE );
if ( sm->IsEmpty() && !myFaceMesher->Compute( theMesh, shape ))
{
sm->GetComputeError() = myFaceMesher->GetComputeError();
sm->GetComputeError()->myAlgo = myFaceMesher;
return false;
}
break;
case TopAbs_SOLID:
{
SMESH_MesherHelper helper( theMesh );
helper.SetElementsOnShape( true );
_quadraticMesh = helper.IsQuadraticSubMesh( shape );
SMESH_ProxyMesh::Ptr proxymesh( new SMESH_ProxyMesh( theMesh ));
if ( myViscousLayersHyp )
{
proxymesh = myViscousLayersHyp->Compute( theMesh, theShape );
if ( !proxymesh )
return false;
}
std::vector< const SMDS_MeshElement* > faces;
faces.reserve( 20 );
for ( TopExp_Explorer faceEx( shape, TopAbs_FACE ); faceEx.More(); faceEx.Next() )
{
const SMESHDS_SubMesh* smDS = proxymesh->GetSubMesh( faceEx.Current() );
for ( SMDS_ElemIteratorPtr faceIt = smDS->GetElements(); faceIt->more(); )
faces.push_back( faceIt->next() );
}
bool useMediumNodes = false;
if ( !_quadraticMesh && theMesh.GetMeshDS()->GetMeshInfo().NbFaces( ORDER_QUADRATIC ))
for ( size_t i = 0; i < faces.size() && !useMediumNodes ; ++i )
useMediumNodes = faces[ i ]->IsQuadratic();
std::vector< int > quantities( faces.size() );
std::set< const SMDS_MeshNode* > nodes;
for ( size_t i = 0; i < faces.size(); ++i )
{
quantities[ i ] = useMediumNodes ? faces[ i ]->NbNodes() : faces[ i ]->NbCornerNodes();
for ( int iN = 0; iN < quantities[ i ]; ++iN )
nodes.insert( faces[ i ]->GetNode( iN ));
}
const size_t nbNodes = nodes.size(), nbFaces = faces.size();
if ( nbNodes == 8 && nbFaces == 6 ) newVolume = addHexa ( faces, quantities, helper );
else if ( nbNodes == 4 && nbFaces == 4 ) newVolume = addTetra ( faces, quantities, helper );
else if ( nbNodes == 6 && nbFaces == 5 ) newVolume = addPenta ( faces, quantities, helper );
else if ( nbNodes == 5 && nbFaces == 5 ) newVolume = addPyra ( faces, quantities, helper );
else if ( nbNodes == 12 && nbFaces == 8 ) newVolume = addHPrism( faces, quantities, helper );
if ( !newVolume )
newVolume = addPoly ( faces, quantities, helper );
if ( newVolume )
{
SMESH::Controls::BadOrientedVolume checker;
checker.SetMesh( theMesh.GetMeshDS() );
if ( checker.IsSatisfy( newVolume->GetID() ))
{
SMESH_MeshEditor editor( &theMesh );
editor.Reorient( newVolume );
}
}
}
default:;
} // switch ( shape.ShapeType() )
} // loop on sub-meshes
return newVolume;
}
//=======================================================================
//function : Evaluate
//purpose :
//=======================================================================
bool StdMeshers_PolyhedronPerSolid_3D::Evaluate(SMESH_Mesh& theMesh,
const TopoDS_Shape& theShape,
MapShapeNbElems& theResMap)
{
_quadraticMesh = false;
SMESH_subMesh* sm = theMesh.GetSubMesh( theShape );
SMESH_subMeshIteratorPtr smIt = sm->getDependsOnIterator( /*includeSelf=*/true,
/*complexFirst=*/false);
while ( smIt->more() )
{
sm = smIt->next();
MapShapeNbElems::iterator sm2vec = theResMap.find( sm );
if ( sm2vec != theResMap.end() && !sm2vec->second.empty() )
continue;
const TopoDS_Shape & shape = sm->GetSubShape();
switch ( shape.ShapeType() )
{
case TopAbs_EDGE:
myEdgeMesher->Evaluate( theMesh, shape, theResMap );
break;
case TopAbs_FACE:
{
myFaceMesher->Evaluate( theMesh, shape, theResMap );
std::vector<int> & quantities = theResMap[ sm ];
_quadraticMesh = ( !quantities.empty() &&
( quantities[ SMDSEntity_Quad_Triangle ] +
quantities[ SMDSEntity_Quad_Quadrangle ] +
quantities[ SMDSEntity_Quad_Polygon ]));
break;
}
case TopAbs_SOLID:
{
std::vector<int> & quantities = theResMap[ sm ];
quantities.resize( SMDSEntity_Last, 0 );
SMESH_MesherHelper helper( theMesh );
const int nbNodes = helper.Count( shape, TopAbs_VERTEX, /*ignoreSame=*/true );
const int nbFaces = helper.Count( shape, TopAbs_FACE, /*ignoreSame=*/false );
if ( nbNodes == 8 && nbFaces == 6 )
quantities[ _quadraticMesh ? SMDSEntity_Quad_Hexa : SMDSEntity_Hexa ] = 1;
else if ( nbNodes == 4 && nbFaces == 4 )
quantities[ _quadraticMesh ? SMDSEntity_Quad_Tetra : SMDSEntity_Tetra ] = 1;
else if ( nbNodes == 6 && nbFaces == 5 )
quantities[ _quadraticMesh ? SMDSEntity_Quad_Penta : SMDSEntity_Penta ] = 1;
else if ( nbNodes == 5 && nbFaces == 5 )
quantities[ _quadraticMesh ? SMDSEntity_Quad_Pyramid : SMDSEntity_Pyramid ] = 1;
else if ( nbNodes == 12 && nbFaces == 8 )
quantities[ /*_quadraticMesh ? SMDSEntity_Quad_Pyramid :*/ SMDSEntity_Hexagonal_Prism ] = 1;
else
quantities[ /*_quadraticMesh ? SMDSEntity_Quad_Polyhedra : */SMDSEntity_Polyhedra ] = 1;
return true;
}
default:;
} // switch ( shape.ShapeType() )
} // loop on sub-meshes
return false;
}

@ -0,0 +1,58 @@
// Copyright (C) 2007-2019 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, 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 : StdMeshers_PolyhedronPerSolid_3D.hxx
// Module : SMESH
//
#ifndef _SMESH_PolyhedronPerSolid_3D_HXX_
#define _SMESH_PolyhedronPerSolid_3D_HXX_
#include "SMESH_StdMeshers.hxx"
#include "SMESH_Algo.hxx"
class StdMeshers_Regular_1D;
class StdMeshers_PolygonPerFace_2D;
class StdMeshers_ViscousLayers;
class STDMESHERS_EXPORT StdMeshers_PolyhedronPerSolid_3D: public SMESH_3D_Algo
{
public:
StdMeshers_PolyhedronPerSolid_3D(int hypId, SMESH_Gen* gen);
~StdMeshers_PolyhedronPerSolid_3D();
virtual bool CheckHypothesis(SMESH_Mesh& aMesh,
const TopoDS_Shape& aShape,
SMESH_Hypothesis::Hypothesis_Status& aStatus);
virtual bool Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape);
virtual bool Evaluate(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape,
MapShapeNbElems& aResMap);
private:
StdMeshers_Regular_1D* myEdgeMesher;
StdMeshers_PolygonPerFace_2D* myFaceMesher;
const StdMeshers_ViscousLayers* myViscousLayersHyp;
};
#endif

@ -5222,10 +5222,10 @@ bool StdMeshers_Sweeper::ComputeNodesByTrsf( const double tol,
for ( ++zS, --zT; zS < zTgt; ++zS, --zT ) // vertical loop on layers for ( ++zS, --zT; zS < zTgt; ++zS, --zT ) // vertical loop on layers
{ {
// invert transformation // invert transformation
if ( !trsfOfLayer[ zS+1 ].Invert() ) //if ( !trsfOfLayer[ zS+1 ].Invert() )
trsfOfLayer[ zS+1 ] = NSProjUtils::TrsfFinder3D(); // to recompute trsfOfLayer[ zS+1 ] = NSProjUtils::TrsfFinder3D(); // to recompute
if ( !trsfOfLayer[ zT-1 ].Invert() ) //if ( !trsfOfLayer[ zT-1 ].Invert() )
trsfOfLayer[ zT-1 ] = NSProjUtils::TrsfFinder3D(); trsfOfLayer[ zT-1 ] = NSProjUtils::TrsfFinder3D();
// project internal nodes and compute bnd error // project internal nodes and compute bnd error
for ( size_t iP = 0; iP < myBndColumns.size(); ++iP ) for ( size_t iP = 0; iP < myBndColumns.size(); ++iP )

@ -974,6 +974,8 @@ bool StdMeshers_Regular_1D::computeInternalParameters(SMESH_Mesh & theMesh,
an = eltSize; an = eltSize;
eltSize *= q; eltSize *= q;
++nbParams; ++nbParams;
if ( q < 1. && eltSize < 1e-100 )
return error("Too small common ratio causes too many segments");
} }
if ( nbParams > 1 ) if ( nbParams > 1 )
{ {

File diff suppressed because it is too large Load Diff

@ -32,6 +32,8 @@
#include <vector> #include <vector>
class SMDS_MeshGroup;
/*! /*!
* \brief Hypothesis defining parameters of viscous layers * \brief Hypothesis defining parameters of viscous layers
*/ */
@ -73,6 +75,13 @@ public:
void SetMethod( ExtrusionMethod how ); void SetMethod( ExtrusionMethod how );
ExtrusionMethod GetMethod() const { return _method; } ExtrusionMethod GetMethod() const { return _method; }
// name of a group to create
void SetGroupName(const std::string& name);
const std::string& GetGroupName() const { return _groupName; }
static SMDS_MeshGroup* CreateGroup( const std::string& theName,
SMESH_Mesh& theMesh,
SMDSAbs_ElementType theType);
// Computes temporary 2D mesh to be used by 3D algorithm. // Computes temporary 2D mesh to be used by 3D algorithm.
// Return SMESH_ProxyMesh for each SOLID in theShape // Return SMESH_ProxyMesh for each SOLID in theShape
SMESH_ProxyMesh::Ptr Compute(SMESH_Mesh& theMesh, SMESH_ProxyMesh::Ptr Compute(SMESH_Mesh& theMesh,
@ -116,6 +125,7 @@ public:
double _thickness; double _thickness;
double _stretchFactor; double _stretchFactor;
ExtrusionMethod _method; ExtrusionMethod _method;
std::string _groupName;
}; };
class SMESH_subMesh; class SMESH_subMesh;

@ -2402,6 +2402,17 @@ bool _ViscousBuilder2D::refine()
outerNodes.swap( innerNodes ); outerNodes.swap( innerNodes );
} }
// Add faces to a group
SMDS_MeshGroup* group = StdMeshers_ViscousLayers::CreateGroup( hyp->GetGroupName(),
*_helper.GetMesh(),
SMDSAbs_Face );
if ( group )
{
TIDSortedElemSet::iterator fIt = L._newFaces.begin();
for ( ; fIt != L._newFaces.end(); ++fIt )
group->Add( *fIt );
}
// faces between not shared _LayerEdge's (at concave VERTEX) // faces between not shared _LayerEdge's (at concave VERTEX)
for ( int isR = 0; isR < 2; ++isR ) for ( int isR = 0; isR < 2; ++isR )
{ {
@ -2413,15 +2424,22 @@ bool _ViscousBuilder2D::refine()
if ( lNodes.empty() || rNodes.empty() || lNodes.size() != rNodes.size() ) if ( lNodes.empty() || rNodes.empty() || lNodes.size() != rNodes.size() )
continue; continue;
const SMDS_MeshElement* face = 0;
for ( size_t i = 1; i < lNodes.size(); ++i ) for ( size_t i = 1; i < lNodes.size(); ++i )
_helper.AddFace( lNodes[ i+prev ], rNodes[ i+prev ], {
rNodes[ i+cur ], lNodes[ i+cur ]); face = _helper.AddFace( lNodes[ i+prev ], rNodes[ i+prev ],
rNodes[ i+cur ], lNodes[ i+cur ]);
if ( group )
group->Add( face );
}
const UVPtStruct& ptOnVertex = points[ isR ? L._lastPntInd : L._firstPntInd ]; const UVPtStruct& ptOnVertex = points[ isR ? L._lastPntInd : L._firstPntInd ];
if ( isReverse ) if ( isReverse )
_helper.AddFace( ptOnVertex.node, lNodes[ 0 ], rNodes[ 0 ]); face = _helper.AddFace( ptOnVertex.node, lNodes[ 0 ], rNodes[ 0 ]);
else else
_helper.AddFace( ptOnVertex.node, rNodes[ 0 ], lNodes[ 0 ]); face = _helper.AddFace( ptOnVertex.node, rNodes[ 0 ], lNodes[ 0 ]);
if ( group )
group->Add( face );
} }
// Fill the _ProxyMeshOfFace // Fill the _ProxyMeshOfFace

@ -82,6 +82,7 @@ SET(_moc_HEADERS
StdMeshersGUI_CartesianParamCreator.h StdMeshersGUI_CartesianParamCreator.h
StdMeshersGUI_RadioButtonsGrpWdg.h StdMeshersGUI_RadioButtonsGrpWdg.h
StdMeshersGUI_PropagationHelperWdg.h StdMeshersGUI_PropagationHelperWdg.h
StdMeshersGUI_NameCheckableGrpWdg.h
) )
IF(SALOME_USE_PLOT2DVIEWER) IF(SALOME_USE_PLOT2DVIEWER)
@ -117,6 +118,7 @@ SET(_other_SOURCES
StdMeshersGUI_CartesianParamCreator.cxx StdMeshersGUI_CartesianParamCreator.cxx
StdMeshersGUI_RadioButtonsGrpWdg.cxx StdMeshersGUI_RadioButtonsGrpWdg.cxx
StdMeshersGUI_PropagationHelperWdg.cxx StdMeshersGUI_PropagationHelperWdg.cxx
StdMeshersGUI_NameCheckableGrpWdg.cxx
) )
IF(SALOME_USE_PLOT2DVIEWER) IF(SALOME_USE_PLOT2DVIEWER)

@ -204,8 +204,8 @@ namespace StdMeshersGUI
axisTabLayout->setSpacing( SPACING ); axisTabLayout->setSpacing( SPACING );
axisTabLayout->addWidget( modeBox , 0, 0, 1, 3 ); axisTabLayout->addWidget( modeBox , 0, 0, 1, 3 );
axisTabLayout->addWidget( myInsertBtn , 1, 0, 1, 2 ); axisTabLayout->addWidget( myInsertBtn, 1, 0, 1, 2 );
axisTabLayout->addWidget( myDeleteBtn , 2, 0, 1, 2 ); axisTabLayout->addWidget( myDeleteBtn, 2, 0, 1, 2 );
axisTabLayout->addWidget( myStepLabel, 3, 0 ); axisTabLayout->addWidget( myStepLabel, 3, 0 );
axisTabLayout->addWidget( myStepSpin , 3, 1 ); axisTabLayout->addWidget( myStepSpin , 3, 1 );
axisTabLayout->addWidget( csFrame , 1, 2, 4, 1 ); axisTabLayout->addWidget( csFrame , 1, 2, 4, 1 );
@ -821,6 +821,15 @@ QFrame* StdMeshersGUI_CartesianParamCreator::buildFrame()
myAddEdges = new QCheckBox( tr("ADD_EDGES"), GroupC1 ); myAddEdges = new QCheckBox( tr("ADD_EDGES"), GroupC1 );
argGroupLayout->addWidget( myAddEdges, row, 0, 1, 2 ); argGroupLayout->addWidget( myAddEdges, row, 0, 1, 2 );
row++; row++;
myCreateFaces = new QCheckBox( tr("CREATE_FACES"), GroupC1 );
argGroupLayout->addWidget( myCreateFaces, row, 0, 1, 2 );
row++;
myConsiderInternalFaces = new QCheckBox( tr("CONSIDER_INTERNAL_FACES"), GroupC1 );
argGroupLayout->addWidget( myConsiderInternalFaces, row, 0, 1, 2 );
row++;
myUseThresholdForInternalFaces = new QCheckBox( tr("USE_THRESHOLD_FOR_INTERNAL_FACES"), GroupC1 );
argGroupLayout->addWidget( myUseThresholdForInternalFaces, row, 0, 1, 2 );
row++;
// 3) Grid definition // 3) Grid definition
QTabWidget* tabWdg = new QTabWidget( fr ); QTabWidget* tabWdg = new QTabWidget( fr );
@ -924,6 +933,8 @@ QFrame* StdMeshersGUI_CartesianParamCreator::buildFrame()
connect( myOrthogonalChk, SIGNAL( toggled(bool)), SLOT( onOrthogonalAxes(bool))); connect( myOrthogonalChk, SIGNAL( toggled(bool)), SLOT( onOrthogonalAxes(bool)));
connect( optimBtn, SIGNAL( clicked(bool)), SLOT( onOptimalAxes(bool))); connect( optimBtn, SIGNAL( clicked(bool)), SLOT( onOptimalAxes(bool)));
connect( resetBtn, SIGNAL( clicked(bool)), SLOT( onResetAxes(bool))); connect( resetBtn, SIGNAL( clicked(bool)), SLOT( onResetAxes(bool)));
connect( myConsiderInternalFaces, SIGNAL( toggled(bool)),
myUseThresholdForInternalFaces, SLOT( setEnabled(bool)));
for ( int i = 0; i < 3; ++i ) for ( int i = 0; i < 3; ++i )
{ {
connect( myXDirSpin[i], SIGNAL(valueChanged (const QString&)), connect( myXDirSpin[i], SIGNAL(valueChanged (const QString&)),
@ -999,6 +1010,9 @@ void StdMeshersGUI_CartesianParamCreator::retrieveParams() const
myThreshold->setText( varName ); myThreshold->setText( varName );
myAddEdges->setChecked( h->GetToAddEdges() ); myAddEdges->setChecked( h->GetToAddEdges() );
myCreateFaces->setChecked( h->GetToCreateFaces() );
myConsiderInternalFaces->setChecked( h->GetToConsiderInternalFaces() );
myUseThresholdForInternalFaces->setChecked( h->GetToUseThresholdForInternalFaces() );
// grid definition // grid definition
for ( int ax = 0; ax < 3; ++ax ) for ( int ax = 0; ax < 3; ++ax )
@ -1086,6 +1100,9 @@ QString StdMeshersGUI_CartesianParamCreator::storeParams() const
h->SetVarParameter( myThreshold->text().toLatin1().constData(), "SetSizeThreshold" ); h->SetVarParameter( myThreshold->text().toLatin1().constData(), "SetSizeThreshold" );
h->SetSizeThreshold( myThreshold->text().toDouble() ); h->SetSizeThreshold( myThreshold->text().toDouble() );
h->SetToAddEdges( myAddEdges->isChecked() ); h->SetToAddEdges( myAddEdges->isChecked() );
h->SetToCreateFaces( myCreateFaces->isChecked() );
h->SetToConsiderInternalFaces( myConsiderInternalFaces->isChecked() );
h->SetToUseThresholdForInternalFaces( myUseThresholdForInternalFaces->isChecked() );
// grid // grid
for ( int ax = 0; ax < 3; ++ax ) for ( int ax = 0; ax < 3; ++ax )

@ -152,6 +152,9 @@ private:
QLineEdit* myName; QLineEdit* myName;
SMESHGUI_SpinBox* myThreshold; SMESHGUI_SpinBox* myThreshold;
QCheckBox* myAddEdges; QCheckBox* myAddEdges;
QCheckBox* myCreateFaces;
QCheckBox* myConsiderInternalFaces;
QCheckBox* myUseThresholdForInternalFaces;
StdMeshersGUI::GridAxisTab* myAxisTabs[3]; StdMeshersGUI::GridAxisTab* myAxisTabs[3];
QGroupBox* myFixedPointGrp; QGroupBox* myFixedPointGrp;

@ -0,0 +1,68 @@
// Copyright (C) 2007-2019 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
//
#include "StdMeshersGUI_NameCheckableGrpWdg.h"
#include <QGridLayout>
#include <QLabel>
#include <QLineEdit>
#define SPACING 6
#define MARGIN 11
//================================================================================
/*!
* \brief Creates a QGroupBox with a given title
*/
//================================================================================
StdMeshersGUI_NameCheckableGrpWdg::StdMeshersGUI_NameCheckableGrpWdg( const QString& groupTitle,
const QString& nameLabel )
: QGroupBox( groupTitle ),
myNameLineEdit( new QLineEdit( this ))
{
setCheckable( true );
QLabel* label = new QLabel( nameLabel );
QGridLayout* layout = new QGridLayout( this );
layout->setSpacing(SPACING);
layout->setMargin(MARGIN);
layout->addWidget( label, 0, 0 );
layout->addWidget( myNameLineEdit, 0, 1 );
connect( this, SIGNAL( toggled( bool )), myNameLineEdit, SLOT( setEnabled( bool )));
}
QString StdMeshersGUI_NameCheckableGrpWdg::getName()
{
return isChecked() ? myNameLineEdit->text() : QString();
}
void StdMeshersGUI_NameCheckableGrpWdg::setName( CORBA::String_var name )
{
myNameLineEdit->setText( name.in() );
setChecked( ! myNameLineEdit->text().isEmpty() );
}
void StdMeshersGUI_NameCheckableGrpWdg::setDefaultName( QString name )
{
myNameLineEdit->setText( name );
setChecked( ! myNameLineEdit->text().isEmpty() );
}

@ -0,0 +1,53 @@
// Copyright (C) 2007-2019 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
//
#ifndef STDMESHERSGUI_NameCheckableGrpWdg_H
#define STDMESHERSGUI_NameCheckableGrpWdg_H
// SMESH includes
#include "SMESH_StdMeshersGUI.hxx"
// Qt includes
#include <QGroupBox>
#include <omniORB4/CORBA.h>
class QButtonGroup;
class QLineEdit;
/*!
* \brief A QGroupBox holding several radio buttons
*/
class STDMESHERSGUI_EXPORT StdMeshersGUI_NameCheckableGrpWdg : public QGroupBox
{
Q_OBJECT
public:
StdMeshersGUI_NameCheckableGrpWdg(const QString& groupTitle,
const QString& nameLabel);
QString getName();
void setName( CORBA::String_var name );
void setDefaultName( QString name );
private:
QLineEdit* myNameLineEdit;
};
#endif // STDMESHERSGUI_NameCheckableGrpWdg_H

@ -39,6 +39,7 @@
#include "StdMeshersGUI_PropagationHelperWdg.h" #include "StdMeshersGUI_PropagationHelperWdg.h"
#include "StdMeshersGUI_QuadrangleParamWdg.h" #include "StdMeshersGUI_QuadrangleParamWdg.h"
#include "StdMeshersGUI_RadioButtonsGrpWdg.h" #include "StdMeshersGUI_RadioButtonsGrpWdg.h"
#include "StdMeshersGUI_NameCheckableGrpWdg.h"
#include "StdMeshersGUI_SubShapeSelectorWdg.h" #include "StdMeshersGUI_SubShapeSelectorWdg.h"
#include <SALOMEDSClient_Study.hxx> #include <SALOMEDSClient_Study.hxx>
@ -377,10 +378,51 @@ namespace {
} }
} }
//================================================================================
/*!
* \brief Remove a group, whose name is stored by hypothesis, upon group name modification
* \param [in] oldName - old group name
* \param [in] newName - new group name
* \param [in] type - group type
*/
//================================================================================
void StdMeshersGUI_StdHypothesisCreator::
removeOldGroup(const char* oldName, const char* newName, SMESH::ElementType type) const
{
if ( !oldName || !oldName[0] )
return; // old name undefined
if ( newName && strcmp( oldName, newName ) == 0 )
return; // same name
SMESH::SMESH_Hypothesis_var h = hypothesis();
SMESH::SObjectList listSOmesh = SMESH::GetMeshesUsingAlgoOrHypothesis( h );
for ( size_t i = 0; i < listSOmesh.size(); i++ )
{
_PTR(SObject) submSO = listSOmesh[i];
SMESH::SMESH_Mesh_var mesh = SMESH::SObjectToInterface<SMESH::SMESH_Mesh>( submSO );
SMESH::SMESH_subMesh_var subMesh = SMESH::SObjectToInterface<SMESH::SMESH_subMesh>( submSO );
if( !subMesh->_is_nil() )
mesh = subMesh->GetFather();
if ( mesh->_is_nil() )
continue;
SMESH::ListOfGroups_var groups = mesh->GetGroups();
for ( CORBA::ULong iG = 0; iG < groups->length(); iG++ )
{
if ( groups[iG]->GetType() != type )
continue;
CORBA::String_var name = groups[iG]->GetName();
if ( strcmp( name.in(), oldName ))
continue;
mesh->RemoveGroup( groups[iG] );
}
}
}
//================================================================================ //================================================================================
/*! /*!
* \brief Check parameter values before accept() * \brief Check parameter values before accept()
* \retval bool - true if OK * \retval bool - true if OK
*/ */
//================================================================================ //================================================================================
@ -422,7 +464,7 @@ bool StdMeshersGUI_StdHypothesisCreator::checkParams( QString& msg ) const
// then the FACE must have only one VERTEX // then the FACE must have only one VERTEX
GEOM::GEOM_Object_var face = w->GetObject< GEOM::GEOM_Object >(); GEOM::GEOM_Object_var face = w->GetObject< GEOM::GEOM_Object >();
GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen(); GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen( face );
_PTR(Study) aStudy = SMESH::getStudy(); _PTR(Study) aStudy = SMESH::getStudy();
GEOM::GEOM_IShapesOperations_wrap shapeOp; GEOM::GEOM_IShapesOperations_wrap shapeOp;
if ( !geomGen->_is_nil() && aStudy ) if ( !geomGen->_is_nil() && aStudy )
@ -728,6 +770,15 @@ QString StdMeshersGUI_StdHypothesisCreator::storeParams() const
{ {
h->SetFaces( idsWg->GetListOfIDs(), params[4].myValue.toInt() ); h->SetFaces( idsWg->GetListOfIDs(), params[4].myValue.toInt() );
} }
if ( StdMeshersGUI_NameCheckableGrpWdg* nameWg =
widget< StdMeshersGUI_NameCheckableGrpWdg >( 6 ))
{
CORBA::String_var oldName = h->GetGroupName();
h->SetGroupName( nameWg->getName().toUtf8().data() );
CORBA::String_var newName = h->GetGroupName();
removeOldGroup( oldName, newName, SMESH::VOLUME );
}
} }
else if( hypType()=="ViscousLayers2D" ) else if( hypType()=="ViscousLayers2D" )
{ {
@ -746,6 +797,15 @@ QString StdMeshersGUI_StdHypothesisCreator::storeParams() const
{ {
h->SetEdges( idsWg->GetListOfIDs(), params[3].myValue.toInt() ); h->SetEdges( idsWg->GetListOfIDs(), params[3].myValue.toInt() );
} }
if ( StdMeshersGUI_NameCheckableGrpWdg* nameWg =
widget< StdMeshersGUI_NameCheckableGrpWdg >( 5 ))
{
CORBA::String_var oldName = h->GetGroupName();
h->SetGroupName( nameWg->getName().toUtf8().data() );
CORBA::String_var newName = h->GetGroupName();
removeOldGroup( oldName, newName, SMESH::FACE );
}
} }
// else if( hypType()=="QuadrangleParams" ) // else if( hypType()=="QuadrangleParams" )
// { // {
@ -1250,6 +1310,19 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const
} }
customWidgets()->append ( idsWg ); customWidgets()->append ( idsWg );
} }
item.setNoName();
p.append( item );
StdMeshersGUI_NameCheckableGrpWdg* nameWdg =
new StdMeshersGUI_NameCheckableGrpWdg( tr( "CREATE_GROUPS_FROM_LAYERS" ),
tr( "GROUP_NAME" ));
nameWdg->setName( h->GetGroupName() );
if ( nameWdg->getName().isEmpty() )
{
nameWdg->setDefaultName( type() );
nameWdg->setChecked( false );
}
customWidgets()->append ( nameWdg );
} }
else if( hypType()=="ViscousLayers2D" ) else if( hypType()=="ViscousLayers2D" )
{ {
@ -1308,6 +1381,19 @@ bool StdMeshersGUI_StdHypothesisCreator::stdParams( ListOfStdParams& p ) const
} }
customWidgets()->append ( idsWg ); customWidgets()->append ( idsWg );
} }
item.setNoName();
p.append( item );
StdMeshersGUI_NameCheckableGrpWdg* nameWdg =
new StdMeshersGUI_NameCheckableGrpWdg( tr( "CREATE_GROUPS_FROM_LAYERS" ),
tr( "GROUP_NAME" ));
nameWdg->setName( h->GetGroupName() );
if ( nameWdg->getName().isEmpty() )
{
nameWdg->setDefaultName( type() );
nameWdg->setChecked( false );
}
customWidgets()->append ( nameWdg );
} }
else else
res = false; res = false;
@ -1574,6 +1660,10 @@ bool StdMeshersGUI_StdHypothesisCreator::getParamFromCustomWidget( StdParam & pa
param.myValue = w->checkedId(); param.myValue = w->checkedId();
return true; return true;
} }
if ( widget->inherits( "StdMeshersGUI_NameCheckableGrpWdg" ))
{
return true;
}
return false; return false;
} }

@ -66,6 +66,9 @@ protected:
bool initVariableName(SMESH::SMESH_Hypothesis_var theHyp, StdParam& theParams, const char* theMethod) const; bool initVariableName(SMESH::SMESH_Hypothesis_var theHyp, StdParam& theParams, const char* theMethod) const;
QWidget* makeReverseEdgesWdg( SMESH::long_array_var edgeIDs, QWidget* makeReverseEdgesWdg( SMESH::long_array_var edgeIDs,
CORBA::String_var shapeEntry) const; CORBA::String_var shapeEntry) const;
void removeOldGroup(const char* oldName,
const char* newName,
SMESH::ElementType type) const;

@ -59,6 +59,14 @@ this one for this mesh/sub-mesh.</translation>
<source>EXTMETH_FACE_OFFSET</source> <source>EXTMETH_FACE_OFFSET</source>
<translation>Face offset</translation> <translation>Face offset</translation>
</message> </message>
<message>
<source>CREATE_GROUPS_FROM_LAYERS</source>
<translation>Create groups from layers</translation>
</message>
<message>
<source>GROUP_NAME</source>
<translation>Group name</translation>
</message>
</context> </context>
<context> <context>
<name>@default</name> <name>@default</name>
@ -572,6 +580,18 @@ this one for this mesh/sub-mesh.</translation>
<source>ADD_EDGES</source> <source>ADD_EDGES</source>
<translation>Implement Edges</translation> <translation>Implement Edges</translation>
</message> </message>
<message>
<source>CREATE_FACES</source>
<translation>Create Faces</translation>
</message>
<message>
<source>CONSIDER_INTERNAL_FACES</source>
<translation>Consider Shared and Internal Faces</translation>
</message>
<message>
<source>USE_THRESHOLD_FOR_INTERNAL_FACES</source>
<translation>Apply Threshold to Shared / Internal Faces</translation>
</message>
<message> <message>
<source>AXIS_X</source> <source>AXIS_X</source>
<translation>Axis X</translation> <translation>Axis X</translation>

@ -119,6 +119,7 @@ SET(StdMeshersEngine_HEADERS
StdMeshers_CartesianParameters3D_i.hxx StdMeshers_CartesianParameters3D_i.hxx
StdMeshers_Cartesian_3D_i.hxx StdMeshers_Cartesian_3D_i.hxx
StdMeshers_PolygonPerFace_2D_i.hxx StdMeshers_PolygonPerFace_2D_i.hxx
StdMeshers_PolyhedronPerSolid_3D_i.hxx
) )
IF(SALOME_SMESH_ENABLE_MEFISTO) IF(SALOME_SMESH_ENABLE_MEFISTO)
SET(StdMeshersEngine_HEADERS ${StdMeshersEngine_HEADERS} StdMeshers_MEFISTO_2D_i.hxx) SET(StdMeshersEngine_HEADERS ${StdMeshersEngine_HEADERS} StdMeshers_MEFISTO_2D_i.hxx)
@ -174,6 +175,7 @@ SET(StdMeshersEngine_SOURCES
StdMeshers_Cartesian_3D_i.cxx StdMeshers_Cartesian_3D_i.cxx
StdMeshers_Adaptive1D_i.cxx StdMeshers_Adaptive1D_i.cxx
StdMeshers_PolygonPerFace_2D_i.cxx StdMeshers_PolygonPerFace_2D_i.cxx
StdMeshers_PolyhedronPerSolid_3D_i.cxx
) )
IF(SALOME_SMESH_ENABLE_MEFISTO) IF(SALOME_SMESH_ENABLE_MEFISTO)

@ -240,6 +240,14 @@ void StdMeshers_CartesianParameters3D_i::SetAxesDirs(const SMESH::DirStruct& xDi
coords[6] = zDir.PS.x; coords[6] = zDir.PS.x;
coords[7] = zDir.PS.y; coords[7] = zDir.PS.y;
coords[8] = zDir.PS.z; coords[8] = zDir.PS.z;
const double* oldCoords = GetImpl()->GetAxisDirs();
bool isSame = true;
for ( int i = 0; i < 9 && isSame; ++i )
isSame = ( oldCoords[i] == coords[i] );
if ( isSame )
return;
try { try {
this->GetImpl()->SetAxisDirs(coords); this->GetImpl()->SetAxisDirs(coords);
@ -283,6 +291,11 @@ void StdMeshers_CartesianParameters3D_i::GetAxesDirs(SMESH::DirStruct& xDir,
void StdMeshers_CartesianParameters3D_i::SetFixedPoint(const SMESH::PointStruct& ps, void StdMeshers_CartesianParameters3D_i::SetFixedPoint(const SMESH::PointStruct& ps,
CORBA::Boolean toUnset) CORBA::Boolean toUnset)
{ {
SMESH::PointStruct oldPS;
GetFixedPoint( oldPS );
if ( oldPS.x == ps.x && oldPS.y == ps.y && oldPS.z == ps.z )
return;
double p[3] = { ps.x, ps.y, ps.z }; double p[3] = { ps.x, ps.y, ps.z };
GetImpl()->SetFixedPoint( p, toUnset ); GetImpl()->SetFixedPoint( p, toUnset );
@ -335,6 +348,76 @@ CORBA::Boolean StdMeshers_CartesianParameters3D_i::GetToAddEdges()
return GetImpl()->GetToAddEdges(); return GetImpl()->GetToAddEdges();
} }
//=======================================================================
//function : SetToConsiderInternalFaces
//purpose : Enables treatment of geom faces, either shared by solids or internal.
//=======================================================================
void StdMeshers_CartesianParameters3D_i::SetToConsiderInternalFaces(CORBA::Boolean toTreat)
{
if ( GetToConsiderInternalFaces() == toTreat )
return;
GetImpl()->SetToConsiderInternalFaces( toTreat );
SMESH::TPythonDump() << _this() << ".SetToConsiderInternalFaces( " << toTreat << " )";
}
//=======================================================================
//function : GetToConsiderInternalFaces
//purpose : Return true if treatment of internal geom faces is enabled
//=======================================================================
CORBA::Boolean StdMeshers_CartesianParameters3D_i::GetToConsiderInternalFaces()
{
return GetImpl()->GetToConsiderInternalFaces();
}
//=======================================================================
//function : SetToUseThresholdForInternalFaces
//purpose : Enables applying size threshold to grid cells cut by internal geom faces.
//=======================================================================
void StdMeshers_CartesianParameters3D_i::SetToUseThresholdForInternalFaces(CORBA::Boolean toUse)
{
if ( GetToUseThresholdForInternalFaces() == toUse )
return;
GetImpl()->SetToUseThresholdForInternalFaces( toUse );
SMESH::TPythonDump() << _this() << ".SetToUseThresholdForInternalFaces( " << toUse << " )";
}
//=======================================================================
//function : GetToUseThresholdForInternalFaces
//purpose : Return true if applying size threshold to grid cells cut by
// internal geom faces is enabled
//=======================================================================
CORBA::Boolean StdMeshers_CartesianParameters3D_i::GetToUseThresholdForInternalFaces()
{
return GetImpl()->GetToUseThresholdForInternalFaces();
}
//=======================================================================
//function : SetToCreateFaces
//purpose : Enables creation of mesh faces.
//=======================================================================
void StdMeshers_CartesianParameters3D_i::SetToCreateFaces(CORBA::Boolean toCreate)
{
if ( GetToCreateFaces() == toCreate )
return;
GetImpl()->SetToCreateFaces( toCreate );
SMESH::TPythonDump() << _this() << ".SetToCreateFaces( " << toCreate << " )";
}
//=======================================================================
//function : GetToCreateFaces
//purpose : Check if creation of mesh faces enabled
//=======================================================================
CORBA::Boolean StdMeshers_CartesianParameters3D_i::GetToCreateFaces()
{
return GetImpl()->GetToCreateFaces();
}
//======================================================================= //=======================================================================
//function : IsGridBySpacing //function : IsGridBySpacing
//purpose : Return true if the grid is defined by spacing functions and //purpose : Return true if the grid is defined by spacing functions and

@ -100,7 +100,7 @@ class STDMESHERS_I_EXPORT StdMeshers_CartesianParameters3D_i:
/*! /*!
* \brief Enables implementation of geometrical edges into the mesh. If this feature * \brief Enable implementation of geometrical edges into the mesh. If this feature
* is disabled, sharp edges of the shape are lost ("smoothed") in the mesh if * is disabled, sharp edges of the shape are lost ("smoothed") in the mesh if
* they don't coincide with the grid lines * they don't coincide with the grid lines
*/ */
@ -108,13 +108,32 @@ class STDMESHERS_I_EXPORT StdMeshers_CartesianParameters3D_i:
CORBA::Boolean GetToAddEdges(); CORBA::Boolean GetToAddEdges();
/*! /*!
* \brief Return true if the grid is defined by spacing functions and * Enable treatment of geom faces, either shared by solids or internal.
*/
void SetToConsiderInternalFaces(CORBA::Boolean toTreat);
CORBA::Boolean GetToConsiderInternalFaces();
/*!
* Enable applying size threshold to grid cells cut by internal geom faces.
*/
void SetToUseThresholdForInternalFaces(CORBA::Boolean toUse);
CORBA::Boolean GetToUseThresholdForInternalFaces();
/*!
* Enable creation of mesh faces.
*/
void SetToCreateFaces(CORBA::Boolean toCreate);
CORBA::Boolean GetToCreateFaces();
/*!
* \brief Return true if the grid is defined by spacing functions and
* not by node coordinates * not by node coordinates
*/ */
CORBA::Boolean IsGridBySpacing(CORBA::Short axis); CORBA::Boolean IsGridBySpacing(CORBA::Short axis);
/*! /*!
* Returns axes at which number of hexahedra is maximal * Return axes at which number of hexahedra is maximal
*/ */
void ComputeOptimalAxesDirs(GEOM::GEOM_Object_ptr shape, void ComputeOptimalAxesDirs(GEOM::GEOM_Object_ptr shape,
CORBA::Boolean isOrthogonal, CORBA::Boolean isOrthogonal,
@ -122,7 +141,7 @@ class STDMESHERS_I_EXPORT StdMeshers_CartesianParameters3D_i:
SMESH::DirStruct& y, SMESH::DirStruct& y,
SMESH::DirStruct& z) throw (SALOME::SALOME_Exception); SMESH::DirStruct& z) throw (SALOME::SALOME_Exception);
/*! /*!
* \brief Computes node coordinates by spacing functions * \brief Compute node coordinates by spacing functions
* \param x0 - lower coordinate * \param x0 - lower coordinate
* \param x1 - upper coordinate * \param x1 - upper coordinate
* \param spaceFuns - space functions * \param spaceFuns - space functions

@ -0,0 +1,57 @@
// Copyright (C) 2007-2019 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, 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 : StdMeshers_PolyhedronPerSolid_3D_i.cxx
// Module : SMESH
//
#include "StdMeshers_PolyhedronPerSolid_3D_i.hxx"
#include "SMESH_Gen.hxx"
#include "StdMeshers_PolyhedronPerSolid_3D.hxx"
//=============================================================================
/*!
* Constructor
*/
//=============================================================================
StdMeshers_PolyhedronPerSolid_3D_i::StdMeshers_PolyhedronPerSolid_3D_i( PortableServer::POA_ptr thePOA,
::SMESH_Gen* theGenImpl )
: SALOME::GenericObj_i( thePOA ),
SMESH_Hypothesis_i( thePOA ),
SMESH_Algo_i( thePOA ),
SMESH_3D_Algo_i( thePOA )
{
myBaseImpl = new ::StdMeshers_PolyhedronPerSolid_3D( theGenImpl->GetANewId(),
theGenImpl );
}
//=============================================================================
/*!
* Destructor
*/
//=============================================================================
StdMeshers_PolyhedronPerSolid_3D_i::~StdMeshers_PolyhedronPerSolid_3D_i()
{
}

@ -0,0 +1,53 @@
// Copyright (C) 2007-2019 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, 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 : StdMeshers_PolyhedronPerSolid_3D_i.hxx
// Module : SMESH
//
#ifndef _SMESH_PolyhedronPerSolid_3D_I_HXX_
#define _SMESH_PolyhedronPerSolid_3D_I_HXX_
#include "SMESH_StdMeshers_I.hxx"
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis)
#include "SMESH_3D_Algo_i.hxx"
class SMESH_Gen;
// ======================================================
// Polyhedron Per Solid 3D algorithm
// ======================================================
class STDMESHERS_I_EXPORT StdMeshers_PolyhedronPerSolid_3D_i:
public virtual POA_StdMeshers::StdMeshers_PolyhedronPerSolid_3D,
public virtual SMESH_3D_Algo_i
{
public:
// Constructor
StdMeshers_PolyhedronPerSolid_3D_i( PortableServer::POA_ptr thePOA,
::SMESH_Gen* theGenImpl );
// Destructor
virtual ~StdMeshers_PolyhedronPerSolid_3D_i();
};
#endif

@ -222,6 +222,33 @@ throw ( SALOME::SALOME_Exception )
return GetImpl()->GetStretchFactor(); return GetImpl()->GetStretchFactor();
} }
//================================================================================
/*!
* \brief Set name of a group of layers elements
*/
//================================================================================
void StdMeshers_ViscousLayers2D_i::SetGroupName(const char* name)
{
if ( GetImpl()->GetGroupName() != name )
{
GetImpl()->SetGroupName( name );
SMESH::TPythonDump() << _this() << ".SetGroupName( '" << name << "' )";
}
}
//================================================================================
/*!
* \brief Return name of a group of layers elements
*/
//================================================================================
char* StdMeshers_ViscousLayers2D_i::GetGroupName()
{
return CORBA::string_dup( GetImpl()->GetGroupName().c_str() );
}
//============================================================================= //=============================================================================
/*! /*!
* Get implementation * Get implementation

@ -64,6 +64,10 @@ class STDMESHERS_I_EXPORT StdMeshers_ViscousLayers2D_i:
void SetStretchFactor(::CORBA::Double factor) throw ( SALOME::SALOME_Exception ); void SetStretchFactor(::CORBA::Double factor) throw ( SALOME::SALOME_Exception );
::CORBA::Double GetStretchFactor(); ::CORBA::Double GetStretchFactor();
void SetGroupName(const char* name);
char* GetGroupName();
// Get implementation // Get implementation
::StdMeshers_ViscousLayers2D* GetImpl(); ::StdMeshers_ViscousLayers2D* GetImpl();

@ -253,6 +253,32 @@ void StdMeshers_ViscousLayers_i::SetMethod( ::StdMeshers::VLExtrusionMethod how
return (::StdMeshers::VLExtrusionMethod) GetImpl()->GetMethod(); return (::StdMeshers::VLExtrusionMethod) GetImpl()->GetMethod();
} }
//================================================================================
/*!
* \brief Set name of a group of layers elements
*/
//================================================================================
void StdMeshers_ViscousLayers_i::SetGroupName(const char* name)
{
if ( GetImpl()->GetGroupName() != name )
{
GetImpl()->SetGroupName( name );
SMESH::TPythonDump() << _this() << ".SetGroupName( '" << name << "' )";
}
}
//================================================================================
/*!
* \brief Return name of a group of layers elements
*/
//================================================================================
char* StdMeshers_ViscousLayers_i::GetGroupName()
{
return CORBA::string_dup( GetImpl()->GetGroupName().c_str() );
}
//============================================================================= //=============================================================================
/*! /*!
* Get implementation * Get implementation

@ -67,10 +67,14 @@ class STDMESHERS_I_EXPORT StdMeshers_ViscousLayers_i:
void SetMethod( ::StdMeshers::VLExtrusionMethod how ); void SetMethod( ::StdMeshers::VLExtrusionMethod how );
::StdMeshers::VLExtrusionMethod GetMethod(); ::StdMeshers::VLExtrusionMethod GetMethod();
void SetGroupName(const char* name);
char* GetGroupName();
// Get implementation // Get implementation
::StdMeshers_ViscousLayers* GetImpl(); ::StdMeshers_ViscousLayers* GetImpl();
// Verify whether hypothesis supports given entity type // Verify whether hypothesis supports given entity type
CORBA::Boolean IsDimSupported( SMESH::Dimension type ); CORBA::Boolean IsDimSupported( SMESH::Dimension type );
// Methods for copying mesh definition to other geometry // Methods for copying mesh definition to other geometry

@ -57,6 +57,7 @@
#include "StdMeshers_NumberOfLayers_i.hxx" #include "StdMeshers_NumberOfLayers_i.hxx"
#include "StdMeshers_NumberOfSegments_i.hxx" #include "StdMeshers_NumberOfSegments_i.hxx"
#include "StdMeshers_PolygonPerFace_2D_i.hxx" #include "StdMeshers_PolygonPerFace_2D_i.hxx"
#include "StdMeshers_PolyhedronPerSolid_3D_i.hxx"
#include "StdMeshers_Prism_3D_i.hxx" #include "StdMeshers_Prism_3D_i.hxx"
#include "StdMeshers_ProjectionSource1D_i.hxx" #include "StdMeshers_ProjectionSource1D_i.hxx"
#include "StdMeshers_ProjectionSource2D_i.hxx" #include "StdMeshers_ProjectionSource2D_i.hxx"
@ -250,6 +251,8 @@ STDMESHERS_I_EXPORT
aCreator = new StdHypothesisCreator_i<StdMeshers_Cartesian_3D_i>; aCreator = new StdHypothesisCreator_i<StdMeshers_Cartesian_3D_i>;
else if (strcmp(aHypName, "PolygonPerFace_2D") == 0) else if (strcmp(aHypName, "PolygonPerFace_2D") == 0)
aCreator = new StdHypothesisCreator_i<StdMeshers_PolygonPerFace_2D_i>; aCreator = new StdHypothesisCreator_i<StdMeshers_PolygonPerFace_2D_i>;
else if (strcmp(aHypName, "PolyhedronPerSolid_3D") == 0)
aCreator = new StdHypothesisCreator_i<StdMeshers_PolyhedronPerSolid_3D_i>;
else ; else ;
return aCreator; return aCreator;