From c452daaf16c43426b3c9bc3ba2a070c7b167edbf Mon Sep 17 00:00:00 2001 From: nge Date: Mon, 27 Jul 2009 15:39:04 +0000 Subject: [PATCH] == New "Enforced Vertex" feature == It is possible to add and remove an enforced vertex in the volume with the following commands: SetEnforcedVertex( x, y, z, size ) RemoveEnforcedVertex( x, y, z ) where (x,y,z) are the coordinates of vertex and "size" the physical size associated to this vertex. ATTENTION: A node is created on this vertex. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit == New features with ghs3d version 4.1 == Add following options: ** -no_initial_central_point : to remove initial central point. ** -FEM : Applies finite-element correction by replacing overconstrained elements where it is possible. * Add "standard+" optimisation level. --- idl/GHS3DPlugin_Algorithm.idl | 27 +- src/GHS3DPlugin_GHS3D.cxx | 36 +- src/GHS3DPlugin_Hypothesis.cxx | 156 ++++++-- src/GHS3DPlugin_Hypothesis.hxx | 39 +- src/GHS3DPlugin_Hypothesis_i.cxx | 86 +++- src/GHS3DPlugin_Hypothesis_i.hxx | 23 +- src/GUI/GHS3DPluginGUI_HypothesisCreator.cxx | 397 +++++++++++-------- src/GUI/GHS3DPluginGUI_HypothesisCreator.h | 73 ++-- src/GUI/GHS3DPlugin_msg_en.ts | 42 +- 9 files changed, 571 insertions(+), 308 deletions(-) diff --git a/idl/GHS3DPlugin_Algorithm.idl b/idl/GHS3DPlugin_Algorithm.idl index d14d738..341c809 100644 --- a/idl/GHS3DPlugin_Algorithm.idl +++ b/idl/GHS3DPlugin_Algorithm.idl @@ -31,14 +31,14 @@ */ module GHS3DPlugin { - struct GHS3DSizeMapVertex { + struct GHS3DEnforcedVertex { double x; double y; double z; double size; }; - typedef sequence GHS3DSizeMapVertexList; + typedef sequence GHS3DEnforcedVertexList; /*! * GHS3DPlugin_GHS3D: interface of "Tetrahedron (GHS3D)" algorithm */ @@ -107,6 +107,19 @@ module GHS3DPlugin */ void SetToUseBoundaryRecoveryVersion(in boolean toUse); boolean GetToUseBoundaryRecoveryVersion(); + /*! + * Applies finite-element correction by replacing overconstrained elements where + * it is possible. The process is cutting first the overconstrained edges and + * second the overconstrained facets. This insure that no edges have two boundary + * vertices and that no facets have three boundary vertices. + */ + void SetFEMCorrection(in boolean toUseFem); + boolean GetFEMCorrection(); + /*! + * To removes initial central point. + */ + void SetToRemoveCentralPoint(in boolean toRemove); + boolean GetToRemoveCentralPoint(); /*! * To set hiden/undocumented/advanced options */ @@ -115,11 +128,11 @@ module GHS3DPlugin /*! * To set an enforced vertex */ - void SetSizeMapVertex(in double x, in double y, in double z, in double size); - double GetSizeMapVertex(in double x, in double y, in double z) raises (SALOME::SALOME_Exception); - void RemoveSizeMapVertex(in double x, in double y, in double z) raises (SALOME::SALOME_Exception); - GHS3DSizeMapVertexList GetSizeMapVerteces(); - void ClearSizeMapVerteces(); + void SetEnforcedVertex(in double x, in double y, in double z, in double size); + double GetEnforcedVertex(in double x, in double y, in double z) raises (SALOME::SALOME_Exception); + void RemoveEnforcedVertex(in double x, in double y, in double z) raises (SALOME::SALOME_Exception); + GHS3DEnforcedVertexList GetEnforcedVerteces(); + void ClearEnforcedVerteces(); }; }; diff --git a/src/GHS3DPlugin_GHS3D.cxx b/src/GHS3DPlugin_GHS3D.cxx index 23d5949..08265aa 100644 --- a/src/GHS3DPlugin_GHS3D.cxx +++ b/src/GHS3DPlugin_GHS3D.cxx @@ -303,7 +303,8 @@ static bool writeFaces (ofstream & theFile, } } } - + + delete [] tabID; delete [] tabShape; @@ -404,7 +405,7 @@ static bool writePoints (ofstream & theFile, SMESHDS_Mesh * theMesh, map & theSmdsToGhs3dIdMap, map & theGhs3dIdToNodeMap, - GHS3DPlugin_Hypothesis::TSizeMapVertexValues & theEnforcedVerteces) + map,double> & theEnforcedVerteces) { // record structure: // @@ -456,7 +457,7 @@ static bool writePoints (ofstream & theFile, } // Iterate over the enforced verteces - GHS3DPlugin_Hypothesis::TSizeMapVertexValues::const_iterator vertexIt; + GHS3DPlugin_Hypothesis::TEnforcedVertexValues::const_iterator vertexIt; const TopoDS_Shape shapeToMesh = theMesh->ShapeToMesh(); for(vertexIt = theEnforcedVerteces.begin() ; vertexIt != theEnforcedVerteces.end() ; ++vertexIt) { double x = vertexIt->first[0]; @@ -468,7 +469,7 @@ static bool writePoints (ofstream & theFile, scl.Perform(myPoint, 1e-7); TopAbs_State result = scl.State(); if ( result == TopAbs_IN ) { - std::cout << "Adding enforced vertex (" << x << "," << y <<"," << z << ") = " << vertexIt->second << std::endl; + MESSAGE("Adding enforced vertex (" << x << "," << y <<"," << z << ") = " << vertexIt->second); // X Y Z PHY_SIZE DUMMY_INT theFile << space << x @@ -480,8 +481,10 @@ static bool writePoints (ofstream & theFile, theFile << std::endl; } else - std::cout << "Enforced vertex (" << x << "," << y <<"," << z << ") is not inside the geometry: it was not added " << std::endl; + MESSAGE("Enforced vertex (" << x << "," << y <<"," << z << ") is not inside the geometry: it was not added "); } + + std::cout << std::endl; std::cout << "End writing in 'points' file." << std::endl; @@ -496,7 +499,7 @@ static bool writePoints (ofstream & theFile, static bool writePoints (ofstream & theFile, SMESHDS_Mesh * theMesh, const vector & theNodeByGhs3dId, - GHS3DPlugin_Hypothesis::TSizeMapVertexValues & theEnforcedVerteces) + map,double> & theEnforcedVerteces) { // record structure: // @@ -545,7 +548,7 @@ static bool writePoints (ofstream & theFile, } // Iterate over the enforced verteces - GHS3DPlugin_Hypothesis::TSizeMapVertexValues::const_iterator vertexIt; + GHS3DPlugin_Hypothesis::TEnforcedVertexValues::const_iterator vertexIt; const TopoDS_Shape shapeToMesh = theMesh->ShapeToMesh(); for(vertexIt = theEnforcedVerteces.begin() ; vertexIt != theEnforcedVerteces.end() ; ++vertexIt) { double x = vertexIt->first[0]; @@ -722,6 +725,7 @@ static bool readResultFile(const int fileOpen, bool toMeshHoles, int nbEnforcedVerteces) { + MESSAGE("GHS3DPlugin_GHS3D::readResultFile()"); struct stat status; size_t length; @@ -782,12 +786,18 @@ static bool readResultFile(const int fileOpen, for (int i=0; i < 4*nbElems; i++) nodeId = strtol(ptr, &ptr, 10); + MESSAGE("nbInputNodes: "< (nbInputNodes-nbEnforcedVerteces) ) { + // Creating SMESH nodes + // - for enforced verteces + // - for verteces of forced edges + // - for ghs3d nodes nodeAssigne[ iNode ] = 0; aNewNode = theMeshDS->AddNode( coord[0],coord[1],coord[2] ); theGhs3dIdToNodeMap.insert(theGhs3dIdToNodeMap.end(), make_pair( iNode, aNewNode )); @@ -825,7 +835,7 @@ static bool readResultFile(const int fileOpen, } // END -- 0020330: Pb with ghs3d as a submesh #ifdef _DEBUG_ - cout << i+1 << " subdomain: findShapeID() returns " << tabID[i] << endl; + std::cout << i+1 << " subdomain: findShapeID() returns " << tabID[i] << std::endl; #endif } catch ( Standard_Failure ) { } catch (...) {} @@ -1108,14 +1118,13 @@ bool GHS3DPlugin_GHS3D::Compute(SMESH_Mesh& theMesh, } map aSmdsToGhs3dIdMap; map aGhs3dIdToNodeMap; - GHS3DPlugin_Hypothesis::TSizeMapVertexValues enforcedVerteces; - int nbEnforcedVerteces; + map,double> enforcedVerteces; + int nbEnforcedVerteces = 0; try { enforcedVerteces = GHS3DPlugin_Hypothesis::GetEnforcedVerteces(_hyp); nbEnforcedVerteces = enforcedVerteces.size(); } catch(...) { - nbEnforcedVerteces = 0; } Ok = writePoints( aPointsFile, meshDS, aSmdsToGhs3dIdMap, aGhs3dIdToNodeMap, enforcedVerteces) && @@ -1257,14 +1266,13 @@ bool GHS3DPlugin_GHS3D::Compute(SMESH_Mesh& theMesh, if (!Ok) return error( SMESH_Comment("Can't write into ") << aPointsFileName); - GHS3DPlugin_Hypothesis::TSizeMapVertexValues enforcedVerteces; - int nbEnforcedVerteces; + GHS3DPlugin_Hypothesis::TEnforcedVertexValues enforcedVerteces; + int nbEnforcedVerteces = 0; try { enforcedVerteces = GHS3DPlugin_Hypothesis::GetEnforcedVerteces(_hyp); nbEnforcedVerteces = enforcedVerteces.size(); } catch(...) { - nbEnforcedVerteces = 0; } vector aNodeByGhs3dId; diff --git a/src/GHS3DPlugin_Hypothesis.cxx b/src/GHS3DPlugin_Hypothesis.cxx index 55dbd84..253b31a 100644 --- a/src/GHS3DPlugin_Hypothesis.cxx +++ b/src/GHS3DPlugin_Hypothesis.cxx @@ -41,7 +41,9 @@ GHS3DPlugin_Hypothesis::GHS3DPlugin_Hypothesis(int hypId, int studyId, SMESH_Gen myVerboseLevel(DefaultVerboseLevel()), myToCreateNewNodes(DefaultToCreateNewNodes()), myToUseBoundaryRecoveryVersion(DefaultToUseBoundaryRecoveryVersion()), - mySizeMapVerteces(DefaultSizeMapVerteces()) + myToUseFemCorrection(DefaultToUseFEMCorrection()), + myToRemoveCentralPoint(DefaultToRemoveCentralPoint()), + myEnforcedVerteces(DefaultEnforcedVerteces()) { _name = "GHS3D_Parameters"; _param_algo_dim = 3; @@ -243,6 +245,48 @@ bool GHS3DPlugin_Hypothesis::GetToUseBoundaryRecoveryVersion() const return myToUseBoundaryRecoveryVersion; } +//======================================================================= +//function : SetFEMCorrection +//======================================================================= + +void GHS3DPlugin_Hypothesis::SetFEMCorrection(bool toUseFem) +{ + if ( myToUseFemCorrection != toUseFem ) { + myToUseFemCorrection = toUseFem; + NotifySubMeshesHypothesisModification(); + } +} + +//======================================================================= +//function : GetFEMCorrection +//======================================================================= + +bool GHS3DPlugin_Hypothesis::GetFEMCorrection() const +{ + return myToUseFemCorrection; +} + +//======================================================================= +//function : SetToRemoveCentralPoint +//======================================================================= + +void GHS3DPlugin_Hypothesis::SetToRemoveCentralPoint(bool toRemove) +{ + if ( myToRemoveCentralPoint != toRemove ) { + myToRemoveCentralPoint = toRemove; + NotifySubMeshesHypothesisModification(); + } +} + +//======================================================================= +//function : GetToRemoveCentralPoint +//======================================================================= + +bool GHS3DPlugin_Hypothesis::GetToRemoveCentralPoint() const +{ + return myToRemoveCentralPoint; +} + //======================================================================= //function : SetTextOption //======================================================================= @@ -265,51 +309,51 @@ std::string GHS3DPlugin_Hypothesis::GetTextOption() const } //======================================================================= -//function : SetSizeMapVertex +//function : SetEnforcedVertex //======================================================================= -void GHS3DPlugin_Hypothesis::SetSizeMapVertex(double x, double y, double z, double size) +void GHS3DPlugin_Hypothesis::SetEnforcedVertex(double x, double y, double z, double size) { std::vector coord(3); coord[0] = x; coord[1] = y; coord[2] = z; - mySizeMapVerteces[coord] = size; + myEnforcedVerteces[coord] = size; NotifySubMeshesHypothesisModification(); } //======================================================================= -//function : GetSizeMapVertex +//function : GetEnforcedVertex //======================================================================= -double GHS3DPlugin_Hypothesis::GetSizeMapVertex(double x, double y, double z) +double GHS3DPlugin_Hypothesis::GetEnforcedVertex(double x, double y, double z) throw (std::invalid_argument) { std::vector coord(3); coord[0] = x; coord[1] = y; coord[2] = z; - if (mySizeMapVerteces.count(coord)>0) - return mySizeMapVerteces[coord]; + if (myEnforcedVerteces.count(coord)>0) + return myEnforcedVerteces[coord]; std::ostringstream msg ; msg << "No enforced vertex at " << x << ", " << y << ", " << z; throw std::invalid_argument(msg.str()); } //======================================================================= -//function : RemoveSizeMapVertex +//function : RemoveEnforcedVertex //======================================================================= -void GHS3DPlugin_Hypothesis::RemoveSizeMapVertex(double x, double y, double z) +void GHS3DPlugin_Hypothesis::RemoveEnforcedVertex(double x, double y, double z) throw (std::invalid_argument) { std::vector coord(3); coord[0] = x; coord[1] = y; coord[2] = z; - TSizeMapVertexValues::iterator it = mySizeMapVerteces.find(coord); - if (it != mySizeMapVerteces.end()) { - mySizeMapVerteces.erase(it); + TEnforcedVertexValues::iterator it = myEnforcedVerteces.find(coord); + if (it != myEnforcedVerteces.end()) { + myEnforcedVerteces.erase(it); NotifySubMeshesHypothesisModification(); return; } @@ -319,11 +363,11 @@ void GHS3DPlugin_Hypothesis::RemoveSizeMapVertex(double x, double y, double z) } //======================================================================= -//function : ClearSizeMapVerteces +//function : ClearEnforcedVerteces //======================================================================= -void GHS3DPlugin_Hypothesis::ClearSizeMapVerteces() +void GHS3DPlugin_Hypothesis::ClearEnforcedVerteces() { - mySizeMapVerteces.clear(); + myEnforcedVerteces.clear(); NotifySubMeshesHypothesisModification(); } @@ -448,12 +492,30 @@ bool GHS3DPlugin_Hypothesis::DefaultToUseBoundaryRecoveryVersion() } //======================================================================= -//function : DefaultSizeMapVerteces +//function : DefaultToUseFEMCorrection //======================================================================= -GHS3DPlugin_Hypothesis::TSizeMapVertexValues GHS3DPlugin_Hypothesis::DefaultSizeMapVerteces() +bool GHS3DPlugin_Hypothesis::DefaultToUseFEMCorrection() { - return GHS3DPlugin_Hypothesis::TSizeMapVertexValues(); + return false; +} + +//======================================================================= +//function : DefaultToRemoveCentralPoint +//======================================================================= + +bool GHS3DPlugin_Hypothesis::DefaultToRemoveCentralPoint() +{ + return false; +} + +//======================================================================= +//function : DefaultEnforcedVerteces +//======================================================================= + +GHS3DPlugin_Hypothesis::TEnforcedVertexValues GHS3DPlugin_Hypothesis::DefaultEnforcedVerteces() +{ + return GHS3DPlugin_Hypothesis::TEnforcedVertexValues(); } @@ -472,15 +534,17 @@ std::ostream & GHS3DPlugin_Hypothesis::SaveTo(std::ostream & save) save << myVerboseLevel << " "; save << (int)myToCreateNewNodes << " "; save << (int)myToUseBoundaryRecoveryVersion << " "; + save << (int)myToUseFemCorrection << " "; + save << (int)myToRemoveCentralPoint << " "; save << "__OPTIONS_BEGIN__ "; save << myTextOption << " "; save << " __OPTIONS_END__ "; - TSizeMapVertexValues::iterator it = mySizeMapVerteces.begin(); - if (it != mySizeMapVerteces.end()) { + TEnforcedVertexValues::iterator it = myEnforcedVerteces.begin(); + if (it != myEnforcedVerteces.end()) { save << "__ENFORCED_VERTECES_BEGIN__ "; - for ( ; it != mySizeMapVerteces.end(); ++it ) { + for ( ; it != myEnforcedVerteces.end(); ++it ) { save << it->first[0] << " " << it->first[1] << " " << it->first[2] << " " @@ -565,6 +629,18 @@ std::istream & GHS3DPlugin_Hypothesis::LoadFrom(std::istream & load) else load.clear(ios::badbit | load.rdstate()); + isOK = (load >> i); + if (isOK) + myToUseFemCorrection = (bool) i; + else + load.clear(ios::badbit | load.rdstate()); + + isOK = (load >> i); + if (isOK) + myToRemoveCentralPoint = (bool) i; + else + load.clear(ios::badbit | load.rdstate()); + // isOK = (load >> myTextOption); // while (isOK) { // std::string txt; @@ -636,7 +712,7 @@ std::istream & GHS3DPlugin_Hypothesis::LoadFrom(std::istream & load) coord.push_back(x); coord.push_back(y); coord.push_back(z); - mySizeMapVerteces[ coord ] = size; + myEnforcedVerteces[ coord ] = size; } } } @@ -681,13 +757,15 @@ std::string GHS3DPlugin_Hypothesis::CommandToRun(const GHS3DPlugin_Hypothesis* h TCollection_AsciiString cmd( "ghs3d.exe" ); #endif // check if any option is overridden by hyp->myTextOption - bool m = hyp ? ( hyp->myTextOption.find("-m") == std::string::npos ) : true; - bool M = hyp ? ( hyp->myTextOption.find("-M") == std::string::npos ) : true; - bool c = hyp ? ( hyp->myTextOption.find("-c") == std::string::npos ) : true; - bool o = hyp ? ( hyp->myTextOption.find("-o") == std::string::npos ) : true; - bool p0= hyp ? ( hyp->myTextOption.find("-p0")== std::string::npos ) : true; - bool C = hyp ? ( hyp->myTextOption.find("-C") == std::string::npos ) : true; - bool v = hyp ? ( hyp->myTextOption.find("-v") == std::string::npos ) : true; + bool m = hyp ? ( hyp->myTextOption.find("-m") == std::string::npos ) : true; + bool M = hyp ? ( hyp->myTextOption.find("-M") == std::string::npos ) : true; + bool c = hyp ? ( hyp->myTextOption.find("-c") == std::string::npos ) : true; + bool o = hyp ? ( hyp->myTextOption.find("-o") == std::string::npos ) : true; + bool p0 = hyp ? ( hyp->myTextOption.find("-p0") == std::string::npos ) : true; + bool C = hyp ? ( hyp->myTextOption.find("-C") == std::string::npos ) : true; + bool v = hyp ? ( hyp->myTextOption.find("-v") == std::string::npos ) : true; + bool fem = hyp ? ( hyp->myTextOption.find("-FEM")== std::string::npos ) : true; + bool rem = hyp ? ( hyp->myTextOption.find("-no_initial_central_point")== std::string::npos ) : true; // if use boundary recovery version, few options are allowed bool useBndRecovery = !C; @@ -731,8 +809,8 @@ std::string GHS3DPlugin_Hypothesis::CommandToRun(const GHS3DPlugin_Hypothesis* h // optimization level if ( o && hyp && !useBndRecovery ) { - if ( hyp->myOptimizationLevel >= 0 && hyp->myOptimizationLevel < 4 ) { - char* level[] = { "none" , "light" , "standard" , "strong" }; + if ( hyp->myOptimizationLevel >= 0 && hyp->myOptimizationLevel < 5 ) { + char* level[] = { "none" , "light" , "standard" , "standard+" , "strong" }; cmd += " -o "; cmd += level[ hyp->myOptimizationLevel ]; } @@ -754,6 +832,16 @@ std::string GHS3DPlugin_Hypothesis::CommandToRun(const GHS3DPlugin_Hypothesis* h cmd += " -C"; } + // to use FEM correction + if ( fem && hyp && hyp->myToUseFemCorrection) { + cmd += " -FEM"; + } + + // to remove initial central point. + if ( rem && hyp && hyp->myToRemoveCentralPoint) { + cmd += " -no_initial_central_point"; + } + // options as text if ( hyp && !hyp->myTextOption.empty() ) { cmd += " "; @@ -799,8 +887,8 @@ std::string GHS3DPlugin_Hypothesis::GetFileName(const GHS3DPlugin_Hypothesis* hy */ //================================================================================ -GHS3DPlugin_Hypothesis::TSizeMapVertexValues GHS3DPlugin_Hypothesis::GetEnforcedVerteces(const GHS3DPlugin_Hypothesis* hyp) +GHS3DPlugin_Hypothesis::TEnforcedVertexValues GHS3DPlugin_Hypothesis::GetEnforcedVerteces(const GHS3DPlugin_Hypothesis* hyp) { - return hyp ? hyp->GetSizeMapVerteces():DefaultSizeMapVerteces(); + return hyp ? hyp->_GetEnforcedVerteces():DefaultEnforcedVerteces(); } diff --git a/src/GHS3DPlugin_Hypothesis.hxx b/src/GHS3DPlugin_Hypothesis.hxx index cab3b68..fcdd774 100644 --- a/src/GHS3DPlugin_Hypothesis.hxx +++ b/src/GHS3DPlugin_Hypothesis.hxx @@ -57,9 +57,9 @@ public: void SetInitialMemory(short MB); short GetInitialMemory() const; /*! - * Optimization level: 0-none, 1-light, 2-medium, 3-strong. Default is medium + * Optimization level: 0-none, 1-light, 2-medium, 3-standard+, 4-strong. Default is medium */ - enum OptimizationLevel { None = 0, Light, Medium, Strong }; + enum OptimizationLevel { None = 0, Light, Medium, StandardPlus, Strong }; void SetOptimizationLevel(OptimizationLevel level); OptimizationLevel GetOptimizationLevel() const; /*! @@ -95,6 +95,19 @@ public: */ void SetToUseBoundaryRecoveryVersion(bool toUse); bool GetToUseBoundaryRecoveryVersion() const; + /*! + * Applies finite-element correction by replacing overconstrained elements where + * it is possible. The process is cutting first the overconstrained edges and + * second the overconstrained facets. This insure that no edges have two boundary + * vertices and that no facets have three boundary vertices. + */ + void SetFEMCorrection(bool toUseFem); + bool GetFEMCorrection() const; + /*! + * To removes initial central point. + */ + void SetToRemoveCentralPoint(bool toRemove); + bool GetToRemoveCentralPoint() const; /*! * To set hiden/undocumented/advanced options */ @@ -103,12 +116,12 @@ public: /*! * To set an enforced vertex */ - typedef std::map,double> TSizeMapVertexValues; - void SetSizeMapVertex(double x, double y, double z, double size); - double GetSizeMapVertex(double x, double y, double z) throw (std::invalid_argument); - void RemoveSizeMapVertex(double x, double y, double z) throw (std::invalid_argument); - const TSizeMapVertexValues GetSizeMapVerteces() const { return mySizeMapVerteces; } - void ClearSizeMapVerteces(); + typedef std::map,double> TEnforcedVertexValues; + void SetEnforcedVertex(double x, double y, double z, double size); + double GetEnforcedVertex(double x, double y, double z) throw (std::invalid_argument); + void RemoveEnforcedVertex(double x, double y, double z) throw (std::invalid_argument); + const TEnforcedVertexValues _GetEnforcedVerteces() const { return myEnforcedVerteces; } + void ClearEnforcedVerteces(); static bool DefaultMeshHoles(); static short DefaultMaximumMemory(); @@ -119,7 +132,9 @@ public: static short DefaultVerboseLevel(); static bool DefaultToCreateNewNodes(); static bool DefaultToUseBoundaryRecoveryVersion(); - static TSizeMapVertexValues DefaultSizeMapVerteces(); + static bool DefaultToUseFEMCorrection(); + static bool DefaultToRemoveCentralPoint(); + static TEnforcedVertexValues DefaultEnforcedVerteces(); /*! * \brief Return command to run ghs3d mesher excluding file prefix (-f) @@ -133,7 +148,7 @@ public: /*! * \brief Return the enforced verteces */ - static TSizeMapVertexValues GetEnforcedVerteces(const GHS3DPlugin_Hypothesis* hyp); + static TEnforcedVertexValues GetEnforcedVerteces(const GHS3DPlugin_Hypothesis* hyp); // Persistence virtual std::ostream & SaveTo(std::ostream & save); @@ -162,8 +177,10 @@ private: short myVerboseLevel; bool myToCreateNewNodes; bool myToUseBoundaryRecoveryVersion; + bool myToUseFemCorrection; + bool myToRemoveCentralPoint; std::string myTextOption; - TSizeMapVertexValues mySizeMapVerteces; + TEnforcedVertexValues myEnforcedVerteces; }; diff --git a/src/GHS3DPlugin_Hypothesis_i.cxx b/src/GHS3DPlugin_Hypothesis_i.cxx index e7af824..853a795 100644 --- a/src/GHS3DPlugin_Hypothesis_i.cxx +++ b/src/GHS3DPlugin_Hypothesis_i.cxx @@ -273,6 +273,48 @@ CORBA::Boolean GHS3DPlugin_Hypothesis_i::GetToUseBoundaryRecoveryVersion() return this->GetImpl()->GetToUseBoundaryRecoveryVersion(); } +//======================================================================= +//function : SetFEMCorrection +//======================================================================= + +void GHS3DPlugin_Hypothesis_i::SetFEMCorrection(CORBA::Boolean toUseFem) +{ + ASSERT(myBaseImpl); + this->GetImpl()->SetFEMCorrection(toUseFem); + SMESH::TPythonDump() << _this() << ".SetFEMCorrection( " << toUseFem << " )"; +} + +//======================================================================= +//function : GetFEMCorrection +//======================================================================= + +CORBA::Boolean GHS3DPlugin_Hypothesis_i::GetFEMCorrection() +{ + ASSERT(myBaseImpl); + return this->GetImpl()->GetFEMCorrection(); +} + +//======================================================================= +//function : SetToRemoveCentralPoint +//======================================================================= + +void GHS3DPlugin_Hypothesis_i::SetToRemoveCentralPoint(CORBA::Boolean toRemove) +{ + ASSERT(myBaseImpl); + this->GetImpl()->SetToRemoveCentralPoint(toRemove); + SMESH::TPythonDump() << _this() << ".SetToRemoveCentralPoint( " << toRemove << " )"; +} + +//======================================================================= +//function : GetToRemoveCentralPoint +//======================================================================= + +CORBA::Boolean GHS3DPlugin_Hypothesis_i::GetToRemoveCentralPoint() +{ + ASSERT(myBaseImpl); + return this->GetImpl()->GetToRemoveCentralPoint(); +} + //======================================================================= //function : SetTextOption //======================================================================= @@ -295,32 +337,32 @@ char* GHS3DPlugin_Hypothesis_i::GetTextOption() } //======================================================================= -//function : SetSizeMapVertex +//function : SetEnforcedVertex //======================================================================= -void GHS3DPlugin_Hypothesis_i::SetSizeMapVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size) +void GHS3DPlugin_Hypothesis_i::SetEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size) { ASSERT(myBaseImpl); - this->GetImpl()->SetSizeMapVertex(x,y,z,size); - SMESH::TPythonDump() << _this() << ".SetSizeMapVertex( " << x << ", " << y << ", " << z << ", " << size << " )"; + this->GetImpl()->SetEnforcedVertex(x,y,z,size); + SMESH::TPythonDump() << _this() << ".SetEnforcedVertex( " << x << ", " << y << ", " << z << ", " << size << " )"; } //======================================================================= -//function : SetSizeMapVertex +//function : GetEnforcedVertex //======================================================================= -CORBA::Double GHS3DPlugin_Hypothesis_i::GetSizeMapVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z) +CORBA::Double GHS3DPlugin_Hypothesis_i::GetEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z) throw (SALOME::SALOME_Exception) { ASSERT(myBaseImpl); try { - return this->GetImpl()->GetSizeMapVertex(x,y,z); + return this->GetImpl()->GetEnforcedVertex(x,y,z); } catch (const std::invalid_argument& ex) { SALOME::ExceptionStruct ExDescription; ExDescription.text = ex.what(); ExDescription.type = SALOME::BAD_PARAM; - ExDescription.sourceFile = "GHS3DPlugin_Hypothesis::GetSizeMapVertex(x,y,z)"; + ExDescription.sourceFile = "GHS3DPlugin_Hypothesis::GetEnforcedVertex(x,y,z)"; ExDescription.lineNumber = 0; throw SALOME::SALOME_Exception(ExDescription); } @@ -331,22 +373,22 @@ CORBA::Double GHS3DPlugin_Hypothesis_i::GetSizeMapVertex(CORBA::Double x, CORBA: } //======================================================================= -//function : GetSizeMapVerteces +//function : GetEnforcedVerteces //======================================================================= -GHS3DPlugin::GHS3DSizeMapVertexList* GHS3DPlugin_Hypothesis_i::GetSizeMapVerteces() +GHS3DPlugin::GHS3DEnforcedVertexList* GHS3DPlugin_Hypothesis_i::GetEnforcedVerteces() { ASSERT(myBaseImpl); - GHS3DPlugin::GHS3DSizeMapVertexList_var result = new GHS3DPlugin::GHS3DSizeMapVertexList(); + GHS3DPlugin::GHS3DEnforcedVertexList_var result = new GHS3DPlugin::GHS3DEnforcedVertexList(); - const ::GHS3DPlugin_Hypothesis::TSizeMapVertexValues sizeMaps = this->GetImpl()->GetSizeMapVerteces(); + const ::GHS3DPlugin_Hypothesis::TEnforcedVertexValues sizeMaps = this->GetImpl()->_GetEnforcedVerteces(); int size = sizeMaps.size(); result->length( size ); - ::GHS3DPlugin_Hypothesis::TSizeMapVertexValues::const_iterator it; + ::GHS3DPlugin_Hypothesis::TEnforcedVertexValues::const_iterator it; int i = 0; for (it = sizeMaps.begin() ; it != sizeMaps.end(); it++ ) { - GHS3DPlugin::GHS3DSizeMapVertex_var myVertex = new GHS3DPlugin::GHS3DSizeMapVertex(); + GHS3DPlugin::GHS3DEnforcedVertex_var myVertex = new GHS3DPlugin::GHS3DEnforcedVertex(); myVertex->x = it->first[0]; myVertex->y = it->first[1]; myVertex->z = it->first[2]; @@ -359,22 +401,22 @@ GHS3DPlugin::GHS3DSizeMapVertexList* GHS3DPlugin_Hypothesis_i::GetSizeMapVertece } //======================================================================= -//function : RemoveSizeMapVertex +//function : RemoveEnforcedVertex //======================================================================= -void GHS3DPlugin_Hypothesis_i::RemoveSizeMapVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z) +void GHS3DPlugin_Hypothesis_i::RemoveEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z) throw (SALOME::SALOME_Exception) { ASSERT(myBaseImpl); try { - this->GetImpl()->RemoveSizeMapVertex(x,y,z); - SMESH::TPythonDump() << _this() << ".RemoveSizeMapVertex( " << x << ", " << y << ", " << z << " )"; + this->GetImpl()->RemoveEnforcedVertex(x,y,z); + SMESH::TPythonDump() << _this() << ".RemoveEnforcedVertex( " << x << ", " << y << ", " << z << " )"; } catch (const std::invalid_argument& ex) { SALOME::ExceptionStruct ExDescription; ExDescription.text = ex.what(); ExDescription.type = SALOME::BAD_PARAM; - ExDescription.sourceFile = "GHS3DPlugin_Hypothesis::RemoveSizeMapVertex(x,y,z)"; + ExDescription.sourceFile = "GHS3DPlugin_Hypothesis::RemoveEnforcedVertex(x,y,z)"; ExDescription.lineNumber = 0; throw SALOME::SALOME_Exception(ExDescription); } @@ -384,13 +426,13 @@ void GHS3DPlugin_Hypothesis_i::RemoveSizeMapVertex(CORBA::Double x, CORBA::Doubl } //======================================================================= -//function : ClearSizeMapVerteces +//function : ClearEnforcedVerteces //======================================================================= -void GHS3DPlugin_Hypothesis_i::ClearSizeMapVerteces() +void GHS3DPlugin_Hypothesis_i::ClearEnforcedVerteces() { ASSERT(myBaseImpl); - this->GetImpl()->ClearSizeMapVerteces(); + this->GetImpl()->ClearEnforcedVerteces(); } //============================================================================= diff --git a/src/GHS3DPlugin_Hypothesis_i.hxx b/src/GHS3DPlugin_Hypothesis_i.hxx index ab5a079..f4d8c0c 100644 --- a/src/GHS3DPlugin_Hypothesis_i.hxx +++ b/src/GHS3DPlugin_Hypothesis_i.hxx @@ -102,6 +102,19 @@ class GHS3DPLUGIN_EXPORT GHS3DPlugin_Hypothesis_i: */ void SetToUseBoundaryRecoveryVersion(CORBA::Boolean toUse); CORBA::Boolean GetToUseBoundaryRecoveryVersion(); + /*! + * Applies finite-element correction by replacing overconstrained elements where + * it is possible. The process is cutting first the overconstrained edges and + * second the overconstrained facets. This insure that no edges have two boundary + * vertices and that no facets have three boundary vertices. + */ + void SetFEMCorrection(CORBA::Boolean toUseFem); + CORBA::Boolean GetFEMCorrection(); + /*! + * To removes initial central point. + */ + void SetToRemoveCentralPoint(CORBA::Boolean toRemove); + CORBA::Boolean GetToRemoveCentralPoint(); /*! * To set hiden/undocumented/advanced options */ @@ -110,11 +123,11 @@ class GHS3DPLUGIN_EXPORT GHS3DPlugin_Hypothesis_i: /*! * To set an enforced vertex */ - void SetSizeMapVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size); - CORBA::Double GetSizeMapVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z) throw (SALOME::SALOME_Exception); - void RemoveSizeMapVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z) throw (SALOME::SALOME_Exception); - GHS3DPlugin::GHS3DSizeMapVertexList* GetSizeMapVerteces(); - void ClearSizeMapVerteces(); + void SetEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z, CORBA::Double size); + CORBA::Double GetEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z) throw (SALOME::SALOME_Exception); + void RemoveEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z) throw (SALOME::SALOME_Exception); + GHS3DPlugin::GHS3DEnforcedVertexList* GetEnforcedVerteces(); + void ClearEnforcedVerteces(); // Get implementation ::GHS3DPlugin_Hypothesis* GetImpl(); diff --git a/src/GUI/GHS3DPluginGUI_HypothesisCreator.cxx b/src/GUI/GHS3DPluginGUI_HypothesisCreator.cxx index db11e0c..c63252b 100644 --- a/src/GUI/GHS3DPluginGUI_HypothesisCreator.cxx +++ b/src/GUI/GHS3DPluginGUI_HypothesisCreator.cxx @@ -32,6 +32,7 @@ #include #include #include +#include #include #include @@ -54,26 +55,32 @@ #include #include +// tabs enum { STD_TAB = 0, ADV_TAB, - SMP_TAB, - SMP_X_COLUMN = 0, - SMP_Y_COLUMN, - SMP_Z_COLUMN, - SMP_SIZE_COLUMN, - SMP_NB_COLUMNS + ENF_VER_TAB }; +// Enforced verteces array columns enum { - SMP_COORDS = 0, - SMP_BTNS = 0, - SMP_X_COORD, - SMP_Y_COORD, - SMP_Z_COORD, - SMP_VERTEX_BTN, - SMP_SEPARATOR, - SMP_REMOVE_BTN, + ENF_VER_X_COLUMN = 0, + ENF_VER_Y_COLUMN, + ENF_VER_Z_COLUMN, + ENF_VER_SIZE_COLUMN, + ENF_VER_NB_COLUMNS +}; + +// Enforced verteces inputs +enum { + ENF_VER_BTNS = 0, + ENF_VER_X_COORD, + ENF_VER_Y_COORD, + ENF_VER_Z_COORD, + ENF_VER_SIZE, + ENF_VER_VERTEX_BTN, + ENF_VER_SEPARATOR, + ENF_VER_REMOVE_BTN, }; namespace { @@ -112,6 +119,8 @@ namespace { } } +class QDoubleValidator; + // // BEGIN DoubleLineEditDelegate // @@ -208,7 +217,7 @@ QFrame* GHS3DPluginGUI_HypothesisCreator::buildFrame() aStdLayout->addWidget( myOptimizationLevelCombo, row++, 1, 1, 1 ); QStringList types; - types << tr( "LEVEL_NONE" ) << tr( "LEVEL_LIGHT" ) << tr( "LEVEL_MEDIUM" ) << tr( "LEVEL_STRONG" ); + types << tr( "LEVEL_NONE" ) << tr( "LEVEL_LIGHT" ) << tr( "LEVEL_MEDIUM" ) << tr( "LEVEL_STANDARDPLUS" ) << tr( "LEVEL_STRONG" ); myOptimizationLevelCombo->addItems( types ); aStdLayout->setRowStretch( row, 5 ); @@ -249,76 +258,88 @@ QFrame* GHS3DPluginGUI_HypothesisCreator::buildFrame() myToCreateNewNodesCheck = new QCheckBox( tr( "TO_ADD_NODES" ), myAdvGroup ); + myRemoveInitialCentralPointCheck = new QCheckBox( tr( "NO_INITIAL_CENTRAL_POINT" ), myAdvGroup ); + myBoundaryRecoveryCheck = new QCheckBox( tr( "RECOVERY_VERSION" ), myAdvGroup ); + + myFEMCorrectionCheck = new QCheckBox( tr( "FEM_CORRECTION" ), myAdvGroup ); QLabel* aTextOptionLabel = new QLabel( tr( "TEXT_OPTION" ), myAdvGroup ); myTextOption = new QLineEdit( myAdvGroup ); - anAdvLayout->addWidget( myMaximumMemoryCheck, 0, 0, 1, 1 ); - anAdvLayout->addWidget( myMaximumMemorySpin, 0, 1, 1, 1 ); - anAdvLayout->addWidget( aMegabyteLabel, 0, 2, 1, 1 ); - anAdvLayout->addWidget( myInitialMemoryCheck, 1, 0, 1, 1 ); - anAdvLayout->addWidget( myInitialMemorySpin, 1, 1, 1, 1 ); - anAdvLayout->addWidget( aMegabyteLabel2, 1, 2, 1, 1 ); - anAdvLayout->addWidget( aWorkinDirLabel, 2, 0, 1, 1 ); - anAdvLayout->addWidget( myWorkingDir, 2, 1, 1, 2 ); - anAdvLayout->addWidget( dirBtn, 2, 3, 1, 1 ); - anAdvLayout->addWidget( myKeepFiles, 3, 0, 1, 4 ); - anAdvLayout->addWidget( aVerboseLevelLabel, 4, 0, 1, 1 ); - anAdvLayout->addWidget( myVerboseLevelSpin, 4, 1, 1, 1 ); - anAdvLayout->addWidget( myToCreateNewNodesCheck, 5, 0, 1, 4 ); - anAdvLayout->addWidget( myBoundaryRecoveryCheck, 6, 0, 1, 4 ); - anAdvLayout->addWidget( aTextOptionLabel, 7, 0, 1, 1 ); - anAdvLayout->addWidget( myTextOption, 7, 1, 1, 2 ); + anAdvLayout->addWidget( myMaximumMemoryCheck, 0, 0, 1, 1 ); + anAdvLayout->addWidget( myMaximumMemorySpin, 0, 1, 1, 1 ); + anAdvLayout->addWidget( aMegabyteLabel, 0, 2, 1, 1 ); + anAdvLayout->addWidget( myInitialMemoryCheck, 1, 0, 1, 1 ); + anAdvLayout->addWidget( myInitialMemorySpin, 1, 1, 1, 1 ); + anAdvLayout->addWidget( aMegabyteLabel2, 1, 2, 1, 1 ); + anAdvLayout->addWidget( aWorkinDirLabel, 2, 0, 1, 1 ); + anAdvLayout->addWidget( myWorkingDir, 2, 1, 1, 2 ); + anAdvLayout->addWidget( dirBtn, 2, 3, 1, 1 ); + anAdvLayout->addWidget( myKeepFiles, 3, 0, 1, 4 ); + anAdvLayout->addWidget( aVerboseLevelLabel, 4, 0, 1, 1 ); + anAdvLayout->addWidget( myVerboseLevelSpin, 4, 1, 1, 1 ); + anAdvLayout->addWidget( myToCreateNewNodesCheck, 5, 0, 1, 4 ); + anAdvLayout->addWidget( myRemoveInitialCentralPointCheck, 6, 0, 1, 4 ); + anAdvLayout->addWidget( myBoundaryRecoveryCheck, 7, 0, 1, 4 ); + anAdvLayout->addWidget( myFEMCorrectionCheck, 8, 0, 1, 4 ); + anAdvLayout->addWidget( aTextOptionLabel, 9, 0, 1, 1 ); + anAdvLayout->addWidget( myTextOption, 9, 1, 1, 2 ); // Size Maps parameters mySmpGroup = new QWidget(); QGridLayout* anSmpLayout = new QGridLayout(mySmpGroup); - mySmpModel = new QStandardItemModel(0, SMP_NB_COLUMNS); - mySizeMapTableView = new QTableView(mySmpGroup); - mySizeMapTableView->setModel(mySmpModel); - mySizeMapTableView->setSortingEnabled(true); - mySizeMapTableView->setItemDelegateForColumn(SMP_SIZE_COLUMN,new DoubleLineEditDelegate(this)); - anSmpLayout->addWidget(mySizeMapTableView, 1, 0, 9, 1); - QStringList sizeMapHeaders; - sizeMapHeaders << tr( "GHS3D_SMP_X_COLUMN" )<< tr( "GHS3D_SMP_Y_COLUMN" ) << tr( "GHS3D_SMP_Z_COLUMN" ) << tr( "GHS3D_SMP_SIZEMAP_COLUMN" ); - mySmpModel->setHorizontalHeaderLabels(sizeMapHeaders); - mySizeMapTableView->setAlternatingRowColors(true); - mySizeMapTableView->verticalHeader()->hide(); - mySizeMapTableView->horizontalHeader()->setResizeMode(QHeaderView::Stretch); + mySmpModel = new QStandardItemModel(0, ENF_VER_NB_COLUMNS); + myEnforcedTableView = new QTableView(mySmpGroup); + myEnforcedTableView->setModel(mySmpModel); + myEnforcedTableView->setSortingEnabled(true); + myEnforcedTableView->setItemDelegateForColumn(ENF_VER_SIZE_COLUMN,new DoubleLineEditDelegate(this)); + anSmpLayout->addWidget(myEnforcedTableView, 1, 0, 9, 1); + QStringList enforcedHeaders; + enforcedHeaders << tr( "GHS3D_ENF_VER_X_COLUMN" )<< tr( "GHS3D_ENF_VER_Y_COLUMN" ) << tr( "GHS3D_ENF_VER_Z_COLUMN" ) << tr( "GHS3D_ENF_VER_SIZE_COLUMN" ); + mySmpModel->setHorizontalHeaderLabels(enforcedHeaders); + myEnforcedTableView->setAlternatingRowColors(true); + myEnforcedTableView->verticalHeader()->hide(); + myEnforcedTableView->horizontalHeader()->setResizeMode(QHeaderView::Stretch); - QLabel* myXCoordLabel = new QLabel( tr( "GHS3D_SMP_X_LABEL" ), mySmpGroup ); - anSmpLayout->addWidget(myXCoordLabel, SMP_X_COORD, 1, 1, 1); + QLabel* myXCoordLabel = new QLabel( tr( "GHS3D_ENF_VER_X_LABEL" ), mySmpGroup ); + anSmpLayout->addWidget(myXCoordLabel, ENF_VER_X_COORD, 1, 1, 1); myXCoord = new QLineEdit(mySmpGroup); myXCoord->setValidator(new QDoubleValidator(mySmpGroup)); - anSmpLayout->addWidget(myXCoord, SMP_X_COORD, 2, 1, 1); - QLabel* myYCoordLabel = new QLabel( tr( "GHS3D_SMP_Y_LABEL" ), mySmpGroup ); - anSmpLayout->addWidget(myYCoordLabel, SMP_Y_COORD, 1, 1, 1); + anSmpLayout->addWidget(myXCoord, ENF_VER_X_COORD, 2, 1, 1); + QLabel* myYCoordLabel = new QLabel( tr( "GHS3D_ENF_VER_Y_LABEL" ), mySmpGroup ); + anSmpLayout->addWidget(myYCoordLabel, ENF_VER_Y_COORD, 1, 1, 1); myYCoord = new QLineEdit(mySmpGroup); myYCoord->setValidator(new QDoubleValidator(mySmpGroup)); - anSmpLayout->addWidget(myYCoord, SMP_Y_COORD, 2, 1, 1); - QLabel* myZCoordLabel = new QLabel( tr( "GHS3D_SMP_Z_LABEL" ), mySmpGroup ); - anSmpLayout->addWidget(myZCoordLabel, SMP_Z_COORD, 1, 1, 1); + anSmpLayout->addWidget(myYCoord, ENF_VER_Y_COORD, 2, 1, 1); + QLabel* myZCoordLabel = new QLabel( tr( "GHS3D_ENF_VER_Z_LABEL" ), mySmpGroup ); + anSmpLayout->addWidget(myZCoordLabel, ENF_VER_Z_COORD, 1, 1, 1); myZCoord = new QLineEdit(mySmpGroup); myZCoord->setValidator(new QDoubleValidator(mySmpGroup)); - anSmpLayout->addWidget(myZCoord, SMP_Z_COORD, 2, 1, 1); + anSmpLayout->addWidget(myZCoord, ENF_VER_Z_COORD, 2, 1, 1); + QLabel* mySizeLabel = new QLabel( tr( "GHS3D_ENF_VER_SIZE_LABEL" ), mySmpGroup ); + anSmpLayout->addWidget(mySizeLabel, ENF_VER_SIZE, 1, 1, 1); + mySizeValue = new QLineEdit(mySmpGroup); + mySizeValue->setValidator(new QDoubleValidator(mySmpGroup)); + anSmpLayout->addWidget(mySizeValue, ENF_VER_SIZE, 2, 1, 1); - addVertexButton = new QPushButton(tr("GHS3D_SMP_VERTEX"),mySmpGroup); - anSmpLayout->addWidget(addVertexButton, SMP_VERTEX_BTN, 1, 1, 2); + addVertexButton = new QPushButton(tr("GHS3D_ENF_VER_VERTEX"),mySmpGroup); + anSmpLayout->addWidget(addVertexButton, ENF_VER_VERTEX_BTN, 1, 1, 2); + addVertexButton->setEnabled(false); QFrame *line = new QFrame(mySmpGroup); line->setFrameShape(QFrame::HLine); line->setFrameShadow(QFrame::Sunken); - anSmpLayout->addWidget(line, SMP_SEPARATOR, 1, 1, 2); + anSmpLayout->addWidget(line, ENF_VER_SEPARATOR, 1, 1, 2); - removeVertexButton = new QPushButton(tr("GHS3D_SMP_REMOVE"),mySmpGroup); - anSmpLayout->addWidget(removeVertexButton, SMP_REMOVE_BTN, 1, 1, 2); + removeVertexButton = new QPushButton(tr("GHS3D_ENF_VER_REMOVE"),mySmpGroup); + anSmpLayout->addWidget(removeVertexButton, ENF_VER_REMOVE_BTN, 1, 1, 2); // add tabs tab->insertTab( STD_TAB, myStdGroup, tr( "SMESH_ARGUMENTS" ) ); tab->insertTab( ADV_TAB, myAdvGroup, tr( "GHS3D_ADV_ARGS" ) ); - tab->insertTab( SMP_TAB, mySmpGroup, tr( "GHS3D_SIZE_MAP" ) ); + tab->insertTab( ENF_VER_TAB, mySmpGroup, tr( "GHS3D_ENFORCED_VERTECES" ) ); tab->setCurrentIndex( STD_TAB ); // connections @@ -326,9 +347,16 @@ QFrame* GHS3DPluginGUI_HypothesisCreator::buildFrame() connect( myInitialMemoryCheck, SIGNAL( toggled( bool ) ), this, SLOT( updateWidgets() ) ); connect( myBoundaryRecoveryCheck, SIGNAL( toggled( bool ) ), this, SLOT( updateWidgets() ) ); connect( dirBtn, SIGNAL( clicked() ), this, SLOT( onDirBtnClicked() ) ); + connect( myXCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( checkVertexIsDefined() ) ); + connect( myYCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( checkVertexIsDefined() ) ); + connect( myZCoord, SIGNAL( textChanged(const QString&) ), this, SLOT( checkVertexIsDefined() ) ); + connect( mySizeValue, SIGNAL( textChanged(const QString&) ), this, SLOT( checkVertexIsDefined() ) ); + connect( this, SIGNAL( vertexDefined(bool) ), addVertexButton, SLOT( setEnabled(bool) ) ); connect( addVertexButton, SIGNAL( clicked() ), this, SLOT( onVertexBtnClicked() ) ); connect( removeVertexButton, SIGNAL( clicked() ), this, SLOT( onRemoveVertexBtnClicked() ) ); + + return fr; } @@ -336,24 +364,37 @@ bool GHS3DPluginGUI_HypothesisCreator::smpVertexExists(double x, double y, doubl { const int rowCount = mySmpModel->rowCount(); for (int i=0 ; i < rowCount ; i++) { - double myX = mySmpModel->data(mySmpModel->index(i, SMP_X_COLUMN)).toDouble(); + double myX = mySmpModel->data(mySmpModel->index(i, ENF_VER_X_COLUMN)).toDouble(); if (myX == x) { - MESSAGE("Found x value " << x << " at row " << i); - double myY = mySmpModel->data(mySmpModel->index(i, SMP_Y_COLUMN)).toDouble(); +// MESSAGE("Found x value " << x << " at row " << i); + double myY = mySmpModel->data(mySmpModel->index(i, ENF_VER_Y_COLUMN)).toDouble(); if (myY == y) { - MESSAGE("Found y value " << y << " at row " << i); - double myZ = mySmpModel->data(mySmpModel->index(i, SMP_Z_COLUMN)).toDouble(); +// MESSAGE("Found y value " << y << " at row " << i); + double myZ = mySmpModel->data(mySmpModel->index(i, ENF_VER_Z_COLUMN)).toDouble(); if (myZ == z) { + MESSAGE("Found x value " << x << " at row " << i); + MESSAGE("Found y value " << y << " at row " << i); MESSAGE("Found z value " << z << " at row " << i); return true; } } } } - MESSAGE("Not found x,y,z values: " << x << " " << y << " " << z); +// MESSAGE("Not found x,y,z values: " << x << " " << y << " " << z); return false; } +bool GHS3DPluginGUI_HypothesisCreator::checkVertexIsDefined() +{ + bool val = (!myXCoord->text().isEmpty())&&(!myYCoord->text().isEmpty())&&(!myZCoord->text().isEmpty())&&(!mySizeValue->text().isEmpty()); + bool isDefined = val; + if (val) + isDefined = not smpVertexExists(myXCoord->text().toDouble(),myYCoord->text().toDouble(),myZCoord->text().toDouble()); + + emit vertexDefined(isDefined); + return isDefined; +} + void GHS3DPluginGUI_HypothesisCreator::onVertexBtnClicked() { MESSAGE("GHS3DPluginGUI_HypothesisCreator::onVertexBtnClicked()"); @@ -361,34 +402,36 @@ void GHS3DPluginGUI_HypothesisCreator::onVertexBtnClicked() double x = myXCoord->text().toDouble(); double y = myYCoord->text().toDouble(); double z = myZCoord->text().toDouble(); + double size = mySizeValue->text().toDouble(); if (smpVertexExists(x,y,z)) return; - double size = 10.0; - // SMP_X_COLUMN - mySmpModel->setData(mySmpModel->index(row, SMP_X_COLUMN),x); - mySmpModel->setItem( row, SMP_X_COLUMN, new QStandardItem(QString::number(x)) ); - mySmpModel->item( row, SMP_X_COLUMN )->setFlags( Qt::ItemIsSelectable ); - // SMP_Y_COLUMN - mySmpModel->setData(mySmpModel->index(row, SMP_Y_COLUMN),y); - mySmpModel->setItem( row, SMP_Y_COLUMN, new QStandardItem(QString::number(y)) ); - mySmpModel->item( row, SMP_Y_COLUMN )->setFlags( Qt::ItemIsSelectable ); - // SMP_Z_COLUMN - mySmpModel->setData(mySmpModel->index(row, SMP_Z_COLUMN),z); - mySmpModel->setItem( row, SMP_Z_COLUMN, new QStandardItem(QString::number(z)) ); - mySmpModel->item( row, SMP_Z_COLUMN )->setFlags( Qt::ItemIsSelectable ); - // SMP_SIZE_COLUMN - mySmpModel->setData(mySmpModel->index(row, SMP_SIZE_COLUMN),size); - mySmpModel->setItem( row, SMP_SIZE_COLUMN, new QStandardItem(QString::number(size,'f')) ); - - mySizeMapTableView->clearSelection(); - mySizeMapTableView->scrollTo( mySmpModel->item( row, SMP_SIZE_COLUMN )->index() ); +// double size = 10.0; + // ENF_VER_X_COLUMN + mySmpModel->setData(mySmpModel->index(row, ENF_VER_X_COLUMN),x); + mySmpModel->setItem( row, ENF_VER_X_COLUMN, new QStandardItem(QString::number(x)) ); + mySmpModel->item( row, ENF_VER_X_COLUMN )->setFlags( Qt::ItemIsSelectable ); + // ENF_VER_Y_COLUMN + mySmpModel->setData(mySmpModel->index(row, ENF_VER_Y_COLUMN),y); + mySmpModel->setItem( row, ENF_VER_Y_COLUMN, new QStandardItem(QString::number(y)) ); + mySmpModel->item( row, ENF_VER_Y_COLUMN )->setFlags( Qt::ItemIsSelectable ); + // ENF_VER_Z_COLUMN + mySmpModel->setData(mySmpModel->index(row, ENF_VER_Z_COLUMN),z); + mySmpModel->setItem( row, ENF_VER_Z_COLUMN, new QStandardItem(QString::number(z)) ); + mySmpModel->item( row, ENF_VER_Z_COLUMN )->setFlags( Qt::ItemIsSelectable ); + // ENF_VER_SIZE_COLUMN + mySmpModel->setData(mySmpModel->index(row, ENF_VER_SIZE_COLUMN),size); + mySmpModel->setItem( row, ENF_VER_SIZE_COLUMN, new QStandardItem(QString::number(size,'f')) ); + + myEnforcedTableView->clearSelection(); + myEnforcedTableView->scrollTo( mySmpModel->item( row, ENF_VER_SIZE_COLUMN )->index() ); + checkVertexIsDefined(); } void GHS3DPluginGUI_HypothesisCreator::onRemoveVertexBtnClicked() { QList selectedRows; - QList selectedIndex = mySizeMapTableView->selectionModel()->selectedIndexes(); + QList selectedIndex = myEnforcedTableView->selectionModel()->selectedIndexes(); int row; QModelIndex index; foreach( index, selectedIndex ) { @@ -404,7 +447,7 @@ void GHS3DPluginGUI_HypothesisCreator::onRemoveVertexBtnClicked() MESSAGE("delete row #"<< row); mySmpModel->removeRow(row ); } - mySizeMapTableView->clearSelection(); + myEnforcedTableView->clearSelection(); } void GHS3DPluginGUI_HypothesisCreator::onDirBtnClicked() { @@ -444,44 +487,46 @@ void GHS3DPluginGUI_HypothesisCreator::retrieveParams() const if ( myName ) myName->setText( data.myName ); - myToMeshHolesCheck ->setChecked ( data.myToMeshHoles ); - myOptimizationLevelCombo->setCurrentIndex( data.myOptimizationLevel ); - myMaximumMemoryCheck ->setChecked ( data.myMaximumMemory > 0 ); - myMaximumMemorySpin ->setValue ( qMax( data.myMaximumMemory, - myMaximumMemorySpin->minimum() )); - myInitialMemoryCheck ->setChecked ( data.myInitialMemory > 0 ); - myInitialMemorySpin ->setValue ( qMax( data.myInitialMemory, - myInitialMemorySpin->minimum() )); - myWorkingDir ->setText ( data.myWorkingDir ); - myKeepFiles ->setChecked ( data.myKeepFiles ); - myVerboseLevelSpin ->setValue ( data.myVerboseLevel ); - myToCreateNewNodesCheck ->setChecked ( data.myToCreateNewNodes ); - myBoundaryRecoveryCheck ->setChecked ( data.myBoundaryRecovery ); - myTextOption ->setText ( data.myTextOption ); - - TSizeMapVertexValues::const_iterator it; + myToMeshHolesCheck ->setChecked ( data.myToMeshHoles ); + myOptimizationLevelCombo ->setCurrentIndex( data.myOptimizationLevel ); + myMaximumMemoryCheck ->setChecked ( data.myMaximumMemory > 0 ); + myMaximumMemorySpin ->setValue ( qMax( data.myMaximumMemory, + myMaximumMemorySpin->minimum() )); + myInitialMemoryCheck ->setChecked ( data.myInitialMemory > 0 ); + myInitialMemorySpin ->setValue ( qMax( data.myInitialMemory, + myInitialMemorySpin->minimum() )); + myWorkingDir ->setText ( data.myWorkingDir ); + myKeepFiles ->setChecked ( data.myKeepFiles ); + myVerboseLevelSpin ->setValue ( data.myVerboseLevel ); + myToCreateNewNodesCheck ->setChecked ( data.myToCreateNewNodes ); + myRemoveInitialCentralPointCheck ->setChecked ( data.myRemoveInitialCentralPoint ); + myBoundaryRecoveryCheck ->setChecked ( data.myBoundaryRecovery ); + myFEMCorrectionCheck ->setChecked ( data.myFEMCorrection ); + myTextOption ->setText ( data.myTextOption ); + + TEnforcedVertexValues::const_iterator it; int row = 0; - for(it = data.mySizeMapVerteces.begin() ; it != data.mySizeMapVerteces.end(); it++ ) + for(it = data.myEnforcedVerteces.begin() ; it != data.myEnforcedVerteces.end(); it++ ) { double x = it->at(0); double y = it->at(1); double z = it->at(2); double size = it->at(3); - // SMP_X_COLUMN - mySmpModel->setData(mySmpModel->index(row, SMP_X_COLUMN),x); - mySmpModel->setItem( row, SMP_X_COLUMN, new QStandardItem(QString::number(x)) ); - mySmpModel->item( row, SMP_X_COLUMN )->setFlags( Qt::ItemIsSelectable ); - // SMP_Y_COLUMN - mySmpModel->setData(mySmpModel->index(row, SMP_Y_COLUMN),y); - mySmpModel->setItem( row, SMP_Y_COLUMN, new QStandardItem(QString::number(y)) ); - mySmpModel->item( row, SMP_Y_COLUMN )->setFlags( Qt::ItemIsSelectable ); - // SMP_Z_COLUMN - mySmpModel->setData(mySmpModel->index(row, SMP_Z_COLUMN),z); - mySmpModel->setItem( row, SMP_Z_COLUMN, new QStandardItem(QString::number(z)) ); - mySmpModel->item( row, SMP_Z_COLUMN )->setFlags( Qt::ItemIsSelectable ); - // SMP_SIZE_COLUMN - mySmpModel->setData(mySmpModel->index(row, SMP_SIZE_COLUMN),size); - mySmpModel->setItem( row, SMP_SIZE_COLUMN, new QStandardItem(QString::number(size)) ); + // ENF_VER_X_COLUMN + mySmpModel->setData(mySmpModel->index(row, ENF_VER_X_COLUMN),x); + mySmpModel->setItem( row, ENF_VER_X_COLUMN, new QStandardItem(QString::number(x)) ); + mySmpModel->item( row, ENF_VER_X_COLUMN )->setFlags( Qt::ItemIsSelectable ); + // ENF_VER_Y_COLUMN + mySmpModel->setData(mySmpModel->index(row, ENF_VER_Y_COLUMN),y); + mySmpModel->setItem( row, ENF_VER_Y_COLUMN, new QStandardItem(QString::number(y)) ); + mySmpModel->item( row, ENF_VER_Y_COLUMN )->setFlags( Qt::ItemIsSelectable ); + // ENF_VER_Z_COLUMN + mySmpModel->setData(mySmpModel->index(row, ENF_VER_Z_COLUMN),z); + mySmpModel->setItem( row, ENF_VER_Z_COLUMN, new QStandardItem(QString::number(z)) ); + mySmpModel->item( row, ENF_VER_Z_COLUMN )->setFlags( Qt::ItemIsSelectable ); + // ENF_VER_SIZE_COLUMN + mySmpModel->setData(mySmpModel->index(row, ENF_VER_SIZE_COLUMN),size); + mySmpModel->setItem( row, ENF_VER_SIZE_COLUMN, new QStandardItem(QString::number(size)) ); MESSAGE("Row " << row << ": (" << x << ","<< y << ","<< z << ") ="<< size); row++; @@ -503,8 +548,8 @@ QString GHS3DPluginGUI_HypothesisCreator::storeParams() const if ( !data.myBoundaryRecovery ) valStr = "-c " + QString::number( !data.myToMeshHoles ); - if ( data.myOptimizationLevel >= 0 && data.myOptimizationLevel < 4 && !data.myBoundaryRecovery) { - char* level[] = { "none" , "light" , "standard" , "strong" }; + if ( data.myOptimizationLevel >= 0 && data.myOptimizationLevel < 5 && !data.myBoundaryRecovery) { + char* level[] = { "none" , "light" , "standard" , "standard+" , "strong" }; valStr += " -o "; valStr += level[ data.myOptimizationLevel ]; } @@ -522,9 +567,15 @@ QString GHS3DPluginGUI_HypothesisCreator::storeParams() const if ( !data.myToCreateNewNodes ) valStr += " -p0"; + if ( data.myRemoveInitialCentralPoint ) + valStr += " -no_initial_central_point"; + if ( data.myBoundaryRecovery ) valStr += " -C"; + if ( data.myFEMCorrection ) + valStr += " -FEM"; + valStr += " "; valStr += data.myTextOption; @@ -532,10 +583,10 @@ QString GHS3DPluginGUI_HypothesisCreator::storeParams() const // Add size map parameters storage for (int i=0 ; irowCount() ; i++) { valStr += " ("; - double x = mySmpModel->data(mySmpModel->index(i,SMP_X_COLUMN)).toDouble(); - double y = mySmpModel->data(mySmpModel->index(i,SMP_Y_COLUMN)).toDouble(); - double z = mySmpModel->data(mySmpModel->index(i,SMP_Z_COLUMN)).toDouble(); - double size = mySmpModel->data(mySmpModel->index(i,SMP_SIZE_COLUMN)).toDouble(); + double x = mySmpModel->data(mySmpModel->index(i,ENF_VER_X_COLUMN)).toDouble(); + double y = mySmpModel->data(mySmpModel->index(i,ENF_VER_Y_COLUMN)).toDouble(); + double z = mySmpModel->data(mySmpModel->index(i,ENF_VER_Z_COLUMN)).toDouble(); + double size = mySmpModel->data(mySmpModel->index(i,ENF_VER_SIZE_COLUMN)).toDouble(); valStr += QString::number( x ); valStr += ","; valStr += QString::number( y ); @@ -560,29 +611,31 @@ bool GHS3DPluginGUI_HypothesisCreator::readParamsFromHypo( GHS3DHypothesisData& HypothesisData* data = SMESH::GetHypothesisData( hypType() ); h_data.myName = isCreation() && data ? hypName() : ""; - h_data.myToMeshHoles = h->GetToMeshHoles(); - h_data.myMaximumMemory = h->GetMaximumMemory(); - h_data.myInitialMemory = h->GetInitialMemory(); - h_data.myInitialMemory = h->GetInitialMemory(); - 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(); + h_data.myToMeshHoles = h->GetToMeshHoles(); + h_data.myMaximumMemory = h->GetMaximumMemory(); + h_data.myInitialMemory = h->GetInitialMemory(); + h_data.myInitialMemory = h->GetInitialMemory(); + 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.myRemoveInitialCentralPoint = h->GetToRemoveCentralPoint(); + h_data.myBoundaryRecovery = h->GetToUseBoundaryRecoveryVersion(); + h_data.myFEMCorrection = h->GetFEMCorrection(); + h_data.myTextOption = h->GetTextOption(); - GHS3DPlugin::GHS3DSizeMapVertexList_var verteces = h->GetSizeMapVerteces(); + GHS3DPlugin::GHS3DEnforcedVertexList_var verteces = h->GetEnforcedVerteces(); MESSAGE("verteces->length(): " << verteces->length()); - h_data.mySizeMapVerteces.clear(); + h_data.myEnforcedVerteces.clear(); for (int i=0 ; ilength() ; i++) { - GHS3DSizeMapVertex myVertex; + GHS3DEnforcedVertex myVertex; myVertex.push_back(verteces[i].x); myVertex.push_back(verteces[i].y); myVertex.push_back(verteces[i].z); myVertex.push_back(verteces[i].size); MESSAGE("Add enforced vertex ("<< myVertex[0] << ","<< myVertex[1] << ","<< myVertex[2] << ") ="<< myVertex[3]); - h_data.mySizeMapVerteces.push_back(myVertex); + h_data.myEnforcedVerteces.push_back(myVertex); } return true; } @@ -617,23 +670,27 @@ bool GHS3DPluginGUI_HypothesisCreator::storeParamsToHypo( const GHS3DHypothesisD h->SetVerboseLevel ( h_data.myVerboseLevel ); if ( h->GetToCreateNewNodes() != h_data.myToCreateNewNodes ) h->SetToCreateNewNodes( h_data.myToCreateNewNodes ); + if ( h->GetToRemoveCentralPoint() != h_data.myRemoveInitialCentralPoint ) + h->SetToRemoveCentralPoint( h_data.myRemoveInitialCentralPoint ); if ( h->GetToUseBoundaryRecoveryVersion() != h_data.myBoundaryRecovery ) h->SetToUseBoundaryRecoveryVersion( h_data.myBoundaryRecovery ); + if ( h->GetFEMCorrection() != h_data.myFEMCorrection ) + h->SetFEMCorrection( h_data.myFEMCorrection ); if ( h->GetTextOption() != h_data.myTextOption ) h->SetTextOption ( h_data.myTextOption.toLatin1().constData() ); - int nbVertex = (int) h_data.mySizeMapVerteces.size(); - GHS3DPlugin::GHS3DSizeMapVertexList_var vertexHyp = h->GetSizeMapVerteces(); + int nbVertex = (int) h_data.myEnforcedVerteces.size(); + GHS3DPlugin::GHS3DEnforcedVertexList_var vertexHyp = h->GetEnforcedVerteces(); int nbVertexHyp = vertexHyp->length(); MESSAGE("Store params for size maps: " << nbVertex << " enforced verteces"); - MESSAGE("h->GetSizeMapVerteces()->length(): " << nbVertexHyp); + MESSAGE("h->GetEnforcedVerteces()->length(): " << nbVertexHyp); // Some verteces were removed if (nbVertex < nbVertexHyp) { - if (nbVertex == 0) - h->ClearSizeMapVerteces(); - else { +// if (nbVertex == 0) +// h->ClearEnforcedVerteces(); +// else { // iterate over verteces of hypo for(int i = 0 ; i RemoveSizeMapVertex(x,y,z); + h->RemoveEnforcedVertex(x,y,z); } - } +// } } - TSizeMapVertexValues::const_iterator it; - for(it = h_data.mySizeMapVerteces.begin() ; it != h_data.mySizeMapVerteces.end(); it++ ) { + TEnforcedVertexValues::const_iterator it; + for(it = h_data.myEnforcedVerteces.begin() ; it != h_data.myEnforcedVerteces.end(); it++ ) { double x = it->at(0); double y = it->at(1); double z = it->at(2); @@ -658,16 +715,16 @@ bool GHS3DPluginGUI_HypothesisCreator::storeParamsToHypo( const GHS3DHypothesisD << size ); double mySize; try { - mySize = h->GetSizeMapVertex(x,y,z); + mySize = h->GetEnforcedVertex(x,y,z); MESSAGE("Old size: " << mySize); if (mySize != size) { MESSAGE("Setting new size: " << size); - h->SetSizeMapVertex(x,y,z,size); + h->SetEnforcedVertex(x,y,z,size); } } catch (...) { MESSAGE("Setting new size: " << size); - h->SetSizeMapVertex(x,y,z,size); + h->SetEnforcedVertex(x,y,z,size); } } } @@ -682,30 +739,32 @@ bool GHS3DPluginGUI_HypothesisCreator::storeParamsToHypo( const GHS3DHypothesisD bool GHS3DPluginGUI_HypothesisCreator::readParamsFromWidgets( GHS3DHypothesisData& h_data ) const { MESSAGE("GHS3DPluginGUI_HypothesisCreator::readParamsFromWidgets"); - h_data.myName = myName ? myName->text() : ""; - h_data.myToMeshHoles = myToMeshHolesCheck->isChecked(); - h_data.myMaximumMemory = myMaximumMemoryCheck->isChecked() ? myMaximumMemorySpin->value() : -1; - h_data.myInitialMemory = myInitialMemoryCheck->isChecked() ? myInitialMemorySpin->value() : -1; - h_data.myOptimizationLevel = myOptimizationLevelCombo->currentIndex(); - h_data.myKeepFiles = myKeepFiles->isChecked(); - h_data.myWorkingDir = myWorkingDir->text().trimmed(); - h_data.myVerboseLevel = myVerboseLevelSpin->value(); - h_data.myToCreateNewNodes = myToCreateNewNodesCheck->isChecked(); - h_data.myBoundaryRecovery = myBoundaryRecoveryCheck->isChecked(); - h_data.myTextOption = myTextOption->text(); - h_data.mySizeMapVerteces.clear(); + h_data.myName = myName ? myName->text() : ""; + h_data.myToMeshHoles = myToMeshHolesCheck->isChecked(); + h_data.myMaximumMemory = myMaximumMemoryCheck->isChecked() ? myMaximumMemorySpin->value() : -1; + h_data.myInitialMemory = myInitialMemoryCheck->isChecked() ? myInitialMemorySpin->value() : -1; + h_data.myOptimizationLevel = myOptimizationLevelCombo->currentIndex(); + h_data.myKeepFiles = myKeepFiles->isChecked(); + h_data.myWorkingDir = myWorkingDir->text().trimmed(); + h_data.myVerboseLevel = myVerboseLevelSpin->value(); + h_data.myToCreateNewNodes = myToCreateNewNodesCheck->isChecked(); + h_data.myRemoveInitialCentralPoint = myRemoveInitialCentralPointCheck->isChecked(); + h_data.myBoundaryRecovery = myBoundaryRecoveryCheck->isChecked(); + h_data.myFEMCorrection = myFEMCorrectionCheck->isChecked(); + h_data.myTextOption = myTextOption->text(); + h_data.myEnforcedVerteces.clear(); for (int i=0 ; irowCount() ; i++) { - GHS3DSizeMapVertex myVertex; - myVertex.push_back(mySmpModel->data(mySmpModel->index(i,SMP_X_COLUMN)).toDouble()); - myVertex.push_back(mySmpModel->data(mySmpModel->index(i,SMP_Y_COLUMN)).toDouble()); - myVertex.push_back(mySmpModel->data(mySmpModel->index(i,SMP_Z_COLUMN)).toDouble()); - myVertex.push_back(mySmpModel->data(mySmpModel->index(i,SMP_SIZE_COLUMN)).toDouble()); + GHS3DEnforcedVertex myVertex; + myVertex.push_back(mySmpModel->data(mySmpModel->index(i,ENF_VER_X_COLUMN)).toDouble()); + myVertex.push_back(mySmpModel->data(mySmpModel->index(i,ENF_VER_Y_COLUMN)).toDouble()); + myVertex.push_back(mySmpModel->data(mySmpModel->index(i,ENF_VER_Z_COLUMN)).toDouble()); + myVertex.push_back(mySmpModel->data(mySmpModel->index(i,ENF_VER_SIZE_COLUMN)).toDouble()); MESSAGE("Add new enforced vertex (" << myVertex[0] << ", " << myVertex[1] << ", " << myVertex[2] << ") = " << myVertex[3]); - h_data.mySizeMapVerteces.push_back(myVertex); + h_data.myEnforcedVerteces.push_back(myVertex); } return true; diff --git a/src/GUI/GHS3DPluginGUI_HypothesisCreator.h b/src/GUI/GHS3DPluginGUI_HypothesisCreator.h index e959cd7..551a7e8 100644 --- a/src/GUI/GHS3DPluginGUI_HypothesisCreator.h +++ b/src/GUI/GHS3DPluginGUI_HypothesisCreator.h @@ -41,23 +41,20 @@ class QSpinBox; class QStandardItemModel; class QTableView; class QHeaderView; -class QTableWidget; class QDoubleSpinBox; -class QItemDelegate; -class QStandardItem; -class QDoubleValidator; +class LightApp_SelectionMgr; -typedef std::vector GHS3DSizeMapVertex; -typedef std::vector TSizeMapVertexValues; +typedef std::vector GHS3DEnforcedVertex; +typedef std::vector TEnforcedVertexValues; typedef struct { - bool myToMeshHoles,myKeepFiles,myToCreateNewNodes,myBoundaryRecovery; + bool myToMeshHoles,myKeepFiles,myToCreateNewNodes,myBoundaryRecovery,myFEMCorrection,myRemoveInitialCentralPoint; int myMaximumMemory,myInitialMemory,myOptimizationLevel; QString myName,myWorkingDir,myTextOption; short myVerboseLevel; - TSizeMapVertexValues mySizeMapVerteces; + TEnforcedVertexValues myEnforcedVerteces; } GHS3DHypothesisData; /*! @@ -84,43 +81,53 @@ protected: virtual QString type() const; protected slots: - void onDirBtnClicked(); - void updateWidgets(); - void onVertexBtnClicked(); - void onRemoveVertexBtnClicked(); + void onDirBtnClicked(); + void updateWidgets(); + void onVertexBtnClicked(); + void onRemoveVertexBtnClicked(); + bool checkVertexIsDefined(); + +signals: + void vertexDefined(bool); private: - bool readParamsFromHypo( GHS3DHypothesisData& ) const; - bool readParamsFromWidgets( GHS3DHypothesisData& ) const; - bool storeParamsToHypo( const GHS3DHypothesisData& ) const; - bool smpVertexExists(double, double, double) const; + bool readParamsFromHypo( GHS3DHypothesisData& ) const; + bool readParamsFromWidgets( GHS3DHypothesisData& ) const; + bool storeParamsToHypo( const GHS3DHypothesisData& ) const; + bool smpVertexExists(double, double, double) const; private: - QWidget* myStdGroup; - QLineEdit* myName; - QCheckBox* myToMeshHolesCheck; - QComboBox* myOptimizationLevelCombo; - - QWidget* myAdvGroup; - QCheckBox* myMaximumMemoryCheck; - QSpinBox* myMaximumMemorySpin; - QCheckBox* myInitialMemoryCheck; - QSpinBox* myInitialMemorySpin; - QLineEdit* myWorkingDir; - QCheckBox* myKeepFiles; - QSpinBox* myVerboseLevelSpin; - QCheckBox* myToCreateNewNodesCheck; - QCheckBox* myBoundaryRecoveryCheck; - QLineEdit* myTextOption; + QWidget* myStdGroup; + QLineEdit* myName; + QCheckBox* myToMeshHolesCheck; + QComboBox* myOptimizationLevelCombo; + + QWidget* myAdvGroup; + QCheckBox* myMaximumMemoryCheck; + QSpinBox* myMaximumMemorySpin; + QCheckBox* myInitialMemoryCheck; + QSpinBox* myInitialMemorySpin; + QLineEdit* myWorkingDir; + QCheckBox* myKeepFiles; + QSpinBox* myVerboseLevelSpin; + QCheckBox* myToCreateNewNodesCheck; + QCheckBox* myRemoveInitialCentralPointCheck; + QCheckBox* myBoundaryRecoveryCheck; + QCheckBox* myFEMCorrectionCheck; +QLineEdit* myTextOption; QWidget* mySmpGroup; QStandardItemModel* mySmpModel; - QTableView* mySizeMapTableView; + QTableView* myEnforcedTableView; QLineEdit* myXCoord; QLineEdit* myYCoord; QLineEdit* myZCoord; + QLineEdit* mySizeValue; QPushButton* addVertexButton; QPushButton* removeVertexButton; + + LightApp_SelectionMgr* mySelectionMgr; /* User shape selection */ +// SVTK_Selector* mySelector; }; class DoubleLineEditDelegate : public QItemDelegate diff --git a/src/GUI/GHS3DPlugin_msg_en.ts b/src/GUI/GHS3DPlugin_msg_en.ts index 1ba1fcb..431abdb 100644 --- a/src/GUI/GHS3DPlugin_msg_en.ts +++ b/src/GUI/GHS3DPlugin_msg_en.ts @@ -58,6 +58,10 @@ KEEP_WORKING_FILES To keep working files + + LEVEL_NONE + None + LEVEL_LIGHT Light @@ -67,8 +71,8 @@ Medium (standard) - LEVEL_NONE - None + LEVEL_STANDARDPLUS + Standard+ LEVEL_STRONG @@ -82,10 +86,18 @@ MEGABYTE Megabytes + + NO_INITIAL_CENTRAL_POINT + To remove initial central point + RECOVERY_VERSION To use boundary recovery version + + FEM_CORRECTION + To use FEM correction + SELECT_DIR ... @@ -107,43 +119,47 @@ Working directory - GHS3D_SIZE_MAP - Size Map + GHS3D_ENFORCED_VERTECES + Enforced verteces - GHS3D_SMP_X_COLUMN + GHS3D_ENF_VER_X_COLUMN X - GHS3D_SMP_Y_COLUMN + GHS3D_ENF_VER_Y_COLUMN Y - GHS3D_SMP_Z_COLUMN + GHS3D_ENF_VER_Z_COLUMN Z - GHS3D_SMP_SIZEMAP_COLUMN + GHS3D_ENF_VER_SIZE_COLUMN Size - GHS3D_SMP_X_LABEL + GHS3D_ENF_VER_X_LABEL X: - GHS3D_SMP_Y_LABEL + GHS3D_ENF_VER_Y_LABEL Y: - GHS3D_SMP_Z_LABEL + GHS3D_ENF_VER_Z_LABEL Z: - GHS3D_SMP_VERTEX + GHS3D_ENF_VER_SIZE_LABEL + Size: + + + GHS3D_ENF_VER_VERTEX Add enforced vertex - GHS3D_SMP_REMOVE + GHS3D_ENF_VER_REMOVE Remove vertex -- 2.39.2