pub fn to_polytope(&self, poly: &Abstract) -> Abstract {
        // TODO: use an AbstractBuilder instead, probably.
        let rank = self.rank();
        let mut abs = Ranks::with_rank_capacity(poly.rank());

        // For every rank stored in the element map.
        for r in 0..=rank {
            let hash = &self.0[r];
            let mut elements: ElementList =
                iter::repeat(Element::default()).take(hash.len()).collect();

            // For every element of rank r in the hash element list.
            for (&idx, &new_idx) in hash {
                // We take the corresponding element in the original polytope
                // and use the hash map to get its sub and superelements in the
                // new polytope.
                let el = &poly[(r, idx)];

                // Gets the subelements.
                let mut subs = Subelements::new();
                if r >= 1 {
                    if let Some(prev_hash) = self.get(r - 1) {
                        for sub in &el.subs {
                            if let Some(&new_sub) = prev_hash.get(sub) {
                                subs.push(new_sub);
                            }
                        }
                    }
                }

                // Gets the superelements. (do I really need to do this?)
                let mut sups = Superelements::new();
                if let Some(next_hash) = self.get(r + 1) {
                    for sup in &el.sups {
                        if let Some(&new_sup) = next_hash.get(sup) {
                            sups.push(new_sup);
                        }
                    }
                }

                elements[new_idx] = Element { subs, sups };
            }

            abs.push(elements);
        }

        // Safety: TODO document
        unsafe { Abstract::from_ranks(abs) }
    }
/// Gets the indices of the vertices of a given element in a polytope.
Gets the indices of the vertices of a given element in a polytope.
Gets the indices of the vertices of a given element in a polytope .
pub fn to_polytope(&self, poly: &Abstract) -> Abstract {
        // TODO: use an AbstractBuilder instead, probably.
        let rank = self.rank();
        let mut abs = Ranks::with_rank_capacity(poly.rank());
        // For every rank stored in the element map.
        for r in 0..=rank {
            let hash = &self.0[r];
            let mut elements: ElementList =
                iter::repeat(Element::default()).take(hash.len()).collect();
            // For every element of rank r in the hash element list.
            for (&idx, &new_idx) in hash {
                // We take the corresponding element in the original polytope
                // and use the hash map to get its sub and superelements in the
                // new polytope.
                let el = &poly[(r, idx)];
                // Gets the subelements.
                let mut subs = Subelements::new();
                if r >= 1 {
                    if let Some(prev_hash) = self.get(r - 1) {
                        for sub in &el.subs {
                            if let Some(&new_sub) = prev_hash.get(sub) {
                                subs.push(new_sub);
                            }
                        }
                    }
                }
                // Gets the superelements. (do I really need to do this?)
                let mut sups = Superelements::new();
                if let Some(next_hash) = self.get(r + 1) {
                    for sup in &el.sups {
                        if let Some(&new_sup) = next_hash.get(sup) {
                            sups.push(new_sup);
                        }
                    }
                }
                elements[new_idx] = Element { subs, sups };
            }
            abs.push(elements);
        }
        // Safety: TODO document
        unsafe { Abstract::from_ranks(abs) }
    }
pub fn to_polytope ( & self , poly : & Abstract ) -> Abstract { // TODO: use an AbstractBuilder instead, probably. let rank = self . rank ( ) ; let mut abs = Ranks :: with_rank_capacity ( poly . rank ( ) ) ; // For every rank stored in the element map. for r in 0 ..= rank { let hash = & self . 0 [ r ] ; let mut elements : ElementList = iter :: repeat ( Element :: default ( ) ) . take ( hash . len ( ) ) . collect ( ) ; // For every element of rank r in the hash element list. for ( & idx , & new_idx ) in hash { // We take the corresponding element in the original polytope // and use the hash map to get its sub and superelements in the // new polytope. let el = & poly [ ( r , idx ) ] ; // Gets the subelements. let mut subs = Subelements :: new ( ) ; if r >= 1 { if let Some ( prev_hash ) = self . get ( r - 1 ) { for sub in & el . subs { if let Some ( & new_sub ) = prev_hash . get ( sub ) { subs . push ( new_sub ) ; } } } } // Gets the superelements. (do I really need to do this?) let mut sups = Superelements :: new ( ) ; if let Some ( next_hash ) = self . get ( r + 1 ) { for sup in & el . sups { if let Some ( & new_sup ) = next_hash . get ( sup ) { sups . push ( new_sup ) ; } } } elements [ new_idx ] = Element { subs , sups } ; } abs . push ( elements ) ; } // Safety: TODO document unsafe { Abstract :: from_ranks ( abs ) } }
Gets the indices of the vertices of a given element in a polytope.
Gets the indices of the vertices of a given element in a polytope .
&self
poly
&Abstract
&self
poly
&Abstract