From: eap Date: Wed, 30 Apr 2008 09:37:41 +0000 (+0000) Subject: PAL19680 CEA 4.1.2: Meshers: BLSURF, GHS3D and holed shapes X-Git-Tag: V4_1_2rc3~8 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d0500d605e38c8f7fc2d9a4e72061da4fe03eca8;p=plugins%2Fghs3dplugin.git PAL19680 CEA 4.1.2: Meshers: BLSURF, GHS3D and holed shapes add more 4 advanced options --- diff --git a/idl/GHS3DPlugin_Algorithm.idl b/idl/GHS3DPlugin_Algorithm.idl index 3f02497..983d7d8 100644 --- a/idl/GHS3DPlugin_Algorithm.idl +++ b/idl/GHS3DPlugin_Algorithm.idl @@ -79,6 +79,34 @@ module GHS3DPlugin */ void SetKeepFiles(in boolean toKeep); boolean GetKeepFiles(); + /*! + * Verbose level [0-10] + * 0 - no standard output, + * 2 - prints the data, quality statistics of the skin and final meshes and + * indicates when the final mesh is being saved. In addition the software + * gives indication regarding the CPU time. + * 10 - same as 2 plus the main steps in the computation, quality statistics + * histogram of the skin mesh, quality statistics histogram together with + * the characteristics of the final mesh. + */ + void SetVerboseLevel(in short level); + short GetVerboseLevel(); + /*! + * To create new nodes + */ + void SetToCreateNewNodes(in boolean toCreate); + boolean GetToCreateNewNodes(); + /*! + * To use boundary recovery version which tries to create mesh on a very poor + * quality surface mesh + */ + void SetToUseBoundaryRecoveryVersion(in boolean toUse); + boolean GetToUseBoundaryRecoveryVersion(); + /*! + * To set hiden/undocumented/advanced options + */ + void SetTextOption(in string option); + string GetTextOption(); }; }; diff --git a/src/GHS3DPlugin_GHS3D.cxx b/src/GHS3DPlugin_GHS3D.cxx index 54ff8ef..ec8738a 100644 --- a/src/GHS3DPlugin_GHS3D.cxx +++ b/src/GHS3DPlugin_GHS3D.cxx @@ -1028,6 +1028,7 @@ bool GHS3DPlugin_GHS3D::Compute(SMESH_Mesh& theMesh, } return error(COMPERR_BAD_INPUT_MESH); } + OSD_File( aResultFileName ).Remove(); // needed for boundary recovery module usage // ----------------- // run ghs3d mesher @@ -1186,6 +1187,7 @@ bool GHS3DPlugin_GHS3D::Compute(SMESH_Mesh& theMesh, } return error(COMPERR_BAD_INPUT_MESH); } + OSD_File( aResultFileName ).Remove(); // needed for boundary recovery module usage // ----------------- // run ghs3d mesher diff --git a/src/GHS3DPlugin_Hypothesis.cxx b/src/GHS3DPlugin_Hypothesis.cxx index 6eabb04..f76ce82 100644 --- a/src/GHS3DPlugin_Hypothesis.cxx +++ b/src/GHS3DPlugin_Hypothesis.cxx @@ -37,12 +37,15 @@ GHS3DPlugin_Hypothesis::GHS3DPlugin_Hypothesis(int hypId, int studyId, SMESH_Gen _name = "GHS3D_Parameters"; _param_algo_dim = 3; - myToMeshHoles = DefaultMeshHoles(); - myMaximumMemory = -1;//DefaultMaximumMemory(); - myInitialMemory = -1;//DefaultInitialMemory(); - myOptimizationLevel = DefaultOptimizationLevel(); - myWorkingDirectory = DefaultWorkingDirectory(); - myKeepFiles = DefaultKeepFiles(); + myToMeshHoles = DefaultMeshHoles(); + myMaximumMemory = -1;//DefaultMaximumMemory(); + myInitialMemory = -1;//DefaultInitialMemory(); + myOptimizationLevel = DefaultOptimizationLevel(); + myWorkingDirectory = DefaultWorkingDirectory(); + myKeepFiles = DefaultKeepFiles(); + myVerboseLevel = DefaultVerboseLevel(); + myToCreateNewNodes = DefaultToCreateNewNodes(); + myToUseBoundaryRecoveryVersion = DefaultToUseBoundaryRecoveryVersion(); } //======================================================================= @@ -134,7 +137,7 @@ GHS3DPlugin_Hypothesis::OptimizationLevel GHS3DPlugin_Hypothesis::GetOptimizatio //function : SetWorkingDirectory //======================================================================= -void GHS3DPlugin_Hypothesis::SetWorkingDirectory(string path) +void GHS3DPlugin_Hypothesis::SetWorkingDirectory(const string& path) { if ( myWorkingDirectory != path ) { myWorkingDirectory = path; @@ -172,6 +175,91 @@ bool GHS3DPlugin_Hypothesis::GetKeepFiles() const return myKeepFiles; } +//======================================================================= +//function : SetVerboseLevel +//======================================================================= + +void GHS3DPlugin_Hypothesis::SetVerboseLevel(short level) +{ + if ( myVerboseLevel != level ) { + myVerboseLevel = level; + NotifySubMeshesHypothesisModification(); + } +} + +//======================================================================= +//function : GetVerboseLevel +//======================================================================= + +short GHS3DPlugin_Hypothesis::GetVerboseLevel() const +{ + return myVerboseLevel; +} + +//======================================================================= +//function : SetToCreateNewNodes +//======================================================================= + +void GHS3DPlugin_Hypothesis::SetToCreateNewNodes(bool toCreate) +{ + if ( myToCreateNewNodes != toCreate ) { + myToCreateNewNodes = toCreate; + NotifySubMeshesHypothesisModification(); + } +} + +//======================================================================= +//function : GetToCreateNewNodes +//======================================================================= + +bool GHS3DPlugin_Hypothesis::GetToCreateNewNodes() const +{ + return myToCreateNewNodes; +} + +//======================================================================= +//function : SetToUseBoundaryRecoveryVersion +//======================================================================= + +void GHS3DPlugin_Hypothesis::SetToUseBoundaryRecoveryVersion(bool toUse) +{ + if ( myToUseBoundaryRecoveryVersion != toUse ) { + myToUseBoundaryRecoveryVersion = toUse; + NotifySubMeshesHypothesisModification(); + } +} + +//======================================================================= +//function : GetToUseBoundaryRecoveryVersion +//======================================================================= + +bool GHS3DPlugin_Hypothesis::GetToUseBoundaryRecoveryVersion() const +{ + return myToUseBoundaryRecoveryVersion; +} + +//======================================================================= +//function : SetTextOption +//======================================================================= + +void GHS3DPlugin_Hypothesis::SetTextOption(const string& option) +{ + if ( myTextOption != option ) { + myTextOption = option; + NotifySubMeshesHypothesisModification(); + } +} + +//======================================================================= +//function : GetTextOption +//======================================================================= + +string GHS3DPlugin_Hypothesis::GetTextOption() const +{ + return myTextOption; +} + + //======================================================================= //function : DefaultMeshHoles //======================================================================= @@ -251,18 +339,49 @@ bool GHS3DPlugin_Hypothesis::DefaultKeepFiles() return false; } +//======================================================================= +//function : DefaultVerboseLevel +//======================================================================= + +short GHS3DPlugin_Hypothesis::DefaultVerboseLevel() +{ + return 10; +} + +//======================================================================= +//function : DefaultToCreateNewNodes +//======================================================================= + +bool GHS3DPlugin_Hypothesis::DefaultToCreateNewNodes() +{ + return true; +} + +//======================================================================= +//function : DefaultToUseBoundaryRecoveryVersion +//======================================================================= + +bool GHS3DPlugin_Hypothesis::DefaultToUseBoundaryRecoveryVersion() +{ + return false; +} + //======================================================================= //function : SaveTo //======================================================================= ostream & GHS3DPlugin_Hypothesis::SaveTo(ostream & save) { - save << (int) myToMeshHoles << " "; - save << myMaximumMemory << " "; - save << myInitialMemory << " "; - save << myOptimizationLevel << " "; - save << myWorkingDirectory << " "; - save << (int)myKeepFiles << " "; + save << (int) myToMeshHoles << " "; + save << myMaximumMemory << " "; + save << myInitialMemory << " "; + save << myOptimizationLevel << " "; + save << myWorkingDirectory << " "; + save << (int)myKeepFiles << " "; + save << myVerboseLevel << " "; + save << (int)myToCreateNewNodes << " "; + save << (int)myToUseBoundaryRecoveryVersion << " "; + save << myTextOption << " "; return save; } @@ -304,20 +423,38 @@ istream & GHS3DPlugin_Hypothesis::LoadFrom(istream & load) if ( myWorkingDirectory == "0") { // myWorkingDirectory was empty myKeepFiles = false; myWorkingDirectory.clear(); - return load; } else if ( myWorkingDirectory == "1" ) { myKeepFiles = true; myWorkingDirectory.clear(); - return load; } } else load.clear(ios::badbit | load.rdstate()); + if ( !myWorkingDirectory.empty() ) { + isOK = (load >> i); + if (isOK) + myKeepFiles = i; + else + load.clear(ios::badbit | load.rdstate()); + } + isOK = (load >> i); if (isOK) - myKeepFiles = i; + myVerboseLevel = (short) i; + else + load.clear(ios::badbit | load.rdstate()); + + isOK = (load >> i); + if (isOK) + myToCreateNewNodes = (bool) i; + else + load.clear(ios::badbit | load.rdstate()); + + isOK = (load >> myTextOption); + if (isOK) + ; else load.clear(ios::badbit | load.rdstate()); @@ -346,38 +483,79 @@ string GHS3DPlugin_Hypothesis::CommandToRun(const GHS3DPlugin_Hypothesis* hyp) #else TCollection_AsciiString cmd( "ghs3d.exe" ); #endif + // check if any option is overridden by hyp->myTextOption + bool m = hyp ? ( hyp->myTextOption.find("-m") == string::npos ) : true; + bool M = hyp ? ( hyp->myTextOption.find("-M") == string::npos ) : true; + bool c = hyp ? ( hyp->myTextOption.find("-c") == string::npos ) : true; + bool o = hyp ? ( hyp->myTextOption.find("-o") == string::npos ) : true; + bool p0= hyp ? ( hyp->myTextOption.find("-p0")== string::npos ) : true; + bool C = hyp ? ( hyp->myTextOption.find("-C") == string::npos ) : true; + bool v = hyp ? ( hyp->myTextOption.find("-v") == string::npos ) : true; + + // if use boundary recovery version, few options are allowed + bool useBndRecovery = !C; + if ( !useBndRecovery && hyp ) + useBndRecovery = hyp->myToUseBoundaryRecoveryVersion; // ghs3d needs to know amount of memory it may use (MB). // Default memory is defined at ghs3d installation but it may be not enough, // so allow to use about all available memory - short aMaximumMemory = hyp ? hyp->myMaximumMemory : -1; - cmd += " -m "; - if ( aMaximumMemory < 0 ) - cmd += DefaultMaximumMemory(); - else - cmd += aMaximumMemory; - short aInitialMemory = hyp ? hyp->myInitialMemory : -1; - cmd += " -M "; - if ( aInitialMemory > 0 ) - cmd += aInitialMemory; - else - cmd += "100"; - + if ( m ) { + short aMaximumMemory = hyp ? hyp->myMaximumMemory : -1; + cmd += " -m "; + if ( aMaximumMemory < 0 ) + cmd += DefaultMaximumMemory(); + else + cmd += aMaximumMemory; + } + if ( M && !useBndRecovery ) { + short aInitialMemory = hyp ? hyp->myInitialMemory : -1; + cmd += " -M "; + if ( aInitialMemory > 0 ) + cmd += aInitialMemory; + else + cmd += "100"; + } // component to mesh // 0 , all components to be meshed // 1 , only the main ( outermost ) component to be meshed - bool aToMeshHoles = hyp ? hyp->myToMeshHoles : DefaultMeshHoles(); - if ( aToMeshHoles ) - cmd += " -c 0"; - else - cmd += " -c 1"; + if ( c && !useBndRecovery ) { + bool aToMeshHoles = hyp ? hyp->myToMeshHoles : DefaultMeshHoles(); + if ( aToMeshHoles ) + cmd += " -c 0"; + else + cmd += " -c 1"; + } // optimization level - short aOptimizationLevel = hyp ? hyp->myOptimizationLevel : DefaultOptimizationLevel(); - if ( aOptimizationLevel >= 0 && aOptimizationLevel < 4 ) { - char* level[] = { "none" , "light" , "standard" , "strong" }; - cmd += " -o "; - cmd += level[ aOptimizationLevel ]; + if ( o && hyp && !useBndRecovery ) { + if ( hyp->myOptimizationLevel >= 0 && hyp->myOptimizationLevel < 4 ) { + char* level[] = { "none" , "light" , "standard" , "strong" }; + cmd += " -o "; + cmd += level[ hyp->myOptimizationLevel ]; + } + } + + // to create internal nodes + if ( p0 && hyp && !hyp->myToCreateNewNodes ) { + cmd += " -p0"; + } + + // verbose mode + if ( v && hyp ) { + cmd += " -v "; + cmd += hyp->myVerboseLevel; + } + + // boundary recovery version + if ( useBndRecovery ) { + cmd += " -C"; + } + + // options as text + if ( hyp && !hyp->myTextOption.empty() ) { + cmd += " "; + cmd += (char*) hyp->myTextOption.c_str(); } return cmd.ToCString(); diff --git a/src/GHS3DPlugin_Hypothesis.hxx b/src/GHS3DPlugin_Hypothesis.hxx index 2bba333..f698480 100644 --- a/src/GHS3DPlugin_Hypothesis.hxx +++ b/src/GHS3DPlugin_Hypothesis.hxx @@ -60,13 +60,41 @@ public: /*! * Path to working directory */ - void SetWorkingDirectory(string path); + void SetWorkingDirectory(const string& path); string GetWorkingDirectory() const; /*! * To keep working files or remove them. Log file remains in case of errors anyway. */ void SetKeepFiles(bool toKeep); bool GetKeepFiles() const; + /*! + * Verbose level [0-10] + * 0 - no standard output, + * 2 - prints the data, quality statistics of the skin and final meshes and + * indicates when the final mesh is being saved. In addition the software + * gives indication regarding the CPU time. + * 10 - same as 2 plus the main steps in the computation, quality statistics + * histogram of the skin mesh, quality statistics histogram together with + * the characteristics of the final mesh. + */ + void SetVerboseLevel(short level); + short GetVerboseLevel() const; + /*! + * To create new nodes + */ + void SetToCreateNewNodes(bool toCreate); + bool GetToCreateNewNodes() const; + /*! + * To use boundary recovery version which tries to create mesh on a very poor + * quality surface mesh + */ + void SetToUseBoundaryRecoveryVersion(bool toUse); + bool GetToUseBoundaryRecoveryVersion() const; + /*! + * To set hiden/undocumented/advanced options + */ + void SetTextOption(const string& option); + string GetTextOption() const; static bool DefaultMeshHoles(); static short DefaultMaximumMemory(); @@ -74,6 +102,9 @@ public: static short DefaultOptimizationLevel(); static string DefaultWorkingDirectory(); static bool DefaultKeepFiles(); + static short DefaultVerboseLevel(); + static bool DefaultToCreateNewNodes(); + static bool DefaultToUseBoundaryRecoveryVersion(); /*! * \brief Return command to run ghs3d mesher excluding file prefix (-f) @@ -92,20 +123,22 @@ public: /*! * \brief Does nothing - * \param theMesh - the built mesh - * \param theShape - the geometry of interest - * \retval bool - always false */ virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape); private: - bool myToMeshHoles; - short myMaximumMemory; - short myInitialMemory; - short myOptimizationLevel; - std::string myWorkingDirectory; - bool myKeepFiles; + bool myToMeshHoles; + short myMaximumMemory; + short myInitialMemory; + short myOptimizationLevel; + bool myKeepFiles; + string myWorkingDirectory; + short myVerboseLevel; + bool myToCreateNewNodes; + bool myToUseBoundaryRecoveryVersion; + string myTextOption; + }; diff --git a/src/GHS3DPlugin_Hypothesis_i.cxx b/src/GHS3DPlugin_Hypothesis_i.cxx index ccc7f15..cbedd2d 100644 --- a/src/GHS3DPlugin_Hypothesis_i.cxx +++ b/src/GHS3DPlugin_Hypothesis_i.cxx @@ -189,10 +189,96 @@ CORBA::Boolean GHS3DPlugin_Hypothesis_i::GetKeepFiles() return this->GetImpl()->GetKeepFiles(); } +//======================================================================= +//function : SetVerboseLevel +//======================================================================= + +void GHS3DPlugin_Hypothesis_i::SetVerboseLevel(CORBA::Short level) + throw ( SALOME::SALOME_Exception ) +{ + if (level < 0 || level > 10 ) + THROW_SALOME_CORBA_EXCEPTION( "Invalid verbose level, valid range is [0-10]", + SALOME::BAD_PARAM ); + ASSERT(myBaseImpl); + this->GetImpl()->SetVerboseLevel(level); + SMESH::TPythonDump() << _this() << ".SetVerboseLevel( " << level << " )"; +} + +//======================================================================= +//function : GetVerboseLevel +//======================================================================= + +CORBA::Short GHS3DPlugin_Hypothesis_i::GetVerboseLevel() +{ + ASSERT(myBaseImpl); + return this->GetImpl()->GetVerboseLevel(); +} + +//======================================================================= +//function : SetToCreateNewNodes +//======================================================================= + +void GHS3DPlugin_Hypothesis_i::SetToCreateNewNodes(CORBA::Boolean toCreate) +{ + ASSERT(myBaseImpl); + this->GetImpl()->SetToCreateNewNodes(toCreate); + SMESH::TPythonDump() << _this() << ".SetToCreateNewNodes( " << toCreate << " )"; +} + +//======================================================================= +//function : GetToCreateNewNodes +//======================================================================= + +CORBA::Boolean GHS3DPlugin_Hypothesis_i::GetToCreateNewNodes() +{ + ASSERT(myBaseImpl); + return this->GetImpl()->GetToCreateNewNodes(); +} + +//======================================================================= +//function : SetToUseBoundaryRecoveryVersion +//======================================================================= + +void GHS3DPlugin_Hypothesis_i::SetToUseBoundaryRecoveryVersion(CORBA::Boolean toUse) +{ + ASSERT(myBaseImpl); + this->GetImpl()->SetToUseBoundaryRecoveryVersion(toUse); + SMESH::TPythonDump() << _this() << ".SetToUseBoundaryRecoveryVersion( " << toUse << " )"; +} + +//======================================================================= +//function : GetToUseBoundaryRecoveryVersion +//======================================================================= + +CORBA::Boolean GHS3DPlugin_Hypothesis_i::GetToUseBoundaryRecoveryVersion() +{ + ASSERT(myBaseImpl); + return this->GetImpl()->GetToUseBoundaryRecoveryVersion(); +} + +//======================================================================= +//function : SetTextOption +//======================================================================= + +void GHS3DPlugin_Hypothesis_i::SetTextOption(const char* option) +{ + ASSERT(myBaseImpl); + this->GetImpl()->SetTextOption(option); + SMESH::TPythonDump() << _this() << ".SetTextOption( '" << option << "' )"; +} + +//======================================================================= +//function : GetTextOption +//======================================================================= + +char* GHS3DPlugin_Hypothesis_i::GetTextOption() +{ + ASSERT(myBaseImpl); + return CORBA::string_dup( this->GetImpl()->GetTextOption().c_str() ); +} + //============================================================================= /*! - * GHS3DPlugin_Hypothesis_i::GetImpl - * * Get implementation */ //============================================================================= @@ -205,10 +291,6 @@ CORBA::Boolean GHS3DPlugin_Hypothesis_i::GetKeepFiles() //================================================================================ /*! * \brief Verify whether hypothesis supports given entity type - * \param type - dimension (see SMESH::Dimension enumeration) - * \retval CORBA::Boolean - TRUE if dimension is supported, FALSE otherwise - * - * Verify whether hypothesis supports given entity type (see SMESH::Dimension enumeration) */ //================================================================================ diff --git a/src/GHS3DPlugin_Hypothesis_i.hxx b/src/GHS3DPlugin_Hypothesis_i.hxx index d868e24..f86e4f4 100644 --- a/src/GHS3DPlugin_Hypothesis_i.hxx +++ b/src/GHS3DPlugin_Hypothesis_i.hxx @@ -81,6 +81,34 @@ class GHS3DPLUGIN_EXPORT GHS3DPlugin_Hypothesis_i: */ void SetKeepFiles(CORBA::Boolean toKeep); CORBA::Boolean GetKeepFiles(); + /*! + * Verbose level [0-10] + * 0 - no standard output, + * 2 - prints the data, quality statistics of the skin and final meshes and + * indicates when the final mesh is being saved. In addition the software + * gives indication regarding the CPU time. + * 10 - same as 2 plus the main steps in the computation, quality statistics + * histogram of the skin mesh, quality statistics histogram together with + * the characteristics of the final mesh. + */ + void SetVerboseLevel(CORBA::Short level) throw ( SALOME::SALOME_Exception ); + CORBA::Short GetVerboseLevel(); + /*! + * To create new nodes + */ + void SetToCreateNewNodes(CORBA::Boolean toCreate); + CORBA::Boolean GetToCreateNewNodes(); + /*! + * To use boundary recovery version which tries to create mesh on a very poor + * quality surface mesh + */ + void SetToUseBoundaryRecoveryVersion(CORBA::Boolean toUse); + CORBA::Boolean GetToUseBoundaryRecoveryVersion(); + /*! + * To set hiden/undocumented/advanced options + */ + void SetTextOption(const char* option); + char* GetTextOption(); // Get implementation ::GHS3DPlugin_Hypothesis* GetImpl(); diff --git a/src/GUI/GHS3DPluginGUI_HypothesisCreator.cxx b/src/GUI/GHS3DPluginGUI_HypothesisCreator.cxx index e5b599e..770aba2 100644 --- a/src/GUI/GHS3DPluginGUI_HypothesisCreator.cxx +++ b/src/GUI/GHS3DPluginGUI_HypothesisCreator.cxx @@ -128,33 +128,76 @@ QFrame* GHS3DPluginGUI_HypothesisCreator::buildFrame() // advanced parameters myAdvGroup = new QGroupBox( 3, Qt::Horizontal, fr, "myAdvGroup" ); lay->addWidget( myAdvGroup ); + QFrame* anAdvFrame = new QFrame(myAdvGroup, "anAdvFrame"); + QGridLayout* anAdvLayout = new QGridLayout(anAdvFrame, 8, 3); + anAdvLayout->setSpacing(6); + anAdvLayout->setAutoAdd(false); - myMaximumMemoryCheck = new QCheckBox( tr("MAX_MEMORY_SIZE"), myAdvGroup ); + myMaximumMemoryCheck = new QCheckBox( tr("MAX_MEMORY_SIZE"), anAdvFrame ); - myMaximumMemorySpin = new QSpinBox( myAdvGroup ); + myMaximumMemorySpin = new QSpinBox( anAdvFrame ); myMaximumMemorySpin->setMinValue( 1 ); myMaximumMemorySpin->setMaxValue( maxAvailableMemory() ); myMaximumMemorySpin->setLineStep( 10 ); - new QLabel( tr("MEGABYTE"), myAdvGroup); + QLabel* aMegabyteLabel = new QLabel( tr("MEGABYTE"), anAdvFrame); - myInitialMemoryCheck = new QCheckBox( tr("INIT_MEMORY_SIZE"), myAdvGroup ); + myInitialMemoryCheck = new QCheckBox( tr("INIT_MEMORY_SIZE"), anAdvFrame ); - myInitialMemorySpin = new QSpinBox( myAdvGroup ); + myInitialMemorySpin = new QSpinBox( anAdvFrame ); myInitialMemorySpin->setMinValue( 1 ); myInitialMemorySpin->setMaxValue( maxAvailableMemory() ); myInitialMemorySpin->setLineStep( 10 ); - new QLabel( tr("MEGABYTE"), myAdvGroup); - new QLabel( tr( "WORKING_DIR" ), myAdvGroup ); - QPushButton* dirBtn = new QPushButton( tr( "SELECT_DIR"), myAdvGroup, "dirBtn"); - myWorkingDir = new QLineEdit( myAdvGroup, "myWorkingDir"); + QLabel* aWorkinDirLabel = new QLabel( tr( "WORKING_DIR" ), anAdvFrame ); + QPushButton* dirBtn = new QPushButton( tr( "SELECT_DIR"), anAdvFrame, "dirBtn"); + myWorkingDir = new QLineEdit( anAdvFrame, "myWorkingDir"); myWorkingDir->setReadOnly( true ); - myKeepFiles = new QCheckBox( tr( "KEEP_WORKING_FILES" ), myAdvGroup ); + myKeepFiles = new QCheckBox( tr( "KEEP_WORKING_FILES" ), anAdvFrame ); + + QLabel* aVerboseLevelLabel = new QLabel( tr("VERBOSE_LEVEL"), anAdvFrame); + myVerboseLevelSpin = new QSpinBox( anAdvFrame ); + myVerboseLevelSpin->setMinValue( 0 ); + myVerboseLevelSpin->setMaxValue( 10 ); + myVerboseLevelSpin->setLineStep( 1 ); + + myToCreateNewNodesCheck = new QCheckBox( tr( "TO_ADD_NODES" ), anAdvFrame ); + + myBoundaryRecoveryCheck = new QCheckBox( tr( "RECOVERY_VERSION" ), anAdvFrame ); + + QLabel* aTextOptionLabel = new QLabel( tr( "TEXT_OPTION" ), anAdvFrame ); + myTextOption = new QLineEdit( anAdvFrame, "myTextOption"); + + + anAdvLayout->addWidget(myMaximumMemoryCheck, 0, 0); + anAdvLayout->addWidget(myMaximumMemorySpin, 0, 1); + anAdvLayout->addWidget(aMegabyteLabel, 0, 2); + + anAdvLayout->addWidget(myInitialMemoryCheck, 1, 0); + anAdvLayout->addWidget(myInitialMemorySpin, 1, 1); + anAdvLayout->addWidget(aMegabyteLabel, 1, 2); + + anAdvLayout->addWidget(aWorkinDirLabel, 2, 0); + anAdvLayout->addWidget(dirBtn, 2, 1); + anAdvLayout->addWidget(myWorkingDir, 2, 2); + + anAdvLayout->addWidget(myKeepFiles, 3, 0); + anAdvLayout->addWidget(aVerboseLevelLabel, 4, 0); + anAdvLayout->addWidget(myVerboseLevelSpin, 4, 1); + + anAdvLayout->addWidget(myToCreateNewNodesCheck, 5, 0); + + anAdvLayout->addMultiCellWidget(myBoundaryRecoveryCheck, 6, 6, 0, 1); + + anAdvLayout->addWidget(aTextOptionLabel, 7, 0); + anAdvLayout->addMultiCellWidget(myTextOption,7, 7, 1, 2); + + connect( tab, SIGNAL( selected(int) ), this, SLOT( onTabSelected(int) ) ); - connect( myMaximumMemoryCheck, SIGNAL( toggled(bool) ), this, SLOT( onMemCheckToggled(bool) )); - connect( myInitialMemoryCheck, SIGNAL( toggled(bool) ), this, SLOT( onMemCheckToggled(bool) )); + connect( myMaximumMemoryCheck, SIGNAL( toggled(bool) ), this, SLOT( onCheckToggled(bool) )); + connect( myInitialMemoryCheck, SIGNAL( toggled(bool) ), this, SLOT( onCheckToggled(bool) )); + connect( myBoundaryRecoveryCheck,SIGNAL(toggled(bool)), this, SLOT( onCheckToggled(bool) )); connect( dirBtn, SIGNAL( clicked() ), this, SLOT( onDirBtnClicked() ) ); return fr; @@ -174,12 +217,22 @@ void GHS3DPluginGUI_HypothesisCreator::onTabSelected(int tab) dlg()->adjustSize(); } -void GHS3DPluginGUI_HypothesisCreator::onMemCheckToggled(bool on) +void GHS3DPluginGUI_HypothesisCreator::onCheckToggled(bool on) { - if ( sender() == myMaximumMemoryCheck ) + const QObject * aSender = sender(); + if ( aSender == myMaximumMemoryCheck ) myMaximumMemorySpin->setEnabled( on ); - else + + else if ( aSender == myInitialMemoryCheck ) myInitialMemorySpin->setEnabled( on ); + + else if ( aSender == myBoundaryRecoveryCheck ) { + myOptimizationLevelCombo->setEnabled( !on ); + myInitialMemorySpin->setEnabled( myInitialMemoryCheck->isChecked() && !on ); + myInitialMemoryCheck->setEnabled( !on ); + myOptimizationLevelCombo->setEnabled( !on ); + } + } void GHS3DPluginGUI_HypothesisCreator::onDirBtnClicked() @@ -213,14 +266,24 @@ void GHS3DPluginGUI_HypothesisCreator::retrieveParams() const myToMeshHolesCheck ->setChecked ( data.myToMeshHoles ); myOptimizationLevelCombo->setCurrentItem( data.myOptimizationLevel ); myMaximumMemoryCheck ->setChecked ( data.myMaximumMemory > 0 ); - myMaximumMemorySpin ->setValue ( std::max( data.myMaximumMemory, myMaximumMemorySpin->minValue() )); + myMaximumMemorySpin ->setValue ( std::max( data.myMaximumMemory, + myMaximumMemorySpin->minValue() )); myInitialMemoryCheck ->setChecked ( data.myInitialMemory > 0 ); - myInitialMemorySpin ->setValue ( std::max( data.myInitialMemory, myInitialMemorySpin->minValue() )); + myInitialMemorySpin ->setValue ( std::max( data.myInitialMemory, + myInitialMemorySpin->minValue() )); myWorkingDir ->setText ( data.myWorkingDir ); myKeepFiles ->setChecked ( data.myKeepFiles ); - - myMaximumMemorySpin->setEnabled( myMaximumMemoryCheck->isChecked() ); - myInitialMemorySpin->setEnabled( myInitialMemoryCheck->isChecked() ); + myVerboseLevelSpin ->setValue ( data.myVerboseLevel ); + myToCreateNewNodesCheck ->setChecked ( data.myToCreateNewNodes ); + myBoundaryRecoveryCheck ->setChecked ( data.myBoundaryRecovery ); + myTextOption ->setText ( data.myTextOption ); + + myOptimizationLevelCombo->setEnabled ( !data.myBoundaryRecovery ); + myMaximumMemorySpin ->setEnabled ( myMaximumMemoryCheck->isChecked() ); + myInitialMemorySpin ->setEnabled ( myInitialMemoryCheck->isChecked() && + !data.myBoundaryRecovery ); + myInitialMemoryCheck ->setEnabled (!data.myBoundaryRecovery ); + myOptimizationLevelCombo->setEnabled (!data.myBoundaryRecovery ); } QString GHS3DPluginGUI_HypothesisCreator::storeParams() const @@ -229,13 +292,36 @@ QString GHS3DPluginGUI_HypothesisCreator::storeParams() const readParamsFromWidgets( data ); storeParamsToHypo( data ); - QString valStr = " -c " + QString::number( !data.myToMeshHoles ); - if ( data.myOptimizationLevel >= 0 && data.myOptimizationLevel < 4 ) { + QString valStr = ""; + + if ( !data.myBoundaryRecovery ) + valStr = "-c " + QString::number( !data.myToMeshHoles ); + + if ( data.myOptimizationLevel >= 0 && data.myOptimizationLevel < 4 && !data.myBoundaryRecovery) { char* level[] = { "none" , "light" , "standard" , "strong" }; valStr += " -o "; valStr += level[ data.myOptimizationLevel ]; } - + if ( data.myMaximumMemory > 0 ) { + valStr += " -m "; + valStr += QString::number( data.myMaximumMemory ); + } + if ( data.myInitialMemory > 0 && !data.myBoundaryRecovery ) { + valStr += " -M "; + valStr += QString::number( data.myInitialMemory ); + } + valStr += " -v "; + valStr += QString::number( data.myVerboseLevel ); + + if ( !data.myToCreateNewNodes ) + valStr += " -p0"; + + if ( data.myBoundaryRecovery ) + valStr += " -C"; + + valStr += " "; + valStr += data.myTextOption; + return valStr; } @@ -254,6 +340,10 @@ bool GHS3DPluginGUI_HypothesisCreator::readParamsFromHypo( GHS3DHypothesisData& h_data.myOptimizationLevel = h->GetOptimizationLevel(); h_data.myKeepFiles = h->GetKeepFiles(); h_data.myWorkingDir = h->GetWorkingDirectory(); + h_data.myVerboseLevel = h->GetVerboseLevel(); + h_data.myToCreateNewNodes = h->GetToCreateNewNodes(); + h_data.myBoundaryRecovery = h->GetToUseBoundaryRecoveryVersion(); + h_data.myTextOption = h->GetTextOption(); return true; } @@ -281,8 +371,16 @@ bool GHS3DPluginGUI_HypothesisCreator::storeParamsToHypo( const GHS3DHypothesisD h->SetOptimizationLevel( h_data.myOptimizationLevel ); if ( h->GetKeepFiles() != h_data.myKeepFiles ) h->SetKeepFiles ( h_data.myKeepFiles ); - if (h->GetWorkingDirectory() != h_data.myWorkingDir ) + if ( h->GetWorkingDirectory() != h_data.myWorkingDir ) h->SetWorkingDirectory ( h_data.myWorkingDir ); + if ( h->GetVerboseLevel() != h_data.myVerboseLevel ) + h->SetVerboseLevel ( h_data.myVerboseLevel ); + if ( h->GetToCreateNewNodes() != h_data.myToCreateNewNodes ) + h->SetToCreateNewNodes( h_data.myToCreateNewNodes ); + if ( h->GetToUseBoundaryRecoveryVersion() != h_data.myBoundaryRecovery ) + h->SetToUseBoundaryRecoveryVersion( h_data.myBoundaryRecovery ); + if ( h->GetTextOption() != h_data.myTextOption ) + h->SetTextOption ( h_data.myTextOption ); } catch(const SALOME::SALOME_Exception& ex) { @@ -301,6 +399,10 @@ bool GHS3DPluginGUI_HypothesisCreator::readParamsFromWidgets( GHS3DHypothesisDat h_data.myOptimizationLevel = myOptimizationLevelCombo->currentItem(); h_data.myKeepFiles = myKeepFiles->isChecked(); h_data.myWorkingDir = myWorkingDir->text(); + h_data.myVerboseLevel = myVerboseLevelSpin->value(); + h_data.myToCreateNewNodes = myToCreateNewNodesCheck->isChecked(); + h_data.myBoundaryRecovery = myBoundaryRecoveryCheck->isChecked(); + h_data.myTextOption = myTextOption->text(); return true; } diff --git a/src/GUI/GHS3DPluginGUI_HypothesisCreator.h b/src/GUI/GHS3DPluginGUI_HypothesisCreator.h index ca3e508..3ba32cd 100644 --- a/src/GUI/GHS3DPluginGUI_HypothesisCreator.h +++ b/src/GUI/GHS3DPluginGUI_HypothesisCreator.h @@ -44,6 +44,11 @@ typedef struct bool myKeepFiles; QString myWorkingDir; QString myName; + short myVerboseLevel; + bool myToCreateNewNodes; + bool myBoundaryRecovery; + QString myTextOption; + } GHS3DHypothesisData; /*! @@ -72,7 +77,7 @@ protected: protected slots: void onTabSelected(int); - void onMemCheckToggled(bool); + void onCheckToggled(bool); void onDirBtnClicked(); private: @@ -94,6 +99,10 @@ private: QSpinBox* myInitialMemorySpin; QLineEdit* myWorkingDir; QCheckBox* myKeepFiles; + QSpinBox* myVerboseLevelSpin; + QCheckBox* myToCreateNewNodesCheck; + QCheckBox* myBoundaryRecoveryCheck; + QLineEdit* myTextOption; }; #endif diff --git a/src/GUI/GHS3DPlugin_msg_en.po b/src/GUI/GHS3DPlugin_msg_en.po index b5b1d39..43209d0 100755 --- a/src/GUI/GHS3DPlugin_msg_en.po +++ b/src/GUI/GHS3DPlugin_msg_en.po @@ -74,8 +74,17 @@ msgstr "..." msgid "KEEP_WORKING_FILES" msgstr "To keep working files" -msgid "" -msgstr "" +msgid "VERBOSE_LEVEL" +msgstr "Verbose level" + +msgid "TO_ADD_NODES" +msgstr "To create new nodes" + +msgid "RECOVERY_VERSION" +msgstr "To use boundary recovery version" + +msgid "TEXT_OPTION" +msgstr "Option as text" msgid "GHS3D_HYPOTHESIS"