Salome HOME
23586: [EDF] HYDRO: Copy mesh to new geometry
[plugins/netgenplugin.git] / src / NETGENPlugin / NETGENPluginBuilder.py
index 932500d85d1e9be3e4ea2c36a4625d40d71af566..3c851e6f8f82555dd0918d2384a08234f2016741 100644 (file)
@@ -106,7 +106,11 @@ class NETGEN_Algorithm(Mesh_Algorithm):
     def __init__(self, mesh, geom=0):
         Mesh_Algorithm.__init__(self)
         if noNETGENPlugin: print("Warning: NETGENPlugin module unavailable")
-        self.Create(mesh, geom, self.algoType, LIBRARY)
+        if not mesh.GetMesh().HasShapeToMesh() and \
+           self.meshMethod == "Triangle": # create a 2D remesher
+            self.Create(mesh, geom, "NETGEN_Remesher_2D", LIBRARY)
+        else:
+            self.Create(mesh, geom, self.algoType, LIBRARY)
         self.params = None
         pass
 
@@ -161,6 +165,9 @@ class NETGEN_Algorithm(Mesh_Algorithm):
         else:
             hypType = "NETGEN_Parameters_3D"
 
+        if self.algo.GetName() == "NETGEN_Remesher_2D":
+            hypType = "NETGEN_RemesherParameters_2D"
+
         if self.params and self.params.GetName() != hypType:
             self.mesh.RemoveHypothesis( self.params, self.geom )
             self.params = None
@@ -175,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
 
 
@@ -221,6 +236,21 @@ class NETGEN_1D2D3D_Algorithm(NETGEN_Algorithm):
         if self.Parameters(): self.params.SetNbSegPerRadius(theVal)
         pass
 
+    ## Sets @c ChordalError parameter
+    #  @param theVal new value of the @c ChordalError parameter
+    def SetChordalError(self, theVal):
+        if self.Parameters():
+            self.params.SetChordalError(theVal)
+            self.params.SetChordalErrorEnabled( theVal > 0 )
+        pass
+
+    ## Sets @c RidgeAngle parameter
+    #  @param theVal new value of the @c RidgeAngle parameter
+    def SetRidgeAngle(self, theVal):
+        if self.Parameters():
+            self.params.SetRidgeAngle(theVal)
+        pass
+
     ## Sets @c QuadAllowed flag
     #  @param toAllow new value of the @c QuadAllowed parameter (@c True by default)
     def SetQuadAllowed(self, toAllow=True):