Ejemplo n.º 1
0
    def __init__(self, card=None, data=None, comment=''):
        TabularLoad.__init__(self, card, data)
        if comment:
            self._comment = comment
        if card:
            self.sid = integer(card, 1, 'sid')
            self.exciteID = integer(card, 2, 'exciteID')
            self.delay = integer_double_or_blank(card, 3, 'delay', 0)
            self.dphase = integer_double_or_blank(card, 4, 'dphase')
            self.tb = integer_or_blank(card, 5, 'tb', 0)
            self.tp = integer_or_blank(card, 6, 'tp', 0)
            self.Type = integer_string_or_blank(card, 7, 'Type', 'LOAD')

            if self.Type in [0, 'L', 'LO', 'LOA', 'LOAD']:
                self.Type = 'LOAD'
            elif self.Type in [1, 'D', 'DI', 'DIS', 'DISP']:
                self.Type = 'DISP'
            elif self.Type in [2, 'V', 'VE', 'VEL', 'VELO']:
                self.Type = 'VELO'
            elif self.Type in [3, 'A', 'AC', 'ACC', 'ACCE']:
                self.Type = 'ACCE'
            else:
                msg = 'invalid RLOAD2 type  Type=|%s|' % self.Type
                raise RuntimeError(msg)
            assert len(card) <= 8, 'len(RLOAD2 card) = %i' % len(card)
        else:
            raise NotImplementedError(data)
Ejemplo n.º 2
0
    def __init__(self, card=None, data=None, comment=''):
        TabularLoad.__init__(self, card, data)
        if comment:
            self._comment = comment
        if card:
            self.sid = integer(card, 1, 'sid')
            self.exciteID = integer(card, 2, 'exciteID')
            self.delay = integer_double_or_blank(card, 3, 'delay')
            self.dphase = integer_double_or_blank(card, 4, 'dphase')
            self.tb = integer_or_blank(card, 5, 'tb', 0)
            self.tp = integer_or_blank(card, 6, 'tp', 0)
            self.Type = string_or_blank(card, 7, 'Type', 'LOAD')

            if self.Type in [0, 'L', 'LO', 'LOA', 'LOAD']:
                self.Type = 'LOAD'
            elif self.Type in [1, 'D', 'DI', 'DIS', 'DISP']:
                self.Type = 'DISP'
            elif self.Type in [2, 'V', 'VE', 'VEL', 'VELO']:
                self.Type = 'VELO'
            elif self.Type in [3, 'A', 'AC', 'ACC', 'ACCE']:
                self.Type = 'ACCE'
            else:
                msg = 'invalid RLOAD2 type  Type=|%s|' % self.Type
                raise RuntimeError(msg)
            assert len(card) <= 8, 'len(RLOAD2 card) = %i' % len(card)
        else:
            raise NotImplementedError(data)
Ejemplo n.º 3
0
    def __init__(self, card=None, data=None, comment=''):
        TabularLoad.__init__(self, card, data)
        if comment:
            self._comment = comment
        if card:
            self.sid = integer(card, 1, 'sid')
            self.exciteID = integer(card, 2, 'exciteID')
            self.delay = integer_double_or_blank(card, 3, 'delay', 0)
            self.dphase = integer_double_or_blank(card, 4, 'dphase')
            self.tc = integer_double_or_blank(card, 5, 'tc', 0)
            self.td = integer_double_or_blank(card, 6, 'td', 0)
            self.Type = integer_string_or_blank(card, 7, 'Type', 'LOAD')
            assert self.tc > 0 or self.td > 0, 'either RLOAD TC or TD > 0; tc=%s td=%s' % (tc, td)

            if self.Type in [0, 'L', 'LO', 'LOA', 'LOAD']:
                self.Type = 'LOAD'
            elif self.Type in [1, 'D', 'DI', 'DIS', 'DISP']:
                self.Type = 'DISP'
            elif self.Type in [2, 'V', 'VE', 'VEL', 'VELO']:
                self.Type = 'VELO'
            elif self.Type in [3, 'A', 'AC', 'ACC', 'ACCE']:
                self.Type = 'ACCE'
            else:
                msg = 'invalid RLOAD1 type  Type=%r' % self.Type
                raise RuntimeError(msg)
            assert len(card) <= 8, 'len(RLOAD1 card) = %i' % len(card)
        else:
            raise NotImplementedError(data)
Ejemplo n.º 4
0
    def __init__(self, card=None, data=None, comment=''):
        LineElement.__init__(self, card, data)
        if comment:
            self._comment = comment
        if card:
            self.eid = integer(card, 1, 'eid')
            self.pid = integer_or_blank(card, 2, 'pid', self.eid)
            self.ga = integer(card, 3, 'ga')
            self.gb = integer(card, 4, 'gb')
            x1Go = integer_double_or_blank(card, 5, 'x1_g0', 0.0)
            if isinstance(x1Go, integer_types):
                self.g0 = x1Go
                self.x = None
            elif isinstance(x1Go, float):
                self.g0 = None
                self.x = array([double_or_blank(card, 5, 'x1', 0.0),
                                double_or_blank(card, 6, 'x2', 0.0),
                                double_or_blank(card, 7, 'x3', 0.0)], dtype='float64')
                if norm(self.x) == 0.0:
                    msg = 'G0 vector defining plane 1 is not defined.\n'
                    msg += 'G0 = %s\n' % self.g0
                    msg += 'X  = %s\n' % self.x
                    raise RuntimeError(msg)
            else:
                raise ValueError('invalid x1Go=|%s| on CBEND' % x1Go)
            self.geom = integer(card, 8, 'geom')

            assert len(card) == 9, 'len(CBEND card) = %i' % len(card)
            assert self.geom in [1, 2, 3, 4], 'geom is invalid geom=|%s|' % self.geom
        else:
            raise NotImplementedError(data)

        if self.g0 in [self.ga, self.gb]:
            msg = 'G0=%s cannot be GA=%s or GB=%s' % (self.g0, self.ga, self.gb)
            raise RuntimeError(msg)
Ejemplo n.º 5
0
 def initX_G0(self, card):
     field5 = integer_double_or_blank(card, 5, 'g0_x1', 0.0)
     if isinstance(field5, int):
         self.g0 = field5
         self.x1 = None
         self.x2 = None
         self.x3 = None
     elif isinstance(field5, float):
         self.g0 = None
         self.x1 = field5
         self.x2 = double_or_blank(card, 6, 'x2', 0.0)
         self.x3 = double_or_blank(card, 7, 'x3', 0.0)
         if norm([self.x1, self.x2, self.x3]) == 0.0:
             msg = 'G0 vector defining plane 1 is not defined.\n'
             msg += 'G0 = %s\n' % self.g0
             msg += 'X1 = %s\n' % self.x1
             msg += 'X2 = %s\n' % self.x2
             msg += 'X3 = %s\n' % self.x3
             raise RuntimeError(msg)
     else:
         msg = ('field5 on %s (G0/X1) is the wrong type...id=%s field5=%s '
                'type=%s' %(self.type, self.eid, field5, type(field5)))
         raise RuntimeError(msg)
         self.g0 = None
         self.x1 = 0.
         self.x2 = 0.
         self.x3 = 0.
Ejemplo n.º 6
0
    def __init__(self, card=None, data=None, comment=''):
        TriShell.__init__(self, card, data)
        if comment:
            self._comment = comment
        #: Element ID
        self.eid = integer(card, 1, 'eid')
        #: Property ID
        self.pid = integer(card, 2, 'pid')

        nids = [integer(card, 3, 'n1'),
                integer(card, 4, 'n2'),
                integer(card, 5, 'n3')]

        self.prepareNodeIDs(nids)
        assert len(self.nodes) == 3

        self.thetaMcid = integer_double_or_blank(card, 6, 'thetaMcid', 0.0)
        self.zOffset = double_or_blank(card, 7, 'zOffset', 0.0)
        blank(card, 8, 'blank')
        blank(card, 9, 'blank')
        blank(card, 10, 'blank')

        self.TFlag = integer_or_blank(card, 11, 'TFlag', 0)
        self.T1 = double_or_blank(card, 11, 'T1', 1.0)
        self.T2 = double_or_blank(card, 12, 'T2', 1.0)
        self.T3 = double_or_blank(card, 13, 'T3', 1.0)
        assert len(card) <= 14, 'len(CTRIAR card) = %i' % len(card)
Ejemplo n.º 7
0
    def __init__(self, card=None, data=None, comment=''):
        TriShell.__init__(self, card, data)
        if comment:
            self._comment = comment
        #: Element ID
        self.eid = integer(card, 1, 'eid')
        #: Property ID
        self.pid = integer(card, 2, 'pid')

        nids = [
            integer(card, 3, 'n1'),
            integer(card, 4, 'n2'),
            integer(card, 5, 'n3')
        ]

        self.prepareNodeIDs(nids)
        assert len(self.nodes) == 3

        self.thetaMcid = integer_double_or_blank(card, 6, 'thetaMcid', 0.0)
        self.zOffset = double_or_blank(card, 7, 'zOffset', 0.0)
        blank(card, 8, 'blank')
        blank(card, 9, 'blank')
        blank(card, 10, 'blank')

        self.TFlag = integer_or_blank(card, 11, 'TFlag', 0)
        self.T1 = double_or_blank(card, 11, 'T1', 1.0)
        self.T2 = double_or_blank(card, 12, 'T2', 1.0)
        self.T3 = double_or_blank(card, 13, 'T3', 1.0)
        assert len(card) <= 14, 'len(CTRIAR card) = %i' % len(card)
Ejemplo n.º 8
0
    def __init__(self, card=None, data=None, comment=''):
        TriShell.__init__(self, card, data)
        if comment:
            self._comment = comment
        if card:
            #: Element ID
            self.eid = integer(card, 1, 'eid')
            #: Property ID
            self.pid = integer(card, 2, 'pid')

            nids = [
                integer_or_blank(card, 3, 'n1'),
                integer_or_blank(card, 4, 'n2'),
                integer_or_blank(card, 5, 'n3'),
                integer_or_blank(card, 6, 'n4'),
                integer_or_blank(card, 7, 'n5'),
                integer_or_blank(card, 8, 'n6')
            ]
            self.thetaMcid = integer_double_or_blank(card, 9, 'theta_mcsid',
                                                     0.0)
            assert len(card) <= 10, 'len(CTRIAX card) = %i' % len(card)
        else:
            raise NotImplementedError(data)
        self.prepareNodeIDs(nids, allowEmptyNodes=True)
        assert len(nids) == 6, 'error on CTRIAX'
Ejemplo n.º 9
0
    def __init__(self, card=None, data=None, comment=''):
        """
        Design Optimization Parameters
        Overrides default values of parameters used in design optimization

        ::

          DOPTPRM PARAM1 VAL1 PARAM2 VAL2 PARAM3 VAL3 PARAM4 VAL4
                  PARAM5 VAL5 -etc.-
        """
        if comment:
            self._comment = comment

        nFields = len(card) - 1
        self.params = {}
        for i in range(0, nFields, 2):
            param = string_or_blank(card, i + 1, 'param')
            default_value = None
            if param is None:
                continue
            if param in self.defaults:
                default_value = self.defaults[param]
            val = integer_double_or_blank(card, i + 2, '%s_value' % param,
                                          default_value)
            self.params[param] = val
Ejemplo n.º 10
0
    def add(self, card=None, data=None, comment=''):
        if self.n == 1:
            raise RuntimeError('only one CBAROR is allowed')
        self.n = 1
        if comment:
            self._comment = comment

        self.property_id = integer_or_blank(card, 2, 'pid')

        #---------------------------------------------------------
        # x / g0
        field5 = integer_double_or_blank(card, 5, 'g0_x1', 0.0)
        if isinstance(field5, int):
            self.is_g0 = True
            self.g0 = field5
            self.x = [0., 0., 0.]
        elif isinstance(field5, float):
            self.is_g0 = False
            self.g0 = None
            self.x = array([
                field5,
                double_or_blank(card, 6, 'x2', 0.0),
                double_or_blank(card, 7, 'x3', 0.0)
            ],
                           dtype='float64')
        self.offt = string_or_blank(card, 8, 'offt', 'GGG')
        assert len(card) <= 9, 'len(CBAROR card) = %i' % len(card)
Ejemplo n.º 11
0
 def __init__(self, card=None, data=None, comment=''):
     LineElement.__init__(self, card, data)
     if comment:
         self._comment = comment
     if card:
         self.eid = integer(card, 1, 'eid')
         self.pid = integer_or_blank(card, 2, 'pid', self.eid)
         self.ga = integer(card, 3, 'ga')
         self.gb = integer(card, 4, 'gb')
         x1Go = integer_double_or_blank(card, 5, 'x1_g0')
         if isinstance(x1Go, int):
             self.g0 = x1Go
             self.x1 = None
             self.x2 = None
             self.x3 = None
         elif isinstance(x1Go, float):
             self.g0 = None
             self.x1 = x1Go
             self.x2 = double(card, 6, 'x2')
             self.x3 = double(card, 7, 'x3')
         else:
             raise ValueError('invalid x1Go=|%s| on CBEND' % x1Go)
         self.geom = integer(card, 8, 'geom')
         assert len(card) == 9, 'len(CBEND card) = %i' % len(card)
         assert self.geom in [1, 2, 3,
                              4], 'geom is invalid geom=|%s|' % self.geom
     else:
         raise NotImplementedError(data)
Ejemplo n.º 12
0
 def __init__(self, card=None, data=None, comment=''):
     if comment:
         self._comment = comment
     if card:
         self.oid = integer(card, 1, 'oid')
         self.rid = integer(card, 2, 'rid')
         self.lid = integer_double_or_blank(card, 3, 'lid', -1e20)
         self.uid = integer_double_or_blank(card, 4, 'uid', 1e20)
         self.lowfq = double_or_blank(card, 5, 'lowfq', 0.0)
         self.highfq = double_or_blank(card, 6, 'highfq', 1e20)
         assert len(card) <= 7, 'len(DCONSTR card) = %i' % len(card)
     else:
         self.oid = data[0]
         self.rid = data[1]
         self.lid = data[2]
         self.uid = data[3]
         self.lowfq = data[4]
         self.highfq = data[5]
Ejemplo n.º 13
0
    def add(self, card, comment=''):
        i = self.i
        eid = integer(card, 1, 'element_id')
        self.element_id[i] = eid
        self.property_id[i] = integer_or_blank(card, 2, 'property_id', eid)
        self.node_ids[i] = [integer(card, 3, 'GA'), integer(card, 4, 'GB')]

        #---------------------------------------------------------
        # x / g0
        field5 = integer_double_or_blank(card, 5, 'x1_g0')
        if isinstance(field5, int):
            self.is_g0[i] = True
            self.g0[i] = field5
        elif isinstance(field5, float):
            self.is_g0[i] = False
            x = array([
                field5,
                double_or_blank(card, 6, 'x2', x2_default),
                double_or_blank(card, 7, 'x3', x3_default)
            ],
                      dtype='float64')
            self.x[i, :] = x
            if norm(x) == 0.0:
                msg = 'G0 vector defining plane 1 is not defined on %s %s.\n' % (
                    self.type, eid)
                msg += 'G0 = %s\n' % field5
                msg += 'X  = %s\n' % x
                msg += '%s' % card
                raise RuntimeError(msg)
        #else:
        #msg = ('field5 on %s (G0/X1) is the wrong type...eid=%s field5=%s '
        #'type=%s' % (self.type, eid, field5, type(field5)))
        #raise RuntimeError(msg)

        #---------------------------------------------------------
        #: Element coordinate system identification. A 0 means the basic
        #: coordinate system. If CID is blank, then the element coordinate
        #: system is determined from GO or Xi.
        #: (default=blank=element-based)
        cid = integer_or_blank(card, 8, 'cid')
        if cid is not None:
            self.cid[i] = cid
        #: Location of spring damper (0 <= s <= 1.0)
        self.s[i] = double_or_blank(card, 9, 's', 0.5)
        #: Coordinate system identification of spring-damper offset. See
        #: Remark 9. (Integer > -1; Default = -1, which means the offset
        #: point lies on the line between GA and GB
        self.ocid[i] = integer_or_blank(card, 10, 'ocid', -1)
        #: Components of spring-damper offset in the OCID coordinate system
        #: if OCID > 0.
        self.si[i, :] = [
            double_or_blank(card, 11, 's1'),
            double_or_blank(card, 12, 's2'),
            double_or_blank(card, 13, 's3')
        ]
        assert len(card) <= 14, 'len(CBUSH card) = %i' % len(card)
        self.i += 1
Ejemplo n.º 14
0
    def add_cquad4(self, card=None, data=None, comment=''):
        #QuadShell.__init__(self, card, data)
        if comment:
            self._comment = comment
        if card:
            eid = integer(card, 1, 'eid')
            pid = integer(card, 2, 'pid')
            nids = [integer(card, 3, 'n1'),
                    integer(card, 4, 'n2'),
                    integer(card, 5, 'n3'),
                    integer(card, 6, 'n4')]
            thetaMcid = integer_double_or_blank(card, 7, 'thetaMcid', 0.0)
            zOffset = double_or_blank(card, 8, 'zOffset', 0.0)
            blank(card, 9, 'blank')
            TFlag = integer_or_blank(card, 10, 'TFlag', 0)
            T1 = double_or_blank(card, 11, 'T1', 1.0)
            T2 = double_or_blank(card, 12, 'T2', 1.0)
            T3 = double_or_blank(card, 13, 'T3', 1.0)
            T4 = double_or_blank(card, 14, 'T4', 1.0)
            assert len(card) <= 15, 'len(CQUAD4 card) = %i' % len(card)
        else:
            eid = data[0]
            pid = data[1]
            nids = data[2:6]

            thetaMcid = data[6]
            zOffset = data[7]
            TFlag = data[8]
            T1 = data[9]
            T2 = data[10]
            T3 = data[11]
            T4 = data[12]
            if T1 == -1.0:
                T1 = 1.0
            if T2 == -1.0:
                T2 = 1.0
            if T3 == -1.0:
                T3 = 1.0
            if T4 == -1.0:
                T4 = 1.0

        #self.prepareNodeIDs(nids)
        assert len(nids) == 4, 'CQUAD4'

        self._eidmap[eid] = self._ncquad4
        self.eid.append(eid)
        self.pid.append(pid)
        self.nodes.append(nids)
        self.thetaMcid.append(thetaMcid)
        self.zOffset.append(zOffset)
        self.TFlag.append(TFlag)
        self.T.append([T1, T2, T3, T4])

        self._ncquad4 += 1
Ejemplo n.º 15
0
    def add(self, card, comment=''):
        i = self.i
        eid = integer(card, 1, 'element_id')
        self.element_id[i] = eid
        self.property_id[i] = integer_or_blank(card, 2, 'property_id', eid)
        self.node_ids[i] = [integer(card, 3, 'GA'),
                            integer(card, 4, 'GB')]

        #---------------------------------------------------------
        # x / g0
        field5 = integer_double_or_blank(card, 5, 'x1_g0')
        if isinstance(field5, int):
            self.is_g0[i] = True
            self.g0[i] = field5
        elif isinstance(field5, float):
            self.is_g0[i] = False
            x = array([field5,
                       double_or_blank(card, 6, 'x2', x2_default),
                       double_or_blank(card, 7, 'x3', x3_default)], dtype='float64')
            self.x[i, :] = x
            if norm(x) == 0.0:
                msg = 'G0 vector defining plane 1 is not defined on %s %s.\n' % (self.type, eid)
                msg += 'G0 = %s\n' % field5
                msg += 'X  = %s\n' % x
                msg += '%s' % card
                raise RuntimeError(msg)
        #else:
            #msg = ('field5 on %s (G0/X1) is the wrong type...eid=%s field5=%s '
                   #'type=%s' % (self.type, eid, field5, type(field5)))
            #raise RuntimeError(msg)

        #---------------------------------------------------------
        #: Element coordinate system identification. A 0 means the basic
        #: coordinate system. If CID is blank, then the element coordinate
        #: system is determined from GO or Xi.
        #: (default=blank=element-based)
        cid = integer_or_blank(card, 8, 'cid')
        if cid is not None:
            self.cid[i] = cid
        #: Location of spring damper (0 <= s <= 1.0)
        self.s[i] = double_or_blank(card, 9, 's', 0.5)
        #: Coordinate system identification of spring-damper offset. See
        #: Remark 9. (Integer > -1; Default = -1, which means the offset
        #: point lies on the line between GA and GB
        self.ocid[i] = integer_or_blank(card, 10, 'ocid', -1)
        #: Components of spring-damper offset in the OCID coordinate system
        #: if OCID > 0.
        self.si[i, :] = [double_or_blank(card, 11, 's1'),
                   double_or_blank(card, 12, 's2'),
                   double_or_blank(card, 13, 's3')]
        assert len(card) <= 14, 'len(CBUSH card) = %i' % len(card)
        self.i += 1
Ejemplo n.º 16
0
    def __init__(self, card=None, data=None, comment=''):
        QuadShell.__init__(self, card, data)
        if comment:
            self._comment = comment
        if card:
            #: Element ID
            self.eid = integer(card, 1, 'eid')
            #: Property ID
            self.pid = integer(card, 2, 'pid')
            nids = [
                integer(card, 3, 'n1'),
                integer(card, 4, 'n2'),
                integer(card, 5, 'n3'),
                integer(card, 6, 'n4'),
                integer_or_blank(card, 7, 'n5', 0),
                integer_or_blank(card, 8, 'n6', 0),
                integer_or_blank(card, 9, 'n7', 0),
                integer_or_blank(card, 10, 'n8', 0)
            ]

            self.T1 = double_or_blank(card, 11, 'T1', 1.0)
            self.T2 = double_or_blank(card, 12, 'T2', 1.0)
            self.T3 = double_or_blank(card, 13, 'T3', 1.0)
            self.T4 = double_or_blank(card, 14, 'T4', 1.0)
            self.thetaMcid = integer_double_or_blank(card, 15, 'thetaMcid',
                                                     0.0)
            self.zOffset = double_or_blank(card, 16, 'zOffset', 0.0)
            self.TFlag = integer_or_blank(card, 17, 'TFlag', 0)
            assert len(card) <= 18, 'len(CQUAD4 card) = %i' % len(card)
        else:
            #print "CQUAD8 = ",data
            #(6401,
            #6400,
            #6401, 6402, 6405, 6403, 0, 0, 6404, 0,
            #-1.0, -1.0, -1.0, -1.0,
            #0.0, 0)
            self.eid = data[0]
            self.pid = data[1]
            nids = data[2:10]
            self.T1 = data[10]
            self.T2 = data[11]
            self.T3 = data[12]
            self.T4 = data[13]
            self.thetaMcid = data[14]
            self.zOffset = data[14]
            self.TFlag = data[15]

        self.prepareNodeIDs(nids, allowEmptyNodes=True)
        assert len(self.nodes) == 8
Ejemplo n.º 17
0
    def __init__(self, card=None, data=None, comment=''):
        BushElement.__init__(self, card, data)
        if comment:
            self._comment = comment
        if card:
            self.eid = integer(card, 1, 'eid')
            self.pid = integer_or_blank(card, 2, 'pid', self.eid)
            self.ga = integer(card, 3, 'ga')
            self.gb = integer_or_blank(card, 4, 'gb')

            x1G0 = integer_double_or_blank(card, 5, 'x1_g0')
            if isinstance(x1G0, int):
                self.g0 = x1G0
                self.x = None
            elif isinstance(x1G0, float):
                self.g0 = None
                x1 = x1G0
                x2 = double_or_blank(card, 6, 'x2', 0.0)
                x3 = double_or_blank(card, 7, 'x3', 0.0)
                self.x = [x1, x2, x3]
                assert max(self.x) != min(self.x), 'x=%s' % self.x
            else:
                self.g0 = None
                self.x = [None, None, None]

            #: Element coordinate system identification. A 0 means the basic
            #: coordinate system. If CID is blank, then the element coordinate
            #: system is determined from GO or Xi.
            #: (default=blank=element-based)
            self.cid = integer_or_blank(card, 8, 'cid')
            #: Location of spring damper (0 <= s <= 1.0)
            self.s = double_or_blank(card, 9, 's', 0.5)
            #: Coordinate system identification of spring-damper offset. See
            #: Remark 9. (Integer > -1; Default = -1, which means the offset
            #: point lies on the line between GA and GB
            self.ocid = integer_or_blank(card, 10, 'ocid', -1)
            #: Components of spring-damper offset in the OCID coordinate system
            #: if OCID > 0.
            self.si = [
                double_or_blank(card, 11, 's1'),
                double_or_blank(card, 12, 's2'),
                double_or_blank(card, 13, 's3')
            ]
            assert len(card) <= 14, 'len(CBUSH card) = %i' % len(card)
        else:
            self.eid = data[0]
            raise NotImplementedError('CBUSH data...')
Ejemplo n.º 18
0
    def __init__(self, card=None, data=None, comment=''):
        QuadShell.__init__(self, card, data)
        if comment:
            self._comment = comment
        if card:
            #: Element ID
            self.eid = integer(card, 1, 'eid')
            #: Property ID
            self.pid = integer(card, 2, 'pid')
            nids = [
                integer_or_blank(card, 3, 'n1'),
                integer_or_blank(card, 4, 'n2'),
                integer_or_blank(card, 5, 'n3'),
                integer_or_blank(card, 6, 'n4')
            ]

            self.thetaMcid = integer_double_or_blank(card, 7, 'thetaMcid', 0.0)
            self.zOffset = double_or_blank(card, 8, 'zOffset', 0.0)

            self.TFlag = integer_or_blank(card, 10, 'TFlag', 0)
            self.T1 = double_or_blank(card, 11, 'T1', 1.0)
            self.T2 = double_or_blank(card, 12, 'T2', 1.0)
            self.T3 = double_or_blank(card, 13, 'T3', 1.0)
            self.T4 = double_or_blank(card, 14, 'T4', 1.0)
            assert len(card) <= 15, 'len(CQUADR card) = %i' % len(card)
        else:
            self.eid = data[0]
            self.pid = data[1]
            nids = data[2:6]

            self.thetaMcid = data[6]
            self.zOffset = data[7]
            self.TFlag = data[8]
            self.T1 = data[9]
            self.T2 = data[10]
            self.T3 = data[11]
            self.T4 = data[12]
            if self.T1 == -1.0:
                self.T1 = 1.0
            if self.T2 == -1.0:
                self.T2 = 1.0
            if self.T3 == -1.0:
                self.T3 = 1.0
            if self.T4 == -1.0:
                self.T4 = 1.0
        self.prepareNodeIDs(nids)
        assert len(self.nodes) == 4, 'CQUADR'
Ejemplo n.º 19
0
    def __init__(self, card=None, data=None, comment=''):
        TabularLoad.__init__(self, card, data)
        if comment:
            self._comment = comment
        if card:
            #: load ID
            self.sid = integer(card, 1, 'sid')

            #: Identification number of DAREA or SPCD entry set or a thermal load
            #: set (in heat transfer analysis) that defines {A}. (Integer > 0)
            self.exciteID = integer(card, 2, 'exciteID')

            #: If it is a non-zero integer, it represents the
            #: identification number of DELAY Bulk Data entry that defines .
            #: If it is real, then it directly defines the value of that will
            #: be used for all degrees-of-freedom that are excited by this
            #: dynamic load entry.  See also Remark 9. (Integer >= 0,
            #: real or blank)
            self.delay = integer_double_or_blank(card, 3, 'delay', 0)

            #: Defines the type of the dynamic excitation. (LOAD,DISP, VELO, ACCE)
            self.Type = integer_string_or_blank(card, 4, 'Type', 'LOAD')

            #: Identification number of TABLEDi entry that gives F(t). (Integer > 0)
            self.tid = integer(card, 5, 'tid')

            #: Factor for initial displacements of the enforced degrees-of-freedom.
            #: (Real; Default = 0.0)
            self.us0 = double_or_blank(card, 6, 'us0', 0.0)

            #: Factor for initial velocities of the enforced degrees-of-freedom.
            #: (Real; Default = 0.0)
            self.vs0 = double_or_blank(card, 7, 'vs0', 0.0)
            if   self.Type in [0, 'L', 'LO', 'LOA', 'LOAD']:
                self.Type = 'LOAD'
            elif self.Type in [1, 'D', 'DI', 'DIS', 'DISP']:
                self.Type = 'DISP'
            elif self.Type in [2, 'V', 'VE', 'VEL', 'VELO']:
                self.Type = 'VELO'
            elif self.Type in [3, 'A', 'AC', 'ACC', 'ACCE']:
                self.Type = 'ACCE'
            else:
                msg = 'invalid TLOAD1 type  Type=|%s|' % self.Type
                raise RuntimeError(msg)
            assert len(card) <= 8, 'len(TLOAD1 card) = %i' % len(card)
        else:
            raise NotImplementedError(data)
Ejemplo n.º 20
0
    def __init__(self, card=None, data=None, comment=''):
        TabularLoad.__init__(self, card, data)
        if comment:
            self._comment = comment
        if card:
            #: load ID
            self.sid = integer(card, 1, 'sid')

            #: Identification number of DAREA or SPCD entry set or a thermal load
            #: set (in heat transfer analysis) that defines {A}. (Integer > 0)
            self.exciteID = integer(card, 2, 'exciteID')

            #: If it is a non-zero integer, it represents the
            #: identification number of DELAY Bulk Data entry that defines .
            #: If it is real, then it directly defines the value of that will
            #: be used for all degrees-of-freedom that are excited by this
            #: dynamic load entry.  See also Remark 9. (Integer >= 0,
            #: real or blank)
            self.delay = integer_double_or_blank(card, 3, 'delay')

            #: Defines the type of the dynamic excitation. (LOAD,DISP, VELO, ACCE)
            self.Type = integer_string_or_blank(card, 4, 'Type', 'LOAD')

            #: Identification number of TABLEDi entry that gives F(t). (Integer > 0)
            self.tid = integer(card, 5, 'tid')

            #: Factor for initial displacements of the enforced degrees-of-freedom.
            #: (Real; Default = 0.0)
            self.us0 = double_or_blank(card, 6, 'us0', 0.0)

            #: Factor for initial velocities of the enforced degrees-of-freedom.
            #: (Real; Default = 0.0)
            self.vs0 = double_or_blank(card, 7, 'vs0', 0.0)
            if   self.Type in [0, 'L', 'LO', 'LOA', 'LOAD']:
                self.Type = 'LOAD'
            elif self.Type in [1, 'D', 'DI', 'DIS', 'DISP']:
                self.Type = 'DISP'
            elif self.Type in [2, 'V', 'VE', 'VEL', 'VELO']:
                self.Type = 'VELO'
            elif self.Type in [3, 'A', 'AC', 'ACC', 'ACCE']:
                self.Type = 'ACCE'
            else:
                msg = 'invalid TLOAD1 type  Type=|%s|' % self.Type
                raise RuntimeError(msg)
            assert len(card) <= 8, 'len(TLOAD1 card) = %i' % len(card)
        else:
            raise NotImplementedError(data)
