def __init__(self, card=None, data=None): ## @todo doesnt support data ## Set identification number. (Integer > 0) self.sid = card.field(1) ## List of aerodynamic boxes generated by CAERO1 entries to define a ## surface. (Integer > 0 or 'THRU') self.elements = expand_thru(card.fields(2)) self.cleanIDs()
def add(self, card, comment=''): assert self.n > 0, self.n i = self.i load_id = integer(card, 1, 'load_id') tbar = double(card, 3, 'Tbar') tprime = double(card, 4, 'Tprime') t1 = double_or_blank(card, 5, 'T1') t2 = double_or_blank(card, 6, 'T2') self.load_id[i] = load_id self.element_id[i] = integer(card, 2, 'element_id') self.tbar[i] = tbar self.tprime[i] = tprime self.temp[i, 0] = t1 self.temp[i, 1] = t2 self.i += 1 if len(card) >= 7: # i must be < self.n eids = expand_thru(card[9:]) for eid in eids: self.load_id[i] = load_id assert isinstance(eid, int), eid self.element_id[i] = eid self.tbar[i] = tbar self.tprime[i] = tprime self.temp[i, 0] = t1 self.temp[i, 1] = t2 self.i += 1 assert self.i <= self.n assert len(card) <= 7, '%s; n=%s' % (card, len(card)) #assert len(card) <= 7, len(card) self.eids = None
def __init__(self, card=None, data=None, comment=''): """ Creates the SPOINTs card that contains many SPOINTs :param self: the SPOINTs object pointer :param card: a BDFCard object :type card: BDFCard :param data: a list with the SPOINT fields defined in OP2 format :type data: LIST :param comment: a comment for the card :type comment: string """ if comment: self._comment = comment Node.__init__(self, card, data) if card: fields = [] for i in range(1, len(card)): field = integer_or_string(card, i, 'ID%i' % i) fields.append(field) else: fields = data assert isinstance(data, list), data assert isinstance(data[0], int), data self.spoints = set(expand_thru(fields))
def __init__(self, card=None, data=None, comment=''): Set.__init__(self, card, data) if comment: self._comment = comment #: Unique identification number. (Integer > 0) self.sid = integer(card, 1, 'sid') self.IDs = [] IDs = [] i = 1 for ifield in range(2, len(card)): ID = integer_string_or_blank(card, ifield, 'ID%i' % i) if ID: i += 1 IDs.append(ID) #IDs = fields(integer_or_string, card, 'ID', i=2, j=len(card)) self.isSkin = False i = 0 if isinstance(IDs[0], str) and IDs[0] == 'SKIN': self.isSkin = True i += 1 #: List of structural grid point or element identification numbers. #: (Integer > 0 or 'THRU'; for the 'THRU' option, ID1 < ID2 or 'SKIN'; #: in field 3) self.IDs = expand_thru(IDs[i:]) self.cleanIDs()
def __init__(self, card=None, data=None, comment=''): ThermalLoad.__init__(self, card, data) if comment: self._comment = comment if card: #: Load set identification number. (Integer > 0) self.sid = integer(card, 1, 'sid') #: Heat flux into element (FLOAT) self.qFlux = double(card, 2, 'qFlux') eids = [] j = 1 for i in range(3, len(card)): eid = integer_or_string(card, i, 'eid%i' % j) eids.append(eid) j += 1 #: CHBDYj element identification numbers (Integer) assert len(eids) > 0 #: .. todo:: use expand_thru_by ??? self.eids = expand_thru(eids) else: self.sid = data[0] self.qFlux = data[1] self.eids = data[2:]
def __init__(self, card=None, data=None): Constraint.__init__(self, card, data) self.conid = card.field(1) self.constraints = str(card.field(2, '')) # 246 = y; dx, dz dir nodes = card.fields(3) self.nodes = expand_thru(nodes) self.nodes.sort()
def get_spcadd_constraint(card): constraint_id = integer(card, 1, 'constraint_id') node_ids = card.fields(2) node_ids = expand_thru(node_ids) assert isinstance(constraint_id, int), constraint_id return constraint_id, node_ids
def __init__(self, card=None, data=None): ## @todo doesnt support data Set.__init__(self, card, data) ## Component number. (Integer zero or blank for scalar points or any ## unique combination of the Integers 1 through 6 for grid points with ## no embedded blanks.) self.components = str(card.field(1, 0)) ## Identifiers of grids points. (Integer > 0) self.IDs = expand_thru(card.fields(2))
def __init__(self, card=None, data=None): Set.__init__(self, card, data) self.seid = card.field(1) ## Grid or scalar point identification number. ## (0 < Integer < 1000000; G1 < G2) self.IDs = [] self.IDs = expand_thru(card.fields(2)) self.cleanIDs()
def get_spc1_constraint(card): constraint_id = integer(card, 1, 'constraint_id') dofs = components(card, 2, 'constraints') # 246 = y; dx, dz dir node_ids = card.fields(3) node_ids = expand_thru(node_ids) assert isinstance(constraint_id, int), constraint_id return constraint_id, dofs, node_ids
def __init__(self, card=None, data=None): Node.__init__(self, card, data) #nFields = card.nFields() if card: fields = card.fields(1) else: fields = data self.spoints = set(expand_thru(fields))
def __init__(self, card=None, data=None): ## @todo doesnt support data Set.__init__(self, card, data) ## Identifiers of grids points. (Integer > 0) self.IDs = [] if card.field(2) == "ALL": self.components = "123456" else: self.components = str(card.field(1)) self.IDs = expand_thru(card.fields(2))
def __init__(self, card=None, data=None, comment=''): Set.__init__(self, card, data) if comment: self._comment = comment #: Identifiers of grids points. (Integer > 0) self.IDs = [] self.components = components(card, 1, 'components') IDs = fields(integer_or_string, card, i=2, j=len(card)) self.IDs = expand_thru(IDs)
def __init__(self, card=None, data=None): ## @todo doesnt support data Set.__init__(self, card, data) ## Identifiers of grids points. (Integer > 0) self.IDs = [] if card.field(2) == 'ALL': self.components = '123456' else: self.components = str(card.field(1)) self.IDs = expand_thru(card.fields(2))
def add(self, card, comment=''): fields = [] for i in range(1, len(card)): field = integer_or_string(card, i, 'ID%i' % i) fields.append(field) ex = expand_thru(fields) ex = set(ex) self.spoint.update(ex) self._comments.append(comment) self.n = len(self.spoint)
def __init__(self, card=None, data=None, comment=''): ConstraintADD.__init__(self, card, data) if comment: self._comment = comment if card: self.conid = integer(card, 1, 'conid') sets = card.fields(2) self.sets = expand_thru(sets) self.sets.sort() else: msg = '%s has not implemented data parsing' % self.type raise NotImplementedError(msg)
def __init__(self, card=None, data=None, comment=''): Set.__init__(self, card, data) if comment: self._comment = comment self.seid = integer(card, 1, 'seid') #: Grid or scalar point identification number. #: (0 < Integer < 1000000; G1 < G2) self.IDs = [] IDs = fields(integer_or_string, card, 'ID', i=2, j=len(card)) self.IDs = expand_thru(IDs) self.cleanIDs()
def __init__(self, card=None, data=None, comment=''): Set.__init__(self, card, data) if comment: self._comment = comment #: Identifiers of grids points. (Integer > 0) self.IDs = [] if string_or_blank(card, 2, 'C') == 'ALL': self.components = '123456' else: self.components = components(card, 1, 'components') IDs = fields(integer_or_string, 'ID', i=2, j=len(card)) self.IDs = expand_thru(IDs)
def __init__(self, card=None, data=None): SetSuper.__init__(self, card, data) ## Identification number for secondary superelement. (Integer >= 0). self.ssid = card.field(1) ## Identification number for the primary superelement. (Integer >= 0). self.psid = card.field(2) ## Exterior grid point identification numbers for the primary ## superelement. (Integer > 0) self.IDs = [] fields = card.fields(3) self.IDs = expand_thru(fields) self.cleanIDs()
def __init__(self, card=None, data=None, comment=''): Constraint.__init__(self, card, data) if comment: self._comment = comment if card: self.conid = integer(card, 1, 'conid') self.constraints = components(card, 2, 'constraints') # 246 = y; dx, dz dir nodes = card.fields(3) self.nodes = expand_thru(nodes) self.nodes.sort() else: msg = '%s has not implemented data parsing' % self.type raise NotImplementedError(msg)
def __init__(self, card=None, data=None, comment=''): Constraint.__init__(self, card, data) if comment: self._comment = comment if card: self.conid = integer(card, 1, 'conid') self.constraints = components(card, 2, 'constraints') # 246 = y; dx, dz dir nodes = card.fields(3) self.nodes = expand_thru(nodes) self.nodes.sort() else: self.conid = data[0] self.constraints = data[1] self.nodes = data[2:]
def __init__(self, card=None, data=None, comment=''): if comment: self._comment = comment Node.__init__(self, card, data) if card: fields = [] for i in range(1, len(card)): field = integer_or_string(card, i, 'ID%i' % i) fields.append(field) else: fields = data assert isinstance(data, list), data assert isinstance(data[0], int), data self.points = set(expand_thru(fields))
def __init__(self, card=None, data=None, comment=''): if comment: self._comment = comment Node.__init__(self, card, data) if card: fields = [] for i in range(1, len(card)): field = integer_or_string(card, i, 'ID%i' % i) fields.append(field) else: fields = data assert isinstance(data, list), data assert isinstance(data[0], int), data self.spoints = set(expand_thru(fields))
def __init__(self, card=None, data=None, comment=''): SetSuper.__init__(self, card, data) if comment: self._comment = comment #: Identification number for secondary superelement. (Integer >= 0). self.ssid = integer(card, 1, 'ssid') #: Identification number for the primary superelement. (Integer >= 0). self.psid = integer(card, 2, 'psid') #: Exterior grid point identification numbers for the primary #: superelement. (Integer > 0) self.IDs = [] IDs = fields(integer_or_string, card, i=3, j=len(card)) self.IDs = expand_thru(IDs) self.cleanIDs()
def __init__(self, card=None, data=None): ## @todo doesnt support data Set.__init__(self, card, data) ## Unique identification number. (Integer > 0) self.sid = card.field(1) ## Set description (Character). Valid options are 'GRID', 'ELEM', ## 'POINT' and 'PROP'. self.desc = card.field(2).upper() assert self.desc in ["GRID", "POINT", "ELEM", "PROP"] ## Identifiers of grids points, elements, points or properties. ## (Integer > 0) self.IDs = [] fields = card.fields(2) self.IDs = expand_thru(fields) self.cleanIDs()
def __init__(self, card=None, data=None): ## @todo doesnt support data Set.__init__(self, card, data) ## Unique identification number. (Integer > 0) self.sid = card.field(1) ## Set description (Character). Valid options are 'GRID', 'ELEM', ## 'POINT' and 'PROP'. self.desc = card.field(2).upper() assert self.desc in ['GRID', 'POINT', 'ELEM', 'PROP'] ## Identifiers of grids points, elements, points or properties. ## (Integer > 0) self.IDs = [] fields = card.fields(2) self.IDs = expand_thru(fields) self.cleanIDs()
def __init__(self, card=None, data=None): ## @todo doesnt support data Set.__init__(self, card, data) ## Unique identification number. (Integer > 0) self.sid = card.field(1) ## List of structural grid point or element identification numbers. ## (Integer > 0 or 'THRU'; for the 'THRU' option, ID1 < ID2 or 'SKIN'; ## in field 3) self.IDs = [] fields = card.fields(2) self.isSkin = False i = 0 if isinstance(fields[0], str) and fields[0].upper() == "SKIN": self.isSkin = True i += 1 self.IDs = expand_thru(fields[i:]) self.cleanIDs()
def __init__(self, card=None, data=None): ## @todo doesnt support data Set.__init__(self, card, data) ## Unique identification number. (Integer > 0) self.sid = card.field(1) ## List of structural grid point or element identification numbers. ## (Integer > 0 or 'THRU'; for the 'THRU' option, ID1 < ID2 or 'SKIN'; ## in field 3) self.IDs = [] fields = card.fields(2) self.isSkin = False i = 0 if isinstance(fields[0], str) and fields[0].upper() == 'SKIN': self.isSkin = True i += 1 self.IDs = expand_thru(fields[i:]) self.cleanIDs()
def __init__(self, card=None, data=None, comment=''): Set.__init__(self, card, data) if comment: self._comment = comment #: Identifiers of grids points. (Integer > 0) self.IDs = [] if string_or_blank(card, 2, 'C') == 'ALL': self.components = '123456' else: self.components = components(card, 1, 'components') IDs2 = [] ii = 1 for ifield in range(2, len(card)): integer_or_string(card, ifield, 'ID' % ii) ii += 1 self.IDs = expand_thru(IDs)
def __init__(self, card=None, data=None, comment=''): Set.__init__(self, card, data) if comment: self._comment = comment #: Unique identification number. (Integer > 0) self.sid = integer(card, 1, 'sid') #: Set description (Character). Valid options are 'GRID', 'ELEM', #: 'POINT' and 'PROP'. self.desc = string(card, 2, 'desc') assert self.desc in ['GRID', 'POINT', 'ELEM', 'PROP'] #: Identifiers of grids points, elements, points or properties. #: (Integer > 0) self.IDs = [] IDs = fields(integer_or_string, card, 'ID', i=3, j=len(card)) self.IDs = expand_thru(IDs) self.cleanIDs()
def __init__(self, card=None, data=None, comment=''): Set.__init__(self, card, data) if comment: self._comment = comment #: Component number. (Integer zero or blank for scalar points or any #: unique combination of the Integers 1 through 6 for grid points with #: no embedded blanks.) self.components = components_or_blank(card, 1, 'components', 0) nfields = len(card) IDs = [] i = 1 for ifield in range(2, nfields): ID = integer_string_or_blank(card, ifield, 'ID%i' % i) if ID: i += 1 IDs.append(ID) #IDs = fields(integer_or_string, card, 'ID', i=2, j=nfields) #: Identifiers of grids points. (Integer > 0) self.IDs = expand_thru(IDs)
def __init__(self, card=None, data=None, comment=''): Set.__init__(self, card, data) if comment: self._comment = comment #: Unique identification number. (Integer > 0) self.sid = integer(card, 1, 'sid') self.IDs = [] IDs = fields(integer_or_string, card, 'ID', i=2, j=len(card)) self.isSkin = False i = 0 if isinstance(IDs[0], string_types) and IDs[0] == 'SKIN': self.isSkin = True i += 1 #: List of structural grid point or element identification numbers. #: (Integer > 0 or 'THRU'; for the 'THRU' option, ID1 < ID2 or 'SKIN'; #: in field 3) self.IDs = expand_thru(IDs[i:]) self.clean_ids() self.xref_type = None
def build(self): """ :param self: the PLOAD4 object """ cards = self._cards ncards = len(cards) self.n = ncards if ncards: float_fmt = self.model.float self.load_id = zeros(ncards, 'int32') #: Element ID self.element_id = zeros(ncards, 'int32') #: Property ID self.pressures = zeros((ncards, 4), 'int32') element_ids = {} for i in range(ncards): element_ids[i] = [] self.g1 = full(ncards, nan, 'int32') self.g34 = full(ncards, nan, 'int32') self.ldir = full(ncards, nan, '|S4') self.sorl = full(ncards, nan, '|S4') self.cid = zeros(ncards, dtype='int32') self.NVector = zeros((ncards, 3), dtype=float_fmt) for i, card in enumerate(cards): self.load_id[i] = integer(card, 1, 'load_id') eid = integer(card, 2, 'element_id') self.element_id[i] = eid p1 = double_or_blank(card, 3, 'p1', 0.0) p = [p1, double_or_blank(card, 4, 'p2', p1), double_or_blank(card, 5, 'p3', p1), double_or_blank(card, 6, 'p4', p1)] self.pressures[i, :] = p self.element_ids[i] = [eid] if(integer_string_or_blank(card, 7, 'g1/THRU') == 'THRU' and integer_or_blank(card, 8, 'eid2')): # plates eid2 = integer(card, 8, 'eid2') if eid2: self.element_ids[i] = list(unique(expand_thru([self.eid, 'THRU', eid2], set_fields=False, sort_fields=False))) #self.g1 = None #self.g34 = None else: #: used for CPENTA, CHEXA self.element_ids[i] = [self.eid] #: used for solid element only self.g1[i] = integer_or_blank(card, 7, 'g1') #: g3/g4 - different depending on CHEXA/CPENTA or CTETRA self.g34[i] = integer_or_blank(card, 8, 'g34') #: Coordinate system identification number. See Remark 2. #: (Integer >= 0;Default=0) self.cid[i] = integer_or_blank(card, 9, 'cid', 0) self.NVector[i, :] = [ double_or_blank(card, 10, 'N1', 0.0), double_or_blank(card, 11, 'N2', 0.0), double_or_blank(card, 12, 'N3', 0.0), ] self.sorl[i] = string_or_blank(card, 13, 'sorl', 'SURF') self.ldir[i] = string_or_blank(card, 14, 'ldir', 'NORM') assert len(card) <= 15, 'len(PLOAD4 card) = %i' % len(card) i = self.load_id.argsort() #self.element_id = self.element_id[i] self.pressures = self.pressures[i, :] #self.node_ids = self.node_ids[i, :] #element_ids = {} #for j in range(ncards): #element_ids[j] = element_ids[i[j]] self.g1 = self.g1[i] self.g34 = self.g34[i] self.ldir = self.ldir[i] self.sorl = self.sorl[i] self.cid = self.cid[i] self.NVector = self.NVector[i, :] self.n += len(eids) self.load_cases = {} self.load_ids = unique(self.load_id) else: self.load_id = array([], dtype='int32')
def __init__(self, card=None, data=None): ConstraintADD.__init__(self, card, data) self.conid = card.field(1) sets = card.fields(2) self.sets = expand_thru(sets) self.sets.sort()