Salome HOME
23586: [EDF] HYDRO: Copy mesh to new geometry hydro/imps_2018 HYDRO_V2_0_0
authoreap <eap@opencascade.com>
Tue, 18 Sep 2018 14:10:30 +0000 (17:10 +0300)
committereap <eap@opencascade.com>
Tue, 18 Sep 2018 14:10:30 +0000 (17:10 +0300)
idl/BLSURFPlugin_Algorithm.idl
src/BLSURFPlugin/BLSURFPlugin_Hypothesis.cxx
src/BLSURFPlugin/BLSURFPlugin_Hypothesis.hxx
src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.cxx
src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.hxx
src/GUI/BLSURFPluginGUI_HypothesisCreator.cxx

index e02d105a7e07ba5602f4bf4441bcdeb79099664f..59f8dfc435d4cae449aad6317a5da1e1a081ad22 100644 (file)
@@ -674,32 +674,8 @@ module BLSURFPlugin
     /*!
      * Sets the file for export resulting mesh in GMF format
      */
-//     void SetGMFFile(in string theFileName, in boolean isBinary);
     void SetGMFFile(in string theFileName);
     string GetGMFFile();
-//     boolean GetGMFFileMode();
-
-    //
-    // Obsolete methods - To be removed in V7
-    //
-    void SetPhyMin(in double theMinSize);
-    double GetPhyMin();
-    void SetPhyMax(in double theMaxSize);
-    double GetPhyMax();
-    void SetGeoMin(in double theMinSize);
-    double GetGeoMin();
-    void SetGeoMax(in double theMaxSize);
-    double GetGeoMax();
-    void SetAngleMeshS(in double angle);
-    double GetAngleMeshS();
-    void SetAngleMeshC(in double angle);
-    double GetAngleMeshC();
-    void SetDecimesh(in boolean toIgnoreEdges);
-    boolean GetDecimesh();
-    void SetPreCADRemoveNanoEdges(in boolean toRemoveNanoEdges);
-    boolean GetPreCADRemoveNanoEdges();
-    void SetPreCADEpsNano(in double epsNano);
-    double GetPreCADEpsNano();
   };
 };
 