Ejemplo n.º 21
0
    def __init__(self, card=None, data=None, comment=''):
        QuadShell.__init__(self, card, data)
        if comment:
            self._comment = comment
        if card:
            #: Element ID
            self.eid = integer(card, 1, 'eid')
            #: Property ID
            self.pid = integer(card, 2, 'pid')
            nids = [integer(card, 3, 'n1'),
                    integer(card, 4, 'n2'),
                    integer(card, 5, 'n3'),
                    integer(card, 6, 'n4'),
                    integer_or_blank(card, 7, 'n5', 0),
                    integer_or_blank(card, 8, 'n6', 0),
                    integer_or_blank(card, 9, 'n7', 0),
                    integer_or_blank(card, 10, 'n8', 0)]

            self.T1 = double_or_blank(card, 11, 'T1', 1.0)
            self.T2 = double_or_blank(card, 12, 'T2', 1.0)
            self.T3 = double_or_blank(card, 13, 'T3', 1.0)
            self.T4 = double_or_blank(card, 14, 'T4', 1.0)
            self.thetaMcid = integer_double_or_blank(card, 15, 'thetaMcid', 0.0)
            self.zOffset = double_or_blank(card, 16, 'zOffset', 0.0)
            self.TFlag = integer_or_blank(card, 17, 'TFlag', 0)
            assert len(card) <= 18, 'len(CQUAD4 card) = %i' % len(card)
        else:
            #print "CQUAD8 = ",data
            #(6401,
            #6400,
            #6401, 6402, 6405, 6403, 0, 0, 6404, 0,
            #-1.0, -1.0, -1.0, -1.0,
            #0.0, 0)
            self.eid = data[0]
            self.pid = data[1]
            nids = data[2:10]
            self.T1 = data[10]
            self.T2 = data[11]
            self.T3 = data[12]
            self.T4 = data[13]
            self.thetaMcid = data[14]
            self.zOffset = data[14]
            self.TFlag = data[15]

        self.prepareNodeIDs(nids, allowEmptyNodes=True)
        assert len(self.nodes) == 8
Ejemplo n.º 22
0
    def __init__(self, card=None, data=None, comment=''):
        QuadShell.__init__(self, card, data)
        if comment:
            self._comment = comment
        if card:
            #: Element ID
            self.eid = integer(card, 1, 'eid')
            #: Property ID
            self.pid = integer(card, 2, 'pid')
            nids = [integer_or_blank(card, 3, 'n1'),
                    integer_or_blank(card, 4, 'n2'),
                    integer_or_blank(card, 5, 'n3'),
                    integer_or_blank(card, 6, 'n4')]

            self.thetaMcid = integer_double_or_blank(card, 7, 'thetaMcid', 0.0)
            self.zOffset = double_or_blank(card, 8, 'zOffset', 0.0)

            self.TFlag = integer_or_blank(card, 10, 'TFlag', 0)
            self.T1 = double_or_blank(card, 11, 'T1', 1.0)
            self.T2 = double_or_blank(card, 12, 'T2', 1.0)
            self.T3 = double_or_blank(card, 13, 'T3', 1.0)
            self.T4 = double_or_blank(card, 14, 'T4', 1.0)
            assert len(card) <= 15, 'len(CQUADR card) = %i' % len(card)
        else:
            self.eid = data[0]
            self.pid = data[1]
            nids = data[2:6]

            self.thetaMcid = data[6]
            self.zOffset = data[7]
            self.TFlag = data[8]
            self.T1 = data[9]
            self.T2 = data[10]
            self.T3 = data[11]
            self.T4 = data[12]
            if self.T1 == -1.0:
                self.T1 = 1.0
            if self.T2 == -1.0:
                self.T2 = 1.0
            if self.T3 == -1.0:
                self.T3 = 1.0
            if self.T4 == -1.0:
                self.T4 = 1.0
        self.prepareNodeIDs(nids)
        assert len(self.nodes) == 4, 'CQUADR'
Ejemplo n.º 23
0
    def __init__(self, card=None, data=None, comment=''):
        BushElement.__init__(self, card, data)
        if comment:
            self._comment = comment
        if card:
            self.eid = integer(card, 1, 'eid')
            self.pid = integer_or_blank(card, 2, 'pid', self.eid)
            self.ga = integer(card, 3, 'ga')
            self.gb = integer_or_blank(card, 4, 'gb')

            x1G0 = integer_double_or_blank(card, 5, 'x1_g0')
            if isinstance(x1G0, int):
                self.g0 = x1G0
                self.x = None
            elif isinstance(x1G0, float):
                self.g0 = None
                x1 = x1G0
                x2 = double_or_blank(card, 6, 'x2', 0.0)
                x3 = double_or_blank(card, 7, 'x3', 0.0)
                self.x = [x1, x2, x3]
                assert max(self.x) != min(self.x), 'x=%s' % self.x
            else:
                self.g0 = None
                self.x = [None, None, None]

            #: Element coordinate system identification. A 0 means the basic
            #: coordinate system. If CID is blank, then the element coordinate
            #: system is determined from GO or Xi.
            #: (default=blank=element-based)
            self.cid = integer_or_blank(card, 8, 'cid')
            #: Location of spring damper (0 <= s <= 1.0)
            self.s = double_or_blank(card, 9, 's', 0.5)
            #: Coordinate system identification of spring-damper offset. See
            #: Remark 9. (Integer > -1; Default = -1, which means the offset
            #: point lies on the line between GA and GB
            self.ocid = integer_or_blank(card, 10, 'ocid', -1)
            #: Components of spring-damper offset in the OCID coordinate system
            #: if OCID > 0.
            self.si = [double_or_blank(card, 11, 's1'),
                       double_or_blank(card, 12, 's2'),
                       double_or_blank(card, 13, 's3')]
            assert len(card) <= 14, 'len(CBUSH card) = %i' % len(card)
        else:
            self.eid = data[0]
            raise NotImplementedError('CBUSH data...')
Ejemplo n.º 24
0
 def initX_G0(self, card):
     field5 = integer_double_or_blank(card, 5, 'g0_x1', 0.0)
     if isinstance(field5, integer_types):
         self.g0 = field5
         self.x = None
     elif isinstance(field5, float):
         self.g0 = None
         self.x = array([field5,
                         double_or_blank(card, 6, 'x2', 0.0),
                         double_or_blank(card, 7, 'x3', 0.0)], dtype='float64')
         if norm(self.x) == 0.0:
             msg = 'G0 vector defining plane 1 is not defined.\n'
             msg += 'G0 = %s\n' % self.g0
             msg += 'X  = %s\n' % self.x
             raise RuntimeError(msg)
     else:
         msg = ('field5 on %s (G0/X1) is the wrong type...id=%s field5=%s '
                'type=%s' % (self.type, self.eid, field5, type(field5)))
         raise RuntimeError(msg)
Ejemplo n.º 25
0
 def initX_G0(self, card):
     field5 = integer_double_or_blank(card, 5, 'g0_x1')
     if isinstance(field5, int):
         self.g0 = field5
         self.x1 = None
         self.x2 = None
         self.x3 = None
     elif isinstance(field5, float):
         self.g0 = None
         self.x1 = field5
         self.x2 = double_or_blank(card, 6, 'x2', 0.0)
         self.x3 = double_or_blank(card, 7, 'x3', 0.0)
     else:
         #msg = 'field5 on %s is the wrong type...id=%s field5=%s '
         #      'type=%s' %(self.type,self.eid,field5,type(field5))
         #raise InvalidFieldError(msg)
         self.g0 = None
         self.x1 = 0.
         self.x2 = 0.
         self.x3 = 0.
Ejemplo n.º 26
0
 def __init__(self, card=None, data=None, comment=''):
     """
     # .. todo:: not done...
     """
     Element.__init__(self, card, data)
     if comment:
         self._comment = comment
     if card:
         self.eid = integer(card, 1, 'eid')
         self.pid = integer_or_blank(card, 2, 'pid', self.eid)
         self.ga = integer_or_blank(card, 3, 'ga')
         self.gb = integer_or_blank(card, 4, 'gb')
         x1G0 = integer_double_or_blank(card, 5, 'x1_g0')
         if isinstance(x1G0, integer_types):
             self.g0 = x1G0
             self.x = None
             self.cid = None
         elif isinstance(x1G0, float):
             self.g0 = None
             x1 = x1G0
             x2 = double_or_blank(card, 6, 'x2', 0.0)
             x3 = double_or_blank(card, 7, 'x3', 0.0)
             self.x = [x1, x2, x3]
             self.cid = integer_or_blank(card, 8, 'cid', 0)
         else:
             #raise RuntimeError('invalid CGAP...x1/g0 = |%s|' %(x1G0))
             self.g0 = None
             self.x = [None, None, None]
             self.cid = None
         assert len(card) <= 9, 'len(CGAP card) = %i' % len(card)
     else:
         self.eid = data[0]
         self.pid = data[1]
         self.ga = data[2]
         self.gb = data[3]
         self.g0 = data[4]
         x1 = data[5]
         x2 = data[6]
         x3 = data[7]
         self.x = [x1, x2, x3]
         self.cid = data[8]
