To receive notifications about scheduled maintenance, please subscribe to the mailing-list gitlab-operations@sympa.ethz.ch. You can subscribe to the mailing-list at https://sympa.ethz.ch

Commit 57237612 authored by sfritschi's avatar sfritschi
Browse files

Minor refactoring

parent ff3f75ed
......@@ -20,7 +20,7 @@ def main():
print("Min. number of throats per pore: %d" % min(pore_throat_counts))
print("Avg. number of throats per pore: %f" % (sum(pore_throat_counts) / len(pore_throat_counts)))
target = [5, 5, 5]
target = [2, 2, 2]
print("Target size: {}".format(target))
cutoff = 0.5 * max([basenet.ub[i] - basenet.lb[i] \
for i in range(len(basenet.ub))])
......@@ -31,10 +31,12 @@ def main():
end = perf_counter()
elapsed = end - start
print("Elapsed time: %e s" % elapsed)
"""
_ = netgen.plot_network(dendro)
plt.savefig('plots/dendro.png')
"""
print("Generated network statistics:")
print("Throats: %d" % len(dendro.throats))
print("Pores: %d" % len(dendro.pores))
......
gen/plots/dendro.png

131 KB | W: | H:

gen/plots/dendro.png

134 KB | W: | H:

gen/plots/dendro.png
gen/plots/dendro.png
gen/plots/dendro.png
gen/plots/dendro.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -128,7 +128,7 @@ class CellList:
# Offset in pore-throat table for given pore index
self.throatOffsets = [0] # size: #pores + 1 (non-periodic)
offset = 0
# Pore-throat table
# Used to keep track of realized throats
self.poreThroatIndices = [set() for _ in range(nInterior)]
L = [ub-lb for lb,ub in zip(basenet.lb,basenet.ub)]
......@@ -778,6 +778,7 @@ def generate_dendrogram(basenet: Network, targetsize: List[int], \
# Initialize cell-list; Place each pore in respective cell-set
cellList = CellList(pores, trueDomainSize, basenet.Lmax, basenet, n)
# Evenly distribute pores among threads
remainder = n % nthreads
loads = [n // nthreads] * nthreads
for i in range(remainder):
......@@ -820,7 +821,6 @@ def generate_dendrogram(basenet: Network, targetsize: List[int], \
matches = cellList.fetch_throats(poreIdx)
throatIndices = cellList.fetch_throat_indices(poreIdx)
# TODO: Remove throats from both pore.throats and nbor.throats
for i, match in enumerate(matches):
throatIdx = throatIndices[i]
......@@ -878,7 +878,10 @@ def generate_dendrogram(basenet: Network, targetsize: List[int], \
for cpore in copies[pore]:
cellList.expel(cpore)
# Free space
del cellList.poreThroatTable
# Finally, find next best candidates for left-out pores
if (not mute): print("finding next best candidates")
......@@ -894,6 +897,7 @@ def generate_dendrogram(basenet: Network, targetsize: List[int], \
candidates = cellList.find_candidates(poreIdx)
for throatIdx in ttbr.copy():
r = cellList.throatR[throatIdx]
targetLen = cellList.throatL[throatIdx]
if (len(candidates) == 0):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment