23151: EDF 9626 SMESH: Opening an existing study makes salome end with an allocation error when closing.

Fix ~SMESH_Gen_i()

Regression 2D_mesh_Polygons_00/A2
  Fix DriverSTL_W_SMDS_Mesh.cxx

IPAL52658: Quadrangle (Mapping) makes invalid mesh with Enforced vertices
IPAL52654: Quadrangle (Mapping) with enforced vertices works wrong
IPAL20729: Difference in behaviour of selection for Rotation against Translation, Symmetry after Apply.
IPAL9947: SMESH – Merge nodes dialog box
This commit is contained in:
eap 2015-09-02 17:39:00 +03:00
parent 859219d598
commit 081f12102e
13 changed files with 365 additions and 308 deletions

View File

@ -43,7 +43,8 @@ information about the selected mesh node(s) or element(s), namely:
- For a node: - For a node:
- Node ID; - Node ID;
- Coordinates (X, Y, Z); - Coordinates (X, Y, Z);
- Connectivity information (connected elements); - Connectivity information (connected elements); double click in
this line makes the dialog show information of these elements;
- Position on a shape (for meshes built on a geometry); - Position on a shape (for meshes built on a geometry);
- Groups information (names of groups the node belongs to). - Groups information (names of groups the node belongs to).
@ -55,7 +56,8 @@ information about the selected mesh node(s) or element(s), namely:
- Element ID; - Element ID;
- Type (triangle, quadrangle, etc.); - Type (triangle, quadrangle, etc.);
- Gravity center (X, Y, Z coordinates); - Gravity center (X, Y, Z coordinates);
- Connectivity information (connected nodes); - Connectivity information (connected nodes); double click in
a line of a node makes the dialog show information of this node;
- Quality controls (area, aspect ration, volume, etc.); - Quality controls (area, aspect ration, volume, etc.);
- Position on a shape (for meshes built on a geometry); - Position on a shape (for meshes built on a geometry);
- Groups information (names of groups the element belongs to). - Groups information (names of groups the element belongs to).
@ -63,7 +65,7 @@ information about the selected mesh node(s) or element(s), namely:
<center>\image html eleminfo2.png <center>\image html eleminfo2.png
<em>"Element Info" page, element information</em></center> <em>"Element Info" page, element information</em></center>
The use can either input the ID of a node or element he wants to The user can either input the ID of a node or element he wants to
analyze directly in the dialog box or select the node(s) or element(s) in analyze directly in the dialog box or select the node(s) or element(s) in
the 3D viewer. the 3D viewer.

View File

@ -252,9 +252,10 @@ namespace
gp_XY p = _prev->_xy - v->_xy; gp_XY p = _prev->_xy - v->_xy;
gp_XY t = this->_xy - v->_xy; gp_XY t = this->_xy - v->_xy;
gp_XY n = _next->_xy - v->_xy; gp_XY n = _next->_xy - v->_xy;
return (( p ^ t ) > 0 && const double tol = -1e-12;
( t ^ n ) > 0 && return (( p ^ t ) >= tol &&
( n ^ p ) > 0 ); ( t ^ n ) >= tol &&
( n ^ p ) >= tol );
// return ( Area( _prev, this, v ) > 0 && // return ( Area( _prev, this, v ) > 0 &&
// Area( this, _next, v ) > 0 && // Area( this, _next, v ) > 0 &&
// Area( _next, _prev, v ) > 0 ); // Area( _next, _prev, v ) > 0 );
@ -370,6 +371,7 @@ namespace
v->GetTriaNodes( &nodes[ iN ] ); v->GetTriaNodes( &nodes[ iN ] );
iN += 3; iN += 3;
v = v->Delete(); v = v->Delete();
--nbVertices;
} }
return true; return true;

View File

