23416: [CEA 2033] Impossible to re-compute a mesh from an hdf

Optimize mesh loading in case of complex shape + a group on geometry
  (SMESHDS_GroupBase.cxx)


+ While MED export, create groups of all balls and 0D elements, if required
  (SMESH_Mesh.cxx)

+ Remember collapsed state of information on elements and nodes in Mesh Information dlg
  (SMESHGUI_MeshInfo)
This commit is contained in:
eap 2017-03-02 17:22:58 +03:00
parent c80762b0a1
commit 3957e28e35
8 changed files with 481 additions and 453 deletions

View File

@ -20,7 +20,6 @@
# --- options ---
# additional include directories
INCLUDE_DIRECTORIES(
${QT_INCLUDES}
${KERNEL_INCLUDE_DIRS}
${GUI_INCLUDE_DIRS}
${MEDFILE_INCLUDE_DIRS}

View File

@ -1421,6 +1421,8 @@ void SMESH_Mesh::ExportMED(const char * file,
myWriter.AddGroupOfEdges();
myWriter.AddGroupOfFaces();
myWriter.AddGroupOfVolumes();
myWriter.AddGroupOf0DElems();
myWriter.AddGroupOfBalls();
}
if ( theAllElemsToGroup )
myWriter.AddAllToGroup();

View File

@ -124,6 +124,9 @@ int SMESHDS_GroupBase::Extent() const
bool SMESHDS_GroupBase::IsEmpty()
{
if ( myMesh->GetMeshInfo().NbElements( myType ) == 0 )
// avoid long iteration over sub-meshes of a complex sub-mesh of a group on geometry
return false;
SMDS_ElemIteratorPtr it = GetElements();
return ( !it || !it->more() );
}

View File

@ -21,7 +21,6 @@
# additional include directories
INCLUDE_DIRECTORIES(
${CAS_INCLUDE_DIRS}
${QT_INCLUDES}
${PYTHON_INCLUDE_DIRS}
${VTK_INCLUDE_DIRS}
${KERNEL_INCLUDE_DIRS}

View File

@ -468,9 +468,13 @@ namespace
return;
}
SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow( aMeshItem );
if ( aCheckWarn && !aGroup->_is_nil() ) {
QMessageBox msgBox(SUIT_MessageBox::Warning,QObject::tr("SMESH_WRN_WARNING"),
QObject::tr("SMESH_EXPORT_ONLY_GPOUP"),QMessageBox::StandardButton::NoButton, SMESHGUI::desktop());
if ( aCheckWarn && !aGroup->_is_nil() )
{
QMessageBox msgBox(SUIT_MessageBox::Warning,
QObject::tr("SMESH_WRN_WARNING"),
QObject::tr("SMESH_EXPORT_ONLY_GPOUP"),
QMessageBox::StandardButton::NoButton,
SMESHGUI::desktop());
QCheckBox dontShowCheckBox(QObject::tr("SMESH_WRN_SHOW_DLG_CHECKBOX"));
msgBox.addButton(QMessageBox::Ok);
msgBox.addButton(QMessageBox::Cancel);

View File

@ -1661,6 +1661,8 @@ SMESHGUI_TreeElemInfo::SMESHGUI_TreeElemInfo( QWidget* parent )
l->setMargin( 0 );
l->addWidget( myInfo );
connect( myInfo, SIGNAL( itemDoubleClicked( QTreeWidgetItem*, int )), this, SLOT( itemDoubleClicked( QTreeWidgetItem*, int )) );
connect( myInfo, SIGNAL( itemCollapsed( QTreeWidgetItem* )), this, SLOT( saveExpanded( QTreeWidgetItem* )) );
connect( myInfo, SIGNAL( itemExpanded( QTreeWidgetItem* )), this, SLOT( saveExpanded( QTreeWidgetItem* )) );
}
/*!
@ -2264,6 +2266,12 @@ QTreeWidgetItem* SMESHGUI_TreeElemInfo::createItem( QTreeWidgetItem* parent, int
item->setFont( i, f );
}
if ( parent && parent->childCount() == 1 && itemDepth( parent ) == 1 )
{
QString resName = expandedResource( parent );
parent->setExpanded( SMESHGUI::resourceMgr()->booleanValue("SMESH", resName, true ));
}
item->setExpanded( true );
return item;
}
@ -2295,6 +2303,17 @@ void SMESHGUI_TreeElemInfo::itemDoubleClicked( QTreeWidgetItem* theItem, int th
}
}
void SMESHGUI_TreeElemInfo::saveExpanded( QTreeWidgetItem* theItem )
{
if ( theItem )
SMESHGUI::resourceMgr()->setValue("SMESH", expandedResource( theItem ), theItem->isExpanded() );
}
QString SMESHGUI_TreeElemInfo::expandedResource( QTreeWidgetItem* theItem )
{
return QString("Expanded_") + ( isElements() ? "E_" : "N_" ) + theItem->text(0);
}
void SMESHGUI_TreeElemInfo::saveInfo( QTextStream &out )
{
out << QString( 12, '-' ) << "\n";

View File

@ -242,9 +242,11 @@ protected:
private slots:
void itemDoubleClicked( QTreeWidgetItem*, int );
void saveExpanded( QTreeWidgetItem* );
private:
QTreeWidgetItem* createItem( QTreeWidgetItem* = 0, int = 0 );
QString expandedResource( QTreeWidgetItem* );
private:
QTreeWidget* myInfo;