parameters: (self,
                                   expression,
                                   element_block_ids='all',
                                   timestep='last',
                                   new_element_block_id=None)
docstring: Delete elements which do not satisfy a condition.
  
          The expression can contain element field values.
  
          If 'new_element_block_id' is given, all elements which don't pass
          the threshold will be moved into that element block.  Else, they are
          deleted.
  
          Example:
          >>> model.threshold_element_block('all', 'eqps >= 0.01')
docstring_summary: Delete elements which do not satisfy a condition.
docstring_tokens: Delete elements which do not satisfy a condition .
function: def threshold_element_blocks(self,
                                   expression,
                                   element_block_ids='all',
                                   timestep='last',
                                   new_element_block_id=None):
          """
          Delete elements which do not satisfy a condition.
  
          The expression can contain element field values.
  
          If 'new_element_block_id' is given, all elements which don't pass
          the threshold will be moved into that element block.  Else, they are
          deleted.
  
          Example:
          >>> model.threshold_element_block('all', 'eqps >= 0.01')
  
          """
          element_block_ids = self._format_element_block_id_list(
              element_block_ids)
          [timestep] = self._format_id_list([timestep],
                                            self.get_timesteps(),
                                            'timestep',
                                            single=True)
          if new_element_block_id is not None:
              if self.element_block_exists(new_element_block_id):
                  self._exists_error(new_element_block_id, 'element block')
          # create a temporary field name on these elements
          name = self._new_element_field_name()
          # evaluate the expression
          self.calculate_element_field('%s = %s' % (name, expression),
                                       element_block_ids=element_block_ids)
          # go through each element block and delete elements
          for id_ in element_block_ids:
              values = self.get_element_field_values(name,
                                                     element_block_id=id_,
                                                     timestep=timestep)
              # if we're saving elements, duplicate the block, and delete the
              # ones we're keeping
              if new_element_block_id is not None:
                  indices_to_keep = [i for i, x in enumerate(values) if x]
                  temporary_element_block_id = self._new_element_block_id()
                  self.duplicate_element_block(id_,
                                               temporary_element_block_id,
                                               duplicate_nodes=False)
                  self._delete_elements(temporary_element_block_id,
                                        indices_to_keep)
                  if temporary_element_block_id != new_element_block_id:
                      if self.element_block_exists(new_element_block_id):
                          self.combine_element_blocks(
                              [temporary_element_block_id, new_element_block_id],
                              new_element_block_id)
                      else:
                          self.rename_element_block(temporary_element_block_id,
                                                    new_element_block_id)
              # delete elements which don't meet the threshold
              indices_to_delete = [i for i, x in enumerate(values) if not x]
              self._delete_elements(id_, indices_to_delete)
          # delete the temporary element field
          self.delete_element_field(name, element_block_ids=element_block_ids)
          if new_element_block_id is not None:
              self.delete_element_field(name,
                                        element_block_ids=new_element_block_id)
function_tokens: def threshold_element_blocks ( self , expression , element_block_ids = 'all' , timestep = 'last' , new_element_block_id = None ) : element_block_ids = self . _format_element_block_id_list ( element_block_ids ) [ timestep ] = self . _format_id_list ( [ timestep ] , self . get_timesteps ( ) , 'timestep' , single = True ) if new_element_block_id is not None : if self . element_block_exists ( new_element_block_id ) : self . _exists_error ( new_element_block_id , 'element block' ) # create a temporary field name on these elements name = self . _new_element_field_name ( ) # evaluate the expression self . calculate_element_field ( '%s = %s' % ( name , expression ) , element_block_ids = element_block_ids ) # go through each element block and delete elements for id_ in element_block_ids : values = self . get_element_field_values ( name , element_block_id = id_ , timestep = timestep ) # if we're saving elements, duplicate the block, and delete the # ones we're keeping if new_element_block_id is not None : indices_to_keep = [ i for i , x in enumerate ( values ) if x ] temporary_element_block_id = self . _new_element_block_id ( ) self . duplicate_element_block ( id_ , temporary_element_block_id , duplicate_nodes = False ) self . _delete_elements ( temporary_element_block_id , indices_to_keep ) if temporary_element_block_id != new_element_block_id : if self . element_block_exists ( new_element_block_id ) : self . combine_element_blocks ( [ temporary_element_block_id , new_element_block_id ] , new_element_block_id ) else : self . rename_element_block ( temporary_element_block_id , new_element_block_id ) # delete elements which don't meet the threshold indices_to_delete = [ i for i , x in enumerate ( values ) if not x ] self . _delete_elements ( id_ , indices_to_delete ) # delete the temporary element field self . delete_element_field ( name , element_block_ids = element_block_ids ) if new_element_block_id is not None : self . delete_element_field ( name , element_block_ids = new_element_block_id )