]> SALOME platform Git repositories - plugins/hybridplugin.git/commitdiff
Salome HOME
Fix several bugs in the "Enforced meshes" feature:
authorgdd <gdd>
Mon, 3 Sep 2012 08:53:51 +0000 (08:53 +0000)
committergdd <gdd>
Mon, 3 Sep 2012 08:53:51 +0000 (08:53 +0000)
- Enforced meshes are now correctly saved to study
- The size parameter was removed (unused)
- When more than 1 enforced mesh is added, all are correctly treated

15 files changed:
doc/salome/gui/GHS3DPLUGIN/Makefile.am
doc/salome/gui/GHS3DPLUGIN/images/ghs3d_enforced_meshes.png
doc/salome/gui/GHS3DPLUGIN/images/ghs3d_enforced_vertices.png
doc/salome/gui/GHS3DPLUGIN/images/ghs3d_parameters_advanced.png
doc/salome/gui/GHS3DPLUGIN/images/ghs3d_parameters_basic.png
doc/salome/gui/GHS3DPLUGIN/input/ghs3d_hypo.doc
idl/GHS3DPlugin_Algorithm.idl
src/GHS3DPlugin/GHS3DPlugin_GHS3D.cxx
src/GHS3DPlugin/GHS3DPlugin_Hypothesis.cxx
src/GHS3DPlugin/GHS3DPlugin_Hypothesis.hxx
src/GHS3DPlugin/GHS3DPlugin_Hypothesis_i.cxx
src/GHS3DPlugin/GHS3DPlugin_Hypothesis_i.hxx
src/GUI/GHS3DPluginGUI_Enums.h
src/GUI/GHS3DPluginGUI_HypothesisCreator.cxx
src/GUI/GHS3DPluginGUI_HypothesisCreator.h

index 3ebe7077ab96e4796a884668ea20eed1fe9c7302..8d25b01072a6bdb2692d7f6325f8803d32ac11f8 100755 (executable)
@@ -54,7 +54,7 @@ install-data-local: usr_docs
            *) echo "Installing $${filen}" ; cp -rp $${filen} $(DESTDIR)$(docdir)/gui/GHS3DPLUGIN ;;    \
          esac ;                                                                                \
        done ;
-       cp -rp $(srcdir)/images/head.png $(DESTDIR)$(docdir)/gui/GHS3DPLUGIN/ghs3dpluginpy_doc/ ;
+       cp -rfp $(srcdir)/images/head.png $(DESTDIR)$(docdir)/gui/GHS3DPLUGIN/ghs3dpluginpy_doc/ ;
 
 uninstall-local:
        rm -rf $(DESTDIR)$(docdir)/gui/GHS3DPLUGIN
index 9ddc0127df92bf99b76244a00271ff76cabfa8c2..df87f7751497e8b4cc4dfbf2376f9e758e874219 100644 (file)
Binary files a/doc/salome/gui/GHS3DPLUGIN/images/ghs3d_enforced_meshes.png and b/doc/salome/gui/GHS3DPLUGIN/images/ghs3d_enforced_meshes.png differ
index d3a4bbcfa49c2ddd8d28f288c594bb7a5d207735..27768e4259a2f76d6017ab6ef7b984438f7d3a23 100644 (file)
Binary files a/doc/salome/gui/GHS3DPLUGIN/images/ghs3d_enforced_vertices.png and b/doc/salome/gui/GHS3DPLUGIN/images/ghs3d_enforced_vertices.png differ
index c254112a2f433d9fc1ffa749e6ff1d671db579c7..74b2be1038da5c6d32952d98819d7a2e547885d1 100644 (file)
Binary files a/doc/salome/gui/GHS3DPLUGIN/images/ghs3d_parameters_advanced.png and b/doc/salome/gui/GHS3DPLUGIN/images/ghs3d_parameters_advanced.png differ
index 9519c1461d3734447fd669b37a63f7fea55d83cf..e272cefdd0ba5f5bc8e99c25749cf4423fca8751 100644 (file)
Binary files a/doc/salome/gui/GHS3DPLUGIN/images/ghs3d_parameters_basic.png and b/doc/salome/gui/GHS3DPLUGIN/images/ghs3d_parameters_basic.png differ
index 8b544ed28989099fd63352c5103e1af1a13f7dd9..0e18ad3dfda4a4c76d63a362a004df5490fe454e 100644 (file)
@@ -156,8 +156,6 @@ entirely into the solid mesh.
   - NODE
   - EDGE
   - FACE
-- If a size is given, the mesh will be refined around the enforced
-elements given the size (not available yet)
 - If a group name is given, the enforced elements will be added to
 the group. If the group does not exist, it is created.
 
index 8af4f1e746900b8f30cea2f87e1497f5f85c022a..0a4fbf2319f10dec0919ebc33b685fed4a88bf26 100644 (file)
@@ -50,7 +50,6 @@ module GHS3DPlugin
     string entry;
     SMESH::ElementType elementType;
     string groupName;
-    double size;
   };
   
   typedef sequence<GHS3DEnforcedMesh> GHS3DEnforcedMeshList;
@@ -166,15 +165,18 @@ module GHS3DPlugin
     
     boolean SetEnforcedMesh(in SMESH::SMESH_IDSource theSource, in SMESH::ElementType elementType) raises (SALOME::SALOME_Exception);
     boolean SetEnforcedMeshWithGroup(in SMESH::SMESH_IDSource theSource, in SMESH::ElementType elementType, in string groupName) raises (SALOME::SALOME_Exception);
+    
+    /* OBSOLETE FUNCTIONS */
     boolean SetEnforcedMeshSize(in SMESH::SMESH_IDSource theSource, in SMESH::ElementType elementType, in double size) raises (SALOME::SALOME_Exception);
     boolean SetEnforcedMeshSizeWithGroup(in SMESH::SMESH_IDSource theSource, in SMESH::ElementType elementType, in double size, in string groupName) raises (SALOME::SALOME_Exception);
+    /* OBSOLETE FUNCTIONS */
+    
     GHS3DEnforcedMeshList GetEnforcedMeshes();
     void ClearEnforcedMeshes();
    /*!
     * Set/get/unset an enforced vertex (private method for GUI)
     */
-    boolean p_SetEnforcedMesh(in SMESH::SMESH_IDSource theSource, in SMESH::ElementType elementType,
-                             in double size,  in string groupName) raises (SALOME::SALOME_Exception);
+    boolean p_SetEnforcedMesh(in SMESH::SMESH_IDSource theSource, in SMESH::ElementType elementType, in string name, in string groupName) raises (SALOME::SALOME_Exception);
   };
 };
 
index 9f2737b65454f4045b4215bf6a19080e1e2cb590..07b451dd1c2461ffea78edd6adf0e7bce5f28228 100644 (file)
@@ -1035,7 +1035,7 @@ static void addElemInMeshGroup(SMESH_Mesh*             theMesh,
     groupDone = true;
   }
   if (!groupDone)
-    throw SALOME_Exception(LOCALIZED("A enforced vertex node was not added to a group"));
+    throw SALOME_Exception(LOCALIZED("A given element was not added to a group"));
 }
 
 
