Merge from V7_main

This commit is contained in:
rnc 2013-08-22 11:40:15 +00:00
parent 3d3ea93b44
commit d2ee158882
111 changed files with 10846 additions and 1869 deletions

View File

@ -587,9 +587,6 @@ AC_OUTPUT([ \
src/Tools/padder/spadderpy/plugin/Makefile \ src/Tools/padder/spadderpy/plugin/Makefile \
src/Tools/padder/spadderpy/plugin/envPlugins.sh \ src/Tools/padder/spadderpy/plugin/envPlugins.sh \
src/Tools/padder/resources/Makefile \ src/Tools/padder/resources/Makefile \
src/Tools/padder/resources/appligen/Makefile \
src/Tools/padder/resources/appligen/appligen.sh \
src/Tools/padder/resources/appligen/config_appli.xml \
src/Tools/padder/resources/testdata/Makefile \ src/Tools/padder/resources/testdata/Makefile \
src/Tools/padder/unittests/Makefile \ src/Tools/padder/unittests/Makefile \
src/Tools/padder/unittests/autotest.sh \ src/Tools/padder/unittests/autotest.sh \

View File

@ -110,6 +110,7 @@ GOOD_TESTS = \
grouping_elements_ex08.py \ grouping_elements_ex08.py \
measurements_ex01.py \ measurements_ex01.py \
measurements_ex02.py \ measurements_ex02.py \
measurements_ex03.py \
modifying_meshes_ex01.py \ modifying_meshes_ex01.py \
modifying_meshes_ex02.py \ modifying_meshes_ex02.py \
modifying_meshes_ex03.py \ modifying_meshes_ex03.py \

View File

@ -0,0 +1,79 @@
# Basic Properties
import salome
salome.salome_init()
import GEOM
from salome.geom import geomBuilder
geompy = geomBuilder.New(salome.myStudy)
import SMESH, SALOMEDS
from salome.smesh import smeshBuilder
smesh = smeshBuilder.New(salome.myStudy)
# create a box
box = geompy.MakeBoxDXDYDZ(100,100,100)
face = geompy.SubShapeAllSorted(box, geompy.ShapeType['FACE'])[0]
# mesh a box
mesh = smesh.Mesh(box)
submesh_1d = mesh.Segment().NumberOfSegments(5)
submesh_2d = mesh.Quadrangle()
submesh_3d = mesh.Hexahedron()
submesh_2d_face = mesh.Triangle(face)
mesh.Compute()
# create a group
group_2d = mesh.Group(face)
# compute basic properties
print "Get basic properties: approach 1 (via measurements tool) ----"
measure = smesh.CreateMeasurements()
print "* for mesh:"
print " length:", measure.Length(mesh.mesh)
print " area:", measure.Area(mesh.mesh)
print " volume:", measure.Volume(mesh.mesh)
print "* for group (2d):"
print " length:", measure.Length(group_2d)
print " area:", measure.Area(group_2d)
print " volume:", measure.Volume(group_2d)
print "* for submesh (2d):"
print " length:", measure.Length(submesh_2d_face.GetSubMesh())
print " area:", measure.Area(submesh_2d_face.GetSubMesh())
print " volume:", measure.Volume(submesh_2d_face.GetSubMesh())
measure.UnRegister()
print "Get basic properties: approach 2 (via smeshBuilder) ----"
print "* for mesh:"
print " length:", smesh.GetLength(mesh)
print " area:", smesh.GetArea(mesh)
print " volume:", smesh.GetVolume(mesh)
print "* for group (2d):"
print " length:", smesh.GetLength(group_2d)
print " area:", smesh.GetArea(group_2d)
print " volume:", smesh.GetVolume(group_2d)
print "* for submesh (2d):"
print " length:", smesh.GetLength(submesh_2d_face)
print " area:", smesh.GetArea(submesh_2d_face)
print " volume:", smesh.GetVolume(submesh_2d_face)
print "Get basic properties: approach 3 (via smeshBuilder.Mesh) ----"
print "* for mesh:"
print " length:", mesh.GetLength()
print " area:", mesh.GetArea()
print " volume:", mesh.GetVolume()
print "* for group (2d): unsupported"
print "* for submesh (2d): unsupported"

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

@ -79,7 +79,7 @@ path</b> item or click <em>"Extrusion along a path"</em> button in the toolbar.
The following dialog common for line and planar elements will appear: The following dialog common for line and planar elements will appear:
\image html extrusion1.png \image html extrusion_along_path_dlg.png
</li> </li>
<li>In this dialog: <li>In this dialog:
@ -99,28 +99,31 @@ about filters in the \ref selection_filter_library_page "Selection filter librar
</ul> </ul>
</li> </li>
<li>define the Path along which the elements will be extruded, <li>define the \b Path along which the elements will be extruded.<br>
\n Path definition consists of several elements: Path definition consists of several elements:
<ul> <ul>
<li><b>Mesh or submesh</b> - 1D mesh or sub-mesh, along which proceeds the extrusion</li> <li><b>Mesh or submesh</b> - 1D mesh or sub-mesh, along which proceeds the extrusion</li>
<li><b>Start node</b> - the start node. It is used to define the direction of extrusion </li> <li><b>Start node</b> - the start node. It is used to define the direction of extrusion </li>
</ul> </ul>
</li> </li>
<li>activate <b>Generate Groups</b> checkbox if it is necessary to copy the groups of <li>activate <b>Generate Groups</b> checkbox if it is necessary to copy the groups of
elements of the source mesh to the newly created one. </li> elements of the source mesh to the newly created one. </li>
</ul> </ul>
</li> </li>
<li>There are two optional parameters, which can be very useful: <li>There are two optional parameters, which can be very useful:
<ul> <ul>
<li>If the path of extrusion is curvilinear, at each iteration the <li>If the path of extrusion is curvilinear, at each iteration the
extruded shape is rotated to keep its initial angularity to the extruded elements are rotated to keep its initial angularity to the
curve. By default, the <b>Base Point</b> around which the shape is rotated is curve. By default, the <b>Base Point</b> around which the elements are rotated is
the mass center of the shape, however, you can specify any point as the mass center of the elements, however, you can specify any point as
the <b>Base Point</b> and the shape will be rotated with respect to this the <b>Base Point</b> and the elements will be rotated with respect to this
point. point.<br>
Note that it is the <b>Base Point</b> whos track exactly equals to the
path, and all the elements being extruded just keep their relative
position around the <b>Base Point</b> at each iteration.
</li> </li>
<li>The shape can also be rotated around the path to get the resulting <li>The elements can also be rotated around the path to get the resulting
mesh in a helical fashion. You can set the values of angles at the mesh in a helical fashion. You can set the values of angles at the
right, add them to the list of angles at the left by pressing the <em>"Add"</em> right, add them to the list of angles at the left by pressing the <em>"Add"</em>
button and remove them from the list by pressing the <em>"Remove"</em> button. button and remove them from the list by pressing the <em>"Remove"</em> button.
@ -132,7 +135,7 @@ button and remove them from the list by pressing the <em>"Remove"</em> button.
<center><em>"Remove" button</em></center> <center><em>"Remove" button</em></center>
<b>Linear variation of the angles</b> option allows defining the angle of gradual rotation for the whole path. <b>Linear variation of the angles</b> option allows defining the angle of gradual rotation for the whole path.
At each step the shape will be rotated by angle/nb. of steps. At each step the elements will be rotated by <code>angle / nb. of steps</code>.
</li> </li>
</ul> </ul>

View File

@ -64,6 +64,32 @@ viewer.
\image html bnd_box_preview.png \image html bnd_box_preview.png
\section basic_properties_anchor Basic Properties
This operation allows calculation of length, area or volume for the the selected
object:
- Length is calculated as a sum of length of all 1D elements;
- Area id a sum of area of all 2D elements
- Volume is a sum of volume of all 3D elements.
To start one of <b>Basic Properties</b> calculations, select <b>Length</b>, <b>Area</b>
or <b>Volume</b> item from <b>Measurements - Basic Properties</b> menu.
\image html basic_props.png
In the dialog box select the required type of calculation (length, area or volume), select
the the object (mesh, sub-mesh or group) and press \em Compute button.
The result of calculation will be shown in the bottom area of the
dialog box.
\note
- If mesh consists of 3D elements only, its "length" and "area" will be 0.
- As calculation result is a sum of length, area and volume of all mesh elements,
duplications are not taken into account; i.e. all duplicated elements
(elements built on the same set of nodes) will be included into the result.
- Similarly, intersection of elements is not taken into account.
<b>See Also</b> a sample TUI Script of a <b>See Also</b> a sample TUI Script of a
\ref tui_measurements_page "Measurement operations". \ref tui_measurements_page "Measurement operations".

View File

@ -6,7 +6,8 @@
of two triangles separated by a diagonal. So it can be calculated only of two triangles separated by a diagonal. So it can be calculated only
for elements consisting of 4 nodes. for elements consisting of 4 nodes.
\image html image25.png <b><center>JA=0.25 * (A1 + A2 + A3 + A4)
<br> TAPER= MAX(|A1/JA - 1|, |A2/JA - 1|, |A3/JA - 1|, |A4/JA - 1|)</center></b>
<br><em>To apply the Taper quality criterion to your mesh:</em> <br><em>To apply the Taper quality criterion to your mesh:</em>

View File

@ -8,4 +8,7 @@
\section tui_bounding_box Bounding Box \section tui_bounding_box Bounding Box
\tui_script{measurements_ex02.py} \tui_script{measurements_ex02.py}
\section tui_bounding_box Basic Properties
\tui_script{measurements_ex03.py}
*/ */

View File

@ -55,6 +55,21 @@ module SMESH
* common bounding box of entities * common bounding box of entities
*/ */
Measure BoundingBox(in ListOfIDSources sources); Measure BoundingBox(in ListOfIDSources sources);
/*!
* sum of length of 1D elements of the source
*/
double Length(in SMESH_IDSource source);
/*!
* sum of area of 2D elements of the source
*/
double Area(in SMESH_IDSource source);
/*!
* sum of volume of 3D elements of the source
*/
double Volume(in SMESH_IDSource source);
}; };
}; };

View File

@ -277,7 +277,7 @@ module SMESH
interface SMESH_Mesh; interface SMESH_Mesh;
interface SMESH_IDSource interface SMESH_IDSource : SALOME::GenericObj
{ {
/*! /*!
* Returns a sequence of all element IDs * Returns a sequence of all element IDs

View File

@ -208,7 +208,11 @@ dist_salomeres_DATA = \
mesh_min_dist.png \ mesh_min_dist.png \
reorient_faces_point.png \ reorient_faces_point.png \
reorient_faces_face.png \ reorient_faces_face.png \
mesh_ball.png mesh_ball.png \
mesh_measure_basic_props.png \
mesh_measure_length.png \
mesh_measure_area.png \
mesh_measure_volume.png
# VSR: little trick to avoid putting if SMESHCatalog.xml to the distribution archive # VSR: little trick to avoid putting if SMESHCatalog.xml to the distribution archive
nodist_salomeres_SCRIPTS = SMESHCatalog.xml SalomeApp.xml nodist_salomeres_SCRIPTS = SMESHCatalog.xml SalomeApp.xml

View File

@ -30,6 +30,7 @@
<meshers-group name="Standard Meshers" <meshers-group name="Standard Meshers"
resources="StdMeshers" resources="StdMeshers"
idl-module="StdMeshers"
server-lib="StdMeshersEngine" server-lib="StdMeshersEngine"
gui-lib="StdMeshersGUI"> gui-lib="StdMeshersGUI">
<hypotheses> <hypotheses>

Binary file not shown.

After

Width:  |  Height:  |  Size: 806 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 331 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 914 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1018 B

View File

@ -54,7 +54,8 @@ libSMESHControls_la_LDFLAGS = \
../SMESHDS/libSMESHDS.la \ ../SMESHDS/libSMESHDS.la \
../SMESHUtils/libSMESHUtils.la \ ../SMESHUtils/libSMESHUtils.la \
$(CAS_LDPATH) -lTKernel -lTKBRep -lTKG3d -lTKTopAlgo -lTKGeomBase -lTKGeomAlgo \ $(CAS_LDPATH) -lTKernel -lTKBRep -lTKG3d -lTKTopAlgo -lTKGeomBase -lTKGeomAlgo \
$(VTK_LIBS) $(VTK_LIBS) \
$(KERNEL_LDFLAGS) -lOpUtil -lSALOMELocalTrace -lSALOMEBasics
SMESHControls_CPPFLAGS = \ SMESHControls_CPPFLAGS = \
$(libSMESHControls_la_CPPFLAGS) $(libSMESHControls_la_CPPFLAGS)
@ -64,6 +65,6 @@ SMESHControls_LDADD = \
../SMDS/libSMDS.la \ ../SMDS/libSMDS.la \
../SMESHDS/libSMESHDS.la \ ../SMESHDS/libSMESHDS.la \
libSMESHControls.la \ libSMESHControls.la \
$(KERNEL_LDFLAGS) -lOpUtil -lSALOMELocalTrace -lSALOMEBasics \ $(KERNEL_LDFLAGS) -lOpUtil -lSALOMELocalTrace -lSALOMEBasics -lSalomeIDLKernel \
$(GEOM_LDFLAGS) -lGEOMAlgo \ $(GEOM_LDFLAGS) -lGEOMAlgo \
$(CAS_LDPATH) -lTKernel -lTKBRep -lTKG3d $(CAS_LDPATH) -lTKernel -lTKBRep -lTKG3d

View File

@ -57,7 +57,7 @@ libMeshDriverDAT_la_CPPFLAGS = \
libMeshDriverDAT_la_LDFLAGS = \ libMeshDriverDAT_la_LDFLAGS = \
../Driver/libMeshDriver.la \ ../Driver/libMeshDriver.la \
$(KERNEL_LDFLAGS) -lSALOMEBasics \ $(KERNEL_LDFLAGS) -lSALOMEBasics -lSalomeIDLKernel \
$(CAS_KERNEL) $(CAS_KERNEL)
DAT_Test_CPPFLAGS = \ DAT_Test_CPPFLAGS = \
@ -67,5 +67,5 @@ DAT_Test_LDADD = \
libMeshDriverDAT.la \ libMeshDriverDAT.la \
../Driver/libMeshDriver.la \ ../Driver/libMeshDriver.la \
../SMDS/libSMDS.la \ ../SMDS/libSMDS.la \
$(KERNEL_LDFLAGS) -lOpUtil -lSALOMELocalTrace -lSALOMEBasics $(KERNEL_LDFLAGS) -lOpUtil -lSALOMELocalTrace -lSALOMEBasics -lSalomeIDLKernel

View File

@ -81,6 +81,7 @@ MED_Test_LDADD = \
-lOpUtil \ -lOpUtil \
-lSALOMELocalTrace \ -lSALOMELocalTrace \
-lSALOMEBasics \ -lSALOMEBasics \
-lSalomeIDLKernel \
../MEDWrapper/Factory/libMEDWrapper.la \ ../MEDWrapper/Factory/libMEDWrapper.la \
../MEDWrapper/Base/libMEDWrapperBase.la \ ../MEDWrapper/Base/libMEDWrapperBase.la \
../MEDWrapper/V2_2/libMEDWrapper_V2_2.la \ ../MEDWrapper/V2_2/libMEDWrapper_V2_2.la \

View File

@ -70,6 +70,6 @@ STL_Test_LDADD = \
libMeshDriverSTL.la \ libMeshDriverSTL.la \
../Driver/libMeshDriver.la \ ../Driver/libMeshDriver.la \
../SMDS/libSMDS.la \ ../SMDS/libSMDS.la \
$(KERNEL_LDFLAGS) -lOpUtil -lSALOMELocalTrace -lSALOMEBasics \ $(KERNEL_LDFLAGS) -lOpUtil -lSALOMELocalTrace -lSALOMEBasics -lSalomeIDLKernel \
$(CAS_LDPATH) -lTKernel -lTKSTL -lTKTopAlgo -lTKMesh -lTKBO $(CAS_LDPATH) -lTKernel -lTKSTL -lTKTopAlgo -lTKMesh -lTKBO

View File

@ -82,4 +82,4 @@ UNV_Test_LDADD = \
libMeshDriverUNV.la \ libMeshDriverUNV.la \
../Driver/libMeshDriver.la \ ../Driver/libMeshDriver.la \
../SMDS/libSMDS.la \ ../SMDS/libSMDS.la \
$(KERNEL_LDFLAGS) -lOpUtil -lSALOMELocalTrace -lSALOMEBasics $(KERNEL_LDFLAGS) -lOpUtil -lSALOMELocalTrace -lSALOMEBasics -lSalomeIDLKernel

View File

@ -42,7 +42,7 @@ void UNV164::Read(std::ifstream& in_stream, TRecord& theUnitsRecord )
return; return;
string num_buf; string num_buf;
char line[theMaxLineLen]; char line[theMaxLineLen] = "";
in_stream >> theUnitsRecord.units_code; in_stream >> theUnitsRecord.units_code;
in_stream.readsome( line, 20 ); in_stream.readsome( line, 20 );

View File

@ -42,9 +42,16 @@ private:
int _nextFree; int _nextFree;
int _maxAvail; int _maxAvail;
int _chunkSize; int _chunkSize;
int _maxOccupied;
int _nbHoles;
int getNextFree() int getNextFree()
{ {
// Don't iterate on the _freeList if all the "holes"
// are filled. Go straight to the last occupied ID + 1
if ( _nbHoles == 0 )
return std::min(_maxOccupied + 1, _maxAvail);
for (int i = _nextFree; i < _maxAvail; i++) for (int i = _nextFree; i < _maxAvail; i++)
if (_freeList[i] == true) if (_freeList[i] == true)
{ {
@ -73,6 +80,8 @@ public:
_chunkSize = nblk; _chunkSize = nblk;
_nextFree = 0; _nextFree = 0;
_maxAvail = 0; _maxAvail = 0;
_maxOccupied = 0;
_nbHoles = 0;
_chunkList.clear(); _chunkList.clear();
_freeList.clear(); _freeList.clear();
} }
@ -103,6 +112,14 @@ public:
_freeList[_nextFree] = false; _freeList[_nextFree] = false;
obj = _chunkList[chunkId] + rank; // &_chunkList[chunkId][rank]; obj = _chunkList[chunkId] + rank; // &_chunkList[chunkId][rank];
} }
if (_nextFree < _maxOccupied)
{
_nbHoles-=1;
}
else
{
_maxOccupied = _nextFree;
}
//obj->init(); //obj->init();
return obj; return obj;
} }
@ -124,6 +141,8 @@ public:
_freeList[toFree] = true; _freeList[toFree] = true;
if (toFree < _nextFree) if (toFree < _nextFree)
_nextFree = toFree; _nextFree = toFree;
if (toFree < _maxOccupied)
_nbHoles += 1;
//obj->clean(); //obj->clean();
//checkDelete(i); compactage non fait //checkDelete(i); compactage non fait
break; break;
@ -134,6 +153,8 @@ public:
{ {
_nextFree = 0; _nextFree = 0;
_maxAvail = 0; _maxAvail = 0;
_maxOccupied = 0;
_nbHoles = 0;
for (size_t i = 0; i < _chunkList.size(); i++) for (size_t i = 0; i < _chunkList.size(); i++)
delete[] _chunkList[i]; delete[] _chunkList[i];
clearVector( _chunkList ); clearVector( _chunkList );

View File

@ -3370,6 +3370,7 @@ void SMDS_Mesh::RemoveFreeElement(const SMDS_MeshElement * elem)
myNodes[elemId] = 0; myNodes[elemId] = 0;
myInfo.myNbNodes--; myInfo.myNbNodes--;
((SMDS_MeshNode*) n)->SetPosition(SMDS_SpacePosition::originSpacePosition()); ((SMDS_MeshNode*) n)->SetPosition(SMDS_SpacePosition::originSpacePosition());
((SMDS_MeshNode*) n)->SMDS_MeshElement::init( -1, -1, -1 ); // avoid reuse
myNodePool->destroy(static_cast<SMDS_MeshNode*>(todest)); myNodePool->destroy(static_cast<SMDS_MeshNode*>(todest));
myNodeIDFactory->ReleaseID(elemId, vtkId); myNodeIDFactory->ReleaseID(elemId, vtkId);
} }

View File

@ -141,7 +141,7 @@ public:
* \param node - the node to check * \param node - the node to check
* \retval int - node index within the element, -1 if not found * \retval int - node index within the element, -1 if not found
*/ */
int GetNodeIndex( const SMDS_MeshNode* node ) const; virtual int GetNodeIndex( const SMDS_MeshNode* node ) const;
inline ShortType getMeshId() const { return myMeshId; } inline ShortType getMeshId() const { return myMeshId; }
inline LongType getshapeId() const { return myShapeId; } inline LongType getshapeId() const { return myShapeId; }

View File

@ -165,7 +165,7 @@ public:
cellList.push_back(vtkId); cellList.push_back(vtkId);
} }
} }
myCells = &cellList[0]; myCells = cellList.empty() ? 0 : &cellList[0];
myNcells = cellList.size(); myNcells = cellList.size();
//MESSAGE("myNcells="<<myNcells); //MESSAGE("myNcells="<<myNcells);
} }

View File

@ -65,7 +65,6 @@ protected:
SMDS_MeshNode(int id, int meshId, int shapeId = -1, double x=0, double y=0, double z=0); SMDS_MeshNode(int id, int meshId, int shapeId = -1, double x=0, double y=0, double z=0);
virtual ~SMDS_MeshNode(); virtual ~SMDS_MeshNode();
void init(int id, int meshId, int shapeId = -1, double x=0, double y=0, double z=0); void init(int id, int meshId, int shapeId = -1, double x=0, double y=0, double z=0);
inline void setVtkId(int vtkId) { myVtkID = vtkId; };
double* getCoord() const; double* getCoord() const;
void AddInverseElement(const SMDS_MeshElement * ME); void AddInverseElement(const SMDS_MeshElement * ME);
void RemoveInverseElement(const SMDS_MeshElement * parent); void RemoveInverseElement(const SMDS_MeshElement * parent);

View File

@ -285,8 +285,6 @@ void SMDS_UnstructuredGrid::compactGrid(std::vector<int>& idNodesOldToNew, int n
} }
newFaceLocations->Squeeze(); newFaceLocations->Squeeze();
newFaces->Squeeze(); newFaces->Squeeze();
newFaceLocations->Register(this);
newFaces->Register(this);
this->SetCells(newTypes, newLocations, newConnectivity, newFaceLocations, newFaces); this->SetCells(newTypes, newLocations, newConnectivity, newFaceLocations, newFaces);
newFaceLocations->Delete(); newFaceLocations->Delete();
newFaces->Delete(); newFaces->Delete();
@ -328,7 +326,7 @@ void SMDS_UnstructuredGrid::copyBloc(vtkUnsignedCharArray *newTypes,
int start, int start,
int end) int end)
{ {
MESSAGE("copyBloc " << alreadyCopied << " " << start << " " << end << " size: " << end - start << " total: " << alreadyCopied + end - start); //MESSAGE("copyBloc " << alreadyCopied << " " << start << " " << end << " size: " << end - start << " total: " << alreadyCopied + end - start);
for (int j = start; j < end; j++) for (int j = start; j < end; j++)
{ {
newTypes->SetValue(alreadyCopied, this->Types->GetValue(j)); newTypes->SetValue(alreadyCopied, this->Types->GetValue(j));

View File

@ -1507,17 +1507,21 @@ bool SMDS_VolumeTool::IsFreeFace( int faceIndex, const SMDS_MeshElement** otherV
const SMDS_MeshNode** nodes = GetFaceNodes( faceIndex ); const SMDS_MeshNode** nodes = GetFaceNodes( faceIndex );
// a set of facet nodes w/o medium ones and w/o nodes[0] // a set of facet nodes w/o medium ones and w/o nodes[0]
set< const SMDS_MeshNode* > nodeSet; set< const SMDS_MeshElement* > nodeSet;
const int di = myVolume->IsQuadratic() ? 2 : 1; const int di = myVolume->IsQuadratic() ? 2 : 1;
for ( int i = di; i < myFaceNbNodes; i += di ) for ( int i = di; i < myFaceNbNodes; i += di )
nodeSet.insert( nodes[i] ); nodeSet.insert( nodes[i] );
SMDS_ElemIteratorPtr eIt = nodes[0]->GetInverseElementIterator( SMDSAbs_Volume ); SMDS_ElemIteratorPtr eIt = nodes[0]->GetInverseElementIterator( SMDSAbs_Volume );
SMDS_ElemIteratorPtr nIt;
while ( eIt->more() ) { while ( eIt->more() ) {
const SMDS_MeshElement* vol = eIt->next(); const SMDS_MeshElement* vol = eIt->next();
if ( vol != myVolume ) { if ( vol != myVolume ) {
size_t nbShared = 0; size_t nbShared = 0;
SMDS_NodeIteratorPtr nIt = vol->nodeIterator(); if ( const SMDS_VtkVolume* v = dynamic_cast< const SMDS_VtkVolume* >( vol ))
nIt = v->uniqueNodesIterator();
else
nIt = vol->nodesIterator();
while ( nIt->more() ) while ( nIt->more() )
if (( nbShared += nodeSet.count( nIt->next() )) == nodeSet.size() ) if (( nbShared += nodeSet.count( nIt->next() )) == nodeSet.size() )
{ {

View File

@ -161,6 +161,22 @@ SMDS_VtkFace::GetNode(const int ind) const
return SMDS_Mesh::_meshList[myMeshId]->FindNodeVtk( pts[ ind ]); return SMDS_Mesh::_meshList[myMeshId]->FindNodeVtk( pts[ ind ]);
} }
/*!
* \brief Check if a node belongs to the element
* \param node - the node to check
* \retval int - node index within the element, -1 if not found
*/
int SMDS_VtkFace::GetNodeIndex( const SMDS_MeshNode* node ) const
{
vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid();
vtkIdType npts, *pts;
grid->GetCellPoints( this->myVtkID, npts, pts );
for ( vtkIdType i = 0; i < npts; ++i )
if ( pts[i] == node->getVtkId() )
return i;
return -1;
}
bool SMDS_VtkFace::IsQuadratic() const bool SMDS_VtkFace::IsQuadratic() const
{ {
vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid(); vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid();

View File

@ -47,6 +47,7 @@ public:
virtual SMDSAbs_EntityType GetEntityType() const; virtual SMDSAbs_EntityType GetEntityType() const;
virtual SMDSAbs_GeometryType GetGeomType() const; virtual SMDSAbs_GeometryType GetGeomType() const;
virtual const SMDS_MeshNode* GetNode(const int ind) const; virtual const SMDS_MeshNode* GetNode(const int ind) const;
virtual int GetNodeIndex( const SMDS_MeshNode* node ) const;
virtual bool IsQuadratic() const; virtual bool IsQuadratic() const;
virtual bool IsPoly() const; virtual bool IsPoly() const;

View File

@ -448,6 +448,41 @@ const SMDS_MeshNode* SMDS_VtkVolume::GetNode(const int ind) const
const std::vector<int>& interlace = SMDS_MeshCell::fromVtkOrder( VTKCellType( aVtkType )); const std::vector<int>& interlace = SMDS_MeshCell::fromVtkOrder( VTKCellType( aVtkType ));
return SMDS_Mesh::_meshList[myMeshId]->FindNodeVtk( pts[ interlace.empty() ? ind : interlace[ind]] ); return SMDS_Mesh::_meshList[myMeshId]->FindNodeVtk( pts[ interlace.empty() ? ind : interlace[ind]] );
} }
/*!
* \brief Check if a node belongs to the element
* \param node - the node to check
* \retval int - node index within the element, -1 if not found
*/
int SMDS_VtkVolume::GetNodeIndex( const SMDS_MeshNode* node ) const
{
vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid();
const vtkIdType aVtkType = grid->GetCellType(this->myVtkID);
if ( aVtkType == VTK_POLYHEDRON)
{
vtkIdType nFaces = 0;
vtkIdType* ptIds = 0;
grid->GetFaceStream(this->myVtkID, nFaces, ptIds);
int id = 0;
for (int iF = 0; iF < nFaces; iF++)
{
int nodesInFace = ptIds[id];
for ( vtkIdType i = 0; i < nodesInFace; ++i )
if ( ptIds[id+i+1] == node->getVtkId() )
return id+i-iF;
id += (nodesInFace + 1);
}
return -1;
}
vtkIdType npts, *pts;
grid->GetCellPoints( this->myVtkID, npts, pts );
for ( vtkIdType i = 0; i < npts; ++i )
if ( pts[i] == node->getVtkId() )
{
const std::vector<int>& interlace = SMDS_MeshCell::toVtkOrder( VTKCellType( aVtkType ));
return interlace.empty() ? i : interlace[i];
}
return -1;
}
bool SMDS_VtkVolume::IsQuadratic() const bool SMDS_VtkVolume::IsQuadratic() const
{ {

View File

@ -56,6 +56,7 @@ public:
virtual SMDSAbs_EntityType GetEntityType() const; virtual SMDSAbs_EntityType GetEntityType() const;
virtual SMDSAbs_GeometryType GetGeomType() const; virtual SMDSAbs_GeometryType GetGeomType() const;
virtual const SMDS_MeshNode* GetNode(const int ind) const; virtual const SMDS_MeshNode* GetNode(const int ind) const;
virtual int GetNodeIndex( const SMDS_MeshNode* node ) const;
virtual bool IsQuadratic() const; virtual bool IsQuadratic() const;
virtual bool IsPoly() const; virtual bool IsPoly() const;
virtual bool IsMediumNode(const SMDS_MeshNode* node) const; virtual bool IsMediumNode(const SMDS_MeshNode* node) const;

View File

@ -38,6 +38,7 @@
#include "SMESH_Gen.hxx" #include "SMESH_Gen.hxx"
#include "SMESH_HypoFilter.hxx" #include "SMESH_HypoFilter.hxx"
#include "SMESH_Mesh.hxx" #include "SMESH_Mesh.hxx"
#include "SMESH_MeshAlgos.hxx"
#include "SMESH_TypeDefs.hxx" #include "SMESH_TypeDefs.hxx"
#include "SMESH_subMesh.hxx" #include "SMESH_subMesh.hxx"
@ -71,6 +72,8 @@
#include <algorithm> #include <algorithm>
#include <limits> #include <limits>
#include "SMESH_ProxyMesh.hxx"
#include "SMESH_MesherHelper.hxx"
using namespace std; using namespace std;
@ -526,6 +529,57 @@ GeomAbs_Shape SMESH_Algo::Continuity(TopoDS_Edge E1,
return GeomAbs_C0; return GeomAbs_C0;
} }
//================================================================================
/*!
* \brief Return true if an edge can be considered straight
*/
//================================================================================
bool SMESH_Algo::isStraight( const TopoDS_Edge & E,
const bool degenResult)
{
{
double f,l;
if ( BRep_Tool::Curve( E, f, l ).IsNull())
return degenResult;
}
BRepAdaptor_Curve curve( E );
switch( curve.GetType() )
{
case GeomAbs_Line:
return true;
case GeomAbs_Circle:
case GeomAbs_Ellipse:
case GeomAbs_Hyperbola:
case GeomAbs_Parabola:
return false;
// case GeomAbs_BezierCurve:
// case GeomAbs_BSplineCurve:
// case GeomAbs_OtherCurve:
default:;
}
const double f = curve.FirstParameter();
const double l = curve.LastParameter();
const gp_Pnt pf = curve.Value( f );
const gp_Pnt pl = curve.Value( l );
const gp_Vec v1( pf, pl );
const double v1Len = v1.Magnitude();
if ( v1Len < std::numeric_limits< double >::min() )
return false; // E seems closed
const double tol = Min( 10 * curve.Tolerance(), v1Len * 1e-2 );
const int nbSamples = 7;
for ( int i = 0; i < nbSamples; ++i )
{
const double r = ( i + 1 ) / nbSamples;
const gp_Pnt pi = curve.Value( f * r + l * ( 1 - r ));
const gp_Vec vi( pf, pi );
const double h = 0.5 * v1.Crossed( vi ).Magnitude() / v1Len;
if ( h > tol )
return false;
}
return true;
}
//================================================================================ //================================================================================
/*! /*!
* \brief Return the node built on a vertex * \brief Return the node built on a vertex
@ -848,3 +902,206 @@ int SMESH_Algo::NumberOfPoints(SMESH_Mesh& aMesh, const TopoDS_Wire& W)
} }
//================================================================================
/*!
* Method in which an algorithm generating a structured mesh
* fixes positions of in-face nodes after there movement
* due to insertion of viscous layers.
*/
//================================================================================
bool SMESH_2D_Algo::FixInternalNodes(const SMESH_ProxyMesh& mesh,
const TopoDS_Face& face)
{
const SMESHDS_SubMesh* smDS = mesh.GetSubMesh(face);
if ( !smDS || smDS->NbElements() < 1 )
return false;
SMESH_MesherHelper helper( *mesh.GetMesh() );
// get all faces from a proxy sub-mesh
typedef SMDS_StdIterator< const SMDS_MeshElement*, SMDS_ElemIteratorPtr > TIterator;
TIDSortedElemSet allFaces( TIterator( smDS->GetElements() ), TIterator() );
TIDSortedElemSet avoidSet, firstRowQuads;
// indices of nodes to pass to a neighbour quad using SMESH_MeshAlgos::FindFaceInSet()
int iN1, iN2;
// get two first rows of nodes by passing through the first row of faces
vector< vector< const SMDS_MeshNode* > > nodeRows;
int iRow1 = 0, iRow2 = 1;
const SMDS_MeshElement* quad;
{
// look for a corner quadrangle and it's corner node
const SMDS_MeshElement* cornerQuad = 0;
int cornerNodeInd = -1;
SMDS_ElemIteratorPtr fIt = smDS->GetElements();
while ( !cornerQuad && fIt->more() )
{
cornerQuad = fIt->next();
if ( cornerQuad->NbCornerNodes() != 4 )
return false;
SMDS_NodeIteratorPtr nIt = cornerQuad->nodeIterator();
for ( int i = 0; i < 4; ++i )
{
int nbInverseQuads = 0;
SMDS_ElemIteratorPtr fIt = nIt->next()->GetInverseElementIterator(SMDSAbs_Face);
while ( fIt->more() )
nbInverseQuads += allFaces.count( fIt->next() );
if ( nbInverseQuads == 1 )
cornerNodeInd = i, i = 4;
}
if ( cornerNodeInd < 0 )
cornerQuad = 0;
}
if ( !cornerQuad || cornerNodeInd < 0 )
return false;
iN1 = helper.WrapIndex( cornerNodeInd + 1, 4 );
iN2 = helper.WrapIndex( cornerNodeInd + 2, 4 );
int iN3 = helper.WrapIndex( cornerNodeInd + 3, 4 );
nodeRows.resize(2);
nodeRows[iRow1].push_back( cornerQuad->GetNode( cornerNodeInd ));
nodeRows[iRow1].push_back( cornerQuad->GetNode( iN1 ));
nodeRows[iRow2].push_back( cornerQuad->GetNode( iN3 ));
nodeRows[iRow2].push_back( cornerQuad->GetNode( iN2 ));
firstRowQuads.insert( cornerQuad );
// pass through the rest quads in a face row
quad = cornerQuad;
while ( quad )
{
avoidSet.clear();
avoidSet.insert( quad );
if (( quad = SMESH_MeshAlgos::FindFaceInSet( nodeRows[iRow1].back(),
nodeRows[iRow2].back(),
allFaces, avoidSet, &iN1, &iN2)))
{
nodeRows[iRow1].push_back( quad->GetNode( helper.WrapIndex( iN2 + 2, 4 )));
nodeRows[iRow2].push_back( quad->GetNode( helper.WrapIndex( iN1 + 2, 4 )));
if ( quad->NbCornerNodes() != 4 )
return false;
}
}
if ( nodeRows[iRow1].size() < 3 )
return true; // there is nothing to fix
}
nodeRows.reserve( smDS->NbElements() / nodeRows[iRow1].size() );
// get the rest node rows
while ( true )
{
++iRow1, ++iRow2;
// get the first quad in the next face row
if (( quad = SMESH_MeshAlgos::FindFaceInSet( nodeRows[iRow1][0],
nodeRows[iRow1][1],
allFaces, /*avoid=*/firstRowQuads,
&iN1, &iN2)))
{
if ( quad->NbCornerNodes() != 4 )
return false;
nodeRows.resize( iRow2+1 );
nodeRows[iRow2].push_back( quad->GetNode( helper.WrapIndex( iN2 + 2, 4 )));
nodeRows[iRow2].push_back( quad->GetNode( helper.WrapIndex( iN1 + 2, 4 )));
firstRowQuads.insert( quad );
}
else
{
break; // no more rows
}
// pass through the rest quads in a face row
while ( quad )
{
avoidSet.clear();
avoidSet.insert( quad );
if (( quad = SMESH_MeshAlgos::FindFaceInSet( nodeRows[iRow1][ nodeRows[iRow2].size()-1 ],
nodeRows[iRow2].back(),
allFaces, avoidSet, &iN1, &iN2)))
{
if ( quad->NbCornerNodes() != 4 )
return false;
nodeRows[iRow2].push_back( quad->GetNode( helper.WrapIndex( iN1 + 2, 4 )));
}
}
if ( nodeRows[iRow1].size() != nodeRows[iRow2].size() )
return false;
}
if ( nodeRows.size() < 3 )
return true; // there is nothing to fix
// get params of the first (bottom) and last (top) node rows
UVPtStructVec uvB( nodeRows[0].size() ), uvT( nodeRows[0].size() );
for ( int isBot = 0; isBot < 2; ++isBot )
{
UVPtStructVec & uvps = isBot ? uvB : uvT;
vector< const SMDS_MeshNode* >& nodes = nodeRows[ isBot ? 0 : nodeRows.size()-1 ];
for ( size_t i = 0; i < nodes.size(); ++i )
{
uvps[i].node = nodes[i];
gp_XY uv = helper.GetNodeUV( face, uvps[i].node );
uvps[i].u = uv.Coord(1);
uvps[i].v = uv.Coord(2);
uvps[i].x = 0;
}
// calculate x (normalized param)
for ( size_t i = 1; i < nodes.size(); ++i )
uvps[i].x = uvps[i-1].x + SMESH_TNodeXYZ( uvps[i-1].node ).Distance( uvps[i].node );
for ( size_t i = 1; i < nodes.size(); ++i )
uvps[i].x /= uvps.back().x;
}
// get params of the left and right node rows
UVPtStructVec uvL( nodeRows.size() ), uvR( nodeRows.size() );
for ( int isLeft = 0; isLeft < 2; ++isLeft )
{
UVPtStructVec & uvps = isLeft ? uvL : uvR;
const int iCol = isLeft ? 0 : nodeRows[0].size() - 1;
for ( size_t i = 0; i < nodeRows.size(); ++i )
{
uvps[i].node = nodeRows[i][iCol];
gp_XY uv = helper.GetNodeUV( face, uvps[i].node );
uvps[i].u = uv.Coord(1);
uvps[i].v = uv.Coord(2);
uvps[i].y = 0;
}
// calculate y (normalized param)
for ( size_t i = 1; i < nodeRows.size(); ++i )
uvps[i].y = uvps[i-1].y + SMESH_TNodeXYZ( uvps[i-1].node ).Distance( uvps[i].node );
for ( size_t i = 1; i < nodeRows.size(); ++i )
uvps[i].y /= uvps.back().y;
}
// update node coordinates
SMESHDS_Mesh* meshDS = mesh.GetMeshDS();
Handle(Geom_Surface) S = BRep_Tool::Surface( face );
gp_XY a0 ( uvB.front().u, uvB.front().v );
gp_XY a1 ( uvB.back().u, uvB.back().v );
gp_XY a2 ( uvT.back().u, uvT.back().v );
gp_XY a3 ( uvT.front().u, uvT.front().v );
for ( size_t iRow = 1; iRow < nodeRows.size()-1; ++iRow )
{
gp_XY p1 ( uvR[ iRow ].u, uvR[ iRow ].v );
gp_XY p3 ( uvL[ iRow ].u, uvL[ iRow ].v );
const double y0 = uvL[ iRow ].y;
const double y1 = uvR[ iRow ].y;
for ( size_t iCol = 1; iCol < nodeRows[0].size()-1; ++iCol )
{
gp_XY p0 ( uvB[ iCol ].u, uvB[ iCol ].v );
gp_XY p2 ( uvT[ iCol ].u, uvT[ iCol ].v );
const double x0 = uvB[ iCol ].x;
const double x1 = uvT[ iCol ].x;
double x = (x0 + y0 * (x1 - x0)) / (1 - (y1 - y0) * (x1 - x0));
double y = y0 + x * (y1 - y0);
gp_XY uv = helper.calcTFI( x, y, a0,a1,a2,a3, p0,p1,p2,p3 );
gp_Pnt p = S->Value( uv.Coord(1), uv.Coord(2));
const SMDS_MeshNode* n = nodeRows[iRow][iCol];
meshDS->MoveNode( n, p.X(), p.Y(), p.Z() );
if ( SMDS_FacePosition* pos = dynamic_cast< SMDS_FacePosition*>( n->GetPosition() ))
pos->SetParameters( uv.Coord(1), uv.Coord(2) );
}
}
return true;
}

View File

@ -52,6 +52,7 @@ class SMESH_Gen;
class SMESH_HypoFilter; class SMESH_HypoFilter;
class SMESH_Mesh; class SMESH_Mesh;
class SMESH_MesherHelper; class SMESH_MesherHelper;
class SMESH_ProxyMesh;
class SMESH_subMesh; class SMESH_subMesh;
class TopoDS_Face; class TopoDS_Face;
class TopoDS_Shape; class TopoDS_Shape;
@ -356,6 +357,10 @@ public:
static bool IsContinuous(const TopoDS_Edge & E1, const TopoDS_Edge & E2) { static bool IsContinuous(const TopoDS_Edge & E1, const TopoDS_Edge & E2) {
return ( Continuity( E1, E2 ) >= GeomAbs_G1 ); return ( Continuity( E1, E2 ) >= GeomAbs_G1 );
} }
/*!
* \brief Return true if an edge can be considered straight
*/
static bool isStraight( const TopoDS_Edge & E, const bool degenResult=false );
/*! /*!
* \brief Return the node built on a vertex * \brief Return the node built on a vertex
@ -445,6 +450,13 @@ class SMESH_EXPORT SMESH_2D_Algo: public SMESH_Algo
{ {
public: public:
SMESH_2D_Algo(int hypId, int studyId, SMESH_Gen* gen); SMESH_2D_Algo(int hypId, int studyId, SMESH_Gen* gen);
/*!
* \brief Method in which an algorithm generating a structured mesh
* fixes positions of in-face nodes after there movement
* due to insertion of viscous layers.
*/
virtual bool FixInternalNodes(const SMESH_ProxyMesh& mesh,
const TopoDS_Face& face);
}; };
class SMESH_EXPORT SMESH_3D_Algo: public SMESH_Algo class SMESH_EXPORT SMESH_3D_Algo: public SMESH_Algo

View File

@ -66,6 +66,8 @@
#include <TopTools_MapOfShape.hxx> #include <TopTools_MapOfShape.hxx>
#include <TopoDS_Iterator.hxx> #include <TopoDS_Iterator.hxx>
#include "SMESH_TryCatch.hxx" // include after OCCT headers!
#include "Utils_ExceptHandlers.hxx" #include "Utils_ExceptHandlers.hxx"
#include <boost/thread/thread.hpp> #include <boost/thread/thread.hpp>
@ -1259,7 +1261,7 @@ void SMESH_Mesh::ExportMED(const char * file,
bool theAutoDimension) bool theAutoDimension)
throw(SALOME_Exception) throw(SALOME_Exception)
{ {
Unexpect aCatch(SalomeException); SMESH_TRY;
DriverMED_W_SMESHDS_Mesh myWriter; DriverMED_W_SMESHDS_Mesh myWriter;
myWriter.SetFile ( file, MED::EVersion(theVersion) ); myWriter.SetFile ( file, MED::EVersion(theVersion) );
@ -1306,6 +1308,8 @@ void SMESH_Mesh::ExportMED(const char * file,
} }
// Perform export // Perform export
myWriter.Perform(); myWriter.Perform();
SMESH_CATCH( SMESH::throwSalomeEx );
} }
//================================================================================ //================================================================================
@ -1486,12 +1490,16 @@ double SMESH_Mesh::GetComputeProgress() const
currentSubIds.Add( smToCompute[i]->GetId() ); currentSubIds.Add( smToCompute[i]->GetId() );
} }
double rate = algo->GetProgress(); double rate = algo->GetProgress();
if ( !( 0. < rate && rate < 1.001 )) if ( 0. < rate && rate < 1.001 )
{
computedCost += rate * ( algoDoneCost + algoNotDoneCost );
}
else
{ {
rate = algo->GetProgressByTic(); rate = algo->GetProgressByTic();
computedCost += algoDoneCost + rate * algoNotDoneCost;
} }
// cout << "rate: "<<rate << " algoNotDoneCost: " << algoNotDoneCost << endl; // cout << "rate: "<<rate << " algoNotDoneCost: " << algoNotDoneCost << endl;
computedCost += algoDoneCost + rate * algoNotDoneCost;
} }
// get cost of already treated sub-meshes // get cost of already treated sub-meshes

View File

@ -5144,7 +5144,7 @@ SMESH_MeshEditor::ExtrusionAlongTrack (TIDSortedElemSet & theElements,
const TopoDS_Shape& aS = theTrack->GetShapeToMesh(); const TopoDS_Shape& aS = theTrack->GetShapeToMesh();
if( aS == SMESH_Mesh::PseudoShape() ) { if ( !theTrack->HasShapeToMesh() ) {
//Mesh without shape //Mesh without shape
const SMDS_MeshNode* currentNode = NULL; const SMDS_MeshNode* currentNode = NULL;
const SMDS_MeshNode* prevNode = theN1; const SMDS_MeshNode* prevNode = theN1;
@ -5267,16 +5267,8 @@ SMESH_MeshEditor::ExtrusionAlongTrack (TIDSortedElemSet & theElements,
if ( BRep_Tool::Degenerated( aTrackEdge ) ) if ( BRep_Tool::Degenerated( aTrackEdge ) )
return EXTR_BAD_PATH_SHAPE; return EXTR_BAD_PATH_SHAPE;
TopExp::Vertices( aTrackEdge, aV1, aV2 ); TopExp::Vertices( aTrackEdge, aV1, aV2 );
const SMDS_MeshNode* aN1 = 0; const SMDS_MeshNode* aN1 = SMESH_Algo::VertexNode( aV1, pMeshDS );
const SMDS_MeshNode* aN2 = 0; const SMDS_MeshNode* aN2 = SMESH_Algo::VertexNode( aV2, pMeshDS );
if ( theTrack->GetSubMesh( aV1 ) && theTrack->GetSubMesh( aV1 )->GetSubMeshDS() ) {
aItN = theTrack->GetSubMesh( aV1 )->GetSubMeshDS()->GetNodes();
aN1 = aItN->next();
}
if ( theTrack->GetSubMesh( aV2 ) && theTrack->GetSubMesh( aV2 )->GetSubMeshDS() ) {
aItN = theTrack->GetSubMesh( aV2 )->GetSubMeshDS()->GetNodes();
aN2 = aItN->next();
}
// starting node must be aN1 or aN2 // starting node must be aN1 or aN2
if ( !( aN1 == theN1 || aN2 == theN1 ) ) if ( !( aN1 == theN1 || aN2 == theN1 ) )
return EXTR_BAD_STARTING_NODE; return EXTR_BAD_STARTING_NODE;
@ -5324,17 +5316,8 @@ SMESH_MeshEditor::ExtrusionAlongTrack (TIDSortedElemSet & theElements,
if ( aVprev.IsNull() ) { if ( aVprev.IsNull() ) {
// if previous vertex is not yet defined, it means that we in the beginning of wire // if previous vertex is not yet defined, it means that we in the beginning of wire
// and we have to find initial vertex corresponding to starting node theN1 // and we have to find initial vertex corresponding to starting node theN1
const SMDS_MeshNode* aN1 = 0; const SMDS_MeshNode* aN1 = SMESH_Algo::VertexNode( aV1, pMeshDS );
const SMDS_MeshNode* aN2 = 0; const SMDS_MeshNode* aN2 = SMESH_Algo::VertexNode( aV2, pMeshDS );
if ( locTrack->GetFather()->GetSubMesh(aV1) && locTrack->GetFather()->GetSubMesh(aV1)->GetSubMeshDS() ) {
aItN = locTrack->GetFather()->GetSubMesh(aV1)->GetSubMeshDS()->GetNodes();
aN1 = aItN->next();
}
if ( locTrack->GetFather()->GetSubMesh(aV2) && locTrack->GetFather()->GetSubMesh(aV2)->GetSubMeshDS() ) {
aItN = locTrack->GetFather()->GetSubMesh(aV2)->GetSubMeshDS()->GetNodes();
aN2 = aItN->next();
}
// starting node must be aN1 or aN2 // starting node must be aN1 or aN2
aN1isOK = ( aN1 && aN1 == theN1 ); aN1isOK = ( aN1 && aN1 == theN1 );
aN2isOK = ( aN2 && aN2 == theN1 ); aN2isOK = ( aN2 && aN2 == theN1 );
@ -5368,27 +5351,21 @@ SMESH_MeshEditor::ExtrusionAlongTrack (TIDSortedElemSet & theElements,
} }
} }
list< list<SMESH_MeshEditor_PathPoint> >::iterator itLLPP = LLPPs.begin(); list< list<SMESH_MeshEditor_PathPoint> >::iterator itLLPP = LLPPs.begin();
list<SMESH_MeshEditor_PathPoint> firstList = *itLLPP; list<SMESH_MeshEditor_PathPoint>& firstList = *itLLPP;
list<SMESH_MeshEditor_PathPoint>::iterator itPP = firstList.begin(); fullList.splice( fullList.end(), firstList );
for(; itPP!=firstList.end(); itPP++) {
fullList.push_back( *itPP );
}
SMESH_MeshEditor_PathPoint PP1 = fullList.back(); SMESH_MeshEditor_PathPoint PP1 = fullList.back();
fullList.pop_back(); fullList.pop_back();
itLLPP++; itLLPP++;
for(; itLLPP!=LLPPs.end(); itLLPP++) { for(; itLLPP!=LLPPs.end(); itLLPP++) {
list<SMESH_MeshEditor_PathPoint> currList = *itLLPP; list<SMESH_MeshEditor_PathPoint>& currList = *itLLPP;
itPP = currList.begin();
SMESH_MeshEditor_PathPoint PP2 = currList.front(); SMESH_MeshEditor_PathPoint PP2 = currList.front();
gp_Dir D1 = PP1.Tangent(); gp_Dir D1 = PP1.Tangent();
gp_Dir D2 = PP2.Tangent(); gp_Dir D2 = PP2.Tangent();
gp_Dir Dnew( ( D1.XYZ() + D2.XYZ() ) / 2 ); gp_Dir Dnew( ( D1.XYZ() + D2.XYZ() ) / 2 );
PP1.SetTangent(Dnew); PP1.SetTangent(Dnew);
fullList.push_back(PP1); fullList.push_back(PP1);
itPP++; fullList.splice( fullList.end(), currList, ++currList.begin(), currList.end() );
for(; itPP!=currList.end(); itPP++) {
fullList.push_back( *itPP );
}
PP1 = fullList.back(); PP1 = fullList.back();
fullList.pop_back(); fullList.pop_back();
} }
@ -5474,54 +5451,34 @@ SMESH_MeshEditor::MakeExtrElements(TIDSortedElemSet& theElements,
const gp_Pnt& theRefPoint, const gp_Pnt& theRefPoint,
const bool theMakeGroups) const bool theMakeGroups)
{ {
MESSAGE("MakeExtrElements"); const int aNbTP = fullList.size();
//cout<<"MakeExtrElements fullList.size() = "<<fullList.size()<<endl;
int aNbTP = fullList.size();
vector<SMESH_MeshEditor_PathPoint> aPPs(aNbTP);
// Angles // Angles
if( theHasAngles && theAngles.size()>0 && theLinearVariation ) { if( theHasAngles && !theAngles.empty() && theLinearVariation )
LinearAngleVariation(aNbTP-1, theAngles); LinearAngleVariation(aNbTP-1, theAngles);
}
vector<double> aAngles( aNbTP );
int j = 0;
for(; j<aNbTP; ++j) {
aAngles[j] = 0.;
}
if ( theHasAngles ) {
double anAngle;;
std::list<double>::iterator aItD = theAngles.begin();
for ( j=1; (aItD != theAngles.end()) && (j<aNbTP); ++aItD, ++j ) {
anAngle = *aItD;
aAngles[j] = anAngle;
}
}
// fill vector of path points with angles // fill vector of path points with angles
//aPPs.resize(fullList.size()); vector<SMESH_MeshEditor_PathPoint> aPPs;
j = -1;
list<SMESH_MeshEditor_PathPoint>::iterator itPP = fullList.begin(); list<SMESH_MeshEditor_PathPoint>::iterator itPP = fullList.begin();
for(; itPP!=fullList.end(); itPP++) { list<double>::iterator itAngles = theAngles.begin();
j++; aPPs.push_back( *itPP++ );
SMESH_MeshEditor_PathPoint PP = *itPP; for( ; itPP != fullList.end(); itPP++) {
PP.SetAngle(aAngles[j]); aPPs.push_back( *itPP );
aPPs[j] = PP; if ( theHasAngles && itAngles != theAngles.end() )
aPPs.back().SetAngle( *itAngles );
} }
TNodeOfNodeListMap mapNewNodes; TNodeOfNodeListMap mapNewNodes;
TElemOfVecOfNnlmiMap mapElemNewNodes; TElemOfVecOfNnlmiMap mapElemNewNodes;
TElemOfElemListMap newElemsMap; TElemOfElemListMap newElemsMap;
TIDSortedElemSet::iterator itElem; TIDSortedElemSet::iterator itElem;
double aX, aY, aZ;
int aNb;
SMDSAbs_ElementType aTypeE;
// source elements for each generated one // source elements for each generated one
SMESH_SequenceOfElemPtr srcElems, srcNodes; SMESH_SequenceOfElemPtr srcElems, srcNodes;
// 3. Center of rotation aV0 // 3. Center of rotation aV0
gp_Pnt aV0 = theRefPoint; gp_Pnt aV0 = theRefPoint;
gp_XYZ aGC; if ( !theHasRefPoint )
if ( !theHasRefPoint ) { {
aNb = 0; gp_XYZ aGC( 0.,0.,0. );
aGC.SetCoord( 0.,0.,0. ); TIDSortedElemSet newNodes;
itElem = theElements.begin(); itElem = theElements.begin();
for ( ; itElem != theElements.end(); itElem++ ) { for ( ; itElem != theElements.end(); itElem++ ) {
@ -5529,25 +5486,14 @@ SMESH_MeshEditor::MakeExtrElements(TIDSortedElemSet& theElements,
SMDS_ElemIteratorPtr itN = elem->nodesIterator(); SMDS_ElemIteratorPtr itN = elem->nodesIterator();
while ( itN->more() ) { while ( itN->more() ) {
const SMDS_MeshNode* node = static_cast<const SMDS_MeshNode*>( itN->next() ); const SMDS_MeshElement* node = itN->next();
aX = node->X(); if ( newNodes.insert( node ).second )
aY = node->Y(); aGC += SMESH_TNodeXYZ( node );
aZ = node->Z();
if ( mapNewNodes.find( node ) == mapNewNodes.end() ) {
list<const SMDS_MeshNode*> aLNx;
mapNewNodes[node] = aLNx;
//
gp_XYZ aXYZ( aX, aY, aZ );
aGC += aXYZ;
++aNb;
} }
} }
} aGC /= newNodes.size();
aGC /= aNb;
aV0.SetXYZ( aGC ); aV0.SetXYZ( aGC );
} // if (!theHasRefPoint) { } // if (!theHasRefPoint) {
mapNewNodes.clear();
// 4. Processing the elements // 4. Processing the elements
SMESHDS_Mesh* aMesh = GetMeshDS(); SMESHDS_Mesh* aMesh = GetMeshDS();
@ -5555,7 +5501,7 @@ SMESH_MeshEditor::MakeExtrElements(TIDSortedElemSet& theElements,
for ( itElem = theElements.begin(); itElem != theElements.end(); itElem++ ) { for ( itElem = theElements.begin(); itElem != theElements.end(); itElem++ ) {
// check element type // check element type
const SMDS_MeshElement* elem = *itElem; const SMDS_MeshElement* elem = *itElem;
aTypeE = elem->GetType(); SMDSAbs_ElementType aTypeE = elem->GetType();
if ( !elem || ( aTypeE != SMDSAbs_Face && aTypeE != SMDSAbs_Edge ) ) if ( !elem || ( aTypeE != SMDSAbs_Face && aTypeE != SMDSAbs_Edge ) )
continue; continue;
@ -5577,8 +5523,6 @@ SMESH_MeshEditor::MakeExtrElements(TIDSortedElemSet& theElements,
list<const SMDS_MeshNode*>& listNewNodes = nIt->second; list<const SMDS_MeshNode*>& listNewNodes = nIt->second;
// make new nodes // make new nodes
aX = node->X(); aY = node->Y(); aZ = node->Z();
Standard_Real aAngle1x, aAngleT1T0, aTolAng; Standard_Real aAngle1x, aAngleT1T0, aTolAng;
gp_Pnt aP0x, aP1x, aPN0, aPN1, aV0x, aV1x; gp_Pnt aP0x, aP1x, aPN0, aPN1, aV0x, aV1x;
gp_Ax1 anAx1, anAxT1T0; gp_Ax1 anAx1, anAxT1T0;
@ -5587,14 +5531,14 @@ SMESH_MeshEditor::MakeExtrElements(TIDSortedElemSet& theElements,
aTolAng=1.e-4; aTolAng=1.e-4;
aV0x = aV0; aV0x = aV0;
aPN0.SetCoord(aX, aY, aZ); aPN0 = SMESH_TNodeXYZ( node );
const SMESH_MeshEditor_PathPoint& aPP0 = aPPs[0]; const SMESH_MeshEditor_PathPoint& aPP0 = aPPs[0];
aP0x = aPP0.Pnt(); aP0x = aPP0.Pnt();
aDT0x= aPP0.Tangent(); aDT0x= aPP0.Tangent();
//cout<<"j = 0 PP: Pnt("<<aP0x.X()<<","<<aP0x.Y()<<","<<aP0x.Z()<<")"<<endl; //cout<<"j = 0 PP: Pnt("<<aP0x.X()<<","<<aP0x.Y()<<","<<aP0x.Z()<<")"<<endl;
for ( j = 1; j < aNbTP; ++j ) { for ( int j = 1; j < aNbTP; ++j ) {
const SMESH_MeshEditor_PathPoint& aPP1 = aPPs[j]; const SMESH_MeshEditor_PathPoint& aPP1 = aPPs[j];
aP1x = aPP1.Pnt(); aP1x = aPP1.Pnt();
aDT1x = aPP1.Tangent(); aDT1x = aPP1.Tangent();
@ -5641,10 +5585,7 @@ SMESH_MeshEditor::MakeExtrElements(TIDSortedElemSet& theElements,
srcNodes.Append( node ); srcNodes.Append( node );
listNewNodes.push_back( newNode ); listNewNodes.push_back( newNode );
} }
aX = aPN1.X(); const SMDS_MeshNode* newNode = aMesh->AddNode( aPN1.X(), aPN1.Y(), aPN1.Z() );
aY = aPN1.Y();
aZ = aPN1.Z();
const SMDS_MeshNode* newNode = aMesh->AddNode( aX, aY, aZ );
myLastCreatedNodes.Append(newNode); myLastCreatedNodes.Append(newNode);
srcNodes.Append( node ); srcNodes.Append( node );
listNewNodes.push_back( newNode ); listNewNodes.push_back( newNode );
@ -8505,12 +8446,21 @@ void SMESH_MeshEditor::ConvertToQuadratic(const bool theForce3d, const bool theT
if ( !volume ) continue; if ( !volume ) continue;
const SMDSAbs_EntityType type = volume->GetEntityType(); const SMDSAbs_EntityType type = volume->GetEntityType();
if (( theToBiQuad && type == SMDSEntity_TriQuad_Hexa ) || if ( volume->IsQuadratic() )
( !theToBiQuad && type == SMDSEntity_Quad_Hexa )) {
bool alreadyOK;
switch ( type )
{
case SMDSEntity_Quad_Hexa: alreadyOK = !theToBiQuad; break;
case SMDSEntity_TriQuad_Hexa: alreadyOK = theToBiQuad; break;
default: alreadyOK = true;
}
if ( alreadyOK )
{ {
aHelper.AddTLinks( static_cast< const SMDS_MeshVolume* >( volume )); aHelper.AddTLinks( static_cast< const SMDS_MeshVolume* >( volume ));
continue; continue;
} }
}
const int id = volume->GetID(); const int id = volume->GetID();
vector<const SMDS_MeshNode *> nodes (volume->begin_nodes(), volume->end_nodes()); vector<const SMDS_MeshNode *> nodes (volume->begin_nodes(), volume->end_nodes());
if ( type == SMDSEntity_Polyhedra ) if ( type == SMDSEntity_Polyhedra )
@ -9950,12 +9900,14 @@ namespace {
//================================================================================ //================================================================================
/*! /*!
\brief Identify the elements that will be affected by node duplication (actual duplication is not performed. \brief Identify the elements that will be affected by node duplication (actual duplication is not performed).
This method is the first step of DoubleNodeElemGroupsInRegion. This method is the first step of DoubleNodeElemGroupsInRegion.
\param theElems - list of groups of elements (edges or faces) to be replicated \param theElems - list of groups of elements (edges or faces) to be replicated
\param theNodesNot - list of groups of nodes not to replicated \param theNodesNot - list of groups of nodes not to replicated
\param theShape - shape to detect affected elements (element which geometric center \param theShape - shape to detect affected elements (element which geometric center
located on or inside shape). located on or inside shape). If the shape is null, detection is done on faces orientations
(select elements with a gravity center on the side given by faces normals).
This mode (null shape) is faster, but works only when theElems are faces, with coherents orientations.
The replicated nodes should be associated to affected elements. The replicated nodes should be associated to affected elements.
\return groups of affected elements \return groups of affected elements
\sa DoubleNodeElemGroupsInRegion() \sa DoubleNodeElemGroupsInRegion()
@ -9968,8 +9920,105 @@ bool SMESH_MeshEditor::AffectedElemGroupsInRegion( const TIDSortedElemSet& theEl
TIDSortedElemSet& theAffectedElems) TIDSortedElemSet& theAffectedElems)
{ {
if ( theShape.IsNull() ) if ( theShape.IsNull() )
return false; {
std::set<const SMDS_MeshNode*> alreadyCheckedNodes;
std::set<const SMDS_MeshElement*> alreadyCheckedElems;
std::set<const SMDS_MeshElement*> edgesToCheck;
alreadyCheckedNodes.clear();
alreadyCheckedElems.clear();
edgesToCheck.clear();
// --- iterates on elements to be replicated and get elements by back references from their nodes
TIDSortedElemSet::const_iterator elemItr = theElems.begin();
int ielem = 1;
for ( ; elemItr != theElems.end(); ++elemItr )
{
SMDS_MeshElement* anElem = (SMDS_MeshElement*)*elemItr;
if (!anElem || (anElem->GetType() != SMDSAbs_Face))
continue;
gp_XYZ normal;
SMESH_MeshAlgos::FaceNormal( anElem, normal, /*normalized=*/true );
MESSAGE("element " << ielem++ << " normal " << normal.X() << " " << normal.Y() << " " << normal.Z());
std::set<const SMDS_MeshNode*> nodesElem;
nodesElem.clear();
SMDS_ElemIteratorPtr nodeItr = anElem->nodesIterator();
while ( nodeItr->more() )
{
const SMDS_MeshNode* aNode = cast2Node(nodeItr->next());
nodesElem.insert(aNode);
}
std::set<const SMDS_MeshNode*>::iterator nodit = nodesElem.begin();
for (; nodit != nodesElem.end(); nodit++)
{
MESSAGE(" noeud ");
const SMDS_MeshNode* aNode = *nodit;
if ( !aNode || theNodesNot.find(aNode) != theNodesNot.end() )
continue;
if (alreadyCheckedNodes.find(aNode) != alreadyCheckedNodes.end())
continue;
alreadyCheckedNodes.insert(aNode);
SMDS_ElemIteratorPtr backElemItr = aNode->GetInverseElementIterator();
while ( backElemItr->more() )
{
MESSAGE(" backelem ");
const SMDS_MeshElement* curElem = backElemItr->next();
if (alreadyCheckedElems.find(curElem) != alreadyCheckedElems.end())
continue;
if (theElems.find(curElem) != theElems.end())
continue;
alreadyCheckedElems.insert(curElem);
double x=0, y=0, z=0;
int nb = 0;
SMDS_ElemIteratorPtr nodeItr2 = curElem->nodesIterator();
while ( nodeItr2->more() )
{
const SMDS_MeshNode* anotherNode = cast2Node(nodeItr2->next());
x += anotherNode->X();
y += anotherNode->Y();
z += anotherNode->Z();
nb++;
}
gp_XYZ p;
p.SetCoord( x/nb -aNode->X(),
y/nb -aNode->Y(),
z/nb -aNode->Z() );
MESSAGE(" check " << p.X() << " " << p.Y() << " " << p.Z());
if (normal*p > 0)
{
MESSAGE(" --- inserted")
theAffectedElems.insert( curElem );
}
else if (curElem->GetType() == SMDSAbs_Edge)
edgesToCheck.insert(curElem);
}
}
}
// --- add also edges lying on the set of faces (all nodes in alreadyCheckedNodes)
std::set<const SMDS_MeshElement*>::iterator eit = edgesToCheck.begin();
for( ; eit != edgesToCheck.end(); eit++)
{
bool onside = true;
const SMDS_MeshElement* anEdge = *eit;
SMDS_ElemIteratorPtr nodeItr = anEdge->nodesIterator();
while ( nodeItr->more() )
{
const SMDS_MeshNode* aNode = cast2Node(nodeItr->next());
if (alreadyCheckedNodes.find(aNode) == alreadyCheckedNodes.end())
{
onside = false;
break;
}
}
if (onside)
{
MESSAGE(" --- edge onside inserted")
theAffectedElems.insert(anEdge);
}
}
}
else
{
const double aTol = Precision::Confusion(); const double aTol = Precision::Confusion();
auto_ptr< BRepClass3d_SolidClassifier> bsc3d; auto_ptr< BRepClass3d_SolidClassifier> bsc3d;
auto_ptr<_FaceClassifier> aFaceClassifier; auto_ptr<_FaceClassifier> aFaceClassifier;
@ -9985,21 +10034,24 @@ bool SMESH_MeshEditor::AffectedElemGroupsInRegion( const TIDSortedElemSet& theEl
// iterates on indicated elements and get elements by back references from their nodes // iterates on indicated elements and get elements by back references from their nodes
TIDSortedElemSet::const_iterator elemItr = theElems.begin(); TIDSortedElemSet::const_iterator elemItr = theElems.begin();
int ielem = 1;
for ( ; elemItr != theElems.end(); ++elemItr ) for ( ; elemItr != theElems.end(); ++elemItr )
{ {
MESSAGE("element " << ielem++);
SMDS_MeshElement* anElem = (SMDS_MeshElement*)*elemItr; SMDS_MeshElement* anElem = (SMDS_MeshElement*)*elemItr;
if (!anElem) if (!anElem)
continue; continue;
SMDS_ElemIteratorPtr nodeItr = anElem->nodesIterator(); SMDS_ElemIteratorPtr nodeItr = anElem->nodesIterator();
while ( nodeItr->more() ) while ( nodeItr->more() )
{ {
MESSAGE(" noeud ");
const SMDS_MeshNode* aNode = cast2Node(nodeItr->next()); const SMDS_MeshNode* aNode = cast2Node(nodeItr->next());
if ( !aNode || theNodesNot.find(aNode) != theNodesNot.end() ) if ( !aNode || theNodesNot.find(aNode) != theNodesNot.end() )
continue; continue;
SMDS_ElemIteratorPtr backElemItr = aNode->GetInverseElementIterator(); SMDS_ElemIteratorPtr backElemItr = aNode->GetInverseElementIterator();
while ( backElemItr->more() ) while ( backElemItr->more() )
{ {
MESSAGE(" backelem ");
const SMDS_MeshElement* curElem = backElemItr->next(); const SMDS_MeshElement* curElem = backElemItr->next();
if ( curElem && theElems.find(curElem) == theElems.end() && if ( curElem && theElems.find(curElem) == theElems.end() &&
( bsc3d.get() ? ( bsc3d.get() ?
@ -10009,6 +10061,7 @@ bool SMESH_MeshEditor::AffectedElemGroupsInRegion( const TIDSortedElemSet& theEl
} }
} }
} }
}
return true; return true;
} }

View File

@ -600,10 +600,8 @@ gp_XY SMESH_MesherHelper::GetNodeUV(const TopoDS_Face& F,
for ( TopExp_Explorer vert(F,TopAbs_VERTEX); !uvOK && vert.More(); vert.Next() ) for ( TopExp_Explorer vert(F,TopAbs_VERTEX); !uvOK && vert.More(); vert.Next() )
uvOK = ( V == vert.Current() ); uvOK = ( V == vert.Current() );
if ( !uvOK ) { if ( !uvOK ) {
#ifdef _DEBUG_
MESSAGE ( "SMESH_MesherHelper::GetNodeUV(); Vertex " << vertexID MESSAGE ( "SMESH_MesherHelper::GetNodeUV(); Vertex " << vertexID
<< " not in face " << GetMeshDS()->ShapeToIndex( F ) ); << " not in face " << GetMeshDS()->ShapeToIndex( F ) );
#endif
// get UV of a vertex closest to the node // get UV of a vertex closest to the node
double dist = 1e100; double dist = 1e100;
gp_Pnt pn = XYZ( n ); gp_Pnt pn = XYZ( n );
@ -944,6 +942,7 @@ bool SMESH_MesherHelper::CheckNodeU(const TopoDS_Edge& E,
} }
Quantity_Parameter U = projector->LowerDistanceParameter(); Quantity_Parameter U = projector->LowerDistanceParameter();
u = double( U ); u = double( U );
MESSAGE(" f " << f << " l " << l << " u " << u);
curvPnt = curve->Value( u ); curvPnt = curve->Value( u );
dist = nodePnt.Distance( curvPnt ); dist = nodePnt.Distance( curvPnt );
if ( distXYZ ) { if ( distXYZ ) {
@ -968,6 +967,7 @@ bool SMESH_MesherHelper::CheckNodeU(const TopoDS_Edge& E,
} }
if (( u < f-tol || u > l+tol ) && force ) if (( u < f-tol || u > l+tol ) && force )
{ {
MESSAGE("u < f-tol || u > l+tol ; u " << u << " f " << f << " l " << l);
// node is on vertex but is set on periodic but trimmed edge (issue 0020890) // node is on vertex but is set on periodic but trimmed edge (issue 0020890)
try try
{ {
@ -4673,4 +4673,3 @@ void SMESH_MesherHelper::FixQuadraticElements(SMESH_ComputeErrorPtr& compError,
} }
} }
} }

View File

@ -97,7 +97,7 @@ class SMESH_EXPORT SMESH_MesherHelper
* The key of the map is a normalized parameter of each * The key of the map is a normalized parameter of each
* base node on theBaseSide. Edges in theBaseSide must be sequenced. * base node on theBaseSide. Edges in theBaseSide must be sequenced.
* This method works in supposition that nodes on the face * This method works in supposition that nodes on the face
* forms a rectangular grid and elements can be quardrangles or triangles * forms a structured grid and elements can be quardrangles or triangles
*/ */
static bool LoadNodeColumns(TParam2ColumnMap & theParam2ColumnMap, static bool LoadNodeColumns(TParam2ColumnMap & theParam2ColumnMap,
const TopoDS_Face& theFace, const TopoDS_Face& theFace,

View File

@ -1381,7 +1381,7 @@ static void cleanSubMesh( SMESH_subMesh * subMesh )
const SMDS_MeshElement * elt = ite->next(); const SMDS_MeshElement * elt = ite->next();
//MESSAGE( " RM elt: "<<elt->GetID()<<" ( "<<elt->NbNodes()<<" )" ); //MESSAGE( " RM elt: "<<elt->GetID()<<" ( "<<elt->NbNodes()<<" )" );
//meshDS->RemoveElement(elt); //meshDS->RemoveElement(elt);
meshDS->RemoveFreeElement(elt, subMeshDS); meshDS->RemoveFreeElement(elt, 0);
} }
SMDS_NodeIteratorPtr itn = subMeshDS->GetNodes(); SMDS_NodeIteratorPtr itn = subMeshDS->GetNodes();
@ -1389,10 +1389,11 @@ static void cleanSubMesh( SMESH_subMesh * subMesh )
const SMDS_MeshNode * node = itn->next(); const SMDS_MeshNode * node = itn->next();
//MESSAGE( " RM node: "<<node->GetID()); //MESSAGE( " RM node: "<<node->GetID());
if ( node->NbInverseElements() == 0 ) if ( node->NbInverseElements() == 0 )
meshDS->RemoveFreeNode(node, subMeshDS); meshDS->RemoveFreeNode(node, 0);
else // for StdMeshers_CompositeSegment_1D: node in one submesh, edge in another else // for StdMeshers_CompositeSegment_1D: node in one submesh, edge in another
meshDS->RemoveNode(node); meshDS->RemoveNode(node);
} }
subMeshDS->Clear();
} }
} }
} }

View File

@ -69,11 +69,13 @@ libSMESHClient_la_LDFLAGS = \
../MEDWrapper/Factory/libMEDWrapper.la \ ../MEDWrapper/Factory/libMEDWrapper.la \
../MEDWrapper/Base/libMEDWrapperBase.la \ ../MEDWrapper/Base/libMEDWrapperBase.la \
../MEDWrapper/V2_2/libMEDWrapper_V2_2.la \ ../MEDWrapper/V2_2/libMEDWrapper_V2_2.la \
$(KERNEL_LDFLAGS) -lSalomeLifeCycleCORBA -lSalomeNS -lOpUtil -lSALOMEBasics \ $(KERNEL_LDFLAGS) -lSalomeLifeCycleCORBA -lSalomeNS -lOpUtil -lSALOMEBasics -lSalomeContainer -lSalomeHDFPersist -lSalomeGenericObj \
-lRegistry -lResourcesManager -lSalomeResourcesManager -lSalomeNotification \
-lSalomeIDLKernel -lSALOMELocalTrace \ -lSalomeIDLKernel -lSALOMELocalTrace \
$(GEOM_LDFLAGS) -lNMTDS -lSalomeIDLGEOM \ $(GEOM_LDFLAGS) -lNMTDS -lSalomeIDLGEOM \
$(CAS_KERNEL) $(CAS_KERNEL)
SMESHClientBin_CPPFLAGS = \ SMESHClientBin_CPPFLAGS = \
$(libSMESHClient_la_CPPFLAGS) $(libSMESHClient_la_CPPFLAGS)

View File

@ -888,7 +888,7 @@ void SMESHDS_Mesh::RemoveFreeNode(const SMDS_MeshNode * n,
set<SMESHDS_GroupBase*>::iterator GrIt = myGroups.begin(); set<SMESHDS_GroupBase*>::iterator GrIt = myGroups.begin();
for (; GrIt != myGroups.end(); GrIt++) { for (; GrIt != myGroups.end(); GrIt++) {
SMESHDS_Group* group = dynamic_cast<SMESHDS_Group*>(*GrIt); SMESHDS_Group* group = dynamic_cast<SMESHDS_Group*>(*GrIt);
if (!group || group->IsEmpty()) continue; if (group && !group->IsEmpty())
group->SMDSGroup().Remove(n); group->SMDSGroup().Remove(n);
} }
} }
@ -915,11 +915,12 @@ void SMESHDS_Mesh::RemoveElement(const SMDS_MeshElement * elt)
if (!hasConstructionEdges() && !hasConstructionFaces()) if (!hasConstructionEdges() && !hasConstructionFaces())
{ {
SMESHDS_SubMesh* subMesh=0; SMESHDS_SubMesh* subMesh=0;
map<int,SMESHDS_SubMesh*>::iterator SubIt = myShapeIndexToSubMesh.begin(); if ( elt->getshapeId() > 0 )
for ( ; !subMesh && SubIt != myShapeIndexToSubMesh.end(); SubIt++ ) {
if (!SubIt->second->IsComplexSubmesh() && SubIt->second->Contains( elt )) map<int,SMESHDS_SubMesh*>::iterator SubIt = myShapeIndexToSubMesh.find( elt->getshapeId() );
if ( SubIt != myShapeIndexToSubMesh.end() )
subMesh = SubIt->second; subMesh = SubIt->second;
//MESSAGE("subMesh " << elt->getshapeId()); }
RemoveFreeElement( elt, subMesh, true); RemoveFreeElement( elt, subMesh, true);
return; return;
} }

View File

@ -67,6 +67,7 @@ SMESHDS_SubMesh::~SMESHDS_SubMesh()
//function : AddElement //function : AddElement
//purpose : //purpose :
//======================================================================= //=======================================================================
void SMESHDS_SubMesh::AddElement(const SMDS_MeshElement * ME) void SMESHDS_SubMesh::AddElement(const SMDS_MeshElement * ME)
{ {
if (!IsComplexSubmesh()) if (!IsComplexSubmesh())
@ -76,7 +77,6 @@ void SMESHDS_SubMesh::AddElement(const SMDS_MeshElement * ME)
AddNode( static_cast< const SMDS_MeshNode* >( ME )); AddNode( static_cast< const SMDS_MeshNode* >( ME ));
return; return;
} }
//MESSAGE("in " << myIndex << " AddElement "<< ME->GetID());
int oldShapeId = ME->getshapeId(); int oldShapeId = ME->getshapeId();
if ( oldShapeId > 0 ) if ( oldShapeId > 0 )
{ {
@ -121,6 +121,7 @@ void SMESHDS_SubMesh::AddElement(const SMDS_MeshElement * ME)
//function : RemoveElement //function : RemoveElement
//purpose : //purpose :
//======================================================================= //=======================================================================
bool SMESHDS_SubMesh::RemoveElement(const SMDS_MeshElement * ME, bool isElemDeleted) bool SMESHDS_SubMesh::RemoveElement(const SMDS_MeshElement * ME, bool isElemDeleted)
{ {
if (!ME) if (!ME)
@ -128,13 +129,11 @@ bool SMESHDS_SubMesh::RemoveElement(const SMDS_MeshElement * ME, bool isElemDele
MESSAGE("-----------------> Remove Null Element " << isElemDeleted); MESSAGE("-----------------> Remove Null Element " << isElemDeleted);
return false; return false;
} }
//MESSAGE("-----------------> RemoveElement "<< ME->GetID() << " " << isElemDeleted);
if (!IsComplexSubmesh()) if (!IsComplexSubmesh())
{ {
if ( ME->getshapeId() != myIndex ) if ( ME->getshapeId() != myIndex )
return false; return false;
int idInSubShape = ME->getIdInShape(); int idInSubShape = ME->getIdInShape();
//MESSAGE("in "<< myIndex << " RemoveElement " << ME->GetID() << " " << idInSubShape << " " << myUnusedIdElements);
SMDS_MeshElement* elem = (SMDS_MeshElement*) (ME); SMDS_MeshElement* elem = (SMDS_MeshElement*) (ME);
elem->setShapeId(0); elem->setShapeId(0);
elem->setIdInShape(-1); elem->setIdInShape(-1);
@ -145,7 +144,6 @@ bool SMESHDS_SubMesh::RemoveElement(const SMDS_MeshElement * ME, bool isElemDele
return true; return true;
} }
return false; return false;
// }
} }
MESSAGE("Try to remove an element from a complex submesh "); MESSAGE("Try to remove an element from a complex submesh ");
return false; return false;
@ -188,13 +186,9 @@ bool SMESHDS_SubMesh::RemoveNode(const SMDS_MeshNode * N, bool isNodeDeleted)
{ {
if (!IsComplexSubmesh()) if (!IsComplexSubmesh())
{ {
// if (!isNodeDeleted) // alive node has valid ID and can be found
// {
if ( N->getshapeId() != myIndex ) if ( N->getshapeId() != myIndex )
return false; return false;
int idInSubShape = N->getIdInShape(); int idInSubShape = N->getIdInShape();
//int shapeId = N->getshapeId();
//MESSAGE("in "<< myIndex << " RemoveNode " << shapeId << " " << idInSubShape << " " << N->GetID());
SMDS_MeshNode* node = (SMDS_MeshNode*) (N); SMDS_MeshNode* node = (SMDS_MeshNode*) (N);
node->setShapeId(0); node->setShapeId(0);
node->setIdInShape(-1); node->setIdInShape(-1);
@ -205,7 +199,6 @@ bool SMESHDS_SubMesh::RemoveNode(const SMDS_MeshNode * N, bool isNodeDeleted)
return true; return true;
} }
return false; return false;
// }
} }
MESSAGE("Try to remove a node from a complex submesh"); MESSAGE("Try to remove a node from a complex submesh");
return false; return false;
@ -215,9 +208,9 @@ bool SMESHDS_SubMesh::RemoveNode(const SMDS_MeshNode * N, bool isNodeDeleted)
//function : NbElements //function : NbElements
//purpose : //purpose :
//======================================================================= //=======================================================================
int SMESHDS_SubMesh::NbElements() const int SMESHDS_SubMesh::NbElements() const
{ {
//MESSAGE(this << " NbElements " << IsComplexSubmesh() << " " << myElements.size() - myUnusedIdElements);
if ( !IsComplexSubmesh() ) if ( !IsComplexSubmesh() )
return myElements.size() - myUnusedIdElements; return myElements.size() - myUnusedIdElements;
@ -236,7 +229,6 @@ int SMESHDS_SubMesh::NbElements() const
int SMESHDS_SubMesh::NbNodes() const int SMESHDS_SubMesh::NbNodes() const
{ {
//MESSAGE(this << " NbNodes " << IsComplexSubmesh() << " " << myNodes.size() - myUnusedIdNodes);
if ( !IsComplexSubmesh() ) if ( !IsComplexSubmesh() )
return myNodes.size() - myUnusedIdNodes; return myNodes.size() - myUnusedIdNodes;
@ -476,64 +468,52 @@ void SMESHDS_SubMesh::Clear()
clearVector( myNodes ); clearVector( myNodes );
myUnusedIdNodes = 0; myUnusedIdNodes = 0;
myUnusedIdElements = 0; myUnusedIdElements = 0;
if ( NbSubMeshes() > 0 )
{
SMESHDS_SubMeshIteratorPtr sub = GetSubMeshIterator(); SMESHDS_SubMeshIteratorPtr sub = GetSubMeshIterator();
while ( sub->more() ) { while ( sub->more() ) {
if ( SMESHDS_SubMesh* sm = (SMESHDS_SubMesh*) sub->next()) if ( SMESHDS_SubMesh* sm = (SMESHDS_SubMesh*) sub->next())
sm->Clear(); sm->Clear();
} }
}
} }
int SMESHDS_SubMesh::getSize() int SMESHDS_SubMesh::getSize()
{ {
int c = NbNodes(); int c = NbNodes();
int d = NbElements(); int d = NbElements();
//cerr << "SMESHDS_SubMesh::NbNodes " << c << endl;
//cerr << "SMESHDS_SubMesh::NbElements " << d << endl;
return c+d; return c+d;
} }
void SMESHDS_SubMesh::compactList() void SMESHDS_SubMesh::compactList()
{ {
//MESSAGE("compactList old: nodes " << myNodes.size() << " elements " << myElements.size()); if ( myUnusedIdElements > 0 )
//stringstream a; {
//stringstream b;
//stringstream c;
//stringstream d;
std::vector<const SMDS_MeshElement*> newElems; std::vector<const SMDS_MeshElement*> newElems;
newElems.clear(); newElems.reserve( myElements.size() - myUnusedIdElements );
for (int i = 0; i < myElements.size(); i++) for (size_t i = 0; i < myElements.size(); i++)
if (myElements[i]) if (myElements[i])
{ {
SMDS_MeshElement* elem = (SMDS_MeshElement*)myElements[i]; SMDS_MeshElement* elem = (SMDS_MeshElement*)myElements[i];
elem->setIdInShape(newElems.size()); elem->setIdInShape(newElems.size());
newElems.push_back(elem); newElems.push_back(elem);
//a << elem->GetID() << " ";
//b << elem->GetID() << " ";
} }
//else
// a << "_ ";
myElements.swap(newElems); myElements.swap(newElems);
myUnusedIdElements = 0; myUnusedIdElements = 0;
//MESSAGE("in " << myIndex << " oldElems " << a.str()); }
//MESSAGE("in " << myIndex << " newElems " << b.str());
if ( myUnusedIdNodes > 0 )
{
std::vector<const SMDS_MeshNode*> newNodes; std::vector<const SMDS_MeshNode*> newNodes;
newNodes.clear(); newNodes.reserve( myNodes.size() - myUnusedIdNodes );
for (int i = 0; i < myNodes.size(); i++) for (size_t i = 0; i < myNodes.size(); i++)
if (myNodes[i]) if (myNodes[i])
{ {
SMDS_MeshNode* node = (SMDS_MeshNode*)myNodes[i]; SMDS_MeshNode* node = (SMDS_MeshNode*)myNodes[i];
node->setIdInShape(newNodes.size()); node->setIdInShape(newNodes.size());
newNodes.push_back(node); newNodes.push_back(node);
//c << node->GetID() << " ";
//d << node->GetID() << " ";
} }
//else
// c << "_ ";
myNodes.swap(newNodes); myNodes.swap(newNodes);
myUnusedIdNodes = 0; myUnusedIdNodes = 0;
//MESSAGE("in " << myIndex << " oldNodes " << c.str()); }
//MESSAGE("in " << myIndex << " newNodes " << d.str());
//MESSAGE("compactList new: nodes " << myNodes.size() << " elements " << myElements.size());
} }

View File

@ -285,4 +285,5 @@ libSMESH_la_LDFLAGS = \
nodist_salomeres_DATA= \ nodist_salomeres_DATA= \
SMESH_images.qm \ SMESH_images.qm \
SMESH_msg_en.qm \ SMESH_msg_en.qm \
SMESH_msg_fr.qm SMESH_msg_fr.qm \
SMESH_msg_ja.qm

View File

@ -361,11 +361,6 @@
SMESH::SetName( aMeshSO, QFileInfo(filename).fileName() ); SMESH::SetName( aMeshSO, QFileInfo(filename).fileName() );
anEntryList.append( aMeshSO->GetID().c_str() ); anEntryList.append( aMeshSO->GetID().c_str() );
// obj has been published in study. Its refcount has been incremented.
// It is safe to decrement its refcount
// so that it will be destroyed when the entry in study will be removed
aMeshes[i]->UnRegister();
} }
else { else {
isEmpty = true; isEmpty = true;
@ -928,7 +923,8 @@
} }
} }
void AutoColor(){ void AutoColor()
{
SALOME_ListIO selected; SALOME_ListIO selected;
SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
if( !app ) if( !app )
@ -951,6 +947,8 @@
if( aMainObject->_is_nil() ) if( aMainObject->_is_nil() )
return; return;
SUIT_OverrideCursor wc;
aMainObject->SetAutoColor( true ); // mesh groups are re-colored here aMainObject->SetAutoColor( true ); // mesh groups are re-colored here
QList<SALOMEDS::Color> aReservedColors; QList<SALOMEDS::Color> aReservedColors;
@ -967,6 +965,7 @@
SALOMEDS::Color aColor = SMESHGUI::getUniqueColor( aReservedColors ); SALOMEDS::Color aColor = SMESHGUI::getUniqueColor( aReservedColors );
aReservedColors.append( aColor ); aReservedColors.append( aColor );
#endif // SIMPLE_AUTOCOLOR #endif // SIMPLE_AUTOCOLOR
aGroupObject->SetColor( aColor );
_PTR(SObject) aGroupSObject = SMESH::FindSObject(aGroupObject); _PTR(SObject) aGroupSObject = SMESH::FindSObject(aGroupObject);
if (aGroupSObject) { if (aGroupSObject) {
@ -1790,7 +1789,7 @@
aSO = aRefSObject; // Delete main Object instead of reference aSO = aRefSObject; // Delete main Object instead of reference
listSO.push_back( aSO ); listSO.push_back( aSO );
std::list< _PTR(SObject) >::iterator itSO = listSO.begin(); std::list< _PTR(SObject) >::iterator itSO = --listSO.end();
for ( ; itSO != listSO.end(); ++itSO ) { for ( ; itSO != listSO.end(); ++itSO ) {
_PTR(ChildIterator) it = aStudy->NewChildIterator( *itSO ); _PTR(ChildIterator) it = aStudy->NewChildIterator( *itSO );
for (it->InitEx(false); it->More(); it->Next()) for (it->InitEx(false); it->More(); it->Next())
@ -1835,24 +1834,9 @@
if ( !SO ) continue; if ( !SO ) continue;
std::string anEntry = SO->GetID(); std::string anEntry = SO->GetID();
/** Erase graphical object **/ /** Erase graphical object and remove all its data **/
if(SO->FindAttribute(anAttr, "AttributeIOR")) { if(SO->FindAttribute(anAttr, "AttributeIOR")) {
SMESH::RemoveVisualObjectWithActors( anEntry.c_str(), true); SMESH::RemoveVisualObjectWithActors( anEntry.c_str(), true);
// ViewManagerList aViewMenegers = anApp->viewManagers();
// ViewManagerList::const_iterator it = aViewMenegers.begin();
// for( ; it != aViewMenegers.end(); it++) {
// SUIT_ViewManager* vm = *it;
// int nbSf = vm ? vm->getViewsCount() : 0;
// if(vm) {
// QVector<SUIT_ViewWindow*> aViews = vm->getViews();
// for(int i = 0; i < nbSf; i++){
// SUIT_ViewWindow *sf = aViews[i];
// if(SMESH_Actor* anActor = SMESH::FindActorByEntry(sf,anEntry.c_str())){
// SMESH::RemoveActor(sf,anActor);
// }
// }
// }
// }
} }
/** Remove an object from data structures **/ /** Remove an object from data structures **/
SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow( SMESH::SObjectToObject( SO )); SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow( SMESH::SObjectToObject( SO ));
@ -2002,7 +1986,7 @@ bool SMESHGUI::automaticUpdate(unsigned int requestedSize, bool* limitExceeded)
*/ */
//============================================================================= //=============================================================================
bool SMESHGUI::automaticUpdate( SMESH::SMESH_Mesh_ptr theMesh, bool SMESHGUI::automaticUpdate( SMESH::SMESH_Mesh_ptr theMesh,
int* entities, bool* limitExceeded ) int* entities, bool* limitExceeded, int* hidden )
{ {
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
if ( !resMgr ) if ( !resMgr )
@ -2015,6 +1999,7 @@ bool SMESHGUI::automaticUpdate( SMESH::SMESH_Mesh_ptr theMesh,
long requestedSize = theMesh->NbElements(); long requestedSize = theMesh->NbElements();
*entities = SMESH_Actor::eAllEntity; *entities = SMESH_Actor::eAllEntity;
*hidden = 0;
bool exceeded = updateLimit > 0 && requestedSize > updateLimit; bool exceeded = updateLimit > 0 && requestedSize > updateLimit;
@ -2029,40 +2014,50 @@ bool SMESHGUI::automaticUpdate( SMESH::SMESH_Mesh_ptr theMesh,
long total = 0; long total = 0;
if ( nbOdElems > 0 ) { if ( nbOdElems > 0 ) {
if ( total + nbOdElems > updateLimit ) if ( total + nbOdElems > updateLimit ) {
*entities = *entities & ~SMESH_Actor::e0DElements; *entities = *entities & ~SMESH_Actor::e0DElements;
*hidden = *hidden | SMESH_Actor::e0DElements;
}
else else
exceeded = false; exceeded = false;
} }
total += nbOdElems; total += nbOdElems;
if ( nbEdges > 0 ) { if ( nbEdges > 0 ) {
if ( total + nbEdges > updateLimit ) if ( total + nbEdges > updateLimit ) {
*entities = *entities & ~SMESH_Actor::eEdges; *entities = *entities & ~SMESH_Actor::eEdges;
*hidden = *hidden | SMESH_Actor::eEdges;
}
else else
exceeded = false; exceeded = false;
} }
total += nbEdges; total += nbEdges;
if ( nbFaces > 0 ) { if ( nbFaces > 0 ) {
if ( total + nbFaces > updateLimit ) if ( total + nbFaces > updateLimit ) {
*entities = *entities & ~SMESH_Actor::eFaces; *entities = *entities & ~SMESH_Actor::eFaces;
*hidden = *hidden | SMESH_Actor::eFaces;
}
else else
exceeded = false; exceeded = false;
} }
total += nbFaces; total += nbFaces;
if ( nbVolumes > 0 ) { if ( nbVolumes > 0 ) {
if ( total + nbVolumes > updateLimit ) if ( total + nbVolumes > updateLimit ) {
*entities = *entities & ~SMESH_Actor::eVolumes; *entities = *entities & ~SMESH_Actor::eVolumes;
*hidden = *hidden | SMESH_Actor::eVolumes;
}
else else
exceeded = false; exceeded = false;
} }
total += nbVolumes; total += nbVolumes;
if ( nbBalls > 0 ) { if ( nbBalls > 0 ) {
if ( total + nbBalls > updateLimit ) if ( total + nbBalls > updateLimit ) {
*entities = *entities & ~SMESH_Actor::eBallElem; *entities = *entities & ~SMESH_Actor::eBallElem;
*hidden = *hidden | SMESH_Actor::eBallElem;
}
else else
exceeded = false; exceeded = false;
} }
@ -3546,8 +3541,20 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
} }
case 501: case 501:
case 502: case 502:
case 503:
case 504:
case 505:
{ {
int page = theCommandID == 501 ? SMESHGUI_MeasureDlg::MinDistance : SMESHGUI_MeasureDlg::BoundingBox; int page = SMESHGUI_MeasureDlg::MinDistance;
if ( theCommandID == 502 )
page = SMESHGUI_MeasureDlg::BoundingBox;
else if ( theCommandID == 503 )
page = SMESHGUI_MeasureDlg::Length;
else if ( theCommandID == 504 )
page = SMESHGUI_MeasureDlg::Area;
else if ( theCommandID == 505 )
page = SMESHGUI_MeasureDlg::Volume;
EmitSignalDeactivateDialog(); EmitSignalDeactivateDialog();
SMESHGUI_MeasureDlg* dlg = new SMESHGUI_MeasureDlg( SMESHGUI::desktop(), page ); SMESHGUI_MeasureDlg* dlg = new SMESHGUI_MeasureDlg( SMESHGUI::desktop(), page );
dlg->show(); dlg->show();
@ -3849,6 +3856,9 @@ void SMESHGUI::initialize( CAM_Application* app )
createSMESHAction( 501, "MEASURE_MIN_DIST", "ICON_MEASURE_MIN_DIST" ); createSMESHAction( 501, "MEASURE_MIN_DIST", "ICON_MEASURE_MIN_DIST" );
createSMESHAction( 502, "MEASURE_BND_BOX", "ICON_MEASURE_BND_BOX" ); createSMESHAction( 502, "MEASURE_BND_BOX", "ICON_MEASURE_BND_BOX" );
createSMESHAction( 503, "MEASURE_LENGTH", "ICON_MEASURE_LENGTH" );
createSMESHAction( 504, "MEASURE_AREA", "ICON_MEASURE_AREA" );
createSMESHAction( 505, "MEASURE_VOLUME", "ICON_MEASURE_VOLUME" );
createSMESHAction( 300, "HIDE" ); createSMESHAction( 300, "HIDE" );
createSMESHAction( 301, "SHOW" ); createSMESHAction( 301, "SHOW" );
@ -3877,7 +3887,8 @@ void SMESHGUI::initialize( CAM_Application* app )
addId = createMenu( tr( "MEN_ADD" ), modifyId, 402 ), addId = createMenu( tr( "MEN_ADD" ), modifyId, 402 ),
removeId = createMenu( tr( "MEN_REMOVE" ), modifyId, 403 ), removeId = createMenu( tr( "MEN_REMOVE" ), modifyId, 403 ),
renumId = createMenu( tr( "MEN_RENUM" ), modifyId, 404 ), renumId = createMenu( tr( "MEN_RENUM" ), modifyId, 404 ),
transfId = createMenu( tr( "MEN_TRANSF" ), modifyId, 405 ); transfId = createMenu( tr( "MEN_TRANSF" ), modifyId, 405 ),
basicPropId = createMenu( tr( "MEN_BASIC_PROPERTIES" ), measureId, -1, 10 );
//createMenu( 111, importId, -1 ); //createMenu( 111, importId, -1 );
createMenu( 112, importId, -1 ); createMenu( 112, importId, -1 );
@ -4025,6 +4036,9 @@ void SMESHGUI::initialize( CAM_Application* app )
createMenu( 501, measureId, -1 ); createMenu( 501, measureId, -1 );
createMenu( 502, measureId, -1 ); createMenu( 502, measureId, -1 );
createMenu( 503, basicPropId, -1 );
createMenu( 504, basicPropId, -1 );
createMenu( 505, basicPropId, -1 );
createMenu( 214, viewId, -1 ); createMenu( 214, viewId, -1 );
// ----- create toolbars -------------- // ----- create toolbars --------------

View File

@ -100,7 +100,7 @@ public :
bool isActiveStudyLocked(); bool isActiveStudyLocked();
static bool automaticUpdate(unsigned int requestedSize = 0, bool* limitExceeded = 0); static bool automaticUpdate(unsigned int requestedSize = 0, bool* limitExceeded = 0);
static bool automaticUpdate( SMESH::SMESH_Mesh_ptr, int*, bool* ); static bool automaticUpdate( SMESH::SMESH_Mesh_ptr, int*, bool*, int* );
static void Modified( bool = true ); static void Modified( bool = true );

View File

@ -58,6 +58,7 @@
#include CORBA_SERVER_HEADER(SMESH_Mesh) #include CORBA_SERVER_HEADER(SMESH_Mesh)
#include CORBA_SERVER_HEADER(SMESH_MeshEditor) #include CORBA_SERVER_HEADER(SMESH_MeshEditor)
#define SPACING 6 #define SPACING 6
#define MARGIN 11 #define MARGIN 11
@ -352,14 +353,17 @@ bool SMESHGUI_Add0DElemsOnAllNodesOp::onApply()
return false; return false;
// get a mesh // get a mesh
SMESH::SMESH_IDSource_var meshObject; SMESH::SMESH_IDSource_wrap meshObject;
SMESH::SMESH_Mesh_var mesh; SMESH::SMESH_Mesh_var mesh;
if ( !myIO.IsNull() ) if ( !myIO.IsNull() )
{ {
CORBA::Object_var obj = SMESH::IObjectToObject( myIO ); CORBA::Object_var obj = SMESH::IObjectToObject( myIO );
meshObject = SMESH::SMESH_IDSource::_narrow( obj ); meshObject = SMESH::SMESH_IDSource::_narrow( obj );
if ( !meshObject->_is_nil() ) if ( !meshObject->_is_nil() )
{
mesh = meshObject->GetMesh(); mesh = meshObject->GetMesh();
meshObject->Register();
}
} }
if ( mesh->_is_nil() ) if ( mesh->_is_nil() )
{ {

View File

@ -65,10 +65,6 @@
#define SPACING 6 #define SPACING 6
#define MARGIN 11 #define MARGIN 11
//To disable automatic genericobj management, the following line should be commented.
//Otherwise, it should be uncommented. Refer to KERNEL_SRC/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx
#define WITHGENERICOBJ
//================================================================================= //=================================================================================
// name : SMESHGUI_BuildCompoundDlg // name : SMESHGUI_BuildCompoundDlg
// Purpose : // Purpose :
@ -347,12 +343,6 @@ bool SMESHGUI_BuildCompoundDlg::ClickOnApply()
SMESHGUI::Modified(); SMESHGUI::Modified();
// obj has been published in study. Its refcount has been incremented.
// It is safe to decrement its refcount
// so that it will be destroyed when the entry in study will be removed
if (!CORBA::is_nil(aCompoundMesh))
aCompoundMesh->UnRegister();
return true; return true;
} }
return false; return false;

View File

@ -895,9 +895,10 @@ void SMESHGUI_BaseComputeOp::computeMesh()
bool limitExceeded; bool limitExceeded;
long limitSize = resMgr->integerValue( "SMESH", "update_limit", 500000 ); long limitSize = resMgr->integerValue( "SMESH", "update_limit", 500000 );
int entities = SMESH_Actor::eAllEntity; int entities = SMESH_Actor::eAllEntity;
int hidden = 0;
if ( !memoryLack ) if ( !memoryLack )
{ {
if ( getSMESHGUI()->automaticUpdate( myMesh, &entities, &limitExceeded ) ) if ( getSMESHGUI()->automaticUpdate( myMesh, &entities, &limitExceeded, &hidden ) )
{ {
try { try {
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 #if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
@ -905,17 +906,24 @@ void SMESHGUI_BaseComputeOp::computeMesh()
#endif #endif
SMESH_Actor *anActor = SMESH::FindActorByObject( myMesh ); SMESH_Actor *anActor = SMESH::FindActorByObject( myMesh );
if ( !anActor ) anActor = SMESH::CreateActor( aMeshSObj->GetStudy(), aMeshSObj->GetID().c_str(), true ); if ( !anActor ) anActor = SMESH::CreateActor( aMeshSObj->GetStudy(), aMeshSObj->GetID().c_str(), true );
if ( anActor ) // actor is not created for an empty mesh
{
anActor->SetEntityMode( entities ); anActor->SetEntityMode( entities );
SMESH::DisplayActor( SMESH::GetActiveWindow(), anActor ); SMESH::DisplayActor( SMESH::GetActiveWindow(), anActor );
}
SMESH::Update(myIObject, true); SMESH::Update(myIObject, true);
if ( limitExceeded ) if ( limitExceeded )
{ {
QStringList hiddenMsg;
if ( hidden & SMESH_Actor::e0DElements ) hiddenMsg << tr( "SMESH_ELEMS0D" );
if ( hidden & SMESH_Actor::eEdges ) hiddenMsg << tr( "SMESH_EDGES" );
if ( hidden & SMESH_Actor::eFaces ) hiddenMsg << tr( "SMESH_FACES" );
if ( hidden & SMESH_Actor::eVolumes ) hiddenMsg << tr( "SMESH_VOLUMES" );
if ( hidden & SMESH_Actor::eBallElem ) hiddenMsg << tr( "SMESH_BALLS" );
SUIT_MessageBox::warning( desktop(), SUIT_MessageBox::warning( desktop(),
tr( "SMESH_WRN_WARNING" ), tr( "SMESH_WRN_WARNING" ),
tr( "SMESH_WRN_SIZE_INC_LIMIT_EXCEEDED" ).arg( myMesh->NbElements() ).arg( limitSize ) ); tr( "SMESH_WRN_SIZE_INC_LIMIT_EXCEEDED" ).arg( myMesh->NbElements() ).arg( limitSize ).arg( hiddenMsg.join(", ") ) );
} }
} }
catch (...) { catch (...) {

View File

@ -98,10 +98,6 @@ namespace
#define SPACING 6 #define SPACING 6
#define MARGIN 11 #define MARGIN 11
//To disable automatic genericobj management, the following line should be commented.
//Otherwise, it should be uncommented. Refer to KERNEL_SRC/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx
#define WITHGENERICOBJ
//================================================================================ //================================================================================
/*! /*!
@ -312,10 +308,11 @@ bool SMESHGUI_CopyMeshDlg::ClickOnApply()
try try
{ {
SUIT_OverrideCursor aWaitCursor; SUIT_OverrideCursor aWaitCursor;
SMESH::SMESH_IDSource_var aPartToCopy; SMESH::SMESH_IDSource_wrap aPartToCopy;
if ( myIdSourceCheck->isChecked()) if ( myIdSourceCheck->isChecked())
{ {
aPartToCopy = mySelectedObject; aPartToCopy = mySelectedObject;
aPartToCopy->Register();
} }
else else
{ {
@ -338,13 +335,8 @@ bool SMESHGUI_CopyMeshDlg::ClickOnApply()
if( !newMesh->_is_nil() ) if( !newMesh->_is_nil() )
if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( newMesh ) ) if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( newMesh ) )
anEntryList.append( aSObject->GetID().c_str() ); anEntryList.append( aSObject->GetID().c_str() );
#ifdef WITHGENERICOBJ }
// obj has been published in study. Its refcount has been incremented. catch (...) {
// It is safe to decrement its refcount
// so that it will be destroyed when the entry in study will be removed
newMesh->UnRegister();
#endif
} catch (...) {
} }
mySMESHGUI->updateObjBrowser(true); mySMESHGUI->updateObjBrowser(true);

View File

@ -354,6 +354,7 @@ SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theMod
connect(SelectPathMeshButton, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(SelectPathMeshButton, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(SelectStartPointButton, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(SelectStartPointButton, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(SelectBasePointButton, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(SelectBasePointButton, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(BasePointGrp, SIGNAL(toggled(bool)), this, SLOT(SetEditCurrentArgument()));
connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
@ -883,7 +884,7 @@ void SMESHGUI_ExtrusionAlongPathDlg::SelectionIntoArgument()
return; return;
QString aString; QString aString;
int aNbUnits = SMESH::GetNameOfSelectedNodes(mySelector, myMeshActor->getIO(), aString); int aNbUnits = SMESH::GetNameOfSelectedNodes(mySelector, IO, aString);
// return if more than one node is selected // return if more than one node is selected
if (aNbUnits != 1) if (aNbUnits != 1)
return; return;
@ -914,6 +915,8 @@ void SMESHGUI_ExtrusionAlongPathDlg::SelectionIntoArgument()
void SMESHGUI_ExtrusionAlongPathDlg::SetEditCurrentArgument() void SMESHGUI_ExtrusionAlongPathDlg::SetEditCurrentArgument()
{ {
QToolButton* send = (QToolButton*)sender(); QToolButton* send = (QToolButton*)sender();
if ( sender() == BasePointGrp )
send = SelectBasePointButton;
if (send != SelectElementsButton && if (send != SelectElementsButton &&
send != SelectPathMeshButton && send != SelectPathMeshButton &&
send != SelectStartPointButton && send != SelectStartPointButton &&
@ -978,17 +981,15 @@ void SMESHGUI_ExtrusionAlongPathDlg::SetEditCurrentArgument (QToolButton* button
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
aViewWindow->SetSelectionMode(NodeSelection); aViewWindow->SetSelectionMode(NodeSelection);
SMESH_TypeFilter* aMeshOrSubMeshFilter = new SMESH_TypeFilter(SMESH::MESHorSUBMESH); SMESH_TypeFilter* aMeshOrSubMeshFilter = new SMESH_TypeFilter(SMESH::IDSOURCE);
SMESH_TypeFilter* aSmeshGroupFilter = new SMESH_TypeFilter(SMESH::GROUP);
SMESH_NumberFilter* aVertexFilter = new SMESH_NumberFilter ("GEOM", TopAbs_SHAPE, SMESH_NumberFilter* aVertexFilter = new SMESH_NumberFilter ("GEOM", TopAbs_SHAPE,
-1, TopAbs_VERTEX); -1, TopAbs_VERTEX);
QList<SUIT_SelectionFilter*> aListOfFilters; QList<SUIT_SelectionFilter*> aListOfFilters;
if (aMeshOrSubMeshFilter) aListOfFilters.append(aMeshOrSubMeshFilter); if (aMeshOrSubMeshFilter) aListOfFilters.append(aMeshOrSubMeshFilter);
if (aSmeshGroupFilter) aListOfFilters.append(aSmeshGroupFilter);
if (aVertexFilter) aListOfFilters.append(aVertexFilter); if (aVertexFilter) aListOfFilters.append(aVertexFilter);
mySelectionMgr->installFilter(new SMESH_LogicalFilter mySelectionMgr->installFilter(new SMESH_LogicalFilter
(aListOfFilters, SMESH_LogicalFilter::LO_OR)); (aListOfFilters, SMESH_LogicalFilter::LO_OR, true));
} }
if (myEditCurrentArgument && !myEditCurrentArgument->hasFocus()) if (myEditCurrentArgument && !myEditCurrentArgument->hasFocus())
@ -1277,9 +1278,7 @@ void SMESHGUI_ExtrusionAlongPathDlg::onDisplaySimulation( bool toDisplayPreview
SMESH::SMESH_MeshEditor::Extrusion_Error retVal; SMESH::SMESH_MeshEditor::Extrusion_Error retVal;
SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditPreviewer(); SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditPreviewer();
bool NeedGroups = false; bool NeedGroups = false;
SMESH::ElementType ElemType = SMESH::FACE; SMESH::ElementType ElemType = ( GetConstructorId() == 0 ) ? SMESH::EDGE : SMESH::FACE;
if( GetConstructorId() == 0 )
ElemType = SMESH::EDGE;
if( !MeshCheck->isChecked() ) { if( !MeshCheck->isChecked() ) {
aMeshEditor->ExtrusionAlongPathX(anElementsId, myPath, aNodeStart, AnglesGrp->isChecked(), aMeshEditor->ExtrusionAlongPathX(anElementsId, myPath, aNodeStart, AnglesGrp->isChecked(),
anAngles, LinearAnglesCheck->isChecked(), anAngles, LinearAnglesCheck->isChecked(),
@ -1294,7 +1293,6 @@ void SMESHGUI_ExtrusionAlongPathDlg::onDisplaySimulation( bool toDisplayPreview
NeedGroups, ElemType, retVal); NeedGroups, ElemType, retVal);
} }
wc.suspend();
if( retVal == SMESH::SMESH_MeshEditor::EXTR_OK ) { if( retVal == SMESH::SMESH_MeshEditor::EXTR_OK ) {
SMESH::MeshPreviewStruct_var aMeshPreviewStruct = aMeshEditor->GetPreviewData(); SMESH::MeshPreviewStruct_var aMeshPreviewStruct = aMeshEditor->GetPreviewData();
mySimulation->SetData(aMeshPreviewStruct._retn()); mySimulation->SetData(aMeshPreviewStruct._retn());

View File

@ -1569,7 +1569,8 @@ void SMESHGUI_FilterTable::updateAdditionalWidget()
aCriterion != SMESH::FT_OverConstrainedFace && aCriterion != SMESH::FT_OverConstrainedFace &&
aCriterion != SMESH::FT_OverConstrainedVolume) aCriterion != SMESH::FT_OverConstrainedVolume)
|| ||
aCriterion == SMESH::FT_CoplanarFaces); aCriterion == SMESH::FT_CoplanarFaces ||
aCriterion == SMESH::FT_EqualNodes);
if (!myAddWidgets.contains(anItem)) if (!myAddWidgets.contains(anItem))
{ {
@ -1970,6 +1971,10 @@ void SMESHGUI_FilterTable::onCriterionChanged (const int row, const int col, con
{ {
isThresholdEditable = true; isThresholdEditable = true;
} }
if ( !isThresholdEditable )
{
aTable->setItem( row, 2, new QTableWidgetItem() );
}
aTable->setEditable( isThresholdEditable, row, 2); aTable->setEditable( isThresholdEditable, row, 2);
@ -3323,6 +3328,8 @@ bool SMESHGUI_FilterDlg::createFilter (const int theType)
aCriteria[ i ] = aCriterion; aCriteria[ i ] = aCriterion;
} }
if ( !myFilter[ theType ]->_is_nil() )
myFilter[ theType ]->UnRegister();
myFilter[ theType ] = aFilterMgr->CreateFilter(); myFilter[ theType ] = aFilterMgr->CreateFilter();
myFilter[ theType ]->SetCriteria(aCriteria.inout()); myFilter[ theType ]->SetCriteria(aCriteria.inout());
@ -3356,9 +3363,29 @@ SMESH::Filter_var SMESHGUI_FilterDlg::GetFilter() const
void SMESHGUI_FilterDlg::SetFilter(SMESH::Filter_var filter, int type) void SMESHGUI_FilterDlg::SetFilter(SMESH::Filter_var filter, int type)
{ {
if ( !filter->_is_nil() )
filter->Register();
if ( !myFilter[ type ]->_is_nil() )
myFilter[ type ]->UnRegister();
myFilter[ type ] = filter; myFilter[ type ] = filter;
} }
//================================================================================
/*!
* \brief call UnRegister() for myFilter's
*/
//================================================================================
void SMESHGUI_FilterDlg::UnRegisterFilters()
{
QMap< int, SMESH::Filter_var >::iterator i_f = myFilter.begin();
for ( ; i_f != myFilter.end(); ++i_f )
if ( !i_f.value()->_is_nil() )
i_f.value()->UnRegister();
myFilter.clear();
}
//======================================================================= //=======================================================================
// name : SMESHGUI_FilterDlg::insertFilterInViewer // name : SMESHGUI_FilterDlg::insertFilterInViewer
// Purpose : Insert filter in viewer // Purpose : Insert filter in viewer

View File

@ -234,6 +234,7 @@ public:
SMESH::Filter_var GetFilter() const; SMESH::Filter_var GetFilter() const;
void SetFilter(SMESH::Filter_var filter, int type); void SetFilter(SMESH::Filter_var filter, int type);
void UnRegisterFilters();
signals: signals:

View File

@ -38,7 +38,7 @@
#include <SMESH_TypeFilter.hxx> #include <SMESH_TypeFilter.hxx>
#include <SMESH_Actor.h> #include <SMESH_Actor.h>
#include <SMESH_ActorUtils.h> //#include <SMESH_ActorUtils.h>
#include <SMESH_LogicalFilter.hxx> #include <SMESH_LogicalFilter.hxx>
// SALOME GEOM includes // SALOME GEOM includes
@ -921,7 +921,7 @@ bool SMESHGUI_GroupDlg::onApply()
QStringList anEntryList; QStringList anEntryList;
SMESH::SMESH_GroupBase_var resultGroup; SMESH::SMESH_GroupBase_var resultGroup;
bool isCreation; bool isCreation, isConversion = false;
if (myGrpTypeId == 0) // standalone if (myGrpTypeId == 0) // standalone
{ {
@ -942,6 +942,7 @@ bool SMESHGUI_GroupDlg::onApply()
myGroupOnGeom = SMESH::SMESH_GroupOnGeom::_nil(); myGroupOnGeom = SMESH::SMESH_GroupOnGeom::_nil();
myGroupOnFilter = SMESH::SMESH_GroupOnFilter::_nil(); myGroupOnFilter = SMESH::SMESH_GroupOnFilter::_nil();
isConversion = true;
} }
} }
@ -1150,7 +1151,17 @@ bool SMESHGUI_GroupDlg::onApply()
resultGroup->SetName(myName->text().toLatin1().data()); resultGroup->SetName(myName->text().toLatin1().data());
if ( aMeshGroupSO ) if ( aMeshGroupSO )
{
if(SMESH_Actor *anActor = SMESH::FindActorByEntry(aMeshGroupSO->GetID().c_str())) { if(SMESH_Actor *anActor = SMESH::FindActorByEntry(aMeshGroupSO->GetID().c_str())) {
if ( isConversion ) { // need to reset TVisualObj and actor
Handle(SALOME_InteractiveObject) anIO = anActor->getIO();
SMESH::RemoveVisualObjectWithActors( anIO->getEntry(), true );
SMESH::Update( anIO,true);
myActorsList.clear();
anActor = SMESH::FindActorByEntry( anIO->getEntry() );
if ( !anActor ) return false;
myActorsList.append( anActor );
}
anActor->setName(myName->text().toLatin1().data()); anActor->setName(myName->text().toLatin1().data());
QColor c; QColor c;
int delta; int delta;
@ -1171,6 +1182,7 @@ bool SMESHGUI_GroupDlg::onApply()
} }
} }
} }
}
SMESHGUI::Modified(); SMESHGUI::Modified();
mySMESHGUI->updateObjBrowser(true); mySMESHGUI->updateObjBrowser(true);
SMESH::UpdateView(); // asv: fix of BUG PAL5515 SMESH::UpdateView(); // asv: fix of BUG PAL5515
@ -1193,6 +1205,8 @@ void SMESHGUI_GroupDlg::onOK()
if ( onApply() ) if ( onApply() )
reject(); reject();
setIsApplyAndClose( false ); setIsApplyAndClose( false );
if ( myFilterDlg ) myFilterDlg->UnRegisterFilters();
} }
//================================================================================= //=================================================================================
@ -2202,6 +2216,8 @@ void SMESHGUI_GroupDlg::reject()
mySMESHGUI->ResetState(); mySMESHGUI->ResetState();
QDialog::reject(); QDialog::reject();
if ( myFilterDlg ) myFilterDlg->UnRegisterFilters();
} }
//================================================================================= //=================================================================================

View File

@ -100,15 +100,12 @@ void SMESHGUI_GenericHypothesisCreator::create( bool isAlgo,
if (isAlgo) { if (isAlgo) {
SMESH::SMESH_Hypothesis_var anAlgo = SMESH::SMESH_Hypothesis_var anAlgo =
SMESH::CreateHypothesis( hypType(), theHypName, isAlgo ); SMESH::CreateHypothesis( hypType(), theHypName, isAlgo );
if (!CORBA::is_nil(anAlgo)) anAlgo.out(); // avoid unused variable warning
anAlgo->UnRegister();
} }
else { else {
SMESH::SMESH_Hypothesis_var aHypothesis = SMESH::SMESH_Hypothesis_var aHypothesis =
SMESH::CreateHypothesis( hypType(), theHypName, false ); SMESH::CreateHypothesis( hypType(), theHypName, false );
editHypothesis( aHypothesis.in(), theHypName, theParent, obj, slot ); editHypothesis( aHypothesis.in(), theHypName, theParent, obj, slot );
if (!CORBA::is_nil(aHypothesis))
aHypothesis->UnRegister();
} }
} }
@ -119,8 +116,6 @@ void SMESHGUI_GenericHypothesisCreator::edit( SMESH::SMESH_Hypothesis_ptr theHyp
if( CORBA::is_nil( theHypothesis ) ) if( CORBA::is_nil( theHypothesis ) )
return; return;
MESSAGE("Edition of hypothesis");
myIsCreate = false; myIsCreate = false;
editHypothesis( theHypothesis, theHypName, theParent, obj, slot ); editHypothesis( theHypothesis, theHypName, theParent, obj, slot );

View File

@ -466,14 +466,6 @@ bool SMESHGUI_Make2DFrom3DOp::compute2DMesh( QStringList& theEntryList )
if ( !newMesh->_is_nil() ) { if ( !newMesh->_is_nil() ) {
if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( newMesh ) ) if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( newMesh ) )
theEntryList.append( aSObject->GetID().c_str() ); theEntryList.append( aSObject->GetID().c_str() );
#ifdef WITHGENERICOBJ
newMesh->UnRegister();
#endif
}
if ( !newGrp->_is_nil() ) {
#ifdef WITHGENERICOBJ
newGrp->UnRegister();
#endif
} }
ok = true; ok = true;

View File

@ -519,8 +519,8 @@ void SMESHGUI_MinDistance::secondEdited()
void SMESHGUI_MinDistance::compute() void SMESHGUI_MinDistance::compute()
{ {
SUIT_OverrideCursor wc; SUIT_OverrideCursor wc;
SMESH::SMESH_IDSource_var s1; SMESH::SMESH_IDSource_wrap s1;
SMESH::SMESH_IDSource_var s2; SMESH::SMESH_IDSource_wrap s2;
bool isOrigin = mySecond->checkedId() == OriginTgt; bool isOrigin = mySecond->checkedId() == OriginTgt;
// process first target // process first target
@ -538,6 +538,7 @@ void SMESHGUI_MinDistance::compute()
} }
else { else {
s1 = myFirstSrc; s1 = myFirstSrc;
s1->Register();
} }
} }
@ -556,6 +557,7 @@ void SMESHGUI_MinDistance::compute()
} }
else { else {
s2 = mySecondSrc; s2 = mySecondSrc;
s2->Register();
} }
} }
@ -1035,14 +1037,17 @@ void SMESHGUI_BoundingBox::compute()
} }
else { else {
srcList->length( mySrc.count() ); srcList->length( mySrc.count() );
for( int i = 0; i < mySrc.count(); i++ ) for( int i = 0; i < mySrc.count(); i++ ) {
srcList[i] = mySrc[i]; srcList[i] = mySrc[i];
mySrc[i]->Register();
}
} }
if ( srcList->length() > 0 ) { if ( srcList->length() > 0 ) {
// compute bounding box // compute bounding box
int precision = SMESHGUI::resourceMgr()->integerValue( "SMESH", "length_precision", 6 ); int precision = SMESHGUI::resourceMgr()->integerValue( "SMESH", "length_precision", 6 );
SMESH::Measurements_var measure = SMESHGUI::GetSMESHGen()->CreateMeasurements(); SMESH::Measurements_var measure = SMESHGUI::GetSMESHGen()->CreateMeasurements();
SMESH::Measure result = measure->BoundingBox( srcList.in() ); SMESH::Measure result = measure->BoundingBox( srcList.in() );
SALOME::UnRegister( srcList );
measure->UnRegister(); measure->UnRegister();
myXmin->setText( QString::number( result.minX, precision > 0 ? 'f' : 'g', qAbs( precision ) ) ); myXmin->setText( QString::number( result.minX, precision > 0 ? 'f' : 'g', qAbs( precision ) ) );
myXmax->setText( QString::number( result.maxX, precision > 0 ? 'f' : 'g', qAbs( precision ) ) ); myXmax->setText( QString::number( result.maxX, precision > 0 ? 'f' : 'g', qAbs( precision ) ) );
@ -1080,6 +1085,219 @@ void SMESHGUI_BoundingBox::clear()
erasePreview(); erasePreview();
} }
/*!
\class SMESHGUI_BasicProperties
\brief basic properties measurement widget.
Widget to calculate length, area or volume for the selected object(s).
*/
/*!
\brief Constructor.
\param parent parent widget
*/
SMESHGUI_BasicProperties::SMESHGUI_BasicProperties( QWidget* parent )
: QWidget( parent )
{
// Property (length, area or volume)
QGroupBox* aPropertyGrp = new QGroupBox( tr( "PROPERTY" ), this );
QRadioButton* aLength = new QRadioButton( tr( "LENGTH" ), aPropertyGrp );
QRadioButton* anArea = new QRadioButton( tr( "AREA" ), aPropertyGrp );
QRadioButton* aVolume = new QRadioButton( tr( "VOLUME" ), aPropertyGrp );
myMode = new QButtonGroup( this );
myMode->addButton( aLength, Length );
myMode->addButton( anArea, Area );
myMode->addButton( aVolume, Volume );
QHBoxLayout* aPropertyLayout = new QHBoxLayout;
aPropertyLayout->addWidget( aLength );
aPropertyLayout->addWidget( anArea );
aPropertyLayout->addWidget( aVolume );
aPropertyGrp->setLayout( aPropertyLayout );
// Source object
QGroupBox* aSourceGrp = new QGroupBox( tr( "SOURCE_MESH_SUBMESH_GROUP" ), this );
mySource = new QLineEdit( aSourceGrp );
mySource->setReadOnly( true );
QHBoxLayout* aSourceLayout = new QHBoxLayout;
aSourceLayout->addWidget( mySource );
aSourceGrp->setLayout( aSourceLayout );
// Compute button
QPushButton* aCompute = new QPushButton( tr( "COMPUTE" ), this );
// Result of computation (length, area or volume)
myResultGrp = new QGroupBox( this );
myResult = new QLineEdit;
myResult->setReadOnly( true );
QHBoxLayout* aResultLayout = new QHBoxLayout;
aResultLayout->addWidget( myResult );
myResultGrp->setLayout( aResultLayout );
// Layout
QGridLayout* aMainLayout = new QGridLayout( this );
aMainLayout->setMargin( MARGIN );
aMainLayout->setSpacing( SPACING );
aMainLayout->addWidget( aPropertyGrp, 0, 0, 1, 2 );
aMainLayout->addWidget( aSourceGrp, 1, 0, 1, 2 );
aMainLayout->addWidget( aCompute, 2, 0 );
aMainLayout->addWidget( myResultGrp, 3, 0, 1, 2 );
aMainLayout->setColumnStretch( 1, 5 );
aMainLayout->setRowStretch( 4, 5 );
// Initial state
setMode( Length );
// Connections
connect( myMode, SIGNAL( buttonClicked( int ) ), this, SLOT( modeChanged( int ) ) );
connect( aCompute, SIGNAL( clicked() ), this, SLOT( compute() ) );
// Selection filter
QList<SUIT_SelectionFilter*> filters;
filters.append( new SMESH_TypeFilter( SMESH::MESHorSUBMESH ) );
filters.append( new SMESH_TypeFilter( SMESH::GROUP ) );
myFilter = new SMESH_LogicalFilter( filters, SMESH_LogicalFilter::LO_OR );
}
/*!
\brief Destructor
*/
SMESHGUI_BasicProperties::~SMESHGUI_BasicProperties()
{
}
/*!
\brief Sets the measurement mode.
\param theMode the mode to set (length, area or volume meausurement)
*/
void SMESHGUI_BasicProperties::setMode( const Mode theMode )
{
QRadioButton* aButton = qobject_cast<QRadioButton*>( myMode->button( theMode ) );
if ( aButton ) {
aButton->setChecked( true );
modeChanged( theMode );
}
}
/*!
\brief Setup the selection mode.
*/
void SMESHGUI_BasicProperties::updateSelection()
{
LightApp_SelectionMgr* selMgr = SMESHGUI::selectionMgr();
disconnect( selMgr, 0, this, 0 );
selMgr->clearFilters();
SMESH::SetPointRepresentation( false );
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow() ) {
aViewWindow->SetSelectionMode( ActorSelection );
}
selMgr->installFilter( myFilter );
connect( selMgr, SIGNAL( currentSelectionChanged() ), this, SLOT( selectionChanged() ) );
}
/*!
\brief Deactivate widget
*/
void SMESHGUI_BasicProperties::deactivate()
{
disconnect( SMESHGUI::selectionMgr(), 0, this, 0 );
}
/*!
\brief Called when selection is changed
*/
void SMESHGUI_BasicProperties::selectionChanged()
{
SUIT_OverrideCursor wc;
SALOME_ListIO selected;
SMESHGUI::selectionMgr()->selectedObjects( selected );
if ( selected.Extent() == 1 ) {
Handle(SALOME_InteractiveObject) IO = selected.First();
SMESH::SMESH_IDSource_var obj = SMESH::IObjectToInterface<SMESH::SMESH_IDSource>( IO );
if ( !CORBA::is_nil( obj ) ) {
mySrc = obj;
QString aName;
SMESH::GetNameOfSelectedIObjects( SMESHGUI::selectionMgr(), aName );
mySource->setText( aName );
}
}
clear();
}
/*!
\brief Called when the measurement mode selection is changed.
\param theMode the selected mode
*/
void SMESHGUI_BasicProperties::modeChanged( int theMode )
{
clear();
if ( theMode == Length ) {
myResultGrp->setTitle( tr("LENGTH") );
} else if ( theMode == Area ) {
myResultGrp->setTitle( tr("AREA") );
} else if ( theMode == Volume ) {
myResultGrp->setTitle( tr("VOLUME") );
}
}
/*!
\brief Calculate length, area or volume for the selected object(s)
*/
void SMESHGUI_BasicProperties::compute()
{
SUIT_OverrideCursor wc;
SMESH::SMESH_IDSource_var source;
if ( !CORBA::is_nil( mySrc ) ) {
// compute
int precision = SMESHGUI::resourceMgr()->integerValue( "SMESH", "length_precision", 6 );
SMESH::Measurements_var measure = SMESHGUI::GetSMESHGen()->CreateMeasurements();
double result = 0;
if ( myMode->checkedId() == Length ) {
result = measure->Length( mySrc.in() );
} else if ( myMode->checkedId() == Area ) {
result = measure->Area( mySrc.in() );
} else if ( myMode->checkedId() == Volume ) {
result = measure->Volume( mySrc.in() );
}
measure->UnRegister();
myResult->setText( QString::number( result, precision > 0 ? 'f' : 'g', qAbs( precision ) ) );
} else {
clear();
}
}
/*!
\brief Reset the widget to the initial state (nullify the result field)
*/
void SMESHGUI_BasicProperties::clear()
{
myResult->clear();
}
/*! /*!
\class SMESHGUI_MeshInfoDlg \class SMESHGUI_MeshInfoDlg
\brief Centralized dialog box for the measurements \brief Centralized dialog box for the measurements
@ -1105,12 +1323,17 @@ SMESHGUI_MeasureDlg::SMESHGUI_MeasureDlg( QWidget* parent, int page )
// min distance // min distance
myMinDist = new SMESHGUI_MinDistance( myTabWidget ); myMinDist = new SMESHGUI_MinDistance( myTabWidget );
myTabWidget->addTab( myMinDist, resMgr->loadPixmap( "SMESH", tr( "ICON_MEASURE_MIN_DIST" ) ), tr( "MIN_DIST" ) ); int aMinDistInd = myTabWidget->addTab( myMinDist, resMgr->loadPixmap( "SMESH", tr( "ICON_MEASURE_MIN_DIST" ) ), tr( "MIN_DIST" ) );
// bounding box // bounding box
myBndBox = new SMESHGUI_BoundingBox( myTabWidget ); myBndBox = new SMESHGUI_BoundingBox( myTabWidget );
myTabWidget->addTab( myBndBox, resMgr->loadPixmap( "SMESH", tr( "ICON_MEASURE_BND_BOX" ) ), tr( "BND_BOX" ) ); int aBndBoxInd = myTabWidget->addTab( myBndBox, resMgr->loadPixmap( "SMESH", tr( "ICON_MEASURE_BND_BOX" ) ), tr( "BND_BOX" ) );
// basic properties
myBasicProps = new SMESHGUI_BasicProperties( myTabWidget );
int aBasicPropInd = myTabWidget->addTab( myBasicProps, resMgr->loadPixmap( "SMESH", tr( "ICON_MEASURE_BASIC_PROPS" ) ), tr( "BASIC_PROPERTIES" ) );
// buttons // buttons
QPushButton* okBtn = new QPushButton( tr( "SMESH_BUT_OK" ), this ); QPushButton* okBtn = new QPushButton( tr( "SMESH_BUT_OK" ), this );
@ -1134,7 +1357,19 @@ SMESHGUI_MeasureDlg::SMESHGUI_MeasureDlg( QWidget* parent, int page )
l->addStretch(); l->addStretch();
l->addLayout( btnLayout ); l->addLayout( btnLayout );
myTabWidget->setCurrentIndex( qMax( (int)MinDistance, qMin( (int)BoundingBox, page ) ) ); int anInd = -1;
if ( page == MinDistance ) {
anInd = aMinDistInd;
} else if ( page == BoundingBox ) {
anInd = aBndBoxInd;
} else if ( page == Length || page == Area || page == Volume ) {
myBasicProps->setMode( (SMESHGUI_BasicProperties::Mode)(page - Length) );
anInd = aBasicPropInd;
}
if ( anInd >= 0 ) {
myTabWidget->setCurrentIndex( anInd );
}
connect( okBtn, SIGNAL( clicked() ), this, SLOT( reject() ) ); connect( okBtn, SIGNAL( clicked() ), this, SLOT( reject() ) );
connect( helpBtn, SIGNAL( clicked() ), this, SLOT( help() ) ); connect( helpBtn, SIGNAL( clicked() ), this, SLOT( help() ) );
@ -1195,7 +1430,10 @@ void SMESHGUI_MeasureDlg::updateSelection()
myMinDist->updateSelection(); myMinDist->updateSelection();
else if ( myTabWidget->currentIndex() == BoundingBox ) else if ( myTabWidget->currentIndex() == BoundingBox )
myBndBox->updateSelection(); myBndBox->updateSelection();
else {
myBndBox->erasePreview();
myBasicProps->updateSelection();
}
} }
/*! /*!
@ -1203,9 +1441,16 @@ void SMESHGUI_MeasureDlg::updateSelection()
*/ */
void SMESHGUI_MeasureDlg::help() void SMESHGUI_MeasureDlg::help()
{ {
SMESH::ShowHelpFile( myTabWidget->currentIndex() == MinDistance ? QString aHelpFile;
"measurements_page.html#min_distance_anchor" : if ( myTabWidget->currentIndex() == MinDistance ) {
"measurements_page.html#bounding_box_anchor" ); aHelpFile = "measurements_page.html#min_distance_anchor";
} else if ( myTabWidget->currentIndex() == BoundingBox ) {
aHelpFile = "measurements_page.html#bounding_box_anchor";
} else {
aHelpFile = "measurements_page.html#basic_properties_anchor";
}
SMESH::ShowHelpFile( aHelpFile );
} }
/*! /*!
@ -1224,6 +1469,7 @@ void SMESHGUI_MeasureDlg::activate()
*/ */
void SMESHGUI_MeasureDlg::deactivate() void SMESHGUI_MeasureDlg::deactivate()
{ {
myBasicProps->deactivate();
myMinDist->deactivate(); myMinDist->deactivate();
myBndBox->deactivate(); myBndBox->deactivate();
myTabWidget->setEnabled( false ); myTabWidget->setEnabled( false );

View File

@ -32,6 +32,7 @@
class QButtonGroup; class QButtonGroup;
class QLineEdit; class QLineEdit;
class QTabWidget; class QTabWidget;
class QGroupBox;
class SUIT_SelectionFilter; class SUIT_SelectionFilter;
class SALOME_Actor; class SALOME_Actor;
class SMESH_Actor; class SMESH_Actor;
@ -101,9 +102,9 @@ public:
void updateSelection(); void updateSelection();
void deactivate(); void deactivate();
void erasePreview();
private: private:
void erasePreview();
void displayPreview(); void displayPreview();
void createPreview( double, double, double, double, double, double ); void createPreview( double, double, double, double, double, double );
@ -135,6 +136,37 @@ private:
SALOME_Actor* myPreview; SALOME_Actor* myPreview;
}; };
class SMESHGUI_EXPORT SMESHGUI_BasicProperties : public QWidget
{
Q_OBJECT;
public:
//! Property type
enum Mode { Length, Area, Volume };
SMESHGUI_BasicProperties( QWidget* = 0 );
~SMESHGUI_BasicProperties();
void setMode( const Mode );
void updateSelection();
void deactivate();
private slots:
void selectionChanged();
void modeChanged( int);
void compute();
void clear();
private:
QButtonGroup* myMode;
QLineEdit* mySource;
QGroupBox* myResultGrp;
QLineEdit* myResult;
SMESH::SMESH_IDSource_var mySrc;
SUIT_SelectionFilter* myFilter;
};
class SMESHGUI_EXPORT SMESHGUI_MeasureDlg : public QDialog class SMESHGUI_EXPORT SMESHGUI_MeasureDlg : public QDialog
{ {
Q_OBJECT; Q_OBJECT;
@ -145,7 +177,10 @@ public:
//! Measurement type //! Measurement type
enum { enum {
MinDistance, //!< minimum distance MinDistance, //!< minimum distance
BoundingBox //!< bounding box BoundingBox, //!< bounding box
Length, //!< length
Area, //!< area
Volume //!< volume
}; };
SMESHGUI_MeasureDlg( QWidget* = 0, int = MinDistance ); SMESHGUI_MeasureDlg( QWidget* = 0, int = MinDistance );
@ -167,6 +202,7 @@ private:
QTabWidget* myTabWidget; QTabWidget* myTabWidget;
SMESHGUI_MinDistance* myMinDist; SMESHGUI_MinDistance* myMinDist;
SMESHGUI_BoundingBox* myBndBox; SMESHGUI_BoundingBox* myBndBox;
SMESHGUI_BasicProperties* myBasicProps;
}; };
#endif // SMESHGUI_MEASUREMENTS_H #endif // SMESHGUI_MEASUREMENTS_H

View File

@ -2235,7 +2235,7 @@ void SMESHGUI_AddInfo::meshInfo( SMESH::SMESH_Mesh_ptr mesh, QTreeWidgetItem* pa
{ {
// type // type
GEOM::GEOM_Object_var shape = mesh->GetShapeToMesh(); GEOM::GEOM_Object_var shape = mesh->GetShapeToMesh();
SMESH::MedFileInfo* inf = mesh->GetMEDFileInfo(); SMESH::MedFileInfo_var inf = mesh->GetMEDFileInfo();
QTreeWidgetItem* typeItem = createItem( parent, Bold ); QTreeWidgetItem* typeItem = createItem( parent, Bold );
typeItem->setText( 0, tr( "TYPE" ) ); typeItem->setText( 0, tr( "TYPE" ) );
if ( !CORBA::is_nil( shape ) ) { if ( !CORBA::is_nil( shape ) ) {
@ -3401,6 +3401,7 @@ void SMESHGUI_CtrlInfo::computeAspectRatio()
anItem->attach( myPlot ); anItem->attach( myPlot );
myPlot->replot(); myPlot->replot();
} }
delete aHistogram;
} }
void SMESHGUI_CtrlInfo::computeAspectRatio3D() void SMESHGUI_CtrlInfo::computeAspectRatio3D()
@ -3417,6 +3418,7 @@ void SMESHGUI_CtrlInfo::computeAspectRatio3D()
anItem->attach( myPlot3D ); anItem->attach( myPlot3D );
myPlot3D->replot(); myPlot3D->replot();
} }
delete aHistogram;
} }
/*! /*!
@ -3518,16 +3520,29 @@ SMESHGUI_CtrlInfoDlg::SMESHGUI_CtrlInfoDlg( QWidget* parent )
okBtn->setAutoDefault( true ); okBtn->setAutoDefault( true );
okBtn->setDefault( true ); okBtn->setDefault( true );
okBtn->setFocus(); okBtn->setFocus();
QPushButton* dumpBtn = new QPushButton( tr( "BUT_DUMP_MESH" ), this );
dumpBtn->setAutoDefault( true );
QPushButton* helpBtn = new QPushButton( tr( "SMESH_BUT_HELP" ), this );
helpBtn->setAutoDefault( true );
QGridLayout* l = new QGridLayout ( this ); QHBoxLayout* btnLayout = new QHBoxLayout;
btnLayout->setSpacing( SPACING );
btnLayout->setMargin( 0 );
btnLayout->addWidget( okBtn );
btnLayout->addWidget( dumpBtn );
btnLayout->addStretch( 10 );
btnLayout->addWidget( helpBtn );
QVBoxLayout* l = new QVBoxLayout ( this );
l->setMargin( MARGIN ); l->setMargin( MARGIN );
l->setSpacing( SPACING ); l->setSpacing( SPACING );
l->addWidget( myCtrlInfo, 0, 0, 1, 3 ); l->addWidget( myCtrlInfo );
l->addWidget( okBtn, 1, 1 ); l->addLayout( btnLayout );
l->setColumnStretch( 0, 5 );
l->setColumnStretch( 2, 5 );
connect( okBtn, SIGNAL( clicked() ), this, SLOT( reject() ) ); connect( okBtn, SIGNAL( clicked() ), this, SLOT( reject() ) );
connect( dumpBtn, SIGNAL( clicked() ), this, SLOT( dump() ) );
connect( helpBtn, SIGNAL( clicked() ), this, SLOT( help() ) );
connect( SMESHGUI::GetSMESHGUI(), SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( deactivate() ) ); connect( SMESHGUI::GetSMESHGUI(), SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( deactivate() ) );
connect( SMESHGUI::GetSMESHGUI(), SIGNAL( SignalCloseAllDialogs() ), this, SLOT( reject() ) ); connect( SMESHGUI::GetSMESHGUI(), SIGNAL( SignalCloseAllDialogs() ), this, SLOT( reject() ) );
@ -3606,4 +3621,49 @@ void SMESHGUI_CtrlInfoDlg::deactivate()
disconnect( SMESHGUI::selectionMgr(), SIGNAL( currentSelectionChanged() ), this, SLOT( updateInfo() ) ); disconnect( SMESHGUI::selectionMgr(), SIGNAL( currentSelectionChanged() ), this, SLOT( updateInfo() ) );
} }
/*!
* \brief Dump contents into a file
*/
void SMESHGUI_CtrlInfoDlg::dump()
{
SUIT_Application* app = SUIT_Session::session()->activeApplication();
if ( !app ) return;
SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study *>( app->activeStudy() );
if ( !appStudy ) return;
_PTR( Study ) aStudy = appStudy->studyDS();
QStringList aFilters;
aFilters.append( tr( "TEXT_FILES" ) );
DumpFileDlg fd( this );
fd.setWindowTitle( tr( "SAVE_INFO" ) );
fd.setFilters( aFilters );
fd.myBaseChk->hide();
fd.myElemChk->hide();
fd.myAddChk ->hide();
fd.myCtrlChk->hide();
if ( fd.exec() == QDialog::Accepted )
{
QString aFileName = fd.selectedFile();
if ( !aFileName.isEmpty() ) {
QFileInfo aFileInfo( aFileName );
if ( aFileInfo.isDir() )
return;
QFile aFile( aFileName );
if ( !aFile.open( QIODevice::WriteOnly | QIODevice::Text ) )
return;
QTextStream out( &aFile );
myCtrlInfo->saveInfo( out );
}
}
}
/*!
* \brief Show help
*/
void SMESHGUI_CtrlInfoDlg::help()
{
SMESH::ShowHelpFile("mesh_infos_page.html#mesh_quality_info_anchor");
}

View File

@ -401,6 +401,8 @@ private slots:
void activate(); void activate();
void deactivate(); void deactivate();
void updateSelection(); void updateSelection();
void help();
void dump();
private: private:
SMESHGUI_CtrlInfo* myCtrlInfo; SMESHGUI_CtrlInfo* myCtrlInfo;

View File

@ -75,10 +75,6 @@
#include <SALOMEconfig.h> #include <SALOMEconfig.h>
#include CORBA_CLIENT_HEADER(SMESH_Gen) #include CORBA_CLIENT_HEADER(SMESH_Gen)
//To disable automatic genericobj management, the following line should be commented.
//Otherwise, it should be uncommented. Refer to KERNEL_SRC/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx
#define WITHGENERICOBJ
//================================================================================ //================================================================================
/*! /*!
* \brief Constructor * \brief Constructor
@ -1103,14 +1099,10 @@ void SMESHGUI_MeshOp::createHypothesis(const int theDim,
// Call hypothesis creation server method (without GUI) // Call hypothesis creation server method (without GUI)
SMESH::SMESH_Hypothesis_var aHyp = SMESH::SMESH_Hypothesis_var aHyp =
SMESH::CreateHypothesis(theTypeName, aHypName, false); SMESH::CreateHypothesis(theTypeName, aHypName, false);
#ifdef WITHGENERICOBJ aHyp.out();
if (!CORBA::is_nil(aHyp)) }
aHyp->UnRegister(); else {
#endif
} else {
// Get hypotheses creator client (GUI) // Get hypotheses creator client (GUI)
// BUG 0020378
//SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator(theTypeName);
SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator(theTypeName); SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator(theTypeName);
// Create hypothesis // Create hypothesis
@ -1179,10 +1171,7 @@ void SMESHGUI_MeshOp::createHypothesis(const int theDim,
else { else {
SMESH::SMESH_Hypothesis_var aHyp = SMESH::SMESH_Hypothesis_var aHyp =
SMESH::CreateHypothesis(theTypeName, aHypName, false); SMESH::CreateHypothesis(theTypeName, aHypName, false);
#ifdef WITHGENERICOBJ aHyp.out();
if (!CORBA::is_nil(aHyp))
aHyp->UnRegister();
#endif
} }
} }
@ -1653,13 +1642,6 @@ bool SMESHGUI_MeshOp::createMesh( QString& theMess, QStringList& theEntryList )
if ( !anAlgoVar->_is_nil() ) if ( !anAlgoVar->_is_nil() )
SMESH::AddHypothesisOnMesh( aMeshVar, anAlgoVar ); SMESH::AddHypothesisOnMesh( aMeshVar, anAlgoVar );
} }
#ifdef WITHGENERICOBJ
// obj has been published in study. Its refcount has been incremented.
// It is safe to decrement its refcount
// so that it will be destroyed when the entry in study will be removed
if (aMeshSO)
aMeshVar->UnRegister();
#endif
} }
return true; return true;
} }
@ -1741,8 +1723,9 @@ bool SMESHGUI_MeshOp::createSubMesh( QString& theMess, QStringList& theEntryList
GEOM::GEOM_Object_wrap aGroupVar = op->CreateGroup(mainGeom, aGroupType); GEOM::GEOM_Object_wrap aGroupVar = op->CreateGroup(mainGeom, aGroupType);
op->UnionList(aGroupVar, aSeq); op->UnionList(aGroupVar, aSeq);
if (op->IsDone()) { if (op->IsDone())
aGeomVar = aGroupVar.in(); {
aGeomVar = GEOM::GEOM_Object::_duplicate( aGroupVar.in() );
// publish the GEOM group in study // publish the GEOM group in study
QString aNewGeomGroupName ("Auto_group_for_"); QString aNewGeomGroupName ("Auto_group_for_");
@ -1918,32 +1901,25 @@ SMESH::SMESH_Hypothesis_var SMESHGUI_MeshOp::getAlgo( const int theDim )
if (aHypData) if (aHypData)
{ {
QString aClientLibName = aHypData->ClientLibName; QString aClientLibName = aHypData->ClientLibName;
if (aClientLibName == "") if ( aClientLibName.isEmpty() )
{ {
// Call hypothesis creation server method (without GUI) // Call hypothesis creation server method (without GUI)
SMESH::SMESH_Hypothesis_var aHyp = SMESH::SMESH_Hypothesis_var aHyp =
SMESH::CreateHypothesis(aHypName, aHypName, true); SMESH::CreateHypothesis(aHypName, aHypName, true);
#ifdef WITHGENERICOBJ aHyp.out();
if (!CORBA::is_nil(aHyp))
aHyp->UnRegister();
#endif
} }
else else
{ {
// Get hypotheses creator client (GUI) // Get hypotheses creator client (GUI)
// BUG 0020378
SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator(aHypName); SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator(aHypName);
// Create algorithm // Create algorithm
if (aCreator) if (aCreator)
aCreator->create(true, aHypName, myDlg, 0, QString::null ); aCreator->create( true, aHypName, myDlg, 0, QString::null );
else { else {
SMESH::SMESH_Hypothesis_var aHyp = SMESH::SMESH_Hypothesis_var aHyp =
SMESH::CreateHypothesis(aHypName, aHypName, true); SMESH::CreateHypothesis(aHypName, aHypName, true);
#ifdef WITHGENERICOBJ aHyp.out();
if (!CORBA::is_nil(aHyp))
aHyp->UnRegister();
#endif
} }
} }
QStringList tmpList; QStringList tmpList;

View File

@ -1212,7 +1212,7 @@ bool SMESHGUI_CuttingOfQuadsDlg::process (SMESH::SMESH_MeshEditor_ptr theEditor,
{ {
if ( hasObj ) if ( hasObj )
return theEditor->QuadTo4Tri( obj ), true; return theEditor->QuadTo4Tri( obj ), true;
SMESH::SMESH_IDSource_var elems = theEditor->MakeIDSource( theIds, SMESH::FACE ); SMESH::SMESH_IDSource_wrap elems = theEditor->MakeIDSource( theIds, SMESH::FACE );
theEditor->QuadTo4Tri( elems ); theEditor->QuadTo4Tri( elems );
return true; return true;
} }
@ -1466,9 +1466,11 @@ bool SMESHGUI_CuttingIntoTetraDlg::process (SMESH::SMESH_MeshEditor_ptr theEdito
const SMESH::long_array& theIds, const SMESH::long_array& theIds,
SMESH::SMESH_IDSource_ptr theObj) SMESH::SMESH_IDSource_ptr theObj)
{ {
SMESH::SMESH_IDSource_var obj = theObj; SMESH::SMESH_IDSource_wrap obj = theObj;
if ( CORBA::is_nil( obj )) if ( CORBA::is_nil( obj ))
obj = theEditor->MakeIDSource( theIds, myEntityType ? SMESH::VOLUME : SMESH::FACE ); obj = theEditor->MakeIDSource( theIds, myEntityType ? SMESH::VOLUME : SMESH::FACE );
else
obj->Register();
try { try {
theEditor->SplitVolumesIntoTetra( obj, myGroupChoice->checkedId()+1 ); theEditor->SplitVolumesIntoTetra( obj, myGroupChoice->checkedId()+1 );
} }
@ -1476,5 +1478,8 @@ bool SMESHGUI_CuttingIntoTetraDlg::process (SMESH::SMESH_MeshEditor_ptr theEdito
SalomeApp_Tools::QtCatchCorbaException( S_ex ); SalomeApp_Tools::QtCatchCorbaException( S_ex );
return false; return false;
} }
catch(...) {
return false;
}
return true; return true;
} }

View File

@ -85,9 +85,6 @@ enum { MOVE_ELEMS_BUTTON = 0, COPY_ELEMS_BUTTON, MAKE_MESH_BUTTON }; //!< action
#define SPACING 8 #define SPACING 8
#define MARGIN 11 #define MARGIN 11
//To disable automatic genericobj management, the following line should be commented.
//Otherwise, it should be uncommented. Refer to KERNEL_SRC/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx
#define WITHGENERICOBJ
//================================================================================= //=================================================================================
// class : SMESHGUI_RotationDlg() // class : SMESHGUI_RotationDlg()
@ -494,12 +491,6 @@ bool SMESHGUI_RotationDlg::ClickOnApply()
if (!mesh->_is_nil()) { if (!mesh->_is_nil()) {
if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( mesh ) ) if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( mesh ) )
anEntryList.append( aSObject->GetID().c_str() ); anEntryList.append( aSObject->GetID().c_str() );
#ifdef WITHGENERICOBJ
// obj has been published in study. Its refcount has been incremented.
// It is safe to decrement its refcount
// so that it will be destroyed when the entry in study will be removed
mesh->UnRegister();
#endif
} }
} }
} }
@ -511,12 +502,6 @@ bool SMESHGUI_RotationDlg::ClickOnApply()
if (!mesh->_is_nil()) { if (!mesh->_is_nil()) {
if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( mesh ) ) if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( mesh ) )
anEntryList.append( aSObject->GetID().c_str() ); anEntryList.append( aSObject->GetID().c_str() );
#ifdef WITHGENERICOBJ
// obj has been published in study. Its refcount has been incremented.
// It is safe to decrement its refcount
// so that it will be destroyed when the entry in study will be removed
mesh->UnRegister();
#endif
} }
} }
break; break;

View File

@ -100,10 +100,6 @@ private:
#define SPACING 6 #define SPACING 6
#define MARGIN 11 #define MARGIN 11
//To disable automatic genericobj management, the following line should be commented.
//Otherwise, it should be uncommented. Refer to KERNEL_SRC/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx
#define WITHGENERICOBJ
//================================================================================= //=================================================================================
// class : SMESHGUI_ScaleDlg() // class : SMESHGUI_ScaleDlg()
// purpose : // purpose :
@ -489,8 +485,9 @@ bool SMESHGUI_ScaleDlg::ClickOnApply()
} }
else { else {
SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[0]->GetMeshEditor(); SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[0]->GetMeshEditor();
SMESH::SMESH_IDSource_wrap src = aMeshEditor->MakeIDSource(anElementsId, SMESH::ALL);
myMeshes[0]->SetParameters( aParameters.join( ":" ).toLatin1().constData() ); myMeshes[0]->SetParameters( aParameters.join( ":" ).toLatin1().constData() );
aMeshEditor->Scale(aMeshEditor->MakeIDSource(anElementsId, SMESH::ALL), aPoint, aScaleFact, false); aMeshEditor->Scale( src, aPoint, aScaleFact, false);
} }
break; break;
@ -505,8 +502,9 @@ bool SMESHGUI_ScaleDlg::ClickOnApply()
} }
else { else {
SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[0]->GetMeshEditor(); SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[0]->GetMeshEditor();
SMESH::SMESH_IDSource_wrap src = aMeshEditor->MakeIDSource(anElementsId, SMESH::ALL);
myMeshes[0]->SetParameters(aParameters.join( ":" ).toLatin1().constData()); myMeshes[0]->SetParameters(aParameters.join( ":" ).toLatin1().constData());
groups = aMeshEditor->ScaleMakeGroups(aMeshEditor->MakeIDSource(anElementsId, SMESH::ALL), aPoint, aScaleFact); groups = aMeshEditor->ScaleMakeGroups( src, aPoint, aScaleFact);
} }
} }
else { else {
@ -519,8 +517,9 @@ bool SMESHGUI_ScaleDlg::ClickOnApply()
} }
else { else {
SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[0]->GetMeshEditor(); SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[0]->GetMeshEditor();
SMESH::SMESH_IDSource_wrap src = aMeshEditor->MakeIDSource(anElementsId, SMESH::ALL);
myMeshes[0]->SetParameters(aParameters.join( ":" ).toLatin1().constData()); myMeshes[0]->SetParameters(aParameters.join( ":" ).toLatin1().constData());
aMeshEditor->Scale(aMeshEditor->MakeIDSource(anElementsId, SMESH::ALL), aPoint, aScaleFact, true); aMeshEditor->Scale( src, aPoint, aScaleFact, true);
} }
} }
break; break;
@ -536,27 +535,16 @@ bool SMESHGUI_ScaleDlg::ClickOnApply()
aName.toLatin1().data()); aName.toLatin1().data());
if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( mesh ) ) if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( mesh ) )
anEntryList.append( aSObject->GetID().c_str() ); anEntryList.append( aSObject->GetID().c_str() );
#ifdef WITHGENERICOBJ
// obj has been published in study. Its refcount has been incremented.
// It is safe to decrement its refcount
// so that it will be destroyed when the entry in study will be removed
mesh->UnRegister();
#endif
} }
} }
else { else {
SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[0]->GetMeshEditor(); SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[0]->GetMeshEditor();
myMeshes[0]->SetParameters(aParameters.join( ":" ).toLatin1().constData()); myMeshes[0]->SetParameters(aParameters.join( ":" ).toLatin1().constData());
mesh = aMeshEditor->ScaleMakeMesh(aMeshEditor->MakeIDSource(anElementsId, SMESH::ALL), aPoint, aScaleFact, makeGroups, SMESH::SMESH_IDSource_wrap src = aMeshEditor->MakeIDSource(anElementsId, SMESH::ALL);
mesh = aMeshEditor->ScaleMakeMesh( src, aPoint, aScaleFact, makeGroups,
LineEditNewMesh->text().toLatin1().data()); LineEditNewMesh->text().toLatin1().data());
if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( mesh ) ) if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( mesh ) )
anEntryList.append( aSObject->GetID().c_str() ); anEntryList.append( aSObject->GetID().c_str() );
#ifdef WITHGENERICOBJ
// obj has been published in study. Its refcount has been incremented.
// It is safe to decrement its refcount
// so that it will be destroyed when the entry in study will be removed
mesh->UnRegister();
#endif
} }
break; break;
} }
@ -1158,7 +1146,8 @@ void SMESHGUI_ScaleDlg::onDisplaySimulation( bool toDisplayPreview ) {
} }
else { else {
SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[0]->GetMeshEditPreviewer(); SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[0]->GetMeshEditPreviewer();
aMeshEditor->Scale(aMeshEditor->MakeIDSource(anElementsId, SMESH::ALL), aPoint, aScaleFact, copy); SMESH::SMESH_IDSource_wrap src = aMeshEditor->MakeIDSource(anElementsId, SMESH::ALL);
aMeshEditor->Scale( src, aPoint, aScaleFact, copy);
aMeshPreviewStruct << aMeshEditor->GetPreviewData(); aMeshPreviewStruct << aMeshEditor->GetPreviewData();
} }
setSimulationPreview(aMeshPreviewStruct); setSimulationPreview(aMeshPreviewStruct);

View File

@ -85,10 +85,6 @@ enum { MOVE_ELEMS_BUTTON = 0, COPY_ELEMS_BUTTON, MAKE_MESH_BUTTON }; //!< action
#define SPACING 6 #define SPACING 6
#define MARGIN 11 #define MARGIN 11
//To disable automatic genericobj management, the following line should be commented.
//Otherwise, it should be uncommented. Refer to KERNEL_SRC/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx
#define WITHGENERICOBJ
//================================================================================= //=================================================================================
// class : SMESHGUI_SymmetryDlg() // class : SMESHGUI_SymmetryDlg()
// purpose : // purpose :
@ -556,12 +552,6 @@ bool SMESHGUI_SymmetryDlg::ClickOnApply()
aName.toLatin1().data()); aName.toLatin1().data());
if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( mesh ) ) if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( mesh ) )
anEntryList.append( aSObject->GetID().c_str() ); anEntryList.append( aSObject->GetID().c_str() );
#ifdef WITHGENERICOBJ
// obj has been published in study. Its refcount has been incremented.
// It is safe to decrement its refcount
// so that it will be destroyed when the entry in study will be removed
mesh->UnRegister();
#endif
} }
else { else {
SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[0]->GetMeshEditor(); SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[0]->GetMeshEditor();
@ -570,12 +560,6 @@ bool SMESHGUI_SymmetryDlg::ClickOnApply()
LineEditNewMesh->text().toLatin1().data()); LineEditNewMesh->text().toLatin1().data());
if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( mesh ) ) if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( mesh ) )
anEntryList.append( aSObject->GetID().c_str() ); anEntryList.append( aSObject->GetID().c_str() );
#ifdef WITHGENERICOBJ
// obj has been published in study. Its refcount has been incremented.
// It is safe to decrement its refcount
// so that it will be destroyed when the entry in study will be removed
mesh->UnRegister();
#endif
} }
} }
break; break;

View File

@ -559,11 +559,6 @@ bool SMESHGUI_TranslationDlg::ClickOnApply()
aName.toLatin1().data()); aName.toLatin1().data());
if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( mesh ) ) if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( mesh ) )
anEntryList.append( aSObject->GetID().c_str() ); anEntryList.append( aSObject->GetID().c_str() );
// obj has been published in study. Its refcount has been incremented.
// It is safe to decrement its refcount
// so that it will be destroyed when the entry in study will be removed
mesh->UnRegister();
} }
} }
else { else {
@ -573,11 +568,6 @@ bool SMESHGUI_TranslationDlg::ClickOnApply()
LineEditNewMesh->text().toLatin1().data()); LineEditNewMesh->text().toLatin1().data());
if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( mesh ) ) if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( mesh ) )
anEntryList.append( aSObject->GetID().c_str() ); anEntryList.append( aSObject->GetID().c_str() );
// obj has been published in study. Its refcount has been incremented.
// It is safe to decrement its refcount
// so that it will be destroyed when the entry in study will be removed
mesh->UnRegister();
} }
break; break;
} }

View File

@ -215,10 +215,10 @@ namespace SMESH
SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*> SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>
(SUIT_Session::session()->activeApplication()); (SUIT_Session::session()->activeApplication());
if ( app ) { if ( app ) {
QString IOR = app->orb()->object_to_string( theObject ); CORBA::String_var ior = app->orb()->object_to_string( theObject );
SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( app->activeStudy() ); SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
if ( study && !IOR.isEmpty() ) if ( study && strlen( ior ) > 0 )
res = study->studyDS()->FindObjectIOR( IOR.toLatin1().constData() ); res = study->studyDS()->FindObjectIOR( ior.in() );
} }
return res; return res;
} }

View File

@ -35,6 +35,7 @@
// SALOME KERNEL includes // SALOME KERNEL includes
#include <SALOMEDSClient_definitions.hxx> #include <SALOMEDSClient_definitions.hxx>
#include <SALOME_GenericObj_wrap.hxx>
// SALOME GUI includes // SALOME GUI includes
#include <SALOME_InteractiveObject.hxx> #include <SALOME_InteractiveObject.hxx>
@ -43,6 +44,9 @@
//OCC includes //OCC includes
#include <gp_XYZ.hxx> #include <gp_XYZ.hxx>
#include <SALOMEconfig.h>
#include CORBA_CLIENT_HEADER(SMESH_Mesh)
class SUIT_ViewWindow; class SUIT_ViewWindow;
class SUIT_Desktop; class SUIT_Desktop;
class SUIT_Study; class SUIT_Study;
@ -176,6 +180,10 @@ SMESHGUI_EXPORT
SMESHGUI_EXPORT SMESHGUI_EXPORT
gp_XYZ getNormale( const SMDS_MeshFace* theFace ); gp_XYZ getNormale( const SMDS_MeshFace* theFace );
// type to use instead of SMESH_IDSource_var for automatic UnRegister()
typedef SALOME::GenericObj_wrap<SMESH_IDSource> SMESH_IDSource_wrap;
} }
#endif // SMESHGUI_UTILS_H #endif // SMESHGUI_UTILS_H

View File

@ -559,6 +559,22 @@
<source>ICON_SPLIT_TO_TETRA</source> <source>ICON_SPLIT_TO_TETRA</source>
<translation>split_into_tetra.png</translation> <translation>split_into_tetra.png</translation>
</message> </message>
<message>
<source>ICON_MEASURE_LENGTH</source>
<translation>mesh_measure_length.png</translation>
</message>
<message>
<source>ICON_MEASURE_AREA</source>
<translation>mesh_measure_area.png</translation>
</message>
<message>
<source>ICON_MEASURE_VOLUME</source>
<translation>mesh_measure_volume.png</translation>
</message>
<message>
<source>ICON_MEASURE_BASIC_PROPS</source>
<translation>mesh_measure_basic_props.png</translation>
</message>
<message> <message>
<source>ICON_MEASURE_MIN_DIST</source> <source>ICON_MEASURE_MIN_DIST</source>
<translation>mesh_min_dist.png</translation> <translation>mesh_min_dist.png</translation>

View File

@ -712,6 +712,46 @@
<source>TOP_MEASURE_BND_BOX</source> <source>TOP_MEASURE_BND_BOX</source>
<translation>Bounding box</translation> <translation>Bounding box</translation>
</message> </message>
<message>
<source>MEN_BASIC_PROPERTIES</source>
<translation>Basic Properties</translation>
</message>
<message>
<source>MEN_MEASURE_LENGTH</source>
<translation>Length</translation>
</message>
<message>
<source>STB_MEASURE_LENGTH</source>
<translation>Calculate sum of length of all 1D elements of the selected object(s)</translation>
</message>
<message>
<source>TOP_MEASURE_LENGTH</source>
<translation>Length</translation>
</message>
<message>
<source>MEN_MEASURE_AREA</source>
<translation>Area</translation>
</message>
<message>
<source>STB_MEASURE_AREA</source>
<translation>Calculate sum of area of all 2D elements of the selected object(s)</translation>
</message>
<message>
<source>TOP_MEASURE_AREA</source>
<translation>Area</translation>
</message>
<message>
<source>MEN_MEASURE_VOLUME</source>
<translation>Volume</translation>
</message>
<message>
<source>STB_MEASURE_VOLUME</source>
<translation>Calculate sum of volume of all 3D elements of the selected object(s)</translation>
</message>
<message>
<source>TOP_MEASURE_VOLUME</source>
<translation>Volume</translation>
</message>
<message> <message>
<source>MEN_MOVE</source> <source>MEN_MOVE</source>
<translation>Move Node</translation> <translation>Move Node</translation>
@ -1649,6 +1689,10 @@ Do you want to continue ?</translation>
<source>SMESH_FACE</source> <source>SMESH_FACE</source>
<translation>Face</translation> <translation>Face</translation>
</message> </message>
<message>
<source>SMESH_FACES</source>
<translation>Faces</translation>
</message>
<message> <message>
<source>SMESH_FEATUREANGLE</source> <source>SMESH_FEATUREANGLE</source>
<translation>Feature Angle</translation> <translation>Feature Angle</translation>
@ -2655,6 +2699,10 @@ Consider saving your work before application crash</translation>
<source>SMESH_VOLUME</source> <source>SMESH_VOLUME</source>
<translation>Volume</translation> <translation>Volume</translation>
</message> </message>
<message>
<source>SMESH_VOLUMES</source>
<translation>Volumes</translation>
</message>
<message> <message>
<source>SMESH_WARNING</source> <source>SMESH_WARNING</source>
<translation>Warning</translation> <translation>Warning</translation>
@ -2717,14 +2765,15 @@ Consider saving your work before application crash</translation>
</message> </message>
<message> <message>
<source>SMESH_WRN_SIZE_LIMIT_EXCEEDED</source> <source>SMESH_WRN_SIZE_LIMIT_EXCEEDED</source>
<translation>No automatic update of the presentation has been done: new mesh size (%1 elements) exceeds current size limit (%2 elements). <translation>No automatic update of the presentation has been done:
Please check preferences of Mesh module. New mesh size (%1 elements) exceeds current size limit of automatic update (%2 elements).
</translation> </translation>
</message> </message>
<message> <message>
<source>SMESH_WRN_SIZE_INC_LIMIT_EXCEEDED</source> <source>SMESH_WRN_SIZE_INC_LIMIT_EXCEEDED</source>
<translation>New mesh sise (%1 elements) exceeds current size limit (%2 elements). <translation>New mesh size (%1 elements) exceeds current size limit of automatic update (%2 elements).
Not all mesh elements are shown. Please check preferences of Mesh module. The following elements are not shown: %3.
Use Display Entity menu command to show them.
</translation> </translation>
</message> </message>
<message> <message>
@ -7247,6 +7296,18 @@ as they are of improper type:
<source>CTRL_INFO</source> <source>CTRL_INFO</source>
<translation>Quality Info</translation> <translation>Quality Info</translation>
</message> </message>
<message>
<source>BUT_DUMP_MESH</source>
<translation>&amp;Dump</translation>
</message>
<message>
<source>TEXT_FILES</source>
<translation>Text files (*.txt)</translation>
</message>
<message>
<source>SAVE_INFO</source>
<translation>Save info</translation>
</message>
</context> </context>
<context> <context>
<name>SMESHGUI_MinDistance</name> <name>SMESHGUI_MinDistance</name>
@ -7287,6 +7348,33 @@ as they are of improper type:
<translation>Distance</translation> <translation>Distance</translation>
</message> </message>
</context> </context>
<context>
<name>SMESHGUI_BasicProperties</name>
<message>
<source>PROPERTY</source>
<translation>Property</translation>
</message>
<message>
<source>LENGTH</source>
<translation>Length</translation>
</message>
<message>
<source>AREA</source>
<translation>Area</translation>
</message>
<message>
<source>VOLUME</source>
<translation>Volume</translation>
</message>
<message>
<source>SOURCE_MESH_SUBMESH_GROUP</source>
<translation>Source (mesh, sub-mesh or group)</translation>
</message>
<message>
<source>COMPUTE</source>
<translation>Compute</translation>
</message>
</context>
<context> <context>
<name>SMESHGUI_CopyMeshDlg</name> <name>SMESHGUI_CopyMeshDlg</name>
<message> <message>
@ -7316,6 +7404,10 @@ as they are of improper type:
<source>BND_BOX</source> <source>BND_BOX</source>
<translation>Bounding Box</translation> <translation>Bounding Box</translation>
</message> </message>
<message>
<source>BASIC_PROPERTIES</source>
<translation>Basic Properties</translation>
</message>
</context> </context>
<context> <context>
<name>SMESHGUI_BoundingBox</name> <name>SMESHGUI_BoundingBox</name>

View File

@ -748,6 +748,46 @@
<source>TOP_MEASURE_BND_BOX</source> <source>TOP_MEASURE_BND_BOX</source>
<translation>Boîte englobante</translation> <translation>Boîte englobante</translation>
</message> </message>
<message>
<source>MEN_BASIC_PROPERTIES</source>
<translation type="unfinished">Basic Properties</translation>
</message>
<message>
<source>MEN_MEASURE_LENGTH</source>
<translation type="unfinished">Length</translation>
</message>
<message>
<source>STB_MEASURE_LENGTH</source>
<translation type="unfinished">Calculate sum of length of all 1D elements of the selected object(s)</translation>
</message>
<message>
<source>TOP_MEASURE_LENGTH</source>
<translation type="unfinished">Length</translation>
</message>
<message>
<source>MEN_MEASURE_AREA</source>
<translation type="unfinished">Area</translation>
</message>
<message>
<source>STB_MEASURE_AREA</source>
<translation type="unfinished">Calculate sum of area of all 2D elements of the selected object(s)</translation>
</message>
<message>
<source>TOP_MEASURE_AREA</source>
<translation type="unfinished">Area</translation>
</message>
<message>
<source>MEN_MEASURE_VOLUME</source>
<translation type="unfinished">Volume</translation>
</message>
<message>
<source>STB_MEASURE_VOLUME</source>
<translation type="unfinished">Calculate sum of volume of all 3D elements of the selected object(s)</translation>
</message>
<message>
<source>TOP_MEASURE_VOLUME</source>
<translation type="unfinished">Volume</translation>
</message>
<message> <message>
<source>MEN_MOVE</source> <source>MEN_MOVE</source>
<translation>Déplacer un nœud</translation> <translation>Déplacer un nœud</translation>
@ -1677,6 +1717,10 @@ Voulez-vous continuer ?</translation>
<source>SMESH_FACE</source> <source>SMESH_FACE</source>
<translation>Face</translation> <translation>Face</translation>
</message> </message>
<message>
<source>SMESH_FACES</source>
<translation>Faces</translation>
</message>
<message> <message>
<source>SMESH_FEATUREANGLE</source> <source>SMESH_FEATUREANGLE</source>
<translation>Montrer l&apos;angle</translation> <translation>Montrer l&apos;angle</translation>
@ -2663,6 +2707,10 @@ Enregistrez votre travail avant que l&apos;application se plante</translation>
<source>SMESH_VOLUME</source> <source>SMESH_VOLUME</source>
<translation>Volume</translation> <translation>Volume</translation>
</message> </message>
<message>
<source>SMESH_VOLUMES</source>
<translation>Volumes</translation>
</message>
<message> <message>
<source>SMESH_WARNING</source> <source>SMESH_WARNING</source>
<translation>Avertissement</translation> <translation>Avertissement</translation>
@ -2725,14 +2773,16 @@ Enregistrez votre travail avant que l&apos;application se plante</translation>
</message> </message>
<message> <message>
<source>SMESH_WRN_SIZE_LIMIT_EXCEEDED</source> <source>SMESH_WRN_SIZE_LIMIT_EXCEEDED</source>
<translation>La présentation n&apos;a pas é mise à jour automatiquement: la nouvelle taille du maillage (%1 éléments) dépasse la limite de taille actuelle (%2 éléments). <translation>La présentation n&apos;a pas é mise à jour automatiquement:
la nouvelle taille du maillage (%1 éléments) dépasse la limite de taille actuelle (%2 éléments).
Vérifiez la limite dans les préférences du module Mesh. Vérifiez la limite dans les préférences du module Mesh.
</translation> </translation>
</message> </message>
<message> <message>
<source>SMESH_WRN_SIZE_INC_LIMIT_EXCEEDED</source> <source>SMESH_WRN_SIZE_INC_LIMIT_EXCEEDED</source>
<translation type="unfinished">New mesh sise (%1 elements) exceeds current size limit (%2 elements). <translation>La nouvelle taille de maillage (%1 éléments) dépasse l'actuelle taille limite de la mise à jour automatique (%2 éléments).
Not all mesh elements are shown. Please check preferences of Mesh module. Les éléments suivants ne sont pas affichés: %3.
Utilisez le menu "Visualiser une entité" pour les afficher.
</translation> </translation>
</message> </message>
<message> <message>
@ -7228,6 +7278,18 @@ en raison de leurs types incompatibles:
</context> </context>
<context> <context>
<name>SMESHGUI_CtrlInfoDlg</name> <name>SMESHGUI_CtrlInfoDlg</name>
<message>
<source>SAVE_INFO</source>
<translation type="unfinished">Save info</translation>
</message>
<message>
<source>TEXT_FILES</source>
<translation type="unfinished">Text files (*.txt)</translation>
</message>
<message>
<source>BUT_DUMP_MESH</source>
<translation type="unfinished">&amp;Dump</translation>
</message>
<message> <message>
<source>CTRL_INFO</source> <source>CTRL_INFO</source>
<translation type="unfinished">Quality Info</translation> <translation type="unfinished">Quality Info</translation>
@ -7272,6 +7334,33 @@ en raison de leurs types incompatibles:
<translation>Distance</translation> <translation>Distance</translation>
</message> </message>
</context> </context>
<context>
<name>SMESHGUI_BasicProperties</name>
<message>
<source>PROPERTY</source>
<translation type="unfinished">Property</translation>
</message>
<message>
<source>LENGTH</source>
<translation type="unfinished">Length</translation>
</message>
<message>
<source>AREA</source>
<translation type="unfinished">Area</translation>
</message>
<message>
<source>VOLUME</source>
<translation type="unfinished">Volume</translation>
</message>
<message>
<source>SOURCE_MESH_SUBMESH_GROUP</source>
<translation type="unfinished">Source (mesh, sub-mesh or group)</translation>
</message>
<message>
<source>COMPUTE</source>
<translation type="unfinished">Compute</translation>
</message>
</context>
<context> <context>
<name>SMESHGUI_CopyMeshDlg</name> <name>SMESHGUI_CopyMeshDlg</name>
<message> <message>
@ -7301,6 +7390,10 @@ en raison de leurs types incompatibles:
<source>BND_BOX</source> <source>BND_BOX</source>
<translation>Boîte englobante</translation> <translation>Boîte englobante</translation>
</message> </message>
<message>
<source>BASIC_PROPERTIES</source>
<translation type="unfinished">Basic Properties</translation>
</message>
</context> </context>
<context> <context>
<name>SMESHGUI_BoundingBox</name> <name>SMESHGUI_BoundingBox</name>

7003
src/SMESHGUI/SMESH_msg_ja.ts Normal file

File diff suppressed because it is too large Load Diff

View File

@ -210,7 +210,7 @@ namespace // Utils used in SMESH_ElementSearcherImpl::FindElementsByPoint()
void getElementsInSphere ( const gp_XYZ& center, void getElementsInSphere ( const gp_XYZ& center,
const double radius, TIDSortedElemSet& foundElems); const double radius, TIDSortedElemSet& foundElems);
size_t getSize() { return std::max( _size, _elements.size() ); } size_t getSize() { return std::max( _size, _elements.size() ); }
~ElementBndBoxTree(); virtual ~ElementBndBoxTree();
protected: protected:
ElementBndBoxTree():_size(0) {} ElementBndBoxTree():_size(0) {}
@ -410,6 +410,10 @@ namespace // Utils used in SMESH_ElementSearcherImpl::FindElementsByPoint()
*/ */
//======================================================================= //=======================================================================
SMESH_ElementSearcher::~SMESH_ElementSearcher()
{
}
struct SMESH_ElementSearcherImpl: public SMESH_ElementSearcher struct SMESH_ElementSearcherImpl: public SMESH_ElementSearcher
{ {
SMDS_Mesh* _mesh; SMDS_Mesh* _mesh;
@ -423,7 +427,7 @@ struct SMESH_ElementSearcherImpl: public SMESH_ElementSearcher
SMESH_ElementSearcherImpl( SMDS_Mesh& mesh, SMDS_ElemIteratorPtr elemIt=SMDS_ElemIteratorPtr()) SMESH_ElementSearcherImpl( SMDS_Mesh& mesh, SMDS_ElemIteratorPtr elemIt=SMDS_ElemIteratorPtr())
: _mesh(&mesh),_meshPartIt(elemIt),_ebbTree(0),_nodeSearcher(0),_tolerance(-1),_outerFacesFound(false) {} : _mesh(&mesh),_meshPartIt(elemIt),_ebbTree(0),_nodeSearcher(0),_tolerance(-1),_outerFacesFound(false) {}
~SMESH_ElementSearcherImpl() virtual ~SMESH_ElementSearcherImpl()
{ {
if ( _ebbTree ) delete _ebbTree; _ebbTree = 0; if ( _ebbTree ) delete _ebbTree; _ebbTree = 0;
if ( _nodeSearcher ) delete _nodeSearcher; _nodeSearcher = 0; if ( _nodeSearcher ) delete _nodeSearcher; _nodeSearcher = 0;

View File

@ -87,6 +87,7 @@ struct SMESH_ElementSearcher
* \brief Find out if the given point is out of closed 2D mesh. * \brief Find out if the given point is out of closed 2D mesh.
*/ */
virtual TopAbs_State GetPointState(const gp_Pnt& point) = 0; virtual TopAbs_State GetPointState(const gp_Pnt& point) = 0;
virtual ~SMESH_ElementSearcher();
}; };
namespace SMESH_MeshAlgos namespace SMESH_MeshAlgos

View File

@ -49,6 +49,7 @@ public:
// Constructor. limit must be provided at tree root construction. // Constructor. limit must be provided at tree root construction.
// limit will be deleted by SMESH_Octree // limit will be deleted by SMESH_Octree
SMESH_Octree (SMESH_TreeLimit* limit=0); SMESH_Octree (SMESH_TreeLimit* limit=0);
virtual ~SMESH_Octree() {};
// Compute the bigger dimension of my box // Compute the bigger dimension of my box
double maxSize() const; double maxSize() const;

View File

@ -332,24 +332,22 @@ void SMESH_OctreeNode::FindCoincidentNodes (const SMDS_MeshNode * Node,
list<const SMDS_MeshNode*>* Result, list<const SMDS_MeshNode*>* Result,
const double precision) const double precision)
{ {
gp_XYZ p(Node->X(), Node->Y(), Node->Z()); gp_Pnt p1 (Node->X(), Node->Y(), Node->Z());
bool isInsideBool = isInside(p, precision); bool isInsideBool = isInside( p1.XYZ(), precision );
if (isInsideBool) if (isInsideBool)
{ {
// I'm only looking in the leaves, since all the nodes are stored there. // I'm only looking in the leaves, since all the nodes are stored there.
if (isLeaf()) if (isLeaf())
{ {
gp_Pnt p1 (Node->X(), Node->Y(), Node->Z()); TIDSortedNodeSet::iterator it = myNodes.begin();
const double tol2 = precision * precision;
TIDSortedNodeSet myNodesCopy = myNodes;
TIDSortedNodeSet::iterator it = myNodesCopy.begin();
double tol2 = precision * precision;
bool squareBool; bool squareBool;
while (it != myNodesCopy.end()) while (it != myNodes.end())
{ {
const SMDS_MeshNode* n2 = *it; const SMDS_MeshNode* n2 = *it;
squareBool = false;
// We're only looking at nodes with a superior Id. // We're only looking at nodes with a superior Id.
// JFA: Why? // JFA: Why?
//if (Node->GetID() < n2->GetID()) //if (Node->GetID() < n2->GetID())
@ -364,14 +362,13 @@ void SMESH_OctreeNode::FindCoincidentNodes (const SMDS_MeshNode * Node,
{ {
Result->insert(Result->begin(), n2); Result->insert(Result->begin(), n2);
SetOfNodes->erase( n2 ); SetOfNodes->erase( n2 );
myNodes.erase( n2 ); myNodes.erase( *it++ ); // it++ goes forward and returns it's previous position
} }
} }
//myNodesCopy.erase( it ); if ( !squareBool )
//it = myNodesCopy.begin();
it++; it++;
} }
if (Result->size() > 0) if ( !Result->empty() )
myNodes.erase(Node); // JFA: for bug 0020185 myNodes.erase(Node); // JFA: for bug 0020185
} }
else else

View File

@ -85,7 +85,7 @@ class SMESH_Tree
static int nbChildren() { return NB_CHILDREN; } static int nbChildren() { return NB_CHILDREN; }
// Compute the bigger dimension of my box // Compute the biggest dimension of my box
virtual double maxSize() const = 0; virtual double maxSize() const = 0;
protected: protected:
@ -141,7 +141,7 @@ SMESH_Tree<BND_BOX,NB_CHILDREN>::SMESH_Tree (SMESH_TreeLimit* limit):
myLevel(0), myLevel(0),
myBox(0) myBox(0)
{ {
if ( !myLimit ) myLimit = new SMESH_TreeLimit(); //if ( !myLimit ) myLimit = new SMESH_TreeLimit();
} }
//================================================================================ //================================================================================
@ -155,6 +155,7 @@ void SMESH_Tree<BND_BOX,NB_CHILDREN>::compute()
{ {
if ( myLevel==0 ) if ( myLevel==0 )
{ {
if ( !myLimit ) myLimit = new SMESH_TreeLimit();
myBox = buildRootBox(); myBox = buildRootBox();
if ( myLimit->myMinBoxSize > 0. && maxSize() <= myLimit->myMinBoxSize ) if ( myLimit->myMinBoxSize > 0. && maxSize() <= myLimit->myMinBoxSize )
myIsLeaf = true; myIsLeaf = true;
@ -218,6 +219,8 @@ void SMESH_Tree<BND_BOX,NB_CHILDREN>::buildChildren()
myChildren[i] = newChild(); myChildren[i] = newChild();
// and we assign to him its box. // and we assign to him its box.
myChildren[i]->myFather = this; myChildren[i]->myFather = this;
if (myChildren[i]->myLimit)
delete myChildren[i]->myLimit;
myChildren[i]->myLimit = myLimit; myChildren[i]->myLimit = myLimit;
myChildren[i]->myLevel = myLevel + 1; myChildren[i]->myLevel = myLevel + 1;
myChildren[i]->myBox = newChildBox( i ); myChildren[i]->myBox = newChildBox( i );

View File

@ -110,6 +110,11 @@ libSMESHEngine_la_LDFLAGS = \
../SMESHDS/libSMESHDS.la \ ../SMESHDS/libSMESHDS.la \
../Controls/libSMESHControls.la \ ../Controls/libSMESHControls.la \
$(KERNEL_LDFLAGS) \ $(KERNEL_LDFLAGS) \
-lOpUtil \
-lSalomeNotification \
-lResourcesManager \
-lSalomeResourcesManager \
-lSALOMEBasics \
-lSalomeContainer \ -lSalomeContainer \
-lSalomeNS \ -lSalomeNS \
-lRegistry \ -lRegistry \

View File

@ -369,7 +369,8 @@ namespace {
"ExtrusionSweepObject1D","ExtrusionSweepObject1DMakeGroups", "ExtrusionSweepObject1D","ExtrusionSweepObject1DMakeGroups",
"ExtrusionSweepObject2D","ExtrusionSweepObject2DMakeGroups", "ExtrusionSweepObject2D","ExtrusionSweepObject2DMakeGroups",
"Translate","TranslateMakeGroups","TranslateMakeMesh", "Translate","TranslateMakeGroups","TranslateMakeMesh",
"TranslateObject","TranslateObjectMakeGroups", "TranslateObjectMakeMesh" "TranslateObject","TranslateObjectMakeGroups", "TranslateObjectMakeMesh",
"ExtrusionAlongPathX","ExtrusionAlongPathObjX"
,"" }; // <- mark of the end ,"" }; // <- mark of the end
methodsAcceptingList.Insert( methodNames ); methodsAcceptingList.Insert( methodNames );
} }
@ -621,21 +622,31 @@ Handle(_pyCommand) _pyGen::AddCommand( const TCollection_AsciiString& theCommand
// Prevent moving a command creating a sub-mesh to the end of the script // Prevent moving a command creating a sub-mesh to the end of the script
// if the sub-mesh is used in theCommand as argument // if the sub-mesh is used in theCommand as argument
if ( _pySubMesh::CanBeArgOfMethod( aCommand->GetMethod() )) // if ( _pySubMesh::CanBeArgOfMethod( aCommand->GetMethod() ))
{ // {
PlaceSubmeshAfterItsCreation( aCommand ); // PlaceSubmeshAfterItsCreation( aCommand );
} // }
// Method( SMESH.PointStruct(x,y,z) -> Method( [x,y,z] // Method( SMESH.PointStruct(x,y,z)... -> Method( [x,y,z]...
StructToList( aCommand ); StructToList( aCommand );
// not to erase _pySelfEraser's etc. used as args in some commands
std::list< _pyID >::const_iterator id = myKeepAgrCmdsIDs.begin();
for ( ; id != myKeepAgrCmdsIDs.end(); ++id )
if ( *id != objID && theCommand.Search( *id ) > id->Length() )
{
Handle(_pyObject) obj = FindObject( *id );
if ( !obj.IsNull() )
obj->AddArgCmd( aCommand );
}
// Find an object to process theCommand // Find an object to process theCommand
// SMESH_Gen method? // SMESH_Gen method?
if ( objID == this->GetID() || objID == SMESH_2smeshpy::GenName()) if ( objID == this->GetID() || objID == SMESH_2smeshpy::GenName())
{ {
this->Process( aCommand ); this->Process( aCommand );
addFilterUser( aCommand, theGen ); // protect filters from clearing //addFilterUser( aCommand, theGen ); // protect filters from clearing
return aCommand; return aCommand;
} }
@ -656,13 +667,14 @@ Handle(_pyCommand) _pyGen::AddCommand( const TCollection_AsciiString& theCommand
else if ( aCommand->GetMethod() == "GetSubMesh" ) { // SubMesh creation else if ( aCommand->GetMethod() == "GetSubMesh" ) { // SubMesh creation
_pyID subMeshID = aCommand->GetResultValue(); _pyID subMeshID = aCommand->GetResultValue();
Handle(_pySubMesh) subMesh = new _pySubMesh( aCommand ); Handle(_pySubMesh) subMesh = new _pySubMesh( aCommand );
CheckObjectIsReCreated( subMesh );
myObjects.insert( make_pair( subMeshID, subMesh )); myObjects.insert( make_pair( subMeshID, subMesh ));
} }
// Method( mesh.GetIDSource([id1,id2]) -> Method( [id1,id2] // Method( mesh.GetIDSource([id1,id2]) -> Method( [id1,id2]
GetIDSourceToList( aCommand ); GetIDSourceToList( aCommand );
addFilterUser( aCommand, theGen ); // protect filters from clearing //addFilterUser( aCommand, theGen ); // protect filters from clearing
id_mesh->second->Process( aCommand ); id_mesh->second->Process( aCommand );
id_mesh->second->AddProcessedCmd( aCommand ); id_mesh->second->AddProcessedCmd( aCommand );
@ -676,7 +688,7 @@ Handle(_pyCommand) _pyGen::AddCommand( const TCollection_AsciiString& theCommand
// Method( mesh.GetIDSource([id1,id2]) -> Method( [id1,id2] // Method( mesh.GetIDSource([id1,id2]) -> Method( [id1,id2]
GetIDSourceToList( aCommand ); GetIDSourceToList( aCommand );
addFilterUser( aCommand, theGen ); // protect filters from clearing //addFilterUser( aCommand, theGen ); // protect filters from clearing
const TCollection_AsciiString& method = aCommand->GetMethod(); const TCollection_AsciiString& method = aCommand->GetMethod();
@ -716,8 +728,9 @@ Handle(_pyCommand) _pyGen::AddCommand( const TCollection_AsciiString& theCommand
!myMeshes.count( meshID ) && !myMeshes.count( meshID ) &&
aCommand->IsStudyEntry( meshID )) aCommand->IsStudyEntry( meshID ))
{ {
TCollection_AsciiString processedCommand = aCommand->GetString(); _AString processedCommand = aCommand->GetString();
Handle(_pyMesh) mesh = new _pyMesh( aCommand, meshID ); Handle(_pyMesh) mesh = new _pyMesh( aCommand, meshID );
CheckObjectIsReCreated( mesh );
myMeshes.insert( make_pair( meshID, mesh )); myMeshes.insert( make_pair( meshID, mesh ));
aCommand->Clear(); aCommand->Clear();
aCommand->GetString() = processedCommand; // discard changes made by _pyMesh aCommand->GetString() = processedCommand; // discard changes made by _pyMesh
@ -743,11 +756,11 @@ Handle(_pyCommand) _pyGen::AddCommand( const TCollection_AsciiString& theCommand
} // SMESH_MeshEditor methods } // SMESH_MeshEditor methods
// SMESH_Hypothesis method? // SMESH_Hypothesis method?
list< Handle(_pyHypothesis) >::iterator hyp = myHypos.begin(); Handle(_pyHypothesis) hyp = FindHyp( objID );
for ( ; hyp != myHypos.end(); ++hyp ) if ( !hyp.IsNull() && !hyp->IsAlgo() )
if ( !(*hyp)->IsAlgo() && objID == (*hyp)->GetID() ) { {
(*hyp)->Process( aCommand ); hyp->Process( aCommand );
(*hyp)->AddProcessedCmd( aCommand ); hyp->AddProcessedCmd( aCommand );
return aCommand; return aCommand;
} }
@ -764,6 +777,14 @@ Handle(_pyCommand) _pyGen::AddCommand( const TCollection_AsciiString& theCommand
Handle(_pyObject) filter( new _pyFilter( aCommand, newID )); Handle(_pyObject) filter( new _pyFilter( aCommand, newID ));
AddObject( filter ); AddObject( filter );
} }
// aFreeNodes0x5011f80 = aFilterManager.CreateFreeNodes() ## issue 0020976
else if ( theCommand.Search( "aFilterManager.Create" ) > 0 )
{
// create _pySelfEraser for functors
Handle(_pySelfEraser) functor = new _pySelfEraser( aCommand );
functor->IgnoreOwnCalls(); // to erase if not used as an argument
AddObject( functor );
}
// other object method? // other object method?
map< _pyID, Handle(_pyObject) >::iterator id_obj = myObjects.find( objID ); map< _pyID, Handle(_pyObject) >::iterator id_obj = myObjects.find( objID );
@ -914,7 +935,7 @@ void _pyGen::Process( const Handle(_pyCommand)& theCommand )
if ( method == "CreateMesh" || method == "CreateEmptyMesh") if ( method == "CreateMesh" || method == "CreateEmptyMesh")
{ {
Handle(_pyMesh) mesh = new _pyMesh( theCommand ); Handle(_pyMesh) mesh = new _pyMesh( theCommand );
myMeshes.insert( make_pair( mesh->GetID(), mesh )); AddObject( mesh );
return; return;
} }
if ( method == "CreateMeshesFromUNV" || if ( method == "CreateMeshesFromUNV" ||
@ -922,7 +943,7 @@ void _pyGen::Process( const Handle(_pyCommand)& theCommand )
method == "CopyMesh" ) // command result is a mesh method == "CopyMesh" ) // command result is a mesh
{ {
Handle(_pyMesh) mesh = new _pyMesh( theCommand, theCommand->GetResultValue() ); Handle(_pyMesh) mesh = new _pyMesh( theCommand, theCommand->GetResultValue() );
myMeshes.insert( make_pair( mesh->GetID(), mesh )); AddObject( mesh );
return; return;
} }
if( method == "CreateMeshesFromMED" || if( method == "CreateMeshesFromMED" ||
@ -935,7 +956,7 @@ void _pyGen::Process( const Handle(_pyCommand)& theCommand )
_pyID meshID = theCommand->GetResultValue(ind+1); _pyID meshID = theCommand->GetResultValue(ind+1);
if ( !theCommand->IsStudyEntry( meshID ) ) continue; if ( !theCommand->IsStudyEntry( meshID ) ) continue;
Handle(_pyMesh) mesh = new _pyMesh( theCommand, theCommand->GetResultValue(ind+1)); Handle(_pyMesh) mesh = new _pyMesh( theCommand, theCommand->GetResultValue(ind+1));
myMeshes.insert( make_pair( mesh->GetID(), mesh )); AddObject( mesh );
} }
if ( method == "CreateMeshesFromGMF" ) if ( method == "CreateMeshesFromGMF" )
{ {
@ -953,13 +974,16 @@ void _pyGen::Process( const Handle(_pyCommand)& theCommand )
// issue 199929, remove standard library name (default parameter) // issue 199929, remove standard library name (default parameter)
const TCollection_AsciiString & aLibName = theCommand->GetArg( 2 ); const TCollection_AsciiString & aLibName = theCommand->GetArg( 2 );
if ( aLibName.Search( "StdMeshersEngine" ) != -1 ) { if ( aLibName.Search( "StdMeshersEngine" ) != -1 ) {
// keep first argument // keep the first argument
TCollection_AsciiString arg = theCommand->GetArg( 1 ); TCollection_AsciiString arg = theCommand->GetArg( 1 );
theCommand->RemoveArgs(); theCommand->RemoveArgs();
theCommand->SetArg( 1, arg ); theCommand->SetArg( 1, arg );
} }
myHypos.push_back( _pyHypothesis::NewHypothesis( theCommand )); Handle(_pyHypothesis) hyp = _pyHypothesis::NewHypothesis( theCommand );
CheckObjectIsReCreated( hyp );
myHypos.insert( make_pair( hyp->GetID(), hyp ));
return; return;
} }
@ -996,7 +1020,8 @@ void _pyGen::Process( const Handle(_pyCommand)& theCommand )
// SMESH_Pattern, FilterManager // SMESH_Pattern, FilterManager
if ( method == "GetPattern" || if ( method == "GetPattern" ||
method == "CreateFilterManager" || method == "CreateFilterManager" ||
method == "CreateMeasurements" ) { method == "CreateMeasurements" )
{
Handle(_pyObject) obj = new _pySelfEraser( theCommand ); Handle(_pyObject) obj = new _pySelfEraser( theCommand );
if ( !myObjects.insert( make_pair( obj->GetID(), obj )).second ) if ( !myObjects.insert( make_pair( obj->GetID(), obj )).second )
theCommand->Clear(); // already created theCommand->Clear(); // already created
@ -1009,7 +1034,7 @@ void _pyGen::Process( const Handle(_pyCommand)& theCommand )
theCommand->SetArg( theCommand->GetNbArgs() + 1, "True" ); theCommand->SetArg( theCommand->GetNbArgs() + 1, "True" );
} }
Handle(_pyMesh) mesh = new _pyMesh( theCommand, theCommand->GetResultValue() ); Handle(_pyMesh) mesh = new _pyMesh( theCommand, theCommand->GetResultValue() );
myMeshes.insert( make_pair( mesh->GetID(), mesh )); AddObject( mesh );
AddMeshAccessorMethod( theCommand ); AddMeshAccessorMethod( theCommand );
} }
else if ( method == "SetName" ) // SetName(obj,name) else if ( method == "SetName" ) // SetName(obj,name)
@ -1053,15 +1078,15 @@ void _pyGen::Flush()
map< _pyID, Handle(_pyMesh) >::iterator id_mesh; map< _pyID, Handle(_pyMesh) >::iterator id_mesh;
map< _pyID, Handle(_pyObject) >::iterator id_obj; map< _pyID, Handle(_pyObject) >::iterator id_obj;
list< Handle(_pyHypothesis) >::iterator hyp; map< _pyID, Handle(_pyHypothesis) >::iterator id_hyp;
if ( IsToKeepAllCommands() ) // historical dump if ( IsToKeepAllCommands() ) // historical dump
{ {
// set myIsPublished = true to all objects // set myIsPublished = true to all objects
for ( id_mesh = myMeshes.begin(); id_mesh != myMeshes.end(); ++id_mesh ) for ( id_mesh = myMeshes.begin(); id_mesh != myMeshes.end(); ++id_mesh )
id_mesh->second->SetRemovedFromStudy( false ); id_mesh->second->SetRemovedFromStudy( false );
for ( hyp = myHypos.begin(); hyp != myHypos.end(); ++hyp ) for ( id_hyp = myHypos.begin(); id_hyp != myHypos.end(); ++id_hyp )
(*hyp)->SetRemovedFromStudy( false ); id_hyp->second->SetRemovedFromStudy( false );
for ( id_obj = myObjects.begin(); id_obj != myObjects.end(); ++id_obj ) for ( id_obj = myObjects.begin(); id_obj != myObjects.end(); ++id_obj )
id_obj->second->SetRemovedFromStudy( false ); id_obj->second->SetRemovedFromStudy( false );
} }
@ -1070,9 +1095,9 @@ void _pyGen::Flush()
// let hypotheses find referred objects in order to prevent clearing // let hypotheses find referred objects in order to prevent clearing
// not published referred hyps (it's needed for hyps like "LayerDistribution") // not published referred hyps (it's needed for hyps like "LayerDistribution")
list< Handle(_pyMesh) > fatherMeshes; list< Handle(_pyMesh) > fatherMeshes;
for ( hyp = myHypos.begin(); hyp != myHypos.end(); ++hyp ) for ( id_hyp = myHypos.begin(); id_hyp != myHypos.end(); ++id_hyp )
if ( !hyp->IsNull() ) if ( !id_hyp->second.IsNull() )
(*hyp)->GetReferredMeshesAndGeom( fatherMeshes ); id_hyp->second->GetReferredMeshesAndGeom( fatherMeshes );
} }
// set myIsPublished = false to all objects depending on // set myIsPublished = false to all objects depending on
// meshes built on a removed geometry // meshes built on a removed geometry
@ -1086,12 +1111,12 @@ void _pyGen::Flush()
id_mesh->second->Flush(); id_mesh->second->Flush();
// Flush hyps // Flush hyps
for ( hyp = myHypos.begin(); hyp != myHypos.end(); ++hyp ) for ( id_hyp = myHypos.begin(); id_hyp != myHypos.end(); ++id_hyp )
if ( !hyp->IsNull() ) { if ( !id_hyp->second.IsNull() ) {
(*hyp)->Flush(); id_hyp->second->Flush();
// smeshgen.CreateHypothesis() --> smesh.CreateHypothesis() // smeshgen.CreateHypothesis() --> smesh.CreateHypothesis()
if ( !(*hyp)->IsWrapped() ) if ( !id_hyp->second->IsWrapped() )
(*hyp)->GetCreationCmd()->SetObject( SMESH_2smeshpy::GenName() ); id_hyp->second->GetCreationCmd()->SetObject( SMESH_2smeshpy::GenName() );
} }
// Flush other objects // Flush other objects
@ -1143,10 +1168,10 @@ void _pyGen::ClearCommands()
for ( ; id_mesh != myMeshes.end(); ++id_mesh ) for ( ; id_mesh != myMeshes.end(); ++id_mesh )
id_mesh->second->ClearCommands(); id_mesh->second->ClearCommands();
list< Handle(_pyHypothesis) >::iterator hyp = myHypos.begin(); map< _pyID, Handle(_pyHypothesis) >::iterator id_hyp = myHypos.begin();
for ( ; hyp != myHypos.end(); ++hyp ) for ( ; id_hyp != myHypos.end(); ++id_hyp )
if ( !hyp->IsNull() ) if ( !id_hyp->second.IsNull() )
(*hyp)->ClearCommands(); id_hyp->second->ClearCommands();
map< _pyID, Handle(_pyObject) >::iterator id_obj = myObjects.begin(); map< _pyID, Handle(_pyObject) >::iterator id_obj = myObjects.begin();
for ( ; id_obj != myObjects.end(); ++id_obj ) for ( ; id_obj != myObjects.end(); ++id_obj )
@ -1176,10 +1201,10 @@ void _pyGen::Free()
id_obj->second->Free(); id_obj->second->Free();
myObjects.clear(); myObjects.clear();
list< Handle(_pyHypothesis) >::iterator hyp = myHypos.begin(); map< _pyID, Handle(_pyHypothesis) >::iterator id_hyp = myHypos.begin();
for ( ; hyp != myHypos.end(); ++hyp ) for ( ; id_hyp != myHypos.end(); ++id_hyp )
if ( !hyp->IsNull() ) if ( !id_hyp->second.IsNull() )
(*hyp)->Free(); id_hyp->second->Free();
myHypos.clear(); myHypos.clear();
myFile2ExportedMesh.clear(); myFile2ExportedMesh.clear();
@ -1215,12 +1240,14 @@ bool _pyGen::AddMeshAccessorMethod( Handle(_pyCommand) theCmd ) const
bool _pyGen::AddAlgoAccessorMethod( Handle(_pyCommand) theCmd ) const bool _pyGen::AddAlgoAccessorMethod( Handle(_pyCommand) theCmd ) const
{ {
bool added = false; bool added = false;
list< Handle(_pyHypothesis) >::const_iterator hyp = myHypos.begin(); map< _pyID, Handle(_pyHypothesis) >::const_iterator id_hyp = myHypos.begin();
for ( ; hyp != myHypos.end(); ++hyp ) { for ( ; id_hyp != myHypos.end(); ++id_hyp )
if ( (*hyp)->IsAlgo() && /*(*hyp)->IsWrapped() &&*/ if ( !id_hyp->second.IsNull() &&
theCmd->AddAccessorMethod( (*hyp)->GetID(), (*hyp)->AccessorMethod() )) id_hyp->second->IsAlgo() && /*(*hyp)->IsWrapped() &&*/
theCmd->AddAccessorMethod( id_hyp->second->GetID(),
id_hyp->second->AccessorMethod() ))
added = true; added = true;
}
return added; return added;
} }
@ -1234,19 +1261,20 @@ bool _pyGen::AddAlgoAccessorMethod( Handle(_pyCommand) theCmd ) const
Handle(_pyHypothesis) _pyGen::FindHyp( const _pyID& theHypID ) Handle(_pyHypothesis) _pyGen::FindHyp( const _pyID& theHypID )
{ {
list< Handle(_pyHypothesis) >::iterator hyp = myHypos.begin(); map< _pyID, Handle(_pyHypothesis) >::iterator id_hyp = myHypos.find( theHypID );
for ( ; hyp != myHypos.end(); ++hyp ) if ( id_hyp != myHypos.end() &&
if ( !hyp->IsNull() && theHypID == (*hyp)->GetID() ) !id_hyp->second.IsNull() &&
return *hyp; theHypID == id_hyp->second->GetID() )
return id_hyp->second;
return Handle(_pyHypothesis)(); return Handle(_pyHypothesis)();
} }
//================================================================================ //================================================================================
/*! /*!
* \brief Find algorithm the created algorithm * \brief Find algorithm able to create a hypothesis
* \param theGeom - The shape ID the algorithm was created on * \param theGeom - The shape ID the algorithm was created on
* \param theMesh - The mesh ID that created the algorithm * \param theMesh - The mesh ID that created the algorithm
* \param dim - The algo dimension * \param theHypothesis - The hypothesis the algorithm sould be able to create
* \retval Handle(_pyHypothesis) - The found algo * \retval Handle(_pyHypothesis) - The found algo
*/ */
//================================================================================ //================================================================================
@ -1254,15 +1282,15 @@ Handle(_pyHypothesis) _pyGen::FindHyp( const _pyID& theHypID )
Handle(_pyHypothesis) _pyGen::FindAlgo( const _pyID& theGeom, const _pyID& theMesh, Handle(_pyHypothesis) _pyGen::FindAlgo( const _pyID& theGeom, const _pyID& theMesh,
const Handle(_pyHypothesis)& theHypothesis ) const Handle(_pyHypothesis)& theHypothesis )
{ {
list< Handle(_pyHypothesis) >::iterator hyp = myHypos.begin(); map< _pyID, Handle(_pyHypothesis) >::iterator id_hyp = myHypos.begin();
for ( ; hyp != myHypos.end(); ++hyp ) for ( ; id_hyp != myHypos.end(); ++id_hyp )
if ( !hyp->IsNull() && if ( !id_hyp->second.IsNull() &&
(*hyp)->IsAlgo() && id_hyp->second->IsAlgo() &&
theHypothesis->CanBeCreatedBy( (*hyp)->GetAlgoType() ) && theHypothesis->CanBeCreatedBy( id_hyp->second->GetAlgoType() ) &&
(*hyp)->GetGeom() == theGeom && id_hyp->second->GetGeom() == theGeom &&
(*hyp)->GetMesh() == theMesh ) id_hyp->second->GetMesh() == theMesh )
return *hyp; return id_hyp->second;
return 0; return Handle(_pyHypothesis)();
} }
//================================================================================ //================================================================================
@ -1362,28 +1390,30 @@ void _pyGen::setNeighbourCommand( Handle(_pyCommand)& theCmd,
*/ */
//================================================================================ //================================================================================
void _pyGen::addFilterUser( Handle(_pyCommand)& theCommand, const Handle(_pyObject)& user ) // void _pyGen::addFilterUser( Handle(_pyCommand)& theCommand, const Handle(_pyObject)& user )
{ // {
const char filterPrefix[] = "aFilter0x"; // No more needed after adding _pyObject::myArgCommands
if ( theCommand->GetString().Search( filterPrefix ) < 1 )
return;
for ( int i = theCommand->GetNbArgs(); i > 0; --i ) // const char filterPrefix[] = "aFilter0x";
{ // if ( theCommand->GetString().Search( filterPrefix ) < 1 )
const _AString & arg = theCommand->GetArg( i ); // return;
// NOT TREATED CASE: arg == "[something, aFilter0x36a2f60]"
if ( arg.Search( filterPrefix ) != 1 )
continue;
Handle(_pyFilter) filter = Handle(_pyFilter)::DownCast( FindObject( arg )); // for ( int i = theCommand->GetNbArgs(); i > 0; --i )
if ( !filter.IsNull() ) // {
{ // const _AString & arg = theCommand->GetArg( i );
filter->AddUser( user ); // // NOT TREATED CASE: arg == "[something, aFilter0x36a2f60]"
if ( !filter->GetNewID().IsEmpty() ) // if ( arg.Search( filterPrefix ) != 1 )
theCommand->SetArg( i, filter->GetNewID() ); // continue;
}
} // Handle(_pyFilter) filter = Handle(_pyFilter)::DownCast( FindObject( arg ));
} // if ( !filter.IsNull() )
// {
// filter->AddUser( user );
// if ( !filter->GetNewID().IsEmpty() )
// theCommand->SetArg( i, filter->GetNewID() );
// }
// }
//}
//================================================================================ //================================================================================
/*! /*!
@ -1442,6 +1472,8 @@ void _pyGen::AddObject( Handle(_pyObject)& theObj )
{ {
if ( theObj.IsNull() ) return; if ( theObj.IsNull() ) return;
CheckObjectIsReCreated( theObj );
if ( theObj->IsKind( STANDARD_TYPE( _pyMesh ))) if ( theObj->IsKind( STANDARD_TYPE( _pyMesh )))
myMeshes.insert( make_pair( theObj->GetID(), Handle(_pyMesh)::DownCast( theObj ))); myMeshes.insert( make_pair( theObj->GetID(), Handle(_pyMesh)::DownCast( theObj )));
@ -1452,6 +1484,41 @@ void _pyGen::AddObject( Handle(_pyObject)& theObj )
myObjects.insert( make_pair( theObj->GetID(), theObj )); myObjects.insert( make_pair( theObj->GetID(), theObj ));
} }
//================================================================================
/*!
* \brief Erases an existing object with the same ID. This method should be called
* before storing theObj in _pyGen
*/
//================================================================================
void _pyGen::CheckObjectIsReCreated( Handle(_pyObject)& theObj )
{
if ( theObj.IsNull() || !_pyCommand::IsStudyEntry( theObj->GetID() ))
return;
const bool isHyp = theObj->IsKind( STANDARD_TYPE( _pyHypothesis ));
Handle(_pyObject) existing =
isHyp ? FindHyp( theObj->GetID() ) : FindObject( theObj->GetID() );
if ( !existing.IsNull() && existing != theObj )
{
existing->SetRemovedFromStudy( true );
existing->ClearCommands();
if ( isHyp )
{
if ( myHypos.count( theObj->GetID() ))
myHypos.erase( theObj->GetID() );
}
else if ( myMeshes.count( theObj->GetID() ))
{
myMeshes.erase( theObj->GetID() );
}
else if ( myObjects.count( theObj->GetID() ))
{
myObjects.erase( theObj->GetID() );
}
}
}
//================================================================================ //================================================================================
/*! /*!
* \brief Re-register an object with other ID to make it Process() commands of * \brief Re-register an object with other ID to make it Process() commands of
@ -3480,7 +3547,7 @@ const TCollection_AsciiString & _pyCommand::GetObject()
if ( GetBegPos( OBJECT_IND ) == UNKNOWN ) if ( GetBegPos( OBJECT_IND ) == UNKNOWN )
{ {
// beginning // beginning
int begPos = GetBegPos( RESULT_IND ) + myRes.Length(); int begPos = GetBegPos( RESULT_IND );
if ( begPos < 1 ) { if ( begPos < 1 ) {
begPos = myString.Location( "=", 1, Length() ) + 1; begPos = myString.Location( "=", 1, Length() ) + 1;
// is '=' in the string argument (for example, name) or not // is '=' in the string argument (for example, name) or not
@ -3497,6 +3564,9 @@ const TCollection_AsciiString & _pyCommand::GetObject()
if ( nb1 % 2 != 0 || nb2 % 2 != 0 ) if ( nb1 % 2 != 0 || nb2 % 2 != 0 )
begPos = 1; begPos = 1;
} }
else {
begPos += myRes.Length();
}
myObj = GetWord( myString, begPos, true ); myObj = GetWord( myString, begPos, true );
if ( begPos != EMPTY ) if ( begPos != EMPTY )
{ {
@ -4047,8 +4117,32 @@ _pyID _pyObject::FatherID(const _pyID & childID)
*/ */
//================================================================================ //================================================================================
_pySelfEraser::_pySelfEraser(const Handle(_pyCommand)& theCreationCmd)
:_pyObject(theCreationCmd), myIgnoreOwnCalls(false)
{
myIsPublished = true; // prevent clearing as a not published
theGen->KeepAgrCmds( GetID() ); // ask to fill myArgCmds
}
//================================================================================
/*!
* \brief SelfEraser erases creation command if no more it's commands invoked
*/
//================================================================================
void _pySelfEraser::Flush() void _pySelfEraser::Flush()
{ {
bool toErase = false;
if ( myIgnoreOwnCalls ) // check if this obj is used as argument
{
int nbArgUses = 0;
list< Handle(_pyCommand) >::iterator cmd = myArgCmds.begin();
for ( ; cmd != myArgCmds.end(); ++cmd )
nbArgUses += !(*cmd)->IsEmpty();
toErase = ( nbArgUses < 1 );
}
else
{
int nbCalls = GetNbCalls(); int nbCalls = GetNbCalls();
if ( nbCalls > 0 ) if ( nbCalls > 0 )
{ {
@ -4058,8 +4152,13 @@ void _pySelfEraser::Flush()
for ( ; cmd != cmds.end(); ++cmd ) for ( ; cmd != cmds.end(); ++cmd )
nbCalls -= (*cmd)->IsEmpty(); nbCalls -= (*cmd)->IsEmpty();
} }
if ( nbCalls < 1 ) toErase = ( nbCalls < 1 );
GetCreationCmd()->Clear(); }
if ( toErase )
{
myIsPublished = false;
_pyObject::ClearCommands();
}
} }
//================================================================================ //================================================================================
@ -4072,6 +4171,7 @@ _pySubMesh::_pySubMesh(const Handle(_pyCommand)& theCreationCmd):
_pyObject(theCreationCmd) _pyObject(theCreationCmd)
{ {
myMesh = ObjectToMesh( theGen->FindObject( theCreationCmd->GetObject() )); myMesh = ObjectToMesh( theGen->FindObject( theCreationCmd->GetObject() ));
theGen->KeepAgrCmds( GetID() ); // ask to fill myArgCmds
} }
//================================================================================ //================================================================================
@ -4082,39 +4182,40 @@ _pySubMesh::_pySubMesh(const Handle(_pyCommand)& theCreationCmd):
bool _pySubMesh::CanBeArgOfMethod(const _AString& theMethodName) bool _pySubMesh::CanBeArgOfMethod(const _AString& theMethodName)
{ {
// names of all methods where a sub-mesh can be used as argument return false;
static TStringSet methods; // // names of all methods where a sub-mesh can be used as argument
if ( methods.empty() ) { // static TStringSet methods;
const char * names[] = { // if ( methods.empty() ) {
// methods of SMESH_Gen // const char * names[] = {
"CopyMesh", // // methods of SMESH_Gen
// methods of SMESH_Group // "CopyMesh",
"AddFrom", // // methods of SMESH_Group
// methods of SMESH_Measurements // "AddFrom",
"MinDistance", // // methods of SMESH_Measurements
// methods of SMESH_Mesh // "MinDistance",
"ExportPartToMED","ExportCGNS","ExportPartToDAT","ExportPartToUNV","ExportPartToSTL", // // methods of SMESH_Mesh
"RemoveSubMesh", // "ExportPartToMED","ExportCGNS","ExportPartToDAT","ExportPartToUNV","ExportPartToSTL",
// methods of SMESH_MeshEditor // "RemoveSubMesh",
"ReorientObject","Reorient2D","TriToQuadObject","QuadToTriObject","SplitQuadObject", // // methods of SMESH_MeshEditor
"SplitVolumesIntoTetra","SmoothObject","SmoothParametricObject","ConvertFromQuadraticObject", // "ReorientObject","Reorient2D","TriToQuadObject","QuadToTriObject","SplitQuadObject",
"RotationSweepObject","RotationSweepObjectMakeGroups","RotationSweepObject1D", // "SplitVolumesIntoTetra","SmoothObject","SmoothParametricObject","ConvertFromQuadraticObject",
"RotationSweepObject1DMakeGroups","RotationSweepObject2D","RotationSweepObject2DMakeGroups", // "RotationSweepObject","RotationSweepObjectMakeGroups","RotationSweepObject1D",
"ExtrusionSweepObject","ExtrusionSweepObjectMakeGroups","ExtrusionSweepObject0D", // "RotationSweepObject1DMakeGroups","RotationSweepObject2D","RotationSweepObject2DMakeGroups",
"ExtrusionSweepObject0DMakeGroups","ExtrusionSweepObject1D","ExtrusionSweepObject2D", // "ExtrusionSweepObject","ExtrusionSweepObjectMakeGroups","ExtrusionSweepObject0D",
"ExtrusionSweepObject1DMakeGroups","ExtrusionSweepObject2DMakeGroups", // "ExtrusionSweepObject0DMakeGroups","ExtrusionSweepObject1D","ExtrusionSweepObject2D",
"ExtrusionAlongPathObjX","ExtrusionAlongPathObject","ExtrusionAlongPathObjectMakeGroups", // "ExtrusionSweepObject1DMakeGroups","ExtrusionSweepObject2DMakeGroups",
"ExtrusionAlongPathObject1D","ExtrusionAlongPathObject1DMakeGroups", // "ExtrusionAlongPathObjX","ExtrusionAlongPathObject","ExtrusionAlongPathObjectMakeGroups",
"ExtrusionAlongPathObject2D","ExtrusionAlongPathObject2DMakeGroups","MirrorObject", // "ExtrusionAlongPathObject1D","ExtrusionAlongPathObject1DMakeGroups",
"MirrorObjectMakeGroups","MirrorObjectMakeMesh","TranslateObject","Scale", // "ExtrusionAlongPathObject2D","ExtrusionAlongPathObject2DMakeGroups","MirrorObject",
"TranslateObjectMakeGroups","TranslateObjectMakeMesh","ScaleMakeGroups","ScaleMakeMesh", // "MirrorObjectMakeGroups","MirrorObjectMakeMesh","TranslateObject","Scale",
"RotateObject","RotateObjectMakeGroups","RotateObjectMakeMesh","FindCoincidentNodesOnPart", // "TranslateObjectMakeGroups","TranslateObjectMakeMesh","ScaleMakeGroups","ScaleMakeMesh",
"FindCoincidentNodesOnPartBut","FindEqualElements","FindAmongElementsByPoint", // "RotateObject","RotateObjectMakeGroups","RotateObjectMakeMesh","FindCoincidentNodesOnPart",
"MakeBoundaryMesh","Create0DElementsOnAllNodes", // "FindCoincidentNodesOnPartBut","FindEqualElements","FindAmongElementsByPoint",
"" }; // <- mark of end // "MakeBoundaryMesh","Create0DElementsOnAllNodes",
methods.Insert( names ); // "" }; // <- mark of end
} // methods.Insert( names );
return methods.Contains( theMethodName ); // }
// return methods.Contains( theMethodName );
} }
//================================================================================ //================================================================================
@ -4126,7 +4227,6 @@ bool _pySubMesh::CanBeArgOfMethod(const _AString& theMethodName)
void _pySubMesh::Process( const Handle(_pyCommand)& theCommand ) void _pySubMesh::Process( const Handle(_pyCommand)& theCommand )
{ {
_pyObject::Process(theCommand); // count calls of Process() _pyObject::Process(theCommand); // count calls of Process()
GetCreationCmd()->AddDependantCmd( theCommand );
} }
//================================================================================ //================================================================================
@ -4137,11 +4237,17 @@ void _pySubMesh::Process( const Handle(_pyCommand)& theCommand )
void _pySubMesh::Flush() void _pySubMesh::Flush()
{ {
if ( GetNbCalls() == 0 ) // move to the end of all commands if ( GetNbCalls() == 0 && myArgCmds.empty() ) // move to the end of all commands
theGen->GetLastCommand()->AddDependantCmd( GetCreationCmd() ); theGen->GetLastCommand()->AddDependantCmd( GetCreationCmd() );
else if ( !myCreator.IsNull() ) else if ( !myCreator.IsNull() )
// move to be just after creator // move to be just after creator
myCreator->GetCreationCmd()->AddDependantCmd( GetCreationCmd() ); myCreator->GetCreationCmd()->AddDependantCmd( GetCreationCmd() );
// move sub-mesh usage after creation cmd
list< Handle(_pyCommand) >::iterator cmd = myArgCmds.begin();
for ( ; cmd != myArgCmds.end(); ++cmd )
if ( !(*cmd)->IsEmpty() )
GetCreationCmd()->AddDependantCmd( *cmd );
} }
//================================================================================ //================================================================================
@ -4196,7 +4302,7 @@ _pyGroup::_pyGroup(const Handle(_pyCommand)& theCreationCmd, const _pyID & id)
{ {
if ( !filter->GetNewID().IsEmpty() ) if ( !filter->GetNewID().IsEmpty() )
theCreationCmd->SetArg( 3, filter->GetNewID() ); theCreationCmd->SetArg( 3, filter->GetNewID() );
filter->AddUser( this ); //filter->AddUser( this );
} }
myFilter = filter; myFilter = filter;
} }
@ -4224,7 +4330,9 @@ bool _pyGroup::CanClear()
if ( IsInStudy() ) if ( IsInStudy() )
return false; return false;
if ( !myCanClearCreationCmd && myCreationCmd->GetMethod() == "GetGroups" ) if ( !myCanClearCreationCmd &&
!myCreationCmd.IsNull() &&
myCreationCmd->GetMethod() == "GetGroups" )
{ {
TCollection_AsciiString grIDs = myCreationCmd->GetResultValue(); TCollection_AsciiString grIDs = myCreationCmd->GetResultValue();
list< _pyID > idList = myCreationCmd->GetStudyEntries( grIDs ); list< _pyID > idList = myCreationCmd->GetStudyEntries( grIDs );
@ -4310,6 +4418,7 @@ void _pyGroup::Process( const Handle(_pyCommand)& theCommand)
makeGroupCmd->SetMethod( "MakeGroupByFilter" ); makeGroupCmd->SetMethod( "MakeGroupByFilter" );
makeGroupCmd->SetArg( 1, name ); makeGroupCmd->SetArg( 1, name );
makeGroupCmd->SetArg( 2, idSource ); makeGroupCmd->SetArg( 2, idSource );
filter->AddArgCmd( makeGroupCmd );
} }
} }
else if ( theCommand->GetMethod() == "SetFilter" ) else if ( theCommand->GetMethod() == "SetFilter" )
@ -4334,8 +4443,8 @@ void _pyGroup::Process( const Handle(_pyCommand)& theCommand)
} }
} }
if ( !filter.IsNull() ) // if ( !filter.IsNull() )
filter->AddUser( this ); // filter->AddUser( this );
theGen->AddMeshAccessorMethod( theCommand ); theGen->AddMeshAccessorMethod( theCommand );
} }
@ -4349,7 +4458,7 @@ void _pyGroup::Process( const Handle(_pyCommand)& theCommand)
void _pyGroup::Flush() void _pyGroup::Flush()
{ {
if ( !theGen->IsToKeepAllCommands() && if ( !theGen->IsToKeepAllCommands() &&
myCreationCmd && !myCanClearCreationCmd ) !myCreationCmd.IsNull() && !myCanClearCreationCmd )
{ {
myCreationCmd.Nullify(); // this way myCreationCmd won't be cleared myCreationCmd.Nullify(); // this way myCreationCmd won't be cleared
} }
@ -4364,6 +4473,8 @@ void _pyGroup::Flush()
_pyFilter::_pyFilter(const Handle(_pyCommand)& theCreationCmd, const _pyID& newID/*=""*/) _pyFilter::_pyFilter(const Handle(_pyCommand)& theCreationCmd, const _pyID& newID/*=""*/)
:_pyObject(theCreationCmd), myNewID( newID ) :_pyObject(theCreationCmd), myNewID( newID )
{ {
//myIsPublished = true; // prevent clearing as a not published
theGen->KeepAgrCmds( GetID() ); // ask to fill myArgCmds
} }
//================================================================================ //================================================================================
@ -4396,8 +4507,11 @@ void _pyFilter::Process( const Handle(_pyCommand)& theCommand)
theCommand->SetObject( SMESH_2smeshpy::GenName() ); theCommand->SetObject( SMESH_2smeshpy::GenName() );
theCommand->SetMethod( "GetFilterFromCriteria" ); theCommand->SetMethod( "GetFilterFromCriteria" );
// Clear aFilterManager.CreateFilter() // Swap "aFilterManager.CreateFilter()" and "smesh.GetFilterFromCriteria(criteria)"
GetCreationCmd()->Clear(); GetCreationCmd()->Clear();
GetCreationCmd()->GetString() = theCommand->GetString();
theCommand->Clear();
theCommand->AddDependantCmd( GetCreationCmd() );
} }
else if ( theCommand->GetMethod() == "SetMesh" ) else if ( theCommand->GetMethod() == "SetMesh" )
{ {
@ -4411,13 +4525,31 @@ void _pyFilter::Process( const Handle(_pyCommand)& theCommand)
//================================================================================ //================================================================================
/*! /*!
* \brief Set new filter name to the creation command * \brief Set new filter name to the creation command and to myArgCmds
*/ */
//================================================================================ //================================================================================
void _pyFilter::Flush() void _pyFilter::Flush()
{ {
if ( !myNewID.IsEmpty() && !GetCreationCmd()->IsEmpty() ) if ( myNewID.IsEmpty() ) return;
list< Handle(_pyCommand) >::iterator cmd = myArgCmds.begin();
for ( ; cmd != myArgCmds.end(); ++cmd )
if ( !(*cmd)->IsEmpty() )
{
_AString cmdStr = (*cmd)->GetString();
_AString id = GetID();
int pos = cmdStr.Search( id );
if ( pos > 0 )
{
cmdStr.Remove( pos, id.Length() );
cmdStr.Insert( pos, myNewID );
}
(*cmd)->Clear();
(*cmd)->GetString() = cmdStr;
}
if ( !GetCreationCmd()->IsEmpty() )
GetCreationCmd()->SetResultValue( myNewID ); GetCreationCmd()->SetResultValue( myNewID );
} }
@ -4427,14 +4559,17 @@ void _pyFilter::Flush()
*/ */
//================================================================================ //================================================================================
bool _pyFilter::CanClear() bool _pyObject::CanClear()
{ {
list< Handle(_pyObject) >::iterator obj = myUsers.begin(); list< Handle(_pyCommand) >::iterator cmd = myArgCmds.begin();
for ( ; obj != myUsers.end(); ++obj ) for ( ; cmd != myArgCmds.end(); ++cmd )
if ( !(*obj)->CanClear() ) if ( !(*cmd)->IsEmpty() )
{
Handle(_pyObject) obj = theGen->FindObject( (*cmd)->GetObject() );
if ( !obj.IsNull() && !obj->CanClear() )
return false; return false;
}
return true; return ( !myIsPublished );
} }
//================================================================================ //================================================================================

View File

@ -166,6 +166,7 @@ protected:
_pyID myID; _pyID myID;
Handle(_pyCommand) myCreationCmd; Handle(_pyCommand) myCreationCmd;
std::list< Handle(_pyCommand) > myProcessedCmds; std::list< Handle(_pyCommand) > myProcessedCmds;
std::list< Handle(_pyCommand) > myArgCmds; // where this obj is used as an argument
bool myIsPublished; bool myIsPublished;
void setID(const _pyID& theID); void setID(const _pyID& theID);
@ -182,10 +183,11 @@ public:
void AddProcessedCmd( const Handle(_pyCommand) & cmd ) void AddProcessedCmd( const Handle(_pyCommand) & cmd )
{ if (myProcessedCmds.empty() || myProcessedCmds.back()!=cmd) myProcessedCmds.push_back( cmd );} { if (myProcessedCmds.empty() || myProcessedCmds.back()!=cmd) myProcessedCmds.push_back( cmd );}
std::list< Handle(_pyCommand) >& GetProcessedCmds() { return myProcessedCmds; } std::list< Handle(_pyCommand) >& GetProcessedCmds() { return myProcessedCmds; }
void AddArgCmd( const Handle(_pyCommand) & cmd ) { myArgCmds.push_back( cmd ); }
virtual void Process(const Handle(_pyCommand) & cmd) { AddProcessedCmd(cmd); } virtual void Process(const Handle(_pyCommand) & cmd) { AddProcessedCmd(cmd); }
virtual void Flush() = 0; virtual void Flush() = 0;
virtual const char* AccessorMethod() const; virtual const char* AccessorMethod() const;
virtual bool CanClear() { return !myIsPublished; } virtual bool CanClear();
virtual void ClearCommands(); virtual void ClearCommands();
virtual void Free() {} virtual void Free() {}
@ -228,7 +230,7 @@ public:
const bool theToKeepAllCommands); const bool theToKeepAllCommands);
Handle(_pyCommand) AddCommand( const _AString& theCommand ); Handle(_pyCommand) AddCommand( const _AString& theCommand );
void ExchangeCommands( Handle(_pyCommand) theCmd1, Handle(_pyCommand) theCmd2 ); void ExchangeCommands( Handle(_pyCommand) theCmd1, Handle(_pyCommand) theCmd2 );
void SetCommandAfter( Handle(_pyCommand) theCmd, Handle(_pyCommand) theAfterCmd ); void SetCommandAfter ( Handle(_pyCommand) theCmd, Handle(_pyCommand) theAfterCmd );
void SetCommandBefore( Handle(_pyCommand) theCmd, Handle(_pyCommand) theBeforeCmd ); void SetCommandBefore( Handle(_pyCommand) theCmd, Handle(_pyCommand) theBeforeCmd );
Handle(_pyCommand)& GetLastCommand(); Handle(_pyCommand)& GetLastCommand();
std::list< Handle(_pyCommand) >& GetCommands() { return myCommands; } std::list< Handle(_pyCommand) >& GetCommands() { return myCommands; }
@ -236,6 +238,7 @@ public:
_pyID GenerateNewID( const _pyID& theID ); _pyID GenerateNewID( const _pyID& theID );
void AddObject( Handle(_pyObject)& theObj ); void AddObject( Handle(_pyObject)& theObj );
void CheckObjectIsReCreated( Handle(_pyObject)& theObj );
void SetProxyObject( const _pyID& theID, Handle(_pyObject)& theObj ); void SetProxyObject( const _pyID& theID, Handle(_pyObject)& theObj );
Handle(_pyObject) FindObject( const _pyID& theObjID ) const; Handle(_pyObject) FindObject( const _pyID& theObjID ) const;
Handle(_pySubMesh) FindSubMesh( const _pyID& theSubMeshID ); Handle(_pySubMesh) FindSubMesh( const _pyID& theSubMeshID );
@ -251,6 +254,7 @@ public:
bool IsGeomObject(const _pyID& theObjID) const; bool IsGeomObject(const _pyID& theObjID) const;
bool IsNotPublished(const _pyID& theObjID) const; bool IsNotPublished(const _pyID& theObjID) const;
void ObjectCreationRemoved(const _pyID& theObjID); void ObjectCreationRemoved(const _pyID& theObjID);
void KeepAgrCmds(const _pyID& theObjID) { myKeepAgrCmdsIDs.push_back( theObjID ); }
bool IsToKeepAllCommands() const { return myToKeepAllCommands; } bool IsToKeepAllCommands() const { return myToKeepAllCommands; }
void AddExportedMesh(const _AString& file, const ExportedMeshData& mesh ) void AddExportedMesh(const _AString& file, const ExportedMeshData& mesh )
{ myFile2ExportedMesh[ file ] = mesh; } { myFile2ExportedMesh[ file ] = mesh; }
@ -268,13 +272,14 @@ private:
void setNeighbourCommand( Handle(_pyCommand)& theCmd, void setNeighbourCommand( Handle(_pyCommand)& theCmd,
Handle(_pyCommand)& theOtherCmd, Handle(_pyCommand)& theOtherCmd,
const bool theIsAfter ); const bool theIsAfter );
void addFilterUser( Handle(_pyCommand)& theCmd, const Handle(_pyObject)& user ); //void addFilterUser( Handle(_pyCommand)& theCmd, const Handle(_pyObject)& user );
private: private:
std::map< _pyID, Handle(_pyMesh) > myMeshes; std::map< _pyID, Handle(_pyMesh) > myMeshes;
std::map< _pyID, Handle(_pyMeshEditor) > myMeshEditors; std::map< _pyID, Handle(_pyMeshEditor) > myMeshEditors;
std::map< _pyID, Handle(_pyObject) > myObjects; std::map< _pyID, Handle(_pyObject) > myObjects;
std::list< Handle(_pyHypothesis) > myHypos; std::map< _pyID, Handle(_pyHypothesis) > myHypos;
std::list< _pyID > myKeepAgrCmdsIDs;
std::list< Handle(_pyCommand) > myCommands; std::list< Handle(_pyCommand) > myCommands;
int myNbCommands; int myNbCommands;
Resource_DataMapOfAsciiStringAsciiString& myID2AccessorMethod; Resource_DataMapOfAsciiStringAsciiString& myID2AccessorMethod;
@ -530,9 +535,10 @@ DEFINE_STANDARD_HANDLE (_pySegmentLengthAroundVertexHyp, _pyHypothesis);
// ------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------
class _pySelfEraser: public _pyObject class _pySelfEraser: public _pyObject
{ {
bool myIgnoreOwnCalls; // not to erase only if this obj is used as argument
public: public:
_pySelfEraser(const Handle(_pyCommand)& theCreationCmd) _pySelfEraser(const Handle(_pyCommand)& theCreationCmd);
:_pyObject(theCreationCmd) { myIsPublished = true; } void IgnoreOwnCalls() { myIgnoreOwnCalls = true; }
virtual void Flush(); virtual void Flush();
DEFINE_STANDARD_RTTI (_pySelfEraser) DEFINE_STANDARD_RTTI (_pySelfEraser)
@ -567,14 +573,14 @@ public:
class _pyFilter: public _pyObject class _pyFilter: public _pyObject
{ {
_pyID myNewID, myMesh; _pyID myNewID, myMesh;
std::list< Handle(_pyObject) > myUsers; //std::list< Handle(_pyObject) > myUsers;
public: public:
_pyFilter(const Handle(_pyCommand)& theCreationCmd, const _pyID& newID=""); _pyFilter(const Handle(_pyCommand)& theCreationCmd, const _pyID& newID="");
void AddUser( const Handle(_pyObject)& user) { myUsers.push_back( user ); } //void AddUser( const Handle(_pyObject)& user) { myUsers.push_back( user ); }
virtual void Process( const Handle(_pyCommand)& theCommand); virtual void Process( const Handle(_pyCommand)& theCommand);
virtual void Flush(); virtual void Flush();
virtual bool CanClear(); //virtual bool CanClear();
virtual void Free() { myUsers.clear(); } //virtual void Free() { myUsers.clear(); }
const _pyID& GetNewID() const { return myNewID; } const _pyID& GetNewID() const { return myNewID; }
DEFINE_STANDARD_RTTI (_pyFilter) DEFINE_STANDARD_RTTI (_pyFilter)

View File

@ -36,6 +36,7 @@
#include <TColStd_HSequenceOfInteger.hxx> #include <TColStd_HSequenceOfInteger.hxx>
#include <TCollection_AsciiString.hxx> #include <TCollection_AsciiString.hxx>
#include <LDOMParser.hxx>
#ifdef _DEBUG_ #ifdef _DEBUG_
static int MYDEBUG = 0; static int MYDEBUG = 0;
@ -846,6 +847,45 @@ namespace {
} }
return isValidName; return isValidName;
} }
//================================================================================
/*!
* \brief Return Python module names of available plug-ins.
*/
//================================================================================
std::vector<std::string> getPluginNames()
{
std::vector<std::string> pluginNames;
std::vector< std::string > xmlPaths = SMESH_Gen::GetPluginXMLPaths();
LDOMParser xmlParser;
for ( size_t i = 0; i < xmlPaths.size(); ++i )
{
bool error = xmlParser.parse( xmlPaths[i].c_str() );
if ( error )
{
TCollection_AsciiString data;
INFOS( xmlParser.GetError(data) );
continue;
}
// <meshers-group name="Standard Meshers"
// resources="StdMeshers"
// idl-module="StdMeshers"
// server-lib="StdMeshersEngine"
// gui-lib="StdMeshersGUI">
LDOM_Document xmlDoc = xmlParser.getDocument();
LDOM_NodeList nodeList = xmlDoc.getElementsByTagName( "meshers-group" );
for ( int i = 0; i < nodeList.getLength(); ++i )
{
LDOM_Node node = nodeList.item( i );
LDOM_Element& elem = (LDOM_Element&) node;
LDOMString idlModule = elem.getAttribute( "idl-module" );
if ( strlen( idlModule.GetString() ) > 0 )
pluginNames.push_back( idlModule.GetString() );
}
}
return pluginNames;
}
} }
//============================================================================= //=============================================================================
@ -873,6 +913,7 @@ TCollection_AsciiString SMESH_Gen_i::DumpPython_impl
TCollection_AsciiString aScript; TCollection_AsciiString aScript;
if( isMultiFile ) if( isMultiFile )
aScript += "def RebuildData(theStudy):"; aScript += "def RebuildData(theStudy):";
aScript += "\n\t"; aScript += "\n\t";
if ( isPublished ) if ( isPublished )
aScript += aSMESHGen + " = smeshBuilder.New(theStudy)\n\t"; aScript += aSMESHGen + " = smeshBuilder.New(theStudy)\n\t";
@ -881,17 +922,6 @@ TCollection_AsciiString SMESH_Gen_i::DumpPython_impl
aScript += helper + "aFilterManager = " + aSMESHGen + ".CreateFilterManager()\n\t"; aScript += helper + "aFilterManager = " + aSMESHGen + ".CreateFilterManager()\n\t";
aScript += helper + "aMeasurements = " + aSMESHGen + ".CreateMeasurements()\n\t"; aScript += helper + "aMeasurements = " + aSMESHGen + ".CreateMeasurements()\n\t";
// This is not needed since entering a plug-in system to smesh.py
// import python files corresponding to plugins
// set<string> moduleNameSet;
// map<string, GenericHypothesisCreator_i*>::iterator hyp_creator = myHypCreatorMap.begin();
// for ( ; hyp_creator != myHypCreatorMap.end(); ++hyp_creator ) {
// string moduleName = hyp_creator->second->GetModuleName();
// bool newModule = moduleNameSet.insert( moduleName ).second;
// if ( newModule )
// aScript += helper + "\n\t" + "from salome." + (char*) moduleName.c_str() + " import " + (char*) moduleName.c_str() +"Builder";
// }
// Dump trace of restored study // Dump trace of restored study
if (theSavedTrace.Length() > 0) { if (theSavedTrace.Length() > 0) {
// For the convertion of IDL API calls -> smeshBuilder.py API, "smesh" standing for SMESH_Gen // For the convertion of IDL API calls -> smeshBuilder.py API, "smesh" standing for SMESH_Gen
@ -924,6 +954,30 @@ TCollection_AsciiString SMESH_Gen_i::DumpPython_impl
aScript += helper + "\n" + aNewLines; aScript += helper + "\n" + aNewLines;
} }
// import python files corresponding to plugins if they are used in aScript
{
TCollection_AsciiString importStr;
std::vector<std::string> pluginNames = getPluginNames();
for ( size_t i = 0; i < pluginNames.size(); ++i )
{
// Convert access to plugin members:
// e.g. StdMeshers.QUAD_REDUCED -> StdMeshersBuilder.QUAD_REDUCED
TCollection_AsciiString pluginAccess = (pluginNames[i] + ".").c_str() ;
int iFrom = 1, iPos;
while (( iPos = aScript.Location( pluginAccess, iFrom, aScript.Length() )))
{
aScript.Insert( iPos + pluginNames[i].size(), "Builder" );
iFrom = iPos + pluginNames[i].size() + 8;
}
// if any plugin member is used, import the plugin
if ( iFrom > 1 )
importStr += ( helper + "\n\t" + "from salome." + (char*) pluginNames[i].c_str() +
" import " + (char*) pluginNames[i].c_str() +"Builder" );
}
if ( !importStr.IsEmpty() )
aScript.Insert( 1, importStr + "\n\t" );
}
// Convert IDL API calls into smeshBuilder.py API. // Convert IDL API calls into smeshBuilder.py API.
// Some objects are wrapped with python classes and // Some objects are wrapped with python classes and
// Resource_DataMapOfAsciiStringAsciiString holds methods returning wrapped objects // Resource_DataMapOfAsciiStringAsciiString holds methods returning wrapped objects

View File

@ -3070,8 +3070,7 @@ CORBA::Boolean Filter_i::GetCriteria( SMESH::Filter::Criteria_out theCriteria )
//======================================================================= //=======================================================================
CORBA::Boolean Filter_i::SetCriteria( const SMESH::Filter::Criteria& theCriteria ) CORBA::Boolean Filter_i::SetCriteria( const SMESH::Filter::Criteria& theCriteria )
{ {
if ( myPredicate != 0 ) SetPredicate( SMESH::Predicate::_nil() );
myPredicate->UnRegister();
SMESH::FilterManager_i* aFilter = new SMESH::FilterManager_i(); SMESH::FilterManager_i* aFilter = new SMESH::FilterManager_i();
FilterManager_ptr aFilterMgr = aFilter->_this(); FilterManager_ptr aFilterMgr = aFilter->_this();
@ -3424,6 +3423,8 @@ CORBA::Boolean Filter_i::SetCriteria( const SMESH::Filter::Criteria& theCriteria
SetPredicate( aResPredicate ); SetPredicate( aResPredicate );
aResPredicate->UnRegister();
return !aResPredicate->_is_nil(); return !aResPredicate->_is_nil();
} }

View File

@ -93,7 +93,7 @@
#include "SMESH_Mesh_i.hxx" #include "SMESH_Mesh_i.hxx"
#include "SMESH_PreMeshInfo.hxx" #include "SMESH_PreMeshInfo.hxx"
#include "SMESH_PythonDump.hxx" #include "SMESH_PythonDump.hxx"
#include "memoire.h" //#include "memoire.h"
#include CORBA_SERVER_HEADER(SMESH_Group) #include CORBA_SERVER_HEADER(SMESH_Group)
#include CORBA_SERVER_HEADER(SMESH_Filter) #include CORBA_SERVER_HEADER(SMESH_Filter)
@ -363,7 +363,7 @@ SMESH::SMESH_Hypothesis_ptr SMESH_Gen_i::createHypothesis(const char* theHypName
throw (SALOME::SALOME_Exception) throw (SALOME::SALOME_Exception)
{ {
/* It's Need to tranlate lib name for WIN32 or X platform */ /* It's Need to tranlate lib name for WIN32 or X platform */
char* aPlatformLibName = 0; std::string aPlatformLibName;
if ( theLibName && theLibName[0] != '\0' ) if ( theLibName && theLibName[0] != '\0' )
{ {
int libNameLen = strlen(theLibName); int libNameLen = strlen(theLibName);
@ -374,39 +374,24 @@ SMESH::SMESH_Hypothesis_ptr SMESH_Gen_i::createHypothesis(const char* theHypName
{ {
//the old format //the old format
#ifdef WNT #ifdef WNT
aPlatformLibName = new char[libNameLen - 1]; aPlatformLibName = std::string( theLibName+3, libNameLen-6 ) + ".dll";
aPlatformLibName[0] = '\0';
aPlatformLibName = strncat( aPlatformLibName, theLibName+3, libNameLen-6 );
aPlatformLibName = strcat( aPlatformLibName, ".dll" );
aPlatformLibName[libNameLen - 2] = '\0';
#else #else
aPlatformLibName = new char[ libNameLen + 1]; aPlatformLibName = theLibName;
aPlatformLibName[0] = '\0';
aPlatformLibName = strcat( aPlatformLibName, theLibName );
aPlatformLibName[libNameLen] = '\0';
#endif #endif
} }
else else
{ {
//try to use new format //try to use new format
#ifdef WNT #ifdef WNT
aPlatformLibName = new char[ libNameLen + 5 ]; aPlatformLibName = theLibName + ".dll";
aPlatformLibName[0] = '\0';
aPlatformLibName = strcat( aPlatformLibName, theLibName );
aPlatformLibName = strcat( aPlatformLibName, ".dll" );
#else #else
aPlatformLibName = new char[ libNameLen + 7 ]; aPlatformLibName = "lib" + std::string( theLibName ) + ".so";
aPlatformLibName[0] = '\0';
aPlatformLibName = strcat( aPlatformLibName, "lib" );
aPlatformLibName = strcat( aPlatformLibName, theLibName );
aPlatformLibName = strcat( aPlatformLibName, ".so" );
#endif #endif
} }
} }
Unexpect aCatch(SALOME_SalomeException); Unexpect aCatch(SALOME_SalomeException);
if(MYDEBUG) MESSAGE( "Create Hypothesis <" << theHypName << "> from " << aPlatformLibName/*theLibName*/); if(MYDEBUG) MESSAGE( "Create Hypothesis <" << theHypName << "> from " << aPlatformLibName);
// create a new hypothesis object servant // create a new hypothesis object servant
SMESH_Hypothesis_i* myHypothesis_i = 0; SMESH_Hypothesis_i* myHypothesis_i = 0;
@ -419,7 +404,7 @@ SMESH::SMESH_Hypothesis_ptr SMESH_Gen_i::createHypothesis(const char* theHypName
{ {
// load plugin library // load plugin library
if(MYDEBUG) MESSAGE("Loading server meshers plugin library ..."); if(MYDEBUG) MESSAGE("Loading server meshers plugin library ...");
LibHandle libHandle = LoadLib( aPlatformLibName/*theLibName*/ ); LibHandle libHandle = LoadLib( aPlatformLibName.c_str() );
if (!libHandle) if (!libHandle)
{ {
// report any error, if occured // report any error, if occured
@ -458,21 +443,18 @@ SMESH::SMESH_Hypothesis_ptr SMESH_Gen_i::createHypothesis(const char* theHypName
if(MYDEBUG) MESSAGE("Create Hypothesis " << theHypName); if(MYDEBUG) MESSAGE("Create Hypothesis " << theHypName);
myHypothesis_i = myHypothesis_i =
myHypCreatorMap[string(theHypName)]->Create(myPoa, GetCurrentStudyID(), &myGen); myHypCreatorMap[string(theHypName)]->Create(myPoa, GetCurrentStudyID(), &myGen);
myHypothesis_i->SetLibName(aPlatformLibName/*theLibName*/); // for persistency assurance myHypothesis_i->SetLibName(aPlatformLibName.c_str()); // for persistency assurance
} }
catch (SALOME_Exception& S_ex) catch (SALOME_Exception& S_ex)
{ {
THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), SALOME::BAD_PARAM); THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), SALOME::BAD_PARAM);
} }
if ( aPlatformLibName )
delete[] aPlatformLibName;
if (!myHypothesis_i) if (!myHypothesis_i)
return hypothesis_i._retn(); return hypothesis_i._retn();
// activate the CORBA servant of hypothesis // activate the CORBA servant of hypothesis
hypothesis_i = SMESH::SMESH_Hypothesis::_narrow( myHypothesis_i->_this() ); hypothesis_i = myHypothesis_i->_this();
int nextId = RegisterObject( hypothesis_i ); int nextId = RegisterObject( hypothesis_i );
if(MYDEBUG) { MESSAGE( "Add hypo to map with id = "<< nextId ); } if(MYDEBUG) { MESSAGE( "Add hypo to map with id = "<< nextId ); }
else { nextId = 0; } // avoid "unused variable" warning in release mode else { nextId = 0; } // avoid "unused variable" warning in release mode
@ -1712,7 +1694,7 @@ CORBA::Boolean SMESH_Gen_i::Compute( SMESH::SMESH_Mesh_ptr theMesh,
GEOM::GEOM_Object_ptr theShapeObject ) GEOM::GEOM_Object_ptr theShapeObject )
throw ( SALOME::SALOME_Exception ) throw ( SALOME::SALOME_Exception )
{ {
MEMOSTAT; //MEMOSTAT;
Unexpect aCatch(SALOME_SalomeException); Unexpect aCatch(SALOME_SalomeException);
if(MYDEBUG) MESSAGE( "SMESH_Gen_i::Compute" ); if(MYDEBUG) MESSAGE( "SMESH_Gen_i::Compute" );
@ -3957,7 +3939,7 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
// Get temporary files location // Get temporary files location
TCollection_AsciiString tmpDir = TCollection_AsciiString tmpDir =
isMultiFile ? TCollection_AsciiString( ( char* )theURL ) : ( char* )SALOMEDS_Tool::GetTmpDir().c_str(); ( char* )( isMultiFile ? theURL : SALOMEDS_Tool::GetTmpDir().c_str() );
INFOS( "THE URL++++++++++++++" ); INFOS( "THE URL++++++++++++++" );
INFOS( theURL ); INFOS( theURL );
@ -3969,12 +3951,13 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
tmpDir.ToCString(), tmpDir.ToCString(),
isMultiFile ); isMultiFile );
TCollection_AsciiString aStudyName( "" ); TCollection_AsciiString aStudyName( "" );
if ( isMultiFile ) if ( isMultiFile ) {
aStudyName = ( (char*)SALOMEDS_Tool::GetNameFromPath( myCurrentStudy->URL() ).c_str() ); CORBA::String_var url = myCurrentStudy->URL();
aStudyName = (char*)SALOMEDS_Tool::GetNameFromPath( url.in() ).c_str();
}
// Set names of temporary files // Set names of temporary files
TCollection_AsciiString filename = tmpDir + aStudyName + TCollection_AsciiString( "_SMESH.hdf" ); TCollection_AsciiString filename = tmpDir + aStudyName + "_SMESH.hdf";
TCollection_AsciiString meshfile = tmpDir + aStudyName + TCollection_AsciiString( "_SMESH_Mesh.med" ); TCollection_AsciiString meshfile = tmpDir + aStudyName + "_SMESH_Mesh.med";
int size; int size;
HDFfile* aFile; HDFfile* aFile;
@ -4430,21 +4413,21 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
// --> try to find SUB-MESHES containers for each type of submesh // --> try to find SUB-MESHES containers for each type of submesh
for ( int j = GetSubMeshOnVertexTag(); j <= GetSubMeshOnCompoundTag(); j++ ) { for ( int j = GetSubMeshOnVertexTag(); j <= GetSubMeshOnCompoundTag(); j++ ) {
char name_meshgroup[ 30 ]; const char* name_meshgroup;
if ( j == GetSubMeshOnVertexTag() ) if ( j == GetSubMeshOnVertexTag() )
strcpy( name_meshgroup, "SubMeshes On Vertex" ); name_meshgroup = "SubMeshes On Vertex";
else if ( j == GetSubMeshOnEdgeTag() ) else if ( j == GetSubMeshOnEdgeTag() )
strcpy( name_meshgroup, "SubMeshes On Edge" ); name_meshgroup = "SubMeshes On Edge";
else if ( j == GetSubMeshOnWireTag() ) else if ( j == GetSubMeshOnWireTag() )
strcpy( name_meshgroup, "SubMeshes On Wire" ); name_meshgroup = "SubMeshes On Wire";
else if ( j == GetSubMeshOnFaceTag() ) else if ( j == GetSubMeshOnFaceTag() )
strcpy( name_meshgroup, "SubMeshes On Face" ); name_meshgroup = "SubMeshes On Face";
else if ( j == GetSubMeshOnShellTag() ) else if ( j == GetSubMeshOnShellTag() )
strcpy( name_meshgroup, "SubMeshes On Shell" ); name_meshgroup = "SubMeshes On Shell";
else if ( j == GetSubMeshOnSolidTag() ) else if ( j == GetSubMeshOnSolidTag() )
strcpy( name_meshgroup, "SubMeshes On Solid" ); name_meshgroup = "SubMeshes On Solid";
else if ( j == GetSubMeshOnCompoundTag() ) else if ( j == GetSubMeshOnCompoundTag() )
strcpy( name_meshgroup, "SubMeshes On Compound" ); name_meshgroup = "SubMeshes On Compound";
// try to get submeshes container HDF group // try to get submeshes container HDF group
if ( aTopGroup->ExistInternalObject( name_meshgroup ) ) { if ( aTopGroup->ExistInternalObject( name_meshgroup ) ) {
@ -4458,9 +4441,9 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
// identify submesh // identify submesh
char name_submeshgroup[ HDF_NAME_MAX_LEN+1 ]; char name_submeshgroup[ HDF_NAME_MAX_LEN+1 ];
aGroup->InternalObjectIndentify( k, name_submeshgroup ); aGroup->InternalObjectIndentify( k, name_submeshgroup );
if ( string( name_submeshgroup ).substr( 0, 7 ) == string( "SubMesh" ) ) { if ( strncmp( name_submeshgroup, "SubMesh", 7 ) == 0 ) {
// --> get submesh id // --> get submesh id
int subid = atoi( string( name_submeshgroup ).substr( 7 ).c_str() ); int subid = atoi( name_submeshgroup + 7 );
if ( subid <= 0 ) if ( subid <= 0 )
continue; continue;
// open submesh HDF group // open submesh HDF group
@ -4510,7 +4493,7 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
char name_dataset[ HDF_NAME_MAX_LEN+1 ]; char name_dataset[ HDF_NAME_MAX_LEN+1 ];
aSubSubGroup->InternalObjectIndentify( l, name_dataset ); aSubSubGroup->InternalObjectIndentify( l, name_dataset );
// check if it is an algorithm // check if it is an algorithm
if ( string( name_dataset ).substr( 0, 4 ) == string( "Algo" ) ) { if ( strncmp( name_dataset, "Algo", 4 ) == 0 ) {
aDataset = new HDFdataset( name_dataset, aSubSubGroup ); aDataset = new HDFdataset( name_dataset, aSubSubGroup );
aDataset->OpenOnDisk(); aDataset->OpenOnDisk();
size = aDataset->GetSize(); size = aDataset->GetSize();
@ -4675,8 +4658,10 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
if ( SMESH_GroupOnFilter_i* aFilterGroup = if ( SMESH_GroupOnFilter_i* aFilterGroup =
dynamic_cast< SMESH_GroupOnFilter_i*>( aGroupImpl )) dynamic_cast< SMESH_GroupOnFilter_i*>( aGroupImpl ))
{
aFilterGroup->SetFilter( filter ); aFilterGroup->SetFilter( filter );
filter->UnRegister();
}
SMESHDS_GroupBase* aGroupBaseDS = aGroupImpl->GetGroupDS(); SMESHDS_GroupBase* aGroupBaseDS = aGroupImpl->GetGroupDS();
if ( !aGroupBaseDS ) if ( !aGroupBaseDS )
continue; continue;
@ -4792,11 +4777,11 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
// creation of tree nodes for all data objects in the study // creation of tree nodes for all data objects in the study
// to support tree representation customization and drag-n-drop: // to support tree representation customization and drag-n-drop:
SALOMEDS::UseCaseBuilder_var useCaseBuilder = theComponent->GetStudy()->GetUseCaseBuilder(); SALOMEDS::UseCaseBuilder_wrap useCaseBuilder = theComponent->GetStudy()->GetUseCaseBuilder();
if ( !useCaseBuilder->IsUseCaseNode( theComponent ) ) { if ( !useCaseBuilder->IsUseCaseNode( theComponent ) ) {
useCaseBuilder->SetRootCurrent(); useCaseBuilder->SetRootCurrent();
useCaseBuilder->Append( theComponent ); // component object is added as the top level item useCaseBuilder->Append( theComponent ); // component object is added as the top level item
SALOMEDS::ChildIterator_var it = theComponent->GetStudy()->NewChildIterator( theComponent ); SALOMEDS::ChildIterator_wrap it = theComponent->GetStudy()->NewChildIterator( theComponent );
for (it->InitEx(true); it->More(); it->Next()) { for (it->InitEx(true); it->More(); it->Next()) {
useCaseBuilder->AppendTo( it->Value()->GetFather(), it->Value() ); useCaseBuilder->AppendTo( it->Value()->GetFather(), it->Value() );
} }

View File

@ -262,11 +262,32 @@ static SALOMEDS::SObject_ptr publish(SALOMEDS::Study_ptr theStudy,
SALOMEDS::SObject_wrap SO = SMESH_Gen_i::ObjectToSObject( theStudy, theIOR ); SALOMEDS::SObject_wrap SO = SMESH_Gen_i::ObjectToSObject( theStudy, theIOR );
SALOMEDS::StudyBuilder_var aStudyBuilder = theStudy->NewBuilder(); SALOMEDS::StudyBuilder_var aStudyBuilder = theStudy->NewBuilder();
SALOMEDS::UseCaseBuilder_var useCaseBuilder = theStudy->GetUseCaseBuilder(); SALOMEDS::UseCaseBuilder_var useCaseBuilder = theStudy->GetUseCaseBuilder();
SALOMEDS::SObject_wrap objAfter;
if ( SO->_is_nil() ) { if ( SO->_is_nil() ) {
if ( theTag == 0 ) if ( theTag == 0 ) {
SO = aStudyBuilder->NewObject( theFatherObject ); SO = aStudyBuilder->NewObject( theFatherObject );
else if ( !theFatherObject->FindSubObject( theTag, SO.inout() )) } else if ( !theFatherObject->FindSubObject( theTag, SO.inout() )) {
SO = aStudyBuilder->NewObjectToTag( theFatherObject, theTag ); SO = aStudyBuilder->NewObjectToTag( theFatherObject, theTag );
// define the next tag after given one in the data tree to insert SOobject
std::string anEntry;
int last2Pnt_pos = -1;
int tagAfter = -1;
CORBA::String_var entry;
SALOMEDS::SObject_wrap curObj;
SALOMEDS::UseCaseIterator_var anUseCaseIter = useCaseBuilder->GetUseCaseIterator(theFatherObject);
for ( ; anUseCaseIter->More(); anUseCaseIter->Next() ) {
curObj = anUseCaseIter->Value();
entry = curObj->GetID();
anEntry = entry.in();
last2Pnt_pos = anEntry.rfind( ":" );
tagAfter = atoi( anEntry.substr( last2Pnt_pos+1 ).c_str() );
if ( tagAfter > theTag ) {
objAfter = curObj;
break;
}
}
}
} }
SALOMEDS::GenericAttribute_wrap anAttr; SALOMEDS::GenericAttribute_wrap anAttr;
@ -275,6 +296,10 @@ static SALOMEDS::SObject_ptr publish(SALOMEDS::Study_ptr theStudy,
CORBA::String_var objStr = SMESH_Gen_i::GetORB()->object_to_string( theIOR ); CORBA::String_var objStr = SMESH_Gen_i::GetORB()->object_to_string( theIOR );
SALOMEDS::AttributeIOR_wrap iorAttr = anAttr; SALOMEDS::AttributeIOR_wrap iorAttr = anAttr;
iorAttr->SetValue( objStr.in() ); iorAttr->SetValue( objStr.in() );
// UnRegister() !!!
SALOME::GenericObj_var genObj = SALOME::GenericObj::_narrow( theIOR );
if ( !genObj->_is_nil() )
genObj->UnRegister();
} }
if ( thePixMap ) { if ( thePixMap ) {
anAttr = aStudyBuilder->FindOrCreateAttribute( SO, "AttributePixMap" ); anAttr = aStudyBuilder->FindOrCreateAttribute( SO, "AttributePixMap" );
@ -289,7 +314,11 @@ static SALOMEDS::SObject_ptr publish(SALOMEDS::Study_ptr theStudy,
// add object to the use case tree // add object to the use case tree
// (to support tree representation customization and drag-n-drop) // (to support tree representation customization and drag-n-drop)
useCaseBuilder->AppendTo( SO->GetFather(), SO ); if ( !CORBA::is_nil( objAfter ) ) {
useCaseBuilder->InsertBefore( SO, objAfter ); // insert at given tag
} else if ( !useCaseBuilder->IsUseCaseNode( SO ) ) {
useCaseBuilder->AppendTo( theFatherObject, SO ); // append to the end of list
}
return SO._retn(); return SO._retn();
} }
@ -1179,7 +1208,7 @@ char* SMESH_Gen_i::GetParameters(CORBA::Object_ptr theObject)
{ {
CORBA::String_var aResult(""); CORBA::String_var aResult("");
SALOMEDS::SObject_wrap aSObj = ObjectToSObject( myCurrentStudy,theObject); SALOMEDS::SObject_wrap aSObj = ObjectToSObject( myCurrentStudy, theObject );
if ( !aSObj->_is_nil() ) if ( !aSObj->_is_nil() )
{ {
SALOMEDS::GenericAttribute_wrap attr; SALOMEDS::GenericAttribute_wrap attr;
@ -1189,6 +1218,5 @@ char* SMESH_Gen_i::GetParameters(CORBA::Object_ptr theObject)
aResult = strAttr->Value(); aResult = strAttr->Value();
} }
} }
return aResult._retn();
return CORBA::string_dup( aResult.in() );
} }

View File

@ -101,10 +101,6 @@ SMESH_GroupOnFilter_i::SMESH_GroupOnFilter_i( PortableServer::POA_ptr thePOA,
SMESH_GroupBase_i::~SMESH_GroupBase_i() SMESH_GroupBase_i::~SMESH_GroupBase_i()
{ {
MESSAGE("~SMESH_GroupBase_i; this = "<<this );
if ( myMeshServant )
myMeshServant->removeGroup(myLocalID);
if ( myPreMeshInfo ) delete myPreMeshInfo; myPreMeshInfo = NULL; if ( myPreMeshInfo ) delete myPreMeshInfo; myPreMeshInfo = NULL;
} }
@ -158,13 +154,14 @@ void SMESH_GroupBase_i::SetName( const char* theName )
// Update group name in a study // Update group name in a study
SMESH_Gen_i* aGen = myMeshServant->GetGen(); SMESH_Gen_i* aGen = myMeshServant->GetGen();
SALOMEDS::Study_var aStudy = aGen->GetCurrentStudy(); SALOMEDS::Study_var aStudy = aGen->GetCurrentStudy();
SALOMEDS::SObject_var anSO = aGen->ObjectToSObject( aStudy, _this() ); SMESH::SMESH_GroupBase_var aGrp = _this();
SALOMEDS::SObject_var anSO = aGen->ObjectToSObject( aStudy, aGrp );
if ( !anSO->_is_nil() ) if ( !anSO->_is_nil() )
{ {
aGen->SetName( anSO, theName ); aGen->SetName( anSO, theName );
// Update Python script // Update Python script
TPythonDump() << _this() << ".SetName( '" << theName << "' )"; TPythonDump() << anSO << ".SetName( '" << theName << "' )";
} }
} }
@ -259,7 +256,7 @@ void SMESH_Group_i::Clear()
myPreMeshInfo->FullLoadFromFile(); myPreMeshInfo->FullLoadFromFile();
// Update Python script // Update Python script
TPythonDump() << _this() << ".Clear()"; TPythonDump() << SMESH::SMESH_Group_var(_this()) << ".Clear()";
// Clear the group // Clear the group
SMESHDS_Group* aGroupDS = dynamic_cast<SMESHDS_Group*>( GetGroupDS() ); SMESHDS_Group* aGroupDS = dynamic_cast<SMESHDS_Group*>( GetGroupDS() );
@ -300,7 +297,7 @@ CORBA::Long SMESH_Group_i::Add( const SMESH::long_array& theIDs )
myPreMeshInfo->FullLoadFromFile(); myPreMeshInfo->FullLoadFromFile();
// Update Python script // Update Python script
TPythonDump() << "nbAdd = " << _this() << ".Add( " << theIDs << " )"; TPythonDump() << "nbAdd = " << SMESH::SMESH_Group_var(_this()) << ".Add( " << theIDs << " )";
// Add elements to the group // Add elements to the group
SMESHDS_Group* aGroupDS = dynamic_cast<SMESHDS_Group*>( GetGroupDS() ); SMESHDS_Group* aGroupDS = dynamic_cast<SMESHDS_Group*>( GetGroupDS() );
@ -329,7 +326,8 @@ CORBA::Long SMESH_Group_i::Remove( const SMESH::long_array& theIDs )
myPreMeshInfo->FullLoadFromFile(); myPreMeshInfo->FullLoadFromFile();
// Update Python script // Update Python script
TPythonDump() << "nbDel = " << _this() << ".Remove( " << theIDs << " )"; TPythonDump() << "nbDel = " << SMESH::SMESH_Group_var(_this())
<< ".Remove( " << theIDs << " )";
// Remove elements from the group // Remove elements from the group
SMESHDS_Group* aGroupDS = dynamic_cast<SMESHDS_Group*>( GetGroupDS() ); SMESHDS_Group* aGroupDS = dynamic_cast<SMESHDS_Group*>( GetGroupDS() );
@ -382,8 +380,9 @@ AddByPredicate( SMESH::Predicate_ptr thePredicate )
myPreMeshInfo->FullLoadFromFile(); myPreMeshInfo->FullLoadFromFile();
if(SMESH::Predicate_i* aPredicate = SMESH::GetPredicate(thePredicate)){ if(SMESH::Predicate_i* aPredicate = SMESH::GetPredicate(thePredicate)){
TPythonDump()<<_this()<<".AddByPredicate("<<aPredicate<<")"; TPythonDump() << SMESH::SMESH_Group_var(_this())
return ChangeByPredicate(aPredicate,GetGroupDS(),&SMESHDS_Group::Add); << ".AddByPredicate( " << aPredicate << " )";
return ChangeByPredicate( aPredicate, GetGroupDS(), &SMESHDS_Group::Add );
} }
return 0; return 0;
} }
@ -396,7 +395,8 @@ RemoveByPredicate( SMESH::Predicate_ptr thePredicate )
myPreMeshInfo->FullLoadFromFile(); myPreMeshInfo->FullLoadFromFile();
if(SMESH::Predicate_i* aPredicate = SMESH::GetPredicate(thePredicate)){ if(SMESH::Predicate_i* aPredicate = SMESH::GetPredicate(thePredicate)){
TPythonDump()<<_this()<<".RemoveByPredicate("<<aPredicate<<")"; TPythonDump() << SMESH::SMESH_Group_var(_this())
<< ".RemoveByPredicate( " << aPredicate << " )";
return ChangeByPredicate(aPredicate,GetGroupDS(),&SMESHDS_Group::Remove); return ChangeByPredicate(aPredicate,GetGroupDS(),&SMESHDS_Group::Remove);
} }
return 0; return 0;
@ -408,35 +408,18 @@ CORBA::Long SMESH_Group_i::AddFrom( SMESH::SMESH_IDSource_ptr theSource )
myPreMeshInfo->FullLoadFromFile(); myPreMeshInfo->FullLoadFromFile();
TPythonDump pd; TPythonDump pd;
long nbAdd = 0; long prevNb = Size();
SMESHDS_Group* aGroupDS = dynamic_cast<SMESHDS_Group*>( GetGroupDS() ); SMESHDS_Group* aGroupDS = dynamic_cast<SMESHDS_Group*>( GetGroupDS() );
if (aGroupDS) { if (aGroupDS) {
SMESH::long_array_var anIds; SMDS_ElemIteratorPtr elemIt = SMESH_Mesh_i::GetElements( theSource, GetType() );
SMESH::SMESH_GroupBase_var group = SMESH::SMESH_GroupBase::_narrow(theSource); while ( elemIt->more() )
SMESH::SMESH_Mesh_var mesh = SMESH::SMESH_Mesh::_narrow(theSource); aGroupDS->SMDSGroup().Add( elemIt->next() );
SMESH::SMESH_subMesh_var submesh = SMESH::SMESH_subMesh::_narrow(theSource);
SMESH::Filter_var filter = SMESH::Filter::_narrow(theSource);
if ( !group->_is_nil())
anIds = group->GetType()==GetType() ? theSource->GetIDs() : new SMESH::long_array();
else if ( !mesh->_is_nil() )
anIds = mesh->GetElementsByType( GetType() );
else if ( !submesh->_is_nil())
anIds = submesh->GetElementsByType( GetType() );
else if ( !filter->_is_nil() ) {
filter->SetMesh( GetMeshServant()->_this() );
anIds = filter->GetElementType()==GetType() ? theSource->GetIDs() : new SMESH::long_array();
}
else
anIds = theSource->GetIDs();
for ( int i = 0, total = anIds->length(); i < total; i++ ) {
if ( aGroupDS->Add((int)anIds[i]) ) nbAdd++;
}
} }
// Update Python script // Update Python script
pd << "nbAdd = " << _this() << ".AddFrom( " << theSource << " )"; pd << "nbAdd = " << SMESH::SMESH_Group_var(_this()) << ".AddFrom( " << theSource << " )";
return nbAdd; return prevNb - Size();
} }
//============================================================================= //=============================================================================
@ -583,7 +566,7 @@ SMESH::SMESH_Mesh_ptr SMESH_GroupBase_i::GetMesh()
{ {
SMESH::SMESH_Mesh_var aMesh; SMESH::SMESH_Mesh_var aMesh;
if ( myMeshServant ) if ( myMeshServant )
aMesh = SMESH::SMESH_Mesh::_narrow( myMeshServant->_this() ); aMesh = myMeshServant->_this();
return aMesh._retn(); return aMesh._retn();
} }
@ -640,7 +623,9 @@ void SMESH_GroupBase_i::SetColor(const SALOMEDS::Color& color)
if ( oldColor != aQColor ) if ( oldColor != aQColor )
{ {
aGroupDS->SetColor(aQColor); aGroupDS->SetColor(aQColor);
TPythonDump()<<_this()<<".SetColor( SALOMEDS.Color( "<<color.R<<", "<<color.G<<", "<<color.B<<" ))"; TPythonDump()<< SMESH::SMESH_GroupBase_var(_this())
<< ".SetColor( SALOMEDS.Color( "
<<color.R<<", "<<color.G<<", "<<color.B<<" ))";
} }
} }
} }
@ -670,7 +655,7 @@ void SMESH_GroupBase_i::SetColorNumber(CORBA::Long color)
if (aGroupDS) if (aGroupDS)
{ {
aGroupDS->SetColorGroup(color); aGroupDS->SetColorGroup(color);
TPythonDump()<<_this()<<".SetColorNumber( "<<color<<" )"; TPythonDump()<<SMESH::SMESH_GroupBase_var(_this())<<".SetColorNumber( "<<color<<" )";
} }
MESSAGE("set color number of a group"); MESSAGE("set color number of a group");
return ; return ;
@ -800,7 +785,7 @@ void SMESH_GroupOnFilter_i::SetFilter(SMESH::Filter_ptr theFilter)
if ( SMESHDS_GroupOnFilter* grDS = dynamic_cast< SMESHDS_GroupOnFilter*>( GetGroupDS() )) if ( SMESHDS_GroupOnFilter* grDS = dynamic_cast< SMESHDS_GroupOnFilter*>( GetGroupDS() ))
grDS->SetPredicate( GetPredicate( myFilter )); grDS->SetPredicate( GetPredicate( myFilter ));
TPythonDump()<< _this() <<".SetFilter( "<<theFilter<<" )"; TPythonDump()<< SMESH::SMESH_GroupOnFilter_var(_this()) <<".SetFilter( "<<theFilter<<" )";
if ( myFilter ) if ( myFilter )
{ {
@ -819,7 +804,7 @@ void SMESH_GroupOnFilter_i::SetFilter(SMESH::Filter_ptr theFilter)
SMESH::Filter_ptr SMESH_GroupOnFilter_i::GetFilter() SMESH::Filter_ptr SMESH_GroupOnFilter_i::GetFilter()
{ {
SMESH::Filter_var f = myFilter; SMESH::Filter_var f = myFilter;
TPythonDump() << f << " = " << _this() << ".GetFilter()"; TPythonDump() << f << " = " << SMESH::SMESH_GroupOnFilter_var(_this()) << ".GetFilter()";
return f._retn(); return f._retn();
} }

View File

@ -25,6 +25,7 @@
#include "SMESH_Measurements_i.hxx" #include "SMESH_Measurements_i.hxx"
#include "SMESH_Gen_i.hxx" #include "SMESH_Gen_i.hxx"
#include "SMESH_Filter_i.hxx"
#include "SMESH_PythonDump.hxx" #include "SMESH_PythonDump.hxx"
#include "SMDS_Mesh.hxx" #include "SMDS_Mesh.hxx"
@ -131,6 +132,24 @@ static bool isNodeType (SMESH::array_of_ElementType_var theTypes)
return theTypes->length() > 0 && theTypes[0] == SMESH::NODE; return theTypes->length() > 0 && theTypes[0] == SMESH::NODE;
} }
static double getNumericalValue(SMESH::SMESH_IDSource_ptr theSource, SMESH::Controls::NumericalFunctorPtr theFunctor)
{
double value = 0;
if ( !CORBA::is_nil( theSource ) ) {
const SMESHDS_Mesh* aMesh = getMesh( theSource );
if ( aMesh ) {
theFunctor->SetMesh( aMesh );
SMESH::long_array_var anElementsId = theSource->GetIDs();
for (int i = 0; i < anElementsId->length(); i++) {
value += theFunctor->GetValue( anElementsId[i] );
}
}
}
return value;
}
//======================================================================= //=======================================================================
// name : MinDistance // name : MinDistance
// Purpose : minimal distance between two given entities // Purpose : minimal distance between two given entities
@ -257,3 +276,30 @@ SMESH::Measure Measurements_i::BoundingBox (const SMESH::ListOfIDSources& theSou
return aMeasure; return aMeasure;
} }
//=======================================================================
// name : Length
// Purpose : sum of length of 1D elements of the source
//=======================================================================
double Measurements_i::Length(SMESH::SMESH_IDSource_ptr theSource)
{
return getNumericalValue( theSource, SMESH::Controls::NumericalFunctorPtr(new SMESH::Controls::Length()) );
}
//=======================================================================
// name : Area
// Purpose : sum of area of 2D elements of the source
//=======================================================================
double Measurements_i::Area(SMESH::SMESH_IDSource_ptr theSource)
{
return getNumericalValue( theSource, SMESH::Controls::NumericalFunctorPtr(new SMESH::Controls::Area()) );
}
//=======================================================================
// name : Volume
// Purpose : sum of volume of 3D elements of the source
//=======================================================================
double Measurements_i::Volume(SMESH::SMESH_IDSource_ptr theSource)
{
return getNumericalValue( theSource, SMESH::Controls::NumericalFunctorPtr(new SMESH::Controls::Volume()) );
}

View File

@ -57,6 +57,22 @@ namespace SMESH
* common bounding box of entities * common bounding box of entities
*/ */
SMESH::Measure BoundingBox(const SMESH::ListOfIDSources& theSources); SMESH::Measure BoundingBox(const SMESH::ListOfIDSources& theSources);
/*!
* sum of length of 1D elements of the source
*/
double Length(SMESH::SMESH_IDSource_ptr theSource);
/*!
* sum of area of 2D elements of the source
*/
double Area(SMESH::SMESH_IDSource_ptr);
/*!
* sum of volume of 3D elements of the source
*/
double Volume(SMESH::SMESH_IDSource_ptr);
}; };
} }

View File

@ -63,6 +63,7 @@
#include <Utils_ExceptHandlers.hxx> #include <Utils_ExceptHandlers.hxx>
#include <Utils_CorbaException.hxx> #include <Utils_CorbaException.hxx>
#include <SALOMEDS_wrap.hxx> #include <SALOMEDS_wrap.hxx>
#include <SALOME_GenericObj_i.hh>
#include <BRepAdaptor_Surface.hxx> #include <BRepAdaptor_Surface.hxx>
#include <BRep_Tool.hxx> #include <BRep_Tool.hxx>
@ -453,7 +454,7 @@ SMESH_MeshEditor_i::SMESH_MeshEditor_i(SMESH_Mesh_i* theMesh, bool isPreview):
SMESH_MeshEditor_i::~SMESH_MeshEditor_i() SMESH_MeshEditor_i::~SMESH_MeshEditor_i()
{ {
deleteAuxIDSources(); //deleteAuxIDSources();
delete myPreviewMesh; myPreviewMesh = 0; delete myPreviewMesh; myPreviewMesh = 0;
delete myPreviewEditor; myPreviewEditor = 0; delete myPreviewEditor; myPreviewEditor = 0;
} }
@ -711,10 +712,12 @@ SMESH::ComputeError* SMESH_MeshEditor_i::GetLastError()
//======================================================================= //=======================================================================
//function : MakeIDSource //function : MakeIDSource
//purpose : Wrap a sequence of ids in a SMESH_IDSource //purpose : Wrap a sequence of ids in a SMESH_IDSource.
// Call UnRegister() as you fininsh using it!!
//======================================================================= //=======================================================================
struct SMESH_MeshEditor_i::_IDSource : public POA_SMESH::SMESH_IDSource struct SMESH_MeshEditor_i::_IDSource : public virtual POA_SMESH::SMESH_IDSource,
public virtual SALOME::GenericObj_i
{ {
SMESH::long_array _ids; SMESH::long_array _ids;
SMESH::ElementType _type; SMESH::ElementType _type;
@ -745,14 +748,16 @@ struct SMESH_MeshEditor_i::_IDSource : public POA_SMESH::SMESH_IDSource
SMESH::SMESH_IDSource_ptr SMESH_MeshEditor_i::MakeIDSource(const SMESH::long_array& ids, SMESH::SMESH_IDSource_ptr SMESH_MeshEditor_i::MakeIDSource(const SMESH::long_array& ids,
SMESH::ElementType type) SMESH::ElementType type)
{ {
if ( myAuxIDSources.size() > 10 ) // if ( myAuxIDSources.size() > 10 ) {
deleteAuxIDSources(); // delete myAuxIDSources.front();
// myAuxIDSources.pop_front();
// }
_IDSource* idSrc = new _IDSource; _IDSource* idSrc = new _IDSource;
idSrc->_mesh = myMesh_i->_this(); idSrc->_mesh = myMesh_i->_this();
idSrc->_ids = ids; idSrc->_ids = ids;
idSrc->_type = type; idSrc->_type = type;
myAuxIDSources.push_back( idSrc ); //myAuxIDSources.push_back( idSrc );
SMESH::SMESH_IDSource_var anIDSourceVar = idSrc->_this(); SMESH::SMESH_IDSource_var anIDSourceVar = idSrc->_this();
@ -776,13 +781,13 @@ CORBA::Long* SMESH_MeshEditor_i::GetTemporaryIDs( SMESH::SMESH_IDSource_ptr& idS
return 0; return 0;
} }
void SMESH_MeshEditor_i::deleteAuxIDSources() // void SMESH_MeshEditor_i::deleteAuxIDSources()
{ // {
std::list< _IDSource* >::iterator idSrcIt = myAuxIDSources.begin(); // std::list< _IDSource* >::iterator idSrcIt = myAuxIDSources.begin();
for ( ; idSrcIt != myAuxIDSources.end(); ++idSrcIt ) // for ( ; idSrcIt != myAuxIDSources.end(); ++idSrcIt )
delete *idSrcIt; // delete *idSrcIt;
myAuxIDSources.clear(); // myAuxIDSources.clear();
} // }
//============================================================================= //=============================================================================
/*! /*!

View File

@ -1097,8 +1097,8 @@ private: //!< fields
// temporary IDSources // temporary IDSources
struct _IDSource; struct _IDSource;
std::list< _IDSource* > myAuxIDSources; // std::list< _IDSource* > myAuxIDSources;
void deleteAuxIDSources(); // void deleteAuxIDSources();
}; };
#endif #endif

File diff suppressed because it is too large Load Diff

View File

@ -28,6 +28,11 @@
#include "SMESH.hxx" #include "SMESH.hxx"
#include "SMESH_Hypothesis.hxx"
#include "SMESH_Mesh.hxx"
#include "SMESH_subMesh.hxx"
#include <SALOME_GenericObj_i.hh>
#include <SALOMEconfig.h> #include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SMESH_Gen) #include CORBA_SERVER_HEADER(SMESH_Gen)
#include CORBA_SERVER_HEADER(SMESH_Mesh) #include CORBA_SERVER_HEADER(SMESH_Mesh)
@ -35,18 +40,13 @@
#include CORBA_SERVER_HEADER(SMESH_Hypothesis) #include CORBA_SERVER_HEADER(SMESH_Hypothesis)
#include CORBA_CLIENT_HEADER(GEOM_Gen) #include CORBA_CLIENT_HEADER(GEOM_Gen)
#include "SMESH_Hypothesis.hxx" #include <map>
#include "SMESH_Mesh.hxx"
#include "SMESH_subMesh.hxx"
#include "SALOME_GenericObj_i.hh"
class SMESH_Gen_i; class SMESH_Gen_i;
class SMESH_GroupBase_i; class SMESH_GroupBase_i;
class SMESH_subMesh_i; class SMESH_subMesh_i;
class SMESH_PreMeshInfo; class SMESH_PreMeshInfo;
class SMESH_MeshEditor_i;
#include <map>
class SMESH_I_EXPORT SMESH_Mesh_i: class SMESH_I_EXPORT SMESH_Mesh_i:
public virtual POA_SMESH::SMESH_Mesh, public virtual POA_SMESH::SMESH_Mesh,
@ -655,6 +655,8 @@ private:
std::map<int, SMESH::SMESH_subMesh_ptr> _mapSubMeshIor; std::map<int, SMESH::SMESH_subMesh_ptr> _mapSubMeshIor;
std::map<int, SMESH::SMESH_GroupBase_ptr> _mapGroups; std::map<int, SMESH::SMESH_GroupBase_ptr> _mapGroups;
std::map<int, SMESH::SMESH_Hypothesis_ptr> _mapHypo; std::map<int, SMESH::SMESH_Hypothesis_ptr> _mapHypo;
SMESH_MeshEditor_i* _editor;
SMESH_MeshEditor_i* _previewEditor;
SMESH::MedFileInfo_var _medFileInfo; SMESH::MedFileInfo_var _medFileInfo;
SMESH_PreMeshInfo* _preMeshInfo; // mesh info before full loading from study file SMESH_PreMeshInfo* _preMeshInfo; // mesh info before full loading from study file
@ -669,7 +671,7 @@ private:
// number of items in a group varies (1) <-> (>1) // number of items in a group varies (1) <-> (>1)
std::string _groupEntry; std::string _groupEntry;
std::set<int> _indices; // indices of group items within group's main shape std::set<int> _indices; // indices of group items within group's main shape
CORBA::Object_ptr _smeshObject; // SMESH object depending on GEOM group CORBA::Object_var _smeshObject; // SMESH object depending on GEOM group
}; };
std::list<TGeomGroupData> _geomGroupData; std::list<TGeomGroupData> _geomGroupData;
@ -683,7 +685,7 @@ private:
*/ */
void removeGeomGroupData(CORBA::Object_ptr theSmeshObj); void removeGeomGroupData(CORBA::Object_ptr theSmeshObj);
/*! /*!
* \brief 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);

View File

@ -227,6 +227,7 @@ CORBA::Long SMESH_subMesh_i::GetNumberOfNodes(CORBA::Boolean all)
if (( aSubMeshDS = aSubMesh->GetSubMeshDS() )) if (( aSubMeshDS = aSubMesh->GetSubMeshDS() ))
nbNodes += aSubMeshDS->NbNodes(); nbNodes += aSubMeshDS->NbNodes();
} }
return nbNodes;
} }
return aSubMeshDS ? aSubMeshDS->NbNodes() : 0; return aSubMeshDS ? aSubMeshDS->NbNodes() : 0;

View File

@ -27,10 +27,9 @@ import salome
SMESH = None # SMESH module is loaded only when needed SMESH = None # SMESH module is loaded only when needed
from salome.kernel.studyedit import getStudyEditor from salome.kernel.studyedit import getStudyEditor
try: from salome.kernel.deprecation import is_called_by_sphinx
if not is_called_by_sphinx():
from salome.gui import helper from salome.gui import helper
except ImportError:
pass
class SMeshStudyTools: class SMeshStudyTools:
""" """

View File

@ -551,7 +551,9 @@ class smeshBuilder(object, SMESH._objref_SMESH_Gen):
aMeshes = [ Mesh(self, self.geompyD, m) for m in aSmeshMeshes ] aMeshes = [ Mesh(self, self.geompyD, m) for m in aSmeshMeshes ]
return aMeshes, aStatus return aMeshes, aStatus
## Creates a Mesh object importing data from the given GMF file ## Creates a Mesh object importing data from the given GMF file.
# GMF files have .mesh extension for the ASCII format and .meshb for
# the bynary format.
# @return [ an instance of Mesh class, SMESH.ComputeError ] # @return [ an instance of Mesh class, SMESH.ComputeError ]
# @ingroup l2_impexp # @ingroup l2_impexp
def CreateMeshesFromGMF( self, theFileName ): def CreateMeshesFromGMF( self, theFileName ):
@ -980,6 +982,7 @@ class smeshBuilder(object, SMESH._objref_SMESH_Gen):
if not hasattr(src1, "_narrow"): return None if not hasattr(src1, "_narrow"): return None
src1 = src1._narrow(SMESH.SMESH_IDSource) src1 = src1._narrow(SMESH.SMESH_IDSource)
if not src1: return None if not src1: return None
unRegister = genObjUnRegister()
if id1 != 0: if id1 != 0:
m = src1.GetMesh() m = src1.GetMesh()
e = m.GetMeshEditor() e = m.GetMeshEditor()
@ -987,6 +990,7 @@ class smeshBuilder(object, SMESH._objref_SMESH_Gen):
src1 = e.MakeIDSource([id1], SMESH.FACE) src1 = e.MakeIDSource([id1], SMESH.FACE)
else: else:
src1 = e.MakeIDSource([id1], SMESH.NODE) src1 = e.MakeIDSource([id1], SMESH.NODE)
unRegister.set( src1 )
pass pass
if hasattr(src2, "_narrow"): if hasattr(src2, "_narrow"):
src2 = src2._narrow(SMESH.SMESH_IDSource) src2 = src2._narrow(SMESH.SMESH_IDSource)
@ -997,11 +1001,12 @@ class smeshBuilder(object, SMESH._objref_SMESH_Gen):
src2 = e.MakeIDSource([id2], SMESH.FACE) src2 = e.MakeIDSource([id2], SMESH.FACE)
else: else:
src2 = e.MakeIDSource([id2], SMESH.NODE) src2 = e.MakeIDSource([id2], SMESH.NODE)
unRegister.set( src2 )
pass pass
pass pass
aMeasurements = self.CreateMeasurements() aMeasurements = self.CreateMeasurements()
unRegister.set( aMeasurements )
result = aMeasurements.MinDistance(src1, src2) result = aMeasurements.MinDistance(src1, src2)
aMeasurements.UnRegister()
return result return result
## Get bounding box of the specified object(s) ## Get bounding box of the specified object(s)
@ -1041,6 +1046,44 @@ class smeshBuilder(object, SMESH._objref_SMESH_Gen):
aMeasurements.UnRegister() aMeasurements.UnRegister()
return result return result
## Get sum of lengths of all 1D elements in the mesh object.
# @param elemId obj mesh, submesh or group
# @return sum of lengths of all 1D elements
# @ingroup l1_measurements
def GetLength(self, obj):
if isinstance(obj, Mesh): obj = obj.mesh
if isinstance(obj, Mesh_Algorithm): obj = obj.GetSubMesh()
aMeasurements = self.CreateMeasurements()
value = aMeasurements.Length(obj)
aMeasurements.UnRegister()
return value
## Get sum of areas of all 2D elements in the mesh object.
# @param elemId obj mesh, submesh or group
# @return sum of areas of all 2D elements
# @ingroup l1_measurements
def GetArea(self, obj):
if isinstance(obj, Mesh): obj = obj.mesh
if isinstance(obj, Mesh_Algorithm): obj = obj.GetSubMesh()
aMeasurements = self.CreateMeasurements()
value = aMeasurements.Area(obj)
aMeasurements.UnRegister()
return value
## Get sum of volumes of all 3D elements in the mesh object.
# @param elemId obj mesh, submesh or group
# @return sum of volumes of all 3D elements
# @ingroup l1_measurements
def GetVolume(self, obj):
if isinstance(obj, Mesh): obj = obj.mesh
if isinstance(obj, Mesh_Algorithm): obj = obj.GetSubMesh()
aMeasurements = self.CreateMeasurements()
value = aMeasurements.Volume(obj)
aMeasurements.UnRegister()
return value
pass # end of class smeshBuilder
import omniORB import omniORB
#Registering the new proxy for SMESH_Gen #Registering the new proxy for SMESH_Gen
omniORB.registerObjref(SMESH._objref_SMESH_Gen._NP_RepositoryId, smeshBuilder) omniORB.registerObjref(SMESH._objref_SMESH_Gen._NP_RepositoryId, smeshBuilder)
@ -1577,8 +1620,10 @@ class Mesh:
def ExportMED(self, f, auto_groups=0, version=MED_V2_2, def ExportMED(self, f, auto_groups=0, version=MED_V2_2,
overwrite=1, meshPart=None, autoDimension=True): overwrite=1, meshPart=None, autoDimension=True):
if meshPart: if meshPart:
unRegister = genObjUnRegister()
if isinstance( meshPart, list ): if isinstance( meshPart, list ):
meshPart = self.GetIDSource( meshPart, SMESH.ALL ) meshPart = self.GetIDSource( meshPart, SMESH.ALL )
unRegister.set( meshPart )
self.mesh.ExportPartToMED( meshPart, f, auto_groups, version, overwrite, autoDimension) self.mesh.ExportPartToMED( meshPart, f, auto_groups, version, overwrite, autoDimension)
else: else:
self.mesh.ExportToMEDX(f, auto_groups, version, overwrite, autoDimension) self.mesh.ExportToMEDX(f, auto_groups, version, overwrite, autoDimension)
@ -1598,8 +1643,10 @@ class Mesh:
# @ingroup l2_impexp # @ingroup l2_impexp
def ExportDAT(self, f, meshPart=None): def ExportDAT(self, f, meshPart=None):
if meshPart: if meshPart:
unRegister = genObjUnRegister()
if isinstance( meshPart, list ): if isinstance( meshPart, list ):
meshPart = self.GetIDSource( meshPart, SMESH.ALL ) meshPart = self.GetIDSource( meshPart, SMESH.ALL )
unRegister.set( meshPart )
self.mesh.ExportPartToDAT( meshPart, f ) self.mesh.ExportPartToDAT( meshPart, f )
else: else:
self.mesh.ExportDAT(f) self.mesh.ExportDAT(f)
@ -1610,8 +1657,10 @@ class Mesh:
# @ingroup l2_impexp # @ingroup l2_impexp
def ExportUNV(self, f, meshPart=None): def ExportUNV(self, f, meshPart=None):
if meshPart: if meshPart:
unRegister = genObjUnRegister()
if isinstance( meshPart, list ): if isinstance( meshPart, list ):
meshPart = self.GetIDSource( meshPart, SMESH.ALL ) meshPart = self.GetIDSource( meshPart, SMESH.ALL )
unRegister.set( meshPart )
self.mesh.ExportPartToUNV( meshPart, f ) self.mesh.ExportPartToUNV( meshPart, f )
else: else:
self.mesh.ExportUNV(f) self.mesh.ExportUNV(f)
@ -1623,8 +1672,10 @@ class Mesh:
# @ingroup l2_impexp # @ingroup l2_impexp
def ExportSTL(self, f, ascii=1, meshPart=None): def ExportSTL(self, f, ascii=1, meshPart=None):
if meshPart: if meshPart:
unRegister = genObjUnRegister()
if isinstance( meshPart, list ): if isinstance( meshPart, list ):
meshPart = self.GetIDSource( meshPart, SMESH.ALL ) meshPart = self.GetIDSource( meshPart, SMESH.ALL )
unRegister.set( meshPart )
self.mesh.ExportPartToSTL( meshPart, f, ascii ) self.mesh.ExportPartToSTL( meshPart, f, ascii )
else: else:
self.mesh.ExportSTL(f, ascii) self.mesh.ExportSTL(f, ascii)
@ -1635,21 +1686,27 @@ class Mesh:
# @param meshPart a part of mesh (group, sub-mesh) to export instead of the mesh # @param meshPart a part of mesh (group, sub-mesh) to export instead of the mesh
# @ingroup l2_impexp # @ingroup l2_impexp
def ExportCGNS(self, f, overwrite=1, meshPart=None): def ExportCGNS(self, f, overwrite=1, meshPart=None):
unRegister = genObjUnRegister()
if isinstance( meshPart, list ): if isinstance( meshPart, list ):
meshPart = self.GetIDSource( meshPart, SMESH.ALL ) meshPart = self.GetIDSource( meshPart, SMESH.ALL )
unRegister.set( meshPart )
if isinstance( meshPart, Mesh ): if isinstance( meshPart, Mesh ):
meshPart = meshPart.mesh meshPart = meshPart.mesh
elif not meshPart: elif not meshPart:
meshPart = self.mesh meshPart = self.mesh
self.mesh.ExportCGNS(meshPart, f, overwrite) self.mesh.ExportCGNS(meshPart, f, overwrite)
## Exports the mesh in a file in GMF format ## Exports the mesh in a file in GMF format.
# GMF files must have .mesh extension for the ASCII format and .meshb for
# the bynary format. Other extensions are not allowed.
# @param f is the file name # @param f is the file name
# @param meshPart a part of mesh (group, sub-mesh) to export instead of the mesh # @param meshPart a part of mesh (group, sub-mesh) to export instead of the mesh
# @ingroup l2_impexp # @ingroup l2_impexp
def ExportGMF(self, f, meshPart=None): def ExportGMF(self, f, meshPart=None):
unRegister = genObjUnRegister()
if isinstance( meshPart, list ): if isinstance( meshPart, list ):
meshPart = self.GetIDSource( meshPart, SMESH.ALL ) meshPart = self.GetIDSource( meshPart, SMESH.ALL )
unRegister.set( meshPart )
if isinstance( meshPart, Mesh ): if isinstance( meshPart, Mesh ):
meshPart = meshPart.mesh meshPart = meshPart.mesh
elif not meshPart: elif not meshPart:
@ -1664,9 +1721,15 @@ class Mesh:
# @param opt boolean parameter for creating/not creating # @param opt boolean parameter for creating/not creating
# the groups Group_On_All_Nodes, Group_On_All_Faces, ... # the groups Group_On_All_Nodes, Group_On_All_Faces, ...
# @param overwrite boolean parameter for overwriting/not overwriting the file # @param overwrite boolean parameter for overwriting/not overwriting the file
# @param autoDimension: if @c True (default), a space dimension of a MED mesh can be either
# - 1D if all mesh nodes lie on OX coordinate axis, or
# - 2D if all mesh nodes lie on XOY coordinate plane, or
# - 3D in the rest cases.
#
# If @a autoDimension is @c False, the space dimension is always 3.
# @ingroup l2_impexp # @ingroup l2_impexp
def ExportToMED(self, f, version, opt=0, overwrite=1): def ExportToMED(self, f, version, opt=0, overwrite=1, autoDimension=True):
self.mesh.ExportToMEDX(f, opt, version, overwrite) self.mesh.ExportToMEDX(f, opt, version, overwrite, autoDimension)
# Operations with groups: # Operations with groups:
# ---------------------- # ----------------------
@ -2428,7 +2491,7 @@ class Mesh:
aMeasurements = self.smeshpyD.CreateMeasurements() aMeasurements = self.smeshpyD.CreateMeasurements()
aMeasure = aMeasurements.MinDistance(id1, id2) aMeasure = aMeasurements.MinDistance(id1, id2)
aMeasurements.UnRegister() genObjUnRegister([aMeasurements,id1, id2])
return aMeasure return aMeasure
## Get bounding box of the specified object(s) ## Get bounding box of the specified object(s)
@ -2461,6 +2524,7 @@ class Mesh:
if len(IDs) > 0 and isinstance(IDs[0], int): if len(IDs) > 0 and isinstance(IDs[0], int):
IDs = [IDs] IDs = [IDs]
srclist = [] srclist = []
unRegister = genObjUnRegister()
for o in IDs: for o in IDs:
if isinstance(o, Mesh): if isinstance(o, Mesh):
srclist.append(o.mesh) srclist.append(o.mesh)
@ -2473,11 +2537,12 @@ class Mesh:
srclist.append(self.editor.MakeIDSource(o, SMESH.FACE)) srclist.append(self.editor.MakeIDSource(o, SMESH.FACE))
else: else:
srclist.append(self.editor.MakeIDSource(o, SMESH.NODE)) srclist.append(self.editor.MakeIDSource(o, SMESH.NODE))
unRegister.set( srclist[-1] )
pass pass
pass pass
aMeasurements = self.smeshpyD.CreateMeasurements() aMeasurements = self.smeshpyD.CreateMeasurements()
unRegister.set( aMeasurements )
aMeasure = aMeasurements.BoundingBox(srclist) aMeasure = aMeasurements.BoundingBox(srclist)
aMeasurements.UnRegister()
return aMeasure return aMeasure
# Mesh edition (SMESH_MeshEditor functionality): # Mesh edition (SMESH_MeshEditor functionality):
@ -2530,10 +2595,12 @@ class Mesh:
# can be retrieved from the returned object by calling GetIDs() # can be retrieved from the returned object by calling GetIDs()
# @ingroup l2_modif_add # @ingroup l2_modif_add
def Add0DElementsToAllNodes(self, theObject, theGroupName=""): def Add0DElementsToAllNodes(self, theObject, theGroupName=""):
unRegister = genObjUnRegister()
if isinstance( theObject, Mesh ): if isinstance( theObject, Mesh ):
theObject = theObject.GetMesh() theObject = theObject.GetMesh()
if isinstance( theObject, list ): if isinstance( theObject, list ):
theObject = self.GetIDSource( theObject, SMESH.ALL ) theObject = self.GetIDSource( theObject, SMESH.ALL )
unRegister.set( theObject )
return self.editor.Create0DElementsOnAllNodes( theObject, theGroupName ) return self.editor.Create0DElementsOnAllNodes( theObject, theGroupName )
## Creates a ball element on a node with given ID. ## Creates a ball element on a node with given ID.
@ -2803,11 +2870,13 @@ class Mesh:
# @return number of reoriented faces # @return number of reoriented faces
# @ingroup l2_modif_changori # @ingroup l2_modif_changori
def Reorient2D(self, the2DObject, theDirection, theFaceOrPoint ): def Reorient2D(self, the2DObject, theDirection, theFaceOrPoint ):
unRegister = genObjUnRegister()
# check the2DObject # check the2DObject
if isinstance( the2DObject, Mesh ): if isinstance( the2DObject, Mesh ):
the2DObject = the2DObject.GetMesh() the2DObject = the2DObject.GetMesh()
if isinstance( the2DObject, list ): if isinstance( the2DObject, list ):
the2DObject = self.GetIDSource( the2DObject, SMESH.FACE ) the2DObject = self.GetIDSource( the2DObject, SMESH.FACE )
unRegister.set( the2DObject )
# check theDirection # check theDirection
if isinstance( theDirection, geomBuilder.GEOM._objref_GEOM_Object): if isinstance( theDirection, geomBuilder.GEOM._objref_GEOM_Object):
theDirection = self.smeshpyD.GetDirStruct( theDirection ) theDirection = self.smeshpyD.GetDirStruct( theDirection )
@ -2897,12 +2966,14 @@ class Mesh:
# group or a list of face IDs. By default all quadrangles are split # group or a list of face IDs. By default all quadrangles are split
# @ingroup l2_modif_cutquadr # @ingroup l2_modif_cutquadr
def QuadTo4Tri (self, theElements=[]): def QuadTo4Tri (self, theElements=[]):
unRegister = genObjUnRegister()
if isinstance( theElements, Mesh ): if isinstance( theElements, Mesh ):
theElements = theElements.mesh theElements = theElements.mesh
elif not theElements: elif not theElements:
theElements = self.mesh theElements = self.mesh
elif isinstance( theElements, list ): elif isinstance( theElements, list ):
theElements = self.GetIDSource( theElements, SMESH.FACE ) theElements = self.GetIDSource( theElements, SMESH.FACE )
unRegister.set( theElements )
return self.editor.QuadTo4Tri( theElements ) return self.editor.QuadTo4Tri( theElements )
## Splits quadrangles into triangles. ## Splits quadrangles into triangles.
@ -2942,10 +3013,12 @@ class Mesh:
# Hex_5Tet - split the hexahedron into 5 tetrahedrons, etc # Hex_5Tet - split the hexahedron into 5 tetrahedrons, etc
# @ingroup l2_modif_cutquadr # @ingroup l2_modif_cutquadr
def SplitVolumesIntoTetra(self, elemIDs, method=smeshBuilder.Hex_5Tet ): def SplitVolumesIntoTetra(self, elemIDs, method=smeshBuilder.Hex_5Tet ):
unRegister = genObjUnRegister()
if isinstance( elemIDs, Mesh ): if isinstance( elemIDs, Mesh ):
elemIDs = elemIDs.GetMesh() elemIDs = elemIDs.GetMesh()
if ( isinstance( elemIDs, list )): if ( isinstance( elemIDs, list )):
elemIDs = self.editor.MakeIDSource(elemIDs, SMESH.VOLUME) elemIDs = self.editor.MakeIDSource(elemIDs, SMESH.VOLUME)
unRegister.set( elemIDs )
self.editor.SplitVolumesIntoTetra(elemIDs, method) self.editor.SplitVolumesIntoTetra(elemIDs, method)
## Splits quadrangle faces near triangular facets of volumes ## Splits quadrangle faces near triangular facets of volumes
@ -3216,12 +3289,14 @@ class Mesh:
# @ingroup l2_modif_edit # @ingroup l2_modif_edit
def MakeBoundaryMesh(self, elements, dimension=SMESH.BND_2DFROM3D, groupName="", meshName="", def MakeBoundaryMesh(self, elements, dimension=SMESH.BND_2DFROM3D, groupName="", meshName="",
toCopyElements=False, toCopyExistingBondary=False): toCopyElements=False, toCopyExistingBondary=False):
unRegister = genObjUnRegister()
if isinstance( elements, Mesh ): if isinstance( elements, Mesh ):
elements = elements.GetMesh() elements = elements.GetMesh()
if ( isinstance( elements, list )): if ( isinstance( elements, list )):
elemType = SMESH.ALL elemType = SMESH.ALL
if elements: elemType = self.GetElementType( elements[0], iselem=True) if elements: elemType = self.GetElementType( elements[0], iselem=True)
elements = self.editor.MakeIDSource(elements, elemType) elements = self.editor.MakeIDSource(elements, elemType)
unRegister.set( elements )
mesh, group = self.editor.MakeBoundaryMesh(elements,dimension,groupName,meshName, mesh, group = self.editor.MakeBoundaryMesh(elements,dimension,groupName,meshName,
toCopyElements,toCopyExistingBondary) toCopyElements,toCopyExistingBondary)
if mesh: mesh = self.smeshpyD.Mesh(mesh) if mesh: mesh = self.smeshpyD.Mesh(mesh)
@ -3530,8 +3605,10 @@ class Mesh:
# @param LinearVariation forces the computation of rotation angles as linear # @param LinearVariation forces the computation of rotation angles as linear
# variation of the given Angles along path steps # variation of the given Angles along path steps
# @param HasRefPoint allows using the reference point # @param HasRefPoint allows using the reference point
# @param RefPoint the point around which the shape is rotated (the mass center of the shape by default). # @param RefPoint the point around which the elements are rotated (the mass
# center of the elements by default).
# The User can specify any point as the Reference Point. # The User can specify any point as the Reference Point.
# RefPoint can be either GEOM Vertex, [x,y,z] or SMESH.PointStruct
# @param MakeGroups forces the generation of new groups from existing ones # @param MakeGroups forces the generation of new groups from existing ones
# @param ElemType type of elements for extrusion (if param Base is a mesh) # @param ElemType type of elements for extrusion (if param Base is a mesh)
# @return list of created groups (SMESH_GroupBase) and SMESH::Extrusion_Error if MakeGroups=True, # @return list of created groups (SMESH_GroupBase) and SMESH::Extrusion_Error if MakeGroups=True,
@ -3540,9 +3617,12 @@ class Mesh:
def ExtrusionAlongPathX(self, Base, Path, NodeStart, def ExtrusionAlongPathX(self, Base, Path, NodeStart,
HasAngles, Angles, LinearVariation, HasAngles, Angles, LinearVariation,
HasRefPoint, RefPoint, MakeGroups, ElemType): HasRefPoint, RefPoint, MakeGroups, ElemType):
if ( isinstance( RefPoint, geomBuilder.GEOM._objref_GEOM_Object)): if isinstance( RefPoint, geomBuilder.GEOM._objref_GEOM_Object):
RefPoint = self.smeshpyD.GetPointStruct(RefPoint) RefPoint = self.smeshpyD.GetPointStruct(RefPoint)
pass pass
elif isinstance( RefPoint, list ):
RefPoint = PointStruct(*RefPoint)
pass
Angles,AnglesParameters,hasVars = ParseAngles(Angles) Angles,AnglesParameters,hasVars = ParseAngles(Angles)
Parameters = AnglesParameters + var_separator + RefPoint.parameters Parameters = AnglesParameters + var_separator + RefPoint.parameters
self.mesh.SetParameters(Parameters) self.mesh.SetParameters(Parameters)
@ -3899,10 +3979,12 @@ class Mesh:
# @return list of created groups (SMESH_GroupBase) if MakeGroups=True, # @return list of created groups (SMESH_GroupBase) if MakeGroups=True,
# empty list otherwise # empty list otherwise
def Scale(self, theObject, thePoint, theScaleFact, Copy, MakeGroups=False): def Scale(self, theObject, thePoint, theScaleFact, Copy, MakeGroups=False):
unRegister = genObjUnRegister()
if ( isinstance( theObject, Mesh )): if ( isinstance( theObject, Mesh )):
theObject = theObject.GetMesh() theObject = theObject.GetMesh()
if ( isinstance( theObject, list )): if ( isinstance( theObject, list )):
theObject = self.GetIDSource(theObject, SMESH.ALL) theObject = self.GetIDSource(theObject, SMESH.ALL)
unRegister.set( theObject )
if ( isinstance( theScaleFact, float )): if ( isinstance( theScaleFact, float )):
theScaleFact = [theScaleFact] theScaleFact = [theScaleFact]
if ( isinstance( theScaleFact, int )): if ( isinstance( theScaleFact, int )):
@ -3923,10 +4005,12 @@ class Mesh:
# @param NewMeshName - the name of the newly created mesh # @param NewMeshName - the name of the newly created mesh
# @return instance of Mesh class # @return instance of Mesh class
def ScaleMakeMesh(self, theObject, thePoint, theScaleFact, MakeGroups=False, NewMeshName=""): def ScaleMakeMesh(self, theObject, thePoint, theScaleFact, MakeGroups=False, NewMeshName=""):
unRegister = genObjUnRegister()
if (isinstance(theObject, Mesh)): if (isinstance(theObject, Mesh)):
theObject = theObject.GetMesh() theObject = theObject.GetMesh()
if ( isinstance( theObject, list )): if ( isinstance( theObject, list )):
theObject = self.GetIDSource(theObject,SMESH.ALL) theObject = self.GetIDSource(theObject,SMESH.ALL)
unRegister.set( theObject )
if ( isinstance( theScaleFact, float )): if ( isinstance( theScaleFact, float )):
theScaleFact = [theScaleFact] theScaleFact = [theScaleFact]
if ( isinstance( theScaleFact, int )): if ( isinstance( theScaleFact, int )):
@ -4035,12 +4119,14 @@ class Mesh:
# @return the list of groups of nodes # @return the list of groups of nodes
# @ingroup l2_modif_trsf # @ingroup l2_modif_trsf
def FindCoincidentNodesOnPart (self, SubMeshOrGroup, Tolerance, exceptNodes=[]): def FindCoincidentNodesOnPart (self, SubMeshOrGroup, Tolerance, exceptNodes=[]):
unRegister = genObjUnRegister()
if (isinstance( SubMeshOrGroup, Mesh )): if (isinstance( SubMeshOrGroup, Mesh )):
SubMeshOrGroup = SubMeshOrGroup.GetMesh() SubMeshOrGroup = SubMeshOrGroup.GetMesh()
if not isinstance( exceptNodes, list): if not isinstance( exceptNodes, list):
exceptNodes = [ exceptNodes ] exceptNodes = [ exceptNodes ]
if exceptNodes and isinstance( exceptNodes[0], int): if exceptNodes and isinstance( exceptNodes[0], int):
exceptNodes = [ self.GetIDSource( exceptNodes, SMESH.NODE)] exceptNodes = [ self.GetIDSource( exceptNodes, SMESH.NODE)]
unRegister.set( exceptNodes )
return self.editor.FindCoincidentNodesOnPartBut(SubMeshOrGroup, Tolerance,exceptNodes) return self.editor.FindCoincidentNodesOnPartBut(SubMeshOrGroup, Tolerance,exceptNodes)
## Merges nodes ## Merges nodes
@ -4151,10 +4237,12 @@ class Mesh:
# @return a group where the new elements are added. None if theGroupName == "". # @return a group where the new elements are added. None if theGroupName == "".
# @ingroup l2_modif_edit # @ingroup l2_modif_edit
def DoubleElements(self, theElements, theGroupName=""): def DoubleElements(self, theElements, theGroupName=""):
unRegister = genObjUnRegister()
if isinstance( theElements, Mesh ): if isinstance( theElements, Mesh ):
theElements = theElements.mesh theElements = theElements.mesh
elif isinstance( theElements, list ): elif isinstance( theElements, list ):
theElements = self.GetIDSource( theElements, SMESH.ALL ) theElements = self.GetIDSource( theElements, SMESH.ALL )
unRegister.set( theElements )
return self.editor.DoubleElements(theElements, theGroupName) return self.editor.DoubleElements(theElements, theGroupName)
## Creates a hole in a mesh by doubling the nodes of some particular elements ## Creates a hole in a mesh by doubling the nodes of some particular elements
@ -4347,26 +4435,41 @@ class Mesh:
val = 0 val = 0
return val return val
## Get length of 1D element. ## Get length of 1D element or sum of lengths of all 1D mesh elements
# @param elemId mesh element ID # @param elemId mesh element ID (if not defined - sum of length of all 1D elements will be calculated)
# @return element's length value # @return element's length value if \a elemId is specified or sum of all 1D mesh elements' lengths otherwise
# @ingroup l1_measurements # @ingroup l1_measurements
def GetLength(self, elemId): def GetLength(self, elemId=None):
return self._valueFromFunctor(SMESH.FT_Length, elemId) length = 0
if elemId == None:
length = self.smeshpyD.GetLength(self)
else:
length = self._valueFromFunctor(SMESH.FT_Length, elemId)
return length
## Get area of 2D element. ## Get area of 2D element or sum of areas of all 2D mesh elements
# @param elemId mesh element ID # @param elemId mesh element ID (if not defined - sum of areas of all 2D elements will be calculated)
# @return element's area value # @return element's area value if \a elemId is specified or sum of all 2D mesh elements' areas otherwise
# @ingroup l1_measurements # @ingroup l1_measurements
def GetArea(self, elemId): def GetArea(self, elemId=None):
return self._valueFromFunctor(SMESH.FT_Area, elemId) area = 0
if elemId == None:
area = self.smeshpyD.GetArea(self)
else:
area = self._valueFromFunctor(SMESH.FT_Area, elemId)
return area
## Get volume of 3D element. ## Get volume of 3D element or sum of volumes of all 3D mesh elements
# @param elemId mesh element ID # @param elemId mesh element ID (if not defined - sum of volumes of all 3D elements will be calculated)
# @return element's volume value # @return element's volume value if \a elemId is specified or sum of all 3D mesh elements' volumes otherwise
# @ingroup l1_measurements # @ingroup l1_measurements
def GetVolume(self, elemId): def GetVolume(self, elemId=None):
return self._valueFromFunctor(SMESH.FT_Volume3D, elemId) volume = 0
if elemId == None:
volume = self.smeshpyD.GetVolume(self)
else:
volume = self._valueFromFunctor(SMESH.FT_Volume3D, elemId)
return volume
## Get maximum element length. ## Get maximum element length.
# @param elemId mesh element ID # @param elemId mesh element ID
@ -4510,6 +4613,28 @@ class hypMethodWrapper:
raise ValueError, detail # wrong variable name raise ValueError, detail # wrong variable name
return result return result
pass
# A helper class that call UnRegister() of SALOME.GenericObj'es stored in it
class genObjUnRegister:
def __init__(self, genObj=None):
self.genObjList = []
self.set( genObj )
return
def set(self, genObj):
"Store one or a list of of SALOME.GenericObj'es"
if isinstance( genObj, list ):
self.genObjList.extend( genObj )
else:
self.genObjList.append( genObj )
return
def __del__(self):
for genObj in self.genObjList:
if genObj and hasattr( genObj, "UnRegister" ):
genObj.UnRegister()
for pluginName in os.environ[ "SMESH_MeshersList" ].split( ":" ): for pluginName in os.environ[ "SMESH_MeshersList" ].split( ":" ):
# #

View File

@ -182,10 +182,11 @@ namespace // INTERNAL STUFF
if ( !_importMeshSubDS ) return; if ( !_importMeshSubDS ) return;
SMDS_ElemIteratorPtr eIt = _importMeshSubDS->GetElements(); SMDS_ElemIteratorPtr eIt = _importMeshSubDS->GetElements();
while ( eIt->more() ) while ( eIt->more() )
meshDS->RemoveFreeElement( eIt->next(), _importMeshSubDS, /*fromGroups=*/false ); meshDS->RemoveFreeElement( eIt->next(), 0, /*fromGroups=*/false );
SMDS_NodeIteratorPtr nIt = _importMeshSubDS->GetNodes(); SMDS_NodeIteratorPtr nIt = _importMeshSubDS->GetNodes();
while ( nIt->more() ) while ( nIt->more() )
meshDS->RemoveFreeNode( nIt->next(), _importMeshSubDS, /*fromGroups=*/false ); meshDS->RemoveFreeNode( nIt->next(), 0, /*fromGroups=*/false );
_importMeshSubDS->Clear();
_n2n.clear(); _n2n.clear();
_e2e.clear(); _e2e.clear();
} }
@ -266,6 +267,7 @@ namespace // INTERNAL STUFF
const SMESH_Hypothesis* hyp); const SMESH_Hypothesis* hyp);
void removeSubmesh( SMESH_subMesh* sm, _ListenerData* data ); void removeSubmesh( SMESH_subMesh* sm, _ListenerData* data );
void clearSubmesh ( SMESH_subMesh* sm, _ListenerData* data, bool clearAllSub ); void clearSubmesh ( SMESH_subMesh* sm, _ListenerData* data, bool clearAllSub );
void clearN2N ( SMESH_Mesh* tgtMesh );
// mark sm as missing src hyp with valid groups // mark sm as missing src hyp with valid groups
static void waitHypModification(SMESH_subMesh* sm) static void waitHypModification(SMESH_subMesh* sm)
@ -347,6 +349,18 @@ namespace // INTERNAL STUFF
} }
} }
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------
/*!
* \brief Clear _ImportData::_n2n.
* _n2n is usefull within one mesh.Compute() only
*/
void _Listener::clearN2N( SMESH_Mesh* tgtMesh )
{
list< _ImportData >& dList = get()->_tgtMesh2ImportData[tgtMesh];
list< _ImportData >::iterator d = dList.begin();
for ( ; d != dList.end(); ++d )
d->_n2n.clear();
}
//--------------------------------------------------------------------------------
/*! /*!
* \brief Clear submeshes and remove imported mesh and/or groups if necessary * \brief Clear submeshes and remove imported mesh and/or groups if necessary
* \param sm - cleared submesh * \param sm - cleared submesh
@ -448,6 +462,8 @@ namespace // INTERNAL STUFF
default:; default:;
} }
} }
if ( !data->mySubMeshes.empty() )
clearN2N( data->mySubMeshes.front()->GetFather() );
} }
else // event of Import submesh else // event of Import submesh
{ {
@ -496,6 +512,10 @@ namespace // INTERNAL STUFF
d->_computedSubM.insert( *smIt); d->_computedSubM.insert( *smIt);
} }
} }
// Clear _ImportData::_n2n if it's no more useful, i.e. when
// the event is not within mesh.Compute()
if ( SMESH_subMesh::ALGO_EVENT == eventType )
clearN2N( subMesh->GetFather() );
} }
} }
@ -621,6 +641,7 @@ bool StdMeshers_Import_1D::Compute(SMESH_Mesh & theMesh, const TopoDS_Shape & th
{ {
if ( !_sourceHyp ) return false; if ( !_sourceHyp ) return false;
//MESSAGE("---------> StdMeshers_Import_1D::Compute");
const vector<SMESH_Group*>& srcGroups = _sourceHyp->GetGroups(/*loaded=*/true); const vector<SMESH_Group*>& srcGroups = _sourceHyp->GetGroups(/*loaded=*/true);
if ( srcGroups.empty() ) if ( srcGroups.empty() )
return error("Invalid source groups"); return error("Invalid source groups");
@ -650,9 +671,11 @@ bool StdMeshers_Import_1D::Compute(SMESH_Mesh & theMesh, const TopoDS_Shape & th
{ {
_gen->Compute(theMesh,v,/*anUpward=*/true); _gen->Compute(theMesh,v,/*anUpward=*/true);
n = SMESH_Algo::VertexNode( v, tgtMesh ); n = SMESH_Algo::VertexNode( v, tgtMesh );
//MESSAGE("_gen->Compute " << n);
if ( !n ) return false; // very strange if ( !n ) return false; // very strange
} }
vertexNodes.push_back( SMESH_TNodeXYZ( n )); vertexNodes.push_back( SMESH_TNodeXYZ( n ));
//MESSAGE("SMESH_Algo::VertexNode " << n->GetID() << " " << n->X() << " " << n->Y() << " " << n->Z() );
} }
// import edges from groups // import edges from groups
@ -670,17 +693,19 @@ bool StdMeshers_Import_1D::Compute(SMESH_Mesh & theMesh, const TopoDS_Shape & th
SMDS_ElemIteratorPtr srcElems = srcGroup->GetElements(); SMDS_ElemIteratorPtr srcElems = srcGroup->GetElements();
vector<const SMDS_MeshNode*> newNodes; vector<const SMDS_MeshNode*> newNodes;
SMDS_MeshNode *tmpNode = helper.AddNode(0,0,0); SMDS_MeshNode *tmpNode = helper.AddNode(0,0,0);
double u = 0; double u = 0.314159; // "random" value between 0 and 1, avoid 0 and 1, false detection possible on edge restrictions
while ( srcElems->more() ) // loop on group contents while ( srcElems->more() ) // loop on group contents
{ {
const SMDS_MeshElement* edge = srcElems->next(); const SMDS_MeshElement* edge = srcElems->next();
// find or create nodes of a new edge // find or create nodes of a new edge
newNodes.resize( edge->NbNodes() ); newNodes.resize( edge->NbNodes() );
//MESSAGE("edge->NbNodes " << edge->NbNodes());
newNodes.back() = 0; newNodes.back() = 0;
SMDS_MeshElement::iterator node = edge->begin_nodes(); SMDS_MeshElement::iterator node = edge->begin_nodes();
SMESH_TNodeXYZ a(edge->GetNode(0)); SMESH_TNodeXYZ a(edge->GetNode(0));
// --- define a tolerance relative to the length of an edge // --- define a tolerance relative to the length of an edge
double mytol = a.Distance(edge->GetNode(edge->NbNodes()-1))/25; double mytol = a.Distance(edge->GetNode(edge->NbNodes()-1))/25;
//mytol = max(1.E-5, 10*edgeTol); // too strict and not necessary
//MESSAGE("mytol = " << mytol); //MESSAGE("mytol = " << mytol);
for ( unsigned i = 0; i < newNodes.size(); ++i, ++node ) for ( unsigned i = 0; i < newNodes.size(); ++i, ++node )
{ {
@ -697,22 +722,26 @@ bool StdMeshers_Import_1D::Compute(SMESH_Mesh & theMesh, const TopoDS_Shape & th
for ( vNIt = vertexNodes.begin(); vNIt != vertexNodes.end(); ++vNIt) for ( vNIt = vertexNodes.begin(); vNIt != vertexNodes.end(); ++vNIt)
if ( vNIt->SquareDistance( *node ) < checktol) if ( vNIt->SquareDistance( *node ) < checktol)
{ {
//MESSAGE("SquareDistance " << vNIt->SquareDistance( *node ) << " checktol " << checktol); //MESSAGE("SquareDistance " << vNIt->SquareDistance( *node ) << " checktol " << checktol <<" "<<vNIt->X()<<" "<<vNIt->Y()<<" "<<vNIt->Z());
(*n2nIt).second = vNIt->_node; (*n2nIt).second = vNIt->_node;
vertexNodes.erase( vNIt ); vertexNodes.erase( vNIt );
break; break;
} }
else if ( vNIt->SquareDistance( *node ) < 10*checktol)
MESSAGE("SquareDistance missed" << vNIt->SquareDistance( *node ) << " checktol " << checktol <<" "<<vNIt->X()<<" "<<vNIt->Y()<<" "<<vNIt->Z());
} }
if ( !n2nIt->second ) if ( !n2nIt->second )
{ {
// find out if node lies on theShape // find out if node lies on theShape
//double dxyz[4];
tmpNode->setXYZ( (*node)->X(), (*node)->Y(), (*node)->Z()); tmpNode->setXYZ( (*node)->X(), (*node)->Y(), (*node)->Z());
if ( helper.CheckNodeU( geomEdge, tmpNode, u, mytol, /*force=*/true )) if ( helper.CheckNodeU( geomEdge, tmpNode, u, mytol, /*force=*/true)) // , dxyz )) // dxyz used for debug purposes
{ {
SMDS_MeshNode* newNode = tgtMesh->AddNode( (*node)->X(), (*node)->Y(), (*node)->Z()); SMDS_MeshNode* newNode = tgtMesh->AddNode( (*node)->X(), (*node)->Y(), (*node)->Z());
n2nIt->second = newNode; n2nIt->second = newNode;
tgtMesh->SetNodeOnEdge( newNode, shapeID, u ); tgtMesh->SetNodeOnEdge( newNode, shapeID, u );
//MESSAGE("u=" << u); //MESSAGE("u=" << u << " " << newNode->X()<< " " << newNode->Y()<< " " << newNode->Z());
//MESSAGE("d=" << dxyz[0] << " " << dxyz[1] << " " << dxyz[2] << " " << dxyz[3]);
} }
} }
if ( !(newNodes[i] = n2nIt->second )) if ( !(newNodes[i] = n2nIt->second ))
@ -730,7 +759,7 @@ bool StdMeshers_Import_1D::Compute(SMESH_Mesh & theMesh, const TopoDS_Shape & th
newEdge = tgtMesh->AddEdge( newNodes[0], newNodes[1], newNodes[2] ); newEdge = tgtMesh->AddEdge( newNodes[0], newNodes[1], newNodes[2] );
else else
newEdge = tgtMesh->AddEdge( newNodes[0], newNodes[1]); newEdge = tgtMesh->AddEdge( newNodes[0], newNodes[1]);
//MESSAGE("add Edge"); //MESSAGE("add Edge " << newNodes[0]->GetID() << " " << newNodes[1]->GetID());
tgtMesh->SetMeshElementOnShape( newEdge, shapeID ); tgtMesh->SetMeshElementOnShape( newEdge, shapeID );
e2e->insert( make_pair( edge, newEdge )); e2e->insert( make_pair( edge, newEdge ));
} }

View File

@ -371,6 +371,61 @@ namespace {
return nbRemoved; return nbRemoved;
} }
//================================================================================
/*!
* Consider continuous straight EDGES as one side - mark them to unite
*/
//================================================================================
int countNbSides( const Prism_3D::TPrismTopo & thePrism,
vector<int> & nbUnitePerEdge )
{
int nbEdges = thePrism.myNbEdgesInWires.front(); // nb outer edges
int nbSides = nbEdges;
list< TopoDS_Edge >::const_iterator edgeIt = thePrism.myBottomEdges.begin();
std::advance( edgeIt, nbEdges-1 );
TopoDS_Edge prevE = *edgeIt;
bool isPrevStraight = SMESH_Algo::isStraight( prevE );
int iPrev = nbEdges - 1;
int iUnite = -1; // the first of united EDGEs
edgeIt = thePrism.myBottomEdges.begin();
for ( int iE = 0; iE < nbEdges; ++iE, ++edgeIt )
{
const TopoDS_Edge& curE = *edgeIt;
const bool isCurStraight = SMESH_Algo::isStraight( curE );
if ( isPrevStraight && isCurStraight && SMESH_Algo::IsContinuous( prevE, curE ))
{
if ( iUnite < 0 )
iUnite = iPrev;
nbUnitePerEdge[ iUnite ]++;
nbUnitePerEdge[ iE ] = -1;
--nbSides;
}
else
{
iUnite = -1;
}
prevE = curE;
isPrevStraight = isCurStraight;
iPrev = iE;
}
return nbSides;
}
void pointsToPython(const std::vector<gp_XYZ>& p)
{
#ifdef _DEBUG_
for ( int i = SMESH_Block::ID_V000; i < p.size(); ++i )
{
cout << "mesh.AddNode( " << p[i].X() << ", "<< p[i].Y() << ", "<< p[i].Z() << ") # " << i <<" " ;
SMESH_Block::DumpShapeID( i, cout ) << endl;
}
#endif
}
} // namespace } // namespace
//======================================================================= //=======================================================================
@ -705,10 +760,11 @@ bool StdMeshers_Prism_3D::getWallFaces( Prism_3D::TPrismTopo & thePrism,
list< TopoDS_Edge >::iterator edge = thePrism.myBottomEdges.begin(); list< TopoDS_Edge >::iterator edge = thePrism.myBottomEdges.begin();
std::list< int >::iterator nbE = thePrism.myNbEdgesInWires.begin(); std::list< int >::iterator nbE = thePrism.myNbEdgesInWires.begin();
int iE = 0; int iE = 0;
double f,l;
while ( edge != thePrism.myBottomEdges.end() ) while ( edge != thePrism.myBottomEdges.end() )
{ {
++iE; ++iE;
if ( BRep_Tool::Degenerated( *edge )) if ( BRep_Tool::Curve( *edge, f,l ).IsNull() )
{ {
edge = thePrism.myBottomEdges.erase( edge ); edge = thePrism.myBottomEdges.erase( edge );
--iE; --iE;
@ -989,6 +1045,9 @@ bool StdMeshers_Prism_3D::compute(const Prism_3D::TPrismTopo& thePrism)
if ( !SMESH_Block::ShellPoint( params, myShapeXYZ, coords )) if ( !SMESH_Block::ShellPoint( params, myShapeXYZ, coords ))
return toSM( error("Can't compute coordinates by normalized parameters")); return toSM( error("Can't compute coordinates by normalized parameters"));
// if ( !meshDS->MeshElements( volumeID ) ||
// meshDS->MeshElements( volumeID )->NbNodes() == 0 )
// pointsToPython(myShapeXYZ);
SHOWYXZ("TOPFacePoint ",myShapeXYZ[ ID_TOP_FACE]); SHOWYXZ("TOPFacePoint ",myShapeXYZ[ ID_TOP_FACE]);
SHOWYXZ("BOT Node "<< tBotNode.myNode->GetID(),gpXYZ(tBotNode.myNode)); SHOWYXZ("BOT Node "<< tBotNode.myNode->GetID(),gpXYZ(tBotNode.myNode));
SHOWYXZ("ShellPoint ",coords); SHOWYXZ("ShellPoint ",coords);
@ -2153,6 +2212,13 @@ bool StdMeshers_PrismAsBlock::Init(SMESH_MesherHelper* helper,
vector< double > edgeLength( nbEdges ); vector< double > edgeLength( nbEdges );
multimap< double, int > len2edgeMap; multimap< double, int > len2edgeMap;
// for each EDGE: either split into several parts, or join with several next EDGEs
vector<int> nbSplitPerEdge( nbEdges, 0 );
vector<int> nbUnitePerEdge( nbEdges, 0 ); // -1 means "joined to a previous"
// consider continuous straight EDGEs as one side
const int nbSides = countNbSides( thePrism, nbUnitePerEdge );
list< TopoDS_Edge >::const_iterator edgeIt = thePrism.myBottomEdges.begin(); list< TopoDS_Edge >::const_iterator edgeIt = thePrism.myBottomEdges.begin();
for ( iE = 0; iE < nbEdges; ++iE, ++edgeIt ) for ( iE = 0; iE < nbEdges; ++iE, ++edgeIt )
{ {
@ -2172,14 +2238,8 @@ bool StdMeshers_PrismAsBlock::Init(SMESH_MesherHelper* helper,
edgeLength[ iE ] = SMESH_Algo::EdgeLength( *edgeIt ); edgeLength[ iE ] = SMESH_Algo::EdgeLength( *edgeIt );
if ( nbEdges < NB_WALL_FACES ) // fill map used to split faces if ( nbSides < NB_WALL_FACES ) // fill map used to split faces
{ len2edgeMap.insert( make_pair( edgeLength[ iE ], iE )); // sort edges by length
SMESHDS_SubMesh* smDS = meshDS->MeshElements( *edgeIt);
if ( !smDS )
return error(COMPERR_BAD_INPUT_MESH, TCom("Null submesh on the edge #")
<< MeshDS()->ShapeToIndex( *edgeIt ));
len2edgeMap.insert( make_pair( edgeLength[ iE ], iE ));
}
} }
// Load columns of internal edges (forming holes) // Load columns of internal edges (forming holes)
// and fill map ShapeIndex to TParam2ColumnMap for them // and fill map ShapeIndex to TParam2ColumnMap for them
@ -2217,10 +2277,9 @@ bool StdMeshers_PrismAsBlock::Init(SMESH_MesherHelper* helper,
// Create 4 wall faces of a block // Create 4 wall faces of a block
// ------------------------------- // -------------------------------
if ( nbEdges <= NB_WALL_FACES ) // ************* Split faces if necessary if ( nbSides <= NB_WALL_FACES ) // ************* Split faces if necessary
{ {
map< int, int > iE2nbSplit; if ( nbSides != NB_WALL_FACES ) // define how to split
if ( nbEdges != NB_WALL_FACES ) // define how to split
{ {
if ( len2edgeMap.size() != nbEdges ) if ( len2edgeMap.size() != nbEdges )
RETURN_BAD_RESULT("Uniqueness of edge lengths not assured"); RETURN_BAD_RESULT("Uniqueness of edge lengths not assured");
@ -2232,32 +2291,56 @@ bool StdMeshers_PrismAsBlock::Init(SMESH_MesherHelper* helper,
double midLen = ( len2edgeMap.size() == 1 ) ? 0 : midLen_i->first; double midLen = ( len2edgeMap.size() == 1 ) ? 0 : midLen_i->first;
switch ( nbEdges ) { switch ( nbEdges ) {
case 1: // 0-th edge is split into 4 parts case 1: // 0-th edge is split into 4 parts
iE2nbSplit.insert( make_pair( 0, 4 )); break; nbSplitPerEdge[ 0 ] = 4;
break;
case 2: // either the longest edge is split into 3 parts, or both edges into halves case 2: // either the longest edge is split into 3 parts, or both edges into halves
if ( maxLen / 3 > midLen / 2 ) { if ( maxLen / 3 > midLen / 2 ) {
iE2nbSplit.insert( make_pair( maxLen_i->second, 3 )); nbSplitPerEdge[ maxLen_i->second ] = 3;
} }
else { else {
iE2nbSplit.insert( make_pair( maxLen_i->second, 2 )); nbSplitPerEdge[ maxLen_i->second ] = 2;
iE2nbSplit.insert( make_pair( midLen_i->second, 2 )); nbSplitPerEdge[ midLen_i->second ] = 2;
} }
break; break;
case 3: case 3:
if ( nbSides == 2 )
// split longest into 3 parts
nbSplitPerEdge[ maxLen_i->second ] = 3;
else
// split longest into halves // split longest into halves
iE2nbSplit.insert( make_pair( maxLen_i->second, 2 )); nbSplitPerEdge[ maxLen_i->second ] = 2;
} }
} }
}
else // **************************** Unite faces
{
int nbExraFaces = nbSides - 3; // nb of faces to fuse
for ( iE = 0; iE < nbEdges; ++iE )
{
if ( nbUnitePerEdge[ iE ] < 0 )
continue;
// look for already united faces
for ( int i = iE; i < iE + nbExraFaces; ++i )
{
if ( nbUnitePerEdge[ i ] > 0 ) // a side including nbUnitePerEdge[i]+1 edge
nbExraFaces += nbUnitePerEdge[ i ];
nbUnitePerEdge[ i ] = -1;
}
nbUnitePerEdge[ iE ] = nbExraFaces;
break;
}
}
// Create TSideFace's // Create TSideFace's
int iSide = 0; int iSide = 0;
list< TopoDS_Edge >::const_iterator botE = thePrism.myBottomEdges.begin(); list< TopoDS_Edge >::const_iterator botE = thePrism.myBottomEdges.begin();
for ( iE = 0; iE < nbEdges; ++iE, ++botE ) for ( iE = 0; iE < nbEdges; ++iE, ++botE )
{ {
TFaceQuadStructPtr quad = thePrism.myWallQuads[ iE ].front(); TFaceQuadStructPtr quad = thePrism.myWallQuads[ iE ].front();
// split? const int nbSplit = nbSplitPerEdge[ iE ];
map< int, int >::iterator i_nb = iE2nbSplit.find( iE ); const int nbExraFaces = nbUnitePerEdge[ iE ] + 1;
if ( i_nb != iE2nbSplit.end() ) { if ( nbSplit > 0 ) // split
// split! {
int nbSplit = i_nb->second;
vector< double > params; vector< double > params;
splitParams( nbSplit, &myParam2ColumnMaps[ iE ], params ); splitParams( nbSplit, &myParam2ColumnMaps[ iE ], params );
const bool isForward = const bool isForward =
@ -2273,39 +2356,41 @@ bool StdMeshers_PrismAsBlock::Init(SMESH_MesherHelper* helper,
mySide->SetComponent( iSide++, comp ); mySide->SetComponent( iSide++, comp );
} }
} }
else { else if ( nbExraFaces > 1 ) // unite
TSideFace* comp = new TSideFace( *mesh, wallFaceIds[ iSide ], {
thePrism.myWallQuads[ iE ], *botE,
&myParam2ColumnMaps[ iE ]);
mySide->SetComponent( iSide++, comp );
}
}
}
else { // **************************** Unite faces
// unite first faces
int nbExraFaces = nbEdges - 3;
int iSide = 0, iE;
double u0 = 0, sumLen = 0; double u0 = 0, sumLen = 0;
for ( iE = 0; iE < nbExraFaces; ++iE ) for ( int i = iE; i < iE + nbExraFaces; ++i )
sumLen += edgeLength[ iE ]; sumLen += edgeLength[ i ];
vector< TSideFace* > components( nbExraFaces ); vector< TSideFace* > components( nbExraFaces );
vector< pair< double, double> > params( nbExraFaces ); vector< pair< double, double> > params( nbExraFaces );
list< TopoDS_Edge >::const_iterator botE = thePrism.myBottomEdges.begin(); bool endReached = false;
for ( iE = 0; iE < nbExraFaces; ++iE, ++botE ) for ( int i = 0; i < nbExraFaces; ++i, ++botE, ++iE )
{ {
components[ iE ] = new TSideFace( *mesh, wallFaceIds[ iSide ], if ( iE == nbEdges )
{
endReached = true;
botE = thePrism.myBottomEdges.begin();
iE = 0;
}
components[ i ] = new TSideFace( *mesh, wallFaceIds[ iSide ],
thePrism.myWallQuads[ iE ], *botE, thePrism.myWallQuads[ iE ], *botE,
&myParam2ColumnMaps[ iE ]); &myParam2ColumnMaps[ iE ]);
double u1 = u0 + edgeLength[ iE ] / sumLen; double u1 = u0 + edgeLength[ iE ] / sumLen;
params[ iE ] = make_pair( u0 , u1 ); params[ i ] = make_pair( u0 , u1 );
u0 = u1; u0 = u1;
} }
mySide->SetComponent( iSide++, new TSideFace( *mesh, components, params )); TSideFace* comp = new TSideFace( *mesh, components, params );
mySide->SetComponent( iSide++, comp );
// fill the rest faces if ( endReached )
for ( ; iE < nbEdges; ++iE, ++botE ) break;
--iE; // for increment in an external loop on iE
--botE;
}
else if ( nbExraFaces < 0 ) // skip already united face
{
}
else // use as is
{ {
TSideFace* comp = new TSideFace( *mesh, wallFaceIds[ iSide ], TSideFace* comp = new TSideFace( *mesh, wallFaceIds[ iSide ],
thePrism.myWallQuads[ iE ], *botE, thePrism.myWallQuads[ iE ], *botE,
@ -2423,15 +2508,20 @@ bool StdMeshers_PrismAsBlock::Init(SMESH_MesherHelper* helper,
} }
} }
// gp_XYZ testPar(0.25, 0.25, 0), testCoord; // double _u[]={ 0.1, 0.1, 0.9, 0.9 };
// if ( !FacePoint( ID_BOT_FACE, testPar, testCoord )) // double _v[]={ 0.1, 0.9, 0.1, 0.9, };
// RETURN_BAD_RESULT("TEST FacePoint() FAILED"); // for ( int i = 0; i < 4; ++i )
// SHOWYXZ("IN TEST PARAM" , testPar); // {
// SHOWYXZ("OUT TEST CORD" , testCoord); // //gp_XYZ testPar(0.25, 0.25, 0), testCoord;
// if ( !ComputeParameters( testCoord, testPar , ID_BOT_FACE)) // gp_XYZ testPar(_u[i], _v[i], 0), testCoord;
// RETURN_BAD_RESULT("TEST ComputeParameters() FAILED"); // if ( !FacePoint( ID_BOT_FACE, testPar, testCoord ))
// SHOWYXZ("OUT TEST PARAM" , testPar); // RETURN_BAD_RESULT("TEST FacePoint() FAILED");
// SHOWYXZ("IN TEST PARAM" , testPar);
// SHOWYXZ("OUT TEST CORD" , testCoord);
// if ( !ComputeParameters( testCoord, testPar , ID_BOT_FACE))
// RETURN_BAD_RESULT("TEST ComputeParameters() FAILED");
// SHOWYXZ("OUT TEST PARAM" , testPar);
// }
return true; return true;
} }
@ -2603,6 +2693,8 @@ StdMeshers_PrismAsBlock::TSideFace::TSideFace(SMESH_Mesh& mesh,
myIsForward = StdMeshers_PrismAsBlock::IsForwardEdge( myHelper.GetMeshDS(), myIsForward = StdMeshers_PrismAsBlock::IsForwardEdge( myHelper.GetMeshDS(),
*myParamToColumnMap, *myParamToColumnMap,
myBaseEdge, myID ); myBaseEdge, myID );
myHelper.SetSubShape( quadList.front()->face );
if ( quadList.size() > 1 ) // side is vertically composite if ( quadList.size() > 1 ) // side is vertically composite
{ {
// fill myShapeID2Surf map to enable finding a right surface by any sub-shape ID // fill myShapeID2Surf map to enable finding a right surface by any sub-shape ID
@ -2646,7 +2738,20 @@ TSideFace(SMESH_Mesh& mesh,
myIsForward( true ), myIsForward( true ),
myComponents( components ), myComponents( components ),
myHelper( mesh ) myHelper( mesh )
{} {
if ( myID == ID_Fx1z || myID == ID_F0yz )
{
// reverse components
std::reverse( myComponents.begin(), myComponents.end() );
std::reverse( myParams.begin(), myParams.end() );
for ( size_t i = 0; i < myParams.size(); ++i )
{
const double f = myParams[i].first;
const double l = myParams[i].second;
myParams[i] = make_pair( 1. - l, 1. - f );
}
}
}
//================================================================================ //================================================================================
/*! /*!
* \brief Copy constructor * \brief Copy constructor
@ -2925,6 +3030,7 @@ gp_Pnt StdMeshers_PrismAsBlock::TSideFace::Value(const Standard_Real U,
throw SALOME_Exception("StdMeshers_PrismAsBlock::TSideFace::Value() !mySurface"); throw SALOME_Exception("StdMeshers_PrismAsBlock::TSideFace::Value() !mySurface");
} }
} }
((TSideFace*) this)->myHelper.SetSubShape( mySurface->Face() );
gp_XY uv1 = myHelper.GetNodeUV( mySurface->Face(), nn[0], nn[2]); gp_XY uv1 = myHelper.GetNodeUV( mySurface->Face(), nn[0], nn[2]);
gp_XY uv2 = myHelper.GetNodeUV( mySurface->Face(), nn[1], nn[3]); gp_XY uv2 = myHelper.GetNodeUV( mySurface->Face(), nn[1], nn[3]);

View File

@ -64,12 +64,13 @@ public:
virtual bool CheckHypothesis(SMESH_Mesh& aMesh, virtual bool CheckHypothesis(SMESH_Mesh& aMesh,
const TopoDS_Shape& aShape, const TopoDS_Shape& aShape,
SMESH_Hypothesis::Hypothesis_Status& aStatus); Hypothesis_Status& aStatus);
virtual bool Compute(SMESH_Mesh& aMesh, virtual bool Compute(SMESH_Mesh& aMesh,
const TopoDS_Shape& aShape); const TopoDS_Shape& aShape);
virtual bool Evaluate(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape, virtual bool Evaluate(SMESH_Mesh & aMesh,
const TopoDS_Shape & aShape,
MapShapeNbElems& aResMap); MapShapeNbElems& aResMap);
FaceQuadStruct::Ptr CheckAnd2Dcompute(SMESH_Mesh& aMesh, FaceQuadStruct::Ptr CheckAnd2Dcompute(SMESH_Mesh& aMesh,

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