# File structures/CellComplex.rb, line 249
  def delete cell

    ## recursively delete cells which contain the cell in their
    ## boundary
    upper = @upper[cell].clone
    upper.each do |upCell| delete upCell end
   
    ## update the incidence and switch structures for the
    ## lower dimensional cells
    @lower[cell].each do |lowCell|

      ## delete triples for lowCell and it's switch if applicable
      @lower[lowCell].each do |lowestCell|
        otherCell = @switchH[[lowestCell,lowCell,cell]]
        if (otherCell != nil)
          @switchH[[lowestCell,lowCell,cell]] = nil
          @switchH[[lowestCell,otherCell,cell]] = nil
        end
      end

      ## if cell is of highest dimension then delete triples
      ## that have the d+1 cell
      if (cell.dim == @dim) 
        otherCell = @switchH[[lowCell, cell, nil]]
        if otherCell != nil
          @switchH[[lowCell, cell, nil]] = nil
          @switchH[[lowCell, otherCell, nil]] = nil
        end
      end

      @upper[lowCell].delete(cell)
    end
    
    @cells[cell.dim].delete(cell)
    @lower[cell] = nil
    @upper[cell] = nil
    @inverted[cell] = nil
  end