-// Copyright (C) 2004-2015 CEA/DEN, EDF R&D
+// Copyright (C) 2004-2016 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
#include <boost/algorithm/string.hpp>
-namespace {
-
-#ifdef WIN32
-#include <windows.h>
-#else
-#include <sys/sysinfo.h>
-#endif
-
- long maxAvailableMemory()
- {
-#ifdef WIN32
- // See http://msdn.microsoft.com/en-us/library/aa366589.aspx
- MEMORYSTATUSEX statex;
- statex.dwLength = sizeof (statex);
- long err = GlobalMemoryStatusEx (&statex);
- if (err != 0) {
- long totMB =
- statex.ullTotalPhys / 1024 / 1024 +
- statex.ullTotalPageFile / 1024 / 1024 +
- statex.ullTotalVirtual / 1024 / 1024;
- return (long) ( 0.7 * totMB );
- }
-#else
- struct sysinfo si;
- long err = sysinfo( &si );
- if ( err == 0 ) {
- long totMB =
- si.totalram * si.mem_unit / 1024 / 1024 +
- si.totalswap * si.mem_unit / 1024 / 1024 ;
- return (long) ( 0.7 * totMB );
- }
-#endif
- return 0;
- }
-}
-
//
// BEGIN EnforcedVertexTableWidgetDelegate
//
}
/**
- * \brief {Get or create the geom selection tool for active study}
+ * \brief {Get or create the geom selection tool for study}
* */
GeomSelectionTools* GHS3DPluginGUI_HypothesisCreator::getGeomSelectionTool()
{
GHS3DPluginGUI_HypothesisCreator* that = (GHS3DPluginGUI_HypothesisCreator*)this;
- _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
- if (that->GeomToolSelected == NULL || that->GeomToolSelected->getMyStudy() != aStudy) {
- that->GeomToolSelected = new GeomSelectionTools(aStudy);
+ if (that->GeomToolSelected == NULL) {
+ that->GeomToolSelected = new GeomSelectionTools();
}
return that->GeomToolSelected;
}
myAdvWidget->boundaryRecoveryCheck ->setText (tr( "RECOVERY_VERSION" ));
myAdvWidget->FEMCorrectionCheck ->setText (tr( "FEM_CORRECTION" ));
myAdvWidget->gradationLabel ->setText (tr( "GHS3D_GRADATION" ));
- myAdvWidget->gradationSpinBox->RangeStepAndValidator(1.05, 5.0, 0.05, "length_precision");
- myAdvWidget->textOptionLabel->setText(tr( "TEXT_OPTION" ));
+ myAdvWidget->gradationSpinBox->RangeStepAndValidator(0.0, 5.0, 0.05, "length_precision");
// Enforced vertices parameters
myEnfGroup = new QWidget();
myEnforcedTableWidget->setAlternatingRowColors(true);
myEnforcedTableWidget->setSelectionMode(QAbstractItemView::ExtendedSelection);
myEnforcedTableWidget->setSelectionBehavior(QAbstractItemView::SelectItems);
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
myEnforcedTableWidget->horizontalHeader()->setResizeMode(QHeaderView::Interactive);
+#else
+ myEnforcedTableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::Interactive);
+#endif
myEnforcedTableWidget->resizeColumnsToContents();
myEnforcedTableWidget->hideColumn(ENF_VER_ENTRY_COLUMN);
myEnforcedTableWidget->hideColumn(ENF_VER_COMPOUND_COLUMN);
<< tr( "GHS3D_ENF_GROUP_COLUMN" );
myEnforcedMeshTableWidget->setHorizontalHeaderLabels(enforcedMeshHeaders);
myEnforcedMeshTableWidget->horizontalHeader()->setStretchLastSection(true);
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
myEnforcedMeshTableWidget->horizontalHeader()->setResizeMode(QHeaderView::Interactive);
+#else
+ myEnforcedMeshTableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::Interactive);
+#endif
myEnforcedMeshTableWidget->setAlternatingRowColors(true);
myEnforcedMeshTableWidget->setSelectionMode(QAbstractItemView::ExtendedSelection);
myEnforcedMeshTableWidget->setSelectionBehavior(QAbstractItemView::SelectItems);
return;
if (myEnfVertex->GetShapeType() == GEOM::VERTEX) {
GHS3DPluginGUI_HypothesisCreator* that = (GHS3DPluginGUI_HypothesisCreator*)this;
- GEOM::GEOM_IMeasureOperations_var measureOp = getGeomEngine()->GetIMeasureOperations( that->getGeomSelectionTool()->getMyStudy()->StudyId() );
+ GEOM::GEOM_IMeasureOperations_var measureOp = getGeomEngine()->GetIMeasureOperations( );
if (CORBA::is_nil(measureOp))
return;
int elementType = myEnfMeshConstraint->currentIndex();
- _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
+ _PTR(Study) aStudy = SMESH::getStudy();
_PTR(SObject) aSObj; //SMESH::SMESH_IDSource::_nil;
QString meshEntry = myEnfMeshWdg->GetValue();
MESSAGE("myEnfMeshWdg->GetValue()" << meshEntry.toStdString());
// myEnfMesh = myEnfMeshWdg->GetObject< SMESH::SMESH_IDSource >();
// std::string entry = myEnfMeshWdg->GetValue();
aSObj = aStudy->FindObjectID(meshEntry.toStdString().c_str());
- CORBA::Object_var anObj = SMESH::SObjectToObject(aSObj,aStudy);
+ CORBA::Object_var anObj = SMESH::SObjectToObject(aSObj);
if (!CORBA::is_nil(anObj)) {
// SMESH::SMESH_IDSource_var theSource = SMESH::SObjectToInterface<SMESH::SMESH_IDSource>( aSObj );
addEnforcedMesh( aSObj->GetName(), aSObj->GetID(), elementType, groupName);
QStringListIterator meshEntriesIt (meshEntries);
while (meshEntriesIt.hasNext()) {
aSObj = aStudy->FindObjectID(meshEntriesIt.next().toStdString().c_str());
- CORBA::Object_var anObj = SMESH::SObjectToObject(aSObj,aStudy);
+ CORBA::Object_var anObj = SMESH::SObjectToObject(aSObj);
if (!CORBA::is_nil(anObj)) {
// SMESH::SMESH_IDSource_var theSource = SMESH::SObjectToInterface<SMESH::SMESH_IDSource>( aSObj );
addEnforcedMesh( aSObj->GetName(), aSObj->GetID(), elementType, groupName);
if ( CORBA::is_nil(getGeomEngine()))
return;
- GEOM::GEOM_IMeasureOperations_var measureOp = getGeomEngine()->GetIMeasureOperations( that->getGeomSelectionTool()->getMyStudy()->StudyId() );
+ GEOM::GEOM_IMeasureOperations_var measureOp = getGeomEngine()->GetIMeasureOperations( );
if (CORBA::is_nil(measureOp))
return;
myAdvWidget->boundaryRecoveryCheck ->setChecked ( data.myBoundaryRecovery );
myAdvWidget->FEMCorrectionCheck ->setChecked ( data.myFEMCorrection );
myAdvWidget->gradationSpinBox ->setValue ( data.myGradation );
- myAdvWidget->textOptionLineEdit ->setText ( data.myTextOption );
+ myAdvWidget->advOptionTable ->SetCustomOptions( data.myTextOption );
myAdvWidget->logInFileCheck ->setChecked ( !data.myLogInStandardOutput );
myAdvWidget->removeLogOnSuccessCheck ->setChecked ( data.myRemoveLogOnSuccess );
h_data.myBoundaryRecovery = h->GetToUseBoundaryRecoveryVersion();
h_data.myFEMCorrection = h->GetFEMCorrection();
h_data.myGradation = h->GetGradation();
- h_data.myTextOption = h->GetTextOption();
+ h_data.myTextOption = h->GetAdvancedOption();
h_data.myLogInStandardOutput = h->GetStandardOutputLog();
h_data.myRemoveLogOnSuccess = h->GetRemoveLogOnSuccess();
GHS3DPlugin::GHS3DEnforcedVertexList_var vertices = h->GetEnforcedVertices();
MESSAGE("vertices->length(): " << vertices->length());
h_data.myEnforcedVertices.clear();
- for (int i=0 ; i<vertices->length() ; i++) {
+ for (CORBA::ULong i=0 ; i<vertices->length() ; i++) {
TEnfVertex* myVertex = new TEnfVertex();
myVertex->name = CORBA::string_dup(vertices[i].name.in());
myVertex->geomEntry = CORBA::string_dup(vertices[i].geomEntry.in());
myVertex->size = vertices[i].size;
myVertex->isCompound = vertices[i].isCompound;
if (vertices[i].coords.length()) {
- for (int c = 0; c < vertices[i].coords.length() ; c++)
+ for (CORBA::ULong c = 0; c < vertices[i].coords.length() ; c++)
myVertex->coords.push_back(vertices[i].coords[c]);
MESSAGE("Add enforced vertex ("<< myVertex->coords.at(0) << ","<< myVertex->coords.at(1) << ","<< myVertex->coords.at(2) << ") ="<< myVertex->size);
}
GHS3DPlugin::GHS3DEnforcedMeshList_var enfMeshes = h->GetEnforcedMeshes();
MESSAGE("enfMeshes->length(): " << enfMeshes->length());
h_data.myEnforcedMeshes.clear();
- for (int i=0 ; i<enfMeshes->length() ; i++) {
+ for (CORBA::ULong i=0 ; i<enfMeshes->length() ; i++) {
TEnfMesh* myEnfMesh = new TEnfMesh();
myEnfMesh->name = CORBA::string_dup(enfMeshes[i].name.in());
myEnfMesh->entry = CORBA::string_dup(enfMeshes[i].entry.in());
h->SetFEMCorrection ( h_data.myFEMCorrection );
if ( h->GetGradation() != h_data.myGradation )
h->SetGradation ( h_data.myGradation );
- if ( h->GetTextOption() != h_data.myTextOption )
- h->SetTextOption ( h_data.myTextOption.toLatin1().constData() );
+ if ( h->GetAdvancedOption() != h_data.myTextOption )
+ h->SetAdvancedOption ( h_data.myTextOption.toLatin1().constData() );
if ( h->GetStandardOutputLog() != h_data.myLogInStandardOutput )
h->SetStandardOutputLog( h_data.myLogInStandardOutput );
if ( h->GetRemoveLogOnSuccess() != h_data.myRemoveLogOnSuccess )
TEnfMeshList::const_iterator itEnfMesh;
- _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
+ _PTR(Study) aStudy = SMESH::getStudy();
for(itEnfMesh = h_data.myEnforcedMeshes.begin() ; itEnfMesh != h_data.myEnforcedMeshes.end(); itEnfMesh++ ) {
TEnfMesh* enfMesh = (*itEnfMesh);
h_data.myBoundaryRecovery = myAdvWidget->boundaryRecoveryCheck->isChecked();
h_data.myFEMCorrection = myAdvWidget->FEMCorrectionCheck->isChecked();
h_data.myGradation = myAdvWidget->gradationSpinBox->value();
- h_data.myTextOption = myAdvWidget->textOptionLineEdit->text();
+ h_data.myTextOption = myAdvWidget->advOptionTable->GetCustomOptions();
h_data.myLogInStandardOutput = !myAdvWidget->logInFileCheck->isChecked();
h_data.myRemoveLogOnSuccess = myAdvWidget->removeLogOnSuccessCheck->isChecked();