Ejemplo n.º 27
0
    def __init__(self, card=None, data=None, comment=''):
        LineElement.__init__(self, card, data)
        if comment:
            self._comment = comment
        if card:
            self.eid = integer(card, 1, 'eid')
            self.pid = integer_or_blank(card, 2, 'pid', self.eid)
            self.ga = integer(card, 3, 'ga')
            self.gb = integer(card, 4, 'gb')
            x1Go = integer_double_or_blank(card, 5, 'x1_g0', 0.0)
            if isinstance(x1Go, int):
                self.g0 = x1Go
                self.x = None
            elif isinstance(x1Go, float):
                self.g0 = None
                self.x = array([
                    double_or_blank(card, 5, 'x1', 0.0),
                    double_or_blank(card, 6, 'x2', 0.0),
                    double_or_blank(card, 7, 'x3', 0.0)
                ],
                               dtype='float64')
                if norm(self.x) == 0.0:
                    msg = 'G0 vector defining plane 1 is not defined.\n'
                    msg += 'G0 = %s\n' % self.g0
                    msg += 'X  = %s\n' % self.x
                    raise RuntimeError(msg)
            else:
                raise ValueError('invalid x1Go=|%s| on CBEND' % x1Go)
            self.geom = integer(card, 8, 'geom')

            assert len(card) == 9, 'len(CBEND card) = %i' % len(card)
            assert self.geom in [1, 2, 3,
                                 4], 'geom is invalid geom=|%s|' % self.geom
        else:
            raise NotImplementedError(data)

        if self.g0 in [self.ga, self.gb]:
            msg = 'G0=%s cannot be GA=%s or GB=%s' % (self.g0, self.ga,
                                                      self.gb)
            raise RuntimeError(msg)
Ejemplo n.º 28
0
    def __init__(self, card=None, data=None, comment=''):
        TriShell.__init__(self, card, data)
        if comment:
            self._comment = comment
        if card:
            #: Element ID
            self.eid = integer(card, 1, 'eid')
            #: Property ID
            self.pid = integer(card, 2, 'pid')

            nids = [integer_or_blank(card, 3, 'n1'),
                    integer_or_blank(card, 4, 'n2'),
                    integer_or_blank(card, 5, 'n3'),
                    integer_or_blank(card, 6, 'n4'),
                    integer_or_blank(card, 7, 'n5'),
                    integer_or_blank(card, 8, 'n6')]
            self.thetaMcid = integer_double_or_blank(card, 9, 'theta_mcsid', 0.0)
            assert len(card) <= 10, 'len(CTRIAX card) = %i' % len(card)
        else:
            raise NotImplementedError(data)
        self.prepareNodeIDs(nids, allowEmptyNodes=True)
        assert len(nids) == 6, 'error on CTRIAX'
Ejemplo n.º 29
0
 def initX_G0(self, card):
     field5 = integer_double_or_blank(card, 5, 'g0_x1', 0.0)
     if isinstance(field5, int):
         self.g0 = field5
         self.x = None
     elif isinstance(field5, float):
         self.g0 = None
         self.x = array([
             field5,
             double_or_blank(card, 6, 'x2', 0.0),
             double_or_blank(card, 7, 'x3', 0.0)
         ],
                        dtype='float64')
         if norm(self.x) == 0.0:
             msg = 'G0 vector defining plane 1 is not defined.\n'
             msg += 'G0 = %s\n' % self.g0
             msg += 'X  = %s\n' % self.x
             raise RuntimeError(msg)
     else:
         msg = ('field5 on %s (G0/X1) is the wrong type...id=%s field5=%s '
                'type=%s' % (self.type, self.eid, field5, type(field5)))
         raise RuntimeError(msg)
Ejemplo n.º 30
0
    def __init__(self, card=None, data=None, comment=''):
        TriShell.__init__(self, card, data)
        if comment:
            self._comment = comment
        if card:
            #: Element ID
            self.eid = integer(card, 1, 'eid')
            #: Property ID
            self.pid = integer(card, 2, 'pid')

            nids = [
                integer(card, 3, 'n1'),
                integer(card, 4, 'n2'),
                integer(card, 5, 'n3'),
                integer_or_blank(card, 6, 'n4', 0),
                integer_or_blank(card, 7, 'n5', 0),
                integer_or_blank(card, 8, 'n6', 0)
            ]

            self.thetaMcid = integer_double_or_blank(card, 9, 'thetaMcid', 0.0)
            self.zOffset = double_or_blank(card, 10, 'zOffset', 0.0)

            self.T1 = double_or_blank(card, 11, 'T1', 1.0)
            self.T2 = double_or_blank(card, 12, 'T2', 1.0)
            self.T3 = double_or_blank(card, 13, 'T3', 1.0)
            self.TFlag = integer_or_blank(card, 14, 'TFlag', 0)
            assert len(card) <= 15, 'len(CTRIA6 card) = %i' % len(card)
        else:
            self.eid = data[0]
            self.pid = data[1]
            nids = data[2:8]
            self.thetaMcid = data[8]
            self.zOffset = data[8]
            self.T1 = data[9]
            self.T2 = data[10]
            self.T3 = data[11]
            self.TFlag = data[12]
        self.prepareNodeIDs(nids, allowEmptyNodes=True)
        assert len(nids) == 6, 'error on CTRIA6'
Ejemplo n.º 31
0
 def __init__(self, card=None, data=None, comment=''):
     Element.__init__(self, card, data)
     if comment:
         self._comment = comment
     if card:
         self.eid = integer(card, 1, 'eid')
         self.pid = integer_or_blank(card, 2, 'pid', self.eid)
         self.ga = integer_or_blank(card, 3, 'ga')
         self.gb = integer_or_blank(card, 4, 'gb')
         x1G0 = integer_double_or_blank(card, 5, 'x1_g0')
         if isinstance(x1G0, int):
             self.g0 = x1G0
             self.x = None
             self.cid = None
         elif isinstance(x1G0, float):
             self.g0 = None
             x1 = x1G0
             x2 = double_or_blank(card, 6, 'x2', 0.0)
             x3 = double_or_blank(card, 7, 'x3', 0.0)
             self.x = [x1, x2, x3]
             self.cid = integer_or_blank(card, 8, 'cid', 0)
         else:
             #raise RuntimeError('invalid CGAP...x1/g0 = |%s|' %(x1G0))
             self.g0 = None
             self.x = [None, None, None]
             self.cid = None
         assert len(card) <= 9, 'len(CGAP card) = %i' % len(card)
     else:
         self.eid = data[0]
         self.pid = data[1]
         self.ga = data[2]
         self.gb = data[3]
         self.g0 = data[4]
         x1 = data[5]
         x2 = data[6]
         x3 = data[7]
         self.x = [x1, x2, x3]
         self.cid = data[8]
Ejemplo n.º 32
0
    def add(self, card=None, data=None, comment=''):
        if self.n == 1:
            raise RuntimeError('only one CBAROR is allowed')
        self.n = 1
        if comment:
            self._comment = comment

        self.property_id = integer_or_blank(card, 2, 'pid')

        # x / g0
        field5 = integer_double_or_blank(card, 5, 'g0_x1', 0.0)
        if isinstance(field5, integer_types):
            self.is_g0 = True
            self.g0 = field5
            self.x = [0., 0., 0.]
        elif isinstance(field5, float):
            self.is_g0 = False
            self.g0 = None
            self.x = array([field5,
                            double_or_blank(card, 6, 'x2', 0.0),
                            double_or_blank(card, 7, 'x3', 0.0)], dtype='float64')
        self.offt = string_or_blank(card, 8, 'offt', 'GGG')
        assert len(card) <= 9, 'len(CBAROR card) = %i' % len(card)
Ejemplo n.º 33
0
    def __init__(self, card=None, data=None, comment=''):
        TriShell.__init__(self, card, data)
        if comment:
            self._comment = comment
        if card:
            #: Element ID
            self.eid = integer(card, 1, 'eid')
            #: Property ID
            self.pid = integer(card, 2, 'pid')

            nids = [integer(card, 3, 'n1'),
                    integer(card, 4, 'n2'),
                    integer(card, 5, 'n3'),
                    integer_or_blank(card, 6, 'n4', 0),
                    integer_or_blank(card, 7, 'n5', 0),
                    integer_or_blank(card, 8, 'n6', 0)]

            self.thetaMcid = integer_double_or_blank(card, 9, 'thetaMcid', 0.0)
            self.zOffset = double_or_blank(card, 10, 'zOffset', 0.0)

            self.T1 = double_or_blank(card, 11, 'T1', 1.0)
            self.T2 = double_or_blank(card, 12, 'T2', 1.0)
            self.T3 = double_or_blank(card, 13, 'T3', 1.0)
            self.TFlag = integer_or_blank(card, 14, 'TFlag', 0)
            assert len(card) <= 15, 'len(CTRIA6 card) = %i' % len(card)
        else:
            self.eid = data[0]
            self.pid = data[1]
            nids = data[2:8]
            self.thetaMcid = data[8]
            self.zOffset = data[8]
            self.T1 = data[9]
            self.T2 = data[10]
            self.T3 = data[11]
            self.TFlag = data[12]
        self.prepareNodeIDs(nids, allowEmptyNodes=True)
        assert len(nids) == 6, 'error on CTRIA6'
Ejemplo n.º 34
0
    def __init__(self, card=None, data=None, comment=''):
        """
        Design Optimization Parameters
        Overrides default values of parameters used in design optimization

        ::

          DOPTPRM PARAM1 VAL1 PARAM2 VAL2 PARAM3 VAL3 PARAM4 VAL4
                  PARAM5 VAL5 -etc.-
        """
        if comment:
            self._comment = comment

        nfields = len(card) - 1
        self.params = {}
        for i in range(0, nfields, 2):
            param = string_or_blank(card, i + 1, 'param')
            default_value = None
            if param is None:
                continue
            if param in self.defaults:
                default_value = self.defaults[param]
            val = integer_double_or_blank(card, i + 2, '%s_value' % param, default_value)
            self.params[param] = val
