Salome HOME
Representation of structural elements 'general beams' as rectangular beams (PAL ...
authorbarate <barate>
Wed, 7 Mar 2012 15:40:56 +0000 (15:40 +0000)
committerbarate <barate>
Wed, 7 Mar 2012 15:40:56 +0000 (15:40 +0000)
src/GEOM_PY/structelem/__init__.py
src/GEOM_PY/structelem/parts.py

index 0cc5250d935f627b603ace3696b2ab1564c61dfd..b0503cea998a98119e9d1ac40cacb817e49cbf4c 100644 (file)
@@ -451,7 +451,9 @@ def TEST_StructuralElement():
                                         'VECT_Y': (1.0, 0.0, 1.0)}),
                        ('Orientation', {'MeshGroups': 'Edge_5',
                                         'ANGL_VRIL': 45.0}),
-                       ('GeneralBeam', {'MeshGroups': 'Edge_1, Edge_7'}),
+                       ('GeneralBeam', {'MeshGroups': 'Edge_1, Edge_7',
+                                        'A': 1, 'IY1': 20, 'IY2': 40,
+                                        'IZ1': 60, 'IZ2': 30}),
                        ('VisuPoutreCercle', {'MeshGroups': ['Edge_6'],
                                              'R1': 30, 'R2': 20}),
                        ('CircularBeam', {'MeshGroups': ['Edge_2', 'Edge_3'],
index 406cb1a27ba6c60266f9f649282a9db07d781224..a839f109e443fa5800d8efc3f29ad377e541fc3d 100644 (file)
@@ -25,6 +25,8 @@ directly in the general case. Structural elements should be created by the
 class :class:`~salome.geom.structelem.StructuralElementManager`.
 """
 
+import math
+
 import salome
 
 from salome.kernel.logger import Logger
@@ -347,30 +349,6 @@ class Beam(StructuralElementPart):
         return listMarkers
 
 
-class GeneralBeam(Beam):
-    """
-    This class defines a beam with a generic section. It is represented only
-    as the underlying wire. See class :class:`StructuralElementPart` for the
-    description of the parameters.
-    """
-
-    def __init__(self, studyId, groupName, groupGeomObj, parameters,
-                 name = Beam.DEFAULT_NAME):
-        Beam.__init__(self, studyId, groupName, groupGeomObj, parameters,
-                      name)
-        logger.debug(repr(self))
-
-    def _buildPart(self):
-        """
-        Create a copy of the underlying wire.
-        """
-        edges = self._getSubShapes(1e-7)
-        wire = None
-        if len(edges) > 0:
-            wire = self.geom.MakeWire(edges)
-        return wire
-
-
 class CircularBeam(Beam):
     """
     This class defines a beam with a circular section. It can be full or
@@ -573,6 +551,48 @@ class RectangularBeam(Beam):
         return (outerRect1, innerRect1, outerRect2, innerRect2)
 
 
+def getParameterInDict(nameList, parametersDict, default = None):
+    """
+    This method finds the value of a parameter in the parameters
+    dictionary. The argument is a list because some parameters can have
+    several different names.
+    """
+    for name in nameList:
+        if parametersDict.has_key(name):
+            return parametersDict[name]
+    return default
+
+
+class GeneralBeam(RectangularBeam):
+    """
+    This class defines a beam with a generic section. It is represented as a
+    full rectangular beam with the following parameters:
+    
+    * HY1 = sqrt(12 * IZ1 / A1)
+    * HZ1 = sqrt(12 * IY1 / A1)
+    * HY2 = sqrt(12 * IZ2 / A2)
+    * HZ2 = sqrt(12 * IY2 / A2)
+    
+    See class :class:`StructuralElementPart` for the description of the other
+    parameters.
+    """
+
+    def __init__(self, studyId, groupName, groupGeomObj, parameters,
+                 name = Beam.DEFAULT_NAME):
+        self.IY1 = getParameterInDict(["IY1", "IY"], parameters)
+        self.IZ1 = getParameterInDict(["IZ1", "IZ"], parameters)
+        self.IY2 = getParameterInDict(["IY2", "IY"], parameters)
+        self.IZ2 = getParameterInDict(["IZ2", "IZ"], parameters)
+        self.A1 = getParameterInDict(["A1", "A"], parameters)
+        self.A2 = getParameterInDict(["A2", "A"], parameters)
+        parameters["HY1"] = math.sqrt(12 * self.IZ1 / self.A1)
+        parameters["HZ1"] = math.sqrt(12 * self.IY1 / self.A1)
+        parameters["HY2"] = math.sqrt(12 * self.IZ2 / self.A2)
+        parameters["HZ2"] = math.sqrt(12 * self.IY2 / self.A2)
+        RectangularBeam.__init__(self, studyId, groupName, groupGeomObj, parameters,
+                                 name)
+
+
 class StructuralElementPart2D(StructuralElementPart):
     """
     This class is an "abstract" class for all 2D structural element parts. It