]> SALOME platform Git repositories - plugins/ghs3dplugin.git/commitdiff
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:16:01 +0000 (17:16 +0300)
committereap <eap@opencascade.com>
Tue, 18 Sep 2018 14:16:01 +0000 (17:16 +0300)
src/GHS3DPlugin/GHS3DPlugin_Hypothesis.hxx
src/GHS3DPlugin/GHS3DPlugin_Hypothesis_i.cxx
src/GHS3DPlugin/GHS3DPlugin_Hypothesis_i.hxx

index 951a050e77d037e7e26da8cfa2f4d06d2f52d773..e1e544f0c3f00ffacaf9f153530eaaa2548ddb44 100644 (file)
@@ -247,11 +247,11 @@ public:
   TGHS3DEnforcedVertex* GetEnforcedVertex(double x, double y, double z) throw (std::invalid_argument);
   TGHS3DEnforcedVertex* GetEnforcedVertex(const std::string anEntry) throw (std::invalid_argument);
   bool RemoveEnforcedVertex(double x=0.0, double y=0.0, double z=0.0, const std::string anEntry="" ) throw (std::invalid_argument);
-  const TGHS3DEnforcedVertexCoordsValues _GetEnforcedVerticesCoordsSize() const {return _enfVertexCoordsSizeList; }
-  const TGHS3DEnforcedVertexEntryValues  _GetEnforcedVerticesEntrySize() const {return _enfVertexEntrySizeList; }
-  const TGHS3DEnforcedVertexList         _GetEnforcedVertices() const { return _enfVertexList; }
-  const TCoordsGHS3DEnforcedVertexMap    _GetEnforcedVerticesByCoords() const { return _coordsEnfVertexMap; }
-  const TGeomEntryGHS3DEnforcedVertexMap _GetEnforcedVerticesByEntry() const { return _geomEntryEnfVertexMap; }
+  const TGHS3DEnforcedVertexCoordsValues& _GetEnforcedVerticesCoordsSize() const {return _enfVertexCoordsSizeList; }
+  const TGHS3DEnforcedVertexEntryValues & _GetEnforcedVerticesEntrySize() const {return _enfVertexEntrySizeList; }
+  const TGHS3DEnforcedVertexList        & _GetEnforcedVertices() const { return _enfVertexList; }
+  const TCoordsGHS3DEnforcedVertexMap   & _GetEnforcedVerticesByCoords() const { return _coordsEnfVertexMap; }
+  const TGeomEntryGHS3DEnforcedVertexMap& _GetEnforcedVerticesByEntry() const { return _geomEntryEnfVertexMap; }
   void ClearEnforcedVertices();
 
   /*!
@@ -369,7 +369,6 @@ protected:
   TIDSortedElemGroupMap                    _enfEdges;
   TIDSortedElemGroupMap                    _enfTriangles;
   TID2SizeMap                              _nodeIDToSizeMap;
-  std::map<std::string, TIDSortedElemSet > _entryToElemsMap;
   
   TSetStrings _groupsToRemove;
 };
index 2da4c1055d78dd338801c8660d4dac9373f4fd33..67856ede9ecd95ec6083cb640bab832e254a74df 100644 (file)
@@ -1029,3 +1029,134 @@ CORBA::Boolean GHS3DPlugin_Hypothesis_i::IsDimSupported( SMESH::Dimension type )
 {
   return type == SMESH::DIM_3D;
 }
+
+
+//================================================================================
+/*!
+ * \brief Return geometry this hypothesis depends on. Return false if there is no geometry parameter
+ */
+//================================================================================
+
+bool
+GHS3DPlugin_Hypothesis_i::getObjectsDependOn( std::vector< std::string > & entryArray,
+                                              std::vector< int >         & subIDArray ) const
+{
+  typedef ::GHS3DPlugin_Hypothesis THyp;
+  const THyp* h = static_cast< const THyp*>( myBaseImpl );
+
+  {
+    const THyp::TGHS3DEnforcedVertexList& enfVertexList = h->_GetEnforcedVertices();
+    THyp::TGHS3DEnforcedVertexList::const_iterator evIt = enfVertexList.begin();
+    for ( ; evIt != enfVertexList.end(); ++evIt )
+    {
+      const THyp::TGHS3DEnforcedVertex* ev = *evIt;
+      entryArray.push_back( ev->geomEntry );
+    }
+  }
+  {
+    const THyp::TGHS3DEnforcedVertexEntryValues&
+      enfVertexEntrySizeList = h->_GetEnforcedVerticesEntrySize();
+    THyp::TGHS3DEnforcedVertexEntryValues::const_iterator entry2size;
+    for ( entry2size =  enfVertexEntrySizeList.cbegin();
+          entry2size != enfVertexEntrySizeList.cend();
+          entry2size++ )
+    {
+      entryArray.push_back( entry2size->first );
+    }
+  }
+  {
+    const THyp::TCoordsGHS3DEnforcedVertexMap&
+      coordsEnfVertexMap = h->_GetEnforcedVerticesByCoords();
+    THyp::TCoordsGHS3DEnforcedVertexMap::const_iterator size2ev = coordsEnfVertexMap.cbegin();
+    for ( ; size2ev != coordsEnfVertexMap.cend(); ++size2ev )
+    {
+      const THyp::TGHS3DEnforcedVertex* ev = size2ev->second;
+      entryArray.push_back( ev->geomEntry );
+    }
+  }
+  {
+    const THyp::TGeomEntryGHS3DEnforcedVertexMap&
+      geomEntryEnfVertexMap = h->_GetEnforcedVerticesByEntry();
+    THyp::TGeomEntryGHS3DEnforcedVertexMap::const_iterator entry2ev;
+    for ( entry2ev =  geomEntryEnfVertexMap.cbegin();
+          entry2ev != geomEntryEnfVertexMap.cend();
+          entry2ev++ )
+    {
+      entryArray.push_back( entry2ev->first );
+
+      const THyp::TGHS3DEnforcedVertex* ev = entry2ev->second;
+      entryArray.push_back( ev->geomEntry );
+    }
+  }
+
+  return entryArray.size() > 0;
+}
+
+//================================================================================
+/*!
+ * \brief Set new geometry instead of that returned by getObjectsDependOn()
+ */
+//================================================================================
+
+bool
+GHS3DPlugin_Hypothesis_i::setObjectsDependOn( std::vector< std::string > & entryArray,
+                                              std::vector< int >         & subIDArray )
+{
+  typedef ::GHS3DPlugin_Hypothesis THyp;
+  THyp* h = static_cast< THyp*>( myBaseImpl );
+
+  size_t iEnt = 0;
+  {
+    THyp::TGHS3DEnforcedVertexList& enfVertexList =
+      const_cast<THyp::TGHS3DEnforcedVertexList& >( h->_GetEnforcedVertices() );
+    THyp::TGHS3DEnforcedVertexList::iterator evIt = enfVertexList.begin();
+    for ( ; evIt != enfVertexList.end(); ++evIt )
+    {
+      THyp::TGHS3DEnforcedVertex* ev = *evIt;
+      ev->geomEntry = entryArray[ iEnt++ ];
+    }
+  }
+  {
+    THyp::TGHS3DEnforcedVertexEntryValues& enfVertexEntrySizeListNew =
+      const_cast< THyp::TGHS3DEnforcedVertexEntryValues& > ( h->_GetEnforcedVerticesEntrySize() );
+    THyp::TGHS3DEnforcedVertexEntryValues enfVertexEntrySizeList;
+    enfVertexEntrySizeList.swap( enfVertexEntrySizeListNew );
+    THyp::TGHS3DEnforcedVertexEntryValues::const_iterator entry2size;
+    for ( entry2size =  enfVertexEntrySizeList.cbegin();
+          entry2size != enfVertexEntrySizeList.cend();
+          entry2size++, ++iEnt )
+    {
+      if ( entry2size->first.empty() == entryArray[ iEnt ].empty() )
+        enfVertexEntrySizeListNew[ entryArray[ iEnt ]] = entry2size->second;
+    }
+  }
+  {
+    THyp::TCoordsGHS3DEnforcedVertexMap& coordsEnfVertexMap =
+      const_cast< THyp::TCoordsGHS3DEnforcedVertexMap& > ( h->_GetEnforcedVerticesByCoords() );
+    THyp::TCoordsGHS3DEnforcedVertexMap::iterator size2ev = coordsEnfVertexMap.begin();
+    for ( ; size2ev != coordsEnfVertexMap.end(); ++size2ev )
+    {
+      THyp::TGHS3DEnforcedVertex* ev = size2ev->second;
+      ev->geomEntry = entryArray[ iEnt++ ];
+    }
+  }
+  {
+    THyp::TGeomEntryGHS3DEnforcedVertexMap& geomEntryEnfVertexMapNew =
+      const_cast< THyp::TGeomEntryGHS3DEnforcedVertexMap& > ( h->_GetEnforcedVerticesByEntry() );
+    THyp::TGeomEntryGHS3DEnforcedVertexMap geomEntryEnfVertexMap;
+    geomEntryEnfVertexMap.swap( geomEntryEnfVertexMapNew );
+    THyp::TGeomEntryGHS3DEnforcedVertexMap::iterator entry2ev;
+    for ( entry2ev =  geomEntryEnfVertexMap.begin();
+          entry2ev != geomEntryEnfVertexMap.end();
+          entry2ev++ )
+    {
+      const std::string& entry = entryArray[ iEnt++ ];
+      THyp::TGHS3DEnforcedVertex* ev = entry2ev->second;
+      ev->geomEntry = entryArray[ iEnt++ ];
+
+      geomEntryEnfVertexMapNew[ entry ] = ev;
+    }
+  }
+
+  return iEnt == entryArray.size();
+}
index d51500200e045798f496e0e42904ef00be84edeb..af3e427146bb40807ffeb0ef04e6fbb1bd208ed0 100644 (file)
@@ -186,6 +186,16 @@ class GHS3DPLUGIN_EXPORT GHS3DPlugin_Hypothesis_i:
   // Verify whether hypothesis supports given entity type 
   CORBA::Boolean IsDimSupported( SMESH::Dimension type );
   
+
+  // 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 );
 };
 
 #endif