topology.js
function incidence(from_cells, to_cells) {
  var index = new Array(from_cells.length)
  for(var i=0, il=index.length; i<il; ++i) {
    index[i] = []
  }
  var b = []
  for(var i=0, n=to_cells.length; i<n; ++i) {
    var c = to_cells[i]
    var cl = c.length
    for(var k=1, kn=(1<<cl); k<kn; ++k) {
      b.length = bits.popCount(k)
      var l = 0
      for(var j=0; j<cl; ++j) {
        if(k & (1<<j)) {
          b[l++] = c[j]
        }
      }
      var idx=findCell(from_cells, b)
      if(idx < 0) {
        continue
      }
      while(true) {
        index[idx++].push(i)
        if(idx >= from_cells.length || compareCells(from_cells[idx], b) !== 0) {
          break
        }
      }
    }
  }
  return index
}
function incidence(from_cells, to_cells) {
  var index = new Array(from_cells.length)
  for(var i=0, il=index.length; i<il; ++i) {
    index[i] = []
  }
  var b = []
  for(var i=0, n=to_cells.length; i<n; ++i) {
    var c = to_cells[i]
    var cl = c.length
    for(var k=1, kn=(1<<cl); k<kn; ++k) {
      b.length = bits.popCount(k)
      var l = 0
      for(var j=0; j<cl; ++j) {
        if(k & (1<<j)) {
          b[l++] = c[j]
        }
      }
      var idx=findCell(from_cells, b)
      if(idx < 0) {
        continue
      }
      while(true) {
        index[idx++].push(i)
        if(idx >= from_cells.length || compareCells(from_cells[idx], b) !== 0) {
          break
        }
      }
    }
  }
  return index
}
function incidence ( from_cells , to_cells ) { var index = new Array ( from_cells . length ) for ( var i = 0 , il = index . length ; i < il ; ++ i ) { index [ i ] = [ ] } var b = [ ] for ( var i = 0 , n = to_cells . length ; i < n ; ++ i ) { var c = to_cells [ i ] var cl = c . length for ( var k = 1 , kn = ( 1 << cl ) ; k < kn ; ++ k ) { b . length = bits . popCount ( k ) var l = 0 for ( var j = 0 ; j < cl ; ++ j ) { if ( k & ( 1 << j ) ) { b [ l ++ ] = c [ j ] } } var idx = findCell ( from_cells , b ) if ( idx < 0 ) { continue } while ( true ) { index [ idx ++ ] . push ( i ) if ( idx >= from_cells . length || compareCells ( from_cells [ idx ] , b ) !== 0 ) { break } } } } return index }
Builds an index for an n-cell.  This is more general than dual, but less efficient
Builds an index for an n - cell . This is more general than dual but less efficient