Merge from V7_main
@ -587,9 +587,6 @@ AC_OUTPUT([ \
|
||||
src/Tools/padder/spadderpy/plugin/Makefile \
|
||||
src/Tools/padder/spadderpy/plugin/envPlugins.sh \
|
||||
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/unittests/Makefile \
|
||||
src/Tools/padder/unittests/autotest.sh \
|
||||
|
@ -110,6 +110,7 @@ GOOD_TESTS = \
|
||||
grouping_elements_ex08.py \
|
||||
measurements_ex01.py \
|
||||
measurements_ex02.py \
|
||||
measurements_ex03.py \
|
||||
modifying_meshes_ex01.py \
|
||||
modifying_meshes_ex02.py \
|
||||
modifying_meshes_ex03.py \
|
||||
|
79
doc/salome/examples/measurements_ex03.py
Normal 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"
|
BIN
doc/salome/gui/SMESH/images/basic_props.png
Normal file
After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 37 KiB |
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 16 KiB |
@ -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:
|
||||
|
||||
\image html extrusion1.png
|
||||
\image html extrusion_along_path_dlg.png
|
||||
</li>
|
||||
|
||||
<li>In this dialog:
|
||||
@ -99,28 +99,31 @@ about filters in the \ref selection_filter_library_page "Selection filter librar
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
<li>define the Path along which the elements will be extruded,
|
||||
\n Path definition consists of several elements:
|
||||
<ul>
|
||||
<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>
|
||||
</ul>
|
||||
<li>define the \b Path along which the elements will be extruded.<br>
|
||||
Path definition consists of several elements:
|
||||
<ul>
|
||||
<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>
|
||||
</ul>
|
||||
</li>
|
||||
<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>
|
||||
<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>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
<li>There are two optional parameters, which can be very useful:
|
||||
<ul>
|
||||
<li>If the path of extrusion is curvilinear, at each iteration the
|
||||
extruded shape is rotated to keep its initial angularity to the
|
||||
curve. By default, the <b>Base Point</b> around which the shape is rotated is
|
||||
the mass center of the shape, however, you can specify any point as
|
||||
the <b>Base Point</b> and the shape will be rotated with respect to this
|
||||
point.
|
||||
extruded elements are rotated to keep its initial angularity to the
|
||||
curve. By default, the <b>Base Point</b> around which the elements are rotated is
|
||||
the mass center of the elements, however, you can specify any point as
|
||||
the <b>Base Point</b> and the elements will be rotated with respect to this
|
||||
point.<br>
|
||||
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>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
|
||||
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.
|
||||
@ -132,7 +135,7 @@ button and remove them from the list by pressing the <em>"Remove"</em> button.
|
||||
<center><em>"Remove" button</em></center>
|
||||
|
||||
<b>Linear variation of the angles</b> option allows defining the angle of gradual rotation for the whole path.
|
||||
At each step the shape will be rotated by angle/nb. of steps.
|
||||
At each step the elements will be rotated by <code>angle / nb. of steps</code>.
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
|
@ -64,6 +64,32 @@ viewer.
|
||||
|
||||
\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
|
||||
\ref tui_measurements_page "Measurement operations".
|
||||
|
||||
|
@ -6,7 +6,8 @@
|
||||
of two triangles separated by a diagonal. So it can be calculated only
|
||||
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>
|
||||
|
||||
|
@ -8,4 +8,7 @@
|
||||
\section tui_bounding_box Bounding Box
|
||||
\tui_script{measurements_ex02.py}
|
||||
|
||||
\section tui_bounding_box Basic Properties
|
||||
\tui_script{measurements_ex03.py}
|
||||
|
||||
*/
|
||||
|
@ -55,6 +55,21 @@ module SMESH
|
||||
* common bounding box of entities
|
||||
*/
|
||||
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);
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -277,7 +277,7 @@ module SMESH
|
||||
|
||||
interface SMESH_Mesh;
|
||||
|
||||
interface SMESH_IDSource
|
||||
interface SMESH_IDSource : SALOME::GenericObj
|
||||
{
|
||||
/*!
|
||||
* Returns a sequence of all element IDs
|
||||
|
@ -208,7 +208,11 @@ dist_salomeres_DATA = \
|
||||
mesh_min_dist.png \
|
||||
reorient_faces_point.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
|
||||
nodist_salomeres_SCRIPTS = SMESHCatalog.xml SalomeApp.xml
|
||||
|
@ -30,6 +30,7 @@
|
||||
|
||||
<meshers-group name="Standard Meshers"
|
||||
resources="StdMeshers"
|
||||
idl-module="StdMeshers"
|
||||
server-lib="StdMeshersEngine"
|
||||
gui-lib="StdMeshersGUI">
|
||||
<hypotheses>
|
||||
|
BIN
resources/mesh_measure_area.png
Normal file
After Width: | Height: | Size: 806 B |
BIN
resources/mesh_measure_basic_props.png
Normal file
After Width: | Height: | Size: 331 B |
BIN
resources/mesh_measure_length.png
Normal file
After Width: | Height: | Size: 914 B |
BIN
resources/mesh_measure_volume.png
Normal file
After Width: | Height: | Size: 1018 B |
@ -54,7 +54,8 @@ libSMESHControls_la_LDFLAGS = \
|
||||
../SMESHDS/libSMESHDS.la \
|
||||
../SMESHUtils/libSMESHUtils.la \
|
||||
$(CAS_LDPATH) -lTKernel -lTKBRep -lTKG3d -lTKTopAlgo -lTKGeomBase -lTKGeomAlgo \
|
||||
$(VTK_LIBS)
|
||||
$(VTK_LIBS) \
|
||||
$(KERNEL_LDFLAGS) -lOpUtil -lSALOMELocalTrace -lSALOMEBasics
|
||||
|
||||
SMESHControls_CPPFLAGS = \
|
||||
$(libSMESHControls_la_CPPFLAGS)
|
||||
@ -64,6 +65,6 @@ SMESHControls_LDADD = \
|
||||
../SMDS/libSMDS.la \
|
||||
../SMESHDS/libSMESHDS.la \
|
||||
libSMESHControls.la \
|
||||
$(KERNEL_LDFLAGS) -lOpUtil -lSALOMELocalTrace -lSALOMEBasics \
|
||||
$(KERNEL_LDFLAGS) -lOpUtil -lSALOMELocalTrace -lSALOMEBasics -lSalomeIDLKernel \
|
||||
$(GEOM_LDFLAGS) -lGEOMAlgo \
|
||||
$(CAS_LDPATH) -lTKernel -lTKBRep -lTKG3d
|
||||
|
@ -57,7 +57,7 @@ libMeshDriverDAT_la_CPPFLAGS = \
|
||||
|
||||
libMeshDriverDAT_la_LDFLAGS = \
|
||||
../Driver/libMeshDriver.la \
|
||||
$(KERNEL_LDFLAGS) -lSALOMEBasics \
|
||||
$(KERNEL_LDFLAGS) -lSALOMEBasics -lSalomeIDLKernel \
|
||||
$(CAS_KERNEL)
|
||||
|
||||
DAT_Test_CPPFLAGS = \
|
||||
@ -67,5 +67,5 @@ DAT_Test_LDADD = \
|
||||
libMeshDriverDAT.la \
|
||||
../Driver/libMeshDriver.la \
|
||||
../SMDS/libSMDS.la \
|
||||
$(KERNEL_LDFLAGS) -lOpUtil -lSALOMELocalTrace -lSALOMEBasics
|
||||
$(KERNEL_LDFLAGS) -lOpUtil -lSALOMELocalTrace -lSALOMEBasics -lSalomeIDLKernel
|
||||
|
||||
|
@ -81,6 +81,7 @@ MED_Test_LDADD = \
|
||||
-lOpUtil \
|
||||
-lSALOMELocalTrace \
|
||||
-lSALOMEBasics \
|
||||
-lSalomeIDLKernel \
|
||||
../MEDWrapper/Factory/libMEDWrapper.la \
|
||||
../MEDWrapper/Base/libMEDWrapperBase.la \
|
||||
../MEDWrapper/V2_2/libMEDWrapper_V2_2.la \
|
||||
|
@ -70,6 +70,6 @@ STL_Test_LDADD = \
|
||||
libMeshDriverSTL.la \
|
||||
../Driver/libMeshDriver.la \
|
||||
../SMDS/libSMDS.la \
|
||||
$(KERNEL_LDFLAGS) -lOpUtil -lSALOMELocalTrace -lSALOMEBasics \
|
||||
$(KERNEL_LDFLAGS) -lOpUtil -lSALOMELocalTrace -lSALOMEBasics -lSalomeIDLKernel \
|
||||
$(CAS_LDPATH) -lTKernel -lTKSTL -lTKTopAlgo -lTKMesh -lTKBO
|
||||
|
||||
|
@ -82,4 +82,4 @@ UNV_Test_LDADD = \
|
||||
libMeshDriverUNV.la \
|
||||
../Driver/libMeshDriver.la \
|
||||
../SMDS/libSMDS.la \
|
||||
$(KERNEL_LDFLAGS) -lOpUtil -lSALOMELocalTrace -lSALOMEBasics
|
||||
$(KERNEL_LDFLAGS) -lOpUtil -lSALOMELocalTrace -lSALOMEBasics -lSalomeIDLKernel
|
||||
|
@ -42,7 +42,7 @@ void UNV164::Read(std::ifstream& in_stream, TRecord& theUnitsRecord )
|
||||
return;
|
||||
|
||||
string num_buf;
|
||||
char line[theMaxLineLen];
|
||||
char line[theMaxLineLen] = "";
|
||||
|
||||
in_stream >> theUnitsRecord.units_code;
|
||||
in_stream.readsome( line, 20 );
|
||||
|
@ -42,9 +42,16 @@ private:
|
||||
int _nextFree;
|
||||
int _maxAvail;
|
||||
int _chunkSize;
|
||||
int _maxOccupied;
|
||||
int _nbHoles;
|
||||
|
||||
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++)
|
||||
if (_freeList[i] == true)
|
||||
{
|
||||
@ -73,6 +80,8 @@ public:
|
||||
_chunkSize = nblk;
|
||||
_nextFree = 0;
|
||||
_maxAvail = 0;
|
||||
_maxOccupied = 0;
|
||||
_nbHoles = 0;
|
||||
_chunkList.clear();
|
||||
_freeList.clear();
|
||||
}
|
||||
@ -103,6 +112,14 @@ public:
|
||||
_freeList[_nextFree] = false;
|
||||
obj = _chunkList[chunkId] + rank; // &_chunkList[chunkId][rank];
|
||||
}
|
||||
if (_nextFree < _maxOccupied)
|
||||
{
|
||||
_nbHoles-=1;
|
||||
}
|
||||
else
|
||||
{
|
||||
_maxOccupied = _nextFree;
|
||||
}
|
||||
//obj->init();
|
||||
return obj;
|
||||
}
|
||||
@ -124,6 +141,8 @@ public:
|
||||
_freeList[toFree] = true;
|
||||
if (toFree < _nextFree)
|
||||
_nextFree = toFree;
|
||||
if (toFree < _maxOccupied)
|
||||
_nbHoles += 1;
|
||||
//obj->clean();
|
||||
//checkDelete(i); compactage non fait
|
||||
break;
|
||||
@ -134,6 +153,8 @@ public:
|
||||
{
|
||||
_nextFree = 0;
|
||||
_maxAvail = 0;
|
||||
_maxOccupied = 0;
|
||||
_nbHoles = 0;
|
||||
for (size_t i = 0; i < _chunkList.size(); i++)
|
||||
delete[] _chunkList[i];
|
||||
clearVector( _chunkList );
|
||||
|
@ -3370,6 +3370,7 @@ void SMDS_Mesh::RemoveFreeElement(const SMDS_MeshElement * elem)
|
||||
myNodes[elemId] = 0;
|
||||
myInfo.myNbNodes--;
|
||||
((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));
|
||||
myNodeIDFactory->ReleaseID(elemId, vtkId);
|
||||
}
|
||||
|
@ -141,7 +141,7 @@ public:
|
||||
* \param node - the node to check
|
||||
* \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 LongType getshapeId() const { return myShapeId; }
|
||||
|
@ -165,7 +165,7 @@ public:
|
||||
cellList.push_back(vtkId);
|
||||
}
|
||||
}
|
||||
myCells = &cellList[0];
|
||||
myCells = cellList.empty() ? 0 : &cellList[0];
|
||||
myNcells = cellList.size();
|
||||
//MESSAGE("myNcells="<<myNcells);
|
||||
}
|
||||
|
@ -65,7 +65,6 @@ protected:
|
||||
SMDS_MeshNode(int id, int meshId, int shapeId = -1, double x=0, double y=0, double z=0);
|
||||
virtual ~SMDS_MeshNode();
|
||||
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;
|
||||
void AddInverseElement(const SMDS_MeshElement * ME);
|
||||
void RemoveInverseElement(const SMDS_MeshElement * parent);
|
||||
|
@ -285,8 +285,6 @@ void SMDS_UnstructuredGrid::compactGrid(std::vector<int>& idNodesOldToNew, int n
|
||||
}
|
||||
newFaceLocations->Squeeze();
|
||||
newFaces->Squeeze();
|
||||
newFaceLocations->Register(this);
|
||||
newFaces->Register(this);
|
||||
this->SetCells(newTypes, newLocations, newConnectivity, newFaceLocations, newFaces);
|
||||
newFaceLocations->Delete();
|
||||
newFaces->Delete();
|
||||
@ -328,7 +326,7 @@ void SMDS_UnstructuredGrid::copyBloc(vtkUnsignedCharArray *newTypes,
|
||||
int start,
|
||||
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++)
|
||||
{
|
||||
newTypes->SetValue(alreadyCopied, this->Types->GetValue(j));
|
||||
|
@ -1507,17 +1507,21 @@ bool SMDS_VolumeTool::IsFreeFace( int faceIndex, const SMDS_MeshElement** otherV
|
||||
const SMDS_MeshNode** nodes = GetFaceNodes( faceIndex );
|
||||
|
||||
// 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;
|
||||
for ( int i = di; i < myFaceNbNodes; i += di )
|
||||
nodeSet.insert( nodes[i] );
|
||||
|
||||
SMDS_ElemIteratorPtr eIt = nodes[0]->GetInverseElementIterator( SMDSAbs_Volume );
|
||||
SMDS_ElemIteratorPtr nIt;
|
||||
while ( eIt->more() ) {
|
||||
const SMDS_MeshElement* vol = eIt->next();
|
||||
if ( vol != myVolume ) {
|
||||
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() )
|
||||
if (( nbShared += nodeSet.count( nIt->next() )) == nodeSet.size() )
|
||||
{
|
||||
|
@ -161,6 +161,22 @@ SMDS_VtkFace::GetNode(const int ind) const
|
||||
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
|
||||
{
|
||||
vtkUnstructuredGrid* grid = SMDS_Mesh::_meshList[myMeshId]->getGrid();
|
||||
|
@ -47,6 +47,7 @@ public:
|
||||
virtual SMDSAbs_EntityType GetEntityType() const;
|
||||
virtual SMDSAbs_GeometryType GetGeomType() const;
|
||||
virtual const SMDS_MeshNode* GetNode(const int ind) const;
|
||||
virtual int GetNodeIndex( const SMDS_MeshNode* node ) const;
|
||||
|
||||
virtual bool IsQuadratic() const;
|
||||
virtual bool IsPoly() const;
|
||||
|
@ -448,6 +448,41 @@ const SMDS_MeshNode* SMDS_VtkVolume::GetNode(const int ind) const
|
||||
const std::vector<int>& interlace = SMDS_MeshCell::fromVtkOrder( VTKCellType( aVtkType ));
|
||||
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
|
||||
{
|
||||
|
@ -56,6 +56,7 @@ public:
|
||||
virtual SMDSAbs_EntityType GetEntityType() const;
|
||||
virtual SMDSAbs_GeometryType GetGeomType() const;
|
||||
virtual const SMDS_MeshNode* GetNode(const int ind) const;
|
||||
virtual int GetNodeIndex( const SMDS_MeshNode* node ) const;
|
||||
virtual bool IsQuadratic() const;
|
||||
virtual bool IsPoly() const;
|
||||
virtual bool IsMediumNode(const SMDS_MeshNode* node) const;
|
||||
|
@ -38,6 +38,7 @@
|
||||
#include "SMESH_Gen.hxx"
|
||||
#include "SMESH_HypoFilter.hxx"
|
||||
#include "SMESH_Mesh.hxx"
|
||||
#include "SMESH_MeshAlgos.hxx"
|
||||
#include "SMESH_TypeDefs.hxx"
|
||||
#include "SMESH_subMesh.hxx"
|
||||
|
||||
@ -71,6 +72,8 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <limits>
|
||||
#include "SMESH_ProxyMesh.hxx"
|
||||
#include "SMESH_MesherHelper.hxx"
|
||||
|
||||
using namespace std;
|
||||
|
||||
@ -526,6 +529,57 @@ GeomAbs_Shape SMESH_Algo::Continuity(TopoDS_Edge E1,
|
||||
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
|
||||
@ -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;
|
||||
}
|
||||
|
@ -52,6 +52,7 @@ class SMESH_Gen;
|
||||
class SMESH_HypoFilter;
|
||||
class SMESH_Mesh;
|
||||
class SMESH_MesherHelper;
|
||||
class SMESH_ProxyMesh;
|
||||
class SMESH_subMesh;
|
||||
class TopoDS_Face;
|
||||
class TopoDS_Shape;
|
||||
@ -356,6 +357,10 @@ public:
|
||||
static bool IsContinuous(const TopoDS_Edge & E1, const TopoDS_Edge & E2) {
|
||||
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
|
||||
@ -445,6 +450,13 @@ class SMESH_EXPORT SMESH_2D_Algo: public SMESH_Algo
|
||||
{
|
||||
public:
|
||||
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
|
||||
|
@ -66,6 +66,8 @@
|
||||
#include <TopTools_MapOfShape.hxx>
|
||||
#include <TopoDS_Iterator.hxx>
|
||||
|
||||
#include "SMESH_TryCatch.hxx" // include after OCCT headers!
|
||||
|
||||
#include "Utils_ExceptHandlers.hxx"
|
||||
|
||||
#include <boost/thread/thread.hpp>
|
||||
@ -1259,7 +1261,7 @@ void SMESH_Mesh::ExportMED(const char * file,
|
||||
bool theAutoDimension)
|
||||
throw(SALOME_Exception)
|
||||
{
|
||||
Unexpect aCatch(SalomeException);
|
||||
SMESH_TRY;
|
||||
|
||||
DriverMED_W_SMESHDS_Mesh myWriter;
|
||||
myWriter.SetFile ( file, MED::EVersion(theVersion) );
|
||||
@ -1306,6 +1308,8 @@ void SMESH_Mesh::ExportMED(const char * file,
|
||||
}
|
||||
// Perform export
|
||||
myWriter.Perform();
|
||||
|
||||
SMESH_CATCH( SMESH::throwSalomeEx );
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
@ -1486,12 +1490,16 @@ double SMESH_Mesh::GetComputeProgress() const
|
||||
currentSubIds.Add( smToCompute[i]->GetId() );
|
||||
}
|
||||
double rate = algo->GetProgress();
|
||||
if ( !( 0. < rate && rate < 1.001 ))
|
||||
if ( 0. < rate && rate < 1.001 )
|
||||
{
|
||||
computedCost += rate * ( algoDoneCost + algoNotDoneCost );
|
||||
}
|
||||
else
|
||||
{
|
||||
rate = algo->GetProgressByTic();
|
||||
computedCost += algoDoneCost + rate * algoNotDoneCost;
|
||||
}
|
||||
// cout << "rate: "<<rate << " algoNotDoneCost: " << algoNotDoneCost << endl;
|
||||
computedCost += algoDoneCost + rate * algoNotDoneCost;
|
||||
}
|
||||
|
||||
// get cost of already treated sub-meshes
|
||||
|
@ -2101,7 +2101,7 @@ void SMESH_MeshEditor::SplitVolumesIntoTetra (const TIDSortedElemSet & theElems,
|
||||
GetMeshDS()->RemoveNode( volNodes[i] );
|
||||
}
|
||||
} // loop on volumes to split
|
||||
|
||||
|
||||
myLastCreatedNodes = newNodes;
|
||||
myLastCreatedElems = newElems;
|
||||
}
|
||||
@ -5144,7 +5144,7 @@ SMESH_MeshEditor::ExtrusionAlongTrack (TIDSortedElemSet & theElements,
|
||||
|
||||
const TopoDS_Shape& aS = theTrack->GetShapeToMesh();
|
||||
|
||||
if( aS == SMESH_Mesh::PseudoShape() ) {
|
||||
if ( !theTrack->HasShapeToMesh() ) {
|
||||
//Mesh without shape
|
||||
const SMDS_MeshNode* currentNode = NULL;
|
||||
const SMDS_MeshNode* prevNode = theN1;
|
||||
@ -5267,16 +5267,8 @@ SMESH_MeshEditor::ExtrusionAlongTrack (TIDSortedElemSet & theElements,
|
||||
if ( BRep_Tool::Degenerated( aTrackEdge ) )
|
||||
return EXTR_BAD_PATH_SHAPE;
|
||||
TopExp::Vertices( aTrackEdge, aV1, aV2 );
|
||||
const SMDS_MeshNode* aN1 = 0;
|
||||
const SMDS_MeshNode* aN2 = 0;
|
||||
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();
|
||||
}
|
||||
const SMDS_MeshNode* aN1 = SMESH_Algo::VertexNode( aV1, pMeshDS );
|
||||
const SMDS_MeshNode* aN2 = SMESH_Algo::VertexNode( aV2, pMeshDS );
|
||||
// starting node must be aN1 or aN2
|
||||
if ( !( aN1 == theN1 || aN2 == theN1 ) )
|
||||
return EXTR_BAD_STARTING_NODE;
|
||||
@ -5324,17 +5316,8 @@ SMESH_MeshEditor::ExtrusionAlongTrack (TIDSortedElemSet & theElements,
|
||||
if ( aVprev.IsNull() ) {
|
||||
// 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
|
||||
const SMDS_MeshNode* aN1 = 0;
|
||||
const SMDS_MeshNode* aN2 = 0;
|
||||
|
||||
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();
|
||||
}
|
||||
const SMDS_MeshNode* aN1 = SMESH_Algo::VertexNode( aV1, pMeshDS );
|
||||
const SMDS_MeshNode* aN2 = SMESH_Algo::VertexNode( aV2, pMeshDS );
|
||||
// starting node must be aN1 or aN2
|
||||
aN1isOK = ( aN1 && aN1 == theN1 );
|
||||
aN2isOK = ( aN2 && aN2 == theN1 );
|
||||
@ -5368,27 +5351,21 @@ SMESH_MeshEditor::ExtrusionAlongTrack (TIDSortedElemSet & theElements,
|
||||
}
|
||||
}
|
||||
list< list<SMESH_MeshEditor_PathPoint> >::iterator itLLPP = LLPPs.begin();
|
||||
list<SMESH_MeshEditor_PathPoint> firstList = *itLLPP;
|
||||
list<SMESH_MeshEditor_PathPoint>::iterator itPP = firstList.begin();
|
||||
for(; itPP!=firstList.end(); itPP++) {
|
||||
fullList.push_back( *itPP );
|
||||
}
|
||||
list<SMESH_MeshEditor_PathPoint>& firstList = *itLLPP;
|
||||
fullList.splice( fullList.end(), firstList );
|
||||
|
||||
SMESH_MeshEditor_PathPoint PP1 = fullList.back();
|
||||
fullList.pop_back();
|
||||
itLLPP++;
|
||||
for(; itLLPP!=LLPPs.end(); itLLPP++) {
|
||||
list<SMESH_MeshEditor_PathPoint> currList = *itLLPP;
|
||||
itPP = currList.begin();
|
||||
list<SMESH_MeshEditor_PathPoint>& currList = *itLLPP;
|
||||
SMESH_MeshEditor_PathPoint PP2 = currList.front();
|
||||
gp_Dir D1 = PP1.Tangent();
|
||||
gp_Dir D2 = PP2.Tangent();
|
||||
gp_Dir Dnew( ( D1.XYZ() + D2.XYZ() ) / 2 );
|
||||
PP1.SetTangent(Dnew);
|
||||
fullList.push_back(PP1);
|
||||
itPP++;
|
||||
for(; itPP!=currList.end(); itPP++) {
|
||||
fullList.push_back( *itPP );
|
||||
}
|
||||
fullList.splice( fullList.end(), currList, ++currList.begin(), currList.end() );
|
||||
PP1 = fullList.back();
|
||||
fullList.pop_back();
|
||||
}
|
||||
@ -5410,9 +5387,9 @@ SMESH_MeshEditor::ExtrusionAlongTrack (TIDSortedElemSet & theElements,
|
||||
//purpose : auxilary for ExtrusionAlongTrack
|
||||
//=======================================================================
|
||||
SMESH_MeshEditor::Extrusion_Error
|
||||
SMESH_MeshEditor::MakeEdgePathPoints(std::list<double>& aPrms,
|
||||
const TopoDS_Edge& aTrackEdge,
|
||||
bool FirstIsStart,
|
||||
SMESH_MeshEditor::MakeEdgePathPoints(std::list<double>& aPrms,
|
||||
const TopoDS_Edge& aTrackEdge,
|
||||
bool FirstIsStart,
|
||||
list<SMESH_MeshEditor_PathPoint>& LPP)
|
||||
{
|
||||
Standard_Real aTx1, aTx2, aL2, aTolVec, aTolVec2;
|
||||
@ -5465,63 +5442,43 @@ SMESH_MeshEditor::MakeEdgePathPoints(std::list<double>& aPrms,
|
||||
//purpose : auxilary for ExtrusionAlongTrack
|
||||
//=======================================================================
|
||||
SMESH_MeshEditor::Extrusion_Error
|
||||
SMESH_MeshEditor::MakeExtrElements(TIDSortedElemSet& theElements,
|
||||
SMESH_MeshEditor::MakeExtrElements(TIDSortedElemSet& theElements,
|
||||
list<SMESH_MeshEditor_PathPoint>& fullList,
|
||||
const bool theHasAngles,
|
||||
list<double>& theAngles,
|
||||
const bool theLinearVariation,
|
||||
const bool theHasRefPoint,
|
||||
const gp_Pnt& theRefPoint,
|
||||
const bool theMakeGroups)
|
||||
const bool theHasAngles,
|
||||
list<double>& theAngles,
|
||||
const bool theLinearVariation,
|
||||
const bool theHasRefPoint,
|
||||
const gp_Pnt& theRefPoint,
|
||||
const bool theMakeGroups)
|
||||
{
|
||||
MESSAGE("MakeExtrElements");
|
||||
//cout<<"MakeExtrElements fullList.size() = "<<fullList.size()<<endl;
|
||||
int aNbTP = fullList.size();
|
||||
vector<SMESH_MeshEditor_PathPoint> aPPs(aNbTP);
|
||||
const int aNbTP = fullList.size();
|
||||
// Angles
|
||||
if( theHasAngles && theAngles.size()>0 && theLinearVariation ) {
|
||||
if( theHasAngles && !theAngles.empty() && theLinearVariation )
|
||||
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
|
||||
//aPPs.resize(fullList.size());
|
||||
j = -1;
|
||||
vector<SMESH_MeshEditor_PathPoint> aPPs;
|
||||
list<SMESH_MeshEditor_PathPoint>::iterator itPP = fullList.begin();
|
||||
for(; itPP!=fullList.end(); itPP++) {
|
||||
j++;
|
||||
SMESH_MeshEditor_PathPoint PP = *itPP;
|
||||
PP.SetAngle(aAngles[j]);
|
||||
aPPs[j] = PP;
|
||||
list<double>::iterator itAngles = theAngles.begin();
|
||||
aPPs.push_back( *itPP++ );
|
||||
for( ; itPP != fullList.end(); itPP++) {
|
||||
aPPs.push_back( *itPP );
|
||||
if ( theHasAngles && itAngles != theAngles.end() )
|
||||
aPPs.back().SetAngle( *itAngles );
|
||||
}
|
||||
|
||||
TNodeOfNodeListMap mapNewNodes;
|
||||
TNodeOfNodeListMap mapNewNodes;
|
||||
TElemOfVecOfNnlmiMap mapElemNewNodes;
|
||||
TElemOfElemListMap newElemsMap;
|
||||
TElemOfElemListMap newElemsMap;
|
||||
TIDSortedElemSet::iterator itElem;
|
||||
double aX, aY, aZ;
|
||||
int aNb;
|
||||
SMDSAbs_ElementType aTypeE;
|
||||
// source elements for each generated one
|
||||
SMESH_SequenceOfElemPtr srcElems, srcNodes;
|
||||
|
||||
// 3. Center of rotation aV0
|
||||
gp_Pnt aV0 = theRefPoint;
|
||||
gp_XYZ aGC;
|
||||
if ( !theHasRefPoint ) {
|
||||
aNb = 0;
|
||||
aGC.SetCoord( 0.,0.,0. );
|
||||
if ( !theHasRefPoint )
|
||||
{
|
||||
gp_XYZ aGC( 0.,0.,0. );
|
||||
TIDSortedElemSet newNodes;
|
||||
|
||||
itElem = theElements.begin();
|
||||
for ( ; itElem != theElements.end(); itElem++ ) {
|
||||
@ -5529,25 +5486,14 @@ SMESH_MeshEditor::MakeExtrElements(TIDSortedElemSet& theElements,
|
||||
|
||||
SMDS_ElemIteratorPtr itN = elem->nodesIterator();
|
||||
while ( itN->more() ) {
|
||||
const SMDS_MeshNode* node = static_cast<const SMDS_MeshNode*>( itN->next() );
|
||||
aX = node->X();
|
||||
aY = node->Y();
|
||||
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;
|
||||
}
|
||||
const SMDS_MeshElement* node = itN->next();
|
||||
if ( newNodes.insert( node ).second )
|
||||
aGC += SMESH_TNodeXYZ( node );
|
||||
}
|
||||
}
|
||||
aGC /= aNb;
|
||||
aGC /= newNodes.size();
|
||||
aV0.SetXYZ( aGC );
|
||||
} // if (!theHasRefPoint) {
|
||||
mapNewNodes.clear();
|
||||
|
||||
// 4. Processing the elements
|
||||
SMESHDS_Mesh* aMesh = GetMeshDS();
|
||||
@ -5555,7 +5501,7 @@ SMESH_MeshEditor::MakeExtrElements(TIDSortedElemSet& theElements,
|
||||
for ( itElem = theElements.begin(); itElem != theElements.end(); itElem++ ) {
|
||||
// check element type
|
||||
const SMDS_MeshElement* elem = *itElem;
|
||||
aTypeE = elem->GetType();
|
||||
SMDSAbs_ElementType aTypeE = elem->GetType();
|
||||
if ( !elem || ( aTypeE != SMDSAbs_Face && aTypeE != SMDSAbs_Edge ) )
|
||||
continue;
|
||||
|
||||
@ -5577,8 +5523,6 @@ SMESH_MeshEditor::MakeExtrElements(TIDSortedElemSet& theElements,
|
||||
list<const SMDS_MeshNode*>& listNewNodes = nIt->second;
|
||||
|
||||
// make new nodes
|
||||
aX = node->X(); aY = node->Y(); aZ = node->Z();
|
||||
|
||||
Standard_Real aAngle1x, aAngleT1T0, aTolAng;
|
||||
gp_Pnt aP0x, aP1x, aPN0, aPN1, aV0x, aV1x;
|
||||
gp_Ax1 anAx1, anAxT1T0;
|
||||
@ -5587,17 +5531,17 @@ SMESH_MeshEditor::MakeExtrElements(TIDSortedElemSet& theElements,
|
||||
aTolAng=1.e-4;
|
||||
|
||||
aV0x = aV0;
|
||||
aPN0.SetCoord(aX, aY, aZ);
|
||||
aPN0 = SMESH_TNodeXYZ( node );
|
||||
|
||||
const SMESH_MeshEditor_PathPoint& aPP0 = aPPs[0];
|
||||
aP0x = aPP0.Pnt();
|
||||
aDT0x= aPP0.Tangent();
|
||||
//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];
|
||||
aP1x = aPP1.Pnt();
|
||||
aDT1x = aPP1.Tangent();
|
||||
aP1x = aPP1.Pnt();
|
||||
aDT1x = aPP1.Tangent();
|
||||
aAngle1x = aPP1.Angle();
|
||||
|
||||
gp_Trsf aTrsf, aTrsfRot, aTrsfRotT1T0;
|
||||
@ -5641,10 +5585,7 @@ SMESH_MeshEditor::MakeExtrElements(TIDSortedElemSet& theElements,
|
||||
srcNodes.Append( node );
|
||||
listNewNodes.push_back( newNode );
|
||||
}
|
||||
aX = aPN1.X();
|
||||
aY = aPN1.Y();
|
||||
aZ = aPN1.Z();
|
||||
const SMDS_MeshNode* newNode = aMesh->AddNode( aX, aY, aZ );
|
||||
const SMDS_MeshNode* newNode = aMesh->AddNode( aPN1.X(), aPN1.Y(), aPN1.Z() );
|
||||
myLastCreatedNodes.Append(newNode);
|
||||
srcNodes.Append( node );
|
||||
listNewNodes.push_back( newNode );
|
||||
@ -8505,11 +8446,20 @@ void SMESH_MeshEditor::ConvertToQuadratic(const bool theForce3d, const bool theT
|
||||
if ( !volume ) continue;
|
||||
|
||||
const SMDSAbs_EntityType type = volume->GetEntityType();
|
||||
if (( theToBiQuad && type == SMDSEntity_TriQuad_Hexa ) ||
|
||||
( !theToBiQuad && type == SMDSEntity_Quad_Hexa ))
|
||||
if ( volume->IsQuadratic() )
|
||||
{
|
||||
aHelper.AddTLinks( static_cast< const SMDS_MeshVolume* >( volume ));
|
||||
continue;
|
||||
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 ));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
const int id = volume->GetID();
|
||||
vector<const SMDS_MeshNode *> nodes (volume->begin_nodes(), volume->end_nodes());
|
||||
@ -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.
|
||||
\param theElems - list of groups of elements (edges or faces) to be replicated
|
||||
\param theNodesNot - list of groups of nodes not to replicated
|
||||
\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.
|
||||
\return groups of affected elements
|
||||
\sa DoubleNodeElemGroupsInRegion()
|
||||
@ -9968,44 +9920,145 @@ bool SMESH_MeshEditor::AffectedElemGroupsInRegion( const TIDSortedElemSet& theEl
|
||||
TIDSortedElemSet& theAffectedElems)
|
||||
{
|
||||
if ( theShape.IsNull() )
|
||||
return false;
|
||||
|
||||
const double aTol = Precision::Confusion();
|
||||
auto_ptr< BRepClass3d_SolidClassifier> bsc3d;
|
||||
auto_ptr<_FaceClassifier> aFaceClassifier;
|
||||
if ( theShape.ShapeType() == TopAbs_SOLID )
|
||||
{
|
||||
bsc3d.reset( new BRepClass3d_SolidClassifier(theShape));;
|
||||
bsc3d->PerformInfinitePoint(aTol);
|
||||
}
|
||||
else if (theShape.ShapeType() == TopAbs_FACE )
|
||||
{
|
||||
aFaceClassifier.reset( new _FaceClassifier(TopoDS::Face(theShape)));
|
||||
}
|
||||
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 indicated elements and get elements by back references from their nodes
|
||||
TIDSortedElemSet::const_iterator elemItr = theElems.begin();
|
||||
for ( ; elemItr != theElems.end(); ++elemItr )
|
||||
{
|
||||
SMDS_MeshElement* anElem = (SMDS_MeshElement*)*elemItr;
|
||||
if (!anElem)
|
||||
continue;
|
||||
// --- iterates on elements to be replicated and get elements by back references from their nodes
|
||||
|
||||
SMDS_ElemIteratorPtr nodeItr = anElem->nodesIterator();
|
||||
while ( nodeItr->more() )
|
||||
TIDSortedElemSet::const_iterator elemItr = theElems.begin();
|
||||
int ielem = 1;
|
||||
for ( ; elemItr != theElems.end(); ++elemItr )
|
||||
{
|
||||
const SMDS_MeshNode* aNode = cast2Node(nodeItr->next());
|
||||
if ( !aNode || theNodesNot.find(aNode) != theNodesNot.end() )
|
||||
SMDS_MeshElement* anElem = (SMDS_MeshElement*)*elemItr;
|
||||
if (!anElem || (anElem->GetType() != SMDSAbs_Face))
|
||||
continue;
|
||||
SMDS_ElemIteratorPtr backElemItr = aNode->GetInverseElementIterator();
|
||||
while ( backElemItr->more() )
|
||||
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_MeshElement* curElem = backElemItr->next();
|
||||
if ( curElem && theElems.find(curElem) == theElems.end() &&
|
||||
( bsc3d.get() ?
|
||||
isInside( curElem, *bsc3d, aTol ) :
|
||||
isInside( curElem, *aFaceClassifier, aTol )))
|
||||
theAffectedElems.insert( curElem );
|
||||
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();
|
||||
auto_ptr< BRepClass3d_SolidClassifier> bsc3d;
|
||||
auto_ptr<_FaceClassifier> aFaceClassifier;
|
||||
if ( theShape.ShapeType() == TopAbs_SOLID )
|
||||
{
|
||||
bsc3d.reset( new BRepClass3d_SolidClassifier(theShape));;
|
||||
bsc3d->PerformInfinitePoint(aTol);
|
||||
}
|
||||
else if (theShape.ShapeType() == TopAbs_FACE )
|
||||
{
|
||||
aFaceClassifier.reset( new _FaceClassifier(TopoDS::Face(theShape)));
|
||||
}
|
||||
|
||||
// iterates on indicated elements and get elements by back references from their nodes
|
||||
TIDSortedElemSet::const_iterator elemItr = theElems.begin();
|
||||
int ielem = 1;
|
||||
for ( ; elemItr != theElems.end(); ++elemItr )
|
||||
{
|
||||
MESSAGE("element " << ielem++);
|
||||
SMDS_MeshElement* anElem = (SMDS_MeshElement*)*elemItr;
|
||||
if (!anElem)
|
||||
continue;
|
||||
SMDS_ElemIteratorPtr nodeItr = anElem->nodesIterator();
|
||||
while ( nodeItr->more() )
|
||||
{
|
||||
MESSAGE(" noeud ");
|
||||
const SMDS_MeshNode* aNode = cast2Node(nodeItr->next());
|
||||
if ( !aNode || theNodesNot.find(aNode) != theNodesNot.end() )
|
||||
continue;
|
||||
SMDS_ElemIteratorPtr backElemItr = aNode->GetInverseElementIterator();
|
||||
while ( backElemItr->more() )
|
||||
{
|
||||
MESSAGE(" backelem ");
|
||||
const SMDS_MeshElement* curElem = backElemItr->next();
|
||||
if ( curElem && theElems.find(curElem) == theElems.end() &&
|
||||
( bsc3d.get() ?
|
||||
isInside( curElem, *bsc3d, aTol ) :
|
||||
isInside( curElem, *aFaceClassifier, aTol )))
|
||||
theAffectedElems.insert( curElem );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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() )
|
||||
uvOK = ( V == vert.Current() );
|
||||
if ( !uvOK ) {
|
||||
#ifdef _DEBUG_
|
||||
MESSAGE ( "SMESH_MesherHelper::GetNodeUV(); Vertex " << vertexID
|
||||
<< " not in face " << GetMeshDS()->ShapeToIndex( F ) );
|
||||
#endif
|
||||
<< " not in face " << GetMeshDS()->ShapeToIndex( F ) );
|
||||
// get UV of a vertex closest to the node
|
||||
double dist = 1e100;
|
||||
gp_Pnt pn = XYZ( n );
|
||||
@ -944,6 +942,7 @@ bool SMESH_MesherHelper::CheckNodeU(const TopoDS_Edge& E,
|
||||
}
|
||||
Quantity_Parameter U = projector->LowerDistanceParameter();
|
||||
u = double( U );
|
||||
MESSAGE(" f " << f << " l " << l << " u " << u);
|
||||
curvPnt = curve->Value( u );
|
||||
dist = nodePnt.Distance( curvPnt );
|
||||
if ( distXYZ ) {
|
||||
@ -968,6 +967,7 @@ bool SMESH_MesherHelper::CheckNodeU(const TopoDS_Edge& E,
|
||||
}
|
||||
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)
|
||||
try
|
||||
{
|
||||
@ -4673,4 +4673,3 @@ void SMESH_MesherHelper::FixQuadraticElements(SMESH_ComputeErrorPtr& compError,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -97,7 +97,7 @@ class SMESH_EXPORT SMESH_MesherHelper
|
||||
* The key of the map is a normalized parameter of each
|
||||
* base node on theBaseSide. Edges in theBaseSide must be sequenced.
|
||||
* 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,
|
||||
const TopoDS_Face& theFace,
|
||||
|
@ -1381,7 +1381,7 @@ static void cleanSubMesh( SMESH_subMesh * subMesh )
|
||||
const SMDS_MeshElement * elt = ite->next();
|
||||
//MESSAGE( " RM elt: "<<elt->GetID()<<" ( "<<elt->NbNodes()<<" )" );
|
||||
//meshDS->RemoveElement(elt);
|
||||
meshDS->RemoveFreeElement(elt, subMeshDS);
|
||||
meshDS->RemoveFreeElement(elt, 0);
|
||||
}
|
||||
|
||||
SMDS_NodeIteratorPtr itn = subMeshDS->GetNodes();
|
||||
@ -1389,10 +1389,11 @@ static void cleanSubMesh( SMESH_subMesh * subMesh )
|
||||
const SMDS_MeshNode * node = itn->next();
|
||||
//MESSAGE( " RM node: "<<node->GetID());
|
||||
if ( node->NbInverseElements() == 0 )
|
||||
meshDS->RemoveFreeNode(node, subMeshDS);
|
||||
meshDS->RemoveFreeNode(node, 0);
|
||||
else // for StdMeshers_CompositeSegment_1D: node in one submesh, edge in another
|
||||
meshDS->RemoveNode(node);
|
||||
}
|
||||
subMeshDS->Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -69,11 +69,13 @@ libSMESHClient_la_LDFLAGS = \
|
||||
../MEDWrapper/Factory/libMEDWrapper.la \
|
||||
../MEDWrapper/Base/libMEDWrapperBase.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 \
|
||||
$(GEOM_LDFLAGS) -lNMTDS -lSalomeIDLGEOM \
|
||||
$(CAS_KERNEL)
|
||||
|
||||
|
||||
SMESHClientBin_CPPFLAGS = \
|
||||
$(libSMESHClient_la_CPPFLAGS)
|
||||
|
||||
|
@ -888,8 +888,8 @@ void SMESHDS_Mesh::RemoveFreeNode(const SMDS_MeshNode * n,
|
||||
set<SMESHDS_GroupBase*>::iterator GrIt = myGroups.begin();
|
||||
for (; GrIt != myGroups.end(); GrIt++) {
|
||||
SMESHDS_Group* group = dynamic_cast<SMESHDS_Group*>(*GrIt);
|
||||
if (!group || group->IsEmpty()) continue;
|
||||
group->SMDSGroup().Remove(n);
|
||||
if (group && !group->IsEmpty())
|
||||
group->SMDSGroup().Remove(n);
|
||||
}
|
||||
}
|
||||
|
||||
@ -915,11 +915,12 @@ void SMESHDS_Mesh::RemoveElement(const SMDS_MeshElement * elt)
|
||||
if (!hasConstructionEdges() && !hasConstructionFaces())
|
||||
{
|
||||
SMESHDS_SubMesh* subMesh=0;
|
||||
map<int,SMESHDS_SubMesh*>::iterator SubIt = myShapeIndexToSubMesh.begin();
|
||||
for ( ; !subMesh && SubIt != myShapeIndexToSubMesh.end(); SubIt++ )
|
||||
if (!SubIt->second->IsComplexSubmesh() && SubIt->second->Contains( elt ))
|
||||
if ( elt->getshapeId() > 0 )
|
||||
{
|
||||
map<int,SMESHDS_SubMesh*>::iterator SubIt = myShapeIndexToSubMesh.find( elt->getshapeId() );
|
||||
if ( SubIt != myShapeIndexToSubMesh.end() )
|
||||
subMesh = SubIt->second;
|
||||
//MESSAGE("subMesh " << elt->getshapeId());
|
||||
}
|
||||
RemoveFreeElement( elt, subMesh, true);
|
||||
return;
|
||||
}
|
||||
|
@ -67,6 +67,7 @@ SMESHDS_SubMesh::~SMESHDS_SubMesh()
|
||||
//function : AddElement
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void SMESHDS_SubMesh::AddElement(const SMDS_MeshElement * ME)
|
||||
{
|
||||
if (!IsComplexSubmesh())
|
||||
@ -76,7 +77,6 @@ void SMESHDS_SubMesh::AddElement(const SMDS_MeshElement * ME)
|
||||
AddNode( static_cast< const SMDS_MeshNode* >( ME ));
|
||||
return;
|
||||
}
|
||||
//MESSAGE("in " << myIndex << " AddElement "<< ME->GetID());
|
||||
int oldShapeId = ME->getshapeId();
|
||||
if ( oldShapeId > 0 )
|
||||
{
|
||||
@ -121,32 +121,30 @@ void SMESHDS_SubMesh::AddElement(const SMDS_MeshElement * ME)
|
||||
//function : RemoveElement
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
bool SMESHDS_SubMesh::RemoveElement(const SMDS_MeshElement * ME, bool isElemDeleted)
|
||||
{
|
||||
if (!ME)
|
||||
{
|
||||
MESSAGE("-----------------> Remove Null Element " << isElemDeleted);
|
||||
return false;
|
||||
}
|
||||
//MESSAGE("-----------------> RemoveElement "<< ME->GetID() << " " << isElemDeleted);
|
||||
{
|
||||
MESSAGE("-----------------> Remove Null Element " << isElemDeleted);
|
||||
return false;
|
||||
}
|
||||
if (!IsComplexSubmesh())
|
||||
{
|
||||
if ( ME->getshapeId() != myIndex )
|
||||
return false;
|
||||
int idInSubShape = ME->getIdInShape();
|
||||
//MESSAGE("in "<< myIndex << " RemoveElement " << ME->GetID() << " " << idInSubShape << " " << myUnusedIdElements);
|
||||
SMDS_MeshElement* elem = (SMDS_MeshElement*) (ME);
|
||||
elem->setShapeId(0);
|
||||
elem->setIdInShape(-1);
|
||||
if ((idInSubShape >= 0) && (idInSubShape < myElements.size()))
|
||||
{
|
||||
myElements[idInSubShape] = 0; // this vector entry is no more used
|
||||
myUnusedIdElements++;
|
||||
return true;
|
||||
}
|
||||
{
|
||||
if ( ME->getshapeId() != myIndex )
|
||||
return false;
|
||||
// }
|
||||
int idInSubShape = ME->getIdInShape();
|
||||
SMDS_MeshElement* elem = (SMDS_MeshElement*) (ME);
|
||||
elem->setShapeId(0);
|
||||
elem->setIdInShape(-1);
|
||||
if ((idInSubShape >= 0) && (idInSubShape < myElements.size()))
|
||||
{
|
||||
myElements[idInSubShape] = 0; // this vector entry is no more used
|
||||
myUnusedIdElements++;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
MESSAGE("Try to remove an element from a complex submesh ");
|
||||
return false;
|
||||
}
|
||||
@ -187,26 +185,21 @@ void SMESHDS_SubMesh::AddNode(const SMDS_MeshNode * N)
|
||||
bool SMESHDS_SubMesh::RemoveNode(const SMDS_MeshNode * N, bool isNodeDeleted)
|
||||
{
|
||||
if (!IsComplexSubmesh())
|
||||
{
|
||||
// if (!isNodeDeleted) // alive node has valid ID and can be found
|
||||
// {
|
||||
if ( N->getshapeId() != myIndex )
|
||||
return false;
|
||||
int idInSubShape = N->getIdInShape();
|
||||
//int shapeId = N->getshapeId();
|
||||
//MESSAGE("in "<< myIndex << " RemoveNode " << shapeId << " " << idInSubShape << " " << N->GetID());
|
||||
SMDS_MeshNode* node = (SMDS_MeshNode*) (N);
|
||||
node->setShapeId(0);
|
||||
node->setIdInShape(-1);
|
||||
if ((idInSubShape >= 0) && (idInSubShape < myNodes.size()))
|
||||
{
|
||||
myNodes[idInSubShape] = 0; // this vector entry is no more used
|
||||
myUnusedIdNodes++;
|
||||
return true;
|
||||
}
|
||||
{
|
||||
if ( N->getshapeId() != myIndex )
|
||||
return false;
|
||||
// }
|
||||
int idInSubShape = N->getIdInShape();
|
||||
SMDS_MeshNode* node = (SMDS_MeshNode*) (N);
|
||||
node->setShapeId(0);
|
||||
node->setIdInShape(-1);
|
||||
if ((idInSubShape >= 0) && (idInSubShape < myNodes.size()))
|
||||
{
|
||||
myNodes[idInSubShape] = 0; // this vector entry is no more used
|
||||
myUnusedIdNodes++;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
MESSAGE("Try to remove a node from a complex submesh");
|
||||
return false;
|
||||
}
|
||||
@ -215,9 +208,9 @@ bool SMESHDS_SubMesh::RemoveNode(const SMDS_MeshNode * N, bool isNodeDeleted)
|
||||
//function : NbElements
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
int SMESHDS_SubMesh::NbElements() const
|
||||
{
|
||||
//MESSAGE(this << " NbElements " << IsComplexSubmesh() << " " << myElements.size() - myUnusedIdElements);
|
||||
if ( !IsComplexSubmesh() )
|
||||
return myElements.size() - myUnusedIdElements;
|
||||
|
||||
@ -236,7 +229,6 @@ int SMESHDS_SubMesh::NbElements() const
|
||||
|
||||
int SMESHDS_SubMesh::NbNodes() const
|
||||
{
|
||||
//MESSAGE(this << " NbNodes " << IsComplexSubmesh() << " " << myNodes.size() - myUnusedIdNodes);
|
||||
if ( !IsComplexSubmesh() )
|
||||
return myNodes.size() - myUnusedIdNodes;
|
||||
|
||||
@ -476,10 +468,13 @@ void SMESHDS_SubMesh::Clear()
|
||||
clearVector( myNodes );
|
||||
myUnusedIdNodes = 0;
|
||||
myUnusedIdElements = 0;
|
||||
SMESHDS_SubMeshIteratorPtr sub = GetSubMeshIterator();
|
||||
while ( sub->more() ) {
|
||||
if ( SMESHDS_SubMesh* sm = (SMESHDS_SubMesh*) sub->next())
|
||||
sm->Clear();
|
||||
if ( NbSubMeshes() > 0 )
|
||||
{
|
||||
SMESHDS_SubMeshIteratorPtr sub = GetSubMeshIterator();
|
||||
while ( sub->more() ) {
|
||||
if ( SMESHDS_SubMesh* sm = (SMESHDS_SubMesh*) sub->next())
|
||||
sm->Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -487,53 +482,38 @@ int SMESHDS_SubMesh::getSize()
|
||||
{
|
||||
int c = NbNodes();
|
||||
int d = NbElements();
|
||||
//cerr << "SMESHDS_SubMesh::NbNodes " << c << endl;
|
||||
//cerr << "SMESHDS_SubMesh::NbElements " << d << endl;
|
||||
return c+d;
|
||||
}
|
||||
|
||||
void SMESHDS_SubMesh::compactList()
|
||||
{
|
||||
//MESSAGE("compactList old: nodes " << myNodes.size() << " elements " << myElements.size());
|
||||
//stringstream a;
|
||||
//stringstream b;
|
||||
//stringstream c;
|
||||
//stringstream d;
|
||||
|
||||
std::vector<const SMDS_MeshElement*> newElems;
|
||||
newElems.clear();
|
||||
for (int i = 0; i < myElements.size(); i++)
|
||||
if (myElements[i])
|
||||
if ( myUnusedIdElements > 0 )
|
||||
{
|
||||
std::vector<const SMDS_MeshElement*> newElems;
|
||||
newElems.reserve( myElements.size() - myUnusedIdElements );
|
||||
for (size_t i = 0; i < myElements.size(); i++)
|
||||
if (myElements[i])
|
||||
{
|
||||
SMDS_MeshElement* elem = (SMDS_MeshElement*)myElements[i];
|
||||
elem->setIdInShape(newElems.size());
|
||||
newElems.push_back(elem);
|
||||
//a << elem->GetID() << " ";
|
||||
//b << elem->GetID() << " ";
|
||||
}
|
||||
//else
|
||||
// a << "_ ";
|
||||
myElements.swap(newElems);
|
||||
myUnusedIdElements = 0;
|
||||
//MESSAGE("in " << myIndex << " oldElems " << a.str());
|
||||
//MESSAGE("in " << myIndex << " newElems " << b.str());
|
||||
myElements.swap(newElems);
|
||||
myUnusedIdElements = 0;
|
||||
}
|
||||
|
||||
std::vector<const SMDS_MeshNode*> newNodes;
|
||||
newNodes.clear();
|
||||
for (int i = 0; i < myNodes.size(); i++)
|
||||
if (myNodes[i])
|
||||
if ( myUnusedIdNodes > 0 )
|
||||
{
|
||||
std::vector<const SMDS_MeshNode*> newNodes;
|
||||
newNodes.reserve( myNodes.size() - myUnusedIdNodes );
|
||||
for (size_t i = 0; i < myNodes.size(); i++)
|
||||
if (myNodes[i])
|
||||
{
|
||||
SMDS_MeshNode* node = (SMDS_MeshNode*)myNodes[i];
|
||||
node->setIdInShape(newNodes.size());
|
||||
newNodes.push_back(node);
|
||||
//c << node->GetID() << " ";
|
||||
//d << node->GetID() << " ";
|
||||
}
|
||||
//else
|
||||
// c << "_ ";
|
||||
myNodes.swap(newNodes);
|
||||
myUnusedIdNodes = 0;
|
||||
//MESSAGE("in " << myIndex << " oldNodes " << c.str());
|
||||
//MESSAGE("in " << myIndex << " newNodes " << d.str());
|
||||
//MESSAGE("compactList new: nodes " << myNodes.size() << " elements " << myElements.size());
|
||||
myNodes.swap(newNodes);
|
||||
myUnusedIdNodes = 0;
|
||||
}
|
||||
}
|
||||
|
@ -285,4 +285,5 @@ libSMESH_la_LDFLAGS = \
|
||||
nodist_salomeres_DATA= \
|
||||
SMESH_images.qm \
|
||||
SMESH_msg_en.qm \
|
||||
SMESH_msg_fr.qm
|
||||
SMESH_msg_fr.qm \
|
||||
SMESH_msg_ja.qm
|
||||
|
@ -361,11 +361,6 @@
|
||||
SMESH::SetName( aMeshSO, QFileInfo(filename).fileName() );
|
||||
|
||||
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 {
|
||||
isEmpty = true;
|
||||
@ -928,7 +923,8 @@
|
||||
}
|
||||
}
|
||||
|
||||
void AutoColor(){
|
||||
void AutoColor()
|
||||
{
|
||||
SALOME_ListIO selected;
|
||||
SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
|
||||
if( !app )
|
||||
@ -951,6 +947,8 @@
|
||||
if( aMainObject->_is_nil() )
|
||||
return;
|
||||
|
||||
SUIT_OverrideCursor wc;
|
||||
|
||||
aMainObject->SetAutoColor( true ); // mesh groups are re-colored here
|
||||
|
||||
QList<SALOMEDS::Color> aReservedColors;
|
||||
@ -967,6 +965,7 @@
|
||||
SALOMEDS::Color aColor = SMESHGUI::getUniqueColor( aReservedColors );
|
||||
aReservedColors.append( aColor );
|
||||
#endif // SIMPLE_AUTOCOLOR
|
||||
aGroupObject->SetColor( aColor );
|
||||
|
||||
_PTR(SObject) aGroupSObject = SMESH::FindSObject(aGroupObject);
|
||||
if (aGroupSObject) {
|
||||
@ -1229,14 +1228,14 @@
|
||||
aSel->selectedObjects( selected );
|
||||
|
||||
if(selected.Extent()){
|
||||
Handle(SALOME_InteractiveObject) anIObject = selected.First();
|
||||
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
|
||||
_PTR(SObject) aSObj = aStudy->FindObjectID(anIObject->getEntry());
|
||||
if (aSObj) {
|
||||
if ( aStudy->GetUseCaseBuilder()->SortChildren( aSObj, true/*AscendingOrder*/ ) ) {
|
||||
SMESHGUI::GetSMESHGUI()->updateObjBrowser();
|
||||
}
|
||||
}
|
||||
Handle(SALOME_InteractiveObject) anIObject = selected.First();
|
||||
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
|
||||
_PTR(SObject) aSObj = aStudy->FindObjectID(anIObject->getEntry());
|
||||
if (aSObj) {
|
||||
if ( aStudy->GetUseCaseBuilder()->SortChildren( aSObj, true/*AscendingOrder*/ ) ) {
|
||||
SMESHGUI::GetSMESHGUI()->updateObjBrowser();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1790,7 +1789,7 @@
|
||||
aSO = aRefSObject; // Delete main Object instead of reference
|
||||
|
||||
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 ) {
|
||||
_PTR(ChildIterator) it = aStudy->NewChildIterator( *itSO );
|
||||
for (it->InitEx(false); it->More(); it->Next())
|
||||
@ -1835,24 +1834,9 @@
|
||||
if ( !SO ) continue;
|
||||
std::string anEntry = SO->GetID();
|
||||
|
||||
/** Erase graphical object **/
|
||||
/** Erase graphical object and remove all its data **/
|
||||
if(SO->FindAttribute(anAttr, "AttributeIOR")) {
|
||||
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 **/
|
||||
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,
|
||||
int* entities, bool* limitExceeded )
|
||||
int* entities, bool* limitExceeded, int* hidden )
|
||||
{
|
||||
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
|
||||
if ( !resMgr )
|
||||
@ -2015,6 +1999,7 @@ bool SMESHGUI::automaticUpdate( SMESH::SMESH_Mesh_ptr theMesh,
|
||||
long requestedSize = theMesh->NbElements();
|
||||
|
||||
*entities = SMESH_Actor::eAllEntity;
|
||||
*hidden = 0;
|
||||
|
||||
bool exceeded = updateLimit > 0 && requestedSize > updateLimit;
|
||||
|
||||
@ -2029,40 +2014,50 @@ bool SMESHGUI::automaticUpdate( SMESH::SMESH_Mesh_ptr theMesh,
|
||||
long total = 0;
|
||||
|
||||
if ( nbOdElems > 0 ) {
|
||||
if ( total + nbOdElems > updateLimit )
|
||||
if ( total + nbOdElems > updateLimit ) {
|
||||
*entities = *entities & ~SMESH_Actor::e0DElements;
|
||||
*hidden = *hidden | SMESH_Actor::e0DElements;
|
||||
}
|
||||
else
|
||||
exceeded = false;
|
||||
}
|
||||
total += nbOdElems;
|
||||
|
||||
if ( nbEdges > 0 ) {
|
||||
if ( total + nbEdges > updateLimit )
|
||||
if ( total + nbEdges > updateLimit ) {
|
||||
*entities = *entities & ~SMESH_Actor::eEdges;
|
||||
*hidden = *hidden | SMESH_Actor::eEdges;
|
||||
}
|
||||
else
|
||||
exceeded = false;
|
||||
}
|
||||
total += nbEdges;
|
||||
|
||||
if ( nbFaces > 0 ) {
|
||||
if ( total + nbFaces > updateLimit )
|
||||
if ( total + nbFaces > updateLimit ) {
|
||||
*entities = *entities & ~SMESH_Actor::eFaces;
|
||||
*hidden = *hidden | SMESH_Actor::eFaces;
|
||||
}
|
||||
else
|
||||
exceeded = false;
|
||||
}
|
||||
total += nbFaces;
|
||||
|
||||
if ( nbVolumes > 0 ) {
|
||||
if ( total + nbVolumes > updateLimit )
|
||||
if ( total + nbVolumes > updateLimit ) {
|
||||
*entities = *entities & ~SMESH_Actor::eVolumes;
|
||||
*hidden = *hidden | SMESH_Actor::eVolumes;
|
||||
}
|
||||
else
|
||||
exceeded = false;
|
||||
}
|
||||
total += nbVolumes;
|
||||
|
||||
if ( nbBalls > 0 ) {
|
||||
if ( total + nbBalls > updateLimit )
|
||||
if ( total + nbBalls > updateLimit ) {
|
||||
*entities = *entities & ~SMESH_Actor::eBallElem;
|
||||
*hidden = *hidden | SMESH_Actor::eBallElem;
|
||||
}
|
||||
else
|
||||
exceeded = false;
|
||||
}
|
||||
@ -2529,10 +2524,10 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
||||
if (vtkwnd) {
|
||||
SALOME_ListIteratorOfListIO It( to_process );
|
||||
for ( ; It.More(); It.Next()) {
|
||||
MESSAGE("---");
|
||||
MESSAGE("---");
|
||||
Handle(SALOME_InteractiveObject) IOS = It.Value();
|
||||
if (IOS->hasEntry()) {
|
||||
MESSAGE("---");
|
||||
MESSAGE("---");
|
||||
if (!SMESH::UpdateView(anAction, IOS->getEntry())) {
|
||||
SMESHGUI::GetSMESHGUI()->EmitSignalVisibilityChanged();
|
||||
break; // PAL16774 (Crash after display of many groups)
|
||||
@ -2548,7 +2543,7 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
||||
|
||||
// PAL13338 + PAL15161 -->
|
||||
if ( ( theCommandID==301 || theCommandID==302 ) && !checkLock(aStudy)) {
|
||||
MESSAGE("anAction = SMESH::eDisplayOnly");
|
||||
MESSAGE("anAction = SMESH::eDisplayOnly");
|
||||
SMESH::UpdateView();
|
||||
SMESHGUI::GetSMESHGUI()->EmitSignalVisibilityChanged();
|
||||
}
|
||||
@ -3546,8 +3541,20 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
||||
}
|
||||
case 501:
|
||||
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();
|
||||
SMESHGUI_MeasureDlg* dlg = new SMESHGUI_MeasureDlg( SMESHGUI::desktop(), page );
|
||||
dlg->show();
|
||||
@ -3849,6 +3856,9 @@ void SMESHGUI::initialize( CAM_Application* app )
|
||||
|
||||
createSMESHAction( 501, "MEASURE_MIN_DIST", "ICON_MEASURE_MIN_DIST" );
|
||||
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( 301, "SHOW" );
|
||||
@ -3877,7 +3887,8 @@ void SMESHGUI::initialize( CAM_Application* app )
|
||||
addId = createMenu( tr( "MEN_ADD" ), modifyId, 402 ),
|
||||
removeId = createMenu( tr( "MEN_REMOVE" ), modifyId, 403 ),
|
||||
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( 112, importId, -1 );
|
||||
@ -4025,6 +4036,9 @@ void SMESHGUI::initialize( CAM_Application* app )
|
||||
|
||||
createMenu( 501, measureId, -1 );
|
||||
createMenu( 502, measureId, -1 );
|
||||
createMenu( 503, basicPropId, -1 );
|
||||
createMenu( 504, basicPropId, -1 );
|
||||
createMenu( 505, basicPropId, -1 );
|
||||
createMenu( 214, viewId, -1 );
|
||||
|
||||
// ----- create toolbars --------------
|
||||
|
@ -100,7 +100,7 @@ public :
|
||||
bool isActiveStudyLocked();
|
||||
|
||||
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 );
|
||||
|
||||
|
@ -58,6 +58,7 @@
|
||||
#include CORBA_SERVER_HEADER(SMESH_Mesh)
|
||||
#include CORBA_SERVER_HEADER(SMESH_MeshEditor)
|
||||
|
||||
|
||||
#define SPACING 6
|
||||
#define MARGIN 11
|
||||
|
||||
@ -352,14 +353,17 @@ bool SMESHGUI_Add0DElemsOnAllNodesOp::onApply()
|
||||
return false;
|
||||
|
||||
// get a mesh
|
||||
SMESH::SMESH_IDSource_var meshObject;
|
||||
SMESH::SMESH_Mesh_var mesh;
|
||||
SMESH::SMESH_IDSource_wrap meshObject;
|
||||
SMESH::SMESH_Mesh_var mesh;
|
||||
if ( !myIO.IsNull() )
|
||||
{
|
||||
CORBA::Object_var obj = SMESH::IObjectToObject( myIO );
|
||||
meshObject = SMESH::SMESH_IDSource::_narrow( obj );
|
||||
if ( !meshObject->_is_nil() )
|
||||
{
|
||||
mesh = meshObject->GetMesh();
|
||||
meshObject->Register();
|
||||
}
|
||||
}
|
||||
if ( mesh->_is_nil() )
|
||||
{
|
||||
|
@ -65,10 +65,6 @@
|
||||
#define SPACING 6
|
||||
#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
|
||||
// Purpose :
|
||||
@ -347,12 +343,6 @@ bool SMESHGUI_BuildCompoundDlg::ClickOnApply()
|
||||
|
||||
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 false;
|
||||
|
@ -895,9 +895,10 @@ void SMESHGUI_BaseComputeOp::computeMesh()
|
||||
bool limitExceeded;
|
||||
long limitSize = resMgr->integerValue( "SMESH", "update_limit", 500000 );
|
||||
int entities = SMESH_Actor::eAllEntity;
|
||||
int hidden = 0;
|
||||
if ( !memoryLack )
|
||||
{
|
||||
if ( getSMESHGUI()->automaticUpdate( myMesh, &entities, &limitExceeded ) )
|
||||
if ( getSMESHGUI()->automaticUpdate( myMesh, &entities, &limitExceeded, &hidden ) )
|
||||
{
|
||||
try {
|
||||
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
|
||||
@ -905,17 +906,24 @@ void SMESHGUI_BaseComputeOp::computeMesh()
|
||||
#endif
|
||||
SMESH_Actor *anActor = SMESH::FindActorByObject( myMesh );
|
||||
if ( !anActor ) anActor = SMESH::CreateActor( aMeshSObj->GetStudy(), aMeshSObj->GetID().c_str(), true );
|
||||
|
||||
anActor->SetEntityMode( entities );
|
||||
SMESH::DisplayActor( SMESH::GetActiveWindow(), anActor );
|
||||
|
||||
if ( anActor ) // actor is not created for an empty mesh
|
||||
{
|
||||
anActor->SetEntityMode( entities );
|
||||
SMESH::DisplayActor( SMESH::GetActiveWindow(), anActor );
|
||||
}
|
||||
SMESH::Update(myIObject, true);
|
||||
|
||||
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(),
|
||||
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 (...) {
|
||||
|
@ -98,10 +98,6 @@ namespace
|
||||
#define SPACING 6
|
||||
#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
|
||||
{
|
||||
SUIT_OverrideCursor aWaitCursor;
|
||||
SMESH::SMESH_IDSource_var aPartToCopy;
|
||||
SMESH::SMESH_IDSource_wrap aPartToCopy;
|
||||
if ( myIdSourceCheck->isChecked())
|
||||
{
|
||||
aPartToCopy = mySelectedObject;
|
||||
aPartToCopy->Register();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -338,13 +335,8 @@ bool SMESHGUI_CopyMeshDlg::ClickOnApply()
|
||||
if( !newMesh->_is_nil() )
|
||||
if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( newMesh ) )
|
||||
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
|
||||
newMesh->UnRegister();
|
||||
#endif
|
||||
} catch (...) {
|
||||
}
|
||||
catch (...) {
|
||||
}
|
||||
|
||||
mySMESHGUI->updateObjBrowser(true);
|
||||
|
@ -354,6 +354,7 @@ SMESHGUI_ExtrusionAlongPathDlg::SMESHGUI_ExtrusionAlongPathDlg( SMESHGUI* theMod
|
||||
connect(SelectPathMeshButton, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||
connect(SelectStartPointButton, 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(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
||||
@ -883,7 +884,7 @@ void SMESHGUI_ExtrusionAlongPathDlg::SelectionIntoArgument()
|
||||
return;
|
||||
|
||||
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
|
||||
if (aNbUnits != 1)
|
||||
return;
|
||||
@ -914,6 +915,8 @@ void SMESHGUI_ExtrusionAlongPathDlg::SelectionIntoArgument()
|
||||
void SMESHGUI_ExtrusionAlongPathDlg::SetEditCurrentArgument()
|
||||
{
|
||||
QToolButton* send = (QToolButton*)sender();
|
||||
if ( sender() == BasePointGrp )
|
||||
send = SelectBasePointButton;
|
||||
if (send != SelectElementsButton &&
|
||||
send != SelectPathMeshButton &&
|
||||
send != SelectStartPointButton &&
|
||||
@ -978,17 +981,15 @@ void SMESHGUI_ExtrusionAlongPathDlg::SetEditCurrentArgument (QToolButton* button
|
||||
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
|
||||
aViewWindow->SetSelectionMode(NodeSelection);
|
||||
|
||||
SMESH_TypeFilter* aMeshOrSubMeshFilter = new SMESH_TypeFilter(SMESH::MESHorSUBMESH);
|
||||
SMESH_TypeFilter* aSmeshGroupFilter = new SMESH_TypeFilter(SMESH::GROUP);
|
||||
SMESH_TypeFilter* aMeshOrSubMeshFilter = new SMESH_TypeFilter(SMESH::IDSOURCE);
|
||||
SMESH_NumberFilter* aVertexFilter = new SMESH_NumberFilter ("GEOM", TopAbs_SHAPE,
|
||||
-1, TopAbs_VERTEX);
|
||||
QList<SUIT_SelectionFilter*> aListOfFilters;
|
||||
if (aMeshOrSubMeshFilter) aListOfFilters.append(aMeshOrSubMeshFilter);
|
||||
if (aSmeshGroupFilter) aListOfFilters.append(aSmeshGroupFilter);
|
||||
if (aVertexFilter) aListOfFilters.append(aVertexFilter);
|
||||
|
||||
mySelectionMgr->installFilter(new SMESH_LogicalFilter
|
||||
(aListOfFilters, SMESH_LogicalFilter::LO_OR));
|
||||
(aListOfFilters, SMESH_LogicalFilter::LO_OR, true));
|
||||
}
|
||||
|
||||
if (myEditCurrentArgument && !myEditCurrentArgument->hasFocus())
|
||||
@ -1277,9 +1278,7 @@ void SMESHGUI_ExtrusionAlongPathDlg::onDisplaySimulation( bool toDisplayPreview
|
||||
SMESH::SMESH_MeshEditor::Extrusion_Error retVal;
|
||||
SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditPreviewer();
|
||||
bool NeedGroups = false;
|
||||
SMESH::ElementType ElemType = SMESH::FACE;
|
||||
if( GetConstructorId() == 0 )
|
||||
ElemType = SMESH::EDGE;
|
||||
SMESH::ElementType ElemType = ( GetConstructorId() == 0 ) ? SMESH::EDGE : SMESH::FACE;
|
||||
if( !MeshCheck->isChecked() ) {
|
||||
aMeshEditor->ExtrusionAlongPathX(anElementsId, myPath, aNodeStart, AnglesGrp->isChecked(),
|
||||
anAngles, LinearAnglesCheck->isChecked(),
|
||||
@ -1293,8 +1292,7 @@ void SMESHGUI_ExtrusionAlongPathDlg::onDisplaySimulation( bool toDisplayPreview
|
||||
BasePointGrp->isChecked(), aBasePoint,
|
||||
NeedGroups, ElemType, retVal);
|
||||
}
|
||||
|
||||
wc.suspend();
|
||||
|
||||
if( retVal == SMESH::SMESH_MeshEditor::EXTR_OK ) {
|
||||
SMESH::MeshPreviewStruct_var aMeshPreviewStruct = aMeshEditor->GetPreviewData();
|
||||
mySimulation->SetData(aMeshPreviewStruct._retn());
|
||||
|
@ -1569,7 +1569,8 @@ void SMESHGUI_FilterTable::updateAdditionalWidget()
|
||||
aCriterion != SMESH::FT_OverConstrainedFace &&
|
||||
aCriterion != SMESH::FT_OverConstrainedVolume)
|
||||
||
|
||||
aCriterion == SMESH::FT_CoplanarFaces);
|
||||
aCriterion == SMESH::FT_CoplanarFaces ||
|
||||
aCriterion == SMESH::FT_EqualNodes);
|
||||
|
||||
if (!myAddWidgets.contains(anItem))
|
||||
{
|
||||
@ -1970,6 +1971,10 @@ void SMESHGUI_FilterTable::onCriterionChanged (const int row, const int col, con
|
||||
{
|
||||
isThresholdEditable = true;
|
||||
}
|
||||
if ( !isThresholdEditable )
|
||||
{
|
||||
aTable->setItem( row, 2, new QTableWidgetItem() );
|
||||
}
|
||||
aTable->setEditable( isThresholdEditable, row, 2);
|
||||
|
||||
|
||||
@ -3323,6 +3328,8 @@ bool SMESHGUI_FilterDlg::createFilter (const int theType)
|
||||
aCriteria[ i ] = aCriterion;
|
||||
}
|
||||
|
||||
if ( !myFilter[ theType ]->_is_nil() )
|
||||
myFilter[ theType ]->UnRegister();
|
||||
myFilter[ theType ] = aFilterMgr->CreateFilter();
|
||||
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)
|
||||
{
|
||||
if ( !filter->_is_nil() )
|
||||
filter->Register();
|
||||
if ( !myFilter[ type ]->_is_nil() )
|
||||
myFilter[ type ]->UnRegister();
|
||||
|
||||
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
|
||||
// Purpose : Insert filter in viewer
|
||||
|
@ -234,6 +234,7 @@ public:
|
||||
|
||||
SMESH::Filter_var GetFilter() const;
|
||||
void SetFilter(SMESH::Filter_var filter, int type);
|
||||
void UnRegisterFilters();
|
||||
|
||||
signals:
|
||||
|
||||
|
@ -38,7 +38,7 @@
|
||||
|
||||
#include <SMESH_TypeFilter.hxx>
|
||||
#include <SMESH_Actor.h>
|
||||
#include <SMESH_ActorUtils.h>
|
||||
//#include <SMESH_ActorUtils.h>
|
||||
#include <SMESH_LogicalFilter.hxx>
|
||||
|
||||
// SALOME GEOM includes
|
||||
@ -921,7 +921,7 @@ bool SMESHGUI_GroupDlg::onApply()
|
||||
QStringList anEntryList;
|
||||
|
||||
SMESH::SMESH_GroupBase_var resultGroup;
|
||||
bool isCreation;
|
||||
bool isCreation, isConversion = false;
|
||||
|
||||
if (myGrpTypeId == 0) // standalone
|
||||
{
|
||||
@ -940,8 +940,9 @@ bool SMESHGUI_GroupDlg::onApply()
|
||||
else
|
||||
myGroup = myMesh->ConvertToStandalone( myGroupOnGeom );
|
||||
|
||||
myGroupOnGeom = SMESH::SMESH_GroupOnGeom::_nil();
|
||||
myGroupOnGeom = SMESH::SMESH_GroupOnGeom::_nil();
|
||||
myGroupOnFilter = SMESH::SMESH_GroupOnFilter::_nil();
|
||||
isConversion = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1150,7 +1151,17 @@ bool SMESHGUI_GroupDlg::onApply()
|
||||
resultGroup->SetName(myName->text().toLatin1().data());
|
||||
|
||||
if ( aMeshGroupSO )
|
||||
{
|
||||
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());
|
||||
QColor c;
|
||||
int delta;
|
||||
@ -1160,16 +1171,17 @@ bool SMESHGUI_GroupDlg::onApply()
|
||||
case grpBallSelection: anActor->SetBallColor( aColor.R, aColor.G, aColor.B ); break;
|
||||
case grpEdgeSelection: anActor->SetEdgeColor( aColor.R, aColor.G, aColor.B ); break;
|
||||
case grpVolumeSelection:
|
||||
SMESH::GetColor("SMESH", "volume_color", c , delta, "255,0,170|-100");
|
||||
anActor->SetVolumeColor( aColor.R, aColor.G, aColor.B, delta ); break;
|
||||
break;
|
||||
SMESH::GetColor("SMESH", "volume_color", c , delta, "255,0,170|-100");
|
||||
anActor->SetVolumeColor( aColor.R, aColor.G, aColor.B, delta ); break;
|
||||
break;
|
||||
case grpFaceSelection:
|
||||
default:
|
||||
SMESH::GetColor("SMESH", "fill_color", c , delta, "0,170,255|-100");
|
||||
anActor->SetSufaceColor( aColor.R, aColor.G, aColor.B, delta ); break;
|
||||
break;
|
||||
SMESH::GetColor("SMESH", "fill_color", c , delta, "0,170,255|-100");
|
||||
anActor->SetSufaceColor( aColor.R, aColor.G, aColor.B, delta ); break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
SMESHGUI::Modified();
|
||||
mySMESHGUI->updateObjBrowser(true);
|
||||
@ -1193,6 +1205,8 @@ void SMESHGUI_GroupDlg::onOK()
|
||||
if ( onApply() )
|
||||
reject();
|
||||
setIsApplyAndClose( false );
|
||||
|
||||
if ( myFilterDlg ) myFilterDlg->UnRegisterFilters();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
@ -2202,6 +2216,8 @@ void SMESHGUI_GroupDlg::reject()
|
||||
mySMESHGUI->ResetState();
|
||||
|
||||
QDialog::reject();
|
||||
|
||||
if ( myFilterDlg ) myFilterDlg->UnRegisterFilters();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
|
@ -88,7 +88,7 @@ void SMESHGUI_GenericHypothesisCreator::create( SMESH::SMESH_Hypothesis_ptr init
|
||||
create( false, theHypName, parent, obj, slot );
|
||||
}
|
||||
|
||||
void SMESHGUI_GenericHypothesisCreator::create( bool isAlgo,
|
||||
void SMESHGUI_GenericHypothesisCreator::create( bool isAlgo,
|
||||
const QString& theHypName,
|
||||
QWidget* theParent, QObject* obj, const QString& slot )
|
||||
{
|
||||
@ -100,27 +100,22 @@ void SMESHGUI_GenericHypothesisCreator::create( bool isAlgo,
|
||||
if (isAlgo) {
|
||||
SMESH::SMESH_Hypothesis_var anAlgo =
|
||||
SMESH::CreateHypothesis( hypType(), theHypName, isAlgo );
|
||||
if (!CORBA::is_nil(anAlgo))
|
||||
anAlgo->UnRegister();
|
||||
anAlgo.out(); // avoid unused variable warning
|
||||
}
|
||||
else {
|
||||
SMESH::SMESH_Hypothesis_var aHypothesis =
|
||||
SMESH::CreateHypothesis( hypType(), theHypName, false );
|
||||
editHypothesis( aHypothesis.in(), theHypName, theParent, obj, slot );
|
||||
if (!CORBA::is_nil(aHypothesis))
|
||||
aHypothesis->UnRegister();
|
||||
}
|
||||
}
|
||||
|
||||
void SMESHGUI_GenericHypothesisCreator::edit( SMESH::SMESH_Hypothesis_ptr theHypothesis,
|
||||
const QString& theHypName,
|
||||
const QString& theHypName,
|
||||
QWidget* theParent, QObject* obj, const QString& slot )
|
||||
{
|
||||
if( CORBA::is_nil( theHypothesis ) )
|
||||
return;
|
||||
|
||||
MESSAGE("Edition of hypothesis");
|
||||
|
||||
myIsCreate = false;
|
||||
|
||||
editHypothesis( theHypothesis, theHypName, theParent, obj, slot );
|
||||
|
@ -466,14 +466,6 @@ bool SMESHGUI_Make2DFrom3DOp::compute2DMesh( QStringList& theEntryList )
|
||||
if ( !newMesh->_is_nil() ) {
|
||||
if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( newMesh ) )
|
||||
theEntryList.append( aSObject->GetID().c_str() );
|
||||
#ifdef WITHGENERICOBJ
|
||||
newMesh->UnRegister();
|
||||
#endif
|
||||
}
|
||||
if ( !newGrp->_is_nil() ) {
|
||||
#ifdef WITHGENERICOBJ
|
||||
newGrp->UnRegister();
|
||||
#endif
|
||||
}
|
||||
ok = true;
|
||||
|
||||
|
@ -519,8 +519,8 @@ void SMESHGUI_MinDistance::secondEdited()
|
||||
void SMESHGUI_MinDistance::compute()
|
||||
{
|
||||
SUIT_OverrideCursor wc;
|
||||
SMESH::SMESH_IDSource_var s1;
|
||||
SMESH::SMESH_IDSource_var s2;
|
||||
SMESH::SMESH_IDSource_wrap s1;
|
||||
SMESH::SMESH_IDSource_wrap s2;
|
||||
bool isOrigin = mySecond->checkedId() == OriginTgt;
|
||||
|
||||
// process first target
|
||||
@ -538,6 +538,7 @@ void SMESHGUI_MinDistance::compute()
|
||||
}
|
||||
else {
|
||||
s1 = myFirstSrc;
|
||||
s1->Register();
|
||||
}
|
||||
}
|
||||
|
||||
@ -556,6 +557,7 @@ void SMESHGUI_MinDistance::compute()
|
||||
}
|
||||
else {
|
||||
s2 = mySecondSrc;
|
||||
s2->Register();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1035,14 +1037,17 @@ void SMESHGUI_BoundingBox::compute()
|
||||
}
|
||||
else {
|
||||
srcList->length( mySrc.count() );
|
||||
for( int i = 0; i < mySrc.count(); i++ )
|
||||
for( int i = 0; i < mySrc.count(); i++ ) {
|
||||
srcList[i] = mySrc[i];
|
||||
mySrc[i]->Register();
|
||||
}
|
||||
}
|
||||
if ( srcList->length() > 0 ) {
|
||||
// compute bounding box
|
||||
int precision = SMESHGUI::resourceMgr()->integerValue( "SMESH", "length_precision", 6 );
|
||||
SMESH::Measurements_var measure = SMESHGUI::GetSMESHGen()->CreateMeasurements();
|
||||
SMESH::Measure result = measure->BoundingBox( srcList.in() );
|
||||
SALOME::UnRegister( srcList );
|
||||
measure->UnRegister();
|
||||
myXmin->setText( QString::number( result.minX, 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();
|
||||
}
|
||||
|
||||
/*!
|
||||
\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
|
||||
\brief Centralized dialog box for the measurements
|
||||
@ -1105,12 +1323,17 @@ SMESHGUI_MeasureDlg::SMESHGUI_MeasureDlg( QWidget* parent, int page )
|
||||
// min distance
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
QPushButton* okBtn = new QPushButton( tr( "SMESH_BUT_OK" ), this );
|
||||
@ -1134,7 +1357,19 @@ SMESHGUI_MeasureDlg::SMESHGUI_MeasureDlg( QWidget* parent, int page )
|
||||
l->addStretch();
|
||||
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( helpBtn, SIGNAL( clicked() ), this, SLOT( help() ) );
|
||||
@ -1195,7 +1430,10 @@ void SMESHGUI_MeasureDlg::updateSelection()
|
||||
myMinDist->updateSelection();
|
||||
else if ( myTabWidget->currentIndex() == BoundingBox )
|
||||
myBndBox->updateSelection();
|
||||
|
||||
else {
|
||||
myBndBox->erasePreview();
|
||||
myBasicProps->updateSelection();
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -1203,9 +1441,16 @@ void SMESHGUI_MeasureDlg::updateSelection()
|
||||
*/
|
||||
void SMESHGUI_MeasureDlg::help()
|
||||
{
|
||||
SMESH::ShowHelpFile( myTabWidget->currentIndex() == MinDistance ?
|
||||
"measurements_page.html#min_distance_anchor" :
|
||||
"measurements_page.html#bounding_box_anchor" );
|
||||
QString aHelpFile;
|
||||
if ( myTabWidget->currentIndex() == MinDistance ) {
|
||||
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()
|
||||
{
|
||||
myBasicProps->deactivate();
|
||||
myMinDist->deactivate();
|
||||
myBndBox->deactivate();
|
||||
myTabWidget->setEnabled( false );
|
||||
|
@ -32,6 +32,7 @@
|
||||
class QButtonGroup;
|
||||
class QLineEdit;
|
||||
class QTabWidget;
|
||||
class QGroupBox;
|
||||
class SUIT_SelectionFilter;
|
||||
class SALOME_Actor;
|
||||
class SMESH_Actor;
|
||||
@ -101,9 +102,9 @@ public:
|
||||
|
||||
void updateSelection();
|
||||
void deactivate();
|
||||
void erasePreview();
|
||||
|
||||
private:
|
||||
void erasePreview();
|
||||
void displayPreview();
|
||||
void createPreview( double, double, double, double, double, double );
|
||||
|
||||
@ -135,6 +136,37 @@ private:
|
||||
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
|
||||
{
|
||||
Q_OBJECT;
|
||||
@ -145,7 +177,10 @@ public:
|
||||
//! Measurement type
|
||||
enum {
|
||||
MinDistance, //!< minimum distance
|
||||
BoundingBox //!< bounding box
|
||||
BoundingBox, //!< bounding box
|
||||
Length, //!< length
|
||||
Area, //!< area
|
||||
Volume //!< volume
|
||||
};
|
||||
|
||||
SMESHGUI_MeasureDlg( QWidget* = 0, int = MinDistance );
|
||||
@ -167,6 +202,7 @@ private:
|
||||
QTabWidget* myTabWidget;
|
||||
SMESHGUI_MinDistance* myMinDist;
|
||||
SMESHGUI_BoundingBox* myBndBox;
|
||||
SMESHGUI_BasicProperties* myBasicProps;
|
||||
};
|
||||
|
||||
#endif // SMESHGUI_MEASUREMENTS_H
|
||||
|
@ -2235,7 +2235,7 @@ void SMESHGUI_AddInfo::meshInfo( SMESH::SMESH_Mesh_ptr mesh, QTreeWidgetItem* pa
|
||||
{
|
||||
// type
|
||||
GEOM::GEOM_Object_var shape = mesh->GetShapeToMesh();
|
||||
SMESH::MedFileInfo* inf = mesh->GetMEDFileInfo();
|
||||
SMESH::MedFileInfo_var inf = mesh->GetMEDFileInfo();
|
||||
QTreeWidgetItem* typeItem = createItem( parent, Bold );
|
||||
typeItem->setText( 0, tr( "TYPE" ) );
|
||||
if ( !CORBA::is_nil( shape ) ) {
|
||||
@ -3401,6 +3401,7 @@ void SMESHGUI_CtrlInfo::computeAspectRatio()
|
||||
anItem->attach( myPlot );
|
||||
myPlot->replot();
|
||||
}
|
||||
delete aHistogram;
|
||||
}
|
||||
|
||||
void SMESHGUI_CtrlInfo::computeAspectRatio3D()
|
||||
@ -3417,6 +3418,7 @@ void SMESHGUI_CtrlInfo::computeAspectRatio3D()
|
||||
anItem->attach( myPlot3D );
|
||||
myPlot3D->replot();
|
||||
}
|
||||
delete aHistogram;
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -3518,16 +3520,29 @@ SMESHGUI_CtrlInfoDlg::SMESHGUI_CtrlInfoDlg( QWidget* parent )
|
||||
okBtn->setAutoDefault( true );
|
||||
okBtn->setDefault( true );
|
||||
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->setSpacing( SPACING );
|
||||
l->addWidget( myCtrlInfo, 0, 0, 1, 3 );
|
||||
l->addWidget( okBtn, 1, 1 );
|
||||
l->setColumnStretch( 0, 5 );
|
||||
l->setColumnStretch( 2, 5 );
|
||||
l->addWidget( myCtrlInfo );
|
||||
l->addLayout( btnLayout );
|
||||
|
||||
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( SignalCloseAllDialogs() ), this, SLOT( reject() ) );
|
||||
|
||||
@ -3606,4 +3621,49 @@ void SMESHGUI_CtrlInfoDlg::deactivate()
|
||||
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");
|
||||
}
|
||||
|
@ -401,6 +401,8 @@ private slots:
|
||||
void activate();
|
||||
void deactivate();
|
||||
void updateSelection();
|
||||
void help();
|
||||
void dump();
|
||||
|
||||
private:
|
||||
SMESHGUI_CtrlInfo* myCtrlInfo;
|
||||
|
@ -75,10 +75,6 @@
|
||||
#include <SALOMEconfig.h>
|
||||
#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
|
||||
@ -1103,14 +1099,10 @@ void SMESHGUI_MeshOp::createHypothesis(const int theDim,
|
||||
// Call hypothesis creation server method (without GUI)
|
||||
SMESH::SMESH_Hypothesis_var aHyp =
|
||||
SMESH::CreateHypothesis(theTypeName, aHypName, false);
|
||||
#ifdef WITHGENERICOBJ
|
||||
if (!CORBA::is_nil(aHyp))
|
||||
aHyp->UnRegister();
|
||||
#endif
|
||||
} else {
|
||||
aHyp.out();
|
||||
}
|
||||
else {
|
||||
// Get hypotheses creator client (GUI)
|
||||
// BUG 0020378
|
||||
//SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator(theTypeName);
|
||||
SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator(theTypeName);
|
||||
|
||||
// Create hypothesis
|
||||
@ -1179,10 +1171,7 @@ void SMESHGUI_MeshOp::createHypothesis(const int theDim,
|
||||
else {
|
||||
SMESH::SMESH_Hypothesis_var aHyp =
|
||||
SMESH::CreateHypothesis(theTypeName, aHypName, false);
|
||||
#ifdef WITHGENERICOBJ
|
||||
if (!CORBA::is_nil(aHyp))
|
||||
aHyp->UnRegister();
|
||||
#endif
|
||||
aHyp.out();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1653,13 +1642,6 @@ bool SMESHGUI_MeshOp::createMesh( QString& theMess, QStringList& theEntryList )
|
||||
if ( !anAlgoVar->_is_nil() )
|
||||
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;
|
||||
}
|
||||
@ -1741,8 +1723,9 @@ bool SMESHGUI_MeshOp::createSubMesh( QString& theMess, QStringList& theEntryList
|
||||
GEOM::GEOM_Object_wrap aGroupVar = op->CreateGroup(mainGeom, aGroupType);
|
||||
op->UnionList(aGroupVar, aSeq);
|
||||
|
||||
if (op->IsDone()) {
|
||||
aGeomVar = aGroupVar.in();
|
||||
if (op->IsDone())
|
||||
{
|
||||
aGeomVar = GEOM::GEOM_Object::_duplicate( aGroupVar.in() );
|
||||
|
||||
// publish the GEOM group in study
|
||||
QString aNewGeomGroupName ("Auto_group_for_");
|
||||
@ -1918,32 +1901,25 @@ SMESH::SMESH_Hypothesis_var SMESHGUI_MeshOp::getAlgo( const int theDim )
|
||||
if (aHypData)
|
||||
{
|
||||
QString aClientLibName = aHypData->ClientLibName;
|
||||
if (aClientLibName == "")
|
||||
if ( aClientLibName.isEmpty() )
|
||||
{
|
||||
// Call hypothesis creation server method (without GUI)
|
||||
SMESH::SMESH_Hypothesis_var aHyp =
|
||||
SMESH::CreateHypothesis(aHypName, aHypName, true);
|
||||
#ifdef WITHGENERICOBJ
|
||||
if (!CORBA::is_nil(aHyp))
|
||||
aHyp->UnRegister();
|
||||
#endif
|
||||
aHyp.out();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Get hypotheses creator client (GUI)
|
||||
// BUG 0020378
|
||||
SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator(aHypName);
|
||||
|
||||
// Create algorithm
|
||||
if (aCreator)
|
||||
aCreator->create(true, aHypName, myDlg, 0, QString::null );
|
||||
aCreator->create( true, aHypName, myDlg, 0, QString::null );
|
||||
else {
|
||||
SMESH::SMESH_Hypothesis_var aHyp =
|
||||
SMESH::CreateHypothesis(aHypName, aHypName, true);
|
||||
#ifdef WITHGENERICOBJ
|
||||
if (!CORBA::is_nil(aHyp))
|
||||
aHyp->UnRegister();
|
||||
#endif
|
||||
aHyp.out();
|
||||
}
|
||||
}
|
||||
QStringList tmpList;
|
||||
|
@ -1212,7 +1212,7 @@ bool SMESHGUI_CuttingOfQuadsDlg::process (SMESH::SMESH_MeshEditor_ptr theEditor,
|
||||
{
|
||||
if ( hasObj )
|
||||
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 );
|
||||
return true;
|
||||
}
|
||||
@ -1466,9 +1466,11 @@ bool SMESHGUI_CuttingIntoTetraDlg::process (SMESH::SMESH_MeshEditor_ptr theEdito
|
||||
const SMESH::long_array& theIds,
|
||||
SMESH::SMESH_IDSource_ptr theObj)
|
||||
{
|
||||
SMESH::SMESH_IDSource_var obj = theObj;
|
||||
SMESH::SMESH_IDSource_wrap obj = theObj;
|
||||
if ( CORBA::is_nil( obj ))
|
||||
obj = theEditor->MakeIDSource( theIds, myEntityType ? SMESH::VOLUME : SMESH::FACE );
|
||||
else
|
||||
obj->Register();
|
||||
try {
|
||||
theEditor->SplitVolumesIntoTetra( obj, myGroupChoice->checkedId()+1 );
|
||||
}
|
||||
@ -1476,5 +1478,8 @@ bool SMESHGUI_CuttingIntoTetraDlg::process (SMESH::SMESH_MeshEditor_ptr theEdito
|
||||
SalomeApp_Tools::QtCatchCorbaException( S_ex );
|
||||
return false;
|
||||
}
|
||||
catch(...) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -85,9 +85,6 @@ enum { MOVE_ELEMS_BUTTON = 0, COPY_ELEMS_BUTTON, MAKE_MESH_BUTTON }; //!< action
|
||||
#define SPACING 8
|
||||
#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()
|
||||
@ -494,12 +491,6 @@ bool SMESHGUI_RotationDlg::ClickOnApply()
|
||||
if (!mesh->_is_nil()) {
|
||||
if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( mesh ) )
|
||||
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( _PTR(SObject) aSObject = SMESH::ObjectToSObject( mesh ) )
|
||||
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;
|
||||
|
@ -100,10 +100,6 @@ private:
|
||||
#define SPACING 6
|
||||
#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()
|
||||
// purpose :
|
||||
@ -489,8 +485,9 @@ bool SMESHGUI_ScaleDlg::ClickOnApply()
|
||||
}
|
||||
else {
|
||||
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() );
|
||||
aMeshEditor->Scale(aMeshEditor->MakeIDSource(anElementsId, SMESH::ALL), aPoint, aScaleFact, false);
|
||||
aMeshEditor->Scale( src, aPoint, aScaleFact, false);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -505,8 +502,9 @@ bool SMESHGUI_ScaleDlg::ClickOnApply()
|
||||
}
|
||||
else {
|
||||
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());
|
||||
groups = aMeshEditor->ScaleMakeGroups(aMeshEditor->MakeIDSource(anElementsId, SMESH::ALL), aPoint, aScaleFact);
|
||||
groups = aMeshEditor->ScaleMakeGroups( src, aPoint, aScaleFact);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@ -519,8 +517,9 @@ bool SMESHGUI_ScaleDlg::ClickOnApply()
|
||||
}
|
||||
else {
|
||||
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());
|
||||
aMeshEditor->Scale(aMeshEditor->MakeIDSource(anElementsId, SMESH::ALL), aPoint, aScaleFact, true);
|
||||
aMeshEditor->Scale( src, aPoint, aScaleFact, true);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -536,27 +535,16 @@ bool SMESHGUI_ScaleDlg::ClickOnApply()
|
||||
aName.toLatin1().data());
|
||||
if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( mesh ) )
|
||||
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 {
|
||||
SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[0]->GetMeshEditor();
|
||||
myMeshes[0]->SetParameters(aParameters.join( ":" ).toLatin1().constData());
|
||||
mesh = aMeshEditor->ScaleMakeMesh(aMeshEditor->MakeIDSource(anElementsId, SMESH::ALL), aPoint, aScaleFact, makeGroups,
|
||||
LineEditNewMesh->text().toLatin1().data());
|
||||
SMESH::SMESH_IDSource_wrap src = aMeshEditor->MakeIDSource(anElementsId, SMESH::ALL);
|
||||
mesh = aMeshEditor->ScaleMakeMesh( src, aPoint, aScaleFact, makeGroups,
|
||||
LineEditNewMesh->text().toLatin1().data());
|
||||
if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( mesh ) )
|
||||
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;
|
||||
}
|
||||
@ -1158,7 +1146,8 @@ void SMESHGUI_ScaleDlg::onDisplaySimulation( bool toDisplayPreview ) {
|
||||
}
|
||||
else {
|
||||
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();
|
||||
}
|
||||
setSimulationPreview(aMeshPreviewStruct);
|
||||
|
@ -85,10 +85,6 @@ enum { MOVE_ELEMS_BUTTON = 0, COPY_ELEMS_BUTTON, MAKE_MESH_BUTTON }; //!< action
|
||||
#define SPACING 6
|
||||
#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()
|
||||
// purpose :
|
||||
@ -556,12 +552,6 @@ bool SMESHGUI_SymmetryDlg::ClickOnApply()
|
||||
aName.toLatin1().data());
|
||||
if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( mesh ) )
|
||||
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 {
|
||||
SMESH::SMESH_MeshEditor_var aMeshEditor = myMeshes[0]->GetMeshEditor();
|
||||
@ -570,12 +560,6 @@ bool SMESHGUI_SymmetryDlg::ClickOnApply()
|
||||
LineEditNewMesh->text().toLatin1().data());
|
||||
if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( mesh ) )
|
||||
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;
|
||||
|
@ -559,11 +559,6 @@ bool SMESHGUI_TranslationDlg::ClickOnApply()
|
||||
aName.toLatin1().data());
|
||||
if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( mesh ) )
|
||||
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 {
|
||||
@ -573,11 +568,6 @@ bool SMESHGUI_TranslationDlg::ClickOnApply()
|
||||
LineEditNewMesh->text().toLatin1().data());
|
||||
if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( mesh ) )
|
||||
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;
|
||||
}
|
||||
|
@ -215,10 +215,10 @@ namespace SMESH
|
||||
SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>
|
||||
(SUIT_Session::session()->activeApplication());
|
||||
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() );
|
||||
if ( study && !IOR.isEmpty() )
|
||||
res = study->studyDS()->FindObjectIOR( IOR.toLatin1().constData() );
|
||||
if ( study && strlen( ior ) > 0 )
|
||||
res = study->studyDS()->FindObjectIOR( ior.in() );
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
@ -35,6 +35,7 @@
|
||||
|
||||
// SALOME KERNEL includes
|
||||
#include <SALOMEDSClient_definitions.hxx>
|
||||
#include <SALOME_GenericObj_wrap.hxx>
|
||||
|
||||
// SALOME GUI includes
|
||||
#include <SALOME_InteractiveObject.hxx>
|
||||
@ -43,6 +44,9 @@
|
||||
//OCC includes
|
||||
#include <gp_XYZ.hxx>
|
||||
|
||||
#include <SALOMEconfig.h>
|
||||
#include CORBA_CLIENT_HEADER(SMESH_Mesh)
|
||||
|
||||
class SUIT_ViewWindow;
|
||||
class SUIT_Desktop;
|
||||
class SUIT_Study;
|
||||
@ -176,6 +180,10 @@ SMESHGUI_EXPORT
|
||||
SMESHGUI_EXPORT
|
||||
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
|
||||
|
@ -559,6 +559,22 @@
|
||||
<source>ICON_SPLIT_TO_TETRA</source>
|
||||
<translation>split_into_tetra.png</translation>
|
||||
</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>
|
||||
<source>ICON_MEASURE_MIN_DIST</source>
|
||||
<translation>mesh_min_dist.png</translation>
|
||||
|
@ -712,6 +712,46 @@
|
||||
<source>TOP_MEASURE_BND_BOX</source>
|
||||
<translation>Bounding box</translation>
|
||||
</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>
|
||||
<source>MEN_MOVE</source>
|
||||
<translation>Move Node</translation>
|
||||
@ -1649,6 +1689,10 @@ Do you want to continue ?</translation>
|
||||
<source>SMESH_FACE</source>
|
||||
<translation>Face</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>SMESH_FACES</source>
|
||||
<translation>Faces</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>SMESH_FEATUREANGLE</source>
|
||||
<translation>Feature Angle</translation>
|
||||
@ -2655,6 +2699,10 @@ Consider saving your work before application crash</translation>
|
||||
<source>SMESH_VOLUME</source>
|
||||
<translation>Volume</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>SMESH_VOLUMES</source>
|
||||
<translation>Volumes</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>SMESH_WARNING</source>
|
||||
<translation>Warning</translation>
|
||||
@ -2717,14 +2765,15 @@ Consider saving your work before application crash</translation>
|
||||
</message>
|
||||
<message>
|
||||
<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).
|
||||
Please check preferences of Mesh module.
|
||||
<translation>No automatic update of the presentation has been done:
|
||||
New mesh size (%1 elements) exceeds current size limit of automatic update (%2 elements).
|
||||
</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>SMESH_WRN_SIZE_INC_LIMIT_EXCEEDED</source>
|
||||
<translation>New mesh sise (%1 elements) exceeds current size limit (%2 elements).
|
||||
Not all mesh elements are shown. Please check preferences of Mesh module.
|
||||
<translation>New mesh size (%1 elements) exceeds current size limit of automatic update (%2 elements).
|
||||
The following elements are not shown: %3.
|
||||
Use Display Entity menu command to show them.
|
||||
</translation>
|
||||
</message>
|
||||
<message>
|
||||
@ -7247,6 +7296,18 @@ as they are of improper type:
|
||||
<source>CTRL_INFO</source>
|
||||
<translation>Quality Info</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>BUT_DUMP_MESH</source>
|
||||
<translation>&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>
|
||||
<name>SMESHGUI_MinDistance</name>
|
||||
@ -7287,6 +7348,33 @@ as they are of improper type:
|
||||
<translation>Distance</translation>
|
||||
</message>
|
||||
</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>
|
||||
<name>SMESHGUI_CopyMeshDlg</name>
|
||||
<message>
|
||||
@ -7316,6 +7404,10 @@ as they are of improper type:
|
||||
<source>BND_BOX</source>
|
||||
<translation>Bounding Box</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>BASIC_PROPERTIES</source>
|
||||
<translation>Basic Properties</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>SMESHGUI_BoundingBox</name>
|
||||
|
@ -748,6 +748,46 @@
|
||||
<source>TOP_MEASURE_BND_BOX</source>
|
||||
<translation>Boîte englobante</translation>
|
||||
</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>
|
||||
<source>MEN_MOVE</source>
|
||||
<translation>Déplacer un nœud</translation>
|
||||
@ -1677,6 +1717,10 @@ Voulez-vous continuer ?</translation>
|
||||
<source>SMESH_FACE</source>
|
||||
<translation>Face</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>SMESH_FACES</source>
|
||||
<translation>Faces</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>SMESH_FEATUREANGLE</source>
|
||||
<translation>Montrer l'angle</translation>
|
||||
@ -2663,6 +2707,10 @@ Enregistrez votre travail avant que l'application se plante</translation>
|
||||
<source>SMESH_VOLUME</source>
|
||||
<translation>Volume</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>SMESH_VOLUMES</source>
|
||||
<translation>Volumes</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>SMESH_WARNING</source>
|
||||
<translation>Avertissement</translation>
|
||||
@ -2725,14 +2773,16 @@ Enregistrez votre travail avant que l'application se plante</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>SMESH_WRN_SIZE_LIMIT_EXCEEDED</source>
|
||||
<translation>La présentation n'a pas été 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'a pas été 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.
|
||||
</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>SMESH_WRN_SIZE_INC_LIMIT_EXCEEDED</source>
|
||||
<translation type="unfinished">New mesh sise (%1 elements) exceeds current size limit (%2 elements).
|
||||
Not all mesh elements are shown. Please check preferences of Mesh module.
|
||||
<translation>La nouvelle taille de maillage (%1 éléments) dépasse l'actuelle taille limite de la mise à jour automatique (%2 éléments).
|
||||
Les éléments suivants ne sont pas affichés: %3.
|
||||
Utilisez le menu "Visualiser une entité" pour les afficher.
|
||||
</translation>
|
||||
</message>
|
||||
<message>
|
||||
@ -7228,6 +7278,18 @@ en raison de leurs types incompatibles:
|
||||
</context>
|
||||
<context>
|
||||
<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">&Dump</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>CTRL_INFO</source>
|
||||
<translation type="unfinished">Quality Info</translation>
|
||||
@ -7272,6 +7334,33 @@ en raison de leurs types incompatibles:
|
||||
<translation>Distance</translation>
|
||||
</message>
|
||||
</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>
|
||||
<name>SMESHGUI_CopyMeshDlg</name>
|
||||
<message>
|
||||
@ -7301,6 +7390,10 @@ en raison de leurs types incompatibles:
|
||||
<source>BND_BOX</source>
|
||||
<translation>Boîte englobante</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>BASIC_PROPERTIES</source>
|
||||
<translation type="unfinished">Basic Properties</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>SMESHGUI_BoundingBox</name>
|
||||
|
7003
src/SMESHGUI/SMESH_msg_ja.ts
Normal file
@ -210,7 +210,7 @@ namespace // Utils used in SMESH_ElementSearcherImpl::FindElementsByPoint()
|
||||
void getElementsInSphere ( const gp_XYZ& center,
|
||||
const double radius, TIDSortedElemSet& foundElems);
|
||||
size_t getSize() { return std::max( _size, _elements.size() ); }
|
||||
~ElementBndBoxTree();
|
||||
virtual ~ElementBndBoxTree();
|
||||
|
||||
protected:
|
||||
ElementBndBoxTree():_size(0) {}
|
||||
@ -410,6 +410,10 @@ namespace // Utils used in SMESH_ElementSearcherImpl::FindElementsByPoint()
|
||||
*/
|
||||
//=======================================================================
|
||||
|
||||
SMESH_ElementSearcher::~SMESH_ElementSearcher()
|
||||
{
|
||||
}
|
||||
|
||||
struct SMESH_ElementSearcherImpl: public SMESH_ElementSearcher
|
||||
{
|
||||
SMDS_Mesh* _mesh;
|
||||
@ -423,7 +427,7 @@ struct SMESH_ElementSearcherImpl: public SMESH_ElementSearcher
|
||||
|
||||
SMESH_ElementSearcherImpl( SMDS_Mesh& mesh, SMDS_ElemIteratorPtr elemIt=SMDS_ElemIteratorPtr())
|
||||
: _mesh(&mesh),_meshPartIt(elemIt),_ebbTree(0),_nodeSearcher(0),_tolerance(-1),_outerFacesFound(false) {}
|
||||
~SMESH_ElementSearcherImpl()
|
||||
virtual ~SMESH_ElementSearcherImpl()
|
||||
{
|
||||
if ( _ebbTree ) delete _ebbTree; _ebbTree = 0;
|
||||
if ( _nodeSearcher ) delete _nodeSearcher; _nodeSearcher = 0;
|
||||
|
@ -87,6 +87,7 @@ struct SMESH_ElementSearcher
|
||||
* \brief Find out if the given point is out of closed 2D mesh.
|
||||
*/
|
||||
virtual TopAbs_State GetPointState(const gp_Pnt& point) = 0;
|
||||
virtual ~SMESH_ElementSearcher();
|
||||
};
|
||||
|
||||
namespace SMESH_MeshAlgos
|
||||
|
@ -49,6 +49,7 @@ public:
|
||||
// Constructor. limit must be provided at tree root construction.
|
||||
// limit will be deleted by SMESH_Octree
|
||||
SMESH_Octree (SMESH_TreeLimit* limit=0);
|
||||
virtual ~SMESH_Octree() {};
|
||||
|
||||
// Compute the bigger dimension of my box
|
||||
double maxSize() const;
|
||||
|
@ -327,29 +327,27 @@ void SMESH_OctreeNode::FindCoincidentNodes ( TIDSortedNodeSet* theSetOfNodes,
|
||||
* \param precision - Precision used
|
||||
*/
|
||||
//======================================================================================
|
||||
void SMESH_OctreeNode::FindCoincidentNodes (const SMDS_MeshNode * Node,
|
||||
TIDSortedNodeSet* SetOfNodes,
|
||||
void SMESH_OctreeNode::FindCoincidentNodes (const SMDS_MeshNode * Node,
|
||||
TIDSortedNodeSet* SetOfNodes,
|
||||
list<const SMDS_MeshNode*>* Result,
|
||||
const double precision)
|
||||
const double precision)
|
||||
{
|
||||
gp_XYZ p(Node->X(), Node->Y(), Node->Z());
|
||||
bool isInsideBool = isInside(p, precision);
|
||||
gp_Pnt p1 (Node->X(), Node->Y(), Node->Z());
|
||||
bool isInsideBool = isInside( p1.XYZ(), precision );
|
||||
|
||||
if (isInsideBool)
|
||||
{
|
||||
// I'm only looking in the leaves, since all the nodes are stored there.
|
||||
if (isLeaf())
|
||||
{
|
||||
gp_Pnt p1 (Node->X(), Node->Y(), Node->Z());
|
||||
|
||||
TIDSortedNodeSet myNodesCopy = myNodes;
|
||||
TIDSortedNodeSet::iterator it = myNodesCopy.begin();
|
||||
double tol2 = precision * precision;
|
||||
TIDSortedNodeSet::iterator it = myNodes.begin();
|
||||
const double tol2 = precision * precision;
|
||||
bool squareBool;
|
||||
|
||||
while (it != myNodesCopy.end())
|
||||
while (it != myNodes.end())
|
||||
{
|
||||
const SMDS_MeshNode* n2 = *it;
|
||||
squareBool = false;
|
||||
// We're only looking at nodes with a superior Id.
|
||||
// JFA: Why?
|
||||
//if (Node->GetID() < n2->GetID())
|
||||
@ -364,14 +362,13 @@ void SMESH_OctreeNode::FindCoincidentNodes (const SMDS_MeshNode * Node,
|
||||
{
|
||||
Result->insert(Result->begin(), n2);
|
||||
SetOfNodes->erase( n2 );
|
||||
myNodes.erase( n2 );
|
||||
myNodes.erase( *it++ ); // it++ goes forward and returns it's previous position
|
||||
}
|
||||
}
|
||||
//myNodesCopy.erase( it );
|
||||
//it = myNodesCopy.begin();
|
||||
it++;
|
||||
if ( !squareBool )
|
||||
it++;
|
||||
}
|
||||
if (Result->size() > 0)
|
||||
if ( !Result->empty() )
|
||||
myNodes.erase(Node); // JFA: for bug 0020185
|
||||
}
|
||||
else
|
||||
|
@ -19,257 +19,260 @@
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
|
||||
// SMESH SMESH_Tree : tree implementation
|
||||
// File : SMESH_Tree.hxx
|
||||
// Created : Tue Jan 16 16:00:00 2007
|
||||
// Author : Nicolas Geimer & Aurélien Motteux (OCC)
|
||||
// Module : SMESH
|
||||
//
|
||||
#ifndef _SMESH_Tree_HXX_
|
||||
#define _SMESH_Tree_HXX_
|
||||
|
||||
#include "SMESH_Utils.hxx"
|
||||
|
||||
//================================================================================
|
||||
// Data limiting the tree height
|
||||
struct SMESH_TreeLimit {
|
||||
// MaxLevel of the Tree
|
||||
int myMaxLevel;
|
||||
// Minimal size of the Box
|
||||
double myMinBoxSize;
|
||||
|
||||
// Default:
|
||||
// maxLevel-> 8^8 = 16777216 terminal trees at most
|
||||
// minSize -> box size not checked
|
||||
SMESH_TreeLimit(int maxLevel=8, double minSize=0.):myMaxLevel(maxLevel),myMinBoxSize(minSize) {}
|
||||
virtual ~SMESH_TreeLimit() {} // it can be inherited
|
||||
};
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Base class for 2D and 3D trees
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
template< class BND_BOX,
|
||||
int NB_CHILDREN>
|
||||
class SMESH_Tree
|
||||
{
|
||||
public:
|
||||
|
||||
typedef BND_BOX box_type;
|
||||
|
||||
// Constructor. limit must be provided at tree root construction.
|
||||
// limit will be deleted by SMESH_Tree
|
||||
SMESH_Tree (SMESH_TreeLimit* limit=0);
|
||||
|
||||
// Destructor
|
||||
virtual ~SMESH_Tree ();
|
||||
|
||||
// Compute the Tree. Must be called by constructor of inheriting class
|
||||
void compute();
|
||||
|
||||
// Tell if Tree is a leaf or not.
|
||||
// An inheriting class can influence it via myIsLeaf protected field
|
||||
bool isLeaf() const;
|
||||
|
||||
// Return its level
|
||||
int level() const { return myLevel; }
|
||||
|
||||
// Return Bounding Box of the Tree
|
||||
const box_type* getBox() const { return myBox; }
|
||||
|
||||
// Return height of the tree, full or from this level to topest leaf
|
||||
int getHeight(const bool full=true) const;
|
||||
|
||||
static int nbChildren() { return NB_CHILDREN; }
|
||||
|
||||
// Compute the bigger dimension of my box
|
||||
virtual double maxSize() const = 0;
|
||||
|
||||
protected:
|
||||
// Return box of the whole tree
|
||||
virtual box_type* buildRootBox() = 0;
|
||||
|
||||
// Allocate a child
|
||||
virtual SMESH_Tree* newChild() const = 0;
|
||||
|
||||
// Allocate a bndbox according to childIndex. childIndex is zero based
|
||||
virtual box_type* newChildBox(int childIndex) const = 0;
|
||||
|
||||
// Fill in data of the children
|
||||
virtual void buildChildrenData() = 0;
|
||||
|
||||
// members
|
||||
|
||||
// Array of children
|
||||
SMESH_Tree** myChildren;
|
||||
|
||||
// Point the father, NULL for the level 0
|
||||
SMESH_Tree* myFather;
|
||||
|
||||
// Tell us if the Tree is a leaf or not
|
||||
bool myIsLeaf;
|
||||
|
||||
// Tree limit
|
||||
const SMESH_TreeLimit* myLimit;
|
||||
|
||||
private:
|
||||
// Build the children recursively
|
||||
void buildChildren();
|
||||
|
||||
// Level of the Tree
|
||||
int myLevel;
|
||||
|
||||
box_type* myBox;
|
||||
};
|
||||
|
||||
//===========================================================================
|
||||
/*!
|
||||
* Constructor. limit must be provided at tree root construction.
|
||||
* limit will be deleted by SMESH_Tree.
|
||||
*/
|
||||
//===========================================================================
|
||||
|
||||
template< class BND_BOX, int NB_CHILDREN>
|
||||
SMESH_Tree<BND_BOX,NB_CHILDREN>::SMESH_Tree (SMESH_TreeLimit* limit):
|
||||
myChildren(0),
|
||||
myFather(0),
|
||||
myIsLeaf( false ),
|
||||
myLimit( limit ),
|
||||
myLevel(0),
|
||||
myBox(0)
|
||||
{
|
||||
if ( !myLimit ) myLimit = new SMESH_TreeLimit();
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Compute the Tree
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
template< class BND_BOX, int NB_CHILDREN>
|
||||
void SMESH_Tree<BND_BOX,NB_CHILDREN>::compute()
|
||||
{
|
||||
if ( myLevel==0 )
|
||||
{
|
||||
myBox = buildRootBox();
|
||||
if ( myLimit->myMinBoxSize > 0. && maxSize() <= myLimit->myMinBoxSize )
|
||||
myIsLeaf = true;
|
||||
else
|
||||
buildChildren();
|
||||
}
|
||||
}
|
||||
|
||||
//======================================
|
||||
/*!
|
||||
* \brief SMESH_Tree Destructor
|
||||
*/
|
||||
//======================================
|
||||
|
||||
template< class BND_BOX, int NB_CHILDREN>
|
||||
SMESH_Tree<BND_BOX,NB_CHILDREN>::~SMESH_Tree ()
|
||||
{
|
||||
if ( myChildren )
|
||||
{
|
||||
if ( !isLeaf() )
|
||||
{
|
||||
for(int i = 0; i<NB_CHILDREN; i++)
|
||||
delete myChildren[i];
|
||||
delete[] myChildren;
|
||||
myChildren = 0;
|
||||
}
|
||||
}
|
||||
if ( myBox )
|
||||
delete myBox;
|
||||
myBox = 0;
|
||||
if ( level() == 0 )
|
||||
delete myLimit;
|
||||
myLimit = 0;
|
||||
}
|
||||
|
||||
//=================================================================
|
||||
/*!
|
||||
* \brief Build the children boxes and call buildChildrenData()
|
||||
*/
|
||||
//=================================================================
|
||||
|
||||
template< class BND_BOX, int NB_CHILDREN>
|
||||
void SMESH_Tree<BND_BOX,NB_CHILDREN>::buildChildren()
|
||||
{
|
||||
if ( isLeaf() ) return;
|
||||
|
||||
myChildren = new SMESH_Tree*[NB_CHILDREN];
|
||||
|
||||
// get the whole model size
|
||||
double rootSize = 0;
|
||||
{
|
||||
SMESH_Tree* root = this;
|
||||
while ( root->myLevel > 0 )
|
||||
root = root->myFather;
|
||||
rootSize = root->maxSize();
|
||||
}
|
||||
for (int i = 0; i < NB_CHILDREN; i++)
|
||||
{
|
||||
// The child is of the same type than its father (For instance, a SMESH_OctreeNode)
|
||||
// We allocate the memory we need for the child
|
||||
myChildren[i] = newChild();
|
||||
// and we assign to him its box.
|
||||
myChildren[i]->myFather = this;
|
||||
myChildren[i]->myLimit = myLimit;
|
||||
myChildren[i]->myLevel = myLevel + 1;
|
||||
myChildren[i]->myBox = newChildBox( i );
|
||||
myChildren[i]->myBox->Enlarge( rootSize * 1e-10 );
|
||||
if ( myLimit->myMinBoxSize > 0. && myChildren[i]->maxSize() <= myLimit->myMinBoxSize )
|
||||
myChildren[i]->myIsLeaf = true;
|
||||
}
|
||||
|
||||
// After building the NB_CHILDREN boxes, we put the data into the children.
|
||||
buildChildrenData();
|
||||
|
||||
//After we pass to the next level of the Tree
|
||||
for (int i = 0; i<NB_CHILDREN; i++)
|
||||
myChildren[i]->buildChildren();
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Tell if Tree is a leaf or not
|
||||
* An inheriting class can influence it via myIsLeaf protected field
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
template< class BND_BOX, int NB_CHILDREN>
|
||||
bool SMESH_Tree<BND_BOX,NB_CHILDREN>::isLeaf() const
|
||||
{
|
||||
return myIsLeaf || ((myLimit->myMaxLevel > 0) ? (level() >= myLimit->myMaxLevel) : false );
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Return height of the tree, full or from this level to topest leaf
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
template< class BND_BOX, int NB_CHILDREN>
|
||||
int SMESH_Tree<BND_BOX,NB_CHILDREN>::getHeight(const bool full) const
|
||||
{
|
||||
if ( full && myFather )
|
||||
return myFather->getHeight( true );
|
||||
|
||||
if ( isLeaf() )
|
||||
return 1;
|
||||
|
||||
int heigth = 0;
|
||||
for (int i = 0; i<NB_CHILDREN; i++)
|
||||
{
|
||||
int h = myChildren[i]->getHeight( false );
|
||||
if ( h > heigth )
|
||||
heigth = h;
|
||||
}
|
||||
return heigth + 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// SMESH SMESH_Tree : tree implementation
|
||||
// File : SMESH_Tree.hxx
|
||||
// Created : Tue Jan 16 16:00:00 2007
|
||||
// Author : Nicolas Geimer & Aurélien Motteux (OCC)
|
||||
// Module : SMESH
|
||||
//
|
||||
#ifndef _SMESH_Tree_HXX_
|
||||
#define _SMESH_Tree_HXX_
|
||||
|
||||
#include "SMESH_Utils.hxx"
|
||||
|
||||
//================================================================================
|
||||
// Data limiting the tree height
|
||||
struct SMESH_TreeLimit {
|
||||
// MaxLevel of the Tree
|
||||
int myMaxLevel;
|
||||
// Minimal size of the Box
|
||||
double myMinBoxSize;
|
||||
|
||||
// Default:
|
||||
// maxLevel-> 8^8 = 16777216 terminal trees at most
|
||||
// minSize -> box size not checked
|
||||
SMESH_TreeLimit(int maxLevel=8, double minSize=0.):myMaxLevel(maxLevel),myMinBoxSize(minSize) {}
|
||||
virtual ~SMESH_TreeLimit() {} // it can be inherited
|
||||
};
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Base class for 2D and 3D trees
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
template< class BND_BOX,
|
||||
int NB_CHILDREN>
|
||||
class SMESH_Tree
|
||||
{
|
||||
public:
|
||||
|
||||
typedef BND_BOX box_type;
|
||||
|
||||
// Constructor. limit must be provided at tree root construction.
|
||||
// limit will be deleted by SMESH_Tree
|
||||
SMESH_Tree (SMESH_TreeLimit* limit=0);
|
||||
|
||||
// Destructor
|
||||
virtual ~SMESH_Tree ();
|
||||
|
||||
// Compute the Tree. Must be called by constructor of inheriting class
|
||||
void compute();
|
||||
|
||||
// Tell if Tree is a leaf or not.
|
||||
// An inheriting class can influence it via myIsLeaf protected field
|
||||
bool isLeaf() const;
|
||||
|
||||
// Return its level
|
||||
int level() const { return myLevel; }
|
||||
|
||||
// Return Bounding Box of the Tree
|
||||
const box_type* getBox() const { return myBox; }
|
||||
|
||||
// Return height of the tree, full or from this level to topest leaf
|
||||
int getHeight(const bool full=true) const;
|
||||
|
||||
static int nbChildren() { return NB_CHILDREN; }
|
||||
|
||||
// Compute the biggest dimension of my box
|
||||
virtual double maxSize() const = 0;
|
||||
|
||||
protected:
|
||||
// Return box of the whole tree
|
||||
virtual box_type* buildRootBox() = 0;
|
||||
|
||||
// Allocate a child
|
||||
virtual SMESH_Tree* newChild() const = 0;
|
||||
|
||||
// Allocate a bndbox according to childIndex. childIndex is zero based
|
||||
virtual box_type* newChildBox(int childIndex) const = 0;
|
||||
|
||||
// Fill in data of the children
|
||||
virtual void buildChildrenData() = 0;
|
||||
|
||||
// members
|
||||
|
||||
// Array of children
|
||||
SMESH_Tree** myChildren;
|
||||
|
||||
// Point the father, NULL for the level 0
|
||||
SMESH_Tree* myFather;
|
||||
|
||||
// Tell us if the Tree is a leaf or not
|
||||
bool myIsLeaf;
|
||||
|
||||
// Tree limit
|
||||
const SMESH_TreeLimit* myLimit;
|
||||
|
||||
private:
|
||||
// Build the children recursively
|
||||
void buildChildren();
|
||||
|
||||
// Level of the Tree
|
||||
int myLevel;
|
||||
|
||||
box_type* myBox;
|
||||
};
|
||||
|
||||
//===========================================================================
|
||||
/*!
|
||||
* Constructor. limit must be provided at tree root construction.
|
||||
* limit will be deleted by SMESH_Tree.
|
||||
*/
|
||||
//===========================================================================
|
||||
|
||||
template< class BND_BOX, int NB_CHILDREN>
|
||||
SMESH_Tree<BND_BOX,NB_CHILDREN>::SMESH_Tree (SMESH_TreeLimit* limit):
|
||||
myChildren(0),
|
||||
myFather(0),
|
||||
myIsLeaf( false ),
|
||||
myLimit( limit ),
|
||||
myLevel(0),
|
||||
myBox(0)
|
||||
{
|
||||
//if ( !myLimit ) myLimit = new SMESH_TreeLimit();
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Compute the Tree
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
template< class BND_BOX, int NB_CHILDREN>
|
||||
void SMESH_Tree<BND_BOX,NB_CHILDREN>::compute()
|
||||
{
|
||||
if ( myLevel==0 )
|
||||
{
|
||||
if ( !myLimit ) myLimit = new SMESH_TreeLimit();
|
||||
myBox = buildRootBox();
|
||||
if ( myLimit->myMinBoxSize > 0. && maxSize() <= myLimit->myMinBoxSize )
|
||||
myIsLeaf = true;
|
||||
else
|
||||
buildChildren();
|
||||
}
|
||||
}
|
||||
|
||||
//======================================
|
||||
/*!
|
||||
* \brief SMESH_Tree Destructor
|
||||
*/
|
||||
//======================================
|
||||
|
||||
template< class BND_BOX, int NB_CHILDREN>
|
||||
SMESH_Tree<BND_BOX,NB_CHILDREN>::~SMESH_Tree ()
|
||||
{
|
||||
if ( myChildren )
|
||||
{
|
||||
if ( !isLeaf() )
|
||||
{
|
||||
for(int i = 0; i<NB_CHILDREN; i++)
|
||||
delete myChildren[i];
|
||||
delete[] myChildren;
|
||||
myChildren = 0;
|
||||
}
|
||||
}
|
||||
if ( myBox )
|
||||
delete myBox;
|
||||
myBox = 0;
|
||||
if ( level() == 0 )
|
||||
delete myLimit;
|
||||
myLimit = 0;
|
||||
}
|
||||
|
||||
//=================================================================
|
||||
/*!
|
||||
* \brief Build the children boxes and call buildChildrenData()
|
||||
*/
|
||||
//=================================================================
|
||||
|
||||
template< class BND_BOX, int NB_CHILDREN>
|
||||
void SMESH_Tree<BND_BOX,NB_CHILDREN>::buildChildren()
|
||||
{
|
||||
if ( isLeaf() ) return;
|
||||
|
||||
myChildren = new SMESH_Tree*[NB_CHILDREN];
|
||||
|
||||
// get the whole model size
|
||||
double rootSize = 0;
|
||||
{
|
||||
SMESH_Tree* root = this;
|
||||
while ( root->myLevel > 0 )
|
||||
root = root->myFather;
|
||||
rootSize = root->maxSize();
|
||||
}
|
||||
for (int i = 0; i < NB_CHILDREN; i++)
|
||||
{
|
||||
// The child is of the same type than its father (For instance, a SMESH_OctreeNode)
|
||||
// We allocate the memory we need for the child
|
||||
myChildren[i] = newChild();
|
||||
// and we assign to him its box.
|
||||
myChildren[i]->myFather = this;
|
||||
if (myChildren[i]->myLimit)
|
||||
delete myChildren[i]->myLimit;
|
||||
myChildren[i]->myLimit = myLimit;
|
||||
myChildren[i]->myLevel = myLevel + 1;
|
||||
myChildren[i]->myBox = newChildBox( i );
|
||||
myChildren[i]->myBox->Enlarge( rootSize * 1e-10 );
|
||||
if ( myLimit->myMinBoxSize > 0. && myChildren[i]->maxSize() <= myLimit->myMinBoxSize )
|
||||
myChildren[i]->myIsLeaf = true;
|
||||
}
|
||||
|
||||
// After building the NB_CHILDREN boxes, we put the data into the children.
|
||||
buildChildrenData();
|
||||
|
||||
//After we pass to the next level of the Tree
|
||||
for (int i = 0; i<NB_CHILDREN; i++)
|
||||
myChildren[i]->buildChildren();
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Tell if Tree is a leaf or not
|
||||
* An inheriting class can influence it via myIsLeaf protected field
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
template< class BND_BOX, int NB_CHILDREN>
|
||||
bool SMESH_Tree<BND_BOX,NB_CHILDREN>::isLeaf() const
|
||||
{
|
||||
return myIsLeaf || ((myLimit->myMaxLevel > 0) ? (level() >= myLimit->myMaxLevel) : false );
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Return height of the tree, full or from this level to topest leaf
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
template< class BND_BOX, int NB_CHILDREN>
|
||||
int SMESH_Tree<BND_BOX,NB_CHILDREN>::getHeight(const bool full) const
|
||||
{
|
||||
if ( full && myFather )
|
||||
return myFather->getHeight( true );
|
||||
|
||||
if ( isLeaf() )
|
||||
return 1;
|
||||
|
||||
int heigth = 0;
|
||||
for (int i = 0; i<NB_CHILDREN; i++)
|
||||
{
|
||||
int h = myChildren[i]->getHeight( false );
|
||||
if ( h > heigth )
|
||||
heigth = h;
|
||||
}
|
||||
return heigth + 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -110,6 +110,11 @@ libSMESHEngine_la_LDFLAGS = \
|
||||
../SMESHDS/libSMESHDS.la \
|
||||
../Controls/libSMESHControls.la \
|
||||
$(KERNEL_LDFLAGS) \
|
||||
-lOpUtil \
|
||||
-lSalomeNotification \
|
||||
-lResourcesManager \
|
||||
-lSalomeResourcesManager \
|
||||
-lSALOMEBasics \
|
||||
-lSalomeContainer \
|
||||
-lSalomeNS \
|
||||
-lRegistry \
|
||||
|
@ -369,7 +369,8 @@ namespace {
|
||||
"ExtrusionSweepObject1D","ExtrusionSweepObject1DMakeGroups",
|
||||
"ExtrusionSweepObject2D","ExtrusionSweepObject2DMakeGroups",
|
||||
"Translate","TranslateMakeGroups","TranslateMakeMesh",
|
||||
"TranslateObject","TranslateObjectMakeGroups", "TranslateObjectMakeMesh"
|
||||
"TranslateObject","TranslateObjectMakeGroups", "TranslateObjectMakeMesh",
|
||||
"ExtrusionAlongPathX","ExtrusionAlongPathObjX"
|
||||
,"" }; // <- mark of the end
|
||||
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
|
||||
// if the sub-mesh is used in theCommand as argument
|
||||
if ( _pySubMesh::CanBeArgOfMethod( aCommand->GetMethod() ))
|
||||
{
|
||||
PlaceSubmeshAfterItsCreation( aCommand );
|
||||
}
|
||||
// if ( _pySubMesh::CanBeArgOfMethod( aCommand->GetMethod() ))
|
||||
// {
|
||||
// PlaceSubmeshAfterItsCreation( aCommand );
|
||||
// }
|
||||
|
||||
// Method( SMESH.PointStruct(x,y,z) -> Method( [x,y,z]
|
||||
// Method( SMESH.PointStruct(x,y,z)... -> Method( [x,y,z]...
|
||||
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
|
||||
|
||||
// SMESH_Gen method?
|
||||
if ( objID == this->GetID() || objID == SMESH_2smeshpy::GenName())
|
||||
{
|
||||
this->Process( aCommand );
|
||||
addFilterUser( aCommand, theGen ); // protect filters from clearing
|
||||
//addFilterUser( aCommand, theGen ); // protect filters from clearing
|
||||
return aCommand;
|
||||
}
|
||||
|
||||
@ -656,13 +667,14 @@ Handle(_pyCommand) _pyGen::AddCommand( const TCollection_AsciiString& theCommand
|
||||
else if ( aCommand->GetMethod() == "GetSubMesh" ) { // SubMesh creation
|
||||
_pyID subMeshID = aCommand->GetResultValue();
|
||||
Handle(_pySubMesh) subMesh = new _pySubMesh( aCommand );
|
||||
CheckObjectIsReCreated( subMesh );
|
||||
myObjects.insert( make_pair( subMeshID, subMesh ));
|
||||
}
|
||||
|
||||
// Method( mesh.GetIDSource([id1,id2]) -> Method( [id1,id2]
|
||||
GetIDSourceToList( aCommand );
|
||||
|
||||
addFilterUser( aCommand, theGen ); // protect filters from clearing
|
||||
//addFilterUser( aCommand, theGen ); // protect filters from clearing
|
||||
|
||||
id_mesh->second->Process( 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]
|
||||
GetIDSourceToList( aCommand );
|
||||
|
||||
addFilterUser( aCommand, theGen ); // protect filters from clearing
|
||||
//addFilterUser( aCommand, theGen ); // protect filters from clearing
|
||||
|
||||
const TCollection_AsciiString& method = aCommand->GetMethod();
|
||||
|
||||
@ -716,8 +728,9 @@ Handle(_pyCommand) _pyGen::AddCommand( const TCollection_AsciiString& theCommand
|
||||
!myMeshes.count( meshID ) &&
|
||||
aCommand->IsStudyEntry( meshID ))
|
||||
{
|
||||
TCollection_AsciiString processedCommand = aCommand->GetString();
|
||||
_AString processedCommand = aCommand->GetString();
|
||||
Handle(_pyMesh) mesh = new _pyMesh( aCommand, meshID );
|
||||
CheckObjectIsReCreated( mesh );
|
||||
myMeshes.insert( make_pair( meshID, mesh ));
|
||||
aCommand->Clear();
|
||||
aCommand->GetString() = processedCommand; // discard changes made by _pyMesh
|
||||
@ -743,13 +756,13 @@ Handle(_pyCommand) _pyGen::AddCommand( const TCollection_AsciiString& theCommand
|
||||
} // SMESH_MeshEditor methods
|
||||
|
||||
// SMESH_Hypothesis method?
|
||||
list< Handle(_pyHypothesis) >::iterator hyp = myHypos.begin();
|
||||
for ( ; hyp != myHypos.end(); ++hyp )
|
||||
if ( !(*hyp)->IsAlgo() && objID == (*hyp)->GetID() ) {
|
||||
(*hyp)->Process( aCommand );
|
||||
(*hyp)->AddProcessedCmd( aCommand );
|
||||
return aCommand;
|
||||
}
|
||||
Handle(_pyHypothesis) hyp = FindHyp( objID );
|
||||
if ( !hyp.IsNull() && !hyp->IsAlgo() )
|
||||
{
|
||||
hyp->Process( aCommand );
|
||||
hyp->AddProcessedCmd( aCommand );
|
||||
return aCommand;
|
||||
}
|
||||
|
||||
// aFilterManager.CreateFilter() ?
|
||||
if ( aCommand->GetMethod() == "CreateFilter" )
|
||||
@ -764,6 +777,14 @@ Handle(_pyCommand) _pyGen::AddCommand( const TCollection_AsciiString& theCommand
|
||||
Handle(_pyObject) filter( new _pyFilter( aCommand, newID ));
|
||||
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?
|
||||
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")
|
||||
{
|
||||
Handle(_pyMesh) mesh = new _pyMesh( theCommand );
|
||||
myMeshes.insert( make_pair( mesh->GetID(), mesh ));
|
||||
AddObject( mesh );
|
||||
return;
|
||||
}
|
||||
if ( method == "CreateMeshesFromUNV" ||
|
||||
@ -922,7 +943,7 @@ void _pyGen::Process( const Handle(_pyCommand)& theCommand )
|
||||
method == "CopyMesh" ) // command result is a mesh
|
||||
{
|
||||
Handle(_pyMesh) mesh = new _pyMesh( theCommand, theCommand->GetResultValue() );
|
||||
myMeshes.insert( make_pair( mesh->GetID(), mesh ));
|
||||
AddObject( mesh );
|
||||
return;
|
||||
}
|
||||
if( method == "CreateMeshesFromMED" ||
|
||||
@ -935,7 +956,7 @@ void _pyGen::Process( const Handle(_pyCommand)& theCommand )
|
||||
_pyID meshID = theCommand->GetResultValue(ind+1);
|
||||
if ( !theCommand->IsStudyEntry( meshID ) ) continue;
|
||||
Handle(_pyMesh) mesh = new _pyMesh( theCommand, theCommand->GetResultValue(ind+1));
|
||||
myMeshes.insert( make_pair( mesh->GetID(), mesh ));
|
||||
AddObject( mesh );
|
||||
}
|
||||
if ( method == "CreateMeshesFromGMF" )
|
||||
{
|
||||
@ -953,13 +974,16 @@ void _pyGen::Process( const Handle(_pyCommand)& theCommand )
|
||||
// issue 199929, remove standard library name (default parameter)
|
||||
const TCollection_AsciiString & aLibName = theCommand->GetArg( 2 );
|
||||
if ( aLibName.Search( "StdMeshersEngine" ) != -1 ) {
|
||||
// keep first argument
|
||||
// keep the first argument
|
||||
TCollection_AsciiString arg = theCommand->GetArg( 1 );
|
||||
theCommand->RemoveArgs();
|
||||
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;
|
||||
}
|
||||
|
||||
@ -996,7 +1020,8 @@ void _pyGen::Process( const Handle(_pyCommand)& theCommand )
|
||||
// SMESH_Pattern, FilterManager
|
||||
if ( method == "GetPattern" ||
|
||||
method == "CreateFilterManager" ||
|
||||
method == "CreateMeasurements" ) {
|
||||
method == "CreateMeasurements" )
|
||||
{
|
||||
Handle(_pyObject) obj = new _pySelfEraser( theCommand );
|
||||
if ( !myObjects.insert( make_pair( obj->GetID(), obj )).second )
|
||||
theCommand->Clear(); // already created
|
||||
@ -1009,7 +1034,7 @@ void _pyGen::Process( const Handle(_pyCommand)& theCommand )
|
||||
theCommand->SetArg( theCommand->GetNbArgs() + 1, "True" );
|
||||
}
|
||||
Handle(_pyMesh) mesh = new _pyMesh( theCommand, theCommand->GetResultValue() );
|
||||
myMeshes.insert( make_pair( mesh->GetID(), mesh ));
|
||||
AddObject( mesh );
|
||||
AddMeshAccessorMethod( theCommand );
|
||||
}
|
||||
else if ( method == "SetName" ) // SetName(obj,name)
|
||||
@ -1053,15 +1078,15 @@ void _pyGen::Flush()
|
||||
|
||||
map< _pyID, Handle(_pyMesh) >::iterator id_mesh;
|
||||
map< _pyID, Handle(_pyObject) >::iterator id_obj;
|
||||
list< Handle(_pyHypothesis) >::iterator hyp;
|
||||
map< _pyID, Handle(_pyHypothesis) >::iterator id_hyp;
|
||||
|
||||
if ( IsToKeepAllCommands() ) // historical dump
|
||||
{
|
||||
// set myIsPublished = true to all objects
|
||||
for ( id_mesh = myMeshes.begin(); id_mesh != myMeshes.end(); ++id_mesh )
|
||||
id_mesh->second->SetRemovedFromStudy( false );
|
||||
for ( hyp = myHypos.begin(); hyp != myHypos.end(); ++hyp )
|
||||
(*hyp)->SetRemovedFromStudy( false );
|
||||
for ( id_hyp = myHypos.begin(); id_hyp != myHypos.end(); ++id_hyp )
|
||||
id_hyp->second->SetRemovedFromStudy( false );
|
||||
for ( id_obj = myObjects.begin(); id_obj != myObjects.end(); ++id_obj )
|
||||
id_obj->second->SetRemovedFromStudy( false );
|
||||
}
|
||||
@ -1070,9 +1095,9 @@ void _pyGen::Flush()
|
||||
// let hypotheses find referred objects in order to prevent clearing
|
||||
// not published referred hyps (it's needed for hyps like "LayerDistribution")
|
||||
list< Handle(_pyMesh) > fatherMeshes;
|
||||
for ( hyp = myHypos.begin(); hyp != myHypos.end(); ++hyp )
|
||||
if ( !hyp->IsNull() )
|
||||
(*hyp)->GetReferredMeshesAndGeom( fatherMeshes );
|
||||
for ( id_hyp = myHypos.begin(); id_hyp != myHypos.end(); ++id_hyp )
|
||||
if ( !id_hyp->second.IsNull() )
|
||||
id_hyp->second->GetReferredMeshesAndGeom( fatherMeshes );
|
||||
}
|
||||
// set myIsPublished = false to all objects depending on
|
||||
// meshes built on a removed geometry
|
||||
@ -1086,12 +1111,12 @@ void _pyGen::Flush()
|
||||
id_mesh->second->Flush();
|
||||
|
||||
// Flush hyps
|
||||
for ( hyp = myHypos.begin(); hyp != myHypos.end(); ++hyp )
|
||||
if ( !hyp->IsNull() ) {
|
||||
(*hyp)->Flush();
|
||||
for ( id_hyp = myHypos.begin(); id_hyp != myHypos.end(); ++id_hyp )
|
||||
if ( !id_hyp->second.IsNull() ) {
|
||||
id_hyp->second->Flush();
|
||||
// smeshgen.CreateHypothesis() --> smesh.CreateHypothesis()
|
||||
if ( !(*hyp)->IsWrapped() )
|
||||
(*hyp)->GetCreationCmd()->SetObject( SMESH_2smeshpy::GenName() );
|
||||
if ( !id_hyp->second->IsWrapped() )
|
||||
id_hyp->second->GetCreationCmd()->SetObject( SMESH_2smeshpy::GenName() );
|
||||
}
|
||||
|
||||
// Flush other objects
|
||||
@ -1143,10 +1168,10 @@ void _pyGen::ClearCommands()
|
||||
for ( ; id_mesh != myMeshes.end(); ++id_mesh )
|
||||
id_mesh->second->ClearCommands();
|
||||
|
||||
list< Handle(_pyHypothesis) >::iterator hyp = myHypos.begin();
|
||||
for ( ; hyp != myHypos.end(); ++hyp )
|
||||
if ( !hyp->IsNull() )
|
||||
(*hyp)->ClearCommands();
|
||||
map< _pyID, Handle(_pyHypothesis) >::iterator id_hyp = myHypos.begin();
|
||||
for ( ; id_hyp != myHypos.end(); ++id_hyp )
|
||||
if ( !id_hyp->second.IsNull() )
|
||||
id_hyp->second->ClearCommands();
|
||||
|
||||
map< _pyID, Handle(_pyObject) >::iterator id_obj = myObjects.begin();
|
||||
for ( ; id_obj != myObjects.end(); ++id_obj )
|
||||
@ -1176,10 +1201,10 @@ void _pyGen::Free()
|
||||
id_obj->second->Free();
|
||||
myObjects.clear();
|
||||
|
||||
list< Handle(_pyHypothesis) >::iterator hyp = myHypos.begin();
|
||||
for ( ; hyp != myHypos.end(); ++hyp )
|
||||
if ( !hyp->IsNull() )
|
||||
(*hyp)->Free();
|
||||
map< _pyID, Handle(_pyHypothesis) >::iterator id_hyp = myHypos.begin();
|
||||
for ( ; id_hyp != myHypos.end(); ++id_hyp )
|
||||
if ( !id_hyp->second.IsNull() )
|
||||
id_hyp->second->Free();
|
||||
myHypos.clear();
|
||||
|
||||
myFile2ExportedMesh.clear();
|
||||
@ -1215,12 +1240,14 @@ bool _pyGen::AddMeshAccessorMethod( Handle(_pyCommand) theCmd ) const
|
||||
bool _pyGen::AddAlgoAccessorMethod( Handle(_pyCommand) theCmd ) const
|
||||
{
|
||||
bool added = false;
|
||||
list< Handle(_pyHypothesis) >::const_iterator hyp = myHypos.begin();
|
||||
for ( ; hyp != myHypos.end(); ++hyp ) {
|
||||
if ( (*hyp)->IsAlgo() && /*(*hyp)->IsWrapped() &&*/
|
||||
theCmd->AddAccessorMethod( (*hyp)->GetID(), (*hyp)->AccessorMethod() ))
|
||||
map< _pyID, Handle(_pyHypothesis) >::const_iterator id_hyp = myHypos.begin();
|
||||
for ( ; id_hyp != myHypos.end(); ++id_hyp )
|
||||
if ( !id_hyp->second.IsNull() &&
|
||||
id_hyp->second->IsAlgo() && /*(*hyp)->IsWrapped() &&*/
|
||||
theCmd->AddAccessorMethod( id_hyp->second->GetID(),
|
||||
id_hyp->second->AccessorMethod() ))
|
||||
added = true;
|
||||
}
|
||||
|
||||
return added;
|
||||
}
|
||||
|
||||
@ -1234,19 +1261,20 @@ bool _pyGen::AddAlgoAccessorMethod( Handle(_pyCommand) theCmd ) const
|
||||
|
||||
Handle(_pyHypothesis) _pyGen::FindHyp( const _pyID& theHypID )
|
||||
{
|
||||
list< Handle(_pyHypothesis) >::iterator hyp = myHypos.begin();
|
||||
for ( ; hyp != myHypos.end(); ++hyp )
|
||||
if ( !hyp->IsNull() && theHypID == (*hyp)->GetID() )
|
||||
return *hyp;
|
||||
map< _pyID, Handle(_pyHypothesis) >::iterator id_hyp = myHypos.find( theHypID );
|
||||
if ( id_hyp != myHypos.end() &&
|
||||
!id_hyp->second.IsNull() &&
|
||||
theHypID == id_hyp->second->GetID() )
|
||||
return id_hyp->second;
|
||||
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 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
|
||||
*/
|
||||
//================================================================================
|
||||
@ -1254,15 +1282,15 @@ Handle(_pyHypothesis) _pyGen::FindHyp( const _pyID& theHypID )
|
||||
Handle(_pyHypothesis) _pyGen::FindAlgo( const _pyID& theGeom, const _pyID& theMesh,
|
||||
const Handle(_pyHypothesis)& theHypothesis )
|
||||
{
|
||||
list< Handle(_pyHypothesis) >::iterator hyp = myHypos.begin();
|
||||
for ( ; hyp != myHypos.end(); ++hyp )
|
||||
if ( !hyp->IsNull() &&
|
||||
(*hyp)->IsAlgo() &&
|
||||
theHypothesis->CanBeCreatedBy( (*hyp)->GetAlgoType() ) &&
|
||||
(*hyp)->GetGeom() == theGeom &&
|
||||
(*hyp)->GetMesh() == theMesh )
|
||||
return *hyp;
|
||||
return 0;
|
||||
map< _pyID, Handle(_pyHypothesis) >::iterator id_hyp = myHypos.begin();
|
||||
for ( ; id_hyp != myHypos.end(); ++id_hyp )
|
||||
if ( !id_hyp->second.IsNull() &&
|
||||
id_hyp->second->IsAlgo() &&
|
||||
theHypothesis->CanBeCreatedBy( id_hyp->second->GetAlgoType() ) &&
|
||||
id_hyp->second->GetGeom() == theGeom &&
|
||||
id_hyp->second->GetMesh() == theMesh )
|
||||
return id_hyp->second;
|
||||
return Handle(_pyHypothesis)();
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
@ -1362,28 +1390,30 @@ void _pyGen::setNeighbourCommand( Handle(_pyCommand)& theCmd,
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
void _pyGen::addFilterUser( Handle(_pyCommand)& theCommand, const Handle(_pyObject)& user )
|
||||
{
|
||||
const char filterPrefix[] = "aFilter0x";
|
||||
if ( theCommand->GetString().Search( filterPrefix ) < 1 )
|
||||
return;
|
||||
// void _pyGen::addFilterUser( Handle(_pyCommand)& theCommand, const Handle(_pyObject)& user )
|
||||
// {
|
||||
// No more needed after adding _pyObject::myArgCommands
|
||||
|
||||
for ( int i = theCommand->GetNbArgs(); i > 0; --i )
|
||||
{
|
||||
const _AString & arg = theCommand->GetArg( i );
|
||||
// NOT TREATED CASE: arg == "[something, aFilter0x36a2f60]"
|
||||
if ( arg.Search( filterPrefix ) != 1 )
|
||||
continue;
|
||||
// const char filterPrefix[] = "aFilter0x";
|
||||
// if ( theCommand->GetString().Search( filterPrefix ) < 1 )
|
||||
// return;
|
||||
|
||||
Handle(_pyFilter) filter = Handle(_pyFilter)::DownCast( FindObject( arg ));
|
||||
if ( !filter.IsNull() )
|
||||
{
|
||||
filter->AddUser( user );
|
||||
if ( !filter->GetNewID().IsEmpty() )
|
||||
theCommand->SetArg( i, filter->GetNewID() );
|
||||
}
|
||||
}
|
||||
}
|
||||
// for ( int i = theCommand->GetNbArgs(); i > 0; --i )
|
||||
// {
|
||||
// const _AString & arg = theCommand->GetArg( i );
|
||||
// // NOT TREATED CASE: arg == "[something, aFilter0x36a2f60]"
|
||||
// if ( arg.Search( filterPrefix ) != 1 )
|
||||
// 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;
|
||||
|
||||
CheckObjectIsReCreated( theObj );
|
||||
|
||||
if ( theObj->IsKind( STANDARD_TYPE( _pyMesh )))
|
||||
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 ));
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \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
|
||||
@ -3480,7 +3547,7 @@ const TCollection_AsciiString & _pyCommand::GetObject()
|
||||
if ( GetBegPos( OBJECT_IND ) == UNKNOWN )
|
||||
{
|
||||
// beginning
|
||||
int begPos = GetBegPos( RESULT_IND ) + myRes.Length();
|
||||
int begPos = GetBegPos( RESULT_IND );
|
||||
if ( begPos < 1 ) {
|
||||
begPos = myString.Location( "=", 1, Length() ) + 1;
|
||||
// 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 )
|
||||
begPos = 1;
|
||||
}
|
||||
else {
|
||||
begPos += myRes.Length();
|
||||
}
|
||||
myObj = GetWord( myString, begPos, true );
|
||||
if ( begPos != EMPTY )
|
||||
{
|
||||
@ -4047,19 +4117,48 @@ _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()
|
||||
{
|
||||
int nbCalls = GetNbCalls();
|
||||
if ( nbCalls > 0 )
|
||||
bool toErase = false;
|
||||
if ( myIgnoreOwnCalls ) // check if this obj is used as argument
|
||||
{
|
||||
// ignore cleared commands
|
||||
std::list< Handle(_pyCommand) >& cmds = GetProcessedCmds();
|
||||
std::list< Handle(_pyCommand) >::const_iterator cmd = cmds.begin();
|
||||
for ( ; cmd != cmds.end(); ++cmd )
|
||||
nbCalls -= (*cmd)->IsEmpty();
|
||||
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();
|
||||
if ( nbCalls > 0 )
|
||||
{
|
||||
// ignore cleared commands
|
||||
std::list< Handle(_pyCommand) >& cmds = GetProcessedCmds();
|
||||
std::list< Handle(_pyCommand) >::const_iterator cmd = cmds.begin();
|
||||
for ( ; cmd != cmds.end(); ++cmd )
|
||||
nbCalls -= (*cmd)->IsEmpty();
|
||||
}
|
||||
toErase = ( nbCalls < 1 );
|
||||
}
|
||||
if ( toErase )
|
||||
{
|
||||
myIsPublished = false;
|
||||
_pyObject::ClearCommands();
|
||||
}
|
||||
if ( nbCalls < 1 )
|
||||
GetCreationCmd()->Clear();
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
@ -4072,6 +4171,7 @@ _pySubMesh::_pySubMesh(const Handle(_pyCommand)& theCreationCmd):
|
||||
_pyObject(theCreationCmd)
|
||||
{
|
||||
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)
|
||||
{
|
||||
// names of all methods where a sub-mesh can be used as argument
|
||||
static TStringSet methods;
|
||||
if ( methods.empty() ) {
|
||||
const char * names[] = {
|
||||
// methods of SMESH_Gen
|
||||
"CopyMesh",
|
||||
// methods of SMESH_Group
|
||||
"AddFrom",
|
||||
// methods of SMESH_Measurements
|
||||
"MinDistance",
|
||||
// methods of SMESH_Mesh
|
||||
"ExportPartToMED","ExportCGNS","ExportPartToDAT","ExportPartToUNV","ExportPartToSTL",
|
||||
"RemoveSubMesh",
|
||||
// methods of SMESH_MeshEditor
|
||||
"ReorientObject","Reorient2D","TriToQuadObject","QuadToTriObject","SplitQuadObject",
|
||||
"SplitVolumesIntoTetra","SmoothObject","SmoothParametricObject","ConvertFromQuadraticObject",
|
||||
"RotationSweepObject","RotationSweepObjectMakeGroups","RotationSweepObject1D",
|
||||
"RotationSweepObject1DMakeGroups","RotationSweepObject2D","RotationSweepObject2DMakeGroups",
|
||||
"ExtrusionSweepObject","ExtrusionSweepObjectMakeGroups","ExtrusionSweepObject0D",
|
||||
"ExtrusionSweepObject0DMakeGroups","ExtrusionSweepObject1D","ExtrusionSweepObject2D",
|
||||
"ExtrusionSweepObject1DMakeGroups","ExtrusionSweepObject2DMakeGroups",
|
||||
"ExtrusionAlongPathObjX","ExtrusionAlongPathObject","ExtrusionAlongPathObjectMakeGroups",
|
||||
"ExtrusionAlongPathObject1D","ExtrusionAlongPathObject1DMakeGroups",
|
||||
"ExtrusionAlongPathObject2D","ExtrusionAlongPathObject2DMakeGroups","MirrorObject",
|
||||
"MirrorObjectMakeGroups","MirrorObjectMakeMesh","TranslateObject","Scale",
|
||||
"TranslateObjectMakeGroups","TranslateObjectMakeMesh","ScaleMakeGroups","ScaleMakeMesh",
|
||||
"RotateObject","RotateObjectMakeGroups","RotateObjectMakeMesh","FindCoincidentNodesOnPart",
|
||||
"FindCoincidentNodesOnPartBut","FindEqualElements","FindAmongElementsByPoint",
|
||||
"MakeBoundaryMesh","Create0DElementsOnAllNodes",
|
||||
"" }; // <- mark of end
|
||||
methods.Insert( names );
|
||||
}
|
||||
return methods.Contains( theMethodName );
|
||||
return false;
|
||||
// // names of all methods where a sub-mesh can be used as argument
|
||||
// static TStringSet methods;
|
||||
// if ( methods.empty() ) {
|
||||
// const char * names[] = {
|
||||
// // methods of SMESH_Gen
|
||||
// "CopyMesh",
|
||||
// // methods of SMESH_Group
|
||||
// "AddFrom",
|
||||
// // methods of SMESH_Measurements
|
||||
// "MinDistance",
|
||||
// // methods of SMESH_Mesh
|
||||
// "ExportPartToMED","ExportCGNS","ExportPartToDAT","ExportPartToUNV","ExportPartToSTL",
|
||||
// "RemoveSubMesh",
|
||||
// // methods of SMESH_MeshEditor
|
||||
// "ReorientObject","Reorient2D","TriToQuadObject","QuadToTriObject","SplitQuadObject",
|
||||
// "SplitVolumesIntoTetra","SmoothObject","SmoothParametricObject","ConvertFromQuadraticObject",
|
||||
// "RotationSweepObject","RotationSweepObjectMakeGroups","RotationSweepObject1D",
|
||||
// "RotationSweepObject1DMakeGroups","RotationSweepObject2D","RotationSweepObject2DMakeGroups",
|
||||
// "ExtrusionSweepObject","ExtrusionSweepObjectMakeGroups","ExtrusionSweepObject0D",
|
||||
// "ExtrusionSweepObject0DMakeGroups","ExtrusionSweepObject1D","ExtrusionSweepObject2D",
|
||||
// "ExtrusionSweepObject1DMakeGroups","ExtrusionSweepObject2DMakeGroups",
|
||||
// "ExtrusionAlongPathObjX","ExtrusionAlongPathObject","ExtrusionAlongPathObjectMakeGroups",
|
||||
// "ExtrusionAlongPathObject1D","ExtrusionAlongPathObject1DMakeGroups",
|
||||
// "ExtrusionAlongPathObject2D","ExtrusionAlongPathObject2DMakeGroups","MirrorObject",
|
||||
// "MirrorObjectMakeGroups","MirrorObjectMakeMesh","TranslateObject","Scale",
|
||||
// "TranslateObjectMakeGroups","TranslateObjectMakeMesh","ScaleMakeGroups","ScaleMakeMesh",
|
||||
// "RotateObject","RotateObjectMakeGroups","RotateObjectMakeMesh","FindCoincidentNodesOnPart",
|
||||
// "FindCoincidentNodesOnPartBut","FindEqualElements","FindAmongElementsByPoint",
|
||||
// "MakeBoundaryMesh","Create0DElementsOnAllNodes",
|
||||
// "" }; // <- mark of end
|
||||
// methods.Insert( names );
|
||||
// }
|
||||
// return methods.Contains( theMethodName );
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
@ -4126,7 +4227,6 @@ bool _pySubMesh::CanBeArgOfMethod(const _AString& theMethodName)
|
||||
void _pySubMesh::Process( const Handle(_pyCommand)& theCommand )
|
||||
{
|
||||
_pyObject::Process(theCommand); // count calls of Process()
|
||||
GetCreationCmd()->AddDependantCmd( theCommand );
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
@ -4137,11 +4237,17 @@ void _pySubMesh::Process( const Handle(_pyCommand)& theCommand )
|
||||
|
||||
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() );
|
||||
else if ( !myCreator.IsNull() )
|
||||
// move to be just after creator
|
||||
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() )
|
||||
theCreationCmd->SetArg( 3, filter->GetNewID() );
|
||||
filter->AddUser( this );
|
||||
//filter->AddUser( this );
|
||||
}
|
||||
myFilter = filter;
|
||||
}
|
||||
@ -4224,7 +4330,9 @@ bool _pyGroup::CanClear()
|
||||
if ( IsInStudy() )
|
||||
return false;
|
||||
|
||||
if ( !myCanClearCreationCmd && myCreationCmd->GetMethod() == "GetGroups" )
|
||||
if ( !myCanClearCreationCmd &&
|
||||
!myCreationCmd.IsNull() &&
|
||||
myCreationCmd->GetMethod() == "GetGroups" )
|
||||
{
|
||||
TCollection_AsciiString grIDs = myCreationCmd->GetResultValue();
|
||||
list< _pyID > idList = myCreationCmd->GetStudyEntries( grIDs );
|
||||
@ -4310,6 +4418,7 @@ void _pyGroup::Process( const Handle(_pyCommand)& theCommand)
|
||||
makeGroupCmd->SetMethod( "MakeGroupByFilter" );
|
||||
makeGroupCmd->SetArg( 1, name );
|
||||
makeGroupCmd->SetArg( 2, idSource );
|
||||
filter->AddArgCmd( makeGroupCmd );
|
||||
}
|
||||
}
|
||||
else if ( theCommand->GetMethod() == "SetFilter" )
|
||||
@ -4334,8 +4443,8 @@ void _pyGroup::Process( const Handle(_pyCommand)& theCommand)
|
||||
}
|
||||
}
|
||||
|
||||
if ( !filter.IsNull() )
|
||||
filter->AddUser( this );
|
||||
// if ( !filter.IsNull() )
|
||||
// filter->AddUser( this );
|
||||
|
||||
theGen->AddMeshAccessorMethod( theCommand );
|
||||
}
|
||||
@ -4349,7 +4458,7 @@ void _pyGroup::Process( const Handle(_pyCommand)& theCommand)
|
||||
void _pyGroup::Flush()
|
||||
{
|
||||
if ( !theGen->IsToKeepAllCommands() &&
|
||||
myCreationCmd && !myCanClearCreationCmd )
|
||||
!myCreationCmd.IsNull() && !myCanClearCreationCmd )
|
||||
{
|
||||
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/*=""*/)
|
||||
:_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->SetMethod( "GetFilterFromCriteria" );
|
||||
|
||||
// Clear aFilterManager.CreateFilter()
|
||||
// Swap "aFilterManager.CreateFilter()" and "smesh.GetFilterFromCriteria(criteria)"
|
||||
GetCreationCmd()->Clear();
|
||||
GetCreationCmd()->GetString() = theCommand->GetString();
|
||||
theCommand->Clear();
|
||||
theCommand->AddDependantCmd( GetCreationCmd() );
|
||||
}
|
||||
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()
|
||||
{
|
||||
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 );
|
||||
}
|
||||
|
||||
@ -4427,14 +4559,17 @@ void _pyFilter::Flush()
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
bool _pyFilter::CanClear()
|
||||
bool _pyObject::CanClear()
|
||||
{
|
||||
list< Handle(_pyObject) >::iterator obj = myUsers.begin();
|
||||
for ( ; obj != myUsers.end(); ++obj )
|
||||
if ( !(*obj)->CanClear() )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
list< Handle(_pyCommand) >::iterator cmd = myArgCmds.begin();
|
||||
for ( ; cmd != myArgCmds.end(); ++cmd )
|
||||
if ( !(*cmd)->IsEmpty() )
|
||||
{
|
||||
Handle(_pyObject) obj = theGen->FindObject( (*cmd)->GetObject() );
|
||||
if ( !obj.IsNull() && !obj->CanClear() )
|
||||
return false;
|
||||
}
|
||||
return ( !myIsPublished );
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
|
@ -166,6 +166,7 @@ protected:
|
||||
_pyID myID;
|
||||
Handle(_pyCommand) myCreationCmd;
|
||||
std::list< Handle(_pyCommand) > myProcessedCmds;
|
||||
std::list< Handle(_pyCommand) > myArgCmds; // where this obj is used as an argument
|
||||
bool myIsPublished;
|
||||
|
||||
void setID(const _pyID& theID);
|
||||
@ -182,10 +183,11 @@ public:
|
||||
void AddProcessedCmd( const Handle(_pyCommand) & cmd )
|
||||
{ if (myProcessedCmds.empty() || myProcessedCmds.back()!=cmd) myProcessedCmds.push_back( cmd );}
|
||||
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 Flush() = 0;
|
||||
virtual const char* AccessorMethod() const;
|
||||
virtual bool CanClear() { return !myIsPublished; }
|
||||
virtual bool CanClear();
|
||||
virtual void ClearCommands();
|
||||
virtual void Free() {}
|
||||
|
||||
@ -228,14 +230,15 @@ public:
|
||||
const bool theToKeepAllCommands);
|
||||
Handle(_pyCommand) AddCommand( const _AString& theCommand );
|
||||
void ExchangeCommands( Handle(_pyCommand) theCmd1, Handle(_pyCommand) theCmd2 );
|
||||
void SetCommandAfter( Handle(_pyCommand) theCmd, Handle(_pyCommand) theAfterCmd );
|
||||
void SetCommandBefore( Handle(_pyCommand) theCmd, Handle(_pyCommand) theBeforeCmd );
|
||||
void SetCommandAfter ( Handle(_pyCommand) theCmd, Handle(_pyCommand) theAfterCmd );
|
||||
void SetCommandBefore( Handle(_pyCommand) theCmd, Handle(_pyCommand) theBeforeCmd );
|
||||
Handle(_pyCommand)& GetLastCommand();
|
||||
std::list< Handle(_pyCommand) >& GetCommands() { return myCommands; }
|
||||
void PlaceSubmeshAfterItsCreation( Handle(_pyCommand) theCmdUsingSubmesh ) const;
|
||||
|
||||
_pyID GenerateNewID( const _pyID& theID );
|
||||
void AddObject( Handle(_pyObject)& theObj );
|
||||
void CheckObjectIsReCreated( Handle(_pyObject)& theObj );
|
||||
void SetProxyObject( const _pyID& theID, Handle(_pyObject)& theObj );
|
||||
Handle(_pyObject) FindObject( const _pyID& theObjID ) const;
|
||||
Handle(_pySubMesh) FindSubMesh( const _pyID& theSubMeshID );
|
||||
@ -251,6 +254,7 @@ public:
|
||||
bool IsGeomObject(const _pyID& theObjID) const;
|
||||
bool IsNotPublished(const _pyID& theObjID) const;
|
||||
void ObjectCreationRemoved(const _pyID& theObjID);
|
||||
void KeepAgrCmds(const _pyID& theObjID) { myKeepAgrCmdsIDs.push_back( theObjID ); }
|
||||
bool IsToKeepAllCommands() const { return myToKeepAllCommands; }
|
||||
void AddExportedMesh(const _AString& file, const ExportedMeshData& mesh )
|
||||
{ myFile2ExportedMesh[ file ] = mesh; }
|
||||
@ -268,13 +272,14 @@ private:
|
||||
void setNeighbourCommand( Handle(_pyCommand)& theCmd,
|
||||
Handle(_pyCommand)& theOtherCmd,
|
||||
const bool theIsAfter );
|
||||
void addFilterUser( Handle(_pyCommand)& theCmd, const Handle(_pyObject)& user );
|
||||
//void addFilterUser( Handle(_pyCommand)& theCmd, const Handle(_pyObject)& user );
|
||||
|
||||
private:
|
||||
std::map< _pyID, Handle(_pyMesh) > myMeshes;
|
||||
std::map< _pyID, Handle(_pyMeshEditor) > myMeshEditors;
|
||||
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;
|
||||
int myNbCommands;
|
||||
Resource_DataMapOfAsciiStringAsciiString& myID2AccessorMethod;
|
||||
@ -530,9 +535,10 @@ DEFINE_STANDARD_HANDLE (_pySegmentLengthAroundVertexHyp, _pyHypothesis);
|
||||
// -------------------------------------------------------------------------------------
|
||||
class _pySelfEraser: public _pyObject
|
||||
{
|
||||
bool myIgnoreOwnCalls; // not to erase only if this obj is used as argument
|
||||
public:
|
||||
_pySelfEraser(const Handle(_pyCommand)& theCreationCmd)
|
||||
:_pyObject(theCreationCmd) { myIsPublished = true; }
|
||||
_pySelfEraser(const Handle(_pyCommand)& theCreationCmd);
|
||||
void IgnoreOwnCalls() { myIgnoreOwnCalls = true; }
|
||||
virtual void Flush();
|
||||
|
||||
DEFINE_STANDARD_RTTI (_pySelfEraser)
|
||||
@ -567,14 +573,14 @@ public:
|
||||
class _pyFilter: public _pyObject
|
||||
{
|
||||
_pyID myNewID, myMesh;
|
||||
std::list< Handle(_pyObject) > myUsers;
|
||||
//std::list< Handle(_pyObject) > myUsers;
|
||||
public:
|
||||
_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 Flush();
|
||||
virtual bool CanClear();
|
||||
virtual void Free() { myUsers.clear(); }
|
||||
//virtual bool CanClear();
|
||||
//virtual void Free() { myUsers.clear(); }
|
||||
const _pyID& GetNewID() const { return myNewID; }
|
||||
|
||||
DEFINE_STANDARD_RTTI (_pyFilter)
|
||||
|
@ -36,6 +36,7 @@
|
||||
|
||||
#include <TColStd_HSequenceOfInteger.hxx>
|
||||
#include <TCollection_AsciiString.hxx>
|
||||
#include <LDOMParser.hxx>
|
||||
|
||||
#ifdef _DEBUG_
|
||||
static int MYDEBUG = 0;
|
||||
@ -846,6 +847,45 @@ namespace {
|
||||
}
|
||||
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;
|
||||
if( isMultiFile )
|
||||
aScript += "def RebuildData(theStudy):";
|
||||
|
||||
aScript += "\n\t";
|
||||
if ( isPublished )
|
||||
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 + "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
|
||||
if (theSavedTrace.Length() > 0) {
|
||||
// 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;
|
||||
}
|
||||
|
||||
// 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.
|
||||
// Some objects are wrapped with python classes and
|
||||
// Resource_DataMapOfAsciiStringAsciiString holds methods returning wrapped objects
|
||||
|
@ -3070,8 +3070,7 @@ CORBA::Boolean Filter_i::GetCriteria( SMESH::Filter::Criteria_out theCriteria )
|
||||
//=======================================================================
|
||||
CORBA::Boolean Filter_i::SetCriteria( const SMESH::Filter::Criteria& theCriteria )
|
||||
{
|
||||
if ( myPredicate != 0 )
|
||||
myPredicate->UnRegister();
|
||||
SetPredicate( SMESH::Predicate::_nil() );
|
||||
|
||||
SMESH::FilterManager_i* aFilter = new SMESH::FilterManager_i();
|
||||
FilterManager_ptr aFilterMgr = aFilter->_this();
|
||||
@ -3424,6 +3423,8 @@ CORBA::Boolean Filter_i::SetCriteria( const SMESH::Filter::Criteria& theCriteria
|
||||
|
||||
SetPredicate( aResPredicate );
|
||||
|
||||
aResPredicate->UnRegister();
|
||||
|
||||
return !aResPredicate->_is_nil();
|
||||
}
|
||||
|
||||
|
@ -93,7 +93,7 @@
|
||||
#include "SMESH_Mesh_i.hxx"
|
||||
#include "SMESH_PreMeshInfo.hxx"
|
||||
#include "SMESH_PythonDump.hxx"
|
||||
#include "memoire.h"
|
||||
//#include "memoire.h"
|
||||
|
||||
#include CORBA_SERVER_HEADER(SMESH_Group)
|
||||
#include CORBA_SERVER_HEADER(SMESH_Filter)
|
||||
@ -360,10 +360,10 @@ SMESH_Gen_i::~SMESH_Gen_i()
|
||||
//=============================================================================
|
||||
SMESH::SMESH_Hypothesis_ptr SMESH_Gen_i::createHypothesis(const char* theHypName,
|
||||
const char* theLibName)
|
||||
throw (SALOME::SALOME_Exception)
|
||||
throw (SALOME::SALOME_Exception)
|
||||
{
|
||||
/* It's Need to tranlate lib name for WIN32 or X platform */
|
||||
char* aPlatformLibName = 0;
|
||||
std::string aPlatformLibName;
|
||||
if ( theLibName && theLibName[0] != '\0' )
|
||||
{
|
||||
int libNameLen = strlen(theLibName);
|
||||
@ -374,39 +374,24 @@ SMESH::SMESH_Hypothesis_ptr SMESH_Gen_i::createHypothesis(const char* theHypName
|
||||
{
|
||||
//the old format
|
||||
#ifdef WNT
|
||||
aPlatformLibName = new char[libNameLen - 1];
|
||||
aPlatformLibName[0] = '\0';
|
||||
aPlatformLibName = strncat( aPlatformLibName, theLibName+3, libNameLen-6 );
|
||||
aPlatformLibName = strcat( aPlatformLibName, ".dll" );
|
||||
aPlatformLibName[libNameLen - 2] = '\0';
|
||||
aPlatformLibName = std::string( theLibName+3, libNameLen-6 ) + ".dll";
|
||||
#else
|
||||
aPlatformLibName = new char[ libNameLen + 1];
|
||||
aPlatformLibName[0] = '\0';
|
||||
aPlatformLibName = strcat( aPlatformLibName, theLibName );
|
||||
aPlatformLibName[libNameLen] = '\0';
|
||||
aPlatformLibName = theLibName;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
//try to use new format
|
||||
#ifdef WNT
|
||||
aPlatformLibName = new char[ libNameLen + 5 ];
|
||||
aPlatformLibName[0] = '\0';
|
||||
aPlatformLibName = strcat( aPlatformLibName, theLibName );
|
||||
aPlatformLibName = strcat( aPlatformLibName, ".dll" );
|
||||
aPlatformLibName = theLibName + ".dll";
|
||||
#else
|
||||
aPlatformLibName = new char[ libNameLen + 7 ];
|
||||
aPlatformLibName[0] = '\0';
|
||||
aPlatformLibName = strcat( aPlatformLibName, "lib" );
|
||||
aPlatformLibName = strcat( aPlatformLibName, theLibName );
|
||||
aPlatformLibName = strcat( aPlatformLibName, ".so" );
|
||||
aPlatformLibName = "lib" + std::string( theLibName ) + ".so";
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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
|
||||
SMESH_Hypothesis_i* myHypothesis_i = 0;
|
||||
@ -419,7 +404,7 @@ SMESH::SMESH_Hypothesis_ptr SMESH_Gen_i::createHypothesis(const char* theHypName
|
||||
{
|
||||
// load plugin library
|
||||
if(MYDEBUG) MESSAGE("Loading server meshers plugin library ...");
|
||||
LibHandle libHandle = LoadLib( aPlatformLibName/*theLibName*/ );
|
||||
LibHandle libHandle = LoadLib( aPlatformLibName.c_str() );
|
||||
if (!libHandle)
|
||||
{
|
||||
// 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);
|
||||
myHypothesis_i =
|
||||
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)
|
||||
{
|
||||
THROW_SALOME_CORBA_EXCEPTION(S_ex.what(), SALOME::BAD_PARAM);
|
||||
}
|
||||
|
||||
if ( aPlatformLibName )
|
||||
delete[] aPlatformLibName;
|
||||
|
||||
if (!myHypothesis_i)
|
||||
return hypothesis_i._retn();
|
||||
|
||||
// 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 );
|
||||
if(MYDEBUG) { MESSAGE( "Add hypo to map with id = "<< nextId ); }
|
||||
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 )
|
||||
throw ( SALOME::SALOME_Exception )
|
||||
{
|
||||
MEMOSTAT;
|
||||
//MEMOSTAT;
|
||||
Unexpect aCatch(SALOME_SalomeException);
|
||||
if(MYDEBUG) MESSAGE( "SMESH_Gen_i::Compute" );
|
||||
|
||||
@ -3957,7 +3939,7 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
|
||||
|
||||
// Get temporary files location
|
||||
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( theURL );
|
||||
@ -3969,12 +3951,13 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
|
||||
tmpDir.ToCString(),
|
||||
isMultiFile );
|
||||
TCollection_AsciiString aStudyName( "" );
|
||||
if ( isMultiFile )
|
||||
aStudyName = ( (char*)SALOMEDS_Tool::GetNameFromPath( myCurrentStudy->URL() ).c_str() );
|
||||
|
||||
if ( isMultiFile ) {
|
||||
CORBA::String_var url = myCurrentStudy->URL();
|
||||
aStudyName = (char*)SALOMEDS_Tool::GetNameFromPath( url.in() ).c_str();
|
||||
}
|
||||
// Set names of temporary files
|
||||
TCollection_AsciiString filename = tmpDir + aStudyName + TCollection_AsciiString( "_SMESH.hdf" );
|
||||
TCollection_AsciiString meshfile = tmpDir + aStudyName + TCollection_AsciiString( "_SMESH_Mesh.med" );
|
||||
TCollection_AsciiString filename = tmpDir + aStudyName + "_SMESH.hdf";
|
||||
TCollection_AsciiString meshfile = tmpDir + aStudyName + "_SMESH_Mesh.med";
|
||||
|
||||
int size;
|
||||
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
|
||||
for ( int j = GetSubMeshOnVertexTag(); j <= GetSubMeshOnCompoundTag(); j++ ) {
|
||||
char name_meshgroup[ 30 ];
|
||||
const char* name_meshgroup;
|
||||
if ( j == GetSubMeshOnVertexTag() )
|
||||
strcpy( name_meshgroup, "SubMeshes On Vertex" );
|
||||
name_meshgroup = "SubMeshes On Vertex";
|
||||
else if ( j == GetSubMeshOnEdgeTag() )
|
||||
strcpy( name_meshgroup, "SubMeshes On Edge" );
|
||||
name_meshgroup = "SubMeshes On Edge";
|
||||
else if ( j == GetSubMeshOnWireTag() )
|
||||
strcpy( name_meshgroup, "SubMeshes On Wire" );
|
||||
name_meshgroup = "SubMeshes On Wire";
|
||||
else if ( j == GetSubMeshOnFaceTag() )
|
||||
strcpy( name_meshgroup, "SubMeshes On Face" );
|
||||
name_meshgroup = "SubMeshes On Face";
|
||||
else if ( j == GetSubMeshOnShellTag() )
|
||||
strcpy( name_meshgroup, "SubMeshes On Shell" );
|
||||
name_meshgroup = "SubMeshes On Shell";
|
||||
else if ( j == GetSubMeshOnSolidTag() )
|
||||
strcpy( name_meshgroup, "SubMeshes On Solid" );
|
||||
name_meshgroup = "SubMeshes On Solid";
|
||||
else if ( j == GetSubMeshOnCompoundTag() )
|
||||
strcpy( name_meshgroup, "SubMeshes On Compound" );
|
||||
name_meshgroup = "SubMeshes On Compound";
|
||||
|
||||
// try to get submeshes container HDF group
|
||||
if ( aTopGroup->ExistInternalObject( name_meshgroup ) ) {
|
||||
@ -4458,9 +4441,9 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
|
||||
// identify submesh
|
||||
char name_submeshgroup[ HDF_NAME_MAX_LEN+1 ];
|
||||
aGroup->InternalObjectIndentify( k, name_submeshgroup );
|
||||
if ( string( name_submeshgroup ).substr( 0, 7 ) == string( "SubMesh" ) ) {
|
||||
if ( strncmp( name_submeshgroup, "SubMesh", 7 ) == 0 ) {
|
||||
// --> get submesh id
|
||||
int subid = atoi( string( name_submeshgroup ).substr( 7 ).c_str() );
|
||||
int subid = atoi( name_submeshgroup + 7 );
|
||||
if ( subid <= 0 )
|
||||
continue;
|
||||
// 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 ];
|
||||
aSubSubGroup->InternalObjectIndentify( l, name_dataset );
|
||||
// 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->OpenOnDisk();
|
||||
size = aDataset->GetSize();
|
||||
@ -4675,8 +4658,10 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
|
||||
|
||||
if ( SMESH_GroupOnFilter_i* aFilterGroup =
|
||||
dynamic_cast< SMESH_GroupOnFilter_i*>( aGroupImpl ))
|
||||
{
|
||||
aFilterGroup->SetFilter( filter );
|
||||
|
||||
filter->UnRegister();
|
||||
}
|
||||
SMESHDS_GroupBase* aGroupBaseDS = aGroupImpl->GetGroupDS();
|
||||
if ( !aGroupBaseDS )
|
||||
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
|
||||
// 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 ) ) {
|
||||
useCaseBuilder->SetRootCurrent();
|
||||
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()) {
|
||||
useCaseBuilder->AppendTo( it->Value()->GetFather(), it->Value() );
|
||||
}
|
||||
@ -5015,8 +5000,8 @@ char* SMESH_Gen_i::getVersion()
|
||||
// Is used in the drag-n-drop functionality.
|
||||
//=================================================================================
|
||||
void SMESH_Gen_i::Move( const SMESH::sobject_list& what,
|
||||
SALOMEDS::SObject_ptr where,
|
||||
CORBA::Long row )
|
||||
SALOMEDS::SObject_ptr where,
|
||||
CORBA::Long row )
|
||||
{
|
||||
if ( CORBA::is_nil( where ) ) return;
|
||||
|
||||
|
@ -587,8 +587,8 @@ public:
|
||||
|
||||
// Move objects to the specified position
|
||||
void Move( const SMESH::sobject_list& what,
|
||||
SALOMEDS::SObject_ptr where,
|
||||
CORBA::Long row );
|
||||
SALOMEDS::SObject_ptr where,
|
||||
CORBA::Long row );
|
||||
|
||||
private:
|
||||
// Create hypothesis of given type
|
||||
|
@ -260,13 +260,34 @@ static SALOMEDS::SObject_ptr publish(SALOMEDS::Study_ptr theStudy,
|
||||
const bool theSelectable = true)
|
||||
{
|
||||
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::SObject_wrap objAfter;
|
||||
if ( SO->_is_nil() ) {
|
||||
if ( theTag == 0 )
|
||||
if ( theTag == 0 ) {
|
||||
SO = aStudyBuilder->NewObject( theFatherObject );
|
||||
else if ( !theFatherObject->FindSubObject( theTag, SO.inout() ))
|
||||
} else if ( !theFatherObject->FindSubObject( theTag, SO.inout() )) {
|
||||
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;
|
||||
@ -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 );
|
||||
SALOMEDS::AttributeIOR_wrap iorAttr = anAttr;
|
||||
iorAttr->SetValue( objStr.in() );
|
||||
// UnRegister() !!!
|
||||
SALOME::GenericObj_var genObj = SALOME::GenericObj::_narrow( theIOR );
|
||||
if ( !genObj->_is_nil() )
|
||||
genObj->UnRegister();
|
||||
}
|
||||
if ( thePixMap ) {
|
||||
anAttr = aStudyBuilder->FindOrCreateAttribute( SO, "AttributePixMap" );
|
||||
@ -289,7 +314,11 @@ static SALOMEDS::SObject_ptr publish(SALOMEDS::Study_ptr theStudy,
|
||||
|
||||
// add object to the use case tree
|
||||
// (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();
|
||||
}
|
||||
@ -1179,7 +1208,7 @@ char* SMESH_Gen_i::GetParameters(CORBA::Object_ptr theObject)
|
||||
{
|
||||
CORBA::String_var aResult("");
|
||||
|
||||
SALOMEDS::SObject_wrap aSObj = ObjectToSObject( myCurrentStudy,theObject);
|
||||
SALOMEDS::SObject_wrap aSObj = ObjectToSObject( myCurrentStudy, theObject );
|
||||
if ( !aSObj->_is_nil() )
|
||||
{
|
||||
SALOMEDS::GenericAttribute_wrap attr;
|
||||
@ -1189,6 +1218,5 @@ char* SMESH_Gen_i::GetParameters(CORBA::Object_ptr theObject)
|
||||
aResult = strAttr->Value();
|
||||
}
|
||||
}
|
||||
|
||||
return CORBA::string_dup( aResult.in() );
|
||||
return aResult._retn();
|
||||
}
|
||||
|
@ -101,10 +101,6 @@ SMESH_GroupOnFilter_i::SMESH_GroupOnFilter_i( PortableServer::POA_ptr thePOA,
|
||||
|
||||
SMESH_GroupBase_i::~SMESH_GroupBase_i()
|
||||
{
|
||||
MESSAGE("~SMESH_GroupBase_i; this = "<<this );
|
||||
if ( myMeshServant )
|
||||
myMeshServant->removeGroup(myLocalID);
|
||||
|
||||
if ( myPreMeshInfo ) delete myPreMeshInfo; myPreMeshInfo = NULL;
|
||||
}
|
||||
|
||||
@ -156,15 +152,16 @@ void SMESH_GroupBase_i::SetName( const char* theName )
|
||||
aGroup->SetName(theName);
|
||||
|
||||
// Update group name in a study
|
||||
SMESH_Gen_i* aGen = myMeshServant->GetGen();
|
||||
SALOMEDS::Study_var aStudy = aGen->GetCurrentStudy();
|
||||
SALOMEDS::SObject_var anSO = aGen->ObjectToSObject( aStudy, _this() );
|
||||
SMESH_Gen_i* aGen = myMeshServant->GetGen();
|
||||
SALOMEDS::Study_var aStudy = aGen->GetCurrentStudy();
|
||||
SMESH::SMESH_GroupBase_var aGrp = _this();
|
||||
SALOMEDS::SObject_var anSO = aGen->ObjectToSObject( aStudy, aGrp );
|
||||
if ( !anSO->_is_nil() )
|
||||
{
|
||||
aGen->SetName( anSO, theName );
|
||||
|
||||
// Update Python script
|
||||
TPythonDump() << _this() << ".SetName( '" << theName << "' )";
|
||||
TPythonDump() << anSO << ".SetName( '" << theName << "' )";
|
||||
}
|
||||
}
|
||||
|
||||
@ -259,7 +256,7 @@ void SMESH_Group_i::Clear()
|
||||
myPreMeshInfo->FullLoadFromFile();
|
||||
|
||||
// Update Python script
|
||||
TPythonDump() << _this() << ".Clear()";
|
||||
TPythonDump() << SMESH::SMESH_Group_var(_this()) << ".Clear()";
|
||||
|
||||
// Clear the group
|
||||
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();
|
||||
|
||||
// Update Python script
|
||||
TPythonDump() << "nbAdd = " << _this() << ".Add( " << theIDs << " )";
|
||||
TPythonDump() << "nbAdd = " << SMESH::SMESH_Group_var(_this()) << ".Add( " << theIDs << " )";
|
||||
|
||||
// Add elements to the group
|
||||
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();
|
||||
|
||||
// Update Python script
|
||||
TPythonDump() << "nbDel = " << _this() << ".Remove( " << theIDs << " )";
|
||||
TPythonDump() << "nbDel = " << SMESH::SMESH_Group_var(_this())
|
||||
<< ".Remove( " << theIDs << " )";
|
||||
|
||||
// Remove elements from the group
|
||||
SMESHDS_Group* aGroupDS = dynamic_cast<SMESHDS_Group*>( GetGroupDS() );
|
||||
@ -382,8 +380,9 @@ AddByPredicate( SMESH::Predicate_ptr thePredicate )
|
||||
myPreMeshInfo->FullLoadFromFile();
|
||||
|
||||
if(SMESH::Predicate_i* aPredicate = SMESH::GetPredicate(thePredicate)){
|
||||
TPythonDump()<<_this()<<".AddByPredicate("<<aPredicate<<")";
|
||||
return ChangeByPredicate(aPredicate,GetGroupDS(),&SMESHDS_Group::Add);
|
||||
TPythonDump() << SMESH::SMESH_Group_var(_this())
|
||||
<< ".AddByPredicate( " << aPredicate << " )";
|
||||
return ChangeByPredicate( aPredicate, GetGroupDS(), &SMESHDS_Group::Add );
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -396,7 +395,8 @@ RemoveByPredicate( SMESH::Predicate_ptr thePredicate )
|
||||
myPreMeshInfo->FullLoadFromFile();
|
||||
|
||||
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 0;
|
||||
@ -408,35 +408,18 @@ CORBA::Long SMESH_Group_i::AddFrom( SMESH::SMESH_IDSource_ptr theSource )
|
||||
myPreMeshInfo->FullLoadFromFile();
|
||||
|
||||
TPythonDump pd;
|
||||
long nbAdd = 0;
|
||||
long prevNb = Size();
|
||||
SMESHDS_Group* aGroupDS = dynamic_cast<SMESHDS_Group*>( GetGroupDS() );
|
||||
if (aGroupDS) {
|
||||
SMESH::long_array_var anIds;
|
||||
SMESH::SMESH_GroupBase_var group = SMESH::SMESH_GroupBase::_narrow(theSource);
|
||||
SMESH::SMESH_Mesh_var mesh = SMESH::SMESH_Mesh::_narrow(theSource);
|
||||
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++;
|
||||
}
|
||||
SMDS_ElemIteratorPtr elemIt = SMESH_Mesh_i::GetElements( theSource, GetType() );
|
||||
while ( elemIt->more() )
|
||||
aGroupDS->SMDSGroup().Add( elemIt->next() );
|
||||
}
|
||||
|
||||
// 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;
|
||||
if ( myMeshServant )
|
||||
aMesh = SMESH::SMESH_Mesh::_narrow( myMeshServant->_this() );
|
||||
aMesh = myMeshServant->_this();
|
||||
return aMesh._retn();
|
||||
}
|
||||
|
||||
@ -640,7 +623,9 @@ void SMESH_GroupBase_i::SetColor(const SALOMEDS::Color& color)
|
||||
if ( oldColor != 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)
|
||||
{
|
||||
aGroupDS->SetColorGroup(color);
|
||||
TPythonDump()<<_this()<<".SetColorNumber( "<<color<<" )";
|
||||
TPythonDump()<<SMESH::SMESH_GroupBase_var(_this())<<".SetColorNumber( "<<color<<" )";
|
||||
}
|
||||
MESSAGE("set color number of a group");
|
||||
return ;
|
||||
@ -800,7 +785,7 @@ void SMESH_GroupOnFilter_i::SetFilter(SMESH::Filter_ptr theFilter)
|
||||
if ( SMESHDS_GroupOnFilter* grDS = dynamic_cast< SMESHDS_GroupOnFilter*>( GetGroupDS() ))
|
||||
grDS->SetPredicate( GetPredicate( myFilter ));
|
||||
|
||||
TPythonDump()<< _this() <<".SetFilter( "<<theFilter<<" )";
|
||||
TPythonDump()<< SMESH::SMESH_GroupOnFilter_var(_this()) <<".SetFilter( "<<theFilter<<" )";
|
||||
|
||||
if ( myFilter )
|
||||
{
|
||||
@ -819,7 +804,7 @@ void SMESH_GroupOnFilter_i::SetFilter(SMESH::Filter_ptr theFilter)
|
||||
SMESH::Filter_ptr SMESH_GroupOnFilter_i::GetFilter()
|
||||
{
|
||||
SMESH::Filter_var f = myFilter;
|
||||
TPythonDump() << f << " = " << _this() << ".GetFilter()";
|
||||
TPythonDump() << f << " = " << SMESH::SMESH_GroupOnFilter_var(_this()) << ".GetFilter()";
|
||||
return f._retn();
|
||||
}
|
||||
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "SMESH_Measurements_i.hxx"
|
||||
|
||||
#include "SMESH_Gen_i.hxx"
|
||||
#include "SMESH_Filter_i.hxx"
|
||||
#include "SMESH_PythonDump.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;
|
||||
}
|
||||
|
||||
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
|
||||
// Purpose : minimal distance between two given entities
|
||||
@ -257,3 +276,30 @@ SMESH::Measure Measurements_i::BoundingBox (const SMESH::ListOfIDSources& theSou
|
||||
|
||||
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()) );
|
||||
}
|
||||
|
@ -57,6 +57,22 @@ namespace SMESH
|
||||
* common bounding box of entities
|
||||
*/
|
||||
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);
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -63,6 +63,7 @@
|
||||
#include <Utils_ExceptHandlers.hxx>
|
||||
#include <Utils_CorbaException.hxx>
|
||||
#include <SALOMEDS_wrap.hxx>
|
||||
#include <SALOME_GenericObj_i.hh>
|
||||
|
||||
#include <BRepAdaptor_Surface.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()
|
||||
{
|
||||
deleteAuxIDSources();
|
||||
//deleteAuxIDSources();
|
||||
delete myPreviewMesh; myPreviewMesh = 0;
|
||||
delete myPreviewEditor; myPreviewEditor = 0;
|
||||
}
|
||||
@ -711,10 +712,12 @@ SMESH::ComputeError* SMESH_MeshEditor_i::GetLastError()
|
||||
|
||||
//=======================================================================
|
||||
//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::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::ElementType type)
|
||||
{
|
||||
if ( myAuxIDSources.size() > 10 )
|
||||
deleteAuxIDSources();
|
||||
// if ( myAuxIDSources.size() > 10 ) {
|
||||
// delete myAuxIDSources.front();
|
||||
// myAuxIDSources.pop_front();
|
||||
// }
|
||||
|
||||
_IDSource* idSrc = new _IDSource;
|
||||
idSrc->_mesh = myMesh_i->_this();
|
||||
idSrc->_ids = ids;
|
||||
idSrc->_type = type;
|
||||
myAuxIDSources.push_back( idSrc );
|
||||
//myAuxIDSources.push_back( idSrc );
|
||||
|
||||
SMESH::SMESH_IDSource_var anIDSourceVar = idSrc->_this();
|
||||
|
||||
@ -776,13 +781,13 @@ CORBA::Long* SMESH_MeshEditor_i::GetTemporaryIDs( SMESH::SMESH_IDSource_ptr& idS
|
||||
return 0;
|
||||
}
|
||||
|
||||
void SMESH_MeshEditor_i::deleteAuxIDSources()
|
||||
{
|
||||
std::list< _IDSource* >::iterator idSrcIt = myAuxIDSources.begin();
|
||||
for ( ; idSrcIt != myAuxIDSources.end(); ++idSrcIt )
|
||||
delete *idSrcIt;
|
||||
myAuxIDSources.clear();
|
||||
}
|
||||
// void SMESH_MeshEditor_i::deleteAuxIDSources()
|
||||
// {
|
||||
// std::list< _IDSource* >::iterator idSrcIt = myAuxIDSources.begin();
|
||||
// for ( ; idSrcIt != myAuxIDSources.end(); ++idSrcIt )
|
||||
// delete *idSrcIt;
|
||||
// myAuxIDSources.clear();
|
||||
// }
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
|
@ -1097,8 +1097,8 @@ private: //!< fields
|
||||
|
||||
// temporary IDSources
|
||||
struct _IDSource;
|
||||
std::list< _IDSource* > myAuxIDSources;
|
||||
void deleteAuxIDSources();
|
||||
// std::list< _IDSource* > myAuxIDSources;
|
||||
// void deleteAuxIDSources();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -28,6 +28,11 @@
|
||||
|
||||
#include "SMESH.hxx"
|
||||
|
||||
#include "SMESH_Hypothesis.hxx"
|
||||
#include "SMESH_Mesh.hxx"
|
||||
#include "SMESH_subMesh.hxx"
|
||||
|
||||
#include <SALOME_GenericObj_i.hh>
|
||||
#include <SALOMEconfig.h>
|
||||
#include CORBA_SERVER_HEADER(SMESH_Gen)
|
||||
#include CORBA_SERVER_HEADER(SMESH_Mesh)
|
||||
@ -35,18 +40,13 @@
|
||||
#include CORBA_SERVER_HEADER(SMESH_Hypothesis)
|
||||
#include CORBA_CLIENT_HEADER(GEOM_Gen)
|
||||
|
||||
#include "SMESH_Hypothesis.hxx"
|
||||
#include "SMESH_Mesh.hxx"
|
||||
#include "SMESH_subMesh.hxx"
|
||||
|
||||
#include "SALOME_GenericObj_i.hh"
|
||||
#include <map>
|
||||
|
||||
class SMESH_Gen_i;
|
||||
class SMESH_GroupBase_i;
|
||||
class SMESH_subMesh_i;
|
||||
class SMESH_PreMeshInfo;
|
||||
|
||||
#include <map>
|
||||
class SMESH_MeshEditor_i;
|
||||
|
||||
class SMESH_I_EXPORT SMESH_Mesh_i:
|
||||
public virtual POA_SMESH::SMESH_Mesh,
|
||||
@ -655,6 +655,8 @@ private:
|
||||
std::map<int, SMESH::SMESH_subMesh_ptr> _mapSubMeshIor;
|
||||
std::map<int, SMESH::SMESH_GroupBase_ptr> _mapGroups;
|
||||
std::map<int, SMESH::SMESH_Hypothesis_ptr> _mapHypo;
|
||||
SMESH_MeshEditor_i* _editor;
|
||||
SMESH_MeshEditor_i* _previewEditor;
|
||||
SMESH::MedFileInfo_var _medFileInfo;
|
||||
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)
|
||||
std::string _groupEntry;
|
||||
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;
|
||||
|
||||
@ -683,7 +685,7 @@ private:
|
||||
*/
|
||||
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);
|
||||
|
||||
|
@ -227,6 +227,7 @@ CORBA::Long SMESH_subMesh_i::GetNumberOfNodes(CORBA::Boolean all)
|
||||
if (( aSubMeshDS = aSubMesh->GetSubMeshDS() ))
|
||||
nbNodes += aSubMeshDS->NbNodes();
|
||||
}
|
||||
return nbNodes;
|
||||
}
|
||||
|
||||
return aSubMeshDS ? aSubMeshDS->NbNodes() : 0;
|
||||
|
@ -27,10 +27,9 @@ import salome
|
||||
SMESH = None # SMESH module is loaded only when needed
|
||||
|
||||
from salome.kernel.studyedit import getStudyEditor
|
||||
try:
|
||||
from salome.gui import helper
|
||||
except ImportError:
|
||||
pass
|
||||
from salome.kernel.deprecation import is_called_by_sphinx
|
||||
if not is_called_by_sphinx():
|
||||
from salome.gui import helper
|
||||
|
||||
class SMeshStudyTools:
|
||||
"""
|
||||
|
@ -551,7 +551,9 @@ class smeshBuilder(object, SMESH._objref_SMESH_Gen):
|
||||
aMeshes = [ Mesh(self, self.geompyD, m) for m in aSmeshMeshes ]
|
||||
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 ]
|
||||
# @ingroup l2_impexp
|
||||
def CreateMeshesFromGMF( self, theFileName ):
|
||||
@ -980,6 +982,7 @@ class smeshBuilder(object, SMESH._objref_SMESH_Gen):
|
||||
if not hasattr(src1, "_narrow"): return None
|
||||
src1 = src1._narrow(SMESH.SMESH_IDSource)
|
||||
if not src1: return None
|
||||
unRegister = genObjUnRegister()
|
||||
if id1 != 0:
|
||||
m = src1.GetMesh()
|
||||
e = m.GetMeshEditor()
|
||||
@ -987,6 +990,7 @@ class smeshBuilder(object, SMESH._objref_SMESH_Gen):
|
||||
src1 = e.MakeIDSource([id1], SMESH.FACE)
|
||||
else:
|
||||
src1 = e.MakeIDSource([id1], SMESH.NODE)
|
||||
unRegister.set( src1 )
|
||||
pass
|
||||
if hasattr(src2, "_narrow"):
|
||||
src2 = src2._narrow(SMESH.SMESH_IDSource)
|
||||
@ -997,11 +1001,12 @@ class smeshBuilder(object, SMESH._objref_SMESH_Gen):
|
||||
src2 = e.MakeIDSource([id2], SMESH.FACE)
|
||||
else:
|
||||
src2 = e.MakeIDSource([id2], SMESH.NODE)
|
||||
unRegister.set( src2 )
|
||||
pass
|
||||
pass
|
||||
aMeasurements = self.CreateMeasurements()
|
||||
unRegister.set( aMeasurements )
|
||||
result = aMeasurements.MinDistance(src1, src2)
|
||||
aMeasurements.UnRegister()
|
||||
return result
|
||||
|
||||
## Get bounding box of the specified object(s)
|
||||
@ -1041,6 +1046,44 @@ class smeshBuilder(object, SMESH._objref_SMESH_Gen):
|
||||
aMeasurements.UnRegister()
|
||||
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
|
||||
#Registering the new proxy for SMESH_Gen
|
||||
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,
|
||||
overwrite=1, meshPart=None, autoDimension=True):
|
||||
if meshPart:
|
||||
unRegister = genObjUnRegister()
|
||||
if isinstance( meshPart, list ):
|
||||
meshPart = self.GetIDSource( meshPart, SMESH.ALL )
|
||||
unRegister.set( meshPart )
|
||||
self.mesh.ExportPartToMED( meshPart, f, auto_groups, version, overwrite, autoDimension)
|
||||
else:
|
||||
self.mesh.ExportToMEDX(f, auto_groups, version, overwrite, autoDimension)
|
||||
@ -1598,8 +1643,10 @@ class Mesh:
|
||||
# @ingroup l2_impexp
|
||||
def ExportDAT(self, f, meshPart=None):
|
||||
if meshPart:
|
||||
unRegister = genObjUnRegister()
|
||||
if isinstance( meshPart, list ):
|
||||
meshPart = self.GetIDSource( meshPart, SMESH.ALL )
|
||||
unRegister.set( meshPart )
|
||||
self.mesh.ExportPartToDAT( meshPart, f )
|
||||
else:
|
||||
self.mesh.ExportDAT(f)
|
||||
@ -1610,8 +1657,10 @@ class Mesh:
|
||||
# @ingroup l2_impexp
|
||||
def ExportUNV(self, f, meshPart=None):
|
||||
if meshPart:
|
||||
unRegister = genObjUnRegister()
|
||||
if isinstance( meshPart, list ):
|
||||
meshPart = self.GetIDSource( meshPart, SMESH.ALL )
|
||||
unRegister.set( meshPart )
|
||||
self.mesh.ExportPartToUNV( meshPart, f )
|
||||
else:
|
||||
self.mesh.ExportUNV(f)
|
||||
@ -1623,8 +1672,10 @@ class Mesh:
|
||||
# @ingroup l2_impexp
|
||||
def ExportSTL(self, f, ascii=1, meshPart=None):
|
||||
if meshPart:
|
||||
unRegister = genObjUnRegister()
|
||||
if isinstance( meshPart, list ):
|
||||
meshPart = self.GetIDSource( meshPart, SMESH.ALL )
|
||||
unRegister.set( meshPart )
|
||||
self.mesh.ExportPartToSTL( meshPart, f, ascii )
|
||||
else:
|
||||
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
|
||||
# @ingroup l2_impexp
|
||||
def ExportCGNS(self, f, overwrite=1, meshPart=None):
|
||||
unRegister = genObjUnRegister()
|
||||
if isinstance( meshPart, list ):
|
||||
meshPart = self.GetIDSource( meshPart, SMESH.ALL )
|
||||
unRegister.set( meshPart )
|
||||
if isinstance( meshPart, Mesh ):
|
||||
meshPart = meshPart.mesh
|
||||
elif not meshPart:
|
||||
meshPart = self.mesh
|
||||
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 meshPart a part of mesh (group, sub-mesh) to export instead of the mesh
|
||||
# @ingroup l2_impexp
|
||||
def ExportGMF(self, f, meshPart=None):
|
||||
unRegister = genObjUnRegister()
|
||||
if isinstance( meshPart, list ):
|
||||
meshPart = self.GetIDSource( meshPart, SMESH.ALL )
|
||||
unRegister.set( meshPart )
|
||||
if isinstance( meshPart, Mesh ):
|
||||
meshPart = meshPart.mesh
|
||||
elif not meshPart:
|
||||
@ -1664,9 +1721,15 @@ class Mesh:
|
||||
# @param opt boolean parameter for creating/not creating
|
||||
# the groups Group_On_All_Nodes, Group_On_All_Faces, ...
|
||||
# @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
|
||||
def ExportToMED(self, f, version, opt=0, overwrite=1):
|
||||
self.mesh.ExportToMEDX(f, opt, version, overwrite)
|
||||
def ExportToMED(self, f, version, opt=0, overwrite=1, autoDimension=True):
|
||||
self.mesh.ExportToMEDX(f, opt, version, overwrite, autoDimension)
|
||||
|
||||
# Operations with groups:
|
||||
# ----------------------
|
||||
@ -2428,7 +2491,7 @@ class Mesh:
|
||||
|
||||
aMeasurements = self.smeshpyD.CreateMeasurements()
|
||||
aMeasure = aMeasurements.MinDistance(id1, id2)
|
||||
aMeasurements.UnRegister()
|
||||
genObjUnRegister([aMeasurements,id1, id2])
|
||||
return aMeasure
|
||||
|
||||
## Get bounding box of the specified object(s)
|
||||
@ -2461,6 +2524,7 @@ class Mesh:
|
||||
if len(IDs) > 0 and isinstance(IDs[0], int):
|
||||
IDs = [IDs]
|
||||
srclist = []
|
||||
unRegister = genObjUnRegister()
|
||||
for o in IDs:
|
||||
if isinstance(o, Mesh):
|
||||
srclist.append(o.mesh)
|
||||
@ -2473,11 +2537,12 @@ class Mesh:
|
||||
srclist.append(self.editor.MakeIDSource(o, SMESH.FACE))
|
||||
else:
|
||||
srclist.append(self.editor.MakeIDSource(o, SMESH.NODE))
|
||||
unRegister.set( srclist[-1] )
|
||||
pass
|
||||
pass
|
||||
aMeasurements = self.smeshpyD.CreateMeasurements()
|
||||
unRegister.set( aMeasurements )
|
||||
aMeasure = aMeasurements.BoundingBox(srclist)
|
||||
aMeasurements.UnRegister()
|
||||
return aMeasure
|
||||
|
||||
# Mesh edition (SMESH_MeshEditor functionality):
|
||||
@ -2530,10 +2595,12 @@ class Mesh:
|
||||
# can be retrieved from the returned object by calling GetIDs()
|
||||
# @ingroup l2_modif_add
|
||||
def Add0DElementsToAllNodes(self, theObject, theGroupName=""):
|
||||
unRegister = genObjUnRegister()
|
||||
if isinstance( theObject, Mesh ):
|
||||
theObject = theObject.GetMesh()
|
||||
if isinstance( theObject, list ):
|
||||
theObject = self.GetIDSource( theObject, SMESH.ALL )
|
||||
unRegister.set( theObject )
|
||||
return self.editor.Create0DElementsOnAllNodes( theObject, theGroupName )
|
||||
|
||||
## Creates a ball element on a node with given ID.
|
||||
@ -2803,11 +2870,13 @@ class Mesh:
|
||||
# @return number of reoriented faces
|
||||
# @ingroup l2_modif_changori
|
||||
def Reorient2D(self, the2DObject, theDirection, theFaceOrPoint ):
|
||||
unRegister = genObjUnRegister()
|
||||
# check the2DObject
|
||||
if isinstance( the2DObject, Mesh ):
|
||||
the2DObject = the2DObject.GetMesh()
|
||||
if isinstance( the2DObject, list ):
|
||||
the2DObject = self.GetIDSource( the2DObject, SMESH.FACE )
|
||||
unRegister.set( the2DObject )
|
||||
# check theDirection
|
||||
if isinstance( theDirection, geomBuilder.GEOM._objref_GEOM_Object):
|
||||
theDirection = self.smeshpyD.GetDirStruct( theDirection )
|
||||
@ -2897,12 +2966,14 @@ class Mesh:
|
||||
# group or a list of face IDs. By default all quadrangles are split
|
||||
# @ingroup l2_modif_cutquadr
|
||||
def QuadTo4Tri (self, theElements=[]):
|
||||
unRegister = genObjUnRegister()
|
||||
if isinstance( theElements, Mesh ):
|
||||
theElements = theElements.mesh
|
||||
elif not theElements:
|
||||
theElements = self.mesh
|
||||
elif isinstance( theElements, list ):
|
||||
theElements = self.GetIDSource( theElements, SMESH.FACE )
|
||||
unRegister.set( theElements )
|
||||
return self.editor.QuadTo4Tri( theElements )
|
||||
|
||||
## Splits quadrangles into triangles.
|
||||
@ -2942,10 +3013,12 @@ class Mesh:
|
||||
# Hex_5Tet - split the hexahedron into 5 tetrahedrons, etc
|
||||
# @ingroup l2_modif_cutquadr
|
||||
def SplitVolumesIntoTetra(self, elemIDs, method=smeshBuilder.Hex_5Tet ):
|
||||
unRegister = genObjUnRegister()
|
||||
if isinstance( elemIDs, Mesh ):
|
||||
elemIDs = elemIDs.GetMesh()
|
||||
if ( isinstance( elemIDs, list )):
|
||||
elemIDs = self.editor.MakeIDSource(elemIDs, SMESH.VOLUME)
|
||||
unRegister.set( elemIDs )
|
||||
self.editor.SplitVolumesIntoTetra(elemIDs, method)
|
||||
|
||||
## Splits quadrangle faces near triangular facets of volumes
|
||||
@ -3216,12 +3289,14 @@ class Mesh:
|
||||
# @ingroup l2_modif_edit
|
||||
def MakeBoundaryMesh(self, elements, dimension=SMESH.BND_2DFROM3D, groupName="", meshName="",
|
||||
toCopyElements=False, toCopyExistingBondary=False):
|
||||
unRegister = genObjUnRegister()
|
||||
if isinstance( elements, Mesh ):
|
||||
elements = elements.GetMesh()
|
||||
if ( isinstance( elements, list )):
|
||||
elemType = SMESH.ALL
|
||||
if elements: elemType = self.GetElementType( elements[0], iselem=True)
|
||||
elements = self.editor.MakeIDSource(elements, elemType)
|
||||
unRegister.set( elements )
|
||||
mesh, group = self.editor.MakeBoundaryMesh(elements,dimension,groupName,meshName,
|
||||
toCopyElements,toCopyExistingBondary)
|
||||
if mesh: mesh = self.smeshpyD.Mesh(mesh)
|
||||
@ -3530,8 +3605,10 @@ class Mesh:
|
||||
# @param LinearVariation forces the computation of rotation angles as linear
|
||||
# variation of the given Angles along path steps
|
||||
# @param HasRefPoint allows using the reference point
|
||||
# @param RefPoint the point around which the shape is rotated (the mass center of the shape by default).
|
||||
# @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.
|
||||
# RefPoint can be either GEOM Vertex, [x,y,z] or SMESH.PointStruct
|
||||
# @param MakeGroups forces the generation of new groups from existing ones
|
||||
# @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,
|
||||
@ -3540,9 +3617,12 @@ class Mesh:
|
||||
def ExtrusionAlongPathX(self, Base, Path, NodeStart,
|
||||
HasAngles, Angles, LinearVariation,
|
||||
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)
|
||||
pass
|
||||
elif isinstance( RefPoint, list ):
|
||||
RefPoint = PointStruct(*RefPoint)
|
||||
pass
|
||||
Angles,AnglesParameters,hasVars = ParseAngles(Angles)
|
||||
Parameters = AnglesParameters + var_separator + RefPoint.parameters
|
||||
self.mesh.SetParameters(Parameters)
|
||||
@ -3899,10 +3979,12 @@ class Mesh:
|
||||
# @return list of created groups (SMESH_GroupBase) if MakeGroups=True,
|
||||
# empty list otherwise
|
||||
def Scale(self, theObject, thePoint, theScaleFact, Copy, MakeGroups=False):
|
||||
unRegister = genObjUnRegister()
|
||||
if ( isinstance( theObject, Mesh )):
|
||||
theObject = theObject.GetMesh()
|
||||
if ( isinstance( theObject, list )):
|
||||
theObject = self.GetIDSource(theObject, SMESH.ALL)
|
||||
unRegister.set( theObject )
|
||||
if ( isinstance( theScaleFact, float )):
|
||||
theScaleFact = [theScaleFact]
|
||||
if ( isinstance( theScaleFact, int )):
|
||||
@ -3923,10 +4005,12 @@ class Mesh:
|
||||
# @param NewMeshName - the name of the newly created mesh
|
||||
# @return instance of Mesh class
|
||||
def ScaleMakeMesh(self, theObject, thePoint, theScaleFact, MakeGroups=False, NewMeshName=""):
|
||||
unRegister = genObjUnRegister()
|
||||
if (isinstance(theObject, Mesh)):
|
||||
theObject = theObject.GetMesh()
|
||||
if ( isinstance( theObject, list )):
|
||||
theObject = self.GetIDSource(theObject,SMESH.ALL)
|
||||
unRegister.set( theObject )
|
||||
if ( isinstance( theScaleFact, float )):
|
||||
theScaleFact = [theScaleFact]
|
||||
if ( isinstance( theScaleFact, int )):
|
||||
@ -4035,12 +4119,14 @@ class Mesh:
|
||||
# @return the list of groups of nodes
|
||||
# @ingroup l2_modif_trsf
|
||||
def FindCoincidentNodesOnPart (self, SubMeshOrGroup, Tolerance, exceptNodes=[]):
|
||||
unRegister = genObjUnRegister()
|
||||
if (isinstance( SubMeshOrGroup, Mesh )):
|
||||
SubMeshOrGroup = SubMeshOrGroup.GetMesh()
|
||||
if not isinstance( exceptNodes, list):
|
||||
exceptNodes = [ exceptNodes ]
|
||||
if exceptNodes and isinstance( exceptNodes[0], int):
|
||||
exceptNodes = [ self.GetIDSource( exceptNodes, SMESH.NODE)]
|
||||
unRegister.set( exceptNodes )
|
||||
return self.editor.FindCoincidentNodesOnPartBut(SubMeshOrGroup, Tolerance,exceptNodes)
|
||||
|
||||
## Merges nodes
|
||||
@ -4151,10 +4237,12 @@ class Mesh:
|
||||
# @return a group where the new elements are added. None if theGroupName == "".
|
||||
# @ingroup l2_modif_edit
|
||||
def DoubleElements(self, theElements, theGroupName=""):
|
||||
unRegister = genObjUnRegister()
|
||||
if isinstance( theElements, Mesh ):
|
||||
theElements = theElements.mesh
|
||||
elif isinstance( theElements, list ):
|
||||
theElements = self.GetIDSource( theElements, SMESH.ALL )
|
||||
unRegister.set( theElements )
|
||||
return self.editor.DoubleElements(theElements, theGroupName)
|
||||
|
||||
## Creates a hole in a mesh by doubling the nodes of some particular elements
|
||||
@ -4347,26 +4435,41 @@ class Mesh:
|
||||
val = 0
|
||||
return val
|
||||
|
||||
## Get length of 1D element.
|
||||
# @param elemId mesh element ID
|
||||
# @return element's length value
|
||||
## Get length of 1D element or sum of lengths of all 1D mesh elements
|
||||
# @param elemId mesh element ID (if not defined - sum of length of all 1D elements will be calculated)
|
||||
# @return element's length value if \a elemId is specified or sum of all 1D mesh elements' lengths otherwise
|
||||
# @ingroup l1_measurements
|
||||
def GetLength(self, elemId):
|
||||
return self._valueFromFunctor(SMESH.FT_Length, elemId)
|
||||
def GetLength(self, elemId=None):
|
||||
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.
|
||||
# @param elemId mesh element ID
|
||||
# @return element's area value
|
||||
## Get area of 2D element or sum of areas of all 2D mesh elements
|
||||
# @param elemId mesh element ID (if not defined - sum of areas of all 2D elements will be calculated)
|
||||
# @return element's area value if \a elemId is specified or sum of all 2D mesh elements' areas otherwise
|
||||
# @ingroup l1_measurements
|
||||
def GetArea(self, elemId):
|
||||
return self._valueFromFunctor(SMESH.FT_Area, elemId)
|
||||
def GetArea(self, elemId=None):
|
||||
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.
|
||||
# @param elemId mesh element ID
|
||||
# @return element's volume value
|
||||
## Get volume of 3D element or sum of volumes of all 3D mesh elements
|
||||
# @param elemId mesh element ID (if not defined - sum of volumes of all 3D elements will be calculated)
|
||||
# @return element's volume value if \a elemId is specified or sum of all 3D mesh elements' volumes otherwise
|
||||
# @ingroup l1_measurements
|
||||
def GetVolume(self, elemId):
|
||||
return self._valueFromFunctor(SMESH.FT_Volume3D, elemId)
|
||||
def GetVolume(self, elemId=None):
|
||||
volume = 0
|
||||
if elemId == None:
|
||||
volume = self.smeshpyD.GetVolume(self)
|
||||
else:
|
||||
volume = self._valueFromFunctor(SMESH.FT_Volume3D, elemId)
|
||||
return volume
|
||||
|
||||
## Get maximum element length.
|
||||
# @param elemId mesh element ID
|
||||
@ -4510,6 +4613,28 @@ class hypMethodWrapper:
|
||||
raise ValueError, detail # wrong variable name
|
||||
|
||||
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( ":" ):
|
||||
#
|
||||
|
@ -182,10 +182,11 @@ namespace // INTERNAL STUFF
|
||||
if ( !_importMeshSubDS ) return;
|
||||
SMDS_ElemIteratorPtr eIt = _importMeshSubDS->GetElements();
|
||||
while ( eIt->more() )
|
||||
meshDS->RemoveFreeElement( eIt->next(), _importMeshSubDS, /*fromGroups=*/false );
|
||||
meshDS->RemoveFreeElement( eIt->next(), 0, /*fromGroups=*/false );
|
||||
SMDS_NodeIteratorPtr nIt = _importMeshSubDS->GetNodes();
|
||||
while ( nIt->more() )
|
||||
meshDS->RemoveFreeNode( nIt->next(), _importMeshSubDS, /*fromGroups=*/false );
|
||||
meshDS->RemoveFreeNode( nIt->next(), 0, /*fromGroups=*/false );
|
||||
_importMeshSubDS->Clear();
|
||||
_n2n.clear();
|
||||
_e2e.clear();
|
||||
}
|
||||
@ -266,6 +267,7 @@ namespace // INTERNAL STUFF
|
||||
const SMESH_Hypothesis* hyp);
|
||||
void removeSubmesh( SMESH_subMesh* sm, _ListenerData* data );
|
||||
void clearSubmesh ( SMESH_subMesh* sm, _ListenerData* data, bool clearAllSub );
|
||||
void clearN2N ( SMESH_Mesh* tgtMesh );
|
||||
|
||||
// mark sm as missing src hyp with valid groups
|
||||
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
|
||||
* \param sm - cleared submesh
|
||||
@ -448,6 +462,8 @@ namespace // INTERNAL STUFF
|
||||
default:;
|
||||
}
|
||||
}
|
||||
if ( !data->mySubMeshes.empty() )
|
||||
clearN2N( data->mySubMeshes.front()->GetFather() );
|
||||
}
|
||||
else // event of Import submesh
|
||||
{
|
||||
@ -496,6 +512,10 @@ namespace // INTERNAL STUFF
|
||||
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;
|
||||
|
||||
//MESSAGE("---------> StdMeshers_Import_1D::Compute");
|
||||
const vector<SMESH_Group*>& srcGroups = _sourceHyp->GetGroups(/*loaded=*/true);
|
||||
if ( srcGroups.empty() )
|
||||
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);
|
||||
n = SMESH_Algo::VertexNode( v, tgtMesh );
|
||||
//MESSAGE("_gen->Compute " << n);
|
||||
if ( !n ) return false; // very strange
|
||||
}
|
||||
vertexNodes.push_back( SMESH_TNodeXYZ( n ));
|
||||
//MESSAGE("SMESH_Algo::VertexNode " << n->GetID() << " " << n->X() << " " << n->Y() << " " << n->Z() );
|
||||
}
|
||||
|
||||
// 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();
|
||||
vector<const SMDS_MeshNode*> newNodes;
|
||||
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
|
||||
{
|
||||
const SMDS_MeshElement* edge = srcElems->next();
|
||||
// find or create nodes of a new edge
|
||||
newNodes.resize( edge->NbNodes() );
|
||||
//MESSAGE("edge->NbNodes " << edge->NbNodes());
|
||||
newNodes.back() = 0;
|
||||
SMDS_MeshElement::iterator node = edge->begin_nodes();
|
||||
SMESH_TNodeXYZ a(edge->GetNode(0));
|
||||
// --- define a tolerance relative to the length of an edge
|
||||
double mytol = a.Distance(edge->GetNode(edge->NbNodes()-1))/25;
|
||||
//mytol = max(1.E-5, 10*edgeTol); // too strict and not necessary
|
||||
//MESSAGE("mytol = " << mytol);
|
||||
for ( unsigned i = 0; i < newNodes.size(); ++i, ++node )
|
||||
{
|
||||
@ -697,22 +722,26 @@ bool StdMeshers_Import_1D::Compute(SMESH_Mesh & theMesh, const TopoDS_Shape & th
|
||||
for ( vNIt = vertexNodes.begin(); vNIt != vertexNodes.end(); ++vNIt)
|
||||
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;
|
||||
vertexNodes.erase( vNIt );
|
||||
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 )
|
||||
{
|
||||
// find out if node lies on theShape
|
||||
//double dxyz[4];
|
||||
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());
|
||||
n2nIt->second = newNode;
|
||||
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 ))
|
||||
@ -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] );
|
||||
else
|
||||
newEdge = tgtMesh->AddEdge( newNodes[0], newNodes[1]);
|
||||
//MESSAGE("add Edge");
|
||||
//MESSAGE("add Edge " << newNodes[0]->GetID() << " " << newNodes[1]->GetID());
|
||||
tgtMesh->SetMeshElementOnShape( newEdge, shapeID );
|
||||
e2e->insert( make_pair( edge, newEdge ));
|
||||
}
|
||||
|
@ -371,6 +371,61 @@ namespace {
|
||||
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
|
||||
|
||||
//=======================================================================
|
||||
@ -705,10 +760,11 @@ bool StdMeshers_Prism_3D::getWallFaces( Prism_3D::TPrismTopo & thePrism,
|
||||
list< TopoDS_Edge >::iterator edge = thePrism.myBottomEdges.begin();
|
||||
std::list< int >::iterator nbE = thePrism.myNbEdgesInWires.begin();
|
||||
int iE = 0;
|
||||
double f,l;
|
||||
while ( edge != thePrism.myBottomEdges.end() )
|
||||
{
|
||||
++iE;
|
||||
if ( BRep_Tool::Degenerated( *edge ))
|
||||
if ( BRep_Tool::Curve( *edge, f,l ).IsNull() )
|
||||
{
|
||||
edge = thePrism.myBottomEdges.erase( edge );
|
||||
--iE;
|
||||
@ -989,6 +1045,9 @@ bool StdMeshers_Prism_3D::compute(const Prism_3D::TPrismTopo& thePrism)
|
||||
if ( !SMESH_Block::ShellPoint( params, myShapeXYZ, coords ))
|
||||
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("BOT Node "<< tBotNode.myNode->GetID(),gpXYZ(tBotNode.myNode));
|
||||
SHOWYXZ("ShellPoint ",coords);
|
||||
@ -2150,9 +2209,16 @@ bool StdMeshers_PrismAsBlock::Init(SMESH_MesherHelper* helper,
|
||||
myParam2ColumnMaps.resize( thePrism.myBottomEdges.size() ); // total nb edges
|
||||
|
||||
size_t iE, nbEdges = thePrism.myNbEdgesInWires.front(); // nb outer edges
|
||||
vector< double > edgeLength( nbEdges );
|
||||
vector< double > edgeLength( nbEdges );
|
||||
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();
|
||||
for ( iE = 0; iE < nbEdges; ++iE, ++edgeIt )
|
||||
{
|
||||
@ -2172,14 +2238,8 @@ bool StdMeshers_PrismAsBlock::Init(SMESH_MesherHelper* helper,
|
||||
|
||||
edgeLength[ iE ] = SMESH_Algo::EdgeLength( *edgeIt );
|
||||
|
||||
if ( nbEdges < NB_WALL_FACES ) // fill map used to split faces
|
||||
{
|
||||
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 ));
|
||||
}
|
||||
if ( nbSides < NB_WALL_FACES ) // fill map used to split faces
|
||||
len2edgeMap.insert( make_pair( edgeLength[ iE ], iE )); // sort edges by length
|
||||
}
|
||||
// Load columns of internal edges (forming holes)
|
||||
// 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
|
||||
// -------------------------------
|
||||
|
||||
if ( nbEdges <= NB_WALL_FACES ) // ************* Split faces if necessary
|
||||
if ( nbSides <= NB_WALL_FACES ) // ************* Split faces if necessary
|
||||
{
|
||||
map< int, int > iE2nbSplit;
|
||||
if ( nbEdges != NB_WALL_FACES ) // define how to split
|
||||
if ( nbSides != NB_WALL_FACES ) // define how to split
|
||||
{
|
||||
if ( len2edgeMap.size() != nbEdges )
|
||||
RETURN_BAD_RESULT("Uniqueness of edge lengths not assured");
|
||||
@ -2232,80 +2291,106 @@ bool StdMeshers_PrismAsBlock::Init(SMESH_MesherHelper* helper,
|
||||
double midLen = ( len2edgeMap.size() == 1 ) ? 0 : midLen_i->first;
|
||||
switch ( nbEdges ) {
|
||||
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
|
||||
if ( maxLen / 3 > midLen / 2 ) {
|
||||
iE2nbSplit.insert( make_pair( maxLen_i->second, 3 ));
|
||||
nbSplitPerEdge[ maxLen_i->second ] = 3;
|
||||
}
|
||||
else {
|
||||
iE2nbSplit.insert( make_pair( maxLen_i->second, 2 ));
|
||||
iE2nbSplit.insert( make_pair( midLen_i->second, 2 ));
|
||||
nbSplitPerEdge[ maxLen_i->second ] = 2;
|
||||
nbSplitPerEdge[ midLen_i->second ] = 2;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
// split longest into halves
|
||||
iE2nbSplit.insert( make_pair( maxLen_i->second, 2 ));
|
||||
}
|
||||
}
|
||||
// Create TSideFace's
|
||||
int iSide = 0;
|
||||
list< TopoDS_Edge >::const_iterator botE = thePrism.myBottomEdges.begin();
|
||||
for ( iE = 0; iE < nbEdges; ++iE, ++botE )
|
||||
{
|
||||
TFaceQuadStructPtr quad = thePrism.myWallQuads[ iE ].front();
|
||||
// split?
|
||||
map< int, int >::iterator i_nb = iE2nbSplit.find( iE );
|
||||
if ( i_nb != iE2nbSplit.end() ) {
|
||||
// split!
|
||||
int nbSplit = i_nb->second;
|
||||
vector< double > params;
|
||||
splitParams( nbSplit, &myParam2ColumnMaps[ iE ], params );
|
||||
const bool isForward =
|
||||
StdMeshers_PrismAsBlock::IsForwardEdge( myHelper->GetMeshDS(),
|
||||
myParam2ColumnMaps[iE],
|
||||
*botE, SMESH_Block::ID_Fx0z );
|
||||
for ( int i = 0; i < nbSplit; ++i ) {
|
||||
double f = ( isForward ? params[ i ] : params[ nbSplit - i-1 ]);
|
||||
double l = ( isForward ? params[ i+1 ] : params[ nbSplit - i ]);
|
||||
TSideFace* comp = new TSideFace( *mesh, wallFaceIds[ iSide ],
|
||||
thePrism.myWallQuads[ iE ], *botE,
|
||||
&myParam2ColumnMaps[ iE ], f, l );
|
||||
mySide->SetComponent( iSide++, comp );
|
||||
}
|
||||
}
|
||||
else {
|
||||
TSideFace* comp = new TSideFace( *mesh, wallFaceIds[ iSide ],
|
||||
thePrism.myWallQuads[ iE ], *botE,
|
||||
&myParam2ColumnMaps[ iE ]);
|
||||
mySide->SetComponent( iSide++, comp );
|
||||
if ( nbSides == 2 )
|
||||
// split longest into 3 parts
|
||||
nbSplitPerEdge[ maxLen_i->second ] = 3;
|
||||
else
|
||||
// split longest into halves
|
||||
nbSplitPerEdge[ maxLen_i->second ] = 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
else { // **************************** Unite faces
|
||||
|
||||
// unite first faces
|
||||
int nbExraFaces = nbEdges - 3;
|
||||
int iSide = 0, iE;
|
||||
double u0 = 0, sumLen = 0;
|
||||
for ( iE = 0; iE < nbExraFaces; ++iE )
|
||||
sumLen += edgeLength[ iE ];
|
||||
|
||||
vector< TSideFace* > components( nbExraFaces );
|
||||
vector< pair< double, double> > params( nbExraFaces );
|
||||
list< TopoDS_Edge >::const_iterator botE = thePrism.myBottomEdges.begin();
|
||||
for ( iE = 0; iE < nbExraFaces; ++iE, ++botE )
|
||||
else // **************************** Unite faces
|
||||
{
|
||||
int nbExraFaces = nbSides - 3; // nb of faces to fuse
|
||||
for ( iE = 0; iE < nbEdges; ++iE )
|
||||
{
|
||||
components[ iE ] = new TSideFace( *mesh, wallFaceIds[ iSide ],
|
||||
thePrism.myWallQuads[ iE ], *botE,
|
||||
&myParam2ColumnMaps[ iE ]);
|
||||
double u1 = u0 + edgeLength[ iE ] / sumLen;
|
||||
params[ iE ] = make_pair( u0 , u1 );
|
||||
u0 = u1;
|
||||
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;
|
||||
}
|
||||
mySide->SetComponent( iSide++, new TSideFace( *mesh, components, params ));
|
||||
}
|
||||
|
||||
// fill the rest faces
|
||||
for ( ; iE < nbEdges; ++iE, ++botE )
|
||||
// Create TSideFace's
|
||||
int iSide = 0;
|
||||
list< TopoDS_Edge >::const_iterator botE = thePrism.myBottomEdges.begin();
|
||||
for ( iE = 0; iE < nbEdges; ++iE, ++botE )
|
||||
{
|
||||
TFaceQuadStructPtr quad = thePrism.myWallQuads[ iE ].front();
|
||||
const int nbSplit = nbSplitPerEdge[ iE ];
|
||||
const int nbExraFaces = nbUnitePerEdge[ iE ] + 1;
|
||||
if ( nbSplit > 0 ) // split
|
||||
{
|
||||
vector< double > params;
|
||||
splitParams( nbSplit, &myParam2ColumnMaps[ iE ], params );
|
||||
const bool isForward =
|
||||
StdMeshers_PrismAsBlock::IsForwardEdge( myHelper->GetMeshDS(),
|
||||
myParam2ColumnMaps[iE],
|
||||
*botE, SMESH_Block::ID_Fx0z );
|
||||
for ( int i = 0; i < nbSplit; ++i ) {
|
||||
double f = ( isForward ? params[ i ] : params[ nbSplit - i-1 ]);
|
||||
double l = ( isForward ? params[ i+1 ] : params[ nbSplit - i ]);
|
||||
TSideFace* comp = new TSideFace( *mesh, wallFaceIds[ iSide ],
|
||||
thePrism.myWallQuads[ iE ], *botE,
|
||||
&myParam2ColumnMaps[ iE ], f, l );
|
||||
mySide->SetComponent( iSide++, comp );
|
||||
}
|
||||
}
|
||||
else if ( nbExraFaces > 1 ) // unite
|
||||
{
|
||||
double u0 = 0, sumLen = 0;
|
||||
for ( int i = iE; i < iE + nbExraFaces; ++i )
|
||||
sumLen += edgeLength[ i ];
|
||||
|
||||
vector< TSideFace* > components( nbExraFaces );
|
||||
vector< pair< double, double> > params( nbExraFaces );
|
||||
bool endReached = false;
|
||||
for ( int i = 0; i < nbExraFaces; ++i, ++botE, ++iE )
|
||||
{
|
||||
if ( iE == nbEdges )
|
||||
{
|
||||
endReached = true;
|
||||
botE = thePrism.myBottomEdges.begin();
|
||||
iE = 0;
|
||||
}
|
||||
components[ i ] = new TSideFace( *mesh, wallFaceIds[ iSide ],
|
||||
thePrism.myWallQuads[ iE ], *botE,
|
||||
&myParam2ColumnMaps[ iE ]);
|
||||
double u1 = u0 + edgeLength[ iE ] / sumLen;
|
||||
params[ i ] = make_pair( u0 , u1 );
|
||||
u0 = u1;
|
||||
}
|
||||
TSideFace* comp = new TSideFace( *mesh, components, params );
|
||||
mySide->SetComponent( iSide++, comp );
|
||||
if ( endReached )
|
||||
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 ],
|
||||
thePrism.myWallQuads[ iE ], *botE,
|
||||
@ -2423,15 +2508,20 @@ bool StdMeshers_PrismAsBlock::Init(SMESH_MesherHelper* helper,
|
||||
}
|
||||
}
|
||||
|
||||
// gp_XYZ testPar(0.25, 0.25, 0), testCoord;
|
||||
// if ( !FacePoint( ID_BOT_FACE, testPar, testCoord ))
|
||||
// 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);
|
||||
|
||||
// double _u[]={ 0.1, 0.1, 0.9, 0.9 };
|
||||
// double _v[]={ 0.1, 0.9, 0.1, 0.9, };
|
||||
// for ( int i = 0; i < 4; ++i )
|
||||
// {
|
||||
// //gp_XYZ testPar(0.25, 0.25, 0), testCoord;
|
||||
// gp_XYZ testPar(_u[i], _v[i], 0), testCoord;
|
||||
// if ( !FacePoint( ID_BOT_FACE, testPar, testCoord ))
|
||||
// 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;
|
||||
}
|
||||
|
||||
@ -2603,6 +2693,8 @@ StdMeshers_PrismAsBlock::TSideFace::TSideFace(SMESH_Mesh& mesh,
|
||||
myIsForward = StdMeshers_PrismAsBlock::IsForwardEdge( myHelper.GetMeshDS(),
|
||||
*myParamToColumnMap,
|
||||
myBaseEdge, myID );
|
||||
myHelper.SetSubShape( quadList.front()->face );
|
||||
|
||||
if ( quadList.size() > 1 ) // side is vertically composite
|
||||
{
|
||||
// fill myShapeID2Surf map to enable finding a right surface by any sub-shape ID
|
||||
@ -2646,7 +2738,20 @@ TSideFace(SMESH_Mesh& mesh,
|
||||
myIsForward( true ),
|
||||
myComponents( components ),
|
||||
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
|
||||
@ -2925,7 +3030,8 @@ gp_Pnt StdMeshers_PrismAsBlock::TSideFace::Value(const Standard_Real U,
|
||||
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 uv2 = myHelper.GetNodeUV( mySurface->Face(), nn[1], nn[3]);
|
||||
gp_XY uv12 = uv1 * ( 1 - vR ) + uv2 * vR;
|
||||
|