Salome HOME
23586: [EDF] HYDRO: Copy mesh to new geometry V9_2_0a1
authoreap <eap@opencascade.com>
Mon, 17 Sep 2018 19:10:15 +0000 (22:10 +0300)
committereap <eap@opencascade.com>
Mon, 17 Sep 2018 19:10:15 +0000 (22:10 +0300)
src/NETGENPlugin/NETGENPluginBuilder.py
src/NETGENPlugin/NETGENPlugin_Hypothesis.cxx
src/NETGENPlugin/NETGENPlugin_Hypothesis.hxx
src/NETGENPlugin/NETGENPlugin_Hypothesis_i.cxx
src/NETGENPlugin/NETGENPlugin_Hypothesis_i.hxx
src/NETGENPlugin/NETGENPlugin_SimpleHypothesis_2D_i.hxx
src/NETGENPlugin/NETGENPlugin_SimpleHypothesis_3D_i.hxx

index edf7df747d4525209244d66b67e7e54fcc4df1e7..3c851e6f8f82555dd0918d2384a08234f2016741 100644 (file)
@@ -182,6 +182,14 @@ class NETGEN_Algorithm(Mesh_Algorithm):
         self.Parameters().SetMeshSizeFile(file)
         pass
 
+    ## Set size of elements on a shape
+    #  @param shape - geometry
+    #  @param size - element size
+    def SetLocalSizeOnShape(self, shape, size ):
+        self.Parameters().SetLocalSizeOnShape(shape, size)
+        pass
+        
+
     pass # end of NETGEN_Algorithm class
 
 
index abb5b6aacef9645611fac42ee8c775083dc665b0..afce99b85ac41791c3b6ab588e39891f376a2b32 100644 (file)
@@ -54,7 +54,6 @@ NETGENPlugin_Hypothesis::NETGENPlugin_Hypothesis (int hypId,
     _chordalError       (GetDefaultChordalError() ),
     _secondOrder        (GetDefaultSecondOrder()),
     _optimize           (GetDefaultOptimize()),
-    _localSize          (GetDefaultLocalSize()),
     _quadAllowed        (GetDefaultQuadAllowed()),
     _surfaceCurvature   (GetDefaultSurfaceCurvature()),
     _fuseEdges          (GetDefaultFuseEdges())
index 8f1800ee0d5cda3dc78d150ca709f27ad39504a7..e68d3050f52bd83ec0cabffdafd9d184ea334519 100644 (file)
@@ -89,8 +89,7 @@ public:
   double GetChordalError() const { return _chordalError; }
 
   typedef std::map<std::string, double> TLocalSize;
-  static TLocalSize GetDefaultLocalSize() { return TLocalSize(); }
-  void SetLocalSizeOnEntry(const std::string& entry, double localSize);
+  void   SetLocalSizeOnEntry(const std::string& entry, double localSize);
   double GetLocalSizeOnEntry(const std::string& entry);
   const TLocalSize& GetLocalSizesAndEntries() const { return _localSize; }
   void UnsetLocalSizeOnEntry(const std::string& entry);
index 63eb164091fb88698105298e74882947c543ca26..4da301ebb395318b9425fc1c672e1a64c9c3688a 100644 (file)
@@ -534,3 +534,51 @@ std::string NETGENPlugin_Hypothesis_i::getMethodOfParameter(const int paramIndex
   }
   return "";
 }
+
+//================================================================================
+/*!
+ * \brief Return geometry this hypothesis depends on. Return false if there is no geometry parameter
+ */
+//================================================================================
+
+bool
+NETGENPlugin_Hypothesis_i::getObjectsDependOn( std::vector< std::string > & entryArray,
+                                               std::vector< int >         & subIDArray ) const
+{
+  typedef ::NETGENPlugin_Hypothesis THyp;
+
+  const THyp* h = static_cast< ::NETGENPlugin_Hypothesis* >( myBaseImpl );
+  const THyp::TLocalSize& ls = h->GetLocalSizesAndEntries();
+
+  THyp::TLocalSize::const_iterator entry2size = ls.cbegin();
+  for ( ; entry2size != ls.cend(); ++entry2size )
+    entryArray.push_back( entry2size->first );
+
+  return true;
+}
+
+//================================================================================
+/*!
+ * \brief Set new geometry instead of that returned by getObjectsDependOn()
+ */
+//================================================================================
+
+bool
+NETGENPlugin_Hypothesis_i::setObjectsDependOn( std::vector< std::string > & entryArray,
+                                               std::vector< int >         & subIDArray )
+{
+  typedef ::NETGENPlugin_Hypothesis THyp;
+
+  const THyp* h = static_cast< ::NETGENPlugin_Hypothesis* >( myBaseImpl );
+
+  THyp::TLocalSize& lsNew = const_cast< THyp::TLocalSize& >( h->GetLocalSizesAndEntries() );
+  THyp::TLocalSize ls;
+  lsNew.swap( ls );
+
+  THyp::TLocalSize::const_iterator entry2size = ls.cbegin();
+  for ( int i = 0; entry2size != ls.cend(); ++entry2size, ++i )
+    if ( !entryArray[ i ].empty() )
+      lsNew[ entryArray[ i ]] = entry2size->second;
+
+  return true;
+}
index 84ad0beee5d3bfdedfa3bd19d78ed7855ddb1ffb..59963e6faeb6b0db1a104f7365a9edb5f74a8c3d 100644 (file)
@@ -108,6 +108,17 @@ class NETGENPLUGIN_EXPORT NETGENPlugin_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 );
+
  protected:
 
   // to remember whether a parameter is already set (issue 0021364)
@@ -127,7 +138,7 @@ class NETGENPLUGIN_EXPORT NETGENPlugin_Hypothesis_i:
     METH_SetFuseEdges           = METH_SetSurfaceCurvature * 2,
     METH_SetChordalErrorEnabled = METH_SetFuseEdges * 2,
     METH_SetChordalError        = METH_SetChordalErrorEnabled * 2,
-    METH_LAST                   = METH_SetFuseEdges
+    METH_LAST                   = METH_SetChordalError
   };
   int mySetMethodFlags;
 
index 50bbc5f2dde562090218530a75adbb91f3dea369..dfe5e431f362930ed3c33e9b0e11c17a9d2fc828 100644 (file)
@@ -80,6 +80,17 @@ class NETGENPLUGIN_EXPORT  NETGENPlugin_SimpleHypothesis_2D_i:
   // into myMethod2VarParams. It should return a method name for an index of
   // variable parameters. Index is countered from zero
   virtual std::string getMethodOfParameter(const int paramIndex, int nbVars) const;
+
+
+  // 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 { return 0; }
+
+  // Set new geometry instead of that returned by getObjectsDependOn()
+  virtual bool setObjectsDependOn( std::vector< std::string > & entryArray,
+                                   std::vector< int >         & subIDArray ) { return true; }
 };
 
 #endif
index 4cf259b069b09a6604c07878880416ff0df94978..fe4b263b04e1a1e2113a81158272ffea1a0f824c 100644 (file)
@@ -58,6 +58,17 @@ class NETGENPLUGIN_EXPORT  NETGENPlugin_SimpleHypothesis_3D_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 { return 0; }
+
+  // Set new geometry instead of that returned by getObjectsDependOn()
+  virtual bool setObjectsDependOn( std::vector< std::string > & entryArray,
+                                   std::vector< int >         & subIDArray ) { return true; }
 };
 
 #endif