Salome HOME
Typo-fix by Kunda
[modules/smesh.git] / src / SMESH_SWIG / StdMeshersBuilder.py
index 35e43e551ba6d5b8ce79acfb63de41e21cfb4fec..29e0fccf368299dc8a0e38b5d606eef99f5e317f 100644 (file)
@@ -21,6 +21,8 @@
 # @package StdMeshersBuilder
 # Python API for the standard meshing plug-in module.
 
+LIBRARY = "libStdMeshersEngine.so"
+
 from salome.smesh.smesh_algorithm import Mesh_Algorithm
 import StdMeshers
 
@@ -261,7 +263,7 @@ class StdMeshersBuilder_Segment(Mesh_Algorithm):
     # on curve from 0 to 1 (additionally it is neecessary to check
     # orientation of edges and create list of reversed edges if it is
     # needed) and sets numbers of segments between given points (default
-    # values are equals 1
+    # values are 1)
     #  @param points defines the list of parameters on curve
     #  @param nbSegs defines the list of numbers of segments
     #  @param reversedEdges is a list of edges to mesh using reversed orientation.
@@ -379,7 +381,8 @@ class StdMeshersBuilder_Segment(Mesh_Algorithm):
             pass
         # 0D algorithm
         if self.geom is None:
-            raise RuntimeError, "Attemp to create SegmentAroundVertex_0D algoritm on None shape"
+            self.geom = store_geom
+            raise RuntimeError, "Attempt to create SegmentAroundVertex_0D algorithm on None shape"
         from salome.smesh.smeshBuilder import AssureGeomPublished, GetName, TreatHypoStatus
         AssureGeomPublished( self.mesh, self.geom )
         name = GetName(self.geom)
@@ -950,6 +953,10 @@ class StdMeshersBuilder_Prism3D(Mesh_Algorithm):
     ## doc string of the method
     #  @internal
     docHelper  = "Creates prism 3D algorithm for volumes"
+    ## flag pointing whether this algorithm should be used by default in dynamic method
+    #  of smeshBuilder.Mesh class
+    #  @internal
+    isDefault  = True
 
     ## Private constructor.
     #  @param mesh parent mesh object algorithm is assigned to
@@ -961,10 +968,8 @@ class StdMeshersBuilder_Prism3D(Mesh_Algorithm):
         shape = geom
         if not shape:
             shape = mesh.geom
-        from salome.geom import geomBuilder
-        nbSolids = len( geomBuilder.geom.SubShapeAll( shape, geomBuilder.geomBuilder.ShapeType["SOLID"] ))
-        nbShells = len( geomBuilder.geom.SubShapeAll( shape, geomBuilder.geomBuilder.ShapeType["SHELL"] ))
-        if nbSolids == 0 or nbSolids == nbShells:
+        isRadial = mesh.smeshpyD.IsApplicable("RadialPrism_3D", LIBRARY, shape, False )
+        if not isRadial:
             self.Create(mesh, geom, "Prism_3D")
             pass
         else:
@@ -978,7 +983,7 @@ class StdMeshersBuilder_Prism3D(Mesh_Algorithm):
     ## Return 3D hypothesis holding the 1D one
     def Get3DHypothesis(self):
         if self.algoType != "RadialPrism_3D":
-            print "Prism_3D algorith doesn't support any hyposesis"
+            print "Prism_3D algorithm doesn't support any hypothesis"
             return None
         return self.distribHyp
 
@@ -986,7 +991,7 @@ class StdMeshersBuilder_Prism3D(Mesh_Algorithm):
     #  hypothesis. Returns the created hypothesis
     def OwnHypothesis(self, hypType, args=[], so="libStdMeshersEngine.so"):
         if self.algoType != "RadialPrism_3D":
-            print "Prism_3D algorith doesn't support any hyposesis"
+            print "Prism_3D algorithm doesn't support any hypothesis"
             return None
         if not self.nbLayers is None:
             self.mesh.GetMesh().RemoveHypothesis( self.geom, self.nbLayers )
@@ -1007,7 +1012,7 @@ class StdMeshersBuilder_Prism3D(Mesh_Algorithm):
     #                     the same parameters, else (default) - creates a new one
     def NumberOfLayers(self, n, UseExisting=0):
         if self.algoType != "RadialPrism_3D":
-            print "Prism_3D algorith doesn't support any hyposesis"
+            print "Prism_3D algorithm doesn't support any hypothesis"
             return None
         self.mesh.RemoveHypothesis( self.distribHyp, self.geom )
         from salome.smesh.smeshBuilder import IsEqual
