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:34:38 +0000 (17:34 +0300)
committereap <eap@opencascade.com>
Tue, 18 Sep 2018 14:34:38 +0000 (17:34 +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 7334ae33351c9a3f94d5ed4cf8aec96bd3bed505..fc60826075a70e5b32a23cc853202ac96dd8dee0 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 9bd9ec8a7dceac0f44f48ffbd973c0678aff8632..6117e474c6a64d1016020eb220fd93b1a02464f4 100644 (file)
@@ -53,7 +53,6 @@ NETGENPlugin_Hypothesis::NETGENPlugin_Hypothesis (int hypId, int studyId,
     _chordalError       (GetDefaultChordalError() ),
     _secondOrder        (GetDefaultSecondOrder()),
     _optimize           (GetDefaultOptimize()),
-    _localSize          (GetDefaultLocalSize()),
     _quadAllowed        (GetDefaultQuadAllowed()),
     _surfaceCurvature   (GetDefaultSurfaceCurvature()),
     _fuseEdges          (GetDefaultFuseEdges())
index 44f9095f162b70ee2965728270a7df87d89101db..a8c4e104d92fb17a4f33ade13b458d09116fc753 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 11461d6a0f1fa4270b78fe3c3d9c66f15134d792..35e859dffe8977d7d9877e122dd45c679a8c3911 100644 (file)
@@ -536,3 +536,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 e9b908db225b5e4e9a0f255191ca4873703c5276..fbbbd741d2b8c4124142709371fca46e430b859d 100644 (file)
@@ -109,6 +109,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)
@@ -128,7 +139,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 06ba90d4ae53f0e0623c5312130d74dc7270b05e..50037cc900420500e1b16b769db016b023eb0852 100644 (file)
@@ -81,6 +81,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 940a80701c7d11f3d69043500a25a4068fd96898..f8b1746c68408fc062d5c4f552da4ed516199757 100644 (file)
@@ -59,6 +59,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