@@ -2748,7 +2748,7 @@ static bool writePoints (ofstream &                       theFile,
       if (theEnforcedVertices.find(coords) != theEnforcedVertices.end())
         continue;
         
-      double size = theNodeIDToSizeMap.find(nodeIt->first->GetID())->second;
+//      double size = theNodeIDToSizeMap.find(nodeIt->first->GetID())->second;
   //       theGhs3dIdToNodeMap.insert( make_pair( nbNodes + i, (*nodeIt) ));
   //       MESSAGE("Adding enforced node (" << x << "," << y <<"," << z << ")");
       // X Y Z PHY_SIZE DUMMY_INT
@@ -2756,7 +2756,7 @@ static bool writePoints (ofstream &                       theFile,
       << x << space 
       << y << space 
       << z << space
-      << size << space
+      << -1 << space
       << dummyint << space;
       theFile << std::endl;
       theEnforcedNodeIdToGhs3dIdMap.insert( make_pair( nodeIt->first->GetID(), aGhs3dID ));
index 7aa534153dc02da5bec110bc534797bed4171319..6910f8ca553675f4bf812812f6d9187313b62e43 100644 (file)
@@ -63,7 +63,6 @@ GHS3DPlugin_Hypothesis::GHS3DPlugin_Hypothesis(int hypId, int studyId, SMESH_Gen
   _enfEdges(TIDSortedElemGroupMap()),
   _enfTriangles(TIDSortedElemGroupMap()),
   _nodeIDToSizeMap(DefaultID2SizeMap()),
-  _elementIDToSizeMap(DefaultID2SizeMap()),
   _groupsToRemove(DefaultGroupsToRemove())
 {
   _name = "GHS3D_Parameters";
@@ -419,20 +418,19 @@ bool GHS3DPlugin_Hypothesis::SetEnforcedVertex(std::string theName, std::string
 //=======================================================================
 //function : SetEnforcedMesh
 //=======================================================================
-bool GHS3DPlugin_Hypothesis::SetEnforcedMesh(SMESH_Mesh& theMesh, SMESH::ElementType elementType, std::string name, std::string entry, double size, std::string groupName)
+bool GHS3DPlugin_Hypothesis::SetEnforcedMesh(SMESH_Mesh& theMesh, SMESH::ElementType elementType, std::string name, std::string entry, std::string groupName)
 {
   TIDSortedElemSet theElemSet;
   SMDS_ElemIteratorPtr eIt = theMesh.GetMeshDS()->elementsIterator(SMDSAbs_ElementType(elementType));
   while ( eIt->more() )
     theElemSet.insert( eIt->next() );
   MESSAGE("Add "<<theElemSet.size()<<" types["<<elementType<<"] from source mesh");
-  bool added = SetEnforcedElements( theElemSet, elementType, size, groupName);
+  bool added = SetEnforcedElements( theElemSet, elementType, groupName);
   if (added) {
     TGHS3DEnforcedMesh* newEnfMesh = new TGHS3DEnforcedMesh();
     newEnfMesh->name = name;
     newEnfMesh->entry = entry;
     newEnfMesh->elementType = elementType;
-    newEnfMesh->size = size;
     newEnfMesh->groupName = groupName;
     
     TGHS3DEnforcedMeshList::iterator it = _enfMeshList.find(newEnfMesh);
@@ -447,7 +445,7 @@ bool GHS3DPlugin_Hypothesis::SetEnforcedMesh(SMESH_Mesh& theMesh, SMESH::Element
 //=======================================================================
 //function : SetEnforcedGroup
 //=======================================================================
-bool GHS3DPlugin_Hypothesis::SetEnforcedGroup(const SMESHDS_Mesh* theMeshDS, SMESH::long_array_var theIDs, SMESH::ElementType elementType, std::string name, std::string entry, double size, std::string groupName)
+bool GHS3DPlugin_Hypothesis::SetEnforcedGroup(const SMESHDS_Mesh* theMeshDS, SMESH::long_array_var theIDs, SMESH::ElementType elementType, std::string name, std::string entry, std::string groupName)
 {
   MESSAGE("GHS3DPlugin_Hypothesis::SetEnforcedGroup");
   TIDSortedElemSet theElemSet;
@@ -473,13 +471,12 @@ bool GHS3DPlugin_Hypothesis::SetEnforcedGroup(const SMESHDS_Mesh* theMeshDS, SME
 //     theElemSet.insert( it->next() );
 
   MESSAGE("Add "<<theElemSet.size()<<" types["<<elementType<<"] from source group ");
-  bool added = SetEnforcedElements( theElemSet, elementType, size, groupName);
+  bool added = SetEnforcedElements( theElemSet, elementType, groupName);
   if (added) {
     TGHS3DEnforcedMesh* newEnfMesh = new TGHS3DEnforcedMesh();
     newEnfMesh->name = name;
     newEnfMesh->entry = entry;
     newEnfMesh->elementType = elementType;
-    newEnfMesh->size = size;
     newEnfMesh->groupName = groupName;
     
     TGHS3DEnforcedMeshList::iterator it = _enfMeshList.find(newEnfMesh);
@@ -494,13 +491,16 @@ bool GHS3DPlugin_Hypothesis::SetEnforcedGroup(const SMESHDS_Mesh* theMeshDS, SME
 //=======================================================================
 //function : SetEnforcedElements
 //=======================================================================
-bool GHS3DPlugin_Hypothesis::SetEnforcedElements(TIDSortedElemSet theElemSet, SMESH::ElementType elementType, double size, std::string groupName)
+bool GHS3DPlugin_Hypothesis::SetEnforcedElements(TIDSortedElemSet theElemSet, SMESH::ElementType elementType, std::string groupName)
 {
   MESSAGE("GHS3DPlugin_Hypothesis::SetEnforcedElements");
   TIDSortedElemSet::const_iterator it = theElemSet.begin();
   const SMDS_MeshElement* elem;
   const SMDS_MeshNode* node;
-  bool added = false;
+  bool added = true;
+  pair<TIDSortedNodeGroupMap::iterator,bool> nodeRet;
+  pair<TIDSortedElemGroupMap::iterator,bool> elemRet;
+
   for (;it != theElemSet.end();++it)
   {
     elem = (*it);
@@ -508,43 +508,41 @@ bool GHS3DPlugin_Hypothesis::SetEnforcedElements(TIDSortedElemSet theElemSet, SM
       case SMESH::NODE:
         node = dynamic_cast<const SMDS_MeshNode*>(elem);
         if (node) {
-          _enfNodes.insert(make_pair(node,groupName));
-          _nodeIDToSizeMap.insert(make_pair(node->GetID(), size));
-          added = true;
+          nodeRet = _enfNodes.insert(make_pair(node,groupName));
+          added = added && nodeRet.second;
+          string msg = added ? "yes":"no";
+          MESSAGE( "Node (" <<node->X()<<","<<node->Y()<<","<<node->Z()<< ") with ID " << node->GetID() <<" added ? " << msg);
         }
         else {
           SMDS_ElemIteratorPtr nodeIt = elem->nodesIterator();
           for (;nodeIt->more();) {
             node = dynamic_cast<const SMDS_MeshNode*>(nodeIt->next());
-            _enfNodes.insert(make_pair(node,groupName));
-            _nodeIDToSizeMap.insert(make_pair(node->GetID(), size));
+            nodeRet = _enfNodes.insert(make_pair(node,groupName));
+            added = added && nodeRet.second;
           }
-          added = true;
+//          added = true;s
         }
         break;
       case SMESH::EDGE:
         if (elem->GetType() == SMDSAbs_Edge) {
-          _enfEdges.insert(make_pair(elem,groupName));
-          _elementIDToSizeMap.insert(make_pair(elem->GetID(), size));
-          added = true;
+          elemRet = _enfEdges.insert(make_pair(elem,groupName));
+          added = added && elemRet.second;
         }
         else if (elem->GetType() > SMDSAbs_Edge) {
           SMDS_ElemIteratorPtr it = elem->edgesIterator();
           for (;it->more();) {
             const SMDS_MeshElement* anEdge = it->next();
-            _enfEdges.insert(make_pair(anEdge,groupName));
-            _elementIDToSizeMap.insert(make_pair(anEdge->GetID(), size));
+            elemRet = _enfEdges.insert(make_pair(anEdge,groupName));
+            added = added && elemRet.second;
           }
-          added = true;
         }
         break;
       case SMESH::FACE:
         if (elem->GetType() == SMDSAbs_Face)
         {
           if (elem->NbCornerNodes() == 3) {
-            _enfTriangles.insert(make_pair(elem,groupName));
-            _elementIDToSizeMap.insert(make_pair(elem->GetID(), size));
-            added = true;
+            elemRet = _enfTriangles.insert(make_pair(elem,groupName));
+            added = added && elemRet.second;
           }
         }
         else if (elem->GetType() > SMDSAbs_Face) { // Group of faces
@@ -552,9 +550,8 @@ bool GHS3DPlugin_Hypothesis::SetEnforcedElements(TIDSortedElemSet theElemSet, SM
           for (;it->more();) {
             const SMDS_MeshElement* aFace = it->next();
             if (aFace->NbCornerNodes() == 3) {
-              _enfTriangles.insert(make_pair(aFace,groupName));
-              _elementIDToSizeMap.insert(make_pair(aFace->GetID(), size));
-              added = true;
+              elemRet = _enfTriangles.insert(make_pair(aFace,groupName));
+              added = added && elemRet.second;
             }
           }
         }
@@ -688,7 +685,6 @@ void GHS3DPlugin_Hypothesis::ClearEnforcedMeshes()
   _enfEdges.clear();
   _enfTriangles.clear();
   _nodeIDToSizeMap.clear();
-  _elementIDToSizeMap.clear();
   _enfMeshList.clear();
   _entryEnfMeshMap.clear();
   NotifySubMeshesHypothesisModification();
@@ -879,7 +875,7 @@ std::ostream & GHS3DPlugin_Hypothesis::SaveTo(std::ostream & save)
 
   TGHS3DEnforcedVertexList::iterator it  = _enfVertexList.begin();
   if (it != _enfVertexList.end()) {
-    save << "__ENFORCED_VERTICES_BEGIN__ ";
+    save << " " << "__ENFORCED_VERTICES_BEGIN__ ";
     for ( ; it != _enfVertexList.end(); ++it ) {
       TGHS3DEnforcedVertex *enfVertex = (*it);
       save << " " << "__BEGIN_VERTEX__";
@@ -910,9 +906,38 @@ std::ostream & GHS3DPlugin_Hypothesis::SaveTo(std::ostream & save)
       save << " " << "__END_SIZE__";
       save << " " << "__END_VERTEX__";
     }
-    save << "__ENFORCED_VERTICES_END__ ";
+    save << " " << "__ENFORCED_VERTICES_END__ ";
   }
 
+  TGHS3DEnforcedMeshList::iterator it_mesh  = _enfMeshList.begin();
+  if (it_mesh != _enfMeshList.end()) {
+    save << " " << "__ENFORCED_MESHES_BEGIN__ ";
+    for ( ; it_mesh != _enfMeshList.end(); ++it_mesh ) {
+      TGHS3DEnforcedMesh *enfMesh = (*it_mesh);
+      save << " " << "__BEGIN_ENF_MESH__";
+
+      save << " " << "__BEGIN_NAME__";
+      save << " " << enfMesh->name;
+      save << " " << "__END_NAME__";
+
+      save << " " << "__BEGIN_ENTRY__";
+      save << " " << enfMesh->entry;
+      save << " " << "__END_ENTRY__";
+
+      save << " " << "__BEGIN_ELEM_TYPE__";
+      save << " " << (int)enfMesh->elementType;
+      save << " " << "__END_ELEM_TYPE__";
+
+      if (!enfMesh->groupName.empty()) {
+        save << " " << "__BEGIN_GROUP__";
+        save << " " << enfMesh->groupName;
+        save << " " << "__END_GROUP__";
+      }
+      save << " " << "__END_ENF_MESH__";
+      std::cout << "Saving of enforced mesh " << enfMesh->name.c_str() << " done" << std::endl;
+    }
+    save << " "  << "__ENFORCED_MESHES_END__ ";
+  }
   return save;
 }
 
@@ -922,214 +947,298 @@ std::ostream & GHS3DPlugin_Hypothesis::SaveTo(std::ostream & save)
 
 std::istream & GHS3DPlugin_Hypothesis::LoadFrom(std::istream & load)
 {
-  bool isOK = true;
-  int i;
-  
-  isOK = (load >> i);
-  if (isOK)
-    myToMeshHoles = i;
-  else
-    load.clear(ios::badbit | load.rdstate());
-  
-  isOK = (load >> i);
-  if (isOK)
-    myMaximumMemory = i;
-  else
-    load.clear(ios::badbit | load.rdstate());
-  
-  isOK = (load >> i);
-  if (isOK)
-    myInitialMemory = i;
-  else
-    load.clear(ios::badbit | load.rdstate());
-  
-  isOK = (load >> i);
-  if (isOK)
-    myOptimizationLevel = i;
-  else
-    load.clear(ios::badbit | load.rdstate());
-  
-  isOK = (load >> myWorkingDirectory);
-  if (isOK) {
-    if ( myWorkingDirectory == "0") { // myWorkingDirectory was empty
-      myKeepFiles = false;
-      myWorkingDirectory.clear();
-    }
-    else if ( myWorkingDirectory == "1" ) {
-      myKeepFiles = true;
-      myWorkingDirectory.clear();
-    }
-  }
-  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)
-    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 >> i);
-  if (isOK)
-    myToUseBoundaryRecoveryVersion = (bool) i;
-  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());
-  
-  std::string separator;
-  bool hasOptions = false;
-  bool hasEnforcedVertices = false;
-  isOK = (load >> separator);
-
-  if (isOK) {
-    if (separator == "__OPTIONS_BEGIN__")
-      hasOptions = true;
-    else if (separator == "__ENFORCED_VERTICES_BEGIN__")
-      hasEnforcedVertices = true;
-  }
+       bool isOK = true;
+       int i;
+
+       isOK = (load >> i);
+       if (isOK)
+               myToMeshHoles = i;
+       else
+               load.clear(ios::badbit | load.rdstate());
+
+       isOK = (load >> i);
+       if (isOK)
+               myMaximumMemory = i;
+       else
+               load.clear(ios::badbit | load.rdstate());
+
+       isOK = (load >> i);
+       if (isOK)
+               myInitialMemory = i;
+       else
+               load.clear(ios::badbit | load.rdstate());
+
+       isOK = (load >> i);
+       if (isOK)
+               myOptimizationLevel = i;
+       else
+               load.clear(ios::badbit | load.rdstate());
+
+       isOK = (load >> myWorkingDirectory);
+       if (isOK) {
+               if ( myWorkingDirectory == "0") { // myWorkingDirectory was empty
+                       myKeepFiles = false;
+                       myWorkingDirectory.clear();
+               }
+               else if ( myWorkingDirectory == "1" ) {
+                       myKeepFiles = true;
+                       myWorkingDirectory.clear();
+               }
+       }
+       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)
+               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 >> i);
+       if (isOK)
+               myToUseBoundaryRecoveryVersion = (bool) i;
+       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());
+
+       std::string separator;
+       bool hasOptions = false;
+       bool hasEnforcedVertices = false;
+       bool hasEnforcedMeshes = false;
+       isOK = (load >> separator);
+
+       if (isOK) {
+               if (separator == "__OPTIONS_BEGIN__")
+                       hasOptions = true;
+               else if (separator == "__ENFORCED_VERTICES_BEGIN__")
+                       hasEnforcedVertices = true;
+               else if (separator == "__ENFORCED_MESHES_BEGIN__")
+                       hasEnforcedMeshes = true;
+       }
+
+       if (hasOptions) {
+               std::string txt;
+               while (isOK) {
+                       isOK = (load >> txt);
+                       if (isOK) {
+                               if (txt == "__OPTIONS_END__") {
+                                       if (!myTextOption.empty()) {
+                                               // Remove last space
+                                               myTextOption.erase(myTextOption.end()-1);
+                                       }
+                                       isOK = false;
+                                       break;
+                               }
+                               myTextOption += txt;
+                               myTextOption += " ";
+                       }
+               }
+       }
+
+       if (hasOptions) {
+               isOK = (load >> separator);
+               if (isOK && separator == "__ENFORCED_VERTICES_BEGIN__")
+                       hasEnforcedVertices = true;
+               if (isOK && separator == "__ENFORCED_MESHES_BEGIN__")
+                       hasEnforcedMeshes = true;
+       }
 
-  if (hasOptions) {
-    std::string txt;
-    while (isOK) {
-      isOK = (load >> txt);
-      if (isOK) {
-        if (txt == "__OPTIONS_END__") {
-          if (!myTextOption.empty()) {
-            // Remove last space
-            myTextOption.erase(myTextOption.end()-1);
-          }
-          isOK = false;
-          break;
-        }
-        myTextOption += txt;
-        myTextOption += " ";
-      }
-    }
-  }
-
-  if (hasOptions) {
-    isOK = (load >> separator);
-    if (isOK && separator == "__ENFORCED_VERTICES_BEGIN__")
-      hasEnforcedVertices = true;
+  if (hasEnforcedVertices) {
+         std::string txt, name, entry, groupName;
+         double size, coords[3];
+         bool isCompound;
+         bool hasCoords = false;
+         isOK = (load >> txt);  // __BEGIN_VERTEX__
+         while (isOK) {
+           if (txt == "__ENFORCED_VERTICES_END__")
+             isOK = false;
+
+           TGHS3DEnforcedVertex *enfVertex = new TGHS3DEnforcedVertex();
+           while (isOK) {
+             isOK = (load >> txt);
+             if (txt == "__END_VERTEX__") {
+               enfVertex->name = name;
+               enfVertex->geomEntry = entry;
+               enfVertex->isCompound = isCompound;
+               enfVertex->groupName = groupName;
+               enfVertex->coords.clear();
+               if (hasCoords)
+                 enfVertex->coords.assign(coords,coords+3);
+
+               _enfVertexList.insert(enfVertex);
+
+               if (enfVertex->coords.size())
+                 _coordsEnfVertexMap[enfVertex->coords] = enfVertex;
+               if (!enfVertex->geomEntry.empty())
+                 _geomEntryEnfVertexMap[enfVertex->geomEntry] = enfVertex;
+
+               name.clear();
+               entry.clear();
+               groupName.clear();
+               hasCoords = false;
+               isOK = false;
+             }
+
+             if (txt == "__BEGIN_NAME__") {  // __BEGIN_NAME__
+               while (isOK && (txt != "__END_NAME__")) {
+                 isOK = (load >> txt);
+                 if (txt != "__END_NAME__") {
+                   if (!name.empty())
+                     name += " ";
+                   name += txt;
+                 }
+               }
+               MESSAGE("name: " <<name);
+             }
+
+             if (txt == "__BEGIN_ENTRY__") {  // __BEGIN_ENTRY__
+               isOK = (load >> entry);
+               isOK = (load >> isCompound);
+               isOK = (load >> txt); // __END_ENTRY__
+               if (txt != "__END_ENTRY__")
+                 throw std::exception();
+               MESSAGE("entry: " << entry);
+             }
+
+             if (txt == "__BEGIN_GROUP__") {  // __BEGIN_GROUP__
+               while (isOK && (txt != "__END_GROUP__")) {
+                 isOK = (load >> txt);
+                 if (txt != "__END_GROUP__") {
+                   if (!groupName.empty())
+                     groupName += " ";
+                   groupName += txt;
+                 }
+               }
+               MESSAGE("groupName: " << groupName);
+             }
+
+             if (txt == "__BEGIN_COORDS__") {  // __BEGIN_COORDS__
+               hasCoords = true;
+               isOK = (load >> coords[0] >> coords[1] >> coords[2]);
+               isOK = (load >> txt); // __END_COORDS__
+               if (txt != "__END_COORDS__")
+                 throw std::exception();
+               MESSAGE("coords: " << coords[0] <<","<< coords[1] <<","<< coords[2]);
+             }
+
+             if (txt == "__BEGIN_SIZE__") {  // __BEGIN_ENTRY__
+               isOK = (load >> size);
+               isOK = (load >> txt); // __END_ENTRY__
+               if (txt != "__END_SIZE__") {
+                 throw std::exception();
+               }
+               MESSAGE("size: " << size);
+             }
+           }
+           isOK = (load >> txt);  // __BEGIN_VERTEX__
+         }
   }
 
   if (hasEnforcedVertices) {
-    std::string txt, name, entry, groupName;
-    double size, coords[3];
-    bool isCompound;
-    bool hasCoords = false;
-    while (isOK) {
-      isOK = (load >> txt);  // __BEGIN_VERTEX__
-      if (isOK) {
-        if (txt == "__ENFORCED_VERTICES_END__")
-          isOK = false;
-
-        TGHS3DEnforcedVertex *enfVertex = new TGHS3DEnforcedVertex();
-        while (isOK) {
-          isOK = (load >> txt);
-          if (txt == "__END_VERTEX__") {
-            enfVertex->name = name;
-            enfVertex->geomEntry = entry;
-            enfVertex->isCompound = isCompound;
-            enfVertex->groupName = groupName;
-            enfVertex->coords.clear();
-            if (hasCoords)
-              enfVertex->coords.assign(coords,coords+3);
-            
-            _enfVertexList.insert(enfVertex);
-            
-            if (enfVertex->coords.size())
-              _coordsEnfVertexMap[enfVertex->coords] = enfVertex;
-            if (!enfVertex->geomEntry.empty())
-              _geomEntryEnfVertexMap[enfVertex->geomEntry] = enfVertex;
-            
-            name.clear();
-            entry.clear();
-            groupName.clear();
-            hasCoords = false;
-            isOK = false;
-          }
-          
-          if (txt == "__BEGIN_NAME__") {  // __BEGIN_NAME__
-            while (isOK && (txt != "__END_NAME__")) {
-              isOK = (load >> txt);
-              if (txt != "__END_NAME__") {
-                if (!name.empty())
-                  name += " ";
-                name += txt;
-              }
-            }
-            MESSAGE("name: " <<name);
-          }
-            
-          if (txt == "__BEGIN_ENTRY__") {  // __BEGIN_ENTRY__
-            isOK = (load >> entry);
-            isOK = (load >> isCompound);
-            isOK = (load >> txt); // __END_ENTRY__
-            if (txt != "__END_ENTRY__")
-              throw std::exception();
-            MESSAGE("entry: " << entry);
-          }
-            
-          if (txt == "__BEGIN_GROUP__") {  // __BEGIN_GROUP__
-            while (isOK && (txt != "__END_GROUP__")) {
-              isOK = (load >> txt);
-              if (txt != "__END_GROUP__") {
-                if (!groupName.empty())
-                  groupName += " ";
-                groupName += txt;
-              }
-            }
-            MESSAGE("groupName: " << groupName);
-          }
-            
-          if (txt == "__BEGIN_COORDS__") {  // __BEGIN_COORDS__
-            hasCoords = true;
-            isOK = (load >> coords[0] >> coords[1] >> coords[2]);
-            isOK = (load >> txt); // __END_COORDS__
-            if (txt != "__END_COORDS__")
-              throw std::exception();
-            MESSAGE("coords: " << coords[0] <<","<< coords[1] <<","<< coords[2]);
-          } 
-            
-          if (txt == "__BEGIN_SIZE__") {  // __BEGIN_ENTRY__
-            isOK = (load >> size);
-            isOK = (load >> txt); // __END_ENTRY__
-            if (txt != "__END_SIZE__") {
-              throw std::exception();
-            }
-            MESSAGE("size: " << size);
-          }
-        }
-      }
-    }
+         isOK = (load >> separator);
+         if (isOK && separator == "__ENFORCED_MESHES_BEGIN__")
+                 hasEnforcedMeshes = true;
   }
 
+  if (hasEnforcedMeshes) {
+         std::string txt, name, entry, groupName;
+         int elementType = -1;
+         isOK = (load >> txt);  // __BEGIN_ENF_MESH__
+         while (isOK) {
+//               if (isOK) {
+                         if (txt == "__ENFORCED_MESHES_END__")
+                                 isOK = false;
+
+                         TGHS3DEnforcedMesh *enfMesh = new TGHS3DEnforcedMesh();
+                         while (isOK) {
+                                 isOK = (load >> txt);
+                                 if (txt == "__END_ENF_MESH__") {
+                                         enfMesh->name = name;
+                                         enfMesh->entry = entry;
+                                         enfMesh->elementType = (SMESH::ElementType)elementType;
+                                         enfMesh->groupName = groupName;
+
+                                         _enfMeshList.insert(enfMesh);
+                                         std::cout << "Restoring of enforced mesh " <<name  << " done" << std::endl;
+
+                                         name.clear();
+                                         entry.clear();
+                                         elementType = -1;
+                                         groupName.clear();
+                                         isOK = false;
+                                 }
+
+                                 if (txt == "__BEGIN_NAME__") {  // __BEGIN_NAME__
+                                         while (isOK && (txt != "__END_NAME__")) {
+                                                 isOK = (load >> txt);
+                                                 if (txt != "__END_NAME__") {
+                                                         if (!name.empty())
+                                                                 name += " ";
+                                                         name += txt;
+                                                 }
+                                         }
+                                         MESSAGE("name: " <<name);
+                                 }
+
+                                 if (txt == "__BEGIN_ENTRY__") {  // __BEGIN_ENTRY__
+                                         isOK = (load >> entry);
+                                         isOK = (load >> txt); // __END_ENTRY__
+                                         if (txt != "__END_ENTRY__")
+                                                 throw std::exception();
+                                         MESSAGE("entry: " << entry);
+                                 }
+
+                                 if (txt == "__BEGIN_ELEM_TYPE__") {  // __BEGIN_ELEM_TYPE__
+                                         isOK = (load >> elementType);
+                                         isOK = (load >> txt); // __END_ELEM_TYPE__
+                                         if (txt != "__END_ELEM_TYPE__")
+                                                 throw std::exception();
+                                         MESSAGE("elementType: " << elementType);
+                                 }
+
+                                 if (txt == "__BEGIN_GROUP__") {  // __BEGIN_GROUP__
+                                         while (isOK && (txt != "__END_GROUP__")) {
+                                                 isOK = (load >> txt);
+                                                 if (txt != "__END_GROUP__") {
+                                                         if (!groupName.empty())
+                                                                 groupName += " ";
+                                                         groupName += txt;
+                                                 }
+                                         } // while
+                                         MESSAGE("groupName: " << groupName);
+                                 } // if
+                                 std::cout << "isOK: " << isOK << std::endl;
+                         } // while
+//               } // if
+                 isOK = (load >> txt);  // __BEGIN_ENF_MESH__
+         } // while
+  } // if
+
   return load;
 }
 
@@ -1345,11 +1454,6 @@ GHS3DPlugin_Hypothesis::TID2SizeMap GHS3DPlugin_Hypothesis::GetNodeIDToSizeMap(c
   return hyp ? hyp->_GetNodeIDToSizeMap(): DefaultID2SizeMap();
 }
 
-GHS3DPlugin_Hypothesis::TID2SizeMap GHS3DPlugin_Hypothesis::GetElementIDToSizeMap(const GHS3DPlugin_Hypothesis* hyp)
-{
-  return hyp ? hyp->_GetElementIDToSizeMap(): DefaultID2SizeMap();
-}
-
 GHS3DPlugin_Hypothesis::TSetStrings GHS3DPlugin_Hypothesis::GetGroupsToRemove(const GHS3DPlugin_Hypothesis* hyp)
 {
   return hyp ? hyp->_GetGroupsToRemove(): DefaultGroupsToRemove();
index 93723bb7ec6e28f698797bbe04fbb3dcc3bd6cd1..db3830ddd4f2acbf59afd3af7622569d5f4c61af 100644 (file)
@@ -84,9 +84,8 @@ public:
   struct TGHS3DEnforcedMesh {
     std::string name;
     std::string entry;
-    SMESH::ElementType elementType;
     std::string groupName;
-    double size;
+    SMESH::ElementType elementType;
   };
   
   struct CompareGHS3DEnforcedMesh {
@@ -103,14 +102,19 @@ public:
   };
   typedef std::set< TGHS3DEnforcedMesh*, CompareGHS3DEnforcedMesh > TGHS3DEnforcedMeshList;
   // Map mesh entry / Enforced mesh list
-  // ex: 0:1:2:1 -> [ ("Mesh_1", "0:1:2:1", TopAbs_NODE, "", -1),
-  //                  ("Mesh_1", "0:1:2:1", TopAbs_EDGE, "edge group", 5)]
+  // ex: 0:1:2:1 -> [ ("Mesh_1", "0:1:2:1", TopAbs_NODE, ""),
+  //                  ("Mesh_1", "0:1:2:1", TopAbs_EDGE, "edge group")]
   typedef std::map< std::string, TGHS3DEnforcedMeshList > TEntryGHS3DEnforcedMeshListMap;
   
   typedef std::map<int,double> TID2SizeMap;
+
+  struct TIDMeshIDCompare {
+    bool operator () (const SMDS_MeshElement* e1, const SMDS_MeshElement* e2) const
+    { return e1->getMeshId() == e2->getMeshId() ? e1->GetID() < e2->GetID() : e1->getMeshId() < e2->getMeshId() ; }
+  };
   
-  typedef std::map<const SMDS_MeshElement*, std::string, TIDCompare > TIDSortedElemGroupMap;
-  typedef std::map<const SMDS_MeshNode*, std::string, TIDCompare > TIDSortedNodeGroupMap;
+  typedef std::map<const SMDS_MeshElement*, std::string, TIDMeshIDCompare > TIDSortedElemGroupMap;
+  typedef std::map<const SMDS_MeshNode*, std::string, TIDMeshIDCompare > TIDSortedNodeGroupMap;
   typedef std::set<std::string> TSetStrings;
 
   static const char* GetHypType() { return "GHS3D_Parameters"; }
@@ -225,9 +229,9 @@ public:
   /*!
    * To set enforced elements
    */
-  bool SetEnforcedMesh(SMESH_Mesh& theMesh, SMESH::ElementType elementType, std::string name, std::string entry, double size, std::string groupName = "");
-  bool SetEnforcedGroup(const SMESHDS_Mesh* theMeshDS, SMESH::long_array_var theIDs, SMESH::ElementType elementType, std::string name, std::string entry, double size, std::string groupName = "");
-  bool SetEnforcedElements(TIDSortedElemSet theElemSet, SMESH::ElementType elementType, double size, std::string groupName = "");
+  bool SetEnforcedMesh(SMESH_Mesh& theMesh, SMESH::ElementType elementType, std::string name, std::string entry, std::string groupName = "");
+  bool SetEnforcedGroup(const SMESHDS_Mesh* theMeshDS, SMESH::long_array_var theIDs, SMESH::ElementType elementType, std::string name, std::string entry, std::string groupName = "");
+  bool SetEnforcedElements(TIDSortedElemSet theElemSet, SMESH::ElementType elementType, std::string groupName = "");
   const TGHS3DEnforcedMeshList _GetEnforcedMeshes() const { return _enfMeshList; }
   const TEntryGHS3DEnforcedMeshListMap _GetEnforcedMeshesByEntry() const { return _entryEnfMeshMap; }
   void ClearEnforcedMeshes();
@@ -235,7 +239,6 @@ public:
   const TIDSortedElemGroupMap _GetEnforcedEdges() const { return _enfEdges; }
   const TIDSortedElemGroupMap _GetEnforcedTriangles() const { return _enfTriangles; }
   const TID2SizeMap _GetNodeIDToSizeMap() const {return _nodeIDToSizeMap; }
-  const TID2SizeMap _GetElementIDToSizeMap() const {return _elementIDToSizeMap; }
   const TSetStrings _GetGroupsToRemove() const {return _groupsToRemove; }
   /*!
    * \brief Return the enforced vertices
@@ -252,7 +255,6 @@ public:
   static TIDSortedElemGroupMap GetEnforcedEdges(const GHS3DPlugin_Hypothesis* hyp);
   static TIDSortedElemGroupMap GetEnforcedTriangles(const GHS3DPlugin_Hypothesis* hyp);
   static TID2SizeMap GetNodeIDToSizeMap(const GHS3DPlugin_Hypothesis* hyp);
-  static TID2SizeMap GetElementIDToSizeMap(const GHS3DPlugin_Hypothesis* hyp);
   static TSetStrings GetGroupsToRemove(const GHS3DPlugin_Hypothesis* hyp);
   void ClearGroupsToRemove();
   
@@ -331,7 +333,6 @@ private:
   TIDSortedElemGroupMap _enfEdges;
   TIDSortedElemGroupMap _enfTriangles;
   TID2SizeMap _nodeIDToSizeMap;
-  TID2SizeMap _elementIDToSizeMap;
   std::map<std::string, TIDSortedElemSet > _entryToElemsMap;
   
   TSetStrings _groupsToRemove;
index 5b8466b1175364004879b62262305f2eabb3e99c..2e7a37ea56bc28c341d306a9b85c0d857f015610 100644 (file)
@@ -799,8 +799,6 @@ GHS3DPlugin::GHS3DEnforcedMeshList* GHS3DPlugin_Hypothesis_i::GetEnforcedMeshes(
     enfMesh->elementType = currentMesh->elementType;
     // Group Name
     enfMesh->groupName = CORBA::string_dup(currentMesh->groupName.c_str());
-    // Size
-    enfMesh->size = currentMesh->size;
     
     result[i]=enfMesh;
     }
@@ -817,22 +815,7 @@ bool GHS3DPlugin_Hypothesis_i::SetEnforcedMeshWithGroup(SMESH::SMESH_IDSource_pt
   throw (SALOME::SALOME_Exception)
 {
 #if GHS3D_VERSION >= 42
-  return p_SetEnforcedMesh(theSource, theType, -1.0, theGroupName);
-//   bool res = p_SetEnforcedMesh(theSource, theType, -1.0, theGroupName);
-//   SMESH_Mesh_i* theMesh_i = SMESH::DownCast<SMESH_Mesh_i*>( theSource);
-//   SMESH_Group_i* theGroup_i = SMESH::DownCast<SMESH_Group_i*>( theSource);
-//   SMESH_GroupOnGeom_i* theGroupOnGeom_i = SMESH::DownCast<SMESH_GroupOnGeom_i*>( theSource);
-//   if (theGroup_i || theGroupOnGeom_i)
-//   {
-//     SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshWithGroup( " 
-//                           << theSource << ", " << theType << ", \"" << theGroupName << "\" )";
-//   }
-//   else if (theMesh_i)
-//   {
-//     SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshWithGroup( " 
-//                           << theSource << ".GetMesh(), " << theType << ", \"" << theGroupName << "\" )";
-//   }
-//   return res;
+  return p_SetEnforcedMesh(theSource, theType, "", theGroupName);
 #else
   SALOME::ExceptionStruct ExDescription;
   ExDescription.text = "Bad version of GHS3D. It must >= 4.2.";
@@ -852,21 +835,6 @@ bool GHS3DPlugin_Hypothesis_i::SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSour
 //   MESSAGE("GHS3DPlugin_Hypothesis_i::SetEnforcedMesh");
 #if GHS3D_VERSION >= 42
   return p_SetEnforcedMesh(theSource, theType);
-//   bool res = p_SetEnforcedMesh(theSource, theType);
-//   SMESH_Mesh_i* theMesh_i = SMESH::DownCast<SMESH_Mesh_i*>( theSource);
-//   SMESH_Group_i* theGroup_i = SMESH::DownCast<SMESH_Group_i*>( theSource);
-//   SMESH_GroupOnGeom_i* theGroupOnGeom_i = SMESH::DownCast<SMESH_GroupOnGeom_i*>( theSource);
-//   if (theGroup_i || theGroupOnGeom_i)
-//   {
-//     SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMesh( " 
-//                           << theSource << ", " << theType << " )";
-//   }
-//   else if (theMesh_i)
-//   {
-//     SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMesh( " 
-//                           << theSource << ".GetMesh(), " << theType << " )";
-//   }
-//   return res;
 #else
   SALOME::ExceptionStruct ExDescription;
   ExDescription.text = "Bad version of GHS3D. It must >= 4.2.";
@@ -878,37 +846,13 @@ bool GHS3DPlugin_Hypothesis_i::SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSour
 }
 
 /*!
- * \brief Adds enforced elements of type elementType using another mesh/sub-mesh/mesh group theSource and a size. The elements will be grouped in theGroupName.
+ * \brief OBSOLETE FUNCTION - Adds enforced elements of type elementType using another mesh/sub-mesh/mesh group theSource and a size. The elements will be grouped in theGroupName.
  */
 bool GHS3DPlugin_Hypothesis_i::SetEnforcedMeshSizeWithGroup(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType, double theSize, const char* theGroupName)
   throw (SALOME::SALOME_Exception)
 {
 #if GHS3D_VERSION >= 42
-  if (theSize < 0) {
-    SALOME::ExceptionStruct ExDescription;
-    ExDescription.text = "Size cannot be negative";
-    ExDescription.type = SALOME::BAD_PARAM;
-    ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
-    ExDescription.lineNumber = 781;
-    throw SALOME::SALOME_Exception(ExDescription);
-  }
-  
-  return p_SetEnforcedMesh(theSource, theType, theSize, theGroupName);
-//   bool res = p_SetEnforcedMesh(theSource, theType, theSize, theGroupName);
-//   SMESH_Mesh_i* theMesh_i = SMESH::DownCast<SMESH_Mesh_i*>( theSource);
-//   SMESH_Group_i* theGroup_i = SMESH::DownCast<SMESH_Group_i*>( theSource);
-//   SMESH_GroupOnGeom_i* theGroupOnGeom_i = SMESH::DownCast<SMESH_GroupOnGeom_i*>( theSource);
-//   if (theGroup_i || theGroupOnGeom_i)
-//   {
-//     SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshSizeWithGroup( " 
-//                           << theSource << ", " << theType << ", " << theSize << ", \"" << theGroupName << "\" )";
-//   }
-//   else if (theMesh_i)
-//   {
-//     SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshSizeWithGroup( " 
-//                           << theSource << ".GetMesh(), " << theType << ", " << theSize << ", \"" << theGroupName << "\" )";
-//   }
-//   return res;
+  return p_SetEnforcedMesh(theSource, theType, "", theGroupName);
 #else
   SALOME::ExceptionStruct ExDescription;
   ExDescription.text = "Bad version of GHS3D. It must >= 4.2.";
@@ -920,36 +864,13 @@ bool GHS3DPlugin_Hypothesis_i::SetEnforcedMeshSizeWithGroup(SMESH::SMESH_IDSourc
 }
 
 /*!
- * \brief Adds enforced elements of type elementType using another mesh/sub-mesh/mesh group theSource and a size.
+ * \brief OBSOLETE FUNCTION - Adds enforced elements of type elementType using another mesh/sub-mesh/mesh group theSource and a size.
  */
 bool GHS3DPlugin_Hypothesis_i::SetEnforcedMeshSize(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType, double theSize)
   throw (SALOME::SALOME_Exception)
 {
 #if GHS3D_VERSION >= 42
-  if (theSize < 0) {
-    SALOME::ExceptionStruct ExDescription;
-    ExDescription.text = "Size cannot be negative";
-    ExDescription.type = SALOME::BAD_PARAM;
-    ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
-    ExDescription.lineNumber = 781;
-    throw SALOME::SALOME_Exception(ExDescription);
-  }
-  return p_SetEnforcedMesh(theSource, theType, theSize);
-//   bool res = p_SetEnforcedMesh(theSource, theType, theSize);
-//   SMESH_Mesh_i* theMesh_i = SMESH::DownCast<SMESH_Mesh_i*>( theSource);
-//   SMESH_Group_i* theGroup_i = SMESH::DownCast<SMESH_Group_i*>( theSource);
-//   SMESH_GroupOnGeom_i* theGroupOnGeom_i = SMESH::DownCast<SMESH_GroupOnGeom_i*>( theSource);
-//   if (theGroup_i || theGroupOnGeom_i)
-//   {
-//     SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshSize( " 
-//                           << theSource << ", " << theType << ", " << theSize << " )";
-//   }
-//   else if (theMesh_i)
-//   {
-//     SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshSize( " 
-//                           << theSource << ".GetMesh(), " << theType << ", " << theSize << " )";
-//   }
-//   return res;
+  return p_SetEnforcedMesh(theSource, theType);
 #else
   SALOME::ExceptionStruct ExDescription;
   ExDescription.text = "Bad version of GHS3D. It must >= 4.2.";
@@ -960,7 +881,7 @@ bool GHS3DPlugin_Hypothesis_i::SetEnforcedMeshSize(SMESH::SMESH_IDSource_ptr the
 #endif
 }
 
-bool GHS3DPlugin_Hypothesis_i::p_SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType, double theSize, const char* theGroupName)
+bool GHS3DPlugin_Hypothesis_i::p_SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType theType, const char* theName, const char* theGroupName)
   throw (SALOME::SALOME_Exception)
 {
   MESSAGE("GHS3DPlugin_Hypothesis_i::p_SetEnforcedMesh");
@@ -976,18 +897,6 @@ bool GHS3DPlugin_Hypothesis_i::p_SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSo
     throw SALOME::SALOME_Exception(ExDescription);
   }
   
-  if ((theType != SMESH::NODE) && (theType != SMESH::EDGE) && (theType != SMESH::FACE))
-  {
-    return false;
-//     SALOME::ExceptionStruct ExDescription;
-//     ExDescription.text = "Bad elementType";
-//     ExDescription.type = SALOME::BAD_PARAM;
-//     ExDescription.sourceFile = "GHS3DPlugin_Hypothesis_i.cxx";
-//     ExDescription.lineNumber = 840;
-//     throw SALOME::SALOME_Exception(ExDescription);
-  }
-  
-  SMESH::array_of_ElementType_var types = theSource->GetTypes();
   switch (theType) {
     case SMESH::NODE:
       MESSAGE("Required type is NODE");
@@ -999,13 +908,16 @@ bool GHS3DPlugin_Hypothesis_i::p_SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSo
       MESSAGE("Required type is FACE");
       break;
     default:
-      break;
+       MESSAGE("Incompatible required type: " << theType);
+       return false;
   }
 //   MESSAGE("Required type is "<<theType);
+  SMESH::array_of_ElementType_var types = theSource->GetTypes();
   MESSAGE("Available types:");
   for (int i=0;i<types->length();i++){MESSAGE(types[i]);}
   if ( types->length() >= 1 && types[types->length()-1] <  theType)
   {
+    MESSAGE("Required type not available");
     return false;
 //     SALOME::ExceptionStruct ExDescription;
 //     ExDescription.text = "The source mesh has bad type";
@@ -1015,36 +927,31 @@ bool GHS3DPlugin_Hypothesis_i::p_SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSo
 //     throw SALOME::SALOME_Exception(ExDescription);
   }
   
+
+  SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
+  SALOMEDS::SObject_ptr SObj = smeshGen->ObjectToSObject(smeshGen->GetCurrentStudy(),theSource);
+
   SMESH_Mesh_i* theMesh_i = SMESH::DownCast<SMESH_Mesh_i*>( theSource);
   SMESH_Group_i* theGroup_i = SMESH::DownCast<SMESH_Group_i*>( theSource);
   SMESH_GroupOnGeom_i* theGroupOnGeom_i = SMESH::DownCast<SMESH_GroupOnGeom_i*>( theSource);
-  TIDSortedElemSet theElemSet;
-  SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
-  SALOMEDS::SObject_ptr SObj = smeshGen->ObjectToSObject(smeshGen->GetCurrentStudy(),theSource);
+
+  string enfMeshName = theName;
+  if (enfMeshName.empty())
+         enfMeshName = SObj->GetName();
+
   if (theMesh_i)
   {
     try {
-      bool res = this->GetImpl()->SetEnforcedMesh(theMesh_i->GetImpl(), theType, SObj->GetName() , SObj->GetID(), theSize, theGroupName);
-      if (theSize > 0) {
-        if (theGroupName != "") {
-          SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshSizeWithGroup( " 
-                                << theSource << ".GetMesh(), " << theType << ", " << theSize << ", \"" << theGroupName << "\" )";
-        }
-        else {
-          SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshSize( " 
-                                << theSource << ".GetMesh(), " << theType << ", " << theSize << ", \"" << theGroupName << "\" )";
-        }
-      }
-      else {
-        if (theGroupName != "") {
-          SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshWithGroup( " 
-                                << theSource << ".GetMesh(), " << theType << ", \"" << theGroupName << "\" )";
-        }
-        else {
-          SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMesh( " 
-                                << theSource << ".GetMesh(), " << theType << " )";
-        }
-      }
+       bool res = this->GetImpl()->SetEnforcedMesh(theMesh_i->GetImpl(), theType, enfMeshName , SObj->GetID(), theGroupName);
+               if (theGroupName != "") {
+                 SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshWithGroup( "
+                                                               << theSource << ".GetMesh(), " << theType << ", \"" << theGroupName << "\" )";
+               }
+               else {
+                 SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMesh( "
+                                                               << theSource << ".GetMesh(), " << theType << " )";
+               }
+
       return res;
     }
     catch (const std::invalid_argument& ex) {
@@ -1059,22 +966,11 @@ bool GHS3DPlugin_Hypothesis_i::p_SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSo
       THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
     }
   }
-  else if (theGroup_i && types->length() == 1 && types[0] == theType)
+  else if (theGroup_i)// && types->length() == 1 && types[0] == theType)
   {
     MESSAGE("The source is a group")
     try {
-      bool res = this->GetImpl()->SetEnforcedGroup(theGroup_i->GetGroupDS()->GetMesh(), theGroup_i->GetListOfID(), theType, SObj->GetName() , SObj->GetID(), theSize, theGroupName);
-      if (theSize > 0) {
-        if (theGroupName != "") {
-          SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshSizeWithGroup( " 
-                                << theSource << ", " << theType << ", " << theSize << ", \"" << theGroupName << "\" )";
-        }
-        else {
-          SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshSize( " 
-                                << theSource << ", " << theType << ", " << theSize << ", \"" << theGroupName << "\" )";
-        }
-      }
-      else {
+       bool res = this->GetImpl()->SetEnforcedGroup(theGroup_i->GetGroupDS()->GetMesh(), theGroup_i->GetListOfID(), theType, enfMeshName , SObj->GetID(), theGroupName);
         if (theGroupName != "") {
           SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshWithGroup( " 
                                 << theSource << ", " << theType << ", \"" << theGroupName << "\" )";
@@ -1083,7 +979,6 @@ bool GHS3DPlugin_Hypothesis_i::p_SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSo
           SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMesh( " 
                                 << theSource << ", " << theType << " )";
         }
-      }
       return res;
     }
     catch (const std::invalid_argument& ex) {
@@ -1098,22 +993,11 @@ bool GHS3DPlugin_Hypothesis_i::p_SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSo
       THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
     }
   }
-  else if (theGroupOnGeom_i && types->length() == 1 && types[0] == theType)
+  else if (theGroupOnGeom_i)// && types->length() == 1 && types[0] == theType)
   {
     MESSAGE("The source is a group on geom")
     try {
-      bool res = this->GetImpl()->SetEnforcedGroup(theGroupOnGeom_i->GetGroupDS()->GetMesh(),theGroupOnGeom_i->GetListOfID(), theType, SObj->GetName() , SObj->GetID(), theSize, theGroupName);
-      if (theSize > 0) {
-        if (theGroupName != "") {
-          SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshSizeWithGroup( " 
-                                << theSource << ", " << theType << ", " << theSize << ", \"" << theGroupName << "\" )";
-        }
-        else {
-          SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshSize( " 
-                                << theSource << ", " << theType << ", " << theSize << ", \"" << theGroupName << "\" )";
-        }
-      }
-      else {
+       bool res = this->GetImpl()->SetEnforcedGroup(theGroupOnGeom_i->GetGroupDS()->GetMesh(),theGroupOnGeom_i->GetListOfID(), theType, enfMeshName , SObj->GetID(), theGroupName);
         if (theGroupName != "") {
           SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMeshWithGroup( " 
                                 << theSource << ", " << theType << ", \"" << theGroupName << "\" )";
@@ -1122,7 +1006,6 @@ bool GHS3DPlugin_Hypothesis_i::p_SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSo
           SMESH::TPythonDump () << "isDone = " << _this() << ".SetEnforcedMesh( " 
                                 << theSource << ", " << theType << " )";
         }
-      }
       return res;
     }
     catch (const std::invalid_argument& ex) {
index 7ca3cac9709be1b242be7c1e5cbd68f21bf85849..62ae16edacc916a779ab0b2aea19f068858972ca 100644 (file)
@@ -144,11 +144,15 @@ class GHS3DPLUGIN_EXPORT GHS3DPlugin_Hypothesis_i:
   /*!
    * To set an enforced mesh
    */  
-  bool p_SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType elementType, double size = -1, const char* theGroupName="") throw (SALOME::SALOME_Exception);
+  bool p_SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType elementType, const char* theName="", const char* theGroupName="") throw (SALOME::SALOME_Exception);
   bool SetEnforcedMesh(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType elementType) throw (SALOME::SALOME_Exception);
   bool SetEnforcedMeshWithGroup(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType elementType, const char* theGroupName) throw (SALOME::SALOME_Exception);
+
+  /* OBSOLETE FUNCTIONS */
   bool SetEnforcedMeshSize(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType elementType, double size) throw (SALOME::SALOME_Exception);
   bool SetEnforcedMeshSizeWithGroup(SMESH::SMESH_IDSource_ptr theSource, SMESH::ElementType elementType, double size, const char* theGroupName) throw (SALOME::SALOME_Exception);
+  /* OBSOLETE FUNCTIONS */
+
   GHS3DPlugin::GHS3DEnforcedMeshList* GetEnforcedMeshes();
   void ClearEnforcedMeshes();
 
index 8516565f798e2e2cad2713a1523c382827088c30..2a2aca8f9881ff9e3813b53472574c354b43e989 100644 (file)
@@ -51,7 +51,6 @@ enum {
   ENF_MESH_NAME_COLUMN = 0,
   ENF_MESH_ENTRY_COLUMN,
   ENF_MESH_CONSTRAINT_COLUMN,
-  ENF_MESH_SIZE_COLUMN,
   ENF_MESH_GROUP_COLUMN,
   ENF_MESH_NB_COLUMNS
 };
@@ -74,7 +73,6 @@ enum {
   ENF_MESH_WARNING = 0,
   ENF_MESH_MESH /*= 0*/,
   ENF_MESH_CONSTRAINT,
-  ENF_MESH_SIZE,
   ENF_MESH_GROUP,
   ENF_MESH_BTN,
   ENF_MESH_NB_LINES
index 6c097cc009c6d355e02e3594665df6d552ecdf43..46a077655ed09ac034e346b4acc4bf1365fc534c 100644 (file)
@@ -287,38 +287,20 @@ EnforcedMeshTableWidgetDelegate::EnforcedMeshTableWidgetDelegate(QObject *parent
 QWidget *EnforcedMeshTableWidgetDelegate::createEditor(QWidget *parent,
                                                   const QStyleOptionViewItem & option ,
                                                   const QModelIndex & index ) const
-{  
-  if (index.column() == ENF_MESH_SIZE_COLUMN) {
-    SMESHGUI_SpinBox *editor = new SMESHGUI_SpinBox(parent);
-    editor->RangeStepAndValidator(0, COORD_MAX, 10.0, "length_precision");
-    return editor;
-  }
+{
   return QItemDelegate::createEditor(parent, option, index);
 }
 
 void EnforcedMeshTableWidgetDelegate::setEditorData(QWidget *editor,
                                                const QModelIndex &index) const
 {
-  if (index.column() == ENF_MESH_SIZE_COLUMN) {
-    SMESHGUI_SpinBox *spinBox = qobject_cast<SMESHGUI_SpinBox*>(editor);
-    spinBox->SetValue(index.data().toDouble());
-  } 
-  else
-    QItemDelegate::setEditorData(editor, index);
+       QItemDelegate::setEditorData(editor, index);
 }
 
 void EnforcedMeshTableWidgetDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
                                               const QModelIndex &index) const
 {  
-  if (index.column() == ENF_MESH_SIZE_COLUMN)
-  {
-    SMESHGUI_SpinBox *spinBox = qobject_cast<SMESHGUI_SpinBox*>(editor);
-    const double newsize =  spinBox->GetValue();
-    if (newsize > 0)
-      model->setData(index, newsize, Qt::EditRole);
-  } 
-  else
-    QItemDelegate::setModelData(editor, model, index);
+  QItemDelegate::setModelData(editor, model, index);
 
 }
 
@@ -590,7 +572,6 @@ QFrame* GHS3DPluginGUI_HypothesisCreator::buildFrame()
   enforcedMeshHeaders << tr( "GHS3D_ENF_NAME_COLUMN" ) 
                       << tr( "GHS3D_ENF_ENTRY_COLUMN" ) 
                       << tr( "GHS3D_ENF_MESH_CONSTRAINT_COLUMN" ) 
-                      << tr( "GHS3D_ENF_SIZE_COLUMN" ) 
                       << tr( "GHS3D_ENF_GROUP_COLUMN" );
   myEnforcedMeshTableWidget->setHorizontalHeaderLabels(enforcedMeshHeaders);
   myEnforcedMeshTableWidget->horizontalHeader()->setStretchLastSection(true);
@@ -616,10 +597,6 @@ QFrame* GHS3DPluginGUI_HypothesisCreator::buildFrame()
   myEnfMeshConstraint->insertItems(0,myEnfMeshConstraintLabels);
   myEnfMeshConstraint->setEditable(false);
   myEnfMeshConstraint->setCurrentIndex(0);
-  
-  QLabel* myMeshSizeLabel = new QLabel( tr( "GHS3D_ENF_SIZE_LABEL" ), myEnfMeshGroup );
-  myMeshSizeValue = new SMESHGUI_SpinBox(myEnfMeshGroup);
-  myMeshSizeValue->RangeStepAndValidator(0, COORD_MAX, 10.0, "length_precision");
 
   QLabel* myMeshGroupNameLabel = new QLabel( tr( "GHS3D_ENF_GROUP_LABEL" ), myEnfMeshGroup );
   myMeshGroupName = new QLineEdit(myEnfMeshGroup);
@@ -644,8 +621,6 @@ QFrame* GHS3DPluginGUI_HypothesisCreator::buildFrame()
   anEnfMeshLayout2->addWidget(myEnfMeshWdg,             ENF_MESH_MESH, 0, 1, 2);
   anEnfMeshLayout2->addWidget(myMeshConstraintLabel,    ENF_MESH_CONSTRAINT, 0, 1, 1);
   anEnfMeshLayout2->addWidget(myEnfMeshConstraint,      ENF_MESH_CONSTRAINT, 1, 1, 1);
-  anEnfMeshLayout2->addWidget(myMeshSizeLabel,          ENF_MESH_SIZE, 0, 1, 1);
-  anEnfMeshLayout2->addWidget(myMeshSizeValue,          ENF_MESH_SIZE, 1, 1, 1);
   anEnfMeshLayout2->addWidget(myMeshGroupNameLabel,     ENF_MESH_GROUP, 0, 1, 1);
   anEnfMeshLayout2->addWidget(myMeshGroupName,          ENF_MESH_GROUP, 1, 1, 1);
   anEnfMeshLayout2->addWidget(addEnfMeshButton,         ENF_MESH_BTN, 0, 1, 1);
@@ -688,7 +663,6 @@ QFrame* GHS3DPluginGUI_HypothesisCreator::buildFrame()
   connect( removeEnfMeshButton,     SIGNAL( clicked()),                       this, SLOT( onRemoveEnforcedMesh() ) );
 //   connect( myEnfMeshWdg,            SIGNAL( contentModified()),              this,  SLOT( checkEnfMeshIsDefined() ) );
 //   connect( myEnfMeshConstraint,     SIGNAL( currentIndexChanged(int) ),      this,  SLOT( checkEnfMeshIsDefined() ) );
-//   connect( myMeshSizeValue,         SIGNAL( textChanged(const QString&) ),   this,  SLOT( checkEnfMeshIsDefined() ) );
 //   connect( this,                    SIGNAL( enfMeshDefined(bool) ), addEnfMeshButton, SLOT( setEnabled(bool) ) );
   
   return fr;
@@ -729,7 +703,7 @@ void GHS3DPluginGUI_HypothesisCreator::checkVertexIsDefined()
 **/
 void GHS3DPluginGUI_HypothesisCreator::checkEnfMeshIsDefined()
 {
-  emit enfMeshDefined((!myMeshSizeValue->GetString().isEmpty() && !myEnfVertexWdg->NbObjects() == 0));
+  emit enfMeshDefined( myEnfVertexWdg->NbObjects() != 0);
 }
 
 /** 
@@ -924,9 +898,9 @@ void GHS3DPluginGUI_HypothesisCreator::synchronizeCoords() {
 /** GHS3DPluginGUI_HypothesisCreator::addEnforcedMesh( meshName, geomEntry, elemType, size, groupName)
 This method adds in the tree widget an enforced mesh from mesh, submesh or group with optionally size and and groupName.
 */
-void GHS3DPluginGUI_HypothesisCreator::addEnforcedMesh(std::string name, std::string entry, int elementType, double size, std::string groupName)
+void GHS3DPluginGUI_HypothesisCreator::addEnforcedMesh(std::string name, std::string entry, int elementType, std::string groupName)
 {
-  MESSAGE("addEnforcedMesh(\"" << name << ", \"" << entry << "\", " << elementType << ", " << size << ", \"" << groupName << "\")");
+  MESSAGE("addEnforcedMesh(\"" << name << ", \"" << entry << "\", " << elementType << ", \"" << groupName << "\")");
   bool okToCreate = true;
   QString itemEntry = "";
   int itemElementType = 0;
@@ -960,11 +934,6 @@ void GHS3DPluginGUI_HypothesisCreator::addEnforcedMesh(std::string name, std::st
       break;
   
     if (itemEntry == QString(entry.c_str()) && itemElementType == elementType) { 
-//       // update size
-//       if (itemSize != size) {
-//         MESSAGE("Size is updated from \"" << itemSize << "\" to \"" << size << "\"");
-//         myEnforcedMeshTableWidget->item(row, ENF_MESH_SIZE_COLUMN)->setData( Qt::EditRole, QVariant(size));
-//       }
 //       // update group name
 //       if (itemGroupName.toStdString() != groupName) {
 //         MESSAGE("Group is updated from \"" << itemGroupName.toStdString() << "\" to \"" << groupName << "\"");
@@ -1013,11 +982,6 @@ void GHS3DPluginGUI_HypothesisCreator::addEnforcedMesh(std::string name, std::st
           MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
           myEnforcedMeshTableWidget->setItem(rowCount,col,item);
           break;
-        case ENF_MESH_SIZE_COLUMN:
-          item->setData( 0, size );
-          MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
-          myEnforcedMeshTableWidget->setItem(rowCount,col,item);
-          break;
         case ENF_MESH_GROUP_COLUMN:
           item->setData( 0, groupName.c_str() );
           MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
@@ -1233,12 +1197,6 @@ void GHS3DPluginGUI_HypothesisCreator::onAddEnforcedMesh()
     groupName = "";
 
   
-  double size = -1;
-  if (!myMeshSizeValue->GetString().isEmpty())
-    size = myMeshSizeValue->GetValue();
-//   if (size < 0)
-//     return;
-  
   int elementType = myEnfMeshConstraint->currentIndex();
   
   
@@ -1256,7 +1214,7 @@ void GHS3DPluginGUI_HypothesisCreator::onAddEnforcedMesh()
     CORBA::Object_var anObj = SMESH::SObjectToObject(aSObj,aStudy);
     if (!CORBA::is_nil(anObj)) {
 //       SMESH::SMESH_IDSource_var theSource = SMESH::SObjectToInterface<SMESH::SMESH_IDSource>( aSObj );
-      addEnforcedMesh( aSObj->GetName(), aSObj->GetID(), elementType, size, groupName);
+      addEnforcedMesh( aSObj->GetName(), aSObj->GetID(), elementType, groupName);
     }
   }
   else
@@ -1269,7 +1227,7 @@ void GHS3DPluginGUI_HypothesisCreator::onAddEnforcedMesh()
       CORBA::Object_var anObj = SMESH::SObjectToObject(aSObj,aStudy);
       if (!CORBA::is_nil(anObj)) {
 //         SMESH::SMESH_IDSource_var theSource = SMESH::SObjectToInterface<SMESH::SMESH_IDSource>( aSObj );
-        addEnforcedMesh( aSObj->GetName(), aSObj->GetID(), elementType, size, groupName);
+        addEnforcedMesh( aSObj->GetName(), aSObj->GetID(), elementType, groupName);
       }
     }
   }
@@ -1477,6 +1435,7 @@ void GHS3DPluginGUI_HypothesisCreator::retrieveParams() const
 
   TEnfVertexList::const_iterator it;
   int rowCount = 0;
+  myEnforcedTableWidget->clear();
   myEnforcedTableWidget->setSortingEnabled(false);
   myEnforcedTableWidget->disconnect(SIGNAL( itemChanged(QTableWidgetItem *)));
   for(it = data.myEnforcedVertices.begin() ; it != data.myEnforcedVertices.end(); it++ )
@@ -1556,6 +1515,7 @@ void GHS3DPluginGUI_HypothesisCreator::retrieveParams() const
   // Update Enforced meshes QTableWidget
   TEnfMeshList::const_iterator itMesh;
   rowCount = 0;
+  myEnforcedMeshTableWidget->clear();
   myEnforcedMeshTableWidget->setSortingEnabled(false);
 //   myEnforcedMeshTableWidget->disconnect(SIGNAL( itemChanged(QTableWidgetItem *)));
   for(itMesh = data.myEnforcedMeshes.begin() ; itMesh != data.myEnforcedMeshes.end(); itMesh++ )
@@ -1592,11 +1552,6 @@ void GHS3DPluginGUI_HypothesisCreator::retrieveParams() const
             MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
             myEnforcedMeshTableWidget->setItem(rowCount,col,item);
             break;
-          case ENF_MESH_SIZE_COLUMN:
-            item->setData( 0, enfMesh->size );
-            MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
-            myEnforcedMeshTableWidget->setItem(rowCount,col,item);
-            break;
           case ENF_MESH_GROUP_COLUMN:
             item->setData( 0, enfMesh->groupName.c_str() );
             MESSAGE("Add item in table at (" << rowCount << "," << col << "): " << item->text().toStdString());
@@ -1739,7 +1694,6 @@ bool GHS3DPluginGUI_HypothesisCreator::readParamsFromHypo( GHS3DHypothesisData&
     myEnfMesh->name = CORBA::string_dup(enfMeshes[i].name.in());
     myEnfMesh->entry = CORBA::string_dup(enfMeshes[i].entry.in());
     myEnfMesh->groupName = CORBA::string_dup(enfMeshes[i].groupName.in());
-    myEnfMesh->size = enfMeshes[i].size;
     switch (enfMeshes[i].elementType) {
       case SMESH::NODE:
         myEnfMesh->elementType = 0;
@@ -1838,14 +1792,17 @@ bool GHS3DPluginGUI_HypothesisCreator::storeParamsToHypo( const GHS3DHypothesisD
       h->ClearEnforcedMeshes();
     
     TEnfMeshList::const_iterator itEnfMesh;
+
     _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
+
     for(itEnfMesh = h_data.myEnforcedMeshes.begin() ; itEnfMesh != h_data.myEnforcedMeshes.end(); itEnfMesh++ ) {
       TEnfMesh* enfMesh = (*itEnfMesh);
-      
+
       _PTR(SObject) aSObj = aStudy->FindObjectID(enfMesh->entry.c_str());
       SMESH::SMESH_IDSource_var theSource = SMESH::SObjectToInterface<SMESH::SMESH_IDSource>( aSObj );
-      SMESH::ElementType elementType;
+
       MESSAGE("enfMesh->elementType: " << enfMesh->elementType);
+      SMESH::ElementType elementType;
       switch(enfMesh->elementType) {
         case 0:
           elementType = SMESH::NODE;
@@ -1860,7 +1817,8 @@ bool GHS3DPluginGUI_HypothesisCreator::storeParamsToHypo( const GHS3DHypothesisD
           break;
       }
     
-      ok = h->p_SetEnforcedMesh(theSource, elementType, enfMesh->size, enfMesh->groupName.c_str());
+      std::cout << "h->p_SetEnforcedMesh(theSource, "<< elementType <<", \""<< enfMesh->name << "\", \"" << enfMesh->groupName.c_str() <<"\")"<<std::endl;
+      ok = h->p_SetEnforcedMesh(theSource, elementType, enfMesh->name.c_str(), enfMesh->groupName.c_str());
     } // for
   } // try
 //   catch(const std::exception& ex) {
@@ -1936,12 +1894,11 @@ bool GHS3DPluginGUI_HypothesisCreator::readParamsFromWidgets( GHS3DHypothesisDat
     MESSAGE("Entry is \"" << myEnfMesh->entry << "\"" );
     myEnfMesh->groupName = myEnforcedMeshTableWidget->item(row,ENF_MESH_GROUP_COLUMN)->data(Qt::EditRole).toString().toStdString();
     MESSAGE("Group name is \"" << myEnfMesh->groupName << "\"" );
-    myEnfMesh->size = myEnforcedMeshTableWidget->item(row,ENF_MESH_SIZE_COLUMN)->data(Qt::EditRole).toDouble();
-    MESSAGE("Size is " << myEnfMesh->size);
     QComboBox* combo = qobject_cast<QComboBox*>(myEnforcedMeshTableWidget->cellWidget(row,ENF_MESH_CONSTRAINT_COLUMN));
     myEnfMesh->elementType = combo->currentIndex();
     MESSAGE("Element type: " << myEnfMesh->elementType);
     h_data.myEnforcedMeshes.insert(myEnfMesh);
+    std::cout << "h_data.myEnforcedMeshes.size(): " << h_data.myEnforcedMeshes.size() << std::endl;
   }
 
   return true;
index 693f9ce5d95661af3bc6c4889299564bb21bee04..0aab3e982bdb577973a1a058d842088ac1d24232 100644 (file)
@@ -120,7 +120,6 @@ struct TEnfMesh{
   std::string entry;
   int elementType;
   std::string groupName;
-  double size;
 };
 
 struct CompareEnfMeshes
@@ -188,7 +187,7 @@ protected slots:
   void                checkVertexIsDefined();
   void                clearEnfVertexSelection();
   
-  void                addEnforcedMesh(std::string name, std::string entry, int elementType, double size = 0, std::string groupName = "");
+  void                addEnforcedMesh(std::string name, std::string entry, int elementType, std::string groupName = "");
   void                onAddEnforcedMesh();
   void                onRemoveEnforcedMesh();
   //void                synchronizeEnforcedMesh();
@@ -247,7 +246,6 @@ private:
   QStringList         myEnfMeshConstraintLabels;
 //   SMESH::mesh_array_var myEnfMeshArray;
   QTableWidget*       myEnforcedMeshTableWidget;
-  SMESHGUI_SpinBox*   myMeshSizeValue;
   QLineEdit*          myMeshGroupName;
   QPushButton*        addEnfMeshButton;
   QPushButton*        removeEnfMeshButton;