Esempio n. 1
0
    def _get_element_ids(self, element_ids_orig):
        if element_ids_orig is None:
            element_ids = self.element_ids
            element_ids_orig = element_ids
            #print('A %s' % element_ids)
        else:
            # remove elements that don't exist in the BDF
            #print("self.element_ids = \n%s" % str(self.element_ids))
            #print("element_ids = \n%s" % str(element_ids))
            element_ids_orig = asarray(element_ids_orig)
            element_ids = np.intersect1d(element_ids_orig, self.element_ids)

            # check for invalid IDs
            #n = len(element_ids)
            #i = where(element_ids < 1)[0]  #  < 100000000
            #j = where(element_ids[i] > 99999999)[0]
            #if len(i) + len(j):
            #eids = setdiff1d(element_ids[i[j]], element_ids)
            #eids = '???'
            #raise RuntimeError('0 < element_ids < 100000000 is invalid; eids=%s' % eids)
            #element_ids = element_ids[i[j]]
            #print('B %s' % element_ids)

        return element_ids, element_ids_orig
Esempio n. 2
0
    def build(self):
        #print('elements')
        self.n = 0
        self._build_elements()
        self._build_properties()

        old_build = False
        if old_build:
            etypes = self._get_element_types(nlimit=False)
            ptypes = self._get_property_types(nlimit=False)

            for elems in etypes:
                #if elems is None:
                #continue
                if hasattr(elems, 'type'):
                    if elems.type in self.model.card_count:
                        self.model.log.debug('building %s' %
                                             elems.__class__.__name__)
                else:
                    #if elems.n:
                    self.model.log.debug('building %s' %
                                         elems.__class__.__name__)
                elems.build()
                self.nelements += elems.n
                self.validate_nodes(elems)
                #print(nids - grids[i])

            for props in ptypes:
                #if props is None:
                #continue
                if hasattr(props, 'type'):
                    if props.type in self.model.card_count:
                        self.model.log.debug('building %s' %
                                             props.__class__.__name__)
                else:
                    #if props.n:
                    self.model.log.debug('building %s' %
                                         props.__class__.__name__)
                props.build()
                self.nproperties += props.n
        else:
            etypes = self._get_element_types(nlimit=True)
            ptypes = self._get_property_types(nlimit=True)
            self.model.log.debug('etypes = %s' % etypes)
            self.model.log.debug('ptypes = %s' % ptypes)
            for elems in etypes:
                #if elems.type in ['CONROD']:
                #self.nproperties += elems.n
                self.nelements += elems.n
                self.validate_nodes(elems)
            for props in ptypes:
                self.nproperties += props.n

        self.model.log.debug('finished building %s' % self.__class__.__name__)

        if self.nelements:
            eids = check_duplicate('element_id', etypes, self.model.log)
            self.element_ids = asarray(eids, dtype='int32')
            self.element_ids.sort()
            self.element_groups = build_groups(etypes,
                                               'element_id',
                                               is_element=True)
            #self.model.log.info('self.element_groups = %s' % self.element_groups)
        else:
            self.model.log.warning('no elements...')

        if self.nproperties:
            pids = check_duplicate('property_id', ptypes, self.model.log)
            self.property_ids = asarray(pids, dtype='int32')
            self.property_ids.sort()
            self.property_groups = build_groups(ptypes, 'property_id')
            self.model.log.info('self.property_groups = %s' %
                                self.property_groups)