@@ -1023,7 +1028,7 @@ class StdMeshersBuilder_Prism3D(Mesh_Algorithm):
     #  @param p the precision of rounding
     def LocalLength(self, l, p=1e-07):
         if self.algoType != "RadialPrism_3D":
-            print "Prism_3D algorith doesn't support any hyposesis"
+            print "Prism_3D algorithm doesn't support any hypothesis"
             return None
         hyp = self.OwnHypothesis("LocalLength", [l,p])
         hyp.SetLength(l)
@@ -1036,7 +1041,7 @@ class StdMeshersBuilder_Prism3D(Mesh_Algorithm):
     #  @param s the scale factor (optional)
     def NumberOfSegments(self, n, s=[]):
         if self.algoType != "RadialPrism_3D":
-            print "Prism_3D algorith doesn't support any hyposesis"
+            print "Prism_3D algorithm doesn't support any hypothesis"
             return None
         if not s:
             hyp = self.OwnHypothesis("NumberOfSegments", [n])
@@ -1053,7 +1058,7 @@ class StdMeshersBuilder_Prism3D(Mesh_Algorithm):
     #  @param end    the length of the last  segment
     def Arithmetic1D(self, start, end ):
         if self.algoType != "RadialPrism_3D":
-            print "Prism_3D algorith doesn't support any hyposesis"
+            print "Prism_3D algorithm doesn't support any hypothesis"
             return None
         hyp = self.OwnHypothesis("Arithmetic1D", [start, end])
         hyp.SetLength(start, 1)
@@ -1067,7 +1072,7 @@ class StdMeshersBuilder_Prism3D(Mesh_Algorithm):
     #  @param ratio  the common ratio of the geometric progression
     def GeometricProgression(self, start, ratio ):
         if self.algoType != "RadialPrism_3D":
-            print "Prism_3D algorith doesn't support any hyposesis"
+            print "Prism_3D algorithm doesn't support any hypothesis"
             return None
         hyp = self.OwnHypothesis("GeometricProgression", [start, ratio])
         hyp.SetStartLength( start )
@@ -1080,7 +1085,7 @@ class StdMeshersBuilder_Prism3D(Mesh_Algorithm):
     #  @param end   for the length of the last  segment
     def StartEndLength(self, start, end):
         if self.algoType != "RadialPrism_3D":
-            print "Prism_3D algorith doesn't support any hyposesis"
+            print "Prism_3D algorithm doesn't support any hypothesis"
             return None
         hyp = self.OwnHypothesis("StartEndLength", [start, end])
         hyp.SetLength(start, 1)
@@ -1092,7 +1097,7 @@ class StdMeshersBuilder_Prism3D(Mesh_Algorithm):
     #  @param fineness defines the quality of the mesh within the range [0-1]
     def AutomaticLength(self, fineness=0):
         if self.algoType != "RadialPrism_3D":
-            print "Prism_3D algorith doesn't support any hyposesis"
+            print "Prism_3D algorithm doesn't support any hypothesis"
             return None
         hyp = self.OwnHypothesis("AutomaticLength")
         hyp.SetFineness( fineness )
@@ -1469,7 +1474,7 @@ class StdMeshersBuilder_Cartesian_3D(Mesh_Algorithm):
     #    several functions, they must be accompanied by relative coordinates of
     #    points dividing the whole shape into ranges where the functions apply; points
     #    coodrinates should vary within (0.0, 1.0) range. Parameter \a t of the spacing
-    #    function f(t) varies from 0.0 to 1.0 witin a shape range. 
+    #    function f(t) varies from 0.0 to 1.0 within a shape range. 
     #    Examples:
     #    - "10.5" - defines a grid with a constant spacing
     #    - [["1", "1+10*t", "11"] [0.1, 0.6]] - defines different spacing in 3 ranges.
@@ -1565,7 +1570,7 @@ class StdMeshersBuilder_Cartesian_3D(Mesh_Algorithm):
     pass # end of StdMeshersBuilder_Cartesian_3D class
 
 ## Defines a stub 1D algorithm, which enables "manual" creation of nodes and
-#  segments usable by 2D algoritms
+#  segments usable by 2D algorithms
 #
 #  It is created by calling smeshBuilder.Mesh.UseExistingSegments(geom=0)
 #
@@ -1593,7 +1598,7 @@ class StdMeshersBuilder_UseExisting_1D(Mesh_Algorithm):
     pass # end of StdMeshersBuilder_UseExisting_1D class
 
 ## Defines a stub 2D algorithm, which enables "manual" creation of nodes and
-#  faces usable by 3D algoritms
+#  faces usable by 3D algorithms
 #
 #  It is created by calling smeshBuilder.Mesh.UseExistingFaces(geom=0)
 #