-// Copyright (C) 2007-2019 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2021 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#include "SMESHGUI.h"
#include "SMESHGUI_GEOMGenUtils.h"
+#include "SMESHGUI_GroupOnShapeDlg.h"
#include "SMESHGUI_Hypotheses.h"
#include "SMESHGUI_HypothesesUtils.h"
#include "SMESHGUI_MeshDlg.h"
#include "SMESHGUI_ShapeByMeshDlg.h"
#include "SMESHGUI_Utils.h"
#include "SMESH_NumberFilter.hxx"
+#include "SMESH_TypeDefs.hxx"
#include "SMESH_TypeFilter.hxx"
+#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis)
+
// SALOME GEOM includes
-#include <GEOM_SelectionFilter.h>
#include <GEOMBase.h>
-#include <GeometryGUI.h>
-#include <GEOM_wrap.hxx>
#include <GEOMImpl_Types.hxx>
+#include <GEOM_Client.hxx>
+#include <GEOM_SelectionFilter.h>
+#include <GEOM_wrap.hxx>
+#include <GeometryGUI.h>
// SALOME GUI includes
-#include <SalomeApp_Tools.h>
-#include <SalomeApp_Application.h>
#include <LightApp_Application.h>
#include <LightApp_SelectionMgr.h>
#include <LightApp_UpdateFlags.h>
+#include <SALOME_InteractiveObject.hxx>
+#include <SALOME_ListIO.hxx>
#include <SUIT_MessageBox.h>
#include <SUIT_OverrideCursor.h>
+#include <SUIT_ResourceMgr.h>
#include <SUIT_Session.h>
-#include <SALOME_InteractiveObject.hxx>
-#include <SALOME_ListIO.hxx>
+#include <SalomeApp_Application.h>
+#include <SalomeApp_Tools.h>
// SALOME KERNEL includes
#include <SALOMEDS_SComponent.hxx>
#include <SALOMEDS_wrap.hxx>
// Qt includes
-#include <QStringList>
-#include <QLineEdit>
#include <QApplication>
+#include <QLineEdit>
+#include <QStringList>
// OCCT includes
-#include <TopoDS.hxx>
-#include <TopoDS_Shape.hxx>
-#include <TopoDS_Shell.hxx>
-#include <TopExp_Explorer.hxx>
#include <BRep_Tool.hxx>
+#include <TopExp.hxx>
+#include <TopExp_Explorer.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
+#include <TopoDS.hxx>
//================================================================================
/*!
SUIT_MessageBox::warning( myDlg, tr( "SMESH_ERROR" ), aMess );
}
+ myHypoSet = 0;
+
return aResult;
}
selectionDone();
+ myHypoSet = 0;
myHasConcurrentSubBefore = false;
myObjectToSelect.clear();
}
//================================================================================
/*!
* \brief Creates selection filter
- * \param theId - identifier of current selection widget
- * \retval SUIT_SelectionFilter* - pointer to the created filter or null
+ * \param theId - identifier of current selection widget
+ * \retval SUIT_SelectionFilter* - pointer to the created filter or null
*
* Creates selection filter in accordance with identifier of current selection widget
*/
//================================================================================
/*!
* \brief check if selected shape is a sub-shape of the shape to mesh
- * \retval bool - check result
+ * \retval bool - check result
*/
//================================================================================
bool SMESHGUI_MeshOp::isSubshapeOk() const
QStringList aGEOMs;
myDlg->selectedObject(SMESHGUI_MeshDlg::Geom, aGEOMs);
- if (aGEOMs.count() > 0) {
- GEOM::GEOM_Gen_var geomGen = mainGeom->GetGen();
- if (geomGen->_is_nil()) return false;
-
- GEOM::GEOM_IGroupOperations_ptr op = geomGen->GetIGroupOperations();
- if (op->_is_nil()) return false;
-
- // check all selected shapes
- QStringList::const_iterator aSubShapesIter = aGEOMs.begin();
- for ( ; aSubShapesIter != aGEOMs.end(); aSubShapesIter++) {
- QString aSubGeomEntry = (*aSubShapesIter);
- _PTR(SObject) pSubGeom = SMESH::getStudy()->FindObjectID(aSubGeomEntry.toUtf8().data());
- if (!pSubGeom) return false;
-
- GEOM::GEOM_Object_var aSubGeomVar =
- GEOM::GEOM_Object::_narrow(_CAST(SObject,pSubGeom)->GetObject());
- if (aSubGeomVar->_is_nil()) return false;
-
- // skl for NPAL14695 - implementation of searching of mainObj
- GEOM::GEOM_Object_var mainObj = op->GetMainShape(aSubGeomVar); /* _var not _wrap as
- mainObj already exists! */
- while( !mainObj->_is_nil()) {
- CORBA::String_var entry1 = mainObj->GetEntry();
- CORBA::String_var entry2 = mainGeom->GetEntry();
- if (std::string( entry1.in() ) == entry2.in() )
- return true;
- mainObj = op->GetMainShape(mainObj);
- }
- if ( aSubGeomVar->GetShapeType() == GEOM::COMPOUND )
- {
- // is aSubGeomVar a compound of sub-shapes?
- GEOM::GEOM_IShapesOperations_wrap sop = geomGen->GetIShapesOperations();
- if (sop->_is_nil()) return false;
- GEOM::ListOfLong_var ids = sop->GetAllSubShapesIDs( aSubGeomVar,
- GEOM::SHAPE,/*sorted=*/false);
- if ( ids->length() > 0 )
- {
- ids->length( 1 );
- GEOM::GEOM_Object_var compSub = geomGen->AddSubShape( aSubGeomVar, ids );
- if ( !compSub->_is_nil() )
- {
- GEOM::ListOfGO_var shared = sop->GetSharedShapes( mainGeom,
- compSub,
- compSub->GetShapeType() );
- geomGen->RemoveObject( compSub );
- compSub->UnRegister();
- if ( shared->length() > 0 ) {
- geomGen->RemoveObject( shared[0] );
- shared[0]->UnRegister();
- }
- return ( shared->length() > 0 );
- }
- }
- }
- }
+ // check all selected shapes
+ for ( QString& aSubGeomEntry : aGEOMs )
+ {
+ _PTR(SObject) pSubGeom = SMESH::getStudy()->FindObjectID( aSubGeomEntry.toUtf8().data() );
+ if ( !pSubGeom ) return false;
+
+ GEOM::GEOM_Object_var subGeom =
+ GEOM::GEOM_Object::_narrow(_CAST(SObject,pSubGeom)->GetObject());
+
+ if ( SMESH::ContainsSubShape( mainGeom, subGeom ))
+ return true;
}
return false;
bool isApplicable = false;
if ( myGeomEntry == myLastGeomEntry && !myGeomEntry.isEmpty() ) {
- THypLabelIsAppMap::const_iterator lab2isApp = myHypMapIsApplicable.find( theAlgoData->Label );
+ THypLabelIsAppMap::const_iterator lab2isApp = myHypMapIsApplicable.find( theAlgoData->TypeName );
if ( lab2isApp != myHypMapIsApplicable.end() ) {
isApplicable = lab2isApp.value();
return isApplicable;
toCheckIsApplicableToAll = ( myGeom->GetType() == GEOM_GROUP );
isApplicable = SMESH::IsApplicable( theAlgoData->TypeName, myGeom, toCheckIsApplicableToAll );
- myHypMapIsApplicable.insert( theAlgoData->Label, isApplicable );
+ myHypMapIsApplicable.insert( theAlgoData->TypeName, isApplicable );
return isApplicable;
}
THypDataList& theDataList,
HypothesisData* thePrevAlgoData,
HypothesisData* theNextAlgoData,
- const QString& theMeshType)
+ const QString& /*theMeshType*/)
{
theDataList.clear();
theHyps.clear();
*/
//================================================================================
SMESH::SMESH_Hypothesis_var
-SMESHGUI_MeshOp::getInitParamsHypothesis( const QString& aHypType,
- const QString& aServerLib ) const
+SMESHGUI_MeshOp::getInitParamsHypothesis( const QString& aHypType,
+ const QString& aServerLib,
+ const SMESH::HypInitParams* aParams ) const
{
if ( aHypType.isEmpty() || aServerLib.isEmpty() )
return SMESH::SMESH_Hypothesis::_nil();
}
}
- SMESH::SMESH_Hypothesis_var hyp =
- SMESHGUI::GetSMESHGen()->GetHypothesisParameterValues( aHypType.toUtf8().data(),
- aServerLib.toUtf8().data(),
- aMesh,
- aGeomVar,
- /*byMesh = */isSubMesh);
- if ( hyp->_is_nil() && isSubMesh )
+ SMESH::HypInitParams initParams;
+ enum { BY_MESH, BY_GEOM, BY_AVERAGE_LENGTH }; // same as ::SMESH_Hypothesis::InitWay
+ if ( aParams )
+ {
+ initParams = *aParams;
+ }
+ else
+ {
+ initParams.way = isSubMesh ? BY_MESH : BY_GEOM;
+ }
+
+ SMESH::SMESH_Hypothesis_var hyp;
+ if ( initParams.way == BY_AVERAGE_LENGTH )
+ hyp = SMESHGUI::GetSMESHGen()->CreateHypothesisByAverageLength( aHypType.toUtf8().data(),
+ aServerLib.toUtf8().data(),
+ initParams.averageLength,
+ initParams.quadDominated );
+ else
+ hyp = SMESHGUI::GetSMESHGen()->GetHypothesisParameterValues( aHypType.toUtf8().data(),
+ aServerLib.toUtf8().data(),
+ aMesh,
+ aGeomVar,
+ initParams );
+ if ( hyp->_is_nil() && initParams.way == BY_MESH )
+ {
+ initParams.way = BY_GEOM;
hyp = SMESHGUI::GetSMESHGen()->GetHypothesisParameterValues( aHypType.toLatin1().data(),
aServerLib.toUtf8().data(),
aMesh,
aGeomVar,
- /*byMesh = */false);
+ initParams );
+ }
+ if ( hyp->_is_nil() && initParams.way == BY_GEOM )
+ {
+ initParams.way = BY_AVERAGE_LENGTH;
+ initParams.averageLength = 1.;
+ hyp = SMESHGUI::GetSMESHGen()->GetHypothesisParameterValues( aHypType.toLatin1().data(),
+ aServerLib.toUtf8().data(),
+ aMesh,
+ aGeomVar,
+ initParams );
+ }
return hyp;
}
//================================================================================
/*!
- * Create hypothesis and update dialog.
- * \param theDim - dimension of hypothesis to be created
- * \param theType - hypothesis category (algorithm, hypothesis, additional hypothesis)
- * \param theTypeName - specifies hypothesis to be created
+ * \brief Return names of all existing hypotheses
*/
//================================================================================
-void SMESHGUI_MeshOp::createHypothesis(const int theDim,
- const int theType,
- const QString& theTypeName)
-{
- HypothesisData* aData = SMESH::GetHypothesisData(theTypeName);
- if (!aData)
- return;
-
- myDim = theDim;
- myType = theType;
- // get a unique hyp name
+QStringList SMESHGUI_MeshOp::getHypoNames()
+{
QStringList aHypNames;
+
TDim2Type2HypList::const_iterator aDimIter = myExistingHyps.begin();
for ( ; aDimIter != myExistingHyps.end(); aDimIter++) {
const TType2HypList& aType2HypList = aDimIter.value();
}
}
}
- QString aHypName = GetUniqueName( aHypNames, aData->Label);
+ return aHypNames;
+}
+
+//================================================================================
+/*!
+ * Create hypothesis and update dialog.
+ * \param theDim - dimension of hypothesis to be created
+ * \param theType - hypothesis category (algorithm, hypothesis, additional hypothesis)
+ * \param theTypeName - specifies hypothesis to be created
+ */
+//================================================================================
+void SMESHGUI_MeshOp::createHypothesis(const int theDim,
+ const int theType,
+ const QString& theTypeName)
+{
+ HypothesisData* aData = SMESH::GetHypothesisData(theTypeName);
+ if (!aData)
+ return;
+
+ myDim = theDim;
+ myType = theType;
+
+ // get a unique hyp name
+ QString aHypName = GetUniqueName( getHypoNames(), aData->Label);
// existing hypos
bool dialog = false;
* 1 = accepted
*/
//================================================================================
-void SMESHGUI_MeshOp::onHypoEdited( int result )
+void SMESHGUI_MeshOp::onHypoEdited( int /*result*/ )
{
int obj = myDlg->getActiveObject();
onActivateObject( obj ); // Issue 0020170. Restore filters
return;
}
+//================================================================================
+/*!
+ * \brief Create a sub-mesh on internal edges in the case where the global algorithm
+ * is of type 1D-2D[-3D] so that the internal edges would remain not meshed.
+ */
+//================================================================================
+
+void SMESHGUI_MeshOp::createSubMeshOnInternalEdges( SMESH::SMESH_Mesh_ptr theMesh,
+ GEOM::GEOM_Object_ptr theMainShape )
+{
+ if ( theMesh->_is_nil() || theMainShape->_is_nil() )
+ return;
+
+ if ( isAccessibleDim( 1 ))
+ return; // global 1D algorithm is/can be assigned
+
+ const HypothesesSet::SetType internSet = HypothesesSet::INTERN;
+ bool toCreate = true;
+ bool toCreateMandatory = ( myHypoSet &&
+ myAverageSize > 0 &&
+ ( myHypoSet->init( /*algo=*/ true, internSet ), myHypoSet->more()) &&
+ ( myHypoSet->init( /*algo=*/false, internSet ), myHypoSet->more()));
+ if ( !toCreateMandatory ) // ask the user
+ toCreate = false; // can't pass both mesh and geometry to Create Submesh operation (so far?)
+ // toCreate = SUIT_MessageBox::warning( SMESHGUI::desktop(),
+ // QObject::tr("SMESH_WRN_WARNING"),
+ // QObject::tr("SMESH_CREATE_SUBMESH_ON_INTERNAL_EDGES"),
+ // QObject::tr("SMESH_BUT_YES"),
+ // QObject::tr("SMESH_BUT_NO"), 1, 0);
+ if ( !toCreate )
+ return;
+
+ TopoDS_Shape shape;
+ if ( !GEOMBase::GetShape( theMainShape, shape ))
+ return;
+
+ std::vector< TopoDS_Shape > internalEdges;
+ for ( TopExp_Explorer edge( shape, TopAbs_EDGE, TopAbs_WIRE ); edge.More(); edge.Next() )
+ internalEdges.push_back( edge.Current() );
+
+ if ( internalEdges.empty() )
+ return;
+
+ TopTools_IndexedMapOfShape shapeIDs;
+ TopExp::MapShapes( shape, shapeIDs );
+
+ std::set< int > intIDSet;
+ for ( size_t i = 0; i < internalEdges.size(); ++i )
+ intIDSet.insert( shapeIDs.FindIndex( internalEdges[ i ]));
+
+ GEOM::GEOM_Gen_var geomGen = theMainShape->GetGen();
+ if (geomGen->_is_nil()) return;
+
+ GEOM::GEOM_Object_var edgeGroup;
+ GEOM::GEOM_IShapesOperations_wrap sOp = geomGen->GetIShapesOperations();
+ GEOM::GEOM_IGroupOperations_wrap gOp = geomGen->GetIGroupOperations();
+ GEOM::ListOfGO_var geomGroups = sOp->GetExistingSubObjects( theMainShape,
+ /*groupsOnly=*/true );
+ for ( CORBA::ULong i = 0; i < geomGroups->length(); ++i )
+ {
+ GEOM::ListOfLong_var ids = gOp->GetObjects( geomGroups[ i ]);
+ std::set< int > idSet( & ids[0], & ids[0] + ids->length() );
+ if ( idSet == intIDSet )
+ {
+ edgeGroup = geomGroups[ i ];
+ break;
+ }
+ }
+
+ if ( edgeGroup->_is_nil() )
+ {
+ GEOM::GEOM_Object_var edgeGroup = gOp->CreateGroup( theMainShape, TopAbs_EDGE );
+
+ GEOM::ListOfLong_var edgeIDs = new GEOM::ListOfLong;
+ edgeIDs->length( internalEdges.size() );
+ std::set< int >::iterator id = intIDSet.begin();
+ for ( size_t i = 0; i < intIDSet.size(); ++i, ++id )
+ edgeIDs[ i ] = *id;
+ gOp->UnionIDs( edgeGroup, edgeIDs );
+
+ SALOMEDS::SObject_wrap so = geomGen->AddInStudy( edgeGroup, "Internal edges", theMainShape );
+ }
+
+ if ( !toCreateMandatory )
+ {
+ // show Create Sub-mesh dislog
+ // _PTR(SObject) aMeshSO = SMESH::FindSObject( theMesh );
+ // selectionMgr()->clearFilters();
+ // selectObject( pSubmesh );
+ // SMESHGUI::GetSMESHGUI()->switchToOperation( SMESHOp::OpEditMeshOrSubMesh );
+ return;
+ }
+
+ // create a sub-mesh using myAverageSize w/o GUI
+
+ SMESH::SMESH_subMesh_var subMesh = theMesh->GetSubMesh( edgeGroup, "" );
+
+ for ( int isAlgo = 1; isAlgo >= 0; --isAlgo )
+ for ( myHypoSet->init( isAlgo, internSet ); myHypoSet->more(); myHypoSet->next() )
+ {
+ QString aHypoTypeName = myHypoSet->current();
+ HypothesisData* aHypData = SMESH::GetHypothesisData( aHypoTypeName );
+ if ( !aHypData )
+ continue;
+
+ myDim = aHypData->Dim[0];
+ if ( myDim != 1 )
+ continue;
+
+ // create or/and set
+ SMESH::SMESH_Hypothesis_var newHypo;
+ if ( isAlgo )
+ {
+ myAvailableHypData[ myDim ][ Algo ].clear();
+ myAvailableHypData[ myDim ][ Algo ] << aHypData;
+ QStringList hypList; hypList << aHypoTypeName;
+ myDlg->tab( myDim )->setAvailableHyps( Algo, hypList );
+ setCurrentHyp( myDim, Algo, 0 );
+ newHypo = getAlgo( myDim );
+ }
+ else
+ {
+ SMESH::HypInitParams params = { 2, myAverageSize, false };
+ newHypo = getInitParamsHypothesis( aHypData->TypeName, aHypData->ServerLibName, & params );
+ QString hypName = GetUniqueName( getHypoNames(), aHypData->Label );
+ SALOMEDS::SObject_wrap so =
+ SMESHGUI::GetSMESHGen()->PublishInStudy( SALOMEDS::SObject::_nil(), newHypo,
+ hypName.toUtf8().data() );
+ }
+ SMESH::AddHypothesisOnSubMesh( subMesh, newHypo );
+ }
+
+ return;
+}
+
+//================================================================================
+/*!
+ * \brief Ask the user to enter an average size which will be used to create
+ * hypotheses of a hypo-set basing on this size
+ * \param [out] averageSize - average element size
+ * \return bool - false if the user canceled the dialog
+ */
+//================================================================================
+
+bool SMESHGUI_MeshOp::getAverageSize( double & averageSize )
+{
+ HypothesisData* hypData = SMESH::GetHypothesisData( "MaxLength" );
+ if ( !hypData )
+ return false;
+
+ SMESH::SMESH_Hypothesis_var hyp = getInitParamsHypothesis( hypData->TypeName,
+ hypData->ServerLibName );
+ if ( hyp->_is_nil() )
+ return false;
+
+ SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator( hypData->TypeName );
+ if ( !aCreator )
+ return false;
+
+ initHypCreator( aCreator );
+ myDlg->setEnabled( false );
+
+ aCreator->edit( hyp.in(), HypothesesSet::getCommonHypoSetHypoType(),
+ dlg(), this, SLOT( onHypoEdited( int )));
+
+ StdMeshers::StdMeshers_MaxLength_var lenHyp = StdMeshers::StdMeshers_MaxLength::_narrow( hyp );
+ if ( lenHyp->_is_nil() )
+ return false;
+
+ averageSize = lenHyp->GetLength();
+ return true;
+}
+
//================================================================================
/*!
* \brief Creates and selects hypothesis of hypotheses set
void SMESHGUI_MeshOp::onHypoSet( const QString& theSetName )
{
HypothesesSet* aHypoSet = SMESH::GetHypothesesSet(theSetName);
+ myHypoSet = aHypoSet;
if (!aHypoSet)
return;
onAlgoSelected( -1, dim );
}
+ HypothesesSet::SetType setType = aHypoSet->getPreferredHypType();
+ if ( !aHypoSet->getAlgoAvailable( setType ))
+ {
+ setType = ( setType == HypothesesSet::ALT ) ? HypothesesSet::MAIN : HypothesesSet::ALT;
+ if ( !aHypoSet->getAlgoAvailable( setType ))
+ return;
+ }
+
+ myAverageSize = -1;
+ if ( aHypoSet->toUseCommonSize() && !getAverageSize( myAverageSize ))
+ return;
+
+ int maxDim = -1;
for ( int isAlgo = 1; isAlgo >= 0; --isAlgo )
- for ( aHypoSet->init( isAlgo ); aHypoSet->more(); aHypoSet->next() )
+ for ( aHypoSet->init( isAlgo, setType ); aHypoSet->more(); aHypoSet->next() )
{
QString aHypoTypeName = aHypoSet->current();
HypothesisData* aHypData = SMESH::GetHypothesisData( aHypoTypeName );
if (!aHypData)
continue;
- int aDim = aHypData->Dim[0];
+ myDim = aHypData->Dim[0];
// create or/and set
if ( isAlgo )
{
- int index = myAvailableHypData[aDim][Algo].indexOf( aHypData );
+ int index = myAvailableHypData[myDim][Algo].indexOf( aHypData );
if ( index >= 0 )
{
- setCurrentHyp( aDim, Algo, index );
- onAlgoSelected( index, aDim );
+ setCurrentHyp( myDim, Algo, index );
+ onAlgoSelected( index, myDim );
+ maxDim = Max( maxDim, myDim );
}
}
else
{
- bool mainHyp = true;
- int index = myAvailableHypData[aDim][MainHyp].indexOf( aHypData );
+ myType = MainHyp;
+ int index = myAvailableHypData[myDim][MainHyp].indexOf( aHypData );
if ( index < 0 )
{
- mainHyp = false;
- index = myAvailableHypData[aDim][AddHyp].indexOf( aHypData );
+ myType = AddHyp;
+ index = myAvailableHypData[myDim][AddHyp].indexOf( aHypData );
}
if ( index >= 0 )
- createHypothesis( aDim, mainHyp ? MainHyp : AddHyp, aHypoTypeName );
+ {
+ if ( myAverageSize > 0 )
+ {
+ SMESH::HypInitParams params = { 2, myAverageSize, aHypoSet->isQuadDominated() };
+ SMESH::SMESH_Hypothesis_var hyp =
+ getInitParamsHypothesis( aHypData->TypeName, aHypData->ServerLibName, & params );
+
+ QString hypName = GetUniqueName( getHypoNames(), aHypData->Label );
+ SALOMEDS::SObject_wrap so =
+ SMESHGUI::GetSMESHGen()->PublishInStudy( SALOMEDS::SObject::_nil(), hyp,
+ hypName.toUtf8().data() );
+ onHypoCreated(2);
+ }
+ else
+ {
+ createHypothesis( myDim, myType, aHypoTypeName );
+ }
+ }
}
}
+
+ if ( maxDim > 0 )
+ myDlg->setCurrentTab( maxDim );
+
return;
}
namePrefix += "_";
}
QStringList::Iterator it = aList.begin();
- for ( int i = 0; it!=aList.end(); it++, ++i )
+ for ( int i = 0; it != aList.end(); it++, ++i )
{
QString aGeomEntry = *it;
_PTR(SObject) pGeom = SMESH::getStudy()->FindObjectID( aGeomEntry.toUtf8().data() );
if ( !anAlgoVar->_is_nil() )
SMESH::AddHypothesisOnMesh( aMesh, anAlgoVar );
}
+
+
+ if ( myDlg->toCreateAllGroups() && !aGeomVar->_is_nil() )
+ {
+ // Create groups on all geom groups
+
+ GEOM::GEOM_Gen_var geomGen = aGeomVar->GetGen();
+ GEOM::GEOM_IShapesOperations_wrap op = geomGen->GetIShapesOperations();
+ GEOM::ListOfGO_var geomGroups = op->GetExistingSubObjects( aGeomVar,
+ /*groupsOnly=*/false );
+ SMESH::SMESH_GroupOnGeom_var meshGroup;
+ for ( CORBA::ULong iG = 0; iG < geomGroups->length(); ++iG )
+ {
+ SMESH::ElementType elemType = SMESHGUI_GroupOnShapeOp::ElementType( geomGroups[ iG ] );
+ if ( elemType == SMESH::ALL )
+ continue;
+ if ( elemType == SMESH::ELEM0D )
+ elemType = SMESH::NODE;
+
+ CORBA::String_var name = geomGroups[ iG ]->GetName();
+ meshGroup = aMesh->CreateGroupFromGEOM( elemType, name, geomGroups[ iG ]);
+ // if ( elemType != SMESH::NODE )
+ // meshGroup = aMesh->CreateGroupFromGEOM( SMESH::NODE, name, geomGroups[ iG ]);
+ }
+ }
+
+ createSubMeshOnInternalEdges( aMesh, aGeomVar );
+
}
+
return true;
}
else if (aGEOMs.count() > 1)
{
// create a GEOM group
- GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen( mainGeom );
+ GEOM::GEOM_Gen_var geomGen = mainGeom->GetGen();
if ( !geomGen->_is_nil() ) {
- GEOM::GEOM_IGroupOperations_ptr op = geomGen->GetIGroupOperations();
+ GEOM::GEOM_IGroupOperations_wrap op = geomGen->GetIGroupOperations();
if ( !op->_is_nil() )
{
// check and add all selected GEOM objects: they must be
}
}
+ if ( aSubMeshVar->_is_nil() )
+ {
+ GEOM::GEOM_Object_var mainGeom = aMesh->GetShapeToMesh();
+ createSubMeshOnInternalEdges( aMesh, mainGeom );
+ }
+
myHasConcurrentSubBefore =
checkSubMeshConcurrency( aMesh, aSubMeshVar, /*askUser=*/!myHasConcurrentSubBefore );
for ( ; inHypoSetName != aHypothesesSetsList.end(); ++inHypoSetName )
{
HypothesesSet* currentHypoSet = SMESH::GetHypothesesSet( *inHypoSetName );
- bool isAvailable = false;
- for ( currentHypoSet->init( true ); currentHypoSet->more(); currentHypoSet->next() )
+ HypothesesSet::SetType sType;
+ for ( sType = HypothesesSet::MAIN; sType <= HypothesesSet::ALT; SMESHUtils::Increment( sType ))
{
- isAvailable = false;
- if ( HypothesisData* algoDataIn = SMESH::GetHypothesisData( currentHypoSet->current() )) {
- for (int i = SMESH::DIM_0D; i <= myMaxShapeDim; i++) {
- int aCurrentAvailableAlgo = myAvailableHypData[i][Algo].indexOf( algoDataIn );
- if ( aCurrentAvailableAlgo > -1 ) {
- isAvailable = true;
- break;
+ bool isAvailable = false;
+ for ( currentHypoSet->init( true, sType ); currentHypoSet->more(); currentHypoSet->next() )
+ {
+ isAvailable = false;
+ if ( HypothesisData* algoDataIn = SMESH::GetHypothesisData( currentHypoSet->current() )) {
+ for ( int dim = SMESH::DIM_0D; dim <= myMaxShapeDim; dim++) {
+ int aCurrentAvailableAlgo = myAvailableHypData[dim][Algo].indexOf( algoDataIn );
+ if ( aCurrentAvailableAlgo > -1 ) {
+ isAvailable = true;
+ break;
+ }
}
+ if ( !isAvailable )
+ break;
}
- if ( !isAvailable )
- break;
}
+ currentHypoSet->setAlgoAvailable( sType, isAvailable );
+ }
+ if ( currentHypoSet->hasAlgo( HypothesesSet::MAIN ) &&
+ currentHypoSet->hasAlgo( HypothesesSet::ALT ))
+ {
+ HypothesesSet::SetType setType = HypothesesSet::getPreferredHypType();
+ if ( !currentHypoSet->getAlgoAvailable( setType ))
+ continue; // not add if a preferred type not available currently
}
- if ( isAvailable )
+
+ if ( currentHypoSet->getAlgoAvailable( HypothesesSet::MAIN ) ||
+ currentHypoSet->getAlgoAvailable( HypothesesSet::ALT ))
+ {
aFilteredHypothesesSetsList.append( *inHypoSetName );
+ }
}
myDlg->setHypoSets( aFilteredHypothesesSetsList );
}
* \param theIndex - Index of current type of mesh
*/
//================================================================================
-void SMESHGUI_MeshOp::onAlgoSetByMeshType( const int theTabIndex, const int theIndex )
+void SMESHGUI_MeshOp::onAlgoSetByMeshType( const int /*theTabIndex*/, const int /*theIndex*/ )
{
setFilteredAlgoData();
}