index 4eed18794c86aa4104f26cd63f8ab379d30e0f47..2f55f2ffe3b4cc123e3bebc3c0d4603948e54b6b 100644 (file)
@@ -1446,16 +1446,10 @@ bool BLSURFPlugin_Hypothesis::SetEnforcedVertex(TEntry        theFaceEntry,
 //   //////// CREATE ////////////
   if (toCreate) {
     toNotify = true;
-    _faceEntryEnfVertexListMap[theFaceEntry].insert(newEnfVertex);
-    _enfVertexList.insert(newEnfVertex);
-    if (theVertexEntry == "") {
-      _faceEntryCoordsListMap[theFaceEntry].insert(newEnfVertex->coords);
-      _coordsEnfVertexMap[newEnfVertex->coords] = newEnfVertex;
-    }
-    else {
-      _faceEntryEnfVertexEntryListMap[theFaceEntry].insert(newEnfVertex->geomEntry);
-      _enfVertexEntryEnfVertexMap[newEnfVertex->geomEntry] = newEnfVertex;
-    }
+    AddEnforcedVertex( theFaceEntry, newEnfVertex );
+  }
+  else {
+    delete newEnfVertex;
   }
 
   if (toNotify)
@@ -1464,6 +1458,27 @@ bool BLSURFPlugin_Hypothesis::SetEnforcedVertex(TEntry        theFaceEntry,
   return toNotify;
 }
 
+//=======================================================================
+//function : AddEnforcedVertex
+//=======================================================================
+
+void BLSURFPlugin_Hypothesis::AddEnforcedVertex( const TEntry& faceEntry,
+                                                 TEnfVertex *  newEnfVertex )
+{
+  if ( newEnfVertex )
+  {
+    _faceEntryEnfVertexListMap[faceEntry].insert(newEnfVertex);
+    _enfVertexList.insert(newEnfVertex);
+    if ( newEnfVertex->geomEntry.empty() ) {
+      _faceEntryCoordsListMap[faceEntry].insert(newEnfVertex->coords);
+      _coordsEnfVertexMap[newEnfVertex->coords] = newEnfVertex;
+    }
+    else {
+      _faceEntryEnfVertexEntryListMap[faceEntry].insert(newEnfVertex->geomEntry);
+      _enfVertexEntryEnfVertexMap[newEnfVertex->geomEntry] = newEnfVertex;
+    }
+  }
+}
 
 //=======================================================================
 //function : GetEnforcedVertices
@@ -1708,18 +1723,25 @@ bool BLSURFPlugin_Hypothesis::ClearEnforcedVertices(const TEntry& theFaceEntry)
 //=======================================================================
 //function : ClearAllEnforcedVertices
 //=======================================================================
-void BLSURFPlugin_Hypothesis::ClearAllEnforcedVertices() {
+void BLSURFPlugin_Hypothesis::ClearAllEnforcedVertices()
+{
   _faceEntryEnfVertexListMap.clear();
-  _enfVertexList.clear();
   _faceEntryCoordsListMap.clear();
   _coordsEnfVertexMap.clear();
   _faceEntryEnfVertexEntryListMap.clear();
   _enfVertexEntryEnfVertexMap.clear();
+  
+  TEnfVertexList::iterator it_enfVertex = _enfVertexList.begin();
+  for ( ; it_enfVertex != _enfVertexList.end(); ++it_enfVertex )
+    delete *it_enfVertex;
+  _enfVertexList.clear();
+
 //  Enable internal enforced vertices on specific face if requested by user
 //  _faceEntryInternalVerticesList.clear();
   NotifySubMeshesHypothesisModification();
 }
 
+
 //================================================================================
 /*!
  * \brief Return the enforced vertices
@@ -2823,7 +2845,7 @@ std::istream & BLSURFPlugin_Hypothesis::LoadFrom(std::istream & load)
         break;
       isOK = static_cast<bool>(load >> newAtShapeEntry);
       if (!isOK)
-    break;
+        break;
       isOK = static_cast<bool>(load >> attParams[0]>>attParams[1]>>attParams[2]>>attParams[3]); //>>step);
     }
     if (isOK) {
@@ -2983,6 +3005,22 @@ std::istream & BLSURFPlugin_Hypothesis::LoadFrom(std::istream & load)
     }
   }
 
+  if ( hasEnforcedVertex ) {
+    isOK = static_cast<bool>(load >> option_or_sm);
+    if (isOK) {
+      if (option_or_sm == "__PRECAD_FACES_PERIODICITY_BEGIN__")
+        hasPreCADFacesPeriodicity = true;
+      else if (option_or_sm == "__PRECAD_EDGES_PERIODICITY_BEGIN__")
+        hasPreCADEdgesPeriodicity = true;
+      else if (option_or_sm == "__FACES_PERIODICITY_BEGIN__")
+        hasFacesPeriodicity = true;
+      else if (option_or_sm == "__EDGES_PERIODICITY_BEGIN__")
+        hasEdgesPeriodicity = true;
+      else if (option_or_sm == "__VERTICES_PERIODICITY_BEGIN__")
+        hasVerticesPeriodicity = true;
+    }
+  }
+
   // PERIODICITY
 
   if (hasPreCADFacesPeriodicity)
index f44510593f155356210a2d475aba87d5480b4414..a93d327b91c0a8a4935444855b7a00d0e2ca259f 100644 (file)
@@ -373,15 +373,16 @@ public:
   bool ClearEnforcedVertices(const TEntry& theFaceEntry) throw (std::invalid_argument);
 
   void ClearAllEnforcedVertices();
+  void AddEnforcedVertex( const TEntry& theFaceEntry, TEnfVertex * theEnfVertex );
 
-  const TFaceEntryEnfVertexListMap  _GetAllEnforcedVerticesByFace() const { return _faceEntryEnfVertexListMap; }
-  const TEnfVertexList              _GetAllEnforcedVertices() const { return _enfVertexList; }
+  const TFaceEntryEnfVertexListMap&  _GetAllEnforcedVerticesByFace() const { return _faceEntryEnfVertexListMap; }
+  const TEnfVertexList&              _GetAllEnforcedVertices() const { return _enfVertexList; }
 
-  const TFaceEntryCoordsListMap     _GetAllCoordsByFace() const { return _faceEntryCoordsListMap; }
-  const TCoordsEnfVertexMap         _GetAllEnforcedVerticesByCoords() const { return _coordsEnfVertexMap; }
+  const TFaceEntryCoordsListMap&     _GetAllCoordsByFace() const { return _faceEntryCoordsListMap; }
+  const TCoordsEnfVertexMap&         _GetAllEnforcedVerticesByCoords() const { return _coordsEnfVertexMap; }
 
-  const TFaceEntryEnfVertexEntryListMap _GetAllEnfVertexEntriesByFace() const { return _faceEntryEnfVertexEntryListMap; }
-  const TEnfVertexEntryEnfVertexMap     _GetAllEnforcedVerticesByEnfVertexEntry() const { return _enfVertexEntryEnfVertexMap; }
+  const TFaceEntryEnfVertexEntryListMap& _GetAllEnfVertexEntriesByFace() const { return _faceEntryEnfVertexEntryListMap; }
+  const TEnfVertexEntryEnfVertexMap&     _GetAllEnforcedVerticesByEnfVertexEntry() const { return _enfVertexEntryEnfVertexMap; }
 
 //   TODO GROUPS
 //   const TEnfVertexGroupNameMap _GetEnforcedVertexGroupNameMap() const { return _enfVertexGroupNameMap; }
@@ -480,23 +481,23 @@ public:
 //  const TPreCadPeriodicityEntriesVector _GetPreCadFacesPeriodicityEntries() const { return _preCadFacesPeriodicityEntriesVector; }
 
   static TPreCadPeriodicityVector GetDefaultPreCadFacesPeriodicityVector() { return TPreCadPeriodicityVector(); }
-  const TPreCadPeriodicityVector  _GetPreCadFacesPeriodicityVector() const { return _preCadFacesPeriodicityVector; }
+  const TPreCadPeriodicityVector&  _GetPreCadFacesPeriodicityVector() const { return _preCadFacesPeriodicityVector; }
   static TPreCadPeriodicityVector GetPreCadFacesPeriodicityVector(const BLSURFPlugin_Hypothesis* hyp);
 
   static TPreCadPeriodicityVector GetDefaultPreCadEdgesPeriodicityVector() { return TPreCadPeriodicityVector(); }
-  const TPreCadPeriodicityVector  _GetPreCadEdgesPeriodicityVector() const { return _preCadEdgesPeriodicityVector; }
+  const TPreCadPeriodicityVector&  _GetPreCadEdgesPeriodicityVector() const { return _preCadEdgesPeriodicityVector; }
   static TPreCadPeriodicityVector GetPreCadEdgesPeriodicityVector(const BLSURFPlugin_Hypothesis* hyp);
 
   static TFacesPeriodicityVector GetDefaultFacesPeriodicityVector() { return TFacesPeriodicityVector(); }
-  const TFacesPeriodicityVector  _GetFacesPeriodicityVector() const { return _facesPeriodicityVector; }
+  const TFacesPeriodicityVector&  _GetFacesPeriodicityVector() const { return _facesPeriodicityVector; }
   static TFacesPeriodicityVector GetFacesPeriodicityVector(const BLSURFPlugin_Hypothesis* hyp);
 
   static TEdgesPeriodicityVector GetDefaultEdgesPeriodicityVector() { return TEdgesPeriodicityVector(); }
-  const TEdgesPeriodicityVector  _GetEdgesPeriodicityVector() const { return _edgesPeriodicityVector; }
+  const TEdgesPeriodicityVector&  _GetEdgesPeriodicityVector() const { return _edgesPeriodicityVector; }
   static TEdgesPeriodicityVector GetEdgesPeriodicityVector(const BLSURFPlugin_Hypothesis* hyp);
 
   static TVerticesPeriodicityVector GetDefaultVerticesPeriodicityVector() { return TVerticesPeriodicityVector(); }
-  const TVerticesPeriodicityVector  _GetVerticesPeriodicityVector() const { return _verticesPeriodicityVector; }
+  const TVerticesPeriodicityVector&  _GetVerticesPeriodicityVector() const { return _verticesPeriodicityVector; }
   static TVerticesPeriodicityVector GetVerticesPeriodicityVector(const BLSURFPlugin_Hypothesis* hyp);
 
   void ClearPreCadPeriodicityVectors();
@@ -605,8 +606,6 @@ private:
   TSizeMap        _sizeMap;
   TSizeMap        _attractors;
   TAttractorMap   _classAttractors;
-  TSizeMap        _attEntry;
-  TParamsMap      _attParams;
 
   TFaceEntryEnfVertexListMap      _faceEntryEnfVertexListMap;
   TEnfVertexList                  _enfVertexList;
index db1eb65427b98fc70479ed3e9e44720018443c79..2df6caac9c2db1b1add8cee4ae35b749a11eafca 100644 (file)
@@ -1743,7 +1743,7 @@ void BLSURFPlugin_Hypothesis_i::SetConstantSizeMapEntry(const char* entry, GEOM:
     THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
   }
   if (valueChanged)
-    SMESH::TPythonDump() << _this() << ".SetConstantSizeMap(" << entry << ", '" << sizeMap << "' )";
+    SMESH::TPythonDump() << _this() << ".SetConstantSizeMap(" << entry << ", " << sizeMap << " )";
 }
 
 //=============================================================================
@@ -3860,85 +3860,249 @@ char* BLSURFPlugin_Hypothesis_i::GetGMFFile() {
 
 //================================================================================
 /*!
- * \brief Verify whether hypothesis supports given entity type 
+ * \brief Verify whether hypothesis supports given entity type
  * \param type - dimension (see SMESH::Dimension enumeration)
  * \retval CORBA::Boolean - TRUE if dimension is supported, FALSE otherwise
- * 
+ *
  * Verify whether hypothesis supports given entity type (see SMESH::Dimension enumeration)
  */
-//================================================================================  
+//================================================================================
 CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsDimSupported(SMESH::Dimension type) {
   return type == SMESH::DIM_2D;
 }
 
-//
-// Obsolete methods - To be removed in V7
-//
 
-void BLSURFPlugin_Hypothesis_i::SetPhyMin(CORBA::Double theMinSize) {
-  this->SetMinSize(theMinSize);
-}
-CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhyMin() {
-  return this->GetMinSize();
-}
-void BLSURFPlugin_Hypothesis_i::SetPhyMax(CORBA::Double theMaxSize) {
-  this->SetMaxSize(theMaxSize);
-}
-CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhyMax() {
-  return this->GetMaxSize();
-}
-void BLSURFPlugin_Hypothesis_i::SetGeoMin(CORBA::Double theMinSize) {
-  this->SetMinSize(theMinSize);
-}
-CORBA::Double BLSURFPlugin_Hypothesis_i::GetGeoMin() {
-  return this->GetMinSize();
-}
-void BLSURFPlugin_Hypothesis_i::SetGeoMax(CORBA::Double theMaxSize) {
-  this->SetMaxSize(theMaxSize);
-}
-CORBA::Double BLSURFPlugin_Hypothesis_i::GetGeoMax() {
-  return this->GetMaxSize();
-}
-void BLSURFPlugin_Hypothesis_i::SetAngleMeshS(CORBA::Double theValue) {
-  this->SetAngleMesh(theValue);
-}
-CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMeshS() {
-  return this->GetAngleMesh();
-}
-void BLSURFPlugin_Hypothesis_i::SetAngleMeshC(CORBA::Double theValue) {
-  this->SetAngleMesh(theValue);
-}
-CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMeshC() {
-  return this->GetAngleMesh();
-}
-void BLSURFPlugin_Hypothesis_i::SetDecimesh(CORBA::Boolean theValue) {
-  std::string theValueStr = theValue ? "1" : "0";
-  this->SetOptionValue("respect_geometry",theValueStr.c_str());
-}
-CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetDecimesh() {
-  std::string theValueStr = this->GetOptionValue("respect_geometry");
-  if (theValueStr.empty() || theValueStr == "respect")
-    return true;
-  return false;
-}
-void BLSURFPlugin_Hypothesis_i::SetPreCADRemoveNanoEdges(CORBA::Boolean theValue) {
-  std::string theValueStr = theValue ? "1" : "0";
-  this->AddPreCADOption("remove_tiny_edges",theValueStr.c_str());
-}
-CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetPreCADRemoveNanoEdges() {
-  std::string theValueStr = this->GetPreCADOption("remove_tiny_edges");
-  if (theValueStr == "1")
-    return true;
-  return false;
-}
-void BLSURFPlugin_Hypothesis_i::SetPreCADEpsNano(CORBA::Double theValue) {
-  std::ostringstream theValueStr;
-  theValueStr << theValue;
-  this->AddPreCADOption("tiny_edge_length",theValueStr.str().c_str());
+//================================================================================
+/*!
+ * \brief Return geometry this hypothesis depends on. Return false if there is no geometry parameter
+ */
+//================================================================================
+
+bool
+BLSURFPlugin_Hypothesis_i::getObjectsDependOn( std::vector< std::string > & entryArray,
+                                               std::vector< int >         & subIDArray ) const
+{
+  typedef ::BLSURFPlugin_Hypothesis BH;
+  const BH* impl = static_cast<const BH*>( myBaseImpl );
+
+  {
+    const BH::TSizeMap& sizeMap = impl->_GetSizeMapEntries();
+    BH::TSizeMap::const_iterator entry2size = sizeMap.cbegin();
+    for ( ; entry2size != sizeMap.cend(); ++entry2size )
+      entryArray.push_back( entry2size->first );
+  }
+  {
+    const BH::TSizeMap& sizeMap = impl->_GetAttractorEntries();
+    BH::TSizeMap::const_iterator entry2size = sizeMap.cbegin();
+    for ( ; entry2size != sizeMap.cend(); ++entry2size )
+      entryArray.push_back( entry2size->first );
+  }
+  {
+    const BH::TAttractorMap& classAttractors = impl-> _GetClassAttractorEntries();
+    BH::TAttractorMap::const_iterator entry2size = classAttractors.cbegin();
+    for ( ; entry2size != classAttractors.cend(); ++entry2size )
+      entryArray.push_back( entry2size->first );
+  }
+  {
+    const BH::TFaceEntryEnfVertexListMap& faceEntryEnfVertexListMap = impl->_GetAllEnforcedVerticesByFace();
+    BH::TFaceEntryEnfVertexListMap::const_iterator entry2evList = faceEntryEnfVertexListMap.cbegin();
+    for ( ; entry2evList != faceEntryEnfVertexListMap.cend(); ++entry2evList )
+    {
+      entryArray.push_back( entry2evList->first );
+
+      const BH::TEnfVertexList& evList = entry2evList->second;
+      BH::TEnfVertexList::const_iterator evIt = evList.cbegin();
+      for ( ; evIt != evList.cend(); ++evIt )
+      {
+        const BH::TEnfVertex* ev = *evIt;
+        entryArray.push_back( ev->geomEntry );
+        entryArray.insert( entryArray.end(), ev->faceEntries.cbegin(), ev->faceEntries.cend() );
+      }
+    }
+  }
+  // { // duplicated data of faceEntryEnfVertexListMap
+  //   const BH::TEnfVertexList& enfVertexList = impl->_GetAllEnforcedVertices();
+  //   const BH::TFaceEntryCoordsListMap& faceEntryCoordsListMap = impl->_GetAllCoordsByFace();
+  //   const BH::TFaceEntryEnfVertexEntryListMap& faceEntryEnfVertexEntryListMap = impl->_GetAllEnfV  //   const BH::TEnfVertexEntryEnfVertexMap& enfVertexEntryEnfVertexMap = impl->_GetAllEnforcedVert  // }
+  {
+    const BH::TPreCadPeriodicityVector& preCadFacesPeriodicityVector = impl->_GetPreCadFacesPeriodicityVector();
+    BH::TPreCadPeriodicityVector::const_iterator pcp = preCadFacesPeriodicityVector.cbegin();
+    for ( ; pcp != preCadFacesPeriodicityVector.cend(); ++pcp )
+    {
+      entryArray.push_back( pcp->shape1Entry );
+      entryArray.push_back( pcp->shape2Entry );
+      entryArray.insert( entryArray.end(),
+                         pcp->theSourceVerticesEntries.cbegin(),
+                         pcp->theSourceVerticesEntries.cend() );
+      entryArray.insert( entryArray.end(),
+                         pcp->theTargetVerticesEntries.cbegin(),
+                         pcp->theTargetVerticesEntries.cend() );
+    }
+  }
+  {
+    const BH::TPreCadPeriodicityVector& preCadEdgesPeriodicityVector = impl->_GetPreCadEdgesPeriodicityVector();
+    BH::TPreCadPeriodicityVector::const_iterator pcp = preCadEdgesPeriodicityVector.cbegin();
+    for ( ; pcp != preCadEdgesPeriodicityVector.cend(); ++pcp )
+    {
+      entryArray.push_back( pcp->shape1Entry );
+      entryArray.push_back( pcp->shape2Entry );
+      entryArray.insert( entryArray.end(),
+                         pcp->theSourceVerticesEntries.cbegin(),
+                         pcp->theSourceVerticesEntries.cend() );
+      entryArray.insert( entryArray.end(),
+                         pcp->theTargetVerticesEntries.cbegin(),
+                         pcp->theTargetVerticesEntries.cend() );
+    }
+  }
+  {
+    const BH::THyperPatchList& hyperPatchList = impl->GetHyperPatches();
+    BH::THyperPatchList::const_iterator idSet = hyperPatchList.cbegin();
+    for ( ; idSet != hyperPatchList.cend(); ++idSet )
+    {
+      subIDArray.insert( subIDArray.end(), idSet->cbegin(), idSet->cend() );
+    }
+  }
+  return true;
 }
-CORBA::Double BLSURFPlugin_Hypothesis_i::GetPreCADEpsNano() {
-  std::istringstream theValueStr(this->GetPreCADOption("tiny_edge_length"));
-  double result;
-  theValueStr >> result;
-  return result;
+
+//================================================================================
+/*!
+ * \brief Set new geometry instead of that returned by getObjectsDependOn()
+ */
+//================================================================================
+
+bool
+BLSURFPlugin_Hypothesis_i::setObjectsDependOn( std::vector< std::string > & entryArray,
+                                               std::vector< int >         & subIDArray )
+{
+  typedef ::BLSURFPlugin_Hypothesis BH;
+  BH* impl = static_cast<BH*>( myBaseImpl );
+
+  size_t iEnt = 0;
+  {
+    BH::TSizeMap& sizeMapNew = const_cast< BH::TSizeMap& >( impl->_GetSizeMapEntries() );
+    BH::TSizeMap sizeMap;
+    sizeMap.swap( sizeMapNew );
+    BH::TSizeMap::const_iterator entry2size = sizeMap.cbegin();
+    for ( ; entry2size != sizeMap.cend(); ++entry2size, ++iEnt )
+      if ( entryArray[ iEnt ].empty() == entry2size->first.empty() )
+        sizeMapNew[ entryArray[ iEnt ]] =  entry2size->second;
+  }
+  {
+    BH::TSizeMap& sizeMapNew = const_cast< BH::TSizeMap& >( impl->_GetAttractorEntries() );
+    BH::TSizeMap sizeMap;
+    sizeMap.swap( sizeMapNew );
+    BH::TSizeMap::const_iterator entry2size = sizeMap.cbegin();
+    for ( ; entry2size != sizeMap.cend(); ++entry2size, ++iEnt )
+      if ( entryArray[ iEnt ].empty() == entry2size->first.empty() )
+        sizeMapNew[ entryArray[ iEnt ]] =  entry2size->second;
+  }
+  {
+    BH::TAttractorMap& attrMapNew =
+      const_cast< BH::TAttractorMap& > ( impl->_GetClassAttractorEntries() );
+    BH::TAttractorMap attrMap;
+    attrMap.swap( attrMapNew );
+    BH::TAttractorMap::const_iterator entry2size = attrMap.cbegin();
+    for ( ; entry2size != attrMap.cend(); ++entry2size, ++iEnt )
+      if ( entryArray[ iEnt ].empty() == entry2size->first.empty() )
+        attrMapNew.insert( std::make_pair( entryArray[ iEnt ], entry2size->second ));
+      else
+        delete entry2size->second;
+  }
+  {
+    BH::TFaceEntryEnfVertexListMap& faceEntryEnfVertexListMapNew =
+      const_cast< BH::TFaceEntryEnfVertexListMap& >( impl->_GetAllEnforcedVerticesByFace() );
+    BH::TFaceEntryEnfVertexListMap faceEntryEnfVertexListMap;
+    faceEntryEnfVertexListMap.swap( faceEntryEnfVertexListMapNew );
+
+    BH::TEnfVertexList& enfVertexList =
+      const_cast< BH::TEnfVertexList& > ( impl->_GetAllEnforcedVertices() );
+    enfVertexList.clear(); // avoid removal
+
+    impl->ClearAllEnforcedVertices();
+
+    BH::TFaceEntryEnfVertexListMap::iterator entry2evList = faceEntryEnfVertexListMap.begin();
+    for ( ; entry2evList != faceEntryEnfVertexListMap.end(); ++entry2evList )
+    {
+      const BH::TEntry& entry = entryArray[ iEnt++ ];
+      bool faceOk = ( entry.empty() == entry2evList->first.empty() );
+
+      BH::TEnfVertexList& evList = entry2evList->second;
+      BH::TEnfVertexList::iterator evIt = evList.begin();
+      for ( ; evIt != evList.end(); ++evIt )
+      {
+        BH::TEnfVertex* ev = *evIt;
+        bool ok = faceOk && ( ev->geomEntry.empty() != entryArray[ iEnt ].empty() );
+        ev->geomEntry = entryArray[ iEnt++ ];
+        BH::TEntryList faceEntriesNew;
+        BH::TEntryList::iterator fEnt = ev->faceEntries.begin();
+        for ( ; fEnt != ev->faceEntries.end(); ++fEnt, ++iEnt )
+        {
+          if ( !entryArray[ iEnt ].empty() )
+            faceEntriesNew.insert( entryArray[ iEnt ]);
+        }
+        if ( ok )
+        {
+          ev->faceEntries.swap( faceEntriesNew );
+          impl->AddEnforcedVertex( entry, ev );
+        }
+        else
+        {
+          delete ev;
+        }
+      }
+    }
+  }
+  {
+    BH::TPreCadPeriodicityVector& preCadPeriodicityVector =
+      const_cast< BH::TPreCadPeriodicityVector&> ( impl->_GetPreCadFacesPeriodicityVector() );
+    BH::TPreCadPeriodicityVector::iterator pcp = preCadPeriodicityVector.begin();
+    for ( ; pcp != preCadPeriodicityVector.end(); ++pcp )
+    {
+      pcp->shape1Entry = entryArray[ iEnt++ ];
+      pcp->shape2Entry = entryArray[ iEnt++ ];
+      for ( size_t i = 0; i < pcp->theSourceVerticesEntries.size(); ++i, iEnt++ )
+        pcp->theSourceVerticesEntries[i] = entryArray[ iEnt ];
+
+      for ( size_t i = 0; i < pcp->theTargetVerticesEntries.size(); ++i, iEnt++ )
+        pcp->theTargetVerticesEntries[i] = entryArray[ iEnt ];
+    }
+  }
+  {
+    BH::TPreCadPeriodicityVector& preCadPeriodicityVector =
+      const_cast< BH::TPreCadPeriodicityVector&> ( impl->_GetPreCadEdgesPeriodicityVector() );
+    BH::TPreCadPeriodicityVector::iterator pcp = preCadPeriodicityVector.begin();
+    for ( ; pcp != preCadPeriodicityVector.end(); ++pcp )
+    {
+      pcp->shape1Entry = entryArray[ iEnt++ ];
+      pcp->shape2Entry = entryArray[ iEnt++ ];
+      for ( size_t i = 0; i < pcp->theSourceVerticesEntries.size(); ++i, iEnt++ )
+        pcp->theSourceVerticesEntries[i] = entryArray[ iEnt ];
+
+      for ( size_t i = 0; i < pcp->theTargetVerticesEntries.size(); ++i, iEnt++ )
+        pcp->theTargetVerticesEntries[i] = entryArray[ iEnt ];
+    }
+  }
+
+  size_t iID = 0;
+  {
+    BH::THyperPatchList& hyperPatchListNew =
+      const_cast< BH::THyperPatchList& >( impl->GetHyperPatches() );
+    BH::THyperPatchList hyperPatchList;
+    hyperPatchList.swap( hyperPatchListNew );
+    BH::THyperPatchList::iterator idSet = hyperPatchList.begin();
+    for ( ; idSet != hyperPatchList.end(); ++idSet )
+    {
+      BH::THyperPatchTags& ids = *idSet;
+      BH::THyperPatchTags idsNew;
+      BH::THyperPatchTags::iterator i = ids.begin();
+      for ( ; i != ids.end(); ++i, ++iID )
+        if ( subIDArray[ iID ] > 0 )
+          idsNew.insert( subIDArray[ iID ]);
+      if ( !idsNew.empty() )
+        hyperPatchListNew.push_back( idsNew );
+    }
+  }
+
+  return ( iEnt == entryArray.size() && iID == subIDArray.size() );
 }
index e5517d9a4b34d7b54865e18001d109535a98e3ad..a027ad24dfcd460fc28d90cb68076bc1bc6709cf 100644 (file)
@@ -409,28 +409,16 @@ public:
   CORBA::Boolean IsDimSupported(SMESH::Dimension type);
 
 
-  //
-  // Obsolete methods - To be removed in V7
-  //
-  void SetPhyMin(CORBA::Double theMinSize);
-  CORBA::Double GetPhyMin();
-  void SetPhyMax(CORBA::Double theMaxSize);
-  CORBA::Double GetPhyMax();
-  void SetGeoMin(CORBA::Double theMinSize);
-  CORBA::Double GetGeoMin();
-  void SetGeoMax(CORBA::Double theMaxSize);
-  CORBA::Double GetGeoMax();
-  void SetAngleMeshS(CORBA::Double angle);
-  CORBA::Double GetAngleMeshS();
-  void SetAngleMeshC(CORBA::Double angle);
-  CORBA::Double GetAngleMeshC();
-  void SetDecimesh(CORBA::Boolean toIgnoreEdges);
-  CORBA::Boolean GetDecimesh();
-  void SetPreCADRemoveNanoEdges(CORBA::Boolean toRemoveNanoEdges);
-  CORBA::Boolean GetPreCADRemoveNanoEdges();
-  void SetPreCADEpsNano(CORBA::Double epsNano);
-  CORBA::Double GetPreCADEpsNano();
 
+  // Methods for copying mesh definition to other geometry
+
+  // Return geometry this hypothesis depends on. Return false if there is no geometry parameter
+  virtual bool getObjectsDependOn( std::vector< std::string > & entryArray,
+                                   std::vector< int >         & subIDArray ) const;
+
+  // Set new geometry instead of that returned by getObjectsDependOn()
+  virtual bool setObjectsDependOn( std::vector< std::string > & entryArray,
+                                   std::vector< int >         & subIDArray );
 private:
   ///////////////////////
   // PERIODICITY       //
index 48cf60ceebea38686428e74f9649e8dbc6826bd3..cec18e4022184901081372d0a27cd42957f9b438 100644 (file)
@@ -1451,8 +1451,6 @@ This method is called when a item is added into the enforced vertices tree widge
 */
 void BLSURFPluginGUI_HypothesisCreator::onAddEnforcedVertices()
 {
-  BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
-
   getGeomSelectionTool()->selectionMgr()->clearFilters();
   myEnfVertexWdg->deactivateSelection();
 
@@ -1488,7 +1486,7 @@ void BLSURFPluginGUI_HypothesisCreator::onAddEnforcedVertices()
       if ( CORBA::is_nil(getGeomEngine()))
         return;
 
-      GEOM::GEOM_IMeasureOperations_var measureOp = getGeomEngine()->GetIMeasureOperations( that->getGeomSelectionTool()->getMyStudy()->StudyId() );
+      GEOM::GEOM_IMeasureOperations_var measureOp = getGeomEngine()->GetIMeasureOperations( getGeomSelectionTool()->getMyStudy()->StudyId() );
       if (CORBA::is_nil(measureOp))
         return;
 
@@ -2196,14 +2194,16 @@ void BLSURFPluginGUI_HypothesisCreator::AddPreCadSequenceToVector(BlsurfHypothes
         {
           periodicity_i[PERIODICITY_P1_SOURCE_COLUMN] = sourceVertices[0].in();
           periodicity_i[PERIODICITY_P2_SOURCE_COLUMN] = sourceVertices[1].in();
-          periodicity_i[PERIODICITY_P3_SOURCE_COLUMN] = sourceVertices[2].in();
+          if ( onFace )
+            periodicity_i[PERIODICITY_P3_SOURCE_COLUMN] = sourceVertices[2].in();
         }
 
       if (targetVertices.length()!=0)
         {
           periodicity_i[PERIODICITY_P1_TARGET_COLUMN] = targetVertices[0].in();
           periodicity_i[PERIODICITY_P2_TARGET_COLUMN] = targetVertices[1].in();
-          periodicity_i[PERIODICITY_P3_TARGET_COLUMN] = targetVertices[2].in();
+          if ( onFace )
+            periodicity_i[PERIODICITY_P3_TARGET_COLUMN] = targetVertices[2].in();
         }
 
       if (onFace)