-// Copyright (C) 2004-2014 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
-
- int maxAvailableMemory()
- {
-#ifdef WIN32
- // See http://msdn.microsoft.com/en-us/library/aa366589.aspx
- MEMORYSTATUSEX statex;
- statex.dwLength = sizeof (statex);
- int err = GlobalMemoryStatusEx (&statex);
- if (err != 0) {
- int totMB =
- statex.ullTotalPhys / 1024 / 1024 +
- statex.ullTotalPageFile / 1024 / 1024 +
- statex.ullTotalVirtual / 1024 / 1024;
- return (int) ( 0.7 * totMB );
- }
-#else
- struct sysinfo si;
- int err = sysinfo( &si );
- if ( err == 0 ) {
- int totMB =
- si.totalram * si.mem_unit / 1024 / 1024 +
- si.totalswap * si.mem_unit / 1024 / 1024 ;
- return (int) ( 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->maxMemoryCheck->setText(tr( "MAX_MEMORY_SIZE" ));
myAdvWidget->initialMemoryCheck->setText(tr( "INIT_MEMORY_SIZE" ));
- myAdvWidget->maxMemorySpin->RangeStepAndValidator(20.0, 1e6, 10.0);
- myAdvWidget->maxMemorySpin->setValue( 128.0 );
+ myAdvWidget->maxMemorySpin->stepBy(10);
+ myAdvWidget->maxMemorySpin->setValue( 128 );
- myAdvWidget->initialMemorySpin->RangeStepAndValidator(0.0, 1e6, 10.0);
- myAdvWidget->initialMemorySpin->setValue( 100.0 );
+ myAdvWidget->initialMemorySpin->stepBy(10);
+ myAdvWidget->initialMemorySpin->setValue( 100 );
myAdvWidget->initialMemoryLabel ->setText (tr( "MEGABYTE" ));
myAdvWidget->maxMemoryLabel ->setText (tr( "MEGABYTE" ));
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);
shapeTypes.Add( TopAbs_COMPOUND );
SMESH_NumberFilter* vertexFilter = new SMESH_NumberFilter("GEOM", TopAbs_SHAPE, 1, shapeTypes);
- myEnfVertexWdg = new StdMeshersGUI_ObjectReferenceParamWdg( vertexFilter, 0, /*multiSel=*/true, /*stretch=*/false);
+ myEnfVertexWdg = new StdMeshersGUI_ObjectReferenceParamWdg( vertexFilter, 0, /*multiSel=*/true);
myEnfVertexWdg->SetDefaultText(tr("GHS3D_ENF_SELECT_VERTEX"), "QLineEdit { color: grey }");
QLabel* myXCoordLabel = new QLabel( tr( "GHS3D_ENF_VER_X_LABEL" ), myEnfGroup );
<< 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;
myToMakeGroupsOfDomains ->setChecked ( data.myToMakeGroupsOfDomains );
myOptimizationLevelCombo ->setCurrentIndex( data.myOptimizationLevel );
myAdvWidget->maxMemoryCheck ->setChecked ( data.myMaximumMemory > 0 );
- myAdvWidget->maxMemorySpin ->setValue ( qMax( data.myMaximumMemory,
+ myAdvWidget->maxMemorySpin ->setValue ( qMax( (int)data.myMaximumMemory,
myAdvWidget->maxMemorySpin->minimum() ));
myAdvWidget->initialMemoryCheck ->setChecked ( data.myInitialMemory > 0 );
- myAdvWidget->initialMemorySpin ->setValue ( qMax( data.myInitialMemory,
+ myAdvWidget->initialMemorySpin ->setValue ( qMax( (int)data.myInitialMemory,
myAdvWidget->initialMemorySpin->minimum() ));
myAdvWidget->workingDirectoryLineEdit ->setText ( data.myWorkingDir );
myAdvWidget->keepWorkingFilesCheck ->setChecked ( data.myKeepFiles );
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 );
QString valStr = "";
if ( !data.myBoundaryRecovery )
- valStr = "-c " + QString::number( !data.myToMeshHoles );
+ valStr = " --components " + data.myToMeshHoles ? "all" : "outside_components" ;
if ( data.myOptimizationLevel >= 0 && data.myOptimizationLevel < 5 && !data.myBoundaryRecovery) {
const char* level[] = { "none" , "light" , "standard" , "standard+" , "strong" };
- valStr += " -o ";
+ valStr += " --optimisation_level ";
valStr += level[ data.myOptimizationLevel ];
}
if ( data.myMaximumMemory > 0 ) {
- valStr += " -m ";
+ valStr += " --max_memory ";
valStr += QString::number( data.myMaximumMemory );
}
if ( data.myInitialMemory > 0 && !data.myBoundaryRecovery ) {
- valStr += " -M ";
+ valStr += " --automatic_memory ";
valStr += QString::number( data.myInitialMemory );
}
- valStr += " -v ";
+ valStr += " --verbose ";
valStr += QString::number( data.myVerboseLevel );
if ( !data.myToCreateNewNodes )
- valStr += " -p0";
+ valStr += " --no_internal_points";
if ( data.myRemoveInitialCentralPoint )
- valStr += " -no_initial_central_point";
+ valStr += " --no_initial_central_point";
if ( data.myBoundaryRecovery )
valStr += " -C";
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();