Ejemplo n.º 35
0
    def test_integer_double_or_blank(self):
        """
        value = double_or_blank(card, n, fieldname, default=None)
        """
        # integer
        self.check_integer(integer_double_or_blank)

        # float
        self.check_double(integer_double_or_blank)

        # error - string
        with self.assertRaises(SyntaxError):
            integer_double_or_blank(BDFCard(['C']  ), 0, 'field')
        with self.assertRaises(SyntaxError):
            integer_double_or_blank(BDFCard(['1C']  ), 0, 'field')
        with self.assertRaises(SyntaxError):
            integer_double_or_blank(BDFCard(['C1']  ), 0, 'field')

        # blank
        double_or_blank(BDFCard(['   ']), 0, 'field')
        double_or_blank(BDFCard([None]), 0, 'field')
Ejemplo n.º 36
0
    def test_integer_double_or_blank(self):
        """
        value = double_or_blank(card, n, fieldname, default=None)
        """
        # integer
        integer_double_or_blank(BDFCard([1]), 0, 'field')
        integer_double_or_blank(BDFCard(['2']), 0, 'field')

        # float
        integer_double_or_blank(BDFCard([3.0]), 0, 'field')
        integer_double_or_blank(BDFCard(['4.0']), 0, 'field')
        integer_double_or_blank(BDFCard(['5.']), 0, 'field')

        # error - string
        with self.assertRaises(SyntaxError):
            integer_double_or_blank(BDFCard(['C']), 0, 'field')
        with self.assertRaises(SyntaxError):
            integer_double_or_blank(BDFCard(['1C']), 0, 'field')
        with self.assertRaises(SyntaxError):
            integer_double_or_blank(BDFCard(['C1']), 0, 'field')
Ejemplo n.º 37
0
    def add(self, card, comment=''):
        i = self.i

        if self.model.cbaror.n > 0:
            cbaror = self.model.cbaror
            pid_default = cbaror.property_id
            is_g0_default = cbaror.is_g0
            x1_default = cbaror.x[0]
            x2_default = cbaror.x[1]
            x3_default = cbaror.x[2]
            g0_default = cbaror.g0
            offt_default = cbaror.offt
        else:
            pid_default = None
            is_g0_default = None
            x1_default = 0.0
            x2_default = 0.0
            x3_default = 0.0
            g0_default = None
            offt_default = 'GGG'

        eid = integer(card, 1, 'element_id')
        self.element_id[i] = eid
        if pid_default is not None:
            self.property_id[i] = integer_or_blank(card, 2, 'property_id',
                                                   pid_default)
        else:
            self.property_id[i] = integer_or_blank(card, 2, 'property_id', eid)
        self.node_ids[i] = [integer(card, 3, 'GA'), integer(card, 4, 'GB')]

        #---------------------------------------------------------
        # x / g0
        if g0_default is not None:
            field5 = integer_double_or_blank(card, 5, 'g0_x1', g0_default)
        else:
            field5 = integer_double_or_blank(card, 5, 'g0_x1', x1_default)

        if isinstance(field5, int):
            self.is_g0[i] = True
            self.g0[i] = field5
        elif isinstance(field5, float):
            self.is_g0[i] = False
            x = array([
                field5,
                double_or_blank(card, 6, 'x2', x2_default),
                double_or_blank(card, 7, 'x3', x3_default)
            ],
                      dtype='float64')
            self.x[i, :] = x
            if norm(x) == 0.0:
                msg = 'G0 vector defining plane 1 is not defined on %s %s.\n' % (
                    self.type, eid)
                msg += 'G0 = %s\n' % field5
                msg += 'X  = %s\n' % x
                msg += '%s' % card
                raise RuntimeError(msg)
        else:
            msg = ('field5 on %s (G0/X1) is the wrong type...id=%s field5=%s '
                   'type=%s' % (self.type, self.eid, field5, type(field5)))
            raise RuntimeError(msg)

        #---------------------------------------------------------
        # offt
        # bit doesn't exist on the CBAR
        offt = string_or_blank(card, 8, 'offt', offt_default)

        msg = 'invalid offt parameter of CBEAM...offt=%s' % offt
        assert offt[0] in ['G', 'B', 'O', 'E'], msg
        assert offt[1] in ['G', 'B', 'O', 'E'], msg
        assert offt[2] in ['G', 'B', 'O', 'E'], msg
        self.offt[i] = offt

        self.pin_flags[i, :] = [
            integer_or_blank(card, 9, 'pa', 0),
            integer_or_blank(card, 10, 'pb', 0)
        ]

        self.wa[i, :] = [
            double_or_blank(card, 11, 'w1a', 0.0),
            double_or_blank(card, 12, 'w2a', 0.0),
            double_or_blank(card, 13, 'w3a', 0.0),
        ]

        self.wb[i, :] = [
            double_or_blank(card, 14, 'w1b', 0.0),
            double_or_blank(card, 15, 'w2b', 0.0),
            double_or_blank(card, 16, 'w3b', 0.0),
        ]
        assert len(card) <= 17, 'len(CBAR card) = %i' % len(card)

        self.i += 1
Ejemplo n.º 38
0
    def add(self, card, comment=''):
        i = self.i

        if self.model.cbaror.n > 0:
            cbaror = self.model.cbaror
            pid_default = cbaror.property_id
            is_g0_default = cbaror.is_g0
            x1_default = cbaror.x[0]
            x2_default = cbaror.x[1]
            x3_default = cbaror.x[2]
            g0_default = cbaror.g0
            offt_default = cbaror.offt
        else:
            pid_default = None
            is_g0_default = None
            x1_default = 0.0
            x2_default = 0.0
            x3_default = 0.0
            g0_default = None
            offt_default = 'GGG'

        eid = integer(card, 1, 'element_id')
        self.element_id[i] = eid
        if pid_default is not None:
            self.property_id[i] = integer_or_blank(card, 2, 'property_id', pid_default)
        else:
            self.property_id[i] = integer_or_blank(card, 2, 'property_id', eid)
        self.node_ids[i] = [integer(card, 3, 'GA'),
                            integer(card, 4, 'GB')]

        #---------------------------------------------------------
        # x / g0
        if g0_default is not None:
            field5 = integer_double_or_blank(card, 5, 'g0_x1', g0_default)
        else:
            field5 = integer_double_or_blank(card, 5, 'g0_x1', x1_default)

        if isinstance(field5, int):
            self.is_g0[i] = True
            self.g0[i] = field5
        elif isinstance(field5, float):
            self.is_g0[i] = False
            x = array([field5,
                       double_or_blank(card, 6, 'x2', x2_default),
                       double_or_blank(card, 7, 'x3', x3_default)], dtype='float64')
            self.x[i, :] = x
            if norm(x) == 0.0:
                msg = 'G0 vector defining plane 1 is not defined on %s %s.\n' % (self.type, eid)
                msg += 'G0 = %s\n' % field5
                msg += 'X  = %s\n' % x
                msg += '%s' % card
                raise RuntimeError(msg)
        else:
            msg = ('field5 on %s (G0/X1) is the wrong type...id=%s field5=%s '
                   'type=%s' % (self.type, self.eid, field5, type(field5)))
            raise RuntimeError(msg)

        #---------------------------------------------------------
        # offt
        # bit doesn't exist on the CBAR
        offt = string_or_blank(card, 8, 'offt', offt_default)

        msg = 'invalid offt parameter of CBEAM...offt=%s' % offt
        assert offt[0] in ['G', 'B', 'O', 'E'], msg
        assert offt[1] in ['G', 'B', 'O', 'E'], msg
        assert offt[2] in ['G', 'B', 'O', 'E'], msg
        self.offt[i] = offt

        self.pin_flags[i, :] = [integer_or_blank(card, 9, 'pa', 0),
                                integer_or_blank(card, 10, 'pb', 0)]

        self.wa[i, :] = [double_or_blank(card, 11, 'w1a', 0.0),
                         double_or_blank(card, 12, 'w2a', 0.0),
                         double_or_blank(card, 13, 'w3a', 0.0),]

        self.wb[i, :] = [double_or_blank(card, 14, 'w1b', 0.0),
                         double_or_blank(card, 15, 'w2b', 0.0),
                         double_or_blank(card, 16, 'w3b', 0.0),]
        assert len(card) <= 17, 'len(CBAR card) = %i' % len(card)

        self.i += 1
Ejemplo n.º 39
0
    def add(self, card, comment=''):
        i = self.i
        eid = integer(card, 1, 'element_id')
        self.element_id[i] = eid
        self.property_id[i] = integer_or_blank(card, 2, 'property_id', eid)
        self.node_ids[i] = [integer(card, 3, 'GA'),
                            integer(card, 4, 'GB')]

        #---------------------------------------------------------
        # x / g0
        field5 = integer_double_or_blank(card, 5, 'g0_x1', 0.0)
        if isinstance(field5, int):
            self.is_g0[i] = True
            self.g0[i] = field5
        elif isinstance(field5, float):
            self.is_g0[i] = False
            x = array([field5,
                       double_or_blank(card, 6, 'x2', 0.0),
                       double_or_blank(card, 7, 'x3', 0.0)])
            self.x[i, :] = x
            if norm(x) == 0.0:
                msg = 'G0 vector defining plane 1 is not defined on %s %s.\n' % (self.type, eid)
                msg += 'G0 = %s\n' % field5
                msg += 'X  = %s\n' % x
                msg += '%s' % card
                raise RuntimeError(msg)
        else:
            msg = ('field5 on %s (G0/X1) is the wrong type...id=%s field5=%s '
                   'type=%s' % (self.type, self.eid, field5, type(field5)))
            raise RuntimeError(msg)

        #---------------------------------------------------------
        # offt/bit
        field8 = double_string_or_blank(card, 8, 'offt/bit', 'GGG')
        if isinstance(field8, float):
            self.is_offt[i] = False
            self.bit[i] = field8
        elif isinstance(field8, string_types):
            self.is_offt[i] = True
            offt = field8
            msg = 'invalid offt parameter of CBEAM...offt=%s' % offt
            assert offt[0] in ['G', 'B', 'O', 'E'], msg
            assert offt[1] in ['G', 'B', 'O', 'E'], msg
            assert offt[2] in ['G', 'B', 'O', 'E'], msg
            self.offt[i] = offt
        else:
            msg = ('field8 on %s (offt/bit) is the wrong type...id=%s field5=%s '
                   'type=%s' % (self.type, self.eid, field8, type(field8)))
            raise RuntimeError(msg)

        self.pin_flags[i, :] = [integer_or_blank(card, 9, 'pa', 0),
                                integer_or_blank(card, 10, 'pb', 0)]

        self.wa[i, :] = [double_or_blank(card, 11, 'w1a', 0.0),
                         double_or_blank(card, 12, 'w2a', 0.0),
                         double_or_blank(card, 13, 'w3a', 0.0),]

        self.wb[i, :] = [double_or_blank(card, 14, 'w1b', 0.0),
                         double_or_blank(card, 15, 'w2b', 0.0),
                         double_or_blank(card, 16, 'w3b', 0.0),]
        self.sa[i] = integer_or_blank(card, 17, 'sa', 0)
        self.sb[i] = integer_or_blank(card, 18, 'sb', 0)
        assert len(card) <= 19, 'len(CBEAM card) = %i' % len(card)
        self.i += 1
