From: barate Date: Wed, 7 Mar 2012 15:40:56 +0000 (+0000) Subject: Representation of structural elements 'general beams' as rectangular beams (PAL ... X-Git-Tag: V6_5_0a1~34 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d50f2187f361ba442eef0c6e41a85ab20ba27100;p=modules%2Fgeom.git Representation of structural elements 'general beams' as rectangular beams (PAL #1881) --- diff --git a/src/GEOM_PY/structelem/__init__.py b/src/GEOM_PY/structelem/__init__.py index 0cc5250d9..b0503cea9 100644 --- a/src/GEOM_PY/structelem/__init__.py +++ b/src/GEOM_PY/structelem/__init__.py @@ -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'], diff --git a/src/GEOM_PY/structelem/parts.py b/src/GEOM_PY/structelem/parts.py index 406cb1a27..a839f109e 100644 --- a/src/GEOM_PY/structelem/parts.py +++ b/src/GEOM_PY/structelem/parts.py @@ -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