Exemplo n.º 1
0
    def get_properties(self, property_id=None):
        #self.model.log.debug('property_idA = %s' % property_id)
        property_id, int_flag = slice_to_iter(property_id)
        #self.model.log.debug('property_idB = %s int_flag=%s' % (property_id, int_flag))
        TypeMap = self.get_property_typemap()
        out = []
        #print('property_id = %s' % property_id)
        for pid in property_id:
            for Type, pids in iteritems(self.property_groups):
                if not isinstance(pid, integer_types):
                    self.model.log.debug('pids = %s' % pids)
                    self.model.log.debug('pid  = %s' % pid)

                if pid in pids:
                    i = where(pid == pids)[0]
                    #print('i = %s, shape=%s' % (i, i.shape))
                    #print('pids_extract = %s' % pids_extract)
                    #obj = TypeMap[Type].slice_by_index(i)

                    pids_extract = pids[i]
                    #i = TypeMap[Type].get_property_index_by_property_id(pids_extract)
                    #obj = TypeMap[Type][i]
                    obj = TypeMap[Type].slice_by_property_id(pids_extract)
                    out.append(obj)
        #return out
        #self.model.log.debug('out[0] = %s' % out[0])
        return out[0] if int_flag else out
Exemplo n.º 2
0
    def __getitem__(self, material_id):
        TypeMap = {
            'MAT1': (self.mat1, self.mat1.material_id),
            #'MAT2'  : (self.mat2, self.mat2.material_id),
            #'MAT4'  : (self.mat4, self.mat4.material_id),
            #'MAT5'  : (self.mat5, self.mat5.material_id),
            'MAT8': (self.mat8, self.mat8.material_id),
            #'MAT10' : (self.mat10, self.mat10.material_id),

            #'MATS1' : (self.mats1, self.mats1.material_id),
        }
        material_id, int_flag = slice_to_iter(material_id)
        out = []
        self.model.log.debug('material_ids = %s' % material_id)
        for mid in material_id:
            obj = None
            for Type, (mdict, mids) in iteritems(TypeMap):
                if mdict.n:
                    self.model.log.debug('Type=%s mid=%s mids=%s' %
                                         (Type, mid, mids))
                    if mid in mids:
                        self.model.log.debug(' *mid=%i Type=%s was found' %
                                             (mid, Type))
                        i = where(mid == mids)[0]
                        obj = mdict.slice_by_material_id([mid])
                        break
                    else:
                        self.model.log.debug('  mid=%i Type=%s was not found' %
                                             (mid, Type))
            out.append(obj)
        return out[0] if int_flag else out
Exemplo n.º 3
0
    def __getitem__(self, material_id):
        TypeMap = {
            'MAT1'  : (self.mat1, self.mat1.material_id),
            #'MAT2'  : (self.mat2, self.mat2.material_id),
            #'MAT4'  : (self.mat4, self.mat4.material_id),
            #'MAT5'  : (self.mat5, self.mat5.material_id),
            'MAT8'  : (self.mat8, self.mat8.material_id),
            #'MAT10' : (self.mat10, self.mat10.material_id),

            #'MATS1' : (self.mats1, self.mats1.material_id),
        }
        material_id, int_flag = slice_to_iter(material_id)
        out = []
        self.model.log.debug('material_ids = %s' % material_id)
        for mid in material_id:
            obj = None
            for Type, (mdict, mids) in iteritems(TypeMap):
                if mdict.n:
                    self.model.log.debug('Type=%s mid=%s mids=%s' % (Type, mid, mids))
                    if mid in mids:
                        self.model.log.debug(' *mid=%i Type=%s was found' % (mid, Type))
                        i = where(mid == mids)[0]
                        obj = mdict[mid]  #[i]
                        break
                    else:
                        #self.model.log.debug('  mid=%i Type=%s was not found' % (mid, Type))
                        pass
            out.append(obj)
        return out[0] if int_flag else out
Exemplo n.º 4
0
    def get_properties(self, property_id=None):
        #self.model.log.debug('property_idA = %s' % property_id)
        property_id, int_flag = slice_to_iter(property_id)
        #self.model.log.debug('property_idB = %s int_flag=%s' % (property_id, int_flag))
        type_map = self.get_property_typemap()
        out = []
        #self.model.log.debug('property_id = %s' % property_id)
        for pid in property_id:
            for Type, pids in iteritems(self.property_groups):
                if not isinstance(pid, integer_types):
                    self.model.log.debug('pids = %s' % pids)
                    self.model.log.debug('pid  = %s' % pid)

                if pid in pids:
                    i = np.where(pid == pids)[0]
                    #self.model.log.debug('i = %s, shape=%s' % (i, i.shape))
                    #self.model.log.debug('pids_extract = %s' % pids_extract)
                    #obj = TypeMap[Type].slice_by_index(i)

                    pids_extract = pids[i]
                    #i = TypeMap[Type].get_property_index_by_property_id(pids_extract)
                    #obj = TypeMap[Type][i]
                    obj = type_map[Type].slice_by_property_id(pids_extract)
                    out.append(obj)
        #return out
        self.model.log.info('out = %s' % out)
        #return out
        return out[0] if int_flag else out