Ejemplo n.º 40
0
    def add(self, card, comment=''):
        i = self.i
        eid = integer(card, 1, 'element_id')
        self.element_id[i] = eid
        self.property_id[i] = integer_or_blank(card, 2, 'property_id', eid)
        self.node_ids[i] = [integer(card, 3, 'GA'), integer(card, 4, 'GB')]

        #---------------------------------------------------------
        # x / g0
        field5 = integer_double_or_blank(card, 5, 'g0_x1', 0.0)
        if isinstance(field5, int):
            self.is_g0[i] = True
            self.g0[i] = field5
        elif isinstance(field5, float):
            self.is_g0[i] = False
            x = array([
                field5,
                double_or_blank(card, 6, 'x2', 0.0),
                double_or_blank(card, 7, 'x3', 0.0)
            ])
            self.x[i, :] = x
            if norm(x) == 0.0:
                msg = 'G0 vector defining plane 1 is not defined on %s %s.\n' % (
                    self.type, eid)
                msg += 'G0 = %s\n' % field5
                msg += 'X  = %s\n' % x
                msg += '%s' % card
                raise RuntimeError(msg)
        else:
            msg = ('field5 on %s (G0/X1) is the wrong type...id=%s field5=%s '
                   'type=%s' % (self.type, self.eid, field5, type(field5)))
            raise RuntimeError(msg)

        #---------------------------------------------------------
        # offt/bit
        field8 = double_string_or_blank(card, 8, 'offt/bit', 'GGG')
        if isinstance(field8, float):
            self.is_offt[i] = False
            self.bit[i] = field8
        elif isinstance(field8, string_types):
            self.is_offt[i] = True
            offt = field8
            msg = 'invalid offt parameter of CBEAM...offt=%s' % offt
            assert offt[0] in ['G', 'B', 'O', 'E'], msg
            assert offt[1] in ['G', 'B', 'O', 'E'], msg
            assert offt[2] in ['G', 'B', 'O', 'E'], msg
            self.offt[i] = offt
        else:
            msg = (
                'field8 on %s (offt/bit) is the wrong type...id=%s field5=%s '
                'type=%s' % (self.type, self.eid, field8, type(field8)))
            raise RuntimeError(msg)

        self.pin_flags[i, :] = [
            integer_or_blank(card, 9, 'pa', 0),
            integer_or_blank(card, 10, 'pb', 0)
        ]

        self.wa[i, :] = [
            double_or_blank(card, 11, 'w1a', 0.0),
            double_or_blank(card, 12, 'w2a', 0.0),
            double_or_blank(card, 13, 'w3a', 0.0),
        ]

        self.wb[i, :] = [
            double_or_blank(card, 14, 'w1b', 0.0),
            double_or_blank(card, 15, 'w2b', 0.0),
            double_or_blank(card, 16, 'w3b', 0.0),
        ]
        self.sa[i] = integer_or_blank(card, 17, 'sa', 0)
        self.sb[i] = integer_or_blank(card, 18, 'sb', 0)
        assert len(card) <= 19, 'len(CBEAM card) = %i' % len(card)
        self.i += 1
Ejemplo n.º 41
0
    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')
        #if comment:
            #self._comment = comment
        self.element_id[i] = integer(card, 1, 'eid')
        blank(card, 2, 'blank')
        self.refgrid[i] = integer(card, 3, 'refgrid')
        self.refc[i] = components_or_blank(card, 4, 'refc', 0)
        #iUM = fields.index('UM')

        fields = [field.upper() if isinstance(field, string_types) else field for field in card[5:]]
        iOffset = 5
        iWtMax = len(fields) + iOffset
        try:
            iAlpha = fields.index('ALPHA') + iOffset
            iWtMax = iAlpha  # the index to start parsing UM
            iUmStop = iAlpha  # the index to stop  parsing UM
        except ValueError:
            iAlpha = None
            iUmStop = iWtMax
        #print("iAlpha = %s" % iAlpha)
        try:
            iUm = fields.index('UM') + iOffset
            iWtMax = iUm
        except ValueError:
            iUm = None
        #print("iAlpha=%s iUm=%s" % (iAlpha, iUm))
        #print("iAlpha=%s iWtMax=%s" % (iAlpha, iWtMax))

        #print("iUM = %s" % iUM)
        WtCG_groups = []

        i = iOffset
        n = 1
        while i < iWtMax:
            Gij = []
            wtname = 'wt' + str(n)
            wt = double_or_blank(card, i, wtname)
            if wt is not None:
                cname = 'c'+str(n)
                ci = components_or_blank(card, i + 1, cname)

                #print("%s=%s %s=%s" % (wtname, wt, cname, ci))
                i += 2
                gij = 0

                j = 0
                while isinstance(gij, int) and i < iWtMax:
                    j += 1
                    gij_name = 'g%s,%s' % (n, j)
                    gij = integer_double_or_blank(card, i, gij_name)
                    if isinstance(gij, float):
                        break
                    #print("%s = %s" % (gij_name, gij))
                    if gij is not None:
                        Gij.append(gij)
                    i += 1
                wtCG_group = [wt, ci, Gij]
                WtCG_groups.append(wtCG_group)
                #print('----finished a group=%r----' % wtCG_group)
            else:
                i += 1
        self.WtCG_groups[i] = WtCG_groups
        Gmi = []
        Cmi = []
        #print("")
        if iUm:
            #print('UM = %s' % card.field(iUm))  # UM
            i = iUm + 1
            n = 1
            #print("i=%s iUmStop=%s" % (i, iUmStop))
            for j in range(i, iUmStop, 2):

                gm_name = 'gm' + str(n)
                cm_name = 'cm' + str(n)
                gmi = integer_or_blank(card, j, gm_name)
                if gmi is not None:
                    cmi = components(card, j + 1, cm_name)
                    #print("gmi=%s cmi=%s" % (gmi, cmi))
                    Gmi.append(gmi)
                    Cmi.append(cmi)
        self.Gmi[i] = Gmi
        self.Cmi[i] = Cmi
        if iAlpha:
            alpha = double_or_blank(card, iAlpha + 1, 'alpha', 0.0)
        else:
            alpha = 0.0
        self.alpha[i] = alpha
Ejemplo n.º 42
0
    def __init__(self, card=None, data=None, comment=''):
        if comment:
            self._comment = comment
        if card:
            #: Contact set ID. Parameters defined in this command apply to
            #: contact set CSID defined by a BCTSET entry. (Integer > 0)
            self.csid = integer(card, 1, 'csid')
            i = 2
            j = 1
            self.params = {}
            while i < card.nFields():
                param = string(card, i, 'param%s' % j)
                i += 1
                if param == 'TYPE':
                    value = integer(card, i, 'value%s' % j, 0)
                    assert value in [0, 1, 2], 'TYPE must be [0, 1, 2]'
                elif param == 'NSIDE':
                    value = integer_or_blank(card, i, 'value%s' % j, 1)
                    assert value in [1, 2], 'NSIDE must be [1, 2]'
                elif param == 'TBIRTH':
                    value = double_or_blank(card, i, 'value%s' % j, 0.0)
                elif param == 'TDEATH':
                    value = double_or_blank(card, i, 'value%s' % j, 0.0)
                elif param == 'INIPENE':
                    value = integer_or_blank(card, i, 'value%s' % j, 0)
                    assert value in [0, 1, 2], 'INIPENE must be [0, 1, 2]'
                elif param == 'PDEPTH':
                    value = double_or_blank(card, i, 'value%s' % j, 0.0)
                elif param == 'SEGNORM':
                    value = integer_or_blank(card, i, 'value%s' % j, 0)
                    assert value in [-1, 0, 1], 'SEGNORM must be [-1, 0, 1]'
                elif param == 'OFFTYPE':
                    value = integer_or_blank(card, i, 'value%s' % j, 0)
                    assert value in [0, 1, 2], 'SEGNORM must be [0, 1, 2]'
                elif param == 'OFFSET':
                    value = double_or_blank(card, i, 'value%s' % j, 0.0)
                elif param == 'TZPENE':
                    value = double_or_blank(card, i, 'value%s' % j, 0.0)

                elif param == 'CSTIFF':
                    value = integer_or_blank(card, i, 'value%s' % j, 0)
                    assert value in [0, 1], 'CSTIFF must be [0, 1]'
                elif param == 'TIED':
                    value = integer_or_blank(card, i, 'value%s' % j, 0)
                    assert value in [0, 1], 'TIED must be [0, 1]'
                elif param == 'TIEDTOL':
                    value = double_or_blank(card, i, 'value%s' % j, 0.0)
                elif param == 'EXTFAC':
                    value = double_or_blank(card, i, 'value%s' % j, 0.0)
                    assert 1.0E-6 < value < 0.1, 'EXTFAC must be 1.0E-6 < EXTFAC < 0.1'
                else:
                    # FRICMOD, FPARA1/2/3/4/5, EPSN, EPST, CFACTOR1, PENETOL
                    # NCMOD, TCMOD, RFORCE, LFORCE, RTPCHECK, RTPMAX, XTYPE
                    # ...
                    value = integer_double_or_blank(card, i, 'value%s' % j)
                    assert value is not None, '%s%i must not be None' % (param,
                                                                         j)

                self.params[param] = value
                i += 2
                j += 1
        else:
            msg = '%s has not implemented data parsing' % self.type
            raise NotImplementedError(msg)
