Skip to content

Commit

Permalink
half memory usage
Browse files Browse the repository at this point in the history
  • Loading branch information
H-A-M-G-E-R committed Nov 23, 2023
1 parent 8e7db4d commit ecb19e1
Showing 1 changed file with 9 additions and 15 deletions.
24 changes: 9 additions & 15 deletions miratope-core/src/conc/faceting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -892,15 +892,13 @@ fn faceting_subdim(

for r in 2..rank-1 { // edges and up
let mut subs_to_idx = HashMap::new();
let mut idx_to_subs = Vec::new();
let mut idx = 0;

for facet in &facet_vec {
let els = &facet[r];
for el in els {
if subs_to_idx.get(&el.subs).is_none() {
subs_to_idx.insert(el.subs.clone(), idx);
idx_to_subs.push(el.subs.clone());
idx += 1;
}
}
Expand All @@ -918,22 +916,20 @@ fn faceting_subdim(
facet_vec[i][r+1] = new_list;
}

let mut new_rank = ElementList::new();
for el in idx_to_subs {
new_rank.push(Element::new(el, vec![].into()));
let mut new_rank = ElementList(vec![Element::new(vec![].into(), vec![].into()); subs_to_idx.len()]);
for el in subs_to_idx {
new_rank[el.1] = Element::new(el.0, vec![].into());
}
ranks.push(new_rank);

if uniform {
let mut subs_to_idx = HashMap::new();
let mut idx_to_subs = Vec::new();
let mut idx = 0;
for facet in &facet_vec2 {
let els = &facet[r];
for el in els {
if subs_to_idx.get(&el.subs).is_none() {
subs_to_idx.insert(el.subs.clone(), idx);
idx_to_subs.push(el.subs.clone());
idx += 1;
}
}
Expand All @@ -951,9 +947,9 @@ fn faceting_subdim(
facet_vec2[i][r+1] = new_list;
}

let mut new_rank = ElementList::new();
for el in idx_to_subs {
new_rank.push(Element::new(el, vec![].into()));
let mut new_rank = ElementList(vec![Element::new(vec![].into(), vec![].into()); subs_to_idx.len()]);
for el in subs_to_idx {
new_rank[el.1] = Element::new(el.0, vec![].into());
}
ranks2.push(new_rank);
}
Expand Down Expand Up @@ -2075,15 +2071,13 @@ impl Concrete {

for r in 2..rank-1 { // edges and up
let mut subs_to_idx = HashMap::new();
let mut idx_to_subs = Vec::new();
let mut idx = 0;

for facet in &facet_vec {
let els = &facet[r];
for el in els {
if subs_to_idx.get(&el.subs).is_none() {
subs_to_idx.insert(el.subs.clone(), idx);
idx_to_subs.push(el.subs.clone());
idx += 1;
}
}
Expand All @@ -2100,9 +2094,9 @@ impl Concrete {
}
facet_vec[i][r+1] = new_list;
}
let mut new_rank = ElementList::new();
for el in idx_to_subs {
new_rank.push(Element::new(el, vec![].into()));
let mut new_rank = ElementList(vec![Element::new(vec![].into(), vec![].into()); subs_to_idx.len()]);
for el in subs_to_idx {
new_rank[el.1] = Element::new(el.0, vec![].into());
}
ranks.push(new_rank);
}
Expand Down

0 comments on commit ecb19e1

Please sign in to comment.