Example #1
0
    def group_elements_by_property_type_and_element_type(self, elements, pid_data):
        """
        group elements of the same type by property type
           same element type & different property id (e.g. CTRIA3 PSHELL/PCOMP)  -> different group
           different element type & same property id (e.g. CTRIA3/CQUAD4 PSHELL) -> different group
           same element & same type -> same group

        we do this in order to think about one property at a time and not
        have to do a lot of special work to handle different methods for
        getting the mass
        """
        # find unique groups
        #print("pid_data = \n%s\n" % str(pid_data))
        pid_eType = unique2d(pid_data[:, 1:])

        data2 = {}
        #print('model %s' % type(model))
        eTypeMap = self.model._element_type_to_element_name_mapper

        #print("pid_eType = \n%s\n" % str(pid_eType))
        for (pid, eType) in pid_eType:
            if pid not in elements.property_ids:
                self.model.log.debug('Property pid=%s does not exist' % pid)
                #continue
            i = where(pid_data[:, 1] == pid)[0]
            #self.model.log.debug("pid=%i eType=%s Step #1=> \n%s\n" % (pid, eType, pid_data[i, :]))
            j = where(pid_data[i, 2] == eType)[0]
            eids = pid_data[i[j], 0]
            #self.model.log.debug("pid=%i eType=%s eids=%s Step #2=> \n%s\n" % (pid, eType, eids, pid_data[i[j], :]))
            eType = eTypeMap[eType]
            data2[(pid, eType)] = eids
        return data2
Example #2
0
    def group_elements_by_property_type_and_element_type(
            self, elements, pid_data):
        """
        group elements of the same type by property type
           same element type & different property id (e.g. CTRIA3 PSHELL/PCOMP)  -> different group
           different element type & same property id (e.g. CTRIA3/CQUAD4 PSHELL) -> different group
           same element & same type -> same group

        we do this in order to think about one property at a time and not
        have to do a lot of special work to handle different methods for
        getting the mass
        """
        # find unique groups
        #print("pid_data = \n%s\n" % str(pid_data))
        pid_etype = unique2d(pid_data[:, 1:])

        data2 = {}
        #print('model %s' % type(model))
        etype_map = self.model._element_type_to_element_name_mapper

        #print("pid_etype = \n%s\n" % str(pid_etype))
        for (pid, etype) in pid_etype:
            if pid not in elements.property_ids:
                self.model.log.debug('Property pid=%s does not exist' % pid)
                #continue
            i = np.where(pid_data[:, 1] == pid)[0]
            #self.model.log.debug("pid=%i etype=%s Step #1=> \n%s\n" % (
            #pid, etype, pid_data[i, :]))
            j = np.where(pid_data[i, 2] == etype)[0]
            eids = pid_data[i[j], 0]
            #self.model.log.debug("pid=%i etype=%s eids=%s Step #2=> \n%s\n" % (
            #pid, etype, eids, pid_data[i[j], :]))
            etype = etype_map[etype]
            data2[(pid, etype)] = eids
        return data2
Example #3
0
def group_elements_by_property_type_and_element_type(elements, pid_data):
    """
    group elements of the same type by property type
       same element type & different property id (e.g. CTRIA3 PSHELL/PCOMP)  -> different group
       different element type & same property id (e.g. CTRIA3/CQUAD4 PSHELL) -> different group
       same element & same type -> same group

    we do this in order to think about one property at a time and not
    have to do a lot of special work to handle different methods for
    getting the mass
    """
    # find unique groups
    # print("pid_data = \n%s\n" % str(pid_data))
    pid_eType = unique2d(pid_data[:, 1:])

    data2 = {}
    eTypeMap = {
        1: "CROD",
        5: "CONROD",
        2: "CBEAM",
        3: "CBAR",
        4: "CSHEAR",
        10: "CELAS1",
        11: "CELAS2",
        12: "CELAS3",
        13: "CELAS4",
        73: "CTRIA3",
        144: "CQUAD4",
        60: "CTETRA4",
        61: "CTETRA10",
        62: "CPENTA6",
        63: "CPENTA15",
        64: "CHEXA8",
        65: "CHEXA20",
    }

    # self.model.log.debug("pid_eType = \n%s\n" % str(pid_eType))
    for (pid, eType) in pid_eType:
        if pid not in elements.property_ids:
            print("Property pid=%s does not exist" % pid)
            # continue
        i = where(pid_data[:, 1] == pid)[0]
        # self.model.log.debug("pid=%i eType=%s Step #1=> \n%s\n" % (pid, eType, pid_data[i, :]))
        j = where(pid_data[i, 2] == eType)[0]
        eids = pid_data[i[j], 0]
        # self.model.log.debug("pid=%i eType=%s eids=%s Step #2=> \n%s\n" % (pid, eType, eids, pid_data[i[j], :]))
        eType = eTypeMap[eType]
        data2[(pid, eType)] = eids
    return data2