Ejemplo n.º 43
0
    def __init__(self, card=None, data=None, comment=''):
        """
        eid
        refgrid
        refc
        WtCG_groups = [wt,ci,Gij]
        Gmi
        Cmi
        alpha
        """
        RigidElement.__init__(self, card, data)
        if comment:
            self._comment = comment
        self.eid = integer(card, 1, 'eid')
        blank(card, 2, 'blank')
        self.refgrid = integer(card, 3, 'refgrid')
        self.refc = components_or_blank(card, 4, 'refc')
        #iUM = fields.index('UM')

        fields = [
            field.upper() if isinstance(field, string_types) else field
            for field in card[5:]
        ]
        iOffset = 5
        iWtMax = len(fields) + iOffset
        try:
            iAlpha = fields.index('ALPHA') + iOffset
            iWtMax = iAlpha  # the index to start parsing UM
            iUmStop = iAlpha  # the index to stop  parsing UM
        except ValueError:
            iAlpha = None
            iUmStop = iWtMax
        #print("iAlpha = %s" % iAlpha)
        try:
            iUm = fields.index('UM') + iOffset
            iWtMax = iUm
        except ValueError:
            iUm = None
        #print("iAlpha=%s iUm=%s" % (iAlpha, iUm))
        #print("iAlpha=%s iWtMax=%s" % (iAlpha, iWtMax))

        #print("iUM = ", iUM)
        self.WtCG_groups = []

        i = iOffset
        n = 1
        while i < iWtMax:
            Gij = []
            wtname = 'wt' + str(n)
            wt = double_or_blank(card, i, wtname)
            if wt is not None:
                cname = 'c' + str(n)
                ci = components_or_blank(card, i + 1, cname)

                #print("%s=%s %s=%s" % (wtname, wt, cname, ci))
                i += 2
                gij = 0

                j = 0
                while isinstance(gij, int) and i < iWtMax:
                    j += 1
                    gij_name = 'g%s,%s' % (n, j)
                    gij = integer_double_or_blank(card, i, gij_name)
                    if isinstance(gij, float):
                        break
                    #print("%s = %s" % (gij_name, gij))
                    if gij is not None:
                        Gij.append(gij)
                    i += 1
                wtCG_group = [wt, ci, Gij]
                self.WtCG_groups.append(wtCG_group)
                #print('----finished a group=%r----' % wtCG_group)
            else:
                i += 1

        self.Gmi = []
        self.Cmi = []
        #print("")
        if iUm:
            #print('UM = %s' % card.field(iUm))  # UM
            i = iUm + 1
            n = 1
            #print("i=%s iUmStop=%s" % (i, iUmStop))
            for j in range(i, iUmStop, 2):

                gm_name = 'gm' + str(n)
                cm_name = 'cm' + str(n)
                gmi = integer_or_blank(card, j, gm_name)
                if gmi is not None:
                    cmi = components(card, j + 1, cm_name)
                    #print "gmi=%s cmi=%s" % (gmi, cmi)
                    self.Gmi.append(gmi)
                    self.Cmi.append(cmi)

        if iAlpha:
            self.alpha = double_or_blank(card, iAlpha + 1, 'alpha')
        else:
            #: thermal expansion coefficient
            self.alpha = 0.0
Ejemplo n.º 44
0
    def __init__(self, card=None, data=None, comment=''):
        """
        eid
        refgrid
        refc
        WtCG_groups = [wt,ci,Gij]
        Gmi
        Cmi
        alpha
        """
        RigidElement.__init__(self, card, data)
        if comment:
            self._comment = comment
        self.eid = integer(card, 1, 'eid')
        blank(card, 2, 'blank')
        self.refgrid = integer(card, 3, 'refgrid')
        self.refc = components_or_blank(card, 4, 'refc')
        #iUM = fields.index('UM')

        fields = [field.upper() if isinstance(field, string_types) else field for field in card[5:]]
        iOffset = 5
        iWtMax = len(fields) + iOffset
        try:
            iAlpha = fields.index('ALPHA') + iOffset
            iWtMax = iAlpha  # the index to start parsing UM
            iUmStop = iAlpha  # the index to stop  parsing UM
        except ValueError:
            iAlpha = None
            iUmStop = iWtMax
        #print("iAlpha = %s" % iAlpha)
        try:
            iUm = fields.index('UM') + iOffset
            iWtMax = iUm
        except ValueError:
            iUm = None
        #print("iAlpha=%s iUm=%s" % (iAlpha, iUm))
        #print("iAlpha=%s iWtMax=%s" % (iAlpha, iWtMax))

        #print("iUM = ", iUM)
        self.WtCG_groups = []

        i = iOffset
        n = 1
        while i < iWtMax:
            Gij = []
            wtname = 'wt' + str(n)
            wt = double_or_blank(card, i, wtname)
            if wt is not None:
                cname = 'c'+str(n)
                ci = components_or_blank(card, i + 1, cname)

                #print("%s=%s %s=%s" % (wtname, wt, cname, ci))
                i += 2
                gij = 0

                j = 0
                while isinstance(gij, int) and i < iWtMax:
                    j += 1
                    gij_name = 'g%s,%s' % (n, j)
                    gij = integer_double_or_blank(card, i, gij_name)
                    if isinstance(gij, float):
                        break
                    #print("%s = %s" % (gij_name, gij))
                    if gij is not None:
                        Gij.append(gij)
                    i += 1
                wtCG_group = [wt, ci, Gij]
                self.WtCG_groups.append(wtCG_group)
                #print('----finished a group=%r----' % wtCG_group)
            else:
                i += 1

        self.Gmi = []
        self.Cmi = []
        #print("")
        if iUm:
            #print('UM = %s' % card.field(iUm))  # UM
            i = iUm + 1
            n = 1
            #print("i=%s iUmStop=%s" % (i, iUmStop))
            for j in range(i, iUmStop, 2):

                gm_name = 'gm' + str(n)
                cm_name = 'cm' + str(n)
                gmi = integer_or_blank(card, j, gm_name)
                if gmi is not None:
                    cmi = components(card, j + 1, cm_name)
                    #print "gmi=%s cmi=%s" % (gmi, cmi)
                    self.Gmi.append(gmi)
                    self.Cmi.append(cmi)

        if iAlpha:
            self.alpha = double_or_blank(card, iAlpha + 1, 'alpha')
        else:
            #: thermal expansion coefficient
            self.alpha = 0.0
Ejemplo n.º 45
0
    def __init__(self, card=None, data=None, comment=''):
        if comment:
            self._comment = comment
        if card:
            #: Contact set ID. Parameters defined in this command apply to
            #: contact set CSID defined by a BCTSET entry. (Integer > 0)
            self.csid = integer(card, 1, 'csid')
            i = 2
            j = 1
            self.params = {}
            while i < card.nfields:
                param = string(card, i, 'param%s' % j)
                i += 1
                if param == 'TYPE':
                    value = integer_or_blank(card, i, 'value%s' % j, 0)
                    assert value in [0, 1, 2], 'TYPE must be [0, 1, 2]; TYPE=%r' % value
                elif param == 'NSIDE':
                    value = integer_or_blank(card, i, 'value%s' % j, 1)
                    assert value in [1, 2], 'NSIDE must be [1, 2]; NSIDE=%r' % value
                elif param == 'TBIRTH':
                    value = double_or_blank(card, i, 'value%s' % j, 0.0)
                elif param == 'TDEATH':
                    value = double_or_blank(card, i, 'value%s' % j, 0.0)
                elif param == 'INIPENE':
                    value = integer_or_blank(card, i, 'value%s' % j, 0)
                    assert value in [0, 1, 2, 3], 'INIPENE must be [0, 1, 2]; INIPENE=%r' % value
                elif param == 'PDEPTH':
                    value = double_or_blank(card, i, 'value%s' % j, 0.0)
                elif param == 'SEGNORM':
                    value = integer_or_blank(card, i, 'value%s' % j, 0)
                    assert value in [-1, 0, 1], 'SEGNORM must be [-1, 0, 1]; SEGNORM=%r' % value
                elif param == 'OFFTYPE':
                    value = integer_or_blank(card, i, 'value%s' % j, 0)
                    assert value in [0, 1, 2], 'OFFTYPE must be [0, 1, 2]; OFFTYPE=%r' % value
                elif param == 'OFFSET':
                    value = double_or_blank(card, i, 'value%s' % j, 0.0)
                elif param == 'TZPENE':
                    value = double_or_blank(card, i, 'value%s' % j, 0.0)

                elif param == 'CSTIFF':
                    value = integer_or_blank(card, i, 'value%s' % j, 0)
                    assert value in [0, 1], 'CSTIFF must be [0, 1]; CSTIFF=%r' % value
                elif param == 'TIED':
                    value = integer_or_blank(card, i, 'value%s' % j, 0)
                    assert value in [0, 1], 'TIED must be [0, 1]; TIED=%r' % value
                elif param == 'TIEDTOL':
                    value = double_or_blank(card, i, 'value%s' % j, 0.0)
                elif param == 'EXTFAC':
                    value = double_or_blank(card, i, 'value%s' % j, 0.001)
                    assert 1.0E-6 <= value <= 0.1, 'EXTFAC must be 1.0E-6 < EXTFAC < 0.1; EXTFAC=%r' % value
                else:
                    # FRICMOD, FPARA1/2/3/4/5, EPSN, EPST, CFACTOR1, PENETOL
                    # NCMOD, TCMOD, RFORCE, LFORCE, RTPCHECK, RTPMAX, XTYPE
                    # ...
                    value = integer_double_or_blank(card, i, 'value%s' % j)
                    assert value is not None, '%s%i must not be None' % (param, j)

                self.params[param] = value
                i += 1
                j += 1
                if j == 4:
                    i += 1
        else:
            msg = '%s has not implemented data parsing' % self.type
            raise NotImplementedError(msg)