def test_integer_double_or_string(self): # out of range with self.assertRaises(SyntaxError): integer_or_double(BDFCard([1.] ), 1, 'field') # integer self.check_integer(integer_double_or_string) # float self.check_double(integer_double_or_string) # string self.assertEqual('LOAD', integer_double_or_string(BDFCard(['load'] ), 0, 'field'))
def test_integer_double_or_string(self): # out of range with self.assertRaises(SyntaxError): integer_or_double(BDFCard([1.0]), 1, "field") # integer self.check_integer(integer_double_or_string) # float self.check_double(integer_double_or_string) # string self.assertEqual("LOAD", integer_double_or_string(BDFCard(["load"]), 0, "field"))
def add(self, card, comment=''): #self.model.log.debug('RBE2.add') i = self.i #if comment: #self._comment = comment eid = integer(card, 1, 'element_id') gn = integer(card, 2, 'gn') cm = components_or_blank(card, 3, 'cm') #assert gn is not None, 'gn=%s' % self.gn #assert cm is not None, 'cm=%s' % self.cm self.element_id[i] = eid self.gn[i] = gn self.cm[i] = cm alpha = integer_or_double(card, len(card) - 1, 'alpha') if isinstance(alpha, float): # the last field is not part of Gmi self.alpha[i] = alpha n = 1 else: # the last field is part of Gmi n = 0 #self.alpha[i] = 0.0 # we don't need to set alpha j = 4 Gmi = [] for k in range(len(card) - 4 - n): gmi = integer(card, j + k, 'Gm%i' % (k + 1)) #print('GM%i = %s' % (k + 1, gmi)) Gmi.append(gmi) self.gmi[i] = Gmi self.i += 1
def add(self, card, comment=''): #self.model.log.debug('RBE2.add') i = self.i #if comment: #self._comment = comment eid = integer(card, 1, 'element_id') gn = integer(card, 2, 'gn') cm = components_or_blank(card, 3, 'cm') #assert gn is not None, 'gn=%s' % self.gn #assert cm is not None, 'cm=%s' % self.cm self.element_id[i] = eid self.gn[i] = gn self.cm[i] = cm alpha = integer_or_double(card, len(card) - 1, 'alpha') if isinstance(alpha, float): # the last field is not part of Gmi self.alpha[i] = alpha n = 1 else: # the last field is part of Gmi n = 0 #self.alpha[i] = 0.0 # we don't need to set alpha j = 4 gmis = [] for k in range(len(card) - 4 - n): gmi = integer(card, j + k, 'Gm%i' % (k + 1)) #print('GM%i = %s' % (k + 1, gmi)) gmis.append(gmi) self.gmi[i] = gmis self.i += 1
def __init__(self, card=None, data=None, comment=''): """ +-------+-----+-----+-----+------+-------+-----+-----+-----+ | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | +-------+-----+-----+-----+------+-------+-----+-----+-----+ | RBE2 | EID | GN | CM | GM1 | GM2 | GM3 | GM4 | GM5 | +-------+-----+-----+-----+------+-------+-----+-----+-----+ | | GM6 | GM7 | GM8 | etc. | ALPHA | +-------+-----+-----+-----+------+-------+ """ RigidElement.__init__(self, card, data) if comment: self._comment = comment if card: #: Element identification number self.eid = integer(card, 1, 'eid') #: Identification number of grid point to which all six independent #: degrees-of-freedom for the element are assigned. (Integer > 0) self.gn = integer(card, 2, 'gn') #: Component numbers of the dependent degrees-of-freedom in the #: global coordinate system at grid points GMi. (Integers 1 through #: 6 with no embedded blanks.) self.cm = components_or_blank(card, 3, 'cm') alpha = integer_or_double(card, len(card) - 1, 'alpha') if isinstance(alpha, float): #: Grid point identification numbers at which dependent #: degrees-of-freedom are assigned. (Integer > 0) self.alpha = alpha # the last field is not part of Gmi n = 1 else: # the last field is part of Gmi n = 0 self.alpha = 0.0 j = 4 self.Gmi = [] for i in range(len(card) - 4 - n): gmi = integer(card, j + i, 'Gm%i' % (i + 1)) #print('gm%i = %s' % (i + 1, gmi)) self.Gmi.append(gmi) else: self.eid = data[0] self.gn = data[1] self.cm = data[2] self.Gmi = data[3] self.alpha = data[4] print("eid=%s gn=%s cm=%s Gmi=%s alpha=%s" % (self.eid, self.gn, self.cm, self.Gmi, self.alpha)) #raise NotImplementedError('RBE2 data...') assert self.gn is not None, 'gn=%s' % self.gn assert self.cm is not None, 'cm=%s' % self.cm self.gn = str(self.gn) self.cm = str(self.cm)
def __init__(self, card=None, data=None, comment=''): """ +-------+-----+-----+-----+------+-------+-----+-----+-----+ | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | +-------+-----+-----+-----+------+-------+-----+-----+-----+ | RBE2 | EID | GN | CM | GM1 | GM2 | GM3 | GM4 | GM5 | +-------+-----+-----+-----+------+-------+-----+-----+-----+ | | GM6 | GM7 | GM8 | etc. | ALPHA | +-------+-----+-----+-----+------+-------+ """ RigidElement.__init__(self, card, data) if comment: self._comment = comment if card: #: Element identification number self.eid = integer(card, 1, 'eid') #: Identification number of grid point to which all six independent #: degrees-of-freedom for the element are assigned. (Integer > 0) self.gn = integer(card, 2, 'gn') #: Component numbers of the dependent degrees-of-freedom in the #: global coordinate system at grid points GMi. (Integers 1 through #: 6 with no embedded blanks.) self.cm = components_or_blank(card, 3, 'cm') alpha = integer_or_double(card, len(card) - 1, 'alpha') if isinstance(alpha, float): #: Grid point identification numbers at which dependent #: degrees-of-freedom are assigned. (Integer > 0) self.alpha = alpha # the last field is not part of Gmi n = 1 else: # the last field is part of Gmi n = 0 self.alpha = 0.0 j = 4 self.Gmi = [] for i in range(len(card)-4-n): gmi = integer(card, j + i, 'Gm%i' % (i + 1)) #print('gm%i = %s' % (i + 1, gmi)) self.Gmi.append(gmi) else: self.eid = data[0] self.gn = data[1] self.cm = data[2] self.Gmi = data[3] self.alpha = data[4] print("eid=%s gn=%s cm=%s Gmi=%s alpha=%s" % (self.eid, self.gn, self.cm, self.Gmi, self.alpha)) #raise NotImplementedError('RBE2 data...') assert self.gn is not None, 'gn=%s' % self.gn assert self.cm is not None, 'cm=%s' % self.cm self.gn = str(self.gn) self.cm = str(self.cm)
def __init__(self, card=None, data=None, comment=''): LineProperty.__init__(self, card, data) if comment: self._comment = comment if card: self.pid = integer(card, 1, 'pid') self.mid = integer(card, 2, 'mid') value3 = integer_or_double(card, 3, 'A_FSI') if isinstance(value3, float): self.beamType = 1 #: Area of the beam cross section self.A = double(card, 3, 'A') #: Area moments of inertia in planes 1 and 2. self.i1 = double(card, 4, 'I1') self.i2 = double(card, 5, 'I2') #: Torsional stiffness :math:`J` self.j = double(card, 6, 'J') # line2 #: The r,z locations from the geometric centroid for stress #: data recovery. self.c1 = double(card, 9, 'c1') self.c2 = double(card, 10, 'c2') self.d1 = double(card, 11, 'd1') self.d2 = double(card, 12, 'd2') self.e1 = double(card, 13, 'e1') self.e2 = double(card, 14, 'e2') self.f1 = double(card, 15, 'f1') self.f2 = double(card, 16, 'f2') # line 3 #: Shear stiffness factor K in K*A*G for plane 1. self.k1 = double(card, 17, 'k1') #: Shear stiffness factor K in K*A*G for plane 2. self.k2 = double(card, 18, 'k2') #: Nonstructural mass per unit length. self.nsm = double(card, 19, 'nsm') #: Radial offset of the geometric centroid from points GA and GB. self.rc = double(card, 20, 'rc') #: Offset of the geometric centroid in a direction perpendicular #: to the plane of points GA and GB and vector v self.zc = double(card, 21, 'zc') #: Radial offset of the neutral axis from the geometric #: centroid, positive is toward the center of curvature self.deltaN = double(card, 22, 'deltaN') elif isinstance(value3, int): # alternate form self.beamType = 2 #: Flag selecting the flexibility and stress intensification #: factors. See Remark 3. (Integer = 1, 2, or 3) self.fsi = integer(card, 3, 'fsi') assert self.fsi in [1, 2, 3] #: Mean cross-sectional radius of the curved pipe self.rm = double(card, 4, 'rm') #: Wall thickness of the curved pipe self.t = double(card, 5, 't') #: Internal pressure self.p = double(card, 6, 'p') # line3 # Non-structural mass :math:`nsm` self.nsm = double(card, 11, 'nsm') self.rc = double(card, 12, 'rc') self.zc = double(card, 13, 'zc') else: raise RuntimeError('Area/FSI on CBEND must be defined...') #: Bend radius of the line of centroids self.rb = double_or_blank(card, 7, 'rb') #: Arc angle :math:`\theta_B` of element (optional) self.thetab = double_or_blank(card, 8, 'thetab') assert len(card) <= 23, 'len(PBEND card) = %i' % len(card) else: raise NotImplementedError(data)
def test_integer_or_double(self): # out of range with self.assertRaises(SyntaxError): integer_or_double(BDFCard([1.] ), 1, 'field')