@ -1011,7 +1011,7 @@ bool SMDS_VolumeTool::IsFaceExternal( int faceIndex ) const
ori = ( minProj < 0 ? +1 : -1 ); ori = ( minProj < 0 ? +1 : -1 );
me->myPolyFacetOri[ faceIndex ] = ori; me->myPolyFacetOri[ faceIndex ] = ori;
if ( !me->myFwdLinks.empty() ) // concave polyhedron; collect oriented links if ( !myFwdLinks.empty() ) // concave polyhedron; collect oriented links
for ( int i = 0; i < myCurFace.myNbNodes; ++i ) for ( int i = 0; i < myCurFace.myNbNodes; ++i )
{ {
NLink link( myCurFace.myNodes[i], myCurFace.myNodes[i+1], ori ); NLink link( myCurFace.myNodes[i], myCurFace.myNodes[i+1], ori );
@ -1024,10 +1024,10 @@ bool SMDS_VolumeTool::IsFaceExternal( int faceIndex ) const
// concave polyhedron // concave polyhedron
if ( me->myFwdLinks.empty() ) // get links of the least ambiguously oriented facet if ( myFwdLinks.empty() ) // get links of the least ambiguously oriented facet
{ {
for ( size_t i = 0; i < myPolyFacetOri.size() && !ori; ++i ) for ( size_t i = 0; i < myPolyFacetOri.size() && !ori; ++i )
ori = me->myPolyFacetOri[ i ]; ori = myPolyFacetOri[ i ];
if ( !ori ) // none facet is oriented yet if ( !ori ) // none facet is oriented yet
{ {
@ -1058,10 +1058,10 @@ bool SMDS_VolumeTool::IsFaceExternal( int faceIndex ) const
me->myPolyFacetOri[ faceMostConvex ] = ori; me->myPolyFacetOri[ faceMostConvex ] = ori;
} }
} }
// collect links of the oriented facets in me->myFwdLinks // collect links of the oriented facets in myFwdLinks
for ( size_t iF = 0; iF < myPolyFacetOri.size(); ++iF ) for ( size_t iF = 0; iF < myPolyFacetOri.size(); ++iF )
{ {
ori = me->myPolyFacetOri[ iF ]; ori = myPolyFacetOri[ iF ];
if ( !ori ) continue; if ( !ori ) continue;
setFace( iF ); setFace( iF );
for ( int i = 0; i < myCurFace.myNbNodes; ++i ) for ( int i = 0; i < myCurFace.myNbNodes; ++i )
@ -1079,8 +1079,8 @@ bool SMDS_VolumeTool::IsFaceExternal( int faceIndex ) const
for ( int i = 0; i < myCurFace.myNbNodes && !ori; ++i ) for ( int i = 0; i < myCurFace.myNbNodes && !ori; ++i )
{ {
NLink link( myCurFace.myNodes[i], myCurFace.myNodes[i+1] ); NLink link( myCurFace.myNodes[i], myCurFace.myNodes[i+1] );
std::map<Link, int>::iterator l2o = me->myFwdLinks.find( link ); std::map<Link, int>::const_iterator l2o = myFwdLinks.find( link );
if ( l2o != me->myFwdLinks.end() ) if ( l2o != myFwdLinks.end() )
ori = link.myOri * l2o->second * -1; ori = link.myOri * l2o->second * -1;
links[ i ] = link; links[ i ] = link;
} }
@ -1089,15 +1089,15 @@ bool SMDS_VolumeTool::IsFaceExternal( int faceIndex ) const
// orient and collect links of other non-oriented facets // orient and collect links of other non-oriented facets
for ( size_t iF = 0; iF < myPolyFacetOri.size(); ++iF ) for ( size_t iF = 0; iF < myPolyFacetOri.size(); ++iF )
{ {
if ( me->myPolyFacetOri[ iF ] ) continue; // already oriented if ( myPolyFacetOri[ iF ] ) continue; // already oriented
setFace( iF ); setFace( iF );
links2.clear(); links2.clear();
ori = 0; ori = 0;
for ( int i = 0; i < myCurFace.myNbNodes && !ori; ++i ) for ( int i = 0; i < myCurFace.myNbNodes && !ori; ++i )
{ {
NLink link( myCurFace.myNodes[i], myCurFace.myNodes[i+1] ); NLink link( myCurFace.myNodes[i], myCurFace.myNodes[i+1] );
std::map<Link, int>::iterator l2o = me->myFwdLinks.find( link ); std::map<Link, int>::const_iterator l2o = myFwdLinks.find( link );
if ( l2o != me->myFwdLinks.end() ) if ( l2o != myFwdLinks.end() )
ori = link.myOri * l2o->second * -1; ori = link.myOri * l2o->second * -1;
links2.push_back( link ); links2.push_back( link );
} }
@ -1116,8 +1116,8 @@ bool SMDS_VolumeTool::IsFaceExternal( int faceIndex ) const
ori = 0; ori = 0;
for ( size_t i = 0; i < links.size() && !ori; ++i ) for ( size_t i = 0; i < links.size() && !ori; ++i )
{ {
std::map<Link, int>::iterator l2o = me->myFwdLinks.find( links[i] ); std::map<Link, int>::const_iterator l2o = myFwdLinks.find( links[i] );
if ( l2o != me->myFwdLinks.end() ) if ( l2o != myFwdLinks.end() )
ori = links[i].myOri * l2o->second * -1; ori = links[i].myOri * l2o->second * -1;
} }
me->myPolyFacetOri[ faceIndex ] = ori; me->myPolyFacetOri[ faceIndex ] = ori;

View File

@ -649,10 +649,10 @@ gp_XY SMESH_MesherHelper::GetNodeUV(const TopoDS_Face& F,
} }
catch (Standard_Failure& exc) { catch (Standard_Failure& exc) {
} }
if ( !uvOK ) { if ( !uvOK )
for ( TopExp_Explorer vert(F,TopAbs_VERTEX); !uvOK && vert.More(); vert.Next() ) {
uvOK = ( V == vert.Current() ); if ( !IsSubShape( V, F ))
if ( !uvOK ) { {
MESSAGE ( "SMESH_MesherHelper::GetNodeUV(); Vertex " << vertexID MESSAGE ( "SMESH_MesherHelper::GetNodeUV(); Vertex " << vertexID
<< " not in face " << GetMeshDS()->ShapeToIndex( F ) ); << " not in face " << GetMeshDS()->ShapeToIndex( F ) );
// get UV of a vertex closest to the node // get UV of a vertex closest to the node
@ -669,7 +669,8 @@ gp_XY SMESH_MesherHelper::GetNodeUV(const TopoDS_Face& F,
} }
} }
} }
else { else
{
uvOK = false; uvOK = false;
TopTools_ListIteratorOfListOfShape it( myMesh->GetAncestors( V )); TopTools_ListIteratorOfListOfShape it( myMesh->GetAncestors( V ));
for ( ; it.More(); it.Next() ) { for ( ; it.More(); it.Next() ) {
@ -678,13 +679,23 @@ gp_XY SMESH_MesherHelper::GetNodeUV(const TopoDS_Face& F,
double f,l; double f,l;
Handle(Geom2d_Curve) C2d = BRep_Tool::CurveOnSurface(edge, F, f, l); Handle(Geom2d_Curve) C2d = BRep_Tool::CurveOnSurface(edge, F, f, l);
if ( !C2d.IsNull() ) { if ( !C2d.IsNull() ) {
double u = ( V == TopExp::FirstVertex( edge ) ) ? f : l; double u = ( V == IthVertex( 0, edge )) ? f : l;
uv = C2d->Value( u ); uv = C2d->Value( u );
uvOK = true; uvOK = true;
break; break;
} }
} }
} }
if ( !uvOK && V.Orientation() == TopAbs_INTERNAL )
{
Handle(ShapeAnalysis_Surface) projector = GetSurface( F );
if ( n2 ) uv = GetNodeUV( F, n2 );
if ( Precision::IsInfinite( uv.X() ))
uv = projector->NextValueOfUV( uv, BRep_Tool::Pnt( V ), BRep_Tool::Tolerance( F ));
else
uv = projector->ValueOfUV( BRep_Tool::Pnt( V ), BRep_Tool::Tolerance( F ));
uvOK = ( projector->Gap() < getFaceMaxTol( F ));
}
} }
} }
if ( n2 && IsSeamShape( vertexID )) if ( n2 && IsSeamShape( vertexID ))
@ -812,7 +823,7 @@ GeomAPI_ProjectPointOnSurf& SMESH_MesherHelper::GetProjector(const TopoDS_Face&
//purpose : Return a cached ShapeAnalysis_Surface of a FACE //purpose : Return a cached ShapeAnalysis_Surface of a FACE
//======================================================================= //=======================================================================
Handle(ShapeAnalysis_Surface) SMESH_MesherHelper::GetSurface(const TopoDS_Face& F ) Handle(ShapeAnalysis_Surface) SMESH_MesherHelper::GetSurface(const TopoDS_Face& F ) const
{ {
Handle(Geom_Surface) surface = BRep_Tool::Surface( F ); Handle(Geom_Surface) surface = BRep_Tool::Surface( F );
int faceID = GetMeshDS()->ShapeToIndex( F ); int faceID = GetMeshDS()->ShapeToIndex( F );

View File

@ -532,7 +532,7 @@ public:
/*! /*!
* \brief Return a cached ShapeAnalysis_Surface of a FACE * \brief Return a cached ShapeAnalysis_Surface of a FACE
*/ */
Handle(ShapeAnalysis_Surface) GetSurface(const TopoDS_Face& F ); Handle(ShapeAnalysis_Surface) GetSurface(const TopoDS_Face& F ) const;
/*! /*!
* \brief Check if shape is a degenerated edge or it's vertex * \brief Check if shape is a degenerated edge or it's vertex
@ -739,7 +739,7 @@ public:
typedef std::map< int, Handle(ShapeAnalysis_Surface)> TID2Surface; typedef std::map< int, Handle(ShapeAnalysis_Surface)> TID2Surface;
typedef std::map< int, GeomAPI_ProjectPointOnSurf* > TID2ProjectorOnSurf; typedef std::map< int, GeomAPI_ProjectPointOnSurf* > TID2ProjectorOnSurf;
typedef std::map< int, GeomAPI_ProjectPointOnCurve* > TID2ProjectorOnCurve; typedef std::map< int, GeomAPI_ProjectPointOnCurve* > TID2ProjectorOnCurve;
TID2Surface myFace2Surface; mutable TID2Surface myFace2Surface;
TID2ProjectorOnSurf myFace2Projector; TID2ProjectorOnSurf myFace2Projector;
TID2ProjectorOnCurve myEdge2Projector; TID2ProjectorOnCurve myEdge2Projector;

View File

@ -898,7 +898,13 @@ void SMESHGUI_MergeDlg::updateControls()
{ {
if (ListEdit->count() == 0) if (ListEdit->count() == 0)
SetFirstButton->setEnabled(false); SetFirstButton->setEnabled(false);
bool enable = !(myMesh->_is_nil()) && (ListCoincident->count() || (myTypeId == TYPE_AUTO));
bool groupsEmpty = ( myTypeId != TYPE_AUTO );
for (int i = 0; i < ListCoincident->count() && groupsEmpty; i++) {
QStringList aListIds = ListCoincident->item(i)->text().split(" ", QString::SkipEmptyParts);
groupsEmpty = ( aListIds.count() < 2 );
}
bool enable = ( !myMesh->_is_nil() && !groupsEmpty );
buttonOk->setEnabled(enable); buttonOk->setEnabled(enable);
buttonApply->setEnabled(enable); buttonApply->setEnabled(enable);
DetectButton->setEnabled( !myMesh->_is_nil() ); DetectButton->setEnabled( !myMesh->_is_nil() );

View File

@ -32,7 +32,6 @@
#include "SMESHGUI_MeshUtils.h" #include "SMESHGUI_MeshUtils.h"
#include "SMESHGUI_IdValidator.h" #include "SMESHGUI_IdValidator.h"
#include "SMESHGUI_FilterDlg.h" #include "SMESHGUI_FilterDlg.h"
#include "SMESHGUI_MeshEditPreview.h"
#include <SMESH_Actor.h> #include <SMESH_Actor.h>
#include <SMESH_TypeFilter.hxx> #include <SMESH_TypeFilter.hxx>
@ -362,9 +361,21 @@ void SMESHGUI_RotationDlg::Init (bool ResetControls)
buttonOk->setEnabled(false); buttonOk->setEnabled(false);
buttonApply->setEnabled(false); buttonApply->setEnabled(false);
if ( !ResetControls && !isApplyAndClose() && // make highlight move upon [Apply] (IPAL20729)
myActor && !myActor->getIO().IsNull() &&
ActionGroup->button( MOVE_ELEMS_BUTTON )->isChecked() &&
!CheckBoxMesh->isChecked() ) // move selected elements
{
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
{
aViewWindow->highlight( myActor->getIO(), false, false );
aViewWindow->highlight( myActor->getIO(), true, true );
}
}
myActor = 0; myActor = 0;
if (ResetControls) { if (ResetControls)
{
SpinBox_X->SetValue(0.0); SpinBox_X->SetValue(0.0);
SpinBox_Y->SetValue(0.0); SpinBox_Y->SetValue(0.0);
SpinBox_Z->SetValue(0.0); SpinBox_Z->SetValue(0.0);
@ -378,10 +389,6 @@ void SMESHGUI_RotationDlg::Init (bool ResetControls)
CheckBoxMesh->setChecked(false); CheckBoxMesh->setChecked(false);
myPreviewCheckBox->setChecked(false); myPreviewCheckBox->setChecked(false);
onDisplaySimulation(false); onDisplaySimulation(false);
// MakeGroupsCheck->setChecked(false);
// MakeGroupsCheck->setEnabled(false);
// onSelectMesh(false);
} }
onSelectMesh(CheckBoxMesh->isChecked()); onSelectMesh(CheckBoxMesh->isChecked());
@ -524,7 +531,6 @@ bool SMESHGUI_RotationDlg::ClickOnApply()
anApp->browseObjects( anEntryList, isApplyAndClose() ); anApp->browseObjects( anEntryList, isApplyAndClose() );
} }
Init(false); Init(false);
SelectionIntoArgument();
SMESHGUI::Modified(); SMESHGUI::Modified();
} }
@ -747,47 +753,8 @@ void SMESHGUI_RotationDlg::SelectionIntoArgument()
if ( myMeshes.isEmpty() ) if ( myMeshes.isEmpty() )
return; return;
// get IDs from mesh
/*
SMDS_Mesh* aSMDSMesh = myActor->GetObject()->GetMesh();
if (!aSMDSMesh)
return;
for (int i = aSMDSMesh->MinElementID(); i <= aSMDSMesh->MaxElementID(); i++) {
const SMDS_MeshElement * e = aSMDSMesh->FindElement(i);
if (e) {
myElementsId += QString(" %1").arg(i);
aNbUnits++;
} }
} else {
} else if (!SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO)->_is_nil()) { //SUBMESH
// get submesh
SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(IO);
// get IDs from submesh
SMESH::long_array_var anElementsIds = new SMESH::long_array;
anElementsIds = aSubMesh->GetElementsId();
for (int i = 0; i < anElementsIds->length(); i++) {
myElementsId += QString(" %1").arg(anElementsIds[i]);
}
aNbUnits = anElementsIds->length();
} else { // GROUP
// get smesh group
SMESH::SMESH_GroupBase_var aGroup =
SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IO);
if (aGroup->_is_nil())
return;
// get IDs from smesh group
SMESH::long_array_var anElementsIds = new SMESH::long_array;
anElementsIds = aGroup->GetListOfID();
for (int i = 0; i < anElementsIds->length(); i++) {
myElementsId += QString(" %1").arg(anElementsIds[i]);
}
aNbUnits = anElementsIds->length();
}
*/
} else {
aNbUnits = SMESH::GetNameOfSelectedElements(mySelector, aList.First(), aString); aNbUnits = SMESH::GetNameOfSelectedElements(mySelector, aList.First(), aString);
myElementsId = aString; myElementsId = aString;
if (aNbUnits < 1) if (aNbUnits < 1)
@ -980,7 +947,6 @@ void SMESHGUI_RotationDlg::onSelectMesh (bool toSelectMesh)
aViewWindow->SetSelectionMode( CellSelection ); aViewWindow->SetSelectionMode( CellSelection );
LineEditElements->setReadOnly(false); LineEditElements->setReadOnly(false);
LineEditElements->setValidator(myIdValidator); LineEditElements->setValidator(myIdValidator);
onTextChange(LineEditElements->text());
hidePreview(); hidePreview();
} }

View File

@ -407,7 +407,7 @@ bool SMESHGUI_SmoothingDlg::ClickOnApply()
if (aResult) { if (aResult) {
SMESH::Update(myIO, SMESH::eDisplay); SMESH::Update(myIO, SMESH::eDisplay);
SMESHGUI::Modified(); SMESHGUI::Modified();
Init(); //Init();
mySelectedObject = SMESH::SMESH_IDSource::_nil(); mySelectedObject = SMESH::SMESH_IDSource::_nil();
} }
@ -560,7 +560,7 @@ void SMESHGUI_SmoothingDlg::onTextChange (const QString& theNewText)
//================================================================================= //=================================================================================
// function : SelectionIntoArgument() // function : SelectionIntoArgument()
// purpose : Called when selection as changed or other case // purpose : Called when selection has changed or other cases
//================================================================================= //=================================================================================
void SMESHGUI_SmoothingDlg::SelectionIntoArgument() void SMESHGUI_SmoothingDlg::SelectionIntoArgument()
{ {
@ -594,9 +594,8 @@ void SMESHGUI_SmoothingDlg::SelectionIntoArgument()
SALOME_ListIO aList; SALOME_ListIO aList;
mySelectionMgr->selectedObjects(aList); mySelectionMgr->selectedObjects(aList);
int nbSel = aList.Extent(); int nbSel = aList.Extent();
if (nbSel != 1) if (nbSel == 1)
return; {
Handle(SALOME_InteractiveObject) IO = aList.First(); Handle(SALOME_InteractiveObject) IO = aList.First();
if (myEditCurrentArgument == LineEditElements) { if (myEditCurrentArgument == LineEditElements) {
@ -633,6 +632,7 @@ void SMESHGUI_SmoothingDlg::SelectionIntoArgument()
{ {
myNbOkNodes = SMESH::GetNameOfSelectedNodes(mySelector, IO, aString); myNbOkNodes = SMESH::GetNameOfSelectedNodes(mySelector, IO, aString);
} }
}
myEditCurrentArgument->setText(aString); myEditCurrentArgument->setText(aString);
myEditCurrentArgument->repaint(); myEditCurrentArgument->repaint();

View File

@ -32,7 +32,6 @@
#include "SMESHGUI_MeshUtils.h" #include "SMESHGUI_MeshUtils.h"
#include "SMESHGUI_IdValidator.h" #include "SMESHGUI_IdValidator.h"
#include "SMESHGUI_FilterDlg.h" #include "SMESHGUI_FilterDlg.h"
#include "SMESHGUI_MeshEditPreview.h"
#include <SMESH_Actor.h> #include <SMESH_Actor.h>
#include <SMESH_TypeFilter.hxx> #include <SMESH_TypeFilter.hxx>
@ -358,14 +357,25 @@ void SMESHGUI_SymmetryDlg::Init (bool ResetControls)
myObjects.clear(); myObjects.clear();
myObjectsNames.clear(); myObjectsNames.clear();
myEditCurrentArgument = 0; myEditCurrentArgument = LineEditElements;
LineEditElements->clear(); LineEditElements->setFocus();
myElementsId = ""; myElementsId = "";
myNbOkElements = 0; myNbOkElements = 0;
buttonOk->setEnabled(false); buttonOk->setEnabled(false);
buttonApply->setEnabled(false); buttonApply->setEnabled(false);
if ( !ResetControls && !isApplyAndClose() && // make highlight move upon [Apply] (IPAL20729)
myActor && !myActor->getIO().IsNull() &&
ActionGroup->button( MOVE_ELEMS_BUTTON )->isChecked() &&
!CheckBoxMesh->isChecked() ) // move selected elements
{
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
{
aViewWindow->highlight( myActor->getIO(), false, false );
aViewWindow->highlight( myActor->getIO(), true, true );
}
}
myActor = 0; myActor = 0;
if (ResetControls) { if (ResetControls) {
@ -380,11 +390,8 @@ void SMESHGUI_SymmetryDlg::Init (bool ResetControls)
CheckBoxMesh->setChecked(false); CheckBoxMesh->setChecked(false);
myPreviewCheckBox->setChecked(false); myPreviewCheckBox->setChecked(false);
onDisplaySimulation(false); onDisplaySimulation(false);
// MakeGroupsCheck->setChecked(false);
// MakeGroupsCheck->setEnabled(false);
onSelectMesh(false);
} }
onSelectMesh(CheckBoxMesh->isChecked());
} }
//================================================================================= //=================================================================================
@ -584,8 +591,6 @@ bool SMESHGUI_SymmetryDlg::ClickOnApply()
anApp->browseObjects( anEntryList, isApplyAndClose() ); anApp->browseObjects( anEntryList, isApplyAndClose() );
} }
Init(false); Init(false);
ConstructorsClicked(GetConstructorId());
SelectionIntoArgument();
SMESHGUI::Modified(); SMESHGUI::Modified();
} }