Example #4
0
def group_elements_by_property_type_and_element_type(elements, pid_data):
    """
    group elements of the same type by property type
       same element type & different property id (e.g. CTRIA3 PSHELL/PCOMP)  -> different group
       different element type & same property id (e.g. CTRIA3/CQUAD4 PSHELL) -> different group
       same element & same type -> same group

    we do this in order to think about one property at a time and not
    have to do a lot of special work to handle different methods for
    getting the mass
    """
    # find unique groups
    #print("pid_data = \n%s\n" % str(pid_data))
    pid_eType = unique2d(pid_data[:, 1:])

    data2 = {}
    eTypeMap = {
        1: 'CROD',
        5: 'CONROD',
        2: 'CBEAM',
        3: 'CBAR',
        4: 'CSHEAR',
        10: 'CELAS1',
        11: 'CELAS2',
        12: 'CELAS3',
        13: 'CELAS4',
        73: 'CTRIA3',
        144: 'CQUAD4',
        60: 'CTETRA4',
        61: 'CTETRA10',
        62: 'CPENTA6',
        63: 'CPENTA15',
        64: 'CHEXA8',
        65: 'CHEXA20',
    }

    #self.model.log.debug("pid_eType = \n%s\n" % str(pid_eType))
    for (pid, eType) in pid_eType:
        if pid not in elements.property_ids:
            self.model.log.debug('Property pid=%s does not exist' % pid)
            #continue
        i = where(pid_data[:, 1] == pid)[0]
        #self.model.log.debug("pid=%i eType=%s Step #1=> \n%s\n" % (pid, eType, pid_data[i, :]))
        j = where(pid_data[i, 2] == eType)[0]
        eids = pid_data[i[j], 0]
        #self.model.log.debug("pid=%i eType=%s eids=%s Step #2=> \n%s\n" % (pid, eType, eids, pid_data[i[j], :]))
        eType = eTypeMap[eType]
        data2[(pid, eType)] = eids
    return data2
Example #5
0
def group_elements_by_property_type_and_element_type(elements, pid_data):
    """
    group elements of the same type by property type
       same element type & different property id (e.g. CTRIA3 PSHELL/PCOMP)  -> different group
       different element type & same property id (e.g. CTRIA3/CQUAD4 PSHELL) -> different group
       same element & same type -> same group

    we do this in order to think about one property at a time and not
    have to do a lot of special work to handle different methods for
    getting the mass
    """
    # find unique groups
    #print("pid_data = \n%s\n" % str(pid_data))
    pid_elementnum = unique2d(pid_data[:, 1:])

    data2 = {}
    etype_map = {
        1 : 'CROD', 5: 'CONROD',
        2 : 'CBEAM', 3 : 'CBAR',
        4 : 'CSHEAR',
        10 : 'CELAS1', 11 : 'CELAS2', 12 : 'CELAS3', 13 : 'CELAS4',
        73 : 'CTRIA3', 144 : 'CQUAD4',

        60 : 'CTETRA4', 61 : 'CTETRA10',
        62 : 'CPENTA6', 63 : 'CPENTA15',
        64 : 'CHEXA8', 65 : 'CHEXA20',
    }

    #self.model.log.debug("pid_elementnum = \n%s\n" % str(pid_elementnum))
    for (pid, element_num) in pid_elementnum:
        if pid not in elements.property_ids:
            print('Property pid=%s does not exist' % pid)
            #continue
        i = np.where(pid_data[:, 1] == pid)[0]
        #self.model.log.debug("pid=%i element_num=%s Step #1=> \n%s\n" % (
            #pid, element_num, pid_data[i, :]))
        j = np.where(pid_data[i, 2] == element_num)[0]
        eids = pid_data[i[j], 0]
        #self.model.log.debug("pid=%i element_num=%s eids=%s Step #2=> \n%s\n" % (
            #pid, element_num, eids, pid_data[i[j], :]))
        element_type = etype_map[element_num]
        data2[(pid, element_type)] = eids
    return data2