Exemplo n.º 5
0
    def __getitem__(self, property_id):
        property_id, int_flag = slice_to_iter(property_id)
        obj = PBEAM(self.model)

        properties = {}
        for pid in sorted(property_id):
            properties[pid] = self.properties[pid]
        obj.n = len(property_id)
        obj.properties = properties
        obj.property_id = sorted(self.properties.keys())
        # obj._comments = obj._comments[index]
        # obj.comments = obj.comments[index]
        return obj
Exemplo n.º 6
0
    def __getitem__(self, property_id):
        property_id, int_flag = slice_to_iter(property_id)
        obj = PBEAM(self.model)

        properties = {}
        for pid in sorted(property_id):
            properties[pid] = self.properties[pid]
        obj.n = len(property_id)
        obj.properties = properties
        obj.property_id = sorted(self.properties.keys())
        #obj._comments = obj._comments[index]
        #obj.comments = obj.comments[index]
        return obj
Exemplo n.º 7
0
    def __getitem__(self, element_ids):
        TypeMap = self.get_element_typemap()
        element_ids2, int_flag = slice_to_iter(element_ids)

        out = []
        #print('element_ids_getitem = %s' % element_ids2)
        for eid in element_ids2:
            #obj = None
            for Type, eids in iteritems(self.element_groups):
                if eid in eids:
                    #print('  found Type=%s' % Type)
                    i = where(eid == eids)[0]
                    #print("    i = %s" % i)
                    obj = TypeMap[Type].slice_by_index(i)
                    self.model.log.debug("    found eid=%s " % obj.element_id)
                    out.append(obj)
                    #break
                #else:
                    #out.append(None)
            #print('*obj = %s' % obj)
            #out.append(obj)
            #print('element_ids = %s\n--%s' % (element_ids2, out))
        return out[0] if int_flag else out
Exemplo n.º 8
0
    def __getitem__(self, element_ids):
        type_map = self.get_element_typemap()
        element_ids2, int_flag = slice_to_iter(element_ids)

        out = []
        self.model.log.debug('element_ids = %s' % element_ids)
        self.model.log.debug('element_ids_getitem = %s' % element_ids2)
        for eid in element_ids2:
            #obj = None
            for Type, eids in iteritems(self.element_groups):
                if eid in eids:
                    #self.model.log.debug('  found Type=%s' % Type)
                    i = np.where(eid == eids)[0]
                    #self.model.log.debug("    i = %s" % i)
                    obj = type_map[Type].slice_by_index(i)
                    self.model.log.debug("    found eid=%s " % obj.element_id)
                    out.append(obj)
                    #break
                #else:
                    #out.append(None)
            #print('*obj = %s' % obj)
            #out.append(obj)
            #print('element_ids = %s\n--%s' % (element_ids2, out))
        return out[0] if int_flag else out
Exemplo n.º 9
0
 def __getitem__(self, property_id):
     property_id, int_flag = slice_to_iter(property_id)
     #print('looking for %s property_ids' % str(property_id))
     i = searchsorted(self.property_id, property_id)
     return self.slice_by_index(i)
Exemplo n.º 10
0
 def __getitem__(self, property_id):
     property_id, int_flag = slice_to_iter(property_id)
     #print('looking for %s property_ids' % str(property_id))
     i = searchsorted(self.property_id, property_id)
     return self.slice_by_index(i)
Exemplo n.º 11
0
 def __getitem__(self, property_id):
     property_id, int_flag = slice_to_iter(property_id)
     i = searchsorted(self.property_id, property_id)
     return self.slice_by_index(i)
Exemplo n.º 12
0
 def __getitem__(self, property_id):
     property_id = slice_to_iter(property_id)[0]
     #self.model.log.debug('looking for %s property_ids' % str(property_id))
     #self.model.log.debug(property_id)
     i = searchsorted(self.property_id, property_id)
     return self.slice_by_index(i)
Exemplo n.º 13
0
 def __getitem__(self, property_id):
     property_id = slice_to_iter(property_id)[0]
     #self.model.log.debug('looking for %s property_ids' % str(property_id))
     #self.model.log.debug(property_id)
     i = searchsorted(self.property_id, property_id)
     return self.slice_by_index(i)