View File

@ -362,14 +362,25 @@ void SMESHGUI_TranslationDlg::Init (bool ResetControls)
myObjectsNames.clear(); myObjectsNames.clear();
myMeshes.clear(); myMeshes.clear();
myEditCurrentArgument = 0; myEditCurrentArgument = LineEditElements;
LineEditElements->clear(); LineEditElements->setFocus();
myElementsId = ""; myElementsId = "";
myNbOkElements = 0; myNbOkElements = 0;
buttonOk->setEnabled(false); buttonOk->setEnabled(false);
buttonApply->setEnabled(false); buttonApply->setEnabled(false);
if ( !ResetControls && !isApplyAndClose() && // make highlight move upon [Apply] (IPAL20729)
myActor && !myActor->getIO().IsNull() &&
ActionGroup->button( MOVE_ELEMS_BUTTON )->isChecked() &&
!CheckBoxMesh->isChecked() ) // move selected elements
{
if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
{
aViewWindow->highlight( myActor->getIO(), false, false );
aViewWindow->highlight( myActor->getIO(), true, true );
}
}
myActor = 0; myActor = 0;
if (ResetControls) { if (ResetControls) {
@ -382,12 +393,10 @@ void SMESHGUI_TranslationDlg::Init (bool ResetControls)
ActionGroup->button( MOVE_ELEMS_BUTTON )->setChecked(true); ActionGroup->button( MOVE_ELEMS_BUTTON )->setChecked(true);
CheckBoxMesh->setChecked(false); CheckBoxMesh->setChecked(false);
// MakeGroupsCheck->setChecked(false);
// MakeGroupsCheck->setEnabled(false);
myPreviewCheckBox->setChecked(false); myPreviewCheckBox->setChecked(false);
onDisplaySimulation(false); onDisplaySimulation(false);
onSelectMesh(false);
} }
onSelectMesh(CheckBoxMesh->isChecked());
} }
//================================================================================= //=================================================================================
@ -593,7 +602,6 @@ bool SMESHGUI_TranslationDlg::ClickOnApply()
Init(false); Init(false);
ConstructorsClicked(GetConstructorId()); ConstructorsClicked(GetConstructorId());
SelectionIntoArgument();
SMESHGUI::Modified(); SMESHGUI::Modified();
} }
@ -999,7 +1007,6 @@ void SMESHGUI_TranslationDlg::onSelectMesh (bool toSelectMesh)
aViewWindow->SetSelectionMode( CellSelection ); aViewWindow->SetSelectionMode( CellSelection );
LineEditElements->setReadOnly(false); LineEditElements->setReadOnly(false);
LineEditElements->setValidator(myIdValidator); LineEditElements->setValidator(myIdValidator);
onTextChange(LineEditElements->text());
hidePreview(); hidePreview();
} }
@ -1138,7 +1145,8 @@ bool SMESHGUI_TranslationDlg::isValid()
// function : onDisplaySimulation // function : onDisplaySimulation
// purpose : Show/Hide preview // purpose : Show/Hide preview
//================================================================================= //=================================================================================
void SMESHGUI_TranslationDlg::onDisplaySimulation( bool toDisplayPreview ) { void SMESHGUI_TranslationDlg::onDisplaySimulation( bool toDisplayPreview )
{
if (myPreviewCheckBox->isChecked() && toDisplayPreview) { if (myPreviewCheckBox->isChecked() && toDisplayPreview) {
if (isValid() && myNbOkElements) { if (isValid() && myNbOkElements) {

View File

@ -339,10 +339,17 @@ SMESH_Gen_i::~SMESH_Gen_i()
MESSAGE( "SMESH_Gen_i::~SMESH_Gen_i" ); MESSAGE( "SMESH_Gen_i::~SMESH_Gen_i" );
// delete hypothesis creators // delete hypothesis creators
map<string, GenericHypothesisCreator_i*>::iterator itHyp; map<string, GenericHypothesisCreator_i*>::iterator itHyp, itHyp2;
for (itHyp = myHypCreatorMap.begin(); itHyp != myHypCreatorMap.end(); itHyp++) for (itHyp = myHypCreatorMap.begin(); itHyp != myHypCreatorMap.end(); itHyp++)
{ {
delete (*itHyp).second; // same creator can be mapped under different names
GenericHypothesisCreator_i* creator = (*itHyp).second;
if ( !creator )
continue;
delete creator;
for (itHyp2 = itHyp; itHyp2 != myHypCreatorMap.end(); itHyp2++)
if ( creator == (*itHyp2).second )
(*itHyp2).second = 0;
} }
myHypCreatorMap.clear(); myHypCreatorMap.clear();

View File

@ -228,6 +228,7 @@ bool StdMeshers_Quadrangle_2D::Compute (SMESH_Mesh& aMesh,
myHelper = &helper; myHelper = &helper;
_quadraticMesh = myHelper->IsQuadraticSubMesh(aShape); _quadraticMesh = myHelper->IsQuadraticSubMesh(aShape);
myHelper->SetElementsOnShape( true );
myNeedSmooth = false; myNeedSmooth = false;
myCheckOri = false; myCheckOri = false;
@ -471,10 +472,7 @@ bool StdMeshers_Quadrangle_2D::computeQuadDominant(SMESH_Mesh& aMesh,
b = quad->uv_grid[ j * nbhoriz + i + 1].node; b = quad->uv_grid[ j * nbhoriz + i + 1].node;
c = quad->uv_grid[(j + 1) * nbhoriz + i + 1].node; c = quad->uv_grid[(j + 1) * nbhoriz + i + 1].node;
d = quad->uv_grid[(j + 1) * nbhoriz + i ].node; d = quad->uv_grid[(j + 1) * nbhoriz + i ].node;
SMDS_MeshFace* face = myHelper->AddFace(a, b, c, d); myHelper->AddFace(a, b, c, d);
if (face) {
meshDS->SetMeshElementOnShape(face, geomFaceID);
}
} }
} }
@ -558,8 +556,7 @@ bool StdMeshers_Quadrangle_2D::computeQuadDominant(SMESH_Mesh& aMesh,
} }
if (near == g) { // make triangle if (near == g) { // make triangle
SMDS_MeshFace* face = myHelper->AddFace(a, b, c); myHelper->AddFace(a, b, c);
if (face) meshDS->SetMeshElementOnShape(face, geomFaceID);
} }
else { // make quadrangle else { // make quadrangle
if (near - 1 < ilow) if (near - 1 < ilow)
@ -569,8 +566,7 @@ bool StdMeshers_Quadrangle_2D::computeQuadDominant(SMESH_Mesh& aMesh,
//SMDS_MeshFace* face = meshDS->AddFace(a, b, c, d); //SMDS_MeshFace* face = meshDS->AddFace(a, b, c, d);
if (!myTrianglePreference){ if (!myTrianglePreference){
SMDS_MeshFace* face = myHelper->AddFace(a, b, c, d); myHelper->AddFace(a, b, c, d);
if (face) meshDS->SetMeshElementOnShape(face, geomFaceID);
} }
else { else {
splitQuadFace(meshDS, geomFaceID, a, b, c, d); splitQuadFace(meshDS, geomFaceID, a, b, c, d);
@ -584,8 +580,7 @@ bool StdMeshers_Quadrangle_2D::computeQuadDominant(SMESH_Mesh& aMesh,
d = uv_e3[1].node; d = uv_e3[1].node;
else else
d = quad->uv_grid[nbhoriz + k - 1].node; d = quad->uv_grid[nbhoriz + k - 1].node;
SMDS_MeshFace* face = myHelper->AddFace(a, c, d); myHelper->AddFace(a, c, d);
if (face) meshDS->SetMeshElementOnShape(face, geomFaceID);
} }
} }
g = near; g = near;
@ -642,14 +637,12 @@ bool StdMeshers_Quadrangle_2D::computeQuadDominant(SMESH_Mesh& aMesh,
d = quad->UVPt( g, nbvertic-2 ).node; d = quad->UVPt( g, nbvertic-2 ).node;
if ( myTrianglePreference ) if ( myTrianglePreference )
{ {
if ( SMDS_MeshFace* face = myHelper->AddFace(a, d, c)) myHelper->AddFace(a, d, c);
meshDS->SetMeshElementOnShape(face, geomFaceID);
} }
else else
{ {
if ( SMDS_MeshFace* face = myHelper->AddFace(a, b, d, c)) if ( SMDS_MeshFace* face = myHelper->AddFace(a, b, d, c))
{ {
meshDS->SetMeshElementOnShape(face, geomFaceID);
SMESH_ComputeErrorPtr& err = aMesh.GetSubMesh( aFace )->GetComputeError(); SMESH_ComputeErrorPtr& err = aMesh.GetSubMesh( aFace )->GetComputeError();
if ( !err || err->IsOK() || err->myName < COMPERR_WARNING ) if ( !err || err->IsOK() || err->myName < COMPERR_WARNING )
{ {
@ -696,8 +689,7 @@ bool StdMeshers_Quadrangle_2D::computeQuadDominant(SMESH_Mesh& aMesh,
} }
if (near == g) { // make triangle if (near == g) { // make triangle
SMDS_MeshFace* face = myHelper->AddFace(a, b, c); myHelper->AddFace(a, b, c);
if (face) meshDS->SetMeshElementOnShape(face, geomFaceID);
} }
else { // make quadrangle else { // make quadrangle
if (near + 1 > iup) if (near + 1 > iup)
@ -706,8 +698,7 @@ bool StdMeshers_Quadrangle_2D::computeQuadDominant(SMESH_Mesh& aMesh,
d = quad->uv_grid[nbhoriz*(nbvertic - 2) + near + 1].node; d = quad->uv_grid[nbhoriz*(nbvertic - 2) + near + 1].node;
//SMDS_MeshFace* face = meshDS->AddFace(a, b, c, d); //SMDS_MeshFace* face = meshDS->AddFace(a, b, c, d);
if (!myTrianglePreference){ if (!myTrianglePreference){
SMDS_MeshFace* face = myHelper->AddFace(a, b, c, d); myHelper->AddFace(a, b, c, d);
if (face) meshDS->SetMeshElementOnShape(face, geomFaceID);
} }
else { else {
splitQuadFace(meshDS, geomFaceID, a, b, c, d); splitQuadFace(meshDS, geomFaceID, a, b, c, d);
@ -720,8 +711,7 @@ bool StdMeshers_Quadrangle_2D::computeQuadDominant(SMESH_Mesh& aMesh,
d = uv_e1[nbright - 2].node; d = uv_e1[nbright - 2].node;
else else
d = quad->uv_grid[nbhoriz*(nbvertic - 2) + k + 1].node; d = quad->uv_grid[nbhoriz*(nbvertic - 2) + k + 1].node;
SMDS_MeshFace* face = myHelper->AddFace(a, c, d); myHelper->AddFace(a, c, d);
if (face) meshDS->SetMeshElementOnShape(face, geomFaceID);
} }
} }
g = near; g = near;
@ -770,8 +760,7 @@ bool StdMeshers_Quadrangle_2D::computeQuadDominant(SMESH_Mesh& aMesh,
} }
if (near == g) { // make triangle if (near == g) { // make triangle
SMDS_MeshFace* face = myHelper->AddFace(a, b, c); myHelper->AddFace(a, b, c);
if (face) meshDS->SetMeshElementOnShape(face, geomFaceID);
} }
else { // make quadrangle else { // make quadrangle
if (near - 1 < jlow) if (near - 1 < jlow)
@ -781,8 +770,7 @@ bool StdMeshers_Quadrangle_2D::computeQuadDominant(SMESH_Mesh& aMesh,
//SMDS_MeshFace* face = meshDS->AddFace(a, b, c, d); //SMDS_MeshFace* face = meshDS->AddFace(a, b, c, d);
if (!myTrianglePreference){ if (!myTrianglePreference){
SMDS_MeshFace* face = myHelper->AddFace(a, b, c, d); myHelper->AddFace(a, b, c, d);
if (face) meshDS->SetMeshElementOnShape(face, geomFaceID);
} }
else { else {
splitQuadFace(meshDS, geomFaceID, a, b, c, d); splitQuadFace(meshDS, geomFaceID, a, b, c, d);
@ -795,8 +783,7 @@ bool StdMeshers_Quadrangle_2D::computeQuadDominant(SMESH_Mesh& aMesh,
d = uv_e0[nbdown - 2].node; d = uv_e0[nbdown - 2].node;
else else
d = quad->uv_grid[nbhoriz*k - 2].node; d = quad->uv_grid[nbhoriz*k - 2].node;
SMDS_MeshFace* face = myHelper->AddFace(a, c, d); myHelper->AddFace(a, c, d);
if (face) meshDS->SetMeshElementOnShape(face, geomFaceID);
} }
} }
g = near; g = near;
@ -823,14 +810,12 @@ bool StdMeshers_Quadrangle_2D::computeQuadDominant(SMESH_Mesh& aMesh,
d = quad->UVPt( 1, g ).node; d = quad->UVPt( 1, g ).node;
if ( myTrianglePreference ) if ( myTrianglePreference )
{ {
if ( SMDS_MeshFace* face = myHelper->AddFace(a, d, c)) myHelper->AddFace(a, d, c);
meshDS->SetMeshElementOnShape(face, geomFaceID);
} }
else else
{ {
if ( SMDS_MeshFace* face = myHelper->AddFace(a, b, d, c)) if ( SMDS_MeshFace* face = myHelper->AddFace(a, b, d, c))
{ {
meshDS->SetMeshElementOnShape(face, geomFaceID);
SMESH_ComputeErrorPtr& err = aMesh.GetSubMesh( aFace )->GetComputeError(); SMESH_ComputeErrorPtr& err = aMesh.GetSubMesh( aFace )->GetComputeError();
if ( !err || err->IsOK() || err->myName < COMPERR_WARNING ) if ( !err || err->IsOK() || err->myName < COMPERR_WARNING )
{ {
@ -876,8 +861,7 @@ bool StdMeshers_Quadrangle_2D::computeQuadDominant(SMESH_Mesh& aMesh,
} }
if (near == g) { // make triangle if (near == g) { // make triangle
SMDS_MeshFace* face = myHelper->AddFace(a, b, c); myHelper->AddFace(a, b, c);
if (face) meshDS->SetMeshElementOnShape(face, geomFaceID);
} }
else { // make quadrangle else { // make quadrangle
if (near + 1 > jup) if (near + 1 > jup)
@ -885,8 +869,7 @@ bool StdMeshers_Quadrangle_2D::computeQuadDominant(SMESH_Mesh& aMesh,
else else
d = quad->uv_grid[nbhoriz*(near + 1) + 1].node; d = quad->uv_grid[nbhoriz*(near + 1) + 1].node;
if (!myTrianglePreference) { if (!myTrianglePreference) {
SMDS_MeshFace* face = myHelper->AddFace(a, b, c, d); myHelper->AddFace(a, b, c, d);
if (face) meshDS->SetMeshElementOnShape(face, geomFaceID);
} }
else { else {
splitQuadFace(meshDS, geomFaceID, a, b, c, d); splitQuadFace(meshDS, geomFaceID, a, b, c, d);
@ -899,8 +882,7 @@ bool StdMeshers_Quadrangle_2D::computeQuadDominant(SMESH_Mesh& aMesh,
d = quad->uv_grid[nbhoriz*jup + 1].node; //uv_e2[1].node; d = quad->uv_grid[nbhoriz*jup + 1].node; //uv_e2[1].node;
else else
d = quad->uv_grid[nbhoriz*(k + 1) + 1].node; d = quad->uv_grid[nbhoriz*(k + 1) + 1].node;
SMDS_MeshFace* face = myHelper->AddFace(a, c, d); myHelper->AddFace(a, c, d);
if (face) meshDS->SetMeshElementOnShape(face, geomFaceID);
} }
} }
g = near; g = near;
@ -1453,6 +1435,8 @@ bool StdMeshers_Quadrangle_2D::setNormalizedGrid (FaceQuadStruct::Ptr quad)
int nbhoriz = Min( bSide.NbPoints(), tSide.NbPoints() ); int nbhoriz = Min( bSide.NbPoints(), tSide.NbPoints() );
int nbvertic = Min( rSide.NbPoints(), lSide.NbPoints() ); int nbvertic = Min( rSide.NbPoints(), lSide.NbPoints() );
if ( nbhoriz < 1 || nbvertic < 1 )
return error("Algo error: empty quad");
if ( myQuadList.size() == 1 ) if ( myQuadList.size() == 1 )
{ {
@ -1853,6 +1837,10 @@ bool StdMeshers_Quadrangle_2D::computeQuadPref (SMESH_Mesh & aMesh,
} }
sideLCb = StdMeshers_FaceSide::New( pointsLCb, aFace ); sideLCb = StdMeshers_FaceSide::New( pointsLCb, aFace );
p3dom = pointsLCb.back(); p3dom = pointsLCb.back();
gp_Pnt xyz = S->Value( p3dom.u, p3dom.v );
p3dom.node = myHelper->AddNode( xyz.X(), xyz.Y(), xyz.Z(), 0, p3dom.u, p3dom.v );
pointsLCb.back() = p3dom;
} }
// Make a side separating domains L and Ct // Make a side separating domains L and Ct
StdMeshers_FaceSidePtr sideLCt; StdMeshers_FaceSidePtr sideLCt;
@ -2004,6 +1992,16 @@ bool StdMeshers_Quadrangle_2D::computeQuadPref (SMESH_Mesh & aMesh,
sideRCb = StdMeshers_FaceSide::New( pointsRCb, aFace ); sideRCb = StdMeshers_FaceSide::New( pointsRCb, aFace );
pTBL = pointsLCb.back(); pTBL = pointsLCb.back();
pTBR = pointsRCb.back(); pTBR = pointsRCb.back();
{
gp_Pnt xyz = S->Value( pTBL.u, pTBL.v );
pTBL.node = myHelper->AddNode( xyz.X(), xyz.Y(), xyz.Z(), 0, pTBL.u, pTBL.v );
pointsLCb.back() = pTBL;
}
{
gp_Pnt xyz = S->Value( pTBR.u, pTBR.v );
pTBR.node = myHelper->AddNode( xyz.X(), xyz.Y(), xyz.Z(), 0, pTBR.u, pTBR.v );
pointsRCb.back() = pTBR;
}
} }
// Make sides separating domains Ct and L and R // Make sides separating domains Ct and L and R
StdMeshers_FaceSidePtr sideLCt, sideRCt; StdMeshers_FaceSidePtr sideLCt, sideRCt;
@ -2207,10 +2205,8 @@ bool StdMeshers_Quadrangle_2D::computeQuadPref (SMESH_Mesh & aMesh,
for (i=1; i<=dl; i++) { for (i=1; i<=dl; i++) {
for (j=1; j<nl; j++) { for (j=1; j<nl; j++) {
if (WisF) { if (WisF) {
SMDS_MeshFace* F =
myHelper->AddFace(NodesL.Value(i,j), NodesL.Value(i+1,j), myHelper->AddFace(NodesL.Value(i,j), NodesL.Value(i+1,j),
NodesL.Value(i+1,j+1), NodesL.Value(i,j+1)); NodesL.Value(i+1,j+1), NodesL.Value(i,j+1));
if (F) meshDS->SetMeshElementOnShape(F, geomFaceID);
} }
} }
} }
@ -2264,10 +2260,8 @@ bool StdMeshers_Quadrangle_2D::computeQuadPref (SMESH_Mesh & aMesh,
for (i=1; i<=dr; i++) { for (i=1; i<=dr; i++) {
for (j=1; j<nr; j++) { for (j=1; j<nr; j++) {
if (WisF) { if (WisF) {
SMDS_MeshFace* F =
myHelper->AddFace(NodesR.Value(i,j), NodesR.Value(i+1,j), myHelper->AddFace(NodesR.Value(i,j), NodesR.Value(i+1,j),
NodesR.Value(i+1,j+1), NodesR.Value(i,j+1)); NodesR.Value(i+1,j+1), NodesR.Value(i,j+1));
if (F) meshDS->SetMeshElementOnShape(F, geomFaceID);
} }
} }
} }
@ -2337,10 +2331,8 @@ bool StdMeshers_Quadrangle_2D::computeQuadPref (SMESH_Mesh & aMesh,
for (i=1; i<nb; i++) { for (i=1; i<nb; i++) {
for (j=1; j<nbv; j++) { for (j=1; j<nbv; j++) {
if (WisF) { if (WisF) {
SMDS_MeshFace* F =
myHelper->AddFace(NodesC.Value(i,j), NodesC.Value(i+1,j), myHelper->AddFace(NodesC.Value(i,j), NodesC.Value(i+1,j),
NodesC.Value(i+1,j+1), NodesC.Value(i,j+1)); NodesC.Value(i+1,j+1), NodesC.Value(i,j+1));
if (F) meshDS->SetMeshElementOnShape(F, geomFaceID);
} }
} }
} }
@ -2369,10 +2361,8 @@ bool StdMeshers_Quadrangle_2D::computeQuadPref (SMESH_Mesh & aMesh,
for (j=1; j<nnn-1; j++) { for (j=1; j<nnn-1; j++) {
for (i=1; i<nb; i++) { for (i=1; i<nb; i++) {
if (WisF) { if (WisF) {
SMDS_MeshFace* F =
myHelper->AddFace(NodesBRD.Value(i,j), NodesBRD.Value(i+1,j), myHelper->AddFace(NodesBRD.Value(i,j), NodesBRD.Value(i+1,j),
NodesBRD.Value(i+1,j+1), NodesBRD.Value(i,j+1)); NodesBRD.Value(i+1,j+1), NodesBRD.Value(i,j+1));
if (F) meshDS->SetMeshElementOnShape(F, geomFaceID);
} }
} }
} }
@ -2475,10 +2465,8 @@ bool StdMeshers_Quadrangle_2D::computeQuadPref (SMESH_Mesh & aMesh,
for (j=1; j<=drl+addv; j++) { for (j=1; j<=drl+addv; j++) {
for (i=1; i<nb; i++) { for (i=1; i<nb; i++) {
if (WisF) { if (WisF) {
SMDS_MeshFace* F =
myHelper->AddFace(NodesC.Value(i,j), NodesC.Value(i+1,j), myHelper->AddFace(NodesC.Value(i,j), NodesC.Value(i+1,j),
NodesC.Value(i+1,j+1), NodesC.Value(i,j+1)); NodesC.Value(i+1,j+1), NodesC.Value(i,j+1));
if (F) meshDS->SetMeshElementOnShape(F, geomFaceID);
} }
} }
} // end nr<nl } // end nr<nl
@ -2502,10 +2490,8 @@ bool StdMeshers_Quadrangle_2D::computeQuadPref (SMESH_Mesh & aMesh,
} }
for (i=1; i<nt; i++) { for (i=1; i<nt; i++) {
if (WisF) { if (WisF) {
SMDS_MeshFace* F =
myHelper->AddFace(NodesLast.Value(i,1), NodesLast.Value(i+1,1), myHelper->AddFace(NodesLast.Value(i,1), NodesLast.Value(i+1,1),
NodesLast.Value(i+1,2), NodesLast.Value(i,2)); NodesLast.Value(i+1,2), NodesLast.Value(i,2));
if (F) meshDS->SetMeshElementOnShape(F, geomFaceID);
} }
} }
} // if ((drl+addv) > 0) } // if ((drl+addv) > 0)
@ -2664,21 +2650,16 @@ void StdMeshers_Quadrangle_2D::splitQuadFace(SMESHDS_Mesh * theMeshDS,
const SMDS_MeshNode* theNode3, const SMDS_MeshNode* theNode3,
const SMDS_MeshNode* theNode4) const SMDS_MeshNode* theNode4)
{ {
SMDS_MeshFace* face;
if ( SMESH_TNodeXYZ( theNode1 ).SquareDistance( theNode3 ) > if ( SMESH_TNodeXYZ( theNode1 ).SquareDistance( theNode3 ) >
SMESH_TNodeXYZ( theNode2 ).SquareDistance( theNode4 ) ) SMESH_TNodeXYZ( theNode2 ).SquareDistance( theNode4 ) )
{ {
face = myHelper->AddFace(theNode2, theNode4 , theNode1); myHelper->AddFace(theNode2, theNode4 , theNode1);
if (face) theMeshDS->SetMeshElementOnShape(face, theFaceID); myHelper->AddFace(theNode2, theNode3, theNode4);
face = myHelper->AddFace(theNode2, theNode3, theNode4);
if (face) theMeshDS->SetMeshElementOnShape(face, theFaceID);
} }
else else
{ {
face = myHelper->AddFace(theNode1, theNode2 ,theNode3); myHelper->AddFace(theNode1, theNode2 ,theNode3);
if (face) theMeshDS->SetMeshElementOnShape(face, theFaceID); myHelper->AddFace(theNode1, theNode3, theNode4);
face = myHelper->AddFace(theNode1, theNode3, theNode4);
if (face) theMeshDS->SetMeshElementOnShape(face, theFaceID);
} }
} }
@ -3090,10 +3071,8 @@ bool StdMeshers_Quadrangle_2D::computeReduced (SMESH_Mesh & aMesh,
// create faces // create faces
for (i=1; i<=dl; i++) { for (i=1; i<=dl; i++) {
for (j=1; j<nl; j++) { for (j=1; j<nl; j++) {
SMDS_MeshFace* F =
myHelper->AddFace(NodesL.Value(i,j), NodesL.Value(i+1,j), myHelper->AddFace(NodesL.Value(i,j), NodesL.Value(i+1,j),
NodesL.Value(i+1,j+1), NodesL.Value(i,j+1)); NodesL.Value(i+1,j+1), NodesL.Value(i,j+1));
if (F) meshDS->SetMeshElementOnShape(F, geomFaceID);
} }
} }
} }
@ -3145,10 +3124,8 @@ bool StdMeshers_Quadrangle_2D::computeReduced (SMESH_Mesh & aMesh,
// create faces // create faces
for (i=1; i<=dr; i++) { for (i=1; i<=dr; i++) {
for (j=1; j<nr; j++) { for (j=1; j<nr; j++) {
SMDS_MeshFace* F =
myHelper->AddFace(NodesR.Value(i,j), NodesR.Value(i+1,j), myHelper->AddFace(NodesR.Value(i,j), NodesR.Value(i+1,j),
NodesR.Value(i+1,j+1), NodesR.Value(i,j+1)); NodesR.Value(i+1,j+1), NodesR.Value(i,j+1));
if (F) meshDS->SetMeshElementOnShape(F, geomFaceID);
} }
} }
} }
@ -3209,10 +3186,8 @@ bool StdMeshers_Quadrangle_2D::computeReduced (SMESH_Mesh & aMesh,
// create faces // create faces
for (i=1; i<nb; i++) { for (i=1; i<nb; i++) {
for (j=1; j<nbv; j++) { for (j=1; j<nbv; j++) {
SMDS_MeshFace* F =
myHelper->AddFace(NodesC.Value(i,j), NodesC.Value(i+1,j), myHelper->AddFace(NodesC.Value(i,j), NodesC.Value(i+1,j),
NodesC.Value(i+1,j+1), NodesC.Value(i,j+1)); NodesC.Value(i+1,j+1), NodesC.Value(i,j+1));
if (F) meshDS->SetMeshElementOnShape(F, geomFaceID);
} }
} }
} // end Multiple Reduce implementation } // end Multiple Reduce implementation
@ -3312,8 +3287,6 @@ bool StdMeshers_Quadrangle_2D::computeReduced (SMESH_Mesh & aMesh,
if (uv_eb.size() != nb || uv_er.size() != nr || uv_et.size() != nt || uv_el.size() != nl) if (uv_eb.size() != nb || uv_er.size() != nr || uv_et.size() != nt || uv_el.size() != nl)
return error(COMPERR_BAD_INPUT_MESH); return error(COMPERR_BAD_INPUT_MESH);
myHelper->SetElementsOnShape( true );
gp_UV uv[ UV_SIZE ]; gp_UV uv[ UV_SIZE ];
uv[ UV_A0 ].SetCoord( uv_eb.front().u, uv_eb.front().v); uv[ UV_A0 ].SetCoord( uv_eb.front().u, uv_eb.front().v);
uv[ UV_A1 ].SetCoord( uv_eb.back().u, uv_eb.back().v ); uv[ UV_A1 ].SetCoord( uv_eb.back().u, uv_eb.back().v );
@ -3906,29 +3879,72 @@ void StdMeshers_Quadrangle_2D::smooth (FaceQuadStruct::Ptr quad)
{ {
if ( !myNeedSmooth ) return; if ( !myNeedSmooth ) return;
// Get nodes to smooth SMESHDS_Mesh* meshDS = myHelper->GetMeshDS();
const double tol = BRep_Tool::Tolerance( quad->face );
Handle(ShapeAnalysis_Surface) surface = myHelper->GetSurface( quad->face );
// TODO: do not smooth fixed nodes if ( myHelper->HasDegeneratedEdges() && myForcedPnts.empty() )
{
// "smooth" by computing node positions using 3D TFI and further projection
int nbhoriz = quad->iSize;
int nbvertic = quad->jSize;
SMESH_TNodeXYZ a0( quad->UVPt( 0, 0 ).node );
SMESH_TNodeXYZ a1( quad->UVPt( nbhoriz-1, 0 ).node );
SMESH_TNodeXYZ a2( quad->UVPt( nbhoriz-1, nbvertic-1 ).node );
SMESH_TNodeXYZ a3( quad->UVPt( 0, nbvertic-1 ).node );
for (int i = 1; i < nbhoriz-1; i++)
{
SMESH_TNodeXYZ p0( quad->UVPt( i, 0 ).node );
SMESH_TNodeXYZ p2( quad->UVPt( i, nbvertic-1 ).node );
for (int j = 1; j < nbvertic-1; j++)
{
SMESH_TNodeXYZ p1( quad->UVPt( nbhoriz-1, j ).node );
SMESH_TNodeXYZ p3( quad->UVPt( 0, j ).node );
UVPtStruct& uvp = quad->UVPt( i, j );
gp_Pnt p = myHelper->calcTFI(uvp.x,uvp.y, a0,a1,a2,a3, p0,p1,p2,p3);
gp_Pnt2d uv = surface->NextValueOfUV( uvp.UV(), p, 10*tol );
gp_Pnt pnew = surface->Value( uv );
meshDS->MoveNode( uvp.node, pnew.X(), pnew.Y(), pnew.Z() );
uvp.u = uv.X();
uvp.v = uv.Y();
}
}
return;
}
// Get nodes to smooth
typedef map< const SMDS_MeshNode*, TSmoothNode, TIDCompare > TNo2SmooNoMap; typedef map< const SMDS_MeshNode*, TSmoothNode, TIDCompare > TNo2SmooNoMap;
TNo2SmooNoMap smooNoMap; TNo2SmooNoMap smooNoMap;
const TopoDS_Face& geomFace = TopoDS::Face( myHelper->GetSubShape() ); // fixed nodes
Handle(Geom_Surface) surface = BRep_Tool::Surface( geomFace ); set< const SMDS_MeshNode* > fixedNodes;
double U1, U2, V1, V2; for ( size_t i = 0; i < myForcedPnts.size(); ++i )
surface->Bounds(U1, U2, V1, V2); {
GeomAPI_ProjectPointOnSurf proj; fixedNodes.insert( myForcedPnts[i].node );
proj.Init( surface, U1, U2, V1, V2, BRep_Tool::Tolerance( geomFace ) ); if ( myForcedPnts[i].node->getshapeId() != myHelper->GetSubShapeID() )
{
SMESHDS_Mesh* meshDS = myHelper->GetMeshDS(); TSmoothNode & sNode = smooNoMap[ myForcedPnts[i].node ];
SMESHDS_SubMesh* fSubMesh = meshDS->MeshElements( geomFace ); sNode._uv = myForcedPnts[i].uv;
sNode._xyz = SMESH_TNodeXYZ( myForcedPnts[i].node );
}
}
SMESHDS_SubMesh* fSubMesh = meshDS->MeshElements( quad->face );
SMDS_NodeIteratorPtr nIt = fSubMesh->GetNodes(); SMDS_NodeIteratorPtr nIt = fSubMesh->GetNodes();
while ( nIt->more() ) // loop on nodes bound to a FACE while ( nIt->more() ) // loop on nodes bound to a FACE
{ {
const SMDS_MeshNode* node = nIt->next(); const SMDS_MeshNode* node = nIt->next();
TSmoothNode & sNode = smooNoMap[ node ]; TSmoothNode & sNode = smooNoMap[ node ];
sNode._uv = myHelper->GetNodeUV( geomFace, node ); sNode._uv = myHelper->GetNodeUV( quad->face, node );
sNode._xyz = SMESH_TNodeXYZ( node ); sNode._xyz = SMESH_TNodeXYZ( node );
if ( fixedNodes.count( node ))
continue; // fixed - no triangles
// set sNode._triangles // set sNode._triangles
SMDS_ElemIteratorPtr fIt = node->GetInverseElementIterator( SMDSAbs_Face ); SMDS_ElemIteratorPtr fIt = node->GetInverseElementIterator( SMDSAbs_Face );
@ -3946,9 +3962,15 @@ void StdMeshers_Quadrangle_2D::smooth (FaceQuadStruct::Ptr quad)
} }
} }
// set _uv of smooth nodes on FACE boundary // set _uv of smooth nodes on FACE boundary
for ( unsigned i = 0; i < quad->side.size(); ++i ) set< StdMeshers_FaceSide* > sidesOnEdge;
list< FaceQuadStruct::Ptr >::iterator q = myQuadList.begin();
for ( ; q != myQuadList.end() ; ++q )
for ( size_t i = 0; i < (*q)->side.size(); ++i )
if ( ! (*q)->side[i].grid->Edge(0).IsNull() &&
//(*q)->nbNodeOut( i ) == 0 &&
sidesOnEdge.insert( (*q)->side[i].grid.get() ).second )
{ {
const vector<UVPtStruct>& uvVec = quad->side[i].GetUVPtStruct(); const vector<UVPtStruct>& uvVec = (*q)->side[i].grid->GetUVPtStruct();
for ( unsigned j = 0; j < uvVec.size(); ++j ) for ( unsigned j = 0; j < uvVec.size(); ++j )
{ {
TSmoothNode & sNode = smooNoMap[ uvVec[j].node ]; TSmoothNode & sNode = smooNoMap[ uvVec[j].node ];
@ -3984,23 +4006,17 @@ void StdMeshers_Quadrangle_2D::smooth (FaceQuadStruct::Ptr quad)
{ {
// compute a new XYZ // compute a new XYZ
gp_XYZ newXYZ (0,0,0); gp_XYZ newXYZ (0,0,0);
for ( unsigned i = 0; i < sNode._triangles.size(); ++i ) for ( size_t i = 0; i < sNode._triangles.size(); ++i )
newXYZ += sNode._triangles[i]._n1->_xyz; newXYZ += sNode._triangles[i]._n1->_xyz;
newXYZ /= sNode._triangles.size(); newXYZ /= sNode._triangles.size();
// compute a new UV by projection // compute a new UV by projection
proj.Perform( newXYZ ); newUV = surface->NextValueOfUV( sNode._uv, newXYZ, 10*tol ).XY();
isValid = ( proj.IsDone() && proj.NbPoints() > 0 );
if ( isValid )
{
// check validity of the newUV // check validity of the newUV
Quantity_Parameter u,v; for ( size_t i = 0; i < sNode._triangles.size() && isValid; ++i )
proj.LowerDistanceParameters( u, v );
newUV.SetCoord( u, v );
for ( unsigned i = 0; i < sNode._triangles.size() && isValid; ++i )
isValid = ( sNode._triangles[i].IsForward( newUV ) == refForward ); isValid = ( sNode._triangles[i].IsForward( newUV ) == refForward );
} }
}
if ( !isValid ) if ( !isValid )
{ {
// compute a new UV by averaging // compute a new UV by averaging
@ -4017,7 +4033,7 @@ void StdMeshers_Quadrangle_2D::smooth (FaceQuadStruct::Ptr quad)
if ( isValid ) if ( isValid )
{ {
sNode._uv = newUV; sNode._uv = newUV;
sNode._xyz = surface->Value( newUV.X(), newUV.Y() ).XYZ(); sNode._xyz = surface->Value( newUV ).XYZ();
} }
} }
} }
@ -4031,7 +4047,7 @@ void StdMeshers_Quadrangle_2D::smooth (FaceQuadStruct::Ptr quad)
continue; // not movable node continue; // not movable node
SMDS_MeshNode* node = const_cast< SMDS_MeshNode*>( n2sn->first ); SMDS_MeshNode* node = const_cast< SMDS_MeshNode*>( n2sn->first );
gp_Pnt xyz = surface->Value( sNode._uv.X(), sNode._uv.Y() ); gp_Pnt xyz = surface->Value( sNode._uv );
meshDS->MoveNode( node, xyz.X(), xyz.Y(), xyz.Z() ); meshDS->MoveNode( node, xyz.X(), xyz.Y(), xyz.Z() );
// store the new UV // store the new UV
@ -4051,13 +4067,13 @@ void StdMeshers_Quadrangle_2D::smooth (FaceQuadStruct::Ptr quad)
if ( node->getshapeId() != myHelper->GetSubShapeID() ) if ( node->getshapeId() != myHelper->GetSubShapeID() )
continue; // medium node is on EDGE or VERTEX continue; // medium node is on EDGE or VERTEX
gp_XY uv1 = myHelper->GetNodeUV( geomFace, link.node1(), node ); gp_XYZ pm = 0.5 * ( SMESH_TNodeXYZ( link.node1() ) + SMESH_TNodeXYZ( link.node2() ));
gp_XY uv2 = myHelper->GetNodeUV( geomFace, link.node2(), node ); gp_XY uvm = myHelper->GetNodeUV( quad->face, node );
gp_Pnt2d uv = surface->NextValueOfUV( uvm, pm, 10*tol );
gp_Pnt xyz = surface->Value( uv );
gp_XY uv = myHelper->GetMiddleUV( surface, uv1, uv2 );
node->SetPosition( SMDS_PositionPtr( new SMDS_FacePosition( uv.X(), uv.Y() ))); node->SetPosition( SMDS_PositionPtr( new SMDS_FacePosition( uv.X(), uv.Y() )));
gp_Pnt xyz = surface->Value( uv.X(), uv.Y() );
meshDS->MoveNode( node, xyz.X(), xyz.Y(), xyz.Z() ); meshDS->MoveNode( node, xyz.X(), xyz.Y(), xyz.Z() );
} }
} }
@ -4158,6 +4174,7 @@ bool StdMeshers_Quadrangle_2D::check()
if ( !myHelper->IsSeamShape( nn[i]->getshapeId() )) if ( !myHelper->IsSeamShape( nn[i]->getshapeId() ))
nInFace = nn[i]; nInFace = nn[i];
toCheckUV = true;
for ( int i = 0; i < nbN; ++i ) for ( int i = 0; i < nbN; ++i )
uv[ i ] = myHelper->GetNodeUV( geomFace, nn[i], nInFace, &toCheckUV ); uv[ i ] = myHelper->GetNodeUV( geomFace, nn[i], nInFace, &toCheckUV );
@ -4253,7 +4270,7 @@ int StdMeshers_Quadrangle_2D::getCorners(const TopoDS_Face& theFace,
if ( !theConsiderMesh || faceSide.VertexNode( iE )) if ( !theConsiderMesh || faceSide.VertexNode( iE ))
{ {
TopoDS_Vertex v = helper.IthVertex( 0, *edge ); TopoDS_Vertex v = helper.IthVertex( 0, *edge );
double angle = SMESH_MesherHelper::GetAngle( prevE, *edge, theFace, v ); double angle = helper.GetAngle( prevE, *edge, theFace, v );
vertexByAngle.insert( make_pair( angle, v )); vertexByAngle.insert( make_pair( angle, v ));
angleByVertex.Bind( v, angle ); angleByVertex.Bind( v, angle );
} }
@ -4645,49 +4662,66 @@ bool StdMeshers_Quadrangle_2D::getEnforcedUV()
Standard_Real u1,u2,v1,v2; Standard_Real u1,u2,v1,v2;
const TopoDS_Face& face = TopoDS::Face( myHelper->GetSubShape() ); const TopoDS_Face& face = TopoDS::Face( myHelper->GetSubShape() );
const double tol = BRep_Tool::Tolerance( face ); const double tol = BRep_Tool::Tolerance( face );
Handle(Geom_Surface) surf = BRep_Tool::Surface( face ); Handle(ShapeAnalysis_Surface) project = myHelper->GetSurface( face );
surf->Bounds( u1,u2,v1,v2 ); project->Bounds( u1,u2,v1,v2 );
GeomAPI_ProjectPointOnSurf project;
project.Init(surf, u1,u2, v1,v2, tol );
Bnd_Box bbox; Bnd_Box bbox;
BRepBndLib::Add( face, bbox ); BRepBndLib::Add( face, bbox );
double farTol = 0.01 * sqrt( bbox.SquareExtent() ); double farTol = 0.01 * sqrt( bbox.SquareExtent() );
// get internal VERTEXes of the FACE to use them instead of equal points
typedef map< pair< double, double >, TopoDS_Vertex > TUV2VMap;
TUV2VMap uv2intV;
for ( TopExp_Explorer vExp( face, TopAbs_VERTEX, TopAbs_EDGE ); vExp.More(); vExp.Next() )
{
TopoDS_Vertex v = TopoDS::Vertex( vExp.Current() );
gp_Pnt2d uv = project->ValueOfUV( BRep_Tool::Pnt( v ), tol );
uv2intV.insert( make_pair( make_pair( uv.X(), uv.Y() ), v ));
}
for ( size_t iP = 0; iP < points.size(); ++iP ) for ( size_t iP = 0; iP < points.size(); ++iP )
{ {
project.Perform( points[ iP ]); gp_Pnt2d uv = project->ValueOfUV( points[ iP ], tol );
if ( !project.IsDone() ) if ( project->Gap() > farTol )
{
if ( isStrictCheck && iP < nbPoints )
return error
(TComm("Projection of an enforced point to the face failed - (")
<< points[ iP ].X() << ", "<< points[ iP ].Y() << ", "<< points[ iP ].Z() << " )");
continue;
}
if ( project.LowerDistance() > farTol )
{ {
if ( isStrictCheck && iP < nbPoints ) if ( isStrictCheck && iP < nbPoints )
return error return error
(COMPERR_BAD_PARMETERS, TComm("An enforced point is too far from the face, dist = ") (COMPERR_BAD_PARMETERS, TComm("An enforced point is too far from the face, dist = ")
<< project.LowerDistance() << " - (" << points[ iP ].Distance( project->Value( uv )) << " - ("
<< points[ iP ].X() << ", "<< points[ iP ].Y() << ", "<< points[ iP ].Z() << " )"); << points[ iP ].X() << ", "<< points[ iP ].Y() << ", "<< points[ iP ].Z() << " )");
continue; continue;
} }
Quantity_Parameter u, v;
project.LowerDistanceParameters(u, v);
gp_Pnt2d uv( u, v );
BRepClass_FaceClassifier clsf ( face, uv, tol ); BRepClass_FaceClassifier clsf ( face, uv, tol );
switch ( clsf.State() ) { switch ( clsf.State() ) {
case TopAbs_IN: case TopAbs_IN:
{ {
double edgeDist = ( Min( Abs( u - u1 ), Abs( u - u2 )) + double edgeDist = ( Min( Abs( uv.X() - u1 ), Abs( uv.X() - u2 )) +
Min( Abs( v - v1 ), Abs( v - v2 ))); Min( Abs( uv.Y() - v1 ), Abs( uv.Y() - v2 )));
ForcedPoint fp; ForcedPoint fp;
fp.uv = uv.XY(); fp.uv = uv.XY();
fp.xyz = points[ iP ].XYZ(); fp.xyz = points[ iP ].XYZ();
if ( iP >= nbPoints ) if ( iP >= nbPoints )
fp.vertex = TopoDS::Vertex( vMap( iP - nbPoints + 1 )); fp.vertex = TopoDS::Vertex( vMap( iP - nbPoints + 1 ));
TUV2VMap::iterator uv2v = uv2intV.lower_bound( make_pair( uv.X()-tol, uv.Y()-tol ));
for ( ; uv2v != uv2intV.end() && uv2v->first.first <= uv.X()+tol; ++uv2v )
if ( uv.SquareDistance( gp_Pnt2d( uv2v->first.first, uv2v->first.second )) < tol*tol )
{
fp.vertex = uv2v->second;
break;
}
fp.node = 0;
if ( myHelper->IsSubShape( fp.vertex, myHelper->GetMesh() ))
{
SMESH_subMesh* sm = myHelper->GetMesh()->GetSubMesh( fp.vertex );
sm->ComputeStateEngine( SMESH_subMesh::COMPUTE );
fp.node = SMESH_Algo::VertexNode( fp.vertex, myHelper->GetMeshDS() );
}
else
{
fp.node = myHelper->AddNode( fp.xyz.X(), fp.xyz.Y(), fp.xyz.Z(),
0, fp.uv.X(), fp.uv.Y() );
}
sortedFP.insert( make_pair( edgeDist, fp )); sortedFP.insert( make_pair( edgeDist, fp ));
break; break;
} }
@ -4756,7 +4790,7 @@ bool StdMeshers_Quadrangle_2D::addEnforcedNodes()
{ {
bool isNodeEnforced = false; bool isNodeEnforced = false;
// look for a quad enclosing a enforced point // look for a quad enclosing an enforced point
for ( quadIt = myQuadList.begin(); quadIt != myQuadList.end(); ++quadIt ) for ( quadIt = myQuadList.begin(); quadIt != myQuadList.end(); ++quadIt )
{ {
FaceQuadStruct::Ptr quad = *quadIt; FaceQuadStruct::Ptr quad = *quadIt;
@ -4813,6 +4847,7 @@ bool StdMeshers_Quadrangle_2D::addEnforcedNodes()
vector<UVPtStruct>& points = (vector<UVPtStruct>&) side.GetUVPtStruct(); vector<UVPtStruct>& points = (vector<UVPtStruct>&) side.GetUVPtStruct();
points[ sideNodeIndex ].u = myForcedPnts[ iFP ].U(); points[ sideNodeIndex ].u = myForcedPnts[ iFP ].U();
points[ sideNodeIndex ].v = myForcedPnts[ iFP ].V(); points[ sideNodeIndex ].v = myForcedPnts[ iFP ].V();
points[ sideNodeIndex ].node = myForcedPnts[ iFP ].node;
updateSideUV( side, sideNodeIndex, quadsBySide ); updateSideUV( side, sideNodeIndex, quadsBySide );
@ -4859,6 +4894,9 @@ bool StdMeshers_Quadrangle_2D::addEnforcedNodes()
FaceQuadStruct::Ptr newQuad = myQuadList.back(); FaceQuadStruct::Ptr newQuad = myQuadList.back();
FaceQuadStruct::Side& newSide = newQuad->side[ iNewSide ]; FaceQuadStruct::Side& newSide = newQuad->side[ iNewSide ];
vector<UVPtStruct>& points = (vector<UVPtStruct>&) newSide.GetUVPtStruct();
points[ indForced ].node = myForcedPnts[ iFP ].node;
newSide.forced_nodes.insert( indForced ); newSide.forced_nodes.insert( indForced );
quad->side[( iNewSide+2 ) % 4 ].forced_nodes.insert( indForced ); quad->side[( iNewSide+2 ) % 4 ].forced_nodes.insert( indForced );
@ -4895,6 +4933,7 @@ bool StdMeshers_Quadrangle_2D::addEnforcedNodes()
<< myForcedPnts[iFP].xyz.Y() << ", " << myForcedPnts[iFP].xyz.Y() << ", "
<< myForcedPnts[iFP].xyz.Z() << " )"); << myForcedPnts[iFP].xyz.Z() << " )");
} }
myNeedSmooth = true;
} // loop on enforced points } // loop on enforced points
@ -4912,10 +4951,15 @@ bool StdMeshers_Quadrangle_2D::addEnforcedNodes()
if ( quadVec.size() <= 1 ) if ( quadVec.size() <= 1 )
continue; // outer side continue; // outer side
bool missedNodesOnSide = false;
const vector<UVPtStruct>& points = side.grid->GetUVPtStruct(); const vector<UVPtStruct>& points = side.grid->GetUVPtStruct();
for ( size_t iC = 0; iC < side.contacts.size(); ++iC ) for ( size_t iC = 0; iC < side.contacts.size(); ++iC )
{ {
if ( side.contacts[iC].point < side.from ||
side.contacts[iC].point >= side.to )
continue;
if ( side.contacts[iC].other_point < side.contacts[iC].other_side->from ||
side.contacts[iC].other_point >= side.contacts[iC].other_side->to )
continue;
const vector<UVPtStruct>& oGrid = side.contacts[iC].other_side->grid->GetUVPtStruct(); const vector<UVPtStruct>& oGrid = side.contacts[iC].other_side->grid->GetUVPtStruct();
const UVPtStruct& uvPt = points[ side.contacts[iC].point ]; const UVPtStruct& uvPt = points[ side.contacts[iC].point ];
if ( side.contacts[iC].other_point >= oGrid .size() || if ( side.contacts[iC].other_point >= oGrid .size() ||
@ -4924,13 +4968,14 @@ bool StdMeshers_Quadrangle_2D::addEnforcedNodes()
if ( oGrid[ side.contacts[iC].other_point ].node ) if ( oGrid[ side.contacts[iC].other_point ].node )
(( UVPtStruct& ) uvPt).node = oGrid[ side.contacts[iC].other_point ].node; (( UVPtStruct& ) uvPt).node = oGrid[ side.contacts[iC].other_point ].node;
} }
bool missedNodesOnSide = false;
for ( size_t iP = 0; iP < points.size(); ++iP ) for ( size_t iP = 0; iP < points.size(); ++iP )
if ( !points[ iP ].node ) if ( !points[ iP ].node )
{ {
UVPtStruct& uvPnt = ( UVPtStruct& ) points[ iP ]; UVPtStruct& uvPnt = ( UVPtStruct& ) points[ iP ];
gp_Pnt P = surf->Value( uvPnt.u, uvPnt.v ); gp_Pnt P = surf->Value( uvPnt.u, uvPnt.v );
uvPnt.node = meshDS->AddNode(P.X(), P.Y(), P.Z()); uvPnt.node = myHelper->AddNode(P.X(), P.Y(), P.Z(), 0, uvPnt.u, uvPnt.v );
meshDS->SetNodeOnFace( uvPnt.node, myHelper->GetSubShapeID(), uvPnt.u, uvPnt.v );
missedNodesOnSide = true; missedNodesOnSide = true;
} }
if ( missedNodesOnSide ) if ( missedNodesOnSide )
@ -4990,8 +5035,10 @@ int StdMeshers_Quadrangle_2D::splitQuad(FaceQuadStruct::Ptr quad, int I, int J)
newQuad->side[ QUAD_TOP_SIDE ].from = iTop; newQuad->side[ QUAD_TOP_SIDE ].from = iTop;
newQuad->name = ( TComm("Right of I=") << I ); newQuad->name = ( TComm("Right of I=") << I );
quad->side[ QUAD_BOTTOM_SIDE ].to = iBot + 1; bool bRev = quad->side[ QUAD_BOTTOM_SIDE ].IsReversed();
quad->side[ QUAD_TOP_SIDE ].to = iTop + 1; bool tRev = quad->side[ QUAD_TOP_SIDE ].IsReversed();
quad->side[ QUAD_BOTTOM_SIDE ].to = iBot + ( bRev ? -1 : +1 );
quad->side[ QUAD_TOP_SIDE ].to = iTop + ( tRev ? -1 : +1 );
quad->uv_grid.clear(); quad->uv_grid.clear();
return QUAD_LEFT_SIDE; return QUAD_LEFT_SIDE;
@ -5579,6 +5626,8 @@ void FaceQuadStruct::Side::AddContact( int ip, Side* side, int iop )
if ( ip >= GetUVPtStruct().size() || if ( ip >= GetUVPtStruct().size() ||
iop >= side->GetUVPtStruct().size() ) iop >= side->GetUVPtStruct().size() )
throw SALOME_Exception( "FaceQuadStruct::Side::AddContact(): wrong point" ); throw SALOME_Exception( "FaceQuadStruct::Side::AddContact(): wrong point" );
if ( ip < from || ip >= to )
return;
{ {
contacts.resize( contacts.size() + 1 ); contacts.resize( contacts.size() + 1 );
Contact& c = contacts.back(); Contact& c = contacts.back();

View File

@ -247,6 +247,7 @@ class STDMESHERS_EXPORT StdMeshers_Quadrangle_2D: public SMESH_2D_Algo
gp_XY uv; gp_XY uv;
gp_XYZ xyz; gp_XYZ xyz;
TopoDS_Vertex vertex; TopoDS_Vertex vertex;
const SMDS_MeshNode* node;
double U() const { return uv.X(); } double U() const { return uv.X(); }
double V() const { return uv.Y(); } double V() const { return uv.Y(); }